aboutsummaryrefslogtreecommitdiff
path: root/src/share/classes/com/sun/tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/classes/com/sun/tools')
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/Arguments.java325
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/AttributeEntry.java105
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/AttributeGen.java46
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/Comment.java208
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/Compile.java520
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ConstEntry.java112
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ConstGen.java46
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/DefaultSymtabFactory.java257
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/EnumEntry.java108
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/EnumGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ExceptionEntry.java91
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ExceptionGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/Factories.java108
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ForwardEntry.java142
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ForwardGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ForwardValueEntry.java90
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ForwardValueGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/GenFactory.java86
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/GenFileStream.java97
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/Generator.java42
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/IDLID.java134
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/IncludeEntry.java125
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/IncludeGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/InterfaceEntry.java355
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/InterfaceGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/InterfaceState.java61
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/InterfaceType.java65
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/InvalidArgument.java62
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/InvalidCharacter.java65
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/MethodEntry.java197
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/MethodGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ModuleEntry.java113
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ModuleGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/NativeEntry.java84
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/NativeGen.java36
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/NoPragma.java50
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/Noop.java241
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ParameterEntry.java114
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ParameterGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ParseException.java456
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/Parser.java3905
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/PragmaEntry.java103
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/PragmaGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/PragmaHandler.java148
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/Preprocessor.java1431
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/PrimitiveEntry.java92
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/PrimitiveGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/RepositoryID.java80
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ResourceBundleUtil.java107
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/Scanner.java1615
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/SequenceEntry.java141
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/SequenceGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/StringEntry.java118
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/StringGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/StructEntry.java143
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/StructGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/SymtabEntry.java375
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/SymtabFactory.java117
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/Token.java689
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/TokenBuffer.java91
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/TypedefEntry.java123
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/TypedefGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/UnionBranch.java83
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/UnionEntry.java191
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/UnionGen.java48
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/Util.java379
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ValueBoxEntry.java88
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ValueBoxGen.java47
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ValueEntry.java414
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ValueGen.java46
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ValueRepositoryId.java131
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/And.java78
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/BinaryExpr.java64
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanAnd.java95
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanNot.java79
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanOr.java94
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/DefaultExprFactory.java191
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/Divide.java132
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/Equal.java79
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/EvaluationException.java46
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/ExprFactory.java75
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/Expression.java258
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterEqual.java79
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterThan.java79
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/LessEqual.java79
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/LessThan.java79
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/Minus.java82
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/Modulo.java78
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/Negative.java73
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/Not.java88
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/NotEqual.java80
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/Or.java78
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/Plus.java82
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/Positive.java73
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftLeft.java88
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftRight.java88
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/Terminal.java122
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/Times.java82
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/UnaryExpr.java59
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/constExpr/Xor.java81
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/first.set233
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/follow.set233
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/grammar.idl422
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/grammar3.idl539
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/idl.prp195
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp177
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp177
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/ir.idl778
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/keywords81
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/orb.idl47
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/som/cff/FileLocator.java411
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/som/cff/Messages.java356
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/som/idlemit/MetaPragma.java259
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Arguments.java342
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen.java195
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen24.java104
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AuxGen.java46
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Compile.java430
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ConstGen.java197
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/DefaultFactory.java200
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/EnumGen.java279
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ExceptionGen.java65
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Factories.java141
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ForwardValueGen.java206
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/GenFactory.java162
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper.java699
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper24.java158
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Holder.java255
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/InterfaceGen.java862
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/JavaGenerator.java68
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen.java1091
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen24.java258
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGenClone24.java107
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ModuleGen.java78
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifier.java32
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifierImpl.java119
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NativeGen.java65
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/PrimitiveGen.java139
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/SequenceGen.java271
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Skeleton.java568
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StringGen.java139
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StructGen.java455
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Stub.java380
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TCOffsets.java145
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TypedefGen.java326
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java1074
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Util.java1429
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen.java349
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen24.java163
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueFactory.java173
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen.java767
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen24.java416
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp111
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp69
-rw-r--r--src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp68
-rw-r--r--src/share/classes/com/sun/tools/corba/se/logutil/IndentingPrintWriter.java123
-rw-r--r--src/share/classes/com/sun/tools/corba/se/logutil/Input.java211
-rw-r--r--src/share/classes/com/sun/tools/corba/se/logutil/InputCode.java116
-rw-r--r--src/share/classes/com/sun/tools/corba/se/logutil/InputException.java93
-rw-r--r--src/share/classes/com/sun/tools/corba/se/logutil/MC.java559
-rw-r--r--src/share/classes/com/sun/tools/corba/se/logutil/Makefile93
-rw-r--r--src/share/classes/com/sun/tools/corba/se/logutil/StringUtil.java62
162 files changed, 0 insertions, 36993 deletions
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/Arguments.java b/src/share/classes/com/sun/tools/corba/se/idl/Arguments.java
deleted file mode 100644
index 90185ae..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/Arguments.java
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-// -F46082.51<daz> Remove -stateful option. "Stateful interfaces" obsolete.
-// -D58319<daz> Add -version option. Note that this may occur as the last
-// argument on the command-line.
-// -F60858.1<daz> Add -corba [level] option. Accept IDL upto this level, and
-// behave in a "proprietary manner" otherwise.
-// -D62023<daz> Add -noWarn option to supress warnings.
-
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.util.Hashtable;
-import java.util.Properties;
-import java.util.Vector;
-import java.util.StringTokenizer;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Field;
-
-import com.sun.tools.corba.se.idl.som.cff.FileLocator;
-
-/**
- * This class is responsible for parsing the command line arguments to the
- * compiler. To add new arguments to the compiler, this class must be extended
- * and the parseOtherArgs method overridden.
- **/
-public class Arguments
-{
- /**
- * Method parseOtherArgs() is called when the framework detects arguments
- * which are unknown to it. The default implementation of this method simply
- * throws an InvalidArgument exception. Any overriding implementation
- * must check the arguments passed to it for validity and process the
- * arguments appropriately. If it detects an invalid argument, it should
- * throw an InvalidArgument exception. Arguments MUST be of the form
- * `/<arg> [<qualifiers>]' or `-<arg> [<qualifiers>]' where <qualifiers>
- * is optional (for example, -iC:\includes, `C:\includes' is the qualifier
- * for the argument `i').
- * @param args The arguments which are unknown by the framework.
- * @param properties Environment-style properties collected from the
- * file idl.config.
- * @exception idl.InvalidArgument if the argument is unknown.
- **/
- protected void parseOtherArgs (String[] args, Properties properties) throws InvalidArgument
- {
- if (args.length > 0)
- throw new InvalidArgument (args[0]);
- } // parseOtherArgs
-
-
- protected void setDebugFlags( String args )
- {
- StringTokenizer st = new StringTokenizer( args, "," ) ;
- while (st.hasMoreTokens()) {
- String token = st.nextToken() ;
-
- // If there is a public boolean data member in this class
- // named token + "DebugFlag", set it to true.
- try {
- Field fld = this.getClass().getField( token + "DebugFlag" ) ;
- int mod = fld.getModifiers() ;
- if (Modifier.isPublic( mod ) && !Modifier.isStatic( mod ))
- if (fld.getType() == boolean.class)
- fld.setBoolean( this, true ) ;
- } catch (Exception exc) {
- // ignore it
- }
- }
- }
-
- /**
- * Collect the command-line parameters.
- **/
- void parseArgs (String[] args) throws InvalidArgument {
- Vector unknownArgs = new Vector ();
- int i = 0;
-
- try {
- // Process command line parameters
- for (i = 0; i < args.length - 1; ++i) {
- String lcArg = args[i].toLowerCase ();
- if (lcArg.charAt (0) != '-' && lcArg.charAt (0) != '/')
- throw new InvalidArgument (args[i]);
- if (lcArg.charAt (0) == '-' ) {
- lcArg = lcArg.substring (1);
- }
-
- // Include path
- if (lcArg.equals ("i")) {
- includePaths.addElement (args[++i]);
- } else if (lcArg.startsWith ("i")) {
- includePaths.addElement (args[i].substring (2));
- } else if (lcArg.equals ("v") || lcArg.equals ("verbose")) {
- // Verbose mode
- verbose = true;
- } else if (lcArg.equals ("d")) {
- // Define symbol
- definedSymbols.put (args[++i], "");
- } else if (lcArg.equals( "debug" )) {
- // Turn on debug flags
- setDebugFlags( args[++i] ) ;
- } else if (lcArg.startsWith ("d")) {
- definedSymbols.put (args[i].substring (2), "");
- } else if (lcArg.equals ("emitall")) {
- // Emit bindings for included sources
- emitAll = true;
- } else if (lcArg.equals ("keep")) {
- // Keep old files
- keepOldFiles = true;
- } else if (lcArg.equals ("nowarn")) {
- // <d62023> Suppress warnings
- noWarn = true;
- } else if (lcArg.equals ("trace")) {
- // Allow tracing.
- Runtime.getRuntime ().traceMethodCalls (true);
- }
- // <f46082.51> Remove -stateful feature.
- //else if (lcArg.equals ("stateful"))
- //{
- // Emit stateful bindings.
- // parseStateful = true;
- //}
- // CPPModule
- else if ( lcArg.equals ("cppmodule")) {
- cppModule = true;
- } else if (lcArg.equals ("version")) {
- // Version
- versionRequest = true;
- } else if (lcArg.equals ("corba")) {
- // CORBA level
- if (i + 1 >= args.length)
- throw new InvalidArgument (args[i]);
- String level = args[++i];
- if (level.charAt (0) == '-')
- throw new InvalidArgument (args[i - 1]);
- try {
- corbaLevel = new Float (level).floatValue ();
- } catch (NumberFormatException e) {
- throw new InvalidArgument (args[i]);
- }
- } else {
- unknownArgs.addElement (args[i]);
- ++i;
- while (i < (args.length - 1) &&
- args[i].charAt (0) != '-' &&
- args[i].charAt (0) != '/') {
- unknownArgs.addElement (args[i++]);
- }
- --i;
- }
- }
- } catch (ArrayIndexOutOfBoundsException e) {
- // If there is any array indexing problem, it is probably
- // because the qualifier on the last argument is missing.
- // Report that this last argument is invalid.
- throw new InvalidArgument (args[args.length - 1]);
- }
-
- // <d57319>
- // The last argument is the file argument or "-version", which may
- // be specified without a file argument.
- if (i == args.length - 1) {
- if (args[i].toLowerCase ().equals ("-version"))
- versionRequest = true;
- else
- file = args[i];
- } else
- throw new InvalidArgument ();
-
- // Get and process the idl.config file.
- Properties props = new Properties ();
- try {
- DataInputStream stream = FileLocator.locateFileInClassPath ("idl.config");
- props.load (stream);
- addIncludePaths (props);
- } catch (IOException e) {
- }
-
- // Call parseOtherArgs. By default, if there are unknown args,
- // InvalidArgument is called. A call to parseOtherArgs is useful
- // only when this framework has been extended.
- String[] otherArgs;
- if (unknownArgs.size () > 0) {
- otherArgs = new String[unknownArgs.size ()];
- unknownArgs.copyInto (otherArgs);
- } else
- otherArgs = new String[0];
-
- parseOtherArgs (otherArgs, props);
- } // parseArgs
-
- /**
- *
- **/
- private void addIncludePaths (Properties props)
- {
- String paths = props.getProperty ("includes");
- if (paths != null)
- {
- String separator = System.getProperty ("path.separator");
- int end = -separator.length (); // so the first pass paths == original paths
- do
- {
- paths = paths.substring (end + separator.length ());
- end = paths.indexOf (separator);
- if (end < 0)
- end = paths.length ();
- includePaths.addElement (paths.substring (0, end));
- }
- while (end != paths.length ());
- }
- } // addIncludePaths
-
- /**
- * The name of the IDL file.
- **/
- public String file = null;
-
- /**
- * True if the user wishes to see processing remarks.
- **/
- public boolean verbose = false;
-
- /**
- * If this is true, then existing files should not be overwritten
- * by the compiler.
- **/
- public boolean keepOldFiles = false;
-
- /**
- * If this is true, then the types in all included files are also emitted.
- **/
- public boolean emitAll = false;
-
- // <f46082.51> Remove -stateful feature.
- ///**
- // * If this is true, then stateful interfaces (for the Objects-by-Value
- // * proposal) are allowed. This is not yet a standard, so it must
- // * explicitly be called for by setting the -stateful argument to the
- // * compiler. If -stateful does not appear on the command line, then
- // * the IDL will be parsed according to the standards.
- // **/
- //public boolean parseStateful = false;
- /**
- * A list of strings, each of which is a path from which included files
- * are found.
- **/
- public Vector includePaths = new Vector ();
-
- /**
- * A table of defined symbols. The key is the symbol name; the value
- * (if any) is the replacement value for the symbol.
- **/
- public Hashtable definedSymbols = new Hashtable ();
-
- /**
- * <f46082.46.01> True if new module entries are created for each
- * re-opened module.
- **/
- public boolean cppModule = false;
-
- /**
- * -version option.
- **/
- public boolean versionRequest = false; // <D58319>
-
- // <f60858.1> Specify the maximal level of the CORBA spec. the parser
- // will support.
- //
- // NOTE: For BOSS 3.0, specify at 2.2. Raise to greater value in future
- // releases.
- /**
- * -corba [level] option, where [level] is a floating-point number indicating
- * the maximal level of CORBA IDL the parser framework can accept.
- **/
- public float corbaLevel = 2.2f;
- // <d62023>
- /**
- * -noWarn option. Suppress warnings when true.
- **/
- public boolean noWarn = false; // Issue warnings by default.
-
- // Currently defined debug flags. Any additions must be called xxxDebugFlag.
- // All debug flags must be public boolean types.
- // These are set by passing the flag -ORBDebug x,y,z in the ORB init args.
- // Note that x,y,z must not contain spaces.
- public boolean scannerDebugFlag = false ;
- public boolean tokenDebugFlag = false ;
-
-} // class Arguments
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/AttributeEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/AttributeEntry.java
deleted file mode 100644
index c2dab55..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/AttributeEntry.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-/**
- * This is the symbol table entry for attributes. An attribute is simply
- * two methods with no exceptions or contexts: a get method and, if not
- * readOnly, a set method.
- **/
-public class AttributeEntry extends MethodEntry
-{
- protected AttributeEntry ()
- {
- super ();
- } // ctor
-
- protected AttributeEntry (AttributeEntry that)
- {
- super (that);
- _readOnly = that._readOnly;
- } // ctor
-
- protected AttributeEntry (InterfaceEntry that, IDLID clone)
- {
- super (that, clone);
- } // ctor
-
- public Object clone ()
- {
- return new AttributeEntry (this);
- } // clone
-
- /** Invoke the attribute generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- attributeGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the attribute generator.
- @returns an object which implements the AttributeGen interface.
- @see AttributeGen */
- public Generator generator ()
- {
- return attributeGen;
- } // generator
-
- /** if true, only a get method will be generated. */
- public boolean readOnly ()
- {
- return _readOnly;
- } // readOnly
-
- /** if true, only a get method will be generated. */
- public void readOnly (boolean readOnly)
- {
- _readOnly = readOnly;
- } // readOnly
-
- static AttributeGen attributeGen;
-
- public boolean _readOnly = false;
-} // class AttributeEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/AttributeGen.java b/src/share/classes/com/sun/tools/corba/se/idl/AttributeGen.java
deleted file mode 100644
index a041779..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/AttributeGen.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-public interface AttributeGen extends Generator
-{
- void generate (Hashtable symbolTable, AttributeEntry entry, PrintWriter stream);
-} // interface AttributeGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/Comment.java b/src/share/classes/com/sun/tools/corba/se/idl/Comment.java
deleted file mode 100644
index 698d292..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/Comment.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.io.IOException;
-import java.util.StringTokenizer;
-
-public class Comment
-{
- // Styles
- static final int UNKNOWN = -1;
- static final int JAVA_DOC = 0;
- static final int C_BLOCK = 1;
- static final int CPP_LINE = 2;
-
- // System-dependent line separator
- private static String _eol = System.getProperty ("line.separator");
-
- private String _text = new String ("");
- private int _style = UNKNOWN;
-
- Comment () {_text = new String (""); _style = UNKNOWN;} // ctor
-
- Comment (String text) {_text = text; _style = style (_text);} // ctor
-
- /** Sets comment text */
- public void text (String string) {_text = string; _style = style (_text);}
-
- /** Returns comment text */
- public String text () {return _text;}
-
- /** Returns the comment style of a string. */
- private int style (String text)
- {
- if (text == null)
- return UNKNOWN;
- else if (text.startsWith ("/**") && text.endsWith ("*/"))
- return JAVA_DOC;
- else if (text.startsWith ("/*") && text.endsWith ("*/"))
- return C_BLOCK;
- else if (text.startsWith ("//"))
- return CPP_LINE;
- else
- return UNKNOWN;
- } // style
-
- /** Writes comment text to standard output (debug). */
- public void write () {System.out.println (_text);}
-
- /** Writes comment text to the specified print stream in the appropriate format. */
- public void generate (String indent, PrintWriter printStream)
- {
- if (_text == null || printStream == null)
- return;
- if (indent == null)
- indent = new String ("");
- switch (_style)
- {
- case JAVA_DOC:
- //printJavaDoc (indent, printStream);
- print (indent, printStream);
- break;
- case C_BLOCK:
- //printCBlock (indent, printStream);
- print (indent, printStream);
- break;
- case CPP_LINE:
- //printCppLine (indent, printStream);
- print (indent, printStream);
- break;
- default:
- break;
- }
- } // generate
-
- /** Writes comment to the specified print stream without altering its format.
- This routine does not alter vertical or horizontal spacing of comment text,
- thus, it only works well for comments with a non-indented first line. */
- private void print (String indent, PrintWriter stream)
- {
- String text = _text.trim () + _eol;
- String line = null;
-
- int iLineStart = 0;
- int iLineEnd = text.indexOf (_eol);
- int iTextEnd = text.length () - 1;
-
- stream.println ();
- while (iLineStart < iTextEnd)
- {
- line = text.substring (iLineStart, iLineEnd);
- stream.println (indent + line);
- iLineStart = iLineEnd + _eol.length ();
- iLineEnd = iLineStart + text.substring (iLineStart).indexOf (_eol);
- }
- } // print
-
- /*
- * The following routines print formatted comments of differing styles.
- * Each routine will alter the horizontal spacing of the comment text,
- * but not the vertical spacing.
- */
-
- /** Writes comment in JavaDoc-style to the specified print stream. */
- private void printJavaDoc (String indent, PrintWriter stream)
- {
- // Strip surrounding "/**", "*/", and whitespace; append sentinel
- String text = _text.substring (3, (_text.length () - 2)).trim () + _eol;
- String line = null;
-
- int iLineStart = 0;
- int iLineEnd = text.indexOf (_eol);
- int iTextEnd = text.length () - 1; // index of last text character
-
- stream.println (_eol + indent + "/**");
- while (iLineStart < iTextEnd)
- {
- line = text.substring (iLineStart, iLineEnd).trim ();
- if (line.startsWith ("*"))
- // Strip existing "*<ws>" prefix
- stream.println (indent + " * " + line.substring (1, line.length ()).trim ());
- else
- stream.println (indent + " * " + line);
- iLineStart = iLineEnd + _eol.length ();
- iLineEnd = iLineStart + text.substring (iLineStart).indexOf (_eol);
- }
- stream.println (indent + " */");
- } // printJavaDoc
-
- /** Writes comment in c-block-style to the specified print stream. */
- private void printCBlock (String indent, PrintWriter stream)
- {
- // Strip surrounding "/*", "*/", and whitespace; append sentinel
- String text = _text.substring (2, (_text.length () - 2)).trim () + _eol;
- String line = null;
-
- int iLineStart = 0;
- int iLineEnd = text.indexOf (_eol);
- int iTextEnd = text.length () - 1; // index of last text character
-
- stream.println (indent + "/*");
- while (iLineStart < iTextEnd)
- {
- line = text.substring (iLineStart, iLineEnd).trim ();
- if (line.startsWith ("*"))
- // Strip existing "*[ws]" prefix
- stream.println (indent + " * " + line.substring (1, line.length ()).trim ());
- else
- stream.println (indent + " * " + line);
- iLineStart = iLineEnd + _eol.length ();
- iLineEnd = iLineStart + text.substring (iLineStart).indexOf (_eol);
- }
- stream.println (indent + " */");
- } // printCBlock
-
- /** Writes a line comment to the specified print stream. */
- private void printCppLine (String indent, PrintWriter stream)
- {
- stream.println (indent + "//");
- // Strip "//[ws]" prefix
- stream.println (indent + "// " + _text.substring (2).trim ());
- stream.println (indent + "//");
- } // printCppLine
-} // class Comment
-
-
-/*==================================================================================
- DATE<AUTHOR> ACTION
- ----------------------------------------------------------------------------------
- 11aug1997<daz> Initial version completed.
- 18aug1997<daz> Modified generate to write comment unformatted.
- ==================================================================================*/
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/Compile.java b/src/share/classes/com/sun/tools/corba/se/idl/Compile.java
deleted file mode 100644
index b2668b2..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/Compile.java
+++ /dev/null
@@ -1,520 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-// -D56351<daz> Update computation of RepositoryIDs to CORBA 2.3 (see spec.).
-// -D58319<daz> Display version info. for -version option.
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.constExpr.ExprFactory;
-import com.sun.tools.corba.se.idl.constExpr.DefaultExprFactory;
-
-/**
- * Compiler usage:
- * <br><br>
- *
- * java com.sun.tools.corba.se.idl.toJava.compile [options] <idl file>
- * <br><br>
- *
- * where &lt;idl file&gt; is the name of a file containing IDL definitions,
- * and [options] is any combination of the options listed below. The options
- * and the idl file name can appear in any order.
- * <br><br>
- *
- * Options:
- * <dl>
- * <dt>-i &lt;include path&gt;
- * <dd>By default, the current directory is scanned for included files.
- * This option adds another directory. See also Note 1 below.
- *
- * <dt>-d &lt;symbol&gt;
- * <dd>This is equivalent to the following line in an IDL file: #define &lt;symbol&gt;
- *
- * <dt>-emitAll
- * <dd>Emit all types, including those found in #included files.
- *
- * <dt>-v
- * <dd>Verbose mode.
- * </dl>
- *
- * Note 1: If you have an include path or paths that you will always be using,
- * it can get tedious putting these on the command with the -i option all the
- * time. Instead, these can be placed into a config file called idl.config.
- * This file must be in the CLASSPATH. The format of the includes line is:
- *
- * <pre>
- * includes=<path1>;<path2>;...;<pathN>
- * </pre>
- *
- * Note that the path separator character, here shown as a semicolon, is
- * machine dependent. For instance, on Windows 95 this character is a
- * semicolon, on UNIX it is a colon.
- *
- * <p>
- * Note 2: If you are directly invoking the main method on this class (not
- * a subclass), then it will only check that the IDL file is syntactically
- * correct. It does not generate any files. Only extensions to this
- * framework generate files, therefore an extension must be invoked if you
- * want files to be generated.
- * <br><br>
- *
- * To Extend the compiler:
- * <br><br>
- *
- * You only need to extend the compiler if you want it to generate something
- * other than what it currently generates.
- * <br><br>
- *
- * Step 1 - Implement the generator interfaces:
- * <br><br>
- *
- * Each generator interface defines one method: generate (Hashtable, XXXEntry, PrintWriter);
- * <br>
- * - The Hashtable is the symbol table; each element is a SymtabEntry (or a
- * subclass of SymtabEntry) and is keyed by its fully qualified name;
- * <br>
- * - XXXEntry is the appropriate entry for the type to be generated. For
- * example: AttributeGen defines generate (Hashtable, AttributeEntry, PrintWriter);
- * ConstGen defines generate (Hashtable, ConstEntry, PrintWriter); etc.
- * <br>
- * - The PrintWriter is a stream to the file being generated. For the
- * generators called by the compiler framework, this will be null. The
- * generator is responsible for creating and opening files. But for
- * generators that are called by other generators - for instance,
- * MethodGen.generate will most likely be called by InterfaceGen.generate -
- * this parameter is provided so that the proper file can be written to.
- * <br><br>
- *
- * Step 2 - Implement the GenFactory interface:
- * <br><br>
- *
- * All of the generators implemented in Step 1 must be created somehow. There
- * is an interface for a factory, GenFactory, which must be implemented. The
- * name of this factory must be set in the extension to the Compile class (see
- * Step 3, below).
- * <br><br>
- *
- * Step 3 - Extend com.sun.tools.corba.se.idl.Factories:
- * <br><br>
- *
- * Extend com.sun.tools.corba.se.idl.Factories and override the method genFactory. This
- * method must return an instance of the factory which you implemented in
- * step 2. Your extension of this class may also do more, this is only the
- * minimum. See com.sun.tools.corba.se.idl.Factories for more information.
- * <br><br>
- *
- * Step 4 - Extend com.sun.tools.corba.se.idl.Compile:
- * <br><br>
- *
- * Your extension of com.sun.tools.corba.se.idl.Compile should contain a minimum of
- * two methods:
- * <dl>
- * <dt>protected com.sun.tools.corba.se.idl.Factories ()
- * <dd>This method overrides com.sun.tools.corba.se.idl.Compile.factories and returns your
- * extension from Step 3.
- *
- * <dt>public static void main (String[] args)
- * <dd>This main method must instantiate this class and call its start method.
- * </dl>
- *
- * Given that the extension of Factories is MyFactories, the extension of
- * Compile could be:
- *
- * <pre>
- * public class MyCompile extends com.sun.tools.corba.se.idl.Compile
- * {
- * protected com.sun.tools.corba.se.idl.Factories factories ()
- * {
- * return new MyFactories ();
- * }
- * public static void main (String[] args)
- * {
- * MyCompile compile = new MyCompile ();
- * compile.start (args);
- * }
- * }
- * </pre>
- *
- * If you would like a bit more control over the processing of the framework,
- * you can replace compile.start with what it calls. But then you also have
- * to handle the exceptions which start handles for you:
- * <pre>
- * public class MyCompile extends com.sun.tools.corba.se.idl.Compile
- * {
- * ...
- *
- * public static void main (String[] args)
- * {
- * MyCompile compile = new MyCompile ();
- * try
- * {
- * compile.init (args);
- * java.util.Enumeration emitList = compile.parse ();
- * compile.generate ();
- * }
- * catch (com.sun.tools.corba.se.idl.InvalidArgument e)
- * {
- * System.err.println (e);
- * }
- * catch (java.io.IOException e)
- * {
- * System.err.println (e);
- * }
- * }
- * }
- * </pre>
- *
- * Note that compile.parse returns an enumeration. This enumerates the
- * SymtabEntry's which should be generated. If the parse method detects
- * errors, it returns null. Note that you do not have to check that
- * `emitList' is valid before calling generate (that's done internally), but
- * if you do any processing between parse and generate, emitList should be
- * checked before executing that code.
- * <br><br>
- **/
-public class Compile
-{
- public Compile ()
- {
- noPragma.init (preprocessor);
- preprocessor.registerPragma (noPragma);
-
- // <d41197> Reset static variables to allow parsing multiple sources.
- // DO NOT reset SymtabEntry.maxKey because it crashes IDLC.
- ParseException.detected = false;
- SymtabEntry.includeStack = new java.util.Stack ();
- SymtabEntry.setEmit = true;
- //SymtabEntry.maxKey = -1;
- Parser.repIDStack = new java.util.Stack (); // <d56351>
- } // ctor
-
- public static void main (String[] args)
- {
- (new Compile ()).start (args);
- } // main
-
- protected Factories factories ()
- {
- return new Factories ();
- } // genFactoryName
-
- protected void registerPragma (PragmaHandler handler)
- {
- handler.init (preprocessor);
- preprocessor.registerPragma (handler);
- } // registerPragma
-
- /**
- * Initialize the framework.
- **/
- protected void init (String[] args) throws InvalidArgument
- {
- initFactories ();
- arguments.parseArgs (args);
- initGenerators ();
- parser = new Parser (preprocessor, arguments, overrideNames, symbolTable, symtabFactory, exprFactory, keywords);
- preprocessor.init (parser);
- parser.includes = includes;
- parser.includeEntries = includeEntries;
- } // init
-
- /**
- * Parse the IDL file and return an enumeration of the symbols to be
- * generated. All elements of the Enumeration will be extensions of
- * SymtabEntry. If any errors were encountered during parsing, null
- * will be returned.
- **/
- protected Enumeration parse () throws IOException
- {
- if (arguments.verbose)
- System.out.println (Util.getMessage ("Compile.parsing", arguments.file));
- parser.parse (arguments.file);
- if ( !ParseException.detected )
- {
- parser.forwardEntryCheck();
-
- // <46082.03> Revert to "IDL:"-style (i.e., regular) repository ID.
- //parser.updateRepositoryIds();
- }
- if (arguments.verbose)
- System.out.println (Util.getMessage ("Compile.parseDone", arguments.file));
- if (ParseException.detected)
- {
- symbolTable = null;
- emitList = null;
- }
- else
- {
- symbolTable = parser.symbolTable;
- emitList = parser.emitList.elements ();
- }
- return emitList;
- } // parse
-
- /**
- * Invoke the generators.
- **/
- protected void generate () throws IOException
- {
- /*
- // print the symbol table
- Enumeration v = parser.symbolTable.elements ();
- Enumeration k = parser.symbolTable.keys ();
- while (k.hasMoreElements ())
- System.out.println (k.nextElement () + ": " + v.nextElement ());
- */
- if (ParseException.detected)
- emitList = null;
- else
- emitList = parser.emitList.elements ();
- if (emitList != null)
- {
- // Emit the output files for all of the types in the IDL file
- if (arguments.verbose)
- System.out.println ();
- while (emitList.hasMoreElements ())
- {
- SymtabEntry entry = (SymtabEntry)emitList.nextElement ();
- if (arguments.verbose)
- if (entry.generator () instanceof Noop)
- ; // Nothing will be generated, so don't say so.
- else if (entry.module () . equals (""))
- System.out.println (Util.getMessage ("Compile.generating", entry.name ()));
- else
- System.out.println (Util.getMessage ("Compile.generating", entry.module () + '/' + entry.name ()));
- entry.generate (symbolTable, null);
- if (arguments.verbose)
- if (entry.generator () instanceof Noop)
- ; // Nothing will be generated, so don't say so.
- else if (entry.module () . equals (""))
- System.out.println (Util.getMessage ("Compile.genDone", entry.name ()));
- else
- System.out.println (Util.getMessage ("Compile.genDone", entry.module () + '/' + entry.name ()));
- }
- }
- } // generate
-
- /**
- * Start the parse/code generation process. This method calls init,
- * parse, generate. If more control is desired, rather than call start,
- * those three methods could be called explicitly.
- **/
- public void start (String[] args)
- {
- try
- {
- init (args);
- if (arguments.versionRequest) // <d59319>
- displayVersion ();
- else
- {
- parse ();
- generate ();
- }
- }
- catch (InvalidArgument e)
- {
- System.err.println (e);
- }
- catch (IOException e)
- {
- System.err.println (e);
- }
- } // start
-
- private void initFactories ()
- {
- // Get the factories.
- Factories factories = factories ();
- if (factories == null) factories = new Factories ();
-
- // Get the argument processor from the factories.
- Arguments tmpArgs = factories.arguments ();
- if (tmpArgs == null)
- arguments = new Arguments ();
- else
- arguments = tmpArgs;
-
- // Get the symbol table entry factory from the factories.
- SymtabFactory tmpSTF = factories.symtabFactory ();
- if (tmpSTF == null)
- symtabFactory = new DefaultSymtabFactory ();
- else
- symtabFactory = tmpSTF;
-
- // Get the expression factory from the factories.
- ExprFactory tmpExpF = factories.exprFactory ();
- if (tmpExpF == null)
- exprFactory = new DefaultExprFactory ();
- else
- exprFactory = tmpExpF;
-
- // Get the generator factory from the factories.
- GenFactory tmpGenF = factories.genFactory ();
- if (tmpGenF == null)
- genFactory = noop;
- else
- genFactory = tmpGenF;
-
- // Get the language keywords.
- keywords = factories.languageKeywords ();
- if (keywords == null)
- keywords = new String[0];
- } // initFactories
-
- private void initGenerators ()
- {
- AttributeGen agen = genFactory.createAttributeGen ();
- AttributeEntry.attributeGen = agen == null ? noop : agen;
-
- ConstGen cgen = genFactory.createConstGen ();
- ConstEntry.constGen = cgen == null ? noop : cgen;
-
- EnumGen egen = genFactory.createEnumGen ();
- EnumEntry.enumGen = egen == null ? noop : egen;
-
- ExceptionGen exgen = genFactory.createExceptionGen ();
- ExceptionEntry.exceptionGen = exgen == null ? noop : exgen;
-
- ForwardGen fgen = genFactory.createForwardGen ();
- ForwardEntry.forwardGen = fgen == null ? noop : fgen;
-
- ForwardValueGen fvgen = genFactory.createForwardValueGen ();
- ForwardValueEntry.forwardValueGen = fvgen == null ? noop : fvgen;
-
- IncludeGen ingen = genFactory.createIncludeGen ();
- IncludeEntry.includeGen = ingen == null ? noop : ingen;
-
- InterfaceGen igen = genFactory.createInterfaceGen ();
- InterfaceEntry.interfaceGen = igen == null ? noop : igen;
-
- ValueGen vgen = genFactory.createValueGen ();
- ValueEntry.valueGen = vgen == null ? noop : vgen;
-
- ValueBoxGen vbgen = genFactory.createValueBoxGen ();
- ValueBoxEntry.valueBoxGen = vbgen == null ? noop : vbgen;
-
- MethodGen mgen = genFactory.createMethodGen ();
- MethodEntry.methodGen = mgen == null ? noop : mgen;
-
- ModuleGen modgen = genFactory.createModuleGen ();
- ModuleEntry.moduleGen = modgen == null ? noop : modgen;
-
- NativeGen ngen = genFactory.createNativeGen ();
- NativeEntry.nativeGen = ngen == null ? noop : ngen;
-
- ParameterGen pgen = genFactory.createParameterGen ();
- ParameterEntry.parameterGen = pgen == null ? noop : pgen;
-
- PragmaGen prgen = genFactory.createPragmaGen ();
- PragmaEntry.pragmaGen = prgen == null ? noop : prgen;
-
- PrimitiveGen primgen = genFactory.createPrimitiveGen ();
- PrimitiveEntry.primitiveGen = primgen == null ? noop : primgen;
-
- SequenceGen seqgen = genFactory.createSequenceGen ();
- SequenceEntry.sequenceGen = seqgen == null ? noop : seqgen;
-
- StringGen strgen = genFactory.createStringGen ();
- StringEntry.stringGen = strgen == null ? noop : strgen;
-
- StructGen sgen = genFactory.createStructGen ();
- StructEntry.structGen = sgen == null ? noop : sgen;
-
- TypedefGen tgen = genFactory.createTypedefGen ();
- TypedefEntry.typedefGen = tgen == null ? noop : tgen;
-
- UnionGen ugen = genFactory.createUnionGen ();
- UnionEntry.unionGen = ugen == null ? noop : ugen;
- } // initGenerators
-
- /**
- * Write the version number of this compiler to standard out.
- **/
- protected void displayVersion ()
- {
- String message = Util.getMessage ("Version.product", Util.getMessage ("Version.number"));
- System.out.println (message);
- }
-
- /**
- * This is the repository of emitter arguments.
- **/
- public Arguments arguments = null;
- /**
- * This hashtable contains <real name, alias> pairs. It is filled in by
- * extenders in cases where they wish to override an IDL type name with
- * some other name. For instance, when mapping to Java, there could be
- * an overrideNames entry of <"TRUE", "true">. NOTE: Do NOT change this
- * variable to a new Hash table. Just add elements to it.
- **/
- protected Hashtable overrideNames = new Hashtable ();
- /**
- * This is the symbol table. It will be empty until the parse method
- * executes. If errors are encountered, the state of the symbol table
- * is undefined.
- **/
- protected Hashtable symbolTable = new Hashtable ();
- /**
- * This is a vector of strings of the form "IDLfile" or <IDLfile>. It is
- * a list of the files included in the given IDL file. It will be empty
- * until the parse method executes. If errors are encountered, the state
- * of this vector is undefined.
- **/
- protected Vector includes = new Vector ();
- /**
- * This is a vector of IncludeEntry's. It is a list of the files included
- * in the given IDL file. It mirrors the includes vector. It will be empty
- * until the parse method executes. If errors are encountered, the state of
- * this vector is undefined.
- **/
- protected Vector includeEntries = new Vector ();
- static Noop noop = new Noop ();
- private GenFactory genFactory = null;
- private SymtabFactory symtabFactory = null;
- private ExprFactory exprFactory = null;
- private Parser parser = null;
- Preprocessor preprocessor = new Preprocessor ();
- private NoPragma noPragma = new NoPragma ();
- private Enumeration emitList = null;
- private String[] keywords = null;
-} // class Compile
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ConstEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/ConstEntry.java
deleted file mode 100644
index bd5ab92..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ConstEntry.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.constExpr.Expression;
-
-/**
- * This is the symbol table entry for constants.
- **/
-public class ConstEntry extends SymtabEntry
-{
- protected ConstEntry ()
- {
- super ();
- } // ctor
-
- protected ConstEntry (ConstEntry that)
- {
- super (that);
- if (module ().equals (""))
- module (name ());
- else if (!name ().equals (""))
- module (module () + "/" + name ());
- _value = that._value;
- } // ctor
-
- /** This is a shallow copy constructor. */
- protected ConstEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
- if (module ().equals (""))
- module (name ());
- else if (!name ().equals (""))
- module (module () + "/" + name ());
- } // ctor
-
- /** This is a shallow copy clone. */
- public Object clone ()
- {
- return new ConstEntry (this);
- } // clone
-
- /** Invoke the constant generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- constGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the constant generator.
- @returns an object which implements the ConstGen interface.
- @see ConstGen */
- public Generator generator ()
- {
- return constGen;
- } // generator
-
- public Expression value ()
- {
- return _value;
- } // value
-
- public void value (Expression newValue)
- {
- _value = newValue;
- } // value
-
- static ConstGen constGen;
- private Expression _value = null;
-} // class ConstEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ConstGen.java b/src/share/classes/com/sun/tools/corba/se/idl/ConstGen.java
deleted file mode 100644
index 8dde99e..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ConstGen.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-public interface ConstGen extends Generator
-{
- void generate (Hashtable symbolTable, ConstEntry entry, PrintWriter stream);
-} // interface ConstGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/DefaultSymtabFactory.java b/src/share/classes/com/sun/tools/corba/se/idl/DefaultSymtabFactory.java
deleted file mode 100644
index f929d03..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/DefaultSymtabFactory.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-/**
- * This factory constructs the default symbol table entries, namely,
- * those declared within the package com.sun.tools.corba.se.idl.
- **/
-public class DefaultSymtabFactory implements SymtabFactory
-{
- public AttributeEntry attributeEntry ()
- {
- return new AttributeEntry ();
- } // attributeEntry
-
- public AttributeEntry attributeEntry (InterfaceEntry container, IDLID id)
- {
- return new AttributeEntry (container, id);
- } // attributeEntry
-
- public ConstEntry constEntry ()
- {
- return new ConstEntry ();
- } // constEntry
-
- public ConstEntry constEntry (SymtabEntry container, IDLID id)
- {
- return new ConstEntry (container, id);
- } // constEntry
-
- public NativeEntry nativeEntry ()
- {
- return new NativeEntry ();
- } // interfaceEntry
-
- public NativeEntry nativeEntry (SymtabEntry container, IDLID id)
- {
- return new NativeEntry (container, id);
- } // interfaceEntry
-
- public EnumEntry enumEntry ()
- {
- return new EnumEntry ();
- } // enumEntry
-
- public EnumEntry enumEntry (SymtabEntry container, IDLID id)
- {
- return new EnumEntry (container, id);
- } // enumEntry
-
- public ExceptionEntry exceptionEntry ()
- {
- return new ExceptionEntry ();
- } // exceptionEntry
-
- public ExceptionEntry exceptionEntry (SymtabEntry container, IDLID id)
- {
- return new ExceptionEntry (container, id);
- } // exceptionEntry
-
- public ForwardEntry forwardEntry ()
- {
- return new ForwardEntry ();
- } // forwardEntry
-
- public ForwardEntry forwardEntry (ModuleEntry container, IDLID id)
- {
- return new ForwardEntry (container, id);
- } // forwardEntry
-
- public ForwardValueEntry forwardValueEntry ()
- {
- return new ForwardValueEntry ();
- } // forwardValueEntry
-
- public ForwardValueEntry forwardValueEntry (ModuleEntry container, IDLID id)
- {
- return new ForwardValueEntry (container, id);
- } // forwardValueEntry
-
- public IncludeEntry includeEntry ()
- {
- return new IncludeEntry ();
- } // includeEntry
-
- public IncludeEntry includeEntry (SymtabEntry container)
- {
- return new IncludeEntry (container);
- } // includeEntry
-
- public InterfaceEntry interfaceEntry ()
- {
- return new InterfaceEntry ();
- } // interfaceEntry
-
- public InterfaceEntry interfaceEntry (ModuleEntry container, IDLID id)
- {
- return new InterfaceEntry (container, id);
- } // interfaceEntry
-
- public ValueEntry valueEntry ()
- {
- return new ValueEntry ();
- } // valueEntry
-
- public ValueEntry valueEntry (ModuleEntry container, IDLID id)
- {
- return new ValueEntry (container, id);
- } // valueEntry
-
- public ValueBoxEntry valueBoxEntry ()
- {
- return new ValueBoxEntry ();
- } // valueBoxEntry
-
- public ValueBoxEntry valueBoxEntry (ModuleEntry container, IDLID id)
- {
- return new ValueBoxEntry (container, id);
- } // valueBoxEntry
-
- public MethodEntry methodEntry ()
- {
- return new MethodEntry ();
- } // methodEntry
-
- public MethodEntry methodEntry (InterfaceEntry container, IDLID id)
- {
- return new MethodEntry (container, id);
- } // methodEntry
-
- public ModuleEntry moduleEntry ()
- {
- return new ModuleEntry ();
- } // moduleEntry
-
- public ModuleEntry moduleEntry (ModuleEntry container, IDLID id)
- {
- return new ModuleEntry (container, id);
- } // moduleEntry
-
- public ParameterEntry parameterEntry ()
- {
- return new ParameterEntry ();
- } // parameterEntry
-
- public ParameterEntry parameterEntry (MethodEntry container, IDLID id)
- {
- return new ParameterEntry (container, id);
- } // parameterEntry
-
- public PragmaEntry pragmaEntry ()
- {
- return new PragmaEntry ();
- } // pragmaEntry
-
- public PragmaEntry pragmaEntry (SymtabEntry container)
- {
- return new PragmaEntry (container);
- } // pragmaEntry
-
- public PrimitiveEntry primitiveEntry ()
- {
- return new PrimitiveEntry ();
- } // primitiveEntry
-
- /** "name" can be, but is not limited to, the primitive idl type names:
- 'char', 'octet', 'short', 'long', etc. The reason it is not limited
- to these is that, as an extender, you may wish to override these names.
- For instance, when generating Java code, octet translates to byte, so
- there is an entry in Compile.overrideNames: <"octet", "byte"> and a
- PrimitiveEntry in the symbol table for "byte". */
- public PrimitiveEntry primitiveEntry (String name)
- {
- return new PrimitiveEntry (name);
- } // primitiveEntry
-
- public SequenceEntry sequenceEntry ()
- {
- return new SequenceEntry ();
- } // sequenceEntry
-
- public SequenceEntry sequenceEntry (SymtabEntry container, IDLID id)
- {
- return new SequenceEntry (container, id);
- } // sequenceEntry
-
- public StringEntry stringEntry ()
- {
- return new StringEntry ();
- } // stringEntry
-
- public StructEntry structEntry ()
- {
- return new StructEntry ();
- } // structEntry
-
- public StructEntry structEntry (SymtabEntry container, IDLID id)
- {
- return new StructEntry (container, id);
- } // structEntry
-
- public TypedefEntry typedefEntry ()
- {
- return new TypedefEntry ();
- } // typedefEntry
-
- public TypedefEntry typedefEntry (SymtabEntry container, IDLID id)
- {
- return new TypedefEntry (container, id);
- } // typedefEntry
-
- public UnionEntry unionEntry ()
- {
- return new UnionEntry ();
- } // unionEntry
-
- public UnionEntry unionEntry (SymtabEntry container, IDLID id)
- {
- return new UnionEntry (container, id);
- } // unionEntry
-
-} // interface DefaultSymtabFactory
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/EnumEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/EnumEntry.java
deleted file mode 100644
index 098301c..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/EnumEntry.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * This is the symbol table entry for enumerated types.
- **/
-public class EnumEntry extends SymtabEntry
-{
- protected EnumEntry ()
- {
- super ();
- } // ctor
-
- protected EnumEntry (EnumEntry that)
- {
- super (that);
- _elements = (Vector)that._elements.clone ();
- } // ctor
-
- protected EnumEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
-
- if (module ().equals (""))
- module (name ());
- else if (!name ().equals (""))
- module (module () + "/" + name ());
- } // ctor
-
- public Object clone ()
- {
- return new EnumEntry (this);
- } // clone
-
- /** Invoke the enumerator generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- enumGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the enumerator generator.
- @returns an object which implements the EnumGen interface.
- @see EnumGen */
- public Generator generator ()
- {
- return enumGen;
- } // generator
-
- /** Add an element to the list of elements. */
- public void addElement (String element)
- {
- _elements.addElement (element);
- } // addElement
-
- /** Each element of the vector is a String. */
- public Vector elements ()
- {
- return _elements;
- } // elements
-
- static EnumGen enumGen;
- private Vector _elements = new Vector ();
-} // class EnumEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/EnumGen.java b/src/share/classes/com/sun/tools/corba/se/idl/EnumGen.java
deleted file mode 100644
index 7a05ea4..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/EnumGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface EnumGen extends Generator
-{
- void generate (Hashtable symbolTable, EnumEntry entry, PrintWriter stream);
-} // interface EnumGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ExceptionEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/ExceptionEntry.java
deleted file mode 100644
index c18902b..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ExceptionEntry.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * This is the symbol table entry for exceptions. An exception is simply
- * a struct by a different name.
- **/
-public class ExceptionEntry extends StructEntry
-{
- protected ExceptionEntry ()
- {
- super ();
- } // ctor
-
- protected ExceptionEntry (ExceptionEntry that)
- {
- super (that);
- } // ctor
-
- protected ExceptionEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
- } // ctor
-
- public Object clone ()
- {
- return new ExceptionEntry (this);
- } // clone
-
- /** Invoke the exception generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- exceptionGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the exception generator.
- @returns an object which implements the ExceptionGen interface.
- @see ExceptionGen */
- public Generator generator ()
- {
- return exceptionGen;
- } // generator
-
- static ExceptionGen exceptionGen;
-} // class ExceptionEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ExceptionGen.java b/src/share/classes/com/sun/tools/corba/se/idl/ExceptionGen.java
deleted file mode 100644
index 52cbea8..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ExceptionGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface ExceptionGen extends Generator
-{
- void generate (Hashtable symbolTable, ExceptionEntry entry, PrintWriter stream);
-} // interface ExceptionGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/Factories.java b/src/share/classes/com/sun/tools/corba/se/idl/Factories.java
deleted file mode 100644
index de17dfa..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/Factories.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-/**
- * If the framework is being extended, this class must be extended.
- * At very least, the genFactory method must be overridden to return
- * the code generator extensions. The remaining methods may be overridden
- * if necessary:
- * <dl>
- * <dt>symtabFactory
- * <dd>If you wish to extend the symbol table entries, this method must return the factory which constructs those extensions. If you only want to extend a few of the symbol table entries, it may be useful to extend com.sun.tools.corba.se.idl.DefaultSymtabFactory and only override the pertinent methods.
- * <dt>exprFactory
- * <dd>If you wish to extend the expression classes, this method must return the factory which constructs those extensions. If you only want to extend a few of the expression classes, it may be useful to extend com.sun.tools.corba.se.idl.constExpr.DefaultSymtabFactory and only override the pertinent methods.
- * <dt>arguments
- * <dd>If you wish to add additional arguments to the base set of arguments, extend com.sun.tools.corba.se.idl.Arguments and override this method to return that class.
- * <dt>languageKeywords
- * <dd>If the language you are generating code in has keywords other than IDL keywords, these keywords should be returned by this method. The framework will prepend any IDL identifiers it encounters which are in this list with an underscore (`_') to avoid compilation errors. For instance, `catch' is a Java keyword. If the generators are emitting Java code for the following IDL, emitting `catch' as is will cause compile errors, so it is changed to `_catch':
- * <br>
- * IDL:
- * <br>
- * const long catch = 22;
- * <br>
- * Possible generated code:
- * <br>
- * public static final int _catch = 22;
- * </dl>
- **/
-public class Factories
-{
- /** Return the implementation of the GenFactory interface. If this
- returns null, then the compiler cannot generate anything. */
- public GenFactory genFactory ()
- {
- return null;
- } // genFactory
-
- /** Return the implementation of the SymtabFactory interface. If this
- returns null, the default symbol table entries will be used. */
- public SymtabFactory symtabFactory ()
- {
- return new DefaultSymtabFactory ();
- } // symtabFactory
-
- /** Return the implementation of the ExprFactory interface. If this
- returns null, the default expressions will be used. */
- public com.sun.tools.corba.se.idl.constExpr.ExprFactory exprFactory ()
- {
- return new com.sun.tools.corba.se.idl.constExpr.DefaultExprFactory ();
- } // exprFactory
-
- /** Return a subclass of the Arguments class. If this returns null,
- the default will be used. */
- public Arguments arguments ()
- {
- return new Arguments ();
- } // arguments
-
- /** Return the list of keywords in the generated language.
- Note that these keywords may contain the following wildcards:
- <dl>
- <dt>`*'
- <dd>matches zero or more characters
- <dt>`+'
- <dd>matches one or more characters
- <dt>`.'
- <dd>matches any single character
- </dl> */
- public String[] languageKeywords ()
- {
- return null;
- } // languageKeywords
-} // interface Factories
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ForwardEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/ForwardEntry.java
deleted file mode 100644
index 83a634c..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ForwardEntry.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * This is the symbol table entry for forward declarations of interfaces.
- **/
-public class ForwardEntry extends SymtabEntry implements InterfaceType
-{
- protected ForwardEntry ()
- {
- super ();
- } // ctor
-
- protected ForwardEntry (ForwardEntry that)
- {
- super (that);
- } // ctor
-
- protected ForwardEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
- if (module ().equals (""))
- module (name ());
- else if (!name ().equals (""))
- module (module () + "/" + name ());
- } // ctor
-
- public Object clone ()
- {
- return new ForwardEntry (this);
- } // clone
-
- /** Invoke the forward declaration generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- forwardGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the interface generator.
- @returns an object which implements the InterfaceGen interface.
- @see InterfaceGen */
- public Generator generator ()
- {
- return forwardGen;
- } // generator
-
- static boolean replaceForwardDecl (InterfaceEntry interfaceEntry)
- {
- boolean result = true;
- try
- {
- ForwardEntry forwardEntry =
- (ForwardEntry)Parser.symbolTable.get (interfaceEntry.fullName ());
- if ( forwardEntry != null )
- {
- result = (interfaceEntry.getInterfaceType () ==
- forwardEntry.getInterfaceType ());
- forwardEntry.type (interfaceEntry);
-
- // If this interface has been forward declared, there are probably
- // other interfaces which derive from a ForwardEntry. Replace
- // those ForwardEntry's with this InterfaceEntry:
- interfaceEntry.forwardedDerivers = forwardEntry.derivers;
- for ( Enumeration derivers = forwardEntry.derivers.elements();
- derivers.hasMoreElements(); )
- ((InterfaceEntry)derivers.nextElement ()).replaceForwardDecl (forwardEntry, interfaceEntry);
-
- // Replace the entry's whose types are forward declarations:
- for ( Enumeration types = forwardEntry.types.elements ();
- types.hasMoreElements (); )
- ((SymtabEntry)types.nextElement ()).type (interfaceEntry);
- }
- }
- catch (Exception exception)
- {}
- return result;
- } // replaceForwardDecl
-
- ///////////////
- // Implement interface InterfaceType
-
- public int getInterfaceType ()
- {
- return _type;
- }
-
- public void setInterfaceType (int type)
- {
- _type = type;
- }
-
- static ForwardGen forwardGen;
- Vector derivers = new Vector (); // Vector of InterfaceEntry's.
- Vector types = new Vector (); // Vector of the entry's whose type is a forward declaration.
- private int _type = InterfaceType.NORMAL; // interface type
-} // class ForwardEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ForwardGen.java b/src/share/classes/com/sun/tools/corba/se/idl/ForwardGen.java
deleted file mode 100644
index c136a26..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ForwardGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface ForwardGen extends Generator
-{
- void generate (Hashtable symbolTable, ForwardEntry entry, PrintWriter stream);
-} // interface ForwardGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ForwardValueEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/ForwardValueEntry.java
deleted file mode 100644
index ce78430..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ForwardValueEntry.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * This is the symbol table entry for forward declarations of values.
- **/
-public class ForwardValueEntry extends ForwardEntry
-{
- protected ForwardValueEntry ()
- {
- super ();
- } // ctor
-
- protected ForwardValueEntry (ForwardValueEntry that)
- {
- super (that);
- } // ctor
-
- protected ForwardValueEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
- } // ctor
-
- public Object clone ()
- {
- return new ForwardValueEntry (this);
- } // clone
-
- /** Invoke the forward value declaration generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- forwardValueGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the interface generator.
- @returns an object which implements the ForwardValueGen interface.
- @see ValueGen */
- public Generator generator ()
- {
- return forwardValueGen;
- } // generator
-
- static ForwardValueGen forwardValueGen;
-} // class ForwardValueEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ForwardValueGen.java b/src/share/classes/com/sun/tools/corba/se/idl/ForwardValueGen.java
deleted file mode 100644
index d4f85a6..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ForwardValueGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface ForwardValueGen extends Generator
-{
- void generate (Hashtable symbolTable, ForwardValueEntry entry, PrintWriter stream);
-} // interface ForwardValueGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/GenFactory.java b/src/share/classes/com/sun/tools/corba/se/idl/GenFactory.java
deleted file mode 100644
index 315b1fe..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/GenFactory.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 1999, 2000, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-/**
- * To extend this compiler framework to generate something other than
- * the default, this factory interface must be implemented and the name
- * of it must be set in the main method (see idl.Compile).
- * <p>
- * The implementation of each method should be quite simple. Take
- * createAttributeGen, for instance. If the interface AttributeGen is
- * implemented by a class called MyAttributeGen, then createAttributeGen
- * will be the following:
- * <pre>
- * public AttributeGen createAttributeGen ()
- * {
- * return new MyAttributeGen ();
- * }
- * </pre>
- * <p>
- * If it is desired that a generator do nothing, it is not necessary to
- * implement one which does nothing; you may simply write that particular
- * create method so that it returns null.
- * <p>
- * Note that this class MUST have a public default constructor (one which
- * takes no parameters).
- **/
-public interface GenFactory
-{
- public AttributeGen createAttributeGen ();
- public ConstGen createConstGen ();
- public EnumGen createEnumGen ();
- public ExceptionGen createExceptionGen ();
- public ForwardGen createForwardGen ();
- public ForwardValueGen createForwardValueGen ();
- public IncludeGen createIncludeGen ();
- public InterfaceGen createInterfaceGen ();
- public ValueGen createValueGen ();
- public ValueBoxGen createValueBoxGen ();
- public MethodGen createMethodGen ();
- public ModuleGen createModuleGen ();
- public NativeGen createNativeGen ();
- public ParameterGen createParameterGen ();
- public PragmaGen createPragmaGen ();
- public PrimitiveGen createPrimitiveGen ();
- public SequenceGen createSequenceGen ();
- public StringGen createStringGen ();
- public StructGen createStructGen ();
- public TypedefGen createTypedefGen ();
- public UnionGen createUnionGen ();
-} // interface GenFactory
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/GenFileStream.java b/src/share/classes/com/sun/tools/corba/se/idl/GenFileStream.java
deleted file mode 100644
index d4347c0..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/GenFileStream.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.CharArrayWriter;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.PrintWriter;
-
-public class GenFileStream extends PrintWriter
-{
- public GenFileStream (String filename)
- {
- // What I really want to do here is:
- // super (byteStream = new ByteArrayOutputStream ());
- // but that isn't legal. The super constructor MUST
- // be called before any instance variables are used.
- // This implementation gets around that problem.
- // <f49747.1>
- //super (tmpByteStream = new ByteArrayOutputStream ());
- //byteStream = tmpByteStream;
- super (tmpCharArrayWriter = new CharArrayWriter());
- charArrayWriter = tmpCharArrayWriter;
- name = filename;
- } // ctor
-
- public void close ()
- {
- File file = new File (name);
- try
- {
- if (checkError ())
- throw new IOException ();
- // <f49747.1>
- //FileOutputStream fileStream = new FileOutputStream (file);
- //fileStream.write (byteStream.toByteArray ());
- //fileStream.close ();
- FileWriter fileWriter = new FileWriter (file);
- fileWriter.write (charArrayWriter.toCharArray ());
- fileWriter.close ();
- }
- catch (IOException e)
- {
- String[] parameters = {name, e.toString ()};
- System.err.println (Util.getMessage ("GenFileStream.1", parameters));
- }
- super.close ();
- } // close
-
- public String name ()
- {
- return name;
- } // name
-
- // <f49747.1>
- //private ByteArrayOutputStream byteStream;
- //private static ByteArrayOutputStream tmpByteStream;
- private CharArrayWriter charArrayWriter;
- private static CharArrayWriter tmpCharArrayWriter;
- private String name;
-} // GenFileStream
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/Generator.java b/src/share/classes/com/sun/tools/corba/se/idl/Generator.java
deleted file mode 100644
index 6eff7f7..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/Generator.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-public interface Generator
-{
-} // interface Generator
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/IDLID.java b/src/share/classes/com/sun/tools/corba/se/idl/IDLID.java
deleted file mode 100644
index 6feb97d..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/IDLID.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-public class IDLID extends RepositoryID
-{
- public IDLID ()
- {
- _prefix = "";
- _name = "";
- _version = "1.0";
- } // ctor
-
- public IDLID (String prefix, String name, String version)
- {
- _prefix = prefix;
- _name = name;
- _version = version;
- } // ctor
-
- public String ID ()
- {
- if (_prefix.equals (""))
- return "IDL:" + _name + ':' + _version;
- else
- return "IDL:" + _prefix + '/' + _name + ':' + _version;
- } // ID
-
- public String prefix ()
- {
- return _prefix;
- } // prefix
-
- void prefix (String prefix)
- {
- if (prefix == null)
- _prefix = "";
- else
- _prefix = prefix;
- } // prefix
-
- public String name ()
- {
- return _name;
- } // name
-
- void name (String name)
- {
- if (name == null)
- _name = "";
- else
- _name = name;
- } // name
-
- public String version ()
- {
- return _version;
- } // version
-
- void version (String version)
- {
- if (version == null)
- _version = "";
- else
- _version = version;
- } // version
-
- void appendToName (String name)
- {
- if (name != null)
- if (_name.equals (""))
- _name = name;
- else
- _name = _name + '/' + name;
- } // appendToName
-
- void replaceName (String name)
- {
- if (name == null)
- _name = "";
- else
- {
- int index = _name.lastIndexOf ('/');
- if (index < 0)
- _name = name;
- else
- _name = _name.substring (0, index + 1) + name;
- }
- } // replaceName
-
- public Object clone ()
- {
- return new IDLID (_prefix, _name, _version);
- } // clone
-
- private String _prefix;
- private String _name;
- private String _version;
-} // class IDLID
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/IncludeEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/IncludeEntry.java
deleted file mode 100644
index 42b9de6..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/IncludeEntry.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * This is the symbol table entry for the #include statement.
- **/
-public class IncludeEntry extends SymtabEntry
-{
- protected IncludeEntry ()
- {
- super ();
- repositoryID (Util.emptyID);
- } // ctor
-
- protected IncludeEntry (SymtabEntry that)
- {
- super (that, new IDLID ());
- module (that.name ());
- name ("");
- } // ctor
-
- protected IncludeEntry (IncludeEntry that)
- {
- super (that);
- } // ctor
-
- public Object clone ()
- {
- return new IncludeEntry (this);
- } // clone
-
- /** Invoke the Include type generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- includeGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the Include type generator.
- @returns an object which implements the IncludeGen interface.
- @see IncludeGen */
- public Generator generator ()
- {
- return includeGen;
- } // generator
-
- //d44810
- /** Set the fully-qualified file specification of this include file. */
- public void absFilename (String afn)
- {
- _absFilename = afn;
- }
-
- //d44810
- /** Access the fully-qualified file specification of this include.
- @returns a string containing the path of the include file. */
- public String absFilename ()
- {
- return _absFilename;
- }
-
- /** Add an IncludeEntry to the list of files which this included
- file includes. */
- public void addInclude (IncludeEntry entry)
- {
- includeList.addElement (entry);
- } // addInclude
-
- /** Get the list of files which this file includes. */
- public Vector includes ()
- {
- return includeList;
- } // includes
-
- static IncludeGen includeGen;
- /** List of files this file includes */
- private Vector includeList = new Vector ();
- //d44810
- /** Absolute file name for .u file generation. */
- private String _absFilename = null;
-} // class IncludeEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/IncludeGen.java b/src/share/classes/com/sun/tools/corba/se/idl/IncludeGen.java
deleted file mode 100644
index d97f602..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/IncludeGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface IncludeGen extends Generator
-{
- void generate (Hashtable symbolTable, IncludeEntry entry, PrintWriter stream);
-} // interface IncludeGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/InterfaceEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/InterfaceEntry.java
deleted file mode 100644
index 3b32546..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/InterfaceEntry.java
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * This is the symbol table entry for interfaces.
- **/
-public class InterfaceEntry extends SymtabEntry implements InterfaceType
-{
-
- protected InterfaceEntry ()
- {
- super ();
- } // ctor
-
- protected InterfaceEntry (InterfaceEntry that)
- {
- super (that);
- _derivedFromNames = (Vector)that._derivedFromNames.clone ();
- _derivedFrom = (Vector)that._derivedFrom.clone ();
- _methods = (Vector)that._methods.clone ();
- _allMethods = (Vector)that._allMethods.clone ();
- forwardedDerivers = (Vector)that.forwardedDerivers.clone ();
- _contained = (Vector)that._contained.clone ();
- _interfaceType = that._interfaceType;
- } // ctor
-
- protected InterfaceEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
- if (module ().equals (""))
- module (name ());
- else if (!name ().equals (""))
- module (module () + "/" + name ());
- } // ctor
-
- public boolean isAbstract()
- {
- return _interfaceType == ABSTRACT ;
- }
-
- public boolean isLocal()
- {
- return _interfaceType == LOCAL ;
- }
-
- public boolean isLocalServant()
- {
- return _interfaceType == LOCALSERVANT ;
- }
-
- public boolean isLocalSignature()
- {
- return _interfaceType == LOCAL_SIGNATURE_ONLY ;
- }
-
- public Object clone ()
- {
- return new InterfaceEntry (this);
- } // clone
-
- /** Invoke the interface generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- interfaceGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the interface generator.
- @returns an object which implements the InterfaceGen interface.
- @see InterfaceGen */
- public Generator generator ()
- {
- return interfaceGen;
- } // generator
-
- /** Add an InterfaceEntry to the list of interfaces which this interface
- is derivedFrom. During parsing, the parameter to this method COULD
- be a ForwardEntry, but when parsing is complete, calling derivedFrom
- will return a vector which only contains InterfaceEntry's. */
- public void addDerivedFrom (SymtabEntry derivedFrom)
- {
- _derivedFrom.addElement (derivedFrom);
- } // addDerivedFrom
-
- /** This method returns a vector of InterfaceEntry's. */
- public Vector derivedFrom ()
- {
- return _derivedFrom;
- } // derivedFrom
-
- /** Add to the list of derivedFrom names. */
- public void addDerivedFromName (String name)
- {
- _derivedFromNames.addElement (name);
- } // addDerivedFromName
-
- /** This method returns a vector of Strings, each of which is a fully
- qualified name of an interface. This vector corresponds to the
- derivedFrom vector. The first element of this vector is the name
- of the first element of the derivedFrom vector, etc. */
- public Vector derivedFromNames ()
- {
- return _derivedFromNames;
- } // derivedFromNames
-
- /** Add a method/attribute to the list of methods. */
- public void addMethod (MethodEntry method)
- {
- _methods.addElement (method);
- } // addMethod
-
- /** This is a vector of MethodEntry's. These are the methods and
- attributes contained within this Interface. */
- public Vector methods ()
- {
- return _methods;
- } // methods
-
- /** Add a symbol table entry to this interface's contained vector. */
- public void addContained (SymtabEntry entry)
- {
- _contained.addElement (entry);
- } // addContained
-
- /** This is a vector of SymtabEntry's. Valid entries in this vector are:
- AttributeEntry, ConstEntry, EnumEntry, ExceptionEntry, MethodEntry,
- StructEntry, NativeEntry, TypedefEntry, UnionEntry.
- Note that the methods vector is a subset of this vector. */
- public Vector contained ()
- {
- return _contained;
- } // contained
-
- void methodsAddElement (MethodEntry method, Scanner scanner)
- {
- if (verifyMethod (method, scanner, false))
- {
- addMethod (method);
- _allMethods.addElement (method);
-
- // Add this method to the 'allMethods' list of any interfaces
- // which may have inherited this one when it was a forward
- // reference.
- addToForwardedAllMethods (method, scanner);
- }
- } // methodsAddElement
-
- void addToForwardedAllMethods (MethodEntry method, Scanner scanner)
- {
- Enumeration e = forwardedDerivers.elements ();
- while (e.hasMoreElements ())
- {
- InterfaceEntry derived = (InterfaceEntry)e.nextElement ();
- if (derived.verifyMethod (method, scanner, true))
- derived._allMethods.addElement (method);
- }
- } // addToForwardedAllMethods
-
- // Make sure a method by this name doesn't exist in this class or
- // in this class's parents
- private boolean verifyMethod (MethodEntry method, Scanner scanner, boolean clash)
- {
- boolean unique = true;
- String lcName = method.name ().toLowerCase ();
- Enumeration e = _allMethods.elements ();
- while (e.hasMoreElements ())
- {
- MethodEntry emethod = (MethodEntry)e.nextElement ();
-
- // Make sure the method doesn't exist either in its
- // original name or in all lower case. In IDL, identifiers
- // which differ only in case are collisions.
- String lceName = emethod.name ().toLowerCase ();
- if (method != emethod && lcName.equals (lceName))
- {
- if (clash)
- ParseException.methodClash (scanner, fullName (), method.name ());
- else
- ParseException.alreadyDeclared (scanner, method.name ());
- unique = false;
- break;
- }
- }
- return unique;
- } // verifyMethod
-
- void derivedFromAddElement (SymtabEntry e, Scanner scanner)
- {
- addDerivedFrom (e);
- addDerivedFromName (e.fullName ());
- addParentType( e, scanner );
- } // derivedFromAddElement
-
- void addParentType (SymtabEntry e, Scanner scanner)
- {
- if (e instanceof ForwardEntry)
- addToDerivers ((ForwardEntry)e);
- else
- { // e instanceof InterfaceEntry
- InterfaceEntry derivedFrom = (InterfaceEntry)e;
-
- // Compare all of the parent's methods to the methods on this
- // interface, looking for name clashes:
- for ( Enumeration enumeration = derivedFrom._allMethods.elements ();
- enumeration.hasMoreElements (); )
- {
- MethodEntry method = (MethodEntry)enumeration.nextElement ();
- if ( verifyMethod (method, scanner, true))
- _allMethods.addElement (method);
-
- // Add this method to the 'allMethods' list of any interfaces
- // which may have inherited this one when it was a forward
- // reference:
- addToForwardedAllMethods (method, scanner);
- }
-
- // If any of the parent's parents are forward entries, make
- // sure this interface gets added to their derivers list so
- // that when the forward entry is defined, the 'allMethods'
- // list of this interface can be updated.
- lookForForwardEntrys (scanner, derivedFrom);
- }
- } // addParentType
-
- private void lookForForwardEntrys (Scanner scanner, InterfaceEntry entry)
- {
- Enumeration parents = entry.derivedFrom ().elements ();
- while (parents.hasMoreElements ())
- {
- SymtabEntry parent = (SymtabEntry)parents.nextElement ();
- if (parent instanceof ForwardEntry)
- addToDerivers ((ForwardEntry)parent);
- else if (parent == entry)
- ParseException.selfInherit (scanner, entry.fullName ());
- else // it must be an InterfaceEntry
- lookForForwardEntrys (scanner, (InterfaceEntry)parent);
- }
- } // lookForForwardEntrys
-
- public boolean replaceForwardDecl (ForwardEntry oldEntry, InterfaceEntry newEntry)
- {
- int index = _derivedFrom.indexOf( oldEntry );
- if ( index >= 0 )
- _derivedFrom.setElementAt( newEntry, index );
- return (index >= 0);
- } // replaceForwardDecl
-
- private void addToDerivers (ForwardEntry forward)
- {
- // Add this interface to the derivers list on the forward entry
- // so that when the forward entry is defined, the 'allMethods'
- // list of this interface can be updated.
- forward.derivers.addElement (this);
- Enumeration e = forwardedDerivers.elements ();
- while (e.hasMoreElements ())
- forward.derivers.addElement ((InterfaceEntry)e.nextElement ());
- } // addToDerivers
-
- /** This method returns a vector of the elements in the state block.
- If it is null, this is not a stateful interface. If it is non-null,
- but of zero length, then it is still stateful; it has no state
- entries itself, but it has an ancestor which does. */
- public Vector state ()
- {
- return _state;
- } // state
-
- public void initState ()
- {
- _state = new Vector ();
- } // initState
-
- public void addStateElement (InterfaceState state, Scanner scanner)
- {
- if (_state == null)
- _state = new Vector ();
- String name = state.entry.name ();
- for (Enumeration e = _state.elements (); e.hasMoreElements ();)
- if (name.equals (((InterfaceState) e.nextElement ()).entry.name ()))
- ParseException.duplicateState (scanner, name);
- _state.addElement (state);
- } // state
-
- public int getInterfaceType ()
- {
- return _interfaceType;
- }
-
- public void setInterfaceType (int type)
- {
- _interfaceType = type;
- }
-
- /** Get the allMethods vector. */
- public Vector allMethods ()
- {
- return _allMethods;
- }
-
- private Vector _derivedFromNames = new Vector();
- private Vector _derivedFrom = new Vector();
- private Vector _methods = new Vector();
- Vector _allMethods = new Vector();
- Vector forwardedDerivers = new Vector();
- private Vector _contained = new Vector();
- private Vector _state = null;
- private int _interfaceType = NORMAL;
-
- static InterfaceGen interfaceGen;
-} // class InterfaceEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/InterfaceGen.java b/src/share/classes/com/sun/tools/corba/se/idl/InterfaceGen.java
deleted file mode 100644
index aee4d67..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/InterfaceGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface InterfaceGen extends Generator
-{
- void generate (Hashtable symbolTable, InterfaceEntry entry, PrintWriter stream);
-} // interface InterfaceGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/InterfaceState.java b/src/share/classes/com/sun/tools/corba/se/idl/InterfaceState.java
deleted file mode 100644
index 2827456..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/InterfaceState.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-/**
- * This class is only used within an InterfaceEntry. If the interface
- * is stateful, then its state vector will contain one or more of these
- * InterfaceStates.
- **/
-public class InterfaceState
-{
- public static final int Private = 0,
- Protected = 1,
- Public = 2;
-
- public InterfaceState (int m, TypedefEntry e)
- {
- modifier = m;
- entry = e;
- if (modifier < Private || modifier > Public)
- modifier = Public;
- } // ctor
-
- public int modifier = Public;
- public TypedefEntry entry = null;
-} // class InterfaceState
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/InterfaceType.java b/src/share/classes/com/sun/tools/corba/se/idl/InterfaceType.java
deleted file mode 100644
index 4fb3418..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/InterfaceType.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1999, 2000, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface InterfaceType
-{
- public static final int NORMAL = 0 ;
- public static final int ABSTRACT = 1 ;
-
- // LOCAL generates code according to the Local interfaces
- // Here helper and holder classes are the only ones generated
- public static final int LOCAL = 2 ;
-
- // intermediate solution to enable people to extend ServantLocatorPOA
- // and ServantActivatorPOA for interoperability. This is until the
- // POA is declared Local officially by OMG
- public static final int LOCALSERVANT = 3 ;
-
- // generate only signature interfaces, no helper/holders are generated
- public static final int LOCAL_SIGNATURE_ONLY = 4 ;
-
- public int getInterfaceType ();
-
- public void setInterfaceType( int type ) ;
-} // interface InterfaceType
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/InvalidArgument.java b/src/share/classes/com/sun/tools/corba/se/idl/InvalidArgument.java
deleted file mode 100644
index fa3e1bd..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/InvalidArgument.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-/**
- * An invalid argument for the compiler has been encountered.
- **/
-public class InvalidArgument extends Exception
-{
- /** @param arg the invalid argument. */
- public InvalidArgument (String arg)
- {
- message = Util.getMessage ("InvalidArgument.1", arg) + "\n\n" + Util.getMessage ("usage");
- } // ctor
-
- public InvalidArgument ()
- {
- message = Util.getMessage ("InvalidArgument.2") + "\n\n" + Util.getMessage ("usage");
- } // ctor
-
- public String getMessage ()
- {
- return message;
- } // getMessage
-
- private String message = null;
-} // class InvalidArgument
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/InvalidCharacter.java b/src/share/classes/com/sun/tools/corba/se/idl/InvalidCharacter.java
deleted file mode 100644
index 19932b2..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/InvalidCharacter.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-// -D62023<daz> Cast char to byte for JDK 1.2 compatability.
-
-import java.io.IOException;
-
-public class InvalidCharacter extends IOException
-{
- public InvalidCharacter (String filename, String line, int lineNumber, int pos, char ch)
- {
- String pointer = "^";
- if (pos > 1)
- {
- byte[] bytes = new byte [pos - 1];
- for (int i = 0; i < pos - 1; ++i)
- bytes[i] = (byte)' '; // <d62023>
- pointer = new String (bytes) + pointer;
- }
- String[] parameters = {filename, Integer.toString (lineNumber), "" + ch, Integer.toString ((int)ch), line, pointer};
- message = Util.getMessage ("InvalidCharacter.1", parameters);
- }
-
- public String getMessage ()
- {
- return message;
- } // getMessage
-
- private String message = null;
-} // class InvalidCharacter
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/MethodEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/MethodEntry.java
deleted file mode 100644
index f13d845..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/MethodEntry.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-// - What does oneway mean?
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * This is the symbol table entry for methods.
- **/
-public class MethodEntry extends SymtabEntry
-{
- protected MethodEntry ()
- {
- super ();
- } // ctor
-
- protected MethodEntry (MethodEntry that)
- {
- super (that);
- _exceptionNames = (Vector)that._exceptionNames.clone ();
- _exceptions = (Vector)that._exceptions.clone ();
- _contexts = (Vector)that._contexts.clone ();
- _parameters = (Vector)that._parameters.clone ();
- _oneway = that._oneway;
- } // ctor
-
- protected MethodEntry (InterfaceEntry that, IDLID clone)
- {
- super (that, clone);
- if (module ().equals (""))
- module (name ());
- else if (!name ().equals (""))
- module (module () + "/" + name ());
- } // ctor
-
- public Object clone ()
- {
- return new MethodEntry (this);
- } // clone
-
- /** Invoke the method generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- methodGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the method generator.
- @returns an object which implements the MethodGen interface.
- @see MethodGen */
- public Generator generator ()
- {
- return methodGen;
- } // generator
-
- public void type (SymtabEntry newType)
- {
- super.type (newType);
- if (newType == null)
- typeName ("void");
- } // type
-
- /** Add an exception to the exception list. */
- public void addException (ExceptionEntry exception)
- {
- _exceptions.addElement (exception);
- } // addException
-
- /** This a a vector of the exceptions which this method raises. */
- public Vector exceptions ()
- {
- return _exceptions;
- } // exceptions
-
- /** Add an exception name to the list of exception names. */
- public void addExceptionName (String name)
- {
- _exceptionNames.addElement (name);
- } // addExceptionName
-
- /** This is a vector of strings, each of which is the full name of an
- exception which this method throws. This vector corresponds to the
- exceptions vector. The first element of this vector is the name
- of the first element of the exceptions vector, etc. */
- public Vector exceptionNames ()
- {
- return _exceptionNames;
- } // exceptionNames
-
- /* Add a context to the context list. */
- public void addContext (String context)
- {
- _contexts.addElement (context);
- } // addContext
-
- /** This is a vector of strings, each of which is the name of a context. */
- public Vector contexts ()
- {
- return _contexts;
- } // contexts
-
- /** Add a parameter to the parameter list. */
- public void addParameter (ParameterEntry parameter)
- {
- _parameters.addElement (parameter);
- } // addParameter
-
- /** This is a vector of ParameterEntry's. They are the parameters on
- this method and their order in the vector is the order they appear
- on the method. */
- public Vector parameters ()
- {
- return _parameters;
- } // parameters
-
- /** Is this a oneway method? */
- public void oneway (boolean yes)
- {
- _oneway = yes;
- } // oneway
-
- /** Is this a oneway method? */
- public boolean oneway ()
- {
- return _oneway;
- } // oneway
-
- /** Is this a value method? */
- public void valueMethod (boolean yes)
- {
- _valueMethod = yes;
- } // valueMethod
-
- /** Is this a value method? */
- public boolean valueMethod ()
- {
- return _valueMethod;
- } // valueMethod
-
- void exceptionsAddElement (ExceptionEntry e)
- {
- addException (e);
- addExceptionName (e.fullName ());
- } // exceptionsAddElement
-
- private Vector _exceptionNames = new Vector ();
- private Vector _exceptions = new Vector ();
- private Vector _contexts = new Vector ();
- private Vector _parameters = new Vector ();
- private boolean _oneway = false;
- private boolean _valueMethod = false;
-
- static MethodGen methodGen;
-} // class MethodEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/MethodGen.java b/src/share/classes/com/sun/tools/corba/se/idl/MethodGen.java
deleted file mode 100644
index fab8044..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/MethodGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface MethodGen extends Generator
-{
- void generate (Hashtable symbolTable, MethodEntry entry, PrintWriter stream);
-} // interface MethodGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ModuleEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/ModuleEntry.java
deleted file mode 100644
index a5b8164..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ModuleEntry.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * This is the symbol table entry for modules.
- **/
-public class ModuleEntry extends SymtabEntry
-{
- protected ModuleEntry ()
- {
- super ();
- } // ctor
-
- protected ModuleEntry (ModuleEntry that)
- {
- super (that);
- _contained = (Vector)that._contained.clone ();
- } // ctor
-
- protected ModuleEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
-
- if (module ().equals (""))
- module (name ());
- else if (!name ().equals (""))
- module (module () + "/" + name ());
- } // ctor
-
- public Object clone ()
- {
- return new ModuleEntry (this);
- } // clone
-
- /** Invoke the module generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- moduleGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the module generator.
- @returns an object which implements the ModuleGen interface.
- @see ModuleGen */
- public Generator generator ()
- {
- return moduleGen;
- } // generator
-
- /** alid entries in this vector are: TypedefEntry, ExceptionEntry,
- StructEntry, UnionEntry, EnumEntry, ConstEntry, InterfaceEntry,
- ModuleEntry. */
- public void addContained (SymtabEntry entry)
- {
- _contained.addElement (entry);
- } // addContained
-
- /** This is a vector of SymtabEntry's. Valid entries in this vector are:
- TypedefEntry, ExceptionEntry, StructEntry, UnionEntry, EnumEntry,
- ConstEntry, InterfaceEntry, ModuleEntry. */
- public Vector contained ()
- {
- return _contained;
- } // contained
-
- private Vector _contained = new Vector ();
-
- static ModuleGen moduleGen;
-} // class ModuleEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ModuleGen.java b/src/share/classes/com/sun/tools/corba/se/idl/ModuleGen.java
deleted file mode 100644
index 90902d0..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ModuleGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface ModuleGen extends Generator
-{
- void generate (Hashtable symbolTable, ModuleEntry entry, PrintWriter stream);
-} // interface ModuleGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/NativeEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/NativeEntry.java
deleted file mode 100644
index c9075e5..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/NativeEntry.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-/**
- * This is the symbol table entry for constants.
- **/
-public class NativeEntry extends SymtabEntry
-{
- protected NativeEntry ()
- {
- super ();
- repositoryID (Util.emptyID);
- } // ctor
-
- protected NativeEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
- if (module ().equals (""))
- module (name ());
- else if (!name ().equals (""))
- module (module () + "/" + name ());
- } // ctor
-
- protected NativeEntry (NativeEntry that)
- {
- super (that);
- } // ctor
-
- /** This is a shallow copy clone. */
- public Object clone ()
- {
- return new NativeEntry (this);
- } // clone
-
- /** Invoke the constant generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- nativeGen.generate(symbolTable, this, stream);
- } // generate
-
- /** Access the constant generator.
- @returns an object which implements the ConstGen interface.
- @see ConstGen */
- public Generator generator ()
- {
- return nativeGen;
- } // generator
-
- static NativeGen nativeGen;
-} // class NativeEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/NativeGen.java b/src/share/classes/com/sun/tools/corba/se/idl/NativeGen.java
deleted file mode 100644
index 91fb12c..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/NativeGen.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-public interface NativeGen extends Generator
-{
- void generate (Hashtable symbolTable, NativeEntry entry, PrintWriter stream);
-} // interface NativeGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/NoPragma.java b/src/share/classes/com/sun/tools/corba/se/idl/NoPragma.java
deleted file mode 100644
index c8e6a70..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/NoPragma.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.IOException;
-
-class NoPragma extends PragmaHandler
-{
- public boolean process (String pragma, String currentToken) throws IOException
- {
- parseException (Util.getMessage ("Preprocessor.unknownPragma", pragma));
- skipToEOL ();
- return true;
- } // process
-} // class NoPragma
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/Noop.java b/src/share/classes/com/sun/tools/corba/se/idl/Noop.java
deleted file mode 100644
index 87ae2ce..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/Noop.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.constExpr.ExprFactory;
-
-public class Noop implements
- AttributeGen, ConstGen, EnumGen, ExceptionGen, ForwardGen,
- ForwardValueGen, IncludeGen, InterfaceGen, ValueGen, ValueBoxGen,
- MethodGen, ModuleGen, NativeGen, ParameterGen, PragmaGen,
- PrimitiveGen, SequenceGen, StringGen, StructGen, TypedefGen,
- UnionGen, GenFactory
-{
- public void generate (Hashtable symbolTable, AttributeEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, ConstEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, EnumEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, ExceptionEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, ForwardEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, ForwardValueEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, IncludeEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, InterfaceEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, ValueEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, ValueBoxEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, MethodEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, ModuleEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, ParameterEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, PragmaEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, PrimitiveEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, SequenceEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, StringEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, StructEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, TypedefEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, UnionEntry entry, PrintWriter stream)
- {
- } // generate
-
- public void generate (Hashtable symbolTable, NativeEntry entry, PrintWriter stream)
- {
- } // generate
-
- // For GenFactory
- public AttributeGen createAttributeGen ()
- {
- return null;
- } // createAttributeGen
-
- public ConstGen createConstGen ()
- {
- return null;
- } // createConstGen
-
- public EnumGen createEnumGen ()
- {
- return null;
- } // createEnumGen
-
- public ExceptionGen createExceptionGen ()
- {
- return null;
- } // createExceptionGen
-
- public ForwardGen createForwardGen ()
- {
- return null;
- } // createForwardGen
-
- public ForwardValueGen createForwardValueGen ()
- {
- return null;
- } // createForwardValueGen
-
- public IncludeGen createIncludeGen ()
- {
- return null;
- } // createIncludeGen
-
- public InterfaceGen createInterfaceGen ()
- {
- return null;
- } // createInterfaceGen
-
- public ValueGen createValueGen ()
- {
- return null;
- } // createValueGen
-
- public ValueBoxGen createValueBoxGen ()
- {
- return null;
- } // createValueBoxGen
-
- public MethodGen createMethodGen ()
- {
- return null;
- } // createMethodGen
-
- public ModuleGen createModuleGen ()
- {
- return null;
- } // createModuleGen
-
- public NativeGen createNativeGen ()
- {
- return null;
- } // createNativeGen
-
- public ParameterGen createParameterGen ()
- {
- return null;
- } // createParameterGen
-
- public PragmaGen createPragmaGen ()
- {
- return null;
- } // createPragmaGen
-
- public PrimitiveGen createPrimitiveGen ()
- {
- return null;
- } // createPrimitiveGen
-
- public SequenceGen createSequenceGen ()
- {
- return null;
- } // createSequenceGen
-
- public StringGen createStringGen ()
- {
- return null;
- } // createStringGen
-
- public StructGen createStructGen ()
- {
- return null;
- } // createStructGen
-
- public TypedefGen createTypedefGen ()
- {
- return null;
- } // createTypedefGen
-
- public UnionGen createUnionGen ()
- {
- return null;
- } // createUnionGen
-} // class Noop
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ParameterEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/ParameterEntry.java
deleted file mode 100644
index d5d18db..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ParameterEntry.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-/**
- * This is the symbol table entry for parameters.
- **/
-public class ParameterEntry extends SymtabEntry
-{
- /** This is a set of class constants. A parameter can be passed
- as one of In, Out, or Inout. */
- public static final int In = 0,
- Inout = 1,
- Out = 2;
-
- protected ParameterEntry ()
- {
- super ();
- } // ctor
-
- protected ParameterEntry (ParameterEntry that)
- {
- super (that);
- _passType = that._passType;
- } // ctor
-
- protected ParameterEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
- if (module ().equals (""))
- module (name ());
- else if (!name ().equals (""))
- module (module () + "/" + name ());
- } // ctor
-
- public Object clone ()
- {
- return new ParameterEntry (this);
- } // clone
-
- /** Invoke the paramter generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- parameterGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the parameter generator.
- @returns an object which implements the ParameterGen interface.
- @see ParameterGen */
- public Generator generator ()
- {
- return parameterGen;
- } // generator
-
- /** This indicates the pass type of this parameter. */
- public void passType (int passType)
- {
- if (passType >= In && passType <= Out)
- _passType = passType;
- } // passType
-
- /** This indicates the pass type of this parameter. */
- public int passType ()
- {
- return _passType;
- } // passType
-
- private int _passType = In;
-
- static ParameterGen parameterGen;
-} // class ParameterEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ParameterGen.java b/src/share/classes/com/sun/tools/corba/se/idl/ParameterGen.java
deleted file mode 100644
index d61923f..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ParameterGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface ParameterGen extends Generator
-{
- void generate (Hashtable symbolTable, ParameterEntry entry, PrintWriter stream);
-} // interface ParameterGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ParseException.java b/src/share/classes/com/sun/tools/corba/se/idl/ParseException.java
deleted file mode 100644
index d689f5b..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ParseException.java
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-// -D56351<daz> Update Prefix pragma directive to CORBA 2.3 (see spec.).
-// -D57110<daz> Update ID pragma directive to CORBA 2.3 (see spec.).
-// -D46094<daz> Prohibit exceptions from appearing wihtin structs, unions, exceptions.
-// -D46094<daz> Prohibit attributes from appearing as operation parameter types,
-// operation return types, attribute types.
-// -D59166<daz> Prohibit identifiers form colliding with IDL keywords.
-// -F60858.1<daz> Add keyword collision warning.
-// -F60942<daz> Prohibit operations from appearing as operation parameter types.
-// -D62023<daz> Add deprecated keyword warning; cast char to byte for JDK 1.2 compatability.
-
-import java.io.IOException;
-
-/**
- *
- **/
-class ParseException extends Exception
-{
- /**
- * Constructor: print the supplied message to Standard.err
- * and create a new ParseException
- * @return a new ParseException.
- **/
- ParseException (String message)
- {
- super (message);
- System.err.println (message);
- detected = true;
- } // ctor
-
- /**
- * Constructor: print the supplied message to Standard.err, if it
- * is not a warning, and create a new ParseException.
- * @return a new ParseException.
- **/
- ParseException (String message, boolean onlyAWarning)
- {
- super (message);
- System.err.println (message);
- if (!onlyAWarning)
- detected = true;
- }
-
- static ParseException abstractValueBox (Scanner scanner)
- {
- return arg0 ("abstractValueBox", scanner);
- }
-
- static ParseException alreadyDeclared (Scanner scanner, String type)
- {
- return arg1 ("alreadyDeclared", scanner, type);
- }
-
- static ParseException declNotInSameFile( Scanner scanner, String type,
- String firstFile )
- {
- return arg2 ("declNotInSameFile", scanner, type, firstFile) ;
- }
-
- static ParseException alreadyDefaulted (Scanner scanner)
- {
- return arg0 ("alreadydefaulted", scanner);
- }
-
- static ParseException alreadyDerived (Scanner scanner, String derived, String iface)
- {
- return arg2 ("alreadyDerived", scanner, derived, iface);
- }
-
- static ParseException alreadyRaised (Scanner scanner, String exception)
- {
- return arg1 ("alreadyRaised", scanner, exception);
- }
-
- // <d60942>
- static ParseException attributeNotType (Scanner scanner, String attr)
- {
- return arg1 ("attributeNotType", scanner, attr);
- }
-
- static ParseException badAbstract (Scanner scanner, String name)
- {
- return arg1 ("badAbstract", scanner, name);
- }
-
- static ParseException badCustom (Scanner scanner)
- {
- return arg0 ("badCustom", scanner);
- }
-
- // <d57110>
- static ParseException badRepIDAlreadyAssigned (Scanner scanner, String entry)
- {
- return arg1 ("badRepIDAlreadyAssigned", scanner, entry);
- }
-
- // <d57110>
- static ParseException badRepIDForm (Scanner scanner, String entry)
- {
- return arg1 ("badRepIDForm", scanner, entry);
- }
-
- // <d56351>
- static ParseException badRepIDPrefix (Scanner scanner, String entry, String expected, String got)
- {
- return arg3 ("badRepIDPrefix", scanner, entry, expected, got);
- }
-
- static ParseException badState (Scanner scanner, String entry)
- {
- return arg1 ("badState", scanner, entry);
- }
-
- static ParseException branchLabel (Scanner scanner, String label)
- {
- return arg1 ("branchLabel", scanner, label);
- }
-
- static ParseException branchName (Scanner scanner, String name)
- {
- return arg1 ("branchName", scanner, name);
- }
-
- static ParseException duplicateInit (Scanner scanner)
- {
- return arg0 ("duplicateInit", scanner);
- }
-
- static ParseException duplicateState (Scanner scanner, String name)
- {
- return arg1 ("duplicateState", scanner, name);
- }
-
- static ParseException elseNoIf (Scanner scanner)
- {
- return arg0 ("elseNoIf", scanner);
- }
-
- static ParseException endNoIf (Scanner scanner)
- {
- return arg0 ("endNoIf", scanner);
- }
-
- static ParseException evaluationError (Scanner scanner, String problem)
- {
- return arg1 ("evaluation", scanner, problem);
- }
-
- static ParseException forwardEntry (Scanner scanner, String name)
- {
- return arg1 ("forwardEntry", scanner, name);
- }
-
- // <f46082.40> Cannot forward value boxes.
- static ParseException forwardedValueBox (Scanner scanner, String name)
- {
- return arg1 ("forwardedValueBox", scanner, name);
- }
-
- static ParseException generic (Scanner scanner, String message)
- {
- return arg1 ("generic", scanner, message);
- }
-
- static ParseException illegalArray (Scanner scanner, String name)
- {
- return arg1 ("illegalArray", scanner, name);
- }
-
- static ParseException illegalException (Scanner scanner, String name)
- {
- return arg1 ("illegalException", scanner, name);
- }
-
- static ParseException invalidConst (Scanner scanner, String mustBe, String is)
- {
- return arg2 ("invalidConst1", scanner, mustBe, is);
- }
-
- static ParseException invalidConst (Scanner scanner, String type)
- {
- return arg1 ("invalidConst2", scanner, type);
- }
-
- // <d59166> Non-escaped identifiers that collide with keywords are illegal.
- static ParseException keywordCollision (Scanner scanner, String id)
- {
- return arg1 ("keywordCollision", scanner, id);
- }
-
- // <d62023> Warning for keywords that will be removed in a future version of IDL.
- static ParseException deprecatedKeywordWarning (Scanner scanner, String id)
- {
- return arg1Warning ("deprecatedKeywordWarning", scanner, id);
- }
-
- // <f60858.1> Warning for above error.
- static ParseException keywordCollisionWarning (Scanner scanner, String id)
- {
- return arg1Warning ("keywordCollisionWarning", scanner, id);
- }
-
- static ParseException methodClash (Scanner scanner, String interf, String method)
- {
- return arg2 ("methodClash", scanner, interf, method);
- }
-
- static ParseException moduleNotType (Scanner scanner, String module)
- {
- return arg1 ("moduleNotType", scanner, module);
- }
-
- // <d59067>
- static ParseException nestedValueBox (Scanner scanner)
- {
- return arg0 ("nestedValueBox", scanner);
- }
-
- static ParseException noDefault (Scanner scanner)
- {
- return arg0 ("noDefault", scanner);
- }
-
- static ParseException nonAbstractParent (Scanner scanner, String baseClass, String parentClass)
- {
- return arg2 ("nonAbstractParent", scanner, baseClass, parentClass);
- }
-
- static ParseException nonAbstractParent2 (Scanner scanner, String baseClass, String parentClass)
- {
- return arg2 ("nonAbstractParent2", scanner, baseClass, parentClass);
- }
-
- static ParseException nonAbstractParent3 (Scanner scanner, String baseClass, String parentClass)
- {
- return arg2 ("nonAbstractParent3", scanner, baseClass, parentClass);
- }
-
- static ParseException notANumber (Scanner scanner, String notNumber)
- {
- return arg1 ("notANumber", scanner, notNumber);
- }
-
- static ParseException nothing (String filename)
- {
- return new ParseException (Util.getMessage ("ParseException.nothing", filename));
- }
-
- static ParseException notPositiveInt (Scanner scanner, String notPosInt)
- {
- return arg1 ("notPosInt", scanner, notPosInt);
- }
-
- static ParseException oneway (Scanner scanner, String method)
- {
- return arg1 ("oneway", scanner, method);
- }
-
- // <d60942>
- static ParseException operationNotType (Scanner scanner, String op)
- {
- return arg1 ("operationNotType", scanner, op);
- }
-
- static ParseException outOfRange (Scanner scanner, String value, String type)
- {
- return arg2 ("outOfRange", scanner, value, type);
- }
-
- static ParseException recursive (Scanner scanner, String type, String name)
- {
- return arg2 ("recursive", scanner, type, name);
- }
-
- static ParseException selfInherit (Scanner scanner, String name)
- {
- return arg1 ("selfInherit", scanner, name);
- }
-
- static ParseException stringTooLong (Scanner scanner, String str, String max)
- {
- return arg2 ("stringTooLong", scanner, str, max);
- }
-
- static ParseException syntaxError (Scanner scanner, int expected, int got)
- {
- return arg2 ("syntax1", scanner, Token.toString (expected), Token.toString (got));
- }
-
- static ParseException syntaxError (Scanner scanner, String expected, String got)
- {
- return arg2 ("syntax1", scanner, expected, got);
- }
-
- static ParseException syntaxError (Scanner scanner, int[] expected, int got)
- {
- return syntaxError (scanner, expected, Token.toString (got));
- }
-
- static ParseException syntaxError (Scanner scanner, int[] expected, String got)
- {
- String tokenList = "";
- for (int i = 0; i < expected.length; ++i)
- tokenList += " `" + Token.toString (expected[i]) + "'";
- return arg2 ("syntax2", scanner, tokenList, got);
- }
-
- static ParseException unclosedComment (String filename)
- {
- return new ParseException (Util.getMessage ("ParseException.unclosed", filename));
- }
-
- static ParseException undeclaredType (Scanner scanner, String undeclaredType)
- {
- return arg1 ("undeclaredType", scanner, undeclaredType);
- }
-
- static ParseException warning (Scanner scanner, String message)
- {
- scannerInfo (scanner);
- String[] parameters = { filename, Integer.toString (lineNumber), message, line, pointer };
- return new ParseException (Util.getMessage ("ParseException.warning", parameters), true);
- }
-
- static ParseException wrongType (Scanner scanner, String name, String mustBe, String is)
- {
- scannerInfo (scanner);
- String[] parameters = {filename, Integer.toString (lineNumber), name, is, mustBe, line, pointer};
- return new ParseException (Util.getMessage ("ParseException.wrongType", parameters));
- }
-
- static ParseException wrongExprType (Scanner scanner, String mustBe, String is)
- {
- scannerInfo (scanner);
- String[] parameters = {filename, Integer.toString (lineNumber),
- is, mustBe, line, pointer};
- return new ParseException (Util.getMessage ("ParseException.constExprType",
- parameters));
- }
-
- static ParseException illegalForwardInheritance( Scanner scanner, String declName,
- String baseName )
- {
- scannerInfo( scanner ) ;
- String[] parameters = { filename, Integer.toString(lineNumber),
- declName, baseName, line, pointer } ;
- return new ParseException (Util.getMessage(
- "ParseException.forwardInheritance", parameters ) ) ;
- }
-
- static ParseException illegalIncompleteTypeReference( Scanner scanner,
- String declName )
- {
- scannerInfo( scanner ) ;
- String[] parameters = { filename, Integer.toString(lineNumber),
- declName, line, pointer } ;
- return new ParseException (Util.getMessage(
- "ParseException.illegalIncompleteTypeReference", parameters ) ) ;
- }
-
- private static void scannerInfo (Scanner scanner)
- {
- filename = scanner.filename ();
- line = scanner.lastTokenLine ();
- lineNumber = scanner.lastTokenLineNumber ();
- int pos = scanner.lastTokenLinePosition ();
- pointer = "^";
- if (pos > 1)
- {
- byte[] bytes = new byte[ pos - 1 ];
- for (int i = 0; i < pos - 1; ++i)
- bytes[i] = (byte)' '; // <d62023>
- pointer = new String (bytes) + pointer;
- }
- }
-
- private static ParseException arg0 (String msgId, Scanner scanner)
- {
- scannerInfo (scanner);
- String[] parameters = {filename, Integer.toString (lineNumber), line, pointer};
- return new ParseException (Util.getMessage ("ParseException." + msgId, parameters));
- }
-
- private static ParseException arg1 (String msgId, Scanner scanner, String arg1)
- {
- scannerInfo (scanner);
- String[] parameters = {filename, Integer.toString (lineNumber), arg1, line, pointer};
- return new ParseException (Util.getMessage ("ParseException." + msgId, parameters));
- }
-
- // <f60858.1>
- private static ParseException arg1Warning (String msgId, Scanner scanner, String arg1)
- {
- scannerInfo (scanner);
- String[] parameters = {filename, Integer.toString (lineNumber), arg1, line, pointer};
- return new ParseException (Util.getMessage ("ParseException." + msgId, parameters), true);
- }
-
- private static ParseException arg2 (String msgId, Scanner scanner, String arg1, String arg2)
- {
- scannerInfo (scanner);
- String[] parameters = {filename, Integer.toString (lineNumber), arg1, arg2, line, pointer};
- return new ParseException (Util.getMessage ("ParseException." + msgId, parameters));
- }
-
- private static ParseException arg3 (String msgId, Scanner scanner, String arg1, String arg2, String arg3)
- {
- scannerInfo (scanner);
- String[] parameters = {filename, Integer.toString (lineNumber), arg1, arg2, arg3, line, pointer};
- return new ParseException (Util.getMessage ("ParseException." + msgId, parameters));
- }
-
- private static String filename = "";
- private static String line = "";
- private static int lineNumber = 0;
- private static String pointer = "^";
-
- static boolean detected = false;
-} // class ParseException
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/Parser.java b/src/share/classes/com/sun/tools/corba/se/idl/Parser.java
deleted file mode 100644
index ff42421..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/Parser.java
+++ /dev/null
@@ -1,3905 +0,0 @@
-/*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-// -F46082.51<daz> Remove -stateful feature.
-// -D52042<daz> Allow floating-point constants to be initialized with
-// integral as well as floating-point literals. No other variations allowed.
-// -D58058<daz> Set index array type to long rather than array element type.
-// -D56351<daz> Update computation of RepositoryIDs to CORBA 2.3 (see spec.).
-// -D57110<daz> Provide method() to set/clear ability for scoped names to
-// resolve to modules. Allows rep. ids to be assigned to modules.
-// -D46094<daz> Prohibit exceptions from appearing wihtin structs, unions, exceptions.
-// -D46094<daz> Prohibit attributes from appearing as operation parameter types,
-// operation return types, attribute types.
-// -D59067<daz> Prohibit nested value boxes.
-// -D59166<daz> Prohibit collisions between keywords and non-escaped identifiers.
-// -D59809<daz> At Pigeonhole(), add map short name of CORBA types to long name
-// (e.g., CORBA/StringValue --> org/omg/CORBA/StringValue), which allows fully-
-// qualified CORBA type names to resolve successfully.
-// -F60858.1<daz> Support "-corba" option, level <= 2.2: issue warning for
-// keyowrd collisions;
-// -D60942<daz> Prohibit operations from appearing within parameter types.
-// -D61643<daz> Repair pigeonhole() to correctly filter bad RepIDs.
-// -D62023<daz> Support -noWarn option; Issue warnings when tokens are
-// deprecated keywords or keywords in greater release version.
-// -D61919<daz> Emit entries for modules originally opened in #include files
-// appearing at global scope and then reopened in the main IDL file. Only
-// types appearing in the main IDL source will be emitted.
-
-import java.io.EOFException;
-import java.io.IOException;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Stack;
-import java.util.Vector;
-import java.util.List ;
-import java.util.ArrayList ;
-import java.util.Iterator ;
-
-import java.math.BigInteger;
-
-import com.sun.tools.corba.se.idl.constExpr.*;
-
-/**
- *
- **/
-class Parser
-{
- /**
- *
- **/
- Parser (Preprocessor preprocessor, Arguments arguments, Hashtable overrides,
- Hashtable symtab, SymtabFactory stFac, ExprFactory exprFac, String [] genKeywords)
- {
- this.arguments = arguments;
- noWarn = arguments.noWarn; // <d62023>
- corbaLevel = arguments.corbaLevel; // <f60858.1>
- paths = arguments.includePaths;
- symbols = arguments.definedSymbols;
- verbose = arguments.verbose;
- emitAll = arguments.emitAll;
- // <f46082.46.01>
- cppModule = arguments.cppModule;
- // <f46082.51> Remove -stateful feature.
- //parseStateful = arguments.parseStateful;
- overrideNames = (overrides == null) ? new Hashtable () : overrides;
- symbolTable = (symtab == null) ? new Hashtable () : symtab;
- keywords = (genKeywords == null) ? new String [0] : genKeywords;
- stFactory = stFac;
- exprFactory = exprFac;
- currentModule = topLevelModule = new ModuleEntry ();
- prep = preprocessor;
- repIDStack.push (new IDLID ());
- addPrimEntries ();
- } // ctor
-
- /**
- *
- **/
- void parse (String file) throws IOException
- {
- IncludeEntry fileEntry = stFactory.includeEntry ();
- fileEntry.name ('"' + file + '"');
- try
- {
- // Set absolute file path
- fileEntry.absFilename (Util.getAbsolutePath (file, paths));
- }
- catch (IOException ioe)
- {}
-
- // <f46082.51> Remove -stateful feature.
- //scanner = new Scanner (fileEntry, keywords, verbose, parseStateful, emitAll);
- // <f60585.1> Support "-corba [level]" option.
- //scanner = new Scanner (fileEntry, keywords, verbose, emitAll);
- scanner = new Scanner (fileEntry, keywords, verbose, emitAll, corbaLevel,
- arguments.scannerDebugFlag );
- topLevelModule.sourceFile (fileEntry);
-
- // Prime the pump...
- // Match handles preprocessor directives, so use match to
- // call scanner.getToken just in case the first token is
- // such a directive. But match depends on the token
- // already having a value, so fudge something.
- token = new Token (0);
- tokenHistory.insert (token); // Initialize look back buffer <26jul1997daz>.
- try
- {
- match (0);
- if (token.equals (Token.EOF))
- ParseException.nothing (file);
- else
- specification (topLevelModule);
- }
- catch (ParseException exception) // Match MIGHT throw this
- {
- // It has already been reported, just end.
- }
- catch (EOFException exception) // skipToSemicolon MIGHT throw this
- {
- // It has already been reported, just end.
- }
- } // parse
-
- /**
- *
- **/
- private void addPrimEntries ()
- {
- symbolTable.put ("short", stFactory.primitiveEntry ("short"));
- symbolTable.put ("long", stFactory.primitiveEntry ("long"));
- symbolTable.put ("long long", stFactory.primitiveEntry ("long long"));
- symbolTable.put ("unsigned short", stFactory.primitiveEntry ("unsigned short"));
- symbolTable.put ("unsigned long", stFactory.primitiveEntry ("unsigned long"));
- symbolTable.put ("unsigned long long", stFactory.primitiveEntry ("unsigned long long"));
- symbolTable.put ("char", stFactory.primitiveEntry ("char"));
- symbolTable.put ("wchar", stFactory.primitiveEntry ("wchar"));
- symbolTable.put ("float", stFactory.primitiveEntry ("float"));
- //Support fixed type: symbolTable.put ("fixed", stFactory.primitiveEntry ("fixed"));
- symbolTable.put ("double", stFactory.primitiveEntry ("double"));
- symbolTable.put ("boolean", stFactory.primitiveEntry ("boolean"));
- symbolTable.put ("octet", stFactory.primitiveEntry ("octet"));
- symbolTable.put ("any", stFactory.primitiveEntry ("any"));
-
- InterfaceEntry object = stFactory.interfaceEntry();
- object.name ("Object");
- symbolTable.put ("Object", object);
-
- ValueEntry valueBase = stFactory.valueEntry();
- valueBase.name ("ValueBase");
- symbolTable.put ("ValueBase", valueBase);
-
- // put these same entries in the lowercase symbol table
- lcSymbolTable.put ("short", stFactory.primitiveEntry ("short"));
- lcSymbolTable.put ("long", stFactory.primitiveEntry ("long"));
- lcSymbolTable.put ("long long", stFactory.primitiveEntry ("long long"));
- lcSymbolTable.put ("unsigned short", stFactory.primitiveEntry ("unsigned short"));
- lcSymbolTable.put ("unsigned long", stFactory.primitiveEntry ("unsigned long"));
- lcSymbolTable.put ("unsigned long long", stFactory.primitiveEntry ("unsigned long long"));
- lcSymbolTable.put ("char", stFactory.primitiveEntry ("char"));
- lcSymbolTable.put ("wchar", stFactory.primitiveEntry ("wchar"));
- lcSymbolTable.put ("float", stFactory.primitiveEntry ("float"));
- // Support fixed type: lcSymbolTable.put ("fixed", stFactory.primitiveEntry ("fixed"));
- lcSymbolTable.put ("double", stFactory.primitiveEntry ("double"));
- lcSymbolTable.put ("boolean", stFactory.primitiveEntry ("boolean"));
- lcSymbolTable.put ("octet", stFactory.primitiveEntry ("octet"));
- lcSymbolTable.put ("any", stFactory.primitiveEntry ("any"));
- lcSymbolTable.put ("object", object);
- lcSymbolTable.put ("valuebase", valueBase);
- } // addPrimEntries
-
- /**
- *
- **/
- private void specification (ModuleEntry entry) throws IOException
- {
- while (!token.equals (Token.EOF))
- {
- definition (entry);
- addToEmitList (entry);
- }
- } // specification
-
- // ModuleEntry is the topLevelModule; add its contained types to the emit list.
- /**
- *
- **/
- private void addToEmitList (ModuleEntry entry)
- {
- for (Enumeration e = entry.contained ().elements (); e.hasMoreElements();)
- {
- SymtabEntry emitEntry = (SymtabEntry)e.nextElement ();
- if (emitEntry.emit ())
- {
- emitList.addElement (emitEntry);
-
- // <d61919> I think the absence of the following statement was an
- // oversight. If module X.Y.Z first appears in an include file, then is
- // reopened in the main IDL source, this statement guarantees that X.Y.Z
- // definitions within the main IDL source are emitted.
- ///---------------------------------------------------------------------
- // If any of this module's elements should be emitted, add
- // this module to the emit list.
- if (emitEntry instanceof ModuleEntry)
- checkContained ((ModuleEntry)emitEntry);
- if (emitEntry instanceof IncludeEntry)
- {
- includes.addElement (emitEntry.name ());
- includeEntries.addElement (emitEntry);
- }
- }
- else
- // If any of this module's elements should be emitted, add
- // this module to the emit list.
- if (emitEntry instanceof ModuleEntry)
- checkContained ((ModuleEntry)emitEntry);
- }
- entry.contained ().removeAllElements ();
- } // addToEmitList
-
- /**
- *
- **/
- private void checkContained (ModuleEntry entry)
- {
- // If any of this module's elements is to be emitted,
- // then add the module to the emit list.
- for (Enumeration e = entry.contained ().elements (); e.hasMoreElements ();)
- {
- SymtabEntry contained = (SymtabEntry)e.nextElement ();
- if (contained instanceof ModuleEntry)
- checkContained ((ModuleEntry)contained);
- if (contained.emit ())
- {
- if (!emitList.contains (entry))
- emitList.addElement (entry);
- entry.emit (true);
- break;
- }
- }
- } // checkContained
-
- /**
- *
- **/
- private void definition (ModuleEntry entry) throws IOException
- {
- try
- {
- switch (token.type)
- {
- case Token.Typedef:
- case Token.Struct:
- case Token.Union:
- case Token.Enum:
- typeDcl (entry);
- break;
- case Token.Const:
- constDcl (entry);
- break;
- case Token.Native:
- nativeDcl (entry);
- break;
- case Token.Exception:
- exceptDcl (entry);
- break;
- case Token.Interface:
- interfaceProd (entry, InterfaceEntry.NORMAL);
- break;
- case Token.Local:
- match( Token.Local ) ;
- if (token.type == Token.Interface)
- interfaceProd( entry, InterfaceEntry.LOCAL ) ;
- else
- throw ParseException.syntaxError( scanner, new int[] {
- Token.Interface }, token.type ) ;
- break ;
- case Token.Module:
- module (entry);
- break;
- case Token.Abstract:
- match (Token.Abstract);
- if (token.type == Token.Interface)
- interfaceProd (entry, InterfaceEntry.ABSTRACT);
- else if (token.type == Token.Valuetype)
- valueProd (entry, true);
- else
- throw ParseException.syntaxError (scanner, new int[] {
- Token.Interface, Token.Valuetype }, token.type);
- break;
- case Token.Custom:
- case Token.Valuetype:
- valueProd (entry, false);
- break;
- default:
- throw ParseException.syntaxError (scanner, new int[] {
- Token.Typedef, Token.Struct, Token.Union, Token.Enum,
- Token.Const, Token.Exception, Token.Interface, Token.Valuetype,
- Token.Module }, token.type);
- }
- match (Token.Semicolon);
- }
- catch (ParseException e)
- {
- skipToSemicolon ();
- }
- } // definition
-
- /**
- *
- **/
- private void module (ModuleEntry entry) throws IOException, ParseException
- {
- match (Token.Module);
- repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
- ModuleEntry newEntry = newModule (entry);
- ((IDLID)repIDStack.peek ()).appendToName (newEntry.name ());
- // comment must immediately precede "module" keyword
- newEntry.comment (tokenHistory.lookBack (1).comment);
- currentModule = newEntry;
- match (Token.Identifier);
- prep.openScope (newEntry);
- match (Token.LeftBrace);
- definition (newEntry);
- while (!token.equals (Token.EOF) && !token.equals (Token.RightBrace))
- definition (newEntry);
- prep.closeScope (newEntry);
- match (Token.RightBrace);
- currentModule = entry;
- repIDStack.pop ();
- } // module
-
- /**
- *
- **/
- private void interfaceProd (ModuleEntry entry, int interfaceType)
- throws IOException, ParseException
- {
- match (Token.Interface);
- String name = token.name;
- match (Token.Identifier);
- interface2 (entry, name, interfaceType);
- } // interfaceProd
-
- /**
- *
- **/
- private void interface2 (ModuleEntry module, String name, int interfaceType)
- throws IOException, ParseException
- {
- if (token.type == Token.Colon || token.type == Token.LeftBrace) {
- repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
- InterfaceEntry entry = stFactory.interfaceEntry (module,
- (IDLID)repIDStack.peek ());
- entry.sourceFile (scanner.fileEntry ());
- entry.name (name);
- entry.setInterfaceType(interfaceType);
- // Comment must immediately precede "[local | abstract] interface" keyword
- entry.comment (tokenHistory.lookBack (
- entry.getInterfaceType() == InterfaceEntry.NORMAL ? 2 : 3).comment);
-
- if (!ForwardEntry.replaceForwardDecl (entry))
- ParseException.badAbstract (scanner, entry.fullName ());
- pigeonhole (module, entry);
- ((IDLID)repIDStack.peek ()).appendToName (name);
- currentModule = entry;
- interfaceDcl (entry);
- currentModule = module;
- repIDStack.pop ();
- } else { // This is a forward declaration
- ForwardEntry entry = stFactory.forwardEntry (module, (IDLID)repIDStack.peek ());
- entry.sourceFile (scanner.fileEntry ());
- entry.name (name);
- entry.setInterfaceType(interfaceType);
- // comment must immediately precede "interface" keyword.
- entry.comment (tokenHistory.lookBack (
- entry.getInterfaceType() == InterfaceEntry.NORMAL ? 2 : 3).comment);
- pigeonhole (module, entry);
- }
- } // interface2
-
- /**
- *
- **/
- private void interfaceDcl (InterfaceEntry entry) throws IOException, ParseException
- {
- if (token.type != Token.LeftBrace)
- inheritanceSpec (entry);
- else if (!entry.isAbstract ()) {
- SymtabEntry objectEntry = qualifiedEntry ("Object");
- SymtabEntry realOEntry = typeOf (objectEntry);
- if (objectEntry == null)
- ; // qualifiedEntry already generated an error message
- else if (!isInterface(realOEntry))
- ParseException.wrongType (scanner, overrideName ("Object"),
- "interface", objectEntry.typeName ());
- else
- entry.derivedFromAddElement (realOEntry, scanner);
- }
-
- prep.openScope (entry);
- match (Token.LeftBrace);
- while (token.type != Token.RightBrace)
- export (entry);
- prep.closeScope (entry);
- match (Token.RightBrace);
- } // interfaceDcl
-
- /**
- *
- **/
- private void export (InterfaceEntry entry) throws IOException
- {
- try
- {
- switch (token.type)
- {
- case Token.Typedef:
- case Token.Struct:
- case Token.Union:
- case Token.Enum:
- typeDcl (entry);
- break;
- case Token.Const:
- constDcl (entry);
- break;
- case Token.Native:
- nativeDcl (entry);
- break;
- case Token.Exception:
- exceptDcl (entry);
- break;
- case Token.Readonly:
- case Token.Attribute:
- attrDcl (entry);
- break;
- case Token.Oneway:
- case Token.Float:
- case Token.Double:
- case Token.Long:
- case Token.Short:
- case Token.Unsigned:
- case Token.Char:
- case Token.Wchar:
- case Token.Boolean:
- case Token.Octet:
- case Token.Any:
- case Token.String:
- case Token.Wstring:
- case Token.Identifier:
- case Token.Object:
- // <f46082.40> Value base type.
- case Token.ValueBase:
- case Token.DoubleColon:
- case Token.Void:
- opDcl (entry);
- break;
- // <f46082.51> Remove -stateful feature.
- //case Token.State: if (parseStateful) {
- // stateDef (entry);
- // break; }
- default:
- throw ParseException.syntaxError(scanner, new int [] {
- Token.Typedef, Token.Struct, Token.Union, Token.Enum,
- Token.Const, Token.Exception, Token.Readonly, Token.Attribute,
- Token.Oneway, Token.Float, Token.Double, Token.Long,
- Token.Short, Token.Unsigned, Token.Char, Token.Wchar,
- Token.Boolean, Token.Octet, Token.Any, Token.String,
- Token.Wstring, Token.Identifier, Token.DoubleColon, Token.Void,
- Token.ValueBase }, token.type);
- }
- match (Token.Semicolon);
- }
- catch (ParseException exception)
- {
- skipToSemicolon ();
- }
- } // export
-
- private void inheritanceSpec (InterfaceEntry entry) throws IOException, ParseException
- {
- for (match (Token.Colon); ; match (Token.Comma)) {
- SymtabEntry parent = scopedName (entry.container (),
- stFactory.interfaceEntry ());
- SymtabEntry realParent = typeOf (parent);
-
- if (isInterfaceOnly (realParent)) {
- boolean isInterface = (realParent instanceof InterfaceEntry);
- if (entry.derivedFrom ().contains (realParent))
- ParseException.alreadyDerived (scanner, realParent.fullName (), entry.fullName ());
- else if (!entry.isAbstract () ||
- (((InterfaceType)realParent).getInterfaceType() == InterfaceType.ABSTRACT))
- entry.derivedFromAddElement (realParent, scanner);
- else
- ParseException.nonAbstractParent (scanner, entry.fullName (), parent.fullName ());
- } else if (isForward( realParent )) {
- ParseException.illegalForwardInheritance( scanner,
- entry.fullName(), parent.fullName() ) ;
- } else
- ParseException.wrongType (scanner, parent.fullName (), "interface", entryName (parent));
-
- if ((parent instanceof InterfaceEntry) && (((InterfaceEntry)parent).state () != null))
- if (entry.state () == null)
- entry.initState ();
- else
- throw ParseException.badState (scanner, entry.fullName ());
-
- if (token.type != Token.Comma)
- break;
- }
- } // inheritanceSpec
-
- // <57110> Member _moduleIsLegalType may be set by any feature to allow
- // method scopedName() and any of its helper methods -- qualifiedName(),
- // partlyQualifiedName(), and unqualifiedName() -- to return a ModuleEntry
- // rather than a parse error in the event a name resolves to a module. The
- // flag must be cleared (set to false) to resume normal parsing behavior.
- //
- // Currently, this is used only when preprocessing the ID pragma directive.
-
- private boolean _isModuleLegalType = false;
-
- /**
- *
- **/
- public boolean isModuleLegalType ()
- {
- return _isModuleLegalType;
- }; // moduleIsLegaType
-
- /**
- *
- **/
- public void isModuleLegalType (boolean b)
- {
- _isModuleLegalType = b;
- }; // moduleIsLegalType
-
- /**
- *
- **/
- SymtabEntry scopedName (SymtabEntry container,
- SymtabEntry expected) throws IOException, ParseException
- {
- return scopedName( container, expected, true ) ;
- }
-
- SymtabEntry scopedName (SymtabEntry container, SymtabEntry expected,
- boolean mustBeReferencable ) throws IOException, ParseException
- {
- boolean globalScope = false;
- boolean partialScope = false;
- String name = null;
- if (token.type == Token.DoubleColon)
- globalScope = true;
- else
- {
- if (token.type == Token.Object)
- {
- name = "Object";
- match (Token.Object);
- }
- else if (token.type == Token.ValueBase) // <f46082.40>
- {
- name = "ValueBase";
- match (Token.ValueBase);
- }
- else
- {
- name = token.name;
- match (Token.Identifier);
- }
- }
- while (token.type == Token.DoubleColon)
- {
- match (Token.DoubleColon);
- partialScope = true;
- if (name != null)
- name += '/' + token.name;
- else name = token.name;
- match (Token.Identifier);
- }
- SymtabEntry entry = null;
- if (globalScope)
- entry = qualifiedEntry (name);
- else if (partialScope)
- entry = partlyQualifiedEntry (name, container);
- else
- entry = unqualifiedEntry (name, container);
-
- if (entry == null)
- // Make the entry the expected entry. The generators will
- // not be called now, since a semantic exception ocurred, but
- // the parse has to finish and something valid has to be
- // returned.
- (entry = expected).name (name);
- else if (!entry.isReferencable() && mustBeReferencable)
- throw ParseException.illegalIncompleteTypeReference( scanner, name ) ;
-
- return entry;
- } // scopedName
-
- private void valueProd (ModuleEntry entry, boolean isAbstract) throws IOException, ParseException
- {
- boolean isCustom = (token.type == Token.Custom);
- if (isCustom)
- match (Token.Custom);
- match (Token.Valuetype);
- String name = token.name;
- match (Token.Identifier);
-
- switch (token.type)
- {
- case Token.LeftBrace:
- case Token.Colon:
- case Token.Supports:
- value2 (entry, name, isAbstract, isCustom);
- return;
- case Token.Semicolon:
- if (isCustom)
- break;
- valueForwardDcl (entry, name, isAbstract);
- return;
- }
- if (isCustom)
- throw ParseException.badCustom (scanner);
- if (isAbstract)
- throw ParseException.abstractValueBox (scanner);
- valueBox (entry, name);
- } // valueProd
-
- /**
- *
- **/
- private void value2 (ModuleEntry module, String name, boolean isAbstract,
- boolean isCustom) throws IOException, ParseException
- {
- repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
- // The 'actual' repository ID will be calculated at the end of the
- // parsing phase, since it is based on the entire contents of the
- // declaration, and needs to have all forward references resolved:
- ValueEntry entry = stFactory.valueEntry (module, (IDLID)repIDStack.peek ());
- entry.sourceFile (scanner.fileEntry ());
- entry.name (name);
- entry.setInterfaceType (isAbstract ? InterfaceType.ABSTRACT : InterfaceType.NORMAL);
- entry.setCustom (isCustom);
- // Comment must immediately precede "[abstract | custom] value" keyword
- entry.comment (tokenHistory.lookBack ((isAbstract || isCustom) ? 3 : 2).comment);
- // If this value has been forward declared, there are probably
- // other values which derive from a ForwardValueEntry. Replace
- // those ForwardValueEntry's with this ValueEntry:
- if (!ForwardEntry.replaceForwardDecl (entry))
- ParseException.badAbstract (scanner, entry.fullName ());
- pigeonhole (module, entry);
- ((IDLID)repIDStack.peek ()).appendToName (name);
- currentModule = entry;
- valueDcl (entry);
- entry.tagMethods ();
- currentModule = module;
- repIDStack.pop ();
- } // value2
-
- /**
- *
- **/
- private void valueDcl (ValueEntry entry) throws IOException, ParseException
- {
- if (token.type == Token.Colon)
- valueInheritanceSpec (entry);
- else if (!entry.isAbstract ())
- {
- SymtabEntry objectEntry = qualifiedEntry ("ValueBase");
- SymtabEntry realOEntry = typeOf (objectEntry);
- if (objectEntry == null)
- ; // qualifiedEntry already generated an error message
- else if (!isValue (realOEntry))
- ParseException.wrongType (scanner, overrideName ("ValueBase"), "value", objectEntry.typeName ());
- else
- entry.derivedFromAddElement (realOEntry, false, scanner);
- }
- if (token.type == Token.Supports)
- valueSupportsSpec (entry);
- prep.openScope (entry);
- match (Token.LeftBrace);
- while (token.type != Token.RightBrace)
- {
- valueElement (entry);
- }
- prep.closeScope (entry);
- match (Token.RightBrace);
- } // valueDcl
-
- /**
- *
- **/
- private void valueInheritanceSpec (ValueEntry entry) throws IOException, ParseException
- {
- match (Token.Colon);
- boolean isTruncatable = (token.type == Token.Truncatable);
- if (isTruncatable)
- match (Token.Truncatable);
- for (; ; match (Token.Comma), isTruncatable = false) {
- SymtabEntry parent = scopedName (entry.container (),
- stFactory.valueEntry ());
- SymtabEntry realParent = typeOf (parent);
- if (isValue (realParent) && !(realParent instanceof ValueBoxEntry))
- entry.derivedFromAddElement (realParent, isTruncatable,
- scanner);
- else if (isForward(realParent))
- ParseException.illegalForwardInheritance( scanner,
- entry.fullName(), parent.fullName() ) ;
- else
- ParseException.wrongType (scanner,
- parent.fullName (), "value", entryName (parent));
- if (token.type != Token.Comma)
- break;
- }
- } // valueInheritanceSpec
-
- /**
- *
- **/
- private void valueSupportsSpec (ValueEntry entry) throws IOException, ParseException
- {
- match (Token.Supports) ;
- for (; ; match( Token.Comma ) ) {
- SymtabEntry parent = scopedName (entry.container (), stFactory.interfaceEntry ());
- SymtabEntry realParent = typeOf (parent);
- if (isInterface(realParent))
- entry.derivedFromAddElement (realParent, scanner);
- else
- ParseException.wrongType (scanner, parent.fullName (), "interface",
- entryName (parent));
-
- if (token.type != Token.Comma)
- break;
- }
- } // valueSupportsSpec
-
- private void valueElement (ValueEntry entry) throws IOException, ParseException
- {
- if (entry.isAbstract ())
- export (entry);
- else
- switch (token.type)
- {
- case Token.Private:
- case Token.Public:
- valueStateMember (entry);
- break;
- case Token.Init:
- case Token.Factory: // <d62023> "factory" supplants "init" in 2.4RTF
- initDcl (entry);
- break;
- case Token.Typedef:
- case Token.Struct:
- case Token.Union:
- case Token.Enum:
- case Token.Const:
- case Token.Native:
- case Token.Exception:
- case Token.Readonly:
- case Token.Attribute:
- case Token.Oneway:
- case Token.Float:
- case Token.Double:
- case Token.Long:
- case Token.Short:
- case Token.Unsigned:
- case Token.Char:
- case Token.Wchar:
- case Token.Boolean:
- case Token.Octet:
- case Token.Any:
- case Token.String:
- case Token.Wstring:
- case Token.Identifier:
- case Token.Object:
- case Token.ValueBase:
- case Token.DoubleColon:
- case Token.Void:
- export (entry);
- break;
- default:
- throw ParseException.syntaxError(scanner, new int[] {
- Token.Private, Token.Public, Token.Init, Token.ValueBase,
- Token.Typedef, Token.Struct, Token.Union, Token.Enum,
- Token.Const, Token.Exception, Token.Readonly, Token.Attribute,
- Token.Oneway, Token.Float, Token.Double, Token.Long,
- Token.Short, Token.Unsigned, Token.Char, Token.Wchar,
- Token.Boolean, Token.Octet, Token.Any, Token.String,
- Token.Wstring, Token.Identifier, Token.DoubleColon, Token.Void },
- token.type);
- } // switch
- } // valueElement
-
- // <f46082.40>
- /**
- *
- **/
- private void valueStateMember (ValueEntry entry) throws IOException, ParseException
- {
- TypedefEntry typedefEntry =
- stFactory.typedefEntry (entry, (IDLID)repIDStack.peek ());
- typedefEntry.sourceFile (scanner.fileEntry ());
- // comment must immediately precede "public", "private" keywords
- typedefEntry.comment (token.comment);
- boolean isPublic = (token.type == Token.Public);
- if (isPublic)
- match (Token.Public);
- else
- match (Token.Private);
- // <f46082.40> Add constructed types declared "inline" to the contained
- // vector of this value entry.
- boolean isConstTypeSpec =
- (token.type == Token.Struct || token.type == Token.Union || token.type == Token.Enum);
- // <f46082.40> Make typedefEntry anonymous. If this line is removed,
- // the entry will be named incorrectly. See <d50618>.
- typedefEntry.name ("");
- typedefEntry.type (typeSpec (typedefEntry));
- addDeclarators (entry, typedefEntry, isPublic);
- // <f46082.40>
- if (isConstTypeSpec)
- entry.addContained (typedefEntry);
- match (Token.Semicolon);
- } // valueStateMember
-
-
- private void addDeclarators (ValueEntry entry, TypedefEntry typedefEntry,
- boolean isPublic) throws IOException, ParseException
- {
- int modifier = isPublic ? InterfaceState.Public : InterfaceState.Private;
- try
- {
- Vector typedefList = new Vector ();
- declarators (typedefEntry, typedefList);
- for (Enumeration e = typedefList.elements (); e.hasMoreElements ();)
- entry.addStateElement (
- new InterfaceState (modifier, (TypedefEntry)e.nextElement ()), scanner);
- }
- catch (ParseException exception)
- {
- skipToSemicolon ();
- }
- } // addDeclarators
-
- /**
- *
- **/
- private void initDcl (ValueEntry entry) throws IOException, ParseException
- {
- MethodEntry method = stFactory.methodEntry (entry, (IDLID)repIDStack.peek ());
- method.sourceFile (scanner.fileEntry ());
- // Comment must immediately precede "init" keyword:
- method.comment (token.comment);
- repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
- ((IDLID)repIDStack.peek ()).appendToName (token.name);
-
- // <d62023> In 2.3 prelim, <init_dcl> ::= "init" "(" ...
- if (token.type == Token.Init)
- {
- method.name ("init");
- match (Token.Init);
- match (Token.LeftParen);
- }
- else // <d62023> In 2.4rtf, <init_dcl> ::= "factory" <Indentifier> "(" ...
- {
- match (Token.Factory);
- method.name (token.name);
- if (token.type == Token.MacroIdentifier)
- match (Token.MacroIdentifier); // "(" already consumed.
- else
- {
- match (Token.Identifier);
- match (Token.LeftParen);
- }
- }
-
- if (token.type != Token.RightParen)
- for (;;)
- {
- initParamDcl (method);
- if (token.type == Token.RightParen)
- break;
- match (Token.Comma);
- }
- entry.initializersAddElement (method, scanner);
- match (Token.RightParen);
- match (Token.Semicolon);
- repIDStack.pop ();
- } // initDcl
-
- /**
- *
- **/
- private void initParamDcl (MethodEntry entry) throws IOException, ParseException
- {
- ParameterEntry parmEntry = stFactory.parameterEntry (entry, (IDLID)repIDStack.peek ());
- parmEntry.sourceFile (scanner.fileEntry());
- // Comment must immediately precede parameter attribute
- parmEntry.comment (token.comment);
- match (Token.In);
- parmEntry.passType (ParameterEntry.In);
- parmEntry.type (paramTypeSpec (entry));
- parmEntry.name (token.name);
- match (Token.Identifier);
- if (isntInList (entry.parameters (), parmEntry.name ()))
- entry.addParameter (parmEntry);
- } // initParamDcl
-
- /**
- *
- **/
- private void valueBox (ModuleEntry module, String name) throws IOException, ParseException
- {
- repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
- // Note: The 'actual' repository ID will be calculated at the end of
- // the parsing phase, since it is based on the entire contents of the
- // declaration, and needs to have all forward references resolved:
- ValueEntry entry = stFactory.valueBoxEntry (module, (IDLID)repIDStack.peek ());
- entry.sourceFile (scanner.fileEntry ());
- entry.name (name);
- // comment must immediately precede "value" keyword
- entry.comment (tokenHistory.lookBack (2).comment);
- // <f46082.40> Value boxes may not be forwarded.
- // If this value has been forward declared, there are probably
- // other values which derive from a ForwardValueEntry.
- // Replace those ForwardValueEntry's with this ValueEntry:
- //if (!ForwardValueEntry.replaceForwardDecl (entry))
- // ParseException.badAbstract (scanner, entry.fullName());
- SymtabEntry valueForward = (SymtabEntry)Parser.symbolTable.get (entry.fullName ());
- if (valueForward != null && valueForward instanceof ForwardEntry)
- ParseException.forwardedValueBox (scanner, entry.fullName ());
- pigeonhole (module, entry);
- ((IDLID)repIDStack.peek ()).appendToName (name);
- currentModule = entry;
- TypedefEntry typedefEntry = stFactory.typedefEntry (entry, (IDLID)repIDStack.peek ());
- typedefEntry.sourceFile (scanner.fileEntry ());
- typedefEntry.comment (token.comment);
- // <d50237> Workaround to place typedefEntry in the _contained vector of
- // this value box entry ONLY when <type_spec> is a constructed type declared
- // at this point (i.e., not an identifier that resolves to a constructed
- // type), so that emitters may generate bindings for it. <daz>
- boolean isConstTypeSpec =
- token.type == Token.Struct || token.type == Token.Union || token.type == Token.Enum;
- // <d50618> Make typedefEntry anonymous. If this line is removed, the
- // entry will be named incorrectly.
- typedefEntry.name ("");
- typedefEntry.type (typeSpec (typedefEntry));
- // <d59067> Value boxes cannot be nested.
- if (typedefEntry.type () instanceof ValueBoxEntry)
- ParseException.nestedValueBox (scanner);
- //typedefEntry.name ("");
- entry.addStateElement (new InterfaceState (InterfaceState.Public, typedefEntry), scanner);
- if (isConstTypeSpec)
- entry.addContained (typedefEntry);
- currentModule = module;
- repIDStack.pop ();
- } // valueBox
-
- /**
- *
- **/
- private void valueForwardDcl (ModuleEntry module, String name, boolean isAbstract)
- throws IOException, ParseException
- {
- ForwardValueEntry entry = stFactory.forwardValueEntry (module, (IDLID)repIDStack.peek ());
- entry.sourceFile (scanner.fileEntry ());
- entry.name (name);
- entry.setInterfaceType(isAbstract ? InterfaceType.ABSTRACT : InterfaceType.NORMAL );
- // Comment must immediately precede "[abstract] value" keyword[s]
- entry.comment (tokenHistory.lookBack (isAbstract? 3 : 2).comment);
- pigeonhole (module, entry);
- } // valueForwardDcl
-
- private void nativeDcl (SymtabEntry entry) throws IOException, ParseException
- {
- match (Token.Native);
- NativeEntry nativeEntry = stFactory.nativeEntry (entry, (IDLID)repIDStack.peek ());
- nativeEntry.sourceFile (scanner.fileEntry ());
- // Comment must immediately precede "native" keyword
- nativeEntry.comment (tokenHistory.lookBack (1).comment);
- nativeEntry.name (token.name);
- match (Token.Identifier);
- pigeonhole (entry, nativeEntry);
- } // nativeDcl
- /**
- *
- **/
- private void constDcl (SymtabEntry entry) throws IOException, ParseException
- {
- match (Token.Const);
- ConstEntry constEntry = stFactory.constEntry (entry, (IDLID)repIDStack.peek ());
- constEntry.sourceFile (scanner.fileEntry ());
- // Comment must immediately precede "const" keyword
- constEntry.comment (tokenHistory.lookBack (1).comment);
- constType (constEntry);
- constEntry.name (token.name);
- match (Token.Identifier);
- match (Token.Equal);
- constEntry.value (constExp (constEntry));
- verifyConstType (constEntry.value (), typeOf (constEntry.type ()));
- pigeonhole (entry, constEntry);
- } // constDcl
-
- /**
- *
- **/
- private void constType (SymtabEntry entry) throws IOException, ParseException
- {
- switch (token.type)
- {
- case Token.Octet:
- entry.type( octetType()) ;
- break ;
- case Token.Long:
- case Token.Short:
- case Token.Unsigned:
- entry.type (integerType (entry));
- break;
- case Token.Char:
- case Token.Wchar:
- entry.type (charType ());
- break;
- case Token.Boolean:
- entry.type (booleanType ());
- break;
- case Token.Float:
- case Token.Double:
- entry.type (floatingPtType ());
- break;
- case Token.String:
- case Token.Wstring:
- entry.type (stringType (entry));
- break;
- case Token.Identifier:
- case Token.DoubleColon:
- entry.type (scopedName (entry.container (), stFactory.primitiveEntry ()));
- if (hasArrayInfo (entry.type ()))
- ParseException.illegalArray (scanner, "const");
- SymtabEntry entryType = typeOf (entry.type ());
- if (!((entryType instanceof PrimitiveEntry) || (entryType instanceof StringEntry)))
- {
- ParseException.wrongType(scanner, entry.fullName (), "primitive or string", entryName (entry.type ()));
- entry.type (qualifiedEntry ("long"));
- }
- else if (entryType instanceof PrimitiveEntry)
- {
- String any = overrideName ("any");
- if (entryType.name().equals (any))
- {
- ParseException.wrongType (scanner, entry.fullName (), "primitive or string (except " + any + ')', any);
- entry.type (qualifiedEntry ("long"));
- }
- }
- break;
- default:
- throw ParseException.syntaxError (scanner, new int [] {
- Token.Long, Token.Short, Token.Unsigned, Token.Char,
- Token.Wchar, Token.Boolean, Token.Float, Token.Double,
- Token.String, Token.Wstring, Token.Identifier,
- Token.DoubleColon }, token.type);
- }
- } // constType
-
- /**
- *
- **/
- private boolean hasArrayInfo (SymtabEntry entry)
- {
- while (entry instanceof TypedefEntry)
- {
- if (((TypedefEntry)entry).arrayInfo ().size () != 0)
- return true;
- entry = entry.type ();
- }
- return false;
- } // hasArrayInfo
-
- /**
- *
- **/
- public static String overrideName (String string)
- {
- String name = (String)overrideNames.get (string);
- return (name == null) ? string : name;
- } // overrideName
-
- // If entry is boolean, expression value must be boolean
- // If entry is float/double, expression value must be float/double
- // If entry is integral, expression value must be integral
- // If entry is string, expression value must be string
-
- /**
- *
- **/
- private void verifyConstType (Expression e, SymtabEntry t)
- {
- Object value = e.value ();
- if (value instanceof BigInteger)
- verifyIntegral ((Number)value, t);
- else if (value instanceof String)
- verifyString (e, t);
- else if (value instanceof Boolean)
- verifyBoolean (t);
- else if (value instanceof Character)
- verifyCharacter (e, t);
- else if (value instanceof Float || value instanceof Double)
- verifyFloat((Number)value, t);
- else if (value instanceof ConstEntry)
- verifyConstType (((ConstEntry)value).value (), t);
- else
- ParseException.wrongExprType (scanner, t.fullName (),
- (value == null) ? "" : value.toString ());
- } // verifyConstType
-
- private static final int MAX_SHORT = 32767;
- private static final int MIN_SHORT = -32768;
- private static final int MAX_USHORT = 65535;
-
- /**
- *
- **/
- private void verifyIntegral (Number n, SymtabEntry t)
- {
- boolean outOfRange = false;
- //KEEP: Useful for debugging com.sun.tools.corba.se.idl.constExpr package
- //System.out.println ("verifyIntegral, n = " + n.toString ());
-
- if (t == qualifiedEntry( "octet" )) {
- if ((n.longValue() > 255) || (n.longValue() < 0))
- outOfRange = true ;
- } else if (t == qualifiedEntry ("long")) {
- if (n.longValue () > Integer.MAX_VALUE || n.longValue() < Integer.MIN_VALUE)
- outOfRange = true;
- } else if (t == qualifiedEntry ("short")) {
- if (n.intValue () > Short.MAX_VALUE || n.intValue () < Short.MIN_VALUE)
- outOfRange = true;
- } else if (t == qualifiedEntry ("unsigned long")) {
- if (n.longValue () > (long)Integer.MAX_VALUE*2+1 || n.longValue() < 0)
- outOfRange = true;
- } else if (t == qualifiedEntry ("unsigned short")) {
- if (n.intValue () > (int) Short.MAX_VALUE*2+1 || n.intValue () < 0)
- outOfRange = true;
- } else if (t == qualifiedEntry ("long long")) {
- // BigInteger required because value being compared may exceed
- // java.lang.Long.MAX_VALUE/MIN_VALUE:
- BigInteger llMax = BigInteger.valueOf (Long.MAX_VALUE);
- BigInteger llMin = BigInteger.valueOf (Long.MIN_VALUE);
- if (((BigInteger)n).compareTo (llMax) > 0 ||
- ((BigInteger)n).compareTo (llMin) < 0)
- outOfRange = true;
- } else if (t == qualifiedEntry ("unsigned long long")) {
- BigInteger ullMax = BigInteger.valueOf (Long.MAX_VALUE).
- multiply (BigInteger.valueOf (2)).
- add (BigInteger.valueOf (1));
- BigInteger ullMin = BigInteger.valueOf (0);
- if (((BigInteger)n).compareTo (ullMax) > 0 ||
- ((BigInteger)n).compareTo (ullMin) < 0)
- outOfRange = true;
- } else {
- String got = null;
- // THIS MUST BE CHANGED; BIGINTEGER IS ALWAYS THE CONTAINER
- /*
- if (n instanceof Short)
- got = "short";
- else if (n instanceof Integer)
- got = "long";
- else
- got = "long long";
- */
- got = "long";
- ParseException.wrongExprType (scanner, t.fullName (), got);
- }
-
- if (outOfRange)
- ParseException.outOfRange (scanner, n.toString (), t.fullName ());
- } // verifyIntegral
-
- /**
- *
- **/
- private void verifyString (Expression e, SymtabEntry t)
- {
- String string = (String)(e.value()) ;
- if (!(t instanceof StringEntry)) {
- ParseException.wrongExprType (scanner, t.fullName (), e.type() );
- } else if (((StringEntry)t).maxSize () != null) {
- Expression maxExp = ((StringEntry)t).maxSize ();
- try {
- Number max = (Number)maxExp.value ();
- if (string.length () > max.intValue ())
- ParseException.stringTooLong (scanner, string, max.toString ());
- } catch (Exception exception) {
- // If the above statement is not valid and throws an
- // exception, then an error occurred and was reported
- // earlier. Move on.
- }
- }
-
- if (!e.type().equals( t.name())) {
- // cannot mix strings and wide strings
- ParseException.wrongExprType (scanner, t.name(), e.type() ) ;
- }
- } // verifyString
-
- /**
- *
- **/
- private void verifyBoolean (SymtabEntry t)
- {
- if (!t.name ().equals (overrideName ("boolean")))
- ParseException.wrongExprType(scanner, t.name(), "boolean");
- } // verifyBoolean
-
- /**
- *
- **/
- private void verifyCharacter (Expression e, SymtabEntry t)
- {
- // Bug fix 4382578: Can't compile a wchar literal.
- // Allow a Character to be either a char or a wchar.
- if (!t.name ().equals (overrideName ("char")) &&
- !t.name ().equals (overrideName ("wchar")) ||
- !t.name().equals(e.type()) )
- ParseException.wrongExprType (scanner, t.fullName(), e.type() ) ;
- } // verifyCharacter
-
- /**
- *
- **/
- private void verifyFloat (Number f, SymtabEntry t)
- {
- // <d52042> Added range checking for floats.
- //if (!(t.name ().equals (overrideName ("float")) ||
- // t.name ().equals (overrideName ("double"))))
- // ParseException.wrongExprType (scanner,
- // t.fullName (), (f instanceof Float) ? "float" : "double");
- //KEEP: Useful for debugging com.sun.tools.corba.se.idl.constExpr package
- //System.out.println ("verifyFloat, f = " + f.toString ());
- boolean outOfRange = false;
- if (t.name ().equals (overrideName ("float")))
- {
- double absVal = (f.doubleValue () < 0.0) ?
- f.doubleValue () * -1.0 : f.doubleValue ();
- if ((absVal != 0.0) &&
- (absVal > Float.MAX_VALUE || absVal < Float.MIN_VALUE))
- outOfRange = true;
- }
- else if (t.name ().equals (overrideName ("double")))
- {
- // Cannot check range of double until BigDecimal is the basis
- // of all floating-point types. Currently, it is Double. The
- // parser will fail when instantiating a Double with an exception.
- }
- else
- {
- ParseException.wrongExprType (scanner, t.fullName (),
- (f instanceof Float) ? "float" : "double");
- }
- if (outOfRange)
- ParseException.outOfRange (scanner, f.toString (), t.fullName ());
- } // verifyFloat
-
- /**
- *
- **/
- Expression constExp (SymtabEntry entry) throws IOException, ParseException
- {
- // Parse the expression.
- Expression expr = orExpr (null, entry);
-
- // Set its target type.
- if (expr.type() == null)
- expr.type (entry.typeName ());
- // Compute its value and <d53042> coerce it to the target type.
- try
- {
- expr.evaluate ();
-
- // <d54042> Coerces integral value to Double if an integer literal
- // was used to initialize a floating-point constant expression.
- if (expr instanceof Terminal &&
- expr.value () instanceof BigInteger &&
- (overrideName (expr.type ()).equals ("float") ||
- overrideName (expr.type ()).indexOf ("double") >= 0))
- {
- expr.value (new Double (((BigInteger)expr.value ()).doubleValue ()));
- }
- }
- catch (EvaluationException exception)
- {
- ParseException.evaluationError (scanner, exception.toString ());
- }
- return expr;
- } // constExp
-
- /**
- *
- **/
- private Expression orExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
- {
- if (e == null)
- e = xorExpr (null, entry);
- else
- {
- BinaryExpr b = (BinaryExpr)e;
- b.right (xorExpr (null, entry));
- e.rep (e.rep () + b.right ().rep ());
- }
- if (token.equals (Token.Bar))
- {
- match (token.type);
- Or or = exprFactory.or (e, null);
- or.type (entry.typeName ());
- or.rep (e.rep () + " | ");
- return orExpr (or, entry);
- }
- return e;
- } // orExpr
-
- /**
- *
- **/
- private Expression xorExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
- {
- if (e == null)
- e = andExpr (null, entry);
- else
- {
- BinaryExpr b = (BinaryExpr)e;
- b.right (andExpr (null, entry));
- e.rep (e.rep () + b.right ().rep ());
- }
- if (token.equals (Token.Carat))
- {
- match (token.type);
- Xor xor = exprFactory.xor (e, null);
- xor.rep (e.rep () + " ^ ");
- xor.type (entry.typeName ());
- return xorExpr (xor, entry);
- }
- return e;
- } // xorExpr
-
- /**
- *
- **/
- private Expression andExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
- {
- if (e == null)
- e = shiftExpr (null, entry);
- else
- {
- BinaryExpr b = (BinaryExpr)e;
- b.right (shiftExpr (null, entry));
- e.rep (e.rep () + b.right ().rep ());
- }
- if (token.equals (Token.Ampersand))
- {
- match (token.type);
- And and = exprFactory.and (e, null);
- and.rep(e.rep () + " & ");
- and.type (entry.typeName ());
- return andExpr (and, entry);
- }
- return e;
- } // andExpr
-
- /**
- *
- **/
- private Expression shiftExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
- {
- if (e == null)
- e = addExpr (null, entry);
- else
- {
- BinaryExpr b = (BinaryExpr)e;
- b.right (addExpr (null, entry));
- e.rep (e.rep () + b.right ().rep ());
- }
- if (token.equals (Token.ShiftLeft))
- {
- match (token.type);
- ShiftLeft sl = exprFactory.shiftLeft (e, null);
- sl.type (entry.typeName ());
- sl.rep (e.rep () + " << ");
- return shiftExpr (sl, entry);
- }
- if (token.equals (Token.ShiftRight))
- {
- match (token.type);
- ShiftRight sr = exprFactory.shiftRight (e, null);
- sr.type (entry.typeName ());
- sr.rep (e.rep () + " >> ");
- return shiftExpr (sr, entry);
- }
- return e;
- } // shiftExpr
-
- /**
- *
- **/
- private Expression addExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
- {
- if (e == null)
- e = multExpr (null, entry);
- else
- {
- BinaryExpr b = (BinaryExpr)e;
- b.right (multExpr (null, entry));
- e.rep (e.rep () + b.right ().rep ());
- }
- if (token.equals (Token.Plus))
- {
- match (token.type);
- Plus p = exprFactory.plus (e, null);
- p.type (entry.typeName ());
- p.rep (e.rep () + " + ");
- return addExpr (p, entry);
- }
- if (token.equals (Token.Minus))
- {
- match (token.type);
- Minus m = exprFactory.minus (e, null);
- m.type (entry.typeName ());
- m.rep (e.rep () + " - ");
- return addExpr (m, entry);
- }
- return e;
- } // addExpr
-
- /**
- *
- **/
- private Expression multExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
- {
- if (e == null)
- e = unaryExpr (entry);
- else
- {
- BinaryExpr b = (BinaryExpr)e;
- b.right (unaryExpr (entry));
- e.rep (e.rep () + b.right ().rep ());
- }
- if (token.equals (Token.Star))
- {
- match (token.type);
- Times t = exprFactory.times (e, null);
- t.type (entry.typeName ());
- t.rep (e.rep () + " * ");
- return multExpr (t, entry);
- }
- if (token.equals (Token.Slash))
- {
- match (token.type);
- Divide d = exprFactory.divide (e, null);
- d.type (entry.typeName ());
- d.rep (e.rep () + " / ");
- return multExpr (d, entry);
- }
- if (token.equals (Token.Percent))
- {
- match (token.type);
- Modulo m = exprFactory.modulo (e, null);
- m.type (entry.typeName ());
- m.rep (e.rep () + " % ");
- return multExpr (m, entry);
- }
- return e;
- } // multExpr
-
- /**
- *
- **/
- private Expression unaryExpr (SymtabEntry entry) throws IOException, ParseException
- {
- if (token.equals (Token.Plus))
- {
- match (token.type);
- Expression e = primaryExpr (entry);
- Positive pos = exprFactory.positive (e);
- pos.type (entry.typeName());
- pos.rep ('+' + e.rep());
- return pos;
- }
- if (token.equals (Token.Minus))
- {
- match (token.type);
- Expression e = primaryExpr (entry);
- Negative neg = exprFactory.negative (e);
- neg.type (entry.typeName());
- neg.rep ('-' + e.rep());
- return neg;
- }
- if (token.equals (Token.Tilde))
- {
- match (token.type);
- Expression e = primaryExpr (entry);
- Not not = exprFactory.not (e);
- not.type (entry.typeName());
- not.rep ('~' + e.rep());
- return not;
- }
- return primaryExpr (entry);
- } // unaryExpr
-
- /**
- *
- **/
- private Expression primaryExpr (SymtabEntry entry)
- throws IOException, ParseException
- {
- Expression primary = null;
- if (parsingConditionalExpr)
- {
- prep.token = token; // Give current token to preprocessor
- primary = prep.primaryExpr (entry);
- token = prep.token; // Get the current token from preprocessor
- }
- else
- switch (token.type)
- {
- case Token.Identifier:
- case Token.DoubleColon:
- ConstEntry expectedC = stFactory.constEntry ();
- expectedC.value (exprFactory.terminal ("1", BigInteger.valueOf (1)));
- SymtabEntry ref = scopedName (entry.container (), expectedC);
- if (!(ref instanceof ConstEntry))
- {
- ParseException.invalidConst (scanner, ref.fullName ());
- // An error occurred. Just give it some bogus value. <daz>
- //primary = exprFactory.terminal ("1", new Long (1));
- primary = exprFactory.terminal ("1", BigInteger.valueOf (1));
- }
- else
- primary = exprFactory.terminal ((ConstEntry)ref);
- break;
- case Token.BooleanLiteral:
- case Token.CharacterLiteral:
- case Token.IntegerLiteral:
- case Token.FloatingPointLiteral:
- case Token.StringLiteral:
- primary = literal (entry);
- break;
- case Token.LeftParen:
- match (Token.LeftParen);
- primary = constExp (entry);
- match (Token.RightParen);
- primary.rep ('(' + primary.rep () + ')');
- break;
- default:
- throw ParseException.syntaxError (scanner, new int [] {
- Token.Identifier, Token.DoubleColon, Token.Literal, Token.LeftParen},
- token.type);
- }
- return primary;
- } // primaryExpr
-
- /**
- *
- **/
- Expression literal (SymtabEntry entry) throws IOException, ParseException
- {
- String string = token.name;
- Expression literal = null;
- switch (token.type)
- {
- case Token.IntegerLiteral:
- match (Token.IntegerLiteral);
- try
- {
- literal = exprFactory.terminal (string, parseString (string));
- literal.type (entry.typeName ());
- }
- catch (NumberFormatException exception)
- {
- ParseException.notANumber (scanner, string);
- literal = exprFactory.terminal ("0", BigInteger.valueOf (0));
- }
- break;
- case Token.CharacterLiteral:
- boolean isWide = token.isWide();
- match (Token.CharacterLiteral);
- literal = exprFactory.terminal ("'" + string.substring (1) + "'",
- new Character (string.charAt (0)), isWide );
- break;
- case Token.FloatingPointLiteral:
- match (Token.FloatingPointLiteral);
- try
- {
- literal = exprFactory.terminal (string, new Double (string));
- literal.type (entry.typeName ());
- }
- catch (NumberFormatException e)
- {
- ParseException.notANumber (scanner, string);
- }
- break;
- case Token.BooleanLiteral:
- literal = booleanLiteral ();
- break;
- case Token.StringLiteral:
- literal = stringLiteral ();
- break;
- default:
- throw ParseException.syntaxError (scanner, Token.Literal,token.type);
- }
- return literal;
- } // literal
-
- /**
- *
- **/
- private BigInteger parseString (String string) throws NumberFormatException
- {
- int radix = 10;
- if (string.length() > 1)
- if (string.charAt (0) == '0')
- if (string.charAt (1) == 'x' || string.charAt (1) == 'X')
- {
- string = string.substring (2);
- radix = 16;
- }
- else
- radix = 8;
- return new BigInteger (string, radix);
- } // parseString
-
- /**
- *
- **/
- private Terminal booleanLiteral () throws IOException, ParseException
- {
- Boolean bool = null;
- if (token.name.equals ("TRUE"))
- bool = new Boolean (true);
- else if (token.name.equals ("FALSE"))
- bool = new Boolean (false);
- else
- {
- ParseException.invalidConst (scanner, token.name);
- bool = new Boolean (false);
- }
- String name = token.name;
- match (Token.BooleanLiteral);
- return exprFactory.terminal (name, bool);
- } // booleanLiteral
-
- /**
- *
- **/
- private Expression stringLiteral () throws IOException, ParseException
- {
- // If string literals appear together, concatenate them. Ie:
- // "Twas " "brillig " "and " "the " "slithy " "toves"
- // becomes
- // "Twas brillig and the slithy toves"
- boolean isWide = token.isWide() ;
- String literal = "";
- do
- {
- literal += token.name;
- match (Token.StringLiteral);
- } while (token.equals (Token.StringLiteral));
- Expression stringExpr = exprFactory.terminal (literal, isWide );
- stringExpr.rep ('"' + literal + '"');
- return stringExpr;
- } // stringLiteral
-
- /**
- *
- **/
- private Expression positiveIntConst (SymtabEntry entry) throws IOException, ParseException
- {
- Expression e = constExp (entry);
- Object value = e.value ();
- while (value instanceof ConstEntry)
- value = ((ConstEntry)value).value ().value ();
- if (!(value instanceof Number) || value instanceof Float || value instanceof Double)
- {
- ParseException.notPositiveInt (scanner, e.rep ());
- //e = exprFactory.terminal ("1", new Long (1));
- e = exprFactory.terminal ("1", BigInteger.valueOf (1));
- }
- //else if (((Number)value).longValue () <= 0) {
- // ParseException.notPositiveInt (scanner, value.toString ());
- // e = exprFactory.terminal ("1", new Long (1)); }
- else if (((BigInteger)value).compareTo (BigInteger.valueOf (0)) <= 0)
- {
- ParseException.notPositiveInt (scanner, value.toString ());
- //e = exprFactory.terminal ("1", new Long (1)); <daz>
- e = exprFactory.terminal ("1", BigInteger.valueOf (1));
- }
- return e;
- } // positiveIntConst
-
- /**
- *
- **/
- private SymtabEntry typeDcl (SymtabEntry entry) throws IOException, ParseException
- {
- switch (token.type)
- {
- case Token.Typedef:
- match (Token.Typedef);
- return typeDeclarator (entry);
- case Token.Struct:
- return structType (entry);
- case Token.Union:
- return unionType (entry);
- case Token.Enum:
- return enumType (entry);
- default:
- throw ParseException.syntaxError (scanner, new int [] {
- Token.Typedef, Token.Struct, Token.Union, Token.Enum}, token.type);
- }
- } // typeDcl
-
- /**
- *
- **/
- private TypedefEntry typeDeclarator (SymtabEntry entry) throws IOException, ParseException
- {
- TypedefEntry typedefEntry = stFactory.typedefEntry (entry, (IDLID)repIDStack.peek ());
- typedefEntry.sourceFile (scanner.fileEntry ());
- // Comment must immediately precede "typedef" keyword
- typedefEntry.comment (tokenHistory.lookBack (1).comment);
- typedefEntry.type (typeSpec (entry));
- Vector typedefList = new Vector ();
- declarators (typedefEntry, typedefList);
- for (Enumeration e = typedefList.elements(); e.hasMoreElements();)
- pigeonhole (entry, (SymtabEntry)e.nextElement ());
- return typedefEntry;
- } // typeDeclarator
-
- /**
- *
- **/
- private SymtabEntry typeSpec (SymtabEntry entry) throws IOException, ParseException
- {
- return ((token.type == Token.Struct) ||
- (token.type == Token.Union) ||
- (token.type == Token.Enum))
- ? constrTypeSpec (entry)
- : simpleTypeSpec (entry, true);
- } // typeSpec
-
- /**
- *
- **/
- private SymtabEntry simpleTypeSpec (SymtabEntry entry,
- boolean mustBeReferencable ) throws IOException, ParseException
- {
- // <f46082.40>
- //if ((token.type == Token.Identifier) ||
- // (token.type == Token.DoubleColon) ||
- // (token.type == Token.Object)) {
- if ((token.type == Token.Identifier) ||
- (token.type == Token.DoubleColon) ||
- (token.type == Token.Object) ||
- (token.type == Token.ValueBase))
- {
- SymtabEntry container = ((entry instanceof InterfaceEntry) ||
- (entry instanceof ModuleEntry) ||
- (entry instanceof StructEntry) ||
- (entry instanceof UnionEntry))
- ? entry
- : entry.container ();
- return scopedName (container, stFactory.primitiveEntry (),
- mustBeReferencable);
- }
- return ((token.type == Token.Sequence) ||
- (token.type == Token.String) ||
- (token.type == Token.Wstring))
- ? templateTypeSpec (entry)
- : baseTypeSpec (entry);
- } // simpleTypeSpec
-
- /**
- *
- **/
- private SymtabEntry baseTypeSpec (SymtabEntry entry) throws IOException, ParseException
- {
- switch (token.type)
- {
- case Token.Float:
- case Token.Double:
- return floatingPtType ();
- case Token.Long:
- case Token.Short:
- case Token.Unsigned:
- return integerType (entry);
- case Token.Char:
- case Token.Wchar:
- return charType ();
- case Token.Boolean:
- return booleanType ();
- case Token.Octet:
- return octetType ();
- case Token.Any:
- return anyType ();
- // NOTE: Object and ValueBase are <base_type_spec>s, but both
- // are processed at simpleTypeSpec(), not here. parmTypeSpec()
- // directly checks for these types. Could make baseTypeSpec() do
- // the same
- default:
- throw ParseException.syntaxError (scanner, new int [] {
- Token.Float, Token.Double, Token.Long, Token.Short,
- Token.Unsigned, Token.Char, Token.Wchar, Token.Boolean,
- Token.Octet, Token.Any}, token.type);
- }
- } // baseTypeSpec
-
- /**
- *
- **/
- private SymtabEntry templateTypeSpec (SymtabEntry entry) throws IOException, ParseException
- {
- switch (token.type)
- {
- case Token.Sequence:
- return sequenceType (entry);
- case Token.String:
- case Token.Wstring:
- return stringType (entry);
- }
- throw ParseException.syntaxError (scanner, new int [] {Token.Sequence, Token.String, Token.Wstring}, token.type);
- } // templateTypeSpec
-
- /**
- *
- **/
- private SymtabEntry constrTypeSpec (SymtabEntry entry) throws IOException, ParseException
- {
- switch (token.type)
- {
- case Token.Struct:
- return structType (entry);
- case Token.Union:
- return unionType (entry);
- case Token.Enum:
- return enumType (entry);
- }
- throw ParseException.syntaxError (scanner, new int [] {Token.Struct, Token.Union, Token.Enum}, token.type);
- } // constrTypeSpec
-
- /**
- *
- **/
- private void declarators (TypedefEntry entry, Vector list) throws IOException, ParseException
- {
- for (; ; match (Token.Comma))
- {
- TypedefEntry newEntry = (TypedefEntry)entry.clone ();
- declarator (newEntry);
- if (isntInList (list, newEntry.name ()))
- list.addElement (newEntry);
- if (token.type != Token.Comma)
- break;
- }
- } // declarators
-
- /**
- *
- **/
- private void declarator (TypedefEntry entry) throws IOException, ParseException
- {
- entry.name (token.name);
- // If the declarator is commented then override the comment cloned from the parent
- // entry. <08aug1997daz>
- if (!token.comment.text ().equals (""))
- entry.comment (token.comment);
- match (Token.Identifier);
- while (token.type == Token.LeftBracket)
- fixedArraySize (entry);
- } // declarator
-
- /**
- *
- **/
- private PrimitiveEntry floatingPtType () throws IOException, ParseException
- {
- String name = "double";
- if (token.type == Token.Float)
- {
- match (Token.Float);
- name = "float";
- }
- else if (token.type == Token.Double)
- match (Token.Double);
- else
- {
- int [] expected = {Token.Float, Token.Double};
- ParseException.syntaxError (scanner, new int [] {Token.Float, Token.Double }, token.type);
- }
- PrimitiveEntry ret = null;
- try
- {
- ret = (PrimitiveEntry)qualifiedEntry (name);
- }
- catch (ClassCastException exception)
- {
- ParseException.undeclaredType (scanner, name);
- }
- return ret;
- } // floatingPtType
-
- /**
- *
- **/
- private PrimitiveEntry integerType (SymtabEntry entry) throws IOException, ParseException
- {
- String name = "";
- if (token.type == Token.Unsigned)
- {
- match (Token.Unsigned);
- name = "unsigned ";
- }
- name += signedInt();
- PrimitiveEntry ret = null;
- try
- {
- ret = (PrimitiveEntry) qualifiedEntry (name);
- }
- catch (ClassCastException exception)
- {
- ParseException.undeclaredType (scanner, name);
- }
- return ret;
- } // integerType
-
- /**
- *
- **/
- private String signedInt () throws IOException, ParseException
- {
- String ret = "long";
- if (token.type == Token.Long)
- {
- match (Token.Long);
- // <signedInt'> ::= "long" | e
- if (token.type == Token.Long)
- {
- ret = "long long";
- match (Token.Long);
- }
- }
- else if (token.type == Token.Short)
- {
- ret = "short";
- match (Token.Short);
- }
- else
- ParseException.syntaxError (scanner, new int [] {Token.Long, Token.Short}, token.type);
- return ret;
- } // signedInt
-
- /**
- *
- **/
- private PrimitiveEntry charType () throws IOException, ParseException
- {
- String tokenName;
- if (token.type == Token.Char)
- {
- match (Token.Char);
- tokenName = "char";
- }
- else
- {
- match (Token.Wchar);
- tokenName = "wchar";
- }
- PrimitiveEntry ret = null;
- try
- {
- ret = (PrimitiveEntry) qualifiedEntry (tokenName);
- }
- catch (ClassCastException exception)
- {
- ParseException.undeclaredType (scanner, overrideName (tokenName));
- }
- return ret;
- } // charType
-
- /**
- *
- **/
- private PrimitiveEntry booleanType () throws IOException, ParseException
- {
- PrimitiveEntry ret = null;
- match (Token.Boolean);
- try
- {
- ret = (PrimitiveEntry) qualifiedEntry ("boolean");
- }
- catch (ClassCastException exception)
- {
- ParseException.undeclaredType (scanner, overrideName ("boolean"));
- }
- return ret;
- } // booleanType
-
- /**
- *
- **/
- private PrimitiveEntry octetType () throws IOException, ParseException
- {
- PrimitiveEntry ret = null;
- match (Token.Octet);
- try
- {
- ret = (PrimitiveEntry) qualifiedEntry ("octet");
- }
- catch (ClassCastException exception)
- {
- ParseException.undeclaredType (scanner, overrideName ("octet"));
- }
- return ret;
- } // octetType
-
- /**
- *
- **/
- private SymtabEntry anyType () throws IOException, ParseException
- {
- match (Token.Any);
- try
- {
- return qualifiedEntry ("any");
- }
- catch (ClassCastException exception)
- {
- ParseException.undeclaredType (scanner, overrideName ("any"));
- return null;
- }
- } // anyType
-
- /**
- *
- **/
- private StructEntry structType (SymtabEntry entry) throws IOException,
- ParseException
- {
- match (Token.Struct);
- String name = token.name;
- match (Token.Identifier);
- StructEntry structEntry = null ;
-
- if (token.type == Token.LeftBrace) {
- repIDStack.push(((IDLID)repIDStack.peek ()).clone ()) ;
- structEntry = makeStructEntry( name, entry, false ) ;
- ((IDLID)repIDStack.peek ()).appendToName (name);
- prep.openScope (structEntry);
- match (Token.LeftBrace) ;
- member (structEntry) ;
- memberList2 (structEntry) ;
- prep.closeScope (structEntry);
- match (Token.RightBrace) ;
- repIDStack.pop() ;
- } else if (token.equals( Token.Semicolon )) {
- structEntry = makeStructEntry( name, entry, true ) ;
- } else {
- throw ParseException.syntaxError (scanner,
- new int[] { Token.Semicolon, Token.LeftBrace }, token.type);
- }
- return structEntry;
- } // structType
-
- private StructEntry makeStructEntry( String name, SymtabEntry entry,
- boolean isForward )
- {
- StructEntry structEntry = stFactory.structEntry (entry,
- (IDLID)repIDStack.peek () );
- structEntry.isReferencable( !isForward ) ;
- structEntry.sourceFile (scanner.fileEntry ());
- structEntry.name (name);
- // Comment must immediately preceed "struct" keyword
- structEntry.comment (tokenHistory.lookBack (1).comment);
- pigeonhole( entry, structEntry ) ;
- return structEntry ;
- }
-
- /**
- *
- **/
- private void memberList2 (StructEntry entry) throws IOException
- {
- while (token.type != Token.RightBrace)
- member (entry);
- } // memberList2
-
- /**
- *
- **/
- private void member (StructEntry entry) throws IOException
- {
- TypedefEntry newEntry = stFactory.typedefEntry(entry, (IDLID)repIDStack.peek());
- newEntry.sourceFile (scanner.fileEntry ());
- // comment must immediately precede <type_spec> lexeme
- newEntry.comment (token.comment);
- try
- {
- newEntry.type (typeSpec (entry));
- if (newEntry.type () == entry)
- throw ParseException.recursive (scanner, entry.fullName (),
- (token.name == null) ? "" : token.name);
- // <d46094> Exception cannot appear within a struct, union, or exception
- if (typeOf (newEntry) instanceof ExceptionEntry)
- throw ParseException.illegalException (scanner, entryName (entry));
- declarators (newEntry, entry.members ());
- match (Token.Semicolon);
- }
- catch (ParseException exception)
- {
- skipToSemicolon ();
- }
- } // member
-
- /**
- *
- **/
- private final boolean isConstTypeSpec (Token t)
- {
- return (t.type == Token.Struct || t.type == Token.Union || t.type == Token.Enum);
- } // isConstTypeSpec
-
- /**
- *
- **/
- private UnionEntry unionType (SymtabEntry entry) throws IOException, ParseException
- {
- match (Token.Union) ;
- String name = token.name ;
- match (Token.Identifier) ;
- UnionEntry unionEntry = null ;
-
- if (token.type == Token.Switch) {
- repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
- unionEntry = makeUnionEntry( name, entry, false ) ;
- ((IDLID)repIDStack.peek ()).appendToName (name);
- match (Token.Switch);
- match (Token.LeftParen);
- unionEntry.type (switchTypeSpec (unionEntry));
- match (Token.RightParen);
- prep.openScope (unionEntry);
- match (Token.LeftBrace);
- switchBody (unionEntry);
- verifyUnion (unionEntry);
- prep.closeScope (unionEntry);
- match (Token.RightBrace);
- repIDStack.pop ();
- } else if (token.equals( Token.Semicolon )) {
- unionEntry = makeUnionEntry( name, entry, true ) ;
- } else {
- throw ParseException.syntaxError (scanner,
- new int[] { Token.Semicolon, Token.Switch }, token.type);
- }
-
- return unionEntry ;
- } // unionType
-
- private UnionEntry makeUnionEntry( String name, SymtabEntry entry,
- boolean isForward )
- {
- UnionEntry unionEntry = stFactory.unionEntry (entry,
- (IDLID)repIDStack.peek () );
- unionEntry.isReferencable( !isForward ) ;
- unionEntry.sourceFile (scanner.fileEntry ());
- unionEntry.name (name);
- // Comment must immediately preceed "union" keyword
- unionEntry.comment (tokenHistory.lookBack (1).comment);
- pigeonhole( entry, unionEntry ) ;
- return unionEntry ;
- }
-
- /**
- *
- **/
- private void verifyUnion (UnionEntry u)
- {
- if (u.typeName ().equals (overrideName ("boolean")))
- {
- if (caseCount (u) > 2)
- ParseException.noDefault (scanner);
- }
- else if (u.type () instanceof EnumEntry)
- {
- if (caseCount (u) > ((EnumEntry)u.type ()).elements ().size ())
- ParseException.noDefault (scanner);
- }
- } // verifyUnion
-
- /**
- *
- **/
- private long caseCount (UnionEntry u)
- {
- long cases = 0;
- Enumeration branches = u.branches ().elements ();
- while (branches.hasMoreElements ())
- {
- UnionBranch branch = (UnionBranch)branches.nextElement ();
- cases += branch.labels.size ();
- if (branch.isDefault)
- ++cases;
- }
- return cases;
- } // caseCount
-
- /**
- *
- **/
- private SymtabEntry switchTypeSpec (UnionEntry entry) throws IOException, ParseException
- {
- SymtabEntry ret = null;
- switch (token.type)
- {
- case Token.Long:
- case Token.Short:
- case Token.Unsigned:
- return integerType (entry);
- case Token.Char:
- case Token.Wchar:
- return charType();
- case Token.Boolean:
- return booleanType();
- case Token.Enum:
- return enumType (entry);
- case Token.Identifier:
- case Token.DoubleColon:
- ret = scopedName (entry, stFactory.primitiveEntry ());
- if (hasArrayInfo (entry.type ()))
- ParseException.illegalArray (scanner, "switch");
- SymtabEntry retType = typeOf (ret);
- if (!(retType instanceof EnumEntry || retType instanceof PrimitiveEntry))
- ParseException.wrongType (scanner, ret.fullName (),
- "long, unsigned long, short, unsigned short, char, boolean, enum",
- entryName (ret.type ()));
- else if (ret instanceof PrimitiveEntry)
- {
- SymtabEntry octet = qualifiedEntry ("octet");
- SymtabEntry flt = qualifiedEntry ("float");
- SymtabEntry dbl = qualifiedEntry ("double");
- if (retType == octet || retType == flt || retType == dbl)
- ParseException.wrongType (scanner, ret.fullName(),
- "long, unsigned long, short, unsigned short, char, boolean, enum",
- entryName(ret.type ()));
- }
- break;
- default:
- throw ParseException.syntaxError (scanner, new int [] {
- Token.Long, Token.Short, Token.Unsigned, Token.Char,
- Token.Boolean, Token.Enum, Token.Identifier,
- Token.DoubleColon }, token.type);
- }
- return ret;
- } // switchTypeSpec
-
- // This is only used by the union methods
- UnionBranch defaultBranch = null;
-
- /**
- *
- **/
- private void switchBody (UnionEntry entry) throws IOException, ParseException
- {
- caseProd (entry);
- while (!token.equals (Token.RightBrace))
- caseProd (entry);
- entry.defaultBranch ((defaultBranch == null) ? null : defaultBranch.typedef);
- defaultBranch = null;
- } // switchBody
-
- /**
- *
- **/
- private void caseProd (UnionEntry entry) throws IOException, ParseException
- {
- UnionBranch branch = new UnionBranch ();
- entry.addBranch (branch);
- caseLabel (entry, branch);
- while (token.equals (Token.Case) || token.equals (Token.Default))
- caseLabel (entry, branch);
- elementSpec (entry, branch);
- match (Token.Semicolon);
- } // caseProd
-
- /**
- *
- **/
- private void caseLabel (UnionEntry entry, UnionBranch branch) throws IOException, ParseException
- {
- if (token.type == Token.Case)
- {
- match (Token.Case);
- ConstEntry tmpEntry = stFactory.constEntry (entry, (IDLID)repIDStack.peek ());
- tmpEntry.sourceFile (scanner.fileEntry ());
- tmpEntry.type (entry);
-
- Expression label;
- SymtabEntry type = typeOf (entry.type ());
- if (type instanceof EnumEntry)
- label = matchEnum ((EnumEntry)type);
- else
- {
- label = constExp (tmpEntry);
- verifyConstType (label, type);
- }
- if (entry.has (label))
- ParseException.branchLabel (scanner, label.rep ());
- branch.labels.addElement (label);
- match (Token.Colon);
- }
- else if (token.type == Token.Default)
- {
- match (Token.Default);
- match (Token.Colon);
- if (entry.defaultBranch () != null)
- ParseException.alreadyDefaulted (scanner);
- branch.isDefault = true;
- defaultBranch = branch;
- }
- else
- throw ParseException.syntaxError (scanner, new int [] { Token.Case, Token.Default }, token.type);
- } // caselabel
-
- /**
- *
- **/
- private Expression matchEnum (EnumEntry entry) throws IOException, ParseException
- {
- // Get the symbol table entry for the case label based on the
- // scope of the EnumEntry, NOT the UnionEntry (the union could be
- // in a different scope than the enum). Given
- // module M { enum E {A, B, C, D}; };
- // a case label for A could be one of the following:
- // case A:
- // case M::A:
- // case ::M::A:
- SymtabEntry label = scopedName (entry.container(), new SymtabEntry ());
- return exprFactory.terminal (label.name (), false);
- } // matchEnum
-
- /**
- *
- **/
- private void elementSpec (UnionEntry entry, UnionBranch branch) throws IOException, ParseException
- {
- TypedefEntry typedef = stFactory.typedefEntry (entry, (IDLID)repIDStack.peek ());
- typedef.sourceFile (scanner.fileEntry ());
- // Comment must immediately precede <type_spec> lexeme
- typedef.comment (token.comment);
- typedef.type (typeSpec (entry));
- if (typedef.type () == entry)
- throw ParseException.recursive (scanner, entry.fullName (), (token.name == null)? "" : token.name);
- // <d46094> Exception cannot appear within a struct, union, or exception
- if (typeOf (typedef) instanceof ExceptionEntry)
- throw ParseException.illegalException (scanner, entryName (entry));
- declarator (typedef);
- branch.typedef = typedef;
- // Ensure a branch with the same name doesn't already exist.
- if (entry.has (typedef))
- ParseException.branchName (scanner, typedef.name ());
- } // elementSpec
-
- /**
- *
- **/
- private EnumEntry enumType (SymtabEntry entry) throws IOException, ParseException
- {
- match (Token.Enum);
- EnumEntry enumEntry = newEnumEntry (entry);
- // comment must immediately precede "enum" keyword
- enumEntry.comment (tokenHistory.lookBack (1).comment);
- enumEntry.name (token.name);
- match (Token.Identifier);
- prep.openScope (enumEntry);
- match (Token.LeftBrace);
- if (isntInStringList (enumEntry.elements (), token.name))
- {
- enumEntry.addElement (token.name);
- SymtabEntry element = new SymtabEntry (entry, (IDLID)repIDStack.peek ());
- // if block taken from EnumEntry ctor
- if (element.module ().equals (""))
- element.module (element.name ());
- else if (!element.name ().equals (""))
- element.module (element.module () + "/" + element.name ());
- element.name (token.name);
- // <d50237> Place the SymtabEntry representing this enumeration
- // contant into the SymtabEntry defining its scope (e.g., InterfaceEntry,
- // ValueEntry, etc.) rather than the SymtabEntry passed in, which
- // may not define the contant's scope (e.g., TypedefEntry).
- //pigeonhole (entry, element); } <daz>
- pigeonhole (enumEntry.container (), element);
- }
- match (Token.Identifier);
- enumType2 (enumEntry);
- prep.closeScope (enumEntry);
- match (Token.RightBrace);
- return enumEntry;
- } // enumType
-
- /**
- *
- **/
- private void enumType2 (EnumEntry entry) throws IOException, ParseException
- {
- while (token.type == Token.Comma)
- {
- match (Token.Comma);
- String name = token.name;
- match (Token.Identifier);
- if (isntInStringList (entry.elements (), name))
- {
- entry.addElement (name);
- SymtabEntry element = new SymtabEntry (entry.container (), (IDLID)repIDStack.peek ());
- // if block taken from EnumEntry ctor:
- if (element.module ().equals (""))
- element.module (element.name ());
- else if (!element.name().equals (""))
- element.module (element.module () + "/" + element.name ());
- element.name (name);
- pigeonhole (entry.container (), element);
- }
- }
- } // enumType2
-
- /**
- *
- **/
- private SequenceEntry sequenceType (SymtabEntry entry) throws IOException, ParseException
- {
- match (Token.Sequence);
- match (Token.LessThan);
-
- SequenceEntry newEntry = newSequenceEntry (entry);
- SymtabEntry tsentry = simpleTypeSpec (newEntry, false );
- newEntry.type (tsentry);
- if (!tsentry.isReferencable()) {
- // This is a sequence type that is referencing an
- // incomplete forward declaration of a struct or
- // union. Save the sequence in a list for later
- // backpatching.
- try {
- List fwdTypes = (List)tsentry.dynamicVariable( ftlKey ) ;
- if (fwdTypes == null) {
- fwdTypes = new ArrayList() ;
- tsentry.dynamicVariable( ftlKey, fwdTypes ) ;
- }
- fwdTypes.add( newEntry ) ;
- } catch (NoSuchFieldException exc) {
- throw new IllegalStateException() ;
- }
- }
-
- if (token.type == Token.Comma)
- {
- match (Token.Comma);
- ConstEntry tmpEntry = stFactory.constEntry (newEntry, (IDLID)repIDStack.peek ());
- tmpEntry.sourceFile (scanner.fileEntry ());
- tmpEntry.type (qualifiedEntry ("long"));
- newEntry.maxSize (positiveIntConst (tmpEntry));
- verifyConstType (newEntry.maxSize(), qualifiedEntry ("long"));
- }
- match (Token.GreaterThan);
- return newEntry;
- } // sequenceType
-
- /**
- *
- **/
- private StringEntry stringType (SymtabEntry entry) throws IOException, ParseException
- {
- StringEntry string = stFactory.stringEntry ();
- if (token.type == Token.String)
- {
- string.name (overrideName ("string"));
- match (Token.String);
- }
- else
- {
- string.name (overrideName ("wstring"));
- match (Token.Wstring);
- }
- string.maxSize (stringType2 (entry));
- return string;
- } // stringType
-
- /**
- *
- **/
- private Expression stringType2 (SymtabEntry entry) throws IOException, ParseException
- {
- if (token.type == Token.LessThan)
- {
- match (Token.LessThan);
-
- // START IBM.11417 failure in the IDL compiler
- //Expression maxSize = positiveIntConst (entry); IBM.11417
-
- ConstEntry tmpEntry = stFactory.constEntry (entry, (IDLID)repIDStack.peek
-());
- tmpEntry.sourceFile (scanner.fileEntry ());
- tmpEntry.type (qualifiedEntry ("long"));
- Expression maxSize = positiveIntConst (tmpEntry);
-
- // END IBM.11417
-
- verifyConstType (maxSize, qualifiedEntry ("long"));
- match (Token.GreaterThan);
- return maxSize;
- }
- return null;
- } // stringType2
-
- /**
- *
- **/
- private void fixedArraySize (TypedefEntry entry) throws IOException, ParseException
- {
- match (Token.LeftBracket);
- ConstEntry tmpEntry = stFactory.constEntry (entry, (IDLID)repIDStack.peek ());
- tmpEntry.sourceFile (scanner.fileEntry ());
- // <d58058> Set type of tmpExpr to "long", which is the array index type.
- // Previously, this type was erroneously set to the array element type.
- //tmpEntry.type (entry.type ());
- tmpEntry.type (qualifiedEntry ("long"));
- Expression expr = positiveIntConst (tmpEntry);
- entry.addArrayInfo (expr);
- verifyConstType (expr, qualifiedEntry ("long"));
- match (Token.RightBracket);
- } // fixedArraySize
-
- /**
- *
- **/
- private void attrDcl (InterfaceEntry entry) throws IOException, ParseException
- {
- AttributeEntry attribute = stFactory.attributeEntry (entry, (IDLID)repIDStack.peek ());
- attribute.sourceFile (scanner.fileEntry ());
- // Comment must immediately precede the "attribute" keyword. Save the
- // comment preceding the declaration for use below.
- attribute.comment (token.comment);
- Comment dclComment = attribute.comment ();
-
- if (token.type == Token.Readonly)
- {
- match (Token.Readonly);
- attribute.readOnly (true);
- }
- match (Token.Attribute);
- attribute.type (paramTypeSpec (attribute));
- attribute.name (token.name);
- // Override declaration comment if attribute identifier is commented
- if (!token.comment.text ().equals (""))
- attribute.comment (token.comment);
- entry.methodsAddElement (attribute, scanner);
- pigeonholeMethod (entry, attribute);
- // Declaration comment was overriden:
- if (!token.comment.text ().equals (""))
- {
- // Create a temporary attribute with declaration comment so cloning in
- // attrdcl2() can use declaration comment as default.
- AttributeEntry attributeClone = (AttributeEntry) attribute.clone ();
- attributeClone.comment (dclComment);
-
- match (Token.Identifier);
- attrDcl2 (entry, attributeClone);
- }
- else
- {
- match (Token.Identifier);
- attrDcl2 (entry, attribute);
- }
- //match (Token.Identifier);
- //attrDcl2 (entry, attribute);
- } // attrDcl
-
- /**
- *
- **/
- private void attrDcl2 (InterfaceEntry entry, AttributeEntry clone)
- throws IOException, ParseException
- {
- while (token.type == Token.Comma)
- {
- match (Token.Comma);
- AttributeEntry attribute = (AttributeEntry)clone.clone ();
- attribute.name (token.name);
- // Override the declaration comment (i.e., that preceding the
- // "attribute" keyword) if the attribute identifier is commented.
- if (!token.comment.text ().equals (""))
- attribute.comment (token.comment);
- entry.methodsAddElement (attribute, scanner);
- pigeonholeMethod (entry, attribute);
- match (Token.Identifier);
- }
- } // attrDcl2
-
- /**
- *
- **/
- private void exceptDcl (SymtabEntry entry) throws IOException, ParseException
- {
- match (Token.Exception);
- repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
- ExceptionEntry exceptEntry = stFactory.exceptionEntry (entry, (IDLID)repIDStack.peek ());
- ((IDLID)repIDStack.peek ()).appendToName (token.name);
- exceptEntry.sourceFile (scanner.fileEntry ());
- // Comment must immediately precede "exception" keyword
- exceptEntry.comment (tokenHistory.lookBack (1).comment);
- exceptEntry.name (token.name);
- match (Token.Identifier);
- pigeonhole (entry, exceptEntry);
- if (token.equals (Token.LeftBrace))
- {
- prep.openScope (exceptEntry);
- match (Token.LeftBrace);
- memberList2 (exceptEntry);
- prep.closeScope (exceptEntry);
- match (Token.RightBrace);
- repIDStack.pop ();
- }
- else
- throw ParseException.syntaxError (scanner, Token.LeftBrace,token.type);
- } // exceptDcl
-
- /**
- *
- **/
- private void opDcl (InterfaceEntry entry) throws IOException, ParseException
- {
- MethodEntry method = stFactory.methodEntry (entry, (IDLID)repIDStack.peek ());
- method.sourceFile (scanner.fileEntry ());
- // Comment must immediately precede "oneway" keyword or <return_type_spec>
- method.comment (token.comment);
- if (token.type == Token.Oneway)
- {
- match (Token.Oneway);
- method.oneway (true);
- }
- method.type (opTypeSpec (method));
- repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
- ((IDLID)repIDStack.peek ()).appendToName (token.name);
- method.name (token.name);
- entry.methodsAddElement (method, scanner);
- pigeonholeMethod (entry, method);
- opDcl2 (method);
- if (method.oneway ())
- checkIfOpLegalForOneway (method);
- repIDStack.pop ();
- } // opDcl
-
- /**
- *
- **/
- private void checkIfOpLegalForOneway (MethodEntry method)
- {
- boolean notLegal = false;
- if ((method.type() != null) ||
- (method.exceptions().size() != 0)) notLegal = true;
- else
- {
- for (Enumeration e = method.parameters().elements(); e.hasMoreElements();)
- {
- if (((ParameterEntry)e.nextElement ()).passType () != ParameterEntry.In)
- {
- notLegal = true;
- break;
- }
- }
- }
- if (notLegal)
- ParseException.oneway (scanner, method.name ());
- } // checkifOpLegalForOneway
-
- /**
- *
- **/
- private void opDcl2 (MethodEntry method) throws IOException, ParseException
- {
- if (token.equals (Token.MacroIdentifier))
- {
- match (Token.MacroIdentifier);
- parameterDcls2 (method);
- }
- else
- {
- match (Token.Identifier);
- parameterDcls (method);
- }
- opDcl3 (method);
- } // opDcl2
-
- /**
- *
- **/
- private void opDcl3 (MethodEntry entry) throws IOException, ParseException
- {
- if (token.type != Token.Semicolon)
- {
- if (!token.equals (Token.Raises) && !token.equals (Token.Context))
- throw ParseException.syntaxError (scanner, new int [] {
- Token.Raises, Token.Context, Token.Semicolon }, token.type);
- if (token.type == Token.Raises)
- raisesExpr (entry);
- if (token.type == Token.Context)
- contextExpr (entry);
- }
- } // opDcl3
-
- /**
- *
- **/
- private SymtabEntry opTypeSpec (SymtabEntry entry) throws IOException, ParseException
- {
- SymtabEntry ret = null;
- if (token.type == Token.Void)
- match (Token.Void);
- else
- ret = paramTypeSpec (entry);
- return ret;
- } // opTypeSpec
-
- /**
- *
- **/
- private void parameterDcls (MethodEntry entry) throws IOException, ParseException
- {
- match (Token.LeftParen);
- parameterDcls2 (entry);
- } // parameterDcls
-
- /**
- *
- **/
- private void parameterDcls2 (MethodEntry entry) throws IOException, ParseException
- {
- if (token.type == Token.RightParen)
- match (Token.RightParen);
- else
- {
- paramDcl (entry);
- while (token.type == Token.Comma)
- {
- match (Token.Comma);
- paramDcl (entry);
- }
- match (Token.RightParen);
- }
- } // paraneterDcls2
-
- /**
- *
- **/
- private void paramDcl (MethodEntry entry) throws IOException, ParseException
- {
- ParameterEntry parmEntry = stFactory.parameterEntry (entry, (IDLID)repIDStack.peek ());
- parmEntry.sourceFile (scanner.fileEntry ());
- // Comment must immeiately precede the parameter attribute
- parmEntry.comment (token.comment);
- paramAttribute (parmEntry);
- parmEntry.type (paramTypeSpec (entry));
- parmEntry.name (token.name);
- match (Token.Identifier);
- if (isntInList (entry.parameters (), parmEntry.name ()))
- entry.addParameter (parmEntry);
- } // paramDcl
-
- /**
- *
- **/
- private void paramAttribute (ParameterEntry entry) throws IOException, ParseException
- {
- if (token.type == Token.In)
- {
- entry.passType (ParameterEntry.In);
- match (Token.In);
- }
- else if (token.type == Token.Out)
- {
- entry.passType (ParameterEntry.Out);
- match (Token.Out);
- }
- else if (token.type == Token.Inout)
- {
- entry.passType (ParameterEntry.Inout);
- match (Token.Inout);
- }
- else
- throw ParseException.syntaxError (scanner, new int [] {
- Token.In, Token.Out, Token.Inout }, token.type);
- } // paramAttribute
-
- /**
- *
- **/
- private void raisesExpr (MethodEntry entry) throws IOException, ParseException
- {
- match (Token.Raises);
- match (Token.LeftParen);
- // Comment must immediately precede <scoped_name> for exception
- Comment tempComment = token.comment;
- SymtabEntry exception = scopedName(entry.container (), stFactory.exceptionEntry ());
- if (typeOf (exception) instanceof ExceptionEntry)
- {
- // Comment must immediately precede <scoped_name> for exception
- exception.comment (tempComment);
- if (isntInList (entry.exceptions (), exception))
- entry.exceptionsAddElement ((ExceptionEntry) exception);
- }
- else
- ParseException.wrongType (scanner, exception.fullName(),
- "exception", entryName (exception.type ()));
- raisesExpr2 (entry);
- match (Token.RightParen);
- } // raisesExpr
-
- /**
- *
- **/
- private void raisesExpr2 (MethodEntry entry) throws IOException, ParseException
- {
- while (token.type == Token.Comma)
- {
- match (Token.Comma);
- // Comment must immediately precede <scoped_name> of exception
- Comment tempComment = token.comment;
- SymtabEntry exception = scopedName (entry.container (), stFactory.exceptionEntry ());
- if (typeOf (exception) instanceof ExceptionEntry)
- {
- // Comment must immediately precede <scoped_name> of exception
- exception.comment (tempComment);
- if (isntInList (entry.exceptions (), exception))
- entry.addException ((ExceptionEntry)exception);
- }
- else
- ParseException.wrongType (scanner, exception.fullName (),
- "exception", entryName (exception.type ()));
- }
- } // raisesExpr2
-
- /**
- *
- **/
- private void contextExpr (MethodEntry entry) throws IOException, ParseException
- {
- match (Token.Context);
- match (Token.LeftParen);
- String stringLit = (String)stringLiteral ().value ();
- if (isntInStringList (entry.contexts (), stringLit))
- entry.addContext (stringLit);
- contextExpr2 (entry);
- match (Token.RightParen);
- } // contextExpr
-
-
- private void contextExpr2 (MethodEntry entry) throws IOException, ParseException
- {
- while (token.type == Token.Comma)
- {
- match (Token.Comma);
- String stringLit = (String)stringLiteral ().value ();
- if (isntInStringList (entry.contexts (), stringLit))
- entry.addContext (stringLit);
- }
- } // contextExpr2
-
- /**
- *
- **/
- private SymtabEntry paramTypeSpec (SymtabEntry entry) throws IOException, ParseException
- {
- SymtabEntry ret = null;
- switch (token.type)
- {
- case Token.Float:
- case Token.Double:
- case Token.Long:
- case Token.Short:
- case Token.Unsigned:
- case Token.Char:
- case Token.Wchar:
- case Token.Boolean:
- case Token.Octet:
- case Token.Any:
- return baseTypeSpec (entry);
- case Token.String:
- case Token.Wstring:
- return stringType (entry);
- case Token.Identifier:
- case Token.Object:
- // <f46082.40>
- case Token.ValueBase:
- case Token.DoubleColon:
- ret = scopedName (entry.container (), stFactory.primitiveEntry ());
- if (typeOf (ret) instanceof AttributeEntry)
- //ParseException.attributeParamType (scanner);
- ParseException.attributeNotType (scanner, ret.name ());
- else // <d60942>
- if (typeOf (ret) instanceof MethodEntry)
- ParseException.operationNotType (scanner, ret.name ());
-
- //if (!(returnType instanceof PrimitiveEntry ||
- // returnType instanceof StringEntry))
- //ParseException.wrongType (scanner, ret.fullName(),
- // "primitive or string", entryName (ret.type()));
- break;
- default:
- throw ParseException.syntaxError (scanner, new int [] {
- Token.Float, Token.Double, Token.Long, Token.Short,
- Token.Unsigned, Token.Char, Token.Wchar, Token.Boolean,
- Token.Octet, Token.Any, Token.String, Token.Wstring,
- Token.Identifier, Token.DoubleColon, Token.ValueBase }, token.type);
- }
- return ret;
- } // paramTypeSpec
-
- /**
- *
- **/
- private void match (int type) throws IOException, ParseException
- {
- ParseException exception = null;
- if (!token.equals (type))
- {
- exception = ParseException.syntaxError (scanner, type, token.type);
- // Missing a semicolon is a common error. If a semicolon was expected,
- // assume it exists and keep the current token (don't get the next one).
- // BEWARE!!! THIS HAS THE POTENTIAL FOR AN INFINITE LOOP!
- if (type == Token.Semicolon)
- return;
- }
- // <f46082.40> Unecessary due to new valueElement() algorithm.
- //if (!tokenStack.empty())
- //{
- // token = (Token)tokenStack.pop ();
- // return;
- //}
-
- // Fetch the next token.
- token = scanner.getToken ();
-
- // <d62023> Issue warnings about tokens.
- issueTokenWarnings ();
-
- // Maintain history of most recent tokens.
- tokenHistory.insert (token);
-
- // <d59166> Identifiers that collide with keywords are illegal. Note
- // that escaped identifers never collide!
- /*
- if (token.collidesWithKeyword ())
- {
- // <f60858.1> Issue a warning only
- if (corbaLevel <= 2.2f)
- ParseException.keywordCollisionWarning (scanner, token.name);
- else
- exception = ParseException.keywordCollision (scanner, token.name);
- }
- */
-
- while (token.isDirective ())
- token = prep.process (token);
-
- // If the token is a defined thingy, scan the defined string
- // instead of the input stream for a while.
- if (token.equals (Token.Identifier) || token.equals (Token.MacroIdentifier))
- {
- String string = (String)symbols.get (token.name);
- if (string != null && !string.equals (""))
- {
- // If this is a macro, parse the macro
- if (macros.contains (token.name))
- {
- scanner.scanString (prep.expandMacro (string, token));
- match (token.type);
- }
- else // This is just a normal define.
- {
- scanner.scanString (string);
- match (token.type);
- }
- }
- }
- if (exception != null)
- throw exception;
- } // match
-
- // <d62023>
- /**
- * Issue warnings according to attributes of current Token.
- **/
- private void issueTokenWarnings ()
- {
- if (noWarn)
- return;
-
- if ((token.equals (Token.Identifier) || token.equals (Token.MacroIdentifier))
- && !token.isEscaped ())
- {
- // Identifier collision with keyword in another release.
- // Identifier collision with keyword in letter, but not in case.
- if (token.collidesWithKeyword ())
- ParseException.warning (scanner, Util.getMessage ("Migration.keywordCollision", token.name));
- }
- // Deprecated keyword.
- if (token.isKeyword () && token.isDeprecated ())
- ParseException.warning (scanner, Util.getMessage ("Deprecated.keyword", token.toString ()));
- } // issueTokenWarnings
-
- /**
- *
- **/
- private ModuleEntry newModule (ModuleEntry oldEntry)
- {
- ModuleEntry entry = stFactory.moduleEntry (oldEntry, (IDLID)repIDStack.peek ());
- entry.sourceFile (scanner.fileEntry ());
- entry.name (token.name);
- // If this named module already exists, just reopen it.
- /* <46082.46.01> if cppModule, always create new module entry */
- SymtabEntry prevEntry = (SymtabEntry) symbolTable.get (entry.fullName ());
- if (!cppModule && prevEntry != null && prevEntry instanceof ModuleEntry)
- {
- // A module has been reopened, return that ModuleEntry.
- entry = (ModuleEntry) prevEntry;
- if (oldEntry == topLevelModule)
- {
- // Do a little checking:
- if (!entry.emit ())
- // The entry module is being reopened to put new stuff into it.
- // The module itself is not marked as "emit", but the new stuff
- // may be, so put the module on the emitList (add it to topLevelModule).
- addToContainer (oldEntry, entry);
- else if (!oldEntry.contained().contains (entry))
- // <d50767> The entry module being reopened is to be emitted, but
- // will not be placed on the emitList! I.E., it was not added to
- // topLevelModule. Occurs when a generator manually inserts
- // ModuleEntrys into the symbol table (e.g., org; see preParse()
- // in ...idl.toJava.Compile). <daz>
- addToContainer (oldEntry, entry);
- }
- }
- else
- pigeonhole (oldEntry, entry);
- return entry;
- } // newModule
-
- /**
- *
- **/
- private EnumEntry newEnumEntry (SymtabEntry oldEntry)
- {
- EnumEntry entry = stFactory.enumEntry (oldEntry, (IDLID)repIDStack.peek ());
- entry.sourceFile (scanner.fileEntry ());
- entry.name (token.name);
- pigeonhole (oldEntry, entry);
- return entry;
- } // newEnumEntry
-
- /**
- *
- **/
- private SequenceEntry newSequenceEntry (SymtabEntry oldEntry)
- {
- SequenceEntry entry = stFactory.sequenceEntry (oldEntry, (IDLID)repIDStack.peek ());
- entry.sourceFile (scanner.fileEntry ());
- entry.name ("");
- pigeonhole (oldEntry, entry);
- return entry;
- } // newSequenceEntry
-
- private void updateSymbolTable( String fullName, SymtabEntry entry, boolean lcCheck )
- {
- // Check for case-insensitive collision (IDL error).
- String lcFullName = fullName.toLowerCase();
- if (lcCheck)
- if (lcSymbolTable.get (lcFullName) != null) {
- ParseException.alreadyDeclared (scanner, fullName);
- }
- symbolTable.put (fullName, entry);
- lcSymbolTable.put (lcFullName, entry);
- // <d59809> Allow fully-qualified CORBA types to be resolved by mapping
- // short name (e.g., CORBA/StringValue) to long name, actual name.
- String omgPrefix = "org/omg/CORBA" ;
- if (fullName.startsWith (omgPrefix)) {
- overrideNames.put (
- "CORBA" + fullName.substring (omgPrefix.length()), fullName);
- }
- }
-
- private void pigeonhole (SymtabEntry container, SymtabEntry entry)
- {
- if (entry.name().equals (""))
- entry.name (unknownNamePrefix + ++sequence);
-
- // If this object is not in the overrides list, then it is
- // ok to put it in the table (if it IS in the overrides list,
- // it is already in the table under a different name).
- String fullName = entry.fullName();
- if (overrideNames.get (fullName) == null) {
- addToContainer (container, entry);
-
- // It is an error is this name already exists in the symbol
- // table, unless this is a redefinition of a forward decl.
- // Re-opening a module is also legal, but not handled here.
- SymtabEntry oldEntry = (SymtabEntry) symbolTable.get (fullName);
-
- if (oldEntry == null) {
- updateSymbolTable( fullName, entry, true ) ;
- } else if (oldEntry instanceof ForwardEntry &&
- entry instanceof InterfaceEntry) {
-
- String repIDPrefix = ((IDLID)entry.repositoryID ()).prefix ();
- String oldRepIDPrefix = ((IDLID)oldEntry.repositoryID ()).prefix ();
- if (repIDPrefix.equals (oldRepIDPrefix)) {
- updateSymbolTable( fullName, entry, false ) ;
- } else {
- ParseException.badRepIDPrefix (scanner, fullName,
- oldRepIDPrefix, repIDPrefix);
- }
- } else if (entry instanceof ForwardEntry &&
- (oldEntry instanceof InterfaceEntry ||
- oldEntry instanceof ForwardEntry)) {
- if (oldEntry instanceof ForwardEntry &&
- entry.repositoryID () instanceof IDLID &&
- oldEntry.repositoryID () instanceof IDLID) {
-
- String repIDPrefix =
- ((IDLID)entry.repositoryID ()).prefix ();
- String oldRepIDPrefix =
- ((IDLID)oldEntry.repositoryID ()).prefix ();
-
- if (!(repIDPrefix.equals (oldRepIDPrefix))) {
- // Disallow multiple ForwardEntry's having same Repository
- // ID prefixes (CORBA 2.3).
- ParseException.badRepIDPrefix (scanner, fullName,
- oldRepIDPrefix, repIDPrefix);
- }
- }
- } else if (cppModule && entry instanceof ModuleEntry &&
- oldEntry instanceof ModuleEntry) {
- // Allow multiple ModuleEntrys when user submits
- // the -cppModule flag.
- } else if (fullName.startsWith ("org/omg/CORBA") ||
- fullName.startsWith ("CORBA")) {
- // Ignore CORBA PIDL types entered at preParse() by generator.
- } else if (isForwardable( oldEntry, entry )) {
- // Both oldEntry and entry are structs or unions.
- // Legality depends on isReferencable on the two entries:
- // oldEntry Entry
- // T T ERROR alreadyDeclared
- // T F legal fwd decl
- // F T if defined in same file legal,
- // otherwise ERROR
- // F F legal fwd decl
- if (oldEntry.isReferencable() && entry.isReferencable())
- ParseException.alreadyDeclared (scanner, fullName);
-
- if (entry.isReferencable()) {
- String firstFile =
- oldEntry.sourceFile().absFilename() ;
- String defFile =
- entry.sourceFile().absFilename() ;
- if (!firstFile.equals( defFile ))
- ParseException.declNotInSameFile( scanner,
- fullName, firstFile ) ;
- else {
- updateSymbolTable( fullName, entry, false ) ;
-
- List oldRefList ;
-
- try {
- oldRefList = (List)oldEntry.dynamicVariable(
- ftlKey ) ;
- } catch (NoSuchFieldException exc) {
- throw new IllegalStateException() ;
- }
-
- if (oldRefList != null) {
- // Update entries in backpatch list
- Iterator iter = oldRefList.iterator() ;
- while (iter.hasNext()) {
- SymtabEntry elem = (SymtabEntry)iter.next() ;
- elem.type( entry ) ;
- }
- }
- }
- }
- } else {
- ParseException.alreadyDeclared (scanner, fullName);
- }
- }
- } // pigeonhole
-
- private boolean isForwardable( SymtabEntry oldEntry,
- SymtabEntry entry )
- {
- return ((oldEntry instanceof StructEntry) &&
- (entry instanceof StructEntry)) ||
- ((oldEntry instanceof UnionEntry) &&
- (entry instanceof UnionEntry)) ;
- }
-
- // pigeonhole checks to see if this entry is already in the symbol
- // table and generates an error if it is. Methods must be checked
- // not only against the symbol table but also against their
- // interface's parent's methods. This is done in InterfaceEntry.
- // verifyMethod, so no checking need be done here.
-
- /**
- *
- **/
- private void pigeonholeMethod (InterfaceEntry container, MethodEntry entry)
- {
- if (entry.name ().equals (""))
- entry.name (unknownNamePrefix + ++sequence);
-
- // If this object is not in the overrides list, then it is
- // ok to put it in the table (if it IS in the overrides list,
- // it is already in the table under a different name).
- String fullName = entry.fullName ();
- if (overrideNames.get (fullName) == null)
- {
- addToContainer (container, entry);
- String lcFullName = fullName.toLowerCase ();
- symbolTable.put (fullName, entry);
- lcSymbolTable.put (lcFullName, entry);
- // <d59809> Allow fully-qualified CORBA types to be resolved by mapping
- // short name (e.g., CORBA/StringValue) to long name, actual name.
- if (fullName.startsWith ("org/omg/CORBA"))
- overrideNames.put ("CORBA" + fullName.substring (13), fullName);
- }
- } // pigeonholeMethod
-
- /**
- *
- **/
- private void addToContainer (SymtabEntry container, SymtabEntry contained)
- {
- if (container instanceof ModuleEntry)
- ((ModuleEntry)container).addContained (contained);
- else if (container instanceof InterfaceEntry)
- ((InterfaceEntry)container).addContained (contained);
- else if (container instanceof StructEntry)
- ((StructEntry)container).addContained (contained);
- else if (container instanceof UnionEntry)
- ((UnionEntry)container).addContained (contained);
- else if (container instanceof SequenceEntry)
- ((SequenceEntry)container).addContained (contained);
- } // addToContainer
-
- // NOTE: qualifiedEntry/partlyQualifiedEntry/unqualifiedEntry and
- // their court could probably use some performance improvements,
- // but I'm scared to touch anything. It's the most complex bit of
- // code in this parser.
-
- // The qualified named type is searched for in the following order:
- // 1. OverrideNames
- // 2. Global scope
- // 3. Inheritance scope (if container is an interface)
- // A qualified name is one which begins with :: or is assumed to be
- // in the global scope (like long, short, etc).
-
- /**
- *
- **/
- SymtabEntry qualifiedEntry (String typeName)
- {
- SymtabEntry type = recursiveQualifiedEntry (typeName);
- if (type == null)
- // Then it's not anywhere, report the error.
- ParseException.undeclaredType (scanner, typeName);
-
- // <d57110> Relax this retriction when parsing ID pragma directive, e.g..
- //else if (type instanceof ModuleEntry) {
- else if (type instanceof ModuleEntry && !_isModuleLegalType)
- {
- // Module's are not valid types.
- ParseException.moduleNotType (scanner, typeName);
- type = null;
- }
- return type;
- } // qualifiedEntry
-
- /**
- *
- **/
- SymtabEntry recursiveQualifiedEntry (String typeName)
- {
- SymtabEntry type = null;
- if (typeName != null && !typeName.equals ("void"))
- {
- int index = typeName.lastIndexOf ('/');
- if (index >= 0)
- {
- // Figure out if the container of this thing exists, converting any typedefs to interfaces if necessary.
- type = recursiveQualifiedEntry (typeName.substring (0, index));
- if (type == null)
- return null;
- else if (type instanceof TypedefEntry)
- typeName = typeOf (type).fullName () + typeName.substring (index);
- }
-
- // If we got this far, a container exists, start over looking
- // for the thing itself (this is the meat of the method):
- type = searchOverrideNames (typeName);
- if (type == null)
- type = (SymtabEntry) symbolTable.get (typeName); // search global scope:
- if (type == null)
- type = searchGlobalInheritanceScope (typeName);
- }
- return type;
- } // recursiveQualifiedEntry
-
- // A partially qualified name is of the form <scope>::<name>.
- // First the scope is defined (meaning it is fully qualified);
- // Then the name is searched for in the scope.
-
- /**
- *
- **/
- SymtabEntry partlyQualifiedEntry (String typeName, SymtabEntry container)
- {
- // This is the simple logic of this method:
- // type = searchModuleScope (typeName.substring (0, typeName.lastIndexOf ('/')), container);
- // type = qualifiedEntry (type.fullName () + typeName.substring (typeName.lastIndexOf ('/')));
- // But searchModuleScope only finds the first module that fits.
- // The name might not be in that module but in one further out
- // in the module scope. Should others be searched?
- SymtabEntry type = null;
- if (typeName != null)
- {
- int index = typeName.lastIndexOf ('/');
-
- // Figure out if the container of this thing exists, converting any
- // typedefs to interfaces if necessary:
- type = recursivePQEntry (typeName.substring (0, index), container);
- if (type instanceof TypedefEntry)
- typeName = typeOf (type).fullName () + typeName.substring (index);
-
- // If we got this far, a container exists, start over looking
- // for the thing itself.
-
- if (container != null)
- type = searchModuleScope (typeName.substring (0, typeName.lastIndexOf ('/')), container);
- if (type == null)
- type = qualifiedEntry (typeName);
- else
- type = qualifiedEntry (type.fullName () + typeName.substring (typeName.lastIndexOf ('/')));
- }
- return type;
- } // partlyQualifiedEntry
-
- // partlyQualifiedEntry and recursivePQEntry are almost identical.
- // They are different because when the recursive one is looking for
- // the existence of containers, the error check for a module type
- // must not occur (this check is done in qualifiedEntry). Only
- // when the full partly qualified name is being processed must this
- // check be performed.
-
- /**
- *
- **/
- SymtabEntry recursivePQEntry (String typeName, SymtabEntry container)
- {
- SymtabEntry type = null;
- if (typeName != null)
- {
- int index = typeName.lastIndexOf ('/');
- if (index < 0)
- type = searchModuleScope (typeName, container);
- else
- {
- // Figure out if the container of this thing exists, converting any
- // typedefs to interfaces if necessary:
- type = recursivePQEntry (typeName.substring (0, index), container);
- if (type == null)
- return null;
- else if (type instanceof TypedefEntry)
- typeName = typeOf (type).fullName () + typeName.substring (index);
-
- // If we got this far, a container exists, start over, looking
- // for the thing itself (This is the meat of the method):
- if (container != null)
- type = searchModuleScope (typeName.substring (0, typeName.lastIndexOf ('/')), container);
- if (type == null)
- recursiveQualifiedEntry (typeName);
- else
- type = recursiveQualifiedEntry (type.fullName () + typeName.substring (typeName.lastIndexOf ('/')));
- }
- }
- return type;
- } // recursivePQEntry
-
- // The named type is searched for in the following order:
- // 1. Local scope
- // 2. Inheritance scope
- // 3. OverrideNames
- // 4. Module scope
-
- /**
- *
- **/
- SymtabEntry unqualifiedEntry (String typeName, SymtabEntry container)
- {
- SymtabEntry type = unqualifiedEntryWMod (typeName, container);
-
- // <d57110> Relax this retriction in special cases, e.g., when
- // parsing a ID pragma directive.
- //if (type instanceof ModuleEntry) {
- if (type instanceof ModuleEntry && !_isModuleLegalType)
- {
- // Module's are not valid types:
- ParseException.moduleNotType (scanner, typeName);
- type = null;
- }
- return type;
- } // unqualifiedEntry
-
- /**
- *
- **/
- SymtabEntry unqualifiedEntryWMod (String typeName, SymtabEntry container)
- {
- SymtabEntry type = null;
- if ((typeName != null) && !typeName.equals ("void"))
- {
- // Search local scope:
- type = (SymtabEntry)symbolTable.get (container.fullName () + '/' + typeName);
- if (type == null)
- type = searchLocalInheritanceScope (typeName, container);
- if (type == null)
- type = searchOverrideNames (typeName);
- if ((type == null) && (container != null))
- type = searchModuleScope (typeName, container);
- if (type == null)
- type = searchParentInheritanceScope (typeName, container);
- }
- if (type == null)
- // Then it's not anywhere, report the error:
- ParseException.undeclaredType (scanner, typeName);
- return type;
- } // unqualifiedEntryWMod
-
- /**
- * Walks up the enclosing scopes until it finds an interface type. Then,
- * searches up that interface inheritance tree for the type definition.
- *
- * @param name type name to be searched for.
- * @param ptype parent type entry.
- **/
- SymtabEntry searchParentInheritanceScope(String name, SymtabEntry ptype) {
-
- String cname = ptype.fullName();
-
- while ((ptype != null) && !(cname.equals ("")) &&
- !(ptype instanceof InterfaceEntry)) {
- int index = cname.lastIndexOf ('/');
- if (index < 0) {
- cname = "";
- } else {
- cname = cname.substring (0, index);
- ptype = (SymtabEntry) symbolTable.get(cname);
- }
- }
-
- if ((ptype == null) || !(ptype instanceof InterfaceEntry)) {
- return null; // could not find an enclosing interface type - give up.
- }
-
- // check if the enclosing interface supports the type definition.
- String fullName = ptype.fullName () + '/' + name;
- SymtabEntry type = (SymtabEntry) symbolTable.get (fullName);
- if (type != null) {
- return type; // found type definition.
- }
-
- // search up the interface inheritance tree.
- return searchLocalInheritanceScope(name, ptype);
- }
-
- /**
- *
- **/
- SymtabEntry searchGlobalInheritanceScope (String name)
- {
- // See if the container of this named object is an interface:
- int index = name.lastIndexOf ('/');
- SymtabEntry entry = null;
- if (index >= 0)
- {
- String containerName = name.substring (0, index);
- entry = (SymtabEntry)symbolTable.get (containerName);
- entry = (entry instanceof InterfaceEntry)
- // It's an interface, now look in its inheritance scope:
- ? searchLocalInheritanceScope (name.substring (index + 1), entry)
- : null;
- }
- return entry;
- } // searchGlobalInheritanceScope
-
- /**
- *
- **/
- SymtabEntry searchLocalInheritanceScope (String name, SymtabEntry container)
- {
- return (container instanceof InterfaceEntry)
- ? searchDerivedFrom (name, (InterfaceEntry) container)
- : null;
- } // searchLocalInheritanceScope
-
- /**
- *
- **/
- SymtabEntry searchOverrideNames (String name)
- {
- String overrideName = (String)overrideNames.get (name);
- return (overrideName != null)
- ? (SymtabEntry)symbolTable.get (overrideName)
- : null;
- } // searchOverrideNames
-
- /**
- *
- **/
- SymtabEntry searchModuleScope (String name, SymtabEntry container)
- {
- String module = container.fullName ();
- String fullName = module + '/' + name;
- SymtabEntry type = (SymtabEntry)symbolTable.get (fullName);
- while ((type == null) && !module.equals (""))
- {
- int index = module.lastIndexOf ('/');
- if (index < 0)
- module = "";
- else
- {
- module = module.substring (0, index);
- fullName = module + '/' + name;
- type = (SymtabEntry)symbolTable.get (fullName);
- }
- }
- return (type == null) ? (SymtabEntry)symbolTable.get (name) : type;
- } // searchModuleScope
-
- /**
- *
- **/
- SymtabEntry searchDerivedFrom (String name, InterfaceEntry i)
- {
- for (Enumeration e = i.derivedFrom ().elements (); e.hasMoreElements ();)
- {
- SymtabEntry tmp = (SymtabEntry)e.nextElement ();
- if (tmp instanceof InterfaceEntry)
- {
- InterfaceEntry parent = (InterfaceEntry)tmp;
- String fullName = parent.fullName () + '/' + name;
- SymtabEntry type = (SymtabEntry)symbolTable.get (fullName);
- if (type != null)
- return type;
- type = searchDerivedFrom (name, parent);
- if (type != null)
- return type;
- }
- // else it is a ForwardEntry and nothing can be done at this point.
- }
- return null;
- } // searchDerivedFrom
-
- /**
- *
- **/
- String entryName (SymtabEntry entry)
- {
- if (entry instanceof AttributeEntry)
- return "attribute";
- if (entry instanceof ConstEntry)
- return "constant";
- if (entry instanceof EnumEntry)
- return "enumeration";
- if (entry instanceof ExceptionEntry)
- return "exception";
- if (entry instanceof ValueBoxEntry)
- return "value box";
- if (entry instanceof ForwardValueEntry || entry instanceof ValueEntry)
- return "value";
- if (entry instanceof ForwardEntry || entry instanceof InterfaceEntry)
- return "interface";
- if (entry instanceof MethodEntry)
- return "method";
- if (entry instanceof ModuleEntry)
- return "module";
- if (entry instanceof ParameterEntry)
- return "parameter";
- if (entry instanceof PrimitiveEntry)
- return "primitive";
- if (entry instanceof SequenceEntry)
- return "sequence";
- if (entry instanceof StringEntry)
- return "string";
- if (entry instanceof StructEntry)
- return "struct";
- if (entry instanceof TypedefEntry)
- return "typedef";
- if (entry instanceof UnionEntry)
- return "union";
- return "void";
- } // entryName
-
- /**
- *
- **/
- private boolean isInterface (SymtabEntry entry)
- {
- return entry instanceof InterfaceEntry || (entry instanceof ForwardEntry
- && !(entry instanceof ForwardValueEntry)) ;
- }
-
- private boolean isValue (SymtabEntry entry)
- {
- return entry instanceof ValueEntry ; // || entry instanceof ForwardValueEntry;
- }
-
- private boolean isInterfaceOnly (SymtabEntry entry)
- {
- return entry instanceof InterfaceEntry ;
- }
-
- private boolean isForward(SymtabEntry entry)
- {
- return entry instanceof ForwardEntry ;
- }
-
- // list must be a vector of Strings.
- /**
- *
- **/
- private boolean isntInStringList (Vector list, String name)
- {
- boolean isnt = true;
- Enumeration e = list.elements ();
- while (e.hasMoreElements ())
- if (name.equals ((String)e.nextElement ()))
- {
- ParseException.alreadyDeclared (scanner, name);
- isnt = false;
- break;
- }
- return isnt;
- } // isntInStringList
-
- // list must be a vector of SymtabEntry's.
- /**
- *
- **/
- private boolean isntInList (Vector list, String name)
- {
- boolean isnt = true;
- for (Enumeration e = list.elements (); e.hasMoreElements ();)
- if (name.equals (((SymtabEntry)e.nextElement ()).name ()))
- {
- ParseException.alreadyDeclared (scanner, name);
- isnt = false;
- break;
- }
- return isnt;
- } // isntInList
-
- // list must be a vector of SymtabEntry's.
- /**
- *
- **/
- private boolean isntInList (Vector list, SymtabEntry entry)
- {
- boolean isnt = true;
- for (Enumeration e = list.elements (); e.hasMoreElements ();)
- {
- SymtabEntry eEntry = (SymtabEntry)e.nextElement ();
- if (entry == eEntry) // && entry.fullName().equals (eEntry.fullName()))
- {
- ParseException.alreadyDeclared (scanner, entry.fullName ());
- isnt = false;
- break;
- }
- }
- return isnt;
- } // isntInList
-
- /**
- *
- **/
- public static SymtabEntry typeOf (SymtabEntry entry)
- {
- while (entry instanceof TypedefEntry)
- entry = entry.type ();
- return entry;
- } // typeOf
-
- /**
- *
- **/
- void forwardEntryCheck ()
- {
- for (Enumeration e = symbolTable.elements (); e.hasMoreElements ();)
- {
- SymtabEntry entry = (SymtabEntry)e.nextElement ();
- if (entry instanceof ForwardEntry)
- ParseException.forwardEntry (scanner, entry.fullName ());
- }
- } // forwardEntryCheck
-
- // <46082.03> Revert to "IDL:"-style (i.e., regular) repository ID.
- /*
- void updateRepositoryIds () {
- for (Enumeration e = symbolTable.elements(); e.hasMoreElements();) {
- SymtabEntry entry = (SymtabEntry) e.nextElement();
- if (entry instanceof ValueEntry)
- ((ValueEntry) entry).calcRepId();
- }
- } // updateRepositoryIds
- */
-
- ////////////////////
- // Error Handling Methods
-
- // A syntax error occurred. Skip until a semicolon is encountered.
- // Ignore semicolons within {...} blocks
- /**
- *
- **/
- private void skipToSemicolon () throws IOException
- {
- while (!token.equals (Token.EOF) && !token.equals (Token.Semicolon))
- {
- if (token.equals (Token.LeftBrace))
- skipToRightBrace();
- try
- {
- match (token.type);
- }
- catch (ParseException exception)
- {
- // The error has already been reported...
- }
- }
- if (token.equals (Token.EOF))
- throw new EOFException ();
- try
- {
- match (Token.Semicolon);
- }
- catch (Exception exception)
- {
- }
- } // skipToSemicolon
-
- /**
- *
- **/
- private void skipToRightBrace () throws IOException
- {
- boolean firstTime = true;
- while (!token.equals (Token.EOF) && !token.equals (Token.RightBrace))
- {
- if (firstTime)
- firstTime = false;
- else if (token.equals (Token.LeftBrace))
- skipToRightBrace ();
- try
- {
- match (token.type);
- }
- catch (ParseException exception)
- {
- // The error has already been reported...
- }
- }
- if (token.equals (Token.EOF))
- throw new EOFException();
- } // skipToRightBrace
-
- // Error Handling Methods
- ////////////////////
-
- // <d56351> In CORBA 2.3, an IDL file provides a new scope for Repository IDs.
- // The following methods provide a means for other classes in the framework
- // to manage this scoping (see Preprocessor and Scanner).
-
- // public static int nPush = 0;
- // public static int nPop = 0;
-
- /**
- *
- **/
- public static void enteringInclude ()
- {
- repIDStack.push (new IDLID ());
- } // enteringInclude
-
- /**
- *
- **/
- public static void exitingInclude ()
- {
- repIDStack.pop ();
- } // exitingInclude
-
-
- public static final String unknownNamePrefix = "uN__";
-
- static Hashtable symbolTable;
- Hashtable lcSymbolTable = new Hashtable ();
- static Hashtable overrideNames;
- Vector emitList = new Vector ();
- boolean emitAll;
- // <f46082.46.01>
- boolean cppModule;
- // <d62023>
- boolean noWarn;
- Scanner scanner;
- // <f46082.40> No longer necessary due to new valueElement() algorithm.
- // Stack tokenStack = new Stack();
- Hashtable symbols;
- Vector macros = new Vector ();
- Vector paths;
-
- // Only needed for the pragma directive
- SymtabEntry currentModule = null;
-
- // <d56351> Static field necessary to allow Scanner access to enterind/exiting
- // Include() methods. Must reset in Compile class, too!
- // Stack repIDStack = new Stack ();
- static Stack repIDStack = new Stack ();
-
- // Dynamic variable key used for forward type lists.
- // A struct or union X entry may have this attached,
- // which always contains a List<SymtabEntry>.
- // The elements are entries E such that E.type() == X.
- // This list must be resolved in pigeonhole when the
- // type is finally defined. This is similar to
- // ForwardEntry.replaceForwardDecl.
- private static int ftlKey = SymtabEntry.getVariableKey() ;
-
- int sequence = 0;
- Vector includes;
- Vector includeEntries;
-
- // Only needed in primaryExpr. Set in Preprocessor.booleanConstExpr.
- boolean parsingConditionalExpr = false;
-
- Token token;
- ModuleEntry topLevelModule;
- private Preprocessor prep;
- private boolean verbose;
- SymtabFactory stFactory;
- ExprFactory exprFactory;
- private String[] keywords;
- // <f46082.51> Remove -stateful feature.
- //private boolean parseStateful = false;
-
- // Circular buffer containing most recent tokens, including the current token.
- private TokenBuffer tokenHistory = new TokenBuffer ();
- protected float corbaLevel; // <f60858.1>
- private Arguments arguments;
-
-} // class Parser
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/PragmaEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/PragmaEntry.java
deleted file mode 100644
index dc805b8..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/PragmaEntry.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-/**
- * This is the symbol table entry for the #pragma statement.
- **/
-public class PragmaEntry extends SymtabEntry
-{
- protected PragmaEntry ()
- {
- super ();
- repositoryID (Util.emptyID);
- } // ctor
-
- protected PragmaEntry (SymtabEntry that)
- {
- super (that, new IDLID ());
- module (that.name ());
- name ("");
- } // ctor
-
- protected PragmaEntry (PragmaEntry that)
- {
- super (that);
- } // ctor
-
- public Object clone ()
- {
- return new PragmaEntry (this);
- } // clone
-
- /** Invoke the Include type generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- pragmaGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the Include type generator.
- @returns an object which implements the IncludeGen interface.
- @see IncludeGen */
- public Generator generator ()
- {
- return pragmaGen;
- } // generator
-
- public String data ()
- {
- return _data;
- } // data
-
- public void data (String newData)
- {
- _data = newData;
- } // data
-
- static PragmaGen pragmaGen;
-
- private String _data = null;
-} // class PragmaEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/PragmaGen.java b/src/share/classes/com/sun/tools/corba/se/idl/PragmaGen.java
deleted file mode 100644
index 12c46f5..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/PragmaGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface PragmaGen extends Generator
-{
- void generate (Hashtable symbolTable, PragmaEntry entry, PrintWriter stream);
-} // interface PragmaGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/PragmaHandler.java b/src/share/classes/com/sun/tools/corba/se/idl/PragmaHandler.java
deleted file mode 100644
index 0af3af5..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/PragmaHandler.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-// - Add openScope and closeScope.
-
-import java.io.IOException;
-
-public abstract class PragmaHandler
-{
- public abstract boolean process (String pragma, String currentToken) throws IOException;
-
- void init (Preprocessor p)
- {
- preprocessor = p;
- } // init
-
- // Utility methods.
-
- /** Get the current token. */
- protected String currentToken ()
- {
- return preprocessor.currentToken ();
- } // currentToken
-
- /** This method, given an entry name, returns the entry with that name.
- It can take fully or partially qualified names and returns the
- appropriate entry defined within the current scope. If no entry
- exists, null is returned. */
- protected SymtabEntry getEntryForName (String string)
- {
- return preprocessor.getEntryForName (string);
- } // getEntryForName
-
- /** This method returns a string of all of the characters from the input
- file from the current position up to, but not including, the end-of-line
- character(s). */
- protected String getStringToEOL () throws IOException
- {
- return preprocessor.getStringToEOL ();
- } // getStringToEOL
-
- /** This method returns a string of all of the characters from the input
- file from the current position up to, but not including, the given
- character. It encapsulates parenthesis and quoted strings, meaning
- it does not stop if the given character is found within parentheses
- or quotes. For instance, given the input of `start(inside)end',
- getUntil ('n') will return "start(inside)e" */
- protected String getUntil (char c) throws IOException
- {
- return preprocessor.getUntil (c);
- } // getUntil
-
- /** This method returns the next token String from the input file. */
- protected String nextToken () throws IOException
- {
- return preprocessor.nextToken ();
- } // nextToken
-
- /** This method assumes that the current token marks the beginning
- of a scoped name. It then parses the subsequent identifier and
- double colon tokens, builds the scoped name, and finds the symbol
- table entry with that name. */
- protected SymtabEntry scopedName () throws IOException
- {
- return preprocessor.scopedName ();
- } // scopedName
-
- /** Skip to the end of the line. */
- protected void skipToEOL () throws IOException
- {
- preprocessor.skipToEOL ();
- } // skipToEOL
-
- /** This method skips the data in the input file until the specified
- character is encountered, then it returns the next token. */
- protected String skipUntil (char c) throws IOException
- {
- return preprocessor.skipUntil (c);
- } // skipUntil
-
- /** This method displays a Parser Exception complete with line number
- and position information with the given message string. */
- protected void parseException (String message)
- {
- preprocessor.parseException (message);
- } // parseException
-
- /** This method is called when the parser encounters a left curly brace.
- An extender of PragmaHandler may find scope information useful.
- For example, the prefix pragma takes effect as soon as it is
- encountered and stays in effect until the current scope is closed.
- If a similar pragma extension is desired, then the openScope and
- closeScope methods are available for overriding.
- @param entry the symbol table entry whose scope has just been opened.
- Be aware that, since the scope has just been entered, this entry is
- incomplete at this point. */
- protected void openScope (SymtabEntry entry)
- {
- } // openScope
-
- /** This method is called when the parser encounters a right curly brace.
- An extender of PragmaHandler may find scope information useful.
- For example, the prefix pragma takes effect as soon as it is
- encountered and stays in effect until the current scope is closed.
- If a similar pragma extension is desired, then the openScope and
- closeScope methods are available for overriding.
- @param entry the symbol table entry whose scope has just been closed. */
- protected void closeScope (SymtabEntry entry)
- {
- } // closeScope
-
- private Preprocessor preprocessor = null;
-} // class PragmaHandler
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/Preprocessor.java b/src/share/classes/com/sun/tools/corba/se/idl/Preprocessor.java
deleted file mode 100644
index a75b59e..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/Preprocessor.java
+++ /dev/null
@@ -1,1431 +0,0 @@
-/*
- * Copyright (c) 1999, 2000, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-// -D57110<daz> Allow ID pragma directive to be applied to modules and update
-// feature in accordance to CORBA 2.3.
-// -D59165<daz> Enable escaped identifiers when processing pragmas.
-// -f60858.1<daz> Support -corba option, level = 2.2: Accept identifiers that
-// collide with keywords, in letter but not case, and issue a warning.
-// -d62023 <daz> support -noWarn option; suppress inappropriate warnings when
-// parsing IBM-specific pragmas (#meta <interface_name> abstract).
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Stack;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.RepositoryID;
-
-import com.sun.tools.corba.se.idl.constExpr.*;
-
-/**
- * This class should be extended if new pragmas are desired. If the
- * preprocessor encounters a pragma name which it doesn't recognize
- * (anything other than ID, prefix, or version), it calls the method
- * otherPragmas. This is the only method which need be overridden.
- * The Preprocessor base class has a number of utility-like methods
- * which can be used by the overridden otherPragmas method.
- **/
-public class Preprocessor
-{
- /**
- * Public zero-argument constructor.
- **/
- Preprocessor ()
- {
- } // ctor
-
- /**
- *
- **/
- void init (Parser p)
- {
- parser = p;
- symbols = p.symbols;
- macros = p.macros;
- } // init
-
- /**
- *
- **/
- protected Object clone ()
- {
- return new Preprocessor ();
- } // clone
-
- /**
- *
- **/
- Token process (Token t) throws IOException, ParseException
- {
- token = t;
- scanner = parser.scanner;
- // <f46082.40> Deactivate escaped identifier processing in Scanner while
- // preprocessing.
- //scanner.underscoreOK = true;
- scanner.escapedOK = false;
- try
- {
- switch (token.type)
- {
- case Token.Include:
- include ();
- break;
- case Token.If:
- ifClause ();
- break;
- case Token.Ifdef:
- ifdef (false);
- break;
- case Token.Ifndef:
- ifdef (true);
- break;
- case Token.Else:
- if (alreadyProcessedABranch.empty ())
- throw ParseException.elseNoIf (scanner);
- else if (((Boolean)alreadyProcessedABranch.peek ()).booleanValue ())
- skipToEndif ();
- else
- {
- alreadyProcessedABranch.pop ();
- alreadyProcessedABranch.push (new Boolean (true));
- token = scanner.getToken ();
- }
- break;
- case Token.Elif:
- elif ();
- break;
- case Token.Endif:
- if (alreadyProcessedABranch.empty ())
- throw ParseException.endNoIf (scanner);
- else
- {
- alreadyProcessedABranch.pop ();
- token = scanner.getToken ();
- break;
- }
- case Token.Define:
- define ();
- break;
- case Token.Undef:
- undefine ();
- break;
- case Token.Pragma:
- pragma ();
- break;
- case Token.Unknown:
- if (!parser.noWarn)
- ParseException.warning (scanner, Util.getMessage ("Preprocessor.unknown", token.name));
- case Token.Error:
- case Token.Line:
- case Token.Null:
- // ignore
- default:
- scanner.skipLineComment ();
- token = scanner.getToken ();
- }
- }
- catch (IOException e)
- {
- // <f46082.40> Underscore may now precede any identifier, so underscoreOK
- // is vestigal. The Preprocessor must reset escapedOK so that Scanner
- // will process escaped identifiers according to specification.
- //scanner.underscoreOK = false;
- scanner.escapedOK = true;
- throw e;
- }
- catch (ParseException e)
- {
- // <f46082.40> See above.
- //scanner.underscoreOK = false;
- scanner.escapedOK = true;
- throw e;
- }
- // <f46082.40> See above.
- //scanner.underscoreOK = false;
- scanner.escapedOK = true;
- return token;
- } // process
-
- /**
- *
- **/
- private void include () throws IOException, ParseException
- {
- match (Token.Include);
- IncludeEntry include = parser.stFactory.includeEntry (parser.currentModule);
- include.sourceFile (scanner.fileEntry ());
- scanner.fileEntry ().addInclude (include);
- if (token.type == Token.StringLiteral)
- include2 (include);
- else if (token.type == Token.LessThan)
- include3 (include);
- else
- {
- int[] expected = {Token.StringLiteral, Token.LessThan};
- throw ParseException.syntaxError (scanner, expected, token.type);
- }
- if (parser.currentModule instanceof ModuleEntry)
- ((ModuleEntry)parser.currentModule).addContained (include);
- else if (parser.currentModule instanceof InterfaceEntry)
- ((InterfaceEntry)parser.currentModule).addContained (include);
- } // include
-
- /**
- *
- **/
- private void include2 (IncludeEntry include) throws IOException, ParseException
- {
- include.name ('"' + token.name + '"');
- include4 (include, token.name);
- match (Token.StringLiteral);
- } // include2
-
- /**
- *
- **/
- private void include3 (IncludeEntry include) throws IOException, ParseException
- {
- if (token.type != Token.LessThan)
- // match will throw an exception
- match (Token.LessThan);
- else
- {
- try
- {
- String includeFile = getUntil ('>');
- token = scanner.getToken ();
- include.name ('<' + includeFile + '>');
- include4 (include, includeFile);
- match (Token.GreaterThan);
- }
- catch (IOException e)
- {
- throw ParseException.syntaxError (scanner, ">", "EOF");
- }
- }
- } // include3
-
- /**
- *
- **/
- private void include4 (IncludeEntry include, String filename) throws IOException, ParseException
- {
- try
- {
- // If the #include is at the global scope, it is treated as
- // an import statement. If it is within some other scope, it
- // is treated as a normal #include.
- boolean includeIsImport = parser.currentModule == parser.topLevelModule;
- //daz
- include.absFilename (Util.getAbsolutePath (filename, parser.paths));
- scanner.scanIncludedFile (include, getFilename (filename), includeIsImport);
- }
- catch (IOException e)
- {
- ParseException.generic (scanner, e.toString ());
- }
- } // include4
-
- /**
- *
- **/
- private void define () throws IOException, ParseException
- {
- match (Token.Define);
- if (token.equals (Token.Identifier))
- {
- String symbol = scanner.getStringToEOL ();
- symbols.put (token.name, symbol.trim ());
- match (Token.Identifier);
- }
- else if (token.equals (Token.MacroIdentifier))
- {
- symbols.put (token.name, '(' + scanner.getStringToEOL () . trim ());
- macros.addElement (token.name);
- match (Token.MacroIdentifier);
- }
- else
- throw ParseException.syntaxError (scanner, Token.Identifier, token.type);
- } // define
-
- /**
- *
- **/
- private void undefine () throws IOException, ParseException
- {
- match (Token.Undef);
- if (token.equals (Token.Identifier))
- {
- symbols.remove (token.name);
- macros.removeElement (token.name);
- match (Token.Identifier);
- }
- else
- throw ParseException.syntaxError (scanner, Token.Identifier, token.type);
- } // undefine
-
- /**
- *
- **/
- private void ifClause () throws IOException, ParseException
- {
- match (Token.If);
- constExpr ();
- } // ifClause
-
- /**
- *
- **/
- private void constExpr () throws IOException, ParseException
- {
- SymtabEntry dummyEntry = new SymtabEntry (parser.currentModule);
- dummyEntry.container (parser.currentModule);
- parser.parsingConditionalExpr = true;
- Expression boolExpr = booleanConstExpr (dummyEntry);
- parser.parsingConditionalExpr = false;
- boolean expr;
- if (boolExpr.value () instanceof Boolean)
- expr = ((Boolean)boolExpr.value ()).booleanValue ();
- else
- expr = ((Number)boolExpr.value ()).longValue () != 0;
- alreadyProcessedABranch.push (new Boolean (expr));
- if (!expr)
- skipToEndiforElse ();
- } // constExpr
-
- /**
- *
- **/
- Expression booleanConstExpr (SymtabEntry entry) throws IOException, ParseException
- {
- Expression expr = orExpr (null, entry);
- try
- {
- expr.evaluate ();
- }
- catch (EvaluationException e)
- {
- ParseException.evaluationError (scanner, e.toString ());
- }
- return expr;
- } // booleanConstExpr
-
- /**
- *
- **/
- private Expression orExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
- {
- if (e == null)
- e = andExpr (null, entry);
- else
- {
- BinaryExpr b = (BinaryExpr)e;
- b.right (andExpr (null, entry));
- e.rep (e.rep () + b.right ().rep ());
- }
- if (token.equals (Token.DoubleBar))
- {
- match (token.type);
- BooleanOr or = parser.exprFactory.booleanOr (e, null);
- or.rep (e.rep () + " || ");
- return orExpr (or, entry);
- }
- else
- return e;
- } // orExpr
-
- /**
- *
- **/
- private Expression andExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
- {
- if (e == null)
- e = notExpr (entry);
- else
- {
- BinaryExpr b = (BinaryExpr)e;
- b.right (notExpr (entry));
- e.rep (e.rep () + b.right ().rep ());
- }
- if (token.equals (Token.DoubleAmpersand))
- {
- match (token.type);
- BooleanAnd and = parser.exprFactory.booleanAnd (e, null);
- and.rep (e.rep () + " && ");
- return andExpr (and, entry);
- }
- else
- return e;
- } // andExpr
-
- /**
- *
- **/
- private Expression notExpr (/*boolean alreadySawExclamation, */SymtabEntry entry) throws IOException, ParseException
- {
- Expression e;
- if (token.equals (Token.Exclamation))
- {
- match (Token.Exclamation);
- e = parser.exprFactory.booleanNot (definedExpr (entry));
- e.rep ("!" + ((BooleanNot)e).operand ().rep ());
- }
- else
- e = definedExpr (entry);
- return e;
- } // notExpr
-
- /**
- *
- **/
- private Expression definedExpr (SymtabEntry entry) throws IOException, ParseException
- {
- if (token.equals (Token.Identifier) && token.name.equals ("defined"))
- match (Token.Identifier);
- return equalityExpr (null, entry);
- } // definedExpr
-
- /**
- *
- **/
- private Expression equalityExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
- {
- if (e == null)
- {
- parser.token = token; // Since parser to parse, give it this token
- e = parser.constExp (entry);
- token = parser.token; // Since parser last parsed, get its token
- }
- else
- {
- BinaryExpr b = (BinaryExpr)e;
- parser.token = token; // Since parser to parse, give it this token
- Expression constExpr = parser.constExp (entry);
- token = parser.token; // Since parser last parsed, get its token
- b.right (constExpr);
- e.rep (e.rep () + b.right ().rep ());
- }
- if (token.equals (Token.DoubleEqual))
- {
- match (token.type);
- Equal eq = parser.exprFactory.equal (e, null);
- eq.rep (e.rep () + " == ");
- return equalityExpr (eq, entry);
- }
- else if (token.equals (Token.NotEqual))
- {
- match (token.type);
- NotEqual n = parser.exprFactory.notEqual (e, null);
- n.rep (e.rep () + " != ");
- return equalityExpr (n, entry);
- }
- else if (token.equals (Token.GreaterThan))
- {
- match (token.type);
- GreaterThan g = parser.exprFactory.greaterThan (e, null);
- g.rep (e.rep () + " > ");
- return equalityExpr (g, entry);
- }
- else if (token.equals (Token.GreaterEqual))
- {
- match (token.type);
- GreaterEqual g = parser.exprFactory.greaterEqual (e, null);
- g.rep (e.rep () + " >= ");
- return equalityExpr (g, entry);
- }
- else if (token.equals (Token.LessThan))
- {
- match (token.type);
- LessThan l = parser.exprFactory.lessThan (e, null);
- l.rep (e.rep () + " < ");
- return equalityExpr (l, entry);
- }
- else if (token.equals (Token.LessEqual))
- {
- match (token.type);
- LessEqual l = parser.exprFactory.lessEqual (e, null);
- l.rep (e.rep () + " <= ");
- return equalityExpr (l, entry);
- }
- else
- return e;
- } // equalityExpr
-
- /**
- *
- **/
- Expression primaryExpr (SymtabEntry entry) throws IOException, ParseException
- {
- Expression primary = null;
- switch (token.type)
- {
- case Token.Identifier:
- // If an identifier gets this far, it means that no
- // preprocessor variable was defined with that name.
- // Generate a FALSE boolean expr.
- //daz primary = parser.exprFactory.terminal ("0", new Long (0));
- primary = parser.exprFactory.terminal ("0", BigInteger.valueOf (0));
- token = scanner.getToken ();
- break;
- case Token.BooleanLiteral:
- case Token.CharacterLiteral:
- case Token.IntegerLiteral:
- case Token.FloatingPointLiteral:
- case Token.StringLiteral:
- //daz primary = parser.literal ();
- primary = parser.literal (entry);
- token = parser.token;
- break;
- case Token.LeftParen:
- match (Token.LeftParen);
- primary = booleanConstExpr (entry);
- match (Token.RightParen);
- primary.rep ('(' + primary.rep () + ')');
- break;
- default:
- int[] expected = {Token.Literal, Token.LeftParen};
- throw ParseException.syntaxError (scanner, expected, token.type);
- }
- return primary;
- } // primaryExpr
-
- /**
- *
- **/
- private void ifDefine (boolean inParens, boolean not) throws IOException, ParseException
- {
- if (token.equals (Token.Identifier))
- if ((not && symbols.containsKey (token.name)) || (!not && !symbols.containsKey (token.name)))
- {
- alreadyProcessedABranch.push (new Boolean (false));
- skipToEndiforElse ();
- }
- else
- {
- alreadyProcessedABranch.push (new Boolean (true));
- match (Token.Identifier);
- if (inParens)
- match (Token.RightParen);
- }
- else
- throw ParseException.syntaxError (scanner, Token.Identifier, token.type);
- } // ifDefine
-
- /**
- *
- **/
- private void ifdef (boolean not) throws IOException, ParseException
- {
- if (not)
- match (Token.Ifndef);
- else
- match (Token.Ifdef);
- if (token.equals (Token.Identifier))
- if ((not && symbols.containsKey (token.name)) || (!not && !symbols.containsKey (token.name)))
- {
- alreadyProcessedABranch.push (new Boolean (false));
- skipToEndiforElse ();
- }
- else
- {
- alreadyProcessedABranch.push (new Boolean (true));
- match (Token.Identifier);
- }
- else
- throw ParseException.syntaxError (scanner, Token.Identifier, token.type);
- } // ifdef
-
- /**
- *
- **/
- private void elif () throws IOException, ParseException
- {
- if (alreadyProcessedABranch.empty ())
- throw ParseException.elseNoIf (scanner);
- else if (((Boolean)alreadyProcessedABranch.peek ()).booleanValue ())
- skipToEndif ();
- else
- {
- match (Token.Elif);
- constExpr ();
- }
- } // elif
-
- /**
- *
- **/
- private void skipToEndiforElse () throws IOException, ParseException
- {
- while (!token.equals (Token.Endif) && !token.equals (Token.Else) && !token.equals (Token.Elif))
- {
- if (token.equals (Token.Ifdef) || token.equals (Token.Ifndef))
- {
- alreadyProcessedABranch.push (new Boolean (true));
- skipToEndif ();
- }
- else
- token = scanner.skipUntil ('#');
- }
- process (token);
- } // skipToEndiforElse
-
- /**
- *
- **/
- private void skipToEndif () throws IOException, ParseException
- {
- while (!token.equals (Token.Endif))
- {
- token = scanner.skipUntil ('#');
- if (token.equals (Token.Ifdef) || token.equals (Token.Ifndef))
- {
- alreadyProcessedABranch.push (new Boolean (true));
- skipToEndif ();
- }
- }
- alreadyProcessedABranch.pop ();
- match (Token.Endif);
- } // skipToEndif
-
- ///////////////
- // For Pragma
-
- /**
- *
- **/
- private void pragma () throws IOException, ParseException
- {
- match (Token.Pragma);
- String pragmaType = token.name;
-
- // <d59165> Enable escaped identifiers while processing pragma internals.
- // Don't enable until scanning pragma name!
- scanner.escapedOK = true;
- match (Token.Identifier);
-
- // Add pragma entry to container
- PragmaEntry pragmaEntry = parser.stFactory.pragmaEntry (parser.currentModule);
- pragmaEntry.name (pragmaType);
- pragmaEntry.sourceFile (scanner.fileEntry ());
- pragmaEntry.data (scanner.currentLine ());
- if (parser.currentModule instanceof ModuleEntry)
- ((ModuleEntry)parser.currentModule).addContained (pragmaEntry);
- else if (parser.currentModule instanceof InterfaceEntry)
- ((InterfaceEntry)parser.currentModule).addContained (pragmaEntry);
-
- // If the token was an identifier, then pragmaType WILL be non-null.
- if (pragmaType.equals ("ID"))
- idPragma ();
- else if (pragmaType.equals ("prefix"))
- prefixPragma ();
- else if (pragmaType.equals ("version"))
- versionPragma ();
-
- // we are adding extensions to the Sun's idlj compiler to
- // handle correct code generation for local Objects, where
- // the OMG is taking a long time to formalize stuff. Good
- // example of this is poa.idl. Two proprietory pragmas
- // sun_local and sun_localservant are defined. sun_local
- // generates only Holder and Helper classes, where read
- // and write methods throw marshal exceptions. sun_localservant
- // is to generate Helper, Holder, and only Skel with _invoke
- // throwing an exception, since it does not make sense for
- // local objects.
-
- else if (pragmaType.equals ("sun_local"))
- localPragma();
- else if (pragmaType.equals ("sun_localservant"))
- localServantPragma();
- else
- {
- otherPragmas (pragmaType, tokenToString ());
- token = scanner.getToken ();
- }
-
- scanner.escapedOK = false; // <d59165> Disable escaped identifiers.
- } // pragma
-
- // <d57110> Pragma ID can be appiled to modules and it is an error to
- // name a type in more than one ID pragma directive.
-
- private Vector PragmaIDs = new Vector ();
-
- private void localPragma () throws IOException, ParseException
- {
- // Before I can use a parser method, I must make sure it has the current token.
- parser.token = token;
- // this makes sense only for interfaces, if specified for modules,
- // parser should throw an error
- SymtabEntry anErrorOccurred = new SymtabEntry ();
- SymtabEntry entry = parser.scopedName (parser.currentModule, anErrorOccurred);
- // Was the indicated type found in the symbol table?
- if (entry == anErrorOccurred)
- {
- System.out.println("Error occured ");
- // Don't have to generate an error, scopedName already has.
- scanner.skipLineComment ();
- token = scanner.getToken ();
- }
- else
- {
- // by this time we have already parsed the ModuleName and the
- // pragma type, therefore setInterfaceType
- if (entry instanceof InterfaceEntry) {
- InterfaceEntry ent = (InterfaceEntry) entry;
- ent.setInterfaceType (InterfaceEntry.LOCAL_SIGNATURE_ONLY);
- }
- token = parser.token;
- String string = token.name;
- match (Token.StringLiteral);
- // for non-interfaces it doesn't make sense, so just ignore it
- }
- } // localPragma
-
- private void localServantPragma () throws IOException, ParseException
- {
- // Before I can use a parser method, I must make sure it has the current token.
- parser.token = token;
- // this makes sense only for interfaces, if specified for modules,
- // parser should throw an error
- SymtabEntry anErrorOccurred = new SymtabEntry ();
- SymtabEntry entry = parser.scopedName (parser.currentModule, anErrorOccurred);
-
- // Was the indicated type found in the symbol table?
- if (entry == anErrorOccurred)
- {
- // Don't have to generate an error, scopedName already has.
- scanner.skipLineComment ();
- token = scanner.getToken ();
- System.out.println("Error occured ");
- }
- else
- {
- // by this time we have already parsed the ModuleName and the
- // pragma type, therefore setInterfaceType
- if (entry instanceof InterfaceEntry) {
- InterfaceEntry ent = (InterfaceEntry) entry;
- ent.setInterfaceType (InterfaceEntry.LOCALSERVANT);
- }
- token = parser.token;
- String string = token.name;
- match (Token.StringLiteral);
- // for non-interfaces it doesn't make sense, so just ignore it
- }
- } // localServantPragma
-
-
- /**
- *
- **/
- private void idPragma () throws IOException, ParseException
- {
- // Before I can use a parser method, I must make sure it has the current token.
- parser.token = token;
-
- // <d57110> This flag will relax the restriction that the scopedNamed
- // in this ID pragma directive cannot resolve to a module.
- parser.isModuleLegalType (true);
- SymtabEntry anErrorOccurred = new SymtabEntry ();
- SymtabEntry entry = parser.scopedName (parser.currentModule, anErrorOccurred);
- parser.isModuleLegalType (false); // <57110>
-
- // Was the indicated type found in the symbol table?
- if (entry == anErrorOccurred)
- {
- // Don't have to generate an error, scopedName already has.
- scanner.skipLineComment ();
- token = scanner.getToken ();
- }
- // <d57110>
- //else if (PragmaIDs.contains (entry))
- //{
- // ParseException.badRepIDAlreadyAssigned (scanner, entry.name ());
- // scanner.skipLineComment ();
- // token = scanner.getToken ();
- //}
- else
- {
- token = parser.token;
- String string = token.name;
- // Do not match token until after raise exceptions, otherwise
- // incorrect messages will be emitted!
- if (PragmaIDs.contains (entry)) // <d57110>
- {
- ParseException.badRepIDAlreadyAssigned (scanner, entry.name ());
- }
- else if (!RepositoryID.hasValidForm (string)) // <d57110>
- {
- ParseException.badRepIDForm (scanner, string);
- }
- else
- {
- entry.repositoryID (new RepositoryID (string));
- PragmaIDs.addElement (entry); // <d57110>
- }
- match (Token.StringLiteral);
- }
- } // idPragma
-
- /**
- *
- **/
- private void prefixPragma () throws IOException, ParseException
- {
- String string = token.name;
- match (Token.StringLiteral);
- ((IDLID)parser.repIDStack.peek ()).prefix (string);
- ((IDLID)parser.repIDStack.peek ()).name ("");
- } // prefixPragma
-
- /**
- *
- **/
- private void versionPragma () throws IOException, ParseException
- {
- // Before I can use a parser method, I must make sure it has the current token.
- parser.token = token;
- // This flag will relax the restriction that the scopedNamed
- // in this Version pragma directive cannot resolve to a module.
- parser.isModuleLegalType (true);
- SymtabEntry anErrorOccurred = new SymtabEntry ();
- SymtabEntry entry = parser.scopedName (parser.currentModule, anErrorOccurred);
- // reset the flag to original value
- parser.isModuleLegalType (false);
- if (entry == anErrorOccurred)
- {
- // Don't have to generate an error, scopedName already has.
- scanner.skipLineComment ();
- token = scanner.getToken ();
- }
- else
- {
- token = parser.token;
- String string = token.name;
- match (Token.FloatingPointLiteral);
- if (entry.repositoryID () instanceof IDLID)
- ((IDLID)entry.repositoryID ()).version (string);
- }
- } // versionPragma
-
- private Vector pragmaHandlers = new Vector ();
-
- /**
- *
- **/
- void registerPragma (PragmaHandler handler)
- {
- pragmaHandlers.addElement (handler);
- } // registerPragma
-
- /**
- *
- **/
- private void otherPragmas (String pragmaType, String currentToken) throws IOException
- {
- for (int i = pragmaHandlers.size () - 1; i >= 0; --i)
- {
- PragmaHandler handler = (PragmaHandler)pragmaHandlers.elementAt (i);
- if (handler.process (pragmaType, currentToken))
- break;
- }
- } // otherPragmas
-
- /*
- * These protected methods are used by extenders, by the code
- * which implements otherPragma.
- */
-
- /**
- * Get the current token.
- **/
- String currentToken ()
- {
- return tokenToString ();
- } // currentToken
-
- /**
- * This method, given an entry name, returns the entry with that name.
- * It can take fully or partially qualified names and returns the
- * appropriate entry defined within the current scope. If no entry
- * exists, null is returned.
- **/
- SymtabEntry getEntryForName (String string)
- {
- boolean partialScope = false;
- boolean globalScope = false;
-
- // Change all ::'s to /'s
- if (string.startsWith ("::"))
- {
- globalScope = true;
- string = string.substring (2);
- }
- int index = string.indexOf ("::");
- while (index >= 0)
- {
- partialScope = true;
- string = string.substring (0, index) + '/' + string.substring (index + 2);
- index = string.indexOf ("::");
- }
-
- // Get the entry for that string
- SymtabEntry entry = null;
- if (globalScope)
- entry = parser.recursiveQualifiedEntry (string);
- else if (partialScope)
- entry = parser.recursivePQEntry (string, parser.currentModule);
- else
- entry = parser.unqualifiedEntryWMod (string, parser.currentModule);
- return entry;
- } // getEntryForName
-
- /**
- * This method returns a string of all of the characters from the
- * input file from the current position up to, but not including,
- * the end-of-line character(s).
- **/
- String getStringToEOL () throws IOException
- {
- return scanner.getStringToEOL ();
- } // getStringToEOL
-
- /**
- * This method returns a string of all of the characters from the
- * input file from the current position up to, but not including,
- * the given character. It encapsulates parenthesis and quoted strings,
- * meaning it does not stop if the given character is found within
- * parentheses or quotes. For instance, given the input of
- * `start(inside)end', getUntil ('n') will return "start(inside)e"
- **/
- String getUntil (char c) throws IOException
- {
- return scanner.getUntil (c);
- } // getUntil
-
- private boolean lastWasMacroID = false;
-
- /**
- *
- **/
- private String tokenToString ()
- {
- if (token.equals (Token.MacroIdentifier))
- {
- lastWasMacroID = true;
- return token.name;
- }
- else if (token.equals (Token.Identifier))
- return token.name;
- else
- return token.toString ();
- } // tokenToString
-
- /**
- * This method returns the next token String from the input file.
- **/
- String nextToken () throws IOException
- {
- if (lastWasMacroID)
- {
- lastWasMacroID = false;
- return "(";
- }
- else
- {
- token = scanner.getToken ();
- return tokenToString ();
- }
- } // nextToken
-
- /**
- * This method assumes that the current token marks the beginning
- * of a scoped name. It then parses the subsequent identifier and
- * double colon tokens, builds the scoped name, and finds the symbol
- * table entry with that name.
- **/
- SymtabEntry scopedName () throws IOException
- {
- boolean globalScope = false;
- boolean partialScope = false;
- String name = null;
- SymtabEntry entry = null;
- try
- {
- if (token.equals (Token.DoubleColon))
- globalScope = true;
- else
- {
- if (token.equals (Token.Object))
- {
- name = "Object";
- match (Token.Object);
- }
- else if (token.type == Token.ValueBase)
- {
- name = "ValueBase";
- match (Token.ValueBase);
- }
- else
- {
- name = token.name;
- match (Token.Identifier);
- }
- }
- while (token.equals (Token.DoubleColon))
- {
- match (Token.DoubleColon);
- partialScope = true;
- if (name != null)
- name = name + '/' + token.name;
- else
- name = token.name;
- match (Token.Identifier);
- }
- if (globalScope)
- entry = parser.recursiveQualifiedEntry (name);
- else if (partialScope)
- entry = parser.recursivePQEntry (name, parser.currentModule);
- else
- entry = parser.unqualifiedEntryWMod (name, parser.currentModule);
- }
- catch (ParseException e)
- {
- entry = null;
- }
- return entry;
- } // scopedName
-
- /**
- * Skip to the end of the line.
- **/
- void skipToEOL () throws IOException
- {
- scanner.skipLineComment ();
- } // skipToEOL
-
- /**
- * This method skips the data in the input file until the specified
- * character is encountered, then it returns the next token.
- **/
- String skipUntil (char c) throws IOException
- {
- if (!(lastWasMacroID && c == '('))
- token = scanner.skipUntil (c);
- return tokenToString ();
- } // skipUntil
-
- /**
- * This method displays a Parser Exception complete with line number
- * and position information with the given message string.
- **/
- void parseException (String message)
- {
- // <d62023> Suppress warnings
- if (!parser.noWarn)
- ParseException.warning (scanner, message);
- } // parseException
-
- // For Pragma
- ///////////////
- // For macro expansion
-
- /**
- *
- **/
- String expandMacro (String macroDef, Token t) throws IOException, ParseException
- {
- token = t;
- // Get the parameter values from the macro 'call'
- Vector parmValues = getParmValues ();
-
- // Get the parameter names from the macro definition
- // NOTE: a newline character is appended here so that when
- // getStringToEOL is called, it stops scanning at the end
- // of this string.
- scanner.scanString (macroDef + '\n');
- Vector parmNames = new Vector ();
- macro (parmNames);
-
- if (parmValues.size () < parmNames.size ())
- throw ParseException.syntaxError (scanner, Token.Comma, Token.RightParen);
- else if (parmValues.size () > parmNames.size ())
- throw ParseException.syntaxError (scanner, Token.RightParen, Token.Comma);
-
- macroDef = scanner.getStringToEOL ();
- for (int i = 0; i < parmNames.size (); ++i)
- macroDef = replaceAll (macroDef, (String)parmNames.elementAt (i), (String)parmValues.elementAt (i));
- return removeDoublePound (macroDef);
- } // expandMacro
-
- // This method is only used by the macro expansion methods.
- /**
- *
- **/
- private void miniMatch (int type) throws ParseException
- {
- // A normal production would now execute:
- // match (type);
- // But match reads the next token. I don't want to do that now.
- // Just make sure the current token is a 'type'.
- if (!token.equals (type))
- throw ParseException.syntaxError (scanner, type, token.type);
- } // miniMatch
-
- /**
- *
- **/
- private Vector getParmValues () throws IOException, ParseException
- {
- Vector values = new Vector ();
- if (token.equals (Token.Identifier))
- {
- match (Token.Identifier);
- miniMatch (Token.LeftParen);
- }
- else if (!token.equals (Token.MacroIdentifier))
- throw ParseException.syntaxError (scanner, Token.Identifier, token.type);
-
- if (!token.equals (Token.RightParen))
- {
- values.addElement (scanner.getUntil (',', ')').trim ());
- token = scanner.getToken ();
- macroParmValues (values);
- }
- return values;
- } // getParmValues
-
- /**
- *
- **/
- private void macroParmValues (Vector values) throws IOException, ParseException
- {
- while (!token.equals (Token.RightParen))
- {
- miniMatch (Token.Comma);
- values.addElement (scanner.getUntil (',', ')').trim ());
- token = scanner.getToken ();
- }
- } // macroParmValues
-
- /**
- *
- **/
- private void macro (Vector parmNames) throws IOException, ParseException
- {
- match (token.type);
- match (Token.LeftParen);
- macroParms (parmNames);
- miniMatch (Token.RightParen);
- } // macro
-
- /**
- *
- **/
- private void macroParms (Vector parmNames) throws IOException, ParseException
- {
- if (!token.equals (Token.RightParen))
- {
- parmNames.addElement (token.name);
- match (Token.Identifier);
- macroParms2 (parmNames);
- }
- } // macroParms
-
- /**
- *
- **/
- private void macroParms2 (Vector parmNames) throws IOException, ParseException
- {
- while (!token.equals (Token.RightParen))
- {
- match (Token.Comma);
- parmNames.addElement (token.name);
- match (Token.Identifier);
- }
- } // macroParms2
-
- /**
- *
- **/
- private String replaceAll (String string, String from, String to)
- {
- int index = 0;
- while (index != -1)
- {
- index = string.indexOf (from, index);
- if (index != -1)
- {
- if (!embedded (string, index, index + from.length ()))
- if (index > 0 && string.charAt(index) == '#')
- string = string.substring (0, index) + '"' + to + '"' + string.substring (index + from.length ());
- else
- string = string.substring (0, index) + to + string.substring (index + from.length ());
- index += to.length ();
- }
- }
- return string;
- } // replaceAll
-
- /**
- *
- **/
- private boolean embedded (String string, int index, int endIndex)
- {
- // Don't replace if found substring is not an independent id.
- // For example, don't replace "thither".indexOf ("it", 0)
- boolean ret = false;
- char preCh = index == 0 ? ' ' : string.charAt (index - 1);
- char postCh = endIndex >= string.length () - 1 ? ' ' : string.charAt (endIndex);
- if ((preCh >= 'a' && preCh <= 'z') || (preCh >= 'A' && preCh <= 'Z'))
- ret = true;
- else if ((postCh >= 'a' && postCh <= 'z') || (postCh >= 'A' && postCh <= 'Z') || (postCh >= '0' && postCh <= '9') || postCh == '_')
- ret = true;
- else
- ret = inQuotes (string, index);
- return ret;
- } // embedded
-
- /**
- *
- **/
- private boolean inQuotes (String string, int index)
- {
- int quoteCount = 0;
- for (int i = 0; i < index; ++i)
- if (string.charAt (i) == '"') ++quoteCount;
- // If there are an odd number of quotes before this region,
- // then this region is within quotes
- return quoteCount % 2 != 0;
- } // inQuotes
-
- /**
- * Remove any occurrences of ##.
- **/
- private String removeDoublePound (String string)
- {
- int index = 0;
- while (index != -1)
- {
- index = string.indexOf ("##", index);
- if (index != -1)
- {
- int startSkip = index - 1;
- int stopSkip = index + 2;
- if (startSkip < 0)
- startSkip = 0;
- if (stopSkip >= string.length ())
- stopSkip = string.length () - 1;
- while (startSkip > 0 &&
- (string.charAt (startSkip) == ' ' ||
- string.charAt (startSkip) == '\t'))
- --startSkip;
- while (stopSkip < string.length () - 1 &&
- (string.charAt (stopSkip) == ' ' ||
- string.charAt (stopSkip) == '\t'))
- ++stopSkip;
- string = string.substring (0, startSkip + 1) + string.substring (stopSkip);
- }
- }
- return string;
- } // removeDoublePound
-
- // For macro expansion
- ///////////////
-
- /**
- *
- **/
- private String getFilename (String name) throws FileNotFoundException
- {
- String fullName = null;
- File file = new File (name);
- if (file.canRead ())
- fullName = name;
- else
- {
- Enumeration pathList = parser.paths.elements ();
- while (!file.canRead () && pathList.hasMoreElements ())
- {
- fullName = (String)pathList.nextElement () + File.separatorChar + name;
- file = new File (fullName);
- }
- if (!file.canRead ())
- throw new FileNotFoundException (name);
- }
- return fullName;
- } // getFilename
-
- /**
- *
- **/
- private void match (int type) throws IOException, ParseException
- {
- if (!token.equals (type))
- throw ParseException.syntaxError (scanner, type, token.type);
- token = scanner.getToken ();
-
- // <d62023> Added for convenience, but commented-out because there is
- // no reason to issue warnings for tokens scanned during preprocessing.
- // See issueTokenWarnings().
- //issueTokenWarnings ();
-
- //System.out.println ("Preprocessor.match token = " + token.type);
- //if (token.equals (Token.Identifier) || token.equals (Token.MacroIdentifier))
- // System.out.println ("Preprocessor.match token name = " + token.name);
-
- // If the token is a defined thingy, scan the defined string
- // instead of the input stream for a while.
- if (token.equals (Token.Identifier) || token.equals (Token.MacroIdentifier))
- {
- String string = (String)symbols.get (token.name);
- if (string != null && !string.equals (""))
- // If this is a macro, parse the macro
- if (macros.contains (token.name))
- {
- scanner.scanString (expandMacro (string, token));
- token = scanner.getToken ();
- }
- // else this is just a normal define
- else
- {
- scanner.scanString (string);
- token = scanner.getToken ();
- }
- }
- } // match
-
- // <d62023>
- /**
- * Issue warnings about tokens scanned during preprocessing.
- **/
- private void issueTokenWarnings ()
- {
- if (parser.noWarn)
- return;
-
- // There are no keywords defined for preprocessing (only directives), so:
- //
- // 1.) Do not issue warnings for identifiers known to be keywords in
- // another level of IDL.
- // 2.) Do not issue warnings for identifiers that collide with keywords
- // in letter, but not case.
- // 3.) Do not issue warnings for deprecated keywords.
- //
- // Should we warn when a macro identifier replaces a keyword? Hmmm.
-
- // Deprecated directives? None to date.
- //if (token.isDirective () && token.isDeprecated ())
- // ParseException.warning (scanner, Util.getMesage ("Deprecated.directive", token.name));
- } // issueTokenWarnings
-
- /**
- * This method is called when the parser encounters a left curly brace.
- * An extender of PragmaHandler may find scope information useful.
- * For example, the prefix pragma takes effect as soon as it is
- * encountered and stays in effect until the current scope is closed.
- * If a similar pragma extension is desired, then the openScope and
- * closeScope methods are available for overriding.
- * @param entry the symbol table entry whose scope has just been opened.
- * Be aware that, since the scope has just been entered, this entry is
- * incomplete at this point.
- **/
- void openScope (SymtabEntry entry)
- {
- for (int i = pragmaHandlers.size () - 1; i >= 0; --i)
- {
- PragmaHandler handler = (PragmaHandler)pragmaHandlers.elementAt (i);
- handler.openScope (entry);
- }
- } // openScope
-
- /**
- * This method is called when the parser encounters a right curly brace.
- * An extender of PragmaHandler may find scope information useful.
- * For example, the prefix pragma takes effect as soon as it is
- * encountered and stays in effect until the current scope is closed.
- * If a similar pragma extension is desired, then the openScope and
- * closeScope methods are available for overriding.
- * @param entry the symbol table entry whose scope has just been closed.
- **/
- void closeScope (SymtabEntry entry)
- {
- for (int i = pragmaHandlers.size () - 1; i >= 0; --i)
- {
- PragmaHandler handler = (PragmaHandler)pragmaHandlers.elementAt (i);
- handler.closeScope (entry);
- }
- } // closeScope
-
- private Parser parser;
- private Scanner scanner;
- private Hashtable symbols;
- private Vector macros;
-
- // The logic associated with this stack is scattered above.
- // A concise map of the logic is:
- // case #if false, #ifdef false, #ifndef true
- // push (false);
- // skipToEndifOrElse ();
- // case #if true, #ifdef true, #ifndef false
- // push (true);
- // case #elif <conditional>
- // if (top == true)
- // skipToEndif ();
- // else if (conditional == true)
- // pop ();
- // push (true);
- // else if (conditional == false)
- // skipToEndifOrElse ();
- // case #else
- // if (top == true)
- // skipToEndif ();
- // else
- // pop ();
- // push (true);
- // case #endif
- // pop ();
- private Stack alreadyProcessedABranch = new Stack ();
- Token token;
-
- private static String indent = "";
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/PrimitiveEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/PrimitiveEntry.java
deleted file mode 100644
index 8fb700b..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/PrimitiveEntry.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-/**
- * This is the symbol table entry for primitive types: octet, char,
- * short, long, long long (and unsigned versions), float, double, string.
- **/
-public class PrimitiveEntry extends SymtabEntry
-{
- protected PrimitiveEntry ()
- {
- super ();
- repositoryID (Util.emptyID);
- } // ctor
-
- protected PrimitiveEntry (String name)
- {
- name (name);
- module ("");
- repositoryID (Util.emptyID);
- } // ctor
-
- protected PrimitiveEntry (PrimitiveEntry that)
- {
- super (that);
- } // ctor
-
- public Object clone ()
- {
- return new PrimitiveEntry (this);
- } // clone
-
- /** Invoke the primitive type generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- primitiveGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the primitive type generator.
- @returns an object which implements the PrimitiveGen interface.
- @see PrimitiveGen */
- public Generator generator ()
- {
- return primitiveGen;
- } // generator
-
- static PrimitiveGen primitiveGen;
-} // class PrimitiveEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/PrimitiveGen.java b/src/share/classes/com/sun/tools/corba/se/idl/PrimitiveGen.java
deleted file mode 100644
index 601cddc..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/PrimitiveGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface PrimitiveGen extends Generator
-{
- void generate (Hashtable symbolTable, PrimitiveEntry entry, PrintWriter stream);
-} // interface PrimitiveGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/RepositoryID.java b/src/share/classes/com/sun/tools/corba/se/idl/RepositoryID.java
deleted file mode 100644
index 8faebf4..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/RepositoryID.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-// -D57110<daz> Add method to verify format (CORBA 2.3).
-
-public class RepositoryID
-{
- public RepositoryID ()
- {
- _id = "";
- } // ctor
-
- public RepositoryID (String id)
- {
- _id = id;
- } // ctor
-
- public String ID ()
- {
- return _id;
- } // ID
-
- public Object clone ()
- {
- return new RepositoryID (_id);
- } // clone
-
- public String toString ()
- {
- return ID ();
- } // toString
-
- /**
- * Determine is a supplied string meets the minimal format requirement
- * for a Repository ID.
- * @return true iff supplied string has form '<format>:<string>', where
- * <format> is any non-empty string not containing ':'.
- **/
- public static boolean hasValidForm (String string)
- {
- return string != null && string.indexOf (':') > 0;
- } // hasValidForm
-
- private String _id;
-} // class RepositoryID
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ResourceBundleUtil.java b/src/share/classes/com/sun/tools/corba/se/idl/ResourceBundleUtil.java
deleted file mode 100644
index 9a39cbf..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ResourceBundleUtil.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-// -capitalize and parseTypeModifier should probably be in the
-// generators package.
-// -D58319<daz> Add version() method.
-
-import java.util.ResourceBundle;
-import java.text.MessageFormat;
-import java.util.Hashtable;
-
-public class ResourceBundleUtil
-{
- // <d58319>
- /**
- * Fetch the version number of this build of the IDL Parser Framework.
- * This method may be called before or after the framework has been
- * initialized. If the framework is inititialized, the version information
- * is extracted from the message properties object; otherwise, it is extracted
- * from the indicated resouce bundle.
- * @return the version number.
- **/
- public static String getVersion ()
- {
- String version = getMessage ("Version.product", getMessage ("Version.number"));
- return version;
- } // getVersion
-
-
- //////////////
- // Message-related methods
-
- public static String getMessage (String key)
- {
- return fBundle.getString(key);
- } // getMessage
-
- public static String getMessage (String key, String fill)
- {
- Object[] args = { fill };
- return MessageFormat.format(fBundle.getString(key), args);
- } // getMessage
-
- public static String getMessage (String key, String[] fill)
- {
- return MessageFormat.format(fBundle.getString(key), fill);
- } // getMessage
-
-
- /** Register a ResourceBundle. This file will be searched for
- in the CLASSPATH. */
- public static void registerResourceBundle (ResourceBundle bundle)
- {
- if (bundle != null)
- fBundle = bundle;
- } // registerResourceBundle
-
-
- /** Gets the current ResourceBundle. */
- public static ResourceBundle getResourceBundle ()
- {
- return fBundle;
- } // getResourceBundle
-
- private static ResourceBundle fBundle;
- static
- {
- // get the resource bundle for the locale on this machine
- fBundle = ResourceBundle.getBundle("com.sun.tools.corba.se.idl.idl");
- }
-
-} // class ResourceBundleUtil
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/Scanner.java b/src/share/classes/com/sun/tools/corba/se/idl/Scanner.java
deleted file mode 100644
index e1e23e1..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/Scanner.java
+++ /dev/null
@@ -1,1615 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-// -F46082.51<daz> Remove -stateful feature.
-// -D56351<daz> Update computation of RepositoryIDs to CORBA 2.3 (see spec.).
-// -D59166<daz> Add escaped-id. info. to identifiers.
-// -F60858.1<daz> Add support for -corba option, levels 2.2 and 2.3: accept 2.3
-// keywords as ids.; accept ids. that match keywords in letter, but not in case.
-// -D62023<daz> Add support for -corba option, level 2.4: see keyword checking.
-
-import java.io.EOFException;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PushbackInputStream;
-
-import java.util.Enumeration;
-import java.util.Stack;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-/**
- *
- **/
-class Scanner
-{
- // <f46082.51> -Remove stateful feature.
- //Scanner (IncludeEntry file, String[] keywords, boolean vbose, boolean scanStateful, boolean emitAllIncludes) throws IOException
- // <f60858.1>
- //Scanner (IncludeEntry file, String[] keywords, boolean vbose, boolean emitAllIncludes) throws IOException
- /**
- *
- **/
- Scanner (IncludeEntry file, String[] keywords, boolean vbose,
- boolean emitAllIncludes, float cLevel, boolean debug) throws IOException
- {
- readFile (file);
- verbose = vbose;
- // <f46082.51>
- //stateful = scanStateful;
- emitAll = emitAllIncludes;
- sortKeywords (keywords);
- corbaLevel = cLevel;
- this.debug = debug ;
- } // ctor
-
- /**
- *
- **/
- void sortKeywords (String[] keywords)
- {
- for (int i = 0; i < keywords.length; ++i)
- if (wildcardAtEitherEnd (keywords[i]))
- this.openEndedKeywords.addElement (keywords[i]);
- else if (wildcardsInside (keywords[i]))
- this.wildcardKeywords.addElement (keywords[i]);
- else
- this.keywords.addElement (keywords[i]);
- } // sortKeywords
-
- /**
- *
- **/
- private boolean wildcardAtEitherEnd (String string)
- {
- return string.startsWith ("*") ||
- string.startsWith ("+") ||
- string.startsWith (".") ||
- string.endsWith ("*") ||
- string.endsWith ("+") ||
- string.endsWith (".");
- } // wildcardAtEitherEnd
-
- /**
- *
- **/
- private boolean wildcardsInside (String string)
- {
- return string.indexOf ("*") > 0 ||
- string.indexOf ("+") > 0 ||
- string.indexOf (".") > 0;
- } // wildcardsInside
-
- /**
- *
- **/
- void readFile (IncludeEntry file) throws IOException
- {
- String filename = file.name ();
- filename = filename.substring (1, filename.length () - 1);
- readFile (file, filename);
- } // readFile
-
- /**
- *
- **/
- void readFile (IncludeEntry file, String filename) throws IOException
- {
- data.fileEntry = file;
- data.filename = filename;
- // <f49747.1>
- //FileInputStream stream = new FileInputStream (data.filename);
- //data.fileBytes = new byte [stream.available ()];
- //stream.read (data.fileBytes);
- //stream.close (); <ajb>
- File idlFile = new File (data.filename);
- int len = (int)idlFile.length ();
- FileReader fileReader = new FileReader (idlFile);
- // <d41679> data.fileBytes = new char [len];
- final String EOL = System.getProperty ("line.separator");
- data.fileBytes = new char [len + EOL.length ()];
-
- fileReader.read (data.fileBytes, 0, len);
- fileReader.close ();
-
- // <d41679>
- for (int i = 0; i < EOL.length (); i++)
- data.fileBytes[len + i] = EOL.charAt (i);
-
- readChar ();
- } // readFile
-
- /**
- *
- **/
- Token getToken () throws IOException
- {
- //System.out.println ("Scanner.getToken char = |" + data.ch + "| (ASCII " + (int)data.ch + ").");
-
- // The token could be null if the next set of characters
- // is not a token: white space, comments, ignored preprocessor
- // commands.
- Token token = null;
- String commentText = new String ("");
-
- while (token == null)
- try
- {
- data.oldIndex = data.fileIndex;
- data.oldLine = data.line;
- if (data.ch <= ' ') {
- skipWhiteSpace ();
- continue;
- }
-
- // Special case for wchar and wstring literals.
- // The values are preceded by an L.
- //
- // Bug fix 4382578: Can't compile a wchar literal.
- //
- // REVISIT. This maps wchar/wstring literals to
- // our char/string literal types. Eventually, we
- // need to write stronger checking to be spec
- // compliant in negative cases such as leaving the
- // L off of a wide string or putting it on a string.
- if (data.ch == 'L') {
- // Check to see if the next character is an
- // apostrophe.
- readChar();
- // Note: This doesn't allow for space between
- // the L and the apostrophe or quote.
- if (data.ch == '\'') {
- // It was a wchar literal. Get the value
- // and return the token.
- token = getCharacterToken(true);
- readChar();
- continue;
- } else
- if (data.ch == '"') {
- // It was a wstring literal.
- //
- // getUntil assumes we've already passed the
- // first quote.
- readChar ();
- token = new Token (Token.StringLiteral, getUntil ('"'), true);
- readChar ();
- continue;
- } else {
- // It must not have been a wchar literal.
- // Push the input back into the buffer, and
- // fall to the next if case.
- unread(data.ch);
- unread('L');
- readChar();
- }
- }
-
- if ((data.ch >= 'a' && data.ch <= 'z') ||
- (data.ch >= 'A' && data.ch <= 'Z') ||
- // <f46082.40> Escaped identifier; see data member comments.
- //(data.ch == '_' && underscoreOK) || <daz>
- (data.ch == '_') ||
- Character.isLetter (data.ch)) {
- token = getString ();
- } else
- if ((data.ch >= '0' && data.ch <= '9') || data.ch == '.') {
- token = getNumber ();
- } else {
- switch (data.ch)
- {
- case ';':
- token = new Token (Token.Semicolon);
- break;
- case '{':
- token = new Token (Token.LeftBrace);
- break;
- case '}':
- token = new Token (Token.RightBrace);
- break;
- case ':':
- readChar ();
- if (data.ch == ':')
- token = new Token (Token.DoubleColon);
- else
- {
- unread (data.ch);
- token = new Token (Token.Colon);
- }
- break;
- case ',':
- token = new Token (Token.Comma);
- break;
- case '=':
- readChar ();
- if (data.ch == '=')
- token = new Token (Token.DoubleEqual);
- else
- {
- unread (data.ch);
- token = new Token (Token.Equal);
- }
- break;
- case '+':
- token = new Token (Token.Plus);
- break;
- case '-':
- token = new Token (Token.Minus);
- break;
- case '(':
- token = new Token (Token.LeftParen);
- break;
- case ')':
- token = new Token (Token.RightParen);
- break;
- case '<':
- readChar ();
- if (data.ch == '<')
- token = new Token (Token.ShiftLeft);
- else if (data.ch == '=')
- token = new Token (Token.LessEqual);
- else
- {
- unread (data.ch);
- token = new Token (Token.LessThan);
- }
- break;
- case '>':
- readChar ();
- if (data.ch == '>')
- token = new Token (Token.ShiftRight);
- else if (data.ch == '=')
- token = new Token (Token.GreaterEqual);
- else
- {
- unread (data.ch);
- token = new Token (Token.GreaterThan);
- }
- break;
- case '[':
- token = new Token (Token.LeftBracket);
- break;
- case ']':
- token = new Token (Token.RightBracket);
- break;
- case '\'':
- token = getCharacterToken(false);
- break;
- case '"':
- readChar ();
- token = new Token (Token.StringLiteral, getUntil ('"', false, false, false));
- break;
- case '\\':
- readChar ();
- // If this is at the end of a line, then it is the
- // line continuation character - treat it as white space
- if (data.ch == '\n' || data.ch == '\r')
- token = null;
- else
- token = new Token (Token.Backslash);
- break;
- case '|':
- readChar ();
- if (data.ch == '|')
- token = new Token (Token.DoubleBar);
- else
- {
- unread (data.ch);
- token = new Token (Token.Bar);
- }
- break;
- case '^':
- token = new Token (Token.Carat);
- break;
- case '&':
- readChar ();
- if (data.ch == '&')
- token = new Token (Token.DoubleAmpersand);
- else
- {
- unread (data.ch);
- token = new Token (Token.Ampersand);
- }
- break;
- case '*':
- token = new Token (Token.Star);
- break;
- case '/':
- readChar ();
- // <21jul1997daz> Extract comments rather than skipping them.
- // Preserve only the comment immediately preceding the next token.
- if (data.ch == '/')
- //skipLineComment ();
- commentText = getLineComment();
- else if (data.ch == '*')
- //skipBlockComment ();
- commentText = getBlockComment();
- else
- {
- unread (data.ch);
- token = new Token (Token.Slash);
- }
- break;
- case '%':
- token = new Token (Token.Percent);
- break;
- case '~':
- token = new Token (Token.Tilde);
- break;
-
- // The period token is recognized in getNumber.
- // The period is only valid in a floating ponit number.
- //case '.':
- // token = new Token (Token.Period);
- // break;
-
- case '#':
- token = getDirective ();
- break;
- case '!':
- readChar ();
- if (data.ch == '=')
- token = new Token (Token.NotEqual);
- else
- {
- unread (data.ch);
- token = new Token (Token.Exclamation);
- }
- break;
- case '?':
- try
- {
- token = replaceTrigraph ();
- break;
- }
- catch (InvalidCharacter e) {}
- default:
- throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
- }
- readChar ();
- }
- }
- catch (EOFException e)
- {
- token = new Token (Token.EOF);
- }
-
- // Transfer comment to parser via token. <daz>21jul1997
- token.comment = new Comment( commentText );
-
- //System.out.println ("Scanner.getToken returning token.type = " + token.type);
- //if (token.type == Token.Identifier || token.type == Token.MacroIdentifier || (token.type >= Token.BooleanLiteral && token.type <= Token.StringLiteral))
- // System.out.println ("Scanner.getToken returns token.name = " + token.name);
-
- if (debug)
- System.out.println( "Token: " + token ) ;
-
- return token;
- } // getToken
-
- /**
- *
- **/
- void scanString (String string)
- {
- dataStack.push (data);
-
- data = new ScannerData (data);
-
- data.fileIndex = 0;
- data.oldIndex = 0;
- // <f49747.1> data.fileBytes = string.getBytes (); <ajb>
- int strLen = string.length();
- data.fileBytes = new char[strLen];
- string.getChars (0, strLen, data.fileBytes, 0);
-
- data.macrodata = true;
-
- try {readChar ();} catch (IOException e) {}
- } // scanString
-
- /**
- *
- **/
- void scanIncludedFile (IncludeEntry file, String filename, boolean includeIsImport) throws IOException
- {
- dataStack.push (data);
- data = new ScannerData ();
- data.indent = ((ScannerData)dataStack.peek ()).indent + ' ';
- data.includeIsImport = includeIsImport;
- try
- {
- readFile (file, filename);
- if (!emitAll && includeIsImport)
- SymtabEntry.enteringInclude ();
- // <d56351> As of CORBA 2.3, include files define new scope for Repository
- // ID prefixes. The previous Rep. ID is just below the top of the stack and
- // must be restored when the contents of this include file are parsed (see readCh()).
- Parser.enteringInclude ();
-
- if (verbose)
- System.out.println (data.indent + Util.getMessage ("Compile.parsing", filename));
- }
- catch (IOException e)
- {
- data = (ScannerData)dataStack.pop ();
- throw e;
- }
- } // scanIncludedFile
-
- /**
- *
- **/
- private void unread (char ch)
- {
- if (ch == '\n' && !data.macrodata) --data.line;
- --data.fileIndex;
- } // unread
-
- /**
- *
- **/
- void readChar () throws IOException
- {
- if (data.fileIndex >= data.fileBytes.length)
- if (dataStack.empty ())
- throw new EOFException ();
- else
- {
- // <d56351> Indicate end-of-scope for include file to parser.
- //Parser.exitingInclude ();
-
- // IBM.11666 - begin
- //if (!emitAll && data.includeIsImport && !data.macrodata)
- //{
- //SymtabEntry.exitingInclude ();
- //Parser.exitingInclude (); // <d59469>
- //}
- if (!data.macrodata)
- {
- if (!emitAll && data.includeIsImport)
- SymtabEntry.exitingInclude();
- Parser.exitingInclude();
- } // IBM.11666 - end
-
- if (verbose && !data.macrodata)
- System.out.println (data.indent + Util.getMessage ("Compile.parseDone", data.filename));
- data = (ScannerData)dataStack.pop ();
- }
- else
- {
- data.ch = (char)(data.fileBytes[data.fileIndex++] & 0x00ff);
- if (data.ch == '\n' && !data.macrodata) ++data.line;
- }
- } // readChar
-
- /**
- * Starting at a quote, reads a string with possible
- * unicode or octal values until an end quote. Doesn't
- * handle line feeds or comments.
- */
- private String getWString() throws IOException
- {
- readChar();
- StringBuffer result = new StringBuffer();
-
- while (data.ch != '"') {
- if (data.ch == '\\') {
- // Could be a \ooo octal or
- // unicode hex
- readChar();
- if (data.ch == 'u') {
- // Unicode hex
- int num = getNDigitHexNumber(4);
- System.out.println("Got num: " + num);
- System.out.println("Which is: " + (int)(char)num);
- result.append((char)num);
- // result.append((char)getNDigitHexNumber(4));
- // getNDigitHexNumber reads the next
- // character, so loop without reading another
- continue;
- } else
- if (data.ch >= '0' && data.ch <= '7') {
- // Octal
- result.append((char)get3DigitOctalNumber());
- // get3DigitOctalNumber reads the next
- // character, so loop without reading another
- continue;
- } else {
- // Wasn't either, so just append the
- // slash and current character.
- result.append('\\');
- result.append(data.ch);
- }
- } else {
- // Just append the character
- result.append(data.ch);
- }
-
- // Advance to the next character
- readChar();
- }
-
- return result.toString();
- }
-
- /**
- *
- **/
- private Token getCharacterToken(boolean isWide) throws IOException
- {
- // The token name returned contains a string with two elements:
- // first the character appears, then the representation of the
- // character. These are typically the same, but they CAN be
- // different, for example "O\117"
- Token token = null;
- readChar ();
- if ( data.ch == '\\' )
- {
- readChar ();
- if ((data.ch == 'x') || (data.ch == 'u'))
- {
- char charType = data.ch;
- int hexNum = getNDigitHexNumber ((charType == 'x') ? 2 : 4);
- return new Token (Token.CharacterLiteral,
- ((char)hexNum) + "\\" + charType + Integer.toString (hexNum, 16), isWide );
- }
- if ((data.ch >= '0') && (data.ch <= '7'))
- {
- int octNum = get3DigitOctalNumber ();
- return new Token (Token.CharacterLiteral,
- ((char)octNum) + "\\" + Integer.toString (octNum, 8), isWide );
- }
- return singleCharEscapeSequence (isWide);
- }
- token = new Token (Token.CharacterLiteral, "" + data.ch + data.ch, isWide );
- readChar ();
- return token;
- } // getCharacterToken
-
- /**
- *
- **/
- private Token singleCharEscapeSequence (boolean isWide) throws IOException
- {
- Token token;
- if (data.ch == 'n')
- // newline
- token = new Token (Token.CharacterLiteral, "\n\\n", isWide);
- else if (data.ch == 't')
- // horizontal tab
- token = new Token (Token.CharacterLiteral, "\t\\t", isWide);
- else if (data.ch == 'v')
- // vertical tab
- token = new Token (Token.CharacterLiteral, "\013\\v", isWide);
- else if (data.ch == 'b')
- // backspace
- token = new Token (Token.CharacterLiteral, "\b\\b", isWide);
- else if (data.ch == 'r')
- // carriage return
- token = new Token (Token.CharacterLiteral, "\r\\r", isWide);
- else if (data.ch == 'f')
- // form feed
- token = new Token (Token.CharacterLiteral, "\f\\f", isWide);
- else if (data.ch == 'a')
- // alert
- token = new Token (Token.CharacterLiteral, "\007\\a", isWide);
- else if (data.ch == '\\')
- // backslash
- token = new Token (Token.CharacterLiteral, "\\\\\\", isWide);
- else if (data.ch == '?')
- // question mark
- token = new Token (Token.CharacterLiteral, "?\\?", isWide);
- else if (data.ch == '\'')
- // single quote
- token = new Token (Token.CharacterLiteral, "'\\'", isWide);
- else if (data.ch == '"')
- // double quote
- token = new Token (Token.CharacterLiteral, "\"\\\"", isWide);
- else
- throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
- readChar ();
- return token;
- } // singleCharEscapeSequence
-
- private Token getString () throws IOException
- {
- StringBuffer sbuf = new StringBuffer() ;
- boolean escaped = false; // <d59166>
- boolean[] collidesWithKeyword = { false } ; // <d62023>
-
- // <f46082.40> An escaped id. begins with '_', which is followed by a normal
- // identifier. Disallow prefixes of '_' having length > 1.
- if (data.ch == '_') {
- sbuf.append( data.ch ) ;
- readChar ();
- if (escaped = escapedOK)
- if (data.ch == '_')
- throw new InvalidCharacter (data.filename, currentLine (),
- currentLineNumber (), currentLinePosition (), data.ch);
- }
-
- // Build up the string of valid characters until a non-string
- // character is encountered.
- while (Character.isLetterOrDigit( data.ch ) || (data.ch == '_')) {
- sbuf.append( data.ch ) ;
- readChar() ;
- }
-
- String string = sbuf.toString() ;
-
- // <f46082.40> Escaped identifiers - If identifier has '_' prefix, ignore
- // keyword check and strip '_'; otherwise, perform keyword check.
-
- if (!escaped) { // Escaped id ==> ignore keyword check
- Token result = Token.makeKeywordToken( string, corbaLevel, escapedOK,
- collidesWithKeyword ) ;
- if (result != null)
- return result ;
- }
-
- // At this point the string is an identifier. If it is a
- // string which is also a Java keyword, prepend an underscore
- // so that it doesn't generate a compiler error.
- string = getIdentifier (string);
-
- // If a left paren immediately follows, this could be a
- // macro definition, return a MacroIdentifier
- if (data.ch == '(') {
- readChar ();
- return new Token (Token.MacroIdentifier, string, escaped,
- collidesWithKeyword[0], false);
- } else
- return new Token (Token.Identifier, string, escaped,
- collidesWithKeyword[0], false);
- }
-
- // Wildcard values
- static final int Star = 0, Plus = 1, Dot = 2, None = 3;
-
- /**
- *
- **/
- private boolean matchesClosedWildKeyword (String string)
- {
- boolean found = true;
- String tmpString = string;
- Enumeration e = wildcardKeywords.elements ();
- while (e.hasMoreElements ())
- {
- int wildcard = None;
- StringTokenizer tokens = new StringTokenizer ((String)e.nextElement (), "*+.", true);
- if (tokens.hasMoreTokens ())
- {
- String token = tokens.nextToken ();
- if (tmpString.startsWith (token))
- {
- tmpString = tmpString.substring (token.length ());
- while (tokens.hasMoreTokens () && found)
- {
- token = tokens.nextToken ();
- if (token.equals ("*"))
- wildcard = Star;
- else if (token.equals ("+"))
- wildcard = Plus;
- else if (token.equals ("."))
- wildcard = Dot;
- else if (wildcard == Star)
- {
- int index = tmpString.indexOf (token);
- if (index >= 0)
- tmpString = tmpString.substring (index + token.length ());
- else
- found = false;
- }
- else if (wildcard == Plus)
- {
- int index = tmpString.indexOf (token);
- if (index > 0)
- tmpString = tmpString.substring (index + token.length ());
- else
- found = false;
- }
- else if (wildcard == Dot)
- {
- int index = tmpString.indexOf (token);
- if (index == 1)
- tmpString = tmpString.substring (1 + token.length ());
- else
- found = false;
- }
- }
- if (found && tmpString.equals (""))
- break;
- }
- }
- }
- return found && tmpString.equals ("");
- } // matchesClosedWildKeyword
-
- /**
- *
- **/
- private String matchesOpenWildcard (String string)
- {
- Enumeration e = openEndedKeywords.elements ();
- String prepend = "";
- while (e.hasMoreElements ())
- {
- int wildcard = None;
- boolean found = true;
- String tmpString = string;
- StringTokenizer tokens = new StringTokenizer ((String)e.nextElement (), "*+.", true);
- while (tokens.hasMoreTokens () && found)
- {
- String token = tokens.nextToken ();
- if (token.equals ("*"))
- wildcard = Star;
- else if (token.equals ("+"))
- wildcard = Plus;
- else if (token.equals ("."))
- wildcard = Dot;
- else if (wildcard == Star)
- {
- wildcard = None;
- int index = tmpString.lastIndexOf (token);
- if (index >= 0)
- tmpString = blankOutMatch (tmpString, index, token.length ());
- else
- found = false;
- }
- else if (wildcard == Plus)
- {
- wildcard = None;
- int index = tmpString.lastIndexOf (token);
- if (index > 0)
- tmpString = blankOutMatch (tmpString, index, token.length ());
- else
- found = false;
- }
- else if (wildcard == Dot)
- {
- wildcard = None;
- int index = tmpString.lastIndexOf (token);
- if (index == 1)
- tmpString = blankOutMatch (tmpString, 1, token.length ());
- else
- found = false;
- }
- else if (wildcard == None)
- if (tmpString.startsWith (token))
- tmpString = blankOutMatch (tmpString, 0, token.length ());
- else
- found = false;
- }
-
- // Make sure that, if the last character of the keyword is a
- // wildcard, that the string matches what the wildcard
- // requires.
- if (found)
- {
- if (wildcard == Star)
- ;
- else if (wildcard == Plus && tmpString.lastIndexOf (' ') != tmpString.length () - 1)
- ;
- else if (wildcard == Dot && tmpString.lastIndexOf (' ') == tmpString.length () - 2)
- ;
- else if (wildcard == None && tmpString.lastIndexOf (' ') == tmpString.length () - 1)
- ;
- else
- found = false;
- }
- // If found, then prepend an underscore. But also try matching
- // again after leading and trailing blanks are removed from
- // tmpString. This isn't quite right, but it solves a problem
- // which surfaced in the Java mapping. For example:
- // openEndedKeywords = {"+Helper", "+Holder", "+Package"};
- // string = fooHelperPackage.
- // Given the mechanics of the Java mapping, _fooHelperPackage
- // COULD have a conflict, so for each occurance of a keyword,
- // an underscore is added, so this would cause two underscores:
- // __fooHelperPackage. To accomplish this, the first time thru
- // tmpString is "fooHelper " at this point, strip off the
- // trailing blanks and try matching "fooHelper". This also
- // matches, so two underscores are prepended.
- if (found)
- {
- prepend = prepend + "_" + matchesOpenWildcard (tmpString.trim ());
- break;
- }
- }
- return prepend;
- } // matchesOpenWildcard
-
- /**
- *
- **/
- private String blankOutMatch (String string, int start, int length)
- {
- char[] blanks = new char [length];
- for (int i = 0; i < length; ++i)
- blanks[i] = ' ';
- return string.substring (0, start) + new String (blanks) + string.substring (start + length);
- } // blankOutMatch
-
- /**
- *
- **/
- private String getIdentifier (String string)
- {
- if (keywords.contains (string))
- // string matches a non-wildcard keyword
- string = '_' + string;
- else
- {
- // Check to see if string matches any wildcard keywords that
- // aren't open ended (don't have a wildcard as the first or
- // last character.
- String prepend = "";
- if (matchesClosedWildKeyword (string))
- prepend = "_";
- else
- // string did not match any closed wildcard keywords (that
- // is, keywords with wildcards anywhere but at the beginning
- // or end of the word).
- // Now check for * + or . at the beginning or end.
- // These require special handling because they could match
- // more than one keyword. prepend an underscore for each
- // matched keyword.
- prepend = matchesOpenWildcard (string);
- string = prepend + string;
- }
- return string;
- } // getIdentifier
-
- /**
- *
- **/
- private Token getDirective () throws IOException
- {
- readChar ();
- String string = new String ();
- while ((data.ch >= 'a' && data.ch <= 'z') || (data.ch >= 'A' && data.ch <= 'Z'))
- {
- string = string + data.ch;
- readChar ();
- }
- unread (data.ch);
- for (int i = 0; i < Token.Directives.length; ++i)
- if (string.equals (Token.Directives[i]))
- return new Token (Token.FirstDirective + i);
- // If it got this far, it is an unknown preprocessor directive.
- return new Token (Token.Unknown, string);
- } // getDirective
-
- /**
- *
- **/
- private Token getNumber () throws IOException
- {
- if (data.ch == '.')
- return getFractionNoInteger ();
- else if (data.ch == '0')
- return isItHex ();
- else // the only other possibliities are 1..9
- return getInteger ();
- } // getNumber
-
- /**
- *
- **/
- private Token getFractionNoInteger () throws IOException
- {
- readChar ();
- if (data.ch >= '0' && data.ch <= '9')
- return getFraction (".");
- else
- return new Token (Token.Period);
- } // getFractionNoInteger
-
- /**
- *
- **/
- private Token getFraction (String string) throws IOException
- {
- while (data.ch >= '0' && data.ch <= '9')
- {
- string = string + data.ch;
- readChar ();
- }
- if (data.ch == 'e' || data.ch == 'E')
- return getExponent (string + 'E');
- else
- return new Token (Token.FloatingPointLiteral, string);
- } // getFraction
-
- /**
- *
- **/
- private Token getExponent (String string) throws IOException
- {
- readChar ();
- if (data.ch == '+' || data.ch == '-')
- {
- string = string + data.ch;
- readChar ();
- }
- else if (data.ch < '0' || data.ch > '9')
- throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
- while (data.ch >= '0' && data.ch <= '9')
- {
- string = string + data.ch;
- readChar ();
- }
- return new Token (Token.FloatingPointLiteral, string);
- } // getExponent
-
- /**
- *
- **/
- private Token isItHex () throws IOException
- {
- readChar ();
- if (data.ch == '.')
- {
- readChar ();
- return getFraction ("0.");
- }
- else if (data.ch == 'x' || data.ch == 'X')
- return getHexNumber ("0x");
- else if (data.ch == '8' || data.ch == '9')
- throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
- else if (data.ch >= '0' && data.ch <= '7')
- return getOctalNumber ();
- else if (data.ch == 'e' || data.ch == 'E')
- return getExponent ("0E");
- else
- return new Token (Token.IntegerLiteral, "0");
- } // isItHex
-
- /**
- *
- **/
- private Token getOctalNumber () throws IOException
- {
- String string = "0" + data.ch;
- readChar ();
- while ((data.ch >= '0' && data.ch <= '9'))
- {
- if (data.ch == '8' || data.ch == '9')
- throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
- string = string + data.ch;
- readChar ();
- }
- return new Token (Token.IntegerLiteral, string);
- } // getOctalNumber
-
- /**
- *
- **/
- private Token getHexNumber (String string) throws IOException
- {
- readChar ();
- if ((data.ch < '0' || data.ch > '9') && (data.ch < 'a' || data.ch > 'f') && (data.ch < 'A' || data.ch > 'F'))
- throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
- else
- while ((data.ch >= '0' && data.ch <= '9') || (data.ch >= 'a' && data.ch <= 'f') || (data.ch >= 'A' && data.ch <= 'F'))
- {
- string = string + data.ch;
- readChar ();
- }
- return new Token (Token.IntegerLiteral, string);
- } // getHexNumber
-
- /**
- *
- **/
- private int getNDigitHexNumber (int n) throws IOException
- {
- readChar ();
- if (!isHexChar (data.ch))
- throw new InvalidCharacter (data.filename, currentLine (),
- currentLineNumber (), currentLinePosition (), data.ch);
- String string = "" + data.ch;
- readChar ();
- for (int i = 2; i <= n; i++)
- {
- if (!isHexChar( data.ch))
- break;
- string += data.ch;
- readChar ();
- }
- try
- {
- return Integer.parseInt (string, 16);
- }
- catch (NumberFormatException e)
- {
- }
- return 0;
- } // getNDigitHexNumber
-
- /**
- *
- **/
- private boolean isHexChar ( char hex )
- {
- return ((data.ch >= '0') && (data.ch <= '9')) ||
- ((data.ch >= 'a') && (data.ch <= 'f')) ||
- ((data.ch >= 'A') && (data.ch <= 'F'));
- }
-
- /**
- *
- **/
- private int get3DigitOctalNumber () throws IOException
- {
- char firstDigit = data.ch;
- String string = "" + data.ch;
- readChar ();
- if (data.ch >= '0' && data.ch <= '7')
- {
- string = string + data.ch;
- readChar ();
- if (data.ch >= '0' && data.ch <= '7')
- {
- string = string + data.ch;
- if (firstDigit > '3')
- // This is a 3-digit number bigger than 377
- throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), firstDigit);
- readChar ();
- }
- }
- int ret = 0;
- try
- {
- ret = Integer.parseInt (string, 8);
- }
- catch (NumberFormatException e)
- {
- throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), string.charAt (0));
- }
- return ret;
- } // get3DigitOctalNumber
-
- /**
- *
- **/
- private Token getInteger () throws IOException
- {
- String string = "" + data.ch;
- readChar ();
- if (data.ch == '.')
- {
- readChar ();
- return getFraction (string + '.');
- }
- else if (data.ch == 'e' || data.ch == 'E')
- return getExponent (string + 'E');
- else if (data.ch >= '0' && data.ch <= '9')
- while (data.ch >= '0' && data.ch <= '9')
- {
- string = string + data.ch;
- readChar ();
- if (data.ch == '.')
- {
- readChar ();
- return getFraction (string + '.');
- }
- }
- return new Token (Token.IntegerLiteral, string);
- } // getInteger
-
- /**
- *
- **/
- private Token replaceTrigraph () throws IOException
- {
- readChar ();
- if (data.ch == '?')
- {
- readChar ();
- if (data.ch == '=')
- data.ch = '#';
- else if (data.ch == '/')
- data.ch = '\\';
- else if (data.ch == '\'')
- data.ch = '^';
- else if (data.ch == '(')
- data.ch = '[';
- else if (data.ch == ')')
- data.ch = ']';
- else if (data.ch == '!')
- data.ch = '|';
- else if (data.ch == '<')
- data.ch = '{';
- else if (data.ch == '>')
- data.ch = '}';
- else if (data.ch == '-')
- data.ch = '~';
- else
- {
- unread (data.ch);
- unread ('?');
- throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
- }
- return getToken ();
- }
- else
- {
- unread ('?');
- throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
- }
- } // replaceTrigraph
-
- /**
- *
- **/
- void skipWhiteSpace () throws IOException
- {
- while (data.ch <= ' ')
- readChar ();
- } // skipWhiteSpace
-
- /**
- *
- **/
- private void skipBlockComment () throws IOException
- {
- try
- {
- boolean done = false;
- readChar ();
- while (!done)
- {
- while (data.ch != '*')
- readChar ();
- readChar ();
- if (data.ch == '/')
- done = true;
- }
- }
- catch (EOFException e)
- {
- ParseException.unclosedComment (data.filename);
- throw e;
- }
- } // skipBlockComment
-
- /**
- *
- **/
- void skipLineComment () throws IOException
- {
- while (data.ch != '\n')
- readChar ();
- } // skipLineComment
-
- // The following two routines added to extract comments rather
- // than ignore them.
-
- /**
- * Extract a line comment from the input buffer.
- **/
- private String getLineComment () throws IOException
- {
- StringBuffer sb = new StringBuffer( "/" );
- while (data.ch != '\n')
- {
- if (data.ch != '\r')
- sb.append (data.ch);
- readChar ();
- }
- return sb.toString();
- } // getLineComment
-
- /**
- * Extract a block comment from the input buffer.
- **/
- private String getBlockComment () throws IOException
- {
- StringBuffer sb = new StringBuffer ("/*");
- try
- {
- boolean done = false;
- readChar ();
- sb.append (data.ch);
- while (!done)
- {
- while (data.ch != '*')
- {
- readChar ();
- sb.append (data.ch);
- }
- readChar ();
- sb.append (data.ch);
- if (data.ch == '/')
- done = true;
- }
- }
- catch (EOFException e)
- {
- ParseException.unclosedComment (data.filename);
- throw e;
- }
- return sb.toString ();
- } // getBlockComment
-
- /**
- *
- **/
- Token skipUntil (char c) throws IOException
- {
- while (data.ch != c)
- {
- if (data.ch == '/')
- {
- readChar ();
- if (data.ch == '/')
- {
- skipLineComment ();
- // If this is skipping until the newline, skipLineComment
- // reads past the newline, so it won't be seen by the
- // while loop conditional check.
- if (c == '\n') break;
- }
- else if (data.ch == '*')
- skipBlockComment ();
- }
- else
- readChar ();
- }
- return getToken ();
- } // skipUntil
-
- // getUntil is used for macro definitions and to get quoted
- // strings, so characters within "("...")" and '"'...'"' are
- // ignored. Ie getUntil ',' on (,,,,),X will return (,,,,)
-
- String getUntil (char c) throws IOException
- {
- return getUntil (c, true, true, true);
- }
-
- String getUntil (char c, boolean allowQuote, boolean allowCharLit, boolean allowComment) throws IOException
- {
- String string = "";
- while (data.ch != c)
- string = appendToString (string, allowQuote, allowCharLit, allowComment);
- return string;
- } // getUntil
-
- /**
- *
- **/
- String getUntil (char c1, char c2) throws IOException
- {
- String string = "";
- while (data.ch != c1 && data.ch != c2)
- string = appendToString (string, false, false, false);
- return string;
- } // getUntil
-
- /**
- *
- **/
- private String appendToString (String string, boolean allowQuote, boolean allowCharLit, boolean allowComment) throws IOException
- {
- // Ignore any comments if they are allowed
- if (allowComment && data.ch == '/')
- {
- readChar ();
- if (data.ch == '/')
- skipLineComment ();
- else if (data.ch == '*')
- skipBlockComment ();
- else
- string = string + '/';
- }
- // Handle line continuation character
- else if (data.ch == '\\')
- {
- readChar ();
- if (data.ch == '\n')
- readChar ();
- else if (data.ch == '\r')
- {
- readChar ();
- if (data.ch == '\n')
- readChar ();
- }
- else
- {
- string = string + '\\' + data.ch;
- readChar ();
- }
- }
- // characters within "("...")" and '"'...'"' are ignored.
- // Ie getUntil ',' on (,,,,),X will return (,,,)
- else
- {
- if (allowCharLit && data.ch == '"')
- {
- readChar ();
- string = string + '"';
- while (data.ch != '"')
- string = appendToString (string, true, false, allowComment);
- }
- else if (allowQuote && allowCharLit && data.ch == '(')
- {
- readChar ();
- string = string + '(';
- while (data.ch != ')')
- string = appendToString (string, false, false, allowComment);
- }
- else if (allowQuote && data.ch == '\'')
- {
- readChar ();
- string = string + "'";
- while (data.ch != '\'')
- string = appendToString (string, false, true, allowComment);
- }
- string = string + data.ch;
- readChar ();
- }
- return string;
- } // appendToString
-
- /**
- *
- **/
- String getStringToEOL () throws IOException
- {
- String string = new String ();
- while (data.ch != '\n')
- {
- if (data.ch == '\\')
- {
- readChar ();
- if (data.ch == '\n')
- readChar ();
- else if (data.ch == '\r')
- {
- readChar ();
- if (data.ch == '\n')
- readChar ();
- }
- else
- {
- string = string + data.ch;
- readChar ();
- }
- }
- else
- {
- string = string + data.ch;
- readChar ();
- }
- }
- return string;
- } // getStringToEOL
-
- /**
- *
- **/
- String filename ()
- {
- return data.filename;
- } // filename
-
- /**
- *
- **/
- IncludeEntry fileEntry ()
- {
- return data.fileEntry;
- } // fileEntry
-
- /**
- *
- **/
- int currentLineNumber ()
- {
- return data.line;
- } // currentLineNumber
-
- /**
- *
- **/
- int lastTokenLineNumber ()
- {
- return data.oldLine;
- } // lastTokenLineNumber
-
- private int BOL; // Beginning Of Line
-
- /**
- *
- **/
- String currentLine ()
- {
- BOL = data.fileIndex - 1;
- try
- {
- // If the current position is at the end of the line,
- // set BOL to before the end of the line so the whole
- // line is returned.
- if (data.fileBytes[BOL - 1] == '\r' && data.fileBytes[BOL] == '\n')
- BOL -= 2;
- else if (data.fileBytes[BOL] == '\n')
- --BOL;
- while (data.fileBytes[BOL] != '\n')
- --BOL;
- }
- catch (ArrayIndexOutOfBoundsException e)
- {
- BOL = -1;
- }
- ++BOL; // Go to the first character AFTER the newline
- int EOL = data.fileIndex - 1;
- try
- {
- while (data.fileBytes[EOL] != '\n' && data.fileBytes[EOL] != '\r')
- ++EOL;
- }
- catch (ArrayIndexOutOfBoundsException e)
- {
- EOL = data.fileBytes.length;
- }
- if (BOL < EOL)
- return new String (data.fileBytes, BOL, EOL - BOL);
- else
- return "";
- } // currentLine
-
- /**
- *
- **/
- String lastTokenLine ()
- {
- int saveFileIndex = data.fileIndex;
- data.fileIndex = data.oldIndex;
- String ret = currentLine ();
- data.fileIndex = saveFileIndex;
- return ret;
- } // lastTokenLine
-
- /**
- *
- **/
- int currentLinePosition ()
- {
- return data.fileIndex - BOL;
- } // currentLinePosition
-
- /**
- *
- **/
- int lastTokenLinePosition ()
- {
- return data.oldIndex - BOL;
- } // lastTokenLinePosition
-
- // The scanner data is moved to a separate class so that all of the
- // data can easily be pushed and popped to a stack.
-
- // The data must be stackable for macros and #included files. When
- // a macro is encountered: the current stack data is reserved on
- // the stack; the stack is loaded with the macro info; processing
- // proceeds with this data. The same is true for #included files.
-
- // It may seem that the entire Scanner should be put on a stack in
- // the Parser since all the scanner data is stackable. But that
- // would mean instantiating a new scanner. The scanner must
- // continue from where it left off; when certain things cross file
- // boundaries, they must be handled by the scanner, not the parser,
- // things like: block comments, quoted strings, tokens.
- private ScannerData data = new ScannerData ();
- private Stack dataStack = new Stack ();
- private Vector keywords = new Vector ();
- private Vector openEndedKeywords = new Vector ();
- private Vector wildcardKeywords = new Vector ();
- private boolean verbose;
- // <f46082.40> Identifiers starting with '_' are considered "Escaped",
- // except when scanned during preprocessing. Class Preprocessor is
- // responsible to modify the escapedOK flag accordingly. Since preceding
- // underscores are now legal when scanning identifiers as well as
- // macro identifier, underscoreOK is obsolete.
- //
- // boolean underscoreOK = false;
- boolean escapedOK = true;
- // <f46082.51> Remove -stateful feature.
- // boolean stateful;
- private boolean emitAll;
- private float corbaLevel;
- private boolean debug ;
-} // class Scanner
-
-// This is a dumb class, really just a struct. It contains all of the
-// scanner class's data in one place so that that data can be easily
-// pushed and popped to a stack.
-
-/**
- *
- **/
-class ScannerData
-{
- /**
- *
- **/
- public ScannerData ()
- {
- } // ctor
-
- /**
- *
- **/
- public ScannerData (ScannerData that)
- {
- indent = that.indent;
- fileEntry = that.fileEntry;
- filename = that.filename;
- fileBytes = that.fileBytes;
- fileIndex = that.fileIndex;
- oldIndex = that.oldIndex;
- ch = that.ch;
- line = that.line;
- oldLine = that.oldLine;
- macrodata = that.macrodata;
- includeIsImport = that.includeIsImport;
- } // copy ctor
-
- String indent = "";
- IncludeEntry fileEntry = null;
- String filename = "";
-
- // fileBytes is a byte array rather than a char array. This is
- // safe because OMG IDL is specified to be ISO Latin-1 whose high-
- // order byte is always 0x0. <f49747.1> Converted from byte[] to char[]
- // to employ Reader classes, which have Character encoding features. <ajb>
- //byte[] fileBytes = null;
- char[] fileBytes = null;
- int fileIndex = 0;
- int oldIndex = 0;
- char ch;
- int line = 1;
- int oldLine = 1;
- boolean macrodata = false;
- boolean includeIsImport = false;
-} // class ScannerData
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/SequenceEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/SequenceEntry.java
deleted file mode 100644
index 20e2a4c..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/SequenceEntry.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.constExpr.Expression;
-
-/**
- * This is the symbol table entry for sequences.
- **/
-public class SequenceEntry extends SymtabEntry
-{
- protected SequenceEntry ()
- {
- super ();
- repositoryID (Util.emptyID);
- } // ctor
-
- protected SequenceEntry (SequenceEntry that)
- {
- super (that);
- _maxSize = that._maxSize;
- } // ctor
-
- protected SequenceEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
- if (!(that instanceof SequenceEntry))
- // If that is a SequenceEntry, then it is a container of this sequence, but it is not a module of this sequence. It's name doesn't belong in the module name.
- if (module ().equals (""))
- module (name ());
- else if (!name ().equals (""))
- module (module () + "/" + name ());
- repositoryID (Util.emptyID);
- } // ctor
-
- public Object clone ()
- {
- return new SequenceEntry (this);
- } // clone
-
- public boolean isReferencable()
- {
- // A sequence is referencable if its component
- // type is.
- return type().isReferencable() ;
- }
-
- public void isReferencable( boolean value )
- {
- // NO-OP: this cannot be set for a sequence.
- }
-
- /** Invoke the sequence generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- sequenceGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the sequence generator.
- @returns an object which implements the SequenceGen interface.
- @see SequenceGen */
- public Generator generator ()
- {
- return sequenceGen;
- } // generator
-
- /** the constant expression defining the maximum size of the sequence.
- If it is null, then the sequence is unbounded. */
- public void maxSize (Expression expr)
- {
- _maxSize = expr;
- } // maxSize
-
- /** the constant expression defining the maximum size of the sequence.
- If it is null, then the sequence is unbounded. */
- public Expression maxSize ()
- {
- return _maxSize;
- } // maxSize
-
- /** Only sequences can be contained within sequences. */
- public void addContained (SymtabEntry entry)
- {
- _contained.addElement (entry);
- } // addContained
-
- /** Only sequences can be contained within sequences. */
- public Vector contained ()
- {
- return _contained;
- } // contained
-
- static SequenceGen sequenceGen;
-
- private Expression _maxSize = null;
- private Vector _contained = new Vector ();
-} // class SequenceEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/SequenceGen.java b/src/share/classes/com/sun/tools/corba/se/idl/SequenceGen.java
deleted file mode 100644
index b26fefa..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/SequenceGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface SequenceGen extends Generator
-{
- void generate (Hashtable symbolTable, SequenceEntry entry, PrintWriter stream);
-} // interface SequenceGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/StringEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/StringEntry.java
deleted file mode 100644
index a07f8e1..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/StringEntry.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.constExpr.Expression;
-
-public class StringEntry extends SymtabEntry
-{
- protected StringEntry ()
- {
- super ();
- String override = (String)Parser.overrideNames.get ("string");
- if (override == null)
- name ("string");
- else
- name (override);
- repositoryID (Util.emptyID);
- } // ctor
-
- protected StringEntry (StringEntry that)
- {
- super (that);
- _maxSize = that._maxSize;
- } // ctor
-
- protected StringEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
- module ("");
-
- String override = (String)Parser.overrideNames.get ("string");
- if (override == null)
- name ("string");
- else
- name (override);
- repositoryID (Util.emptyID);
- } // ctor
-
- public Object clone ()
- {
- return new StringEntry (this);
- } // clone
-
- /** Invoke the string type generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- stringGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the primitive type generator.
- @returns an object which implements the PrimitiveGen interface.
- @see PrimitiveGen */
- public Generator generator ()
- {
- return stringGen;
- } // generator
-
- /** The constant expression defining the maximum size of the string.
- If it is null, then the string is unbounded. */
- public void maxSize (Expression expr)
- {
- _maxSize = expr;
- } // maxSize
-
- /** The constant expression defining the maximum size of the string.
- If it is null, then the string is unbounded. */
- public Expression maxSize ()
- {
- return _maxSize;
- } // maxSize
-
- static StringGen stringGen;
-
- private Expression _maxSize = null;
-} // class StringEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/StringGen.java b/src/share/classes/com/sun/tools/corba/se/idl/StringGen.java
deleted file mode 100644
index ef9b422..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/StringGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface StringGen extends Generator
-{
- void generate (Hashtable symbolTable, StringEntry entry, PrintWriter stream);
-} // interface StringGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/StructEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/StructEntry.java
deleted file mode 100644
index de20327..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/StructEntry.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * This is the symbol table entry for structs.
- **/
-public class StructEntry extends SymtabEntry
-{
- protected StructEntry ()
- {
- super ();
- } // ctor
-
- protected StructEntry (StructEntry that)
- {
- super (that);
- if (!name ().equals (""))
- {
- module (module () + name ());
- name ("");
- }
- _members = (Vector)that._members.clone ();
- _contained = (Vector)that._contained.clone ();
- } // ctor
-
- protected StructEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
- if (module ().equals (""))
- module (name ());
- else if (!name ().equals (""))
- module (module () + "/" + name ());
- } // ctor
-
- public Object clone ()
- {
- return new StructEntry (this);
- } // clone
-
- /** Invoke the struct generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- structGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the struct generator.
- @returns an object which implements the StructGen interface.
- @see StructGen */
- public Generator generator ()
- {
- return structGen;
- } // generator
-
- /** Add a member to the member list. */
- public void addMember (TypedefEntry member)
- {
- _members.addElement (member);
- } // addMember
-
- /** This is a vector of TypedefEntry's. In this context, only the name,
- type, and arrayInfo fields hold any meaning. */
- public Vector members ()
- {
- return _members;
- } // members
-
- public void addContained (SymtabEntry entry)
- {
- _contained.addElement (entry);
- } // addContained
-
- /** This is a vector of SymtabEntry's. It itemizes any types which
- this struct contains. It is different than the member list.
- For example:
- <pre>
- struct A
- {
- long x;
- Struct B
- {
- long a;
- long b;
- } y;
- }
- </pre>
- Struct B is contained within struct A.
- The members vector will contain entries for x and y. */
- public Vector contained ()
- {
- return _contained;
- } // contained
-
- private Vector _members = new Vector ();
- private Vector _contained = new Vector ();
-
- static StructGen structGen;
-} // class StructEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/StructGen.java b/src/share/classes/com/sun/tools/corba/se/idl/StructGen.java
deleted file mode 100644
index cb03c72..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/StructGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface StructGen extends Generator
-{
- void generate (Hashtable symbolTable, StructEntry entry, PrintWriter stream);
-} // interface StructGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/SymtabEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/SymtabEntry.java
deleted file mode 100644
index 52b8f40..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/SymtabEntry.java
+++ /dev/null
@@ -1,375 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-
-import java.util.Hashtable;
-import java.util.Stack;
-import java.util.Vector;
-
-/**
- * This is the base class for all symbol table entries.
- * @see AttributeEntry
- * @see ConstEntry
- * @see EnumEntry
- * @see ExceptionEntry
- * @see IncludeEntry
- * @see InterfaceEntry
- * @see MethodEntry
- * @see ModuleEntry
- * @see ParameterEntry
- * @see PragmaEntry
- * @see PrimitiveEntry
- * @see SequenceEntry
- * @see StructEntry
- * @see TypedefEntry
- * @see UnionEntry
- **/
-public class SymtabEntry
-{
- public SymtabEntry ()
- {
- initDynamicVars ();
- } // ctor
-
- SymtabEntry (SymtabEntry that, IDLID clone)
- {
- _module = that._module;
- _name = that._name;
- _type = that._type;
- _typeName = that._typeName;
- _sourceFile = that._sourceFile;
- _info = that._info;
- _repID = (RepositoryID)clone.clone ();
- ((IDLID)_repID).appendToName (_name);
- if (that instanceof InterfaceEntry || that instanceof ModuleEntry || that instanceof StructEntry || that instanceof UnionEntry || (that instanceof SequenceEntry && this instanceof SequenceEntry))
- _container = that;
- else
- _container = that._container;
- initDynamicVars ();
- _comment = that._comment; // <21jul1997daz>
- } // ctor
-
- /** This is a shallow copy constructor */
- SymtabEntry (SymtabEntry that)
- {
- _module = that._module;
- _name = that._name;
- _type = that._type;
- _typeName = that._typeName;
- _sourceFile = that._sourceFile;
- _info = that._info;
- _repID = (RepositoryID)that._repID.clone ();
- _container = that._container;
-
- if (_type instanceof ForwardEntry)
- ((ForwardEntry)_type).types.addElement (this);
-
- initDynamicVars ();
- // <21JUL1997>
- _comment = that._comment;
- } // ctor
-
- void initDynamicVars ()
- {
- _dynamicVars = new Vector (maxKey + 1);
- for (int i = 0; i <= maxKey; ++i)
- _dynamicVars.addElement (null);
- } // initDynamicVars
-
- /** This is a shallow copy clone */
- public Object clone ()
- {
- return new SymtabEntry (this);
- } // clone
-
- /** @return the concatenation of the module and the name, delimited by '/'. */
- public final String fullName ()
- {
- return _module.equals ("") ? _name : _module + '/' + _name;
- } // fullName
-
- /** Get the name of this entry's module. If there are modules within
- modules, each module name is separated by '/'.
- @returns this entry's module name. */
- public String module ()
- {
- return _module;
- } // module
-
- /** Set the module for this entry.
- @param newName the new name of the module. */
- public void module (String newName)
- {
- if (newName == null)
- _module = "";
- else
- _module = newName;
- } // module
-
- /** @return the name of this entry. */
- public String name ()
- {
- return _name;
- } // name
-
- /** Set the name.
- @param newName the new name. */
- public void name (String newName)
- {
- if (newName == null)
- _name = "";
- else
- _name = newName;
-
- // Update the RepositoryID
- if (_repID instanceof IDLID)
- ((IDLID)_repID).replaceName (newName);
- } // name
-
- /** @return the type name of this entry. */
- public String typeName ()
- {
- return _typeName;
- } // typeName
-
- protected void typeName (String typeName)
- {
- _typeName = typeName;
- } // typeName
-
- /** @return the type entry of this entry */
- public SymtabEntry type ()
- {
- return _type;
- } // type
-
- public void type (SymtabEntry newType)
- {
- if (newType == null)
- typeName ("");
- else
- typeName (newType.fullName ());
- _type = newType;
-
- if (_type instanceof ForwardEntry)
- ((ForwardEntry)_type).types.addElement (this);
- } // type
-
- /** The file name in which this entry was defined. */
- public IncludeEntry sourceFile ()
- {
- return _sourceFile;
- } // sourceFile
-
- /** The file name in which this entry was defined. */
- public void sourceFile (IncludeEntry file)
- {
- _sourceFile = file;
- } // sourceFile
-
- /** This must be either an InterfaceEntry or a ModuleEntry.
- It can be nothing else. */
- public SymtabEntry container ()
- {
- return _container;
- } // container
-
- /** This must be either an InterfaceEntry or a ModuleEntry.
- It can be nothing else. */
- public void container (SymtabEntry newContainer)
- {
- if (newContainer instanceof InterfaceEntry || newContainer instanceof ModuleEntry)
- _container = newContainer;
- } // container
-
- /** @return the repository ID for this entry. */
- public RepositoryID repositoryID ()
- {
- return _repID;
- } // repositoryID
-
- /** Set the repository ID for this entry.
- @param id the new repository ID. */
- public void repositoryID (RepositoryID id)
- {
- _repID = id;
- } // repositoryID
-
- /** Should this type be emitted? */
- public boolean emit ()
- {
- return _emit && _isReferencable ;
- } // emit
-
- public void emit (boolean emit)
- {
- _emit = emit;
- } // emit
-
- /* <21jul1997daz> Accessors for comment */
-
- public Comment comment()
- {
- return _comment;
- }
-
- public void comment( Comment comment )
- {
- _comment = comment;
- }
-
- public boolean isReferencable()
- {
- return _isReferencable ;
- }
-
- public void isReferencable( boolean value )
- {
- _isReferencable = value ;
- }
-
- static Stack includeStack = new Stack ();
-
- static void enteringInclude ()
- {
- includeStack.push (new Boolean (setEmit));
- setEmit = false;
- } // enteringInclude
-
- static void exitingInclude ()
- {
- setEmit = ((Boolean)includeStack.pop ()).booleanValue ();
- } // exitingInclude
-
- /** Other variables besides the default ones can be dynamically placed
- into SymTabEntry (and therefore on all symbol table entries) by
- extenders. Before such a variable can exist, its key must be
- obtained by calling getVariableKey. */
- public static int getVariableKey ()
- {
- return ++maxKey;
- } // dynamicVariable
-
- /** Other variables besides the default ones can be dynamically placed
- into SymTabEntry (and therefore on all symbol table entries) by
- extenders. This method assigns the value to the variable of the
- given key. A valid key must be obtained by calling the method
- getVariableKey. If the key is invalid, NoSuchFieldException is
- thrown. */
- public void dynamicVariable (int key, Object value) throws NoSuchFieldException
- {
- if (key > maxKey)
- throw new NoSuchFieldException (Integer.toString (key));
- else
- {
- if (key >= _dynamicVars.size ())
- growVars ();
- _dynamicVars.setElementAt (value, key);
- }
- } // dynamicVariable
-
- /** Other variables besides the default ones can be dynamically placed
- into SymTabEntry (and therefore on all symbol table entries) by
- extenders. This method gets the value of the variable of the
- given key. A valid key must be obtained by calling the method
- getVariableKey. If the key is invalid, NoSuchFieldException is
- thrown. */
- public Object dynamicVariable (int key) throws NoSuchFieldException
- {
- if (key > maxKey)
- throw new NoSuchFieldException (Integer.toString (key));
- else
- {
- if (key >= _dynamicVars.size ())
- growVars ();
- return _dynamicVars.elementAt (key);
- }
- } // dynamicVariable
-
- void growVars ()
- {
- int diff = maxKey - _dynamicVars.size () + 1;
- for (int i = 0; i < diff; ++i)
- _dynamicVars.addElement (null);
- } // growVars
-
- /** Invoke a generator. A call to this method is only meaningful
- for subclasses of SymtabEntry. If called on this class, it
- is a no-op.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output. */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- } // generate
-
- /** Access a generator. A call to this method is only meaningful
- for subclasses of SymtabEntry. If called on this class, it
- is a no-op.
- @return an object which implements the Generator interface. */
- public Generator generator ()
- {
- return null;
- } // generator
-
- static boolean setEmit = true;
- static int maxKey = -1;
-
- private SymtabEntry _container = null;
- private String _module = "";
- private String _name = "";
- private String _typeName = "";
- private SymtabEntry _type = null;
- private IncludeEntry _sourceFile = null;
- private Object _info = null;
- private RepositoryID _repID = new IDLID ("", "", "1.0");
- private boolean _emit = setEmit;
- private Comment _comment = null;
- private Vector _dynamicVars;
- private boolean _isReferencable = true ;
-} // class SymtabEntry
-
-/*=======================================================================================
- DATE<AUTHOR> ACTION
- ---------------------------------------------------------------------------------------
- 21jul1997<daz> Added _comment data member to afford transferring comments from source
- file to target; added acessor methods for comment.
- =======================================================================================*/
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/SymtabFactory.java b/src/share/classes/com/sun/tools/corba/se/idl/SymtabFactory.java
deleted file mode 100644
index 1a2f36d..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/SymtabFactory.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-/**
- * Each entry must have three ways in which it can be instantiated:
- * <ul>
- * <li>with no parameters;
- * <li>cloned from a copy of itself;
- * <li>the normal-use instantiation (usually with 2 parameters: the container and the id of the container).
- * </ul>
- **/
-public interface SymtabFactory
-{
- AttributeEntry attributeEntry ();
- AttributeEntry attributeEntry (InterfaceEntry container, IDLID id);
-
- ConstEntry constEntry ();
- ConstEntry constEntry (SymtabEntry container, IDLID id);
-
- NativeEntry nativeEntry ();
- NativeEntry nativeEntry (SymtabEntry container, IDLID id);
-
- EnumEntry enumEntry ();
- EnumEntry enumEntry (SymtabEntry container, IDLID id);
-
- ExceptionEntry exceptionEntry ();
- ExceptionEntry exceptionEntry (SymtabEntry container, IDLID id);
-
- ForwardEntry forwardEntry ();
- ForwardEntry forwardEntry (ModuleEntry container, IDLID id);
-
- ForwardValueEntry forwardValueEntry ();
- ForwardValueEntry forwardValueEntry (ModuleEntry container, IDLID id);
-
- IncludeEntry includeEntry ();
- IncludeEntry includeEntry (SymtabEntry container);
-
- InterfaceEntry interfaceEntry ();
- InterfaceEntry interfaceEntry (ModuleEntry container, IDLID id);
-
- ValueEntry valueEntry ();
- ValueEntry valueEntry (ModuleEntry container, IDLID id);
-
- ValueBoxEntry valueBoxEntry ();
- ValueBoxEntry valueBoxEntry (ModuleEntry container, IDLID id);
-
- MethodEntry methodEntry ();
- MethodEntry methodEntry (InterfaceEntry container, IDLID id);
-
- ModuleEntry moduleEntry ();
- ModuleEntry moduleEntry (ModuleEntry container, IDLID id);
-
- ParameterEntry parameterEntry ();
- ParameterEntry parameterEntry (MethodEntry container, IDLID id);
-
- PragmaEntry pragmaEntry ();
- PragmaEntry pragmaEntry (SymtabEntry container);
-
- PrimitiveEntry primitiveEntry ();
- /** name can be, but is not limited to, the primitive idl type names:
- char, octet, short, long, etc. The reason it is not limited to
- these is that, as an extender, you may wish to override these names.
- For instance, when generating Java code, octet translates to byte,
- so there is an entry in Compile.overrideNames: <"octet", "byte">
- and a PrimitiveEntry in the symbol table for "byte". */
- PrimitiveEntry primitiveEntry (String name);
-
- SequenceEntry sequenceEntry ();
- SequenceEntry sequenceEntry (SymtabEntry container, IDLID id);
-
- StringEntry stringEntry ();
-
- StructEntry structEntry ();
- StructEntry structEntry (SymtabEntry container, IDLID id);
-
- TypedefEntry typedefEntry ();
- TypedefEntry typedefEntry (SymtabEntry container, IDLID id);
-
- UnionEntry unionEntry ();
- UnionEntry unionEntry (SymtabEntry container, IDLID id);
-} // interface SymtabFactory
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/Token.java b/src/share/classes/com/sun/tools/corba/se/idl/Token.java
deleted file mode 100644
index 8ec46d0..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/Token.java
+++ /dev/null
@@ -1,689 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-// -F46082.51<daz> Remove -stateful feature.
-// -D59166<daz> Add support for keyword/identifier collision detection. This
-// feature is implemented here, rather than class Scanner, to allow the Parser
-// to handle the problem.
-// -F60858.1<daz> Support -corba option, level <= 2.2: identify 2.3 keywords.
-// -D62023<daz> Support -corba option, level <= 2.3, identify 2.4 keywords.
-// KMC Support -corba, level <= 3.0. Added 3.0 keywords.
-//
-// Should escaped Identifier should be a type rather than an attribute?
-//
-
-/**
- * Class Token represents a lexeme appearing within an IDL source. Every
- * Token has a type. Depending on its type and on the supported version
- * of IDL, a Token will have other associated attributes, such as a name
- * (identifier, e.g.), and whether it is escaped, deprecated, or is a type
- * that is known to be in a future version of IDL.
- **/
-class Token
-{
- ///////////////
- // Available types
-
- static final int // Keywords
- Any = 0, // 2.2
- Attribute = 1, // |
- Boolean = 2, // .
- Case = 3, // .
- Char = 4, // .
- Const = 5,
- Context = 6,
- Default = 7,
- Double = 8,
- Enum = 9,
- Exception = 10,
- FALSE = 11,
- Fixed = 12, // New addition
- Float = 13,
- In = 14,
- Inout = 15,
- Interface = 16,
- Long = 17,
- Module = 18,
- Native = 19, // New addition
- Object = 20,
- Octet = 21,
- Oneway = 22,
- Out = 23,
- Raises = 24,
- Readonly = 25,
- Sequence = 26,
- Short = 27,
- String = 28,
- Struct = 29,
- Switch = 30,
- TRUE = 31,
- Typedef = 32,
- Unsigned = 33, // .
- Union = 34, // .
- Void = 35, // .
- Wchar = 36, // |
- Wstring = 37, // 2.2
- // <f46082.40> New OBV keywords...
- // <d62023> In 2.4rtf, "factory" is synonymous to "init" in 2.3
- Init = 38, // 2.3 only
- Abstract = 39, // 2.3 2.4rtf
- Custom = 40, // | |
- Private = 41, // | |
- Public = 42, // | |
- Supports = 43, // | |
- Truncatable = 44, // | |
- ValueBase = 45, // | |
- Valuetype = 46, // 2.3 2.4rtf
- Factory = 47, // 2.4rtf only
-
- // Keywords in CORBA 3.0
- Component = 48,
- Consumes = 49,
- Emits = 50,
- Finder = 51,
- GetRaises = 52,
- Home = 53,
- Import = 54,
- Local = 55,
- Manages = 56,
- Multiple = 57,
- PrimaryKey = 58,
- Provides = 59,
- Publishes = 60,
- SetRaises = 61,
- TypeId = 62,
- TypePrefix = 63,
- Uses = 64,
-
- Identifier = 80, // Identifier
- MacroIdentifier = 81, // Macro Identifier
-
- Semicolon = 100, // Symbols
- LeftBrace = 101,
- RightBrace = 102,
- Colon = 103,
- Comma = 104,
- Equal = 105,
- Plus = 106,
- Minus = 107,
- LeftParen = 108,
- RightParen = 109,
- LessThan = 110,
- GreaterThan = 111,
- LeftBracket = 112,
- RightBracket = 113,
- Apostrophe = 114,
- Quote = 115,
- Backslash = 116,
- Bar = 117,
- Carat = 118,
- Ampersand = 119,
- Star = 120,
- Slash = 121,
- Percent = 122,
- Tilde = 123,
- DoubleColon = 124,
- ShiftLeft = 125,
- ShiftRight = 126,
- Period = 127,
- Hash = 128,
- Exclamation = 129,
- DoubleEqual = 130,
- NotEqual = 131,
- GreaterEqual = 132,
- LessEqual = 133,
- DoubleBar = 134,
- DoubleAmpersand = 135,
-
- BooleanLiteral = 200, // Literals
- CharacterLiteral = 201,
- IntegerLiteral = 202,
- FloatingPointLiteral = 203,
- StringLiteral = 204,
- Literal = 205,
-
- Define = 300, // Directives
- Undef = 301,
- If = 302,
- Ifdef = 303,
- Ifndef = 304,
- Else = 305,
- Elif = 306,
- Include = 307,
- Endif = 308,
- Line = 309,
- Error = 310,
- Pragma = 311,
- Null = 312,
- Unknown = 313,
-
- Defined = 400,
-
- // <f46082.40> Keyword identifiers.
- //Abstract = 500,
- //Custom = 501,
- //Init = 502,
- //Private2 = 503,
- //Public2 = 504,
- //Supports = 505,
- //Truncatable = 506,
- //ValueBase = 507,
- //Valuetype = 508,
-
- EOF = 999; // End of Input
-
- // Available types
- ///////////////
- // Keywords
-
- static final String [] Keywords = {
- "any", "attribute", "boolean",
- "case", "char", "const",
- "context", "default", "double",
- "enum", "exception", "FALSE", "fixed",
- "float", "in", "inout",
- "interface", "long", "module", "native",
- "Object", "octet", "oneway",
- "out", "raises", "readonly",
- "sequence", "short", "string",
- "struct", "switch", "TRUE",
- "typedef", "unsigned", "union",
- "void", "wchar", "wstring",
- "init", // In 2.3 only
- "abstract", "custom", "private", // 2.3 and 2.4rtf
- "public", "supports", "truncatable",
- "ValueBase", "valuetype",
- "factory", // In 2.4rtf only
- // CORBA 3.0 keywords
- "component", "consumes", "emits",
- "finder", "getRaises", "home",
- "import", "local", "manages",
- "multiple", "primaryKey", "provides",
- "publishes", "setRaises", "supports",
- "typeId", "typePrefix", "uses" } ;
-
- // <f46082.40> Remove keyword identifiers.
- //static final int
- // FirstKeywordIdentifier = 500,
- // LastKeywordIdentifier = Valuetype;
- //
- //static final String[] KeywordIdentifiers = {
- // "abstract", "custom", "init",
- // "private", "public", "supports",
- // "truncatable", "valueBase", "valuetype"};
-
- /**
- * Determine whether this token is a keyword.
- * @return true iff this token is a keyword.
- **/
- boolean isKeyword ()
- {
- return type >= FirstKeyword && type <= LastKeyword;
- } // isKeyword
-
- private static final int
- FirstKeyword = Any, // 0
- LastKeyword = Uses;
-
- // <f60858.1> Keywords in CORBA 2.2 that we support.
- private static final int
- First22Keyword = Any, // 0
- Last22Keyword = Wstring;
-
- // <f60858.1> New keywords in CORBA 2.3 (preliminary) that we support.
- private static final int
- First23Keyword = Init,
- Last23Keyword = Valuetype;
-
- // <d62023> New keywords in CORBA 2.4rtf (accepted 2.3) that we support.
- // Note that "factory" replaces "init". Scanner must account for this in
- // keyword scan.
- private static final int
- First24rtfKeyword = Abstract,
- Last24rtfKeyword = Factory;
-
- // New keywords in CORBA 3.0 (from CORBA components v. 1)
- private static final int
- First30Keyword = Component,
- Last30Keyword = Uses;
-
- // Current valid CORBA levels:
- // 2.2 (or <2.3): the default: no OBV support
- // 2.3: add OBV with init
- // >2.3: OBV with init replcaed by factory
- // 3.0: adds components, attr exceptions, local interfaces, type repository
- // decls.
-
- private static final int CORBA_LEVEL_22 = 0 ;
- private static final int CORBA_LEVEL_23 = 1 ;
- private static final int CORBA_LEVEL_24RTF = 2 ;
- private static final int CORBA_LEVEL_30 = 3 ;
-
- // Do the conversion from a floating point CORBA level to an int
- private static int getLevel( float cLevel )
- {
- if (cLevel < 2.3f)
- return CORBA_LEVEL_22 ;
- if (Util.absDelta( cLevel, 2.3f ) < 0.001f)
- return CORBA_LEVEL_23 ;
- if (cLevel < 3.0f)
- return CORBA_LEVEL_24RTF ;
- return CORBA_LEVEL_30 ;
- }
-
- // Return the last keyword corresponding to a particular CORBA level
- private static int getLastKeyword( int level )
- {
- if (level == CORBA_LEVEL_22)
- return Last22Keyword ;
- if (level == CORBA_LEVEL_23)
- return Last23Keyword ;
- if (level == CORBA_LEVEL_24RTF)
- return Last24rtfKeyword ;
- return Last30Keyword ;
- }
-
- /** Create a keyword token from a string.
- * Determines whether the string is an IDL keyword based on the corbaLevel.
- * Strings that are keywords at higher CORBA levels than the corbaLevel
- * argument create identifier tokens that are marked as "collidesWithKeyword", unless
- * escapedOK is FALSE, which is the case only when preprocessing is taking place.
- * In the case of the "init" keyword, which was only defined in CORBA 2.3, init is
- * marked deprecated in CORBA 2.3 since it is not supported in higher levels.
- * @param String string The string we are converting to a token.
- * @param float corbaLevel The CORBA level, currently in the interval [2.2, 3.0].
- * @param boolean escapedOK Flag set true if _ is used to escape an IDL keyword for use
- * as an identifier.
- * @param boolean[] collidesWithKeyword is an array containing one value: a flag
- * representing whether this string is an identifier that collides with a keyword.
- * This is set by this method.
- * @returns Token The resulting Token corresponding to string.
- */
- public static Token makeKeywordToken(
- String string, float corbaLevel, boolean escapedOK, boolean[] collision )
- {
- int level = getLevel( corbaLevel ) ;
- int lastKeyword = getLastKeyword( level ) ;
- boolean deprecated = false ;
- collision[0] = false ;
-
- // If the string is a keyword token, return that token
- for (int i = Token.FirstKeyword; i <= Token.LastKeyword; ++i) {
- if (string.equals (Token.Keywords[i])) {
- // <f60858.1><d62023> Return identifier if lexeme is a keyword in a
- // greater CORBA level; collect attributes indicating future keyword/
- // identifier collision and deprecations.
-
- // Init is really a funny case. I don't want to mark it as
- // a keyword collision in the 2.2 case, since it was only
- // defined to be a keyword briefly in 2.3.
- if (i == Token.Init) {
- if (level == CORBA_LEVEL_23)
- deprecated = true ;
- else
- break ;
- }
-
- if (i > lastKeyword) {
- collision[0] |= escapedOK; // escapedOK true iff not preprocessing
- break ;
- }
-
- if (string.equals ("TRUE") || string.equals ("FALSE"))
- return new Token (Token.BooleanLiteral, string) ;
- else
- return new Token (i, deprecated);
- } else if (string.equalsIgnoreCase (Token.Keywords[i])) {
- // <d62023> PU! This will go away in a future release, because
- // case-insensitive keyword checking will be standard. For now,
- // indicate that a keyword collision has occurred.
- collision[0] |= true;
- break;
- }
- } // for i <= lastKeyword
-
- return null ;
- } // makeKeywordToken
-
- // Keywords
- ///////////////
- // Symbols
-
- static final int
- FirstSymbol = 100,
- LastSymbol = 199;
-
- static final String [] Symbols = {
- ";", "{", "}", ":", ",", "=", "+", "-",
- "(", ")", "<", ">", "[", "]", "'", "\"",
- "\\", "|", "^", "&", "*", "/", "%", "~",
- "::", "<<", ">>", ".", "#", "!", "==", "!=",
- ">=", "<=", "||", "&&"};
-
- // Symbols
- ///////////////
- // Literals
-
- static final int
- FirstLiteral = 200,
- LastLiteral = 299;
-
- static final String [] Literals = {
- Util.getMessage ("Token.boolLit"),
- Util.getMessage ("Token.charLit"),
- Util.getMessage ("Token.intLit"),
- Util.getMessage ("Token.floatLit"),
- Util.getMessage ("Token.stringLit"),
- Util.getMessage ("Token.literal")};
-
- // Literals
- ///////////////
- // Directives
-
- /**
- * Determine whether this token is a preprocessor directive.
- * @return true iff this token is a preprocessor directive.
- **/
- boolean isDirective ()
- {
- return type >= FirstDirective && type <= LastDirective;
- } // isDirective
-
- static final int
- FirstDirective = 300,
- LastDirective = 399;
-
- static final String [] Directives = {
- "define", "undef", "if",
- "ifdef", "ifndef", "else",
- "elif", "include","endif",
- "line", "error", "pragma",
- ""};
-
- // Directives
- ///////////////
- // Specials
-
- static final int
- FirstSpecial = 400,
- LastSpecial = 499;
-
- static final String [] Special = {
- "defined"};
-
- // Specials
- ///////////////
-
- /**
- * Constructor.
- * @return a Token of the supplied type.
- **/
- Token (int tokenType)
- {
- type = tokenType;
- } // ctor
-
- // <d62023>
- /**
- * Constructor.
- * @return a Token having the supplied attributes.
- **/
- Token (int tokenType, boolean deprecated)
- {
- this.type = tokenType;
- this.isDeprecated = deprecated;
- } // ctor
-
- /**
- * Constructor.
- * @return a Token having the supplied attributes.
- **/
- Token (int tokenType, String tokenName)
- {
- type = tokenType;
- name = tokenName;
- } // ctor
-
- /**
- * Constructor.
- * @return a Token having the supplied attribtues.
- * having
- **/
- Token (int tokenType, String tokenName, boolean isWide)
- {
- this (tokenType, tokenName);
- this.isWide = isWide;
- } // ctor
-
-
- // <d62023>
- /**
- * Constructor.
- * @return a Token having the supplied attributes.
- **/
- Token (int tokenType, String tokenName, boolean escaped,
- boolean collision, boolean deprecated)
- {
- this (tokenType, tokenName);
- this.isEscaped = escaped;
- this.collidesWithKeyword = collision;
- this.isDeprecated = deprecated;
- } // ctor
-
- // <f46082.40> Remove keyword identifiers.
- ///**
- // * Constructor.
- // * @return a Token having the supplied attributes.
- // **/
- //Token (int tokenType, int tokenSubType, String tokenName)
- //{
- // type = tokenType;
- // subType = tokenSubType;
- // name = tokenName;
- //} // ctor
-
- /**
- * Get the String representation of this Token.
- * @return a String containing representation of this Token.
- **/
- public String toString ()
- {
- if (type == Identifier)
- return name;
- if (type == MacroIdentifier)
- return name + '(';
- return Token.toString (type);
- } // toString
-
- /**
- * Get the String representation of a supplied Token type.
- * @return A String containing the name of the supplied Token type.
- **/
- static String toString (int type)
- {
- if (type <= LastKeyword)
- return Keywords[type];
- // <f46082.40> Remove keyword identifiers.
- //if ( (type >= FirstKeywordIdentifier) && (type <= LastKeywordIdentifier) )
- // return KeywordIdentifiers[ type - FirstKeywordIdentifier ];
- if (type == Identifier || type == MacroIdentifier)
- return Util.getMessage ("Token.identifier");
- if (type <= LastSymbol)
- return Symbols[type - FirstSymbol];
- if (type <= LastLiteral)
- return Literals[type - FirstLiteral];
- if (type <= LastDirective)
- return Directives[type - FirstDirective];
- if (type <= LastSpecial)
- return Special[type - FirstSpecial];
- if (type == EOF)
- return Util.getMessage ("Token.endOfFile");
- return Util.getMessage ("Token.unknown");
- } // toString
-
- ///////////////
- // Accessors and Predicates
-
- /**
- * Determine whether this token equals a supplied token.
- * @return true iff the types and names of this and the supplied
- * Token are equal.
- **/
- boolean equals (Token that)
- {
- if (this.type == that.type)
- if (this.name == null)
- return that.name == null;
- else
- return this.name.equals (that.name);
- return false;
- } // equals
-
- /**
- * Determine whether the this token is of a supplied type.
- * @return true iff the type of this Token equals that supplied.
- **/
- boolean equals (int type)
- {
- return this.type == type;
- } // equals
-
- /**
- * Determine whether this identifier has the supplied name.
- * @return true iff this Token is an identifier having the supplied name.
- **/
- boolean equals (String name)
- {
- return (this.type == Identifier && this.name.equals (name));
- } // equals
-
- // Although isEscaped is an independent attribute, it may be true only
- // when type is Identifer.
- /**
- * Accessor.
- * @return true iff this token is an escaped identifier.
- **/
- public boolean isEscaped ()
- {
- return type == Identifier && isEscaped;
- } // isEscaped
-
- // <d62023>
- /**
- * Accessor.
- * @return true iff this token is an identifier having a name matching
- * a keyword in a version of CORBA greater than the specified CORBA level,
- * or iff it matches a keyword in letter, but note case.
- **/
- public boolean collidesWithKeyword ()
- {
- return collidesWithKeyword;
- } // collidesWithKeyword
-
- // <d62023> Storing deprecation information in a token seems a natural
- // means to notify the parser about deprecated types.
- /**
- * Accessor.
- * @return true iff this token is a deprecated lexeme or lexical type with
- * respect to the specified CORBA level.
- **/
- public boolean isDeprecated ()
- {
- return isDeprecated;
- }
- // isDeprecated
-
- public boolean isWide()
- {
- return isWide ;
- }
-
- // <d59166><d62023> It's more efficient if Scanner determines this attribute.
- /**
- * Determine whether this token collides with an IDL keyword.
- **/
- //public boolean collidesWithKeyword ()
- //{
- // if (name != null && type == Identifier && !isEscaped)
- // {
- // String lcName = name.toLowerCase ();
- // for (int i = FirstKeyword; i <= LastKeyword; ++i)
- // if (lcName.equals (Token.Keywords [i].toLowerCase ()))
- // return true;
- // }
- // return false;
- //} // collidesWithKeyword
-
- // Accessors and Predicates
- ///////////////
-
- /**
- * Code identifying the lexical class to which this token belongs, e.g.,
- * Keyword, Identifier, ...
- **/
- int type;
- /**
- * Lexeme extracted from the source for this token.
- **/
- String name = null;
- /**
- * Source comment associated with this token.
- **/
- Comment comment = null;
- /**
- * True iff this token is an escaped identifier.
- **/
- boolean isEscaped = false; // <d59165>
- /**
- * True iff this token is an identifier that is known to be a keyword
- * in another version of CORBA or matches a keyword in letter, but not case.
- **/
- boolean collidesWithKeyword = false; // <d62023>
- /**
- * True iff this token is deprecated.
- **/
- boolean isDeprecated = false; // <d62023>
- // <f46082.40> Remove keyword identifier implementation.
- ///**
- // * Non-zero only when type = [Macro]Identifier
- // **/
- //int subType = 0;
-
- boolean isWide = false ; // Only for string and char literals: indicates that this is
- // a wide string or char.
-} // class Token
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/TokenBuffer.java b/src/share/classes/com/sun/tools/corba/se/idl/TokenBuffer.java
deleted file mode 100644
index 6e153ae..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/TokenBuffer.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-class TokenBuffer
-{
- private final int DEFAULT_SIZE = 10;
-
- private int _size = 0;
- private Token _buffer [] = null;
- private int _currPos = -1;
-
- TokenBuffer ()
- {
- _size = DEFAULT_SIZE;
- _buffer = new Token [_size];
- _currPos = -1;
- } // ctor
-
- TokenBuffer (int size) throws Exception
- {
- _size = size; // _size == 0 is legal, but useless and problematic
- _buffer = new Token [_size];
- _currPos = -1;
- } // ctor
-
- /** Inserts a token at the head of the buffer. */
- void insert (Token token)
- {
- // _size == 0 ==> ArithmeticException: divide by zero
- _currPos = ++_currPos % _size;
- _buffer [_currPos] = token;
- }
-
- /** Returns the token residing "i" elements from the head of the buffer. */
- Token lookBack (int i)
- {
- // Beware: i > _size ==> idx < 0 ==> ArrayOutOfBoundsException
- return _buffer [(_currPos - i) >= 0 ? _currPos - i : _currPos - i + _size];
- }
-
- /** Return the token most recently inserted into the buffer (i.e., the head of the buffer.) */
- Token current ()
- {
- // Beware: _buffer empty || _size == 0 ==> ArrayOutOfBoundsException
- return _buffer [_currPos];
- }
-} // class TokenBuffer
-
-
-/*==================================================================================
- DATE<AUTHOR> ACTION
- ----------------------------------------------------------------------------------
- 11aug1997<daz> Initial version completed. Buffer used to maintain history of
- comments extracted from source file during parse.
- ==================================================================================*/
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/TypedefEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/TypedefEntry.java
deleted file mode 100644
index 8ed44f5..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/TypedefEntry.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.constExpr.Expression;
-
-/**
- * This is the symbol table entry for typedefs.
- **/
-public class TypedefEntry extends SymtabEntry
-{
- protected TypedefEntry ()
- {
- super ();
- } // ctor
-
- protected TypedefEntry (TypedefEntry that)
- {
- super (that);
- _arrayInfo = (Vector)that._arrayInfo.clone ();
- } // ctor
-
- protected TypedefEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
- if (module ().equals (""))
- module (name ());
- else if (!name ().equals (""))
- module (module () + "/" + name ());
- } // ctor
-
- /** This method returns a vector of Expressions, each expression
- represents a dimension in an array. A zero-length vector indicates
- no array information.*/
- public Vector arrayInfo ()
- {
- return _arrayInfo;
- } // arrayInfo
-
- public void addArrayInfo (Expression e)
- {
- _arrayInfo.addElement (e);
- } // addArrayInfo
-
- public Object clone ()
- {
- return new TypedefEntry (this);
- } // clone
-
- /** Invoke the typedef generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- typedefGen.generate (symbolTable, this, stream);
- } // generate
-
- public boolean isReferencable()
- {
- // A typedef is referencable if its component
- // type is.
- return type().isReferencable() ;
- }
-
- public void isReferencable( boolean value )
- {
- // NO-OP: this cannot be set for a typedef.
- }
-
- /** Access the typedef generator.
- @returns an object which implements the TypedefGen interface.
- @see TypedefGen */
- public Generator generator ()
- {
- return typedefGen;
- } // generator
-
- private Vector _arrayInfo = new Vector ();
-
- static TypedefGen typedefGen;
-} // class TypedefEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/TypedefGen.java b/src/share/classes/com/sun/tools/corba/se/idl/TypedefGen.java
deleted file mode 100644
index c451292..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/TypedefGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface TypedefGen extends Generator
-{
- void generate (Hashtable symbolTable, TypedefEntry entry, PrintWriter stream);
-} // interface TypedefGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/UnionBranch.java b/src/share/classes/com/sun/tools/corba/se/idl/UnionBranch.java
deleted file mode 100644
index 8b0df9d..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/UnionBranch.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.TypedefEntry;
-
-/**
- * This class encapsulates one branch of a union. Here are some examples
- * of what it may contain:
- * <dl>
- * <dt>
- * <pre>
- * case 1: short x;
- * </pre>
- * <dd><short x, <1>, false>
- * <dt>
- * <pre>
- * case 0:
- * case 8:
- * case 2: long x;
- * </pre>
- * <dd><long x, <0, 8, 2>, false>
- * <dt>
- * <pre>
- * default: long x;
- * </pre>
- * <dd><long x, <>, true>
- * <dt>
- * <pre>
- * case 0:
- * case 2:
- * default: char c;
- * </pre>
- * <dd><char c, <0, 2>, true>
- * </dl>
- **/
-public class UnionBranch
-{
- /** The type definition for the branch. */
- public TypedefEntry typedef;
- /** A vector of Expression's, one for each label in the order in which
- they appear in the IDL file. The default branch has no label. */
- public Vector labels = new Vector ();
- /** true if this is the default branch. */
- public boolean isDefault = false;
-} // class UnionBranch
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/UnionEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/UnionEntry.java
deleted file mode 100644
index b41b840..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/UnionEntry.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.constExpr.Expression;
-
-/**
- * This is the symbol table entry for unions.
- **/
-public class UnionEntry extends SymtabEntry
-{
- protected UnionEntry ()
- {
- super ();
- } // ctor
-
- protected UnionEntry (UnionEntry that)
- {
- super (that);
- if (!name ().equals (""))
- {
- module (module () + name ());
- name ("");
- }
- _branches = (Vector)that._branches.clone ();
- _defaultBranch = that._defaultBranch;
- _contained = that._contained;
- } // ctor
-
- protected UnionEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
- if (module ().equals (""))
- module (name ());
- else if (!name ().equals (""))
- module (module () + "/" + name ());
- } // ctor
-
- public Object clone ()
- {
- return new UnionEntry (this);
- } // clone
-
- /** Invoke the union generator.
- @param symbolTable the symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- unionGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the union generator.
- @returns an object which implements the UnionGen interface.
- @see UnionGen */
- public Generator generator ()
- {
- return unionGen;
- } // generator
-
- public void addBranch (UnionBranch branch)
- {
- _branches.addElement (branch);
- } // addBranch
-
- /** This is a vector of UnionBranch's. */
- public Vector branches ()
- {
- return _branches;
- } // branches
-
- /** This TypedefEntry describes the type and name for the default branch.
- Like the entries in the branches vector, only the type and name fields
- are pertinent. */
- public void defaultBranch (TypedefEntry branch)
- {
- _defaultBranch = branch;
- } // defaultBranch
-
- /** This TypedefEntry describes the type and name for the default branch.
- Like the entries in the branches vector, only the type and name fields
- are pertinent. */
- public TypedefEntry defaultBranch ()
- {
- return _defaultBranch;
- } // defaultBranch
-
- public void addContained (SymtabEntry entry)
- {
- _contained.addElement (entry);
- } // addContained
-
- /** This is a vector of SymtabEntry's. It itemizes any types which
- this union contains. For example:
-
- <pre>
- union A
- switch (long)
- {
- case 0: long x;
- case 1:
- Struct B
- {
- long a;
- long b;
- } y;
- }
- </pre>
- Struct B is contained within union A. */
- public Vector contained ()
- {
- return _contained;
- } // contained
-
- boolean has (Expression label)
- {
- Enumeration eBranches = _branches.elements ();
- while (eBranches.hasMoreElements ())
- {
- Enumeration eLabels = ((UnionBranch)eBranches.nextElement ()).labels.elements ();
- while (eLabels.hasMoreElements ())
- {
- Expression exp = (Expression)eLabels.nextElement ();
- if (exp.equals (label) || exp.value ().equals (label.value ()))
- return true;
- }
- }
- return false;
- } // has
-
- boolean has (TypedefEntry typedef)
- {
- Enumeration e = _branches.elements ();
- while (e.hasMoreElements ())
- {
- UnionBranch branch = (UnionBranch)e.nextElement ();
- if (!branch.typedef.equals (typedef) && branch.typedef.name ().equals (typedef.name ()))
- return true;
- }
- return false;
- } // has
-
- /** A vector of UnionBranch's. */
- private Vector _branches = new Vector ();
- private TypedefEntry _defaultBranch = null;
- private Vector _contained = new Vector ();
-
- static UnionGen unionGen;
-} // class UnionEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/UnionGen.java b/src/share/classes/com/sun/tools/corba/se/idl/UnionGen.java
deleted file mode 100644
index fc009a4..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/UnionGen.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-public interface UnionGen extends Generator
-{
- void generate (Hashtable symtab, UnionEntry entry, PrintWriter stream);
-} // interface UnionGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/Util.java b/src/share/classes/com/sun/tools/corba/se/idl/Util.java
deleted file mode 100644
index 7621859..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/Util.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-// -capitalize and parseTypeModifier should probably be in the
-// generators package.
-// -D58319<daz> Add version() method.
-// -D62023<daz> Add absDelta() method to support float computations.
-
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Properties;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.som.cff.FileLocator;
-
-public class Util
-{
- // <d58319>
- /**
- * Fetch the version number of this build of the IDL Parser Framework
- * from the appropriate properties file.
- * @return the version number contained within the appropriate properties
- * file, which indicates the build of this IDL Parser Framework.
- **/
- public static String getVersion ()
- {
- return getVersion ("com/sun/tools/corba/se/idl/idl.prp");
- } // getVersion
-
- /**
- * Fetch the version number of this build of the IDL Parser Framework.
- * This method may be called before or after the framework has been
- * initialized. If the framework is inititialized, the version information
- * is extracted from the message properties object; otherwise, it is extracted
- * from the indicated messages file.
- * @return the version number.
- **/
- public static String getVersion (String filename)
- {
- String version = "";
- if (messages == null) // Use supplied file
- {
- Vector oldMsgFiles = msgFiles;
- if (filename == null || filename.equals (""))
- filename = "com/sun/tools/corba/se/idl/idl.prp";
- filename = filename.replace ('/', File.separatorChar);
- registerMessageFile (filename);
- version = getMessage ("Version.product", getMessage ("Version.number"));
- msgFiles = oldMsgFiles;
- messages = null;
- }
- else
- {
- version = getMessage ("Version.product", getMessage ("Version.number"));
- }
- return version;
- } // getVersion
-
- public static boolean isAttribute (String name, Hashtable symbolTable)
- {
- SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
- return entry == null ? false : entry instanceof AttributeEntry;
- } // isAttribute
-
- public static boolean isConst (String name, Hashtable symbolTable)
- {
- SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
- return entry == null ? false : entry instanceof ConstEntry;
- } // isConst
-
- public static boolean isEnum (String name, Hashtable symbolTable)
- {
- SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
- return entry == null ? false : entry instanceof EnumEntry;
- } // isEnum
-
- public static boolean isException (String name, Hashtable symbolTable)
- {
- SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
- return entry == null ? false : entry instanceof ExceptionEntry;
- } // isException
-
- public static boolean isInterface (String name, Hashtable symbolTable)
- {
- SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
- return entry == null ? false : entry instanceof InterfaceEntry;
- } // isInterface
-
- public static boolean isMethod (String name, Hashtable symbolTable)
- {
- SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
- return entry == null ? false : entry instanceof MethodEntry;
- } // isMethod
-
- public static boolean isModule (String name, Hashtable symbolTable)
- {
- SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
- return entry == null ? false : entry instanceof ModuleEntry;
- } // isModule
-
- public static boolean isParameter (String name, Hashtable symbolTable)
- {
- SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
- return entry == null ? false : entry instanceof ParameterEntry;
- } // isParameter
-
- public static boolean isPrimitive (String name, Hashtable symbolTable)
- {
- // Distinguish "string" because the name could be something like:
- // string(25 + 1)
- SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
- if (entry == null)
- {
- // If it is null then it may be of the form string(<exp>).
- // Don't just check for string because the name "string" may
- // have been overridden.
- int parenIndex = name.indexOf ('(');
- if (parenIndex >= 0)
- entry = (SymtabEntry)symbolTable.get (name.substring (0, parenIndex));
- }
- return entry == null ? false : entry instanceof PrimitiveEntry;
- } // isPrimitive
-
- public static boolean isSequence (String name, Hashtable symbolTable)
- {
- SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
- return entry == null ? false : entry instanceof SequenceEntry;
- } // isSequence
-
- public static boolean isStruct (String name, Hashtable symbolTable)
- {
- SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
- return entry == null ? false : entry instanceof StructEntry;
- } // isStruct
-
- public static boolean isString (String name, Hashtable symbolTable)
- {
- SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
- return entry == null ? false : entry instanceof StringEntry;
- } // isString
-
- public static boolean isTypedef (String name, Hashtable symbolTable)
- {
- SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
- return entry == null ? false : entry instanceof TypedefEntry;
- } // isTypedef
-
- public static boolean isUnion (String name, Hashtable symbolTable)
- {
- SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
- return entry == null ? false : entry instanceof UnionEntry;
- } // isUnion
-
- //////////////
- // Message-related methods
-
- public static String getMessage (String key)
- {
- if (messages == null)
- readMessages ();
- String message = messages.getProperty (key);
- if (message == null)
- message = getDefaultMessage (key);
- return message;
- } // getMessage
-
- public static String getMessage (String key, String fill)
- {
- if (messages == null)
- readMessages ();
- String message = messages.getProperty (key);
- if (message == null)
- message = getDefaultMessage (key);
- else
- {
- int index = message.indexOf ("%0");
- if (index >= 0)
- message = message.substring (0, index) + fill + message.substring (index + 2);
- }
- return message;
- } // getMessage
-
- public static String getMessage (String key, String[] fill)
- {
- if (messages == null)
- readMessages ();
- String message = messages.getProperty (key);
- if (message == null)
- message = getDefaultMessage (key);
- else
- for (int i = 0; i < fill.length; ++i)
- {
- int index = message.indexOf ("%" + i);
- if (index >= 0)
- message = message.substring (0, index) + fill[i] + message.substring (index + 2);
- }
- return message;
- } // getMessage
-
- private static String getDefaultMessage (String keyNotFound)
- {
- String message = messages.getProperty (defaultKey);
- int index = message.indexOf ("%0");
- if (index > 0)
- message = message.substring (0, index) + keyNotFound;
- return message;
- } // getDefaultMessage
-
- /*
- findFile is no longer used now that FileLocator has been provided
- by Larry Raper of the Shasta team.
-
- static File findFile (String name) throws FileNotFoundException
- {
- String classpath = System.getProperty ("java.class.path");
- String separator = System.getProperty ("path.separator");
- int end = -separator.length (); // so the first pass classpath == original classpath
- File file;
- do
- {
- classpath = classpath.substring (end + separator.length ());
- end = classpath.indexOf (separator);
- if (end < 0) end = classpath.length ();
- file = new File (classpath.substring (0, end) + File.separator + "com" + File.separator + "ibm" + File.separator + "idl" + File.separator + name);
- } while (!file.exists () && end != classpath.length ());
- if (!file.exists ()) throw new FileNotFoundException ();
- return file;
- } // findFile
- */
-
- private static void readMessages ()
- {
- messages = new Properties ();
- Enumeration fileList = msgFiles.elements ();
- DataInputStream stream;
- while (fileList.hasMoreElements ())
- try
- {
- stream = FileLocator.locateLocaleSpecificFileInClassPath ((String)fileList.nextElement ());
- messages.load (stream);
- }
- catch (IOException e)
- {
- }
- if (messages.size () == 0)
- messages.put (defaultKey, "Error reading Messages File.");
- } // readMessages
-
- /** Register a message file. This file will be searched for
- in the CLASSPATH. */
- public static void registerMessageFile (String filename)
- {
- if (filename != null)
- if (messages == null)
- msgFiles.addElement (filename);
- else
- try
- {
- DataInputStream stream = FileLocator.locateLocaleSpecificFileInClassPath (filename);
- messages.load (stream);
- }
- catch (IOException e)
- {
- }
- } // registerMessageFile
-
- private static Properties messages = null;
- private static String defaultKey = "default";
- private static Vector msgFiles = new Vector ();
- static
- {
- msgFiles.addElement ("com/sun/tools/corba/se/idl/idl.prp");
- }
-
- // Message-related methods
- ///////////////
-
- public static String capitalize (String lc)
- {
- String first = new String (lc.substring (0, 1));
- first = first.toUpperCase ();
- return first + lc.substring (1);
- } // capitalize
-
- ///////////////
- // General file methods
-
- /** Searches the current user directory and a list of directories for
- a given short file name and returns its absolute file specification.
- @return Absolute file name of a given short filename
- @throws FileNotFoundException The file does not exist in the
- current user or specified directories.
- @see java.io.File.getAbsolutePath */
- public static String getAbsolutePath (String filename, Vector includePaths) throws FileNotFoundException
- {
- String filepath = null;
- File file = new File (filename);
- if (file.canRead ())
- filepath = file.getAbsolutePath ();
- else
- {
- String fullname = null;
- Enumeration pathList = includePaths.elements ();
- while (!file.canRead () && pathList.hasMoreElements ())
- {
- fullname = (String)pathList.nextElement () + File.separatorChar + filename;
- file = new File (fullname);
- }
- if (file.canRead ())
- filepath = file.getPath ();
- else
- throw new FileNotFoundException (filename);
- }
- return filepath;
- } // getAbsolutePath
-
- // General file methods
- ///////////////
-
- ///////////////
- // Numeric computations
-
- // <d62023>
- /**
- * Compute the absolute value of the difference between two floating-point
- * numbers having single precision.
- * @return the absolute value of the difference between two floats.
- **/
- public static float absDelta (float f1, float f2)
- {
- double delta = f1 - f2;
- return (float)((delta < 0) ? delta * -1.0 : delta);
- } // absDelta
-
- // Numeric computations
- ///////////////
-
- static RepositoryID emptyID = new RepositoryID ();
-} // class Util
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ValueBoxEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/ValueBoxEntry.java
deleted file mode 100644
index ebc6704..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ValueBoxEntry.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-/**
- * This is the symbol table entry for valuesBoxes.
- **/
-public class ValueBoxEntry extends ValueEntry
-{
- protected ValueBoxEntry ()
- {
- super ();
- } // ctor
-
- protected ValueBoxEntry (ValueBoxEntry that)
- {
- super (that);
- } // ctor
-
- protected ValueBoxEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
- } // ctor
-
- public Object clone ()
- {
- return new ValueBoxEntry (this);
- } // clone
-
- /** Invoke the interface generator.
- @param symbolTable the symbol table is a hash table whose key is a fully
- qualified type name and whose value is a SymtabEntry or a subclass of
- SymtabEntry.
- @param stream the stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- valueBoxGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the value generator.
- @returns an object which implements the ValueGen interface.
- @see ValueGen */
- public Generator generator ()
- {
- return valueBoxGen;
- } // generator
-
- static ValueBoxGen valueBoxGen;
-} // class ValueEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ValueBoxGen.java b/src/share/classes/com/sun/tools/corba/se/idl/ValueBoxGen.java
deleted file mode 100644
index e8317b0..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ValueBoxGen.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import com.sun.tools.corba.se.idl.*;
-
-public interface ValueBoxGen extends Generator
-{
- void generate (Hashtable symbolTable, ValueBoxEntry entry, PrintWriter stream);
-} // interface ValueBoxGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ValueEntry.java b/src/share/classes/com/sun/tools/corba/se/idl/ValueEntry.java
deleted file mode 100644
index 2d92a9b..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ValueEntry.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-import com.sun.tools.corba.se.idl.constExpr.Expression;
-//<daz> import com.sun.tools.corba.se.idl.som.idlemit.TypeCode;
-
-/**
-* This is the symbol table entry for values.
-**/
-public class ValueEntry extends InterfaceEntry
-{
- protected ValueEntry ()
- {
- super ();
- } // ctor
-
- protected ValueEntry (ValueEntry that)
- {
- super (that);
- _supportsNames = (Vector)that._supportsNames.clone ();
- _supports = (Vector)that._supports.clone ();
- _initializers = (Vector)that._initializers.clone ();
- _custom = that._custom;
- _isSafe = that._isSafe;
- } // ctor
-
- protected ValueEntry (SymtabEntry that, IDLID clone)
- {
- super (that, clone);
- } // ctor
-
- public Object clone ()
- {
- return new ValueEntry (this);
- } // clone
-
- /** Invoke the interface generator.
- @param symbolTable The symbol table is a hash table whose key is
- a fully qualified type name and whose value is a SymtabEntry or
- a subclass of SymtabEntry.
- @param stream The stream to which the generator should sent its output.
- @see SymtabEntry */
- public void generate (Hashtable symbolTable, PrintWriter stream)
- {
- valueGen.generate (symbolTable, this, stream);
- } // generate
-
- /** Access the value generator.
- @returns an object which implements the ValueGen interface.
- @see ValueGen */
- public Generator generator ()
- {
- return valueGen;
- } // generator
-
- /** Add an InterfaceEntry to the list of interfaces which this value
- supports. During parsing, the parameter to this method COULD be a
- ForwardEntry, but when parsing is complete, calling supports will
- return a vector which only contains InterfaceEntry's. */
- public void addSupport (SymtabEntry supports)
- {
- _supports.addElement (supports);
- } // addSupport
-
- /** This method returns a vector of InterfaceEntry's. */
- public Vector supports ()
- {
- return _supports;
- } // supports
-
- /** Add to the list of support names. */
- public void addSupportName (String name)
- {
- _supportsNames.addElement (name);
- } // addSupportName
-
- /** This method returns a vector of Strings, each of which is a fully
- qualified name of an interface. This vector corresponds to the
- supports vector. The first element of this vector is the name of
- the first element of the supports vector, etc. */
- public Vector supportsNames ()
- {
- return _supportsNames;
- } // supportsNames
-
- /** Add a parent value type to the list of parent types for the value.
- This method:
- <UL>
- <LI> Allows only the first added class to be concrete if the receiver is
- concrete.
- <LI> Does not allow any added classes to be concrete if the receiver is
- abstract.
- <LI> Does not allow duplicate classes to be added.
- </UL> */
- void derivedFromAddElement (SymtabEntry e, boolean isSafe, Scanner scanner)
- {
- if (((InterfaceType)e).getInterfaceType() != InterfaceType.ABSTRACT) {
- if (isAbstract ())
- ParseException.nonAbstractParent2 (scanner, fullName (), e.fullName ());
- else if (derivedFrom ().size () > 0)
- ParseException.nonAbstractParent3 (scanner, fullName (), e.fullName ());
- }
-
- if (derivedFrom ().contains (e))
- ParseException.alreadyDerived (scanner, e.fullName (), fullName ());
-
- if (isSafe)
- _isSafe = true;
-
- addDerivedFrom (e);
- addDerivedFromName (e.fullName ());
- addParentType (e, scanner);
- } // derivedFromAddElement
-
- void derivedFromAddElement (SymtabEntry e, Scanner scanner)
- {
- // This code must check for duplicate interfaces being supported...
- addSupport (e);
- addSupportName (e.fullName ());
- addParentType (e, scanner);
- } // derivedFromAddElement
-
- public boolean replaceForwardDecl (ForwardEntry oldEntry, InterfaceEntry newEntry)
- {
- if (super.replaceForwardDecl (oldEntry, newEntry))
- return true;
- int index = _supports.indexOf (oldEntry);
- if ( index >= 0)
- _supports.setElementAt (newEntry, index);
- return (index >= 0);
- }
-
- void initializersAddElement (MethodEntry method, Scanner scanner)
- {
- // Check to see if the parameter signature is a duplicate:
- Vector params = method.parameters ();
- int args = params.size ();
- for (Enumeration e = _initializers.elements (); e.hasMoreElements ();)
- {
- Vector params2 = ( (MethodEntry) e.nextElement ()).parameters ();
- if (args == params2.size ())
- {
- int i = 0;
- for (; i < args; i++)
- if (!((ParameterEntry)params.elementAt (i)).type ().equals (
- ((ParameterEntry)params2.elementAt (i)).type ()))
- break;
- if (i >= args)
- ParseException.duplicateInit (scanner);
- }
- }
- _initializers.addElement (method);
- } // initializersAddElement
-
- public Vector initializers ()
- {
- return _initializers;
- }
-
- /** Tag all methods introduced by the value type as 'value methods' so
- they can be differentiated in the emitters from any interface methods
- that the value type supports. */
- public void tagMethods ()
- {
- for (Enumeration e = methods ().elements (); e.hasMoreElements ();)
- ((MethodEntry)e.nextElement ()).valueMethod (true);
- }
-
- // <46082.03> Revert to "IDL:"-style (i.e., regular) repository ID.
-
- /** Calculate the 'repository ID' for the value. This method should not be
- called before the complete value type has been parsed, since it computes
- the repository ID by computing hashcodes using all information contained
- in the value type definition, not just the value type's fully qualified
- name.*/
- /*
- public void calcRepId ()
- {
- ValueRepositoryId repId = new ValueRepositoryId ();
- repId.addType (this);
- calcRepId (repId);
- String scopedName = fullName ();
- // KLR - following switched to new format 8/26/98 per Simon's request
- repositoryID (new RepositoryID ( "H:" + repId.getHashcode() + ":" + scopedName));
- } // calcRepId
- */
-
- /*
- public void calcRepId (ValueRepositoryId repId)
- {
- Vector baseClasses = derivedFrom ();
- if (baseClasses.size () >= 1)
- ((ValueEntry)baseClasses.elementAt (0)).calcRepId (repId);
- Vector state = state ();
- if (state != null)
- for (Enumeration e = state.elements (); e.hasMoreElements ();)
- calcTypedefType (((InterfaceState)e.nextElement ()).entry, repId);
- } // calcRepId
-
- private void calcValueType (ValueEntry entry, ValueRepositoryId repId)
- {
- if (repId.isNewType (entry))
- {
- //<daz> repId.addValue (TypeCode.tk_value);
- repId.addValue (org.omg.CORBA.TCKind._tk_value);
- entry.calcRepId (repId);
- }
- } // calcValueType
-
- private void calcValueBoxType (ValueBoxEntry entry, ValueRepositoryId repId)
- {
- if (repId.isNewType (entry))
- {
- //<daz> repId.addValue (TypeCode.tk_value_box);
- repId.addValue (org.omg.CORBA.TCKind._tk_value_box);
- entry.calcRepId (repId);
- }
- } // calcValueBoxType
-
- private void calcTypedefType (TypedefEntry entry, ValueRepositoryId repId)
- {
- if (repId.isNewType (entry))
- {
- Vector arrayInfo = entry.arrayInfo ();
- if (arrayInfo.size () > 0)
- {
- //<daz> repId.addValue (TypeCode.tk_array);
- repId.addValue (org.omg.CORBA.TCKind._tk_array);
- for (Enumeration e = arrayInfo.elements (); e.hasMoreElements ();)
- repId.addValue (((Number)((Expression)e.nextElement ()).value ()).intValue ());
- }
- calcType (entry.type (), repId);
- }
- } // calcTypedefType
-
- private void calcType (SymtabEntry entry, ValueRepositoryId repId)
- {
- if (entry instanceof TypedefEntry)
- calcTypedefType ((TypedefEntry)entry, repId);
- else if (entry instanceof PrimitiveEntry)
- calcPrimitiveType (entry, repId);
- else if (entry instanceof InterfaceEntry)
- //<daz> repId.addValue (TypeCode._tk_objref);
- repId.addValue (org.omg.CORBA.TCKind._tk_objref);
- else if (entry instanceof EnumEntry)
- //<daz> repId.addValue (TypeCode._tk_enum);
- repId.addValue (org.omg.CORBA.TCKind._tk_enum);
- else if (entry instanceof StringEntry)
- calcStringType ( (StringEntry) entry, repId);
- else if (entry instanceof SequenceEntry)
- calcSequenceType ( (SequenceEntry) entry, repId);
- else if (entry instanceof StructEntry)
- calcStructType ( (StructEntry) entry, repId);
- else if (entry instanceof UnionEntry)
- calcUnionType ( (UnionEntry) entry, repId);
- else if (entry instanceof ValueBoxEntry)
- calcValueBoxType ( (ValueBoxEntry) entry, repId);
- else if (entry instanceof ValueEntry)
- calcValueType ( (ValueEntry) entry, repId);
- } // calcType
-
- private static Hashtable primTypes;
-
- private void calcPrimitiveType (SymtabEntry entry, ValueRepositoryId repId)
- {
- if (primTypes == null)
- {
- primTypes = new Hashtable ();
- //<daz> primTypes.put ("short", new Integer (TypeCode.tk_short ));
- primTypes.put ("short", new Integer (org.omg.CORBA.TCKind._tk_short ));
- //<daz> primTypes.put ("long", new Integer (TypeCode.tk_long ));
- primTypes.put ("long", new Integer (org.omg.CORBA.TCKind._tk_long ));
- //<daz> primTypes.put ("unsigned short", new Integer (TypeCode.tk_ushort ));
- primTypes.put ("unsigned short", new Integer (org.omg.CORBA.TCKind._tk_ushort ));
- //<daz> primTypes.put ("unsigned long", new Integer (TypeCode.tk_ulong ));
- primTypes.put ("unsigned long", new Integer (org.omg.CORBA.TCKind._tk_ulong ));
- //<daz> primTypes.put ("char", new Integer (TypeCode.tk_char ));
- primTypes.put ("char", new Integer (org.omg.CORBA.TCKind._tk_char ));
- //<daz> primTypes.put ("wchar", new Integer (TypeCode.tk_wchar ));
- primTypes.put ("wchar", new Integer (org.omg.CORBA.TCKind._tk_wchar ));
- //<daz> primTypes.put ("float", new Integer (TypeCode.tk_float ));
- primTypes.put ("float", new Integer (org.omg.CORBA.TCKind._tk_float ));
- //<daz> primTypes.put ("double", new Integer (TypeCode.tk_double ));
- primTypes.put ("double", new Integer (org.omg.CORBA.TCKind._tk_double ));
- //<daz> primTypes.put ("boolean", new Integer (TypeCode.tk_boolean));
- primTypes.put ("boolean", new Integer (org.omg.CORBA.TCKind._tk_boolean));
- //<daz> primTypes.put ("octet", new Integer (TypeCode.tk_octet ));
- primTypes.put ("octet", new Integer (org.omg.CORBA.TCKind._tk_octet ));
- //<daz> primTypes.put ("any", new Integer (TypeCode.tk_any )); }
- primTypes.put ("any", new Integer (org.omg.CORBA.TCKind._tk_any ));
- }
- repId.addValue (((Integer)primTypes.get (entry.name ())).intValue ());
- } // calcPrimitiveType
-
- private void calcStringType (StringEntry entry, ValueRepositoryId repId)
- {
- repId.addValue (entry.name ().equals (Parser.overrideName ("string")) ?
- //<daz> TypeCode.tk_string:
- org.omg.CORBA.TCKind._tk_string :
- //<daz> TypeCode.tk_wstring);
- org.omg.CORBA.TCKind._tk_wstring);
- if (entry.maxSize () != null)
- try
- {
- repId.addValue ( ( (Number) (entry.maxSize ()).value ()). intValue ());
- }
- catch (Exception exception)
- {}
- } // calcStringType
-
- private void calcSequenceType (SequenceEntry entry, ValueRepositoryId repId)
- {
- //<daz> repId.addValue (TypeCode.tk_sequence);
- repId.addValue (org.omg.CORBA.TCKind._tk_sequence);
- if (entry.maxSize () != null)
- try
- {
- repId.addValue (((Number)(entry.maxSize ()).value ()).intValue ());
- }
- catch (Exception exception)
- {}
- } // calcSequenceType
-
- private void calcStructType (StructEntry entry, ValueRepositoryId repId)
- {
- if (repId.isNewType (entry))
- {
- //<daz> repId.addValue (TypeCode.tk_struct);
- repId.addValue (org.omg.CORBA.TCKind._tk_struct);
- for (Enumeration e = entry.members ().elements (); e.hasMoreElements ();)
- calcTypedefType ( (TypedefEntry) e.nextElement (), repId);
- }
- } // calcStructType
-
- private void calcUnionType (UnionEntry entry, ValueRepositoryId repId)
- {
- if (repId.isNewType (entry))
- {
- //<daz> repId.addValue (TypeCode.tk_union);
- repId.addValue (org.omg.CORBA.TCKind._tk_union);
- calcType (entry.type (), repId);
- for (Enumeration e = entry.branches ().elements (); e.hasMoreElements ();)
- calcTypedefType ( ( (UnionBranch) e.nextElement ()).typedef, repId);
- }
- } // calcUnionType
-*/
-
- /** Get the 'custom' marshaling property. */
- public boolean isCustom ()
- {
- return _custom;
- }
-
- /** Set the 'custom' marshaling property. */
- public void setCustom (boolean isCustom)
- {
- _custom = isCustom;
- }
-
- /** Return whether or not the value type can be "safely" truncated to
- its concrete parent type. */
- public boolean isSafe ()
- {
- return _isSafe;
- }
-
- private Vector _supportsNames = new Vector ();
- private Vector _supports = new Vector ();
- private Vector _initializers = new Vector ();
- private boolean _custom = false;
- private boolean _isSafe = false;
-
- static ValueGen valueGen;
-} // class ValueEntry
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ValueGen.java b/src/share/classes/com/sun/tools/corba/se/idl/ValueGen.java
deleted file mode 100644
index 0af0398..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ValueGen.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import com.sun.tools.corba.se.idl.*;
-
-public interface ValueGen extends Generator {
- void generate ( Hashtable symbolTable, ValueEntry entry, PrintWriter stream);
-} // interface ValueGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ValueRepositoryId.java b/src/share/classes/com/sun/tools/corba/se/idl/ValueRepositoryId.java
deleted file mode 100644
index 0aaeb0d..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ValueRepositoryId.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl;
-
-// NOTES:
-
-import java.security.MessageDigest;
-import java.util.Hashtable;
-
-/**
- *
- **/
-public class ValueRepositoryId
-{
- private MessageDigest sha; // Message digest used to compute SHA-1
- private int index; // Current index in the 'logical' sequence
- private Hashtable types; // Already processed types
- private String hashcode; // The computed hashcode
-
- public ValueRepositoryId ()
- {
- try
- {
- sha = MessageDigest.getInstance ("SHA-1");
- }
- catch (Exception exception)
- {}
- index = 0;
- types = new Hashtable ();
- hashcode = null;
- } // ctor
-
- /**Add a value to the hashcode being computed.
- @param value the value to be added to the value RepositoryID. */
- public void addValue (int value)
- {
- sha.update ((byte)((value >> 24) & 0x0F));
- sha.update ((byte)((value >> 16) & 0x0F));
- sha.update ((byte)((value >> 8) & 0x0F));
- sha.update ((byte)(value & 0x0F));
- index++;
- } // addValue
-
- /** Add a type to the list of types which have already been included.
- Note that the type should be added prior to its value.
- @param entry the type to be added to the value RepositoryID. */
- public void addType (SymtabEntry entry)
- {
- types.put (entry, new Integer (index));
- }
-
- /** Check to see if a specified type has already been processed. If so,
- add the appropriate 'previously processed' code (0xFFFFFFFF) and
- sequence offset, and return false; otherwise add the symbol table entry
- and current offset to the hashtable and return false.
- @param entry the type to be checked
- @return true if the symbol table entry has not been previously added;
- and false otherwise. */
- public boolean isNewType (SymtabEntry entry)
- {
- Object index = types.get (entry);
- if (index == null)
- {
- addType (entry);
- return true;
- }
- addValue (0xFFFFFFFF);
- addValue (((Integer)index).intValue ());
- return false;
- } // isNewType
-
- /** Get the hashcode computed for the value type. This method MUST not be
- called until all fields have been added, since it computes the hash
- code from the values entered for each field.
- @return the 64 bit hashcode for the value type represented as a
- 16 character hexadecimal string. */
- public String getHashcode ()
- {
- if (hashcode == null)
- {
- byte [] digest = sha.digest ();
- hashcode = hexOf (digest[0]) + hexOf (digest[1]) +
- hexOf (digest[2]) + hexOf (digest[3]) +
- hexOf (digest[4]) + hexOf (digest[5]) +
- hexOf (digest[6]) + hexOf (digest[7]);
- }
- return hashcode;
- } // getHashCode
-
- // Convert a byte to a two character hex string:
- private static String hexOf (byte value)
- {
- int d1 = (value >> 4) & 0x0F;
- int d2 = value & 0x0F;
- return "0123456789ABCDEF".substring (d1, d1 + 1) +
- "0123456789ABCDEF".substring (d2, d2 + 1);
- } // hexOf
-} // class ValueRepositoryId
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/And.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/And.java
deleted file mode 100644
index d382eb7..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/And.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class And extends BinaryExpr
-{
- protected And (Expression leftOperand, Expression rightOperand)
- {
- super ("&", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Number l = (Number)left ().evaluate ();
- Number r = (Number)right ().evaluate ();
-
- if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.and"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- else
- {
- // Arithmetic and (&)
- //daz value (new Long (l.longValue () & r.longValue ()));
- BigInteger uL = (BigInteger)coerceToTarget ((BigInteger)l);
- BigInteger uR = (BigInteger)coerceToTarget ((BigInteger)r);
- value (uL.and (uR));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.and"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class And
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/BinaryExpr.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/BinaryExpr.java
deleted file mode 100644
index 4d4206a..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/BinaryExpr.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public abstract class BinaryExpr extends Expression
-{
- public BinaryExpr (String operation, Expression leftOperand, Expression rightOperand)
- {
- _op = operation;
- _left = leftOperand;
- _right = rightOperand;
- } // ctor
-
- public void op (String op) {_op = (op == null)? "": op;}
- public String op () {return _op;}
-
- public void left (Expression left) {_left = left;}
- public Expression left () {return _left;}
-
- public void right (Expression right) {_right = right;}
- public Expression right () {return _right;}
-
- private String _op = "";
- private Expression _left = null;
- private Expression _right = null;
-} // class BinaryExpr
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanAnd.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanAnd.java
deleted file mode 100644
index 79b11f6..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanAnd.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class BooleanAnd extends BinaryExpr
-{
- protected BooleanAnd (Expression leftOperand, Expression rightOperand)
- {
- super ("&&", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Object tmpL = left ().evaluate ();
- Object tmpR = right ().evaluate ();
- Boolean l;
- Boolean r;
-
- //daz if (tmpL instanceof Number)
- // l = new Boolean (((Number)tmpL).longValue () != 0);
- // else
- // l = (Boolean)tmpL;
- if (tmpL instanceof Number)
- {
- if (tmpL instanceof BigInteger)
- l = new Boolean (((BigInteger)tmpL).compareTo (BigInteger.valueOf (0)) != 0);
- else
- l = new Boolean (((Number)tmpL).longValue () != 0);
- }
- else
- l = (Boolean)tmpL;
- //daz if (tmpR instanceof Number)
- // r = new Boolean (((Number)tmpR).longValue () != 0);
- // else
- // r = (Boolean)tmpR;
- if (tmpR instanceof Number)
- {
- if (tmpR instanceof BigInteger)
- r = new Boolean (((BigInteger)tmpR).compareTo (zero) != 0);
- else
- r = new Boolean (((Number)tmpR).longValue () != 0);
- }
- else
- r = (Boolean)tmpR;
-
- value (new Boolean (l.booleanValue () && r.booleanValue ()));
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.booleanAnd"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class BooleanAnd
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanNot.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanNot.java
deleted file mode 100644
index 5c15a44..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanNot.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class BooleanNot extends UnaryExpr
-{
- protected BooleanNot (Expression operand)
- {
- super ("!", operand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Object tmp = operand ().evaluate ();
- Boolean op;
- //daz if (tmp instanceof Number)
- // op = new Boolean (((Number)tmp).longValue () != 0);
- // else
- // op = (Boolean)tmp;
- if (tmp instanceof Number)
- {
- if (tmp instanceof BigInteger)
- op = new Boolean (((BigInteger)tmp).compareTo (zero) != 0);
- else
- op = new Boolean (((Number)tmp).longValue () != 0);
- }
- else
- op = (Boolean)tmp;
-
- value (new Boolean (!op.booleanValue ()));
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.booleanNot"), operand ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters));
- }
- return value ();
- } // evaluate
-} // class BooleanNot
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanOr.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanOr.java
deleted file mode 100644
index d225e75..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanOr.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class BooleanOr extends BinaryExpr
-{
- protected BooleanOr (Expression leftOperand, Expression rightOperand)
- {
- super ("||", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Object tmpL = left ().evaluate ();
- Object tmpR = right ().evaluate ();
- Boolean l;
- Boolean r;
-
- //daz if (tmpL instanceof Number)
- // l = new Boolean (((Number)tmpL).longValue () != 0);
- // else
- // l = (Boolean)tmpL;
- if (tmpL instanceof Number)
- {
- if (tmpL instanceof BigInteger)
- l = new Boolean (((BigInteger)tmpL).compareTo (zero) != 0);
- else
- l = new Boolean (((Number)tmpL).longValue () != 0);
- }
- else
- l = (Boolean)tmpL;
- //daz if (tmpR instanceof Number)
- // r = new Boolean (((Number)tmpR).longValue () != 0);
- // else
- // r = (Boolean)tmpR;
- if (tmpR instanceof Number)
- {
- if (tmpR instanceof BigInteger)
- r = new Boolean (((BigInteger)tmpR).compareTo (BigInteger.valueOf (0)) != 0);
- else
- r = new Boolean (((Number)tmpR).longValue () != 0);
- }
- else
- r = (Boolean)tmpR;
- value (new Boolean (l.booleanValue () || r.booleanValue ()));
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.booleanOr"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class BooleanOr
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/DefaultExprFactory.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/DefaultExprFactory.java
deleted file mode 100644
index d6984c0..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/DefaultExprFactory.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.ConstEntry;
-import java.math.BigInteger;
-
-public class DefaultExprFactory implements ExprFactory
-{
- public And and (Expression left, Expression right)
- {
- return new And (left, right);
- } // and
-
- public BooleanAnd booleanAnd (Expression left, Expression right)
- {
- return new BooleanAnd (left, right);
- } // booleanAnd
-
- public BooleanNot booleanNot (Expression operand)
- {
- return new BooleanNot (operand);
- } // booleanNot
-
- public BooleanOr booleanOr (Expression left, Expression right)
- {
- return new BooleanOr (left, right);
- } // booleanOr
-
- public Divide divide (Expression left, Expression right)
- {
- return new Divide (left, right);
- } // divide
-
- public Equal equal (Expression left, Expression right)
- {
- return new Equal (left, right);
- } // equal
-
- public GreaterEqual greaterEqual (Expression left, Expression right)
- {
- return new GreaterEqual (left, right);
- } // greaterEqual
-
- public GreaterThan greaterThan (Expression left, Expression right)
- {
- return new GreaterThan (left, right);
- } // greaterThan
-
- public LessEqual lessEqual (Expression left, Expression right)
- {
- return new LessEqual (left, right);
- } // lessEqual
-
- public LessThan lessThan (Expression left, Expression right)
- {
- return new LessThan (left, right);
- } // lessThan
-
- public Minus minus (Expression left, Expression right)
- {
- return new Minus (left, right);
- } // minus
-
- public Modulo modulo (Expression left, Expression right)
- {
- return new Modulo (left, right);
- } // modulo
-
- public Negative negative (Expression operand)
- {
- return new Negative (operand);
- } // negative
-
- public Not not (Expression operand)
- {
- return new Not (operand);
- } // not
-
- public NotEqual notEqual (Expression left, Expression right)
- {
- return new NotEqual (left, right);
- } // notEqual
-
- public Or or (Expression left, Expression right)
- {
- return new Or (left, right);
- } // or
-
- public Plus plus (Expression left, Expression right)
- {
- return new Plus (left, right);
- } // plus
-
- public Positive positive (Expression operand)
- {
- return new Positive (operand);
- } // positive
-
- public ShiftLeft shiftLeft (Expression left, Expression right)
- {
- return new ShiftLeft (left, right);
- } // shiftLeft
-
- public ShiftRight shiftRight (Expression left, Expression right)
- {
- return new ShiftRight (left, right);
- } // shiftRight
-
- public Terminal terminal (String representation, Character charValue,
- boolean isWide )
- {
- return new Terminal (representation, charValue, isWide );
- } // ctor
-
- public Terminal terminal (String representation, Boolean booleanValue)
- {
- return new Terminal (representation, booleanValue);
- } // ctor
-
- // Support long long <daz>
- public Terminal terminal (String representation, BigInteger bigIntegerValue)
- {
- return new Terminal (representation, bigIntegerValue);
- } // ctor
-
- //daz public Terminal terminal (String representation, Long longValue)
- // {
- // return new Terminal (representation, longValue);
- // } // ctor
-
- public Terminal terminal (String representation, Double doubleValue)
- {
- return new Terminal (representation, doubleValue);
- } // ctor
-
- public Terminal terminal (String stringValue, boolean isWide )
- {
- return new Terminal (stringValue, isWide);
- } // ctor
-
- public Terminal terminal (ConstEntry constReference)
- {
- return new Terminal (constReference);
- } // ctor
-
- public Times times (Expression left, Expression right)
- {
- return new Times (left, right);
- } // times
-
- public Xor xor (Expression left, Expression right)
- {
- return new Xor (left, right);
- } // xor
-} // class DefaultExprFactory
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Divide.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Divide.java
deleted file mode 100644
index ab02e96..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Divide.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-// -D52042<daz> Added protypical code for computing mixed-operand binary
-// expressions, which promotes result to Double only when the target type
-// is floating-point. Code violates spec, but may be usable at some future
-// time.
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-/**
- *
- **/
-public class Divide extends BinaryExpr
-{
- /**
- * Constructor: set operation and operands.
- **/
- protected Divide (Expression leftOperand, Expression rightOperand)
- {
- super ("/", leftOperand, rightOperand);
- } // ctor
-
- /**
- *
- **/
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Number l = (Number)left ().evaluate ();
- Number r = (Number)right ().evaluate ();
-
- boolean lIsNonInteger = l instanceof Float || l instanceof Double;
- boolean rIsNonInteger = r instanceof Float || r instanceof Double;
-
- if (lIsNonInteger && rIsNonInteger)
- value (new Double (l.doubleValue () / r.doubleValue ()));
- else if (lIsNonInteger || rIsNonInteger)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.divide"),
- left ().value ().getClass ().getName (),
- right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- else
- {
- BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r;
- value (tmpL.divide (tmpR));
- }
- // <d52042> Allow evaluation over mixed operands. Supplant code above.
- /*
- Number l = (Number)left ().evaluate ();
- Number r = (Number)right ().evaluate ();
-
- boolean lIsNonInteger = l instanceof Float || l instanceof Double;
- boolean rIsNonInteger = r instanceof Float || r instanceof Double;
-
- // Floating-point operands.
- if (lIsNonInteger && rIsNonInteger)
- {
- value (new Double (l.doubleValue () / r.doubleValue ()));
- }
- // Integral operands.
- else if (!(lIsNonInteger || rIsNonInteger))
- {
- BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r;
- value (tmpL.divide (tmpR));
- }
- // Mixed operands: one operand is floating-point, the other is integral.
- else
- {
- // Legal over floating-point types only.
- if (type ().equals ("float") ||
- type ().equals ("double"))
- {
- value (new Double (l.doubleValue () / r.doubleValue ()));
- }
- else
- {
- String[] parameters = {Util.getMessage ("EvaluationException.divide"),
- left ().value ().getClass ().getName (),
- right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- }
- */
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.divide"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class Divide
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Equal.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Equal.java
deleted file mode 100644
index c43c010..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Equal.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class Equal extends BinaryExpr
-{
- protected Equal (Expression leftOperand, Expression rightOperand)
- {
- super ("==", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Object left = left ().evaluate ();
- if (left instanceof Boolean)
- {
- Boolean l = (Boolean)left;
- Boolean r = (Boolean)right ().evaluate ();
- value (new Boolean (l.booleanValue () == r.booleanValue()));
- }
- else
- {
- Number l = (Number)left;
- Number r = (Number)right ().evaluate ();
- if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
- value (new Boolean (l.doubleValue () == r.doubleValue ()));
- else
- //daz value (new Boolean (l.longValue () == r.longValue ()));
- value (new Boolean (((BigInteger)l).equals ((BigInteger)r)));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.equal"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class Equal
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/EvaluationException.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/EvaluationException.java
deleted file mode 100644
index c04fa34..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/EvaluationException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-public class EvaluationException extends Exception
-{
- public EvaluationException (String message)
- {
- super (message);
- } // ctor
-} // class EvaluationException
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/ExprFactory.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/ExprFactory.java
deleted file mode 100644
index f017a64..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/ExprFactory.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.ConstEntry;
-import java.math.BigInteger;
-
-public interface ExprFactory
-{
- And and (Expression left, Expression right);
- BooleanAnd booleanAnd (Expression left, Expression right);
- BooleanNot booleanNot (Expression operand);
- BooleanOr booleanOr (Expression left, Expression right);
- Divide divide (Expression left, Expression right);
- Equal equal (Expression left, Expression right);
- GreaterEqual greaterEqual (Expression left, Expression right);
- GreaterThan greaterThan (Expression left, Expression right);
- LessEqual lessEqual (Expression left, Expression right);
- LessThan lessThan (Expression left, Expression right);
- Minus minus (Expression left, Expression right);
- Modulo modulo (Expression left, Expression right);
- Negative negative (Expression operand);
- Not not (Expression operand);
- NotEqual notEqual (Expression left, Expression right);
- Or or (Expression left, Expression right);
- Plus plus (Expression left, Expression right);
- Positive positive (Expression operand);
- ShiftLeft shiftLeft (Expression left, Expression right);
- ShiftRight shiftRight (Expression left, Expression right);
- Terminal terminal (String representation, Character charValue,
- boolean isWide );
- Terminal terminal (String representation, Boolean booleanValue);
- //daz Terminal terminal (String representation, Long longValue);
- Terminal terminal (String representation, Double doubleValue);
- Terminal terminal (String representation, BigInteger bigIntegerValue);
- Terminal terminal (String stringValue, boolean isWide );
- Terminal terminal (ConstEntry constReference);
- Times times (Expression left, Expression right);
- Xor xor (Expression left, Expression right);
-} // interface ExprFactory
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Expression.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Expression.java
deleted file mode 100644
index 84a1873..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Expression.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import java.math.BigInteger;
-
-public abstract class Expression
-{
- /**
- * Compute the value of this expression.
- **/
- public abstract Object evaluate () throws EvaluationException;
-
- /**
- * Set the value of this expression.
- **/
- public void value (Object value)
- {
- _value = value;
- }
- /**
- * Get the value of this expression.
- **/
- public Object value ()
- {
- return _value;
- }
-
- /**
- * Set the representation of this expression.
- **/
- public void rep (String rep)
- {
- _rep = rep;
- }
- /**
- * Get the representation of this expression.
- **/
- public String rep ()
- {
- return _rep;
- }
-
- /**
- * Set the target type of this expression.
- **/
- public void type (String type)
- {
- _type = type;
- }
- /**
- * Get the target type of this expression.
- **/
- public String type ()
- {
- return _type;
- }
-
- /**
- * Return the default computation type for the given target type.
- **/
- protected static String defaultType (String targetType)
- {
- return (targetType == null) ? new String ("") : targetType;
- } // defaultType
-
- // BigInteger is a multi-precision number whose representation contains
- // a signum (sign-number = 1, -1) and a magnitude. To support "long long",
- // all integer expressions are now performed over BigInteger and stored as
- // such. During the evaluation of an integer expression, the signum of its
- // value may toggle, which may cause the value of an expression to conflict
- // with its target type: [Case 1] If the resulting value is negative
- // (signum=-1) and the target type is unsigned; or [Case 2] if the resulting
- // value is positive (signum=1) and greater than 2**(target-type-length - 1),
- // and the target type is signed, then the resulting value will be out of
- // range. However, this value is correct and must be coerced to the target
- // type. E.G., After appying "not" to a BigInteger, the result is
- // a BigInteger that represents its 2's-complement (~5 => -6 in a byte-space).
- // In this example, the signum toggles and the magnatude is 6. If the target
- // type of this value were unsigned short, it must be coerced to a positive
- // number whose bits truly represent -6 in 2's-complement (250 in a byte-space).
- //
- // Also, floating types may now be intialized with any integer expression.
- // The result must be coerced to Double.
- //
- // Use the following routines to coerce this expression's value to its
- // "target" type.
-
- /**
- * Coerces a number to the target type of this expression.
- * @param obj The number to coerce.
- * @return the value of number coerced to the (target) type of
- * this expression.
- **/
- public Object coerceToTarget (Object obj)
- {
- if (obj instanceof BigInteger)
- {
- if (type ().indexOf ("unsigned") >= 0)
- return toUnsignedTarget ((BigInteger)obj);
- else
- return toSignedTarget ((BigInteger)obj);
- }
- return obj;
- } // coerceToTarget
-
- /**
- * Coerces an integral value (BigInteger) to its corresponding unsigned
- * representation, if the target type of this expression is unsigned.
- * @param b The BigInteger to be coerced.
- * @return the value of an integral type coerced to its corresponding
- * unsigned integral type, if the target type of this expression is
- * unsigned.
- **/
- protected BigInteger toUnsignedTarget (BigInteger b)
- {
- if (type ().equals ("unsigned short")) // target type of this expression
- {
- if (b != null && b.compareTo (zero) < 0) // error if value < min = -(2**(l-1)).
- return b.add (twoPow16);
- }
- else if (type ().equals ("unsigned long"))
- {
- if (b != null && b.compareTo (zero) < 0)
- return b.add (twoPow32);
- }
- else if (type ().equals ("unsigned long long"))
- {
- if (b != null && b.compareTo (zero) < 0)
- return b.add (twoPow64);
- }
- return b;
- } // toUnsignedTarget
-
- /**
- * Coerces an integral value (BigInteger) to its corresponding signed
- * representation, if the target type of this expression is signed.
- * @param b The BigInteger to be coerced.
- * @return the value of an integral type coerced to its corresponding
- * signed integral type, if the target type of this expression is
- * signed.
- **/
- protected BigInteger toSignedTarget (BigInteger b)
- {
- if (type ().equals ("short"))
- {
- if (b != null && b.compareTo (sMax) > 0)
- return b.subtract (twoPow16);
- }
- else if (type ().equals ("long"))
- {
- if (b != null && b.compareTo (lMax) > 0)
- return b.subtract (twoPow32);
- }
- else if (type ().equals ("long long"))
- {
- if (b != null && b.compareTo (llMax) > 0)
- return b.subtract (twoPow64);
- }
- return b;
- } // toSignedTarget
-
- /**
- * Return the unsigned value of a BigInteger.
- **/
- protected BigInteger toUnsigned (BigInteger b)
- {
- if (b != null && b.signum () == -1)
- if (type ().equals ("short"))
- return b.add (twoPow16);
- else if (type ().equals ("long"))
- return b.add (twoPow32);
- else if (type ().equals ("long long"))
- return b.add (twoPow64);
- return b;
- }
-
- // Integral-type boundaries.
-
- public static final BigInteger negOne = BigInteger.valueOf (-1);
- public static final BigInteger zero = BigInteger.valueOf (0);
- public static final BigInteger one = BigInteger.valueOf (1);
- public static final BigInteger two = BigInteger.valueOf (2);
-
- public static final BigInteger twoPow15 = two.pow (15);
- public static final BigInteger twoPow16 = two.pow (16);
- public static final BigInteger twoPow31 = two.pow (31);
- public static final BigInteger twoPow32 = two.pow (32);
- public static final BigInteger twoPow63 = two.pow (63);
- public static final BigInteger twoPow64 = two.pow (64);
-
- public static final BigInteger sMax = BigInteger.valueOf (Short.MAX_VALUE);
- public static final BigInteger sMin = BigInteger.valueOf (Short.MAX_VALUE);
-
- public static final BigInteger usMax = sMax.multiply (two).add (one);
- public static final BigInteger usMin = zero;
-
- public static final BigInteger lMax = BigInteger.valueOf (Integer.MAX_VALUE);
- public static final BigInteger lMin = BigInteger.valueOf (Integer.MAX_VALUE);
-
- public static final BigInteger ulMax = lMax.multiply (two).add (one);
- public static final BigInteger ulMin = zero;
-
- public static final BigInteger llMax = BigInteger.valueOf (Long.MAX_VALUE);
- public static final BigInteger llMin = BigInteger.valueOf (Long.MIN_VALUE);
-
- public static final BigInteger ullMax = llMax.multiply (two).add (one);
- public static final BigInteger ullMin = zero;
-
- /**
- * Value of this expression: Boolean, Char, Byte, BigInteger, Double,
- * String, Expression, ConstEntry.
- **/
- private Object _value = null;
- /**
- * String representation of this expression.
- **/
- private String _rep = null;
- /**
- * Computation type of this (sub)expression = Target type for now.
- **/
- private String _type = null;
-} // abstract class Expression
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterEqual.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterEqual.java
deleted file mode 100644
index 729eb6d..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterEqual.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class GreaterEqual extends BinaryExpr
-{
- protected GreaterEqual (Expression leftOperand, Expression rightOperand)
- {
- super (">=", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Object left = left ().evaluate ();
- Object right = right ().evaluate ();
- if (left instanceof Boolean)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.greaterEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- else
- {
- Number l = (Number)left;
- Number r = (Number)right ().evaluate ();
- if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
- value (new Boolean (l.doubleValue () >= r.doubleValue ()));
- else
- //daz value (new Boolean (l.longValue () >= r.longValue ()));
- value (new Boolean ( ((BigInteger)l).compareTo ((BigInteger)r) >= 0));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.greaterEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class GreaterEqual
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterThan.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterThan.java
deleted file mode 100644
index bcc2b19..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterThan.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class GreaterThan extends BinaryExpr
-{
- protected GreaterThan (Expression leftOperand, Expression rightOperand)
- {
- super (">", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Object left = left ().evaluate ();
- Object right = right ().evaluate ();
- if (left instanceof Boolean)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.greaterThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- else
- {
- Number l = (Number)left;
- Number r = (Number)right ().evaluate ();
- if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
- value (new Boolean (l.doubleValue () > r.doubleValue ()));
- else
- //daz value (new Boolean (l.longValue () > r.longValue ()));
- value (new Boolean ( ((BigInteger)l).compareTo ((BigInteger)r) > 0));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.greaterThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class GreaterThan
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/LessEqual.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/LessEqual.java
deleted file mode 100644
index 6d4f305..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/LessEqual.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class LessEqual extends BinaryExpr
-{
- protected LessEqual (Expression leftOperand, Expression rightOperand)
- {
- super ("<=", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Object left = left ().evaluate ();
- Object right = right ().evaluate ();
- if (left instanceof Boolean)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.lessEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- else
- {
- Number l = (Number)left;
- Number r = (Number)right ().evaluate ();
- if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
- value (new Boolean (l.doubleValue () <= r.doubleValue ()));
- else
- //daz value (new Boolean (l.longValue () <= r.longValue ()));
- value (new Boolean ( ((BigInteger)l).compareTo ((BigInteger)r) <= 0));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.lessEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class LessEqual
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/LessThan.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/LessThan.java
deleted file mode 100644
index 40eed04..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/LessThan.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class LessThan extends BinaryExpr
-{
- protected LessThan (Expression leftOperand, Expression rightOperand)
- {
- super ("<", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Object left = left ().evaluate ();
- Object right = right ().evaluate ();
- if (left instanceof Boolean)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.lessThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- else
- {
- Number l = (Number)left;
- Number r = (Number)right ().evaluate ();
- if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
- value (new Boolean (l.doubleValue () < r.doubleValue ()));
- else
- //daz value (new Boolean (l.longValue () < r.longValue ()));
- value (new Boolean (((BigInteger)l).compareTo ((BigInteger)r) < 0));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.lessThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class LessThan
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Minus.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Minus.java
deleted file mode 100644
index 6c5af1a..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Minus.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class Minus extends BinaryExpr
-{
- protected Minus (Expression leftOperand, Expression rightOperand)
- {
- super ("-", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Number l = (Number)left ().evaluate ();
- Number r = (Number)right ().evaluate ();
-
- boolean lIsNonInteger = l instanceof Float || l instanceof Double;
- boolean rIsNonInteger = r instanceof Float || r instanceof Double;
-
- if (lIsNonInteger && rIsNonInteger)
- value (new Double (l.doubleValue () - r.doubleValue ()));
- else if (lIsNonInteger || rIsNonInteger)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.minus"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- else
- {
- // Subtraction (-)
- BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r;
- value (tmpL.subtract (tmpR));
- //daz value (new Long (l.longValue () - r.longValue ()));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.minus"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class Minus
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Modulo.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Modulo.java
deleted file mode 100644
index 53b2eef..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Modulo.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class Modulo extends BinaryExpr
-{
- protected Modulo (Expression leftOperand, Expression rightOperand)
- {
- super ("%", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Number l = (Number)left ().evaluate ();
- Number r = (Number)right ().evaluate ();
-
- if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.mod"), left().value ().getClass ().getName (), right().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- else
- {
- // Modulo (%)
- BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r;
- value (tmpL.remainder (tmpR));
- //daz value (tmpL.mod (tmpR)); Requires positive modulus; not required by IDL.
- //daz value (new Long (l.longValue () % r.longValue ()));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.mod"), left().value ().getClass ().getName (), right().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class Modulo
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Negative.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Negative.java
deleted file mode 100644
index 1cc9491..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Negative.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class Negative extends UnaryExpr
-{
- protected Negative (Expression operand)
- {
- super ("-", operand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Number op = (Number)operand ().evaluate ();
-
- if (op instanceof Float || op instanceof Double)
- value (new Double (-op.doubleValue ()));
- else
- {
- // Multiply by -1
- //daz value (new Long (-op.longValue ()));
- BigInteger tmpOp = (BigInteger)op;
- value (tmpOp.multiply (BigInteger.valueOf (-1)));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.neg"), operand ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters));
- }
- return value ();
- } // evaluate
-} // class Negative
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Not.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Not.java
deleted file mode 100644
index 007b1e1..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Not.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class Not extends UnaryExpr
-{
- protected Not (Expression operand)
- {
- super ("~", operand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Number op = (Number)operand ().evaluate ();
-
- if (op instanceof Float || op instanceof Double)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.not"), operand ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters));
- }
- else
- {
- // Complement (~)
- //daz value (new Long (~op.longValue ()));
- BigInteger b = (BigInteger)coerceToTarget((BigInteger)op);
-
- // Compute according to CORBA 2.1 specifications for specified type.
- if (type ().equals ("short") || type ().equals ("long") || type ().equals ("long long"))
- value (b.add (one).multiply (negOne));
- else if (type ().equals("unsigned short"))
- // "short" not CORBA compliant, but necessary for logical operations--size matters!
- value (twoPow16.subtract (one).subtract (b));
- else if (type ().equals ("unsigned long"))
- value (twoPow32.subtract (one).subtract (b));
- else if (type ().equals ("unsigned long long"))
- value (twoPow64.subtract (one).subtract (b));
- else
- value (b.not ()); // Should never execute...
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.not"), operand ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters));
- }
- return value ();
- } // evaluate
-} // class Not
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/NotEqual.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/NotEqual.java
deleted file mode 100644
index 5ce0d68..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/NotEqual.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class NotEqual extends BinaryExpr
-{
- protected NotEqual (Expression leftOperand, Expression rightOperand)
- {
- super ("!=", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Object left = left ().evaluate ();
- if (left instanceof Boolean)
- {
- Boolean l = (Boolean)left;
- Boolean r = (Boolean)right ().evaluate ();
- value (new Boolean (l.booleanValue () != r.booleanValue()));
- }
- else
- {
- Number l = (Number)left;
- Number r = (Number)right ().evaluate ();
-
- if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
- value (new Boolean (l.doubleValue () != r.doubleValue ()));
- else
- //daz value (new Boolean (l.longValue () != r.longValue ()));
- value (new Boolean (!((BigInteger)l).equals ((BigInteger)r)));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.notEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class NotEqual
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Or.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Or.java
deleted file mode 100644
index b5906b1..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Or.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class Or extends BinaryExpr
-{
- protected Or (Expression leftOperand, Expression rightOperand)
- {
- super ("|", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Number l = (Number)left ().evaluate ();
- Number r = (Number)right ().evaluate ();
-
- if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.or"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- else
- {
- // or
- //daz value (new Long (l.longValue () | r.longValue ()));
- BigInteger uL = (BigInteger)toUnsigned((BigInteger)l);
- BigInteger uR = (BigInteger)toUnsigned((BigInteger)r);
- value((BigInteger)coerceToTarget(uL.or (uR)));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.or"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class Or
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Plus.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Plus.java
deleted file mode 100644
index d936501..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Plus.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class Plus extends BinaryExpr
-{
- protected Plus (Expression leftOperand, Expression rightOperand)
- {
- super ("+", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Number l = (Number)left ().evaluate ();
- Number r = (Number)right ().evaluate ();
-
- boolean lIsNonInteger = l instanceof Float || l instanceof Double;
- boolean rIsNonInteger = r instanceof Float || r instanceof Double;
-
- if (lIsNonInteger && rIsNonInteger)
- value (new Double (l.doubleValue () + r.doubleValue ()));
- else if (lIsNonInteger || rIsNonInteger)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.plus"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- else
- {
- // Addition (+)
- BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r;
- value (tmpL.add (tmpR));
- //daz value (new Long (l.longValue () + r.longValue ()));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.plus"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class Plus
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Positive.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Positive.java
deleted file mode 100644
index dbc822b..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Positive.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class Positive extends UnaryExpr
-{
- protected Positive (Expression operand)
- {
- super ("+", operand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Number op = (Number)operand ().evaluate ();
-
- if (op instanceof Float || op instanceof Double)
- value (new Double (+op.doubleValue ()));
- else
- {
- // Multiply by sign
- //daz value (new Long (+op.longValue ()));
- value (((BigInteger)op).multiply (BigInteger.valueOf (((BigInteger)op).signum ())));
- //promote ();
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.pos"), operand ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters));
- }
- return value ();
- } // evaluate
-} // class Positive
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftLeft.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftLeft.java
deleted file mode 100644
index 8ebb7dd..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftLeft.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class ShiftLeft extends BinaryExpr
-{
- protected ShiftLeft (Expression leftOperand, Expression rightOperand)
- {
- super ("<<", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Number l = (Number)left ().evaluate ();
- Number r = (Number)right ().evaluate ();
-
- if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.left"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- else
- {
- // Shift left (<<)
- //daz value (new Long (l.longValue () << r.longValue ()));
- BigInteger bL = (BigInteger)coerceToTarget (l);
- BigInteger bR = (BigInteger)r;
-
- BigInteger ls = bL.shiftLeft (bR.intValue ());
-
- if (type ().indexOf ("short") >= 0)
- ls = ls.mod (twoPow16);
- else if (type ().indexOf ("long") >= 0)
- ls = ls.mod (twoPow32);
- else if (type ().indexOf ("long long") >= 0)
- ls = ls.mod (twoPow64);
-
- value (coerceToTarget (ls));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.left"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class ShiftLeft
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftRight.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftRight.java
deleted file mode 100644
index f832738..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftRight.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class ShiftRight extends BinaryExpr
-{
- protected ShiftRight (Expression leftOperand, Expression rightOperand)
- {
- super (">>", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Number l = (Number)left ().evaluate ();
- Number r = (Number)right ().evaluate ();
-
- if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.right"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- else
- {
- // Shift right (>>)
- //daz value (new Long (l.longValue () >> r.longValue ()));
- BigInteger bL = (BigInteger)coerceToTarget ((BigInteger)l);
- BigInteger bR = (BigInteger)r;
-
- // Change signed to unsigned (Clear sign bit--can be done when setting bL!)
- if (bL.signum () == -1)
- if (type ().equals ("short"))
- bL = bL.add (twoPow16);
- else if (type ().equals ("long"))
- bL = bL.add (twoPow32);
- else if (type ().equals ("long long"))
- bL = bL.add (twoPow64);
-
- value (bL.shiftRight (bR.intValue ()));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.right"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class ShiftRight
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Terminal.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Terminal.java
deleted file mode 100644
index 71c9f29..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Terminal.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.ConstEntry;
-import java.math.BigInteger;
-
-/**
- * This class contains values. Objects of this class are the terminal
- * nodes of an expression tree.
- * <b>
- * Note that there is a constructor for Double values, but not Float.
- * CORBA defines that all floating point expressions are evaluated as
- * double, and that the result is coerced back to float if necessary.
- * <b>
- * Note also that there is a constructor for long values, but not for
- * int or short. CORBA defines that all integral expressions are evaluated
- * as unsigned long. A CORBA long is a Java int. There is no unsigned int
- * in Java, so the next larger type, long, is used.
- **/
-public class Terminal extends Expression
-{
- protected Terminal (String representation, Character charValue,
- boolean isWide)
- {
- rep (representation);
- value (charValue);
- if (isWide)
- type( "wchar" ) ;
- else
- type( "char" ) ;
- } // ctor
-
- protected Terminal (String representation, Boolean booleanValue)
- {
- rep (representation);
- value (booleanValue);
- } // ctor
-
- // Support long long <daz>
- protected Terminal (String representation, BigInteger bigIntegerValue)
- {
- rep (representation);
- value (bigIntegerValue);
- } // ctor
-
- protected Terminal (String representation, Long longValue)
- {
- long lv = longValue.longValue ();
- rep (representation);
- if (lv > Integer.MAX_VALUE || lv < Integer.MIN_VALUE)
- value (longValue);
- else
- value (new Integer (longValue.intValue ()));
- } // ctor
-
- protected Terminal (String representation, Double doubleValue)
- {
- rep (representation);
- value (doubleValue);
- } // ctor
-
- protected Terminal (String stringValue, boolean isWide )
- {
- rep (stringValue);
- value (stringValue);
- if (isWide)
- type( "wstring" ) ;
- else
- type( "string" ) ;
- } // ctor
-
- protected Terminal (ConstEntry constReference)
- {
- rep (constReference.fullName ());
- value (constReference);
- } // ctor
-
- ///// INSTANCE METHODS
- public Object evaluate () throws EvaluationException
- {
- if (value () instanceof ConstEntry)
- return ((ConstEntry)value ()).value ().evaluate ();
- else
- return value ();
- } // evaluate
-} // class Terminal
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Times.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Times.java
deleted file mode 100644
index 77c4ce8..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Times.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class Times extends BinaryExpr
-{
- protected Times (Expression leftOperand, Expression rightOperand)
- {
- super ("*", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Number l = (Number)left ().evaluate ();
- Number r = (Number)right ().evaluate ();
-
- boolean lIsNonInteger = l instanceof Float || l instanceof Double;
- boolean rIsNonInteger = r instanceof Float || r instanceof Double;
-
- if (lIsNonInteger && rIsNonInteger)
- value (new Double (l.doubleValue () * r.doubleValue ()));
- else if (lIsNonInteger || rIsNonInteger)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.times"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- else
- {
- // Multiplication (*)
- BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r;
- value (tmpL.multiply (tmpR));
- //daz value (new Long (l.longValue () * r.longValue ()));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.times"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class Times
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/UnaryExpr.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/UnaryExpr.java
deleted file mode 100644
index 06fdc6c..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/UnaryExpr.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public abstract class UnaryExpr extends Expression
-{
- public UnaryExpr (String operation, Expression unaryOperand)
- {
- _op = operation;
- _operand = unaryOperand;
- } // ctor
-
- public void op (String op) {_op = (op == null)? "": op;}
- public String op () {return _op;}
-
- public void operand (Expression operand) {_operand = operand;}
- public Expression operand () {return _operand;}
-
- private String _op = "";
- private Expression _operand = null;
-} // class UnaryExpr
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Xor.java b/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Xor.java
deleted file mode 100644
index 6cb4913..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/constExpr/Xor.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.constExpr;
-
-// NOTES:
-
-import com.sun.tools.corba.se.idl.Util;
-import java.math.BigInteger;
-
-public class Xor extends BinaryExpr
-{
- protected Xor (Expression leftOperand, Expression rightOperand)
- {
- super ("^", leftOperand, rightOperand);
- } // ctor
-
- public Object evaluate () throws EvaluationException
- {
- try
- {
- Number l = (Number)left ().evaluate ();
- Number r = (Number)right ().evaluate ();
-
- if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.xor"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- else
- {
- // Xor (^)
- //daz value (new Long (l.longValue () ^ r.longValue ()));
- //BigInteger uL = (BigInteger)toUnsigned((BigInteger)l);
- //BigInteger uR = (BigInteger)toUnsigned((BigInteger)r);
- //value (coerceToTarget(uL.xor (uR)));
- BigInteger uL = (BigInteger)coerceToTarget((BigInteger)l);
- BigInteger uR = (BigInteger)coerceToTarget((BigInteger)r);
- value (uL.xor (uR));
- }
- }
- catch (ClassCastException e)
- {
- String[] parameters = {Util.getMessage ("EvaluationException.xor"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
- throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
- }
- return value ();
- } // evaluate
-} // class Xor
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/first.set b/src/share/classes/com/sun/tools/corba/se/idl/first.set
deleted file mode 100644
index ff7f966..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/first.set
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * 5639-D57, (C) COPYRIGHT International Business Machines Corp., 1997, 1998
- *
- */
-
-CORBA IDL
----------------
-
-<specification> typedef, struct, union, enum, const, exception, interface, module
-
-<specification'> <FOLLOW>, typedef, struct, union, enum, const, exception, interface, module
-
-<definition> typedef, struct, union, enum, const, exception, interface, module
-
-<module> module
-
-<module'> typedef, struct, union, enum, const, exception, interface, module
-
-<module''> typedef, struct, union, enum, const, exception, interface, module, <FOLLOW>
-
-<interface> interface
-
-<interface'> <FOLLOW>, :, {
-
-<interface_dcl> :, {
-
-<interface_body> typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state
-
-<interface_body'> <FOLLOW>, typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state
-
-<export> typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state
-
-<state_def> state
-
-<state_def'> private, protected, public, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum, <FOLLOW>
-
-<state_member> private, protected, public, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
-
-<state_modifier> private, protected, public
-
-<inheritance_spec> :
-
-<inheritance_spec'> <FOLLOW>, ","
-
-<scoped_name> id, ::
-
-<scoped_name'> <FOLLOW>, ::
-
-<const_dcl> const
-
-<const_type> long, short, unsigned, char, boolean, float, double, string, id, ::
-
-<const_exp> -, +, ~, id, ::, literal, (
-
-<or_expr> -, +, ~, id, ::, literal, (
-
-<or_expr'> <FOLLOW>, |
-
-<xor_expr> -, +, ~, id, ::, literal, (
-
-<xor_expr'> <FOLLOW>, ^
-
-<and_expr> -, +, ~, id, ::, literal, (
-
-<and_expr'> <FOLLOW>, &
-
-<shift_expr> -, +, ~, id, ::, literal, (
-
-<shift_expr'> <FOLLOW>, >>, <<
-
-<add_expr> -, +, ~, id, ::, literal, (
-
-<add_expr'> <FOLLOW>, +, -
-
-<mult_expr> -, +, ~, id, ::, literal, (
-
-<mult_expr'> <FOLLOW>, *, /, %
-
-<unary_expr> -, +, ~, id, ::, literal, (
-
-<unary_operator> -, +, ~
-
-<primary_expr> id, ::, literal, (
-
-<literal> literals
-
-<positive_int_const> -, +, ~, id, ::, literal, (
-
-<type_dcl> typedef, struct, union, enum
-
-<type_declarator> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
-
-<type_spec> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
-
-<simple_type_spec> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::
-
-<base_type_spec> float, double, long, short, unsigned, char, boolean, octet, any
-
-<template_type_spec> sequence, string
-
-<constr_type_spec> struct, union, enum
-
-<declarators> id
-
-<declarators'> <FOLLOW>, ","
-
-<declarator> id
-
-<declarator'> <FOLLOW>, [
-
-<floating_pt_type> float, double
-
-<integer_type> long, short, unsigned
-
-<signed_int> long, short
-
-<unsigned_int> unsigned
-
-<char_type> char
-
-<boolean_type> boolean
-
-<octet_type> octet
-
-<any_type> any
-
-<struct_type> struct
-
-<member_list> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
-
-<member_list'> <FOLLOW>, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
-
-<member> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
-
-<union_type> union
-
-<switch_type_spec> long, short, unsigned, char, boolean, enum, id, ::
-
-<switch_body> case, default
-
-<switch_body'> <FOLLOW>, case, default
-
-<case> case, default
-
-<case'> <FOLLOW>, case, default
-
-<case_label> case, default
-
-<element_spec> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
-
-<enum_type> enum
-
-<enum_type'> <FOLLOW>, ","
-
-<sequence_type> sequence
-
-<sequence_type'> ",", >
-
-<string_type> string
-
-<string_type'> <FOLLOW>, <
-
-<fixed_array_size> [
-
-<attr_dcl> readonly, attribute
-
-<attr_dcl'> <FOLLOW>, ","
-
-<except_dcl> exception
-
-<except_dcl'> <FOLLOW>, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
-
-<op_dcl> oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void
-
-<op_dcl'> id, macroID
-
-<op_dcl''> <FOLLOW>, raises, context, ;
-
-<op_dcl'''> <FOLLOW>, context
-
-<op_attribute> oneway
-
-<op_type_spec> float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void
-
-<parameter_dcls> (
-
-<parameter_dcls'> in, out, inout, )
-
-<parameter_dcls''> <FOLLOW>, ","
-
-<param_dcl> in, out, inout
-
-<param_attribute> in, out, inout
-
-<raises_expr> raises
-
-<raises_expr'> <FOLLOW>, ","
-
-<context_expr> context
-
-<context_expr'> <FOLLOW>, ","
-
-<param_type_spec> float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::
-
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/follow.set b/src/share/classes/com/sun/tools/corba/se/idl/follow.set
deleted file mode 100644
index bdd1d57..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/follow.set
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * 5639-D57, (C) COPYRIGHT International Business Machines Corp., 1997, 1998
- *
- */
-
-CORBA IDL
------------------
-
-<specification> EOF
-
-<specification'> EOF
-
-<definition> EOF, typedef, struct, union, enum, const, exception, interface, module, }
-
-<module> ;
-
-<module'> }
-
-<module''> }
-
-<interface> ;
-
-<interface'> ;
-
-<interface_dcl> ;
-
-<interface_body> }
-
-<interface_body'> }
-
-<export> typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state, }
-
-<state_def> typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state, }
-
-<state_def'> }
-
-<state_member> private, protected, public, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum, }
-
-<state_modifier> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
-
-<inheritance_spec> {
-
-<inheritance_spec'> {
-
-<scoped_name> ",", {, id, ::, literal, (, >, ), macroID
-
-<scoped_name'> ",", {, id, ::, literal, (, >, ), macroID
-
-<const_dcl> ;
-
-<const_type> id
-
-<const_exp> ;, ), >, ], :
-
-<or_expr> ;, ), >, ], :
-
-<or_expr'> ;, ), >, ], :
-
-<xor_expr> |, ;, ), >, ], :
-
-<xor_expr'> | ;, ), >, ], :
-
-<and_expr> ^, |, ;, ), >, ], :
-
-<and_expr'> ^, |, ;, ), >, ], :
-
-<shift_expr> &, ^, |, ;, ), >, ], :
-
-<shift_expr'> &, ^, |, ;, ), >, ], :
-
-<add_expr> >>, <<, &, ^, |, ;, ), >, ], :
-
-<add_expr'> >>, <<, &, ^, |, ;, ), >, ], :
-
-<mult_expr> >>, <<, &, ^, |, ;, ), >, ], :
-
-<mult_expr'> +, -, >>, <<, &, ^, |, ;, ), >, ], :
-
-<unary_expr> *, /, %, +, -, >>, <<, &, ^, |, ;, ), >, ], :
-
-<unary_operator> id, ::, literal, (
-
-<primary_expr> *, /, %, +, -, >>, <<, &, ^, |, ;, ), >, ], :
-
-<literal> *, /, %, +, -, >>, <<, &, ^, |, ;, ), >, ], : (and , for string literal in <context_expr>)
-
-<positive_int_const> >, ]
-
-<type_dcl> ;
-
-<type_declarator> ;
-
-<type_spec> id
-
-<simple_type_spec> id, ",", >
-
-<base_type_spec> id, ",", >, macroID
-
-<template_type_spec> id, ",", >
-
-<constr_type_spec> id
-
-<declarators> ;
-
-<declarators'> ;
-
-<declarator> ",", ;
-
-<declarator'> ",", ;
-
-<floating_pt_type> id, ",", >, macroID
-
-<integer_type> id, ",", >, macroID, )
-
-<signed_int> id, ",", >, macroID, )
-
-<unsigned_int> id, ",", >, macroID, )
-
-<char_type> id, ",", >, macroID, )
-
-<boolean_type> id, ",", >, macroID, )
-
-<octet_type> id, ",", >, macroID
-
-<any_type> id, ",", >, macroID
-
-<struct_type> ;, id
-
-<member_list> }
-
-<member_list'> }
-
-<member> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum, }
-
-<union_type> ;, id
-
-<switch_type_spec> )
-
-<switch_body> }
-
-<switch_body'> }
-
-<case> case, default, }
-
-<case'> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
-
-<case_label> case, default, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
-
-<element_spec> ;
-
-<enum_type> ;, id, )
-
-<enum_type'> }
-
-<sequence_type> id, ",", >
-
-<sequence_type'> id, ",", >
-
-<string_type> id, ",", >, macroID
-
-<string_type'> id, ",", >, macroID
-
-<fixed_array_size> [, ",", ;
-
-<attr_dcl> ;
-
-<attr_dcl'> ;
-
-<except_dcl> ;
-
-<except_dcl'> }
-
-<op_dcl> ;
-
-<op_dcl'> ;
-
-<op_dcl''> ;
-
-<op_dcl'''> ;
-
-<op_attribute> float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void
-
-<op_type_spec> id, macroID
-
-<parameter_dcls> raises, context, ;
-
-<parameter_dcls'> raises, context, ;
-
-<parameter_dcls''> )
-
-<param_dcl> , )
-
-<param_attribute> float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::
-
-<raises_expr> context, ;
-
-<raises_expr'> )
-
-<context_expr> ;
-
-<context_expr'> )
-
-<param_type_spec> id, macroID
-
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/grammar.idl b/src/share/classes/com/sun/tools/corba/se/idl/grammar.idl
deleted file mode 100644
index 3848083..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/grammar.idl
+++ /dev/null
@@ -1,422 +0,0 @@
-/*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * 5639-D57, (C) COPYRIGHT International Business Machines Corp., 1997, 1998
- *
- */
-
-CORBA 2.3 IDL
----------------
-
-(1) <specification> <definition><specification'>
-
-(1) <specification'> e
- <definition><specification'>
-
-(2) <definition> <type_dcl> ";"
- <const_dcl> ";"
- <except_dcl> ";"
- <interface> ";"
- <module> ";"
- <value> ";"
-
-(3) <module> "module" <id> "{" <module'> "}"
-
-(3) <module'> <definition><module''>
-
-(3) <module''> <definition><module''>
- e
-
-(4) <interface> <interface_dcl>
- <forward_dcl>
-
-(5) <interface_dcl> <interface_header> "{" <interface_body> "}"
-
-(6) <forward_dcl> "abstract" "interface" <id>
- "interface" <id>
-
-(7) <interface_header> "abstract" "interface" <id> <interface_header'>
- "interface" <id> <interface_header'>
-
-(7) <interface_header'> e
- <interface_inheritance_spec>
-
-(8) <interface_body> <export><interface_body'>
-
-(8) <interface_body'> e
- <export><interface_body'>
-
-(9) <export> <type_dcl> ";"
- <const_dcl> ";"
- <except_dcl> ";"
- <attr_dcl> ";"
- <op_dcl> ";"
-
-
-
-(10) <interface_inheritance_spec> ":" <scoped_name> <inheritance_spec'>
-
-(10) <interface_inheritance_spec'> e
- "," <scoped_name> <inheritance_spec'>
-
-(12) <scoped_name> <id> <scoped_name'>
- "::" <id> <scoped_name'>
-
-(12) <scoped_name'> e
- "::" <id> <scoped_name'>
-
-(13) <value> <value_dcl>
- <value_abs_dcl>
- <value_box_dcl>
- <value_forward_dcl>
-
-(14) <value_forward_dcl> "abstract" "valuetype" <id>
- "valuetype" <id>
-
-(15) <value_box_dcl> "valuetype" <id> <type_spec>
-
-(16) <value_abs_dcl> "abstract" "valuetype" <id> <value_inheritance_spec> "{" <export> <vad> "}"
- "abstract" "valuetype" <id> "{" <export> <vad> "}"
-
-(16) <vad> e
- <export> <vad>
-
-(17) <value_dcl> <value_header> "{" <value_element> <ve> "}"
-
-(17) <ve> e
- <value_element> <ve>
-
-(18) <value_header> "custom" "valuetype" <id> <value_inheritance_spec>
- "valuetype" <id> <value_inheritance_spec>
- "custom" "valuetype" <id>
- "valuetype" <id>
-
-(19) <value_inheritance_spec> <opt_inherits> <opt_supports>
-
-(19) <opt_inherits> e
- ":" "truncatable" <value_name> <value_name_list>
- ":" <value_name> <value_name_list>
-
-(19) <value_name_list> e
- "," <value_name> <value_name_list>
-
-(19) <opt_supports> e
- "supports" <interface_name> <interface_name_list>
-
-(19) <interface_name_list> e
- "," <interface_name> <interface_name_list>
-
-(20) <value_name> <scoped_name>
-
-(21) <value_element> <export>
- <state_member>
- <init_dcl>
-
-(22) <state_member> "public" <type_spec> <declarators> ";"
- "private" <type_spec> <declarators> ";"
-
-(23) <init_dcl> "factory" <id> "(" ")"
- "factory" <id> "(" <init_param_dcls> ")"
-
-(24) <init_param_dcls> <init_param_decl>
- <init_param_decl> "," <init_param_dcls>
-
-(25) <init_param_dcl> <init_param_attribute> <param_type_spec> <simple_declarator>
-
-(26) <init_param_attribute> "in"
-
-(27) <const_dcl> "const" <const_type> <id> "=" <const_exp>
-
-(28) <const_type> <integer_type>
- <char_type>
- <wide_char_type>
- <boolean_type>
- <floating_pt_type>
- <string_type>
- <wide_string_type>
- <scoped_name>
- <octet_type>
-
-(29) <const_exp> <or_expr>
-
-(30) <or_expr> <xor_expr> <or_expr'>
-
-(30) <or_expr'> e
- "|" <xor_expr> <or_expr'>
-
-(31) <xor_expr> <and_expr> <xor_expr'>
-
-(31) <xor_expr'> e
- "^" <and_expr> <xor_expr'>
-
-(32) <and_expr> <shift_expr><and_expr'>
-
-(32) <and_expr'> e
- "&" <shift_expr> <and_expr'>
-
-(33) <shift_expr> <add_expr> <shift_expr'>
-
-(33) <shift_expr'> e
- ">>" <add_expr> <shift_expr'>
- "<<" <add_expr> <shift_expr'>
-
-(34) <add_expr> <mult_expr> <add_expr'>
-
-(34) <add_expr'> e
- "+" <mult_expr> <add_expr'>
- "-" <mult_expr> <add_expr'>
-
-(35) <mult_expr> <unary_expr> <mult_expr'>
-
-(35) <mult_expr'> e
- "*" <unary_expr> <mult_expr'>
- "/" <unary_expr> <mult_expr'>
- "%" <unary_expr> <mult_expr'>
-
-(36) <unary_expr> <unary_operator> <primary_expr>
- <primary_expr>
-
-(37) <unary_operator> "-"
- "+"
- "~"
-
-(38) <primary_expr> <scoped_name>
- <literal>
- "(" <const_exp> ")"
-
-(39) <literal> <<integer_literal>>
- <<string_literal>>>
- <<wide_string_literal>>>
- <<character_literal>>
- <<wide_character_literal>>
- <<fixed_pt_literal>>
- <<floating_pt_literal>>
- <<boolean_literal>>
-
-(40) <boolean_literal> "TRUE"
- "FALSE"
-
-(41) <positive_int_const> <const_exp>
-
-(42) <type_dcl> "typedef" <type_declarator>
- <struct_type>
- <union_type>
- <enum_type>
- "native" <simple_declarator>
-
-(43) <type_declarator> <type_spec> <declarators>
-
-(44) <type_spec> <simple_type_spec>
- <constr_type_spec>
-
-(45) <simple_type_spec> <base_type_spec>
- <template_type_spec>
- <scoped_name>
-
-(46) <base_type_spec> <floating_pt_type>
- <integer_type>
- <char_type>
- <wide_char_type>
- <boolean_type>
- <octet_type>
- <any_type>
- <object_type>
- <value_base_type>
-
-(47) <template_type_spec> <sequence_type>
- <string_type>
- <wide_string_type>
- <fixed_pt_type>
-
-(48) <constr_type_spec> <struct_type>
- <union_type>
- <enum_type>
-
-(49) <declarators> <declarator> <declarators'>
-
-(49) <declarators'> e
- "," <declarator> <declarators'>
-
-(50) <declarator> <simple_declarator>
- <complex_declarator>
-
-(51) <simple_declarator> <id>
-
-(52) <complex_declarator> <array_declarator>
-
-(53) <floating_pt_type> "float"
- "double"
- "long" "double"
-
-(54) <integer_type> <signed_int>
- <unsigned_int>
-
-(55) <signed_int> "long"
- "short"
- "long" "long"
-
-// 56-58 omitted
-
-(59) <unsigned_int> "unsigned" <signed_int>
-
-// 60-62 omitted
-
-(63) <char_type> "char"
-
-(64) <wide_char_type> "wchar"
-
-(65) <boolean_type> "boolean"
-
-(66) <octet_type> "octet"
-
-(67) <any_type> "any"
-
-(68) <object_type> "Object"
-
-(69) <struct_type> "struct" <id> "{" <member_list> "}"
-
-(70) <member_list> <member> <member_list'>
-
-(70) <member_list'> e
- <member> <member_list'>
-
-(71) <member> <type_spec> <declarators> ";"
-
-(72) <union_type> "union" <id> "switch" "(" <switch_type_spec> ")" "{" <switch_body> "}"
-
-(73) <switch_type_spec> <integer_type>
- <char_type>
- <boolean_type>
- <enum_type>
- <scoped_name>
-
-(74) <switch_body> <case> <switch_body'>
-
-(74) <switch_body'> e
- <case> <switch_body'>
-
-(75) <case> <case_label> <case'> <element_spec> ";"
-
-(75) <case'> e
- <case_label> <case'>
-
-(76) <case_label> "case" <const_exp> ":"
- "default" ":"
-
-(77) <element_spec> <type_spec> <declarator>
-
-(78) <enum_type> "enum" <id> "{" <id> <enum_type'> "}"
-
-(78) <enum_type'> e
- "," <id> <enum_type'>
-
-// 79 omitted
-
-(80) <sequence_type> "sequence" "<" <simple_type_spec> <sequence_type'>
-
-(80) <sequence_type'> "," <positive_int_const> ">"
- ">"
-
-(81) <string_type> "string"
- "string" "<" <positive_int_const> ">"
-
-(82) <wide_string_type> "wstring"
- "wstring" "<" <positive_int_const> ">"
-
-(83) <array_declarator> <id> <fixed_array_size>
-
-(84) <fixed_array_size> "[" <positive_int_const> "]"
-
-(85) <attr_dcl> "readonly" "attribute" <param_type_spec> <id> <attr_dcl'>
- "attribute" <param_type_spec> <id> <attr_dcl'>
-
-(85) <attr_dcl'> e
- "," <id> <attr_dcl'>
-
-(86) <except_dcl> "exception" <id> "{" <except_dcl'> "}"
-
-(86) <except_dcl'> e
- <member> <except_dcl'>
-
-(87) <op_dcl> <op_attribute> <op_type_spec> <op_dcl'>
- <op_type_spec> <op_dcl'>
-
-(87) <op_dcl'> <id> <parameter_dcls> <op_dcl''>
- <macroID> <parameter_dcls'> <op_dcl''>
-
-(87) <op_dcl''> e
- <context_expr>
- <raises_expr>
- <raises_expr> <context_expr>
-
-(88) <op_attribute> "oneway"
-
-(89) <op_type_spec> <param_type_spec>
- "void"
-
-(90) <parameter_dcls> "(" <parameter_dcls'>
-
-(90) <parameter_dcls'> <param_dcl> <parameter_dcls''> ")"
- ")"
-
-(90) <parameter_dcls''> e
- "," <param_dcl> <parameter_dcls''>
-
-(91) <param_dcl> <param_attribute> <param_type_spec> <id>
-
-(92) <param_attribute> "in"
- "out"
- "inout"
-
-(93) <raises_expr> "raises" "(" <scoped_name> <raises_expr'> ")"
-
-(93) <raises_expr'> e
- "," <scoped_name> <raises_expr'>
-
-(94) <context_expr> "context" "(" <string_literal> <context_expr'> ")"
-
-(94) <context_expr'> e
- "," <string_literal> <context_expr'>
-
-(95) <param_type_spec> <base_type_spec>
- <string_type>
- <wide_string_type>
- <scoped_name>
-
-(96) <fixed_pt_type> "fixed" "<" <positive_int_const> "," <positive_int_const> ">"
-
-(97) <fixed_pt_const_type> "fixed"
-
-(98) <value_base_type> "ValueBase"
-
-NOTES:
-
-- #define id(id, id, ...) token-string is a macro definition. There can be no space between the first id and the left paren. Since id( must be treated as a token and id( can also appear in op_dcl, see that production for the effect of this token.
-
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/grammar3.idl b/src/share/classes/com/sun/tools/corba/se/idl/grammar3.idl
deleted file mode 100644
index e009e42..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/grammar3.idl
+++ /dev/null
@@ -1,539 +0,0 @@
-/*
- * Copyright (c) 1999, 2009, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * COMPONENT_NAME: idl.parser
- *
- * ORIGINS: 27
- *
- * 5639-D57, (C) COPYRIGHT International Business Machines Corp., 1997, 1998
- *
- */
-
-(1) <specification> <imports> <definition> <specification'> // CORBA3
-
-(1) <imports> e // CORBA3
- <import> <imports> // CORBA3
-
-(1) <import> "import" <imported_scope> ";" // CORBA3
-
-(1) <imported_scope> <scoped_name> // CORBA3
- <string_literal> // CORBA3
-
-(1) <specification'> e
- <definition><specification'>
-
-(2) <definition> <type_dcl> ";"
- <const_dcl> ";"
- <except_dcl> ";"
- <interface> ";"
- <module> ";"
- <value> ";"
- <type_id_dcl> ";" // CORBA3
- <type_prefix_dcl> ";" // CORBA3
- <component> ";" // CORBA3
- <home_dcl> ";" // CORBA3
-
-(2) <type_id_dcl> "typeId" <scoped_name> <string_literal> // CORBA3
-
-(2) <type_prefix_dcl> "typePrefix" <scoped_name> <string_literal> // CORBA3
-
-(3) <module> "module" <id> "{" <module'> "}"
-
-(3) <module'> <definition><module''>
-
-(3) <module''> <definition><module''>
- e
-
-(4) <interface> <interface_dcl>
- <forward_dcl>
-
-(5) <interface_dcl> <interface_header> "{" <interface_body> "}"
-
-(6) <forward_dcl> "abstract" "interface" <id>
- "local" "interface" <id> // CORBA3
- "interface" <id>
-
-(7) <interface_header> "abstract" "interface" <id> <interface_header'>
- "local" "interface" <id> <interface_header'> // CORBA3
- "interface" <id> <interface_header'>
-
-(7) <interface_header'> e
- <interface_inheritance_spec>
-
-(8) <interface_body> <export><interface_body'>
-
-(8) <interface_body'> e
- <export><interface_body'>
-
-(9) <export> <type_dcl> ";"
- <const_dcl> ";"
- <except_dcl> ";"
- <attr_dcl> ";"
- <op_dcl> ";"
- <type_id_dcl> ";" // CORBA3
- <type_prefix_dcl> ";" // CORBA3
-
-(10) <interface_inheritance_spec> ":" <scoped_name> <inheritance_spec'>
-
-(10) <interface_inheritance_spec'> e
- "," <scoped_name> <inheritance_spec'>
-
-(12) <scoped_name> <id> <scoped_name'>
- "::" <id> <scoped_name'>
-
-(12) <scoped_name'> e
- "::" <id> <scoped_name'>
-
-(13) <value> <value_dcl>
- <value_abs_dcl>
- <value_box_dcl>
- <value_forward_dcl>
-
-(14) <value_forward_dcl> "abstract" "valuetype" <id>
- "valuetype" <id>
-
-(15) <value_box_dcl> "valuetype" <id> <type_spec>
-
-(16) <value_abs_dcl> "abstract" "valuetype" <id> <value_inheritance_spec> "{" <export> <vad> "}"
- "abstract" "valuetype" <id> "{" <export> <vad> "}"
-
-(16) <vad> e
- <export> <vad>
-
-(17) <value_dcl> <value_header> "{" <value_element> <ve> "}"
-
-(17) <ve> e
- <value_element> <ve>
-
-(18) <value_header> "custom" "valuetype" <id> <value_inheritance_spec>
- "valuetype" <id> <value_inheritance_spec>
- "custom" "valuetype" <id>
- "valuetype" <id>
-
-(19) <value_inheritance_spec> <opt_inherits> <opt_supports>
-
-(19) <opt_inherits> e
- ":" "truncatable" <value_name> <value_name_list>
- ":" <value_name> <value_name_list>
-
-(19) <value_name_list> e
- "," <value_name> <value_name_list>
-
-(19) <opt_supports> e
- "supports" <interface_name> <interface_name_list>
-
-(19) <interface_name_list> e
- "," <interface_name> <interface_name_list>
-
-(20) <value_name> <scoped_name>
-
-(21) <value_element> <export>
- <state_member>
- <init_dcl>
-
-(22) <state_member> "public" <type_spec> <declarators> ";"
- "private" <type_spec> <declarators> ";"
-
-(23) <init_dcl> "factory" <id> "(" ")"
- "factory" <id> "(" <init_param_dcls> ")"
-
-(24) <init_param_dcls> <init_param_dcl>
- <init_param_dcl> "," <init_param_dcls>
-
-(25) <init_param_dcl> <init_param_attribute> <param_type_spec> <simple_declarator>
-
-(26) <init_param_attribute> "in"
-
-(27) <const_dcl> "const" <const_type> <id> "=" <const_exp>
-
-(28) <const_type> <integer_type>
- <char_type>
- <wide_char_type>
- <boolean_type>
- <floating_pt_type>
- <string_type>
- <wide_string_type>
- <scoped_name>
- <octet_type>
-
-(29) <const_exp> <or_expr>
-
-(30) <or_expr> <xor_expr> <or_expr'>
-
-(30) <or_expr'> e
- "|" <xor_expr> <or_expr'>
-
-(31) <xor_expr> <and_expr> <xor_expr'>
-
-(31) <xor_expr'> e
- "^" <and_expr> <xor_expr'>
-
-(32) <and_expr> <shift_expr><and_expr'>
-
-(32) <and_expr'> e
- "&" <shift_expr> <and_expr'>
-
-(33) <shift_expr> <add_expr> <shift_expr'>
-
-(33) <shift_expr'> e
- ">>" <add_expr> <shift_expr'>
- "<<" <add_expr> <shift_expr'>
-
-(34) <add_expr> <mult_expr> <add_expr'>
-
-(34) <add_expr'> e
- "+" <mult_expr> <add_expr'>
- "-" <mult_expr> <add_expr'>
-
-(35) <mult_expr> <unary_expr> <mult_expr'>
-
-(35) <mult_expr'> e
- "*" <unary_expr> <mult_expr'>
- "/" <unary_expr> <mult_expr'>
- "%" <unary_expr> <mult_expr'>
-
-(36) <unary_expr> <unary_operator> <primary_expr>
- <primary_expr>
-
-(37) <unary_operator> "-"
- "+"
- "~"
-
-(38) <primary_expr> <scoped_name>
- <literal>
- "(" <const_exp> ")"
-
-(39) <literal> <<integer_literal>>
- <<string_literal>>>
- <<wide_string_literal>>>
- <<character_literal>>
- <<wide_character_literal>>
- <<fixed_pt_literal>>
- <<floating_pt_literal>>
- <<boolean_literal>>
-
-(40) <boolean_literal> "TRUE"
- "FALSE"
-
-(41) <positive_int_const> <const_exp>
-
-(42) <type_dcl> "typedef" <type_declarator>
- <struct_type>
- <union_type>
- <enum_type>
- "native" <simple_declarator>
-
-(43) <type_declarator> <type_spec> <declarators>
-
-(44) <type_spec> <simple_type_spec>
- <constr_type_spec>
-
-(45) <simple_type_spec> <base_type_spec>
- <template_type_spec>
- <scoped_name>
-
-(46) <base_type_spec> <floating_pt_type>
- <integer_type>
- <char_type>
- <wide_char_type>
- <boolean_type>
- <octet_type>
- <any_type>
- <object_type>
- <value_base_type>
-
-(47) <template_type_spec> <sequence_type>
- <string_type>
- <wide_string_type>
- <fixed_pt_type>
-
-(48) <constr_type_spec> <struct_type>
- <union_type>
- <enum_type>
-
-(49) <declarators> <declarator> <declarators'>
-
-(49) <declarators'> e
- "," <declarator> <declarators'>
-
-(50) <declarator> <simple_declarator>
- <complex_declarator>
-
-(51) <simple_declarator> <id>
-
-(52) <complex_declarator> <array_declarator>
-
-(53) <floating_pt_type> "float"
- "double"
- "long" "double"
-
-(54) <integer_type> <signed_int>
- <unsigned_int>
-
-(55) <signed_int> "long"
- "short"
- "long" "long"
-
-// 56-58 omitted
-
-(59) <unsigned_int> "unsigned" <signed_int>
-
-// 60-62 omitted
-
-(63) <char_type> "char"
-
-(64) <wide_char_type> "wchar"
-
-(65) <boolean_type> "boolean"
-
-(66) <octet_type> "octet"
-
-(67) <any_type> "any"
-
-(68) <object_type> "Object"
-
-(69) <struct_type> "struct" <id> "{" <member_list> "}"
-
-(70) <member_list> <member> <member_list'>
-
-(70) <member_list'> e
- <member> <member_list'>
-
-(71) <member> <type_spec> <declarators> ";"
-
-(72) <union_type> "union" <id> "switch" "(" <switch_type_spec> ")" "{" <switch_body> "}"
-
-(73) <switch_type_spec> <integer_type>
- <char_type>
- <boolean_type>
- <enum_type>
- <scoped_name>
-
-(74) <switch_body> <case> <switch_body'>
-
-(74) <switch_body'> e
- <case> <switch_body'>
-
-(75) <case> <case_label> <case'> <element_spec> ";"
-
-(75) <case'> e
- <case_label> <case'>
-
-(76) <case_label> "case" <const_exp> ":"
- "default" ":"
-
-(77) <element_spec> <type_spec> <declarator>
-
-(78) <enum_type> "enum" <id> "{" <id> <enum_type'> "}"
-
-(78) <enum_type'> e
- "," <id> <enum_type'>
-
-// 79 omitted
-
-(80) <sequence_type> "sequence" "<" <simple_type_spec> <sequence_type'>
-
-(80) <sequence_type'> "," <positive_int_const> ">"
- ">"
-
-(81) <string_type> "string"
- "string" "<" <positive_int_const> ">"
-
-(82) <wide_string_type> "wstring"
- "wstring" "<" <positive_int_const> ">"
-
-(83) <array_declarator> <id> <fixed_array_size>
-
-(84) <fixed_array_size> "[" <positive_int_const> "]"
-
-(85) <attr_dcl> <readonly_attr_spec> // CORBA3
- <attr_spec> // CORBA3
-
-(85) <readonly_attr_spec> <readonly_attr_header> <readonly_attr_declarator> // CORBA3
-
-(85) <readonly_attr_header> "readonly" "attribute" <param_type_spec> // CORBA3
-
-(85) <readonly_attr_declarator> <simple_declarator> <get_excep_expr> // CORBA3
- <simple_declarator> <sds> // CORBA3
-
-(85) <sds> e // CORBA3
- <simple_declarator> <sds> // CORBA3
-
-(85) <attr_spec> "attribute" <param_type_spec> <attr_declarator> // CORBA3
-
-(85) <attr_declarator> <simple_declarator> <attr_raises_expr> // CORBA3
- <simple_declarator> <sds> // CORBA3
-
-(85) <attr_raises_expr> <get_excep_expr> // CORBA3
- <get_excep_expr> <set_excep_expr> // CORBA3
- <set_excep_expr> // CORBA3
-
-(85) <get_excep_expr> "getRaises" <exception_list> // CORBA3
-
-(85) <set_excep_expr> "setRaises" <exception_list> // CORBA3
-
-(85) <exception_list> "(" <scoped_name> <els> ")" // CORBA3
-
-(85) <els> e // CORBA3
- "," <scoped_name> <els> // CORBA3
-
-(86) <except_dcl> "exception" <id> "{" <except_dcl'> "}"
-
-(86) <except_dcl'> e
- <member> <except_dcl'>
-
-(87) <op_dcl> <op_attribute> <op_type_spec> <op_dcl'>
- <op_type_spec> <op_dcl'>
-
-(87) <op_dcl'> <id> <parameter_dcls> <op_dcl''>
- <macroID> <parameter_dcls'> <op_dcl''>
-
-(87) <op_dcl''> e
- <context_expr>
- <raises_expr>
- <raises_expr> <context_expr>
-
-(88) <op_attribute> "oneway"
-
-(89) <op_type_spec> <param_type_spec>
- "void"
-
-(90) <parameter_dcls> "(" <parameter_dcls'>
-
-(90) <parameter_dcls'> <param_dcl> <parameter_dcls''> ")"
- ")"
-
-(90) <parameter_dcls''> e
- "," <param_dcl> <parameter_dcls''>
-
-(91) <param_dcl> <param_attribute> <param_type_spec> <id>
-
-(92) <param_attribute> "in"
- "out"
- "inout"
-
-(93) <raises_expr> "raises" "(" <scoped_name> <raises_expr'> ")"
-
-(93) <raises_expr'> e
- "," <scoped_name> <raises_expr'>
-
-(94) <context_expr> "context" "(" <string_literal> <context_expr'> ")"
-
-(94) <context_expr'> e
- "," <string_literal> <context_expr'>
-
-(95) <param_type_spec> <base_type_spec>
- <string_type>
- <wide_string_type>
- <scoped_name>
-
-(96) <fixed_pt_type> "fixed" "<" <positive_int_const> "," <positive_int_const> ">"
-
-(97) <fixed_pt_const_type> "fixed"
-
-(98) <value_base_type> "ValueBase"
-
-// CORBA3 Component and Home IDL
-
-(200) <component> <component_dcl>
- <component_forward_dcl>
-
-(201) <component_forward_dcl> "component" <id>
-
-(202) <component_dcl> <component_header> "{" <component_body> "}"
-
-(203) <component_header> "component" <id>
- "component" <id> <component_inheritance_spec>
- "component" <id> <supported_interface_spec>
- "component" <id> <component_inheritance_spec> <supported_interface_spec>
-
-(204) <supported_interface_spec> "supports" <scoped_name> <snames>
-
-(204) <snames> e
- "," <scoped_name> <snames>
-
-(205) <component_inheritance_spec> ":" <scoped_name>
-
-(206) <component_body> <component_export> <ces>
-
-(206) <ces> e
- <component_export> <ces>
-
-(207) <component_export> <provides_dcl> ";"
- <uses_dcl> ";"
- <emits_dcl> ";"
- <publishes_dcl> ";"
- <consumes_dcl> ";"
- <attr_dcl> ";"
-
-(208) <provides_dcl> "provides" <interface_type> <id>
-
-(209) <interface_type> <scoped_name>
- "Object"
-
-(210) <uses_dcl> "uses" <interface_type> <id>
- "uses" "multiple" <interface_type> <id>
-
-(211) <emits_dcl> "emits" <scoped_name> <id>
-
-(212) <publishes_dcl> "publishes" <scoped_name> <id>
-
-(213) <consumes_dcl> "consumes" <scoped_name> <id>
-
-(214) <home_dcl> <home_header> <home_body>
-
-(215) <home_header> "home" <id> <home_inheritance_spec> "manages" <scoped_name>
- "home" <id> "manages" <scoped_name>
- "home" <id> <home_inheritance_spec> "manages" <scoped_name> <primary_key_spec>
- "home" <id> "manages" <scoped_name> <primary_key_spec>
-
-(216) <home_inheritance_spec> ":" <scoped_name>
-
-(217) <primary_key_spec> "primaryKey" <scoped_name>
-
-(218) <home_body> "{" <home_export> <hes> "}"
-
-(218) <hes> e
- <home_export> <hes>
-
-(219) <home_export> <export>
- <factory_dcl> ";"
- <finder_dcl> ";"
-
-(220) <factory_dcl> "factory" <id> "(" <init_param_dcls> ")" <raises_expr>
- "factory" <id> "(" ")" <raises_expr>
- "factory" <id> "(" <init_param_dcls> ")"
- "factory" <id> "(" ")"
-
-(221) <finder_dcl> "finder" <id> "(" <init_param_dcls> ")" <raises_expr>
- "finder" <id> "(" ")" <raises_expr>
- "finder" <id> "(" <init_param_dcls> ")"
- "finder" <id> "(" ")"
-
-NOTES:
-
-- #define id(id, id, ...) token-string is a macro definition. There can be no space between the first id and the left paren. Since id( must be treated as a token and id( can also appear in op_dcl, see that production for the effect of this token.
-
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/idl.prp b/src/share/classes/com/sun/tools/corba/se/idl/idl.prp
deleted file mode 100644
index a07db3f..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/idl.prp
+++ /dev/null
@@ -1,195 +0,0 @@
-#
-# Copyright (c) 1999, 2009, Oracle and/or its affiliates. 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. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# COMPONENT_NAME: idl.parser
-#
-# ORIGINS: 27
-#
-# Licensed Materials - Property of IBM
-# 5639-D57 (C) COPYRIGHT International Business Machines Corp., 1997, 1999
-# RMI-IIOP v1.0
-#
-
-# Translator: Each line below is of the form "<key>=<message>".
-# The keys are NOT to be translated.
-# The messages ARE to be translated.
-#
-# DO NOT translate the following:
-# ASCII
-# #else
-# #endif
-# IDL
-#
-# %0, %1, etc. are postional parameters to the message. Do not
-# translate these. The number order is the order they are given to
-# the message writer. It is OK to change their order in the message
-# if the language grammar so dictates.
-#
-# Lines of the form "%0 (line %1): <some message>\n%x\n%y" are error
-# messages: %0 is a filename; %1 is a line number; %x is line %1 from
-# %0; %y is the error marker. So the message comes out looking like:
-# <filename> (line xxx): <some message>
-# Line xxx from <filename> where the carat points to the error
-# ^
-# So the first two and the last two parameters of these messages must
-# remain in their positions.
-#
-# A backslash (\) at the end of a line is a line continuation
-# character. A backslash at the beginning of a line means don't
-# ignore leading blanks (they normally are). These backslashes
-# should remain in the message.
-#
-# Translator: Start Translating
-
-Compile.parsing=Parsing %0
-Compile.parseDone=done - %0
-Compile.generating=Generating %0
-Compile.genDone=done - %0
-Deprecated.keyword=WARNING: Keyword `%0' is deprecated.
-EvaluationException.1=Operands of %0 operator are inconsistent: %1 and %2.
-EvaluationException.2=Operand of %0 operator must be a number, not a %1.
-EvaluationException.or=bitwise or
-EvaluationException.xor=bitwise xor
-EvaluationException.and=bitwise and
-EvaluationException.plus=addition
-EvaluationException.minus=subtraction
-EvaluationException.left=left shift
-EvaluationException.right=right shift
-EvaluationException.times=multiplication
-EvaluationException.divide=division
-EvaluationException.mod=modulo
-EvaluationException.pos=unary positive
-EvaluationException.neg=unary negation
-EvaluationException.not=bitwise not
-EvaluationException.booleanNot=boolean not
-EvaluationException.booleanAnd=boolean and
-EvaluationException.booleanOr=boolean or
-EvaluationException.equal=equal
-EvaluationException.notEqual=not equal
-EvaluationException.greaterThan=greater than
-EvaluationException.lessThan=less than
-EvaluationException.greaterEqual=greater than or equal
-EvaluationException.lessEqual=less than or equal
-GenFileStream.1=%0 could not be generated: %1
-InvalidArgument.1=Invalid argument: %0.
-InvalidArgument.2=No IDL file was specified.
-InvalidCharacter.1=%0 (line %1): invalid character: %2 (ASCII %3).\n%4\n%5
-Migration.futureKeyword=WARNING: Identifier `%0' collides with a keyword; use an escaped identifier to ensure future compatibility.
-Migration.keywordCollision=WARNING: Identifier `%0' collides with a keyword; use an escaped identifier to ensure future compatibility.
-ParseException.abstractValueBox=%0 (line %1): A value box cannot be declared abstract.\n%2\n%3
-ParseException.alreadyDeclared=%0 (line %1): %2 has already been declared.\n%3\n%4
-ParseException.declNotInSameFile=%0 (line %1): %2 was declared previously in a forward declaration in file %3.\n%4\n%5
-ParseException.alreadyDerived=%0 (line %1): %2 has already been declared as a parent of %3.\n%4\n%5
-ParseException.alreadyDefaulted=%0 (line %1): The default branch has already been encountered.\n%2\n%3
-ParseException.alreadyRaised=%0 (line %1): %2 already specified in raises clause.\n%3\n%4
-ParseException.attributeNotType=%0 (line %1): %2 is an attribute. It cannot be used as a type.\n%3\n%4
-ParseException.badAbstract=%0 (line %1): The forward and actual declaration of %2 is inconsistent. One is abstract and the other is not.\n%3\n%4
-ParseException.badCustom=%0 (line %1): A forward value declaration cannot be declared custom.\n%2\n%3
-ParseException.badRepIDAlreadyAssigned=%0 (line %1): Type %2 has already been assigned a Repository ID in a previous ID pragma directive.\n%3\n%4
-ParseException.badRepIDForm=%0 (line %1): Repository ID '%2' should have form '<format>:<string>'.\n%3\n%4
-ParseException.badRepIDPrefix=%0 (line %1): Interface %2 should have Repository ID prefix `%3', not '%4'.\n%5\n%6
-ParseException.badState=%0 (line %1): %2 cannot be a stateful interface; it has more than one stateful parent.\n%3\n%4
-ParseException.branchLabel=%0 (line %1): case %2 has already been declared.\n%3\n%4
-ParseException.branchName=%0 (line %1): A branch named %2 has already been declared.\n%3\n%4
-ParseException.duplicateInit=%0 (line %1): An initializer has the same signature as a previous initializer.\n%2\n%3
-ParseException.duplicateState=%0 (line %1): The data member %2 has the same name as a previous data member.\n%3\n%4
-ParseException.elseNoIf=%0 (line %1): #else encountered without a matching #if.\n%2\n%3
-ParseException.endNoIf=%0 (line %1): #endif encountered without a matching #if.\n%2\n%3
-ParseException.evaluation=%0 (line %1): %2\n%3\n%4
-ParseException.forwardEntry=%0 (line %1): There is a forward reference to %2, but it is not defined.\n%3\n%4
-ParseException.forwardedValueBox=%0 (line %1): %2 has a forward declaration. A value box cannot be forward declared.\n%3\n%4
-ParseException.forwardInheritance=%0 (line %1): It is illegal for %2 to inherit from the incomplete forward declaration of %3.\n%4\n%5
-ParseException.generic=%0 (line %1): %2\n%3\n%4
-ParseException.illegalArray=%0 (line %1): An array is not a legal type in a %2.\n%3\n%4
-ParseException.illegalException=%0 (line %1): Exceptions cannot appear within %2s.\n%3\n%4
-ParseException.invalidConst1=%0 (line %1): Constant expression must be of type %2, not %3.\n%4\n%5
-ParseException.invalidConst2=%0 (line %1): Identifiers in constant expressions must be constants, not %2.\n%3\n%4
-ParseException.keywordCollision=%0 (line %1): Identifier `%2' collides with keyword; use escaped identifier if necessary.\n%3\n%4
-ParseException.methodClash=%0 (line %1): Method name clash in interface %2: %3.\n%4\n%5
-ParseException.moduleNotType=%0 (line %1): %2 is a module. It cannot be used as a type.\n%3\n%4
-ParseException.nestedValueBox=%0 (line %1): Value boxes cannot be nested.\n%2\n%3
-ParseException.noDefault=%0 (line %1): A default branch is not allowed when all possible cases are fully covered.\n%2\n%3
-ParseException.nonAbstractParent=%0 (line %1): The abstract interface %2 cannot inherit from the non-abstract interface %3.\n%4\n%5
-ParseException.nonAbstractParent2=%0 (line %1): The abstract value %2 cannot inherit from the non-abstract value %3.\n%4\n%5
-ParseException.nonAbstractParent3=%0 (line %1): The value %2 cannot inherit from the non-abstract value %3 as specified.\n%4\n%5
-ParseException.notANumber=%0 (line %1): A number was expected. %2 is not a valid number.\n%3\n%4
-ParseException.nothing=%0 is empty. There is nothing to compile.
-ParseException.notPosInt=%0 (line %1): Expected a positive integer constant, not %2.\n%3\n%4
-ParseException.oneway=%0 (line %1): %2 is declared to be oneway. Oneway methods must: return void; have only in parameters; raise no exceptions.\n%3\n%4
-ParseException.operationNotType=%0 (line %1): %2 is an operation. It cannot be used as a type.\n%3\n%4
-ParseException.outOfRange=%0 (line %1): The value of the constant expression, %2, is out of range for type %3.\n%4\n%5
-ParseException.recursive=%0 (line %1): The only legal recursive definition is: sequence<%2> %3.\n%4\n%5
-ParseException.selfInherit=%0 (line %1): %2 cannot inherit from itself.\n%3\n%4
-ParseException.stringTooLong=%0 (line %1): "%2" cannot be more than %3 characters long.\n%4\n%5
-ParseException.syntax1=%0 (line %1): Expected `%2'; encountered `%3'.\n%4\n%5
-ParseException.syntax2=%0 (line %1): Expected one of%2; encountered `%3'.\n%4\n%5
-ParseException.unclosed=%0: Unexpected end of file encountered in comment.
-ParseException.undeclaredType=%0 (line %1): %2 is an undeclared type.\n%3\n%4
-ParseException.warning=%0 (line %1): %2\n%3\n%4
-ParseException.constExprType=%0 (line %1): The type of the constant expression is %2, but it should be %3.\n%4\n%5
-ParseException.wrongType=%0 (line %1): The type of %2 is %3, but it should be %4.\n%5\n%6
-ParseException.illegalIncompleteTypeReference=%0 (line %1): Illegal reference to incomplete forward declaration of type %2.\n%3\n%4
-Preprocessor.unknown=Unknown preprocessor directive, `%0'. Line ignored.
-Preprocessor.unknownPragma=Unknown pragma `%0'. Line ignored.
-Preprocessor.undefinedName=Undefined type name for pragma %0: %1. Line ignored.
-Token.boolLit=<boolean literal>
-Token.charLit=<character literal>
-Token.intLit=<integer literal>
-Token.floatLit=<floating point literal>
-Token.stringLit=<string literal>
-Token.literal=<literal>
-Token.identifier=<identifier>
-Token.endOfFile=EOF
-Token.unknown=?
-Util.cantCreatePkg=Cannot create the package %0.
-Version.product=IDL Parser Framework, version "%0"
-Version.number=3.2
-default=Error! A message was requested which does not exist. The messages file does not contain the key: %0.
-
-# Translator: In the list of options below, do not translate:
-# -i, -d, -keep, -emitAll, -noWarn, -v, -verbose, -version, #define
-# Do not translate the string "java com.sun.tools.corba.se.idl.Compile"
-
-usage=Compiler Usage:\n\
-\ java com.sun.tools.corba.se.idl.Compile [options] <idl file>\n\
-where <idl file> is the name of a file containing IDL definitions, and\n\
-[options] is any combination of the options listed below. The options\n\
-are optional and may appear in any order; <idl file> is required and\n\
-must appear last.\n\
-\ \n\
-Options:\n\
- -d <symbol> This is equivalent to the following line in an\n\
-\ IDL file: #define <symbol>\n\
- -emitAll Emit all types, including those found in #included\n\
-\ files.\n\
- -i <include path> By default, the current directory is scanned for\n\
-\ included files. This option adds another directory.\n\
- -keep If a file to be generated already exists, do not\n\
-\ overwrite it. By default it is overwritten.\n\
- -noWarn Suppress warnings.\n\
- -v, -verbose Verbose mode.\n\
- -version Display the version number.\n
-
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp b/src/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp
deleted file mode 100644
index 47ba5c6..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp
+++ /dev/null
@@ -1,177 +0,0 @@
-#
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. 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. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# COMPONENT_NAME: idl.parser
-#
-# ORIGINS: 27
-#
-# Licensed Materials - Property of IBM
-# 5639-D57 (C) COPYRIGHT International Business Machines Corp., 1997, 1999
-# RMI-IIOP v1.0
-#
-
-# Translator: Each line below is of the form "<key>=<message>".
-# The keys are NOT to be translated.
-# The messages ARE to be translated.
-#
-# DO NOT translate the following:
-# ASCII
-# #else
-# #endif
-# IDL
-#
-# %0, %1, etc. are postional parameters to the message. Do not
-# translate these. The number order is the order they are given to
-# the message writer. It is OK to change their order in the message
-# if the language grammar so dictates.
-#
-# Lines of the form "%0 (line %1): <some message>\n%x\n%y" are error
-# messages: %0 is a filename; %1 is a line number; %x is line %1 from
-# %0; %y is the error marker. So the message comes out looking like:
-# <filename> (line xxx): <some message>
-# Line xxx from <filename> where the carat points to the error
-# ^
-# So the first two and the last two parameters of these messages must
-# remain in their positions.
-#
-# A backslash (\) at the end of a line is a line continuation
-# character. A backslash at the beginning of a line means don't
-# ignore leading blanks (they normally are). These backslashes
-# should remain in the message.
-#
-# Translator: Start Translating
-
-Compile.parsing=%0\u306E\u89E3\u6790\u4E2D
-Compile.parseDone=\u5B8C\u4E86 - %0
-Compile.generating=%0\u306E\u751F\u6210\u4E2D
-Compile.genDone=\u5B8C\u4E86 - %0
-Deprecated.keyword=\u8B66\u544A: \u30AD\u30FC\u30EF\u30FC\u30C9`%0'\u306F\u975E\u63A8\u5968\u3067\u3059\u3002
-EvaluationException.1=%0\u6F14\u7B97\u5B50\u306E\u30AA\u30DA\u30E9\u30F3\u30C9\u306B\u4E00\u8CAB\u6027\u304C\u3042\u308A\u307E\u305B\u3093: %1\u304A\u3088\u3073%2\u3002
-EvaluationException.2=%0\u6F14\u7B97\u5B50\u306E\u30AA\u30DA\u30E9\u30F3\u30C9\u306F\u3001%1\u3067\u306F\u306A\u304F\u6570\u5024\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
-EvaluationException.or=\u30D3\u30C3\u30C8\u5358\u4F4D\u306EOR\u6F14\u7B97
-EvaluationException.xor=\u30D3\u30C3\u30C8\u5358\u4F4D\u306EXOR\u6F14\u7B97
-EvaluationException.and=\u30D3\u30C3\u30C8\u5358\u4F4D\u306EAND\u6F14\u7B97
-EvaluationException.plus=\u52A0\u7B97
-EvaluationException.minus=\u6E1B\u7B97
-EvaluationException.left=\u5DE6\u30B7\u30D5\u30C8
-EvaluationException.right=\u53F3\u30B7\u30D5\u30C8
-EvaluationException.times=\u4E57\u7B97
-EvaluationException.divide=\u9664\u7B97
-EvaluationException.mod=\u3079\u304D\u4E57
-EvaluationException.pos=\u5358\u9805\u30D7\u30E9\u30B9
-EvaluationException.neg=\u5358\u9805\u30DE\u30A4\u30CA\u30B9
-EvaluationException.not=\u30D3\u30C3\u30C8\u5358\u4F4D\u306ENOT\u6F14\u7B97
-EvaluationException.booleanNot=boolean NOT
-EvaluationException.booleanAnd=boolean AND
-EvaluationException.booleanOr=boolean OR
-EvaluationException.equal=\u6B21\u3068\u7B49\u3057\u3044
-EvaluationException.notEqual=\u6B21\u3068\u7B49\u3057\u304F\u306A\u3044
-EvaluationException.greaterThan=\u304C\u6B21\u306E\u5024\u3088\u308A\u5927\u304D\u3044
-EvaluationException.lessThan=\u304C\u6B21\u306E\u5024\u3088\u308A\u5C0F\u3055\u3044
-EvaluationException.greaterEqual=\u304C\u6B21\u306E\u5024\u4EE5\u4E0A
-EvaluationException.lessEqual=\u304C\u6B21\u306E\u5024\u4EE5\u4E0B
-GenFileStream.1=%0\u3092\u751F\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: %1
-InvalidArgument.1=\u5F15\u6570\u304C\u7121\u52B9\u3067\u3059: %0\u3002
-InvalidArgument.2=IDL\u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
-InvalidCharacter.1=%0 (\u884C%1): \u6587\u5B57\u304C\u7121\u52B9\u3067\u3059: %2 (ASCII %3)\u3002\n%4\n%5
-Migration.futureKeyword=\u8B66\u544A: \u8B58\u5225\u5B50`%0'\u304C\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059\u3002\u5C06\u6765\u306E\u4E92\u63DB\u6027\u306E\u305F\u3081\u306B\u3001\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u8B58\u5225\u5B50\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-Migration.keywordCollision=\u8B66\u544A: \u8B58\u5225\u5B50`%0'\u304C\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059\u3002\u5C06\u6765\u306E\u4E92\u63DB\u6027\u306E\u305F\u3081\u306B\u3001\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u8B58\u5225\u5B50\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002
-ParseException.abstractValueBox=%0 (\u884C%1): \u5024\u30DC\u30C3\u30AF\u30B9\u306Fabstract\u3068\u3057\u3066\u5BA3\u8A00\u3067\u304D\u307E\u305B\u3093\u3002\n%2\n%3
-ParseException.alreadyDeclared=%0 (\u884C%1): %2\u306F\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
-ParseException.declNotInSameFile=%0 (\u884C%1): %2\u306F\u30D5\u30A1\u30A4\u30EB%3\u306Eforward\u5BA3\u8A00\u3067\u4EE5\u524D\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%4\n%5
-ParseException.alreadyDerived=%0 (\u884C%1): %2\u306F%3\u306E\u89AA\u3068\u3057\u3066\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%4\n%5
-ParseException.alreadyDefaulted=%0 (\u884C%1): \u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u5206\u5C90\u306F\u3059\u3067\u306B\u691C\u51FA\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%2\n%3
-ParseException.alreadyRaised=%0 (\u884C%1): %2\u306Fraises\u53E5\u3067\u3059\u3067\u306B\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
-ParseException.attributeNotType=%0 (\u884C%1): %2\u306F\u5C5E\u6027\u3067\u3059\u3002\u578B\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
-ParseException.badAbstract=%0 (\u884C%1): %2\u306Eforward\u5BA3\u8A00\u3068\u5B9F\u969B\u306E\u5BA3\u8A00\u306B\u4E00\u8CAB\u6027\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u4E00\u65B9\u306Fabstract\u3067\u3059\u304C\u3001\u3082\u3046\u4E00\u65B9\u306Fabstract\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n%3\n%4
-ParseException.badCustom=%0 (\u884C%1): forward\u5024\u5BA3\u8A00\u306Fcustom\u3068\u3057\u3066\u5BA3\u8A00\u3067\u304D\u307E\u305B\u3093\u3002\n%2\n%3
-ParseException.badRepIDAlreadyAssigned=%0 (\u884C%1): \u578B%2\u306B\u306F\u3001\u524D\u306EID\u30D7\u30E9\u30B0\u30DE\u30FB\u30C7\u30A3\u30EC\u30AF\u30C6\u30A3\u30D6\u306E\u30EA\u30DD\u30B8\u30C8\u30EAID\u304C\u3059\u3067\u306B\u5272\u308A\u5F53\u3066\u3089\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
-ParseException.badRepIDForm=%0 (\u884C%1): \u30EA\u30DD\u30B8\u30C8\u30EAID '%2'\u306E\u5F62\u5F0F\u306F'<format>:<string>'\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4
-ParseException.badRepIDPrefix=%0 (\u884C%1): \u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%2\u306B\u306F\u3001'%4'\u3067\u306F\u306A\u304F\u30EA\u30DD\u30B8\u30C8\u30EAID\u63A5\u982D\u8F9E`%3'\u304C\u5FC5\u8981\u3067\u3059\u3002\n%5\n%6
-ParseException.badState=%0 (\u884C%1): %2\u306F\u30B9\u30C6\u30FC\u30C8\u30D5\u30EB\u30FB\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306B\u3067\u304D\u307E\u305B\u3093\u3002\u8907\u6570\u306E\u30B9\u30C6\u30FC\u30C8\u30D5\u30EB\u89AA\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4
-ParseException.branchLabel=%0 (\u884C%1): case %2\u306F\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
-ParseException.branchName=%0 (\u884C%1): %2\u3068\u3044\u3046\u540D\u524D\u306E\u5206\u5C90\u306F\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
-ParseException.duplicateInit=%0 (\u884C%1): \u521D\u671F\u5316\u5B50\u306B\u306F\u524D\u306E\u521D\u671F\u5316\u5B50\u3068\u540C\u3058\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u3042\u308A\u307E\u3059\u3002\n%2\n%3
-ParseException.duplicateState=%0 (\u884C%1): \u30C7\u30FC\u30BF\u30FB\u30E1\u30F3\u30D0\u30FC%2\u306E\u540D\u524D\u304C\u524D\u306E\u30C7\u30FC\u30BF\u30FB\u30E1\u30F3\u30D0\u30FC\u3068\u540C\u3058\u3067\u3059\u3002\n%3\n%4
-ParseException.elseNoIf=%0 (\u884C%1): \u4E00\u81F4\u3059\u308B#if\u304C\u306A\u3044#else\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%2\n%3
-ParseException.endNoIf=%0 (\u884C%1): \u4E00\u81F4\u3059\u308B#if\u304C\u306A\u3044#endif\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%2\n%3
-ParseException.evaluation=%0 (\u884C%1): %2\n%3\n%4
-ParseException.forwardEntry=%0 (\u884C%1): %2\u3078\u306E\u524D\u65B9\u53C2\u7167\u304C\u3042\u308A\u307E\u3059\u304C\u3001\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\n%3\n%4
-ParseException.forwardedValueBox=%0 (\u884C%1): %2\u306B\u306Fforward\u5BA3\u8A00\u304C\u3042\u308A\u307E\u3059\u3002\u5024\u30DC\u30C3\u30AF\u30B9\u306Fforward\u3068\u3057\u3066\u5BA3\u8A00\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
-ParseException.forwardInheritance=%0 (\u884C%1): %3\u306E\u4E0D\u5B8C\u5168\u306Aforward\u5BA3\u8A00\u304B\u3089\u306E%2\u306E\u7D99\u627F\u306F\u7121\u52B9\u3067\u3059\u3002\n%4\n%5
-ParseException.generic=%0 (\u884C%1): %2\n%3\n%4
-ParseException.illegalArray=%0 (\u884C%1): \u914D\u5217\u306F%2\u306E\u6B63\u3057\u3044\u578B\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n%3\n%4
-ParseException.illegalException=%0 (\u884C%1): \u4F8B\u5916\u3092%2s\u5185\u306B\u8868\u793A\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
-ParseException.invalidConst1=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306F%3\u578B\u3067\u306F\u306A\u304F%2\u578B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%4\n%5
-ParseException.invalidConst2=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306E\u8B58\u5225\u5B50\u306F\u3001%2\u3067\u306F\u306A\u304F\u5B9A\u6570\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4
-ParseException.keywordCollision=%0 (\u884C%1): \u8B58\u5225\u5B50`%2'\u304C\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059\u3002\u5FC5\u8981\u306A\u5834\u5408\u306F\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u8B58\u5225\u5B50\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n%3\n%4
-ParseException.methodClash=%0 (\u884C%1): \u30E1\u30BD\u30C3\u30C9\u540D\u304C\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%2\u3067\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059: %3\u3002\n%4\n%5
-ParseException.moduleNotType=%0 (\u884C%1): %2\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u3067\u3059\u3002\u578B\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
-ParseException.nestedValueBox=%0 (\u884C%1): \u5024\u30DC\u30C3\u30AF\u30B9\u306F\u30CD\u30B9\u30C8\u3067\u304D\u307E\u305B\u3093\u3002\n%2\n%3
-ParseException.noDefault=%0 (\u884C%1): \u8003\u3048\u3089\u308C\u308B\u3059\u3079\u3066\u306Ecase\u304C\u5B8C\u5168\u306B\u9069\u7528\u3055\u308C\u308B\u5834\u5408\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u5206\u5C90\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002\n%2\n%3
-ParseException.nonAbstractParent=%0 (\u884C%1): abstract\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%2\u306F\u975Eabstract\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%3\u304B\u3089\u7D99\u627F\u3067\u304D\u307E\u305B\u3093\u3002\n%4\n%5
-ParseException.nonAbstractParent2=%0 (\u884C%1): abstract\u5024%2\u306F\u975Eabstract\u5024%3\u304B\u3089\u7D99\u627F\u3067\u304D\u307E\u305B\u3093\u3002\n%4\n%5
-ParseException.nonAbstractParent3=%0 (\u884C%1): \u5024%2\u306F\u6307\u5B9A\u3069\u304A\u308A\u306B\u975Eabstract\u5024%3\u304B\u3089\u7D99\u627F\u3067\u304D\u307E\u305B\u3093\u3002\n%4\n%5
-ParseException.notANumber=%0 (\u884C%1): \u6570\u5024\u304C\u5FC5\u8981\u3067\u3059\u3002%2\u306F\u6709\u52B9\u306A\u6570\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n%3\n%4
-ParseException.nothing=%0\u306F\u7A7A\u3067\u3059\u3002\u30B3\u30F3\u30D1\u30A4\u30EB\u3059\u308B\u3082\u306E\u304C\u3042\u308A\u307E\u305B\u3093\u3002
-ParseException.notPosInt=%0 (\u884C%1): %2\u3067\u306F\u306A\u304F\u6B63\u306E\u6574\u6570\u306E\u5B9A\u6570\u304C\u5FC5\u8981\u3067\u3059\u3002\n%3\n%4
-ParseException.oneway=%0 (\u884C%1): %2\u306Foneway\u306B\u306A\u308B\u3088\u3046\u306B\u5BA3\u8A00\u3055\u308C\u307E\u3059\u3002oneway\u30E1\u30BD\u30C3\u30C9\u306F\u3001void\u3092\u8FD4\u3057\u3001\u30D1\u30E9\u30E1\u30FC\u30BF\u5185\u3067\u306E\u307F\u4F7F\u7528\u3057\u3001\u4F8B\u5916\u3092\u767A\u751F\u3057\u306A\u3044\u3088\u3046\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4
-ParseException.operationNotType=%0 (\u884C%1): %2\u306F\u64CD\u4F5C\u3067\u3059\u3002\u578B\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
-ParseException.outOfRange=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306E\u5024%2\u304C\u578B%3\u306E\u7BC4\u56F2\u3092\u8D85\u3048\u3066\u3044\u307E\u3059\u3002\n%4\n%5
-ParseException.recursive=%0 (\u884C%1): \u552F\u4E00\u306E\u6B63\u3057\u3044\u518D\u5E30\u7684\u5B9A\u7FA9\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059: \u30B7\u30FC\u30B1\u30F3\u30B9<%2> %3\u3002\n%4\n%5
-ParseException.selfInherit=%0 (\u884C%1): %2\u3092\u305D\u308C\u81EA\u4F53\u304B\u3089\u7D99\u627F\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
-ParseException.stringTooLong=%0 (\u884C%1): "%2"\u306F%3\u6587\u5B57\u4EE5\u5185\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n%4\n%5
-ParseException.syntax1=%0 (\u884C%1): `%2'\u304C\u5FC5\u8981\u3067\u3059\u304C\u3001`%3'\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%4\n%5
-ParseException.syntax2=%0 (\u884C%1): %2\u306E1\u3064\u304C\u5FC5\u8981\u3067\u3059\u304C\u3001`%3'\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%4\n%5
-ParseException.unclosed=%0: \u30B3\u30E1\u30F3\u30C8\u3067\u4E88\u671F\u3057\u306A\u3044\u30D5\u30A1\u30A4\u30EB\u306E\u7D42\u308F\u308A\u3092\u691C\u51FA\u3057\u307E\u3057\u305F\u3002
-ParseException.undeclaredType=%0 (\u884C%1): %2\u306F\u5BA3\u8A00\u3055\u308C\u3066\u3044\u306A\u3044\u578B\u3067\u3059\u3002\n%3\n%4
-ParseException.warning=%0 (\u884C%1): %2\n%3\n%4
-ParseException.constExprType=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306E\u578B\u306F%2\u3067\u3059\u304C\u3001%3\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%4\n%5
-ParseException.wrongType=%0 (\u884C%1): %2\u306E\u578B\u306F%3\u3067\u3059\u304C\u3001%4\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%5\n%6
-ParseException.illegalIncompleteTypeReference=%0 (\u884C%1): %2\u578B\u306E\u4E0D\u5B8C\u5168\u306Aforward\u5BA3\u8A00\u3078\u306E\u7121\u52B9\u306A\u53C2\u7167\u3067\u3059\u3002\n%3\n%4
-Preprocessor.unknown=\u4E0D\u660E\u306A\u30D7\u30EA\u30D7\u30ED\u30BB\u30C3\u30B5\u30FB\u30C7\u30A3\u30EC\u30AF\u30C6\u30A3\u30D6`%0'\u3067\u3059\u3002\u884C\u306F\u7121\u8996\u3055\u308C\u307E\u3057\u305F\u3002
-Preprocessor.unknownPragma=\u4E0D\u660E\u306A\u30D7\u30E9\u30B0\u30DE`%0'\u3067\u3059\u3002\u884C\u306F\u7121\u8996\u3055\u308C\u307E\u3057\u305F\u3002
-Preprocessor.undefinedName=\u30D7\u30E9\u30B0\u30DE%0\u306E\u578B\u540D\u304C\u672A\u5B9A\u7FA9\u3067\u3059: %1\u3002\u884C\u306F\u7121\u8996\u3055\u308C\u307E\u3057\u305F\u3002
-Token.boolLit=<boolean literal>
-Token.charLit=<character literal>
-Token.intLit=<integer literal>
-Token.floatLit=<floating point literal>
-Token.stringLit=<string literal>
-Token.literal=<literal>
-Token.identifier=<identifier>
-Token.endOfFile=EOF
-Token.unknown=?
-Util.cantCreatePkg=\u30D1\u30C3\u30B1\u30FC\u30B8%0\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3002
-Version.product=IDL\u30D1\u30FC\u30B5\u30FC\u30FB\u30D5\u30EC\u30FC\u30E0\u30EF\u30FC\u30AF\u3001\u30D0\u30FC\u30B8\u30E7\u30F3"%0"
-Version.number=3.2
-default=\u30A8\u30E9\u30FC\u3002\u5B58\u5728\u3057\u306A\u3044\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u30EA\u30AF\u30A8\u30B9\u30C8\u3055\u308C\u307E\u3057\u305F\u3002\u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30D5\u30A1\u30A4\u30EB\u306B\u30AD\u30FC\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093: %0\u3002
-
-# Translator: In the list of options below, do not translate:
-# -i, -d, -keep, -emitAll, -noWarn, -v, -verbose, -version, #define
-# Do not translate the string "java com.sun.tools.corba.se.idl.Compile"
-
-usage=\u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u4F7F\u7528\u65B9\u6CD5:\n java com.sun.tools.corba.se.idl.Compile [options] <idl file>\n<idl file>\u306FIDL\u5B9A\u7FA9\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u3067\u3001\n[options]\u306F\u6B21\u306B\u30EA\u30B9\u30C8\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u3067\u3059\u3002\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\n\u7701\u7565\u53EF\u80FD\u3067\u3001\u4EFB\u610F\u306E\u9806\u5E8F\u3067\u8868\u793A\u3055\u308C\u307E\u3059\u3002<idl file>\u306F\u5FC5\u9808\u3067\u3001\n\u6700\u5F8C\u306B\u8868\u793A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n \n\u30AA\u30D7\u30B7\u30E7\u30F3:\n-d <symbol> IDL\u30D5\u30A1\u30A4\u30EB\u306E\u6B21\u306E\u884C\u3068\n \u540C\u3058\u3067\u3059: #define <symbol>\n-emitAll #included\u30D5\u30A1\u30A4\u30EB\u3067\u898B\u3064\u304B\u3063\u305F\u30BF\u30A4\u30D7\u3092\u542B\u3080\u3001\u3059\u3079\u3066\u306E\u30BF\u30A4\u30D7\u3092\n \u767A\u884C\u3057\u307E\u3059\u3002\n-i <include path> \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u304C\n \u30B9\u30AD\u30E3\u30F3\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u5225\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002\n-keep \u751F\u6210\u3055\u308C\u308B\u30D5\u30A1\u30A4\u30EB\u304C\u3059\u3067\u306B\u5B58\u5728\u3059\u308B\u5834\u5408\u306F\u3001\u4E0A\u66F8\u304D\n \u3057\u307E\u305B\u3093\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u4E0A\u66F8\u304D\u3055\u308C\u307E\u3059\u3002\n-noWarn \u8B66\u544A\u3092\u51FA\u3055\u306A\u3044\u3088\u3046\u306B\u3057\u307E\u3059\u3002\n-v, -verbose \u8A73\u7D30\u30E2\u30FC\u30C9\u3002\n-version \u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n
-
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp b/src/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp
deleted file mode 100644
index aa2279c..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp
+++ /dev/null
@@ -1,177 +0,0 @@
-#
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. 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. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# COMPONENT_NAME: idl.parser
-#
-# ORIGINS: 27
-#
-# Licensed Materials - Property of IBM
-# 5639-D57 (C) COPYRIGHT International Business Machines Corp., 1997, 1999
-# RMI-IIOP v1.0
-#
-
-# Translator: Each line below is of the form "<key>=<message>".
-# The keys are NOT to be translated.
-# The messages ARE to be translated.
-#
-# DO NOT translate the following:
-# ASCII
-# #else
-# #endif
-# IDL
-#
-# %0, %1, etc. are postional parameters to the message. Do not
-# translate these. The number order is the order they are given to
-# the message writer. It is OK to change their order in the message
-# if the language grammar so dictates.
-#
-# Lines of the form "%0 (line %1): <some message>\n%x\n%y" are error
-# messages: %0 is a filename; %1 is a line number; %x is line %1 from
-# %0; %y is the error marker. So the message comes out looking like:
-# <filename> (line xxx): <some message>
-# Line xxx from <filename> where the carat points to the error
-# ^
-# So the first two and the last two parameters of these messages must
-# remain in their positions.
-#
-# A backslash (\) at the end of a line is a line continuation
-# character. A backslash at the beginning of a line means don't
-# ignore leading blanks (they normally are). These backslashes
-# should remain in the message.
-#
-# Translator: Start Translating
-
-Compile.parsing=\u6B63\u5728\u89E3\u6790 %0
-Compile.parseDone=\u5B8C\u6210 - %0
-Compile.generating=\u6B63\u5728\u751F\u6210 %0
-Compile.genDone=\u5B8C\u6210 - %0
-Deprecated.keyword=\u8B66\u544A: \u5173\u952E\u5B57 `%0' \u5DF2\u8FC7\u65F6\u3002
-EvaluationException.1=%0 \u8FD0\u7B97\u7B26\u7684\u64CD\u4F5C\u6570\u4E0D\u4E00\u81F4: %1 \u548C %2\u3002
-EvaluationException.2=%0 \u8FD0\u7B97\u7B26\u7684\u64CD\u4F5C\u6570\u5FC5\u987B\u662F\u6570\u5B57, \u800C\u4E0D\u662F %1\u3002
-EvaluationException.or=\u6309\u4F4D\u6216
-EvaluationException.xor=\u6309\u4F4D\u5F02\u6216
-EvaluationException.and=\u6309\u4F4D\u4E0E
-EvaluationException.plus=\u6DFB\u52A0
-EvaluationException.minus=\u51CF\u6CD5
-EvaluationException.left=\u5411\u5DE6\u79FB\u4F4D
-EvaluationException.right=\u5411\u53F3\u79FB\u4F4D
-EvaluationException.times=\u4E58\u6CD5
-EvaluationException.divide=\u9664\u6CD5
-EvaluationException.mod=\u53D6\u6A21
-EvaluationException.pos=\u4E00\u5143\u6B63\u6570
-EvaluationException.neg=\u4E00\u5143\u8D1F\u6570
-EvaluationException.not=\u6309\u4F4D\u975E
-EvaluationException.booleanNot=\u5E03\u5C14\u975E
-EvaluationException.booleanAnd=\u5E03\u5C14\u4E0E
-EvaluationException.booleanOr=\u5E03\u5C14\u6216
-EvaluationException.equal=\u7B49\u4E8E
-EvaluationException.notEqual=\u4E0D\u7B49\u4E8E
-EvaluationException.greaterThan=\u5927\u4E8E
-EvaluationException.lessThan=\u5C0F\u4E8E
-EvaluationException.greaterEqual=\u5927\u4E8E\u7B49\u4E8E
-EvaluationException.lessEqual=\u5C0F\u4E8E\u7B49\u4E8E
-GenFileStream.1=\u65E0\u6CD5\u751F\u6210%0: %1
-InvalidArgument.1=\u53C2\u6570\u65E0\u6548: %0\u3002
-InvalidArgument.2=\u672A\u6307\u5B9A IDL \u6587\u4EF6\u3002
-InvalidCharacter.1=%0 (\u884C %1): \u5B57\u7B26\u65E0\u6548: %2 (ASCII %3)\u3002\n%4\n%5
-Migration.futureKeyword=\u8B66\u544A: \u6807\u8BC6\u7B26 `%0' \u4E0E\u5173\u952E\u5B57\u51B2\u7A81; \u8BF7\u4F7F\u7528\u8F6C\u4E49\u6807\u8BC6\u7B26\u4EE5\u786E\u4FDD\u5C06\u6765\u517C\u5BB9\u3002
-Migration.keywordCollision=\u8B66\u544A: \u6807\u8BC6\u7B26 `%0' \u4E0E\u5173\u952E\u5B57\u51B2\u7A81; \u8BF7\u4F7F\u7528\u8F6C\u4E49\u6807\u8BC6\u7B26\u4EE5\u786E\u4FDD\u5C06\u6765\u517C\u5BB9\u3002
-ParseException.abstractValueBox=%0 (\u884C %1): \u4E0D\u80FD\u5C06\u503C\u6846\u58F0\u660E\u4E3A\u62BD\u8C61\u3002\n%2\n%3
-ParseException.alreadyDeclared=%0 (\u884C %1): %2\u5DF2\u58F0\u660E\u3002\n%3\n%4
-ParseException.declNotInSameFile=%0 (\u884C %1): %2\u4EE5\u524D\u66FE\u5728\u6587\u4EF6%3\u7684\u524D\u5411\u58F0\u660E\u4E2D\u58F0\u660E\u3002\n%4\n%5
-ParseException.alreadyDerived=%0 (\u884C %1): %2\u5DF2\u58F0\u660E\u4E3A%3\u7684\u7236\u7EA7\u3002\n%4\n%5
-ParseException.alreadyDefaulted=%0 (\u884C %1): \u5DF2\u9047\u5230\u9ED8\u8BA4\u5206\u652F\u3002\n%2\n%3
-ParseException.alreadyRaised=%0 (\u884C %1): %2\u5DF2\u5728 raise \u5B50\u53E5\u4E2D\u6307\u5B9A\u3002\n%3\n%4
-ParseException.attributeNotType=%0 (\u884C %1): %2 \u662F\u5C5E\u6027\u3002\u4E0D\u80FD\u5C06\u5176\u7528\u4F5C\u7C7B\u578B\u3002\n%3\n%4
-ParseException.badAbstract=%0 (\u884C %1): %2\u7684\u524D\u5411\u58F0\u660E\u548C\u5B9E\u9645\u58F0\u660E\u4E0D\u4E00\u81F4\u3002\u4E00\u4E2A\u662F\u62BD\u8C61\u7684, \u800C\u53E6\u4E00\u4E2A\u4E0D\u662F\u62BD\u8C61\u7684\u3002\n%3\n%4
-ParseException.badCustom=%0 (\u884C %1): \u65E0\u6CD5\u5C06\u524D\u5411\u503C\u58F0\u660E\u58F0\u660E\u4E3A\u5B9A\u5236\u3002\n%2\n%3
-ParseException.badRepIDAlreadyAssigned=%0 (\u884C %1): \u5DF2\u5728\u4E0A\u4E00\u4E2A ID \u7F16\u8BD1\u6307\u793A\u6307\u4EE4\u4E2D\u4E3A\u7C7B\u578B%2\u5206\u914D\u4E86\u8D44\u6599\u6863\u6848\u5E93 ID\u3002\n%3\n%4
-ParseException.badRepIDForm=%0 (\u884C %1): \u8D44\u6599\u6863\u6848\u5E93 ID '%2' \u7684\u683C\u5F0F\u5E94\u4E3A '<format>:<string>'\u3002\n%3\n%4
-ParseException.badRepIDPrefix=%0 (\u884C %1): \u63A5\u53E3 %2 \u7684\u8D44\u6599\u6863\u6848\u5E93 ID \u524D\u7F00\u5E94\u4E3A `%3', \u800C\u975E '%4'\u3002\n%5\n%6
-ParseException.badState=%0 (\u884C %1): %2 \u4E0D\u80FD\u662F\u6709\u72B6\u6001\u63A5\u53E3; \u5B83\u5305\u542B\u591A\u4E2A\u6709\u72B6\u6001\u7236\u7EA7\u3002\n%3\n%4
-ParseException.branchLabel=%0 (\u884C %1): case %2\u5DF2\u58F0\u660E\u3002\n%3\n%4
-ParseException.branchName=%0 (\u884C %1): \u540D\u4E3A%2\u7684\u5206\u652F\u5DF2\u58F0\u660E\u3002\n%3\n%4
-ParseException.duplicateInit=%0 (\u884C %1): \u67D0\u4E2A\u521D\u59CB\u5316\u7A0B\u5E8F\u4E0E\u4E0A\u4E00\u4E2A\u521D\u59CB\u5316\u7A0B\u5E8F\u5177\u6709\u76F8\u540C\u7684\u7B7E\u540D\u3002\n%2\n%3
-ParseException.duplicateState=%0 (\u884C %1): \u6570\u636E\u6210\u5458 %2 \u4E0E\u4E0A\u4E00\u4E2A\u6570\u636E\u6210\u5458\u5177\u6709\u76F8\u540C\u7684\u540D\u79F0\u3002\n%3\n%4
-ParseException.elseNoIf=%0 (\u884C %1): \u9047\u5230\u4E86 #else, \u4F46\u6CA1\u6709\u5339\u914D\u7684 #if\u3002\n%2\n%3
-ParseException.endNoIf=%0 (\u884C %1): \u9047\u5230\u4E86 #endif, \u4F46\u6CA1\u6709\u5339\u914D\u7684 #if\u3002\n%2\n%3
-ParseException.evaluation=%0 (\u884C %1): %2\n%3\n%4
-ParseException.forwardEntry=%0 (\u884C %1): \u5B58\u5728\u9488\u5BF9%2\u7684\u524D\u5411\u5F15\u7528, \u4F46\u5B83\u5C1A\u672A\u5B9A\u4E49\u3002\n%3\n%4
-ParseException.forwardedValueBox=%0 (\u884C %1): %2 \u5177\u6709\u524D\u5411\u58F0\u660E\u3002\u4E0D\u80FD\u5BF9\u503C\u6846\u8FDB\u884C\u524D\u5411\u58F0\u660E\u3002\n%3\n%4
-ParseException.forwardInheritance=%0 (\u884C %1): \u5BF9\u4E8E%2, \u4ECE%3\u7684\u4E0D\u5B8C\u6574\u524D\u5411\u58F0\u660E\u8FDB\u884C\u7EE7\u627F\u662F\u975E\u6CD5\u7684\u3002\n%4\n%5
-ParseException.generic=%0 (\u884C %1): %2\n%3\n%4
-ParseException.illegalArray=%0 (\u884C %1): %2\u4E2D\u67D0\u4E2A\u6570\u7EC4\u7684\u7C7B\u578B\u975E\u6CD5\u3002\n%3\n%4
-ParseException.illegalException=%0 (\u884C %1): %2s \u4E2D\u4E0D\u80FD\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF\u3002\n%3\n%4
-ParseException.invalidConst1=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F\u7684\u7C7B\u578B\u5FC5\u987B\u662F%2, \u800C\u4E0D\u80FD\u662F%3\u3002\n%4\n%5
-ParseException.invalidConst2=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F\u4E2D\u7684\u6807\u8BC6\u7B26\u5FC5\u987B\u662F\u5E38\u91CF, \u800C\u4E0D\u80FD\u662F%2\u3002\n%3\n%4
-ParseException.keywordCollision=%0 (\u884C %1): \u6807\u8BC6\u7B26 `%2' \u4E0E\u5173\u952E\u5B57\u51B2\u7A81; \u5982\u6709\u5FC5\u8981, \u8BF7\u4F7F\u7528\u8F6C\u4E49\u6807\u8BC6\u7B26\u3002\n%3\n%4
-ParseException.methodClash=%0 (\u884C %1): \u63A5\u53E3 %2 \u4E2D\u7684\u65B9\u6CD5\u540D\u51B2\u7A81: %3\u3002\n%4\n%5
-ParseException.moduleNotType=%0 (\u884C %1): %2 \u662F\u6A21\u5757\u3002\u4E0D\u80FD\u5C06\u5176\u7528\u4F5C\u7C7B\u578B\u3002\n%3\n%4
-ParseException.nestedValueBox=%0 (\u884C %1): \u503C\u6846\u4E0D\u80FD\u5D4C\u5957\u3002\n%2\n%3
-ParseException.noDefault=%0 (\u884C %1): \u5F53\u5B8C\u5168\u6D89\u53CA\u6240\u6709\u53EF\u80FD\u7684 case \u65F6, \u4E0D\u5141\u8BB8\u4F7F\u7528\u9ED8\u8BA4\u5206\u652F\u3002\n%2\n%3
-ParseException.nonAbstractParent=%0 (\u884C %1): \u62BD\u8C61\u63A5\u53E3 %2 \u4E0D\u80FD\u4ECE\u975E\u62BD\u8C61\u63A5\u53E3 %3 \u7EE7\u627F\u3002\n%4\n%5
-ParseException.nonAbstractParent2=%0 (\u884C %1): \u62BD\u8C61\u503C %2 \u4E0D\u80FD\u4ECE\u975E\u62BD\u8C61\u503C %3 \u7EE7\u627F\u3002\n%4\n%5
-ParseException.nonAbstractParent3=%0 (\u884C %1): \u503C %2 \u4E0D\u80FD\u6839\u636E\u6307\u5B9A\u4ECE\u975E\u62BD\u8C61\u503C %3 \u7EE7\u627F\u3002\n%4\n%5
-ParseException.notANumber=%0 (\u884C %1): \u5E94\u4E3A\u6570\u5B57\u3002%2\u4E0D\u662F\u6709\u6548\u7684\u6570\u5B57\u3002\n%3\n%4
-ParseException.nothing=%0\u4E3A\u7A7A\u3002\u6CA1\u6709\u8981\u7F16\u8BD1\u7684\u5BF9\u8C61\u3002
-ParseException.notPosInt=%0 (\u884C %1): \u5E94\u4E3A\u6B63\u6574\u6570\u5E38\u91CF, \u800C\u975E%2\u3002\n%3\n%4
-ParseException.oneway=%0 (\u884C %1): %2\u5DF2\u58F0\u660E\u4E3A\u5355\u5411\u3002\u5355\u5411\u65B9\u6CD5\u5FC5\u987B: \u8FD4\u56DE\u7A7A\u503C; \u53EA\u6709 in \u53C2\u6570; \u4E0D\u5F15\u53D1\u5F02\u5E38\u9519\u8BEF\u3002\n%3\n%4
-ParseException.operationNotType=%0 (\u884C %1): %2\u662F\u8FD0\u7B97\u3002\u4E0D\u80FD\u5C06\u5176\u7528\u4F5C\u7C7B\u578B\u3002\n%3\n%4
-ParseException.outOfRange=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F %2 \u7684\u503C\u8D85\u51FA\u4E86\u7C7B\u578B%3\u7684\u8303\u56F4\u3002\n%4\n%5
-ParseException.recursive=%0 (\u884C %1): \u552F\u4E00\u7684\u5408\u6CD5\u9012\u5F52\u5B9A\u4E49\u662F: sequence<%2> %3\u3002\n%4\n%5
-ParseException.selfInherit=%0 (\u884C %1): %2 \u4E0D\u80FD\u4ECE\u81EA\u8EAB\u7EE7\u627F\u3002\n%3\n%4
-ParseException.stringTooLong=%0 (\u884C %1): "%2" \u7684\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7 %3 \u4E2A\u5B57\u7B26\u3002\n%4\n%5
-ParseException.syntax1=%0 (\u884C %1): \u5E94\u4E3A `%2'; \u4F46\u9047\u5230 `%3'\u3002\n%4\n%5
-ParseException.syntax2=%0 (\u884C %1): \u5E94\u4E3A %2 \u4E4B\u4E00; \u4F46\u9047\u5230 `%3'\u3002\n%4\n%5
-ParseException.unclosed=%0: \u5728\u6CE8\u91CA\u4E2D\u9047\u5230\u610F\u5916\u7684\u6587\u4EF6\u7ED3\u5C3E\u3002
-ParseException.undeclaredType=%0 (\u884C %1): %2 \u662F\u672A\u58F0\u660E\u7684\u7C7B\u578B\u3002\n%3\n%4
-ParseException.warning=%0 (\u884C %1): %2\n%3\n%4
-ParseException.constExprType=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F\u7684\u7C7B\u578B\u4E3A %2, \u4F46\u5E94\u4E3A %3\u3002\n%4\n%5
-ParseException.wrongType=%0 (\u884C %1): %2\u7684\u7C7B\u578B\u4E3A%3, \u4F46\u5E94\u4E3A%4\u3002\n%5\n%6
-ParseException.illegalIncompleteTypeReference=%0 (\u884C %1): \u5BF9\u7C7B\u578B%2\u7684\u4E0D\u5B8C\u6574\u524D\u5411\u58F0\u660E\u7684\u5F15\u7528\u975E\u6CD5\u3002\n%3\n%4
-Preprocessor.unknown=\u672A\u77E5\u7684\u9884\u5904\u7406\u7A0B\u5E8F\u6307\u4EE4 `%0'\u3002\u5DF2\u5FFD\u7565\u884C\u3002
-Preprocessor.unknownPragma=\u672A\u77E5\u7684\u7F16\u8BD1\u6307\u793A\u6307\u4EE4 `%0'\u3002\u5DF2\u5FFD\u7565\u884C\u3002
-Preprocessor.undefinedName=\u7F16\u8BD1\u6307\u793A %0 \u7684\u672A\u5B9A\u4E49\u7C7B\u578B\u540D: %1\u3002\u5DF2\u5FFD\u7565\u884C\u3002
-Token.boolLit=<\u5E03\u5C14\u6587\u5B57>
-Token.charLit=<\u5B57\u7B26\u6587\u5B57>
-Token.intLit=<\u6574\u578B\u6587\u5B57>
-Token.floatLit=<\u6D6E\u70B9\u6587\u5B57>
-Token.stringLit=<\u5B57\u7B26\u4E32\u6587\u5B57>
-Token.literal=<\u6587\u5B57>
-Token.identifier=<\u6807\u8BC6\u7B26>
-Token.endOfFile=EOF
-Token.unknown=?
-Util.cantCreatePkg=\u65E0\u6CD5\u521B\u5EFA\u7A0B\u5E8F\u5305%0\u3002
-Version.product=IDL \u89E3\u6790\u5668\u6846\u67B6, \u7248\u672C "%0"
-Version.number=3.2
-default=\u9519\u8BEF! \u8BF7\u6C42\u4E86\u4E0D\u5B58\u5728\u7684\u6D88\u606F\u3002\u6D88\u606F\u6587\u4EF6\u672A\u5305\u542B\u5173\u952E\u5B57: %0\u3002
-
-# Translator: In the list of options below, do not translate:
-# -i, -d, -keep, -emitAll, -noWarn, -v, -verbose, -version, #define
-# Do not translate the string "java com.sun.tools.corba.se.idl.Compile"
-
-usage=\u7F16\u8BD1\u5668\u7528\u6CD5:\n java com.sun.tools.corba.se.idl.Compile [\u9009\u9879] <idl \u6587\u4EF6>\n\u5176\u4E2D, <idl \u6587\u4EF6> \u662F\u5305\u542B IDL \u5B9A\u4E49\u7684\u6587\u4EF6\u7684\u540D\u79F0, \u800C\n[\u9009\u9879] \u662F\u4E0B\u5217\u9009\u9879\u7684\u4EFB\u610F\u7EC4\u5408\u3002\u8FD9\u4E9B\u9009\u9879\n\u662F\u53EF\u9009\u7684, \u5E76\u4E14\u663E\u793A\u987A\u5E8F\u5E76\u4E0D\u56FA\u5B9A; <idl \u6587\u4EF6> \u662F\u5FC5\u9700\u7684\n\u5E76\u4E14\u5FC5\u987B\u663E\u793A\u5728\u6700\u540E\u3002\n \n\u9009\u9879:\n-d <\u7B26\u53F7> \u8FD9\u7B49\u540C\u4E8E IDL \u6587\u4EF6\u4E2D\u7684\n \u4E0B\u9762\u4E00\u884C: #define <\u7B26\u53F7>\n-emitAll \u53D1\u51FA\u6240\u6709\u7C7B\u578B, \u5305\u62EC\u5728 #included\n \u6587\u4EF6\u4E2D\u627E\u5230\u7684\u7C7B\u578B\u3002\n-i <\u5305\u542B\u8DEF\u5F84> \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u5C06\u5728\u5F53\u524D\u76EE\u5F55\u4E2D\u626B\u63CF\n \u5305\u542B\u7684\u6587\u4EF6\u3002\u6B64\u9009\u9879\u5C06\u6DFB\u52A0\u53E6\u4E00\u4E2A\u76EE\u5F55\u3002\n-keep \u5982\u679C\u8981\u751F\u6210\u7684\u6587\u4EF6\u5DF2\u5B58\u5728, \u8BF7\u4E0D\u8981\n \u8986\u76D6\u5B83\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4F1A\u8986\u76D6\u5B83\u3002\n-noWarn \u9690\u85CF\u8B66\u544A\u3002\n-v, -verbose \u8BE6\u7EC6\u6A21\u5F0F\u3002\n-version \u663E\u793A\u7248\u672C\u53F7\u3002\n
-
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/ir.idl b/src/share/classes/com/sun/tools/corba/se/idl/ir.idl
deleted file mode 100644
index 921a7cf..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/ir.idl
+++ /dev/null
@@ -1,778 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This file contains OMG IDL from CORBA V2.0, July 1995.
- * It also contains the TypeCode creation APIs in CORBA::ORB
- **/
-
-#pragma prefix "omg.org"
-
-module CORBA {
- typedef string Identifier;
- typedef string ScopedName;
- typedef string RepositoryId;
-
- enum DefinitionKind {
- dk_none, dk_all,
- dk_Attribute, dk_Constant, dk_Exception, dk_Interface,
- dk_Module, dk_Operation, dk_Typedef,
- dk_Alias, dk_Struct, dk_Union, dk_Enum,
- dk_Primitive, dk_String, dk_Sequence, dk_Array,
- dk_Repository,
- dk_Wstring, dk_Fixed,
- dk_Value, dk_ValueBox, dk_ValueMember, // orbos 98-01-18: Objects By Value
- dk_Native
- };
-
-
- interface IRObject
- /**
- An IRObject IDL interface represents the most generic interface
- from which all other Interface Repository interfaces are derived,
- even the Repository itself.
- */
- {
- // read interface
- readonly attribute DefinitionKind def_kind;
-
- // write interface
- void destroy ();
- };
-
-
-
- typedef string VersionSpec;
-
- interface Contained;
- interface Repository;
- interface Container;
-
- interface Contained : IRObject
- /**
- The Contained Interface is inherited by all Interface Repository
- interfaces that are contained by other objects.
- */
- {
- // read/write interface
-
- attribute RepositoryId id;
- attribute Identifier name;
- attribute VersionSpec version;
-
- // read interface
-
- readonly attribute Container defined_in;
- readonly attribute ScopedName absolute_name;
- readonly attribute Repository containing_repository;
-
- struct Description {
- DefinitionKind kind;
- any value;
- };
-
- Description describe ();
-
- // write interface
-
- void move (
- in Container new_container,
- in Identifier new_name,
- in VersionSpec new_version
- );
- };
-
-
- interface ModuleDef;
- interface ConstantDef;
- interface IDLType;
- interface StructDef;
- interface UnionDef;
- interface EnumDef;
- interface AliasDef;
- interface InterfaceDef;
- interface ExceptionDef;
- interface ValueDef; // orbos 98-01-18: Objects By Value
- interface ValueMemberDef; // orbos 98-01-18: Objects By Value
- interface ValueBoxDef; // orbos 98-01-18: Objects By Value
- interface NativeDef;
-
-
- typedef sequence <InterfaceDef> InterfaceDefSeq;
-
-
- typedef sequence <Contained> ContainedSeq;
-
- struct StructMember {
- Identifier name;
- TypeCode type;
- IDLType type_def;
- };
- typedef sequence <StructMember> StructMemberSeq;
-
- struct UnionMember {
- Identifier name;
- any label;
- TypeCode type;
- IDLType type_def;
- };
- typedef sequence <UnionMember> UnionMemberSeq;
-
-
- typedef sequence <Identifier> EnumMemberSeq;
-
- // orbos 98-01-18: Objects By Value -- begin
- typedef short Visibility;
- const Visibility PRIVATE_MEMBER = 0;
- const Visibility PUBLIC_MEMBER = 1;
-
- struct ValueMember {
- Identifier name;
- RepositoryId id;
- RepositoryId defined_in;
- VersionSpec version;
- TypeCode type;
- IDLType type_def;
- Visibility access;
- };
- typedef sequence <ValueMember> ValueMemberSeq;
-
- struct Initializer {
- StructMemberSeq members;
- };
- typedef sequence <Initializer> InitializerSeq;
-
- typedef sequence <ValueDef> ValueDefSeq;
-
- // orbos 98-01-18: Objects By Value -- end
-
-
- interface Container : IRObject
- /**
- The Container interface is used to form a containment hierarchy
- in the Interface Repository. A Container can contain any number
- of objects derived from the Contained interface.
- */
- {
- // read interface
-
- Contained lookup ( in ScopedName search_name);
-
- ContainedSeq contents (
- in DefinitionKind limit_type,
- in boolean exclude_inherited
- );
-
- ContainedSeq lookup_name (
- in Identifier search_name,
- in long levels_to_search,
- in DefinitionKind limit_type,
- in boolean exclude_inherited
- );
-
- struct Description {
- Contained contained_object;
- DefinitionKind kind;
- any value;
- };
-
- typedef sequence<Description> DescriptionSeq;
-
- DescriptionSeq describe_contents (
- in DefinitionKind limit_type,
- in boolean exclude_inherited,
- in long max_returned_objs
- );
-
- // write interface
-
- ModuleDef create_module (
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version
- );
-
- ConstantDef create_constant (
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version,
- in IDLType type,
- in any value
- );
-
- StructDef create_struct (
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version,
- in StructMemberSeq members
- );
-
- UnionDef create_union (
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version,
- in IDLType discriminator_type,
- in UnionMemberSeq members
- );
-
- EnumDef create_enum (
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version,
- in EnumMemberSeq members
- );
-
- AliasDef create_alias (
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version,
- in IDLType original_type
- );
-
- ExceptionDef create_exception (
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version,
- in StructMemberSeq members
- );
-
-
- InterfaceDef create_interface (
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version,
- in boolean is_abstract,
- in InterfaceDefSeq base_interfaces
- );
-
- // orbos 98-01-18: Objects By Value
- ValueDef create_value(
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version,
- in boolean is_custom,
- in boolean is_abstract,
- in octet flags, // must be 0
- in ValueDef base_value,
- in boolean has_safe_base,
- in ValueDefSeq abstract_base_values,
- in InterfaceDefSeq supported_interfaces,
- in InitializerSeq initializers
- );
-
- // orbos 98-01-18: Objects By Value
- ValueBoxDef create_value_box(
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version,
- in IDLType original_type_def
- );
-
- NativeDef create_native(
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version
- );
-
- };
-
-
-
- interface IDLType : IRObject
- /**
- The IDLType interface is an abstract interface inherited by all
- IR objects that represent the OMG IDL types. It provides access
- to the TypeCode describing the type, and is used in defining the
- other interfaces wherever definitions of IDLType must be referenced.
- */
- {
- readonly attribute TypeCode type;
- };
-
-
-
- interface PrimitiveDef;
- interface StringDef;
- interface SequenceDef;
- interface ArrayDef;
-
- enum PrimitiveKind {
- pk_null, pk_void, pk_short, pk_long, pk_ushort, pk_ulong,
- pk_float, pk_double, pk_boolean, pk_char, pk_octet,
- pk_any, pk_TypeCode, pk_Principal, pk_string, pk_objref
- };
-
- interface Repository : Container
- /**
- Repository is an interface that provides global access to the
- Interface Repository. Repository objects can contain constants,
- typedefs, exceptions, interfaces, and modules.
- */
- {
- // read interface
-
- Contained lookup_id (in RepositoryId search_id);
-
- PrimitiveDef get_primitive (in PrimitiveKind kind);
-
- // write interface
-
- StringDef create_string (in unsigned long bound);
-
- SequenceDef create_sequence (
- in unsigned long bound,
- in IDLType element_type
- );
-
- ArrayDef create_array (
- in unsigned long length,
- in IDLType element_type
- );
- };
-
-
- interface ModuleDef : Container, Contained
- /**
- A ModuleDef can contain constants, typedefs, exceptions, interfaces,
- and other module objects.
- */
- {
- };
-
- struct ModuleDescription {
- Identifier name;
- RepositoryId id;
- RepositoryId defined_in;
- VersionSpec version;
- };
-
-
- interface ConstantDef : Contained
- /**
- A ConstantDef object defines a named constant.
- */
- {
- readonly attribute TypeCode type;
- attribute IDLType type_def;
- attribute any value;
- };
-
- struct ConstantDescription {
- Identifier name;
- RepositoryId id;
- RepositoryId defined_in;
- VersionSpec version;
- TypeCode type;
- any value;
- };
-
-
- interface TypedefDef : Contained, IDLType
- /**
- TypedefDef is an abstract interface used as a base interface for
- all named non-object types(structures, unions, enumerations,
- aliases). The TypedefDef interface is not inherited by the definition
- objects for the primitive or anonymous types.
- */
- {
- };
-
- struct TypeDescription {
- Identifier name;
- RepositoryId id;
- RepositoryId defined_in;
- VersionSpec version;
- TypeCode type;
- };
-
-
- interface StructDef : TypedefDef, Container
- /**
- A StructDef represents an OMG IDL structure definition.
- */
- {
- attribute StructMemberSeq members;
- };
-
-
- interface UnionDef : TypedefDef, Container
- /**
- A UnionDef represents an OMG IDL union definition.
- */
- {
- readonly attribute TypeCode discriminator_type;
- attribute IDLType discriminator_type_def;
- attribute UnionMemberSeq members;
- };
-
-
- interface EnumDef : TypedefDef
- /**
- A EnumDef represents an OMG IDL enum definition.
- */
- {
- attribute EnumMemberSeq members;
- };
-
-
- interface AliasDef : TypedefDef
- /**
- An AliasDef represents an OMG IDL typedef that aliases other
- definition.
- */
- {
- attribute IDLType original_type_def;
- };
-
-
- interface PrimitiveDef: IDLType
- /**
- A PrimitiveDef represents one of the IDL primitive types. As
- primitive types are unnamed, this interface is not derived from
- TypedefDef or Contained.
- */
- {
- readonly attribute PrimitiveKind kind;
- };
-
-
- interface StringDef : IDLType
- /**
- A StringDef represents an OMG IDL string type. As string
- types are anonymous, this interface is not derived from TypedefDef
- or Contained.
- */
- {
- attribute unsigned long bound;
- };
-
-
- interface SequenceDef : IDLType
- /**
- A SequenceDef represents an OMG IDL sequence type. As sequence
- types are anonymous, this interface is not derived from TypedefDef
- or Contained.
- */
- {
- attribute unsigned long bound;
- readonly attribute TypeCode element_type;
- attribute IDLType element_type_def;
- };
-
- interface ArrayDef : IDLType
- /**
- An ArrayDef represents an OMG IDL array type. As array
- types are anonymous, this interface is not derived from TypedefDef
- or Contained.
- */
- {
- attribute unsigned long length;
- readonly attribute TypeCode element_type;
- attribute IDLType element_type_def;
- };
-
-
- interface ExceptionDef : Contained, Container
- /**
- An ExceptionDef represents an exception definition.
- */
- {
- readonly attribute TypeCode type;
- attribute StructMemberSeq members;
- };
- struct ExceptionDescription {
- Identifier name;
- RepositoryId id;
- RepositoryId defined_in;
- VersionSpec version;
- TypeCode type;
- };
-
-
-
- enum AttributeMode {ATTR_NORMAL, ATTR_READONLY};
-
- interface AttributeDef : Contained
- /**
- An AttributeDef represents the information that defines an
- attribute of an interface.
- */
- {
- readonly attribute TypeCode type;
- attribute IDLType type_def;
- attribute AttributeMode mode;
- };
-
- struct AttributeDescription {
- Identifier name;
- RepositoryId id;
- RepositoryId defined_in;
- VersionSpec version;
- TypeCode type;
- AttributeMode mode;
- };
-
-
-
- enum OperationMode {OP_NORMAL, OP_ONEWAY};
-
- enum ParameterMode {PARAM_IN, PARAM_OUT, PARAM_INOUT};
- struct ParameterDescription {
- Identifier name;
- TypeCode type;
- IDLType type_def;
- ParameterMode mode;
- };
- typedef sequence <ParameterDescription> ParDescriptionSeq;
-
- typedef Identifier ContextIdentifier;
- typedef sequence <ContextIdentifier> ContextIdSeq;
-
- typedef sequence <ExceptionDef> ExceptionDefSeq;
- typedef sequence <ExceptionDescription> ExcDescriptionSeq;
-
- interface OperationDef : Contained
- /**
- An OperationDef represents the information that defines an
- operation of an interface.
- */
- {
- readonly attribute TypeCode result;
- attribute IDLType result_def;
- attribute ParDescriptionSeq params;
- attribute OperationMode mode;
- attribute ContextIdSeq contexts;
- attribute ExceptionDefSeq exceptions;
- };
-
- struct OperationDescription {
- Identifier name;
- RepositoryId id;
- RepositoryId defined_in;
- VersionSpec version;
- TypeCode result;
- OperationMode mode;
- ContextIdSeq contexts;
- ParDescriptionSeq parameters;
- ExcDescriptionSeq exceptions;
- };
-
-
-
- typedef sequence <RepositoryId> RepositoryIdSeq;
- typedef sequence <OperationDescription> OpDescriptionSeq;
- typedef sequence <AttributeDescription> AttrDescriptionSeq;
-
- interface InterfaceDef : Container, Contained, IDLType
- /**
- An InterfaceDef object represents an interface definition. It can
- contains constants, typedefs, exceptions, operations, and
- attributes.
- */
- {
- // read/write interface
-
- attribute InterfaceDefSeq base_interfaces;
- attribute boolean is_abstract;
-
- // read interface
-
- boolean is_a (in RepositoryId interface_id);
-
- struct FullInterfaceDescription {
- Identifier name;
- RepositoryId id;
- RepositoryId defined_in;
- VersionSpec version;
- boolean is_abstract;
- OpDescriptionSeq operations;
- AttrDescriptionSeq attributes;
- RepositoryIdSeq base_interfaces;
- TypeCode type;
- };
-
- FullInterfaceDescription describe_interface();
-
- // write interface
-
- AttributeDef create_attribute (
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version,
- in IDLType type,
- in AttributeMode mode
- );
-
- OperationDef create_operation (
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version,
- in IDLType result,
- in OperationMode mode,
- in ParDescriptionSeq params,
- in ExceptionDefSeq exceptions,
- in ContextIdSeq contexts
- );
- };
-
- struct InterfaceDescription {
- Identifier name;
- RepositoryId id;
- RepositoryId defined_in;
- VersionSpec version;
- RepositoryIdSeq base_interfaces;
- };
-
-
- // orbos 98-01-18: Objects By Value -- begin
-
- interface ValueMemberDef : Contained
-
- /** A <code>ValueMemberDef</code> object represents the public
- and private data member definition of a <code>Value</code> type
- */
-
- {
- readonly attribute TypeCode type;
- attribute IDLType type_def;
- attribute Visibility access;
- };
-
- interface ValueDef : Container, Contained, IDLType
- /**
- A ValueDef object represents the definition of the
- <code>Value</code> object used to pass the object state
- between hosts
- */
-
- {
- // read/write interface
- attribute InterfaceDefSeq supported_interfaces;
- attribute InitializerSeq initializers;
- attribute ValueDef base_value;
- attribute ValueDefSeq abstract_base_values;
- attribute boolean is_abstract;
- attribute boolean is_custom;
- attribute octet flags; // always 0
- attribute boolean has_safe_base;
-
- // read interface
- boolean is_a(in RepositoryId value_id);
-
- struct FullValueDescription {
- Identifier name;
- RepositoryId id;
- boolean is_abstract;
- boolean is_custom;
- octet flags; // always 0
- RepositoryId defined_in;
- VersionSpec version;
- OpDescriptionSeq operations;
- AttrDescriptionSeq attributes;
- ValueMemberSeq members;
- InitializerSeq initializers;
- RepositoryIdSeq supported_interfaces;
- RepositoryIdSeq abstract_base_values;
- boolean has_safe_base;
- RepositoryId base_value;
- TypeCode type;
- };
-
- FullValueDescription describe_value();
-
- // write interface
-
- ValueMemberDef create_value_member(
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version,
- in IDLType type_def,
- in Visibility access
- );
-
- AttributeDef create_attribute(
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version,
- in IDLType type,
- in AttributeMode mode
- );
-
- OperationDef create_operation(
- in RepositoryId id,
- in Identifier name,
- in VersionSpec version,
- in IDLType result,
- in OperationMode mode,
- in ParDescriptionSeq params,
- in ExceptionDefSeq exceptions,
- in ContextIdSeq contexts
- );
- };
- struct ValueDescription {
- Identifier name;
- RepositoryId id;
- boolean is_abstract;
- boolean is_custom;
- octet flags; // always 0
- RepositoryId defined_in;
- VersionSpec version;
- RepositoryIdSeq supported_interfaces;
- RepositoryIdSeq abstract_base_values;
- boolean has_safe_base;
- RepositoryId base_value;
- };
-
- interface ValueBoxDef : IDLType
-
- /** ValueBoxDef is an interface that reresents a value type with
- a single data member inside its state section and no
- inheritance or methods. For example, when transmitting a
- string or sequence as an actual parameter on an interface
- operation or as a data member of a value type that is an
- actual parameter, it may be important to preserve any sharing
- of the string or sequence within the object graph being
- transmitted. Because current IDL data types do not preserve
- referential integrity in this way, this requirement is
- conveniently handled by using a value type. Value types also
- support the transmission of nulls (as a distinguished value),
- whereas IDL data types such as string and sequence (which are
- mapped to empty strings and sequences) do not. The Java to IDL
- mapping requires both preservation of referential integrity
- and transmission of nulls. Because it would be cumbersome to
- require the full IDL syntax for a value type for this specific
- usage, this shorthand notation is introduced to cover this use
- of value types for simple containment of a single data member.
- */
-
-{
- attribute IDLType original_type_def;
- };
-
- // orbos 98-01-18: Objects By Value -- end
-
- interface NativeDef : TypedefDef {
- };
-};
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/keywords b/src/share/classes/com/sun/tools/corba/se/idl/keywords
deleted file mode 100644
index fddd6f2..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/keywords
+++ /dev/null
@@ -1,81 +0,0 @@
-IDL Tokens:
-
-Grouping: ( ) [ ] { }
-Separators: : :: ;
-Operators: % & * + , - / < << = > >> ^ | ~
-
-Keywords:
- CORBA 2.2 or earlier:
- any
- attribute
- boolean
- case
- char
- const
- context
- default
- double
- enum
- exception
- FALSE
- float
- in
- inout
- interface
- long
- module
- Object
- octet
- oneway
- out
- raises
- readonly
- sequence
- short
- string
- struct
- switch
- TRUE
- typedef
- unsigned
- union
- void
- wchar
- wstring
-
- CORBA 2.3 only:
- init (replaced by factory)
-
- CORBA 2.3 and 2.4rtf:
- abstract
- custom
- private
- public
- truncatable
- ValueBase
- valuetype
- factory
-
- CORBA 2.3, not supported by IBM compiler
- native
- fixed
-
- CORBA 3.0:
- component
- consumes
- emits
- finder
- getRaises
- home
- import
- local
- manages
- multiple
- primaryKey
- provides
- publishes
- setRaises
- supports
- typeId
- typePrefix
- uses
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/orb.idl b/src/share/classes/com/sun/tools/corba/se/idl/orb.idl
deleted file mode 100644
index 81ed1af..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/orb.idl
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// IDL not generated by rmic, do not edit
-// These are all in IDL module CORBA
-// The Java classes are in the package org.omg.CORBA
-// See ValueType Semantics:Standard Value Box Definitions (5.3) in CORBA 2.3 spec
-
-#ifndef __org_omg_CORBA__
-#define __org_omg_CORBA__
-
-#pragma prefix "omg.org"
-
-module CORBA{
-
- valuetype StringValue string;
- valuetype WStringValue wstring;
-
-};
-
-#include "ir.idl"
-
-#pragma prefix ""
-
-#endif
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/som/cff/FileLocator.java b/src/share/classes/com/sun/tools/corba/se/idl/som/cff/FileLocator.java
deleted file mode 100644
index 939de10..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/som/cff/FileLocator.java
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997,1998
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.som.cff;
-
-import java.lang.Exception;
-import java.lang.String;
-import java.lang.System;
-import java.io.BufferedInputStream;
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.io.IOException;
-import java.util.Locale;
-import java.util.NoSuchElementException;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import java.util.zip.*;
-
-/**
- * FileLocator is an abstract class (one that cannot be instantiated) that
- * provides class methods for finding files in the directories or zip
- * archives that make up the CLASSPATH.
- *
- * @author Larry K. Raper
- */
-public abstract class FileLocator extends Object {
-
- /* Class variables */
-
-
- static final Properties pp = System.getProperties ();
- static final String classPath = pp.getProperty ("java.class.path", ".");
- static final String pathSeparator = pp.getProperty ("path.separator", ";");
-
- /* Instance variables */
-
- /* [None, no instances of this class are ever instantiated.] */
-
- /**
- * locateClassFile returns a DataInputStream with mark/reset
- * capability that can be used to read the requested class file. The
- * CLASSPATH is used to locate the class.
- *
- * @param classFileName The name of the class to locate. The class name
- * should be given in fully-qualified form, for example:
- * <pre>
- * java.lang.Object
- * java.io.DataInputStream
- * </pre>
- *
- * @exception java.io.FileNotFoundException The requested class file
- * could not be found.
- * @exception java.io.IOException The requested class file
- * could not be opened.
- */
- public static DataInputStream locateClassFile (String classFileName)
- throws FileNotFoundException, IOException {
-
- boolean notFound = true;
- StringTokenizer st;
- String path = "";
- String pathNameForm;
- File cf = null;
- NamedDataInputStream result;
-
- st = new StringTokenizer (classPath, pathSeparator, false);
- pathNameForm = classFileName.replace ('.', File.separatorChar) +
- ".class";
-
- while (st.hasMoreTokens () && notFound) {
-
- try {path = st.nextToken ();}
- catch (NoSuchElementException nse) {break;}
- int pLen = path.length ();
- String pathLast4 = pLen > 3 ? path.substring (pLen - 4) : "";
- if (pathLast4.equalsIgnoreCase (".zip") ||
- pathLast4.equalsIgnoreCase (".jar")) {
-
- try {
-
- result = locateInZipFile (path, classFileName, true, true);
- if (result == null)
- continue;
- return (DataInputStream) result;
-
- } catch (ZipException zfe) {
- continue;
- } catch (IOException ioe) {
- continue;
- }
-
- } else {
- try {cf = new File (path + File.separator + pathNameForm);
- } catch (NullPointerException npe) { continue; }
- if ((cf != null) && cf.exists ())
- notFound = false;
- }
- }
-
- if (notFound) {
-
- /* Make one last attempt to find the file in the current
- * directory
- */
-
- int lastdot = classFileName.lastIndexOf ('.');
- String simpleName =
- (lastdot >= 0) ? classFileName.substring (lastdot+1) :
- classFileName;
-
- result = new NamedDataInputStream (new BufferedInputStream (
- new FileInputStream (simpleName + ".class")),
- simpleName + ".class", false);
- return (DataInputStream) result;
- }
-
- result = new NamedDataInputStream (new BufferedInputStream (
- new FileInputStream (cf)), path + File.separator + pathNameForm,
- false);
- return (DataInputStream) result;
-
- }
-
- /**
- * locateLocaleSpecificFileInClassPath returns a DataInputStream that
- * can be used to read the requested file, but the name of the file is
- * determined using information from the current locale and the supplied
- * file name (which is treated as a "base" name, and is supplemented with
- * country and language related suffixes, obtained from the current
- * locale). The CLASSPATH is used to locate the file.
- *
- * @param fileName The name of the file to locate. The file name
- * may be qualified with a partial path name, using '/' as the separator
- * character or using separator characters appropriate for the host file
- * system, in which case each directory or zip file in the CLASSPATH will
- * be used as a base for finding the fully-qualified file.
- * Here is an example of how the supplied fileName is used as a base
- * for locating a locale-specific file:
- *
- * <pre>
- * Supplied fileName: a/b/c/x.y, current locale: US English
- *
- * Look first for: a/b/c/x_en_US.y
- * (if that fails) Look next for: a/b/c/x_en.y
- * (if that fails) Look last for: a/b/c/x.y
- *
- * All elements of the class path are searched for each name,
- * before the next possible name is tried.
- * </pre>
- *
- * @exception java.io.FileNotFoundException The requested class file
- * could not be found.
- * @exception java.io.IOException The requested class file
- * could not be opened.
- */
- public static DataInputStream locateLocaleSpecificFileInClassPath (
- String fileName) throws FileNotFoundException, IOException {
-
- String localeSuffix = "_" + Locale.getDefault ().toString ();
- int lastSlash = fileName.lastIndexOf ('/');
- int lastDot = fileName.lastIndexOf ('.');
- String fnFront, fnEnd;
- DataInputStream result = null;
- boolean lastAttempt = false;
-
- if ((lastDot > 0) && (lastDot > lastSlash)) {
- fnFront = fileName.substring (0, lastDot);
- fnEnd = fileName.substring (lastDot);
- } else {
- fnFront = fileName;
- fnEnd = "";
- }
-
- while (true) {
- if (lastAttempt)
- result = locateFileInClassPath (fileName);
- else try {
- result = locateFileInClassPath (fnFront + localeSuffix + fnEnd);
- } catch (Exception e) { /* ignore */ }
- if ((result != null) || lastAttempt)
- break;
- int lastUnderbar = localeSuffix.lastIndexOf ('_');
- if (lastUnderbar > 0)
- localeSuffix = localeSuffix.substring (0, lastUnderbar);
- else
- lastAttempt = true;
- }
- return result;
-
- }
-
- /**
- * locateFileInClassPath returns a DataInputStream that can be used
- * to read the requested file. The CLASSPATH is used to locate the file.
- *
- * @param fileName The name of the file to locate. The file name
- * may be qualified with a partial path name, using '/' as the separator
- * character or using separator characters appropriate for the host file
- * system, in which case each directory or zip file in the CLASSPATH will
- * be used as a base for finding the fully-qualified file.
- *
- * @exception java.io.FileNotFoundException The requested class file
- * could not be found.
- * @exception java.io.IOException The requested class file
- * could not be opened.
- */
- public static DataInputStream locateFileInClassPath (String fileName)
- throws FileNotFoundException, IOException {
-
- boolean notFound = true;
- StringTokenizer st;
- String path = "";
- File cf = null;
- NamedDataInputStream result;
-
- String zipEntryName = File.separatorChar == '/' ? fileName :
- fileName.replace (File.separatorChar, '/');
-
- String localFileName = File.separatorChar == '/' ? fileName :
- fileName.replace ('/', File.separatorChar);
-
- st = new StringTokenizer (classPath, pathSeparator, false);
-
- while (st.hasMoreTokens () && notFound) {
-
- try {path = st.nextToken ();}
- catch (NoSuchElementException nse) {break;}
- int pLen = path.length ();
- String pathLast4 = pLen > 3 ? path.substring (pLen - 4) : "";
- if (pathLast4.equalsIgnoreCase (".zip") ||
- pathLast4.equalsIgnoreCase (".jar")) {
-
- try {
-
- result = locateInZipFile (path, zipEntryName, false, false);
- if (result == null)
- continue;
- return (DataInputStream) result;
-
- } catch (ZipException zfe) {
- continue;
- } catch (IOException ioe) {
- continue;
- }
-
- } else {
- try {cf = new File (path + File.separator + localFileName);
- } catch (NullPointerException npe) { continue; }
- if ((cf != null) && cf.exists ())
- notFound = false;
- }
- }
-
- if (notFound) {
-
- /* Make one last attempt to find the file in the current
- * directory
- */
-
- int lastpart = localFileName.lastIndexOf (File.separator);
- String simpleName =
- (lastpart >= 0) ? localFileName.substring (lastpart+1) :
- localFileName;
-
- result = new NamedDataInputStream (new BufferedInputStream (
- new FileInputStream (simpleName)), simpleName, false);
- return (DataInputStream) result;
- }
-
- result = new NamedDataInputStream (new BufferedInputStream (
- new FileInputStream (cf)), path + File.separator + localFileName,
- false);
- return (DataInputStream) result;
-
- }
-
- /**
- * Returns the fully qualified file name associated with the passed
- * DataInputStream <i>if the DataInputStream was created using one
- * of the static locate methods supplied with this class</i>, otherwise
- * returns a zero length string.
- */
- public static String getFileNameFromStream (DataInputStream ds) {
-
- if (ds instanceof NamedDataInputStream)
- return ((NamedDataInputStream) ds).fullyQualifiedFileName;
- return "";
-
- }
-
- /**
- * Returns an indication of whether the passed DataInputStream is
- * associated with a member of a zip file <i>if the DataInputStream was
- * created using one of the static locate methods supplied with this
- * class</i>, otherwise returns false.
- */
- public static boolean isZipFileAssociatedWithStream (DataInputStream ds) {
-
- if (ds instanceof NamedDataInputStream)
- return ((NamedDataInputStream) ds).inZipFile;
- return false;
-
- }
-
- private static NamedDataInputStream locateInZipFile (String zipFileName,
- String fileName, boolean wantClass, boolean buffered)
- throws ZipException, IOException {
-
- ZipFile zf;
- ZipEntry ze;
- zf = new ZipFile (zipFileName);
-
- if (zf == null)
- return null;
- String zeName = wantClass ?
- fileName.replace ('.', '/') + ".class" :
- fileName;
-
- // This code works with JDK 1.0 level SUN zip classes
- //
-
- // ze = zf.get (zeName);
- // if (ze == null)
- // return null;
- // return new NamedDataInputStream (
- // new BufferedInputStream (new ZipInputStream (ze)),
- // zipFileName + '(' +zeName + ')', true);
-
- // This code works with JDK 1.0.2 and JDK 1.1 level SUN zip classes
- //
-
- ze = zf.getEntry (zeName);
- if (ze == null) {
- zf.close(); // D55355, D56419
- zf = null;
- return null;
- }
- InputStream istream = zf.getInputStream(ze);
- if (buffered)
- istream = new BufferedInputStream(istream);
- return new NamedDataInputStream (istream,
- zipFileName + '(' + zeName + ')', true);
-
- }
-
-}
-
-/**
- * This class is used to associate a filename with a DataInputStream
- * The host platform's file naming conventions are assumed for the filename.
- *
- * @author Larry K. Raper
- *
- */
-/* default access */ class NamedDataInputStream extends DataInputStream {
-
- /* Instance variables */
-
- /**
- * The name of the file associated with the DataInputStream.
- */
- public String fullyQualifiedFileName;
-
- /**
- * Indicates whether or not the file is contained in a .zip file.
- */
- public boolean inZipFile;
-
- /* Constructors */
-
- protected NamedDataInputStream (InputStream in, String fullyQualifiedName,
- boolean inZipFile) {
-
- super (in);
- this.fullyQualifiedFileName = fullyQualifiedName;
- this.inZipFile = inZipFile;
-
- }
-
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/som/cff/Messages.java b/src/share/classes/com/sun/tools/corba/se/idl/som/cff/Messages.java
deleted file mode 100644
index 60dd7c3..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/som/cff/Messages.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997,1998
- * RMI-IIOP v1.0
- *
- * Defect History
- *
- * #26964 LKR 11/25/96 \u0020 at end-of-message not handled properly by Java.
- * #31840 LKR 06/05/97 Replace \n in templates with Java's line separator.
- *
- */
-
-package com.sun.tools.corba.se.idl.som.cff;
-
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Properties;
-import java.lang.String;
-import java.lang.System;
-
-/**
- * This class provides messaging services for accessing, and merging
- * parameters into, translatable message text. The text is presumed
- * to reside in a .properties file. A "cff.properties" file that
- * contains all of the message text needed for the CFF framework itself
- * is loaded during class initialization. All of the messages in the
- * cff.properties file that are needed by the CFF framework contain keys
- * that begin with the string "cff.".
- * <p>
- * The static method Messages.msgLoad may be used to merge additional
- * message text .properties files needed by other frameworks or user
- * programs.
- *
- * @see com.sun.tools.corba.se.idl.som.cff.Messages#msgLoad
- *
- * @author Larry K. Raper
- */
-
-public abstract class Messages {
-
- /* Class variables */
-
-
- /* Metasymbol for leading or trailing blank */
- private static final String LTB = "%B";
- /* Metasymbol for line separator */
- private static final char NL = '\n';
-
- private static final String lineSeparator =
- System.getProperty ("line.separator");
-
- private static final Properties m = new Properties ();
- private static boolean loadNeeded = true;
-
- /* Class methods for message loading and formatting */
-
- private static final synchronized void loadDefaultProperties () {
-
- if (!loadNeeded)
- return;
- try {
- m.load (FileLocator.locateLocaleSpecificFileInClassPath (
- "com/sun/tools/corba/se/idl/som/cff/cff.properties"));
- } catch (IOException ioe) { }
- fixMessages (m); /* #26964 Replace any metasymbols */
- loadNeeded = false;
-
- }
-
- /**
- * This method was introduced to fix defect #26964. For Java 1.0.2
- * on Win NT, the escape sequence \u0020 was not being handled
- * correctly by the Java Properties class when it was the final
- * character of a line. Instead the trailing blank was dropped
- * and the next line was swallowed as a continuation. To work
- * around the problem, we introduced our own metasymbol to represent
- * a trailing blank. Hence:
- *
- * Performs substitution for any metasymbols in the message
- * templates. So far only %B is needed. This was introduced
- * to make it more convenient for .properties files to
- * contain message templates with leading or trailing blanks
- * (although %B may actually occur anywhere in a template).
- * Subsequently, checking for '\n' has also been added. Now,
- * wherever '\n' occurs in a message template, it is replaced
- * with the value of System.getProperty ("line.separator").
- */
- private static final void fixMessages (Properties p) {
-
- Enumeration keys = p.keys ();
- Enumeration elems = p.elements ();
- while (keys.hasMoreElements ()) {
- String key = (String) keys.nextElement ();
- String elem = (String) elems.nextElement ();
- int i = elem.indexOf (LTB);
- boolean changed = false;
- while (i != -1) {
- if (i == 0)
- elem = " " + elem.substring (2);
- else
- elem = elem.substring (0, i) + " " + elem.substring (i+2);
- changed = true;
- i = elem.indexOf (LTB);
- }
- int lsIncr = lineSeparator.length () - 1;
- for (i=0; i<elem.length (); i++) {
- if (elem.charAt (i) == NL) {
- elem = elem.substring (0, i) +
- lineSeparator + elem.substring (i+1);
- i += lsIncr;
- changed = true;
- }
- }
- if (changed)
- p.put (key, elem);
- }
-
- }
-
- /**
- * Loads additional message keys and text found in the passed
- * properties file. The specified properties file is assumed to
- * reside in the CLASSPATH. An IOException is thrown if the loading fails.
- */
- public static final synchronized void msgLoad (String propertyFileName)
- throws IOException {
-
- m.load (FileLocator.locateLocaleSpecificFileInClassPath (
- propertyFileName));
- fixMessages (m); /* #26964 Replace any metasymbols */
- loadNeeded = false;
-
- }
-
- /**
- * Returns the message text corresponding to the passed msgkey
- * string. If the msgkey cannot be found, its value is returned
- * as the output message text.
- */
- public static final String msg (String msgkey) {
-
- if (loadNeeded)
- loadDefaultProperties ();
- String msgtext = m.getProperty (msgkey, msgkey);
- return msgtext;
-
- }
-
- /**
- * Returns the message text corresponding to the passed msgkey
- * string. The message text is assumed to require the insertion
- * of a single argument, supplied by the "parm" parameter.
- * If the message text does not contain the meta characters "%1"
- * that indicate where to place the argument, the passed argument
- * is appended at the end of the message text.
- * <p>
- * If the msgkey cannot be found, its value is used as the
- * message text.
- */
- public static final String msg (String msgkey, String parm) {
-
- if (loadNeeded)
- loadDefaultProperties ();
- String msgtext = m.getProperty (msgkey, msgkey);
- int i = msgtext.indexOf ("%1");
- if (i >= 0) {
- String ending = "";
- if ((i+2) < msgtext.length ())
- ending = msgtext.substring (i+2);
- return msgtext.substring (0, i) + parm + ending;
- } else
- msgtext += " " + parm;
- return msgtext;
-
- }
-
- /**
- * Returns the message text corresponding to the passed msgkey
- * string. The message text is assumed to require the insertion
- * of a single argument, supplied by the "parm" parameter.
- * If the message text does not contain the meta characters "%1"
- * that indicate where to place the argument, the passed argument
- * is appended at the end of the message text.
- * <p>
- * If the msgkey cannot be found, its value is used as the
- * message text.
- */
- public static final String msg (String msgkey, int parm) {
-
- return msg (msgkey, String.valueOf (parm));
-
- }
-
- /**
- * Returns the message text corresponding to the passed msgkey
- * string. The message text is assumed to require the insertion
- * of two arguments, supplied by the "parm1" and "parm2" parameters.
- * If the message text does not contain the meta characters "%1" and
- * "%2" that indicate where to place the arguments, the passed arguments
- * are appended at the end of the message text.
- * <p>
- * If the msgkey cannot be found, its value is used as the
- * message text.
- */
- public static final String msg (String msgkey, String parm1, String parm2) {
-
- if (loadNeeded)
- loadDefaultProperties ();
- String result = m.getProperty (msgkey, msgkey);
- String ending = "";
- int i = result.indexOf ("%1");
- if (i >= 0) {
- if ((i+2) < result.length ())
- ending = result.substring (i+2);
- result = result.substring (0, i) + parm1 + ending;
- } else
- result += " " + parm1;
- i = result.indexOf ("%2");
- if (i >= 0) {
- ending = "";
- if ((i+2) < result.length ())
- ending = result.substring (i+2);
- result = result.substring (0, i) + parm2 + ending;
- } else
- result += " " + parm2;
- return result;
-
- }
-
- /**
- * Returns the message text corresponding to the passed msgkey
- * string. The message text is assumed to require the insertion
- * of two arguments, supplied by the "parm1" and "parm2" parameters.
- * If the message text does not contain the meta characters "%1" and
- * "%2" that indicate where to place the arguments, the passed arguments
- * are appended at the end of the message text.
- * <p>
- * If the msgkey cannot be found, its value is used as the
- * message text.
- */
- public static final String msg (String msgkey, int parm1, String parm2) {
-
- return msg (msgkey, String.valueOf (parm1), parm2);
-
- }
-
- /**
- * Returns the message text corresponding to the passed msgkey
- * string. The message text is assumed to require the insertion
- * of two arguments, supplied by the "parm1" and "parm2" parameters.
- * If the message text does not contain the meta characters "%1" and
- * "%2" that indicate where to place the arguments, the passed arguments
- * are appended at the end of the message text.
- * <p>
- * If the msgkey cannot be found, its value is used as the
- * message text.
- */
- public static final String msg (String msgkey, String parm1, int parm2) {
-
- return msg (msgkey, parm1, String.valueOf (parm2));
-
- }
-
- /**
- * Returns the message text corresponding to the passed msgkey
- * string. The message text is assumed to require the insertion
- * of two arguments, supplied by the "parm1" and "parm2" parameters.
- * If the message text does not contain the meta characters "%1" and
- * "%2" that indicate where to place the arguments, the passed arguments
- * are appended at the end of the message text.
- * <p>
- * If the msgkey cannot be found, its value is used as the
- * message text.
- */
- public static final String msg (String msgkey, int parm1, int parm2) {
-
- return msg (msgkey, String.valueOf (parm1), String.valueOf (parm2));
-
- }
-
-
- /**
- * Returns the message text corresponding to the passed msgkey
- * string. The message text is assumed to require the insertion
- * of three arguments, supplied by the "parm1", "parm2" and "parm3"
- * parameters.
- * If the message text does not contain the meta characters "%1" and
- * "%2" that indicate where to place the arguments, the passed arguments
- * are appended at the end of the message text.
- * <p>
- * If the msgkey cannot be found, its value is used as the
- * message text.
- */
- public static final String msg (String msgkey, String parm1,
- String parm2, String parm3) {
- if (loadNeeded)
- loadDefaultProperties ();
- String result = m.getProperty (msgkey, msgkey);
- result = substituteString(result, 1, parm1);
- result = substituteString(result, 2, parm2);
- result = substituteString(result, 3, parm3);
-
- return result;
- }
-
- /* helper function for string substition.
- @return the substituted string, it substitution is possible.
- Otherwise, return a new string with subst at the end.
- @orig: original string
- @paramNum the parameter number to search. For example,
- paramNam == 1 means search for "%1".
- @subst: string for the substitution.
- */
- private static String substituteString(String orig, int paramNum,
- String subst){
- String result = orig;
- String paramSubst = "%"+ paramNum;
- int len = paramSubst.length();
- int index = result.indexOf (paramSubst);
- String ending = "";
- if (index >= 0) {
- if ((index+len) < result.length ())
- ending = result.substring (index+len);
- result = result.substring (0, index) + subst + ending;
- }
- else result += " " + subst;
-
- return result;
- }
-
-
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/som/idlemit/MetaPragma.java b/src/share/classes/com/sun/tools/corba/se/idl/som/idlemit/MetaPragma.java
deleted file mode 100644
index 262a2d2..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/som/idlemit/MetaPragma.java
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: shasta
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997,1998,1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.som.idlemit;
-import java.util.Vector;
-import com.sun.tools.corba.se.idl.som.cff.Messages;
-/**
- * This is an implementation that handles
- * #pragma meta scoped_name string
- * where
- * <UL>
- * <LI> scoped_name == "::" separated scoped name
- * <LI> string == separated identifiers, such as "localonly",
- * "abstract", or "init".
- * D59407: NOTE: any non-white-space is grouped
- * as part of the identifier.
- * </UL>
- *
- * This pragma handler places a vector of Strings into the dynamicVariable()
- * part of the SymtabEntry. The key to access the dynamicVariable()
- * is com.sun.tools.corba.se.idl.som.idlemit.MetaPragma.metaKey
- *
- * It is possible to associate a meta pragma with a forward entry.
- * At some point after the parser has completed,
- * the method processForward(ForwardEntry entry) should be called
- * for each ForwardEntry so that the meta information can be folded from
- * the ForwardEntry into the corresponding InterfaceEntry.
- */
-public class MetaPragma extends com.sun.tools.corba.se.idl.PragmaHandler {
- /* Class variables */
-
- /* key to access the Cached meta info in com.sun.tools.corba.se.idl.SymtabEntry */
- public static int metaKey = com.sun.tools.corba.se.idl.SymtabEntry.getVariableKey();
-
-
- /**
- * Main entry point for the MetaPragma handler
- * @param pragma string for pragma name
- * @param currentToken next token in the input stream.
- * @return true if this is a meta pragma.
- */
- public boolean process(String pragma, String currentToken) {
- if ( !pragma.equals("meta"))
- return false;
-
- com.sun.tools.corba.se.idl.SymtabEntry entry ;
- String msg;
- try {
- entry = scopedName();
- if ( entry == null){
- /* scoped name not found */
- parseException(Messages.msg("idlemit.MetaPragma.scopedNameNotFound"));
- skipToEOL();
- }
- else {
- msg = (currentToken()+ getStringToEOL());
-// System.out.println(entry + ": " + msg);
- Vector v;
- v = (Vector) entry.dynamicVariable(metaKey);
- if ( v== null){
- v = new Vector();
- entry.dynamicVariable(metaKey, v);
- }
- parseMsg(v, msg);
- }
- } catch(Exception e){
-// System.out.println("exception in MetaPragma");
- }
- return true;
- }
-
-
- /**
- * Fold the meta info from the forward entry into its corresponding
- * interface entry.
- * @param forwardEntry the forward entry to process
- */
- static public void processForward(com.sun.tools.corba.se.idl.ForwardEntry forwardEntry){
-
- Vector forwardMeta;
- try {
- forwardMeta = (Vector)forwardEntry.dynamicVariable(metaKey);
- } catch (Exception e){
- forwardMeta = null;
- }
- com.sun.tools.corba.se.idl.SymtabEntry forwardInterface = forwardEntry.type();
- if (forwardMeta != null && forwardInterface!= null) {
- Vector interfaceMeta;
- try {
- interfaceMeta= (Vector)forwardInterface.dynamicVariable(metaKey);
- } catch ( Exception e){
- interfaceMeta = null;
- }
-
- if ( interfaceMeta == null) {
- /* set */
- try {
- forwardInterface.dynamicVariable(MetaPragma.metaKey, forwardMeta);
- } catch(Exception e){};
- }
- else if (interfaceMeta != forwardMeta) {
- /* The above check is needed because sometimes
- a forward entry is processed more the once.
- Not sure why */
- /* merge */
- for (int i=0; i < forwardMeta.size(); i++){
- try {
- Object obj = forwardMeta.elementAt(i);
- interfaceMeta.addElement(obj);
- } catch (Exception e){};
- }
- }
- }
- }
-
- /**
- * parse pragma message and place into vector v.
- * @param v: vector to add message
- * @param msg: string of comma separated message, perhaps with comment.
- * This is implemented as a state machine as follows:
- *
- * State token next action
- * -----------------------------------------------------
- * initial whitespace initial
- * initial SlashStar comment
- * initial SlashSlash final
- * initial no more final
- * initial text text add to text buffer
- * initial StarSlash initial
- * comment StarSlash initial
- * comment SlashStar comment
- * comment whitespace comment
- * comment SlashSlash comment
- * comment text comment
- * comment no more final
- * text text text add to buffer
- * text SlashStar comment put in vector
- * text whitespace initial put in vector
- * text SlashSlash final put in vector
- * text StarSlash initial put in vector
- * text no more final put in vector
- *
- */
- private static int initialState = 0;
- private static int commentState = 1;
- private static int textState = 2;
- private static int finalState =3;
-
- private void parseMsg(Vector v, String msg){
- int state = initialState;
- String text = "";
- int index = 0;
- while ( state != finalState ){
- boolean isNoMore = index >= msg.length();
- char ch = ' ';
- boolean isSlashStar = false;
- boolean isSlashSlash = false;
- boolean isWhiteSpace = false;
- boolean isStarSlash = false;
- boolean isText = false;
- if (!isNoMore ){
- ch = msg.charAt(index);
- if (ch == '/' && index+1 < msg.length()){
- if (msg.charAt(index+1) == '/'){
- isSlashSlash = true;
- index++;
- }
- else if (msg.charAt(index+1) == '*'){
- isSlashStar= true;
- index++;
- } else isText = true;
- }
- else if (ch == '*' && index+1 < msg.length() ){
- if (msg.charAt(index+1) == '/'){
- isStarSlash = true;
- index++;
- } else isText = true;
- }
- else if ( Character.isSpace(ch) || (ch == ',') // 59601
- || (ch == ';') ) // 59683
- isWhiteSpace = true;
- else isText = true;
- }
-
- if (state == initialState){
- if (isSlashStar){
- state = commentState;
- }
- else if (isSlashSlash || isNoMore){
- state = finalState;
- }
- else if (isText){
- state = textState;
- text = text+ ch;
- }
- }
- else if (state == commentState){
- if (isNoMore){
- state = finalState;
- }
- else if ( isStarSlash){
- state = initialState;
- }
- }
- else if (state == textState){
- if (isNoMore || isStarSlash || isSlashSlash ||
- isSlashStar || isWhiteSpace ){
- if (!text.equals("")) {
- v.addElement(text);
-// System.err.println("adding " + text);
- text = "";
- }
- if (isNoMore)
- state = finalState;
- else if (isSlashStar)
- state = commentState;
- else state = initialState;
- }
- else if (isText){
- text = text+ch;
- }
- }
- index++;
- }
- }
-
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Arguments.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Arguments.java
deleted file mode 100644
index 8f36cc5..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Arguments.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -09/23/98 <klr> Ported -td option to change output directory
-// -09/23/98 <klr> Ported -m option to generate make dependencies
-// -F46082.51<daz> Transferred -m, -mmin, mall, -mdepend options to com.sun.tools.corba.se.idl.toJava
-// since these are IBM-specific (see f46838); cleaned-out dead code.
-// -D57482 <klr> Added method setDefaultEmitter so could be overridden.
-// -F60858.1<daz> Set corba level to 2.3.
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Properties;
-import java.util.Vector;
-import java.io.File;
-
-import com.sun.tools.corba.se.idl.InvalidArgument;
-
-/**
- *
- **/
-public class Arguments extends com.sun.tools.corba.se.idl.Arguments
-{
- /**
- * Public, zero-argument constructor.
- **/
- public Arguments ()
- {
- super ();
- corbaLevel = 2.4f;
- } // ctor
-
- /**
- *
- **/
- protected void parseOtherArgs (String[] args,
- Properties properties) throws InvalidArgument
- {
- String skeletonPattern = null ;
- String tiePattern = null ;
-
- // Get package prefixes from user's properties file.
- packages.put ("CORBA", "org.omg"); // klr - always needed
- packageFromProps (properties);
-
- // Now get package prefixes from command line (along with other args).
- // This order has the effect of making command line packages
- // supercede any idl.config file packages.
- try
- {
- Vector unknownArgs = new Vector ();
-
- // Process command line parameters
- for (int i = 0; i < args.length; ++i)
- {
- String lcArg = args[i].toLowerCase ();
-
- if (lcArg.charAt (0) != '-' && lcArg.charAt (0) != '/')
- throw new InvalidArgument (args[i]);
- if (lcArg.charAt (0) == '-' ) {
- lcArg = lcArg.substring (1);
- }
-
- // Proxy options; default is -fclient.
- if (lcArg.startsWith ("f"))
- {
- // If the command line had '-f client', make it '-fclient'
- if (lcArg.equals ("f"))
- lcArg = 'f' + args[++i].toLowerCase ();
-
- // Determine whether to emit bindings for client, server or both; and
- // whether to emit delegate-style (TIE) rather than derived-style
- // skeletons, which are the default.
-
- if (lcArg.equals ("fclient"))
- {
- emit = ((emit == Server || emit == All) ? All : Client);
- }
- else if (lcArg.equals ("fserver"))
- {
- emit = ((emit == Client || emit == All) ? All : Server);
- TIEServer = false;
- }
- else if (lcArg.equals ("fall"))
- {
- emit = All;
- TIEServer = false;
- //Should be removed and incorporated in the clause below
- // POAServer = true;
- }
- else if (lcArg.equals ("fservertie"))
- {
- emit = ((emit == Client || emit == All) ? All : Server);
- TIEServer = true;
- }
- else if (lcArg.equals ("falltie"))
- {
- emit = All;
- TIEServer = true;
- }
- else
- i = collectUnknownArg (args, i, unknownArgs);
- }
- else if (lcArg.equals ("pkgtranslate"))
- {
- if (i + 2 >= args.length)
- throw new InvalidArgument( args[i] ) ;
-
- String orig = args[++i] ;
- String trans = args[++i] ;
- checkPackageNameValid( orig ) ;
- checkPackageNameValid( trans ) ;
- if (orig.equals( "org" ) || orig.startsWith( "org.omg" ))
- throw new InvalidArgument( args[i] ) ;
- orig = orig.replace( '.', '/' ) ;
- trans = trans.replace( '.', '/' ) ;
- packageTranslation.put( orig, trans ) ;
- }
- // Package prefix
- else if (lcArg.equals ("pkgprefix"))
- {
- if (i + 2 >= args.length)
- throw new InvalidArgument (args[i]);
-
- String type = args[++i];
- String pkg = args[++i];
- checkPackageNameValid( type ) ;
- checkPackageNameValid( pkg ) ;
- packages.put (type, pkg);
- }
- // Target directory
- else if (lcArg.equals ("td")) // <f46838.4>
- {
- if (i + 1 >= args.length)
- throw new InvalidArgument (args[i]);
- String trgtDir = args[++i];
- if (trgtDir.charAt (0) == '-')
- throw new InvalidArgument (args[i - 1]);
- else
- {
- targetDir = trgtDir.replace ('/', File.separatorChar);
- if (targetDir.charAt (targetDir.length () - 1) != File.separatorChar)
- targetDir = targetDir + File.separatorChar;
- }
- }
- // Separator
- else if (lcArg.equals ("sep"))
- {
- if (i + 1 >= args.length)
- throw new InvalidArgument (args[i]);
- separator = args[++i];
- }
- // POA flag ?
- else if (lcArg.equals ("oldimplbase")){
- POAServer = false;
- }
- else if (lcArg.equals("skeletonname")){
- if (i + 1 >= args.length)
- throw new InvalidArgument (args[i]);
- skeletonPattern = args[++i];
- }
- else if (lcArg.equals("tiename")){
- if (i + 1 >= args.length)
- throw new InvalidArgument (args[i]);
- tiePattern = args[++i];
- }
- else if (lcArg.equals("localoptimization")) {
- LocalOptimization = true;
- }
- else i = collectUnknownArg (args, i, unknownArgs);
- }
-
- // Encountered unknown arguments?
- if (unknownArgs.size () > 0)
- {
- String [] otherArgs = new String [unknownArgs.size ()];
- unknownArgs.copyInto (otherArgs);
- // Throws InvalidArgument by default
- super.parseOtherArgs (otherArgs, properties);
- }
-
- setDefaultEmitter(); // d57482 <klr>
- setNameModifiers( skeletonPattern, tiePattern ) ;
- }
- catch (ArrayIndexOutOfBoundsException e)
- {
- // If there is any array indexing problem, it is probably
- // because the qualifier on the last argument is missing.
- // Report that this last argument is invalid.
- throw new InvalidArgument (args[args.length - 1]);
- }
- } // parseOtherArgs
-
- /**
- *
- **/
- protected int collectUnknownArg (String[] args, int i, Vector unknownArgs)
- {
- unknownArgs.addElement (args [i]);
- ++i;
- while (i < args.length && args[i].charAt (0) != '-' && args[i].charAt (0) != '/')
- unknownArgs.addElement (args[i++]);
- return --i;
- } // collectUnknownArg
-
- /**
- *
- **/
- // XXX Either generalize this facility or remove it completely.
- protected void packageFromProps (Properties props) throws InvalidArgument
- {
- Enumeration propsEnum = props.propertyNames ();
- while (propsEnum.hasMoreElements ())
- {
- String prop = (String)propsEnum.nextElement ();
- if (prop.startsWith ("PkgPrefix."))
- {
- String type = prop.substring (10);
- String pkg = props.getProperty (prop);
- checkPackageNameValid( pkg ) ;
- checkPackageNameValid( type ) ;
- packages.put (type, pkg);
- }
- }
- } // packageFromProps
-
- /**
- * d57482 <klr> method added so default emitter check could be overriden.
- **/
- protected void setDefaultEmitter () {
- // If the flag -fclient was not found, assume it.
- if (emit == None) emit = Client;
- }
-
- protected void setNameModifiers( String skeletonPattern,
- String tiePattern ) {
- if (emit>Client) {
- String tp ;
- String sp ;
-
- if (skeletonPattern != null)
- sp = skeletonPattern ;
- else if (POAServer)
- sp = "%POA" ;
- else
- sp = "_%ImplBase" ;
-
- if (tiePattern != null)
- tp = tiePattern ;
- else if (POAServer)
- tp = "%POATie" ;
- else
- tp = "%_Tie" ;
-
- skeletonNameModifier = new NameModifierImpl( sp ) ;
- tieNameModifier = new NameModifierImpl( tp ) ;
- }
- }
-
- /**
- *
- **/
- private void checkPackageNameValid (String name) throws InvalidArgument
- {
- if (name.charAt (0) == '.')
- throw new InvalidArgument (name);
- for (int i = 0; i < name.length ();++i)
- if (name.charAt (i) == '.')
- {
- if (i == name.length () - 1 || !Character.isJavaIdentifierStart (name.charAt (++i)))
- throw new InvalidArgument (name);
- }
- else if (!Character.isJavaIdentifierPart (name.charAt (i)))
- throw new InvalidArgument (name);
- } // validatePackageName
-
- // <46082.03><46838> Modified access restrictions from protected to public.
-
- // This is a hash table whose keys are top-level typenames and
- // whose values are the package prefixes to those types.
- // For instance, <"CORBA", "org.omg"> is a possible entry.
- public Hashtable packages = new Hashtable ();
-
- public String separator = null;
-
- public static final int
- None = 0,
- Client = 1,
- Server = 2,
- All = 3;
- public int emit = None;
- public boolean TIEServer = false;
- public boolean POAServer = true;
- // By default we do not generate Locally Optimized stub because of an
- // unresolved PI problem. We will generate only if -localOptimization flag
- // is passed
- public boolean LocalOptimization = false;
- public NameModifier skeletonNameModifier = null ;
- public NameModifier tieNameModifier = null ;
-
- // Key is original package name; value is translated package name.
- // Note that this translation happens AFTER prefixes are added in the
- // packages table.
- public Hashtable packageTranslation = new Hashtable() ;
-
- public String targetDir = ""; // <f46838.4>
-} // class Arguments
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen.java
deleted file mode 100644
index 6e7c7b1..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.AttributeEntry;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.ParameterEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-
-/**
- *
- **/
-public class AttributeGen extends MethodGen implements com.sun.tools.corba.se.idl.AttributeGen
-{
- /**
- * Public zero-argument constructor.
- **/
- public AttributeGen ()
- {
- } // ctor
-
- /**
- *
- **/
- private boolean unique (InterfaceEntry entry, String name)
- {
- // Compare the name to the methods of this interface
- Enumeration methods = entry.methods ().elements ();
- while (methods.hasMoreElements ())
- {
- SymtabEntry method = (SymtabEntry)methods.nextElement ();
- if (name.equals (method.name ()))
- return false;
- }
-
- // Recursively call unique on each derivedFrom interface
- Enumeration derivedFrom = entry.derivedFrom ().elements ();
- while (derivedFrom.hasMoreElements ())
- if (!unique ((InterfaceEntry)derivedFrom.nextElement (), name))
- return false;
-
- // If the name isn't in any method, nor in any method of the
- // derivedFrom interfaces, then the name is unique.
- return true;
- } // unique
-
- /**
- * Method generate() is not used in MethodGen. They are replaced by the
- * more granular interfaceMethod, stub, skeleton, dispatchSkeleton.
- **/
- public void generate (Hashtable symbolTable, AttributeEntry m, PrintWriter stream)
- {
- } // generate
-
- /**
- *
- **/
- protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
- {
- AttributeEntry a = (AttributeEntry)m;
-
- // Generate for the get method
- super.interfaceMethod (symbolTable, a, stream);
-
- // Generate for the set method if the attribute is not readonly
- if (!a.readOnly ())
- {
- setupForSetMethod ();
- super.interfaceMethod (symbolTable, a, stream);
- clear ();
- }
- } // interfaceMethod
-
- /**
- *
- **/
- protected void stub (String className, boolean isAbstract, Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index)
- {
- AttributeEntry a = (AttributeEntry)m;
-
- // Generate for the get method
- super.stub (className, isAbstract, symbolTable, a, stream, index);
-
- // Generate for the set method if the attribute is not readonly
- if (!a.readOnly ())
- {
- setupForSetMethod ();
- super.stub (className, isAbstract, symbolTable, a, stream, index + 1);
- clear ();
- }
- } // stub
-
- /**
- *
- **/
- protected void skeleton (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index)
- {
- AttributeEntry a = (AttributeEntry)m;
-
- // Generate for the get method
- super.skeleton (symbolTable, a, stream, index);
-
- // Generate for the set method if the attribute is not readonly
- if (!a.readOnly ())
- {
- setupForSetMethod ();
- super.skeleton (symbolTable, a, stream, index + 1);
- clear ();
- }
- } // skeleton
-
- /**
- *
- **/
- protected void dispatchSkeleton (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index)
- {
- AttributeEntry a = (AttributeEntry)m;
-
- // Generate for the get method
- super.dispatchSkeleton (symbolTable, a, stream, index);
-
- // Generate for the set method if the attribute is not readonly
- if (!a.readOnly ())
- {
- setupForSetMethod ();
- super.dispatchSkeleton (symbolTable, m, stream, index + 1);
- clear ();
- }
- } // dispatchSkeleton
-
- private SymtabEntry realType = null;
-
- /**
- *
- **/
- protected void setupForSetMethod ()
- {
- ParameterEntry parm = Compile.compiler.factory.parameterEntry ();
- parm.type (m.type ());
- parm.name ("new" + Util.capitalize (m.name ()));
- m.parameters ().addElement (parm);
- realType = m.type ();
- m.type (null);
- } // setupForSetMethod
-
- /**
- *
- **/
- protected void clear ()
- {
- // Set back to normal
- m.parameters ().removeAllElements ();
- m.type (realType);
- } // clear
-} // class AttributeGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen24.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen24.java
deleted file mode 100644
index bf61f70..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen24.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -D62023 <klr> New file to implement CORBA 2.4 RTF
-// REVISIT: These changes should be folded into AttributeGen.
-
-import java.io.PrintWriter;
-
-import java.util.Enumeration;
-import java.util.Vector;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.ParameterEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.AttributeEntry;
-
-/**
- *
- **/
-public class AttributeGen24 extends MethodGenClone24
-{
- /**
- * Public zero-argument constructor.
- **/
- public AttributeGen24 ()
- {
- } // ctor
-
- /**
- * <d62023-klr> Added for 2.4 RTF
- **/
- protected void abstractMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
- {
- AttributeEntry a = (AttributeEntry)m;
-
- // Generate for the get method
- super.abstractMethod (symbolTable, a, stream);
-
- // Generate for the set method if the attribute is not readonly
- if (!a.readOnly ())
- {
- setupForSetMethod ();
- super.abstractMethod (symbolTable, a, stream);
- clear ();
- }
- } // abstractMethod
-
- /**
- * <d62023-klr> Added for 2.4 RTF
- **/
- protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
- {
- AttributeEntry a = (AttributeEntry)m;
-
- // Generate for the get method
- super.interfaceMethod (symbolTable, a, stream);
-
- // Generate for the set method if the attribute is not readonly
- if (!a.readOnly ())
- {
- setupForSetMethod ();
- super.interfaceMethod (symbolTable, a, stream);
- clear ();
- }
- } // interfaceMethod
-
-} // class AttributeGen24
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AuxGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AuxGen.java
deleted file mode 100644
index d9071ca..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AuxGen.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-
-/**
- *
- **/
-public interface AuxGen
-{
- void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry);
-} // interface AuxGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Compile.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Compile.java
deleted file mode 100644
index c9c9854..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Compile.java
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -09/23/98 KLR Ported -m updates (F46838.1-3)
-// -f46082.51<daz> Transferred makefile list generation (for ODE delta-builds,
-// see f46838) to toJava; cleaned-out dead code.
-// -D58319<daz> Display version info. for -version option.
-// -D58951<daz> Modify to allow QuickTest to build.
-// -D49526<daz> Remove "TypeCode" symbol from preParse().
-// -D58591<daz> Publicise _factories and compile for QuickTest. Need to revert
-// t0 private and add accessor methods.
-// -D59437<daz> Fill typename information for value boxes.
-
-import java.io.File;
-import java.io.IOException;
-import java.io.BufferedWriter;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.SymtabFactory;
-import com.sun.tools.corba.se.idl.IncludeEntry;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.ModuleEntry;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.SequenceEntry;
-import com.sun.tools.corba.se.idl.StructEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.UnionBranch;
-import com.sun.tools.corba.se.idl.UnionEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-import com.sun.tools.corba.se.idl.ValueBoxEntry;
-import com.sun.tools.corba.se.idl.InvalidArgument;
-
-/**
- * Compiler usage:
- * <br><br>
- *
- * java com.sun.tools.corba.se.idl.toJavaPortable.Compile [options] &lt;idl file&gt;
- * <br><br>
- *
- * where &lt;idl file&gt; is the name of a file containing IDL definitions,
- * and [options] is any combination of the options listed below. The options
- * may appear in any order.
- * <br><br>
- *
- * Options:
- * <dl>
- * <dt>-i &lt;include path&gt;
- * <dd>By default, the current directory is scanned for included files.
- * This option adds another directory. See also the note below.
- *
- * <dt>-d &lt;symbol&gt;
- * <dd>This is equivalent to the following line in an IDL file:
- * #define &lt;symbol&gt;
- *
- * <dt>-f<side>
- * <dd>Defines what bindings to emit. <side> is one of client, server, all,
- * serverTIE, allTIE. serverTIE and allTIE cause delegate model skeletons
- * to be emitted. If this flag is not used, -fclient is assumed.
- * allPOA has the same effect as all, except for generation POA type skeletons.
- *
- * <dt>-keep
- * <dd>If a file to be generated already exists, do not overwrite it. By
- * default it is overwritten.
- *
- * <dt>-sep <string>
- * <dd>Only valid with -m. Replace the file separator character with
- * <string> in the file names listed in the .u file.
- *
- * <dt>-emitAll
- * <dd>Emit all types, including those found in #included files.
- *
- * <dt>-v
- * <dd>Verbose mode.
- *
- * <dt>-pkgPrefix <type> <package>
- * <dd>Whereever <type> is encountered, make sure it resides within
- * &lt;package&gt; in all generated files. &lt;type&gt; is a fully
- * qualified, java-style name.
- * </dl>
- *
- * <B>Note:</B> If you have an include path or paths that you will always
- * be using, it can get tedious putting these on the command with the -i
- * option all the time. Instead, these can be placed into a config file
- * called idl.config. This file must be in the CLASSPATH. The format of
- * the includes line is:
- *
- * <pre>
- * includes=<path1>;<path2>;...;<pathN>
- * </pre>
- *
- * Note that the path separator character, here shown as a semicolon,
- * is machine dependent. For instance, on Windows 95 this character
- * is a semicolon, on UNIX it is a colon.
- **/
-public class Compile extends com.sun.tools.corba.se.idl.Compile
-{
- /**
- *
- **/
- public static void main (String[] args)
- {
- compiler = new Compile ();
- compiler.start (args);
- } // main
-
- /**
- *
- **/
- public void start (String[] args)
- {
- try
- {
- // <f46082.51> Use generator-specific messages file.
- //Util.registerMessageFile ("com/sun/corba/se/idl/toJavaPortable/toJava.prp");
- Util.registerMessageFile ("com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp");
- init (args);
- if (arguments.versionRequest)
- displayVersion ();
- else
- {
- preParse ();
- Enumeration e = parse ();
- if (e != null)
- {
- preEmit (e);
- generate ();
- // <f46082.03> Move ODE delta-build support to toJava
- //if (((Arguments)arguments).genMakefileLists)
- // generateMakefileLists ();
- }
- }
- }
- catch (InvalidArgument e)
- {
- System.err.println (e);
- }
- catch (IOException e)
- {
- System.err.println (e);
- }
- } // start
-
- /**
- *
- **/
- protected Compile ()
- {
- factory = factories ().symtabFactory ();
- } // ctor
-
- // <d58591> _factories was made public for QuickTest to operate correctly,
- // but the code needs to be changed to this:
- //private Factories _factories = null;
- //protected com.sun.tools.corba.se.idl.Factories factories ()
- //{
- // if (_factories == null)
- // _factories = new Factories ();
- // return _factories;
- //} // factories
-
- public Factories _factories = new Factories (); // 58974 - changed for quicktest
- protected com.sun.tools.corba.se.idl.Factories factories ()
- {
- return _factories;
- } // factories
-
-
- ModuleEntry org;
- ModuleEntry omg;
- ModuleEntry corba;
- InterfaceEntry object;
-
- /**
- *
- **/
- protected void preParse ()
- {
- Util.setSymbolTable (symbolTable);
- Util.setPackageTranslation( ((Arguments)arguments).packageTranslation ) ;
-
- // Need modules for the predefined objects
- org = factory.moduleEntry ();
- // <d61919> Suppress generation of this module. If the parser reopens it
- // while parsing the main IDL source, any definitions appearing in the module
- // -- and not appearing in a global-scope include file -- will be added to
- // the emit list with emit=true for eventual generation.
- org.emit (false);
- org.name ("org");
- org.container (null);
- omg = factory.moduleEntry ();
- omg.emit (false); // <d61919>
- omg.name ("omg");
- omg.module ("org");
- omg.container (org);
- org.addContained (omg);
- corba = factory.moduleEntry ();
- corba.emit (false); // <d61919>
- corba.name ("CORBA");
- corba.module ("org/omg");
- corba.container (omg);
- omg.addContained (corba);
- symbolTable.put ("org", org);
- symbolTable.put ("org/omg", omg);
- symbolTable.put ("org/omg/CORBA", corba);
-
- // Add CORBA::Object to symbol table.
- object = (InterfaceEntry)symbolTable.get ("Object");
- object.module ("org/omg/CORBA");
- object.container (corba);
- symbolTable.put ("org/omg/CORBA/Object", object);
-
- // <d61961> Add PIDL type (primitive) CORBA::TypeCode to symbol table.
- PrimitiveEntry pEntry = factory.primitiveEntry ();
- pEntry.name ("TypeCode");
- pEntry.module ("org/omg/CORBA");
- pEntry.container (corba);
- symbolTable.put ("org/omg/CORBA/TypeCode", pEntry);
- symbolTable.put ("CORBA/TypeCode", pEntry); // <d55699>
- overrideNames.put ("CORBA/TypeCode", "org/omg/CORBA/TypeCode"); // <d55699>
- overrideNames.put ("org/omg/CORBA/TypeCode", "CORBA/TypeCode"); // <d55699>
- // <d49526> Allow user to specify types named "TypeCode"
- //symbolTable.put ("TypeCode", pEntry);
- //overrideNames.put ("TypeCode", "org/omg/CORBA/TypeCode");
-
- // CORBA::Principal is deprecated!
- // <d61961> Add PIDL type (primitive) CORBA::Principal to symbol table.
- pEntry = factory.primitiveEntry ();
- pEntry.name ("Principal");
- pEntry.module ("org/omg/CORBA");
- pEntry.container (corba);
- symbolTable.put ("org/omg/CORBA/Principle", pEntry);
- symbolTable.put ("CORBA/Principal", pEntry);
- overrideNames.put ("CORBA/Principal", "org/omg/CORBA/Principal");
- overrideNames.put ("org/omg/CORBA/Principal", "CORBA/Principal");
-
- // <d61961> Add PIDL type (interface) CORBA::Current to symbol table.
- //InterfaceEntry iEntry = factory.interfaceEntry ();
- //iEntry.name ("Current");
- //iEntry.module ("org/omg/CORBA");
- //iEntry.container (corba);
- //symbolTable.put ("org/omg/CORBA/Current", iEntry);
- //symbolTable.put ("CORBA/Current", iEntry);
- //overrideNames.put ("CORBA/Current", "org/omg/CORBA/Current");
- //overrideNames.put ("org/omg/CORBA/Current", "CORBA/Current");
-
- overrideNames.put ("TRUE", "true");
- overrideNames.put ("FALSE", "false");
- //overrideNames.put ("any", "org/omg/CORBA/Any");
-
- // Add CORBA module to symbol table
- symbolTable.put ("CORBA", corba); // 55699
- overrideNames.put ("CORBA", "org/omg/CORBA"); // <d55699>
- overrideNames.put ("org/omg/CORBA", "CORBA"); // <d55699>
- } // preParse
-
-
- protected void preEmit (Enumeration emitList)
- {
- typedefInfo = SymtabEntry.getVariableKey ();
- Hashtable tempST = (Hashtable)symbolTable.clone ();
-
- for (Enumeration e = tempST.elements (); e.hasMoreElements ();)
- {
- SymtabEntry element = (SymtabEntry)e.nextElement ();
-
- // Any other symbolTable processing?
- preEmitSTElement (element);
- }
-
- // Do this processing AFTER any other processing to get the
- // correct names.
- Enumeration elements = symbolTable.elements ();
- while (elements.hasMoreElements ())
- {
- // Find all TypedefEntry's and fill in the SymtabEntry.info
- // field with it's real type , including [][]... with const
- // exprs.
- SymtabEntry element = (SymtabEntry)elements.nextElement ();
- if (element instanceof TypedefEntry || element instanceof SequenceEntry)
- Util.fillInfo (element);
-
- // <d59437> Members of constructed types may now be value boxes, and value
- // boxes may contain types that are directly defined rather than typedef-ed
- // (e.g., "valuetype vb sequence <long, 5>;"). If member resolves to a value
- // box, then check and fillInfo() for value box and its content type BEFORE
- // doing fillInfo() on member; otherwise, could get an exception. There's
- // code in fillInfo() that performs this check, so it does not appear here.
-
- else if (element instanceof StructEntry)
- {
- Enumeration members = ((StructEntry)element).members ().elements ();
- while (members.hasMoreElements ())
- Util.fillInfo ((SymtabEntry)members.nextElement ());
- }
- else if (element instanceof InterfaceEntry && ((InterfaceEntry)element).state () != null)
- {
- Enumeration members = ((InterfaceEntry)element).state ().elements ();
- while (members.hasMoreElements ())
- Util.fillInfo (((InterfaceState)members.nextElement ()).entry);
- }
- else if (element instanceof UnionEntry)
- {
- Enumeration branches = ((UnionEntry)element).branches ().elements ();
- while (branches.hasMoreElements ())
- Util.fillInfo (((UnionBranch)branches.nextElement ()).typedef);
- }
-
- // For each type that is at the top level that is NOT a module
- // or IncludeEntry, add it to the imports list. If there are
- // types within modules which refer to these, their types must
- // be explicitly stated in an import statement.
- if (element.module ().equals ("") && !(element instanceof ModuleEntry || element instanceof IncludeEntry || element instanceof PrimitiveEntry))
- importTypes.addElement (element);
- }
-
- while (emitList.hasMoreElements ())
- {
- SymtabEntry entry = (SymtabEntry)emitList.nextElement ();
-
- // Any other emitList processing:
- preEmitELElement (entry);
- }
- } // preEmit
-
- /**
- * This method is called by preEmit once for each symbol table entry.
- * It can be called by extenders.
- **/
- protected void preEmitSTElement (SymtabEntry entry)
- {
- // If the -package argument was used, search the packages list
- // for the given type name and prepend the package to it.
- Hashtable packages = ((Arguments)arguments).packages;
- if (packages.size () > 0)
- {
- String substr = (String)packages.get (entry.fullName ());
- if (substr != null)
- {
- String pkg = null;
- ModuleEntry mod = null;
- ModuleEntry prev = null;
- while (substr != null)
- {
- int dot = substr.indexOf ('.');
- if (dot < 0)
- {
- pkg = substr;
- substr = null;
- }
- else
- {
- pkg = substr.substring (0, dot);
- substr = substr.substring (dot + 1);
- }
-
- String fullName = prev == null ? pkg : prev.fullName () + '/' + pkg;
- mod = (ModuleEntry)symbolTable.get (fullName);
- if (mod == null)
- {
- mod = factory.moduleEntry ();
- mod.name (pkg);
- mod.container (prev);
- if (prev != null) mod.module (prev.fullName ());
- symbolTable.put (pkg, mod);
- }
- prev = mod;
- }
- entry.module (mod.fullName ());
- entry.container (mod);
- }
- }
- } // preEmitSTElement
-
- /**
- * This method is called by preEmit once for each emitList entry.
- * It can be called by extenders.
- **/
- protected void preEmitELElement (SymtabEntry entry)
- {
- } // preEmitELElement
-
- public Vector importTypes = new Vector ();
- public SymtabFactory factory;
- public static int typedefInfo;
- public Hashtable list = new Hashtable ();
- public static Compile compiler = null; // <d58591>
-} // class Compile
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ConstGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ConstGen.java
deleted file mode 100644
index b6a3808..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ConstGen.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (c) 1999, 2000, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.ConstEntry;
-import com.sun.tools.corba.se.idl.ModuleEntry;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.StringEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-
-/**
- *
- **/
-public class ConstGen implements com.sun.tools.corba.se.idl.ConstGen
-{
- /**
- * Public zero-argument constructor.
- **/
- public ConstGen ()
- {
- } // ctor
-
- /**
- * Generate Java code for an IDL constant. A constant is written to
- * a new class only when it is not a member of an interface; otherwise
- * it written to the interface class in which it resides.
- **/
- public void generate (Hashtable symbolTable, ConstEntry c, PrintWriter s)
- {
- this.symbolTable = symbolTable;
- this.c = c;
- this.stream = s;
- init ();
-
- if (c.container () instanceof ModuleEntry)
- generateConst ();
- else if (stream != null)
- writeConstExpr ();
- } // generate
-
- /**
- * Initialize members unique to this generator.
- **/
- protected void init ()
- {
- } // init
-
- /**
- * Generate the class defining the constant.
- **/
- protected void generateConst ()
- {
- openStream ();
- if (stream == null)
- return;
- writeHeading ();
- writeBody ();
- writeClosing ();
- closeStream ();
- } // generateConst
-
- /**
- * Open a new print stream only if the constant is not a member
- * of an interface.
- **/
- protected void openStream ()
- {
- stream = Util.stream (c, ".java");
- } // openStream
-
- /**
- * Write the heading for the class defining the constant.
- **/
- protected void writeHeading ()
- {
- Util.writePackage (stream, c);
- Util.writeProlog (stream, ((GenFileStream)stream).name ());
- stream.println ("public interface " + c.name ());
- // should not be done according to the mapping
- // + " extends org.omg.CORBA.portable.IDLEntity");
- stream.println ("{");
- } // writeHeading
-
- /**
- * Write the constant expression and any comment, if present.
- **/
- protected void writeBody ()
- {
- writeConstExpr ();
- } // writeBody
-
- /**
- * Write the entire constant expression and any comment, if present.
- **/
- protected void writeConstExpr ()
- {
- if (c.comment () != null)
- c.comment ().generate (" ", stream);
- if (c.container () instanceof ModuleEntry) {
-
- stream.print (" public static final " + Util.javaName (c.type ()) + " value = ");
- } else {
- stream.print (" public static final " + Util.javaName (c.type ()) + ' ' + c.name () + " = ");
- }
- writeConstValue (c.type ());
- } // writeConstExpr
-
- /**
- * Write the constant's value according to its type.
- **/
- private void writeConstValue (SymtabEntry type)
- {
- if (type instanceof PrimitiveEntry)
- stream.println ('(' + Util.javaName (type) + ")(" + Util.parseExpression (c.value ()) + ");");
- else if (type instanceof StringEntry)
- stream.println (Util.parseExpression (c.value ()) + ';');
- else if (type instanceof TypedefEntry)
- {
- while (type instanceof TypedefEntry)
- type = type.type ();
- writeConstValue (type);
- }
- else
- stream.println (Util.parseExpression (c.value ()) + ';');
- } // writeValue
-
- /**
- * Generate any last words and close the class.
- **/
- protected void writeClosing ()
- {
- stream.println ("}");
- } // writeClosing
-
- /**
- * Close the print stream, causing the file to be written.
- **/
- protected void closeStream ()
- {
- stream.close ();
- } // closeStream
-
- protected java.util.Hashtable symbolTable = null;
- protected ConstEntry c = null;
- protected PrintWriter stream = null;
-} // class ConstGen
-
-
-/*=======================================================================================
- DATE-AUTHOR ACTION
- ---------------------------------------------------------------------------------------
- 11sep1997daz Return when print stream is null and container is NOT a module. Fixes
- -keep option, which causes null print stream to be sent to ConstGen.
- 31jul1997daz Write source comment immediately preceding constant declaration.
- =======================================================================================*/
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/DefaultFactory.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/DefaultFactory.java
deleted file mode 100644
index ee1dd29..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/DefaultFactory.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -D62023 klr new class
-
-import java.io.PrintWriter;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-
-/**
- *
- **/
-public class DefaultFactory implements AuxGen
-{
- /**
- * Public zero-argument constructor.
- **/
- public DefaultFactory ()
- {
- } // ctor
-
- /**
- * Generate the default value factory class. Provides general algorithm for
- * auxiliary binding generation:
- * 1.) Initialize symbol table and symbol table entry members,
- * common to all generators.
- * 2.) Initialize members unique to this generator.
- * 3.) Open print stream
- * 4.) Write class heading (package, prologue, source comment, class
- * statement, open curly
- * 5.) Write class body (member data and methods)
- * 6.) Write class closing (close curly)
- * 7.) Close the print stream
- **/
- public void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry)
- {
- this.symbolTable = symbolTable;
- this.entry = entry;
- init ();
- openStream ();
- if (stream == null)
- return;
- writeHeading ();
- writeBody ();
- writeClosing ();
- closeStream ();
- } // generate
-
- /**
- * Initialize variables unique to this generator.
- **/
- protected void init ()
- {
- factoryClass = entry.name () + "DefaultFactory";
- factoryInterface = entry.name () + "ValueFactory";
- factoryType = Util.javaName (entry);
- implType = entry.name () + "Impl"; // default implementation class
- } // init
-
- /**
- * @return true if entry has any factory methods declared
- **/
- protected boolean hasFactoryMethods ()
- {
- Vector init = ((ValueEntry)entry).initializers ();
- if (init != null && init.size () > 0)
- return true;
- else
- return false;
- } // hasFactoryMethods
-
- /**
- * Open the print stream for subsequent output.
- **/
- protected void openStream ()
- {
- stream = Util.stream (entry, "DefaultFactory.java");
- } // openStream
-
- /**
- * Generate the heading, including the package, imports,
- * source comment, class statement, and left curly.
- **/
- protected void writeHeading ()
- {
- Util.writePackage (stream, entry, Util.TypeFile); // REVISIT - same as interface?
- Util.writeProlog (stream, stream.name ());
- if (entry.comment () != null)
- entry.comment ().generate ("", stream);
- stream.print ("public class " + factoryClass + " implements ");
- if (hasFactoryMethods ())
- stream.print (factoryInterface);
- else
- stream.print ("org.omg.CORBA.portable.ValueFactory");
- stream.println (" {");
- } // writeHeading
-
- /**
- * Generate the contents of this class
- **/
- protected void writeBody ()
- {
- writeFactoryMethods ();
- stream.println ();
- writeReadValue ();
- } // writeBody
-
- /**
- * Generate members of this class.
- **/
- protected void writeFactoryMethods ()
- {
- Vector init = ((ValueEntry)entry).initializers ();
- if (init != null)
- {
- for (int i = 0; i < init.size (); i++)
- {
- MethodEntry element = (MethodEntry) init.elementAt (i);
- element.valueMethod (true); //tag value method if not tagged previously
- ((MethodGen24) element.generator ()).defaultFactoryMethod (symbolTable, element, stream);
- }
- }
- } // writeFactoryMethods
-
- /**
- * Generate default read_value
- **/
- protected void writeReadValue ()
- {
- stream.println (" public java.io.Serializable read_value (org.omg.CORBA_2_3.portable.InputStream is)");
- stream.println (" {");
- stream.println (" return is.read_value(new " + implType + " ());");
- stream.println (" }");
- } // writeReadValue
-
- /**
- * Generate the closing statements.
- **/
- protected void writeClosing ()
- {
- stream.println ('}');
- } // writeClosing
-
- /**
- * Write the stream to file by closing the print stream.
- **/
- protected void closeStream ()
- {
- stream.close ();
- } // closeStream
-
- protected java.util.Hashtable symbolTable;
- protected com.sun.tools.corba.se.idl.SymtabEntry entry;
- protected GenFileStream stream;
-
- // Unique to this generator
- protected String factoryClass;
- protected String factoryInterface;
- protected String factoryType;
- protected String implType;
-} // class Holder
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/EnumGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/EnumGen.java
deleted file mode 100644
index de07257..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/EnumGen.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -D61056 <klr> Use Util.helperName
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.EnumEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-
-/**
- *
- **/
-public class EnumGen implements com.sun.tools.corba.se.idl.EnumGen, JavaGenerator
-{
- /**
- * Public zero-argument constructor.
- **/
- public EnumGen ()
- {
- } // ctor
-
- /**
- * Generate the Java code for an IDL enumeration.
- **/
- public void generate (Hashtable symbolTable, EnumEntry e, PrintWriter s)
- {
- this.symbolTable = symbolTable;
- this.e = e;
- init ();
-
- openStream ();
- if (stream == null) return;
- generateHolder ();
- generateHelper ();
- writeHeading ();
- writeBody ();
- writeClosing ();
- closeStream ();
- } // generate
-
- /**
- * Initialize members unique to this generator.
- **/
- protected void init ()
- {
- className = e.name ();
- fullClassName = Util.javaName (e);
- }
-
- /**
- * Open the print stream to which to write the enumeration class.
- **/
- protected void openStream ()
- {
- stream = Util.stream (e, ".java");
- }
-
- /**
- * Generate the holder class for this enumeration.
- **/
- protected void generateHolder ()
- {
- ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, e);
- }
-
- /**
- * Generate the helper class for this enumeration.
- **/
- protected void generateHelper ()
- {
- ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, e);
- }
-
- /**
- * Write the heading of the enumeration class, including the package,
- * imports, class statement, and open curly.
- **/
- protected void writeHeading ()
- {
- Util.writePackage (stream, e);
- Util.writeProlog (stream, ((GenFileStream)stream).name ());
- if (e.comment () != null)
- e.comment ().generate ("", stream);
- stream.println ("public class " + className + " implements org.omg.CORBA.portable.IDLEntity");
- stream.println ("{");
- }
-
- /**
- * Write the members of enumeration class.
- **/
- protected void writeBody ()
- {
- stream.println (" private int __value;");
- stream.println (" private static int __size = " + (e.elements ().size ()) + ';');
- stream.println (" private static " + fullClassName + "[] __array = new " + fullClassName + " [__size];");
- stream.println ();
- for (int i = 0; i < e.elements ().size (); ++i)
- {
- String label = (String)e.elements ().elementAt (i);
- stream.println (" public static final int _" + label + " = " + i + ';');
- stream.println (" public static final " + fullClassName + ' ' + label + " = new " + fullClassName + "(_" + label + ");");
- }
- stream.println ();
- writeValue ();
- writeFromInt ();
- writeCtors ();
- }
-
- /**
- * Write the value method for the enumeration class.
- **/
- protected void writeValue ()
- {
- stream.println (" public int value ()");
- stream.println (" {");
- stream.println (" return __value;");
- stream.println (" }");
- stream.println ();
- } // writeValue
-
- /**
- * Write the from_int method for the enumeration class.
- **/
- protected void writeFromInt ()
- {
- stream.println (" public static " + fullClassName + " from_int (int value)");
- stream.println (" {");
- stream.println (" if (value >= 0 && value < __size)");
- stream.println (" return __array[value];");
- stream.println (" else");
- stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
- stream.println (" }");
- stream.println ();
- }
-
- /**
- * Write the protected constructor for the enumeration class.
- **/
- protected void writeCtors ()
- {
- stream.println (" protected " + className + " (int value)");
- stream.println (" {");
- stream.println (" __value = value;");
- stream.println (" __array[__value] = this;");
- stream.println (" }");
- }
-
- /**
- * Close the enumeration class.
- **/
- protected void writeClosing ()
- {
- stream.println ("} // class " + className);
- }
-
- /**
- * Close the print stream, which writes the stream to file.
- **/
- protected void closeStream ()
- {
- stream.close ();
- }
-
- ///////////////
- // From JavaGenerator
-
- public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
- {
- tcoffsets.set (entry);
- EnumEntry enumEntry = (EnumEntry)entry;
- StringBuffer emit = new StringBuffer ("new String[] { ");
- Enumeration e = enumEntry.elements ().elements ();
- boolean firstTime = true;
- while (e.hasMoreElements ())
- {
- if (firstTime)
- firstTime = false;
- else
- emit.append (", ");
- emit.append ('"' + Util.stripLeadingUnderscores ((String)e.nextElement ()) + '"');
- }
- emit.append ("} ");
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_enum_tc ("
- + Util.helperName (enumEntry, true) + ".id (), \"" // <54697> // <d61056>
-// + "_id, \"" <54697>
- + Util.stripLeadingUnderscores (entry.name ()) + "\", "
- + new String (emit) + ");");
- return index + 1;
-
- } // helperType
-
- public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
- stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
- return index;
- } // type
-
- public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- stream.println (" return " + Util.javaQualifiedName (entry) + ".from_int (istream.read_long ());");
- } // helperRead
-
- public void helperWrite (SymtabEntry entry, PrintWriter stream)
- {
- stream.println (" ostream.write_long (value.value ());");
- } // helperWrite
-
- public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- stream.println (indent + name + " = " + Util.javaQualifiedName (entry) + ".from_int (istream.read_long ());");
- return index;
- } // read
-
- public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- stream.println (indent + "ostream.write_long (" + name + ".value ());");
- return index;
- } // write
-
- // From JavaGenerator
- ///////////////
-
- protected Hashtable symbolTable = null;
- protected EnumEntry e = null;
- protected PrintWriter stream = null;
-
- // Member data unique to this generator
- String className = null;
- String fullClassName = null;
-} // class EnumGen
-
-
-/*============================================================================
- DATE<AUTHOR> ACTION
- ----------------------------------------------------------------------------
- 31jul1997<daz> Modified to write comment immediately preceding class defining
- enumeration declaration.
- 12dec1998<klr> D55971 - omg 98-11-03 Java 2.4 RTF - make subclassable
- ===========================================================================*/
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ExceptionGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ExceptionGen.java
deleted file mode 100644
index 2ad0908..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ExceptionGen.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.ExceptionEntry;
-
-/**
- *
- **/
-public class ExceptionGen extends StructGen implements com.sun.tools.corba.se.idl.ExceptionGen
-{
- /**
- * Public zero-argument constructor.
- **/
- public ExceptionGen ()
- {
- super (true);
- } // ctor
-
- /**
- *
- **/
- public void generate (Hashtable symbolTable, ExceptionEntry entry, PrintWriter stream)
- {
- super.generate (symbolTable, entry, stream);
- } // generate
-} // class ExceptionGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Factories.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Factories.java
deleted file mode 100644
index a8fa3e8..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Factories.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -D62023<klr> Add corbaLevel=2.4
-
-/**
- *
- **/
-public class Factories extends com.sun.tools.corba.se.idl.Factories
-{
- public com.sun.tools.corba.se.idl.GenFactory genFactory ()
- {
- return new GenFactory ();
- } // genFactory
-
- public com.sun.tools.corba.se.idl.Arguments arguments ()
- {
- return new Arguments ();
- } // arguments
-
- public String[] languageKeywords ()
- {
- // These are Java keywords that are not also IDL keywords.
- return keywords;
- } // languageKeywords
-
- static String[] keywords =
- {"abstract", "break", "byte",
- "catch", "class", "continue",
- "do", "else", "extends",
- "false", "final", "finally",
- "for", "goto", "if",
- "implements", "import", "instanceof",
- "int", "interface", "native",
- "new", "null", "operator",
- "outer", "package", "private",
- "protected", "public", "return",
- "static", "super", "synchronized",
- "this", "throw", "throws",
- "transient", "true", "try",
- "volatile", "while",
-// Special reserved suffixes:
- "+Helper", "+Holder", "+Package",
-// These following are not strictly keywords. They
-// are methods on java.lang.Object and, as such, must
-// not have conflicts with methods defined on IDL
-// interfaces. Treat them the same as keywords.
- "clone", "equals", "finalize",
- "getClass", "hashCode", "notify",
- "notifyAll", "toString", "wait"};
-
- ///////////////
- // toJava-specific factory methods
-
- private Helper _helper = null; // <62023>
- public Helper helper ()
- {
- if (_helper == null)
- if (Util.corbaLevel (2.4f, 99.0f)) // <d60023>
- _helper = new Helper24 (); // <d60023>
- else
- _helper = new Helper ();
- return _helper;
- } // helper
-
- private ValueFactory _valueFactory = null; // <62023>
- public ValueFactory valueFactory ()
- {
- if (_valueFactory == null)
- if (Util.corbaLevel (2.4f, 99.0f)) // <d60023>
- _valueFactory = new ValueFactory (); // <d60023>
- // else return null since shouldn't be used
- return _valueFactory;
- } // valueFactory
-
- private DefaultFactory _defaultFactory = null; // <62023>
- public DefaultFactory defaultFactory ()
- {
- if (_defaultFactory == null)
- if (Util.corbaLevel (2.4f, 99.0f)) // <d60023>
- _defaultFactory = new DefaultFactory (); // <d60023>
- // else return null since shouldn't be used
- return _defaultFactory;
- } // defaultFactory
-
- private Holder _holder = new Holder ();
- public Holder holder ()
- {
- return _holder;
- } // holder
-
- private Skeleton _skeleton = new Skeleton ();
- public Skeleton skeleton ()
- {
- return _skeleton;
- } // skeleton
-
- private Stub _stub = new Stub ();
- public Stub stub ()
- {
- return _stub;
- } // stub
-
- // toJava-specific factory methods
- ///////////////
-} // class Factories
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ForwardValueGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ForwardValueGen.java
deleted file mode 100644
index a849848..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ForwardValueGen.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -D61056 <klr> Use Util.helperName
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.ForwardValueEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.MethodEntry;
-
-/**
- *
- **/
-public class ForwardValueGen implements com.sun.tools.corba.se.idl.ForwardValueGen, JavaGenerator
-{
- /**
- * Public zero-argument constructor.
- **/
- public ForwardValueGen ()
- {
- } // ctor
-
- /**
- *
- **/
- public void generate (Hashtable symbolTable, ForwardValueEntry v, PrintWriter str)
- {
- this.symbolTable = symbolTable;
- this.v = v;
-
- openStream ();
- if (stream == null)
- return;
- generateHelper ();
- generateHolder ();
- generateStub ();
- writeHeading ();
- writeBody ();
- writeClosing ();
- closeStream ();
- } // generate
-
- /**
- *
- **/
- protected void openStream ()
- {
- stream = Util.stream (v, ".java");
- } // openStream
-
- /**
- *
- **/
- protected void generateHelper ()
- {
- ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, v);
- } // generateHelper
-
- /**
- *
- **/
- protected void generateHolder ()
- {
- ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, v);
- } // generateHolder
-
- /**
- *
- **/
- protected void generateStub ()
- {
- } // generateStub
-
- /**
- *
- **/
- protected void writeHeading ()
- {
- Util.writePackage (stream, v);
- Util.writeProlog (stream, ((GenFileStream)stream).name ());
-
- if (v.comment () != null)
- v.comment ().generate ("", stream);
-
- stream.print ("public class " + v.name () + " implements org.omg.CORBA.portable.IDLEntity");
- // There should ALWAYS be at least one: ValueBase
-
- stream.println ("{");
- } // writeHeading
-
- /**
- *
- **/
- protected void writeBody ()
- {
- } // writeBody
-
- /**
- *
- **/
- protected void writeClosing ()
- {
- stream.println ("} // class " + v.name ());
- } // writeClosing
-
- /**
- *
- **/
- protected void closeStream ()
- {
- stream.close ();
- } // closeStream
-
- ///////////////
- // From JavaGenerator
-
- public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
- {
- return index;
- } // helperType
-
- public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
- stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
- return index;
- } // type
-
- public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- stream.println (" " + entryName + " value = new " + entryName + " ();");
- read (0, " ", "value", entry, stream);
- stream.println (" return value;");
- } // helperRead
-
- public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- return index;
- } // read
-
- public void helperWrite (SymtabEntry entry, PrintWriter stream)
- {
- write (0, " ", "value", entry, stream);
- } // helperWrite
-
- public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- return index;
- } // write
-
- // From JavaGenerator
- ///////////////
-
- /**
- *
- **/
- protected void writeAbstract ()
- {
- } // writeAbstract
-
- protected Hashtable symbolTable = null;
- protected ForwardValueEntry v = null;
- protected PrintWriter stream = null;
-} // class ForwardValueGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/GenFactory.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/GenFactory.java
deleted file mode 100644
index d7b1132..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/GenFactory.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * Copyright (c) 1999, 2000, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-
-/**
- *
- **/
-public class GenFactory implements com.sun.tools.corba.se.idl.GenFactory
-{
-
- public com.sun.tools.corba.se.idl.AttributeGen createAttributeGen ()
- {
- if (Util.corbaLevel (2.4f, 99.0f)) // <d60023>
- return new AttributeGen24 ();
- else
- return new AttributeGen ();
- } // createAttributeGen
-
- public com.sun.tools.corba.se.idl.ConstGen createConstGen ()
- {
- return new ConstGen ();
- } // createConstGen
-
- public com.sun.tools.corba.se.idl.NativeGen createNativeGen ()
- {
- return new NativeGen ();
- } // createNativeGen
-
- public com.sun.tools.corba.se.idl.EnumGen createEnumGen ()
- {
- return new EnumGen ();
- } // createEnumGen
-
- public com.sun.tools.corba.se.idl.ExceptionGen createExceptionGen ()
- {
- return new ExceptionGen ();
- } // createExceptionGen
-
- public com.sun.tools.corba.se.idl.ForwardGen createForwardGen ()
- {
- return null;
- } // createForwardGen
-
- public com.sun.tools.corba.se.idl.ForwardValueGen createForwardValueGen ()
- {
- return null;
- } // createForwardValueGen
-
- public com.sun.tools.corba.se.idl.IncludeGen createIncludeGen ()
- {
- return null;
- } // createIncludeGen
-
- public com.sun.tools.corba.se.idl.InterfaceGen createInterfaceGen ()
- {
- return new InterfaceGen ();
- } // createInterfaceGen
-
- public com.sun.tools.corba.se.idl.ValueGen createValueGen ()
- {
- if (Util.corbaLevel (2.4f, 99.0f)) // <d60023>
- return new ValueGen24 ();
- else
- return new ValueGen ();
- } // createValueGen
-
- public com.sun.tools.corba.se.idl.ValueBoxGen createValueBoxGen ()
- {
- if (Util.corbaLevel (2.4f, 99.0f)) // <d60023>
- return new ValueBoxGen24 ();
- else
- return new ValueBoxGen ();
- } // createValueBoxGen
-
- public com.sun.tools.corba.se.idl.MethodGen createMethodGen ()
- {
- if (Util.corbaLevel (2.4f, 99.0f)) // <d60023>
- return new MethodGen24 ();
- else
- return new MethodGen ();
- } // createMethodGen
-
- public com.sun.tools.corba.se.idl.ModuleGen createModuleGen ()
- {
- return new ModuleGen ();
- } // createModuleGen
-
- public com.sun.tools.corba.se.idl.ParameterGen createParameterGen ()
- {
- return null;
- } // createParameterGen
-
- public com.sun.tools.corba.se.idl.PragmaGen createPragmaGen ()
- {
- return null;
- } // createPragmaGen
-
- public com.sun.tools.corba.se.idl.PrimitiveGen createPrimitiveGen ()
- {
- return new PrimitiveGen ();
- } // createPrimitiveGen
-
- public com.sun.tools.corba.se.idl.SequenceGen createSequenceGen ()
- {
- return new SequenceGen ();
- } // createSequenceGen
-
- public com.sun.tools.corba.se.idl.StringGen createStringGen ()
- {
- return new StringGen ();
- } // createSequenceGen
-
- public com.sun.tools.corba.se.idl.StructGen createStructGen ()
- {
- return new StructGen ();
- } // createStructGen
-
- public com.sun.tools.corba.se.idl.TypedefGen createTypedefGen ()
- {
- return new TypedefGen ();
- } // createTypedefGen
-
- public com.sun.tools.corba.se.idl.UnionGen createUnionGen ()
- {
- return new UnionGen ();
- } // createUnionGen
-} // class GenFactory
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper.java
deleted file mode 100644
index 664fba9..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper.java
+++ /dev/null
@@ -1,699 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -F46082.51<daz> Remove -stateful feature.
-// -D57118 <klr> Fix "narrow" in helper for abstract interface
-// -D58889 <klr> re-Fix "narrow" in helper for abstract interface
-// -D59383 <klr> 'get_class' in value helper returns value class, not helper.
-// -D59413 <klr> Remove Helper interface references for non-value types.
-// -D59435 <klr> Remove read_Object, write_Object completely.
-// -D59418 <klr> Move read_Value, write_Value to generator's helperRead.
-
-import java.io.PrintWriter;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.ParameterEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-import com.sun.tools.corba.se.idl.ValueBoxEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.StructEntry;
-
-/**
- *
- **/
-public class Helper implements AuxGen
-{
- /**
- * Public zero-argument constructor.
- **/
- public Helper ()
- {
- } // ctor
-
- /**
- * Generate the helper class. Provides general algorithm
- * for auxiliary binding generation:
- *
- * 1.) Initialize symbol table and symbol table entry members,
- * common to all generators.
- * 2.) Initialize members unique to this generator.
- * 3.) Open print stream
- * 4.) Write class heading: package, prologue, class statement, open curly
- * 5.) Write class body: member data and methods
- * 6.) Write class closing: close curly
- * 7.) Close the print stream
- **/
- public void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry)
- {
- this.symbolTable = symbolTable;
- this.entry = entry;
- init ();
-
- openStream ();
- if (stream == null)
- return;
- writeHeading ();
- writeBody ();
- writeClosing ();
- closeStream ();
- } // generate
-
- /**
- * Initialize variables unique to this generator.
- **/
- protected void init ()
- {
- helperClass = entry.name () + "Helper";
- if (entry instanceof ValueBoxEntry)
- {
- ValueBoxEntry v = (ValueBoxEntry) entry;
- TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
- SymtabEntry mType = member.type ();
-
- if (mType instanceof PrimitiveEntry)
- helperType = Util.javaName (entry);
- else
- helperType = Util.javaName (mType);
- }
- else
- helperType = Util.javaName (entry);
- } // init
-
- /**
- * Open the print stream for subsequent output.
- **/
- protected void openStream ()
- {
- stream = Util.stream (entry, "Helper.java");
- } // openStream
-
- /**
- * Generate the heading, including package, imports, class statements,
- * and open curly.
- **/
- protected void writeHeading ()
- {
- Util.writePackage (stream, entry, Util.HelperFile);
- Util.writeProlog (stream, stream.name ());
-
- // Transfer comment to target <30jul1997daz>.
- if (entry.comment () != null)
- entry.comment ().generate ("", stream);
-
- stream.print ("public final class " + helperClass);
- if (entry instanceof ValueEntry)
- stream.println (" implements org.omg.CORBA.portable.ValueHelper");
- else
- stream.println ();
- stream.println ('{');
- }
-
- /**
- * Generate members of this class.
- **/
- protected void writeBody ()
- {
- writeInstVars ();
- writeCtors ();
- writeInsert ();
- writeExtract ();
- writeType ();
- writeID ();
- writeRead ();
- writeWrite ();
- if (entry instanceof InterfaceEntry && !(entry instanceof ValueEntry)) {
- writeNarrow ();
- writeUncheckedNarrow ();
- }
- writeHelperInterface ();
- if (entry instanceof ValueEntry)
- writeValueHelperInterface ();
- } // writeBody
-
- /**
- * Generate members of the Helper interface.
- **/
- protected void writeHelperInterface ()
- {
- } // writeHelperInterface
-
- /**
- * Generate members of the ValueHelper interface.
- **/
- protected void writeValueHelperInterface ()
- {
- writeGetID (); // moved for <d59413>
- writeGetType (); // moved for <d59413>
- writeGetInstance (); // not in ValueHelper interface
- writeGetClass ();
- writeGetSafeBaseIds ();
- } // writeHelperInterface
-
- /**
- * Generate the closing statements.
- **/
- protected void writeClosing ()
- {
- stream.println ('}');
- }
-
- /**
- * Write the stream to file by closing the print stream.
- **/
- protected void closeStream ()
- {
- stream.close ();
- }
-
- /**
- * Generate the instance variables.
- **/
- protected void writeInstVars ()
- {
- stream.println (" private static String _id = \"" + Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ()) + "\";");
- if (entry instanceof ValueEntry)
- {
- stream.println ();
- stream.println (" private static " + helperClass + " helper = new " + helperClass + " ();");
- stream.println ();
- stream.println (" private static String[] _truncatable_ids = {");
- stream.print (" _id");
-
- // Any safe ValueEntry must have a concete value parent.
- // The topmost parent cannot be safe since it doesn't have
- // a concrete parent.
- ValueEntry child = (ValueEntry) entry;
- while (child.isSafe ())
- {
- stream.println(",");
- ValueEntry parent = (ValueEntry)child.derivedFrom ().elementAt (0);
- stream.print(" \"" + Util.stripLeadingUnderscoresFromID (parent.repositoryID ().ID ()) + "\"");
- child = parent;
- }
- stream.println(" };");
- }
- stream.println ();
- } // writeInstVars
-
- /**
- * Generate the constructors.
- **/
- protected void writeCtors ()
- {
- stream.println (" public " + helperClass + "()");
- stream.println (" {");
- stream.println (" }");
- stream.println ();
- } // writeCtors
-
- /**
- * Generate the insert method.
- **/
- protected void writeInsert ()
- {
- stream.println (" public static void insert (org.omg.CORBA.Any a, " + helperType + " that)");
- stream.println (" {");
- stream.println (" org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();");
- stream.println (" a.type (type ());");
- stream.println (" write (out, that);");
- stream.println (" a.read_value (out.create_input_stream (), type ());");
- stream.println (" }");
- stream.println ();
- } // writeInsert
-
- /**
- * Generate the extract method.
- **/
- protected void writeExtract ()
- {
- stream.println (" public static " + helperType + " extract (org.omg.CORBA.Any a)");
- stream.println (" {");
- stream.println (" return read (a.create_input_stream ());");
- stream.println (" }");
- stream.println ();
- } // writeExtract
-
- /**
- * Generate the typecode variable and type method.
- **/
- protected void writeType ()
- {
- boolean canRecurse = entry instanceof ValueEntry
- || entry instanceof ValueBoxEntry
- || entry instanceof StructEntry;
- stream.println (" private static org.omg.CORBA.TypeCode __typeCode = null;");
- if (canRecurse)
- stream.println (" private static boolean __active = false;");
- stream.println (" synchronized public static org.omg.CORBA.TypeCode type ()");
- stream.println (" {");
- stream.println (" if (__typeCode == null)");
- stream.println (" {");
- if (canRecurse) {
- stream.println (" synchronized (org.omg.CORBA.TypeCode.class)");
- stream.println (" {");
- stream.println (" if (__typeCode == null)");
- stream.println (" {");
- stream.println (" if (__active)");
- stream.println (" {");
- stream.println (" return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );");
- stream.println (" }");
- stream.println (" __active = true;");
- ((JavaGenerator)entry.generator ()).helperType (0, " ", new TCOffsets (), "__typeCode", entry, stream);
- }
- else
- ((JavaGenerator)entry.generator ()).helperType (0, " ", new TCOffsets (), "__typeCode", entry, stream);
-
- // Generate body of type() method
-
- if (canRecurse) {
- stream.println (" __active = false;");
- stream.println (" }");
- stream.println (" }");
- }
- stream.println (" }");
- stream.println (" return __typeCode;");
- stream.println (" }");
- stream.println ();
- } // writeType
-
- /**
- * Generate the ID method.
- **/
- protected void writeID ()
- {
- stream.println (" public static String id ()");
- stream.println (" {");
- stream.println (" return _id;");
- stream.println (" }");
- stream.println ();
- } // writeID
-
- /**
- * Generate the read method.
- **/
- protected void writeRead ()
- {
-
- boolean isLocalInterface = false;
-
- if (entry instanceof InterfaceEntry) {
- InterfaceEntry ie = (InterfaceEntry) entry;
-
- // for #pragma sun_local or sun_localservant, or actual local
- // local interface, set the flag by checking on both
- isLocalInterface = ie.isLocal() | ie.isLocalServant();
- }
-
- stream.println (" public static " + helperType + " read (org.omg.CORBA.portable.InputStream istream)");
- stream.println (" {");
- if ( !isLocalInterface ) { // nonLocal Interface and other types
- ((JavaGenerator)entry.generator ()).helperRead (helperType, entry, stream);
- } else { //Local interface should throw exception
- stream.println (" throw new org.omg.CORBA.MARSHAL ();");
- }
- stream.println (" }");
- stream.println ();
- } // writeRead
-
- /**
- * Generate the write method.
- **/
- protected void writeWrite ()
- {
-
- boolean isLocalInterface = false;
-
- if (entry instanceof InterfaceEntry) {
- InterfaceEntry ie = (InterfaceEntry) entry;
-
- // for #pragma sun_local or sun_localservant, or actual local
- // local interface, set the flag by checking on both
- isLocalInterface = ie.isLocal() | ie.isLocalServant();
- }
-
- stream.println (" public static void write (org.omg.CORBA.portable.OutputStream ostream, " + helperType + " value)");
- stream.println (" {");
- if ( !isLocalInterface ) { // nonLocal Interface and other types
- ((JavaGenerator)entry.generator ()).helperWrite (entry, stream);
- } else { //Local interface should throw exception
- stream.println (" throw new org.omg.CORBA.MARSHAL ();");
- }
- stream.println (" }");
- stream.println ();
- } // writeWrite
-
-
- /**
- * Generate the narrow method.
- **/
- protected void writeNarrow ()
- {
- writeRemoteNarrow ();
- stream.println ();
- }
-
- /**
- * Write the narrow() method for a remotable object.
- **/
- protected void writeRemoteNarrow ()
- {
- InterfaceEntry ie = (InterfaceEntry) entry;
-
- // narrow for LocalObject interface
- if (ie.isLocal ()) {
- writeRemoteNarrowForLocal (false);
- return;
- }
-
- // narrow for Abstract interface
- if (ie.isAbstract ()) {
- writeRemoteNarrowForAbstract (false);
- return;
- } else {
- // Determine if the non-abstract interface has any abstract parents
- for (int i = 0; i < ie.derivedFrom ().size (); i++) {
- SymtabEntry parent = (SymtabEntry) ie.derivedFrom ().elementAt (i);
- if (((InterfaceEntry) parent).isAbstract ()) {
- writeRemoteNarrowForAbstract (true);
- break;
- }
- }
- }
-
- stream.println (" public static " + helperType + " narrow (org.omg.CORBA.Object obj)");
- stream.println (" {");
- stream.println (" if (obj == null)");
- stream.println (" return null;");
- stream.println (" else if (obj instanceof " + helperType + ')');
- stream.println (" return (" + helperType + ")obj;");
- stream.println (" else if (!obj._is_a (id ()))");
- stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
- stream.println (" else");
- stream.println (" {");
- stream.println (" org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();");
- String stubNameofEntry = stubName ((InterfaceEntry)entry);
- stream.println (" " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
- stream.println (" stub._set_delegate(delegate);");
- stream.println (" return stub;");
- stream.println (" }");
- stream.println (" }");
- } // writeRemoteNarrow
-
- /**
- * Write the narrow() method for local interface.
- **/
- private void writeRemoteNarrowForLocal (boolean hasAbstractParent)
- {
- stream.println (" public static " + helperType + " narrow (org.omg.CORBA.Object obj)");
- stream.println (" {");
- stream.println (" if (obj == null)");
- stream.println (" return null;");
- stream.println (" else if (obj instanceof " + helperType + ')');
- stream.println (" return (" + helperType + ")obj;");
- stream.println (" else");
- stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
- stream.println (" }");
- } // writeRemoteNarrowForLocal
-
- /**
- * Write the narrow() method for abstract interface.
- **/
- private void writeRemoteNarrowForAbstract (boolean hasAbstractParent)
- {
- stream.print (" public static " + helperType + " narrow (java.lang.Object obj)");
- stream.println (" {");
- stream.println (" if (obj == null)");
- stream.println (" return null;");
- if (hasAbstractParent)
- {
- stream.println (" else if (obj instanceof org.omg.CORBA.Object)");
- stream.println (" return narrow ((org.omg.CORBA.Object) obj);");
- }
- else
- {
- stream.println (" else if (obj instanceof " + helperType + ')');
- stream.println (" return (" + helperType + ")obj;");
- }
-
- // If hasAbstractParent is false, then THIS entry must be abstract.
- // This method is also called in case THIS entry is not abstract, but
- // there is an abstract parent. If this entry is not abstract,
- // it can never narrow to a CORBA object reference.
- if (!hasAbstractParent) { // <d58889>
- String stubNameofEntry = stubName ((InterfaceEntry)entry);
-
- stream.println (" else if ((obj instanceof org.omg.CORBA.portable.ObjectImpl) &&");
- stream.println (" (((org.omg.CORBA.Object)obj)._is_a (id ()))) {");
- stream.println (" org.omg.CORBA.portable.ObjectImpl impl = (org.omg.CORBA.portable.ObjectImpl)obj ;" ) ;
- stream.println (" org.omg.CORBA.portable.Delegate delegate = impl._get_delegate() ;" ) ;
- stream.println (" " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
- stream.println (" stub._set_delegate(delegate);");
- stream.println (" return stub;" ) ;
- stream.println (" }" ) ;
- };
- // end <d57118 - check for remotable - klr>
-
- stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
- stream.println (" }");
- stream.println ();
- } // writeRemoteNarrowForAbstract
-
-
- /**
- * Generate the unchecked narrow method.
- **/
- protected void writeUncheckedNarrow ()
- {
- writeUncheckedRemoteNarrow ();
- stream.println ();
- }
-
- /**
- * Write the unchecked narrow() method for a remotable object.
- **/
- protected void writeUncheckedRemoteNarrow ()
- {
- InterfaceEntry ie = (InterfaceEntry) entry;
-
- // unchecked narrow for LocalObject interface
- if (ie.isLocal ()) {
- writeRemoteUncheckedNarrowForLocal (false);
- return;
- }
-
- // unchecked narrow for Abstract interface
- if (ie.isAbstract ()) {
- writeRemoteUncheckedNarrowForAbstract (false);
- return;
- } else {
- // Determine if the non-abstract interface has any abstract parents
- for (int i = 0; i < ie.derivedFrom ().size (); i++) {
- SymtabEntry parent = (SymtabEntry) ie.derivedFrom ().elementAt (i);
- if (((InterfaceEntry) parent).isAbstract ()) {
- writeRemoteUncheckedNarrowForAbstract (true);
- break;
- }
- }
- }
-
- stream.println (" public static " + helperType + " unchecked_narrow (org.omg.CORBA.Object obj)");
- stream.println (" {");
- stream.println (" if (obj == null)");
- stream.println (" return null;");
- stream.println (" else if (obj instanceof " + helperType + ')');
- stream.println (" return (" + helperType + ")obj;");
- stream.println (" else");
- stream.println (" {");
- stream.println (" org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();");
- String stubNameofEntry = stubName ((InterfaceEntry)entry);
- stream.println (" " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
- stream.println (" stub._set_delegate(delegate);");
- stream.println (" return stub;");
- stream.println (" }");
- stream.println (" }");
- } // writeUncheckedRemoteNarrow
-
- /**
- * Write the unchecked narrow() method for local interface.
- **/
- private void writeRemoteUncheckedNarrowForLocal (boolean hasAbstractParent)
- {
- stream.println (" public static " + helperType + " unchecked_narrow (org.omg.CORBA.Object obj)");
- stream.println (" {");
- stream.println (" if (obj == null)");
- stream.println (" return null;");
- stream.println (" else if (obj instanceof " + helperType + ')');
- stream.println (" return (" + helperType + ")obj;");
- stream.println (" else");
- stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
- stream.println (" }");
- } // writeRemoteUncheckedNarrowForLocal
-
- /**
- * Write the unchecked narrow() method for abstract interface.
- **/
- private void writeRemoteUncheckedNarrowForAbstract (boolean hasAbstractParent)
- {
- stream.print (" public static " + helperType + " unchecked_narrow (java.lang.Object obj)");
- stream.println (" {");
- stream.println (" if (obj == null)");
- stream.println (" return null;");
- if (hasAbstractParent)
- {
- stream.println (" else if (obj instanceof org.omg.CORBA.Object)");
- stream.println (" return unchecked_narrow ((org.omg.CORBA.Object) obj);");
- }
- else
- {
- stream.println (" else if (obj instanceof " + helperType + ')');
- stream.println (" return (" + helperType + ")obj;");
- }
-
- if (!hasAbstractParent) {
- String stubNameofEntry = stubName ((InterfaceEntry)entry);
-
- stream.println (" else if (obj instanceof org.omg.CORBA.portable.ObjectImpl) {");
- stream.println (" org.omg.CORBA.portable.ObjectImpl impl = (org.omg.CORBA.portable.ObjectImpl)obj ;" ) ;
- stream.println (" org.omg.CORBA.portable.Delegate delegate = impl._get_delegate() ;" ) ;
- stream.println (" " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
- stream.println (" stub._set_delegate(delegate);");
- stream.println (" return stub;" ) ;
- stream.println (" }" ) ;
- };
-
- stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
- stream.println (" }");
- stream.println ();
- } // writeRemoteUncheckedNarrowForAbstract
-
-
- /**
- * Generate the GetID method.
- **/
- protected void writeGetID ()
- {
- if ( !Util.IDLEntity (entry))
- return;
- stream.println (" public String get_id ()");
- stream.println (" {");
- stream.println (" return _id;");
- stream.println (" }");
- stream.println ();
- } // writeGetID
-
- /**
- * Generate the GetType method.
- **/
- protected void writeGetType ()
- {
- if ( !Util.IDLEntity (entry))
- return;
- stream.println (" public org.omg.CORBA.TypeCode get_type ()");
- stream.println (" {");
- stream.println (" return type ();");
- stream.println (" }");
- stream.println ();
- } // writeGetID
-
- /**
- * Generate the get_class method.
- **/
- protected void writeGetClass ()
- {
- stream.println (" public Class get_class ()");
- stream.println (" {");
- stream.println (" return " + helperType + ".class;"); //<d59383>
- stream.println (" }");
- stream.println ();
- } // writeGetClass
-
- /**
- * Generate the get_instance method.
- **/
- protected void writeGetInstance ()
- {
- stream.println (" public static org.omg.CORBA.portable.ValueHelper get_instance ()");
- stream.println (" {");
- stream.println (" return helper;");
- stream.println (" }");
- stream.println ();
- } // writeGetInstance
-
- /**
- * Generate the GetSafeBaseIds method.
- **/
- protected void writeGetSafeBaseIds ()
- {
- stream.println (" public String[] get_truncatable_base_ids ()");
- stream.println (" {");
- stream.println (" return _truncatable_ids;");
- stream.println (" }");
- stream.println ();
- } // writeGetSafeBaseIds
-
- /**
- * Return the stub name for the interface entry.
- **/
- protected String stubName (InterfaceEntry entry)
- {
- String name;
- if (entry.container ().name ().equals (""))
- name = '_' + entry.name () + "Stub";
- else
- {
- name = Util.containerFullName (entry.container ()) + "._" + entry.name () + "Stub";
- }
- return name.replace ('/', '.');
- } // stubName
-
- protected java.util.Hashtable symbolTable;
- protected com.sun.tools.corba.se.idl.SymtabEntry entry;
- protected GenFileStream stream;
-
- // Unique to this generator
- protected String helperClass;
- protected String helperType;
-} // class Helper
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper24.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper24.java
deleted file mode 100644
index 4f20f62..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper24.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -D62023 <klr> New file to implement CORBA 2.4 RTF
-
-import java.io.PrintWriter;
-
-import java.util.Enumeration;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.ParameterEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-import com.sun.tools.corba.se.idl.ValueBoxEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.StructEntry;
-
-/**
- *
- **/
-public class Helper24 extends Helper
-{
- /**
- * Public zero-argument constructor.
- **/
- public Helper24 ()
- {
- } // ctor
-
- /**
- * Generate the heading, including package, imports, class statements,
- * and open curly.
- * <d62023> - don't implement ValueHelper, make non-boxed helpers abstract
- **/
- protected void writeHeading ()
- {
- Util.writePackage (stream, entry, Util.HelperFile);
- Util.writeProlog (stream, stream.name ());
-
- // Transfer comment to target <30jul1997daz>.
- if (entry.comment () != null)
- entry.comment ().generate ("", stream);
-
- if (entry instanceof ValueBoxEntry) {
- stream.print ("public final class " + helperClass);
- stream.println (" implements org.omg.CORBA.portable.BoxedValueHelper");
- }
- else
- stream.println ("abstract public class " + helperClass);
- stream.println ('{');
- }
-
- /**
- * Generate the instance variables.
- * <d62023> - no helper instance except for boxed valuetypes.
- * - move truncatable_ids to mapped class.
- **/
- protected void writeInstVars ()
- {
- stream.println (" private static String _id = \"" + Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ()) + "\";");
- if (entry instanceof ValueEntry)
- {
- stream.println ();
- if (entry instanceof ValueBoxEntry) {
- stream.println (" private static " + helperClass + " _instance = new " + helperClass + " ();");
- stream.println ();
- }
- }
- stream.println ();
- } // writeInstVars
-
- /**
- * <d62023> generate members of BoxedValueHelper interface if boxed
- *
- * <d62023> Hook in here to write factory methods for non-boxed ValueTypes
- * into Helper.
- **/
- protected void writeValueHelperInterface ()
- {
- if (entry instanceof ValueBoxEntry) {
- writeGetID ();
- } else if (entry instanceof ValueEntry) {
- writeHelperFactories ();
- }
- } // writeValueHelperInterface
-
- /**
- *
- **/
- protected void writeHelperFactories ()
- {
- Vector init = ((ValueEntry)entry).initializers ();
- if (init != null)
- {
- stream.println ();
- for (int i = 0; i < init.size (); i++)
- {
- MethodEntry element = (MethodEntry) init.elementAt (i);
- element.valueMethod (true); //tag value method if not tagged previously
- ((MethodGen24) element.generator ()). helperFactoryMethod (symbolTable, element, entry, stream);
- }
- }
- } // writeHelperFactories
-
- /**
- * <d62023> Generate constructors only for boxed valuetype helpers
- * All other helpers are abstract.
- **/
- protected void writeCtors ()
- {
- if (entry instanceof ValueBoxEntry) {
- stream.println (" public " + helperClass + "()");
- stream.println (" {");
- stream.println (" }");
- stream.println ();
- }
- } // writeCtors
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Holder.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Holder.java
deleted file mode 100644
index d356705..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Holder.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -D61056 <klr> Use Util.helperName
-
-import java.io.PrintWriter;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.ValueBoxEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.StringEntry;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-
-/**
- *
- **/
-public class Holder implements AuxGen
-{
- /**
- * Public zero-argument constructor.
- **/
- public Holder ()
- {
- } // ctor
-
- /**
- * Generate the holder class. Provides general algorithm for
- * auxiliary binding generation:
- * 1.) Initialize symbol table and symbol table entry members,
- * common to all generators.
- * 2.) Initialize members unique to this generator.
- * 3.) Open print stream
- * 4.) Write class heading (package, prologue, source comment, class
- * statement, open curly
- * 5.) Write class body (member data and methods)
- * 6.) Write class closing (close curly)
- * 7.) Close the print stream
- **/
- public void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry)
- {
- this.symbolTable = symbolTable;
- this.entry = entry;
- init ();
-
- openStream ();
- if (stream == null)
- return;
- writeHeading ();
- writeBody ();
- writeClosing ();
- closeStream ();
- } // generate
-
- /**
- * Initialize variables unique to this generator.
- **/
- protected void init ()
- {
- holderClass = entry.name () + "Holder";
- helperClass = Util.helperName (entry, true); // <d61056>
- if (entry instanceof ValueBoxEntry)
- {
- ValueBoxEntry v = (ValueBoxEntry) entry;
- TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
- SymtabEntry mType = member.type ();
- holderType = Util.javaName (mType);
- }
- else
- holderType = Util.javaName (entry);
- } // init
-
- /**
- * Open the print stream for subsequent output.
- **/
- protected void openStream ()
- {
- stream = Util.stream (entry, "Holder.java");
- } // openStream
-
- /**
- * Generate the heading, including the package, imports,
- * source comment, class statement, and left curly.
- **/
- protected void writeHeading ()
- {
- Util.writePackage (stream, entry, Util.HolderFile);
- Util.writeProlog (stream, stream.name ());
- if (entry.comment () != null)
- entry.comment ().generate ("", stream);
- stream.println ("public final class " + holderClass + " implements org.omg.CORBA.portable.Streamable");
- stream.println ('{');
- } // writeHeading
-
- /**
- * Generate members of this class.
- **/
- protected void writeBody ()
- {
- if (entry instanceof ValueBoxEntry)
- stream.println (" public " + holderType + " value;");
- else
- Util.writeInitializer (" public ", "value", "", entry, stream);
- stream.println ();
- writeCtors ();
- writeRead ();
- writeWrite ();
- writeType ();
- } // writeBody
-
- /**
- * Generate the closing statements.
- **/
- protected void writeClosing ()
- {
- stream.println ('}');
- } // writeClosing
-
- /**
- * Write the stream to file by closing the print stream.
- **/
- protected void closeStream ()
- {
- stream.close ();
- } // closeStream
-
- /**
- * Generate the constructors.
- **/
- protected void writeCtors ()
- {
- stream.println (" public " + holderClass + " ()");
- stream.println (" {");
- stream.println (" }");
- stream.println ();
- stream.println (" public " + holderClass + " (" + holderType + " initialValue)");
- stream.println (" {");
- stream.println (" value = initialValue;");
- stream.println (" }");
- stream.println ();
- } // writeCtors
-
- /**
- * Generate the _read method.
- **/
- protected void writeRead ()
- {
- stream.println (" public void _read (org.omg.CORBA.portable.InputStream i)");
- stream.println (" {");
- if (entry instanceof ValueBoxEntry)
- {
- TypedefEntry member = ((InterfaceState) ((ValueBoxEntry) entry).state ().elementAt (0)).entry;
- SymtabEntry mType = member.type ();
- if (mType instanceof StringEntry)
- stream.println (" value = i.read_string ();");
-
- else if (mType instanceof PrimitiveEntry)
- stream.println (" value = " + helperClass + ".read (i).value;");
-
- else
- stream.println (" value = " + helperClass + ".read (i);");
- }
- else
- stream.println (" value = " + helperClass + ".read (i);");
- stream.println (" }");
- stream.println ();
- } // writeRead
-
- /**
- * Generate the _write method.
- **/
- protected void writeWrite ()
- {
- stream.println (" public void _write (org.omg.CORBA.portable.OutputStream o)");
- stream.println (" {");
- if (entry instanceof ValueBoxEntry)
- {
- TypedefEntry member = ((InterfaceState) ((ValueBoxEntry) entry).state ().elementAt (0)).entry;
- SymtabEntry mType = member.type ();
- if (mType instanceof StringEntry)
- stream.println (" o.write_string (value);");
-
- else if (mType instanceof PrimitiveEntry)
- {
- String name = entry.name ();
- stream.println (" " + name + " vb = new " + name + " (value);");
- stream.println (" " + helperClass + ".write (o, vb);");
- }
-
- else
- stream.println (" " + helperClass + ".write (o, value);");
- }
- else
- stream.println (" " + helperClass + ".write (o, value);");
- stream.println (" }");
- stream.println ();
- } // writeWrite
-
- /**
- * Generate the _type method.
- **/
- protected void writeType ()
- {
- stream.println (" public org.omg.CORBA.TypeCode _type ()");
- stream.println (" {");
- stream.println (" return " + helperClass + ".type ();");
- stream.println (" }");
- stream.println ();
- } // writeType
-
- protected java.util.Hashtable symbolTable;
- protected com.sun.tools.corba.se.idl.SymtabEntry entry;
- protected GenFileStream stream;
-
- // Unique to this generator
- protected String holderClass;
- protected String helperClass;
- protected String holderType;
-} // class Holder
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/InterfaceGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/InterfaceGen.java
deleted file mode 100644
index 4cd1a31..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/InterfaceGen.java
+++ /dev/null
@@ -1,862 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -The ctor should really throw an exception, but then it must have a
-// throws clause. How much of a ripple effect is this?
-// -F46082.51<daz> Remove -stateful feature.
-// -D60929 <klr> Update for RTF2.4 changes
-// -D61056 <klr> Use Util.helperName
-// -D62014 <klr> Move const definitions from signature to operations interf.
-// -D62310 <klr> Fix declaration of interfaces extending abstract intf.
-// -D62023 <klr> Move const definitions back from operations to signature.
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.ConstEntry;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.SequenceEntry;
-import com.sun.tools.corba.se.idl.StringEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-
-/**
- *
- **/
-public class InterfaceGen implements com.sun.tools.corba.se.idl.InterfaceGen, JavaGenerator
-{
- /**
- * Public zero-argument constructor.
- **/
- public InterfaceGen ()
- {
- //emit = ((Arguments)Compile.compiler.arguments).emit;
- //factories = (Factories)Compile.compiler.factories ();
- } // ctor
-
- /**
- * Generate the interface and all the files associated with it.
- * Provides general algorithm for binding generation:
- * 1.) Initialize symbol table and symbol table entry members, common to all generators.
- * 2.) Generate the skeleton if required by calling generateSkeletn ()
- * 3.) Generate the holder by calling generateHolder ()
- * 4.) Generate the helper by calling generateHelper ()
- * 5.) Generate the stub if required by calling generateStub ()
- * 6.) Generate the interface by calling generateInterface ()
- **/
- public void generate (Hashtable symbolTable, InterfaceEntry i, PrintWriter stream)
- {
- if (!isPseudo(i))
- {
- this.symbolTable = symbolTable;
- this.i = i;
- init ();
-
- // for sun_local pragma, just generate the signature and operations interfaces
- // for sun_localservant pragma, generate the Local Stubs, and Skel, should not
- // have _invoke defined.
- // for local (is_local()) case, generate only Helpers and Holder, where they
- // have been modified to throw appropriate exceptions for read and write, and
- // narrow is modified to not invoke _is_a
-
- if (! (i.isLocalSignature())) {
- // generate the stubs and skeletons for non-local interfaces
- if (! (i.isLocal())) {
- // for local servant case just generate the skeleton, but
- // for others generate the stubs also
- generateSkeleton ();
-
- // _REVISIT_, Whenever there is time restructure the code to
- // encapsulate stub and skeleton generation.
-
- // If the option is -fallTie then generate the Tie class first
- // and then generate the ImplBase class to make the generation
- // complete for the Hierarchy.
- Arguments theArguments = (Arguments)Compile.compiler.arguments;
- if( (theArguments.TIEServer == true )
- &&(theArguments.emit == theArguments.All ) )
- {
- theArguments.TIEServer = false;
- // Generate the ImplBase class
- generateSkeleton ();
- // Revert in case file contains multiple interfaces
- theArguments.TIEServer = true;
- }
- generateStub ();
- }
- generateHolder ();
- generateHelper ();
- }
- intfType = SIGNATURE;
- generateInterface ();
- intfType = OPERATIONS;
- generateInterface ();
- intfType = 0;
- }
- } // generate
-
- /**
- * Initialize members unique to this generator.
- **/
- protected void init ()
- {
- emit = ((Arguments)Compile.compiler.arguments).emit;
- factories = (Factories)Compile.compiler.factories ();
- } // init
-
- /**
- * Generate a Skeleton when the user does not want just the client-side code.
- **/
- protected void generateSkeleton ()
- {
- // <f46082.51> Remove -stateful feature.
- // The Skeleton is generated only when the user doesn't want
- // JUST the client code OR when the interface is stateful
- //if (emit != Arguments.Client || i.state () != null)
- // factories.skeleton ().generate (symbolTable, i);
- if (emit != Arguments.Client)
- factories.skeleton ().generate (symbolTable, i);
- } // generateSkeleton
-
- /**
- * Generate a Stub when the user does not want just the server-side code.
- **/
- protected void generateStub ()
- {
- // <klr> According to Simon on 10/28/98, we should generate stubs for
- // abstract interfaces too.
- if (emit != Arguments.Server /* && !i.isAbstract () */)
- factories.stub ().generate (symbolTable, i);
- } // generateStub
-
- /**
- * Generate a Helper when the user does not want just the server-side code.
- **/
- protected void generateHelper ()
- {
- if (emit != Arguments.Server)
- factories.helper ().generate (symbolTable, i);
- } // generateHelper
-
- /**
- * Generate a Holder when the user does not want just the server-side code.
- **/
- protected void generateHolder ()
- {
- if (emit != Arguments.Server)
- factories.holder ().generate (symbolTable, i);
- } // generateHolder
-
- /**
- * Generate the interface. Provides general algorithm for binding generation:
- * 1.) Initialize members unique to this generator. - init ()
- * 2.) Open print stream - openStream ()
- * 3.) Write class heading (package, prologue, class statement, open curly - writeHeading ()
- * 4.) Write class body (member data and methods) - write*Body ()
- * 5.) Write class closing (close curly) - writeClosing ()
- * 6.) Close the print stream - closeStream ()
- *
- * For CORBA 2.3, interfaces are mapped to Operations and Signature
- * interfaces. The Operations interface contains the method definitions.
- * The Signature interface extends the Operations interface and adds
- * CORBA::Object. <klr>
- **/
- protected void generateInterface ()
- {
- init ();
- openStream ();
- if (stream == null)
- return;
- writeHeading ();
- if (intfType == OPERATIONS)
- writeOperationsBody ();
- if (intfType == SIGNATURE)
- writeSignatureBody ();
- writeClosing ();
- closeStream ();
- } // generateInterface
-
- /**
- *
- **/
- protected void openStream ()
- {
- if (i.isAbstract () || intfType == SIGNATURE)
- stream = Util.stream (i, ".java");
- else if (intfType == OPERATIONS)
- stream = Util.stream (i, "Operations.java");
- } // openStream
-
- /**
- *
- **/
- protected void writeHeading ()
- {
- Util.writePackage (stream, i, Util.TypeFile);
- Util.writeProlog (stream, ((GenFileStream)stream).name ());
-
- // Transfer interface comment to target <31jul1997>.
- if (i.comment () != null)
- i.comment ().generate ("", stream);
-
- String className = i.name ();
-// if (((Arguments)Compile.compiler.arguments).TIEServer)
-// {
-// // For the delegate model, don't make interface a subclass of CORBA.Object
-// stream.print ("public interface " + className);
-// boolean firstTime = true;
-// for (int ii = 0; ii < i.derivedFrom ().size (); ++ii)
-// {
-// SymtabEntry parent = (SymtabEntry)i.derivedFrom ().elementAt (ii);
-// if (!parent.fullName ().equals ("org/omg/CORBA/Object"))
-// {
-// if (firstTime)
-// {
-// firstTime = false;
-// stream.print (" extends ");
-// }
-// else
-// stream.print (", ");
-// stream.print (Util.javaName (parent));
-// }
-// }
-// if (i.derivedFrom ().size () > 0)
-// stream.print (", ");
-// stream.print ("org.omg.CORBA.portable.IDLEntity ");
-// }
-//
-// else
-// {
- if (intfType == SIGNATURE)
- writeSignatureHeading ();
- else if (intfType == OPERATIONS)
- writeOperationsHeading ();
-// }
-
- stream.println ();
- stream.println ('{');
- } // writeHeading
-
- /**
- *
- **/
- protected void writeSignatureHeading ()
- {
- String className = i.name ();
- stream.print ("public interface " + className + " extends " + className + "Operations, ");
- boolean firstTime = true;
- boolean hasNonAbstractParent = false; // <d62310-klr>
- for (int k = 0; k < i.derivedFrom ().size (); ++k)
- {
- if (firstTime)
- firstTime = false;
- else
- stream.print (", ");
- InterfaceEntry parent = (InterfaceEntry)i.derivedFrom ().elementAt (k);
- stream.print (Util.javaName (parent));
- if (! parent.isAbstract ()) // <d62310-klr>
- hasNonAbstractParent = true; // <d62310-klr>
- }
- // <d62310-klr> - begin
- // If this interface extends only abstract interfaces,
- // it should extend both org.omg.CORBA.Object and IDLEntity.
- if (!hasNonAbstractParent) {
- stream.print (", org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity ");
- }
- else {
- // <d62310-klr> - end
- // extends IDLEntity if there's only one default parent - CORBA.Object
- if (i.derivedFrom ().size () == 1)
- stream.print (", org.omg.CORBA.portable.IDLEntity ");
- }
- } // writeSignatureHeading
-
- /**
- *
- **/
- protected void writeOperationsHeading ()
- {
- stream.print ("public interface " + i.name ());
- if ( !i.isAbstract ())
- stream.print ("Operations ");
- else {
- // <d60929> - base abstract interfaces extend AbstractBase
- // changed to IDLEntity by SCN per latest spec...
- if (i.derivedFrom ().size () == 0)
- stream.print (" extends org.omg.CORBA.portable.IDLEntity");
- }
-
- boolean firstTime = true;
- for (int k = 0; k < i.derivedFrom ().size (); ++k)
- {
- InterfaceEntry parent = (InterfaceEntry) i.derivedFrom ().elementAt (k);
- String parentName = Util.javaName (parent);
-
- // ignore the default parent - CORBA.Object
- if (parentName.equals ("org.omg.CORBA.Object"))
- continue;
-
- if (firstTime)
- {
- firstTime = false;
- stream.print (" extends ");
- }
- else
- stream.print (", ");
-
- // Don't append suffix Operations to the parents of abstract interface
- // or to the abstract parents of regular interface
- if (parent.isAbstract () || i.isAbstract ())
- stream.print (parentName);
- else
- stream.print (parentName + "Operations");
- }
- } // writeOperationsHeading
-
-
- /**
- *
- **/
- protected void writeOperationsBody ()
- {
- // Generate everything but constants
- Enumeration e = i.contained ().elements ();
- while (e.hasMoreElements ())
- {
- SymtabEntry contained = (SymtabEntry)e.nextElement ();
- if (contained instanceof MethodEntry)
- {
- MethodEntry element = (MethodEntry)contained;
- ((MethodGen)element.generator ()).interfaceMethod (symbolTable, element, stream);
- }
- else
- if ( !(contained instanceof ConstEntry))
- contained.generate (symbolTable, stream);
- }
- } // writeOperationsBody
-
- /**
- *
- **/
- protected void writeSignatureBody ()
- {
- // Generate only constants
- Enumeration e = i.contained ().elements ();
- while (e.hasMoreElements ())
- {
- SymtabEntry contained = (SymtabEntry)e.nextElement ();
- if (contained instanceof ConstEntry)
- contained.generate (symbolTable, stream);
- }
- } // writeSignatureBody
-
- /**
- *
- **/
- protected void writeClosing ()
- {
- String intfName = i.name ();
- if ( !i.isAbstract () && intfType == OPERATIONS)
- intfName = intfName + "Operations";
- stream.println ("} // interface " + intfName);
- } // writeClosing
-
- /**
- *
- **/
- protected void closeStream ()
- {
- stream.close ();
- } // closeStream
-
- ///////////////
- // From JavaGenerator
-
- // <f46082.51> Remove -stateful feature.
- /*
- public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
- {
- InterfaceEntry i = (InterfaceEntry)entry;
- if (i.state () != null && i.state ().size () > 0)
- index = structHelperType (index, indent, tcoffsets, name, entry, stream);
- else
- {
- tcoffsets.set (entry);
- if (entry.fullName ().equals ("org/omg/CORBA/Object"))
- stream.println (indent + name
- + " = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_objref);");
- else
- stream.println (indent + name
- // <54697>
- //+ " = org.omg.CORBA.ORB.init ().create_interface_tc (_id, "
- + " = org.omg.CORBA.ORB.init ().create_interface_tc (" + Util.helperName (i, true) + ".id (), " // <d61056>
- + '\"' + Util.stripLeadingUnderscores (entry.name ()) + "\");");
- }
- return index;
- } // helperType
- */
- public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
- {
- InterfaceEntry i = (InterfaceEntry)entry;
- tcoffsets.set (entry);
- if (entry.fullName ().equals ("org/omg/CORBA/Object"))
- stream.println (indent + name
- + " = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_objref);");
- else
- stream.println (indent + name
- // <54697>
- //+ " = org.omg.CORBA.ORB.init ().create_interface_tc (_id, "
- + " = org.omg.CORBA.ORB.init ().create_interface_tc (" + Util.helperName (i, true) + ".id (), " // <d61056>
- + '\"' + Util.stripLeadingUnderscores (entry.name ()) + "\");");
- return index;
- } // helperType
-
- public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
- stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
- return index;
- } // type
-
- // <f46082.51> Remove -stateful feature.
- /*
- public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- InterfaceEntry i = (InterfaceEntry)entry;
- if (i.state () != null)
- structHelperRead (entryName, i, stream);
- else
- {
- if (i.isAbstract ())
- stream.println (" return narrow (((org.omg.CORBA_2_3.portable.InputStream)istream).read_abstract_interface (_" + i.name () + "Stub.class));"); // <d60929>
- else
- stream.println (" return narrow (istream.read_Object (_" + i.name () + "Stub.class));");
- }
- } // helperRead
-
- */
- public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- InterfaceEntry i = (InterfaceEntry)entry;
- if (i.isAbstract ())
- stream.println (" return narrow (((org.omg.CORBA_2_3.portable.InputStream)istream).read_abstract_interface (_" + i.name () + "Stub.class));"); // <d60929>
- else
- stream.println (" return narrow (istream.read_Object (_" + i.name () + "Stub.class));");
- } // helperRead
-
- // <f46082.51> Remove -stateful feature.
- /*
- public void helperWrite (SymtabEntry entry, PrintWriter stream)
- {
- InterfaceEntry i = (InterfaceEntry)entry;
- if (i.state () != null)
- structHelperWrite (entry, stream);
- else
- write (0, " ", "value", entry, stream);
- } // helperWrite
- */
- public void helperWrite (SymtabEntry entry, PrintWriter stream)
- {
- write (0, " ", "value", entry, stream);
- } // helperWrite
-
- // <f46082.51> Remove -stateful feature.
- /*
- public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- InterfaceEntry i = (InterfaceEntry)entry;
- if (i.state () != null)
- index = structRead (index, indent, name, i, stream);
- else
- {
- if (entry.fullName ().equals ("org/omg/CORBA/Object"))
- stream.println (indent + name + " = istream.read_Object (_" + i.name () + "Stub.class);");
- else
- stream.println (indent + name + " = " + Util.helperName (entry, false) + ".narrow (istream.read_Object (_" + i.name () + "Stub.class));"); // <d61056>
- }
- return index;
- } // read
- */
- public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- InterfaceEntry i = (InterfaceEntry)entry;
- if (entry.fullName ().equals ("org/omg/CORBA/Object"))
- stream.println (indent + name + " = istream.read_Object (_" + i.name () + "Stub.class);");
- else
- stream.println (indent + name + " = " + Util.helperName (entry, false) + ".narrow (istream.read_Object (_" + i.name () + "Stub.class));"); // <d61056>
- return index;
- } // read
-
- // <f46082.51> Remove -stateful feature.
- /*
- public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- InterfaceEntry i = (InterfaceEntry)entry;
- if (i.state () != null)
- index = structWrite (index, indent, name, entry, stream);
- else
- {
- if (i.isAbstract ())
- stream.println (indent + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_abstract_interface ((java.lang.Object) " + name + ");"); // <d60929>
- else
- stream.println (indent + "ostream.write_Object ((org.omg.CORBA.Object) " + name + ");");
- }
- return index;
- } // write
- */
- public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- InterfaceEntry i = (InterfaceEntry)entry;
- if (i.isAbstract ())
- stream.println (indent + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_abstract_interface ((java.lang.Object) " + name + ");"); // <d60929>
- else
- stream.println (indent + "ostream.write_Object ((org.omg.CORBA.Object) " + name + ");");
- return index;
- } // write
-
- // <f46082.51> Remove -stateful feature.
- /*
- // These methods are cobbled from StructGen. Stateful interfaces
- // are sent across the wire as if they were structs, with the first
- // element being a string - the Java name of the class.
-
- public int structHelperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
- {
- TCOffsets innerOffsets = new TCOffsets ();
- innerOffsets.set (entry);
- int offsetForStruct = innerOffsets.currentOffset ();
- InterfaceEntry i = (InterfaceEntry)entry;
- String membersName = "_members" + index++;
- Vector state = i.state ();
- stream.println (indent + "org.omg.CORBA.StructMember[] " + membersName + " = new org.omg.CORBA.StructMember [" + (state.size () + 1) + "];");
- String tcOfMembers = "_tcOf" + membersName;
- stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + ';');
-
- // The name string is the first element of the struct
- String memberName = "_name";
- StringEntry stringEntry = Compile.compiler.factory.stringEntry ();
- index = ((JavaGenerator)stringEntry.generator ()).helperType (index, indent, innerOffsets, tcOfMembers, stringEntry, stream);
- stream.println (indent + membersName + "[0] = new org.omg.CORBA.StructMember (");
- stream.println (indent + " \"" + memberName + "\",");
- stream.println (indent + " " + tcOfMembers + ',');
- stream.println (indent + " null);");
- int offsetSoFar = innerOffsets.currentOffset ();
- innerOffsets = new TCOffsets ();
- innerOffsets.set (entry);
- innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForStruct);
-
- for (int idx = 0; idx < state.size (); ++idx)
- {
- TypedefEntry member = ((InterfaceState)state.elementAt (idx)).entry;
- memberName = member.name ();
- index = ((JavaGenerator)member.generator ()).helperType (index, indent, innerOffsets, tcOfMembers, member, stream);
- stream.println (indent + membersName + '[' + (idx + 1) + "] = new org.omg.CORBA.StructMember (");
- stream.println (indent + " \"" + memberName + "\",");
- stream.println (indent + " " + tcOfMembers + ',');
- stream.println (indent + " null);");
- offsetSoFar = innerOffsets.currentOffset ();
- innerOffsets = new TCOffsets ();
- innerOffsets.set (entry);
- innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForStruct);
- }
- tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ());
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_struct_tc (id (), \"" + entry.name () + "\", " + membersName + ");");
- return index;
- } // structHelperType
-
- public void structHelperRead (String entryName, InterfaceEntry entry, PrintWriter stream)
- {
- String impl = implName ((InterfaceEntry)entry);
- stream.println (" " + Util.javaStatefulName (entry) + " value = null;");
- structRead (0, " ", "value", entry, stream);
- stream.println (" return value;");
- } // structHelperRead
-
- private String implName (InterfaceEntry entry)
- {
- String name;
- if (entry.container ().name ().equals (""))
- name = '_' + entry.name () + "Impl";
- else
- name = Util.containerFullName (entry.container ()) + "._" + entry.name () + "Impl";
- return name.replace ('/', '.');
- } // implName
-
- public int structRead (int index, String indent, String name, InterfaceEntry entry, PrintWriter stream)
- {
- // The first element will be the name of the Java implementation class.
- String stringName = "_name" + index++;
- stream.println (indent + "String " + stringName + " = istream.read_string ();");
- stream.println (indent + "try");
- stream.println (indent + "{");
- stream.println (indent + " " + name + " = (" + Util.javaStatefulName (entry) + ")com.sun.CORBA.iiop.ORB.getImpl (" + stringName + ".replace ('/', '.'));");
- stream.println (indent + "}");
- stream.println (indent + "catch (Exception e)");
- stream.println (indent + "{");
- stream.println (indent + " " + name + " = null;");
- stream.println (indent + "}");
- stream.println (indent + "if (" + name + " == null)");
- stream.println (indent + " throw new org.omg.CORBA.NO_IMPLEMENT (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
- stream.println ();
-
- stream.println (indent + "if (!" + stringName + ".equals (\"" + entry.fullName () + "\"))");
- stream.println (indent + '{');
- stream.println (indent + " Class _cls = " + name + ".getClass ();");
- stream.println (indent + " boolean _found = false;");
- stream.println (indent + " while (!_found && _cls != null)");
- stream.println (indent + " {");
- stream.println (indent + " Class[] interfaces = _cls.getInterfaces ();");
- stream.println (indent + " for (int i = 0; i < interfaces.length; ++i)");
- stream.println (indent + " if (interfaces[i].getName ().indexOf (\"State\") > 0)");
- stream.println (indent + " {");
- stream.println (indent + " _cls = interfaces[i];");
- stream.println (indent + " _found = true;");
- stream.println (indent + " break;");
- stream.println (indent + " }");
- stream.println (indent + " if (!_found)");
- stream.println (indent + " _cls = _cls.getSuperclass ();");
- stream.println (indent + " }");
- stream.println (indent + " if (_cls == null)");
- stream.println (indent + " throw new org.omg.CORBA.NO_IMPLEMENT (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
- stream.println ();
- stream.println (indent + " String _className = _cls.getName ();");
- stream.println (indent + " int _index = _className.lastIndexOf ('.');");
- stream.println (indent + " String _helperName = _className.substring (0, _index + 1) + _className.substring (_index + 2, _className.length () - 5) + \"Helper\"; // 5 == \"State\".length");
- stream.println (indent + " try");
- stream.println (indent + " {");
- stream.println (indent + " Class _helperClass = Class.forName (_helperName);");
- stream.println (indent + " Class[] _formalParms = new Class [1];");
- stream.println (indent + " _formalParms[0] = Class.forName (\"org.omg.CORBA.portable.InputStream\");");
- stream.println (indent + " java.lang.reflect.Method _read = _helperClass.getMethod (\"read\", _formalParms);");
- stream.println (indent + " Object[] _actualParms = new Object [1];");
- stream.println (indent + " _actualParms[0] = istream;");
- stream.println (indent + " " + name + " = (" + Util.javaStatefulName (entry) + ")_read.invoke (null, _actualParms);");
- stream.println (indent + " }");
- stream.println (indent + " catch (Exception e)");
- stream.println (indent + " {");
- stream.println (indent + " throw new org.omg.CORBA.NO_IMPLEMENT (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
- stream.println (indent + " }");
- stream.println (indent + '}');
-
- // instantiate an implementation
- stream.println (indent + "else");
- stream.println (indent + '{');
-
- // Load the state
- readState (index, indent, name, (InterfaceEntry)entry, stream);
-
- stream.println (indent + '}');
- return index;
- } // structRead
-
- private void readState (int index, String indent, String name, InterfaceEntry entry, PrintWriter stream)
- {
- // First write the state from all parents
- Enumeration e = entry.derivedFrom ().elements ();
- while (e.hasMoreElements ())
- {
- InterfaceEntry parent = (InterfaceEntry)e.nextElement ();
- if (parent.state () != null)
- {
- if (parent.state ().size () > 0)
- readState (index, indent, name, parent, stream);
- break;
- }
- }
-
- // Now write the state for the local entry
- e = entry.state ().elements ();
- while (e.hasMoreElements ())
- {
- TypedefEntry member = ((InterfaceState)e.nextElement ()).entry;
- String tmpName = '_' + member.name () + "Tmp";
- Util.writeInitializer (indent + " ", tmpName, "", member, stream);
- if (!member.arrayInfo ().isEmpty () || member.type () instanceof SequenceEntry || member.type () instanceof PrimitiveEntry || member.type () instanceof StringEntry)
- index = ((JavaGenerator)member.generator ()).read (index, indent + " ", tmpName, member, stream);
- else
- stream.println (indent + " " + tmpName + " = " + Util.helperName (member.type (), true) + ".read (istream);"); // <d61056>
- stream.println (indent + " " + name + '.' + member.name () + " (" + tmpName + ");");
- }
- } // readState
-
- public void structHelperWrite (SymtabEntry entry, PrintWriter stream)
- {
- structWrite (0, " ", "value", entry, stream);
- } // structHelperWrite
-
- public int structWrite (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- // The first element of the struct must be the name of the real interface.
- stream.println (indent + "Class _cls = " + name + ".getClass ();");
- stream.println (indent + "boolean _found = false;");
- stream.println (indent + "while (!_found && _cls != null)");
- stream.println (indent + "{");
- stream.println (indent + " Class[] interfaces = _cls.getInterfaces ();");
- stream.println (indent + " for (int i = 0; i < interfaces.length; ++i)");
- stream.println (indent + " if (interfaces[i].getName ().indexOf (\"State\") > 0)");
- stream.println (indent + " {");
- stream.println (indent + " _cls = interfaces[i];");
- stream.println (indent + " _found = true;");
- stream.println (indent + " break;");
- stream.println (indent + " }");
- stream.println (indent + " if (!_found)");
- stream.println (indent + " _cls = _cls.getSuperclass ();");
- stream.println (indent + '}');
- stream.println ();
- stream.println (indent + "if (_cls == null)");
- stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
- stream.println ();
- stream.println (indent + "String _className = _cls.getName ();");
- stream.println (indent + "int _index = _className.lastIndexOf ('.');");
- stream.println (indent + "String _interfaceName = _className.substring (0, _index + 1) + _className.substring (_index + 2, _className.length () - 5); // 5 == \"State\".length");
- stream.println (indent + "ostream.write_string (_interfaceName.replace ('.', '/'));");
-
- // If _className != Util.javaName (entry), then call that class's helper class.
- stream.println ();
- stream.println (indent + "if (!_interfaceName.equals (\"" + Util.javaName (entry) + "\"))");
- stream.println (indent + '{');
- stream.println (indent + " try");
- stream.println (indent + " {");
- stream.println (indent + " Class _helperClass = Class.forName (_interfaceName + \"Helper\");");
- stream.println (indent + " Class[] _formalParms = new Class [2];");
- stream.println (indent + " _formalParms[0] = Class.forName (\"org.omg.CORBA.portable.OutputStream\");");
- stream.println (indent + " _formalParms[1] = _cls;");
- stream.println (indent + " java.lang.reflect.Method _write = _helperClass.getMethod (\"write\", _formalParms);");
- stream.println (indent + " Object[] _actualParms = new Object [2];");
- stream.println (indent + " _actualParms[0] = ostream;");
- stream.println (indent + " _actualParms[1] = " + name + ';');
- stream.println (indent + " _write.invoke (null, _actualParms);");
- stream.println (indent + " }");
- stream.println (indent + " catch (Exception e)");
- stream.println (indent + " {");
- stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
- stream.println (indent + " }");
- stream.println (indent + '}');
-
- stream.println (indent + "else");
- stream.println (indent + '{');
-
- writeState (index, indent, name, (InterfaceEntry)entry, stream);
-
- stream.println (indent + '}');
- return index;
- } // structWrite
-
- private void writeState (int index, String indent, String name, InterfaceEntry entry, PrintWriter stream)
- {
- // First write the state from all parents
- Enumeration e = entry.derivedFrom ().elements ();
- while (e.hasMoreElements ())
- {
- InterfaceEntry parent = (InterfaceEntry)e.nextElement ();
- if (parent.state () != null)
- {
- if (parent.state ().size () > 0)
- writeState (index, indent, name, parent, stream);
- break;
- }
- }
-
- // Now write the state for the local entry
- Vector members = entry.state ();
- for (int i = 0; i < members.size (); ++i)
- {
- TypedefEntry member = ((InterfaceState)members.elementAt (i)).entry;
- if (!member.arrayInfo ().isEmpty () || member.type () instanceof SequenceEntry || member.type () instanceof PrimitiveEntry || member.type () instanceof StringEntry)
- index = ((JavaGenerator)member.generator ()).write (index, indent + " ", name + '.' + member.name () + "()", member, stream);
- else
- stream.println (indent + " " + Util.helperName (member.type (), true) + ".write (ostream, " + name + '.' + member.name () + " ());"); // <d61056>
- }
- } // writeState
- */
-
- /**
- * @return true if the entry is for a CORBA pseudo-object.
- **/
- private boolean isPseudo(InterfaceEntry i) {
- java.lang.String fullname = i.fullName();
- if (fullname.equalsIgnoreCase("CORBA/TypeCode"))
- return true;
- if (fullname.equalsIgnoreCase("CORBA/Principal"))
- return true;
- if (fullname.equalsIgnoreCase("CORBA/ORB"))
- return true;
- if (fullname.equalsIgnoreCase("CORBA/Any"))
- return true;
- if (fullname.equalsIgnoreCase("CORBA/Context"))
- return true;
- if (fullname.equalsIgnoreCase("CORBA/ContextList"))
- return true;
- if (fullname.equalsIgnoreCase("CORBA/DynamicImplementation"))
- return true;
- if (fullname.equalsIgnoreCase("CORBA/Environment"))
- return true;
- if (fullname.equalsIgnoreCase("CORBA/ExceptionList"))
- return true;
- if (fullname.equalsIgnoreCase("CORBA/NVList"))
- return true;
- if (fullname.equalsIgnoreCase("CORBA/NamedValue"))
- return true;
- if (fullname.equalsIgnoreCase("CORBA/Request"))
- return true;
- if (fullname.equalsIgnoreCase("CORBA/ServerRequest"))
- return true;
- if (fullname.equalsIgnoreCase("CORBA/UserException"))
- return true;
- return false;
- }
-
- // From JavaGenerator
- ///////////////
-
- protected int emit = 0;
- protected Factories factories = null;
-
- protected Hashtable symbolTable = null;
- protected InterfaceEntry i = null;
- protected PrintWriter stream = null;
-
- // <f46082.03, f46838.1/.2/.3> Modify access to protected.
- protected static final int SIGNATURE = 1;
- protected static final int OPERATIONS = 2;
- protected int intfType = 0;
-} // class InterfaceGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/JavaGenerator.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/JavaGenerator.java
deleted file mode 100644
index 69a2f6e..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/JavaGenerator.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-
-import java.io.PrintWriter;
-
-import com.sun.tools.corba.se.idl.SymtabEntry;
-
-/**
- *
- **/
-public interface JavaGenerator
-{
- // The helper methods print the specific helper method.
- // The helper read/write methods call the read/write methods.
-
- int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream);
-
- void helperRead (String entryName, SymtabEntry entry, PrintWriter stream);
-
- void helperWrite (SymtabEntry entry, PrintWriter stream);
-
- // The read/write methods print the streaming of the type.
- // This printed code is found in the helper method but it is only
- // that code that is concerned with streaming itself.
-
- int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream);
-
- int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream);
-
- int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream);
-
-} // interface JavaGenerator
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen.java
deleted file mode 100644
index 155d27c..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen.java
+++ /dev/null
@@ -1,1091 +0,0 @@
-/*
- * Copyright (c) 1999, 2002, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -After demarshalling an IOR, think about how to deal with the exceptions.
-// -catching Exception throws a string which should be in a properties file.
-// -30jul1997<daz> Modified to write comment immediately preceding method signature.
-// -07May1998<ktp> Modified to support RMI Portable Stub
-// -26Aug1998<klr> Modified to pass helper instance to read_Value.
-// -F46082.51<daz> Remove -stateful feature; javaStatefulName() obsolete.
-// -D56554 <klr> Port bounded string checks from toJava to toJavaPortable
-// -D58549 <klr> bounded string checks on in/inout parms throw BAD_PARAM
-// -D57112<daz> Valuetype initializers map to ctor, regardless of name, and
-// "void _init(...)" methods now mapped correctly.
-// -D59297 <klr> pass context parm when Remarshalling
-// -D59560 <klr> call read/write_Context
-// -D60929 <klr> Update for RTF2.4 changes
-// -D61056 <klr> Use Util.helperName
-// -D61650<daz> Remove '\n' from generated strings; use println()'s.
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.EnumEntry;
-import com.sun.tools.corba.se.idl.ExceptionEntry;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.ParameterEntry;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.StringEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.SequenceEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-import com.sun.tools.corba.se.idl.ValueBoxEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.AttributeEntry;
-
-import com.sun.tools.corba.se.idl.constExpr.Expression;
-
-/**
- *
- **/
-public class MethodGen implements com.sun.tools.corba.se.idl.MethodGen
-{
- private static final String ONE_INDENT = " ";
- private static final String TWO_INDENT = " ";
- private static final String THREE_INDENT = " ";
- private static final String FOUR_INDENT = " ";
- private static final String FIVE_INDENT = " ";
- // This is the length of _get_ and _set_
- private static final int ATTRIBUTE_METHOD_PREFIX_LENGTH = 5;
- /**
- * Public zero-argument constructor.
- **/
- public MethodGen ()
- {
- } // ctor
-
- /**
- * Method generate() is not used in MethodGen. They are replaced by the
- * more granular interfaceMethod, stub, skeleton, dispatchSkeleton.
- **/
- public void generate (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
- {
- } // generate
-
- /**
- *
- **/
- protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
- {
- this.symbolTable = symbolTable;
- this.m = m;
- this.stream = stream;
- if (m.comment () != null)
- m.comment ().generate ("", stream);
- stream.print (" ");
- SymtabEntry container = (SymtabEntry)m.container ();
- boolean isAbstract = false;
- boolean valueContainer = false;
- if (container instanceof ValueEntry)
- {
- isAbstract = ((ValueEntry)container).isAbstract ();
- valueContainer = true;
- }
- if (valueContainer && !isAbstract)
- stream.print ("public ");
- writeMethodSignature ();
- if (valueContainer && !isAbstract)
- {
- stream.println ();
- stream.println (" {");
- stream.println (" }");
- stream.println ();
- }
- else
- stream.println (";");
- } // interfaceMethod
-
- /**
- *
- **/
- protected void stub (String className, boolean isAbstract,
- Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index)
- {
- localOptimization =
- ((Arguments)Compile.compiler.arguments).LocalOptimization;
- this.isAbstract = isAbstract;
- this.symbolTable = symbolTable;
- this.m = m;
- this.stream = stream;
- this.methodIndex = index;
- if (m.comment () != null)
- m.comment ().generate (" ", stream);
- stream.print (" public ");
- writeMethodSignature ();
- stream.println ();
- stream.println (" {");
- writeStubBody ( className );
- stream.println (" } // " + m.name ());
- stream.println ();
- } // stub
-
- /**
- *
- **/
- protected void localstub (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index, InterfaceEntry i)
- {
- this.symbolTable = symbolTable;
- this.m = m;
- this.stream = stream;
- this.methodIndex = index;
- if (m.comment () != null)
- m.comment ().generate (" ", stream);
- stream.print (" public ");
- writeMethodSignature ();
- stream.println ();
- stream.println (" {");
- writeLocalStubBody (i);
- stream.println (" } // " + m.name ());
- stream.println ();
- } // stub
- /**
- *
- **/
- protected void skeleton (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index)
- {
- this.symbolTable = symbolTable;
- this.m = m;
- this.stream = stream;
- this.methodIndex = index;
- if (m.comment () != null)
- m.comment ().generate (" ", stream);
- stream.print (" public ");
- writeMethodSignature ();
- stream.println ();
- stream.println (" {");
- writeSkeletonBody ();
- stream.println (" } // " + m.name ());
- } // skeleton
-
- /**
- *
- **/
- protected void dispatchSkeleton (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index)
- {
- this.symbolTable = symbolTable;
- this.m = m;
- this.stream = stream;
- this.methodIndex = index;
- if (m.comment () != null)
- m.comment ().generate (" ", stream);
- writeDispatchCall ();
- } // dispatchSkeleton
-
- // <d57112>
- /**
- * Determine whether method entry m is a valuetype initializer.
- * @return true if is m is valuetype initializer, false otherwise.
- **/
- protected boolean isValueInitializer ()
- {
- MethodEntry currentInit = null;
- if ((m.container () instanceof ValueEntry))
- {
- Enumeration e = ((ValueEntry)m.container ()).initializers ().elements ();
- while (currentInit != m && e.hasMoreElements ())
- currentInit = (MethodEntry)e.nextElement ();
- }
- return (currentInit == m) && (null != m); // True ==> yes, false ==> no.
- } // isValueInitializer
-
- /**
- *
- **/
- protected void writeMethodSignature ()
- {
- boolean isValueInitializer = isValueInitializer (); // <d57112>
-
- // Step 0. Print the return type and name.
- // A return type of null indicates the "void" return type. If m is a
- // Valuetype intitializer, it has name "init" and a null return type,
- // but it maps to a ctor.
- // <d57112>
- //if (m.type () == null)
- //{
- // if (m.name ().compareTo ("init") != 0)
- // stream.print ("void");
- //}
- if (m.type () == null)
- {
- if (!isValueInitializer)
- stream.print ("void");
- }
- else
- {
- // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
- //stream.print (Util.javaStatefulName (m.type ()));
- stream.print (Util.javaName (m.type ()));
- }
- // <d57112> Value initializers map to constructors.
- // If the value has an 'init' method with a return type, handle
- // the method like other regular methods
- //if (m.valueMethod () && m.name ().compareTo ("init") == 0 &&
- // m.type () == null)
- if (isValueInitializer)
- stream.print (' ' + m.container ().name () + " (");
- else
- stream.print (' ' + m.name () + " (");
-
- // Step 1. Print the parameter list.
- boolean firstTime = true;
- Enumeration e = m.parameters ().elements ();
- while (e.hasMoreElements ())
- {
- if (firstTime)
- firstTime = false;
- else
- stream.print (", ");
- ParameterEntry parm = (ParameterEntry)e.nextElement ();
-
- writeParmType (parm.type (), parm.passType ());
-
- // Print parm name
- stream.print (' ' + parm.name ());
- }
-
- // Step 2. Add the context parameter if necessary.
- if (m.contexts ().size () > 0)
- {
- if (!firstTime)
- stream.print (", ");
- stream.print ("org.omg.CORBA.Context $context");
- }
-
- // Step 3. Print the throws clause (if necessary).
- if (m.exceptions ().size () > 0)
- {
- stream.print (") throws ");
- e = m.exceptions ().elements ();
- firstTime = true;
- while (e.hasMoreElements ())
- {
- if (firstTime)
- firstTime = false;
- else
- stream.print (", ");
- stream.print (Util.javaName ((SymtabEntry)e.nextElement ()));
- }
- }
- else
- stream.print (')');
- } // writeMethodSignature
-
- /**
- *
- **/
- protected void writeParmType (SymtabEntry parm, int passType)
- {
- if (passType != ParameterEntry.In)
- {
- parm = Util.typeOf (parm);
- stream.print (Util.holderName (parm));
- }
- else // passType is `in'
- // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
- //stream.print (Util.javaStatefulName (parm));
- stream.print (Util.javaName (parm));
- } // writeParmType
-
- /**
- *
- **/
- protected void writeDispatchCall ()
- {
- String indent = " ";
- String fullMethodName = m.fullName ();
- if (m instanceof AttributeEntry)
- {
- // determine the index at which the attribute name starts in the full name
- int index = fullMethodName.lastIndexOf ('/') + 1;
- if (m.type () == null) // if it's a modifier
- fullMethodName = fullMethodName.substring (0, index) + "_set_" + m.name ();
- else
- fullMethodName = fullMethodName.substring (0, index) + "_get_" + m.name ();
- }
- stream.println (indent + "case " + methodIndex + ": // " + fullMethodName);
- stream.println (indent + "{");
- indent = indent + " ";
- if (m.exceptions ().size () > 0)
- {
- stream.println (indent + "try {");
- indent = indent + " ";
- }
-
- // Step 1 Read arguments from the input stream
- SymtabEntry mtype = Util.typeOf (m.type ());
- Enumeration parms = m.parameters ().elements ();
- parms = m.parameters ().elements ();
- while (parms.hasMoreElements ())
- {
- ParameterEntry parm = (ParameterEntry) parms.nextElement ();
- String name = parm.name ();
- String anyName = '_' + name;
- SymtabEntry type = parm.type ();
- int passType = parm.passType ();
-
- if (passType == ParameterEntry.In)
- Util.writeInitializer (indent, name, "", type, writeInputStreamRead ("in", type), stream);
-
- else // the parm is a holder
- {
- String holderName = Util.holderName (type);
- stream.println (indent + holderName + ' ' + name + " = new " + holderName + " ();");
- if (passType == ParameterEntry.Inout)
- {
- if (type instanceof ValueBoxEntry)
- {
- ValueBoxEntry v = (ValueBoxEntry) type;
- TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
- SymtabEntry mType = member.type ();
- if (mType instanceof PrimitiveEntry)
- stream.println (indent + name + ".value = (" + writeInputStreamRead ("in", parm.type ()) + ").value;");
- else
- stream.println (indent + name + ".value = " + writeInputStreamRead ("in", parm.type ()) + ";");
- }
- else
- stream.println (indent + name + ".value = " + writeInputStreamRead ("in", parm.type ()) + ";");
- }
- }
- }
-
- // Step 1a. Read the context parameter if necessary. <d59560>
- if (m.contexts ().size () > 0)
- {
- stream.println (indent + "org.omg.CORBA.Context $context = in.read_Context ();");
- }
-
- // Step 2 Load return if necessary
- if (mtype != null)
- Util.writeInitializer (indent, "$result", "", mtype, stream);
-
- // Step 3 Call the method with the list of parameters
- writeMethodCall (indent);
-
- parms = m.parameters ().elements ();
- boolean firstTime = true;
- while (parms.hasMoreElements ())
- {
- ParameterEntry parm = (ParameterEntry)parms.nextElement ();
- if (firstTime)
- firstTime = false;
- else
- stream.print (", ");
- stream.print (parm.name ());
- }
-
- // Step 3a. Add the context parameter if necessary. <d59560>
- if (m.contexts ().size () > 0)
- {
- if (!firstTime)
- stream.print (", ");
- stream.print ("$context");
- }
-
- stream.println (");");
-
- //Step 3b. Create reply;
- writeCreateReply (indent);
-
- // Step 4 Write method's result to the output stream
- if (mtype != null)
- {
- writeOutputStreamWrite (indent, "out", "$result", mtype, stream);
- }
-
- // Step 5 Write inout/out value to the output stream
- parms = m.parameters ().elements ();
- while (parms.hasMoreElements ())
- {
- ParameterEntry parm = (ParameterEntry)parms.nextElement ();
- int passType = parm.passType ();
- if (passType != ParameterEntry.In)
- {
- writeOutputStreamWrite (indent, "out", parm.name () + ".value", parm.type (), stream);
- }
- }
-
- // Step 6 Handle exception
- if (m.exceptions ().size () > 0)
- {
- Enumeration exceptions = m.exceptions ().elements ();
- while (exceptions.hasMoreElements ())
- {
- indent = " ";
- ExceptionEntry exc = (ExceptionEntry) exceptions.nextElement ();
- String fullName = Util.javaQualifiedName (exc);
- stream.println (indent + "} catch (" + fullName + " $ex) {");
- indent = indent + " ";
- stream.println (indent + "out = $rh.createExceptionReply ();");
- stream.println (indent + Util.helperName (exc, true) + ".write (out, $ex);"); // <d61056>
- }
-
- indent = " ";
- stream.println (indent + "}");
- }
-
- stream.println (" break;");
- stream.println (" }");
- stream.println ();
- } // writeDispatchCall
-
- /**
- *
- **/
- protected void writeStubBody ( String className )
- {
- // Step 1 Create a request
- String methodName = Util.stripLeadingUnderscores (m.name ());
- if (m instanceof AttributeEntry)
- {
- if (m.type () == null) // if it's a modifier
- methodName = "_set_" + methodName;
- else
- methodName = "_get_" + methodName;
- }
- if( localOptimization && !isAbstract ) {
- stream.println (ONE_INDENT + "while(true) {" );
- stream.println(TWO_INDENT + "if(!this._is_local()) {" );
- }
- stream.println(THREE_INDENT +
- "org.omg.CORBA.portable.InputStream $in = null;");
- stream.println(THREE_INDENT + "try {");
- stream.println(FOUR_INDENT + "org.omg.CORBA.portable.OutputStream $out =" +
- " _request (\"" + methodName + "\", " + !m.oneway() + ");");
-
- // Step 1.b. Check string bounds <d56554 - klr>
- // begin <d56554> in/inout string bounds check
- Enumeration parms = m.parameters ().elements ();
- while (parms.hasMoreElements ())
- {
- ParameterEntry parm = (ParameterEntry)parms.nextElement ();
- SymtabEntry parmType = Util.typeOf (parm.type ());
- if (parmType instanceof StringEntry)
- if ((parm.passType () == ParameterEntry.In) ||
- (parm.passType () == ParameterEntry.Inout))
- {
- StringEntry string = (StringEntry)parmType;
- if (string.maxSize () != null)
- {
- stream.print (THREE_INDENT + "if (" + parm.name ());
- if (parm.passType () == ParameterEntry.Inout)
- stream.print (".value"); // get from holder
- stream.print (" == null || " + parm.name ());
- if (parm.passType () == ParameterEntry.Inout)
- stream.print (".value"); // get from holder
- stream.println (".length () > (" +
- Util.parseExpression (string.maxSize ()) + "))");
- stream.println (THREE_INDENT +
- "throw new org.omg.CORBA.BAD_PARAM (0," +
- " org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
- }
- }
- }
- // end <d56554> in/inout string bounds check
-
- // Step 2 Load the parameters into the outputStream
- parms = m.parameters ().elements ();
- while (parms.hasMoreElements ())
- {
- ParameterEntry parm = (ParameterEntry)parms.nextElement ();
- if (parm.passType () == ParameterEntry.In)
- writeOutputStreamWrite(FOUR_INDENT, "$out", parm.name (), parm.type (),
- stream);
- else if (parm.passType () == ParameterEntry.Inout)
- writeOutputStreamWrite(FOUR_INDENT, "$out", parm.name () + ".value",
- parm.type (), stream);
- }
-
- // Step 2a. Write the context parameter if necessary. <d59560>
- if (m.contexts ().size () > 0)
- {
- stream.println(FOUR_INDENT + "org.omg.CORBA.ContextList $contextList =" +
- "_orb ().create_context_list ();");
-
- for (int cnt = 0; cnt < m.contexts ().size (); cnt++)
- {
- stream.println(FOUR_INDENT +
- "$contextList.add (\"" + m.contexts (). elementAt (cnt) + "\");");
- }
- stream.println(FOUR_INDENT +
- "$out.write_Context ($context, $contextList);");
- }
-
- // Step 3 Invoke the method with the output stream
- stream.println (FOUR_INDENT + "$in = _invoke ($out);");
-
- SymtabEntry mtype = m.type ();
- if (mtype != null)
- Util.writeInitializer (FOUR_INDENT, "$result", "", mtype,
- writeInputStreamRead ("$in", mtype), stream);
-
- // Step 4 Read the inout/out values
- parms = m.parameters ().elements ();
- while (parms.hasMoreElements ())
- {
- ParameterEntry parm = (ParameterEntry)parms.nextElement ();
- if (parm.passType () != ParameterEntry.In)
- {
- if (parm.type () instanceof ValueBoxEntry)
- {
- ValueBoxEntry v = (ValueBoxEntry) parm.type ();
- TypedefEntry member =
- ((InterfaceState) v.state ().elementAt (0)).entry;
- SymtabEntry mType = member.type ();
- if (mType instanceof PrimitiveEntry)
- stream.println(FOUR_INDENT + parm.name () +
- ".value = (" + writeInputStreamRead ("$in", parm.type ()) +
- ").value;");
- else
- stream.println(FOUR_INDENT + parm.name () +
- ".value = " + writeInputStreamRead ("$in", parm.type ()) +";");
- }
- else
- stream.println (FOUR_INDENT + parm.name () + ".value = " +
- writeInputStreamRead ("$in", parm.type ()) + ";");
- }
- }
- // Step 4.b. Check string bounds <d56554 - klr>
- // begin <d56554> out/inout/return string bounds check
- parms = m.parameters ().elements ();
- while (parms.hasMoreElements ())
- {
- ParameterEntry parm = (ParameterEntry)parms.nextElement ();
- SymtabEntry parmType = Util.typeOf (parm.type ());
- if (parmType instanceof StringEntry)
- if ((parm.passType () == ParameterEntry.Out) ||
- (parm.passType () == ParameterEntry.Inout))
- {
- StringEntry string = (StringEntry)parmType;
- if (string.maxSize () != null)
- {
- stream.print (FOUR_INDENT + "if (" + parm.name () +
- ".value.length ()");
- stream.println (" > (" +
- Util.parseExpression (string.maxSize ()) + "))");
- stream.println (FIVE_INDENT + "throw new org.omg.CORBA.MARSHAL(0,"+
- "org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
- }
- }
- }
- if (mtype instanceof StringEntry)
- {
- StringEntry string = (StringEntry)mtype;
- if (string.maxSize () != null)
- {
- stream.println(FOUR_INDENT + "if ($result.length () > (" +
- Util.parseExpression (string.maxSize ()) + "))");
- stream.println (FIVE_INDENT + "throw new org.omg.CORBA.MARSHAL (0," +
- " org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
- }
- }
- // end <d56554> out/inout/return string bounds check
-
- // Step 5 Handle return if necessary
- if (mtype != null) {
- stream.println(FOUR_INDENT + "return $result;");
- } else {
- stream.println(FOUR_INDENT + "return;");
- }
-
- // Step 6 Handle exceptions
- stream.println(THREE_INDENT +
- "} catch (org.omg.CORBA.portable.ApplicationException " + "$ex) {");
- stream.println(FOUR_INDENT + "$in = $ex.getInputStream ();");
- stream.println(FOUR_INDENT + "String _id = $ex.getId ();");
-
- if (m.exceptions ().size () > 0)
- {
- Enumeration exceptions = m.exceptions ().elements ();
- boolean firstExc = true;
- while (exceptions.hasMoreElements ())
- {
- ExceptionEntry exc = (ExceptionEntry)exceptions.nextElement ();
- if (firstExc)
- {
- stream.print(FOUR_INDENT + "if ");
- firstExc = false;
- }
- else
- stream.print(FOUR_INDENT + "else if ");
-
- stream.println( "(_id.equals (\"" + exc.repositoryID ().ID () + "\"))");
- stream.println (FIVE_INDENT + "throw " +
- Util.helperName ((SymtabEntry)exc, false) + ".read ($in);");
- }
- stream.println(FOUR_INDENT + "else");
- stream.println(FIVE_INDENT + "throw new org.omg.CORBA.MARSHAL (_id);");
- }
- else
- stream.println(FOUR_INDENT + "throw new org.omg.CORBA.MARSHAL (_id);");
-
- stream.println(THREE_INDENT +
- "} catch (org.omg.CORBA.portable.RemarshalException $rm) {");
- stream.print( FOUR_INDENT );
- if (m.type () != null) // not a void method
- stream.print ("return ");
- stream.print (m.name () + " (");
- {
- // write parm names
- boolean firstTime = true;
- Enumeration e = m.parameters ().elements ();
- while (e.hasMoreElements ())
- {
- if (firstTime)
- firstTime = false;
- else
- stream.print (", ");
- ParameterEntry parm = (ParameterEntry)e.nextElement ();
- stream.print (parm.name ());
- }
- // Step 2. Add the context parameter if necessary. <d59297>
- if (m.contexts ().size () > 0)
- {
- if (!firstTime)
- stream.print (", ");
- stream.print ("$context");
- }
- }
- stream.println (TWO_INDENT + ");");
- stream.println (THREE_INDENT + "} finally {");
- stream.println (FOUR_INDENT + "_releaseReply ($in);");
- stream.println (THREE_INDENT + "}");
- if( localOptimization && !isAbstract ) {
- stream.println (TWO_INDENT + "}");
- writeStubBodyForLocalInvocation( className, methodName );
- }
-
- } // writeStubBody
-
-
- /**
- * This method writes the else part of the stub method invocation to
- * enable local invocation in case of collocation.
- * NOTE: This will only be invoked from writeStubBody.
- */
- private void writeStubBodyForLocalInvocation( String className,
- String methodName )
- {
- stream.println (TWO_INDENT + "else {" );
- stream.println (THREE_INDENT +
- "org.omg.CORBA.portable.ServantObject _so =");
- stream.println (FOUR_INDENT + "_servant_preinvoke(\"" + methodName +
- "\", _opsClass);" );
- stream.println(THREE_INDENT + "if (_so == null ) {");
- stream.println(FOUR_INDENT + "continue;" );
- stream.println(THREE_INDENT + "}");
- stream.println(THREE_INDENT + className + "Operations _self =" );
- stream.println(FOUR_INDENT + "(" + className + "Operations) _so.servant;");
- stream.println(THREE_INDENT + "try {" );
- Enumeration parms = m.parameters ().elements ();
- if (m instanceof AttributeEntry)
- {
- // Local Method Name should drop _get_ or _set_ prefix for attribute
- // entry
- methodName = methodName.substring( ATTRIBUTE_METHOD_PREFIX_LENGTH );
- }
- boolean voidReturnType = (this.m.type() == null);
- if ( !voidReturnType ) {
- stream.println (FOUR_INDENT + Util.javaName (this.m.type ()) +
- " $result;");
- }
- if( !isValueInitializer() ) {
- if ( voidReturnType ) {
- stream.print(FOUR_INDENT + "_self." + methodName + "( " );
- } else {
- stream.print(FOUR_INDENT + "$result = _self." +
- methodName + "( " );
- }
- while (parms.hasMoreElements ()) {
- ParameterEntry param = (ParameterEntry)parms.nextElement ();
- if( parms.hasMoreElements( ) ) {
- stream.print( " " + param.name() + "," );
- } else {
- stream.print( " " + param.name() );
- }
- }
- stream.print( ");" );
- stream.println( " " );
- if( voidReturnType ) {
- stream.println(FOUR_INDENT + "return;" );
- } else {
- stream.println(FOUR_INDENT + "return $result;" );
- }
- }
- stream.println(" ");
- stream.println (THREE_INDENT + "}" );
- stream.println (THREE_INDENT + "finally {" );
- stream.println (FOUR_INDENT + "_servant_postinvoke(_so);" );
- stream.println (THREE_INDENT + "}" );
- stream.println (TWO_INDENT + "}" );
- stream.println (ONE_INDENT + "}" );
- }
-
-
- protected void writeLocalStubBody (InterfaceEntry i)
- {
- // Step 1 Create a request
- String methodName = Util.stripLeadingUnderscores (m.name ());
- if (m instanceof AttributeEntry)
- {
- if (m.type () == null) // if it's a modifier
- methodName = "_set_" + methodName;
- else
- methodName = "_get_" + methodName;
- }
- //stream.println (" while(true) {");
- stream.println (" org.omg.CORBA.portable.ServantObject $so = " +
- "_servant_preinvoke (\"" + methodName + "\", " + "_opsClass);");
- //stream.println (" if ($so == null) {");
- //stream.println (" continue;");
- //stream.println (" }");
- String opsName = i.name() + "Operations";
- stream.println (" " + opsName + " $self = " + "(" + opsName + ") " + "$so.servant;");
- stream.println ();
- stream.println (" try {");
- stream.print (" ");
- if (m.type () != null) // not a void method
- stream.print ("return ");
- stream.print ("$self." + m.name () + " (");
- {
- // write parm names
- boolean firstTime = true;
- Enumeration e = m.parameters ().elements ();
- while (e.hasMoreElements ())
- {
- if (firstTime)
- firstTime = false;
- else
- stream.print (", ");
- ParameterEntry parm = (ParameterEntry)e.nextElement ();
- stream.print (parm.name ());
- }
- // Step 2. Add the context parameter if necessary. <d59297>
- if (m.contexts ().size () > 0)
- {
- if (!firstTime)
- stream.print (", ");
- stream.print ("$context");
- }
- }
- stream.println (");");
- //stream.println (" } catch (org.omg.CORBA.portable.RemarshalException $rm) {");
- //stream.println (" continue; ");
- stream.println (" } finally {");
- stream.println (" _servant_postinvoke ($so);");
- stream.println (" }");
- //stream.println (" }");
-
- } // writeLocalStubBody
-
-
-
- /**
- *
- **/
- private void writeInsert (String indent, String target, String source, SymtabEntry type, PrintWriter stream)
- {
- String typeName = type.name ();
- if (type instanceof PrimitiveEntry)
- {
- // RJB does something have to be done with TC offsets?
- if (typeName.equals ("long long"))
- stream.println (indent + source + ".insert_longlong (" + target + ");");
- else if (typeName.equals ("unsigned short"))
- stream.println (indent + source + ".insert_ushort (" + target + ");");
- else if (typeName.equals ("unsigned long"))
- stream.println (indent + source + ".insert_ulong (" + target + ");");
- else if (typeName.equals ("unsigned long long"))
- stream.println (indent + source + ".insert_ulonglong (" + target + ");");
- else
- stream.println (indent + source + ".insert_" + typeName + " (" + target + ");");
- }
- else if (type instanceof StringEntry)
- stream.println (indent + source + ".insert_" + typeName + " (" + target + ");");
- else
- stream.println (indent + Util.helperName (type, true) + ".insert (" + source + ", " + target + ");"); // <d61056>
- } // writeInsert
-
- /**
- *
- **/
- private void writeType (String indent, String name, SymtabEntry type, PrintWriter stream)
- {
- if (type instanceof PrimitiveEntry)
- {
- // RJB does something have to be done with TC offsets?
- if (type.name ().equals ("long long"))
- stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_longlong));");
- else if (type.name ().equals ("unsigned short"))
- stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ushort));");
- else if (type.name ().equals ("unsigned long"))
- stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong));");
- else if (type.name ().equals ("unsigned long long"))
- stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulonglong));");
- else
- stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_" + type.name () + "));");
- }
- else if (type instanceof StringEntry)
- {
- StringEntry s = (StringEntry)type;
- Expression e = s.maxSize ();
- if (e == null)
- stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (" + Util.parseExpression (e) + "));");
- else
- stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (0));");
- }
- else
- stream.println (indent + name + '(' + Util.helperName (type, true) + ".type ());"); // <d61056>
- } // writeType
-
- /**
- *
- **/
- private void writeExtract (String indent, String target, String source, SymtabEntry type, PrintWriter stream)
- {
- if (type instanceof PrimitiveEntry)
- {
- if (type.name ().equals ("long long"))
- stream.println (indent + target + " = " + source + ".extract_longlong ();");
- else if (type.name ().equals ("unsigned short"))
- stream.println (indent + target + " = " + source + ".extract_ushort ();");
- else if (type.name ().equals ("unsigned long"))
- stream.println (indent + target + " = " + source + ".extract_ulong ();");
- else if (type.name ().equals ("unsigned long long"))
- stream.println (indent + target + " = " + source + ".extract_ulonglong ();");
- else
- stream.println (indent + target + " = " + source + ".extract_" + type.name () + " ();");
- }
- else if (type instanceof StringEntry)
- stream.println (indent + target + " = " + source + ".extract_" + type.name () + " ();");
- else
- stream.println (indent + target + " = " + Util.helperName (type, true) + ".extract (" + source + ");"); // <d61056>
- } // writeExtract
-
- /**
- *
- **/
- private String writeExtract (String source, SymtabEntry type)
- {
- String extract;
- if (type instanceof PrimitiveEntry)
- {
- if (type.name ().equals ("long long"))
- extract = source + ".extract_longlong ()";
- else if (type.name ().equals ("unsigned short"))
- extract = source + ".extract_ushort ()";
- else if (type.name ().equals ("unsigned long"))
- extract = source + ".extract_ulong ()";
- else if (type.name ().equals ("unsigned long long"))
- extract = source + ".extract_ulonglong ()";
- else
- extract = source + ".extract_" + type.name () + " ()";
- }
- else if (type instanceof StringEntry)
- extract = source + ".extract_" + type.name () + " ()";
- else
- extract = Util.helperName (type, true) + ".extract (" + source + ')'; // <d61056>
- return extract;
- } // writeExtract
-
- /**
- *
- **/
- private void writeSkeletonBody ()
- {
- SymtabEntry mtype = Util.typeOf (m.type ());
-
- // If there is a return value, increment the appropriate counter
- stream.print (" ");
- if (mtype != null)
- stream.print ("return ");
- stream.print ("_impl." + m.name () + '(');
-
- // Load the parameters
- Enumeration parms = m.parameters ().elements ();
- boolean first = true;
- while (parms.hasMoreElements ())
- {
- ParameterEntry parm = (ParameterEntry)parms.nextElement ();
- if (first)
- first = false;
- else
- stream.print (", ");
- stream.print (parm.name ());
- }
- if (m.contexts ().size () != 0)
- {
- if (!first)
- stream.print (", ");
- stream.print ("$context");
- }
-
- stream.println (");");
- } // writeSkeletonBody
-
- /**
- *
- **/
- protected String passType (int passType)
- {
- String type;
- switch (passType)
- {
- case ParameterEntry.Inout:
- type = "org.omg.CORBA.ARG_INOUT.value";
- break;
- case ParameterEntry.Out:
- type = "org.omg.CORBA.ARG_OUT.value";
- break;
- case ParameterEntry.In:
- default:
- type = "org.omg.CORBA.ARG_IN.value";
- break;
- }
- return type;
- } // passType
-
- /**
- * This is only used by AttributeGen. The java mapping says
- * the names should be getXXX and setXXX, but CORBA says they
- * should be _get_XXX and _set_XXX. this.name () will be
- * getXXX. realName is set by AttributeGen to _get_XXX.
- **/
- protected void serverMethodName (String name)
- {
- realName = (name == null) ? "" : name;
- } // serverMethodName
-
- /**
- *
- **/
- private void writeOutputStreamWrite (String indent, String oStream, String name, SymtabEntry type, PrintWriter stream)
- {
- String typeName = type.name ();
- stream.print (indent);
- if (type instanceof PrimitiveEntry)
- {
- if (typeName.equals ("long long"))
- stream.println (oStream + ".write_longlong (" + name +");");
- else if (typeName.equals ("unsigned short"))
- stream.println (oStream + ".write_ushort (" + name + ");");
- else if (typeName.equals ("unsigned long"))
- stream.println (oStream + ".write_ulong (" + name + ");");
- else if (typeName.equals ("unsigned long long"))
- stream.println (oStream + ".write_ulonglong (" + name + ");");
- else
- stream.println (oStream + ".write_" + typeName + " (" + name + ");");
- }
- else if (type instanceof StringEntry)
- stream.println (oStream + ".write_" + typeName + " (" + name + ");");
- else if (type instanceof SequenceEntry)
- stream.println (oStream + ".write_" + type.type().name() + " (" + name + ");");
- else if (type instanceof ValueBoxEntry)
- {
- ValueBoxEntry v = (ValueBoxEntry) type;
- TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
- SymtabEntry mType = member.type ();
-
- // if write value to the boxed holder indicated by the name ending with ".value"
- if (mType instanceof PrimitiveEntry && name.endsWith (".value"))
- stream.println (Util.helperName (type, true) + ".write (" + oStream + ", " // <d61056>
- + " new " + Util.javaQualifiedName (type) + " (" + name + "));"); //<d60929>
- else
- stream.println (Util.helperName (type, true) + ".write (" + oStream + ", " + name + ");"); //<d60929> // <d61056>
- }
- else if (type instanceof ValueEntry)
- stream.println (Util.helperName (type, true) + ".write (" + oStream + ", " + name + ");"); //<d60929> // <d61056>
- else
- stream.println (Util.helperName (type, true) + ".write (" + oStream + ", " + name + ");"); // <d61056>
- } // writeOutputStreamWrite
-
- /**
- *
- **/
- private String writeInputStreamRead (String source, SymtabEntry type)
- {
- String read = "";
- if (type instanceof PrimitiveEntry)
- {
- if (type.name ().equals ("long long"))
- read = source + ".read_longlong ()";
- else if (type.name ().equals ("unsigned short"))
- read = source + ".read_ushort ()";
- else if (type.name ().equals ("unsigned long"))
- read = source + ".read_ulong ()";
- else if (type.name ().equals ("unsigned long long"))
- read = source + ".read_ulonglong ()";
- else
- read = source + ".read_" + type.name () + " ()";
- }
- else if (type instanceof StringEntry)
- read = source + ".read_" + type.name () + " ()";
- else
- read = Util.helperName (type, true) + ".read (" + source + ')'; // <d61056>
- return read;
- } // writeInputStreamRead
-
- /**
- *
- **/
- protected void writeMethodCall (String indent)
- {
- SymtabEntry mtype = Util.typeOf (m.type ());
- if (mtype == null)
- stream.print (indent + "this." + m.name () + " (");
- else
- stream.print (indent + "$result = this." + m.name () + " (");
- } // writeMethodCall
-
- /**
- *
- **/
- protected void writeCreateReply(String indent){
- stream.println(indent + "out = $rh.createReply();");
- }
-
- protected int methodIndex = 0;
- protected String realName = "";
- protected Hashtable symbolTable = null;
- protected MethodEntry m = null;
- protected PrintWriter stream = null;
- protected boolean localOptimization = false;
- protected boolean isAbstract = false;
-} // class MethodGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen24.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen24.java
deleted file mode 100644
index 99c05ec..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen24.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -D62023 <klr> New file to implement CORBA 2.4 RTF
-// -D62794 <klr> Fix problem with no-arg create functions
-
-import java.io.PrintWriter;
-
-import java.util.Enumeration;
-import java.util.Vector;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.ParameterEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-import com.sun.tools.corba.se.idl.ValueBoxEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.StructEntry;
-
-/**
- *
- **/
-public class MethodGen24 extends MethodGen
-{
- /**
- * Public zero-argument constructor.
- **/
- public MethodGen24 ()
- {
- } // ctor
-
- /**
- * Print the parameter list for the factory method.
- * @param m The method to list parameters for
- * @param listTypes If try, declare the parms, otherwise just list them
- * @param stream The PrintWriter to print on
- */
- protected void writeParmList (MethodEntry m, boolean listTypes, PrintWriter stream) {
- boolean firstTime = true;
- Enumeration e = m.parameters ().elements ();
- while (e.hasMoreElements ())
- {
- if (firstTime)
- firstTime = false;
- else
- stream.print (", ");
- ParameterEntry parm = (ParameterEntry)e.nextElement ();
- if (listTypes) {
- writeParmType (parm.type (), parm.passType ());
- stream.print (' ');
- }
- // Print parm name
- stream.print (parm.name ());
- // end of parameter list
- }
- }
-
- /**
- * <d62023> Write the methodEntry for a valuetype factory method into
- * the Value Helper class. Contents from email from Simon,
- * 4/25/99.
- **/
- protected void helperFactoryMethod (Hashtable symbolTable, MethodEntry m, SymtabEntry t, PrintWriter stream)
- {
- this.symbolTable = symbolTable;
- this.m = m;
- this.stream = stream;
- String initializerName = m.name ();
- String typeName = Util.javaName (t);
- String factoryName = typeName + "ValueFactory";
-
- // Step 1. Print factory method decl up to parms.
- stream.print (" public static " + typeName + " " + initializerName +
- " (org.omg.CORBA.ORB $orb");
- if (!m.parameters ().isEmpty ())
- stream.print (", "); // <d62794>
-
- // Step 2. Print the declaration parameter list.
- writeParmList (m, true, stream);
-
- // Step 3. Print the body of the factory method
- stream.println (")");
- stream.println (" {");
- stream.println (" try {");
- stream.println (" " + factoryName + " $factory = (" + factoryName + ")");
- stream.println (" ((org.omg.CORBA_2_3.ORB) $orb).lookup_value_factory(id());");
- stream.print (" return $factory." + initializerName + " (");
- writeParmList (m, false, stream);
- stream.println (");");
- stream.println (" } catch (ClassCastException $ex) {");
- stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
- stream.println (" }");
- stream.println (" }");
- stream.println ();
- } // helperFactoryMethod
-
- /**
- * <d62023> - write an abstract method definition
- **/
- protected void abstractMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
- {
- this.symbolTable = symbolTable;
- this.m = m;
- this.stream = stream;
- if (m.comment () != null)
- m.comment ().generate (" ", stream);
- stream.print (" ");
- stream.print ("public abstract ");
- writeMethodSignature ();
- stream.println (";");
- stream.println ();
- } // abstractMethod
-
- /**
- * <d62023> - write a default factory method implementation for the
- * <value>DefaultFactory. m is a methodEntry for a factory
- * method contained in a non-abstract ValueEntry.
- **/
- protected void defaultFactoryMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
- {
- this.symbolTable = symbolTable;
- this.m = m;
- this.stream = stream;
- String typeName = m.container (). name ();
- stream.println ();
- if (m.comment () != null)
- m.comment ().generate (" ", stream);
- stream.print (" public " + typeName + " " + m.name () + " (");
- writeParmList (m, true, stream);
- stream.println (")");
- stream.println (" {");
- stream.print (" return new " + typeName + "Impl (");
- writeParmList (m, false, stream);
- stream.println (");");
- stream.println (" }");
- } // defaultFactoryMethod
-
- /**
- * <d62023> - remove all valueInitializer junk
- **/
- protected void writeMethodSignature ()
- {
- // Step 0. Print the return type and name.
- // A return type of null indicates the "void" return type. If m is a
- // Valuetype factory method, it has a null return type,
- if (m.type () == null)
- {
- // if factory method, result type is container
- if (isValueInitializer ())
- stream.print (m.container ().name ());
- else
- stream.print ("void");
- }
- else
- {
- stream.print (Util.javaName (m.type ()));
- }
- stream.print (' ' + m.name () + " (");
-
- // Step 1. Print the parameter list.
- boolean firstTime = true;
- Enumeration e = m.parameters ().elements ();
- while (e.hasMoreElements ())
- {
- if (firstTime)
- firstTime = false;
- else
- stream.print (", ");
- ParameterEntry parm = (ParameterEntry)e.nextElement ();
-
- writeParmType (parm.type (), parm.passType ());
-
- // Print parm name
- stream.print (' ' + parm.name ());
- }
-
- // Step 2. Add the context parameter if necessary.
- if (m.contexts ().size () > 0)
- {
- if (!firstTime)
- stream.print (", ");
- stream.print ("org.omg.CORBA.Context $context");
- }
-
- // Step 3. Print the throws clause (if necessary).
- if (m.exceptions ().size () > 0)
- {
- stream.print (") throws ");
- e = m.exceptions ().elements ();
- firstTime = true;
- while (e.hasMoreElements ())
- {
- if (firstTime)
- firstTime = false;
- else
- stream.print (", ");
- stream.print (Util.javaName ((SymtabEntry)e.nextElement ()));
- }
- }
- else
- stream.print (')');
- } // writeMethodSignature
-
- /**
- * <d62023> - delete method templates for valuetypes
- **/
- protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
- {
- this.symbolTable = symbolTable;
- this.m = m;
- this.stream = stream;
- if (m.comment () != null)
- m.comment ().generate (" ", stream);
- stream.print (" ");
- writeMethodSignature ();
- stream.println (";");
- } // interfaceMethod
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGenClone24.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGenClone24.java
deleted file mode 100644
index 49c6bc8..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGenClone24.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -D62023 <klr> New file to implement CORBA 2.4 RTF
-// NOTE: The methods in this class should be exact copies of the
-// correspoind methods in MethodGen24. The purpose of this class is
-// to inject the changes made in MethodGen24 between AttributeGen
-// and AttributeGen24. When the AttributeGen24 changes are merged, this
-// class should be deleted.
-
-import java.io.PrintWriter;
-
-import java.util.Enumeration;
-import java.util.Vector;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.ParameterEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-import com.sun.tools.corba.se.idl.ValueBoxEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.StructEntry;
-
-/**
- *
- **/
-public class MethodGenClone24 extends AttributeGen
-{
- /**
- * Public zero-argument constructor.
- **/
- public MethodGenClone24 ()
- {
- } // ctor
-
- /**
- * <d62023> - write an abstract method definition
- **/
- protected void abstractMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
- {
- this.symbolTable = symbolTable;
- this.m = m;
- this.stream = stream;
- if (m.comment () != null)
- m.comment ().generate (" ", stream);
- stream.print (" ");
- stream.print ("public abstract ");
- writeMethodSignature ();
- stream.println (";");
- stream.println ();
- } // abstractMethod
-
- /**
- * <d62023> - delete method templates for valuetypes
- **/
- protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
- {
- this.symbolTable = symbolTable;
- this.m = m;
- this.stream = stream;
- if (m.comment () != null)
- m.comment ().generate (" ", stream);
- stream.print (" ");
- writeMethodSignature ();
- stream.println (";");
- } // interfaceMethod
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ModuleGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ModuleGen.java
deleted file mode 100644
index ceae4b1..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ModuleGen.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.ModuleEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-
-/**
- *
- **/
-public class ModuleGen implements com.sun.tools.corba.se.idl.ModuleGen
-{
- /**
- * Public zero-argument constructor.
- **/
- public ModuleGen ()
- {
- } // ctor
-
- /**
- * Generate Java code for all members of an IDL module.
- **/
- public void generate (Hashtable symbolTable, ModuleEntry entry, PrintWriter stream)
- {
- // Generate the package directory
- String name = Util.containerFullName( entry ) ;
- Util.mkdir (name);
-
- // Generate all of the contained types
- Enumeration e = entry.contained ().elements ();
- while (e.hasMoreElements ())
- {
- SymtabEntry element = (SymtabEntry)e.nextElement ();
- if (element.emit ())
- element.generate (symbolTable, stream);
- }
- } // generate
-} // class ModuleGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifier.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifier.java
deleted file mode 100644
index a69d507..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifier.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable ;
-
-public interface NameModifier {
- /** Create a modified name from the base name.
- */
- String makeName( String base ) ;
-} ;
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifierImpl.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifierImpl.java
deleted file mode 100644
index afbd2ea..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifierImpl.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright (c) 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable ;
-
-import com.sun.tools.corba.se.idl.toJavaPortable.NameModifier ;
-
-public class NameModifierImpl implements NameModifier {
- private String prefix ;
- private String suffix ;
-
- public NameModifierImpl( )
- {
- this.prefix = null ;
- this.suffix = null ;
- }
-
- public NameModifierImpl( String prefix, String suffix )
- {
- this.prefix = prefix ;
- this.suffix = suffix ;
- }
-
- /** Construct a NameModifier from a pattern of the form xxx%xxx.
- * The pattern must consist of characters chosen from the
- * set [A-Za-z0-9%$_]. In addition, the pattern must contain
- * exactly one % character. Finally, if % is not the first char in
- * the pattern, the pattern must not start with a number.
- * <p>
- * The semantics of makeName are very simply: just replace the
- * % character with the base in the pattern and return the result.
- */
- public NameModifierImpl( String pattern )
- {
- int first = pattern.indexOf( '%' ) ;
- int last = pattern.lastIndexOf( '%' ) ;
-
- if (first != last)
- throw new IllegalArgumentException(
- Util.getMessage( "NameModifier.TooManyPercent" ) ) ;
-
- if (first == -1)
- throw new IllegalArgumentException(
- Util.getMessage( "NameModifier.NoPercent" ) ) ;
-
- for (int ctr = 0; ctr<pattern.length(); ctr++) {
- char ch = pattern.charAt( ctr ) ;
- if (invalidChar( ch, ctr==0 )) {
- char[] chars = new char[] { ch } ;
- throw new IllegalArgumentException(
- Util.getMessage( "NameModifier.InvalidChar",
- new String( chars )) ) ;
- }
- }
-
- // at this point, 0 <= first && first < pattern.length()
- prefix = pattern.substring( 0, first ) ;
- suffix = pattern.substring( first+1 ) ;
- }
-
- /** Return true if ch is invalid as a character in an
- * identifier. If ch is a number, it is invalid only if
- * isFirst is true.
- */
- private boolean invalidChar( char ch, boolean isFirst )
- {
- if (('A'<=ch) && (ch<='Z'))
- return false ;
- else if (('a'<=ch) && (ch<='z'))
- return false ;
- else if (('0'<=ch) && (ch<='9'))
- return isFirst ;
- else if (ch=='%')
- return false ;
- else if (ch=='$')
- return false ;
- else if (ch=='_')
- return false ;
- else
- return true ;
- }
-
- public String makeName( String base )
- {
- StringBuffer sb = new StringBuffer() ;
-
- if (prefix != null)
- sb.append( prefix ) ;
-
- sb.append( base ) ;
-
- if (suffix != null)
- sb.append( suffix ) ;
-
- return sb.toString() ;
- }
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NativeGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NativeGen.java
deleted file mode 100644
index c29ec74..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NativeGen.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2000, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.NativeEntry;
-import com.sun.tools.corba.se.idl.ModuleEntry;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.StringEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-
-/**
- *
- **/
-public class NativeGen implements com.sun.tools.corba.se.idl.NativeGen
-{
- /**
- * Public zero-argument constructor.
- **/
- public NativeGen ()
- {
- } // ctor
-
- /**
- * Generate Java code for an IDL constant. A constant is written to
- * a new class only when it is not a member of an interface; otherwise
- * it written to the interface class in which it resides.
- **/
- public void generate (Hashtable symbolTable, NativeEntry c, PrintWriter s)
- {
- // noop, do not generate anything
- } // generate
-
-} // class NativeGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/PrimitiveGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/PrimitiveGen.java
deleted file mode 100644
index 95365bc..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/PrimitiveGen.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-
-/**
- *
- **/
-public class PrimitiveGen implements com.sun.tools.corba.se.idl.PrimitiveGen, JavaGenerator
-{
- /**
- * Public zero-argument constructor.
- **/
- public PrimitiveGen ()
- {
- } // ctor
-
- /**
- * This method should never be called; this class exists for
- * the JavaGenerator interface.
- **/
- public void generate (Hashtable symbolTable, PrimitiveEntry e, PrintWriter stream)
- {
- } // generate
-
- ///////////////
- // From JavaGenerator
-
- public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
- {
- return type (index, indent, tcoffsets, name, entry, stream);
- } // helperType
-
- public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
- tcoffsets.set (entry);
- String emit = "tk_null";
- if (entry.name ().equals ("null"))
- emit = "tk_null";
- else if (entry.name ().equals ("void"))
- emit = "tk_void";
- else if (entry.name ().equals ("short"))
- emit = "tk_short";
- else if (entry.name ().equals ("long"))
- emit = "tk_long";
- else if (entry.name ().equals ("long long"))
- emit = "tk_longlong";
- else if (entry.name ().equals ("unsigned short"))
- emit = "tk_ushort";
- else if (entry.name ().equals ("unsigned long"))
- emit = "tk_ulong";
- else if (entry.name ().equals ("unsigned long long"))
- emit = "tk_ulonglong";
- else if (entry.name ().equals ("float"))
- emit = "tk_float";
- else if (entry.name ().equals ("double"))
- emit = "tk_double";
- else if (entry.name ().equals ("boolean"))
- emit = "tk_boolean";
- else if (entry.name ().equals ("char"))
- emit = "tk_char";
- else if (entry.name ().equals ("octet"))
- emit = "tk_octet";
- else if (entry.name ().equals ("any"))
- emit = "tk_any";
- else if (entry.name ().equals ("TypeCode"))
- emit = "tk_TypeCode";
- else if (entry.name ().equals ("wchar"))
- emit = "tk_wchar";
- else if (entry.name ().equals ("Principal")) // <d61961>
- emit = "tk_Principal";
- else if (entry.name ().equals ("wchar"))
- emit = "tk_wchar";
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind." + emit + ");");
- return index;
- } // type
-
- public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- } // helperRead
-
- public void helperWrite (SymtabEntry entry, PrintWriter stream)
- {
- } // helperWrite
-
- public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- stream.println (indent + name + " = " + "istream.read_" + Util.collapseName (entry.name ()) + " ();");
- return index;
- } // read
-
- public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- stream.println (indent + "ostream.write_" + Util.collapseName (entry.name ()) + " (" + name + ");");
- return index;
- } // write
-
- // From JavaGenerator
- ///////////////
-} // class PrimitiveGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/SequenceGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/SequenceGen.java
deleted file mode 100644
index e21c469..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/SequenceGen.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -F46082.51<daz> Remove -stateful feature; javaStatefulName() obsolete.
-// -D61056 <klr> Use Util.helperName
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.SequenceEntry;
-import com.sun.tools.corba.se.idl.StringEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-
-import com.sun.tools.corba.se.idl.constExpr.Expression;
-
-/**
- *
- **/
-public class SequenceGen implements com.sun.tools.corba.se.idl.SequenceGen, JavaGenerator
-{
- /**
- * Public zero-argument constructor.
- **/
- public SequenceGen ()
- {
- } // ctor
-
- /**
- *
- **/
- public void generate (Hashtable symbolTable, SequenceEntry s, PrintWriter stream)
- {
- } // generator
-
- ///////////////
- // From JavaGenerator
-
- public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
- {
- int offsetOfType = tcoffsets.offset (entry.type ().fullName ());
- if (offsetOfType >= 0)
- {
- // This code uses the deprecated create_recursive_sequence_tc()
- // It should be eliminated when the API is removed from the ORB class
- // Regardles, this code will not be emitted since updated emitters invoke
- // method type() below instead of helperType() when handling sequences
-
- // This is a recursive sequence
- tcoffsets.set (null);
- Expression maxSize = ((SequenceEntry)entry).maxSize ();
- if (maxSize == null)
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_recursive_sequence_tc (0, " + (offsetOfType - tcoffsets.currentOffset ()) + ");");
- else
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_recursive_sequence_tc (" + Util.parseExpression (maxSize) + ", " + (offsetOfType - tcoffsets.currentOffset ()) + ");");
- tcoffsets.bumpCurrentOffset (4); // add indirection field
- }
- else
- {
- // This is a normal sequence
- tcoffsets.set (entry);
- index = ((JavaGenerator)entry.type ().generator ()).helperType (index + 1, indent, tcoffsets, name, entry.type (), stream);
- Expression maxSize = ((SequenceEntry)entry).maxSize ();
- if (maxSize == null)
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (0, " + name + ");");
- else
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (" + Util.parseExpression (maxSize) + ", " + name + ");");
- }
- tcoffsets.bumpCurrentOffset (4); // add on the seq max size
- return index;
- } // helperType
-
- public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
- int offsetOfType = tcoffsets.offset (entry.type ().fullName ());
- if (offsetOfType >= 0)
- {
- // This is a recursive sequence
- tcoffsets.set (null);
-
- // Need to fix later: how to get repositoryId of IDL type containing this sequence?
- // entry.repositoryID().ID() returns empty string and
- // Util.javaQualifiedName(entry) returns internal name which is not valid repId
-
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_recursive_tc (" + "\"\"" + ");");
- tcoffsets.bumpCurrentOffset (4); // add indirection field
- }
- else
- {
- // This is a normal sequence
- tcoffsets.set (entry);
- index = ((JavaGenerator)entry.type ().generator ()).type (index + 1, indent, tcoffsets, name, entry.type (), stream);
- Expression maxSize = ((SequenceEntry)entry).maxSize ();
- if (maxSize == null)
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (0, " + name + ");");
- else
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (" + Util.parseExpression (maxSize) + ", " + name + ");");
- }
- //stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
- return index;
- } // type
-
- public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- } // helperRead
-
- public void helperWrite (SymtabEntry entry, PrintWriter stream)
- {
- } // helperWrite
-
- public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- SequenceEntry seq = (SequenceEntry)entry;
- String length = "_len" + index++;
- stream.println (indent + "int " + length + " = istream.read_long ();");
- if (seq.maxSize () != null)
- {
- stream.println (indent + "if (" + length + " > (" + Util.parseExpression (seq.maxSize ()) + "))");
- stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
- }
- String seqOfName;
- try
- {
- seqOfName = Util.sansArrayInfo ((String)seq.dynamicVariable (Compile.typedefInfo));
- }
- catch (NoSuchFieldException e)
- {
- seqOfName = seq.name ();
- }
- int startArray = seqOfName.indexOf ('[');
- String arrayDcl = seqOfName.substring (startArray);
- seqOfName = seqOfName.substring (0, startArray);
-
- // For interfaces having state, e.g., valuetypes.
- SymtabEntry seqOfEntry = (SymtabEntry)Util.symbolTable.get (seqOfName.replace ('.', '/'));
- if (seqOfEntry != null && seqOfEntry instanceof InterfaceEntry && ((InterfaceEntry)seqOfEntry).state () != null)
- // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
- //seqOfName = Util.javaStatefulName ((InterfaceEntry)seqOfEntry);
- seqOfName = Util.javaName ((InterfaceEntry)seqOfEntry);
-
- arrayDcl = arrayDcl.substring (2);
- stream.println (indent + name + " = new " + seqOfName + '[' + length + ']' + arrayDcl + ';');
- if (seq.type () instanceof PrimitiveEntry)
- // <d61961> Check for CORBA::Principal, too
- //if (seq.type ().name ().equals ("any") || seq.type ().name ().equals ("TypeCode"))
- if (seq.type ().name ().equals ("any") ||
- seq.type ().name ().equals ("TypeCode") ||
- seq.type ().name ().equals ("Principal"))
- {
- String loopIndex = "_o" + index;
- stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')');
- stream.println (indent + " " + name + '[' + loopIndex + "] = istream.read_" + seq.type ().name () + " ();");
- }
- else
- { // special case for ValueBox: if name is "xxx tmp", drop xxx
- String varName = name;
- int nameIndex = varName.indexOf (' ');
- if ( nameIndex != -1 )
- varName = varName.substring( nameIndex + 1 );
- stream.println (indent + "istream.read_" + Util.collapseName (entry.type ().name ()) + "_array (" + varName + ", 0, " + length + ");");
- }
- else if (entry.type () instanceof StringEntry)
- {
- String loopIndex = "_o" + index;
- stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')');
- stream.println (indent + " " + name + '[' + loopIndex + "] = istream.read_" + seq.type ().name () + " ();");
- }
- else if (entry.type () instanceof SequenceEntry)
- {
- String loopIndex = "_o" + index;
- stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')');
- stream.println (indent + '{');
- index = ((JavaGenerator)seq.type ().generator ()).read (index, indent + " ", name + '[' + loopIndex + ']', seq.type (), stream);
- stream.println (indent + '}');
- }
- else
- { // special case for ValueBox: if name is "xxx tmp", drop xxx
- String varName = name;
- int nameIndex = varName.indexOf (' ');
- if ( nameIndex != -1 )
- varName = varName.substring( nameIndex + 1 );
- String loopIndex = "_o" + index;
- stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + varName + ".length; ++" + loopIndex + ')');
- stream.println (indent + " " + varName + '[' + loopIndex + "] = " + Util.helperName (seq.type (), true) + ".read (istream);"); // <d61056>
- }
- return index;
- } // read
-
- public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- SequenceEntry seq = (SequenceEntry)entry;
- if (seq.maxSize () != null)
- {
- stream.println (indent + "if (" + name + ".length > (" + Util.parseExpression (seq.maxSize ()) + "))");
- stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
- }
- stream.println (indent + "ostream.write_long (" + name + ".length);");
- if (entry.type () instanceof PrimitiveEntry)
- // <d61961> Check for CORBA::Principal, too.
- //if (entry.type ().name ().equals ("any") || entry.type ().name ().equals ("TypeCode"))
- if (entry.type ().name ().equals ("any") ||
- entry.type ().name ().equals ("TypeCode") ||
- entry.type ().name ().equals ("Principal"))
- {
- String loopIndex = "_i" + index++;
- stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')');
- stream.println (indent + " ostream.write_" + seq.type ().name () + " (" + name + '[' + loopIndex + "]);");
- }
- else
- stream.println (indent + "ostream.write_" + Util.collapseName (entry.type ().name ()) + "_array (" + name + ", 0, " + name + ".length);");
- else if (entry.type () instanceof StringEntry)
- {
- String loopIndex = "_i" + index++;
- stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')');
- stream.println (indent + " ostream.write_" + seq.type ().name () + " (" + name + '[' + loopIndex + "]);");
- }
- else if (entry.type () instanceof SequenceEntry)
- {
- String loopIndex = "_i" + index++;
- stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')');
- stream.println (indent + '{');
- index = ((JavaGenerator)seq.type ().generator ()).write (index, indent + " ", name + '[' + loopIndex + ']', seq.type (), stream);
- stream.println (indent + '}');
- }
- else
- {
- String loopIndex = "_i" + index++;
- stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')');
- stream.println (indent + " " + Util.helperName (seq.type (), true) + ".write (ostream, " + name + '[' + loopIndex + "]);"); // <d61056>
- }
- return index;
- } // write
-
- // From JavaGenerator
- ///////////////
-} // class SequenceGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Skeleton.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Skeleton.java
deleted file mode 100644
index 3707048..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Skeleton.java
+++ /dev/null
@@ -1,568 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -F46082.51<daz> Remove -stateful feature; javaStatefulName() obsolete.
-// -D57147 <klr> Make _Tie implement org.omg.CORBA.portable.InvokeHandler
-// -D58037 <klr> Make _Tie delegate to Operations interface
-// -D62739 <klr> no TIE for values that support abstract interfaces, etc.
-
-import java.io.File;
-import java.io.PrintWriter;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.AttributeEntry;
-import com.sun.tools.corba.se.idl.GenFileStream;
-
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-
-/**
- *
- **/
-public class Skeleton implements AuxGen
-{
- private NameModifier skeletonNameModifier ;
- private NameModifier tieNameModifier ;
-
- public Skeleton ()
- {
- }
-
- public void generate (Hashtable symbolTable, SymtabEntry entry)
- {
- // <d62739-begin>
- // Per Simon, 5-12-99, don't generate TIE or Skeleton for
- //
- // 1) valuetypes supporting abstract interfaces
- // 2) valuetypes with no supports.
- // 3) abstract interfaces
- //
- if (entry instanceof ValueEntry)
- {
- ValueEntry v = (ValueEntry) entry;
- if ((v.supports ().size () == 0) ||
- ((InterfaceEntry) v.supports ().elementAt (0)).isAbstract ()) {
- return;
- }
- }
- if (((InterfaceEntry) entry).isAbstract ()) {
- return;
- }
- // <d62739-end>
-
- this.symbolTable = symbolTable;
-
- this.i = (InterfaceEntry)entry;
- init ();
- openStream ();
- if (stream == null)
- return;
- writeHeading ();
- writeBody ();
- writeClosing ();
- closeStream ();
- } // generate
-
- /**
- * Initialize members unique to this generator.
- **/
- protected void init ()
- {
- tie = ((Arguments)Compile.compiler.arguments).TIEServer ;
- poa = ((Arguments)Compile.compiler.arguments).POAServer ;
-
- skeletonNameModifier =
- ((Arguments)Compile.compiler.arguments).skeletonNameModifier ;
- tieNameModifier =
- ((Arguments)Compile.compiler.arguments).tieNameModifier ;
-
- tieClassName = tieNameModifier.makeName( i.name() ) ;
- skeletonClassName = skeletonNameModifier.makeName( i.name() ) ;
-
- intfName = Util.javaName (i);
- // for valuetype, get the name of the interface the valuetype supports
- if (i instanceof ValueEntry)
- {
- ValueEntry v = (ValueEntry) i;
- InterfaceEntry intf = (InterfaceEntry) v.supports ().elementAt (0);
- intfName = Util.javaName (intf);
- }
- } // init
-
- protected void openStream ()
- {
- if (tie)
- stream = Util.stream( i, tieNameModifier, ".java" ) ;
- else
- stream = Util.stream( i, skeletonNameModifier, ".java" ) ;
- } // openStream
-
- protected void writeHeading ()
- {
- Util.writePackage (stream, i, Util.StubFile);
- Util.writeProlog (stream, ((GenFileStream)stream).name ());
- if (i.comment () != null)
- i.comment ().generate ("", stream);
- writeClassDeclaration ();
- stream.println ('{');
- stream.println ();
- } // writeHeading
-
- protected void writeClassDeclaration ()
- {
- if (tie){
- stream.println ("public class " + tieClassName +
- " extends " + skeletonClassName ) ;
- } else {
- if (poa) {
- stream.println ("public abstract class " + skeletonClassName +
- " extends org.omg.PortableServer.Servant");
- stream.print (" implements " + intfName + "Operations, ");
- stream.println ("org.omg.CORBA.portable.InvokeHandler");
- } else {
- stream.println ("public abstract class " + skeletonClassName +
- " extends org.omg.CORBA.portable.ObjectImpl");
- stream.print (" implements " + intfName + ", ");
- stream.println ("org.omg.CORBA.portable.InvokeHandler");
- }
- }
- } // writeClassDeclaration
-
- /**
- *
- **/
- protected void writeBody ()
- {
- // <f46082.51> Remove -stateful feature. ?????
- //if (i.state () != null)
- // writeState ();
- writeCtors ();
- if (i instanceof ValueEntry)
- {
- // use the interface the valuetype supports to generate the
- // tie class instead of using the valuetype itself
- ValueEntry v = (ValueEntry) i;
- this.i = (InterfaceEntry) v.supports ().elementAt (0);
- }
- buildMethodList ();
- //DispatchMethod and MethodTable
- if (tie){ //Concrete class implementing the remote interface
- //The logic is here for future use
- if (poa) {
- writeMethods ();
- stream.println (" private " + intfName + "Operations _impl;");
- stream.println (" private org.omg.PortableServer.POA _poa;");
- } else {
- writeMethods ();
- stream.println (" private " + intfName + "Operations _impl;");
- }
- } else { //Both POA and ImplBase are abstract InvokeHandler
- //The logic is here for future use
- if (poa) {
- writeMethodTable ();
- writeDispatchMethod ();
- writeCORBAOperations ();
- } else {
- writeMethodTable ();
- writeDispatchMethod ();
- writeCORBAOperations ();
- }
- }
- //legacy !!
- writeOperations ();
- } // writeBody
-
- /**
- * Close the skeleton class. The singleton ORB member is
- * necessary only for portable skeletons.
- **/
- protected void writeClosing ()
- {
- stream.println ();
- if (tie){
- stream.println ("} // class " + tieClassName);
- } else {
- stream.println ("} // class " + skeletonClassName);
- }
- } // writeClosing
-
- /**
- * Close the print stream, which flushes the stream to file.
- **/
- protected void closeStream ()
- {
- stream.close ();
- } // closeStream
-
- protected void writeCtors ()
- {
- stream.println (" // Constructors");
- // Empty argument constructors
- if (!poa) {
- if (tie){
- stream.println (" public " + tieClassName + " ()");
- stream.println (" {");
- stream.println (" }");
- } else {
- stream.println (" public " + skeletonClassName + " ()");
- stream.println (" {");
- stream.println (" }");
- }
- }
- stream.println ();
- // Argumented constructors
- if (tie){
- if (poa) {
- //Write constructors
- writePOATieCtors();
- //Write state setters and getters
- writePOATieFieldAccessMethods();
- } else {
- stream.println (" public " + tieClassName +
- " (" + intfName + "Operations impl)");
- stream.println (" {");
- // Does it derive from a interface having state, e.g., valuetype?
- if (((InterfaceEntry)i.derivedFrom ().firstElement ()).state () != null)
- stream.println (" super (impl);");
- else
- stream.println (" super ();");
- stream.println (" _impl = impl;");
- stream.println (" }");
- stream.println ();
- }
- } else { //Skeleton is not Tie so it has no constructors.
- if (poa) {
- } else {
- }
- }
-
- } // writeCtors
-
-
- private void writePOATieCtors(){
- //First constructor
- stream.println (" public " + tieClassName + " ( " + intfName + "Operations delegate ) {");
- stream.println (" this._impl = delegate;");
- stream.println (" }");
- //Second constructor specifying default poa.
- stream.println (" public " + tieClassName + " ( " + intfName +
- "Operations delegate , org.omg.PortableServer.POA poa ) {");
- stream.println (" this._impl = delegate;");
- stream.println (" this._poa = poa;");
- stream.println (" }");
- }
-
- private void writePOATieFieldAccessMethods(){
- //Getting delegate
- stream.println (" public " + intfName+ "Operations _delegate() {");
- stream.println (" return this._impl;");
- stream.println (" }");
- //Setting delegate
- stream.println (" public void _delegate (" + intfName + "Operations delegate ) {");
- stream.println (" this._impl = delegate;");
- stream.println (" }");
- //Overriding default poa
- stream.println (" public org.omg.PortableServer.POA _default_POA() {");
- stream.println (" if(_poa != null) {");
- stream.println (" return _poa;");
- stream.println (" }");
- stream.println (" else {");
- stream.println (" return super._default_POA();");
- stream.println (" }");
- stream.println (" }");
- }
-
- /**
- * Build a list of all of the methods, keeping out duplicates.
- **/
- protected void buildMethodList ()
- {
- // Start from scratch
- methodList = new Vector ();
-
- buildMethodList (i);
- } // buildMethodList
-
- /**
- *
- **/
- private void buildMethodList (InterfaceEntry entry)
- {
- // Add the local methods
- Enumeration locals = entry.methods ().elements ();
- while (locals.hasMoreElements ())
- addMethod ((MethodEntry)locals.nextElement ());
-
- // Add the inherited methods
- Enumeration parents = entry.derivedFrom ().elements ();
- while (parents.hasMoreElements ())
- {
- InterfaceEntry parent = (InterfaceEntry)parents.nextElement ();
- if (!parent.name ().equals ("Object"))
- buildMethodList (parent);
- }
- } // buildMethodList
-
- /**
- *
- **/
- private void addMethod (MethodEntry method)
- {
- if (!methodList.contains (method))
- methodList.addElement (method);
- } // addMethod
-
- /**
- *
- **/
- protected void writeDispatchMethod ()
- {
- String indent = " ";
- stream.println (" public org.omg.CORBA.portable.OutputStream _invoke (String $method,");
- stream.println (indent + "org.omg.CORBA.portable.InputStream in,");
- stream.println (indent + "org.omg.CORBA.portable.ResponseHandler $rh)");
- stream.println (" {");
-
- // this is a special case code generation for cases servantLocator and
- // servantActivator, where OMG is taking too long to define them
- // as local objects
-
- boolean isLocalInterface = false;
- if (i instanceof InterfaceEntry) {
- isLocalInterface = i.isLocalServant();
- }
-
- if (!isLocalInterface) {
- // Per Simon 8/26/98, create and return reply stream for all methods - KLR
- stream.println (" org.omg.CORBA.portable.OutputStream out = null;");
- stream.println (" java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);");
- stream.println (" if (__method == null)");
- stream.println (" throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
- stream.println ();
- if (methodList.size () > 0)
- {
- stream.println (" switch (__method.intValue ())");
- stream.println (" {");
-
- // Write the method case statements
- int realI = 0;
- for (int i = 0; i < methodList.size (); ++i)
- {
- MethodEntry method = (MethodEntry)methodList.elementAt (i);
- ((MethodGen)method.generator ()).dispatchSkeleton (symbolTable, method, stream, realI);
- if (method instanceof AttributeEntry && !((AttributeEntry)method).readOnly ())
- realI += 2;
- else
- ++realI;
- }
-
- indent = " ";
- stream.println (indent + "default:");
- stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
- stream.println (" }");
- stream.println ();
- }
- stream.println (" return out;");
- } else {
- stream.println(" throw new org.omg.CORBA.BAD_OPERATION();");
- }
- stream.println (" } // _invoke");
- stream.println ();
- } // writeDispatchMethod
-
- /**
- *
- **/
- protected void writeMethodTable ()
- {
- // Write the methods hashtable
- stream.println (" private static java.util.Hashtable _methods = new java.util.Hashtable ();");
- stream.println (" static");
- stream.println (" {");
-
- int count = -1;
- Enumeration e = methodList.elements ();
- while (e.hasMoreElements ())
- {
- MethodEntry method = (MethodEntry)e.nextElement ();
- if (method instanceof AttributeEntry)
- {
- stream.println (" _methods.put (\"_get_" + Util.stripLeadingUnderscores (method.name ()) + "\", new java.lang.Integer (" + (++count) + "));");
- if (!((AttributeEntry)method).readOnly ())
- stream.println (" _methods.put (\"_set_" + Util.stripLeadingUnderscores (method.name ()) + "\", new java.lang.Integer (" + (++count) + "));");
- }
- else
- stream.println (" _methods.put (\"" + Util.stripLeadingUnderscores (method.name ()) + "\", new java.lang.Integer (" + (++count) + "));");
- }
- stream.println (" }");
- stream.println ();
- } // writeMethodTable
-
- /**
- *
- **/
- protected void writeMethods ()
- {
- int realI = 0;
- for (int i = 0; i < methodList.size (); ++i)
- {
- MethodEntry method = (MethodEntry)methodList.elementAt (i);
- ((MethodGen)method.generator ()).skeleton
- (symbolTable, method, stream, realI);
- if (method instanceof AttributeEntry &&
- !((AttributeEntry)method).readOnly ())
- realI += 2;
- else
- ++realI;
- stream.println ();
- }
- } // writeMethods
-
- /**
- *
- **/
- private void writeIDs ()
- {
- Vector list = new Vector ();
- buildIDList (i, list);
- Enumeration e = list.elements ();
- boolean first = true;
- while (e.hasMoreElements ())
- {
- if (first)
- first = false;
- else
- stream.println (", ");
- stream.print (" \"" + (String)e.nextElement () + '"');
- }
- } // writeIDs
-
- /**
- *
- **/
- private void buildIDList (InterfaceEntry entry, Vector list)
- {
- if (!entry.fullName ().equals ("org/omg/CORBA/Object"))
- {
- String id = Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ());
- if (!list.contains (id))
- list.addElement (id);
- Enumeration e = entry.derivedFrom ().elements ();
- while (e.hasMoreElements ())
- buildIDList ((InterfaceEntry)e.nextElement (), list);
- }
- } // buildIDList
-
- /**
- *
- **/
- protected void writeCORBAOperations ()
- {
- stream.println (" // Type-specific CORBA::Object operations");
-
- stream.println (" private static String[] __ids = {");
- writeIDs ();
- stream.println ("};");
- stream.println ();
- if (poa)
- writePOACORBAOperations();
- else
- writeNonPOACORBAOperations();
-
- } // writeCORBAOperations
-
- protected void writePOACORBAOperations(){
- stream.println (" public String[] _all_interfaces (org.omg.PortableServer.POA poa, byte[] objectId)");
- //Right now, with our POA implementation, the same
- //implementation of _ids() type methods seem to work for both non-POA
- //as well as POA servers. We need to REVISIT since the equivalent
- //POA interface, i.e. _all_interfaces, has parameters which are not being
- //used in the _ids() implementation.
- stream.println (" {");
- stream.println (" return (String[])__ids.clone ();");
- stream.println (" }");
- stream.println ();
- //_this()
- stream.println (" public "+ i.name() +" _this() ");
- stream.println (" {");
- stream.println (" return "+ i.name() +"Helper.narrow(" );
- stream.println (" super._this_object());");
- stream.println (" }");
- stream.println ();
- //_this(org.omg.CORBA.ORB orb)
- stream.println (" public "+ i.name() +" _this(org.omg.CORBA.ORB orb) ");
- stream.println (" {");
- stream.println (" return "+ i.name() +"Helper.narrow(" );
- stream.println (" super._this_object(orb));");
- stream.println (" }");
- stream.println ();
- }
- protected void writeNonPOACORBAOperations(){
- stream.println (" public String[] _ids ()");
- stream.println (" {");
- stream.println (" return (String[])__ids.clone ();");
- stream.println (" }");
- stream.println ();
- }
- /**
- *
- **/
- protected void writeOperations ()
- {
- // _get_ids removed at Simon's request 8/26/98 - KLR
- } // writeOperations
-
- protected Hashtable symbolTable = null;
- protected InterfaceEntry i = null;
- protected PrintWriter stream = null;
-
- // Unique to this generator
- protected String tieClassName = null;
- protected String skeletonClassName = null;
- protected boolean tie = false;
- protected boolean poa = false;
- protected Vector methodList = null;
- protected String intfName = "";
-} // class Skeleton
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StringGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StringGen.java
deleted file mode 100644
index ce92610..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StringGen.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright (c) 1999, 2000, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -D61056 <klr> Use Util.helperName
-
-import java.io.PrintWriter;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.StringEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-
-/**
- * Handles generation of CORBA strings as well as wstrings. Be careful
- * not to forget the wstrings.
- **/
-public class StringGen implements com.sun.tools.corba.se.idl.StringGen, JavaGenerator
-{
- /**
- * Public zero-argument constructor.
- **/
- public StringGen ()
- {
- } // ctor
-
- /**
- * This should never be called. This class exists for the
- * JavaGenerator interface.
- **/
- public void generate (Hashtable symbolTable, StringEntry e, PrintWriter stream)
- {
- } // generate
-
- ///////////////
- // From JavaGenerator
-
- public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
- {
- return type(index, indent, tcoffsets, name, entry, stream);
- } // helperType
-
- public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
- tcoffsets.set (entry);
- StringEntry stringEntry = (StringEntry)entry;
- String bound;
- if (stringEntry.maxSize () == null)
- bound = "0";
- else
- bound = Util.parseExpression (stringEntry.maxSize ());
-
- // entry.name() is necessary to determine whether it is a
- // string or wstring
-
- stream.println (indent
- + name
- + " = org.omg.CORBA.ORB.init ().create_"
- + entry.name()
- + "_tc ("
- + bound + ");");
- return index;
- } // type
-
- public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- } // helperRead
-
- public void helperWrite (SymtabEntry entry, PrintWriter stream)
- {
- } // helperWrite
-
- public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- StringEntry string = (StringEntry)entry;
- String entryName = entry.name ();
- if (entryName.equals ("string"))
- stream.println (indent + name + " = istream.read_string ();");
- else if (entryName.equals ("wstring"))
- stream.println (indent + name + " = istream.read_wstring ();");
- if (string.maxSize () != null)
- {
- stream.println (indent + "if (" + name + ".length () > (" + Util.parseExpression (string.maxSize ()) + "))");
- stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
- }
- return index;
- } // read
-
- public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- StringEntry string = (StringEntry)entry;
- if (string.maxSize () != null)
- {
- stream.print (indent + "if (" + name + ".length () > (" + Util.parseExpression (string.maxSize ()) + "))");
- stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
- }
- String entryName = entry.name ();
- if (entryName.equals ("string"))
- stream.println (indent + "ostream.write_string (" + name + ");");
- else if (entryName.equals ("wstring"))
- stream.println (indent + "ostream.write_wstring (" + name + ");");
- return index;
- } // write
-
- // From JavaGenerator
- ///////////////
-} // class StringGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StructGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StructGen.java
deleted file mode 100644
index 610efad..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StructGen.java
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// - Think about arrays (and sequences?) as members
-// - A sequence must be converted to an array, but a memory of the
-// max size must be retained.
-// - After demarshalling an IOR, think about how to deal with the exceptions.
-// - The demarshall method should be throwing a ClientException,
-// but should it, really?
-// -D60929 <klr> Update for RTF2.4 changes
-// -D61056 <klr> Use Util.helperName
-// -D62023 <klr> Use corbaLevel in read/write generation
-// -D59437 <daz> Modify read() to enit qualified name of value box helper.
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.EnumEntry;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.SequenceEntry;
-import com.sun.tools.corba.se.idl.StringEntry;
-import com.sun.tools.corba.se.idl.StructEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-import com.sun.tools.corba.se.idl.ValueBoxEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-
-/**
- *
- **/
-public class StructGen implements com.sun.tools.corba.se.idl.StructGen, JavaGenerator
-{
- /**
- * Public zero-argument constructor.
- **/
- public StructGen ()
- {
- } // ctor
-
- /**
- * Constructor for ExceptionGen.
- **/
- protected StructGen (boolean exception)
- {
- thisIsReallyAnException = exception;
- } // ctor
-
- /**
- *
- **/
- public void generate (Hashtable symbolTable, StructEntry s, PrintWriter str)
- {
- this.symbolTable = symbolTable;
- this.s = s;
- //init ();
-
- openStream ();
- if (stream == null)
- return;
- generateHelper ();
- generateHolder ();
- writeHeading ();
- writeBody ();
- writeClosing ();
- closeStream ();
- generateContainedTypes ();
- } // generate
-
- /**
- * Initialize members unique to this generator.
- **/
- protected void init ()
- {
- } // init
-
- /**
- *
- **/
- protected void openStream ()
- {
- stream = Util.stream (s, ".java");
- } // openStream
-
- /**
- *
- **/
- protected void generateHelper ()
- {
- ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, s);
- } // generateHelper
-
- /**
- *
- **/
- protected void generateHolder ()
- {
- ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, s);
- } // generateHolder
-
- /**
- *
- **/
- protected void writeHeading ()
- {
- Util.writePackage (stream, s);
- Util.writeProlog (stream, ((GenFileStream)stream).name ());
-
- if (s.comment () != null)
- s.comment ().generate ("", stream);
-
- stream.print ("public final class " + s.name ());
- if (thisIsReallyAnException)
- stream.print (" extends org.omg.CORBA.UserException");
- else
- stream.print(" implements org.omg.CORBA.portable.IDLEntity");
- stream.println ();
- stream.println ("{");
- } // writeHeading
-
- /**
- *
- **/
- protected void writeBody ()
- {
- writeMembers ();
- writeCtors ();
- } // writeBody
-
- /**
- *
- **/
- protected void writeClosing ()
- {
- stream.println ("} // class " + s.name ());
- } // writeClosing
-
- /**
- *
- **/
- protected void closeStream ()
- {
- stream.close ();
- } // closeStream
-
- /**
- *
- **/
- protected void generateContainedTypes ()
- {
- // Generate all of the contained types
- Enumeration e = s.contained ().elements ();
- while (e.hasMoreElements ())
- {
- SymtabEntry entry = (SymtabEntry)e.nextElement ();
-
- // Don't generate contained entries if they are sequences.
- // Sequences are unnamed and since they translate to arrays,
- // no classes are generated for them, not even holders in this
- // case since they cannot be accessed outside of this struct.
-
- if (!(entry instanceof SequenceEntry))
- entry.generate (symbolTable, stream);
- }
- } // generateContainedTypes
-
- /**
- *
- **/
- protected void writeMembers ()
- {
- // Write members and populate quality arrays
- int size = s.members ().size ();
- memberIsPrimitive = new boolean [size];
- memberIsInterface = new boolean [size];
- memberIsTypedef = new boolean [size];
- for (int i = 0; i < s.members ().size (); ++i)
- {
- SymtabEntry member = (SymtabEntry)s.members ().elementAt (i);
- memberIsPrimitive[i] = member.type () instanceof PrimitiveEntry;
- memberIsInterface[i] = member.type () instanceof InterfaceEntry;
- memberIsTypedef[i] = member.type () instanceof TypedefEntry;
- Util.fillInfo (member);
- // Transfer member comment to target <31jul1997>.
- if (member.comment () != null)
- member.comment ().generate (" ", stream);
- Util.writeInitializer (" public ", member.name (), "", member, stream);
- }
- } // writeMembers
-
- /**
- *
- **/
- protected void writeCtors ()
- {
- // Write default ctor
- stream.println ();
- stream.println (" public " + s.name () + " ()");
- stream.println (" {");
- // fixed mapping for exceptions
- if (thisIsReallyAnException)
- stream.println (" super(" + s.name() + "Helper.id());");
- stream.println (" } // ctor");
- writeInitializationCtor(true);
- if (thisIsReallyAnException) {
- // for exception according to mapping we should always
- // have a full constructor
- writeInitializationCtor(false);
- }
- }
-
- private void writeInitializationCtor(boolean init)
- {
- // Write initialization ctor
- if (!init || (s.members ().size () > 0))
- {
- stream.println ();
- stream.print (" public " + s.name () + " (");
- boolean firstTime = true;
- if (!init) {
- stream.print ("String $reason");
- firstTime = false;
- }
-
- for (int i = 0; i < s.members ().size (); ++i)
- {
- SymtabEntry member = (SymtabEntry)s.members ().elementAt (i);
- if (firstTime)
- firstTime = false;
- else
- stream.print (", ");
- stream.print (Util.javaName (member) + " _" + member.name ());
- }
- stream.println (")");
- stream.println (" {");
- // fixed mapping for exceptions
- if (thisIsReallyAnException) {
- if (init)
- stream.println (" super(" + s.name() + "Helper.id());");
- else
- stream.println (" super(" + s.name() + "Helper.id() + \" \" + $reason);");
- }
- for (int i = 0; i < s.members ().size (); ++i)
- {
- SymtabEntry member = (SymtabEntry)s.members ().elementAt (i);
- stream.println (" " + member.name () + " = _" + member.name () + ";");
- }
- stream.println (" } // ctor");
- }
- stream.println ();
- } // writeInitializationCtor
-
- ///////////////
- // From JavaGenerator
-
- public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
- {
- TCOffsets innerOffsets = new TCOffsets ();
- innerOffsets.set (entry);
- int offsetForStruct = innerOffsets.currentOffset ();
- StructEntry s = (StructEntry)entry;
- String membersName = "_members" + index++;
- stream.println (indent + "org.omg.CORBA.StructMember[] " + membersName + " = new org.omg.CORBA.StructMember [" + s.members ().size () + "];");
- String tcOfMembers = "_tcOf" + membersName;
- stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + " = null;");
- for (int i = 0; i < s.members ().size (); ++i)
- {
- TypedefEntry member = (TypedefEntry)s.members ().elementAt (i);
- String memberName = member.name ();
- // Generate and assign member TypeCode to tcofMembers
- index = ((JavaGenerator)member.generator ()).type (index, indent, innerOffsets, tcOfMembers, member, stream);
- stream.println (indent + membersName + '[' + i + "] = new org.omg.CORBA.StructMember (");
- stream.println (indent + " \"" + Util.stripLeadingUnderscores (memberName) + "\",");
- stream.println (indent + " " + tcOfMembers + ',');
- stream.println (indent + " null);");
- int offsetSoFar = innerOffsets.currentOffset ();
- innerOffsets = new TCOffsets ();
- innerOffsets.set (entry);
- innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForStruct);
-
- }
- tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ());
- // <54697>
- //stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_struct_tc (id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");");
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_" + (thisIsReallyAnException ? "exception" : "struct") + "_tc (" + Util.helperName (s, true) + ".id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");"); // <d61056>
- return index;
- } // helperType
-
- public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
- stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
- return index;
- } // type
-
- public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- stream.println (" " + entryName + " value = new " + entryName + " ();");
- read (0, " ", "value", entry, stream);
- stream.println (" return value;");
- } // helperRead
-
- public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- if (thisIsReallyAnException)
- {
- stream.println (indent + "// read and discard the repository ID");
- stream.println (indent + "istream.read_string ();");
- }
-
- Enumeration e = ((StructEntry)entry).members ().elements ();
- while (e.hasMoreElements ())
- {
- TypedefEntry member = (TypedefEntry)e.nextElement ();
- SymtabEntry mType = member.type ();
-
- if (!member.arrayInfo ().isEmpty () || mType instanceof SequenceEntry ||
- mType instanceof PrimitiveEntry || mType instanceof StringEntry ||
- mType instanceof TypedefEntry)
- index = ((JavaGenerator)member.generator ()).read (index, indent, name + '.' + member.name (), member, stream);
- else if (mType instanceof ValueBoxEntry)
- {
- // call read_value instead of Helper.read for the value
- Vector st = ((ValueBoxEntry) mType).state ();
- TypedefEntry vbMember = ((InterfaceState) st.elementAt (0)).entry;
- SymtabEntry vbType = vbMember.type ();
-
- String jName = null;
- String jHelper = null;
-
- if (vbType instanceof SequenceEntry || vbType instanceof StringEntry ||
- !vbMember.arrayInfo ().isEmpty ())
- {
- jName = Util.javaName (vbType); // name of mapped Java type
- // <d59437> REVISIT. Typename info. now correct for value boxes, so
- // these two cases may be obsolete. See UnionGen.read().
- //jHelper = Util.helperName (vbType, false); // <d61056>
- jHelper = Util.helperName (mType, true);
- }
- else
- {
- jName = Util.javaName (mType); // name of mapped Java class
- // <d59437>
- //jHelper = Util.helperName (mType, false); // <d61056>
- jHelper = Util.helperName (mType, true);
- }
- // <d62023> Call xHelper.read() for valueboxes for RTF2.4
- if (Util.corbaLevel (2.4f, 99.0f))
- stream.println (indent + name + '.' + member.name () + " = (" + jName + ") " + jHelper + ".read (istream);");
- else
- stream.println (indent + name + '.' + member.name () + " = (" + jName + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + jHelper + ".get_instance ());"); // <d60929> <d61056>
- }
- // <d62023-klr> for corbaLevel 2.4 and up, use Helper.read like
- // everything else
- else if ((mType instanceof ValueEntry) &&
- !Util.corbaLevel (2.4f, 99.0f)) // <d62023>
- {
- // call read_value instead of Helper.read for the value
- stream.println (indent + name + '.' + member.name () + " = (" + Util.javaName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName (mType, false) + ".get_instance ());"); // <d60929> // <d61056>
- }
- else
- stream.println (indent + name + '.' + member.name () + " = " + Util.helperName (member.type (), true) + ".read (istream);"); // <d61056>
- }
- return index;
- } // read
-
- public void helperWrite (SymtabEntry entry, PrintWriter stream)
- {
- write (0, " ", "value", entry, stream);
- } // helperWrite
-
- public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- if (thisIsReallyAnException)
- {
- stream.println (indent + "// write the repository ID");
- stream.println (indent + "ostream.write_string (id ());");
- }
-
- Vector members = ((StructEntry)entry).members ();
- for (int i = 0; i < members.size (); ++i)
- {
- TypedefEntry member = (TypedefEntry)members.elementAt (i);
- SymtabEntry mType = member.type ();
-
- if (!member.arrayInfo ().isEmpty () || mType instanceof SequenceEntry ||
- mType instanceof TypedefEntry || mType instanceof PrimitiveEntry ||
- mType instanceof StringEntry)
- index = ((JavaGenerator)member.generator ()).write (index, " ", name + '.' + member.name (), member, stream);
-
- // <d62023-klr> for corbaLevel 2.4 and up, use Helper.write like
- // everything else
- else if ((mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
- && !Util.corbaLevel (2.4f, 99.0f)) { // <d62023>
- stream.println (indent + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) " // <d60929>
- + name + '.' + member.name () + ", "
- + Util.helperName (member.type (), true) // <d61056>
- + ".get_instance ());"); // <d61056>
- }
- else
- stream.println (indent + Util.helperName (member.type (), true) + ".write (ostream, " + name + '.' + member.name () + ");"); // <d61056>
- }
- return index;
- } // write
-
- // From JavaGenerator
- ///////////////
-
- protected Hashtable symbolTable = null;
- protected StructEntry s = null;
- protected PrintWriter stream = null;
-
- protected boolean thisIsReallyAnException = false;
- private boolean[] memberIsPrimitive;
- private boolean[] memberIsInterface;
- private boolean[] memberIsTypedef;
-} // class StructGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Stub.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Stub.java
deleted file mode 100644
index c305ada..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Stub.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.AttributeEntry;
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-
-/**
- *
- **/
-public class Stub implements AuxGen
-{
- /**
- * Public zero-argument constructor.
- **/
- public Stub ()
- {
- } // ctor
-
- /**
- *
- **/
- public void generate (Hashtable symbolTable, SymtabEntry entry)
- {
- this.symbolTable = symbolTable;
- this.i = (InterfaceEntry)entry;
- this.localStub = i.isLocalServant();
- this.isAbstract = i.isAbstract( );
- init ();
-
- openStream ();
- if (stream == null)
- return;
- writeHeading ();
- writeBody ();
- writeClosing ();
- closeStream ();
- } // generate
-
- /**
- * Initialize unique members of this generator.
- **/
- protected void init ()
- {
- classSuffix = "Stub";
- } // init
-
- /**
- *
- **/
- protected void openStream ()
- {
- String name = '_' + i.name () + classSuffix;
- String pkg = Util.containerFullName (i.container ());
- if (pkg != null && !pkg.equals (""))
- {
- Util.mkdir (pkg);
- name = pkg + '/' + name;
- }
- stream = Util.getStream (name.replace ('/', File.separatorChar) + ".java", i);
- } // openStream
-
- /**
- *
- **/
- protected void writeHeading ()
- {
- Util.writePackage (stream, i, Util.StubFile);
- Util.writeProlog (stream, ((GenFileStream)stream).name ());
-
- // Transfer interface comment to target <31jul1997>.
- if (i.comment () != null)
- i.comment ().generate ("", stream);
-
- writeClassDeclaration ();
- stream.println ('{');
- } // writeHeading
-
- /**
- *
- **/
- protected void writeClassDeclaration ()
- {
- stream.print ("public class _" + i.name () + classSuffix + " extends org.omg.CORBA.portable.ObjectImpl");
- stream.println (" implements " + Util.javaName (i));
- } // writeClassDeclaration
-
- /**
- * Steps done within writeBody include:
- * 1.) makeCtors ();
- * 2.) buildMethodList ();
- * 3.) makeMethods ();
- * 4.) makeCORBAObjectMethods ()
- **/
- protected void writeBody ()
- {
- writeCtors ();
- buildMethodList ();
- writeMethods ();
- writeCORBAObjectMethods ();
- writeSerializationMethods ();
- } // writeBody
-
- /**
- *
- **/
- protected void writeClosing ()
- {
- stream.println ("} // class _" + i.name () + classSuffix);
- } // writeClosing
-
- /**
- *
- **/
- protected void closeStream ()
- {
- stream.close ();
- } // closeStream
-
- /**
- *
- **/
- protected void writeCtors ()
- {
- String name = i.name ();
-
- /*** the constructors are not generated as per ptc/00-01-08.pdf
- * since these are non-standard APIs, and same can be accomplished
- * programatically, we need to comment this out, in order to
- * be able to generate standard stubs
- */
-
- /*************
- stream.println (" // Constructors");
- stream.println (" // NOTE: If the default constructor is used, the");
- stream.println (" // object is useless until _set_delegate (...)");
- stream.println (" // is called.");
- stream.println (" public _" + name + classSuffix + " ()");
- stream.println (" {");
- stream.println (" super ();");
- stream.println (" }");
- stream.println ();
- stream.println (" public _" + name + classSuffix + " (org.omg.CORBA.portable.Delegate delegate)");
- stream.println (" {");
- stream.println (" super ();");
- stream.println (" _set_delegate (delegate);");
- stream.println (" }");
- ***************/
- // This is confusing since we have localOptimization flag as well.
- // We have left this code because JCK team filed a P1 bug for changing
- // _opsClass to $opsClass. Will clean it up in Tiger
- // _REVISIT_ (Hemanth 03/05/2002)
- if (localStub) {
- stream.println (" final public static java.lang.Class _opsClass = " +
- name + "Operations.class;");
- stream.println ();
- }
- stream.println ();
- } // writeCtors
-
- /**
- * Build a list of all of the methods, keeping out duplicates.
- **/
- protected void buildMethodList ()
- {
- // Start from scratch
- methodList = new Vector ();
-
- buildMethodList (i);
- } // buildMethodList
-
- /**
- *
- **/
- private void buildMethodList (InterfaceEntry entry)
- {
- // Add the local methods
- Enumeration locals = entry.methods ().elements ();
- while (locals.hasMoreElements ())
- addMethod ((MethodEntry)locals.nextElement ());
-
- // Add the inherited methods
- Enumeration parents = entry.derivedFrom ().elements ();
- while (parents.hasMoreElements ())
- {
- InterfaceEntry parent = (InterfaceEntry)parents.nextElement ();
- if (!parent.name ().equals ("Object"))
- buildMethodList (parent);
- }
- } // buildMethodList
-
- /**
- *
- **/
- private void addMethod (MethodEntry method)
- {
- if (!methodList.contains (method))
- methodList.addElement (method);
- } // addMethod
-
- /**
- *
- **/
- protected void writeMethods ()
- {
- // Count the methods, attributes which are not readonly are
- // counted as 2 methods.
- int count = methodList.size ();
- Enumeration e = methodList.elements ();
- while (e.hasMoreElements ())
- {
- Object method = e.nextElement ();
- if (method instanceof AttributeEntry && !((AttributeEntry)method).readOnly ())
- ++count;
- }
-
- if( (((Arguments)Compile.compiler.arguments).LocalOptimization )
- && !isAbstract )
- {
- stream.println( " final public static java.lang.Class _opsClass =" );
- stream.println( " " + this.i.name() + "Operations.class;" );
- }
-
- // Write the methods
- int realI = 0;
- for (int i = 0; i < methodList.size (); ++i)
- {
- MethodEntry method = (MethodEntry)methodList.elementAt (i);
- if (!localStub) {
- ((MethodGen)method.generator ()).stub (this.i.name(), isAbstract, symbolTable, method, stream, realI);
- } else {
- ((MethodGen)method.generator ()).localstub (symbolTable, method, stream, realI, this.i);
- }
- if (method instanceof AttributeEntry && !((AttributeEntry)method).readOnly ())
- realI += 2;
- else
- ++realI;
- }
- } // writeMethods
-
- /**
- *
- **/
- private void buildIDList (InterfaceEntry entry, Vector list)
- {
- if (!entry.fullName ().equals ("org/omg/CORBA/Object"))
- {
- String id = Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ());
- if (!list.contains (id))
- list.addElement (id);
- Enumeration e = entry.derivedFrom ().elements ();
- while (e.hasMoreElements ())
- buildIDList ((InterfaceEntry)e.nextElement (), list);
- }
- } // buildIDList
-
- /**
- *
- **/
- private void writeIDs ()
- {
- Vector list = new Vector ();
- buildIDList (i, list);
- Enumeration e = list.elements ();
- boolean first = true;
- while (e.hasMoreElements ())
- {
- if (first)
- first = false;
- else
- stream.println (", ");
- stream.print (" \"" + (String)e.nextElement () + '"');
- }
- } // writeIDs
-
- /**
- *
- **/
- protected void writeCORBAObjectMethods ()
- {
- stream.println (" // Type-specific CORBA::Object operations");
- stream.println (" private static String[] __ids = {");
- writeIDs ();
- stream.println ("};");
- stream.println ();
- stream.println (" public String[] _ids ()");
- stream.println (" {");
- stream.println (" return (String[])__ids.clone ();");
- stream.println (" }");
- stream.println ();
- } // writeCORBAObjectMethods
-
- /**
- *
- **/
- protected void writeSerializationMethods ()
- {
- stream.println (" private void readObject (java.io.ObjectInputStream s) throws java.io.IOException");
- stream.println (" {");
- stream.println (" String str = s.readUTF ();");
- stream.println (" String[] args = null;");
- stream.println (" java.util.Properties props = null;");
- stream.println (" org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);");
- stream.println (" try {");
- stream.println (" org.omg.CORBA.Object obj = orb.string_to_object (str);");
- stream.println (" org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();");
- stream.println (" _set_delegate (delegate);");
- stream.println (" } finally {");
- stream.println (" orb.destroy() ;");
- stream.println (" }");
- stream.println (" }");
- stream.println ();
- stream.println (" private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException");
- stream.println (" {");
- stream.println (" String[] args = null;");
- stream.println (" java.util.Properties props = null;");
- stream.println (" org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);");
- stream.println (" try {");
- stream.println (" String str = orb.object_to_string (this);");
- stream.println (" s.writeUTF (str);");
- stream.println (" } finally {");
- stream.println (" orb.destroy() ;");
- stream.println (" }");
- stream.println (" }");
- }
-
- protected Hashtable symbolTable = null;
- protected InterfaceEntry i = null;
- protected PrintWriter stream = null;
-
- // Unique to this generator
- protected Vector methodList = null;
- protected String classSuffix = "";
- protected boolean localStub = false;
- private boolean isAbstract = false;
-} // class Stub
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TCOffsets.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TCOffsets.java
deleted file mode 100644
index 5cf903d..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TCOffsets.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.*;
-
-// This class is passed through the JavaGenerator.HelperType methods.
-// It is ONLY used when a recursive sequence is detected. ie.
-//
-// struct S1
-// {
-// sequence <S1> others;
-// };
-
-/**
- *
- **/
-public class TCOffsets
-{
- /**
- * Return -1 if the given name is not in the list of types.
- **/
- public int offset (String name)
- {
- Integer value = (Integer)tcs.get (name);
- return value == null ? -1 : value.intValue ();
- } // offset
-
- /**
- *
- **/
- public void set (SymtabEntry entry)
- {
- if (entry == null)
- offset += 8;
- else
- {
- tcs.put (entry.fullName (), new Integer (offset));
- offset += 4;
- String repID = Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ());
- if (entry instanceof InterfaceEntry)
- offset += alignStrLen (repID) + alignStrLen (entry.name ());
- else if (entry instanceof StructEntry)
- offset += alignStrLen (repID) + alignStrLen (entry.name ()) + 4;
- else if (entry instanceof UnionEntry)
- offset += alignStrLen (repID) + alignStrLen (entry.name ()) + 12;
- else if (entry instanceof EnumEntry)
- {
- offset += alignStrLen (repID) + alignStrLen (entry.name ()) + 4;
- Enumeration e = ((EnumEntry)entry).elements ().elements ();
- while (e.hasMoreElements ())
- offset += alignStrLen ((String)e.nextElement ());
- }
- else if (entry instanceof StringEntry)
- offset += 4;
- else if (entry instanceof TypedefEntry)
- {
- offset += alignStrLen (repID) + alignStrLen (entry.name ());
- if (((TypedefEntry)entry).arrayInfo ().size () != 0)
- offset += 8;
- }
- }
- } // set
-
- /**
- * Return the full length of the string type: 4 byte length, x bytes for
- * string + 1 for the null terminator, align it so it ends on a 4-byte
- * boundary. This method assumes the string starts at a 4-byte boundary
- * since it doesn't do any leading alignment.
- **/
- public int alignStrLen (String string)
- {
- int len = string.length () + 1;
- int align = 4 - (len % 4);
- if (align == 4) align = 0;
- return len + align + 4;
- } // alignStrLen
-
- /**
- *
- **/
- public void setMember (SymtabEntry entry)
- {
- offset += alignStrLen (entry.name ());
- if (((TypedefEntry)entry).arrayInfo ().size () != 0)
- offset += 4;
- } // setMember
-
- /**
- *
- **/
- public int currentOffset ()
- {
- return offset;
- } // currentOffset
-
- /**
- *
- **/
- public void bumpCurrentOffset (int value)
- {
- offset += value;
- } // bumpCurrentOffset
-
- private Hashtable tcs = new Hashtable ();
- private int offset = 0;
-} // class TCOffsets
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TypedefGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TypedefGen.java
deleted file mode 100644
index 775a493..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TypedefGen.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -11aug1997<daz> No modification: comments for type_defs will appear in
-// helper, holder classes as a result of modifications to routines
-// makeHelper(), makeHolder() in class com.sun.tools.corba.se.idl.toJava.Util.
-// -F46082.51<daz> Remove -stateful feature; javaStatefulName() obsolete.
-// -D61056 <klr> Use Util.helperName
-
-import java.io.PrintWriter;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.SequenceEntry;
-import com.sun.tools.corba.se.idl.StringEntry;
-import com.sun.tools.corba.se.idl.StructEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.UnionEntry;
-
-import com.sun.tools.corba.se.idl.constExpr.Expression;
-
-// Notes:
-
-/**
- *
- **/
-public class TypedefGen implements com.sun.tools.corba.se.idl.TypedefGen, JavaGenerator
-{
- /**
- * Public zero-argument constructor.
- **/
- public TypedefGen ()
- {
- } // ctor
-
- /**
- *
- **/
- public void generate (Hashtable symbolTable, TypedefEntry t, PrintWriter stream)
- {
- this.symbolTable = symbolTable;
- this.t = t;
-
- if (t.arrayInfo ().size () > 0 || t.type () instanceof SequenceEntry)
- generateHolder ();
- generateHelper ();
- } // generator
-
- /**
- *
- **/
- protected void generateHolder ()
- {
- ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, t);
- }
-
- /**
- *
- **/
- protected void generateHelper ()
- {
- ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, t);
- }
-
- ///////////////
- // From JavaGenerator
-
- private boolean inStruct (TypedefEntry entry)
- {
- boolean inStruct = false;
- if (entry.container () instanceof StructEntry || entry.container () instanceof UnionEntry)
- inStruct = true;
- else if (entry.container () instanceof InterfaceEntry)
- {
- InterfaceEntry i = (InterfaceEntry)entry.container ();
- if (i.state () != null)
- {
- Enumeration e = i.state ().elements ();
- while (e.hasMoreElements ())
- if (((InterfaceState)e.nextElement ()).entry == entry)
- {
- inStruct = true;
- break;
- }
- }
- }
- return inStruct;
- } // inStruct
-
- public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
- {
- TypedefEntry td = (TypedefEntry)entry;
- boolean inStruct = inStruct (td);
- if (inStruct)
- tcoffsets.setMember (entry);
- else
- tcoffsets.set (entry);
-
- // Print the base types typecode
- index = ((JavaGenerator)td.type ().generator ()).type (index, indent, tcoffsets, name, td.type (), stream);
-
- if (inStruct && td.arrayInfo ().size () != 0)
- tcoffsets.bumpCurrentOffset (4); // for array length field
-
- // Print the array typecodes (if there are any)
- int dimensions = td.arrayInfo ().size ();
- for (int i = 0; i < dimensions; ++i)
- {
- String size = Util.parseExpression ((Expression)td.arrayInfo ().elementAt (i));
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_array_tc (" + size + ", " + name + " );");
- }
-
- // If this typedef describes a struct/union member, don't put it
- // in an alias typedef; otherwise that's where it belongs.
- if (!inStruct)
- // <54697>
- //stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_alias_tc (id (), \"" + Util.stripLeadingUnderscores (td.name ()) + "\", " + name + ");");
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_alias_tc (" + Util.helperName (td, true) + ".id (), \"" + Util.stripLeadingUnderscores (td.name ()) + "\", " + name + ");"); // <d61056>
-
- return index;
- } // helperType
-
- public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
- {
- // The type() method is invoked from other emitters instead of when an IDL
- // typedef statement is being processed. Code generated is identical minus the
- // generation of a create_alias_tc() which is required for IDL typedef's but not
- // needed when typedef is being processed as a member of struct/union/valuetype.
-
- return helperType( index, indent, tcoffsets, name, entry, stream);
- } // type
-
- public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- Util.writeInitializer (" ", "value", "", entry, stream);
- read (0, " ", "value", entry, stream);
- stream.println (" return value;");
- } // helperRead
-
- public void helperWrite (SymtabEntry entry, PrintWriter stream)
- {
- write (0, " ", "value", entry, stream);
- } // helperWrite
-
- public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- TypedefEntry td = (TypedefEntry)entry;
- String modifier = Util.arrayInfo (td.arrayInfo ());
- if (!modifier.equals (""))
- {
- // arrayInfo is a vector of Expressions which indicate the
- // number of array dimensions for this typedef. But what if
- // this is a typedef of a sequence?
- // The `new' statement being generated must know the full
- // number of brackets. That can be found in td.info.
- // For instance:
- // typedef sequence<short> A[10][10];
- // void proc (out A a);
- // typeModifier = "[10][10]"
- // td.info = "short[][][]";
- // The first new statement generated is:
- // a.value = new short[10][][];
- // Note that the 3 sets of brackets come from td.info, not
- // arrayInfo;
- // The second new statement generated is:
- // a.value[_i1] = new short[10][];
- // ------------ ---- ------
- // \ \ \
- // name baseName arrayDcl
- int closingBrackets = 0;
- String loopIndex = "";
- String baseName;
- try
- {
- baseName = (String)td.dynamicVariable (Compile.typedefInfo);
- }
- catch (NoSuchFieldException e)
- {
- baseName = td.name ();
- }
- int startArray = baseName.indexOf ('[');
- String arrayDcl = Util.sansArrayInfo (baseName.substring (startArray)) + "[]"; // Add an extra set because the first gets stripped off in the loop.
- baseName = baseName.substring (0, startArray);
-
- // For interfaces having state, e.g., valuetypes.
- SymtabEntry baseEntry = (SymtabEntry)Util.symbolTable.get (baseName.replace ('.', '/'));
- if (baseEntry instanceof InterfaceEntry && ((InterfaceEntry)baseEntry).state () != null)
- // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
- //baseName = Util.javaStatefulName ((InterfaceEntry)baseEntry);
- baseName = Util.javaName ((InterfaceEntry)baseEntry);
-
- int end1stArray;
- while (!modifier.equals (""))
- {
- int rbracket = modifier.indexOf (']');
- String size = modifier.substring (1, rbracket);
- end1stArray = arrayDcl.indexOf (']');
- arrayDcl = '[' + size + arrayDcl.substring (end1stArray + 2);
- stream.println (indent + name + " = new " + baseName + arrayDcl + ';');
- loopIndex = "_o" + index++;
- stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < (" + size + "); ++" + loopIndex + ')');
- stream.println (indent + '{');
- ++closingBrackets;
- modifier = modifier.substring (rbracket + 1);
- indent = indent + " ";
- name = name + '[' + loopIndex + ']';
- }
- end1stArray = arrayDcl.indexOf (']');
- if (td.type () instanceof SequenceEntry || td.type () instanceof PrimitiveEntry || td.type () instanceof StringEntry)
- index = ((JavaGenerator)td.type ().generator ()).read (index, indent, name, td.type (), stream);
- else if (td.type () instanceof InterfaceEntry && td.type ().fullName ().equals ("org/omg/CORBA/Object"))
- stream.println (indent + name + " = istream.read_Object ();");
- else
- stream.println (indent + name + " = " + Util.helperName (td.type (), true) + ".read (istream);"); // <d61056>
- for (int i = 0; i < closingBrackets; ++i)
- {
- indent = indent.substring (2);
- stream.println (indent + '}');
- }
- }
- else
- {
- SymtabEntry tdtype = Util.typeOf (td.type ());
- if (tdtype instanceof SequenceEntry || tdtype instanceof PrimitiveEntry || tdtype instanceof StringEntry)
- index = ((JavaGenerator)tdtype.generator ()).read (index, indent, name, tdtype, stream);
- else if (tdtype instanceof InterfaceEntry && tdtype.fullName ().equals ("org/omg/CORBA/Object"))
- stream.println (indent + name + " = istream.read_Object ();");
- else
- stream.println (indent + name + " = " + Util.helperName (tdtype, true) + ".read (istream);"); // <d61056>
- }
- return index;
- } // read
-
- public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- TypedefEntry td = (TypedefEntry)entry;
- String modifier = Util.arrayInfo (td.arrayInfo ());
- if (!modifier.equals (""))
- {
- int closingBrackets = 0;
- String loopIndex = "";
- while (!modifier.equals (""))
- {
- int rbracket = modifier.indexOf (']');
- String size = modifier.substring (1, rbracket);
- stream.println (indent + "if (" + name + ".length != (" + size + "))");
- stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
- loopIndex = "_i" + index++;
- stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < (" + size + "); ++" + loopIndex + ')');
- stream.println (indent + '{');
- ++closingBrackets;
- modifier = modifier.substring (rbracket + 1);
- indent = indent + " ";
- name = name + '[' + loopIndex + ']';
- }
- if (td.type () instanceof SequenceEntry || td.type () instanceof PrimitiveEntry || td.type () instanceof StringEntry)
- index = ((JavaGenerator)td.type ().generator ()).write (index, indent, name, td.type (), stream);
- else if (td.type () instanceof InterfaceEntry && td.type ().fullName ().equals ("org/omg/CORBA/Object"))
- stream.println (indent + "ostream.write_Object (" + name + ");");
- else
- stream.println (indent + Util.helperName (td.type (), true) + ".write (ostream, " + name + ");"); // <d61056>
- for (int i = 0; i < closingBrackets; ++i)
- {
- indent = indent.substring (2);
- stream.println (indent + '}');
- }
- }
- else
- {
- SymtabEntry tdtype = Util.typeOf (td.type ());
- if (tdtype instanceof SequenceEntry || tdtype instanceof PrimitiveEntry || tdtype instanceof StringEntry)
- index = ((JavaGenerator)tdtype.generator ()).write (index, indent, name, tdtype, stream);
- else if (tdtype instanceof InterfaceEntry && tdtype.fullName ().equals ("org/omg/CORBA/Object"))
- stream.println (indent + "ostream.write_Object (" + name + ");");
- else
- stream.println (indent + Util.helperName (tdtype, true) + ".write (ostream, " + name + ");"); // <d61056>
- }
- return index;
- } // write
-
- // From JavaGenerator
- ////////////////
-
- protected Hashtable symbolTable = null;
- protected TypedefEntry t = null;
-} // class TypedefGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java
deleted file mode 100644
index 89367e6..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java
+++ /dev/null
@@ -1,1074 +0,0 @@
-/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -cast() does not support longlong types yet.
-// -Deal with typedef changes.
-// -Scoped names for the discriminator are ignored at the moment.
-// -F46082.51<daz> Remove -stateful feature; javaStatefulName() obsolete.
-// -D61056 <klr> Use Util.helperName
-
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.ConstEntry;
-import com.sun.tools.corba.se.idl.EnumEntry;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.SequenceEntry;
-import com.sun.tools.corba.se.idl.StringEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.UnionBranch;
-import com.sun.tools.corba.se.idl.UnionEntry;
-
-import com.sun.tools.corba.se.idl.constExpr.Expression;
-import com.sun.tools.corba.se.idl.constExpr.EvaluationException;
-
-/**
- *
- **/
-public class UnionGen implements com.sun.tools.corba.se.idl.UnionGen, JavaGenerator
-{
- /**
- * Public zero-argument constructor.
- **/
- public UnionGen ()
- {
- } // ctor
-
- /**
- *
- **/
- public void generate (Hashtable symbolTable, UnionEntry u, PrintWriter s)
- {
- this.symbolTable = symbolTable;
- this.u = u;
- init ();
-
- openStream ();
- if (stream == null)
- return;
- generateHelper ();
- generateHolder ();
- writeHeading ();
- writeBody ();
- writeClosing ();
- closeStream ();
- generateContainedTypes ();
- } // generate
-
- /**
- * Initialize members unique to this generator.
- **/
- protected void init ()
- {
- utype = Util.typeOf (u.type ());
- unionIsEnum = utype instanceof EnumEntry;
- } // init
-
- /**
- *
- **/
- protected void openStream ()
- {
- stream = Util.stream (u, ".java");
- } // openStream
-
- /**
- *
- **/
- protected void generateHelper ()
- {
- ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, u);
- } // generateHelper
-
- /**
- *
- **/
- protected void generateHolder ()
- {
- ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, u);
- } // generateHolder
-
- /**
- *
- **/
- protected void writeHeading ()
- {
- // If the discriminator is an enum, assign the typePackage string.
- if (unionIsEnum)
- typePackage = Util.javaQualifiedName (utype) + '.';
- else
- typePackage = "";
-
- Util.writePackage (stream, u);
- Util.writeProlog (stream, ((GenFileStream)stream).name ());
-
- String className = u.name ();
- stream.println ("public final class " + u.name () + " implements org.omg.CORBA.portable.IDLEntity");
- stream.println ("{");
- } // writeHeading
-
- /**
- *
- **/
- protected void writeBody ()
- {
- // Write branches and populate quality arrays
- int size = u.branches ().size () + 1;
- Enumeration e = u.branches ().elements ();
- int i = 0;
- while (e.hasMoreElements ())
- {
- UnionBranch branch = (UnionBranch)e.nextElement ();
- Util.fillInfo (branch.typedef);
- // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
- //stream.println (" private " + Util.javaStatefulName (branch.typedef) + " ___" + branch.typedef.name () + ";");
- stream.println (" private " + Util.javaName (branch.typedef) + " ___" + branch.typedef.name () + ";");
- ++i;
- }
- stream.println (" private " + Util.javaName (utype) + " __discriminator;");
- stream.println (" private boolean __uninitialized = true;");
-
- // Write ctor
- stream.println ();
- stream.println (" public " + u.name () + " ()");
- stream.println (" {");
- stream.println (" }");
-
- // Write discriminator
- stream.println ();
- stream.println (" public " + Util.javaName (utype) + " " + safeName (u, "discriminator") + " ()");
- stream.println (" {");
- stream.println (" if (__uninitialized)");
- stream.println (" throw new org.omg.CORBA.BAD_OPERATION ();");
- stream.println (" return __discriminator;");
- stream.println (" }");
-
- // Write for each branch:
- // - setter
- // - getter
- // - private verifyXXX
- e = u.branches ().elements ();
- i = 0;
- while (e.hasMoreElements ())
- {
- UnionBranch branch = (UnionBranch)e.nextElement ();
- writeBranchMethods (stream, u, branch, i++);
- }
- if (u.defaultBranch () == null && !coversAll (u))
- {
- stream.println ();
- stream.println (" public void _default ()");
- stream.println (" {");
- stream.println (" __discriminator = " + defaultDiscriminator (u) + ';');
- stream.println (" __uninitialized = false;");
- stream.println (" }");
-
- stream.println ();
- stream.println (" public void _default (" + Util.javaName(utype) +
- " discriminator)");
- stream.println (" {");
- stream.println (" verifyDefault( discriminator ) ;" );
- stream.println (" __discriminator = discriminator ;");
- stream.println (" __uninitialized = false;");
- stream.println (" }");
-
- writeVerifyDefault() ;
- }
- stream.println ();
- } // writeBody
-
- /**
- *
- **/
- protected void writeClosing ()
- {
- stream.println ("} // class " + u.name ());
- } // writeClosing
-
- /**
- *
- **/
- protected void closeStream ()
- {
- stream.close ();
- } // closeStream
-
- /**
- *
- **/
- protected void generateContainedTypes ()
- {
- Enumeration e = u.contained ().elements ();
- while (e.hasMoreElements ())
- {
- SymtabEntry entry = (SymtabEntry)e.nextElement ();
-
- // Don't generate contained entries if they are sequences.
- // Sequences are unnamed and since they translate to arrays,
- // no classes are generated for them, not even holders in this
- // case since they cannot be accessed outside of this union.
- if (!(entry instanceof SequenceEntry))
- entry.generate (symbolTable, stream);
- }
- } // generateContainedTypes
-
- private void writeVerifyDefault()
- {
- Vector labels = vectorizeLabels (u.branches (), true);
-
- if (Util.javaName(utype).equals ("boolean")) {
- stream.println( "" ) ;
- stream.println( " private void verifyDefault (boolean discriminator)" ) ;
- stream.println( " {" ) ;
- if (labels.contains ("true"))
- stream.println (" if ( discriminator )");
- else
- stream.println (" if ( !discriminator )");
- stream.println( " throw new org.omg.CORBA.BAD_OPERATION();" ) ;
- stream.println( " }" ) ;
- return;
- }
-
- stream.println( "" ) ;
- stream.println( " private void verifyDefault( " + Util.javaName(utype) +
- " value )" ) ;
- stream.println( " {" ) ;
-
- if (unionIsEnum)
- stream.println( " switch (value.value()) {" ) ;
- else
- stream.println( " switch (value) {" ) ;
-
- Enumeration e = labels.elements() ;
- while (e.hasMoreElements()) {
- String str = (String)(e.nextElement()) ;
- stream.println( " case " + str + ":" ) ;
- }
-
- stream.println( " throw new org.omg.CORBA.BAD_OPERATION() ;" ) ;
- stream.println( "" ) ;
- stream.println( " default:" ) ;
- stream.println( " return;" ) ;
- stream.println( " }" ) ;
- stream.println( " }" ) ;
- }
-
- private String defaultDiscriminator (UnionEntry u)
- {
- Vector labels = vectorizeLabels (u.branches (), false );
- String ret = null;
- SymtabEntry utype = Util.typeOf (u.type ());
- if (utype instanceof PrimitiveEntry && utype.name ().equals ("boolean")) {
- // If it got this far, then:
- // - there is only one branch;
- // - that branch has only one label.
- if (labels.contains ("true"))
- ret = "false";
- else
- ret = "true";
- } else if (utype.name ().equals ("char")) {
- // This doesn't handle '\u0030' == '0'. Unions are so
- // seldom used. I don't have time to make this perfect.
- int def = 0;
- String string = "'\\u0000'";
- while (def != 0xFFFF && labels.contains (string))
- if (++def / 0x10 == 0)
- string = "'\\u000" + def + "'";
- else if (def / 0x100 == 0)
- string = "\\u00" + def + "'";
- else if (def / 0x1000 == 0)
- string = "\\u0" + def + "'";
- else
- string = "\\u" + def + "'";
- ret = string;
- } else if (utype instanceof EnumEntry) {
- Enumeration e = labels.elements ();
- EnumEntry enumEntry = (EnumEntry)utype;
- Vector enumList = (Vector)enumEntry.elements ().clone ();
- // cull out those elements in the enumeration list that are
- // in the cases of this union
- while (e.hasMoreElements ())
- enumList.removeElement (e.nextElement ());
- // If all of the enum elements are covered in this union and
- // there is a default statement, just pick one of the
- // elements for the default. If there are enum elements
- // which are NOT covered by the cases, pick one as the
- // default.
- if (enumList.size () == 0)
- ret = typePackage + (String)enumEntry.elements ().lastElement ();
- else
- ret = typePackage + (String)enumList.firstElement ();
- } else if (utype.name ().equals ("octet")) {
- short def = Byte.MIN_VALUE;
- while (def != Byte.MAX_VALUE && labels.contains (Integer.toString (def)))
- ++def;
- ret = Integer.toString (def);
- } else if (utype.name ().equals ("short")) {
- short def = Short.MIN_VALUE;
- while (def != Short.MAX_VALUE && labels.contains (Integer.toString (def)))
- ++def;
- ret = Integer.toString (def);
- } else if (utype.name ().equals ("long")) {
- int def = Integer.MIN_VALUE;
- while (def != Integer.MAX_VALUE && labels.contains (Integer.toString (def)))
- ++def;
- ret = Integer.toString (def);
- } else if (utype.name ().equals ("long long")) {
- long def = Long.MIN_VALUE;
- while (def != Long.MAX_VALUE && labels.contains (Long.toString (def)))
- ++def;
- ret = Long.toString (def);
- } else if (utype.name ().equals ("unsigned short")) {
- short def = 0;
- while (def != Short.MAX_VALUE && labels.contains (Integer.toString (def)))
- ++def;
- ret = Integer.toString (def);
- } else if (utype.name ().equals ("unsigned long")) {
- int def = 0;
- while (def != Integer.MAX_VALUE && labels.contains (Integer.toString (def)))
- ++def;
- ret = Integer.toString (def);
- } else if (utype.name ().equals ("unsigned long long")) {
- long def = 0;
- while (def != Long.MAX_VALUE && labels.contains (Long.toString (def)))
- ++def;
- ret = Long.toString (def);
- }
-
- return ret;
- } // defaultDiscriminator
-
- /**
- *
- **/
- private Vector vectorizeLabels (Vector branchVector, boolean useIntsForEnums )
- {
- Vector mergedLabels = new Vector ();
- Enumeration branches = branchVector.elements ();
- while (branches.hasMoreElements ())
- {
- UnionBranch branch = (UnionBranch)branches.nextElement ();
- Enumeration labels = branch.labels.elements ();
- while (labels.hasMoreElements ())
- {
- Expression expr = (Expression)labels.nextElement ();
- String str ;
-
- if (unionIsEnum)
- if (useIntsForEnums)
- str = typePackage + "_" + Util.parseExpression( expr ) ;
- else
- str = typePackage + Util.parseExpression( expr ) ;
- else
- str = Util.parseExpression( expr ) ;
-
- mergedLabels.addElement (str);
- }
- }
- return mergedLabels;
- } // vectorizeLabels
-
- /**
- *
- **/
- private String safeName (UnionEntry u, String name)
- {
- Enumeration e = u.branches ().elements ();
- while (e.hasMoreElements ())
- if (((UnionBranch)e.nextElement ()).typedef.name ().equals (name))
- {
- name = '_' + name;
- break;
- }
- return name;
- } // safeName
-
- /**
- *
- **/
- private boolean coversAll (UnionEntry u)
- {
- // This assumes that it is not possible to cover types other than
- // boolean and enums. This is not quite correct, but since octet
- // is not a valid discriminator type, it's not too bad in practice.
- // It may also be possible to cover a char type, but we won't worry
- // about that either.
- SymtabEntry utype = Util.typeOf (u.type ());
-
- boolean coversAll = false;
- if (utype.name ().equals ("boolean")) {
- if (u.branches ().size () == 2)
- coversAll = true;
- } else if (utype instanceof EnumEntry) {
- Vector labels = vectorizeLabels (u.branches (), true);
- if (labels.size () == ((EnumEntry)utype).elements ().size ())
- coversAll = true;
- }
-
- return coversAll;
- } // coversAll
-
- /**
- *
- **/
- private void writeBranchMethods (PrintWriter stream, UnionEntry u, UnionBranch branch, int i)
- {
- // Write getter
- stream.println ();
- // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
- //stream.println (" public " + Util.javaStatefulName (branch.typedef) + " " + branch.typedef.name () + " ()");
- stream.println (" public " + Util.javaName (branch.typedef) + " " + branch.typedef.name () + " ()");
- stream.println (" {");
- stream.println (" if (__uninitialized)");
- stream.println (" throw new org.omg.CORBA.BAD_OPERATION ();");
- stream.println (" verify" + branch.typedef.name () + " (__discriminator);");
- stream.println (" return ___" + branch.typedef.name () + ";");
- stream.println (" }");
-
- // Write setter(s)
- stream.println ();
- // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
- //stream.println (" public void " + branch.typedef.name () + " (" + Util.javaStatefulName (branch.typedef) + " value)");
- stream.println (" public void " + branch.typedef.name () + " (" + Util.javaName (branch.typedef) + " value)");
- stream.println (" {");
- if (branch.labels.size () == 0)
- {
- // This is a default branch
- stream.println (" __discriminator = " + defaultDiscriminator (u) + ";");
- }
- else
- {
- // This is a non-default branch
- if (unionIsEnum)
- stream.println (" __discriminator = " + typePackage + Util.parseExpression ((Expression)branch.labels.firstElement ()) + ";");
- else
- stream.println (" __discriminator = " + cast ((Expression)branch.labels.firstElement (), u.type ()) + ";");
- }
- stream.println (" ___" + branch.typedef.name () + " = value;");
- stream.println (" __uninitialized = false;");
- stream.println (" }");
-
- SymtabEntry utype = Util.typeOf (u.type ());
-
- // If there are multiple labels for one branch, write the
- // setter that takes a discriminator.
- if (branch.labels.size () > 0 || branch.isDefault)
- {
- stream.println ();
- // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
- //stream.println (" public void " + branch.typedef.name () + " (" + Util.javaName (utype) + " discriminator, " + Util.javaStatefulName (branch.typedef) + " value)");
- stream.println (" public void " + branch.typedef.name () + " (" + Util.javaName (utype) + " discriminator, " + Util.javaName (branch.typedef) + " value)");
- stream.println (" {");
- stream.println (" verify" + branch.typedef.name () + " (discriminator);");
- stream.println (" __discriminator = discriminator;");
- stream.println (" ___" + branch.typedef.name () + " = value;");
- stream.println (" __uninitialized = false;");
- stream.println (" }");
- }
-
- // Write verifyXXX
- stream.println ();
- stream.println (" private void verify" + branch.typedef.name () + " (" + Util.javaName (utype) + " discriminator)");
- stream.println (" {");
-
- boolean onlyOne = true;
-
- if (branch.isDefault && u.branches ().size () == 1)
- ;// If all that is in this union is a default branch,
- // all discriminators are legal. Don't print any
- // body to this method in that case.
- else
- {
- // Otherwise this code is executed and a body is printed.
- stream.print (" if (");
- if (branch.isDefault)
- {
- Enumeration eBranches = u.branches ().elements ();
- while (eBranches.hasMoreElements ())
- {
- UnionBranch b = (UnionBranch)eBranches.nextElement ();
- if (b != branch)
- {
- Enumeration eLabels = b.labels.elements ();
- while (eLabels.hasMoreElements ())
- {
- Expression label = (Expression)eLabels.nextElement ();
- if (!onlyOne)
- stream.print (" || ");
- if (unionIsEnum)
- stream.print ("discriminator == " + typePackage + Util.parseExpression (label));
- else
- stream.print ("discriminator == " + Util.parseExpression (label));
- onlyOne = false;
- }
- }
- }
- }
- else
- {
- Enumeration e = branch.labels.elements ();
- while (e.hasMoreElements ())
- {
- Expression label = (Expression)e.nextElement ();
- if (!onlyOne)
- stream.print (" && ");
- if (unionIsEnum)
- stream.print ("discriminator != " + typePackage + Util.parseExpression (label));
- else
- stream.print ("discriminator != " + Util.parseExpression (label));
- onlyOne = false;
- }
- }
- stream.println (")");
- stream.println (" throw new org.omg.CORBA.BAD_OPERATION ();");
- }
- stream.println (" }");
- } // writeBranchMethods
-
- ///////////////
- // From JavaGenerator
-
- /**
- *
- **/
-
- // Computes the total number of labels in the union, which is the sum
- // of the number of labels in each branch of the union. Note that the
- // label for the default branch has size 0, but still counts in the total
- // size.
- private int unionLabelSize( UnionEntry un )
- {
- int size = 0 ;
- Vector branches = un.branches() ;
- for (int i = 0; i < branches.size (); ++i) {
- UnionBranch branch = (UnionBranch)(branches.get(i)) ;
- int branchSize = branch.labels.size() ;
- size += ((branchSize == 0) ? 1 : branchSize) ;
- }
- return size ;
- }
-
- public int helperType (int index, String indent, TCOffsets tcoffsets,
- String name, SymtabEntry entry, PrintWriter stream)
- {
- TCOffsets innerOffsets = new TCOffsets ();
- UnionEntry u = (UnionEntry)entry;
- String discTypeCode = "_disTypeCode" + index;
- String membersName = "_members" + index;
-
- // Build discriminator tc
- stream.println (indent + "org.omg.CORBA.TypeCode " + discTypeCode + ';');
- index = ((JavaGenerator)u.type ().generator ()).type (index + 1, indent,
- innerOffsets, discTypeCode, u.type (), stream);
- tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ());
-
- stream.println (indent + "org.omg.CORBA.UnionMember[] " + membersName +
- " = new org.omg.CORBA.UnionMember [" + unionLabelSize(u) + "];");
- String tcOfMembers = "_tcOf" + membersName;
- String anyOfMembers = "_anyOf" + membersName;
- stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + ';');
- stream.println (indent + "org.omg.CORBA.Any " + anyOfMembers + ';');
-
- innerOffsets = new TCOffsets ();
- innerOffsets.set (entry);
- int offsetForUnion = innerOffsets.currentOffset ();
- for (int i = 0; i < u.branches ().size (); ++i) {
- UnionBranch branch = (UnionBranch)u.branches ().elementAt (i);
- TypedefEntry member = branch.typedef;
- Vector labels = branch.labels;
- String memberName = Util.stripLeadingUnderscores (member.name ());
-
- if (labels.size() == 0) {
- stream.println ();
- stream.println (indent + "// Branch for " + memberName +
- " (Default case)" );
- SymtabEntry utype = Util.typeOf (u.type ());
- stream.println (indent + anyOfMembers + " = org.omg.CORBA.ORB.init ().create_any ();");
- // For default member, label is the zero octet (per CORBA spec.)
- stream.println (indent + anyOfMembers + ".insert_octet ((byte)0); // default member label");
-
- // Build typecode
- innerOffsets.bumpCurrentOffset (4); // label value
- index = ((JavaGenerator)member.generator ()).type (index, indent, innerOffsets, tcOfMembers, member, stream);
- int offsetSoFar = innerOffsets.currentOffset ();
- innerOffsets = new TCOffsets ();
- innerOffsets.set (entry);
- innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForUnion);
-
- // Build union member
- stream.println (indent + membersName + '[' + i + "] = new org.omg.CORBA.UnionMember (");
- stream.println (indent + " \"" + memberName + "\",");
- stream.println (indent + " " + anyOfMembers + ',');
- stream.println (indent + " " + tcOfMembers + ',');
- stream.println (indent + " null);");
- } else {
- Enumeration enumeration = labels.elements() ;
- while (enumeration.hasMoreElements()) {
- Expression expr = (Expression)(enumeration.nextElement()) ;
- String elem = Util.parseExpression( expr ) ;
-
- stream.println ();
- stream.println (indent + "// Branch for " + memberName +
- " (case label " + elem + ")" );
-
- SymtabEntry utype = Util.typeOf (u.type ());
-
- // Build any
- stream.println (indent + anyOfMembers + " = org.omg.CORBA.ORB.init ().create_any ();");
-
- if (utype instanceof PrimitiveEntry)
- stream.println (indent + anyOfMembers + ".insert_" +
- Util.collapseName (utype.name ()) + " ((" + Util.javaName (utype) +
- ')' + elem + ");");
- else { // it must be enum
- String enumClass = Util.javaName (utype);
- stream.println (indent + Util.helperName (utype, false) + ".insert (" +
- anyOfMembers + ", " + enumClass + '.' + elem + ");"); // <d61056>
- }
-
- // Build typecode
- innerOffsets.bumpCurrentOffset (4); // label value
- index = ((JavaGenerator)member.generator ()).type (index, indent, innerOffsets, tcOfMembers, member, stream);
- int offsetSoFar = innerOffsets.currentOffset ();
- innerOffsets = new TCOffsets ();
- innerOffsets.set (entry);
- innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForUnion);
-
- // Build union member
- stream.println (indent + membersName + '[' + i + "] = new org.omg.CORBA.UnionMember (");
- stream.println (indent + " \"" + memberName + "\",");
- stream.println (indent + " " + anyOfMembers + ',');
- stream.println (indent + " " + tcOfMembers + ',');
- stream.println (indent + " null);");
- }
- }
- }
-
- tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ());
-
- // Build create_union_tc
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_union_tc (" +
- Util.helperName (u, true) + ".id (), \"" + entry.name () + "\", " +
- discTypeCode + ", " + membersName + ");");
- return index;
- } // helperType
-
- public int type (int index, String indent, TCOffsets tcoffsets, String name,
- SymtabEntry entry, PrintWriter stream)
- {
- stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();");
- return index;
- }
-
- public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- stream.println (" " + entryName + " value = new " + entryName + " ();");
- read (0, " ", "value", entry, stream);
- stream.println (" return value;");
- }
-
- public void helperWrite (SymtabEntry entry, PrintWriter stream)
- {
- write (0, " ", "value", entry, stream);
- }
-
- public int read (int index, String indent, String name,
- SymtabEntry entry, PrintWriter stream)
- {
- UnionEntry u = (UnionEntry)entry;
- String disName = "_dis" + index++;
- SymtabEntry utype = Util.typeOf (u.type ());
- Util.writeInitializer (indent, disName, "", utype, stream);
-
- if (utype instanceof PrimitiveEntry)
- index = ((JavaGenerator)utype.generator ()).read (index, indent, disName, utype, stream);
- else
- stream.println (indent + disName + " = " + Util.helperName (utype, true) + ".read (istream);");
-
- if (utype.name ().equals ("boolean"))
- index = readBoolean (disName, index, indent, name, u, stream);
- else
- index = readNonBoolean (disName, index, indent, name, u, stream);
-
- return index;
- }
-
- private int readBoolean (String disName, int index, String indent,
- String name, UnionEntry u, PrintWriter stream)
- {
- UnionBranch firstBranch = (UnionBranch)u.branches ().firstElement ();
- UnionBranch secondBranch;
-
- if (u.branches ().size () == 2)
- secondBranch = (UnionBranch)u.branches ().lastElement ();
- else
- secondBranch = null;
-
- boolean firstBranchIsTrue = false;
- boolean noCases = false;
- try {
- if (u.branches ().size () == 1 &&
- (u.defaultBranch () != null || firstBranch.labels.size () == 2)) {
- noCases = true;
- } else {
- Expression expr = (Expression)(firstBranch.labels.firstElement()) ;
- Boolean bool = (Boolean)(expr.evaluate()) ;
- firstBranchIsTrue = bool.booleanValue ();
- }
- } catch (EvaluationException ex) {
- // no action
- }
-
- if (noCases) {
- // There is only a default label. Since there are no cases,
- // there is no need for if...else branches.
- index = readBranch (index, indent, firstBranch.typedef.name (), "", firstBranch.typedef, stream);
- } else {
- // If first branch is false, swap branches
- if (!firstBranchIsTrue) {
- UnionBranch tmp = firstBranch;
- firstBranch = secondBranch;
- secondBranch = tmp;
- }
-
- stream.println (indent + "if (" + disName + ')');
-
- if (firstBranch == null)
- stream.println (indent + " value._default(" + disName + ");");
- else {
- stream.println (indent + '{');
- index = readBranch (index, indent + " ", firstBranch.typedef.name (),
- disName, firstBranch.typedef, stream);
- stream.println (indent + '}');
- }
-
- stream.println (indent + "else");
-
- if (secondBranch == null)
- stream.println (indent + " value._default(" + disName + ");");
- else {
- stream.println (indent + '{');
- index = readBranch (index, indent + " ", secondBranch.typedef.name (),
- disName, secondBranch.typedef, stream);
- stream.println (indent + '}');
- }
- }
-
- return index;
- }
-
- private int readNonBoolean (String disName, int index, String indent,
- String name, UnionEntry u, PrintWriter stream)
- {
- SymtabEntry utype = Util.typeOf (u.type ());
-
- if (utype instanceof EnumEntry)
- stream.println (indent + "switch (" + disName + ".value ())");
- else
- stream.println (indent + "switch (" + disName + ')');
-
- stream.println (indent + '{');
- String typePackage = Util.javaQualifiedName (utype) + '.';
-
- Enumeration e = u.branches ().elements ();
- while (e.hasMoreElements ()) {
- UnionBranch branch = (UnionBranch)e.nextElement ();
- Enumeration labels = branch.labels.elements ();
-
- while (labels.hasMoreElements ()) {
- Expression label = (Expression)labels.nextElement ();
-
- if (utype instanceof EnumEntry) {
- String key = Util.parseExpression (label);
- stream.println (indent + " case " + typePackage + '_' + key + ':');
- } else
- stream.println (indent + " case " + cast (label, utype) + ':');
- }
-
- if (!branch.typedef.equals (u.defaultBranch ())) {
- index = readBranch (index, indent + " ", branch.typedef.name (),
- branch.labels.size() > 1 ? disName : "" ,
- branch.typedef, stream);
- stream.println (indent + " break;");
- }
- }
-
- // We need a default branch unless all of the case of the discriminator type
- // are listed in the case branches.
- if (!coversAll(u)) {
- stream.println( indent + " default:") ;
-
- if (u.defaultBranch () == null) {
- // If the union does not have a default branch, we still need to initialize
- // the discriminator.
- stream.println( indent + " value._default( " + disName + " ) ;" ) ;
- } else {
- index = readBranch (index, indent + " ", u.defaultBranch ().name (), disName,
- u.defaultBranch (), stream);
- }
-
- stream.println (indent + " break;");
- }
-
- stream.println (indent + '}');
-
- return index;
- }
-
- private int readBranch (int index, String indent, String name, String disName, TypedefEntry entry, PrintWriter stream)
- {
- SymtabEntry type = entry.type ();
- Util.writeInitializer (indent, '_' + name, "", entry, stream);
-
- if (!entry.arrayInfo ().isEmpty () ||
- type instanceof SequenceEntry ||
- type instanceof PrimitiveEntry ||
- type instanceof StringEntry) {
- index = ((JavaGenerator)entry.generator ()).read (index, indent, '_' + name, entry, stream);
- } else {
- stream.println (indent + '_' + name + " = " + Util.helperName (type, true) + ".read (istream);");
- }
-
- stream.print (indent + "value." + name + " (");
- if( disName == "" )
- stream.println("_" + name + ");");
- else
- stream.println(disName + ", " + "_" + name + ");");
-
- return index;
- }
-
- /**
- *
- **/
- public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- UnionEntry u = (UnionEntry)entry;
- SymtabEntry utype = Util.typeOf (u.type ());
- if (utype instanceof PrimitiveEntry)
- index = ((JavaGenerator)utype.generator ()).write (index, indent, name + ".discriminator ()", utype, stream);
- else
- stream.println (indent + Util.helperName (utype, true) + ".write (ostream, " + name + ".discriminator ());"); // <d61056>
- if (utype.name ().equals ("boolean"))
- index = writeBoolean (name + ".discriminator ()", index, indent, name, u, stream);
- else
- index = writeNonBoolean (name + ".discriminator ()", index, indent, name, u, stream);
- return index;
- } // write
-
- /**
- *
- **/
- private int writeBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream)
- {
- SymtabEntry utype = Util.typeOf (u.type ());
- UnionBranch firstBranch = (UnionBranch)u.branches ().firstElement ();
- UnionBranch secondBranch;
- if (u.branches ().size () == 2)
- secondBranch = (UnionBranch)u.branches ().lastElement ();
- else
- secondBranch = null;
- boolean firstBranchIsTrue = false;
- boolean noCases = false;
- try
- {
- if (u.branches ().size () == 1 && (u.defaultBranch () != null || firstBranch.labels.size () == 2))
- noCases = true;
- else
- firstBranchIsTrue = ((Boolean)((Expression)firstBranch.labels.firstElement ()).evaluate ()).booleanValue ();
- }
- catch (EvaluationException ex)
- {}
-
- if (noCases)
- {
- // There is only a default label. Since there are no cases,
- // there is no need for if...else branches.
- index = writeBranch (index, indent, name, firstBranch.typedef, stream);
- }
- else
- {
- // If first branch is false, swap branches
- if (!firstBranchIsTrue)
- {
- UnionBranch tmp = firstBranch;
- firstBranch = secondBranch;
- secondBranch = tmp;
- }
- if (firstBranch != null && secondBranch != null) {
- stream.println (indent + "if (" + disName + ')');
- stream.println (indent + '{');
- index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream);
- stream.println (indent + '}');
- stream.println (indent + "else");
- stream.println (indent + '{');
- index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream);
- stream.println (indent + '}');
- } else if (firstBranch != null) {
- stream.println (indent + "if (" + disName + ')');
- stream.println (indent + '{');
- index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream);
- stream.println (indent + '}');
- } else {
- stream.println (indent + "if (!" + disName + ')');
- stream.println (indent + '{');
- index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream);
- stream.println (indent + '}');
- }
- }
- return index;
- } // writeBoolean
-
- /**
- *
- **/
- private int writeNonBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream)
- {
- SymtabEntry utype = Util.typeOf (u.type ());
- if (utype instanceof EnumEntry)
- stream.println (indent + "switch (" + name + ".discriminator ().value ())");
- else
- stream.println (indent + "switch (" + name + ".discriminator ())");
- stream.println (indent + "{");
- String typePackage = Util.javaQualifiedName (utype) + '.';
- Enumeration e = u.branches ().elements ();
- while (e.hasMoreElements ())
- {
- UnionBranch branch = (UnionBranch)e.nextElement ();
- Enumeration labels = branch.labels.elements ();
- while (labels.hasMoreElements ())
- {
- Expression label = (Expression)labels.nextElement ();
- if (utype instanceof EnumEntry)
- {
- String key = Util.parseExpression (label);
- stream.println (indent + " case " + typePackage + '_' + key + ":");
- }
- else
- stream.println (indent + " case " + cast (label, utype) + ':');
- }
- if (!branch.typedef.equals (u.defaultBranch ()))
- {
- index = writeBranch (index, indent + " ", name, branch.typedef, stream);
- stream.println (indent + " break;");
- }
- }
- if (u.defaultBranch () != null) {
- stream.println (indent + " default:");
- index = writeBranch (index, indent + " ", name, u.defaultBranch (), stream);
- stream.println (indent + " break;");
- }
- stream.println (indent + "}");
- return index;
- } // writeNonBoolean
-
- /**
- *
- **/
- private int writeBranch (int index, String indent, String name, TypedefEntry entry, PrintWriter stream)
- {
- SymtabEntry type = entry.type ();
- if (!entry.arrayInfo ().isEmpty () || type instanceof SequenceEntry || type instanceof PrimitiveEntry || type instanceof StringEntry)
- index = ((JavaGenerator)entry.generator ()).write (index, indent, name + '.' + entry.name () + " ()", entry, stream);
- else
- stream.println (indent + Util.helperName (type, true) + ".write (ostream, " + name + '.' + entry.name () + " ());"); // <d61056>
- return index;
- } // writeBranch
-
- // From JavaGenerator
- ///////////////
-
- /**
- *
- **/
- private String cast (Expression expr, SymtabEntry type)
- {
- String ret = Util.parseExpression (expr);
- if (type.name ().indexOf ("short") >= 0)
- {
- if (expr.value () instanceof Long)
- {
- long value = ((Long)expr.value ()).longValue ();
- if (value > Short.MAX_VALUE)
- ret = "(short)(" + ret + ')';
- }
- else if (expr.value () instanceof Integer)
- {
- int value = ((Integer)expr.value ()).intValue ();
- if (value > Short.MAX_VALUE)
- ret = "(short)(" + ret + ')';
- }
- }
- else if (type.name ().indexOf ("long") >= 0)
- {
- if (expr.value () instanceof Long)
- {
- long value = ((Long)expr.value ()).longValue ();
- // value == Integer.MIN_VALUE because if the number is
- // Integer.MIN_VALUE, then it will have the 'L' suffix and
- // the cast will be necessary.
- if (value > Integer.MAX_VALUE || value == Integer.MIN_VALUE)
- ret = "(int)(" + ret + ')';
- }
- else if (expr.value () instanceof Integer)
- {
- int value = ((Integer)expr.value ()).intValue ();
- // value == Integer.MIN_VALUE because if the number is
- // Integer.MIN_VALUE, then it will have the 'L' suffix and
- // the cast will be necessary.
- if (value > Integer.MAX_VALUE || value == Integer.MIN_VALUE)
- ret = "(int)(" + ret + ')';
- }
- }
- return ret;
- } // cast
-
- protected Hashtable symbolTable = null;
- protected UnionEntry u = null;
- protected PrintWriter stream = null;
- protected SymtabEntry utype = null;
- protected boolean unionIsEnum;
- protected String typePackage = "";
-} // class UnionGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Util.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Util.java
deleted file mode 100644
index 7fa57fc..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Util.java
+++ /dev/null
@@ -1,1429 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// Notes:
-// -F46838.4<klr> Ported -td option from toJava.
-// -10/17/98 KLR Ported fix for d48911 from toJava
-// -10/18/98 KLR Ported fix from toJava for "unsigned long" constants
-// -F46082.51<daz> Removed code to collect makefile list generation inforamtion
-// from getStream(); see f46830.
-// -F46082.51<daz> Removed -stateful feature: methods javaStatefulName(String)
-// and javaStatefulName(SymtabEntry) are obsolete, supplanted by javaName().
-// -D54640<daz> Represent unsigned long long expressions with their computed
-// value rather than their actual representation (see notes in method
-// parseTerminal(), parseBinary(), and parseUnary().)
-// -D58319<daz> Add getVersion() method.
-// -D48034<daz> Import Helper classes for typedef struct members when generating
-// helper. See method addImportLines().
-// -D59851<daz> Modify to enable QuickTest build. (pending)
-// -D42256<daz> Determine import lines for template types, which may specify any
-// positive int., constant expression for a boundary. Such expression containing
-// non-literal contansts previously caused problems when appearing in constructs
-// structs, unions, exceptions, typedefs, operation types and parameters,
-// attributes; and of course, sequences, strings.
-// -D59063<daz> Add helper for global exception to stub import list.
-// -D58951<daz> Publicise members for QuickTest.
-// -D59421<klr> Change ValueBaseHolder to SerializableHolder
-// -D59596<klr> Prevent accesses to elements of empty Vectors.
-// -D59771<daz> Add import stmt for Helper of global type in stubs.
-// -D59355<daz> Remove target dir. from filename when writing to prolog.
-// -D59437<daz> Fill typename information for value boxes.
-// -D62023<klr> Don't import ValueBase*
-// -D62023<klr> Add corbaLevel
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.math.BigInteger;
-import java.text.DateFormat;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Locale;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.ConstEntry;
-import com.sun.tools.corba.se.idl.EnumEntry;
-import com.sun.tools.corba.se.idl.ExceptionEntry;
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.NativeEntry;
-import com.sun.tools.corba.se.idl.ParameterEntry;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.SequenceEntry;
-import com.sun.tools.corba.se.idl.StringEntry;
-import com.sun.tools.corba.se.idl.StructEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.UnionBranch;
-import com.sun.tools.corba.se.idl.UnionEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-import com.sun.tools.corba.se.idl.ValueBoxEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-
-import com.sun.tools.corba.se.idl.constExpr.*;
-
-/**
- * Class Util is a repository of static members available for general
- * use by the IDL parser framework and any generator extensions.
- **/
-public class Util extends com.sun.tools.corba.se.idl.Util
-{
- // <d58319>
- /**
- * Fetch the version number of this build of the IDL-to-Java (portable)
- * compiler from the appropriate properties file.
- * @return the version number of this compiler build.
- **/
- public static String getVersion ()
- {
- return com.sun.tools.corba.se.idl.Util.getVersion ("com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp");
- } // getVersion
-
- /**
- * This method is called by Setup.preEmit, so
- * symbolTable is available for all Util methods.
- **/
- static void setSymbolTable (Hashtable symtab)
- {
- symbolTable = symtab;
- } // setSymbolTable
-
- public static void setPackageTranslation( Hashtable pkgtrans )
- {
- packageTranslation = pkgtrans ;
- }
-
- public static boolean isInterface (String name)
- {
- return isInterface (name, symbolTable);
- } // isInterface
-
- static String arrayInfo (Vector arrayInfo)
- {
- int arrays = arrayInfo.size ();
- String info = "";
- Enumeration e = arrayInfo.elements ();
- while (e.hasMoreElements ())
- info = info + '[' + parseExpression ((Expression)e.nextElement ()) + ']';
- return info;
- } // arrayInfo
-
- // <d58951> static String sansArrayInfo (Vector arrayInfo)
- public static String sansArrayInfo (Vector arrayInfo)
- {
- int arrays = arrayInfo.size ();
- String brackets = "";
- for (int i = 0; i < arrays; ++i)
- brackets = brackets + "[]";
- return brackets;
- } // sansArrayInfo
-
- // <d58951> static String sansArrayInfo (String name)
- static public String sansArrayInfo (String name)
- {
- int index = name.indexOf ('[');
- if (index >= 0)
- {
- String array = name.substring (index);
- name = name.substring (0, index);
- while (!array.equals (""))
- {
- name = name + "[]";
- array = array.substring (array.indexOf (']') + 1);
- }
- }
- return name;
- } // sansArrayInfo
-
- /**
- * Given a symbol table entry, return the name of
- * the file which should be created.
- **/
- public static String fileName (SymtabEntry entry, String extension )
- {
- NameModifier nm = new NameModifierImpl() ;
- return fileName( entry, nm, extension ) ;
- } // fileName
-
- public static String fileName (SymtabEntry entry, NameModifier modifier, String extension )
- {
- // This may not be the most appropriate place for
- // the mkdir calls, but it's common to everything:
- String pkg = containerFullName (entry.container ());
- if (pkg != null && !pkg.equals (""))
- mkdir (pkg);
-
- String name = entry.name ();
- name = modifier.makeName( name ) + extension ;
- if (pkg != null && !pkg.equals (""))
- name = pkg + '/' + name;
-
- return name.replace ('/', File.separatorChar);
- } // fileName
-
- public static GenFileStream stream (SymtabEntry entry, String extension)
- {
- NameModifier nm = new NameModifierImpl() ;
- return stream(entry, nm, extension);
- } // stream
-
- public static GenFileStream stream (SymtabEntry entry, NameModifier modifier, String extension )
- {
- return getStream ( fileName (entry,modifier,extension), entry ) ;
- }
-
- public static GenFileStream getStream (String name, SymtabEntry entry)
- {
- // <f46838.4>
- String absPathName = ((Arguments)Compile.compiler.arguments).targetDir + name;
- if (Compile.compiler.arguments.keepOldFiles && new File (absPathName).exists ())
- return null;
- else
- // Write the data to the file stream
- return new GenFileStream (absPathName);
- } // getStream
-
- public static String containerFullName( SymtabEntry container)
- {
- String name = doContainerFullName( container ) ;
- if (packageTranslation.size() > 0)
- name = translate( name ) ;
- return name ;
- }
-
- public static String translate( String name )
- {
- String head = name ;
- String tail = "" ;
- int index ;
- String trname ;
-
- // Check for package name translations, starting with the
- // most specific match.
- do {
- trname = (String)(packageTranslation.get( head )) ;
- if (trname != null)
- return trname + tail ;
-
- index = head.lastIndexOf( '/' ) ;
- if (index >= 0) {
- tail = head.substring( index ) + tail ;
- head = head.substring( 0, index ) ;
- }
- } while (index >= 0) ;
-
- return name ;
- }
-
- private static String doContainerFullName (SymtabEntry container)
- {
- String name = "";
-
- if (container == null)
- name = "";
- else
- {
- if (container instanceof InterfaceEntry ||
- container instanceof StructEntry ||
- container instanceof UnionEntry)
- name = container.name () + "Package";
- else
- name = container.name ();
-
- if (container.container () != null &&
- !container.container ().name ().equals (""))
- name = doContainerFullName (container.container ()) + '/' + name;
- }
-
- return name;
- } // doContainerFullName
-
- /**
- * Given a SymtabEntry, return the string which should be used
- * for this entry. Enums are converted to ints, typedefs and
- * sequences are converted to their info types. javaQualifiedName
- * does not do any of these conversions.
- **/
- public static String javaName (SymtabEntry entry)
- {
- // First get the real name of this type
- String name = "";
- if (entry instanceof TypedefEntry || entry instanceof SequenceEntry)
- try
- {
- name = sansArrayInfo ((String)entry.dynamicVariable (Compile.typedefInfo));
- }
- catch (NoSuchFieldException e)
- {
- name = entry.name ();
- }
- else if (entry instanceof PrimitiveEntry)
- name = javaPrimName (entry.name ());
- else if (entry instanceof StringEntry)
- name = "String";
- else if (entry instanceof NativeEntry)
- name = javaNativeName (entry.name());
- else if (entry instanceof ValueEntry && entry.name ().equals ("ValueBase"))
- name = "java.io.Serializable";
- else if (entry instanceof ValueBoxEntry)
- {
- ValueBoxEntry v = (ValueBoxEntry) entry;
- TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
- SymtabEntry mType = member.type ();
- if (mType instanceof PrimitiveEntry)
- {
- name = containerFullName (entry.container ());
- if (!name.equals (""))
- name = name + '.';
- name = name + entry.name ();
- }
- else
- name = javaName (mType);
- }
- else
- {
- name = containerFullName (entry.container ());
- if (name.equals (""))
- name = entry.name ();
- else
- name = name + '.' + entry.name ();
- }
-
- // Make it a fully package-qualified name
- return name.replace ('/', '.');
- } // javaName
-
- public static String javaPrimName (String name)
- {
- if (name.equals ("long") || name.equals ("unsigned long"))
- name = "int";
- else if (name.equals ("octet"))
- name = "byte";
- // "unisigned long long" exceeds Java long.
- else if (name.equals ("long long") || name.equals ("unsigned long long"))
- name = "long";
- else if (name.equals ("wchar"))
- name = "char";
- else if (name.equals ("unsigned short"))
- name = "short";
- else if (name.equals ("any"))
- name = "org.omg.CORBA.Any";
- else if (name.equals ("TypeCode"))
- name = "org.omg.CORBA.TypeCode";
- else if (name.equals ("Principal")) // <d61961>
- name = "org.omg.CORBA.Principal";
- return name;
- } // javaPrimName
-
- public static String javaNativeName (String name)
- {
-
- // translations for Native declarations according to CORBA 2.3 spec
-
- if (name.equals ("AbstractBase") || name.equals ("Cookie"))
- name = "java.lang.Object";
- else if (name.equals ("Servant"))
- name = "org.omg.PortableServer.Servant";
- else if (name.equals ("ValueFactory"))
- name = "org.omg.CORBA.portable.ValueFactory";
- return name;
- }
-
-
- /**
- * Given a symtabEntry, return the name of this entry. This
- * method does not do any conversions like javaName does.
- **/
- public static String javaQualifiedName (SymtabEntry entry)
- {
- String name = "";
- if (entry instanceof PrimitiveEntry)
- name = javaPrimName (entry.name ());
- else if (entry instanceof StringEntry)
- name = "String";
- else if (entry instanceof ValueEntry && entry.name ().equals ("ValueBase"))
- name = "java.io.Serializable";
- else
- {
- SymtabEntry container = entry.container ();
- if (container != null)
- name = container.name ();
- if (name.equals (""))
- name = entry.name ();
- else
- name = containerFullName (entry.container ()) + '.' + entry.name ();
- }
- return name.replace ('/', '.');
- } // javaQualifiedName
-
- // <f46082.03> Publicize for extensions.
- //static String collapseName (String name)
-
- /**
- * Collapse primitive type names.
- **/
- public static String collapseName (String name)
- {
- if (name.equals ("unsigned short"))
- name = "ushort";
- else if (name.equals ("unsigned long"))
- name = "ulong";
- else if (name.equals ("unsigned long long"))
- name = "ulonglong";
- else if (name.equals ("long long"))
- name = "longlong";
- return name;
- } // collapseName
-
- /**
- *
- **/
- public static SymtabEntry typeOf (SymtabEntry entry)
- {
- while (entry instanceof TypedefEntry && ((TypedefEntry)entry).arrayInfo ().isEmpty () && !(entry.type () instanceof SequenceEntry))
- entry = entry.type ();
- return entry;
- } // typeOf
-
- /**
- * Fill the info field with the full name (with array info) of the type.
- **/
- static void fillInfo (SymtabEntry infoEntry)
- {
- String arrayInfo = "";
- SymtabEntry entry = infoEntry;
- boolean alreadyHave = false;
-
- do
- {
- try
- {
- alreadyHave = entry.dynamicVariable (Compile.typedefInfo) != null;
- }
- catch (NoSuchFieldException e)
- {}
- // If this entry's info has already been processed
- // don't bother processing it again, just take it.
- if (!alreadyHave)
- {
- if (entry instanceof TypedefEntry)
- arrayInfo = arrayInfo + arrayInfo (((TypedefEntry)entry).arrayInfo ());
- else if (entry instanceof SequenceEntry)
- {
- Expression maxSize = ((SequenceEntry)entry).maxSize ();
- if (maxSize == null)
- arrayInfo = arrayInfo + "[]";
- else
- arrayInfo = arrayInfo + '[' + parseExpression (maxSize) + ']';
- }
- if (entry.type () == null)
- {
- // <d59437> Suppress this message. It tells the developer nothing, and
- // this path does not cause the algorithm to fail. Value boxes may
- // contain anonymous types, like a struct or enum.
- //System.err.println (getMessage ("PreEmit.indeterminateTypeInfo", entry.typeName ()));
- }
- else
- entry = entry.type ();
- }
- } while (!alreadyHave && entry != null &&
- (entry instanceof TypedefEntry || entry instanceof SequenceEntry));
- // <d59437> Value boxes may contain types lacking typename info., which
- // causes the 2nd case, below, to fail with exception when retrieving the
- // javaName().
- if (entry instanceof ValueBoxEntry)
- fillValueBoxInfo ((ValueBoxEntry)entry);
- try
- {
- if (alreadyHave)
- infoEntry.dynamicVariable (Compile.typedefInfo, (String)entry.dynamicVariable (Compile.typedefInfo) + arrayInfo);
- else
- infoEntry.dynamicVariable (Compile.typedefInfo, javaName (entry) + arrayInfo);
- }
- catch (NoSuchFieldException e)
- {}
- } // fillInfo
-
- // <d59437>
- /**
- *
- **/
- static void fillValueBoxInfo (ValueBoxEntry vb)
- {
- SymtabEntry stateMember = (((InterfaceState) vb.state ().elementAt (0)).entry);
- if (stateMember.type() != null)
- Util.fillInfo (stateMember.type ());
- Util.fillInfo (stateMember);
- } // fillValueBoxInfo
-
- /**
- *
- **/
- public static String holderName (SymtabEntry entry)
- {
- String name;
- if (entry instanceof PrimitiveEntry)
- if (entry.name ().equals ("any"))
- name = "org.omg.CORBA.AnyHolder";
- else if (entry.name ().equals ("TypeCode"))
- name = "org.omg.CORBA.TypeCodeHolder";
- else if (entry.name ().equals ("Principal")) // <d61961>
- name = "org.omg.CORBA.PrincipalHolder";
- else
- name = "org.omg.CORBA." + capitalize (javaQualifiedName (entry)) + "Holder";
- else if (entry instanceof TypedefEntry)
- {
- TypedefEntry td = (TypedefEntry)entry;
- if (!td.arrayInfo ().isEmpty () || td.type () instanceof SequenceEntry)
- name = javaQualifiedName (entry) + "Holder";
- else
- name = holderName (entry.type ());
- }
- else if (entry instanceof StringEntry)
- name = "org.omg.CORBA.StringHolder";
- else if (entry instanceof ValueEntry)
- {
- if (entry.name ().equals ("ValueBase"))
- name = "org.omg.CORBA.ValueBaseHolder"; // <d59421>, <d60929>
- else
- name = javaName (entry) + "Holder";
- } else if (entry instanceof NativeEntry) {
- // do not attach holder to the translation for Native Entries, e.g.
- // for Cookie it should be CookieHolder instead of java.lang.ObjectHolder
- // returns the complete name for the package, etc.
- name = javaQualifiedName(entry) + "Holder";
- }
- else
- name = javaName (entry) + "Holder";
- return name;
- } // holderName
-
- /**
- * <d61056>
- **/
- public static String helperName (SymtabEntry entry, boolean qualifiedName)
- {
- if (entry instanceof ValueEntry)
- if (entry.name ().equals ("ValueBase"))
- return "org.omg.CORBA.ValueBaseHelper";
-
- if (qualifiedName)
- return javaQualifiedName (entry) + "Helper";
- else
- return javaName (entry) + "Helper";
- } // helperName
-
- public static final short
- TypeFile = 0,
- StubFile = 1,
- HelperFile = 2,
- HolderFile = 3,
- StateFile = 4;
-
- /**
- *
- **/
- public static void writePackage (PrintWriter stream, SymtabEntry entry)
- {
- writePackage (stream, entry, TypeFile);
- } // writePackage
-
- /**
- *
- **/
- public static void writePackage (PrintWriter stream, SymtabEntry entry, String name, short type)
- {
- if (name != null && !name.equals (""))
- {
- stream.println ("package " + name.replace ('/', '.') + ';');
-
- // This type is in a module. Just in case it refers to types
- // in the unnamed module, add an import statement for each of
- // those types.
- if (!Compile.compiler.importTypes.isEmpty ())
- {
- stream.println ();
- Vector v = addImportLines (entry, Compile.compiler.importTypes, type);
- printImports (v, stream);
- }
- }
- } // writePackage
-
- /**
- *
- **/
- public static void writePackage (PrintWriter stream, SymtabEntry entry, short type)
- {
- String fullName = containerFullName (entry.container ());
- if (fullName != null && !fullName.equals (""))
- {
- stream.println ("package " + fullName.replace ('/', '.') + ';');
- // This type is in a module. Just in case it refers to types
- // in the unnamed module, add an import statement for each of
- // those types.
- if ((type != HolderFile || entry instanceof TypedefEntry) && !Compile.compiler.importTypes.isEmpty ())
- {
- stream.println ();
- Vector v = addImportLines (entry, Compile.compiler.importTypes, type);
- printImports (v, stream);
- }
- /*
- Enumeration e = Compile.compiler.importTypes.elements ();
- while (e.hasMoreElements ())
- {
- SymtabEntry i = (SymtabEntry)e.nextElement ();
- // Write import for type
- if (!(i instanceof TypedefEntry))
- stream.println ("import " + i.name () + ';');
-
- // Write import for Helper
- if (!(i instanceof ConstEntry))
- stream.println ("import " + i.name () + "Helper;");
-
- // Write import for Holder
- if (!(i instanceof ConstEntry))
- if (!(i instanceof TypedefEntry) || (i.type () instanceof SequenceEntry || !((TypedefEntry)i).arrayInfo ().isEmpty ()))
- stream.println ("import " + i.name () + "Holder;");
- }
- */
- }
- } // writePackage
-
- /**
- *
- **/
- static private void printImports (Vector importList, PrintWriter stream)
- {
- Enumeration e = importList.elements ();
- while (e.hasMoreElements ())
- stream.println ("import " + (String)e.nextElement () + ';');
- } // printImport
-
- /**
- *
- **/
- static private void addTo (Vector importList, String name)
- {
- // REVISIT - <d62023-klr> was also importing ValueBaseHolder and Helper
- if (name.startsWith ("ValueBase")) // don't import ValueBase*
- if ((name.compareTo ("ValueBase") == 0) ||
- (name.compareTo ("ValueBaseHolder") == 0) ||
- (name.compareTo ("ValueBaseHelper") == 0))
- return;
- if (!importList.contains (name))
- importList.addElement (name);
- } // addTo
-
- /**
- *
- **/
- static private Vector addImportLines (SymtabEntry entry, Vector importTypes, short type)
- {
- Vector importList = new Vector ();
- if (entry instanceof ConstEntry)
- {
- ConstEntry c = (ConstEntry)entry;
- Object cvalue = c.value ().value ();
- if (cvalue instanceof ConstEntry && importTypes.contains (cvalue))
- addTo (importList, ((ConstEntry)cvalue).name ());
- }
- else if (entry instanceof ValueEntry && type == HelperFile) // <d59512>
- {
- // This code inspired by ValueGen.getConcreteBaseTypeCode(). Helper method
- // type() could be invoked against a global valuetype.
- if (((ValueEntry)entry).derivedFrom ().size () > 0) // <59596> KLR HACK
- {
- ValueEntry base = (ValueEntry)((ValueEntry)entry).derivedFrom ().elementAt (0);
- String baseName = base.name ();
- if (!"ValueBase".equals (baseName))
- if (importTypes.contains (base))
- addTo (importList, baseName + "Helper");
- }
- }
- else if (entry instanceof InterfaceEntry && (type == TypeFile || type == StubFile))
- {
- InterfaceEntry i = (InterfaceEntry)entry;
-
- if (i instanceof ValueEntry) // <d59512>
- {
- // Examine interface parents in supports vector.
- Enumeration e = ((ValueEntry)i).supports ().elements ();
- while (e.hasMoreElements ())
- {
- SymtabEntry parent = (SymtabEntry)e.nextElement ();
- if (importTypes.contains (parent))
- {
- addTo (importList, parent.name () + "Operations");
- }
- // If this is a stub, then recurse to the parents
- if (type == StubFile)
- {
- if (importTypes.contains (parent))
- addTo (importList, parent.name ());
- Vector subImportList = addImportLines (parent, importTypes, StubFile);
- Enumeration en = subImportList.elements ();
- while (en.hasMoreElements ())
- {
- addTo (importList, (String)en.nextElement ());
- }
- }
- }
- }
- // Interface or valuetype -- Examine interface and valuetype parents,
- // Look through derivedFrom vector
- Enumeration e = i.derivedFrom ().elements ();
- while (e.hasMoreElements ())
- {
- SymtabEntry parent = (SymtabEntry)e.nextElement ();
- if (importTypes.contains (parent))
- {
- addTo (importList, parent.name ());
- // <d59512> Always add both imports, even though superfluous. Cannot
- // tell when writing Operations or Signature interface!
- if (!(parent instanceof ValueEntry)) // && parent.name ().equals ("ValueBase")))
- addTo (importList, parent.name () + "Operations");
- }
- // If this is a stub, then recurse to the parents
- if (type == StubFile)
- {
- Vector subImportList = addImportLines (parent, importTypes, StubFile);
- Enumeration en = subImportList.elements ();
- while (en.hasMoreElements ())
- {
- addTo (importList, (String)en.nextElement ());
- }
- }
- }
- // Look through methods vector
- e = i.methods ().elements ();
- while (e.hasMoreElements ())
- {
- MethodEntry m = (MethodEntry)e.nextElement ();
-
- // Look at method type
- SymtabEntry mtype = typeOf (m.type ());
- if (mtype != null && importTypes.contains (mtype))
- if (type == TypeFile || type == StubFile)
- {
- addTo (importList, mtype.name ());
- addTo (importList, mtype.name () + "Holder");
- if (type == StubFile)
- addTo (importList, mtype.name () + "Helper");
- }
- checkForArrays (mtype, importTypes, importList);
- // <d42256> Print import lines for globals constants and constants
- // within global interfaces.
- if (type == StubFile)
- checkForBounds (mtype, importTypes, importList);
-
- // Look through exceptions
- Enumeration exEnum = m.exceptions ().elements ();
- while (exEnum.hasMoreElements ())
- {
- ExceptionEntry ex = (ExceptionEntry)exEnum.nextElement ();
- if (importTypes.contains (ex))
- {
- addTo (importList, ex.name ());
- addTo (importList, ex.name () + "Helper"); // <d59063>
- }
- }
-
- // Look through parameters
- Enumeration parms = m.parameters ().elements ();
- while (parms.hasMoreElements ())
- {
- ParameterEntry parm = (ParameterEntry)parms.nextElement ();
- SymtabEntry parmType = typeOf (parm.type ());
- if (importTypes.contains (parmType))
- {
- // <d59771> Helper needed in stubs.
- if (type == StubFile)
- addTo (importList, parmType.name () + "Helper");
- if (parm.passType () == ParameterEntry.In)
- addTo (importList, parmType.name ());
- else
- addTo (importList, parmType.name () + "Holder");
- }
- checkForArrays (parmType, importTypes, importList);
- // <d42256>
- if (type == StubFile)
- checkForBounds (parmType, importTypes, importList);
- }
- }
- }
- else if (entry instanceof StructEntry)
- {
- StructEntry s = (StructEntry)entry;
-
- // Look through the members
- Enumeration members = s.members ().elements ();
- while (members.hasMoreElements ())
- {
- SymtabEntry member = (TypedefEntry)members.nextElement ();
- // <d48034> Need to add helper name for typedef members. This name
- // is referenced at typecode generation in Helper class.
- SymtabEntry memberType = member.type ();
- member = typeOf (member);
- if (importTypes.contains (member))
- {
- // If this IS a typedef, then there are only Helper/Holder classes.
- //if (!(member instanceof TypedefEntry))
- // <d59437> Valueboxes
- if (!(member instanceof TypedefEntry) && !(member instanceof ValueBoxEntry))
- addTo (importList, member.name ());
- // <d48034> Add helper name of alias, too, if member is a typedef.
- //if (type == HelperFile)
- // addTo (importList, member.name () + "Helper");
- if (type == HelperFile)
- {
- addTo (importList, member.name () + "Helper");
- if (memberType instanceof TypedefEntry)
- addTo (importList, memberType.name () + "Helper");
- }
- }
- checkForArrays (member, importTypes, importList);
- checkForBounds (member, importTypes, importList);
- }
- }
- else if (entry instanceof TypedefEntry)
- {
- TypedefEntry t = (TypedefEntry)entry;
- String arrays = checkForArrayBase (t, importTypes, importList);
- if (type == HelperFile)
- {
- checkForArrayDimensions (arrays, importTypes, importList);
- try
- {
- String name = (String)t.dynamicVariable (Compile.typedefInfo);
- int index = name.indexOf ('[');
- if (index >= 0)
- name = name.substring (0, index);
- // See if the base type should be added to the list.
- SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name);
- if (typeEntry != null && importTypes.contains (typeEntry))
- addTo (importList, typeEntry.name () + "Helper");
- }
- catch (NoSuchFieldException e)
- {}
-
- // <d42256> Typedefs for global bounded strings need import
- // statement when bound expression contains non-literal constants.
- checkForBounds (typeOf (t), importTypes, importList);
- }
- Vector subImportList = addImportLines (t.type (), importTypes, type);
- Enumeration e = subImportList.elements ();
- while (e.hasMoreElements ())
- addTo (importList, (String)e.nextElement ());
- }
- else if (entry instanceof UnionEntry)
- {
- UnionEntry u = (UnionEntry)entry;
-
- // Look at the discriminant type
- SymtabEntry utype = typeOf (u.type ());
- if (utype instanceof EnumEntry && importTypes.contains (utype))
- addTo (importList, utype.name ());
-
- // Look through the branches
- Enumeration branches = u.branches ().elements ();
- while (branches.hasMoreElements ())
- {
- UnionBranch branch = (UnionBranch)branches.nextElement ();
- SymtabEntry branchEntry = typeOf (branch.typedef);
- if (importTypes.contains (branchEntry))
- {
- addTo (importList, branchEntry.name ());
- if (type == HelperFile)
- addTo (importList, branchEntry.name () + "Helper");
- }
- checkForArrays (branchEntry, importTypes, importList);
- // <d42256>
- checkForBounds (branchEntry, importTypes, importList);
- }
- }
-
- // If a typedef is not a sequence or an array, only holders and
- // helpers are generated for it. Remove references to such
- // class names.
- Enumeration en = importList.elements ();
- while (en.hasMoreElements ())
- {
- String name = (String)en.nextElement ();
- SymtabEntry e = (SymtabEntry)symbolTable.get (name);
- if (e != null && e instanceof TypedefEntry)
- {
- TypedefEntry t = (TypedefEntry)e;
- if (t.arrayInfo ().size () == 0 || !(t.type () instanceof SequenceEntry))
- importList.removeElement (name);
- }
- }
- return importList;
- } // addImportLines
-
- /**
- *
- **/
- static private void checkForArrays (SymtabEntry entry, Vector importTypes, Vector importList)
- {
- if (entry instanceof TypedefEntry)
- {
- TypedefEntry t = (TypedefEntry)entry;
- String arrays = checkForArrayBase (t, importTypes, importList);
- checkForArrayDimensions (arrays, importTypes, importList);
- }
- } // checkForArrays
-
- /**
- *
- **/
- static private String checkForArrayBase (TypedefEntry t, Vector importTypes, Vector importList)
- {
- String arrays = "";
- try
- {
- String name = (String)t.dynamicVariable (Compile.typedefInfo);
- int index = name.indexOf ('[');
- if (index >= 0)
- {
- arrays = name.substring (index);
- name = name.substring (0, index);
- }
-
- // See if the base type should be added to the list.
- SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name);
- if (typeEntry != null && importTypes.contains (typeEntry))
- addTo (importList, typeEntry.name ());
- }
- catch (NoSuchFieldException e)
- {}
- return arrays;
- } // checkForArrayBase
-
- /**
- *
- **/
- static private void checkForArrayDimensions (String arrays, Vector importTypes, Vector importList)
- {
- // See if any of the arrays contain a constentry.
- // If so, see if it should be added to the list.
- while (!arrays.equals (""))
- {
- int index = arrays.indexOf (']');
- String dim = arrays.substring (1, index);
- arrays = arrays.substring (index + 1);
- SymtabEntry constant = (SymtabEntry)symbolTable.get (dim);
- if (constant == null)
- {
- // A constant expr could be of the form <const> OR
- // <interface>.<const>. This if branch checks for that case.
- int i = dim.lastIndexOf ('.');
- if (i >= 0)
- constant = (SymtabEntry)symbolTable.get (dim.substring (0, i));
- }
- if (constant != null && importTypes.contains (constant))
- addTo (importList, constant.name ());
- }
- } // checkForArrayDimensions
-
- // <d42256> Call the following method when its necessary to determine the
- // the import types for IDL constructs containing arbitrary positive int.
- // expressions, which may specify non-literal constants.
-
- /**
- * Determine the import lines for template types.
- **/
- static private void checkForBounds (SymtabEntry entry, Vector importTypes, Vector importList)
- {
- // Obtain actual type, just to be complete.
- SymtabEntry entryType = entry;
- while (entryType instanceof TypedefEntry)
- entryType = entryType.type ();
-
- if (entryType instanceof StringEntry && ((StringEntry)entryType).maxSize () != null)
- checkForGlobalConstants (((StringEntry)entryType).maxSize ().rep (), importTypes, importList);
- else
- if (entryType instanceof SequenceEntry && ((SequenceEntry)entryType).maxSize () != null)
- checkForGlobalConstants (((SequenceEntry)entryType).maxSize ().rep (), importTypes, importList);
- } // checkForBounds
-
- /**
- * Extract the global constants from the supplied integer expression
- * representation (string) and add them to the supplied import list.
- **/
- static private void checkForGlobalConstants (String exprRep, Vector importTypes, Vector importList)
- {
- // NOTE: Do not use '/' as a delimiter. Symbol table names use '/' as a
- // delimiter and would not be otherwise properly collected. Blanks and
- // arithmetic symbols do not appear in tokens, except for '/'.
- java.util.StringTokenizer st = new java.util.StringTokenizer (exprRep, " +-*()~&|^%<>");
- while (st.hasMoreTokens ())
- {
- String token = st.nextToken ();
- // When token contains '/', it represents the division symbol or
- // a nested type (e.g., I/x). Ignore the division symbol, and don't
- // forget constants declared within global interfaces!
- if (!token.equals ("/"))
- {
- SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (token);
- if (typeEntry instanceof ConstEntry)
- {
- int slashIdx = token.indexOf ('/');
- if (slashIdx < 0) // Possible global constant
- {
- if (importTypes.contains (typeEntry))
- addTo (importList, typeEntry.name ());
- }
- else // Possible constant in global interface
- {
- SymtabEntry constContainer = (SymtabEntry)symbolTable.get (token.substring (0, slashIdx));
- if (constContainer instanceof InterfaceEntry && importTypes.contains (constContainer))
- addTo (importList, constContainer.name ());
- }
- }
- }
- }
- } // checkForGlobalConstants
-
- /**
- *
- **/
- public static void writeInitializer (String indent, String name, String arrayDcl, SymtabEntry entry, PrintWriter stream)
- {
- if (entry instanceof TypedefEntry)
- {
- TypedefEntry td = (TypedefEntry)entry;
- writeInitializer (indent, name, arrayDcl + sansArrayInfo (td.arrayInfo ()), td.type (), stream);
- }
- else if (entry instanceof SequenceEntry)
- writeInitializer (indent, name, arrayDcl + "[]", entry.type (), stream);
- else if (entry instanceof EnumEntry)
- if (arrayDcl.length () > 0)
- stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = null;");
- else
- stream.println (indent + javaName (entry) + ' ' + name + " = null;");
- else if (entry instanceof PrimitiveEntry)
- {
- boolean array = arrayDcl.length () > 0;
- String tname = javaPrimName (entry.name ());
- if (tname.equals ("boolean"))
- stream.println (indent + "boolean " + name + arrayDcl + " = " + (array ? "null;" : "false;"));
- else if (tname.equals ("org.omg.CORBA.TypeCode"))
- stream.println (indent + "org.omg.CORBA.TypeCode " + name + arrayDcl + " = null;");
- else if (tname.equals ("org.omg.CORBA.Any"))
- stream.println (indent + "org.omg.CORBA.Any " + name + arrayDcl + " = null;");
- else if (tname.equals ("org.omg.CORBA.Principal")) // <d61961>
- stream.println (indent + "org.omg.CORBA.Principal " + name + arrayDcl + " = null;");
- else
- stream.println (indent + tname + ' ' + name + arrayDcl + " = " + (array ? "null;" : '(' + tname + ")0;"));
- }
- // <f46082.51> Remove -stateful feature. This case is identical to next one
- // because javaName() supplants javaStatefulName().
- //else if (entry instanceof InterfaceEntry && ((InterfaceEntry)entry).state () != null)
- // stream.println (indent + javaStatefulName ((InterfaceEntry)entry) + ' ' + name + arrayDcl + " = null;");
- else
- stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = null;");
- } // writeInitializer
-
- /**
- *
- **/
- public static void writeInitializer (String indent, String name, String arrayDcl, SymtabEntry entry, String initializer, PrintWriter stream)
- {
- if (entry instanceof TypedefEntry)
- {
- TypedefEntry td = (TypedefEntry)entry;
- writeInitializer (indent, name, arrayDcl + sansArrayInfo (td.arrayInfo ()), td.type (), initializer, stream);
- }
- else if (entry instanceof SequenceEntry)
- writeInitializer (indent, name, arrayDcl + "[]", entry.type (), initializer, stream);
- else if (entry instanceof EnumEntry)
- if (arrayDcl.length () > 0)
- stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = " + initializer + ';');
- else
- stream.println (indent + javaName (entry) + ' ' + name + " = " + initializer + ';');
- else if (entry instanceof PrimitiveEntry)
- {
- boolean array = arrayDcl.length () > 0;
- String tname = javaPrimName (entry.name ());
- if (tname.equals ("boolean"))
- stream.println (indent + "boolean " + name + arrayDcl + " = " + initializer + ';');
- else if (tname.equals ("org.omg.CORBA.TypeCode"))
- stream.println (indent + "org.omg.CORBA.TypeCode " + name + arrayDcl + " = " + initializer + ';');
- else if (tname.equals ("org.omg.CORBA.Any"))
- stream.println (indent + "org.omg.CORBA.Any " + name + arrayDcl + " = " + initializer + ';');
- else if (tname.equals ("org.omg.CORBA.Principal")) // <d61961>
- stream.println (indent + "org.omg.CORBA.Principal " + name + arrayDcl + " = " + initializer + ';');
- else
- stream.println (indent + tname + ' ' + name + arrayDcl + " = " + initializer + ';');
- }
- // <f46082.51> Remove -stateful feature. This case is identical to next one
- // because javaName() supplants javaStatefulName().
- //else if (entry instanceof InterfaceEntry && ((InterfaceEntry)entry).state () != null)
- // stream.println (indent + javaStatefulName ((InterfaceEntry)entry) + ' ' + name + arrayDcl + " = " + initializer + ';');
- else
- stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = " + initializer + ';');
- } // writeInitializer
-
- /**
- *
- **/
- public static void mkdir (String name)
- {
- String targetDir = ((Arguments)Compile.compiler.arguments).targetDir; // F46838.4
- name = (targetDir + name).replace ('/', File.separatorChar); // F46838.4
- File pkg = new File (name);
- if (!pkg.exists ())
- if (!pkg.mkdirs ())
- System.err.println (getMessage ("Util.cantCreatePkg", name));
- } // mkdir
-
- /**
- *
- **/
- public static void writeProlog (PrintWriter stream, String filename)
- {
- // <d59355> Remove target directory
- String targetDir = ((Arguments)Compile.compiler.arguments).targetDir;
- if (targetDir != null)
- filename = filename.substring (targetDir.length ());
- stream.println ();
- stream.println ("/**");
- stream.println ("* " + filename.replace (File.separatorChar, '/') +
- " .");
- stream.println ("* " + Util.getMessage ("toJavaProlog1",
- Util.getMessage ("Version.product", Util.getMessage ("Version.number"))));
- // <d48911> Do not introduce invalid escape characters into comment! <daz>
- //stream.println ("* " + Util.getMessage ("toJavaProlog2", Compile.compiler.arguments.file));
- //stream.println ("* " + Util.getMessage ("toJavaProlog2", Compile.compiler.arguments.file.replace (File.separatorChar, '/')));
-
- ///////////////
- // This SHOULD work, but there's a bug in the JDK.
- // stream.println ("* " + DateFormat.getDateTimeInstance (DateFormat.FULL, DateFormat.FULL, Locale.getDefault ()).format (new Date ()));
- // This gets around the bug:
-
- DateFormat formatter = DateFormat.getDateTimeInstance (DateFormat.FULL, DateFormat.FULL, Locale.getDefault ());
-
- // Japanese-specific workaround. JDK bug 4069784 being repaired by JavaSoft.
- // Keep this transient solution until bug fix is reported.cd .
-
- if (Locale.getDefault () == Locale.JAPAN)
- formatter.setTimeZone (java.util.TimeZone.getTimeZone ("JST"));
- else
- formatter.setTimeZone (java.util.TimeZone.getDefault ());
-
- //stream.println ("* " + formatter.format (new Date ()));
-
- // <daz>
- ///////////////
-
- stream.println ("*/");
- stream.println ();
- } // writeProlog
-
- // keywords ending in Holder or Helper or Package have '_' prepended.
- // These prepended underscores must not be part of anything sent
- // across the wire, so these two methods are provided to strip them
- // off.
-
- /**
- *
- **/
- public static String stripLeadingUnderscores (String string)
- {
- while (string.startsWith ("_"))
- string = string.substring (1);
- return string;
- } // stripLeadingUnderscores
-
- /**
- *
- **/
- public static String stripLeadingUnderscoresFromID (String string)
- {
- String stringPrefix = "";
- int slashIndex = string.indexOf (':');
- if (slashIndex >= 0)
- do
- {
- stringPrefix = stringPrefix + string.substring (0, slashIndex + 1);
- string = string.substring (slashIndex + 1);
- while (string.startsWith ("_"))
- string = string.substring (1);
- slashIndex = string.indexOf ('/');
- } while (slashIndex >= 0);
- return stringPrefix + string;
- } // stripLeadingUnderscoresFromID
-
- /**
- *
- **/
- public static String parseExpression (Expression e)
- {
- if (e instanceof Terminal)
- return parseTerminal ((Terminal)e);
- else if (e instanceof BinaryExpr)
- return parseBinary ((BinaryExpr)e);
- else if (e instanceof UnaryExpr)
- return parseUnary ((UnaryExpr)e);
- else
- return "(UNKNOWN_VALUE)"; // This shouldn't happen unless someone slips
- // in another type of expression.
- } // parseExpression
-
- /**
- *
- **/
- static String parseTerminal (Terminal e)
- {
- if (e.value () instanceof ConstEntry)
- {
- ConstEntry c = (ConstEntry)e.value ();
- if (c.container () instanceof InterfaceEntry)
- return javaQualifiedName (c.container ()) + '.' + c.name ();
- else
- return javaQualifiedName (c) + ".value";
- }
- else if (e.value () instanceof Expression)
- return '(' + parseExpression ((Expression)e.value ()) + ')';
- else if (e.value () instanceof Character)
- {
- if (((Character)e.value ()).charValue () == '\013')
- // e.rep is \v. \v for vertical tab is meaningless in Java.
- return "'\\013'";
- else if (((Character)e.value ()).charValue () == '\007')
- // e.rep is \a. \a for alert is meaningless in Java.
- return "'\\007'";
- else if (e.rep ().startsWith ("'\\x"))
- return hexToOctal (e.rep ());
- else if (e.rep ().equals ("'\\?'"))
- return "'?'";
- else
- return e.rep ();
- }
- else if (e.value () instanceof Boolean)
- return e.value ().toString ();
-
- // <d54640> If value is type "unsigned long long" (ull) and its magnitude
- // is greater than the maximal Java long (i.e., IDL long long) value, then
- // return its signed representation rather than its actual representation.
- /*
- // Support long long
- //else if (e.value () instanceof Long)
- else if (e.value () instanceof BigInteger &&
- (e.type ().indexOf ("long long") >= 0 || e.type ().equals ("unsigned long"))) // <klr>
- {
- String rep = e.rep ();
- int index = rep.indexOf (')');
- if (index < 0)
- return rep + 'L';
- else
- return rep.substring (0, index) + 'L' + rep.substring (index);
- }
- */
- else if (e.value () instanceof BigInteger)
- {
- // Get the correct primitive type. Since integer types (octet, short,
- // long, long long, unsigned short, unsigned long, unsigned long long)
- // could be aliased (typedef'ed) to any arbitrary levels, the code
- // below walks up the alias chain to get to the primitive type.
-
- // Get the symbol table entry corresponding to the 'type'.
- SymtabEntry typeEntry = (SymtabEntry) symbolTable.get(e.type());
-
- // Get to the primitive type.
- while (typeEntry.type() != null) {
- typeEntry = typeEntry.type();
- }
- String type = typeEntry.name();
-
- if (type.equals("unsigned long long") &&
- ((BigInteger)e.value ()).compareTo (Expression.llMax) > 0) // value > long long Max?
- {
- // Convert to signed value, which will always be negative.
- BigInteger v = (BigInteger)e.value ();
- v = v.subtract (Expression.twoPow64);
- int index = e.rep ().indexOf (')');
- if (index < 0)
- return v.toString () + 'L';
- else
- return '(' + v.toString () + 'L' + ')';
- }
- else if ( type.indexOf("long long") >= 0 || type.equals("unsigned long") )
- {
- String rep = e.rep ();
- int index = rep.indexOf (')');
- if (index < 0)
- return rep + 'L';
- else
- return rep.substring (0, index) + 'L' + rep.substring (index);
- }
- else
- return e.rep ();
- } // end <d54640>
- else
- return e.rep ();
- } // parseTerminal
-
- /**
- *
- **/
- static String hexToOctal (String hex)
- {
- // The format of hex is '/xXX' where XX is one or two hex digits.
- // This statement pulls off XX.
- hex = hex.substring (3, hex.length () - 1);
- return "'\\" + Integer.toString (Integer.parseInt (hex, 16), 8) + "'";
- } // hexToOctal
-
- /**
- *
- **/
- static String parseBinary (BinaryExpr e)
- {
- String castString = "";
- if (e.value () instanceof Float || e.value () instanceof Double)
- {
- castString = "(double)";
- if (!(e instanceof Plus || e instanceof Minus ||
- e instanceof Times || e instanceof Divide))
- System.err.println ("Operator " + e.op () + " is invalid on floating point numbers");
- }
- else if (e.value () instanceof Number)
- {
- if (e.type (). indexOf ("long long") >= 0)
- castString = "(long)";
- else
- castString = "(int)";
- }
- else
- {
- castString = "";
- System.err.println ("Unknown type in constant expression");
- }
-
- // <d54640> Must emit value rather than representation when type "unsigned
- // long long" (ull) because emitted binary arithmetic expressions containing
- // ull's converted to long (i.e., IDL long long) do not always compute to
- // the correct result.
-
- //return castString + '(' + parseExpression (e.left ()) + ' ' + e.op () + ' ' + parseExpression (e.right ()) + ')';
- if (e.type ().equals ("unsigned long long"))
- {
- BigInteger value = (BigInteger)e.value ();
- if (value.compareTo (Expression.llMax) > 0) // value > long long max?
- value = value.subtract (Expression.twoPow64); // Convert to Java long (signed)
- return castString + '(' + value.toString () + 'L' + ')';
- }
- else
- return castString + '(' + parseExpression (e.left ()) + ' ' + e.op () + ' ' + parseExpression (e.right ()) + ')';
- // <d54640> end
- } // parseBinary
-
- /**
- *
- **/
- static String parseUnary (UnaryExpr e)
- {
- if (!(e.value () instanceof Number))
- return "(UNKNOWN_VALUE)"; // This shouldn't happen if the parser checked the expression types correctly.
- else if ((e.value () instanceof Float || e.value () instanceof Double) && e instanceof Not)
- return "(UNKNOWN_VALUE)"; // This shouldn't happen if the parser checked the expression types correctly.
- else
- {
- String castString = "";
- if (e.operand ().value () instanceof Float ||
- e.operand ().value () instanceof Double)
- castString = "(double)";
- // Support long long.
- //else
- // castString = "(long)";
- else if (e.type (). indexOf ("long long") >= 0)
- castString = "(long)";
- else
- castString = "(int)";
-
- // <d54640> Must emit value rather than representation when type is
- // "unsigned long long" (ull) because emitted unary arithmetic expressions
- // containing a ull converted to long (i.e., IDL long long) do not always
- // compute to the correct result.
-
- //return castString + e.op () + parseExpression (e.operand ());
- if (e.type ().equals ("unsigned long long"))
- {
- BigInteger value = (BigInteger)e.value ();
- if (value.compareTo (Expression.llMax) > 0) // value > long long max?
- value = value.subtract (Expression.twoPow64); // Convert to Java long (signed)
- return castString + '(' + value.toString () + 'L' + ')';
- }
- else
- return castString + e.op () + parseExpression (e.operand ());
- // end <d54640>
- }
- } // parseUnary
-
- /**
- *
- **/
- public static boolean IDLEntity (SymtabEntry entry)
- {
- boolean rc = true;
- if (entry instanceof PrimitiveEntry || entry instanceof StringEntry)
- rc = false;
- else if (entry instanceof TypedefEntry)
- rc = IDLEntity (entry.type ());
- return rc;
- } // IDLEntity
-
- // <d62023>
- /**
- * @return true if the current setting of corbaLevel is within delta of
- * the range min <= corbaLevel <= max
- **/
- public static boolean corbaLevel (float min, float max)
- {
- float level = Compile.compiler.arguments.corbaLevel;
- float delta = 0.001f;
- if ((level - min + delta >= 0.0f) && (max - level + delta >= 0.0f))
- return true;
- else
- return false;
- } // corbaLevel
-
- static Hashtable symbolTable = new Hashtable ();
- static Hashtable packageTranslation = new Hashtable() ;
-} // class Util
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen.java
deleted file mode 100644
index d8efe32..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen.java
+++ /dev/null
@@ -1,349 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -D60929 <klr> Update for RTF2.4 changes
-// -D61056 <klr> Use Util.helperName
-// -D62023 <klr> Fix generation botch in helper.read for boxed bounded strings
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-import com.sun.tools.corba.se.idl.ValueBoxEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.SequenceEntry;
-import com.sun.tools.corba.se.idl.StringEntry;
-
-/**
- *
- **/
-public class ValueBoxGen implements com.sun.tools.corba.se.idl.ValueBoxGen, JavaGenerator
-{
- /**
- * Public zero-argument constructor.
- **/
- public ValueBoxGen ()
- {
- } // ctor
-
- /**
- *
- **/
- public void generate (Hashtable symbolTable, ValueBoxEntry v, PrintWriter str)
- {
- this.symbolTable = symbolTable;
- this.v = v;
-
- TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
- SymtabEntry mType = member.type ();
- // if it's primitive type, generate a java class
- if (mType instanceof PrimitiveEntry)
- {
- openStream ();
- if (stream == null)
- return;
- writeHeading ();
- writeBody ();
- writeClosing ();
- closeStream ();
- }
- else
- {
- // If a constructed type is nested in the value box,
- // value v struct s {...};
- // the bindings for the nested type must be handled here
- Enumeration e = v.contained ().elements ();
- while (e.hasMoreElements ())
- {
- SymtabEntry contained = (SymtabEntry) e.nextElement ();
-
- // in case of value box w/ nested enum, ex: value v enum e {e0, e1,...};
- // the SymtabEntry for the enum and labels are contained in the vector.
- // Must check the type to ignore the SymtabEntry for labels.
- if (contained.type () != null)
- contained.type ().generate (symbolTable, stream);
- }
- }
- generateHelper ();
- generateHolder ();
- } // generate
-
- /**
- *
- **/
- protected void openStream ()
- {
- stream = Util.stream (v, ".java");
- } // openStream
-
- /**
- *
- **/
- protected void generateHelper ()
- {
- ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, v);
- } // generateHelper
-
- /**
- *
- **/
- protected void generateHolder ()
- {
- ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, v);
- } // generateHolder
-
- /**
- *
- **/
- protected void writeHeading ()
- {
- Util.writePackage (stream, v);
- Util.writeProlog (stream, ((GenFileStream)stream).name ());
- if (v.comment () != null)
- v.comment ().generate ("", stream);
-// stream.println ("public class " + v.name () + " implements org.omg.CORBA.portable.ValueBase, org.omg.CORBA.portable.Streamable");
- stream.println ("public class " + v.name () + " implements org.omg.CORBA.portable.ValueBase"); // <d60929>
- stream.println ("{");
- } // writeHeading
-
- /**
- *
- **/
- protected void writeBody ()
- {
- InterfaceState member = (InterfaceState) v.state ().elementAt (0);
- SymtabEntry entry = (SymtabEntry) member.entry;
- Util.fillInfo (entry);
- if (entry.comment () != null)
- entry.comment ().generate (" ", stream);
- stream.println (" public " + Util.javaName (entry) + " value;");
- stream.println (" public " + v.name () + " (" + Util.javaName (entry) + " initial)");
- stream.println (" {");
- stream.println (" value = initial;");
- stream.println (" }");
- stream.println ();
- writeTruncatable (); // <d60929>
-// writeStreamableMethods ();
- } // writeBody
-
- /**
- *
- **/
- protected void writeTruncatable () // <d60929>
- {
- // Per Simon, 4/6/98, emit _truncatable_ids()
- stream.println (" public String[] _truncatable_ids() {");
- stream.println (" return " + Util.helperName(v, true) + ".get_instance().get_truncatable_base_ids();"); // <d61056>
- stream.println (" }");
- stream.println ();
- } // writeTruncatable
-
- /**
- *
- **/
- protected void writeClosing ()
- {
- stream.println ("} // class " + v.name ());
- } // writeClosing
-
- /**
- *
- **/
- protected void closeStream ()
- {
- stream.close ();
- } // closeStream
-
- /**
- *
- **/
- protected void writeStreamableMethods ()
- {
- stream.println (" public void _read (org.omg.CORBA.portable.InputStream istream)");
- stream.println (" {");
- streamableRead ("this", v, stream);
- stream.println (" }");
- stream.println ();
- stream.println (" public void _write (org.omg.CORBA.portable.OutputStream ostream)");
- stream.println (" {");
- write (0, " ", "this", v, stream);
- stream.println (" }");
- stream.println ();
- stream.println (" public org.omg.CORBA.TypeCode _type ()");
- stream.println (" {");
- stream.println (" return " + Util.helperName (v, false) + ".type ();"); // <d61056>
- stream.println (" }");
- } // writeStreamableMethods
-
- ///////////////
- // From JavaGenerator
-
- public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
- {
- ValueEntry vt = (ValueEntry) entry;
- TypedefEntry member = (TypedefEntry) ((InterfaceState) (vt.state ()).elementAt (0)).entry;
- SymtabEntry mType = Util.typeOf (member);
- index = ((JavaGenerator)mType.generator ()).type (index, indent, tcoffsets, name, mType, stream);
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_value_box_tc ("
- + "_id, "
- + '"' + entry.name () + "\", "
- + name
- + ");");
- return index;
- } // helperType
-
- public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
- stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
- return index;
- } // type
-
- public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- return index;
- } // read
-
- public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- // <d59418 - KLR> per Simon, make "static" read call istream.read_value.
- // put real marshalling code in read_value.
- stream.println (" return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (get_instance());"); // <d60929>
- stream.println (" }");
- stream.println ();
-
- // done with "read", now do "read_value with real marshalling code.
-
- stream.println (" public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)"); // <d60929>
- stream.println (" {");
- // end of <d59418> changes
-
- String indent = " ";
- Vector vMembers = ((ValueBoxEntry) entry).state ();
- TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
- SymtabEntry mType = member.type ();
- if (mType instanceof PrimitiveEntry ||
- mType instanceof SequenceEntry ||
- mType instanceof TypedefEntry ||
- mType instanceof StringEntry ||
- !member.arrayInfo ().isEmpty ()) {
- stream.println (indent + Util.javaName (mType) + " tmp;"); // <d62023>
- ((JavaGenerator)member.generator ()).read (0, indent, "tmp", member, stream);
- }
- else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
- stream.println (indent + Util.javaQualifiedName (mType) + " tmp = (" +
- Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName (mType, true) + ".get_instance ());"); // <d60929> // <d61056>
- else
- stream.println (indent + Util.javaName (mType) + " tmp = " +
- Util.helperName ( mType, true ) + ".read (istream);"); // <d61056>
- if (mType instanceof PrimitiveEntry)
- stream.println (indent + "return new " + entryName + " (tmp);");
- else
- stream.println (indent + "return tmp;");
- } // helperRead
-
- public void helperWrite (SymtabEntry entry, PrintWriter stream)
- {
- // <d59418 - KLR> per Simon, make "static" write call istream.write_value.
- // put real marshalling code in write_value.
- stream.println (" ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, get_instance());"); // <d60929>
- stream.println (" }");
- stream.println ();
-
- // done with "write", now do "write_value with real marshalling code.
-
- stream.println (" public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable obj)"); // <d60929>
- stream.println (" {");
-
- String entryName = Util.javaName(entry);
- stream.println (" " + entryName + " value = (" + entryName + ") obj;");
- write (0, " ", "value", entry, stream);
- } // helperWrite
-
- public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- Vector vMembers = ( (ValueEntry) entry ).state ();
- TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
- SymtabEntry mType = member.type ();
-
- if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ())
- index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream);
- else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ())
- index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream);
- else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
- stream.println (indent
- + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) value, " // <d60929>
- + Util.helperName (mType, true) // <d61056>
- + ".get_instance ());"); // <d61056>
- else
- stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // <d61056>
- return index;
- } // write
-
- protected void writeAbstract ()
- {
- } // writeAbstract
-
- protected void streamableRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- Vector vMembers = ( (ValueBoxEntry) entry ).state ();
- TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
- SymtabEntry mType = member.type ();
- if (mType instanceof PrimitiveEntry || mType instanceof SequenceEntry || mType instanceof TypedefEntry ||
- mType instanceof StringEntry || !member.arrayInfo ().isEmpty ())
- {
- SymtabEntry mEntry = (SymtabEntry) ((InterfaceState) vMembers.elementAt (0)).entry;
- ((JavaGenerator)member.generator ()).read (0, " ", entryName + ".value", member, stream);
- }
- else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
- stream.println (" " + entryName + ".value = (" + Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName(mType, true) + ".get_instance ());"); // <d60929> // <d61056>
- else
- stream.println (" " + entryName + ".value = " + Util.helperName (mType, true) + ".read (istream);"); // <d61056>
- } // streamableRead
-
- protected Hashtable symbolTable = null;
- protected ValueBoxEntry v = null;
- protected PrintWriter stream = null;
-} // class ValueBoxGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen24.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen24.java
deleted file mode 100644
index 02d87ed..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen24.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -D62023 <klr> Update for Java 2.4 RTF
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-import com.sun.tools.corba.se.idl.ValueBoxEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.SequenceEntry;
-import com.sun.tools.corba.se.idl.StringEntry;
-
-/**
- *
- **/
-public class ValueBoxGen24 extends ValueBoxGen
-{
- /**
- * Public zero-argument constructor.
- **/
- public ValueBoxGen24 ()
- {
- } // ctor
-
- /**
- * <d62023> - Move from helper to mapped class
- **/
- protected void writeTruncatable () // <d60929>
- {
- stream.print (" private static String[] _truncatable_ids = {");
- stream.println (Util.helperName(v, true) + ".id ()};");
- stream.println ();
- stream.println (" public String[] _truncatable_ids() {");
- stream.println (" return _truncatable_ids;");
- stream.println (" }");
- stream.println ();
- } // writeTruncatable
-
-
- /**
- * <d62023>
- **/
- public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- stream.println (" if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) {");
- stream.println (" throw new org.omg.CORBA.BAD_PARAM(); }");
- stream.println (" return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance);");
- stream.println (" }");
- stream.println ();
-
- // done with "read", now do "read_value with real marshalling code.
-
- stream.println (" public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)"); // <d60929>
- stream.println (" {");
-
- String indent = " ";
- Vector vMembers = ((ValueBoxEntry) entry).state ();
- TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
- SymtabEntry mType = member.type ();
- if (mType instanceof PrimitiveEntry ||
- mType instanceof SequenceEntry ||
- mType instanceof TypedefEntry ||
- mType instanceof StringEntry ||
- !member.arrayInfo ().isEmpty ()) {
- stream.println (indent + Util.javaName (mType) + " tmp;");
- ((JavaGenerator)member.generator ()).read (0, indent, "tmp", member, stream);
- }
- else
- stream.println (indent + Util.javaName (mType) + " tmp = " +
- Util.helperName ( mType, true ) + ".read (istream);");
- if (mType instanceof PrimitiveEntry)
- stream.println (indent + "return new " + entryName + " (tmp);");
- else
- stream.println (indent + "return (java.io.Serializable) tmp;");
- } // helperRead
-
- /**
- * <d62023>
- **/
- public void helperWrite (SymtabEntry entry, PrintWriter stream)
- {
- stream.println (" if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream)) {");
- stream.println (" throw new org.omg.CORBA.BAD_PARAM(); }");
- stream.println (" ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, _instance);");
- stream.println (" }");
- stream.println ();
-
- // done with "write", now do "write_value with real marshalling code.
-
- stream.println (" public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value)");
- stream.println (" {");
-
- String entryName = Util.javaName(entry);
- stream.println (" if (!(value instanceof " + entryName + ")) {");
- stream.println (" throw new org.omg.CORBA.MARSHAL(); }");
- stream.println (" " + entryName + " valueType = (" + entryName + ") value;");
- write (0, " ", "valueType", entry, stream);
- } // helperWrite
-
- /**
- * <d62023>
- **/
- public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- Vector vMembers = ( (ValueEntry) entry ).state ();
- TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
- SymtabEntry mType = member.type ();
-
- if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ())
- index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream);
- else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ())
- index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream);
- else
- stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // <d61056>
- return index;
- } // write
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueFactory.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueFactory.java
deleted file mode 100644
index b0d6e94..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueFactory.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 1999, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -D62023 klr new class
-
-import java.io.PrintWriter;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-
-/**
- *
- **/
-public class ValueFactory implements AuxGen
-{
- /**
- * Public zero-argument constructor.
- **/
- public ValueFactory ()
- {
- } // ctor
-
- /**
- * Generate the default value factory class. Provides general algorithm for
- * auxiliary binding generation:
- * 1.) Initialize symbol table and symbol table entry members,
- * common to all generators.
- * 2.) Initialize members unique to this generator.
- * 3.) Open print stream
- * 4.) Write class heading (package, prologue, source comment, class
- * statement, open curly
- * 5.) Write class body (member data and methods)
- * 6.) Write class closing (close curly)
- * 7.) Close the print stream
- **/
- public void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry)
- {
- this.symbolTable = symbolTable;
- this.entry = entry;
- init ();
- if (hasFactoryMethods ()) {
- openStream ();
- if (stream == null)
- return;
- writeHeading ();
- writeBody ();
- writeClosing ();
- closeStream ();
- }
- } // generate
-
- /**
- * Initialize variables unique to this generator.
- **/
- protected void init ()
- {
- factoryClass = entry.name () + "ValueFactory";
- factoryType = Util.javaName (entry);
- } // init
-
- /**
- * @return true if entry has any factory methods declared
- **/
- protected boolean hasFactoryMethods ()
- {
- Vector init = ((ValueEntry)entry).initializers ();
- if (init != null && init.size () > 0)
- return true;
- else
- return false;
- } // hasFactoryMethods
-
- /**
- * Open the print stream for subsequent output.
- **/
- protected void openStream ()
- {
- stream = Util.stream (entry, "ValueFactory.java");
- } // openStream
-
- /**
- * Generate the heading, including the package, imports,
- * source comment, class statement, and left curly.
- **/
- protected void writeHeading ()
- {
- Util.writePackage (stream, entry, Util.TypeFile); // REVISIT - same as interface?
- Util.writeProlog (stream, stream.name ());
- if (entry.comment () != null)
- entry.comment ().generate ("", stream);
- stream.println ("public interface " + factoryClass + " extends org.omg.CORBA.portable.ValueFactory");
- stream.println ('{');
- } // writeHeading
-
- /**
- * Generate members of this class.
- **/
- protected void writeBody ()
- {
- Vector init = ((ValueEntry)entry).initializers ();
- if (init != null)
- {
- for (int i = 0; i < init.size (); i++)
- {
- MethodEntry element = (MethodEntry) init.elementAt (i);
- element.valueMethod (true); //tag value method if not tagged previously
- ((MethodGen) element.generator ()). interfaceMethod (symbolTable, element, stream);
- }
- }
- } // writeBody
-
- /**
- * Generate the closing statements.
- **/
- protected void writeClosing ()
- {
- stream.println ('}');
- } // writeClosing
-
- /**
- * Write the stream to file by closing the print stream.
- **/
- protected void closeStream ()
- {
- stream.close ();
- } // closeStream
-
- protected java.util.Hashtable symbolTable;
- protected com.sun.tools.corba.se.idl.SymtabEntry entry;
- protected GenFileStream stream;
-
- // Unique to this generator
- protected String factoryClass;
- protected String factoryType;
-} // class Holder
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen.java
deleted file mode 100644
index 26e6fb0..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen.java
+++ /dev/null
@@ -1,767 +0,0 @@
-/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -F46082.51<daz> Remove -stateful feature; javaStatefulName() obsolete.
-// -D57067 <klr> suppress default init if an emit init explicitly specified.
-// -D59071 <daz> Clone method entries when their content needs modification.
-// -D59092 <klr> Valuetype supporting interfaces should implement interface.
-// -D59418 <klr> Custom values implement org.omg.CORBA.CustomMarshal
-// -D59418 <klr> Invert read/read_Value, write/write_Value for Simon
-// -D60929 <klr> Update for RTF2.4 changes
-// -D62018 <klr> write_value for value with value field x calls xHelper.write.
-// -D62062 <klr> Add _write to value Helper to marshal state.
-// write_value for value subclass calls parent._write
-// -D61650<daz> Remove '\n' from generated strings; use println()'s.
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-import com.sun.tools.corba.se.idl.ValueBoxEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.SequenceEntry;
-import com.sun.tools.corba.se.idl.StringEntry;
-import com.sun.tools.corba.se.idl.StructEntry;
-
-/**
- *
- **/
-public class ValueGen implements com.sun.tools.corba.se.idl.ValueGen, JavaGenerator
-{
- /**
- * Public zero-argument constructor.
- **/
- public ValueGen ()
- {
- } // ctor
-
- /**
- *
- **/
- public void generate (Hashtable symbolTable, ValueEntry v, PrintWriter str)
- {
- this.symbolTable = symbolTable;
- this.v = v;
- init ();
-
- openStream ();
- if (stream == null)
- return;
- generateTie ();
- generateHelper ();
- generateHolder ();
- writeHeading ();
- writeBody ();
- writeClosing ();
- closeStream ();
- } // generate
-
- /**
- * Initialize members unique to this generator.
- **/
- protected void init ()
- {
- emit = ((Arguments)Compile.compiler.arguments).emit;
- factories = (Factories)Compile.compiler.factories ();
- } // init
-
- /**
- *
- **/
- protected void openStream ()
- {
- stream = Util.stream (v, ".java");
- } // openStream
-
- /**
- * Generate a Tie class only when the user specifies the TIE option
- * and the valuetype does support an interface.
- **/
- protected void generateTie ()
- {
- boolean tie = ((Arguments)Compile.compiler.arguments).TIEServer;
- if (v.supports ().size () > 0 && tie)
- {
- Factories factories = (Factories)Compile.compiler.factories ();
- factories.skeleton ().generate (symbolTable, v);
- }
- } // generateTie
-
- /**
- *
- **/
- protected void generateHelper ()
- {
- ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, v);
- } // generateHelper
-
- /**
- *
- **/
- protected void generateHolder ()
- {
- ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, v);
- } // generateHolder
-
- /**
- *
- **/
- protected void writeHeading ()
- {
- Util.writePackage (stream, v);
- Util.writeProlog (stream, ((GenFileStream)stream).name ());
-
- if (v.comment () != null)
- v.comment ().generate ("", stream);
-
- if (v.isAbstract ())
- {
- writeAbstract ();
- return;
- }
- else
- stream.print ("public class " + v.name ());
-
- // There should always be at least one parent: ValueBase
- SymtabEntry parent = (SymtabEntry) v.derivedFrom ().elementAt (0);
-
- // If parent is ValueBase, it's mapped to java.io.Serializable
- String parentName = Util.javaName (parent);
- boolean impl = false;
-
- if (parentName.equals ("java.io.Serializable"))
- {
-// stream.print (" implements org.omg.CORBA.portable.ValueBase, org.omg.CORBA.portable.Streamable");
- stream.print (" implements org.omg.CORBA.portable.ValueBase"); // <d60929>
- impl = true;
- }
- else if ( !((ValueEntry)parent).isAbstract ())
- stream.print (" extends " + parentName);
-
- // if inheriting from abstract values
- for (int i = 0; i < v.derivedFrom ().size (); i++) {
- parent = (SymtabEntry) v.derivedFrom ().elementAt (i);
- if ( ((ValueEntry)parent).isAbstract ())
- {
- if (!impl)
- {
- stream.print (" implements ");
- impl = true;
- }
- else
- stream.print (", ");
- stream.print (Util.javaName (parent));
- }
- }
-// <d59092-klr> Valuetype supporting interface implement Operations interface
-// for supported IDL interface
- if (((ValueEntry)v).supports ().size () > 0) {
- if (!impl)
- {
- stream.print (" implements ");
- impl = true;
- }
- else
- stream.print (", ");
-
- InterfaceEntry s =(InterfaceEntry)((ValueEntry)v).supports().elementAt(0);
- // abstract supported classes don't have "Operations"
- if (s.isAbstract ())
- stream.print (Util.javaName (s));
- else
- stream.print (Util.javaName (s) + "Operations");
- }
-
-// <d59418> Custom valuetypes implement org.omg.CORBA.CustomMarshal.
- if ( ((ValueEntry)v).isCustom ()) {
- if (!impl)
- {
- stream.print (" implements ");
- impl = true;
- }
- else
- stream.print (", ");
-
- stream.print ("org.omg.CORBA.CustomMarshal ");
- }
-
- stream.println ();
- stream.println ("{");
- } // writeHeading
-
- /**
- *
- **/
- protected void writeBody ()
- {
- writeMembers ();
- writeInitializers ();
- writeConstructor (); // <d57067>
- writeTruncatable (); // <d60929>
- writeMethods ();
- } // writeBody
-
- /**
- *
- **/
- protected void writeClosing ()
- {
- if (v.isAbstract ())
- stream.println ("} // interface " + v.name ());
- else
- stream.println ("} // class " + v.name ());
- } // writeClosing
-
- /**
- *
- **/
- protected void closeStream ()
- {
- stream.close ();
- } // closeStream
-
- /**
- *
- **/
- protected void writeConstructor ()
- {
- // Per Simon, 9/3/98, emit a protected default constructor
- if (!v.isAbstract () && !explicitDefaultInit) { // <d57067 - klr>
- stream.println (" protected " + v.name () + " () {}");
- stream.println ();
- }
- } // writeConstructor
-
- /**
- *
- **/
- protected void writeTruncatable () // <d60929>
- {
- // Per Simon, 4/6/98, emit _truncatable_ids()
- if (!v.isAbstract ()) {
- stream.println (" public String[] _truncatable_ids() {");
- stream.println (" return " + Util.helperName(v, true) + ".get_instance().get_truncatable_base_ids();"); // <d61056>
- stream.println (" }");
- stream.println ();
- }
- } // writeTruncatable
-
- /**
- *
- **/
- protected void writeMembers ()
- {
- // if the value type contains no data members, a null return is expected
- if (v.state () == null)
- return;
-
- for (int i = 0; i < v.state ().size (); i ++)
- {
- InterfaceState member = (InterfaceState) v.state ().elementAt (i);
- SymtabEntry entry = (SymtabEntry) member.entry;
- Util.fillInfo (entry);
-
- if (entry.comment () != null)
- entry.comment ().generate (" ", stream);
-
- String modifier = " ";
- if (member.modifier == InterfaceState.Public)
- modifier = " public ";
- Util.writeInitializer (modifier, entry.name (), "", entry, stream);
- }
- } // writeMembers
-
- /**
- *
- **/
- protected void writeInitializers ()
- {
- Vector init = v.initializers ();
- if (init != null)
- {
- stream.println ();
- for (int i = 0; i < init.size (); i++)
- {
- MethodEntry element = (MethodEntry) init.elementAt (i);
- element.valueMethod (true);
- ((MethodGen) element.generator ()). interfaceMethod (symbolTable, element, stream);
- if (element.parameters ().isEmpty ()) // <d57067-klr>
- explicitDefaultInit = true;
- }
- }
- } // writeInitializers
-
- /**
- *
- **/
- protected void writeMethods ()
- {
- // contained vector contains methods, attributes, const, enums, exceptions,
- // structs, unions, or typedefs that are declared inside the value object.
- // State members of the nested types are also included in this vector.
- // Thus, if the declaration of a constructed type is nested in the decl.
- // of a state member, e.g struct x {boolean b;} memberx;
- // the generation of the nested type must be handled here.
- Enumeration e = v.contained ().elements ();
- while (e.hasMoreElements ())
- {
- SymtabEntry contained = (SymtabEntry)e.nextElement ();
- if (contained instanceof MethodEntry)
- {
- MethodEntry element = (MethodEntry)contained;
- ((MethodGen)element.generator ()).interfaceMethod (symbolTable, element, stream);
- }
- else
- {
- // Generate the type referenced by the typedef.
- if (contained instanceof TypedefEntry)
- contained.type ().generate (symbolTable, stream);
-
- // Note that we also need to generate the typedef itself if
- // contained is a typedef.
- contained.generate (symbolTable, stream);
- }
- }
-
- // Abstract values are mapped to interfaces. There is no need to generate
- // the bindings for inheriting methods in case of inheritance from other
- // abstract values or supporting interface
- if (v.isAbstract ())
- return;
-
- // workaround: if the value type doesnot support any interfaces, a null
- // return is expected instead of an empty vector
-
- // if supporting an interfaces, generate bindings for inheriting methods
- if (v.supports ().size () > 0)
- {
- InterfaceEntry intf = (InterfaceEntry) v.supports ().elementAt (0);
- Enumeration el = intf.allMethods ().elements ();
- while (el.hasMoreElements ())
- {
- MethodEntry m = (MethodEntry) el.nextElement ();
- // <d59071> Don't alter the symbol table/emit list elements!
- //m.container (v);
- //((MethodGen)m.generator ()).interfaceMethod (symbolTable, m, stream);
- MethodEntry mClone = (MethodEntry)m.clone ();
- mClone.container (v);
- ((MethodGen)mClone.generator ()).interfaceMethod (symbolTable, mClone, stream);
- }
- }
-
- // if inheriting from abstract values, generating bindings for all
- // inheriting methods
- for (int i = 0; i < v.derivedFrom ().size (); i++) {
- ValueEntry parentValue = (ValueEntry) v.derivedFrom ().elementAt (i);
- if (parentValue.isAbstract ())
- {
- Enumeration el = parentValue.allMethods ().elements ();
- while (el.hasMoreElements ())
- {
- MethodEntry m = (MethodEntry) el.nextElement ();
- // <d59071> Don't alter the symbol table/emit list elements!
- //m.container (v);
- //((MethodGen)m.generator ()).interfaceMethod (symbolTable, m, stream);
- MethodEntry mClone = (MethodEntry)m.clone ();
- mClone.container (v);
- ((MethodGen)mClone.generator ()).interfaceMethod (symbolTable, mClone, stream);
- }
- }
- }
-
- //writeStreamableMethods ();
- } // writeMethods
-
- /**
- *
- **/
- protected void writeStreamableMethods ()
- {
- stream.println (" public void _read (org.omg.CORBA.portable.InputStream istream)");
- stream.println (" {");
- read (0, " ", "this", v, stream);
- stream.println (" }");
- stream.println ();
- stream.println (" public void _write (org.omg.CORBA.portable.OutputStream ostream)");
- stream.println (" {");
- write (0, " ", "this", v, stream);
- stream.println (" }");
- stream.println ();
- stream.println (" public org.omg.CORBA.TypeCode _type ()");
- stream.println (" {");
- stream.println (" return " + Util.helperName (v, false) + ".type ();"); // <d61056>
- stream.println (" }");
- } // writeStreamableMethods
-
- ///////////////
- // From JavaGenerator
-
- public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
- {
- ValueEntry vt = (ValueEntry) entry;
- Vector state = vt.state ();
- int noOfMembers = state == null ? 0 : state.size ();
- String members = "_members" + index++;
- String tcOfMembers = "_tcOf" + members;
-
- stream.println (indent + "org.omg.CORBA.ValueMember[] "
- + members + " = new org.omg.CORBA.ValueMember["
- + noOfMembers
- + "];");
- stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + " = null;");
- //stream.println (""); // <d61650>
-
- String definedInrepId = "_id";
- String repId, version;
-
- for (int k=0; k<noOfMembers; k++)
- {
- InterfaceState valueMember = (InterfaceState)state.elementAt (k);
- TypedefEntry member = (TypedefEntry)valueMember.entry;
- SymtabEntry mType = Util.typeOf (member);
- if (hasRepId (member))
- {
- repId = Util.helperName (mType, true) + ".id ()"; // <d61056>
- if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
- // OBV spec is silent on defining VersionSpec for valuetype RepIds
- version = "\"\"";
- else
- {
- String id = mType.repositoryID ().ID ();
- version = '"' + id.substring (id.lastIndexOf (':')+1) + '"';
- }
- }
- else
- {
- repId = "\"\"";
- version = "\"\"";
- }
-
- // Get TypeCode for valuetype member and store it var. name given by tcOfMembers
- stream.println (indent + "// ValueMember instance for " + member.name ());
- index = ((JavaGenerator)member.generator ()).type (index, indent, tcoffsets, tcOfMembers, member, stream);
- stream.println (indent + members + "[" + k + "] = new org.omg.CORBA.ValueMember (" // <d61650>
- + '"' + member.name () + "\", "); // name
- stream.println (indent + " " + repId + ", "); // id
- stream.println (indent + " " + definedInrepId + ", "); // defined_in
- stream.println (indent + " " + version + ", "); // version
- stream.println (indent + " " + tcOfMembers + ", "); // type
- stream.println (indent + " " + "null, "); // type_def
- stream.println (indent + " " + "org.omg.CORBA." +
- (valueMember.modifier == InterfaceState.Public ?
- "PUBLIC_MEMBER" : "PRIVATE_MEMBER") + ".value" + ");"); // access
- } // end for
-
- stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_value_tc ("
- + "_id, "
- + '"' + entry.name () + "\", "
- + getValueModifier (vt) + ", "
- + getConcreteBaseTypeCode (vt) + ", "
- + members
- + ");");
-
- return index;
- } // helperType
-
- public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
- stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
- return index;
- } // type
-
- // Check for types which don't have a Repository ID: primitive,
- // string, arrays and sequences.
-
- private static boolean hasRepId (SymtabEntry member)
- {
- SymtabEntry mType = Util.typeOf (member);
- return !( mType instanceof PrimitiveEntry ||
- mType instanceof StringEntry ||
- ( mType instanceof TypedefEntry &&
- !(((TypedefEntry)mType).arrayInfo ().isEmpty ()) ) ||
- ( mType instanceof TypedefEntry && member.type () instanceof SequenceEntry) );
- } // hasRepId
-
- private static String getValueModifier (ValueEntry vt)
- {
- String mod = "NONE";
- if (vt.isCustom ())
- mod = "CUSTOM";
- else if (vt.isAbstract ())
- mod = "ABSTRACT";
- else if (vt.isSafe ())
- mod = "TRUNCATABLE";
- return "org.omg.CORBA.VM_" + mod + ".value";
- } // getValueModifier
-
- private static String getConcreteBaseTypeCode (ValueEntry vt)
- {
- Vector v = vt.derivedFrom ();
- if (!vt.isAbstract ())
- {
- SymtabEntry base = (SymtabEntry)vt.derivedFrom ().elementAt (0);
- if (!"ValueBase".equals (base.name ()))
- return Util.helperName (base, true) + ".type ()"; // <d61056>
- }
- return "null";
- } // getConcreteBaseTypeCode
-
- public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- // <d59418 - KLR> per Simon, make "static" read call istream.read_value.
- // put real marshalling code in read_value.
-
- if (((ValueEntry)entry).isAbstract ())
- {
- stream.println (" throw new org.omg.CORBA.BAD_OPERATION (\"abstract value cannot be instantiated\");");
- }
- else
- {
- stream.println (" return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (get_instance());"); // <d60929>
- }
- stream.println (" }");
- stream.println ();
-
- // done with "read", now do "read_value with real marshalling code.
-
- stream.println (" public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)"); // <d60929>
- stream.println (" {");
-
- // per Simon, 3/3/99, read_value for custom values throws an exception
- if (((ValueEntry)entry).isAbstract ())
- {
- stream.println (" throw new org.omg.CORBA.BAD_OPERATION (\"abstract value cannot be instantiated\");");
- }
- else
- if (((ValueEntry)entry).isCustom ())
- {
- stream.println (" throw new org.omg.CORBA.BAD_OPERATION (\"custom values should use unmarshal()\");");
- }
- else
- {
- stream.println (" " + entryName + " value = new " + entryName + " ();");
- read (0, " ", "value", entry, stream);
- stream.println (" return value;");
- }
- stream.println (" }");
- stream.println ();
- // End of normal read method
-
- // Per Simon, 8/26/98 - Value helpers get an additional overloaded
- // read method where the value is passed in instead of "new'd" up. This is
- // used for reading parent value state.
-
- // Per Simon, 3/3/99 - Don't change this "read" for custom marshalling
- stream.println (" public static void read (org.omg.CORBA.portable.InputStream istream, " + entryName + " value)");
- stream.println (" {");
- read (0, " ", "value", entry, stream);
- } // helperRead
-
- public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- // First do the state members from concrete parent hierarchy
- Vector vParents = ((ValueEntry) entry).derivedFrom ();
- if (vParents != null && vParents.size() != 0)
- {
- ValueEntry parent = (ValueEntry) vParents.elementAt (0);
- if (parent == null)
- return index;
- // Per Simon, 4/6/99 - call parent read. <d60929>
- if (! Util.javaQualifiedName(parent).equals ("java.io.Serializable")) // <d60929>
- stream.println(indent + Util.helperName (parent, true) + ".read (istream, value);"); // <d60929> // <d61056>
- }
-
- Vector vMembers = ((ValueEntry) entry).state ();
- int noOfMembers = vMembers == null ? 0 : vMembers.size ();
-
- for (int k = 0; k < noOfMembers; k++)
- {
- TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry;
- String memberName = member.name ();
- SymtabEntry mType = member.type ();
-
- if (mType instanceof PrimitiveEntry ||
- mType instanceof TypedefEntry ||
- mType instanceof SequenceEntry ||
- mType instanceof StringEntry ||
- !member.arrayInfo ().isEmpty ())
- index = ((JavaGenerator)member.generator ()).read (index, indent, name + '.' + memberName, member, stream);
- else if (mType instanceof ValueEntry)
- {
- String returnType = Util.javaQualifiedName (mType);
- if (mType instanceof ValueBoxEntry)
- // <f46082.51> Remove -stateful.
- //returnType = Util.javaStatefulName (mType);
- returnType = Util.javaName (mType);
- stream.println (" " + name + '.' + memberName + " = (" + returnType +
- ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName (mType, true) + // <d61056>
- ".get_instance ());"); // <d61056>
- }
- else
- stream.println (indent + name + '.' + memberName + " = " +
- Util.helperName (mType, true) + ".read (istream);"); // <d61056>
- }
-
- return index;
- } // read
-
- public void helperWrite (SymtabEntry entry, PrintWriter stream)
- {
- // <d59418 - KLR> per Simon, make "static" write call istream.write_value.
- // put real marshalling code in write_value.
- stream.println (" ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, get_instance());"); // <d60929>
- stream.println (" }");
- stream.println ();
-
- // <d62062>
- // per Simon, 4/27/99, add static _write that marshals the state of this
- // value for non-custom valuetypes
- if (!((ValueEntry)entry).isCustom ())
- {
- stream.println (" public static void _write (org.omg.CORBA.portable.OutputStream ostream, " + Util.javaName (entry) + " value)");
- stream.println (" {");
- write (0, " ", "value", entry, stream);
- stream.println (" }");
- stream.println ();
- }
-
- // done with "_write", now do "write_value
- stream.println (" public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable obj)"); // <d60929>
- stream.println (" {");
-
- // per Simon, 3/3/99, write_value for custom values throws an exception
- if (((ValueEntry)entry).isCustom ())
- {
- stream.println (" throw new org.omg.CORBA.BAD_OPERATION (\"custom values should use marshal()\");");
- }
- else {
- String entryName = Util.javaName(entry);
- stream.println (" _write (ostream, (" + entryName + ") obj);"); // <d62062>
-// write (0, " ", "value", entry, stream); <d62062>
- }
- } // helperWrite
-
- public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- // First do the state members from concrete parent hierarchy
- Vector vParents = ((ValueEntry)entry).derivedFrom ();
- if (vParents != null && vParents.size () != 0)
- {
- ValueEntry parent = (ValueEntry)vParents.elementAt (0);
- if (parent == null)
- return index;
- // Per Simon, 4/06/99 - call parent write. <d60929>
- // Per Simon, 4/27/99 - call parent _write. <d62062>
- if (! Util.javaQualifiedName(parent).equals ("java.io.Serializable")) // <d60929>
- stream.println(indent + Util.helperName (parent, true) + "._write (ostream, value);"); // <d60929> <d61056> <d62062>
- }
-
- Vector vMembers = ((ValueEntry) entry ).state ();
- int noOfMembers = vMembers == null ? 0 : vMembers.size ();
- for (int k = 0; k < noOfMembers; k++)
- {
- TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry;
- String memberName = member.name ();
- SymtabEntry mType = member.type ();
-
- if (mType instanceof PrimitiveEntry ||
- mType instanceof TypedefEntry ||
- mType instanceof SequenceEntry ||
- mType instanceof StringEntry ||
- !member.arrayInfo ().isEmpty ())
- index = ((JavaGenerator)member.generator ()).write (index, indent, name + '.' + memberName, member, stream);
- else
- stream.println (indent + Util.helperName (mType, true) + // <d61056>
- ".write (ostream, " + name + '.' + memberName + ");");
- }
-
- return index;
- } // write
-
- /**
- *
- **/
- protected void writeAbstract ()
- {
- stream.print ("public interface " + v.name ());
-
- // workaround: if the abstract value type does not have any parent, a vector
- // containing ValueBase should be returned instead of an empty vector
- if (v.derivedFrom ().size () == 0)
- stream.print (" extends org.omg.CORBA.portable.ValueBase"); // <d60929>
- else
- {
- SymtabEntry parent;
- // list the values the abstract value type inherits
- for (int i = 0; i < v.derivedFrom ().size (); i++)
- {
- if (i == 0)
- stream.print (" extends ");
- else
- stream.print (", ");
- parent = (SymtabEntry) v.derivedFrom ().elementAt (i);
- stream.print (Util.javaName (parent));
- }
- }
-
- // list the interface the abstract value type supports
- if (v.supports ().size () > 0)
- {
- stream.print (", ");
- SymtabEntry intf = (SymtabEntry) v.supports ().elementAt (0);
- stream.print (Util.javaName (intf));
- }
- stream.println ();
- stream.println ("{");
- }
-
- protected int emit = 0;
- protected Factories factories = null;
- protected Hashtable symbolTable = null;
- protected ValueEntry v = null;
- protected PrintWriter stream = null;
- protected boolean explicitDefaultInit = false; // <d57067 - klr>
-} // class ValueGen
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen24.java b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen24.java
deleted file mode 100644
index 27930c2..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen24.java
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * Copyright (c) 1999, 2004, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-/*
- * COMPONENT_NAME: idl.toJava
- *
- * ORIGINS: 27
- *
- * Licensed Materials - Property of IBM
- * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
- * RMI-IIOP v1.0
- *
- */
-
-package com.sun.tools.corba.se.idl.toJavaPortable;
-
-// NOTES:
-// -D62023 <klr> Update for Java 2.4 RTF
-// -D62794.1 <klr> Don't include operations inherited from abstract valuetypes
-// -D62794.1 <scn> Don't include operations inherited from supported interfaces
-
-import java.io.File;
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import com.sun.tools.corba.se.idl.GenFileStream;
-import com.sun.tools.corba.se.idl.InterfaceEntry;
-import com.sun.tools.corba.se.idl.SymtabEntry;
-import com.sun.tools.corba.se.idl.TypedefEntry;
-import com.sun.tools.corba.se.idl.ValueEntry;
-import com.sun.tools.corba.se.idl.ValueBoxEntry;
-import com.sun.tools.corba.se.idl.InterfaceState;
-import com.sun.tools.corba.se.idl.MethodEntry;
-import com.sun.tools.corba.se.idl.AttributeEntry;
-import com.sun.tools.corba.se.idl.PrimitiveEntry;
-import com.sun.tools.corba.se.idl.SequenceEntry;
-import com.sun.tools.corba.se.idl.StringEntry;
-import com.sun.tools.corba.se.idl.StructEntry;
-
-/**
- *
- **/
-public class ValueGen24 extends ValueGen
-{
- /**
- * Public zero-argument constructor.
- **/
- public ValueGen24 ()
- {
- } // ctor
-
- /**
- * <d62023> - delete constructor; helper is abstract
- **/
- protected void writeConstructor ()
- {
- } // writeConstructor
-
- /**
- * <d62023> - delete write_value from non-boxed helpers
- * - delete _write from non-boxed helpers
- **/
- public void helperWrite (SymtabEntry entry, PrintWriter stream)
- {
- // REVISIT: Abstract/Custom??
- // per Simon mail 5/17/99
- stream.println (" ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, id ());");
- } // helperWrite
-
- /**
- * <d62023>
- **/
- public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
- {
- // REVISIT: Abstract/Custom??
- // per Simon mail 5/17/99
- stream.println (" return (" + entryName + ")((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (id ());");
- } // helperRead
-
- /**
- * <d62023> - suppress initializers from mapped value; now generated in
- * the Helper class and Factory class
- **/
- protected void writeInitializers ()
- {
- // override to do nothing
- } // writeInitializers
-
- /**
- * <d62023> - Goes in mapped class, not Helper
- **/
- protected void writeTruncatable () // <d60929>
- {
- if (!v.isAbstract ()) {
- stream.println (" private static String[] _truncatable_ids = {");
- stream.print (" " + Util.helperName(v, true) + ".id ()");
-
- // Any safe ValueEntry must have a concete value parent.
- // The topmost parent cannot be safe since it doesn't have
- // a concrete parent.
- ValueEntry child = v;
- while (child.isSafe ())
- {
- stream.println(",");
- ValueEntry parent = (ValueEntry)child.derivedFrom ().elementAt (0);
- stream.print(" \"" + Util.stripLeadingUnderscoresFromID (parent.repositoryID ().ID ()) + "\"");
- child = parent;
- }
- stream.println();
- stream.println(" };");
- stream.println();
- stream.println (" public String[] _truncatable_ids() {");
- stream.println (" return _truncatable_ids;");
- stream.println (" }");
- stream.println ();
- }
- } // writeTruncatable
-
- class ImplStreamWriter {
- private boolean isImplementsWritten = false ;
-
- public void writeClassName( String name )
- {
- if (!isImplementsWritten) {
- stream.print( " implements " ) ;
- isImplementsWritten = true ;
- } else
- stream.print( ", " ) ;
-
- stream.print( name ) ;
- }
- }
-
- /**
- * <d62023> CustomMarshal -> CustomValue for custom valuetypes
- * mapped class is abstract
- **/
- protected void writeHeading ()
- {
- ImplStreamWriter isw = new ImplStreamWriter() ;
-
- Util.writePackage (stream, v);
- Util.writeProlog (stream, ((GenFileStream)stream).name ());
-
- if (v.comment () != null)
- v.comment ().generate ("", stream);
-
- if (v.isAbstract ()) {
- writeAbstract ();
- return;
- } else
- stream.print ("public abstract class " + v.name ());
-
- // There should always be at least one parent: ValueBase
- SymtabEntry parent = (SymtabEntry) v.derivedFrom ().elementAt (0);
-
- // If parent is ValueBase, it's mapped to java.io.Serializable
- String parentName = Util.javaName (parent);
- boolean cv = false; // true if we've already implemented CustomValue
-
- if (parentName.equals ("java.io.Serializable")) {
- if (((ValueEntry)v).isCustom ()) {
- isw.writeClassName( "org.omg.CORBA.portable.CustomValue" ) ;
- cv = true;
- } else
- isw.writeClassName( "org.omg.CORBA.portable.StreamableValue" ) ;
- } else if ( !((ValueEntry)parent).isAbstract ())
- stream.print (" extends " + parentName);
-
- // if inheriting from abstract values
- for (int i = 0; i < v.derivedFrom ().size (); i++) {
- parent = (SymtabEntry) v.derivedFrom ().elementAt (i);
- if ( ((ValueEntry)parent).isAbstract ()) {
- isw.writeClassName( Util.javaName(parent) ) ;
- }
- }
-
- // Write out the supported interfaces
- Enumeration enumeration = v.supports().elements();
- while (enumeration.hasMoreElements()) {
- InterfaceEntry ie = (InterfaceEntry)(enumeration.nextElement()) ;
- String cname = Util.javaName(ie) ;
- if (!ie.isAbstract())
- cname += "Operations" ;
- isw.writeClassName( cname ) ;
- }
-
- // for when a custom valuetype inherits from a non-custom valuetype
- if ( v.isCustom () && !cv)
- isw.writeClassName( "org.omg.CORBA.portable.CustomValue" ) ;
-
- stream.println ();
- stream.println ("{");
- } // writeHeading
-
- /**
- * <d62023> - private state maps to protected, not default
- **/
- protected void writeMembers ()
- {
- // if the value type contains no data members, a null return is expected
- if (v.state () == null)
- return;
-
- for (int i = 0; i < v.state ().size (); i ++)
- {
- InterfaceState member = (InterfaceState) v.state ().elementAt (i);
- SymtabEntry entry = (SymtabEntry) member.entry;
- Util.fillInfo (entry);
-
- if (entry.comment () != null)
- entry.comment ().generate (" ", stream);
-
- String modifier = " ";
- if (member.modifier == InterfaceState.Public)
- modifier = " public ";
- else
- modifier = " protected ";
- Util.writeInitializer (modifier, entry.name (), "", entry, stream);
- }
- stream.println();
- } // writeMembers
-
- /**
- * <d62023> Methods need to be abstract
- * writeStreamable
- **/
- protected void writeMethods ()
- {
- // contained vector contains methods, attributes, const, enums, exceptions,
- // structs, unions, or typedefs that are declared inside the value object.
- // State members of the nested types are also included in this vector.
- // Thus, if the declaration of a constructed type is nested in the decl.
- // of a state member, e.g struct x {boolean b;} memberx;
- // the generation of the nested type must be handled here.
- Enumeration e = v.contained ().elements ();
- while (e.hasMoreElements ())
- {
- SymtabEntry contained = (SymtabEntry)e.nextElement ();
- if (contained instanceof AttributeEntry)
- {
- AttributeEntry element = (AttributeEntry)contained;
- ((AttributeGen24)element.generator ()).abstractMethod (symbolTable, element, stream);
- }
- else if (contained instanceof MethodEntry)
- {
- MethodEntry element = (MethodEntry)contained;
- ((MethodGen24)element.generator ()).abstractMethod (symbolTable, element, stream);
- }
- else
- {
- // Generate the type referenced by the typedef.
- if (contained instanceof TypedefEntry)
- contained.type ().generate (symbolTable, stream);
-
- // Note that we also need to generate the typedef itself if
- // contained is a typedef.
- contained.generate (symbolTable, stream);
- }
- }
-
- // Abstract values are mapped to interfaces. There is no need to generate
- // the bindings for inheriting methods in case of inheritance from other
- // abstract values or supporting interface
- if (v.isAbstract ())
- return;
-
- // Non-abstract, Non-Custom valuetypes support the Streamable interface
- if (!(v.isCustom () || v.isAbstract ()))
- writeStreamableMethods ();
- } // writeMethods
-
- /**
- * <d62023> Call super._read()
- **/
- public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- // First do the state members from concrete parent hierarchy
- Vector vParents = ((ValueEntry) entry).derivedFrom ();
- if (vParents != null && vParents.size() != 0)
- {
- ValueEntry parent = (ValueEntry) vParents.elementAt (0);
- if (parent == null)
- return index;
-
- // call super._read if non-abstract value parent
- if ((!parent.isAbstract ()) && (! Util.javaQualifiedName(parent).equals ("java.io.Serializable"))) // <d60929>
- stream.println(indent + "super._read (istream);");
- }
-
- Vector vMembers = ((ValueEntry) entry).state ();
- int noOfMembers = vMembers == null ? 0 : vMembers.size ();
-
- for (int k = 0; k < noOfMembers; k++)
- {
- TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry;
- String memberName = member.name ();
- SymtabEntry mType = member.type ();
-
- if (mType instanceof PrimitiveEntry ||
- mType instanceof TypedefEntry ||
- mType instanceof SequenceEntry ||
- mType instanceof StringEntry ||
- !member.arrayInfo ().isEmpty ())
- index = ((JavaGenerator)member.generator ()).read (index, indent, name + '.' + memberName, member, stream);
- else
- stream.println (indent + name + '.' + memberName + " = " +
- Util.helperName (mType, true) + ".read (istream);"); // <d61056>
- }
-
- return index;
- } // read
-
- /**
- * <d62023> Call super._write()
- **/
- public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
- {
- // First do the state members from concrete parent hierarchy
- Vector vParents = ((ValueEntry)entry).derivedFrom ();
- if (vParents != null && vParents.size () != 0)
- {
- ValueEntry parent = (ValueEntry)vParents.elementAt (0);
- if (parent == null)
- return index;
- // call super._read if non-abstract value parent
- if ((!parent.isAbstract ()) && (! Util.javaQualifiedName(parent).equals ("java.io.Serializable"))) // <d60929>
- stream.println(indent + "super._write (ostream);");
- }
-
- Vector vMembers = ((ValueEntry) entry ).state ();
- int noOfMembers = vMembers == null ? 0 : vMembers.size ();
- for (int k = 0; k < noOfMembers; k++)
- {
- TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry;
- String memberName = member.name ();
- SymtabEntry mType = member.type ();
-
- if (mType instanceof PrimitiveEntry ||
- mType instanceof TypedefEntry ||
- mType instanceof SequenceEntry ||
- mType instanceof StringEntry ||
- !member.arrayInfo ().isEmpty ())
- index = ((JavaGenerator)member.generator ()).write (index, indent, name + '.' + memberName, member, stream);
- else
- stream.println (indent + Util.helperName (mType, true) + // <d61056>
- ".write (ostream, " + name + '.' + memberName + ");");
- }
-
- return index;
- } // write
-
- /**
- * <62023> - generate factory interface and default factory
- **/
- public void generate (Hashtable symbolTable, ValueEntry v, PrintWriter str)
- {
- this.symbolTable = symbolTable;
- this.v = v;
- init ();
-
- openStream ();
- if (stream == null)
- return;
- generateTie ();
- generateHelper ();
- generateHolder ();
- if (!v.isAbstract ()) {
- generateValueFactory ();
- generateDefaultFactory ();
- }
- writeHeading ();
- writeBody ();
- writeClosing ();
- closeStream ();
- } // generate
-
- /**
- *
- **/
- protected void generateValueFactory ()
- {
- ((Factories)Compile.compiler.factories ()).valueFactory ().generate (symbolTable, v);
- } // generateValueFactory
-
- /**
- *
- **/
- protected void generateDefaultFactory ()
- {
- ((Factories)Compile.compiler.factories ()).defaultFactory ().generate (symbolTable, v);
- } // generateDefaultFactory
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp
deleted file mode 100644
index a6611ad..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp
+++ /dev/null
@@ -1,111 +0,0 @@
-#
-# Copyright (c) 1999, 2009, Oracle and/or its affiliates. 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. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# COMPONENT_NAME: idl.toJava
-#
-# ORIGINS: 27
-#
-# Licensed Materials - Property of IBM
-# 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
-# RMI-IIOP v1.0
-#
-#
-# Translator: Each line below is of the form "<key>=<message>".
-# The keys are NOT to be translated.
-# The messages ARE to be translated.
-#
-# DO NOT translate the following:
-# IBM
-# IDL
-# Java
-#
-# %0 is a parameter to the message. Do not translate it.
-#
-# A backslash (\) at the end of a line is a line continuation
-# character. A backslash at the beginning of a line means don't
-# ignore leading blanks (they normally are). These backslashes
-# should remain in the message.
-#
-# Translator: Start Translating
-#
-toJavaProlog1=Generated by the %0
-toJavaProlog2=from %0
-PreEmit.indeterminateTypeInfo=Cannot determine type infomation for %0.
-InterfaceGen.noImpl=No local implementation found for %0.
-Version.product=IDL-to-Java compiler (portable), version "%0"
-Version.number=3.2
-NameModifier.TooManyPercent=Pattern contains more than one percent characters
-NameModifier.NoPercent=Pattern does not contain a percent character
-NameModifier.InvalidChar=Pattern contains an invalid character %0
-#
-# Translator: In the list of options below, do not translate:
-# -d, -emitAll, -f, -i, -keep, -m, -sep, -pkgPrefix, -td, -v, -verbose, -version, -implbase
-# Do not translate the string "java com.sun.tools.corba.se.idl.toJavaPortable.Compile"
-#
-usage=Compiler Usage:\n\
-\n\
-\ java com.sun.tools.corba.se.idl.toJavaPortable.Compile [options] <idl file>\n\
-\n\
-where <idl file> is the name of a file containing IDL definitions, and\n\
-[options] is any combination of the options listed below. The options\n\
-are optional and may appear in any order; <idl file> is required and\n\
-must appear last.\n\
-\ \n\
-Options:\n\
- -d <symbol> This is equivalent to the following line in an\n\
-\ IDL file: #define <symbol>\n\
- -emitAll Emit all types, including those found in #included files.\n\
- -f<side> Define what bindings to emit. <side> is one of client,\n\
-\ server, all, serverTIE, allTIE. serverTIE and allTIE\n\
-\ cause delegate model skeletons to be emitted. If this\n\
-\ flag is not used, -fclient is assumed.\n\
- -i <include path> By default, the current directory is scanned for\n\
-\ included files. This option adds another directory.\n\
- -keep If a file to be generated already exists, do not\n\
-\ overwrite it. By default it is overwritten.\n\
- -noWarn Suppress warnings.\n\
- -oldImplBase Generate skeletons compatible with old (pre-1.4) JDK ORBs.\n\
- -pkgPrefix <t> <prefix> When the type or module name <t> is encountered at\n\
-\ file scope, begin the Java package name for all files\n\
-\ generated for <t> with <prefix>.\n\
- -pkgTranslate <t> <pkg> When the type or module name <t> in encountered, replace\n\
-\ it with <pkg> in the generated java package. Note that\n\
-\ pkgPrefix changes are made first. <t> must match the\n\
-\ full package name exactly. Also, <t> must not be\n\
-\ org, org.omg, or any subpackage of org.omg.\n\
- -skeletonName <xxx%yyy> Name the skeleton according to the pattern.\n\
-\ The defaults are:\n\
-\ %POA for the POA base class (-fserver or -fall) \n\
-\ _%ImplBase for the oldImplBase base class\n\
-\ (-oldImplBase and (-fserver or -fall)).\n\
- -td <dir> use <dir> for the output directory instead of\n\
-\ the current directory.\n\
- -tieName <xxx%yyy> Name the tie according to the pattern. The defaults are:\n\
-\ %POATie for the POA tie (-fserverTie or -fallTie) \n\
-\ %_Tie for the oldImplBase tie\n\
-\ (-oldImplBase and (-fserverTie or -fallTie)).\n\
- -v, -verbose Verbose mode.\n\
- -version Display the version number and quit.\n
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp
deleted file mode 100644
index 52bb4f3..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp
+++ /dev/null
@@ -1,69 +0,0 @@
-#
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. 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. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# COMPONENT_NAME: idl.toJava
-#
-# ORIGINS: 27
-#
-# Licensed Materials - Property of IBM
-# 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
-# RMI-IIOP v1.0
-#
-#
-# Translator: Each line below is of the form "<key>=<message>".
-# The keys are NOT to be translated.
-# The messages ARE to be translated.
-#
-# DO NOT translate the following:
-# IBM
-# IDL
-# Java
-#
-# %0 is a parameter to the message. Do not translate it.
-#
-# A backslash (\) at the end of a line is a line continuation
-# character. A backslash at the beginning of a line means don't
-# ignore leading blanks (they normally are). These backslashes
-# should remain in the message.
-#
-# Translator: Start Translating
-#
-toJavaProlog1=%0\u306B\u3088\u3063\u3066\u751F\u6210\u3055\u308C\u307E\u3057\u305F
-toJavaProlog2=%0\u304B\u3089
-PreEmit.indeterminateTypeInfo=%0\u306E\u30BF\u30A4\u30D7\u60C5\u5831\u3092\u5224\u5225\u3067\u304D\u307E\u305B\u3093\u3002
-InterfaceGen.noImpl=%0\u306E\u30ED\u30FC\u30AB\u30EB\u5B9F\u88C5\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
-Version.product=IDL-to-Java\u30B3\u30F3\u30D1\u30A4\u30E9(\u30DD\u30FC\u30BF\u30D6\u30EB)\u3001\u30D0\u30FC\u30B8\u30E7\u30F3"%0"
-Version.number=3.2
-NameModifier.TooManyPercent=\u30D1\u30BF\u30FC\u30F3\u306B\u8907\u6570\u306E\u30D1\u30FC\u30BB\u30F3\u30C8\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
-NameModifier.NoPercent=\u30D1\u30BF\u30FC\u30F3\u306B\u30D1\u30FC\u30BB\u30F3\u30C8\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093
-NameModifier.InvalidChar=\u30D1\u30BF\u30FC\u30F3\u306B\u7121\u52B9\u306A\u6587\u5B57%0\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
-#
-# Translator: In the list of options below, do not translate:
-# -d, -emitAll, -f, -i, -keep, -m, -sep, -pkgPrefix, -td, -v, -verbose, -version, -implbase
-# Do not translate the string "java com.sun.tools.corba.se.idl.toJavaPortable.Compile"
-#
-usage=\u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u4F7F\u7528\u65B9\u6CD5:\n\n java com.sun.tools.corba.se.idl.toJavaPortable.Compile [options] <idl file>\n\n<idl file>\u306FIDL\u5B9A\u7FA9\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u3067\u3001\n[options]\u306F\u6B21\u306B\u30EA\u30B9\u30C8\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u3067\u3059\u3002\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\n\u7701\u7565\u53EF\u80FD\u3067\u3001\u4EFB\u610F\u306E\u9806\u5E8F\u3067\u8868\u793A\u3055\u308C\u307E\u3059\u3002<idl file>\u306F\u5FC5\u9808\u3067\u3001\n\u6700\u5F8C\u306B\u8868\u793A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n \n\u30AA\u30D7\u30B7\u30E7\u30F3:\n-d <symbol> IDL\u30D5\u30A1\u30A4\u30EB\u306E\u6B21\u306E\u884C\u3068\n \u540C\u3058\u3067\u3059: #define <symbol>\n-emitAll #included\u30D5\u30A1\u30A4\u30EB\u3067\u898B\u3064\u304B\u3063\u305F\u30BF\u30A4\u30D7\u3092\u542B\u3080\u3001\u3059\u3079\u3066\u306E\u30BF\u30A4\u30D7\u3092\u767A\u884C\u3057\u307E\u3059\u3002\n-f<side> \u767A\u884C\u3059\u308B\u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0\u3092\u5B9A\u7FA9\u3057\u307E\u3059\u3002<side>\u306Fclient\u3001\n server\u3001all\u3001serverTIE\u3001allTIE\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002serverTIE\u3068allTIE\u306F\n \u59D4\u4EFB\u30E2\u30C7\u30EB\u30FB\u30B9\u30B1\u30EB\u30C8\u30F3\u3092\u767A\u884C\u3057\u307E\u3059\u3002\u3053\u306E\u30D5\u30E9\u30B0\u3092\n \u4F7F\u7528\u3057\u306A\u3044\u5834\u5408\u306F\u3001-fclient\u3068\u307F\u306A\u3055\u308C\u307E\u3059\u3002\n-i <include path> \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u304C\n \u30B9\u30AD\u30E3\u30F3\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u5225\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002\n-keep \u751F\u6210\u3055\u308C\u308B\u30D5\u30A1\u30A4\u30EB\u304C\u3059\u3067\u306B\u5B58\u5728\u3059\u308B\u5834\u5408\u306F\u3001\u4E0A\u66F8\u304D\n \u3057\u307E\u305B\u3093\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u4E0A\u66F8\u304D\u3055\u308C\u307E\u3059\u3002\n-noWarn \u8B66\u544A\u3092\u51FA\u3055\u306A\u3044\u3088\u3046\u306B\u3057\u307E\u3059\u3002\n-oldImplBase \u53E4\u3044(1.4\u4EE5\u524D) JDK ORB\u3068\u4E92\u63DB\u6027\u306E\u3042\u308B\u30B9\u30B1\u30EB\u30C8\u30F3\u3092\u751F\u6210\u3057\u307E\u3059\u3002\n-pkgPrefix <t> <prefix> \u30D5\u30A1\u30A4\u30EB\u30FB\u30B9\u30B3\u30FC\u30D7\u3067\u30BF\u30A4\u30D7\u307E\u305F\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u540D<t>\u304C\u691C\u51FA\u3055\u308C\u305F\u5834\u5408\u3001\n <t>\u306B\u5BFE\u3057\u3066\u751F\u6210\u3055\u308C\u305F\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB\u306EJava\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\u3092\n <prefix>\u3067\u59CB\u3081\u307E\u3059\u3002\n-pkgTranslate <t> <pkg> \u30BF\u30A4\u30D7\u307E\u305F\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u540D<t>\u304C\u691C\u51FA\u3055\u308C\u305F\u5834\u5408\u3001\n \u751F\u6210\u3055\u308C\u305FJava\u30D1\u30C3\u30B1\u30FC\u30B8\u5185\u3067<pkg>\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002pkgPrefix\u306E\n \u5909\u66F4\u304C\u5148\u306B\u884C\u308F\u308C\u308B\u3053\u3068\u306B\u6CE8\u610F\u3057\u3066\u304F\u3060\u3055\u3044\u3002<t>\u306F\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\n \u6B63\u5F0F\u540D\u3068\u5B8C\u5168\u306B\u4E00\u81F4\u3057\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\u307E\u305F\u3001<t>\u3092\n \
-org\u3001org.omg\u307E\u305F\u306Forg.omg\u306E\u30B5\u30D6\u30D1\u30C3\u30B1\u30FC\u30B8\u306B\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\n-skeletonName <xxx%yyy> \u30D1\u30BF\u30FC\u30F3\u306B\u5F93\u3063\u3066\u30B9\u30B1\u30EB\u30C8\u30F3\u306B\u540D\u524D\u3092\u4ED8\u3051\u307E\u3059\u3002\n \u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n POA\u30D9\u30FC\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u5834\u5408\u306F%POA (-fserver\u307E\u305F\u306F-fall) \n oldImplBase\u30D9\u30FC\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u5834\u5408\u306F_%ImplBase\n (-oldImplBase\u304A\u3088\u3073(-fserver\u307E\u305F\u306F-fall))\u3002\n-td <dir> \u51FA\u529B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u304B\u308F\u308A\u306B<dir>\u3092\n \u4F7F\u7528\u3057\u307E\u3059\u3002\n-tieName <xxx%yyy> \u30D1\u30BF\u30FC\u30F3\u306B\u5F93\u3063\u3066tie\u306B\u540D\u524D\u3092\u4ED8\u3051\u307E\u3059\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n POA tie\u306E\u5834\u5408\u306F%POATie (-fserverTie\u307E\u305F\u306F-fallTie) \n oldImplBase tie\u306E\u5834\u5408\u306F%_Tie\n (-oldImplBase\u304A\u3088\u3073(-fserverTie\u307E\u305F\u306F-fallTie))\u3002\n-v, -verbose \u8A73\u7D30\u30E2\u30FC\u30C9\u3002\n-version \u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3057\u307E\u3059\u3002\n
diff --git a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp b/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp
deleted file mode 100644
index f436137..0000000
--- a/src/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp
+++ /dev/null
@@ -1,68 +0,0 @@
-#
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. 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. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#
-# COMPONENT_NAME: idl.toJava
-#
-# ORIGINS: 27
-#
-# Licensed Materials - Property of IBM
-# 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
-# RMI-IIOP v1.0
-#
-#
-# Translator: Each line below is of the form "<key>=<message>".
-# The keys are NOT to be translated.
-# The messages ARE to be translated.
-#
-# DO NOT translate the following:
-# IBM
-# IDL
-# Java
-#
-# %0 is a parameter to the message. Do not translate it.
-#
-# A backslash (\) at the end of a line is a line continuation
-# character. A backslash at the beginning of a line means don't
-# ignore leading blanks (they normally are). These backslashes
-# should remain in the message.
-#
-# Translator: Start Translating
-#
-toJavaProlog1=\u7531%0\u751F\u6210
-toJavaProlog2=\u4ECE%0
-PreEmit.indeterminateTypeInfo=\u65E0\u6CD5\u786E\u5B9A%0\u7684\u7C7B\u578B\u4FE1\u606F\u3002
-InterfaceGen.noImpl=\u627E\u4E0D\u5230%0\u7684\u672C\u5730\u5B9E\u73B0\u3002
-Version.product=IDL-to-Java \u7F16\u8BD1\u5668 (\u53EF\u79FB\u690D), \u7248\u672C "%0"
-Version.number=3.2
-NameModifier.TooManyPercent=\u6A21\u5F0F\u4E2D\u5305\u542B\u591A\u4E2A\u767E\u5206\u6BD4\u5B57\u7B26
-NameModifier.NoPercent=\u6A21\u5F0F\u4E2D\u4E0D\u5305\u542B\u767E\u5206\u6BD4\u5B57\u7B26
-NameModifier.InvalidChar=\u6A21\u5F0F\u4E2D\u5305\u542B\u65E0\u6548\u5B57\u7B26 %0
-#
-# Translator: In the list of options below, do not translate:
-# -d, -emitAll, -f, -i, -keep, -m, -sep, -pkgPrefix, -td, -v, -verbose, -version, -implbase
-# Do not translate the string "java com.sun.tools.corba.se.idl.toJavaPortable.Compile"
-#
-usage=\u7F16\u8BD1\u5668\u7528\u6CD5:\n\n java com.sun.tools.corba.se.idl.toJavaPortable.Compile [\u9009\u9879] <idl \u6587\u4EF6>\n\n\u5176\u4E2D, <idl \u6587\u4EF6> \u662F\u5305\u542B IDL \u5B9A\u4E49\u7684\u6587\u4EF6\u7684\u540D\u79F0, \u800C\n[\u9009\u9879] \u662F\u4E0B\u5217\u9009\u9879\u7684\u4EFB\u610F\u7EC4\u5408\u3002\u9009\u9879\n\u662F\u53EF\u9009\u7684, \u5E76\u4E14\u663E\u793A\u987A\u5E8F\u5E76\u4E0D\u56FA\u5B9A; <idl \u6587\u4EF6> \u662F\u5FC5\u9700\u7684,\n\u5E76\u4E14\u5FC5\u987B\u663E\u793A\u5728\u6700\u540E\u3002\n \n\u9009\u9879:\n-d <\u7B26\u53F7> \u8FD9\u7B49\u540C\u4E8E IDL \u6587\u4EF6\u4E2D\u7684\n \u4E0B\u9762\u4E00\u884C: #define <\u7B26\u53F7>\n-emitAll \u53D1\u51FA\u6240\u6709\u7C7B\u578B, \u5305\u62EC\u5728 #included \u6587\u4EF6\u4E2D\u627E\u5230\u7684\u7C7B\u578B\u3002\n-f<side> \u5B9A\u4E49\u8981\u53D1\u51FA\u54EA\u4E9B\u7ED1\u5B9A\u3002<side> \u662F client,\n server, all, serverTIE, allTIE \u4E4B\u4E00\u3002serverTIE \u548C allTIE\n \u5BFC\u81F4\u53D1\u51FA\u59D4\u6D3E\u6A21\u578B\u9AA8\u67B6\u3002\u5982\u679C\u672A\u4F7F\u7528\n \u6B64\u6807\u8BB0, \u5C06\u5047\u5B9A\u4E3A -fclient\u3002\n-i <\u5305\u542B\u8DEF\u5F84> \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u5C06\u5728\u5F53\u524D\u76EE\u5F55\u4E2D\u626B\u63CF\n \u5305\u542B\u7684\u6587\u4EF6\u3002\u6B64\u9009\u9879\u5C06\u6DFB\u52A0\u53E6\u4E00\u4E2A\u76EE\u5F55\u3002\n-keep \u5982\u679C\u8981\u751F\u6210\u7684\u6587\u4EF6\u5DF2\u5B58\u5728, \u8BF7\u4E0D\u8981\n \u8986\u76D6\u5B83\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4F1A\u8986\u76D6\u5B83\u3002\n-noWarn \u9690\u85CF\u8B66\u544A\u3002\n-oldImplBase \u751F\u6210\u4E0E\u65E7\u7248 (1.4 \u7248\u4E4B\u524D) JDK ORB \u517C\u5BB9\u7684\u9AA8\u67B6\u3002\n-pkgPrefix <t> <\u524D\u7F00> \u5F53\u5728\u6587\u4EF6\u8303\u56F4\u5185\u9047\u5230\u7C7B\u578B\u6216\u6A21\u5757\u540D <t> \u65F6,\n \u5728\u4E3A <t> \u751F\u6210\u7684\u6240\u6709\u6587\u4EF6\u7684 Java \u7A0B\u5E8F\u5305\u540D\u524D\n \u6DFB\u52A0 <\u524D\u7F00>\u3002\n-pkgTranslate <t> <pkg> \u5F53\u9047\u5230\u7C7B\u578B\u6216\u6A21\u5757\u540D <t> \u65F6, \u5728\n \u751F\u6210\u7684 Java \u7A0B\u5E8F\u5305\u4E2D\u5C06\u5176\u66FF\u6362\u4E3A <pkg>\u3002\u8BF7\u6CE8\u610F, \n \u5C06\u9996\u5148\u8FDB\u884C pkgPrefix \u66F4\u6539\u3002<t> \u5FC5\u987B\u4E0E\n \u5B8C\u6574\u7A0B\u5E8F\u5305\u540D\u5B8C\u5168\u5339\u914D\u3002\u53E6\u5916, <t> \u4E0D\u80FD\u4E3A\n org, org.omg \u6216 org.omg \u7684\u4EFB\u4F55\u5B50\u7A0B\u5E8F\u5305\u3002\n-skeletonName <xxx%yyy> \u6839\u636E\u6A21\u5F0F\u547D\u540D\u9AA8\u67B6\u3002\n \u9ED8\u8BA4\u503C\u4E3A:\n %POA \u8868\u793A POA \u57FA\u7C7B (-fserver \u6216 -fall) \n _%ImplBase \u8868\u793A oldImplBase \u57FA\u7C7B\n (-oldImplBase \u548C (-fserver \u6216 -fall))\u3002\n-td <dir> \u4F7F\u7528 <dir> \u8868\u793A\u8F93\u51FA\u76EE\u5F55\u4EE5\u4EE3\u66FF\n \u5F53\u524D\u76EE\u5F55\u3002\n-tieName <xxx%yyy> \u6839\u636E\u6A21\u5F0F\u547D\u540D tie\u3002\u9ED8\u8BA4\u503C\u4E3A:\n %POATie \u8868\u793A POA tie (-fserverTie \u6216 -fallTie) \n %_Tie \u8868\u793A oldImplBase tie\n (-oldImplBase \u548C (-fserverTie \u6216 -fallTie))\u3002\n-v, -verbose \u8BE6\u7EC6\u6A21\u5F0F\u3002\n-version \u663E\u793A\u7248\u672C\u53F7\u5E76\u9000\u51FA\u3002\n
diff --git a/src/share/classes/com/sun/tools/corba/se/logutil/IndentingPrintWriter.java b/src/share/classes/com/sun/tools/corba/se/logutil/IndentingPrintWriter.java
deleted file mode 100644
index 164b8cb..0000000
--- a/src/share/classes/com/sun/tools/corba/se/logutil/IndentingPrintWriter.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2003, 2009, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.corba.se.logutil;
-
-import java.io.PrintWriter ;
-import java.io.Writer ;
-import java.io.OutputStream ;
-import java.io.BufferedWriter ;
-import java.io.OutputStreamWriter ;
-import java.util.StringTokenizer ;
-
-public class IndentingPrintWriter extends PrintWriter {
- private int level = 0 ;
- private int indentWidth = 4 ;
- private String indentString = "" ;
-
- public void printMsg( String msg, Object... data )
- {
- // System.out.println( "printMsg called with msg=" + msg + " data=" + data ) ;
- StringTokenizer st = new StringTokenizer( msg, "@", true ) ;
- StringBuffer result = new StringBuffer() ;
- String token = null ;
- int pos = 0;
-
- while (st.hasMoreTokens()) {
- token = st.nextToken() ;
- if (token.equals("@")) {
- if (pos < data.length) {
- result.append( data[pos] );
- ++pos;
- } else {
- throw new Error( "List too short for message" ) ;
- }
- } else {
- result.append( token ) ;
- }
- }
-
- // System.out.println( "Printing result " + result + " to file" ) ;
- print( result ) ;
- println() ;
- }
-
- public IndentingPrintWriter (Writer out) {
- super( out, true ) ;
- // System.out.println( "Constructing a new IndentingPrintWriter with Writer " + out ) ;
- }
-
- public IndentingPrintWriter(Writer out, boolean autoFlush) {
- super( out, autoFlush ) ;
- // System.out.println( "Constructing a new IndentingPrintWriter with Writer " + out ) ;
- }
-
- public IndentingPrintWriter(OutputStream out) {
- super(out, true);
- // System.out.println( "Constructing a new IndentingPrintWriter with OutputStream " + out ) ;
- }
-
- public IndentingPrintWriter(OutputStream out, boolean autoFlush) {
- super(new BufferedWriter(new OutputStreamWriter(out)), autoFlush);
- // System.out.println( "Constructing a new IndentingPrintWriter with OutputStream " + out ) ;
- }
-
- public void setIndentWidth( int indentWidth )
- {
- this.indentWidth = indentWidth ;
- updateIndentString() ;
- }
-
- public void indent()
- {
- level++ ;
- updateIndentString() ;
- }
-
- public void undent()
- {
- if (level > 0) {
- level-- ;
- updateIndentString() ;
- }
- }
-
- private void updateIndentString()
- {
- int size = level * indentWidth ;
- StringBuffer sbuf = new StringBuffer( size ) ;
- for (int ctr = 0; ctr<size; ctr++ )
- sbuf.append( " " ) ;
- indentString = sbuf.toString() ;
- }
-
- // overridden from PrintWriter
- public void println()
- {
- super.println() ;
-
- print( indentString ) ;
- }
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/logutil/Input.java b/src/share/classes/com/sun/tools/corba/se/logutil/Input.java
deleted file mode 100644
index c0e5cf6..0000000
--- a/src/share/classes/com/sun/tools/corba/se/logutil/Input.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.corba.se.logutil;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStreamReader;
-import java.io.IOException;
-
-import java.util.LinkedList;
-import java.util.Queue;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class Input {
-
- /**
- * The name of the package this class will inhabit.
- */
- private String packageName;
-
- /**
- * The name of the generated class.
- */
- private String className;
-
- /**
- * The name of the group of exceptions handled by the class.
- */
- private String groupName;
-
- /**
- * The group of exceptions.
- */
- private Queue<InputException> exceptions;
-
- /**
- * Represents the current state of parsing the input.
- */
- private enum State
- {
- OUTER,
- IN_CLASS,
- IN_EXCEPTION_LIST
- };
-
- /**
- * Regular expression to match each code line.
- */
- private static final Pattern EXCEPTION_INFO_REGEX =
- Pattern.compile("(\\w+)\\s*(\\d+)\\s*(\\w+)");
-
- /**
- * Parses the specified file to create a new {@link Input}
- * object.
- *
- * @param filename the file to parse.
- * @throws FileNotFoundException if the file can't be found.
- * @throws IOException if an I/O error occurs.
- */
- public Input(final String filename)
- throws FileNotFoundException, IOException {
- BufferedReader r =
- new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
- State state = State.OUTER;
- InputException current = null;
- exceptions = new LinkedList<InputException>();
- String line;
- while ((line = r.readLine()) != null) {
- // Skip ; comments
- if (line.startsWith(";"))
- continue;
-
- int index = line.indexOf("(");
- if (index == -1)
- continue;
-
- switch (state) {
- case OUTER:
- state = State.IN_CLASS;
- String[] classInfo = line.substring(index).split(" ");
- packageName = classInfo[0].substring(2, classInfo[0].length() - 1);
- className = classInfo[1].substring(1, classInfo[1].length() - 1);
- groupName = classInfo[2];
- break;
- case IN_CLASS:
- state = State.IN_EXCEPTION_LIST;
- break;
- case IN_EXCEPTION_LIST:
- boolean inQuote = false;
- boolean inCode = false;
- boolean end = false;
- int start = index + 1;
- Queue<String> lines = new LinkedList<String>();
- for (int a = start; a < line.length(); ++a) {
- if (line.charAt(a) == '(' && !inCode && !inQuote) {
- if (current == null)
- current =
- new InputException(line.substring(start, a).trim());
- start = a + 1;
- inCode = true;
- }
- if (line.charAt(a) == '"')
- inQuote = !inQuote;
- if (line.charAt(a) == ')' && !inQuote) {
- if (inCode) {
- lines.offer(line.substring(start, a));
- inCode = false;
- } else
- end = true;
- }
- if (!end && a == line.length() - 1)
- line += r.readLine();
- }
- for (String l : lines) {
- int stringStart = l.indexOf("\"") + 1;
- int stringEnd = l.indexOf("\"", stringStart);
- Matcher matcher = EXCEPTION_INFO_REGEX.matcher(l.substring(0, stringStart));
- if (matcher.find())
- current.add(new InputCode(matcher.group(1),
- Integer.parseInt(matcher.group(2)),
- matcher.group(3),
- l.substring(stringStart, stringEnd)));
- }
- exceptions.offer(current);
- current = null;
- break;
- }
- }
- }
-
- /**
- * Returns the name of this group of exceptions.
- *
- * @return the name of this group of exceptions.
- */
- public String getGroupName()
- {
- return groupName;
- }
-
- /**
- * Returns the name of the package this class will go in.
- *
- * @return the name of the package.
- */
- public String getPackageName()
- {
- return packageName;
- }
-
- /**
- * Returns the name of the generated class.
- *
- * @return the name of the class.
- */
- public String getClassName()
- {
- return className;
- }
-
- /**
- * Returns the exceptions contained in this class.
- *
- * @return the exceptions.
- */
- public Queue<InputException> getExceptions() {
- return exceptions;
- }
-
- /**
- * Returns a textual representation of this input.
- *
- * @return a textual representation.
- */
- public String toString() {
- return getClass().getName() +
- "[packageName=" + packageName +
- ",className=" + className +
- ",groupName=" + groupName +
- ",exceptions=" + exceptions +
- "]";
- }
-
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/logutil/InputCode.java b/src/share/classes/com/sun/tools/corba/se/logutil/InputCode.java
deleted file mode 100644
index 1e26e72..0000000
--- a/src/share/classes/com/sun/tools/corba/se/logutil/InputCode.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.tools.corba.se.logutil;
-
-public class InputCode {
-
- /**
- * The name of this code.
- */
- private final String name;
-
- /**
- * The code.
- */
- private final int code;
-
- /**
- * The log level for this code.
- */
- private final String logLevel;
-
- /**
- * The error message for this code.
- */
- private final String message;
-
- /**
- * Creates a new error code with the specified name, code,
- * log level and error message.
- *
- * @param name the name of the new code.
- * @param code the code itself.
- * @param logLevel the level of severity of this error.
- * @param message the error message for this code.
- */
- public InputCode(final String name, final int code,
- final String logLevel, final String message) {
- this.name = name;
- this.code = code;
- this.logLevel = logLevel;
- this.message = message;
- }
-
- /**
- * Returns the name of this code.
- *
- * @return the name of the code.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns the code.
- *
- * @return the code.
- */
- public int getCode() {
- return code;
- }
-
- /**
- * Returns the severity of this code.
- *
- * @return the log level severity of the code.
- */
- public String getLogLevel() {
- return logLevel;
- }
-
- /**
- * Returns the error message for this code.
- *
- * @return the error message for this code.
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Returns a textual representation of this code.
- *
- * @return a textual representation.
- */
- public String toString() {
- return getClass().getName() +
- "[name=" + name +
- ",code=" + code +
- ",logLevel=" + logLevel +
- ",message=" + message +
- "]";
- }
-
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/logutil/InputException.java b/src/share/classes/com/sun/tools/corba/se/logutil/InputException.java
deleted file mode 100644
index d4aecc0..0000000
--- a/src/share/classes/com/sun/tools/corba/se/logutil/InputException.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.tools.corba.se.logutil;
-
-import java.util.LinkedList;
-import java.util.Queue;
-
-public class InputException {
-
- /**
- * The name of this exception.
- */
- private final String name;
-
- /**
- * The codes associated with this exception.
- */
- private final Queue<InputCode> codes;
-
- /**
- * Constructs a new {@link InputException} with the
- * specified name.
- *
- * @param name the name of the new exception;
- */
- public InputException(final String name) {
- this.name = name;
- codes = new LinkedList<InputCode>();
- }
-
- /**
- * Adds a new code to this exception.
- *
- * @param c the code to add.
- */
- public void add(InputCode c)
- {
- codes.offer(c);
- }
-
- /**
- * Returns the name of this exception.
- *
- * @return the exception's name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns the codes associated with this exception.
- *
- * @return the exception's codes.
- */
- public Queue<InputCode> getCodes() {
- return codes;
- }
-
- /**
- * Returns a textual representation of this exception.
- *
- * @return a textual representation.
- */
- public String toString() {
- return getClass().getName()
- + "[name=" + name
- + ",codes=" + codes
- + "]";
- }
-
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/logutil/MC.java b/src/share/classes/com/sun/tools/corba/se/logutil/MC.java
deleted file mode 100644
index c6a32a0..0000000
--- a/src/share/classes/com/sun/tools/corba/se/logutil/MC.java
+++ /dev/null
@@ -1,559 +0,0 @@
-/*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package com.sun.tools.corba.se.logutil;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import java.util.Arrays;
-import java.util.Date;
-import java.util.Formatter;
-import java.util.List;
-import java.util.Queue;
-
-public class MC {
-
- private static final String VERSION = "1.0";
-
- private static final List<String> SUN_EXCEPTION_GROUPS = Arrays.asList(new String[]
- { "SUNBASE", "ORBUTIL", "ACTIVATION", "NAMING", "INTERCEPTORS", "POA", "IOR", "UTIL" });
-
- private static final List<String> EXCEPTIONS = Arrays.asList(new String[]
- { "UNKNOWN", "BAD_PARAM", "NO_MEMORY", "IMP_LIMIT", "COMM_FAILURE", "INV_OBJREF", "NO_PERMISSION",
- "INTERNAL", "MARSHAL", "INITIALIZE", "NO_IMPLEMENT", "BAD_TYPECODE", "BAD_OPERATION", "NO_RESOURCES",
- "NO_RESPONSE", "PERSIST_STORE", "BAD_INV_ORDER", "TRANSIENT", "FREE_MEM", "INV_IDENT", "INV_FLAG",
- "INTF_REPOS", "BAD_CONTEXT", "OBJ_ADAPTER", "DATA_CONVERSION", "OBJECT_NOT_EXIST", "TRANSACTION_REQUIRED",
- "TRANSACTION_ROLLEDBACK", "INVALID_TRANSACTION", "INV_POLICY", "CODESET_INCOMPATIBLE", "REBIND",
- "TIMEOUT", "TRANSACTION_UNAVAILABLE", "BAD_QOS", "INVALID_ACTIVITY", "ACTIVITY_COMPLETED",
- "ACTIVITY_REQUIRED" });
-
- /**
- * Read the minor codes from the input file and
- * write out a resource file.
- *
- * @param inFile the file to read the codes from.
- * @param outDir the directory to write the resource file to.
- * @throws FileNotFoundException if the input file can not be found.
- * @throws IOException if an I/O error occurs.
- */
- private void makeResource(String inFile, String outDir)
- throws FileNotFoundException, IOException {
- writeResource(outDir, new Input(inFile));
- }
-
- /**
- * Create a new Java source file using the specified Scheme input file,
- * and writing the result to the given output directory.
- *
- * @param inFile the file to read the data from.
- * @param outDir the directory to write the Java class to.
- * @throws FileNotFoundException if the input file can not be found.
- * @throws IOException if an I/O error occurs.
- */
- private void makeClass(String inFile, String outDir)
- throws FileNotFoundException, IOException {
- writeClass(inFile, outDir, new Input(inFile));
- }
-
- /**
- * Writes out a Java source file using the data from the given
- * {@link Input} object. The result is written to {@code outDir}.
- * The name of the input file is just used in the header of the
- * resulting source file.
- *
- * @param inFile the name of the file the data was read from.
- * @param outDir the directory to write the Java class to.
- * @param input the parsed input data.
- * @throws FileNotFoundException if the output file can't be written.
- */
- private void writeClass(String inFile, String outDir, Input input)
- throws FileNotFoundException {
- String packageName = input.getPackageName();
- String className = input.getClassName();
- String groupName = input.getGroupName();
- Queue<InputException> exceptions = input.getExceptions();
- FileOutputStream file = new FileOutputStream(outDir + File.separator + className + ".java");
- IndentingPrintWriter pw = new IndentingPrintWriter(file);
-
- writeClassHeader(inFile, groupName, pw);
- pw.printMsg("package @ ;", packageName);
- pw.println();
- pw.println("import java.util.logging.Logger ;");
- pw.println("import java.util.logging.Level ;");
- pw.println();
- pw.println("import org.omg.CORBA.OMGVMCID ;");
- pw.println( "import com.sun.corba.se.impl.util.SUNVMCID ;");
- pw.println( "import org.omg.CORBA.CompletionStatus ;");
- pw.println( "import org.omg.CORBA.SystemException ;");
- pw.println();
- pw.println( "import com.sun.corba.se.spi.orb.ORB ;");
- pw.println();
- pw.println( "import com.sun.corba.se.spi.logging.LogWrapperFactory;");
- pw.println();
- pw.println( "import com.sun.corba.se.spi.logging.LogWrapperBase;");
- pw.println();
- writeImports(exceptions, pw);
- pw.println();
- pw.indent();
- pw.printMsg("public class @ extends LogWrapperBase {", className);
- pw.println();
- pw.printMsg("public @( Logger logger )", className);
- pw.indent();
- pw.println( "{");
- pw.undent();
- pw.println( "super( logger ) ;");
- pw.println( "}");
- pw.println();
- pw.flush();
- writeFactoryMethod(className, groupName, pw);
- writeExceptions(groupName, exceptions, className, pw);
- pw.undent();
- pw.println( );
- pw.println( "}");
- pw.flush();
- pw.close();
- }
-
- /**
- * Writes out the header of a Java source file.
- *
- * @param inFile the input file the file was generated from.
- * @param groupName the group of exceptions the Java source file is for.
- * @param pw the print writer used to write the output.
- */
- private void writeClassHeader(String inFile, String groupName,
- IndentingPrintWriter pw) {
- if (groupName.equals("OMG"))
- pw.println("// Log wrapper class for standard exceptions");
- else
- pw.printMsg("// Log wrapper class for Sun private system exceptions in group @",
- groupName);
- pw.println("//");
- pw.printMsg("// Generated by MC.java version @, DO NOT EDIT BY HAND!", VERSION);
- //pw.printMsg("// Generated from input file @ on @", inFile, new Date());
- pw.println();
- }
-
- /**
- * Write out the import list for the exceptions.
- *
- * @param groups the exceptions that were parsed.
- * @param pw the {@link IndentingPrintWriter} for writing to the file.
- */
- private void writeImports(Queue<InputException> exceptions,
- IndentingPrintWriter pw) {
- if (exceptions == null)
- return;
- for (InputException e : exceptions)
- pw.println("import org.omg.CORBA." + e.getName() + " ;");
- }
-
- /**
- * Write out the factory method for this group of exceptions.
- *
- * @param className the name of the generated class.
- * @param groupName the name of this group of exceptions.
- * @param pw the {@link IndentingPrintWriter} for writing to the file.
- */
- private void writeFactoryMethod(String className, String groupName,
- IndentingPrintWriter pw) {
- pw.indent();
- pw.println( "private static LogWrapperFactory factory = new LogWrapperFactory() {");
- pw.println( "public LogWrapperBase create( Logger logger )" );
- pw.indent();
- pw.println( "{");
- pw.undent();
- pw.printMsg("return new @( logger ) ;", className);
- pw.undent();
- pw.println( "}" );
- pw.println( "} ;" );
- pw.println();
- pw.printMsg("public static @ get( ORB orb, String logDomain )", className);
- pw.indent();
- pw.println( "{");
- pw.indent();
- pw.printMsg( "@ wrapper = ", className);
- pw.indent();
- pw.printMsg( "(@) orb.getLogWrapper( logDomain, ", className);
- pw.undent();
- pw.undent();
- pw.printMsg( "\"@\", factory ) ;", groupName);
- pw.undent();
- pw.println( "return wrapper ;" );
- pw.println( "} " );
- pw.println();
- pw.printMsg( "public static @ get( String logDomain )", className);
- pw.indent();
- pw.println( "{");
- pw.indent();
- pw.printMsg( "@ wrapper = ", className);
- pw.indent();
- pw.printMsg( "(@) ORB.staticGetLogWrapper( logDomain, ", className);
- pw.undent();
- pw.undent();
- pw.printMsg( "\"@\", factory ) ;", groupName);
- pw.undent();
- pw.println( "return wrapper ;" );
- pw.println( "} " );
- pw.println();
- }
-
- /**
- * Writes out the exceptions themselves.
- *
- * @param groupName the name of this group of exceptions.
- * @param exceptions the exceptions to write out.
- * @param className the name of the generated class.
- * @param pw the {@link IndentingPrintWriter} for writing to the file.
- */
- private void writeExceptions(String groupName, Queue<InputException> exceptions,
- String className, IndentingPrintWriter pw) {
- for (InputException e : exceptions) {
- pw.println("///////////////////////////////////////////////////////////");
- pw.printMsg("// @", e.getName());
- pw.println("///////////////////////////////////////////////////////////");
- pw.println();
- for (InputCode c : e.getCodes())
- writeMethods(groupName, e.getName(), c.getName(), c.getCode(),
- c.getLogLevel(), className, StringUtil.countArgs(c.getMessage()), pw);
- pw.flush();
- }
- }
-
- /**
- * Writes out the methods for a particular error.
- *
- * @param groupName the name of this group of exceptions.
- * @param exceptionName the name of this particular exception.
- * @param errorName the name of this particular error.
- * @param code the minor code for this particular error.
- * @param ident the name of the error in mixed-case identifier form.
- * @param level the level at which to place log messages.
- * @param className the name of the class for this group of exceptions.
- * @param numParams the number of parameters the detail message takes.
- * @param pw the print writer for writing to the file.
- */
- private void writeMethods(String groupName, String exceptionName, String errorName,
- int code, String level, String className, int numParams,
- IndentingPrintWriter pw) {
- String ident = StringUtil.toMixedCase(errorName);
- pw.printMsg("public static final int @ = @ ;", errorName, getBase(groupName, code));
- pw.println();
- pw.flush();
- writeMethodStatusCause(groupName, exceptionName, errorName, ident, level,
- numParams, className, pw);
- pw.println();
- pw.flush();
- writeMethodStatus(exceptionName, ident, numParams, pw);
- pw.println();
- pw.flush();
- writeMethodCause(exceptionName, ident, numParams, pw);
- pw.println();
- pw.flush();
- writeMethodNoArgs(exceptionName, ident, numParams, pw);
- pw.println();
- pw.flush();
- }
-
- /**
- * Writes out a method for an error that takes a
- * {@link org.omg.CORBA.CompletionStatus} and a cause.
- *
- * @param groupName the name of this group of exceptions.
- * @param exceptionName the name of this particular exception.
- * @param errorName the name of this particular error.
- * @param ident the name of the error in mixed-case identifier form.
- * @param logLevel the level at which to place log messages.
- * @param numParams the number of parameters the detail message takes.
- * @param className the name of the class for this group of exceptions.
- * @param pw the print writer for writing to the file.
- */
- private void writeMethodStatusCause(String groupName, String exceptionName,
- String errorName, String ident,
- String logLevel, int numParams,
- String className, IndentingPrintWriter pw) {
- pw.indent();
- pw.printMsg( "public @ @( CompletionStatus cs, Throwable t@) {", exceptionName,
- ident, makeDeclArgs(true, numParams));
- pw.printMsg( "@ exc = new @( @, cs ) ;", exceptionName, exceptionName, errorName);
- pw.indent();
- pw.println( "if (t != null)" );
- pw.undent();
- pw.println( "exc.initCause( t ) ;" );
- pw.println();
- pw.indent();
- pw.printMsg( "if (logger.isLoggable( Level.@ )) {", logLevel);
- if (numParams > 0) {
- pw.printMsg( "Object[] parameters = new Object[@] ;", numParams);
- for (int a = 0; a < numParams; ++a)
- pw.printMsg("parameters[@] = arg@ ;", a, a);
- } else
- pw.println( "Object[] parameters = null ;");
- pw.indent();
- pw.printMsg( "doLog( Level.@, \"@.@\",", logLevel, groupName, ident);
- pw.undent();
- pw.undent();
- pw.printMsg( "parameters, @.class, exc ) ;", className);
- pw.println( "}");
- pw.println();
-
- pw.undent();
- pw.println( "return exc ;");
- pw.println( "}");
- }
-
- /**
- * Writes out a method for an error that takes a
- * {@link org.omg.CORBA.CompletionStatus}.
- *
- * @param exceptionName the name of this particular exception.
- * @param ident the name of the error in mixed-case identifier form.
- * @param numParams the number of parameters the detail message takes.
- * @param pw the print writer for writing to the file.
- */
- private void writeMethodStatus(String exceptionName, String ident,
- int numParams, IndentingPrintWriter pw) {
- pw.indent();
- pw.printMsg("public @ @( CompletionStatus cs@) {", exceptionName,
- ident, makeDeclArgs(true, numParams));
- pw.undent();
- pw.printMsg("return @( cs, null@ ) ;", ident, makeCallArgs(true, numParams));
- pw.println("}");
- }
-
- /**
- * Writes out a method for an error that takes a cause.
- *
- * @param exceptionName the name of this particular exception.
- * @param ident the name of the error in mixed-case identifier form.
- * @param numParams the number of parameters the detail message takes.
- * @param pw the print writer for writing to the file.
- */
- private void writeMethodCause(String exceptionName, String ident,
- int numParams, IndentingPrintWriter pw) {
- pw.indent();
- pw.printMsg("public @ @( Throwable t@) {", exceptionName, ident,
- makeDeclArgs(true, numParams));
- pw.undent();
- pw.printMsg("return @( CompletionStatus.COMPLETED_NO, t@ ) ;", ident,
- makeCallArgs(true, numParams));
- pw.println("}");
- }
-
- /**
- * Writes out a method for an error that takes no arguments.
- *
- * @param exceptionName the name of this particular exception.
- * @param ident the name of the error in mixed-case identifier form.
- * @param numParams the number of parameters the detail message takes.
- * @param pw the print writer for writing to the file.
- */
- private void writeMethodNoArgs(String exceptionName, String ident,
- int numParams, IndentingPrintWriter pw) {
-
- pw.indent();
- pw.printMsg("public @ @( @) {", exceptionName, ident,
- makeDeclArgs(false, numParams));
- pw.undent();
- pw.printMsg("return @( CompletionStatus.COMPLETED_NO, null@ ) ;",
- ident, makeCallArgs(true, numParams));
- pw.println("}");
- }
-
- /**
- * Returns a list of comma-separated arguments with type declarations.
- *
- * @param leadingComma true if the list should start with a comma.
- * @param numArgs the number of arguments to generate.
- * @return the generated string.
- */
- private String makeDeclArgs(boolean leadingComma, int numArgs) {
- return makeArgString("Object arg", leadingComma, numArgs);
- }
-
- /**
- * Returns a list of comma-separated arguments without type declarations.
- *
- * @param leadingComma true if the list should start with a comma.
- * @param numArgs the number of arguments to generate.
- * @return the generated string.
- */
- private String makeCallArgs(boolean leadingComma, int numArgs) {
- return makeArgString("arg", leadingComma, numArgs);
- }
-
- /**
- * Returns a list of comma-separated arguments.
- *
- * @param prefixString the string with which to prefix each argument.
- * @param leadingComma true if the list should start with a comma.
- * @param numArgs the number of arguments to generate.
- * @return the generated string.
- */
- private String makeArgString(String prefixString, boolean leadingComma,
- int numArgs) {
- if (numArgs == 0)
- return " ";
- if (numArgs == 1) {
- if (leadingComma)
- return ", " + prefixString + (numArgs - 1);
- else
- return " " + prefixString + (numArgs - 1);
- }
- return makeArgString(prefixString, leadingComma, numArgs - 1) +
- ", " + prefixString + (numArgs - 1);
- }
-
- /**
- * Returns the {@link String} containing the calculation of the
- * error code.
- *
- * @param groupName the group of exception to which the code belongs.
- * @param code the minor code number representing the exception within the group.
- * @return the unique error code.
- */
- private String getBase(String groupName, int code) {
- if (groupName.equals("OMG"))
- return "OMGVMCID.value + " + code;
- else
- return "SUNVMCID.value + " + (code + getSunBaseNumber(groupName));
- }
-
- /**
- * Returns the base number for Sun-specific exceptions.
- *
- * @return the base number.
- */
- private int getSunBaseNumber(String groupName) {
- return 200 * SUN_EXCEPTION_GROUPS.indexOf(groupName);
- }
-
- /**
- * Writes out a resource file using the data from the given
- * {@link Input} object. The result is written to {@code outDir}.
- *
- * @param outDir the directory to write the Java class to.
- * @param input the parsed input data.
- * @throws FileNotFoundException if the output file can't be written.
- */
- private void writeResource(String outDir, Input input)
- throws FileNotFoundException {
- FileOutputStream file = new FileOutputStream(outDir + File.separator +
- input.getClassName() + ".resource");
- IndentingPrintWriter pw = new IndentingPrintWriter(file);
- String groupName = input.getGroupName();
- for (InputException e : input.getExceptions()) {
- String exName = e.getName();
- for (InputCode c : e.getCodes()) {
- String ident = StringUtil.toMixedCase(c.getName());
- pw.printMsg("@.@=\"@: (@) @\"", groupName, ident,
- getMessageID(groupName, exName, c.getCode()), exName, c.getMessage());
- }
- pw.flush();
- }
- pw.close();
- }
-
- /**
- * Returns the message ID corresponding to the given group name,
- * exception name and error code.
- *
- * @param groupName the name of the group of exceptions.
- * @param exception the name of the particular exception.
- * @param code an error code from the given exception.
- * @return the message ID.
- */
- private String getMessageID(String groupName, String exceptionName, int code) {
- if (groupName.equals("OMG"))
- return getStandardMessageID(exceptionName, code);
- else
- return getSunMessageID(groupName, exceptionName, code);
- }
-
- /**
- * Returns the standard (OMG) message ID corresponding to the given
- * exception name and error code.
- *
- * @param exceptionName the name of the particular exception.
- * @param code an error code from the given exception.
- * @return the message ID.
- */
- private String getStandardMessageID(String exceptionName, int code) {
- return new Formatter().format("IOP%s0%04d", getExceptionID(exceptionName),
- code).toString();
- }
-
- /**
- * Returns the Sun message ID corresponding to the given group name,
- * exception name and error code.
- *
- * @param groupName the name of the group of exceptions.
- * @param exceptionName the name of the particular exception.
- * @param code an error code from the given exception.
- * @return the message ID.
- */
- private String getSunMessageID(String groupName, String exceptionName, int code) {
- return new Formatter().format("IOP%s1%04d", getExceptionID(exceptionName),
- getSunBaseNumber(groupName) + code).toString();
- }
-
- /**
- * Returns the exception ID corresponding to the given exception name.
- *
- * @param exceptionName the name of the particular exception.
- * @return the message ID.
- */
- private String getExceptionID(String exceptionName) {
- return new Formatter().format("%03d", EXCEPTIONS.indexOf(exceptionName)).toString();
- }
-
- /**
- * Entry point for running the generator from the command
- * line. Users can specify either "make-class" or "make-resource"
- * as the first argument to generate the specified type of file.
- *
- * @param args the command-line arguments.
- * @throws FileNotFoundException if the input file can not be found.
- * @throws IOException if an I/O error occurs.
- */
- public static void main(String[] args)
- throws FileNotFoundException, IOException
- {
- if (args.length < 3)
- {
- System.err.println("(make-class|make-resource) <input file> <output dir>");
- System.exit(-1);
- }
- if (args[0].equals("make-class"))
- new MC().makeClass(args[1], args[2]);
- else if (args[0].equals("make-resource"))
- new MC().makeResource(args[1], args[2]);
- else
- System.err.println("Invalid command: " + args[0]);
- }
-
-}
diff --git a/src/share/classes/com/sun/tools/corba/se/logutil/Makefile b/src/share/classes/com/sun/tools/corba/se/logutil/Makefile
deleted file mode 100644
index 9fcb326..0000000
--- a/src/share/classes/com/sun/tools/corba/se/logutil/Makefile
+++ /dev/null
@@ -1,93 +0,0 @@
-#
-# Copyright (c) 2003, Oracle and/or its affiliates. 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. Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-PACKAGE=com/sun/kenc/util
-
-CLASSES=LogWrapperBase IndentingPrintWriter StringUtil
-SOURCE=$(CLASSES:%=$(PACKAGE)/%.java)
-OBJECT=$(CLASSES:%=$(PACKAGE)/%.class)
-
-MCROOTS= Activation Interceptors IOR Naming ORBUtil POA Util OMG
-MCFILES=$(MCROOTS:%=data/%.mc)
-MCSOURCE=$(MCROOTS:%=$(PACKAGE)/%SystemException.java)
-MCCLASS=$(MCROOTS:%=$(PACKAGE)/%SystemException.class)
-MCRESOURCE=$(MCROOTS:%=resources/%SystemException.resource)
-
-JARDIR=lib
-UTILJAR=$(JARDIR)/util.jar
-JSCHEMEJAR=$(JARDIR)/jscheme.jar
-JARS=$(UTILJAR):$(JSCHEMEJAR)
-
-all: mkdir jar resources classes
-
-mkdir :
- @-mkdir resources
-
-clean:
- @-rm $(OBJECT) $(MCSOURCE) $(MCOBJECT) $(MCCLASS) $(MCRESOURCE) $(UTILJAR)
-
-test:
- @echo "PACKAGE :" $(PACKAGE)
- @echo "CLASSES :" $(CLASSES)
- @echo "SOURCE :" $(SOURCE)
- @echo "OBJECT :" $(OBJECT)
- @echo "MCROOTS :" $(MCROOTS)
- @echo "MCFILES :" $(MCFILES)
- @echo "MCCLASS :" $(MCCLASS)
- @echo "MCRESOURCE :" $(MCRESOURCE)
-
-jar: $(UTILJAR)
-
-$(UTILJAR) : $(OBJECT)
- jar cvf $(JARDIR)/util.jar $(OBJECT)
-
-$(OBJECT) : $(SOURCE)
-
-classes: $(MCCLASS)
-
-$(MCCLASS) : $(MCSOURCE)
-
-$(MCSOURCE) : $(MCFILES)
-
-resources: $(MCRESOURCE)
-
-$(MCRESOURCE) : $(MCFILES)
-
-# This target does not compile, because the generated source code requires
-# com.sun.corba.se.impl.util.SUNVMCID, which would normally be built in the
-# ee package. This should not be a problem once everything is merged into the
-# workspace.
-genclasses: $(MCCLASS)
-
-$(PACKAGE)/%SystemException.java : data/%.mc
- ./mc make-class $<
- mv *SystemException.java $(PACKAGE)
-
-resources/%SystemException.resource : data/%.mc
- ./mc make-resource $<
- mv *.resource resources
-
-$(PACKAGE)/%.class : $(PACKAGE)/%.java
- javac -classpath $(JARS) $<
diff --git a/src/share/classes/com/sun/tools/corba/se/logutil/StringUtil.java b/src/share/classes/com/sun/tools/corba/se/logutil/StringUtil.java
deleted file mode 100644
index 2eacfe9..0000000
--- a/src/share/classes/com/sun/tools/corba/se/logutil/StringUtil.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2003, Oracle and/or its affiliates. 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. Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.corba.se.logutil;
-
-public abstract class StringUtil {
- /** Take a string containing underscores, and return a string
- * with the underscore removed, and all characters exception in lower
- * case except the characters after the underscores.
- */
- public static String toMixedCase( String str )
- {
- StringBuffer sbuf = new StringBuffer( str.length() ) ;
- boolean uppercaseNext = false ;
- for (int ctr=0; ctr<str.length(); ctr++) {
- char ch = str.charAt( ctr ) ;
-
- if (ch == '_') {
- uppercaseNext = true ;
- } else if (uppercaseNext) {
- sbuf.append( Character.toUpperCase( ch ) ) ;
- uppercaseNext = false ;
- } else {
- sbuf.append( Character.toLowerCase( ch ) ) ;
- }
- }
-
- return sbuf.toString() ;
- }
-
- public static int countArgs( String str )
- {
- int result = 0 ;
- for( int ctr = 0; ctr<str.length(); ctr++ )
- if (str.charAt(ctr) == '{')
- result++ ;
-
- return result ;
- }
-}