corba/src/share/classes/com/sun/tools/corba/se/idl/Arguments.java
author ohair
Tue, 25 May 2010 15:52:11 -0700
changeset 5555 b2b5ed3f0d0d
parent 4 02bb8761fcce
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     1
/*
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     2
 * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
02bb8761fcce Initial load
duke
parents:
diff changeset
     4
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
02bb8761fcce Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
4
02bb8761fcce Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    10
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
02bb8761fcce Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
02bb8761fcce Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
02bb8761fcce Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
02bb8761fcce Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
02bb8761fcce Initial load
duke
parents:
diff changeset
    16
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
02bb8761fcce Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
02bb8761fcce Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
02bb8761fcce Initial load
duke
parents:
diff changeset
    20
 *
5555
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
b2b5ed3f0d0d 6943119: Rebrand source copyright notices
ohair
parents: 4
diff changeset
    23
 * questions.
4
02bb8761fcce Initial load
duke
parents:
diff changeset
    24
 */
02bb8761fcce Initial load
duke
parents:
diff changeset
    25
/*
02bb8761fcce Initial load
duke
parents:
diff changeset
    26
 * COMPONENT_NAME: idl.parser
02bb8761fcce Initial load
duke
parents:
diff changeset
    27
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    28
 * ORIGINS: 27
02bb8761fcce Initial load
duke
parents:
diff changeset
    29
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    30
 * Licensed Materials - Property of IBM
02bb8761fcce Initial load
duke
parents:
diff changeset
    31
 * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
02bb8761fcce Initial load
duke
parents:
diff changeset
    32
 * RMI-IIOP v1.0
02bb8761fcce Initial load
duke
parents:
diff changeset
    33
 *
02bb8761fcce Initial load
duke
parents:
diff changeset
    34
 */
02bb8761fcce Initial load
duke
parents:
diff changeset
    35
02bb8761fcce Initial load
duke
parents:
diff changeset
    36
package com.sun.tools.corba.se.idl;
02bb8761fcce Initial load
duke
parents:
diff changeset
    37
02bb8761fcce Initial load
duke
parents:
diff changeset
    38
// NOTES:
02bb8761fcce Initial load
duke
parents:
diff changeset
    39
// -F46082.51<daz> Remove -stateful option. "Stateful interfaces" obsolete.
02bb8761fcce Initial load
duke
parents:
diff changeset
    40
// -D58319<daz> Add -version option.  Note that this may occur as the last
02bb8761fcce Initial load
duke
parents:
diff changeset
    41
//  argument on the command-line.
02bb8761fcce Initial load
duke
parents:
diff changeset
    42
// -F60858.1<daz> Add -corba [level] option.  Accept IDL upto this level, and
02bb8761fcce Initial load
duke
parents:
diff changeset
    43
//  behave in a "proprietary manner" otherwise.
02bb8761fcce Initial load
duke
parents:
diff changeset
    44
// -D62023<daz> Add -noWarn option to supress warnings.
02bb8761fcce Initial load
duke
parents:
diff changeset
    45
02bb8761fcce Initial load
duke
parents:
diff changeset
    46
import java.io.DataInputStream;
02bb8761fcce Initial load
duke
parents:
diff changeset
    47
import java.io.IOException;
02bb8761fcce Initial load
duke
parents:
diff changeset
    48
import java.util.Hashtable;
02bb8761fcce Initial load
duke
parents:
diff changeset
    49
import java.util.Properties;
02bb8761fcce Initial load
duke
parents:
diff changeset
    50
import java.util.Vector;
02bb8761fcce Initial load
duke
parents:
diff changeset
    51
import java.util.StringTokenizer;
02bb8761fcce Initial load
duke
parents:
diff changeset
    52
import java.lang.reflect.Modifier;
02bb8761fcce Initial load
duke
parents:
diff changeset
    53
import java.lang.reflect.Field;
02bb8761fcce Initial load
duke
parents:
diff changeset
    54
02bb8761fcce Initial load
duke
parents:
diff changeset
    55
import com.sun.tools.corba.se.idl.som.cff.FileLocator;
02bb8761fcce Initial load
duke
parents:
diff changeset
    56
02bb8761fcce Initial load
duke
parents:
diff changeset
    57
