0N/A/*
2362N/A * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage build.tools.jdwpgen;
0N/A
0N/Aimport java.io.*;
0N/A
0N/Aclass Main {
0N/A
0N/A static String specSource;
0N/A static boolean genDebug = true;
0N/A
0N/A static void usage() {
0N/A System.err.println();
0N/A System.err.println(
0N/A "java Main <spec_input> <options>...");
0N/A System.err.println();
0N/A System.err.println("Options:");
0N/A System.err.println("-doc <doc_output>");
0N/A System.err.println("-jdi <java_output>");
0N/A System.err.println("-include <include_file_output>");
0N/A }
0N/A
0N/A public static void main(String args[]) throws IOException {
0N/A Reader reader = null;
0N/A PrintWriter doc = null;
0N/A PrintWriter jdi = null;
0N/A PrintWriter include = null;
0N/A
0N/A // Parse arguments
0N/A for (int i = 0 ; i < args.length ; ++i) {
0N/A String arg = args[i];
0N/A if (arg.startsWith("-")) {
0N/A String fn = args[++i];
0N/A if (arg.equals("-doc")) {
0N/A doc = new PrintWriter(new FileWriter(fn));
0N/A } else if (arg.equals("-jdi")) {
0N/A jdi = new PrintWriter(new FileWriter(fn));
0N/A } else if (arg.equals("-include")) {
0N/A include = new PrintWriter(new FileWriter(fn));
0N/A } else {
0N/A System.err.println("Invalid option: " + arg);
0N/A usage();
1583N/A return;
0N/A }
0N/A } else {
0N/A specSource = arg;
0N/A reader = new FileReader(specSource);
0N/A }
0N/A }
0N/A if (reader == null) {
0N/A System.err.println("<spec_input> must be specified");
0N/A usage();
1583N/A return;
0N/A }
0N/A
0N/A Parse parse = new Parse(reader);
0N/A RootNode root = parse.items();
0N/A root.parentAndExtractComments();
0N/A root.prune();
0N/A root.constrain(new Context());
0N/A if (doc != null) {
0N/A root.document(doc);
0N/A doc.close();
0N/A }
0N/A if (jdi != null) {
0N/A root.genJava(jdi, 0);
0N/A jdi.close();
0N/A }
0N/A if (include != null) {
0N/A root.genCInclude(include);
0N/A include.close();
0N/A }
0N/A }
0N/A}