Cleanup: Changed "(*struct).member" to "struct->member" for nowadays common syntax

This commit is contained in:
Víctor Román Archidona 2014-07-24 10:09:48 +02:00
parent b77270c2a4
commit 3c2e97089a
24 changed files with 1119 additions and 1119 deletions

View file

@ -550,10 +550,10 @@ void sentencia(void) {
lexico();
if (pieza!=p_id) error(0,59); /* esperando una variable */
if ((*o).tipo==tvglo) {
dir=(*o).vglo.offset; g2(lcar,dir);
} else if ((*o).tipo==tvloc && (!(*o).bloque || (*o).bloque==bloque_actual)) {
dir=-(*o).vloc.offset;
if (o->tipo==tvglo) {
dir=o->vglo.offset; g2(lcar,dir);
} else if (o->tipo==tvloc && (!o->bloque || o->bloque==bloque_actual)) {
dir=-o->vloc.offset;
g2(lcar,-dir); g1(laid);
} else error(0,59); /* esperando una variable */

View file

@ -84,14 +84,14 @@ int EDIV_Export(char* cadena, int nparam, void* hfuncion)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
(*ob).tipo=tfext;
(*ob).fext.codigo=n_externs;
(*ob).fext.num_par=nparam;
ob->tipo=tfext;
ob->fext.codigo=n_externs;
ob->fext.num_par=nparam;
n_externs++;
@ -138,14 +138,14 @@ int EDIV_Export_Const(char* cadena, int valor)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
(*ob).tipo=tcons;
(*ob).cons.valor=valor;
(*ob).cons.literal=0;
ob->tipo=tcons;
ob->cons.valor=valor;
ob->cons.literal=0;
return 1;
}
@ -174,15 +174,15 @@ int EDIV_Export_Global(char* cadena, int valor)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
indexa_variable(v_global,cadena,imem);
(*ob).tipo=tvglo;
(*ob).vglo.offset=imem;
ob->tipo=tvglo;
ob->vglo.offset=imem;
mem[imem]=valor;
return imem++;
@ -212,26 +212,26 @@ int EDIV_Export_Global_Tab(char* cadena, int numregs)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
indexa_variable(v_global,cadena,imem);
(*ob).tipo=ttglo;
(*ob).tglo.offset=imem;
(*ob).tglo.len1=len=numregs;
(*ob).tglo.len2=-1;
(*ob).tglo.len3=-1;
(*ob).tglo.totalen=len+1;
ob->tipo=ttglo;
ob->tglo.offset=imem;
ob->tglo.len1=len=numregs;
ob->tglo.len2=-1;
ob->tglo.len3=-1;
ob->tglo.totalen=len+1;
/* Inicializamos la tabla a 0 */
do {
mem[imem++]=0;
} while (len--);
return (*ob).tglo.offset;
return ob->tglo.offset;
}
@ -258,7 +258,7 @@ int EDIV_Export_Global_Struct(char* cadena, int numregs)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
@ -267,12 +267,12 @@ int EDIV_Export_Global_Struct(char* cadena, int numregs)
decl_struct=1;
(*ob).tipo=tsglo;
(*ob).sglo.offset=imem;
(*ob).sglo.items1=numregs;
(*ob).sglo.items2=(*ob).sglo.items3=-1;
(*ob).sglo.totalitems=numregs+1;
(*ob).sglo.len_item=0;
ob->tipo=tsglo;
ob->sglo.offset=imem;
ob->sglo.items1=numregs;
ob->sglo.items2=ob->sglo.items3=-1;
ob->sglo.totalitems=numregs+1;
ob->sglo.len_item=0;
member=ob;
len=0;
@ -308,11 +308,11 @@ int EDIV_Export_Member_Int(char* cadena, int valor)
return 0;
}
if((*ob).tipo==tsglo) { /* int miembro de struct global */
if(ob->tipo==tsglo) { /* int miembro de struct global */
(*ob2).tipo=tvglo;
(*ob2).vglo.offset=len++;
mem[imem]=valor;
(*ob).sglo.len_item++;
ob->sglo.len_item++;
return imem++;
}
else { /* int miembro de struct local */
@ -321,7 +321,7 @@ int EDIV_Export_Member_Int(char* cadena, int valor)
(*ob2).tipo=tvloc;
(*ob2).vloc.offset=len++;
loc[iloc]=valor;
(*ob).sloc.len_item++;
ob->sloc.len_item++;
return iloc++;
}
}
@ -355,7 +355,7 @@ int EDIV_Export_Member_Str(char* cadena, int tamano)
return 0;
}
if((*ob).tipo==tsglo) { /* string miembro de struct global */
if(ob->tipo==tsglo) { /* string miembro de struct global */
(*ob2).tipo=tcglo;
(*ob2).cglo.offset=len+1;
@ -373,7 +373,7 @@ int EDIV_Export_Member_Str(char* cadena, int tamano)
len+=1+((*ob2).cglo.totalen+5)/4;
mem[imem+1]=0;
imem+=1+((*ob2).cglo.totalen+5)/4;
(*ob).sglo.len_item+=1+((*ob2).cglo.totalen+5)/4;
ob->sglo.len_item+=1+((*ob2).cglo.totalen+5)/4;
return (*ob2).cglo.offset;
}
@ -395,7 +395,7 @@ int EDIV_Export_Member_Str(char* cadena, int tamano)
len+=1+((*ob2).cloc.totalen+5)/4;
loc[iloc+1]=0;
iloc+=1+((*ob2).cloc.totalen+5)/4;
(*ob).sloc.len_item+=1+((*ob2).cloc.totalen+5)/4;
ob->sloc.len_item+=1+((*ob2).cloc.totalen+5)/4;
return (*ob2).cloc.offset;
}
@ -430,7 +430,7 @@ int EDIV_Export_Member_Tab(char* cadena, int numregs)
return 0;
}
if((*ob).tipo==tsglo) { /* array miembro de struct global */
if(ob->tipo==tsglo) { /* array miembro de struct global */
(*ob2).tipo=ttglo;
(*ob2).tglo.offset=len;
(*ob2).tglo.len1=numregs;
@ -440,7 +440,7 @@ int EDIV_Export_Member_Tab(char* cadena, int numregs)
len+=numregs+1;
memset(&mem[imem],0,(numregs+1)*4);
imem+=numregs+1;
(*ob).sglo.len_item+=numregs+1;
ob->sglo.len_item+=numregs+1;
return (*ob2).tglo.offset;
}
@ -456,7 +456,7 @@ int EDIV_Export_Member_Tab(char* cadena, int numregs)
len+=numregs+1;
memset(&loc[iloc],0,(numregs+1)*4);
iloc+=numregs+1;
(*ob).sloc.len_item+=numregs+1;
ob->sloc.len_item+=numregs+1;
return (*ob2).tloc.offset;
}
@ -476,28 +476,28 @@ int EDIV_Export_EndStruct()
member=NULL;
if((*ob).tipo==tsglo) { /* cierra estructura global */
if ((*ob).sglo.len_item==0) {
if(ob->tipo==tsglo) { /* cierra estructura global */
if (ob->sglo.len_item==0) {
dll_error(10);
return 0;
}
if ((*ob).sglo.totalitems>1) {
len=((*ob).sglo.totalitems-1)*(*ob).sglo.len_item-1;
if (ob->sglo.totalitems>1) {
len=(ob->sglo.totalitems-1)*ob->sglo.len_item-1;
do {
mem[imem]=mem[imem-(*ob).sglo.len_item];
mem[imem]=mem[imem-ob->sglo.len_item];
imem++;
} while (len--);
}
}
else { /* cierra estructura local */
if ((*ob).sloc.len_item==0) {
if (ob->sloc.len_item==0) {
dll_error(10);
return 0;
}
if ((*ob).sloc.totalitems>1) {
len=((*ob).sloc.totalitems-1)*(*ob).sloc.len_item-1;
if (ob->sloc.totalitems>1) {
len=(ob->sloc.totalitems-1)*ob->sloc.len_item-1;
do {
loc[iloc]=loc[iloc-(*ob).sloc.len_item];
loc[iloc]=loc[iloc-ob->sloc.len_item];
iloc++;
} while (len--);
}
@ -533,15 +533,15 @@ int EDIV_Export_Local(char* cadena, int valor)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
indexa_variable(v_local,cadena,iloc);
(*ob).tipo=tvloc;
(*ob).vloc.offset=iloc;
ob->tipo=tvloc;
ob->vloc.offset=iloc;
loc[iloc]=valor;
return iloc++;
@ -571,26 +571,26 @@ int EDIV_Export_Local_Tab(char* cadena, int numregs)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
indexa_variable(v_local,cadena,iloc);
(*ob).tipo=ttloc;
(*ob).tloc.offset=iloc;
(*ob).tloc.len1=len=numregs;
(*ob).tloc.len2=-1;
(*ob).tloc.len3=-1;
(*ob).tloc.totalen=len+1;
ob->tipo=ttloc;
ob->tloc.offset=iloc;
ob->tloc.len1=len=numregs;
ob->tloc.len2=-1;
ob->tloc.len3=-1;
ob->tloc.totalen=len+1;
/* Inicializamos la tabla a 0 */
do {
loc[iloc++]=0;
} while (len--);
return (*ob).tloc.offset;
return ob->tloc.offset;
}
@ -617,7 +617,7 @@ int EDIV_Export_Local_Struct(char* cadena, int numregs)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
@ -630,12 +630,12 @@ int EDIV_Export_Local_Struct(char* cadena, int numregs)
indexa_variable(v_local,cadena,iloc);
}
(*ob).tipo=tsloc;
(*ob).sloc.offset=iloc;
(*ob).sloc.items1=numregs;
(*ob).sloc.items2=(*ob).sloc.items3=-1;
(*ob).sloc.totalitems=numregs+1;
(*ob).sloc.len_item=0;
ob->tipo=tsloc;
ob->sloc.offset=iloc;
ob->sloc.items1=numregs;
ob->sloc.items2=ob->sloc.items3=-1;
ob->sloc.totalitems=numregs+1;
ob->sloc.len_item=0;
member=ob;
len=0;

File diff suppressed because it is too large Load diff

View file

@ -123,27 +123,27 @@ void analiza_ltlex(void){
if (num_nodos++==max_nodos)
ltlex_error(3);
e=lex_case[*buf]=ilex_simb++;
(*e).caracter=*buf++;
e->caracter=*buf++;
}
else
buf++;
while (*buf!=' ' && *buf!=tab && *buf!=cr) {
if (lower[*buf]) ltlex_error(4);
if ((*e).siguiente==0)
if (e->siguiente==0)
if (num_nodos++==max_nodos) ltlex_error(3);
else e=(*e).siguiente=ilex_simb++;
else e=e->siguiente=ilex_simb++;
else {
e=(*e).siguiente;
while ((*e).caracter!=*buf && (*e).alternativa)
e=(*e).alternativa;
if ((*e).caracter!=*buf) {
e=e->siguiente;
while (e->caracter!=*buf && e->alternativa)
e=e->alternativa;
if (e->caracter!=*buf) {
if (num_nodos++==max_nodos) ltlex_error(3);
else e=(*e).alternativa=ilex_simb++;
else e=e->alternativa=ilex_simb++;
}
}
(*e).caracter=*buf++;
e->caracter=*buf++;
}
(*e).token=t;
e->token=t;
} break;
}} while (cont);

File diff suppressed because it is too large Load diff

View file

@ -68,13 +68,13 @@ int offset;
return 2; // genera un error "el nombre no es nuevo"
} else {
*ptr=_ivnom; ptr_o=(void*)(_ivnom+4); *ptr_o=o=iobj++; // id nuevo
(*o).name=(byte*)_ivnom+8;
(*o).member=member;
o->name=(byte*)_ivnom+8;
o->member=member;
if (num_obj++==max_obj) return 3; // error "demasiados objetos"
}
(*o).dll=numdlls;
// (*o).usado_dll=0;
o->dll=numdlls;
// o->usado_dll=0;
return 0;
}*/
@ -129,14 +129,14 @@ int EDIV_Export(char* cadena, int nparam, void* hfuncion)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
(*ob).tipo=tfext;
(*ob).fext.codigo=n_externs;
(*ob).fext.num_par=nparam; // es necesario?*/
ob->tipo=tfext;
ob->fext.codigo=n_externs;
ob->fext.num_par=nparam; // es necesario?*/
extfuncs[n_externs]=hfuncion;
extparms[n_externs]=nparam;
@ -203,14 +203,14 @@ int EDIV_Export_Const(char* cadena, int valor)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
(*ob).tipo=tcons;
(*ob).cons.valor=valor;
(*ob).cons.literal=0;
ob->tipo=tcons;
ob->cons.valor=valor;
ob->cons.literal=0;
*/
return 1;
}
@ -239,13 +239,13 @@ int EDIV_Export_Global(char* cadena, int valor)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
(*ob).tipo=tvglo;
(*ob).vglo.offset=imem;
ob->tipo=tvglo;
ob->vglo.offset=imem;
mem[imem]=valor;
*/
return dimem++;
@ -275,17 +275,17 @@ int EDIV_Export_Global_Tab(char* cadena, int numregs)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
(*ob).tipo=ttglo;
(*ob).tglo.offset=imem;
(*ob).tglo.len1=len=numregs;
(*ob).tglo.len2=-1;
(*ob).tglo.len3=-1;
(*ob).tglo.totalen=len+1;
ob->tipo=ttglo;
ob->tglo.offset=imem;
ob->tglo.len1=len=numregs;
ob->tglo.len2=-1;
ob->tglo.len3=-1;
ob->tglo.totalen=len+1;
// Inicializamos la tabla a 0
do {
@ -324,19 +324,19 @@ int EDIV_Export_Global_Struct(char* cadena, int numregs)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
decl_struct=1;
(*ob).tipo=tsglo;
(*ob).sglo.offset=imem;
(*ob).sglo.items1=numregs;
(*ob).sglo.items2=(*ob).sglo.items3=-1;
(*ob).sglo.totalitems=numregs+1;
(*ob).sglo.len_item=0;
ob->tipo=tsglo;
ob->sglo.offset=imem;
ob->sglo.items1=numregs;
ob->sglo.items2=ob->sglo.items3=-1;
ob->sglo.totalitems=numregs+1;
ob->sglo.len_item=0;
member=ob;
len=0;
*/
@ -374,18 +374,18 @@ int EDIV_Export_Member_Int(char* cadena, int valor)
return 0;
}
if((*ob).tipo==tsglo) { // int miembro de struct global
if(ob->tipo==tsglo) { // int miembro de struct global
(*ob2).tipo=tvglo;
(*ob2).vglo.offset=len++;
mem[imem]=valor;
(*ob).sglo.len_item++;
ob->sglo.len_item++;
return imem++;
}
else { // int miembro de struct local
(*ob2).tipo=tvloc;
(*ob2).vloc.offset=len++;
loc[iloc]=valor;
(*ob).sloc.len_item++;
ob->sloc.len_item++;
return iloc++;
}
*/
@ -422,7 +422,7 @@ int EDIV_Export_Member_Str(char* cadena, int tamano)
return 0;
}
if((*ob).tipo==tsglo) { // string miembro de struct global
if(ob->tipo==tsglo) { // string miembro de struct global
(*ob2).tipo=tcglo;
(*ob2).cglo.offset=len+1;
@ -440,7 +440,7 @@ int EDIV_Export_Member_Str(char* cadena, int tamano)
len+=1+((*ob2).cglo.totalen+5)/4;
mem[imem+1]=0;
imem+=1+((*ob2).cglo.totalen+5)/4;
(*ob).sglo.len_item+=1+((*ob2).cglo.totalen+5)/4;
ob->sglo.len_item+=1+((*ob2).cglo.totalen+5)/4;
return (*ob2).cglo.offset;
}
@ -462,7 +462,7 @@ int EDIV_Export_Member_Str(char* cadena, int tamano)
len+=1+((*ob2).cloc.totalen+5)/4;
loc[iloc+1]=0;
iloc+=1+((*ob2).cloc.totalen+5)/4;
(*ob).sloc.len_item+=1+((*ob2).cloc.totalen+5)/4;
ob->sloc.len_item+=1+((*ob2).cloc.totalen+5)/4;
return (*ob2).cloc.offset;
}*/
@ -503,7 +503,7 @@ int EDIV_Export_Member_Tab(char* cadena, int numregs)
return 0;
}
if((*ob).tipo==tsglo) { // array miembro de struct global
if(ob->tipo==tsglo) { // array miembro de struct global
(*ob2).tipo=ttglo;
(*ob2).tglo.offset=len;
(*ob2).tglo.len1=numregs;
@ -513,7 +513,7 @@ int EDIV_Export_Member_Tab(char* cadena, int numregs)
len+=numregs+1;
memset(&mem[imem],0,(numregs+1)*4);
imem+=numregs+1;
(*ob).sglo.len_item+=numregs+1;
ob->sglo.len_item+=numregs+1;
return (*ob2).tglo.offset;
}
@ -527,7 +527,7 @@ int EDIV_Export_Member_Tab(char* cadena, int numregs)
len+=numregs+1;
memset(&loc[iloc],0,(numregs+1)*4);
iloc+=numregs+1;
(*ob).sloc.len_item+=numregs+1;
ob->sloc.len_item+=numregs+1;
return (*ob2).tloc.offset;
}*/
@ -551,32 +551,32 @@ int EDIV_Export_EndStruct()
member=NULL;
if((*ob).tipo==tsglo) { // cierra estructura global
if ((*ob).sglo.len_item==0) {
if(ob->tipo==tsglo) { // cierra estructura global
if (ob->sglo.len_item==0) {
dll_error(10);
return 0;
}
if ((*ob).sglo.totalitems>1) {
len=((*ob).sglo.totalitems-1)*(*ob).sglo.len_item-1;
if (ob->sglo.totalitems>1) {
len=(ob->sglo.totalitems-1)*ob->sglo.len_item-1;
do {
mem[imem]=mem[imem-(*ob).sglo.len_item];
mem[imem]=mem[imem-ob->sglo.len_item];
imem++;
} while (len--);
}
}
else { // cierra estructura local
if ((*ob).sloc.len_item==0) {
if (ob->sloc.len_item==0) {
dll_error(10);
return 0;
}
if ((*ob).sloc.totalitems>1) {
len=((*ob).sloc.totalitems-1)*(*ob).sloc.len_item-1;
if (ob->sloc.totalitems>1) {
len=(ob->sloc.totalitems-1)*ob->sloc.len_item-1;
do {
loc[iloc]=loc[iloc-(*ob).sloc.len_item];
loc[iloc]=loc[iloc-ob->sloc.len_item];
iloc++;
} while (len--);
}
// iloc+=(*ob).sloc.totalitems*(*ob).sloc.len_item;
// iloc+=ob->sloc.totalitems*ob->sloc.len_item;
}
*/
if(len==0) dll_error(10);
@ -613,13 +613,13 @@ int EDIV_Export_Local(char* cadena, int valor)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
(*ob).tipo=tvloc;
(*ob).vloc.offset=iloc;
ob->tipo=tvloc;
ob->vloc.offset=iloc;
loc[iloc]=valor;
*/
return diloc++;
@ -649,24 +649,24 @@ int EDIV_Export_Local_Tab(char* cadena, int numregs)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
(*ob).tipo=ttloc;
(*ob).tloc.offset=iloc;
(*ob).tloc.len1=len=numregs;
(*ob).tloc.len2=-1;
(*ob).tloc.len3=-1;
(*ob).tloc.totalen=len+1;
ob->tipo=ttloc;
ob->tloc.offset=iloc;
ob->tloc.len1=len=numregs;
ob->tloc.len2=-1;
ob->tloc.len3=-1;
ob->tloc.totalen=len+1;
// Inicializamos la tabla a 0
do {
loc[iloc++]=0;
} while (len--);
return (*ob).tloc.offset;*/
return ob->tloc.offset;*/
offset=diloc;
diloc+=numregs;
@ -700,19 +700,19 @@ int EDIV_Export_Local_Struct(char* cadena, int numregs)
ob=o;
if ((*ob).tipo!=tnone) {
if (ob->tipo!=tnone) {
dll_error(5,cadena);
return 0;
}
decl_struct=1;
(*ob).tipo=tsloc;
(*ob).sloc.offset=iloc;
(*ob).sloc.items1=numregs;
(*ob).sloc.items2=(*ob).sloc.items3=-1;
(*ob).sloc.totalitems=numregs+1;
(*ob).sloc.len_item=0;
ob->tipo=tsloc;
ob->sloc.offset=iloc;
ob->sloc.items1=numregs;
ob->sloc.items2=ob->sloc.items3=-1;
ob->sloc.totalitems=numregs+1;
ob->sloc.len_item=0;
member=ob;
len=0;
*/