/**
02bb8761fcce Initial load
duke
parents:
diff changeset
    58
 * This class is responsible for parsing the command line arguments to the
02bb8761fcce Initial load
duke
parents:
diff changeset
    59
 * compiler.  To add new arguments to the compiler, this class must be extended
02bb8761fcce Initial load
duke
parents:
diff changeset
    60
 * and the parseOtherArgs method overridden.
02bb8761fcce Initial load
duke
parents:
diff changeset
    61
 **/
02bb8761fcce Initial load
duke
parents:
diff changeset
    62
public class Arguments
02bb8761fcce Initial load
duke
parents:
diff changeset
    63
{
02bb8761fcce Initial load
duke
parents:
diff changeset
    64
  /**
02bb8761fcce Initial load
duke
parents:
diff changeset
    65
   * Method parseOtherArgs() is called when the framework detects arguments
02bb8761fcce Initial load
duke
parents:
diff changeset
    66
   * which are unknown to it.  The default implementation of this method simply
02bb8761fcce Initial load
duke
parents:
diff changeset
    67
   * throws an InvalidArgument exception.  Any overriding implementation
02bb8761fcce Initial load
duke
parents:
diff changeset
    68
   * must check the arguments passed to it for validity and process the
02bb8761fcce Initial load
duke
parents:
diff changeset
    69
   * arguments appropriately.  If it detects an invalid argument, it should
02bb8761fcce Initial load
duke
parents:
diff changeset
    70
   * throw an InvalidArgument exception.  Arguments MUST be of the form
02bb8761fcce Initial load
duke
parents:
diff changeset
    71
   * `/<arg> [<qualifiers>]' or `-<arg> [<qualifiers>]' where <qualifiers>
02bb8761fcce Initial load
duke
parents:
diff changeset
    72
   * is optional (for example, -iC:\includes, `C:\includes' is the qualifier
02bb8761fcce Initial load
duke
parents:
diff changeset
    73
   * for the argument `i').
02bb8761fcce Initial load
duke
parents:
diff changeset
    74
   * @param args The arguments which are unknown by the framework.
02bb8761fcce Initial load
duke
parents:
diff changeset
    75
   * @param properties Environment-style properties collected from the
02bb8761fcce Initial load
duke
parents:
diff changeset
    76
   * file idl.config.
02bb8761fcce Initial load
duke
parents:
diff changeset
    77
   * @exception idl.InvalidArgument if the argument is unknown.
02bb8761fcce Initial load
duke
parents:
diff changeset
    78
   **/
02bb8761fcce Initial load
duke
parents:
diff changeset
    79
  protected void parseOtherArgs (String[] args, Properties properties) throws InvalidArgument
02bb8761fcce Initial load
duke
parents:
diff changeset
    80
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
    81
    if (args.length > 0)
02bb8761fcce Initial load
duke
parents:
diff changeset
    82
      throw new InvalidArgument (args[0]);
02bb8761fcce Initial load
duke
parents:
diff changeset
    83
  } // parseOtherArgs
02bb8761fcce Initial load
duke
parents:
diff changeset
    84
02bb8761fcce Initial load
duke
parents:
diff changeset
    85
02bb8761fcce Initial load
duke
parents:
diff changeset
    86
    protected void setDebugFlags( String args )
