24 using namespace UCOMMON_NAMESPACE;
26 static unsigned checks = 0;
27 static unsigned exchecks = 0;
28 static unsigned refchecks = 0;
29 static unsigned mainchecks = 0;
30 static unsigned debugcount = 0;
31 static unsigned printcount = 0;
32 static unsigned eventchecks = 0;
33 static unsigned loopingchecks = 0;
34 static unsigned manipchecks = 0;
43 virtual void print(
void);
50 bool scrCheckExit(
void);
51 bool scrCheckMain(
void);
52 bool scrCheckEvent(
void);
53 bool scrCheckLoop(
void);
54 bool scrCheckRefs(
void);
57 bool scrCheckManip(
void);
99 if(scriptEvent(
"event"))
130 Script::line_t *line = stack[frame].line;
132 while(index < line->argc) {
133 const char *cp = getContent(line->argv[index]);
134 printf(
" ARG %d %s <%s>\n", index, line->argv[index], cp);
148 int main(
int argc,
char **argv)
153 static Script::keyword_t keywords[] = {
161 {
"ignore", (Script::method_t)&Script::methods::scrNop, &Script::checks::chkIgnore},
166 const char *filename =
"testscript.scr";
167 const char *mergename =
"mergescript.scr";
170 fprintf(stderr,
"use: testscript [scrname]\n");
180 Script::assign(keywords);
185 image = Script::compile(mergename);
186 image = Script::append(image, filename);
189 image = Script::compile(filename);
192 fprintf(stderr,
"*** failed to load %s\n", filename);
196 errors = image->getErrors();
198 fprintf(stderr,
"*** %d total errors in %s\n", errors, filename);
199 linked_pointer<Script::error> ep = image->getListing();
201 fprintf(stderr,
"*** %s(%d): %s\n", image->getFilename(), ep->errline, ep->errmsg);
210 if(!interp.attach(image)) {
211 fprintf(stderr,
"*** no main section in %s\n", filename);
214 while(interp.step()) {
224 assert(refchecks == 1);
227 assert(exchecks == 1);
230 assert(mainchecks == 1);
233 assert(eventchecks == 1);
236 assert(loopingchecks == 3);
239 assert(debugcount == 1);
242 assert(printcount == 1);
245 assert(manipchecks == 8);
#define BAYONNE_NAMESPACE
GNU Bayonne library namespace.
int main(int argc, char **argv)