21 #include <ccscript-config.h>
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;
46 virtual void print(
void);
58 bool scrCheckExit(
void);
59 bool scrCheckMain(
void);
60 bool scrCheckEvent(
void);
61 bool scrCheckLoop(
void);
62 bool scrCheckRefs(
void);
65 bool scrCheckManip(
void);
138 Script::line_t *line = stack[frame].line;
140 while(index < line->argc) {
141 const char *cp = getContent(line->argv[index]);
142 printf(
" ARG %d %s <%s>\n", index, line->argv[index], cp);
156 int main(
int argc,
char **argv)
161 static Script::keyword_t keywords[] = {
169 {
"check.ignore", (Script::method_t)&Script::methods::scrNop, &Script::checks::chkIgnore},
174 const char *filename =
"testscript.scr";
175 const char *mergename =
"mergescript.scr";
178 fprintf(stderr,
"use: testscript [scrname]\n");
188 Script::assign(keywords);
193 image = Script::compile(NULL, mergename);
194 image = Script::compile(image, filename);
197 image = Script::compile(NULL, filename);
200 fprintf(stderr,
"*** failed to load %s\n", filename);
204 errors = image->getErrors();
206 fprintf(stderr,
"*** %d total errors in %s\n", errors, filename);
207 linked_pointer<Script::error> ep = image->getListing();
209 fprintf(stderr,
"*** %s(%d): %s\n", image->getFilename(), ep->errline, ep->errmsg);
218 if(!interp.attach(image)) {
219 fprintf(stderr,
"*** no main section in %s\n", filename);
222 while(interp.step()) {
232 assert(refchecks == 1);
235 assert(exchecks == 1);
238 assert(mainchecks == 1);
241 assert(eventchecks == 1);
244 assert(loopingchecks == 3);
247 assert(debugcount == 1);
250 assert(printcount == 1);
253 assert(manipchecks == 8);
int main(int argc, char **argv)