02bb8761fcce Initial load
duke
parents:
diff changeset
    87
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
    88
        StringTokenizer st = new StringTokenizer( args, "," ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    89
        while (st.hasMoreTokens()) {
02bb8761fcce Initial load
duke
parents:
diff changeset
    90
            String token = st.nextToken() ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    91
02bb8761fcce Initial load
duke
parents:
diff changeset
    92
            // If there is a public boolean data member in this class
02bb8761fcce Initial load
duke
parents:
diff changeset
    93
            // named token + "DebugFlag", set it to true.
02bb8761fcce Initial load
duke
parents:
diff changeset
    94
            try {
02bb8761fcce Initial load
duke
parents:
diff changeset
    95
                Field fld = this.getClass().getField( token + "DebugFlag" ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    96
                int mod = fld.getModifiers() ;
02bb8761fcce Initial load
duke
parents:
diff changeset
    97
                if (Modifier.isPublic( mod ) && !Modifier.isStatic( mod ))
02bb8761fcce Initial load
duke
parents:
diff changeset
    98
                    if (fld.getType() == boolean.class)
02bb8761fcce Initial load
duke
parents:
diff changeset
    99
                        fld.setBoolean( this, true ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   100
            } catch (Exception exc) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   101
                // ignore it
02bb8761fcce Initial load
duke
parents:
diff changeset
   102
            }
02bb8761fcce Initial load
duke
parents:
diff changeset
   103
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   104
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   105
02bb8761fcce Initial load
duke
parents:
diff changeset
   106
    /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   107
    * Collect the command-line parameters.
02bb8761fcce Initial load
duke
parents:
diff changeset
   108
    **/
02bb8761fcce Initial load
duke
parents:
diff changeset
   109
    void parseArgs (String[] args) throws InvalidArgument {
02bb8761fcce Initial load
duke
parents:
diff changeset
   110
        Vector unknownArgs = new Vector ();
02bb8761fcce Initial load
duke
parents:
diff changeset
   111
        int    i           = 0;
02bb8761fcce Initial load
duke
parents:
diff changeset
   112
02bb8761fcce Initial load
duke
parents:
diff changeset
   113
        try {
02bb8761fcce Initial load
duke
parents:
diff changeset
   114
            // Process command line parameters
02bb8761fcce Initial load
duke
parents:
diff changeset
   115
            for (i = 0; i < args.length - 1; ++i) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   116
                String lcArg = args[i].toLowerCase ();
02bb8761fcce Initial load
duke
parents:
diff changeset
   117
                if (lcArg.charAt (0) != '-' && lcArg.charAt (0) != '/')
02bb8761fcce Initial load
duke
parents:
diff changeset
   118
                    throw new InvalidArgument (args[i]);
02bb8761fcce Initial load
duke
parents:
diff changeset
   119
                if (lcArg.charAt (0) == '-' ) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   120
                    lcArg = lcArg.substring (1);
02bb8761fcce Initial load
duke
parents:
diff changeset
   121
                }
02bb8761fcce Initial load
duke
parents:
diff changeset
   122
02bb8761fcce Initial load
duke
parents:
diff changeset
   123
                // Include path
02bb8761fcce Initial load
duke
parents:
diff changeset
   124
                if (lcArg.equals ("i")) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   125
                    includePaths.addElement (args[++i]);
02bb8761fcce Initial load
duke
parents:
diff changeset
   126
                } else if (lcArg.startsWith ("i")) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   127
                    includePaths.addElement (args[i].substring (2));
02bb8761fcce Initial load
duke
parents:
diff changeset
   128
                } else if (lcArg.equals ("v") || lcArg.equals ("verbose")) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   129
                    // Verbose mode
02bb8761fcce Initial load
duke
parents:
diff changeset
   130
                    verbose = true;
02bb8761fcce Initial load
duke
parents:
diff changeset
   131
                } else if (lcArg.equals ("d")) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   132
                    // Define symbol
02bb8761fcce Initial load
duke
parents:
diff changeset
   133
                    definedSymbols.put (args[++i], "");
02bb8761fcce Initial load
duke
parents:
diff changeset
   134
                } else if (lcArg.equals( "debug" )) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   135
                    // Turn on debug flags
02bb8761fcce Initial load
duke
parents:
diff changeset
   136
                    setDebugFlags( args[++i] ) ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   137
                } else if (lcArg.startsWith ("d")) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   138
                    definedSymbols.put (args[i].substring (2), "");
02bb8761fcce Initial load
duke
parents:
diff changeset
   139
                } else if (lcArg.equals ("emitall")) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   140
                    // Emit bindings for included sources
02bb8761fcce Initial load
duke
parents:
diff changeset
   141
                    emitAll = true;
02bb8761fcce Initial load
duke
parents:
diff changeset
   142
                } else if (lcArg.equals ("keep")) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   143
                    // Keep old files
02bb8761fcce Initial load
duke
parents:
diff changeset
   144
                    keepOldFiles = true;
02bb8761fcce Initial load
duke
parents:
diff changeset
   145
                } else if (lcArg.equals ("nowarn")) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   146
                    // <d62023> Suppress warnings
02bb8761fcce Initial load
duke
parents:
diff changeset
   147
                    noWarn = true;
