Пример #1
0
int main (int argc, char** argv) {
    debugInit(stdout);

    bool fail = false;

    /*Parse the command line options into a config*/
    config conf = configCreate();
    optionsParse(&conf, argc, argv);

    /*Initialize the arch with defaults from <fcc>/defaults.h, which is generated
      by <fcc>/makedefaults.sh and included (with -include) by the makefile.*/
    archSetup(&conf.arch, defaultOS, defaultWordsize);

    if (conf.fail)
        fail = true;

    else if (conf.mode == modeVersion) {
        puts("Fedjmike's C Compiler (fcc) v0.01b");
        puts("Copyright 2014 Sam Nipps.");
        puts("This is free software; see the source for copying conditions.  There is NO");
        puts("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.");

    } else if (conf.mode == modeHelp) {
        puts("Usage: fcc [options...] <files...>");
        puts("Options:");
        puts("  -I <dir>   Add a directory to be searched for headers");
        puts("  -c         Compile and assemble only, do not link");
        puts("  -S         Compile only, do not assemble or link");
        puts("  -s         Keep temporary assembly output after compilation");
        puts("  -o <file>  Output into a specific file");
        puts("  --help     Display command line information");
        puts("  --version  Display version information");

    } else
        fail = driver(conf);

    configDestroy(conf);

    return fail ? 1 : 0;
}
Пример #2
0
int main(int argc,char **argv) {
	int returnValue;
	if(optionsParse(argc,argv)!=optionsRtrnOk) {
		returnValue=jpnevulatorRtrnOptions;
	} else {
		switch(_jpnevulatorOptions.action) {
			case actionTypeRead: {
				returnValue=jpnevulatorRead();
				break;
			}
			case actionTypeWrite: {
				returnValue=jpnevulatorWrite();
				break;
			}
			case actionTypeNone:
			default: {
				/* Should be impossible. :-) */
				returnValue=optionsRtrnImpossible;
				break;
			}
		}
	}
	return(returnValue);
}