It can look for the assignment operator '=', and output from a command is treated like a macro definition, placed in the table. If their is no '$', it default to $Console, a built in macro. Then $Console prints the result of the last command. Very simple and good enough for the lab.
I have the freedom to develop commandlets for managing the join process knowing they can easily be transformed into standard shell macros. All the attachments, except the few core, will likely be DLLs, dynamically linked as needed. I will write a simple Import commandlet that loads the dll file.
// Find arguments and expand macros int ParseArgs(char ** ptrs, char * args) { int i=0,j; char *ch; Name * entry; do { while(*args && isspace(*args)) args++; // white space if(!*args) return(i); if(*args == '$') { args++; entry = get_entry(args); args=args+strlen(entry->name); ch = entry->expand; strmove(args,ch); // move the string to make macro room j= ParseArgs(ptrs+i,args); // Drill down for any macros containing macros i = i+j; // Update the argument count return(i); } else { ptrs[i]=args; args++; i++; } while(*args && isalnum(*args) ) args++; if(*args) { *args=0; args++; } } while(*args); return(i); }
No comments:
Post a Comment