02bb8761fcce Initial load
duke
parents:
diff changeset
   148
                } else if (lcArg.equals ("trace")) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   149
                    // Allow tracing.
02bb8761fcce Initial load
duke
parents:
diff changeset
   150
                    Runtime.getRuntime ().traceMethodCalls (true);
02bb8761fcce Initial load
duke
parents:
diff changeset
   151
                }
02bb8761fcce Initial load
duke
parents:
diff changeset
   152
                // <f46082.51> Remove -stateful feature.
02bb8761fcce Initial load
duke
parents:
diff changeset
   153
                //else if (lcArg.equals ("stateful"))
02bb8761fcce Initial load
duke
parents:
diff changeset
   154
                //{
02bb8761fcce Initial load
duke
parents:
diff changeset
   155
                //  Emit stateful bindings.
02bb8761fcce Initial load
duke
parents:
diff changeset
   156
                //  parseStateful = true;
02bb8761fcce Initial load
duke
parents:
diff changeset
   157
                //}
02bb8761fcce Initial load
duke
parents:
diff changeset
   158
                // CPPModule
02bb8761fcce Initial load
duke
parents:
diff changeset
   159
                else if ( lcArg.equals ("cppmodule")) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   160
                    cppModule = true;
02bb8761fcce Initial load
duke
parents:
diff changeset
   161
                } else if (lcArg.equals ("version"))  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   162
                    // Version
02bb8761fcce Initial load
duke
parents:
diff changeset
   163
                    versionRequest = true;
02bb8761fcce Initial load
duke
parents:
diff changeset
   164
                } else if (lcArg.equals ("corba"))  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   165
                    // CORBA level
02bb8761fcce Initial load
duke
parents:
diff changeset
   166
                    if (i + 1 >= args.length)
02bb8761fcce Initial load
duke
parents:
diff changeset
   167
                        throw new InvalidArgument (args[i]);
02bb8761fcce Initial load
duke
parents:
diff changeset
   168
                    String level = args[++i];
02bb8761fcce Initial load
duke
parents:
diff changeset
   169
                    if (level.charAt (0) == '-')
02bb8761fcce Initial load
duke
parents:
diff changeset
   170
                        throw new InvalidArgument (args[i - 1]);
02bb8761fcce Initial load
duke
parents:
diff changeset
   171
                    try {
02bb8761fcce Initial load
duke
parents:
diff changeset
   172
                        corbaLevel = new Float (level).floatValue ();
02bb8761fcce Initial load
duke
parents:
diff changeset
   173
                    } catch (NumberFormatException e) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   174
                        throw new InvalidArgument (args[i]);
02bb8761fcce Initial load
duke
parents:
diff changeset
   175
                    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   176
                } else {
02bb8761fcce Initial load
duke
parents:
diff changeset
   177
                    unknownArgs.addElement (args[i]);
02bb8761fcce Initial load
duke
parents:
diff changeset
   178
                    ++i;
02bb8761fcce Initial load
duke
parents:
diff changeset
   179
                    while (i < (args.length - 1) &&
02bb8761fcce Initial load
duke
parents:
diff changeset
   180
                        args[i].charAt (0) != '-' &&
02bb8761fcce Initial load
duke
parents:
diff changeset
   181
                        args[i].charAt (0) != '/') {
02bb8761fcce Initial load
duke
parents:
diff changeset
   182
                        unknownArgs.addElement (args[i++]);
02bb8761fcce Initial load
duke
parents:
diff changeset
   183
                    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   184
                    --i;
02bb8761fcce Initial load
duke
parents:
diff changeset
   185
                }
02bb8761fcce Initial load
duke
parents:
diff changeset
   186
            }
02bb8761fcce Initial load
duke
parents:
diff changeset
   187
        } catch (ArrayIndexOutOfBoundsException e) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   188
            // If there is any array indexing problem, it is probably
02bb8761fcce Initial load
duke
parents:
diff changeset
   189
            // because the qualifier on the last argument is missing.
02bb8761fcce Initial load
duke
parents:
diff changeset
   190
            // Report that this last argument is invalid.
02bb8761fcce Initial load
duke
parents:
diff changeset
   191
            throw new InvalidArgument (args[args.length - 1]);
