The macro shell delivers an argument array consisting of pointers to the arguments of a command line string. Since I only deal with int and string, extractin arguments is simple:
void SomeRoutine(int argc, char *args[]) {
char *str;
int number;
str = args[2];
size = atoi(args[3]);
}
Simple enough for the macro processor and the called routines. I did not do this in the call back after all, I need those call backs extremely short and will have the compiler set up arguments on the stack prior to run.
But is makes the macro processor easier than ever. It is a complete, but simple macro generic front in for utilities. It needs on external, and executive that does something with parsed argument lines. Comment out one line and it runs all alone, parsing, defining, ad quoting stuff you type at it, and is always spits out the argument list. I never bothered to get this right in the lab, didn't care, was willing to go spaghetti, didn't matter in the lab.
But now I can see how useful the macro capability ios, especially with file names and environmental variables.
No comments:
Post a Comment