new Main();
}
else if (arg_prompt) {
//System.out.println("prompt");
MinimalConsole console = (arg_noconsole ? null: MinimalConsole.createConsole("Abstrasy Virtual Console"));
int exitCode = 0;
try {
lastInterpreter = Interpreter.interpr_getSuperInterpreter(Interpreter.GETSUPERINTERPRETER_HARDMODE);
if (console != null) {
lastInterpreter.setOutputTextArea(console.getOutputTextArea());
lastInterpreter.setLogTextArea(console.getOutputTextArea());
}
Interpreter.setDebugMode(false);
if (console != null) {
console.getOutputTextArea().write(Interpreter.TITLE_APP + "\n<close this window or enter ''(exit)'' to exit>\nReady...\n");
}
else {
System.out.println(Interpreter.TITLE_APP);
System.out.println("<enter ''(exit)'' to exit> ");
System.out.println("Ready...");
}
String prd = "";
boolean continuer = true;
while (continuer) {
prd = prompt(console);
lastInterpreter.setSource(prd);
try {
lastInterpreter.start();
lastInterpreter.join();
}
catch (Exception ex) {
ex.printStackTrace();
}
if (!Interpreter.hasExitCode()) {
lastInterpreter = Interpreter.interpr_cloneInterpreter(lastInterpreter);
}
else {
exitCode = Interpreter.getExitCode();
continuer = false;
}
}
}
catch (Exception ex) {
System.out.println("Remote exception : " + ex.getMessage());
ex.printStackTrace();
}
System.exit(exitCode);
}
else {
// no-ide
if (arg_file != null) {
try {
SourceFile sf = new SourceFile(arg_file);
sf.load();
source = sf.getSource();
}
catch (Exception e) {
System.out.println("Erreur lors du chargement de " + arg_file);
e.printStackTrace();
}
}
MinimalConsole console = (arg_noconsole ? null: MinimalConsole.createConsole("Abstrasy Virtual Console"));
if (source != null) {
int exitCode = 0;
try {
lastInterpreter = Interpreter.interpr_getSuperInterpreter(Interpreter.GETSUPERINTERPRETER_HARDMODE);
if (console != null) {
lastInterpreter.setOutputTextArea(console.getOutputTextArea());
lastInterpreter.setLogTextArea(console.getOutputTextArea());
}
Interpreter.setDebugMode(false);
if (arg_file != null) {
Interpreter.registerSourceAbsolutePath(arg_file);
}
lastInterpreter.setSource(source);
lastInterpreter.setInterpreterArgs(arg_argv);
//System.out.println(arg_argv);
lastInterpreter.start();
lastInterpreter.join();
if (Interpreter.hasExitCode()) {
exitCode = Interpreter.getExitCode();
if (console != null) {
console.getOutputTextArea().write("Process has an exit code (" + Interpreter.getExitCode() + ")...\n");
}
}
if (console != null && console.isVisible()) {
console.getOutputTextArea().write("\n. . . <close this window to exit> . . .");
return; // on arrête là si on est en mode graphique...
}
}
catch (Exception ex) {
System.out.println("Remote exception : " + ex.getMessage());