02bb8761fcce Initial load
duke
parents:
diff changeset
   192
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   193
02bb8761fcce Initial load
duke
parents:
diff changeset
   194
        // <d57319>
02bb8761fcce Initial load
duke
parents:
diff changeset
   195
        // The last argument is the file argument or "-version", which may
02bb8761fcce Initial load
duke
parents:
diff changeset
   196
        // be specified without a file argument.
02bb8761fcce Initial load
duke
parents:
diff changeset
   197
        if (i == args.length - 1) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   198
            if (args[i].toLowerCase ().equals ("-version"))
02bb8761fcce Initial load
duke
parents:
diff changeset
   199
                versionRequest = true;
02bb8761fcce Initial load
duke
parents:
diff changeset
   200
            else
02bb8761fcce Initial load
duke
parents:
diff changeset
   201
                file = args[i];
02bb8761fcce Initial load
duke
parents:
diff changeset
   202
        } else
02bb8761fcce Initial load
duke
parents:
diff changeset
   203
            throw new InvalidArgument ();
02bb8761fcce Initial load
duke
parents:
diff changeset
   204
02bb8761fcce Initial load
duke
parents:
diff changeset
   205
        // Get and process the idl.config file.
02bb8761fcce Initial load
duke
parents:
diff changeset
   206
        Properties props = new Properties ();
02bb8761fcce Initial load
duke
parents:
diff changeset
   207
        try {
02bb8761fcce Initial load
duke
parents:
diff changeset
   208
          DataInputStream stream = FileLocator.locateFileInClassPath ("idl.config");
02bb8761fcce Initial load
duke
parents:
diff changeset
   209
          props.load (stream);
02bb8761fcce Initial load
duke
parents:
diff changeset
   210
          addIncludePaths (props);
02bb8761fcce Initial load
duke
parents:
diff changeset
   211
        } catch (IOException e) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   212
        }
02bb8761fcce Initial load
duke
parents:
diff changeset
   213
02bb8761fcce Initial load
duke
parents:
diff changeset
   214
        // Call parseOtherArgs.  By default, if there are unknown args,
02bb8761fcce Initial load
duke
parents:
diff changeset
   215
        // InvalidArgument is called.  A call to parseOtherArgs is useful
02bb8761fcce Initial load
duke
parents:
diff changeset
   216
        // only when this framework has been extended.
02bb8761fcce Initial load
duke
parents:
diff changeset
   217
        String[] otherArgs;
02bb8761fcce Initial load
duke
parents:
diff changeset
   218
        if (unknownArgs.size () > 0) {
02bb8761fcce Initial load
duke
parents:
diff changeset
   219
            otherArgs = new String[unknownArgs.size ()];
02bb8761fcce Initial load
duke
parents:
diff changeset
   220
            unknownArgs.copyInto (otherArgs);
02bb8761fcce Initial load
duke
parents:
diff changeset
   221
        } else
02bb8761fcce Initial load
duke
parents:
diff changeset
   222
            otherArgs = new String[0];
02bb8761fcce Initial load
duke
parents:
diff changeset
   223
02bb8761fcce Initial load
duke
parents:
diff changeset
   224
        parseOtherArgs (otherArgs, props);
02bb8761fcce Initial load
duke
parents:
diff changeset
   225
    } // parseArgs
02bb8761fcce Initial load
duke
parents:
diff changeset
   226
02bb8761fcce Initial load
duke
parents:
diff changeset
   227
  /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   228
   *
02bb8761fcce Initial load
duke
parents:
diff changeset
   229
   **/
02bb8761fcce Initial load
duke
parents:
diff changeset
   230
  private void addIncludePaths (Properties props)
