40 #include "lib/charbuf.h" 41 #include "main/evaluator.h" 44 #define ARGS_FORMAT "SHELL/S,NOANSI/S,INPUT/F" 45 #include <clib/dos_protos.h> 53 AmigaProgram::AmigaProgram()
63 AmigaProgram::~AmigaProgram()
65 if (Console !=
nullptr) {
70 if (rdargs !=
nullptr) {
75 void AmigaProgram::Initialize(
int argc,
char **argv)
77 rdargs = (RDArgs*)ReadArgs((
const char*)ARGS_FORMAT, (RDPTR)&args, 0);
80 PrintFault(IoErr(), (STRPTR)argv[0]);
84 shellMode = args.shell ?
true :
false;
85 ansiMode = args.noansi ?
false :
true;
87 if (shellMode || args.input !=
nullptr)
89 Console =
new AmigaShellConsole(Preferences->GetPrompt());
93 Console =
new AmigaWindow(Preferences->GetPrompt(), Language);
99 void AmigaProgram::Start()
101 if(Console ==
nullptr || !Console->Open())
108 if (args.input !=
nullptr)
110 Evaluator *evaluator =
new Evaluator(args.input);
111 evaluator->Evaluate();
112 const char *res = evaluator->GetResult();
113 Console->WriteString(res);
114 Console->ResetConsole();