public static void main(String args[]) {
	final RunScript app = new RunScript();
	GeomBase.registerApp(app);
	app.setLog(new PrintWriter(System.out));
	
	int i = 0;

	try {
	    if (i+1 < args.length && args[i].equals("-b")) {
		Session.installPlugin(GeomBase.class);
		Session.installPlugin(plugins.BasicPrims.class);
		Session.installPlugin(funbase.Assembler.class);
		Session.installPlugin(plugins.Cell.class);
		BootLoader.bootstrap(new File(args[i+1]));
		i += 2;
	    }
	    else if (i+1 < args.length && args[i].equals("-s")) {
		Session.loadSession(new File(args[i+1]));
		i += 2;
	    }
	    else
		Session.loadResource("geomlab.gls");
	}
	catch (CommandException e) {
	    System.err.println(e);
	    System.exit(2);
	}

	while (i < args.length) {
	    if (args[i].equals("-e")) {
		if (i+1 < args.length)
		    app.evalString(args[++i]);
	    }
	    else if (args[i].equals("-")) {
		app.loadFromStream(System.in);
	    }
	    else {
		app.loadFromFile(new File(args[i]), false);
	    }
	    i++;
	}

	System.exit(app.getStatus());
    }