2008-08-31 09:08:24 +00:00
|
|
|
#include <QTextStream>
|
|
|
|
#include "script.h"
|
|
|
|
|
2008-08-31 09:50:57 +00:00
|
|
|
int main(int argc, char* argv[]) {
|
2008-08-31 09:08:24 +00:00
|
|
|
QTextStream output(stdout);
|
|
|
|
|
2008-08-31 09:50:57 +00:00
|
|
|
MIRCScriptManager *mirc = new MIRCScriptManager;
|
|
|
|
MIRCScript *ms = new MIRCScript(mirc);
|
|
|
|
if (argc < 2) {
|
|
|
|
output << "No mIRC script file was specified!\n";
|
|
|
|
return(1);
|
|
|
|
}
|
|
|
|
output << "Attempting to load " << argv[1] << "\n";
|
|
|
|
if (ms->load(argv[1])) {
|
|
|
|
output << "MRC LOADED\n";
|
|
|
|
output << "Code:\n" << ms->code();
|
|
|
|
output << "Aliases:\n";
|
|
|
|
QMapIterator<QString, mirc_alias> alias(ms->aliases());
|
|
|
|
while(alias.hasNext()) {
|
|
|
|
alias.next();
|
|
|
|
output << (alias.value().global ? "global" : "local");
|
|
|
|
output << " " << alias.key() << "\n";
|
|
|
|
}
|
|
|
|
if (ms->run()) {
|
|
|
|
output << "MRC RAN SUCCESSFULLY\n";
|
|
|
|
QMapIterator<QString, QString> i(ms->variables());
|
|
|
|
output << "Variables:\n";
|
|
|
|
while(i.hasNext()) {
|
|
|
|
i.next();
|
|
|
|
output << i.key() << " = " << i.value() << "\n";
|
2008-08-31 09:08:24 +00:00
|
|
|
}
|
|
|
|
}
|
2008-08-31 09:50:57 +00:00
|
|
|
} else {
|
|
|
|
output << "Failed to load " << argv[1] << "\n";
|
|
|
|
return(1);
|
2008-08-31 09:08:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|