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 47 48
| 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[h->result.type] = 1; } if(!strncmp(resultstr,"var",3) || !strncmp(resultstr,"*var",4) || !strncmp(resultstr,"exvar",5) || !strncmp(resultstr,"*exvar",6)){ 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[0] == 1){ strcat(resultstr,"<+tempa>"); is_arrVar[0] = 0; } }
if(!strncmp(opnstr1,"var",3) || !strncmp(opnstr1,"&var",4) || !strncmp(opnstr1,"*var",4) || !strncmp(opnstr1,"exvar",5) || !strncmp(opnstr1,"*exvar",6)){ 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] == 1){ strcat(opnstr1,"<+tempa>"); is_arrVar[1] = 0; } }
if(!strncmp(opnstr2,"var",3) || !strncmp(opnstr2,"*var",4) || !strncmp(opnstr2,"exvar",5) || !strncmp(opnstr2,"*exvar",6)){ if(h->opn2.offset>=0) sprintf(opnstr2,"%s<+%d>",opnstr2,h->opn2.offset); else sprintf(opnstr2,"%s<-%d>",opnstr2,-h->opn2.offset); }
|