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(); lexico();
if (pieza!=p_id) error(0,59); /* esperando una variable */ if (pieza!=p_id) error(0,59); /* esperando una variable */
if ((*o).tipo==tvglo) { if (o->tipo==tvglo) {
dir=(*o).vglo.offset; g2(lcar,dir); dir=o->vglo.offset; g2(lcar,dir);
} else if ((*o).tipo==tvloc && (!(*o).bloque || (*o).bloque==bloque_actual)) { } else if (o->tipo==tvloc && (!o->bloque || o->bloque==bloque_actual)) {
dir=-(*o).vloc.offset; dir=-o->vloc.offset;
g2(lcar,-dir); g1(laid); g2(lcar,-dir); g1(laid);
} else error(0,59); /* esperando una variable */ } else error(0,59); /* esperando una variable */

View file

@ -285,4 +285,4 @@ void sentencia();
void g1(int op); void g1(int op);
void g2(int op, int pa); void g2(int op, int pa);
#endif /* __EDIV_COMPILER_H_ */ #endif /* __EDIV_COMPILER_H_ */

View file

@ -59,4 +59,4 @@ void CheckWindowsVersion(void);
//#endif //#endif

View file

@ -597,4 +597,4 @@ void conecta(char *servidor, char *archivo)
fwrite(content, tam, 1, stdout); fwrite(content, tam, 1, stdout);
} }
#endif #endif

View file

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

View file

@ -24,4 +24,4 @@
void _encriptar(int encode, char * fichero, char * clave); void _encriptar(int encode, char * fichero, char * clave);
void _comprimir(int encode, char *fichero); void _comprimir(int encode, char *fichero);
#endif #endif

File diff suppressed because it is too large Load diff

View file

@ -57,4 +57,4 @@ void expresion_cpa(void);
void generar_expresion(void); void generar_expresion(void);
int constante(void); int constante(void);
#endif #endif

View file

@ -24,4 +24,4 @@
void listado_objetos (void); void listado_objetos (void);
void listado_ensamblador (void); void listado_ensamblador (void);
#endif #endif

View file

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

View file

@ -69,4 +69,4 @@ void save_error(word tipo); /* guarda una posición de error
void error(word tipo,word num, ...); /* error de compilación */ void error(word tipo,word num, ...); /* error de compilación */
void warning(int num, ...); /* warning en el proceso */ void warning(int num, ...); /* warning en el proceso */
#endif #endif

View file

@ -29,4 +29,4 @@ int leedll();
void dll_func(); void dll_func();
void dll_func2(); void dll_func2();
#endif #endif

File diff suppressed because it is too large Load diff

View file

@ -442,4 +442,4 @@ void tglo_init(int tipo);
void tloc_init(int tipo); void tloc_init(int tipo);
void tglo_init2(int tipo); void tglo_init2(int tipo);
#endif /* __EDIV_PARSER_H_ */ #endif /* __EDIV_PARSER_H_ */

View file

@ -61,4 +61,4 @@ void CheckWindowsVersion(void);
#endif // __DLL_LOAD_H__ #endif // __DLL_LOAD_H__

View file

@ -42,4 +42,4 @@ struct _fuente_control_s{
SDL_Surface *imagen ; SDL_Surface *imagen ;
}; };
#endif #endif

View file

@ -305,4 +305,4 @@ int n_dlls; /* Número de DLLs requeridas por el programa */
int n_externs; /* Número de funciones importadas */ int n_externs; /* Número de funciones importadas */
int n_entrypoints; /* Número de entrypoints declarados */ int n_entrypoints; /* Número de entrypoints declarados */
#endif // __EXTERN_H #endif // __EXTERN_H

View file

@ -42,4 +42,4 @@
#define long_header 9 /* Longitud de la cabecera al inicio de los programas */ #define long_header 9 /* Longitud de la cabecera al inicio de los programas */
#endif /* __EDIV_SHARED_H_ */ #endif /* __EDIV_SHARED_H_ */

View file

@ -10,4 +10,4 @@ int strncasecmp2(const char *s1, const char *s2, int n);
char *strlwr(char *str); char *strlwr(char *str);
#endif #endif
#endif /* __UTILS_H */ #endif /* __UTILS_H */

View file

@ -55,4 +55,4 @@ varindex_t* varindex;
#define localptr(nombre) GetVarOffset(v_local,nombre) #define localptr(nombre) GetVarOffset(v_local,nombre)
#endif // __VARINDEX_H #endif // __VARINDEX_H

View file

@ -23,4 +23,4 @@
int carga_dll(char* nombre); int carga_dll(char* nombre);
#endif /* __DLL_H */ #endif /* __DLL_H */

View file

@ -58,4 +58,4 @@ void CheckWindowsVersion(void);
//#endif //#endif

View file

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

View file

@ -106,4 +106,4 @@ void custom_error(tipoerror tipo, char* mensaje); /* Errores personalizados de l
void stub_quit(int n); // Salir del stub void stub_quit(int n); // Salir del stub
void* e_malloc(size_t size); // identico a malloc pero con errormsg utomático void* e_malloc(size_t size); // identico a malloc pero con errormsg utomático
#endif /* __MAIN_H */ #endif /* __MAIN_H */