1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| if(h->op==NOT && h->result.type_array!=NULL){ struct Array * temp = h->result.type_array; while (temp){ num_buf=get_typelen(symbolTable.symbols[temp->kind].type); for(int i=0;i<temp->index-1;i++){ num_buf*=symbolTable.symbols[temp->kind].array[temp->index-i]; } sprintf(buf,"{#%d}*{%s<+%d>}+",num_buf,temp->value.type_id,temp->offset); strcat(resultstr,buf); temp = temp->next; } resultstr[strlen(resultstr)-1] = 0; sprintf(msg,"#!tempa := %s\n", resultstr); print_io(msg,fd); is_arrVar = 1; } if(!strncmp(resultstr,"var",3)){ if(h->result.offset>=0) sprintf(resultstr,"%s<+%d>",resultstr,h->result.offset); else sprintf(resultstr,"%s<-%d>",resultstr,-h->result.offset); if(is_arrVar == 1){ strcat(resultstr,"<+tempa>"); } }
if(!strncmp(opnstr1,"var",3)){ if(h->opn1.offset>=0) sprintf(opnstr1,"%s<+%d>",opnstr1,h->opn1.offset); else sprintf(opnstr1,"%s<-%d>",opnstr1,-h->opn1.offset); if(is_arrVar == 1){ strcat(opnstr1,"<+tempa>"); } }
if(!strncmp(opnstr2,"var",3)){ if(h->opn2.offset>=0) sprintf(opnstr2,"%s<+%d>",opnstr2,h->opn2.offset); else sprintf(opnstr2,"%s<-%d>",opnstr2,-h->opn2.offset); if(is_arrVar == 1){ strcat(opnstr2,"<+tempa>"); } }
|