void exec(const char *str, char *err) { // this function executes a given instruction. // all important functions are called from here. void evali(const char *str, char *err, int *eval); char asgn[ID]=""; /* assignment variable name container*/ strcpy(err,""); /* empty error container string */ int integer=0; /* integer to store integer evaluation results */ double real=0; /* double to store double evaluation results */ if(prechar(asgn,str,"=")=='=') /* check for = operator */ { if(strtrims(asgn,' ')) { // if assignment string is empty strcpy(err,"Assignment variable is not specified."); return; } char isid = id_check(asgn); if(!isid) { // assign *************************************************** printf("\nassgin: %s\n",asgn); return; } else /* is not an identifier */ { if(isid==1) /* var name starts with a number */ { strcpy(err,"Variable name cannot start with a number."); return; } else /* var name has illegal chars*/ { stradd(err,"Variable cannot contain ["); straddc(err,isid); stradd(err,"] character"); } return; } } else /* there is no assigment involved */ { // if there is no assignment then integer is considered // to be the default assignment data type for evaluation. evali(str,err,&integer); if(!strlen(err)) { printf("\nint: %d\n",integer); return; } else { return; } } return; }
int exec(const char *cmd) { int purity_check(const char *str); int id_check(const char *str); printf("exec = %s\n",cmd); printf("pure = %c\n",purity_check(cmd)); printf("idnt = %c\n",id_check(cmd)); return 0; }
int main(int argc, char **argv) { if (argc < 2) { fprintf(stderr, "Usage: chkid <file> [log]\n"); return 1; } id_check(argv[1], argc > 2 ? argv[2] : "chkid.log"); return 0; }
/* The member function of set_customer accepts the customer ID#, and stores the customer information into the member variables. */ bool customers::set_customer(string &input_id) { bool isok = false; customer_info *found_customer = nullptr; found_customer = new customer_info; if (id_check(input_id) && isfound(input_id, found_customer) && check_stay(found_customer)) { c_id = found_customer->cid; c_name = found_customer->cname; chin_date = found_customer->in_date; chin_time = found_customer->in_time; chout_date = found_customer->out_date; chout_time = found_customer->out_time; isok = true; } delete found_customer; found_customer = nullptr; return isok; }
statements() { /* stmt → id := expr | if expr then stmt | while expr do stmt | begin opt_stmts end */ // int flag=0; char *tempvar; while( !match(EOI) ) { //stmt → id := expr; //printf("enter st while\n"); if( match( SEMI ) ) { // if(flag==1) // { // freename(tempvar2); // freename(tempvar3); // } break; } if(match(ID)) { char* id; id =malloc(sizeof(char)*yyleng); int comp; for( comp = 0;comp<yyleng;comp++) { id[comp]=yytext[comp]; } id[comp]='\0'; advance(); if(match(COLE)) { //printf("match cole\n"); advance(); //advance(); //expression(); tempvar = expression(); printf("%s = %s\n\n", id, tempvar ); id_check(id); int f1=tempvar[1]-'0'; //printf("%d %d", f1, f2); FILE* file1=fopen("8086.txt", "a"); fprintf(file1, "mov %s , %s \n", id, lookup[f1]); fclose(file1); // int f1=tempvar[1]-'0'; // printf("mov \n", lookup[f2], lookup[f1]); } // printf("if %s=%s", ); else { printf("Unknown grammar"); break; } } else if(match(IF)) { advance(); tempvar = expression(); if(match(THEN)) advance(); printf("if %s then ", tempvar); int f1=tempvar[1]-'0'; int f2=0; if(tempvar[2]=='=') { f2=tempvar[5]-'0'; FILE* file1=fopen("8086.txt", "a"); fprintf(file1, "cmp %s , %s \n", lookup[f1], lookup[f2]); char lab[7]="labelx"; lab[5]=(char)(count+48); strcpy(label, lab); count++; fprintf(file1, "jne %s\n", lab); fclose(file1); } else if(tempvar[2]=='<') { //printf("gerer"); f2=tempvar[4]-'0'; FILE* file1=fopen("8086.txt", "a"); fprintf(file1, "cmp %s , %s \n", lookup[f1], lookup[f2]); char lab[7]="labelx"; lab[5]=(char)(count+48); strcpy(label, lab); count++; fprintf(file1, "jnbe %s\n", lab); fclose(file1); } else { f2=tempvar[4]-'0'; FILE* file1=fopen("8086.txt", "a"); fprintf(file1, "cmp %s , %s \n", lookup[f2], lookup[f1]); char lab[7]="labelx"; lab[5]=(char)(count+48); strcpy(label, lab); count++; fprintf(file1, "jnbe %s\n", lab); fclose(file1); } //printf("IFIFIF %s, %s \n", lookup[f1], lookup[f2]); } else if(match(WHILE)) { //printf("match while\n"); advance(); //flag=1; tempvar = expression(); if(match(DO)) advance(); // char *tempvar2=newname(); // char *tempvar3=newname(); // printf("%s=%c%c",tempvar2,tempvar[0],tempvar[1]); // if(tempvar[2]=='=') // { // printf("%s=%c%c",tempvar3,tempvar[4],tempvar[5]); // printf("while %s==%s do ", tempvar2,tempvar3); // } // else if(tempvar[2]=='<'|| tempvar[2]=='>') // { // printf("%s=%c%c",tempvar3,tempvar[3],tempvar[4]); // printf("while %s%c%s do", tempvar2, tempvar[2], tempvar3); // } printf("while %s do\n", tempvar ); } else if(match(BEGIN)) { advance(); printf("begin\n"); tempvar = opt_statement(); if(match(END)) { printf("end "); { FILE* file1=fopen("8086.txt", "a"); fprintf(file1, "%s:\n", label); fclose(file1); } freename( tempvar ); advance() ;break;}// advance(); } else if(match(END)) { printf("end "); { FILE* file1=fopen("8086.txt", "a"); fprintf(file1, "%s:\n", label); fclose(file1); } //printf("begin end1 "); freename( tempvar );advance();break; } freename( tempvar ); } }
void evali(const char *str, char *err, int *eval) { // Mathematical Expression Evaluation Function // ----------------------------------------------- // This functions solves mathematical equations. // When a complex equation is passed via *str, // the equation is broken into parts, and the // simplest part is passed on recursively onto // the function itself. This recurvise process is // repeated until the whole equation has been solved. // Results of the evaluation are stored in int eval. if(!bcheck(str)) { /* this is the core of eval where the calculations are done. at this level, the equation does not have any brackets. */ const char symbols[]="^*/%+-&"; const char se[]="Invalid Syntax"; char *tmp = NULL; if((tmp=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *tmp='\0'; /* check wether str has reached the absolute stage */ if(prechar(tmp,str,symbols)==0) { printf("\n[simple]"); if(!ncheck(str)) { printf("\nequation solved!"); *eval = strint(str); free(tmp); tmp = NULL; return; } else if(!id_check(str)) { printf("\nit's a variable!"); free(tmp); tmp = NULL; return; } else { strcpy(err,se); stradd(err,": "); stradd(err,str); free(tmp); tmp = NULL; return; } } else /* there are symbols in str */ { free(tmp); tmp = NULL; } /* now the real maths */ printf("\n[complex]"); char *pre = NULL; /* string preceding of operator */ char *pos = NULL; /* string succeding the operator */ /* now allocate the variables */ if((pre=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *pre='\0'; if((pos=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *pos='\0'; char symbol = 0; if(prechar(pre,str,"^")) { if(postchar(pos,str,"^")) symbol = '^'; } else if(prechar(pre,str,"*")) { if(postchar(pos,str,"*")) symbol = '*'; } else if(prechar(pre,str,"/")) { if(postchar(pos,str,"/")) symbol = '/'; } else if(prechar(pre,str,"%")) { if(postchar(pos,str,"%")) symbol = '%'; } else if(prechar(pre,str,"+")) { if(postchar(pos,str,"+")) symbol = '+'; } else if(prechar(pre,str,"-")) { if(postchar(pos,str,"-")) symbol = '-'; } else if(prechar(pre,str,"&")) { if(postchar(pos,str,"&")) symbol = '&'; } char *ax = NULL; /* value preceding of operator */ char *bx = NULL; /* value succeding the operator */ char *cx = NULL; /* value of ax and bx processed */ /* now allocate the variables */ if((ax=(char *)(malloc(sizeof(char)* (strlen(pre)+1))))==NULL) allocerr(); *ax='\0'; if((bx=(char *)(malloc(sizeof(char)* (strlen(pos)+1))))==NULL) allocerr(); *bx='\0'; if((cx=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *cx='\0'; /* find out the contents of bx */ char *ebx = NULL; /* temp string to build bx */ if((ebx=(char *)(malloc(sizeof(char)* (strlen(pos)+1))))==NULL) allocerr(); *ebx='\0'; strcpy(bx,pos); strcpy(ebx,bx); for(;;) /* infinite loop */ { if(!prechar(bx,ebx,symbols)) { strcpy(bx,ebx); free(ebx); ebx = NULL; /* de-allocate ebx */ break; } else /* here ebx is build */ strcpy(ebx,bx); } /* find out the contents of ax */ char *eax = NULL; /* temp string to build ax */ if((eax=(char *)(malloc(sizeof(char)* (strlen(pre)+1))))==NULL) allocerr(); *eax='\0'; strcpy(ax,pre); strcpy(eax,ax); for(;;) /* infinite loop */ { if(!postchar(ax,eax,symbols)) { strcpy(ax,eax); free(eax); eax = NULL; /* de-allocate eax */ break; } else /* here eax is build */ strcpy(eax,ax); } /* variables to store (pre-ax) and (pre-bx) */ char *prex = NULL; /* string of (pre-ax) */ char *posx = NULL; /* string of (pos-ax) */ /* now allocate prex and posx */ if((prex=(char *)(malloc(sizeof(char)* (strlen(pre)+1))))==NULL) allocerr(); *prex='\0'; if((posx=(char *)(malloc(sizeof(char)* (strlen(pos)+1))))==NULL) allocerr(); *posx='\0'; /* find prex and posx */ strlft(prex,pre,(strlen(pre)-strlen(ax))); strrht(posx,pos,(strlen(pos)-strlen(bx))); /* de-allocate pre & pos */ printf("\nsym: %c",symbol); printf("\npre: %s",pre); printf("\npos: %s",pos); free(pre); pre = NULL; free(pos); pos = NULL; /* process ax and bx to find cx */ // ***************** /* de-allocate ax & bx */ printf("\n*ax: %s",ax); printf("\n*bx: %s",bx); printf("\n*cx: %s",cx); printf("\nprx: %s",prex); printf("\npox: %s",posx); free(ax); ax = NULL; free(bx); bx = NULL; /* variable to store one-step solved equation */ char *ex = NULL; if((ex=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *ex='\0'; /* find ex using cx in prex and posx */ // ***************** /* now de-allocate cx, prex & posx */ free(cx); cx = NULL; free(prex); cx = NULL; free(posx); cx = NULL; /* recurse ex on eval for next-step solving */ // ***************** /* de-allocate ex & return */ free(ex); ex = NULL; return; } else { if(!bcount(str)) { printf("\nEquation has brackets."); return; } else { strcpy(err,"Illegal Equation, inequal number of brackets."); return; } } }
void evali(const char *str, char *err, int *eval) { // Mathematical Expression Evaluation Function (INT) // --------------------------------------------------- // This functions solves mathematical expressions // based on integer numbers. When a complex expression // is passed via *str, the expression is broken // into parts, and the simplest part in accordance // with the BODMAS theorum is passed on recursively // onto the function itself. This recurvise process is // repeated until the whole expression has been solved. // Results of the evaluation are stored in int *eval. if((*str=='\0')||(strlen(str)==0)) { strcpy(err,"Void Expression"); return; } int i = 0; /* common loop counter */ char bcheck = 0; for(i=0;*str!='\0';str++,i++) { /* check if there are brackets in an equation. */ if(*str=='('||*str==')') /* bcheck is 0 if there are no brackets & vice-versa. */ { bcheck = 1; break; } } for(;i>0;i--) str--; /* reverse str pointer to original position */ if(!bcheck) { /* this is the core of eval where the calculations are done. at this level, the equation does not have any brackets. */ const char symbols[]="^*/%+-&"; const char se[]="Invalid Syntax"; const char ue[]="Unknown Symbol"; char *tmp = NULL; if((tmp=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *tmp='\0'; /* check wether str has reached the absolute stage */ if(prechar(tmp,str,symbols)==0) { /* char to store num_check results */ char ncheck = 0; ncheck = num_check(str); if(!ncheck) { /* str is a number (real or integer) */ *eval = atoi(str); free(tmp); tmp = NULL; return; } else if(!id_check(str)) { free(tmp); tmp = NULL; // char *vals = NULL; // vals = valstr(str); // *eval = atoi(vals); // free(vals); // vals = NULL; *eval = 0; return; } else { /* not a variable, number nor function; hence an error */ strcpy(err,se); strcat(err,": "); strcat(err,str); free(tmp); tmp = NULL; return; } } else /* there are symbols in str */ { free(tmp); tmp = NULL; } /* now the real maths */ char *pre = NULL; /* string preceding the operator */ char *pos = NULL; /* string succeding the operator */ /* now allocate the variables */ if((pre=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *pre='\0'; if((pos=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *pos='\0'; char symbol = 0; if(prechar(pre,str,"^")) { if(postchar(pos,str,"^")) symbol = '^'; } else if(prechar(pre,str,"*")) { if(postchar(pos,str,"*")) symbol = '*'; } else if(prechar(pre,str,"/")) { if(postchar(pos,str,"/")) symbol = '/'; } else if(prechar(pre,str,"%")) { if(postchar(pos,str,"%")) symbol = '%'; } else if(prechar(pre,str,"+")) { if(postchar(pos,str,"+")) symbol = '+'; } else if(prechar(pre,str,"-")) { if(postchar(pos,str,"-")) symbol = '-'; } else if(prechar(pre,str,"&")) { if(postchar(pos,str,"&")) symbol = '&'; } else { strcpy(err,ue); strcat(err,": "); *++err=symbol; *++err='\0'; return; } char *ax = NULL; /* value preceding of operator */ char *bx = NULL; /* value succeding the operator */ char *cx = NULL; /* value of ax and bx processed */ /* now allocate ax and bx */ if((ax=(char *)(malloc(sizeof(char)* (strlen(pre)+1))))==NULL) allocerr(); *ax='\0'; if((bx=(char *)(malloc(sizeof(char)* (strlen(pos)+1))))==NULL) allocerr(); *bx='\0'; /* find out the contents of bx */ char *ebx = NULL; /* temp string to build bx */ if((ebx=(char *)(malloc(sizeof(char)* (strlen(pos)+1))))==NULL) allocerr(); *ebx='\0'; strcpy(bx,pos); strcpy(ebx,bx); for(;;) /* infinite loop */ { if(!prechar(bx,ebx,symbols)) { strcpy(bx,ebx); free(ebx); ebx = NULL; /* de-allocate ebx */ break; } else /* here ebx is build */ strcpy(ebx,bx); } /* find out the contents of ax */ char *eax = NULL; /* temp string to build ax */ if((eax=(char *)(malloc(sizeof(char)* (strlen(pre)+1))))==NULL) allocerr(); *eax='\0'; strcpy(ax,pre); strcpy(eax,ax); for(;;) /* infinite loop */ { if(!postchar(ax,eax,symbols)) { strcpy(ax,eax); free(eax); eax = NULL; /* de-allocate eax */ break; } else /* here eax is build */ strcpy(eax,ax); } /* variables to store (pre-ax) and (pre-bx) */ char *prex = NULL; /* string of (pre-ax) */ char *posx = NULL; /* string of (pos-ax) */ /* now allocate prex and posx */ if((prex=(char *)(malloc(sizeof(char)* (strlen(pre)+1))))==NULL) allocerr(); *prex='\0'; if((posx=(char *)(malloc(sizeof(char)* (strlen(pos)+1))))==NULL) allocerr(); *posx='\0'; /* find prex and posx */ strlft(prex,pre,(strlen(pre)-strlen(ax))); strrht(posx,pos,(strlen(pos)-strlen(bx))); /* de-allocate pre & pos */ free(pre); pre = NULL; free(pos); pos = NULL; /* process ax and bx to find cx */ // printf("\nax=%s",ax); // printf("\nbx=%s",bx); int evala=0; int evalb=0; int evalc=0; if(num_check(ax)) { // tmp = valstr(ax); // if((cp=(char *)(realloc(ax,sizeof(char)* // (strlen(tmp)+1))))!=NULL) { ax = cp; } // else { allocerr(); } // strcpy(ax,tmp); // free(tmp); // tmp = NULL; strcpy(ax,""); } if(num_check(bx)) { // tmp = valstr(bx); // if((cp=(char *)(realloc(bx,sizeof(char)* // (strlen(tmp)+1))))!=NULL) { bx = cp; } // else { allocerr(); } // strcpy(bx,tmp); // free(tmp); // tmp = NULL; strcpy(bx,""); } evala = atoi(ax); evalb = atoi(bx); switch(symbol) { case '^': /* power */ evalc = (int)(pow(evala,evalb)); break; case '*': /* multiplication */ evalc = evala * evalb; break; case '/': /* division */ evalc = evala / evalb; break; case '%': /* modulus */ evalc = evala % evalb; break; case '+': /* addition */ evalc = evala + evalb; break; case '-': /* subtraction */ evalc = evala - evalb; break; case '&': /* concatenation */ if((cp=(char *)(realloc(cx,sizeof(char)* (strlen(ax)+strlen(bx)+1))))!=NULL) { cx = cp; } else { allocerr(); } strcpy(cx,ax); strcat(cx,bx); evalc = atoi(cx); break; default: strcpy(err,ue); strcat(err,": "); *++err=symbol; *++err='\0'; return; } /* find the length of evalc */ int cxlen = 8; if(evalc<0) { cxlen = 16; } else if(evalc==0) { cxlen = 2; } else { cxlen = 0; int ctmp = evalc; while(ctmp>0) { ctmp/=10; cxlen++; } } /* allocate cx having the length of evalc */ if((cx=(char *)(malloc(sizeof(char)* ((cxlen)+1))))==NULL) allocerr(); *cx='\0'; itoa(evalc,cx,10); // printf("\ncx=%s\n",cx); /* de-allocate ax & bx */ free(ax); ax = NULL; free(bx); bx = NULL; /* variable to store one-step solved equation */ char *ex = NULL; if((ex=(char *)(malloc(sizeof(char)* (strlen(prex)+strlen(cx)+strlen(posx)+1))))==NULL) allocerr(); *ex='\0'; /* find ex using cx in prex and posx */ strcpy(ex,prex); strcat(ex,cx); strcat(ex,posx); /* now de-allocate cx, prex & posx */ free(cx); cx = NULL; free(prex); prex = NULL; free(posx); posx = NULL; /* recurse ex on eval for next-step solving */ int integer=0; evali(ex,err,&integer); *eval = integer; /* de-allocate ex & return */ free(ex); ex = NULL; return; } else { // check if an equation is correct in no. of brackets. unsigned int brackets[2]={0,0}; for(i=0;*str!='\0';str++,i++) { /* find the no. of brackets */ if(*str=='(') brackets[0]+=1; if(*str==')') brackets[1]+=1; } for(;i>0;i--) str--; /* reverse str pointer to original position */ if(brackets[0]==brackets[1]) { char *pres = NULL; char *poss = NULL; char *mids = NULL; char *midx = NULL; char *newx = NULL; /* now allocate the above string */ if((pres=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *pres='\0'; if((poss=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *poss='\0'; if((mids=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *mids='\0'; if((midx=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *midx='\0'; if((newx=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *newx='\0'; /* now split the string */ unsigned long int cs = 0; unsigned long int bcount = 0; /* make pres */ for(cs=0;*str!='\0';cs++) { if(*str=='(') bcount++; if(bcount==brackets[0]) break; *pres++ = *str++; } for(*pres = '\0';cs>0;cs--) pres--; /* make mids */ for(cs=0,str++;((*str!=')')&&(*str!='\0'));cs++) *mids++ = *str++; for(*mids = '\0';cs>0;cs--) mids--; /* make poss */ for(cs=0,str++;*str!='\0';cs++) *poss++ = *str++; for(*poss = '\0';cs>0;cs--) poss--; /* ok, now evaluate */ int integer = 0; evali(mids,err,&integer); itoa(integer,midx,10); strcpy(newx,pres); strcat(newx,midx); strcat(newx,poss); evali(newx,err,&integer); *eval = integer; return; } else { strcpy(err,"Invalid Equation, inequal number of brackets."); return; } } }
void exec(const char *str, char *err) { // this function executes a given instruction. // all important functions are done from here. int eval(const char *str); void * evals(const char *str, const char data_type); strcpy(err,""); /* empty error container string */ char *exp = NULL; /* string containing evaluation expression */ char *asgn = NULL; /* string containing assignment variable name */ char data_type = '\0'; /* data type of variable to evaluate */ /* assignment analysis & error handling */ if((asgn=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *asgn='\0'; if(prechar(asgn,str,"=")=='=') /* check for = operator */ { /* ok, it is a variable assignment */ strtrm(asgn,' ','S'); if((*asgn==0)||(strlen(asgn)==0)) { /* error: assignment string is empty */ strcpy(err,"Assignment variable is not specified."); free(asgn); return; } else /* assignment string is NOT empty */ { char isid[2] = {'\0','\0'}; /* check identifier validity*/ isid[0] = id_check(asgn); if(isid[0]!=0) /* error: is not an identifier */ { if(isid[0]==1) /* error: var name starts with a number */ { strcpy(err,"Variable name cannot start with a number."); } else if(isid[0]==32) /* error: var name contains spaces */ { strcpy(err,"Variable name cannot contain spaces."); } else /* error: var name has illegal chars*/ { strcpy(err,"Variable name cannot contain ["); strcat(err,isid); strcat(err,"] character."); } free(asgn); return; } else /* success: assignment string is valid */ { /* allocate string exp */ if((exp=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *exp='\0'; /* now split the equation to get the exp. */ postchar(exp,str,"="); strtrm(exp,' ','S'); // find out the data type of the assignment // variable & store it in char data_type } } } else /* there is no assigment involved */ { /* allocate string exp */ if((exp=(char *)(malloc(sizeof(char)* (strlen(str)+1))))==NULL) allocerr(); *exp='\0'; strcpy(exp,str); strtrm(exp,' ','S'); /* de-allocate asgn */ free(asgn); asgn = NULL; } /* variable assignment */ if(asgn!=NULL) { /* possible variable data types */ long *i = NULL; // <- (int) short *n = NULL; // <- (int-) char *c = NULL; // <- (chr) double *d = NULL; // <- (real) float *f = NULL; // <- (real-) unsigned long *j = NULL; // <- (int+) unsigned short *m = NULL; // <- (int-+) unsigned char *a = NULL; // <- (chr+) switch(data_type) { case 'i': break; default: strcpy(err,"Fatal Data Transfer Error on ["); strcat(err,asgn); strcat(err,"] variable."); } /* de-allocate memory of data type */ switch(data_type) { case 'i': free(i); i = NULL; break; case 'n': free(n); n = NULL; break; case 'c': free(c); c = NULL; break; case 'd': free(d); d = NULL; break; case 'f': free(f); f = NULL; break; case 'j': free(j); j = NULL; break; case 'm': free(m); m = NULL; break; case 'a': free(a); a = NULL; break; } /* de-allocate asgn */ free(asgn); asgn = NULL; } else /* no assigment */ { // if there is no assignment then integer is considered // to be the default assignment data type for evaluation. puts(""); int _i=0; _i = eval(exp); printf("eval: %d\n",_i); data_type = 'i'; long *i = NULL; i=(long *)(evals(exp,data_type)); printf("evals: %ld\n",*i); free(i); i = NULL; void evali(const char *str, char *err, int *eval); evali(exp,err,&_i); printf("evali: %d\n",_i); printf("evali was invoked %d time(s).\n",evali_count); evali_count = 0; } free(exp); exp = NULL; }
void relations(const osmium::Relation& relation) { id_check(relation.id(), 900, 999); --m_num_relations; }
void way(const osmium::Way& way) { id_check(way.id(), 800, 899); --m_num_ways; }
void node(const osmium::Node& node) { id_check(node.id(), 0, 799); --m_num_nodes; }