Summary


 main sets up an out-of-memory handler,
 turns off some potential floating point exceptions for some platforms,
 stores the command line (and file redirect) arguments,
 looks for options and sets flag variables,
 then constructs a Control class to process the files.
 finally, it gets the return code and exits.

 Command line arguments are stored in an ArgumentExpander class.
 This class takes care of the file redirection for reading command line
 arguments from a file.

 Option setting is done by the Option class.
 It checks all of the flags on the command line and sets public boolean
 variables in the class for all to reference.

Source

// $Id: jikes.cpp,v 1.16 1999/03/10 19:59:21 shields Exp $
copyright notice

#include "config.h"
#include <iostream.h>
#include <assert.h>
#include "control.h"
#include <stdio.h>

int main(int argc, char *argv[])
{
    int return_code;

 EBCDIC is a mainframe code standard similar to ASCII. 

#ifdef EBCDIC
    Code::Conversion();
#endif

SetNewHandler sets a simple trap routine to handle running out of memory.
    
    SetNewHandler();

FloatingPointCheck will disable certain floating point overflow or
underflow expections that occur under Win95 or OS/2. This call is a NOP
if ICC is not defined.

    FloatingPointCheck();

ArgumentExpander is a class that holds the argument count and arguments.
It handles reading options from the command line or files. This is a storage
class that is used by the Option class below as an parameter.

    ArgumentExpander *arguments = new ArgumentExpander(argc, argv);

    Option *option = new Option(*arguments);

    if (option -> first_file_index < arguments -> argc)
    {
        Control *control = new Control(*arguments, *option);
        return_code = control -> return_code;
#ifdef NO_LEAKS
        delete control;
#endif
    }
    else
    {
        //
        // Be quiet about +A and +C. Those who know, know; those who don't, don't.
        //
        cerr << "\nIBM Research Jikes Compiler"
             << "\n(C) Copyright IBM Corp. 1997, 1999.\n"
             << "- Licensed Materials - Program Property of IBM - All Rights Reserved.\n\n"
             << StringConstant::U8S_command_format
             << "\n\n"
             << "-classpath path    use path for CLASSPATH\n"
             << "-d dir             write class files in directory dir\n"
             << "-debug             no effect (recognized for compatibility)\n"
             << "-depend            recompile all used classes\n"
             << "-deprecation       report uses of deprecated features\n"
             << "-g                 debug (generate LocalVariableTable)\n"
             << "-nowarn            do not issue warning messages\n"
             << "-nowrite           do not write any class files\n"
             << "-O                 do not write LineNumberTable\n"
             << "-verbose           list files read and written\n"
             << "+1.0               recognize only 1.0.2 language\n"
             << "++                 compile in incremental mode\n"
             << "+B                 do not invoke bytecode generator\n"
             << "+D                 report errors immediately in emacs-form without buffering\n"
             << "+E                 list errors in emacs-form\n"
             << "+F                 do full dependence check except for Zip and Jar files\n"
             << "+Kname=TypeKeyWord map name to type keyword\n"
             << "+M                 generate makefile dependencies\n"
             << "+M=filename        generate makefile dependencies information in filename\n"
             << "+P                 Pedantic compilation - issues lots of warnings\n"
             << "+Td...d            set value of tab d...d spaces; each d is a decimal digit\n"
             << "+U                 do full dependence check including Zip and Jar files\n"
             << "+Z                 treat cautions as errors\n"
             << "\nVersion 0.47.1 (3 Jun 99)"
             << " by Philippe Charles and David Shields, IBM Research.\n";
        cerr << "Please report problems to shields@watson.ibm.com.\n" ;
    cerr << "or via browser at http://www.ibm.com/research/jikes\n";

        return_code = 1;
    }

#ifdef NO_LEAKS
    delete arguments;
    delete option;
#endif

    return return_code;
}