02bb8761fcce Initial load
duke
parents:
diff changeset
   231
  {
02bb8761fcce Initial load
duke
parents:
diff changeset
   232
    String paths = props.getProperty ("includes");
02bb8761fcce Initial load
duke
parents:
diff changeset
   233
    if (paths != null)
02bb8761fcce Initial load
duke
parents:
diff changeset
   234
    {
02bb8761fcce Initial load
duke
parents:
diff changeset
   235
      String separator = System.getProperty ("path.separator");
02bb8761fcce Initial load
duke
parents:
diff changeset
   236
      int end = -separator.length (); // so the first pass paths == original paths
02bb8761fcce Initial load
duke
parents:
diff changeset
   237
      do
02bb8761fcce Initial load
duke
parents:
diff changeset
   238
      {
02bb8761fcce Initial load
duke
parents:
diff changeset
   239
        paths = paths.substring (end + separator.length ());
02bb8761fcce Initial load
duke
parents:
diff changeset
   240
        end = paths.indexOf (separator);
02bb8761fcce Initial load
duke
parents:
diff changeset
   241
        if (end < 0)
02bb8761fcce Initial load
duke
parents:
diff changeset
   242
          end = paths.length ();
02bb8761fcce Initial load
duke
parents:
diff changeset
   243
        includePaths.addElement (paths.substring (0, end));
02bb8761fcce Initial load
duke
parents:
diff changeset
   244
      }
02bb8761fcce Initial load
duke
parents:
diff changeset
   245
      while (end != paths.length ());
02bb8761fcce Initial load
duke
parents:
diff changeset
   246
    }
02bb8761fcce Initial load
duke
parents:
diff changeset
   247
  } // addIncludePaths
02bb8761fcce Initial load
duke
parents:
diff changeset
   248
02bb8761fcce Initial load
duke
parents:
diff changeset
   249
  /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   250
   * The name of the IDL file.
02bb8761fcce Initial load
duke
parents:
diff changeset
   251
   **/
02bb8761fcce Initial load
duke
parents:
diff changeset
   252
  public String file = null;
02bb8761fcce Initial load
duke
parents:
diff changeset
   253
02bb8761fcce Initial load
duke
parents:
diff changeset
   254
  /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   255
   * True if the user wishes to see processing remarks.
02bb8761fcce Initial load
duke
parents:
diff changeset
   256
   **/
02bb8761fcce Initial load
duke
parents:
diff changeset
   257
  public boolean verbose = false;
02bb8761fcce Initial load
duke
parents:
diff changeset
   258
02bb8761fcce Initial load
duke
parents:
diff changeset
   259
  /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   260
   * If this is true, then existing files should not be overwritten
02bb8761fcce Initial load
duke
parents:
diff changeset
   261
   * by the compiler.
02bb8761fcce Initial load
duke
parents:
diff changeset
   262
   **/
02bb8761fcce Initial load
duke
parents:
diff changeset
   263
  public boolean keepOldFiles = false;
02bb8761fcce Initial load
duke
parents:
diff changeset
   264
02bb8761fcce Initial load
duke
parents:
diff changeset
   265
  /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   266
   * If this is true, then the types in all included files are also emitted.
02bb8761fcce Initial load
duke
parents:
diff changeset
   267
   **/
02bb8761fcce Initial load
duke
parents:
diff changeset
   268
  public boolean emitAll = false;
02bb8761fcce Initial load
duke
parents:
diff changeset
   269
02bb8761fcce Initial load
duke
parents:
diff changeset
   270
  // <f46082.51> Remove -stateful feature.
02bb8761fcce Initial load
duke
parents:
diff changeset
   271
  ///**
02bb8761fcce Initial load
duke
parents:
diff changeset
   272
  // * If this is true, then stateful interfaces (for the Objects-by-Value
02bb8761fcce Initial load
duke
parents:
diff changeset
   273
  // * proposal) are allowed.  This is not yet a standard, so it must
02bb8761fcce Initial load
duke
parents:
diff changeset
   274
  // * explicitly be called for by setting the -stateful argument to the
02bb8761fcce Initial load
duke
parents:
diff changeset
   275
  // * compiler.  If -stateful does not appear on the command line, then
02bb8761fcce Initial load
duke
parents:
diff changeset
   276
  // * the IDL will be parsed according to the standards.
02bb8761fcce Initial load
duke
parents:
diff changeset
   277
  // **/
02bb8761fcce Initial load
duke
parents:
diff changeset
   278
  //public boolean   parseStateful  = false;
02bb8761fcce Initial load
duke
parents:
diff changeset
   279
  /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   280
   * A list of strings, each of which is a path from which included files
02bb8761fcce Initial load
duke
parents:
diff changeset
   281
   * are found.
