Logo Search packages:      
Sourcecode: jikes version File versions  Download package

char ** JikesAPI::parseOptions ( int  argc,
char **  argv 
) [virtual]

Creates instance of compiler options, corresponding to given command line parameters.

Returns:
list of java file names found on command line Caller should not attempt to manage the memory returned by this method as it can be freed during another call to parseOptions() or when this object is destroyed.

Definition at line 159 of file jikesapi.cpp.

{
    cleanupOptions();

    Tuple<OptionError *> bad_options;
    ArgumentExpander *args = new ArgumentExpander(argc, argv, bad_options);
    Option* opt = new Option(*args, bad_options);
    option = opt;

    if (bad_options.Length() > 0)
    {
        for (unsigned i = 0; i < bad_options.Length(); i++)
            Coutput << bad_options[i] -> GetErrorMessage() << endl;
        parsedOptions = NULL;
    }
    else
    {
        int n = args -> argc - opt -> first_file_index;
        parsedOptions = new char*[n + 1];
        for (int i = 0; i < n; i++)
        {
            const char *o = args -> argv[opt -> first_file_index + i];
            assert(o);
            parsedOptions[i] = new char[strlen(o) + 1];
            strcpy(parsedOptions[i], o);
        }
        parsedOptions[n] = NULL;
    }

    for (unsigned i = 0; i < bad_options.Length(); i++)
        delete bad_options[i];

    delete args;
    return parsedOptions;
}


Generated by  Doxygen 1.6.0   Back to index