static void print3ai(char* op, SYM_ENTRY* arg1, SYM_ENTRY* arg2, SYM_ENTRY* result) { printf("%s = ", result->syminf->name); /* e.g. t0 = */ if(arg1) printarg(arg1); printf("%s ",op); if(arg2) printarg(arg2); printf("\n"); }
static void printIf(char* op, SYM_ENTRY* arg1, SYM_ENTRY* arg2, SYM_ENTRY* result) { /* Statement one */ printf("IF "); printarg(arg1); printf(" %s ",op); printarg(arg2); printf(" GOTO "); printf("-- \n"); //printf("%d\n", result->syminf->lit_int_val); /* Statement two: E.value ‘=’ ‘0’*/ }
/* read arguments from a file. */ void filetokens(FILE *in, FILE *out) { char c; char mydelim = zero ? 0 : (delim ? delim : '\n'); do { S(arg) = 0; while ( (c = getc(in)) != EOF && c != mydelim ) EXPAND(arg) = c; if ( (c == EOF) && (S(arg) == 0) ) break; EXPAND(arg) = 0; S(arg)--; if ( !match_re(T(arg)) ) continue; counter++; if ( cmd ) docommand(out); else if ( out ) printarg(out); } while ( c != EOF ); }
static void printParam(char* op, SYM_ENTRY* result) { //DEBUG("Function: %s --- File: %s \n ", __func__, __FILE__); printf("%s ",op); if(result) { printarg(result); printf(" \n"); } else printf(" \n"); }
int main(int argc, char** argv) { /* printf("foo: %s\n", FOO_STR(FOO)); */ printf("tag: %s\n", convert(tag)); printf("addstr: %s\n", addstr(bar)); int varform(bar, bar2); /* if empty then it'll not show up in the final concatination. */ int varform(bar,); decvar(std::string); printarg("foo: %s\n", "bar"); DBG(1); DBG(2); }
int process_line(const TCHAR* appname,const TCHAR* line) { static TCHAR** argv_l = NULL; static int argc_l = 0; if(argv_l) { while(argc_l-->0) free(argv_l[argc_l]); } else { argv_l = (TCHAR**)malloc(MAX_ARGC*sizeof(TCHAR*)); } argc_l = 1; argv_l[0] = _tcsdup(appname); argc_l = break_cmdline(argv_l+1,line,MAX_ARGC); if(argc_l>0) { argc_l++; DEBUG_CODE_BEGIN printarg(TEXT("process_line"),argc_l,argv_l); DEBUG_CODE_END zcmd_process(argc_l,argv_l); return 1; } return 1; }
/* read arguments off the command line */ void cmdtokens(char *in, FILE *out) { do { S(arg) = 0; while ( *in && (*in != delim) ) EXPAND(arg) = *in++; if ( *in ) ++in; EXPAND(arg) = 0; S(arg)--; if ( !match_re(T(arg)) ) continue; counter++; if ( cmd ) docommand(out); else if ( out ) printarg(out); } while ( *in ); }
void expand(Args ... args) { int arr[] = { (printarg(args), 0)... }; }