02bb8761fcce Initial load
duke
parents:
diff changeset
   282
   **/
02bb8761fcce Initial load
duke
parents:
diff changeset
   283
  public Vector includePaths = new Vector ();
02bb8761fcce Initial load
duke
parents:
diff changeset
   284
02bb8761fcce Initial load
duke
parents:
diff changeset
   285
  /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   286
   * A table of defined symbols.  The key is the symbol name; the value
02bb8761fcce Initial load
duke
parents:
diff changeset
   287
   * (if any) is the replacement value for the symbol.
02bb8761fcce Initial load
duke
parents:
diff changeset
   288
   **/
02bb8761fcce Initial load
duke
parents:
diff changeset
   289
  public Hashtable definedSymbols = new Hashtable ();
02bb8761fcce Initial load
duke
parents:
diff changeset
   290
02bb8761fcce Initial load
duke
parents:
diff changeset
   291
  /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   292
   * <f46082.46.01> True if new module entries are created for each
02bb8761fcce Initial load
duke
parents:
diff changeset
   293
   * re-opened module.
02bb8761fcce Initial load
duke
parents:
diff changeset
   294
   **/
02bb8761fcce Initial load
duke
parents:
diff changeset
   295
  public boolean cppModule = false;
02bb8761fcce Initial load
duke
parents:
diff changeset
   296
02bb8761fcce Initial load
duke
parents:
diff changeset
   297
  /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   298
   * -version option.
02bb8761fcce Initial load
duke
parents:
diff changeset
   299
   **/
02bb8761fcce Initial load
duke
parents:
diff changeset
   300
  public boolean versionRequest = false;  // <D58319>
02bb8761fcce Initial load
duke
parents:
diff changeset
   301
02bb8761fcce Initial load
duke
parents:
diff changeset
   302
  // <f60858.1> Specify the maximal level of the CORBA spec. the parser
02bb8761fcce Initial load
duke
parents:
diff changeset
   303
  // will support.
02bb8761fcce Initial load
duke
parents:
diff changeset
   304
  //
02bb8761fcce Initial load
duke
parents:
diff changeset
   305
  // NOTE: For BOSS 3.0, specify at 2.2.  Raise to greater value in future
02bb8761fcce Initial load
duke
parents:
diff changeset
   306
  //       releases.
02bb8761fcce Initial load
duke
parents:
diff changeset
   307
  /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   308
   * -corba [level] option, where [level] is a floating-point number indicating
02bb8761fcce Initial load
duke
parents:
diff changeset
   309
   * the maximal level of CORBA IDL the parser framework can accept.
02bb8761fcce Initial load
duke
parents:
diff changeset
   310
   **/
02bb8761fcce Initial load
duke
parents:
diff changeset
   311
  public float corbaLevel = 2.2f;
02bb8761fcce Initial load
duke
parents:
diff changeset
   312
  // <d62023>
02bb8761fcce Initial load
duke
parents:
diff changeset
   313
  /**
02bb8761fcce Initial load
duke
parents:
diff changeset
   314
   * -noWarn option.  Suppress warnings when true.
02bb8761fcce Initial load
duke
parents:
diff changeset
   315
   **/
02bb8761fcce Initial load
duke
parents:
diff changeset
   316
  public boolean noWarn = false;  // Issue warnings by default.
02bb8761fcce Initial load
duke
parents:
diff changeset
   317
02bb8761fcce Initial load
duke
parents:
diff changeset
   318
    // Currently defined debug flags.  Any additions must be called xxxDebugFlag.
02bb8761fcce Initial load
duke
parents:
diff changeset
   319
    // All debug flags must be public boolean types.
02bb8761fcce Initial load
duke
parents:
diff changeset
   320
    // These are set by passing the flag -ORBDebug x,y,z in the ORB init args.
02bb8761fcce Initial load
duke
parents:
diff changeset
   321
    // Note that x,y,z must not contain spaces.
02bb8761fcce Initial load
duke
parents:
diff changeset
   322
    public boolean scannerDebugFlag = false ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   323
    public boolean tokenDebugFlag = false ;
02bb8761fcce Initial load
duke
parents:
diff changeset
   324
02bb8761fcce Initial load
duke
parents:
diff changeset
   325
} // class Arguments