Replaced printf(translate(x)) with custom print_translate/get_translate functions
This commit is contained in:
parent
3c592e1d1c
commit
bef39999a6
File diff suppressed because it is too large
Load diff
|
@ -34,18 +34,16 @@ char* buffer;
|
||||||
int linea;
|
int linea;
|
||||||
char cfg[256];
|
char cfg[256];
|
||||||
|
|
||||||
/*void cfg_error(int error)
|
void salta_spc()
|
||||||
{
|
{
|
||||||
printf(translate(41),cfg,linea,translate_cfg_error(error));
|
while (lower[buffer[i]] == 0 && i < tamano)
|
||||||
printf(translate(42));
|
{
|
||||||
exit(1);
|
if (buffer[i] == '\n')
|
||||||
}*/
|
linea++;
|
||||||
|
else if (buffer[i] == '\'')
|
||||||
void salta_spc() {
|
{
|
||||||
while(lower[buffer[i]]==0 && i<tamano) {
|
while (buffer[i] != '\n' && i < tamano)
|
||||||
if(buffer[i]=='\n') linea++;
|
i++;
|
||||||
else if(buffer[i]=='\'') {
|
|
||||||
while(buffer[i]!='\n' && i<tamano) i++;
|
|
||||||
linea++;
|
linea++;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
@ -71,7 +69,8 @@ void lee_ediv_cfg(char* ediv_cfg)
|
||||||
hacer_strfix = 1;
|
hacer_strfix = 1;
|
||||||
optimizar = 1;
|
optimizar = 1;
|
||||||
|
|
||||||
if((f=fopen(ediv_cfg,"r"))==NULL) {
|
if ((f = fopen(ediv_cfg, "r")) == NULL)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,18 +82,22 @@ void lee_ediv_cfg(char* ediv_cfg)
|
||||||
fread(buffer, 1, tamano, f);
|
fread(buffer, 1, tamano, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
for(i=0;i<tamano;i++) {
|
for (i = 0; i < tamano; i++)
|
||||||
|
{
|
||||||
salta_spc();
|
salta_spc();
|
||||||
c = 0;
|
c = 0;
|
||||||
while (lower[buffer[i]] != 0 && c < 20 && i < tamano)
|
while (lower[buffer[i]] != 0 && c < 20 && i < tamano)
|
||||||
tag[c++] = lower[buffer[i++]];
|
tag[c++] = lower[buffer[i++]];
|
||||||
tag[c] = 0;
|
tag[c] = 0;
|
||||||
|
|
||||||
if(!strcmp(tag,"max_process")) {
|
if (!strcmp(tag, "max_process"))
|
||||||
|
{
|
||||||
salta_spc();
|
salta_spc();
|
||||||
if(buffer[i]!='=') cfg_error(1); /* se esperaba '=' */
|
if (buffer[i] != '=')
|
||||||
|
cfg_error(1); /* se esperaba '=' */
|
||||||
salta_spc();
|
salta_spc();
|
||||||
if(buffer[i]<'0' || buffer[i]>'9') cfg_error(2); /* se esperaba un dato numerico */
|
if (buffer[i] < '0' || buffer[i] > '9')
|
||||||
|
cfg_error(2); /* se esperaba un dato numerico */
|
||||||
c = 0;
|
c = 0;
|
||||||
while (buffer[i] >= '0' && buffer[i] <= '9' && i < tamano)
|
while (buffer[i] >= '0' && buffer[i] <= '9' && i < tamano)
|
||||||
tag[c++] = buffer[i++];
|
tag[c++] = buffer[i++];
|
||||||
|
@ -155,7 +158,6 @@ void lee_ediv_cfg(char* ediv_cfg)
|
||||||
lexico();
|
lexico();
|
||||||
comprueba_null=0;
|
comprueba_null=0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
|
@ -90,35 +90,40 @@ int main(int argc, char *argv[])
|
||||||
idioma = detecta_idioma();
|
idioma = detecta_idioma();
|
||||||
|
|
||||||
/* mensaje de cabecera */
|
/* mensaje de cabecera */
|
||||||
printf(translate(0));
|
print_translate(0);
|
||||||
printf(translate(1));
|
print_translate(1);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if(argc<2) goto ayuda;
|
if (argc < 2)
|
||||||
|
goto ayuda;
|
||||||
|
|
||||||
if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-v") == 0)
|
if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-v") == 0)
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
if(strcmp(argv[1],"--help")==0 || strcmp(argv[1],"-h")==0) {
|
if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0)
|
||||||
|
{
|
||||||
ayuda:
|
ayuda:
|
||||||
/* pantalla de ayuda */
|
/* pantalla de ayuda */
|
||||||
printf(translate(2));
|
print_translate(2);
|
||||||
printf(translate(3),argv[0]);
|
print_translate(3, argv[0]);
|
||||||
printf(translate(4));
|
print_translate(4);
|
||||||
printf(translate(5));
|
print_translate(5);
|
||||||
printf(translate(6));
|
print_translate(6);
|
||||||
printf(translate(7));
|
print_translate(7);
|
||||||
printf(translate(8));
|
print_translate(8);
|
||||||
printf(translate(9));
|
print_translate(9);
|
||||||
printf(translate(10),sistema);
|
print_translate(10, sistema);
|
||||||
printf(translate(48));
|
print_translate(48);
|
||||||
printf(translate(11));
|
print_translate(11);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i=1;i<argc;i++) {
|
for (i = 1; i < argc; i++)
|
||||||
if(argv[i][0]=='-') {
|
{
|
||||||
if(argv[i][1]=='-') {
|
if (argv[i][0] == '-')
|
||||||
|
{
|
||||||
|
if (argv[i][1] == '-')
|
||||||
|
{
|
||||||
if (strcmp(argv[i] + 2, "debug") == 0)
|
if (strcmp(argv[i] + 2, "debug") == 0)
|
||||||
debug = 1;
|
debug = 1;
|
||||||
else if (strcmp(argv[i] + 2, "list") == 0)
|
else if (strcmp(argv[i] + 2, "list") == 0)
|
||||||
|
@ -128,26 +133,34 @@ int main(int argc, char *argv[])
|
||||||
else if (strcmp(argv[i] + 2, "check") == 0)
|
else if (strcmp(argv[i] + 2, "check") == 0)
|
||||||
noexe = 1;
|
noexe = 1;
|
||||||
else if (strcmp(argv[i] + 2, "system") == 0)
|
else if (strcmp(argv[i] + 2, "system") == 0)
|
||||||
if(++i<argc) {
|
if (++i < argc)
|
||||||
|
{
|
||||||
strcpy(sistema, argv[i]);
|
strcpy(sistema, argv[i]);
|
||||||
} else {
|
}
|
||||||
printf(translate(12)); /* se debe indicar un sistema para --system */
|
else
|
||||||
|
{
|
||||||
|
print_translate(12); /* se debe indicar un sistema para --system */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
else if(strcmp(argv[i]+2,"news")==0) {
|
else if (strcmp(argv[i] + 2, "news") == 0)
|
||||||
|
{
|
||||||
muestra_motd();
|
muestra_motd();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else {
|
else
|
||||||
printf(translate(13),argv[i]); /* parámetro erróneo */
|
{
|
||||||
|
print_translate(13, argv[i]); /* parámetro erróneo */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
j = 1;
|
j = 1;
|
||||||
while(argv[i][j]!=0) {
|
while (argv[i][j] != 0)
|
||||||
switch(argv[i][j]) {
|
{
|
||||||
|
switch (argv[i][j])
|
||||||
|
{
|
||||||
case 'd':
|
case 'd':
|
||||||
debug = 1;
|
debug = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -161,17 +174,21 @@ int main(int argc, char *argv[])
|
||||||
noexe = 1;
|
noexe = 1;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
if(argv[i][j+1]!=0) {
|
if (argv[i][j + 1] != 0)
|
||||||
|
{
|
||||||
strcpy(sistema, argv[i] + j + 1);
|
strcpy(sistema, argv[i] + j + 1);
|
||||||
j = strlen(argv[i]) - 1;
|
j = strlen(argv[i]) - 1;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
if(++i<argc) {
|
{
|
||||||
|
if (++i < argc)
|
||||||
|
{
|
||||||
strcpy(sistema, argv[i]);
|
strcpy(sistema, argv[i]);
|
||||||
j = strlen(argv[i]) - 1;
|
j = strlen(argv[i]) - 1;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
printf(translate(14)); /* se debe indicar un sistema para -s */
|
{
|
||||||
|
print_translate(14); /* se debe indicar un sistema para -s */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,14 +199,16 @@ int main(int argc, char *argv[])
|
||||||
exit(0);
|
exit(0);
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
printf(translate(15),argv[i][j]); /* parámetro erróneo */
|
print_translate(15, argv[i][j]); /* parámetro erróneo */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else switch (hayprog) {
|
else
|
||||||
|
switch (hayprog)
|
||||||
|
{
|
||||||
case 0:
|
case 0:
|
||||||
fichero_prg = argv[i];
|
fichero_prg = argv[i];
|
||||||
hayprog = 1;
|
hayprog = 1;
|
||||||
|
@ -199,51 +218,58 @@ int main(int argc, char *argv[])
|
||||||
hayprog = 2;
|
hayprog = 2;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf(translate(13),argv[i]); /* parámetro erróneo */
|
print_translate(13, argv[i]); /* parámetro erróneo */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hayprog==0) {
|
if (hayprog == 0)
|
||||||
printf(translate(16)); /* no se ha especificado un archivo */
|
{
|
||||||
|
print_translate(16); /* no se ha especificado un archivo */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0;i<=strlen(fichero_prg);i++) {
|
for (i = 0; i <= strlen(fichero_prg); i++)
|
||||||
|
{
|
||||||
if (*(fichero_prg + i) == '.')
|
if (*(fichero_prg + i) == '.')
|
||||||
break;
|
break;
|
||||||
nombreprog[i] = *(fichero_prg + i);
|
nombreprog[i] = *(fichero_prg + i);
|
||||||
}
|
}
|
||||||
nombreprog[i] = 0;
|
nombreprog[i] = 0;
|
||||||
|
|
||||||
if(!(fp = fopen(fichero_prg, "rb"))) {
|
if (!(fp = fopen(fichero_prg, "rb")))
|
||||||
if(!strcmp(nombreprog,fichero_prg)) {
|
{
|
||||||
|
if (!strcmp(nombreprog, fichero_prg))
|
||||||
|
{
|
||||||
strcpy(fichero_prg, nombreprog);
|
strcpy(fichero_prg, nombreprog);
|
||||||
strcat(fichero_prg, ".prg");
|
strcat(fichero_prg, ".prg");
|
||||||
if(!(fp = fopen(fichero_prg, "rb"))) {
|
if (!(fp = fopen(fichero_prg, "rb")))
|
||||||
|
{
|
||||||
strcpy(fichero_prg, nombreprog);
|
strcpy(fichero_prg, nombreprog);
|
||||||
strcat(fichero_prg, ".PRG");
|
strcat(fichero_prg, ".PRG");
|
||||||
if(!(fp = fopen(fichero_prg, "rb"))) {
|
if (!(fp = fopen(fichero_prg, "rb")))
|
||||||
printf(translate(17),nombreprog); /* error al abrir archivo */
|
{
|
||||||
|
print_translate(17, nombreprog); /* error al abrir archivo */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
printf(translate(17),argv[1]); /* error al abrir archivo */
|
{
|
||||||
|
print_translate(17, argv[1]); /* error al abrir archivo */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Componemos el nombre del ejecutable */
|
/* Componemos el nombre del ejecutable */
|
||||||
if(hayprog<2) {
|
if (hayprog < 2)
|
||||||
|
{
|
||||||
strcpy(outfilename, nombreprog);
|
strcpy(outfilename, nombreprog);
|
||||||
if (!strcmp(sistema, "win32"))
|
if (!strcmp(sistema, "win32"))
|
||||||
strcat(outfilename, ".exe");
|
strcat(outfilename, ".exe");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(translate(18),fichero_prg); /* compilando... */
|
print_translate(18, fichero_prg); /* compilando... */
|
||||||
|
|
||||||
|
|
||||||
/* mete el PRG en el buffer prog */
|
/* mete el PRG en el buffer prog */
|
||||||
fseek(fp, 0, SEEK_END);
|
fseek(fp, 0, SEEK_END);
|
||||||
|
@ -251,32 +277,38 @@ int main(int argc, char *argv[])
|
||||||
prog = e_malloc(progsize + 1);
|
prog = e_malloc(progsize + 1);
|
||||||
fseek(fp, 0, SEEK_SET);
|
fseek(fp, 0, SEEK_SET);
|
||||||
p = (char *)prog;
|
p = (char *)prog;
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
*p = getc(fp);
|
*p = getc(fp);
|
||||||
p++;
|
p++;
|
||||||
} while (!feof(fp));
|
} while (!feof(fp));
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
/* Comprueba si existe la edivrun.lib */
|
/* Comprueba si existe la edivrun.lib */
|
||||||
if(!noexe) {
|
if (!noexe)
|
||||||
|
{
|
||||||
strcpy(edivrun_lib, sistema);
|
strcpy(edivrun_lib, sistema);
|
||||||
if (debug)
|
if (debug)
|
||||||
strcat(edivrun_lib, ".dbg");
|
strcat(edivrun_lib, ".dbg");
|
||||||
else
|
else
|
||||||
strcat(edivrun_lib, ".rel");
|
strcat(edivrun_lib, ".rel");
|
||||||
|
|
||||||
if((fp = fopen(edivrun_lib, "rb"))==NULL) {
|
if ((fp = fopen(edivrun_lib, "rb")) == NULL)
|
||||||
printf(translate(19),edivrun_lib); /* no se encuentra el fichero */
|
{
|
||||||
|
print_translate(19, edivrun_lib); /* no se encuentra el fichero */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
fread(libmagic, 1, 14, fp);
|
fread(libmagic, 1, 14, fp);
|
||||||
if(strcmp(libmagic,magic)) {
|
if (strcmp(libmagic, magic))
|
||||||
printf(translate(20),edivrun_lib); /* formato incorrecto de edivrun.lib */
|
{
|
||||||
|
print_translate(20, edivrun_lib); /* formato incorrecto de edivrun.lib */
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
fread(&stub_size, 1, 4, fp);
|
fread(&stub_size, 1, 4, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
|
@ -286,7 +318,8 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ini) {
|
if (!ini)
|
||||||
|
{
|
||||||
/* Valores de las opciones por defecto */
|
/* Valores de las opciones por defecto */
|
||||||
max_process = 0;
|
max_process = 0;
|
||||||
ignore_errors = 0;
|
ignore_errors = 0;
|
||||||
|
@ -299,7 +332,9 @@ int main(int argc, char *argv[])
|
||||||
hacer_strfix = 1;
|
hacer_strfix = 1;
|
||||||
optimizar = 1;
|
optimizar = 1;
|
||||||
case_sensitive = 0;
|
case_sensitive = 0;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
max_process = iniparser_getint(ini, "default_compiler_options:max_process", 0);
|
max_process = iniparser_getint(ini, "default_compiler_options:max_process", 0);
|
||||||
ignore_errors = iniparser_getboolean(ini, "default_compiler_options:ignore_errors", 0);
|
ignore_errors = iniparser_getboolean(ini, "default_compiler_options:ignore_errors", 0);
|
||||||
free_sintax = iniparser_getboolean(ini, "default_compiler_options:free_sintax", 0);
|
free_sintax = iniparser_getboolean(ini, "default_compiler_options:free_sintax", 0);
|
||||||
|
@ -314,7 +349,6 @@ int main(int argc, char *argv[])
|
||||||
case_sensitive = iniparser_getboolean(ini, "default_compiler_options:case_sensitive", 0);
|
case_sensitive = iniparser_getboolean(ini, "default_compiler_options:case_sensitive", 0);
|
||||||
if (iniparser_getboolean(ini, "default_compiler_options:no_check", 0))
|
if (iniparser_getboolean(ini, "default_compiler_options:no_check", 0))
|
||||||
comprueba_rango = comprueba_id = comprueba_null = 0;
|
comprueba_rango = comprueba_id = comprueba_null = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
prepara_compilacion();
|
prepara_compilacion();
|
||||||
|
@ -326,21 +360,20 @@ int main(int argc, char *argv[])
|
||||||
printf("edivc: Finalizado - %d advertencias, %d errores\n", n_warnings, n_errors);
|
printf("edivc: Finalizado - %d advertencias, %d errores\n", n_warnings, n_errors);
|
||||||
#else
|
#else
|
||||||
if (n_errors)
|
if (n_errors)
|
||||||
printf(translate(21),n_warnings);
|
print_translate(21, n_warnings);
|
||||||
else
|
else
|
||||||
printf(translate(22),n_warnings);
|
print_translate(22, n_warnings);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (n_errors == 0)
|
if (n_errors == 0)
|
||||||
return 0;
|
return 0;
|
||||||
else {
|
else
|
||||||
printf(translate(23));
|
{
|
||||||
|
print_translate(23);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* void *e_malloc(size_t size)
|
* void *e_malloc(size_t size)
|
||||||
* Idéntico a malloc, pero con errormsg automático
|
* Idéntico a malloc, pero con errormsg automático
|
||||||
|
@ -352,8 +385,9 @@ void* e_malloc(size_t size)
|
||||||
{
|
{
|
||||||
void *ret;
|
void *ret;
|
||||||
|
|
||||||
if(!(ret = malloc(size))) {
|
if (!(ret = malloc(size)))
|
||||||
printf(translate(24)); /* memoria insuficiente */
|
{
|
||||||
|
print_translate(24); /* memoria insuficiente */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,7 +396,8 @@ void* e_malloc(size_t size)
|
||||||
|
|
||||||
void e_free(void *puntero)
|
void e_free(void *puntero)
|
||||||
{
|
{
|
||||||
if (puntero) {
|
if (puntero)
|
||||||
|
{
|
||||||
free(puntero);
|
free(puntero);
|
||||||
puntero = NULL;
|
puntero = NULL;
|
||||||
}
|
}
|
||||||
|
@ -370,24 +405,38 @@ void e_free(void *puntero)
|
||||||
|
|
||||||
void errormem()
|
void errormem()
|
||||||
{
|
{
|
||||||
printf(translate(24));
|
print_translate(24);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Gestión de errores
|
* Gestión de errores
|
||||||
*/
|
*/
|
||||||
int _le, _t;
|
int _le, _t;
|
||||||
byte *_ie;
|
byte *_ie;
|
||||||
|
|
||||||
void save_error(word tipo) { /* Guarda una posicion de error (de 0 .. 3) */
|
void save_error(word tipo)
|
||||||
switch(tipo) {
|
{ /* Guarda una posicion de error (de 0 .. 3) */
|
||||||
case 0: _le=linea; _ie=ierror; break;
|
switch (tipo)
|
||||||
case 1: _le=old_linea; _ie=old_ierror_end; break;
|
{
|
||||||
case 2: _le=old_linea; _ie=old_ierror; break;
|
case 0:
|
||||||
case 3: _le=old_linea; _ie=old_ierror_end; break;
|
_le = linea;
|
||||||
} _t=tipo;
|
_ie = ierror;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
_le = old_linea;
|
||||||
|
_ie = old_ierror_end;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
_le = old_linea;
|
||||||
|
_ie = old_ierror;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
_le = old_linea;
|
||||||
|
_ie = old_ierror_end;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_t = tipo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -404,28 +453,54 @@ void error(word tipo, word num, ...)
|
||||||
byte *_p, *p;
|
byte *_p, *p;
|
||||||
va_list opparam;
|
va_list opparam;
|
||||||
|
|
||||||
switch(tipo) {
|
switch (tipo)
|
||||||
case 0: linea_error=linea; p=ierror; break;
|
{
|
||||||
case 1: linea_error=old_linea; _p=p=old_ierror_end; break;
|
case 0:
|
||||||
case 2: linea_error=old_linea; p=old_ierror; break;
|
linea_error = linea;
|
||||||
case 3: linea_error=old_linea; _p=p=old_ierror_end; break;
|
p = ierror;
|
||||||
case 4: linea_error=_le; _p=p=_ie; tipo=_t; break;
|
break;
|
||||||
|
case 1:
|
||||||
|
linea_error = old_linea;
|
||||||
|
_p = p = old_ierror_end;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
linea_error = old_linea;
|
||||||
|
p = old_ierror;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
linea_error = old_linea;
|
||||||
|
_p = p = old_ierror_end;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
linea_error = _le;
|
||||||
|
_p = p = _ie;
|
||||||
|
tipo = _t;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (num!=2 && num!=6) {
|
if (num != 2 && num != 6)
|
||||||
while (--p>=prog) {
|
{
|
||||||
if (*p==lf || (*p==cr && *(p+1)==lf)) break;
|
while (--p >= prog)
|
||||||
|
{
|
||||||
|
if (*p == lf || (*p == cr && *(p + 1) == lf))
|
||||||
|
break;
|
||||||
columna++;
|
columna++;
|
||||||
}
|
}
|
||||||
if (p<prog) columna++;
|
if (p < prog)
|
||||||
|
columna++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tipo==1) {
|
if (tipo == 1)
|
||||||
if (*(_p+1)==' ' || *(_p+1)==cr || *(_p+1)==lf) columna++; columna++;
|
{
|
||||||
} else if (tipo==3) columna++;
|
if (*(_p + 1) == ' ' || *(_p + 1) == cr || *(_p + 1) == lf)
|
||||||
|
columna++;
|
||||||
|
columna++;
|
||||||
|
}
|
||||||
|
else if (tipo == 3)
|
||||||
|
columna++;
|
||||||
|
|
||||||
va_start(opparam, num);
|
va_start(opparam, num);
|
||||||
printf(translate(25), fichero_prg, linea_error, columna, num);
|
print_translate(25, fichero_prg, linea_error, columna, num);
|
||||||
vprintf(translate_error(num), opparam);
|
vprintf(translate_error(num), opparam);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
|
@ -435,12 +510,13 @@ void error(word tipo, word num, ...)
|
||||||
if (n_errors > 20)
|
if (n_errors > 20)
|
||||||
printf("Demasiados errores. Compilación interrumpida.\n");
|
printf("Demasiados errores. Compilación interrumpida.\n");
|
||||||
|
|
||||||
if(num==1 || num==2 || num==6 || n_errors>20) {
|
if (num == 1 || num == 2 || num == 6 || n_errors > 20)
|
||||||
|
{
|
||||||
printf("edivc: Finalizado - %d advertencias, %d errores\n", n_warnings, n_errors);
|
printf("edivc: Finalizado - %d advertencias, %d errores\n", n_warnings, n_errors);
|
||||||
#else
|
#else
|
||||||
printf(translate(21),n_warnings);
|
print_translate(21, n_warnings);
|
||||||
#endif
|
#endif
|
||||||
printf(translate(23));
|
print_translate(23);
|
||||||
exit(2);
|
exit(2);
|
||||||
#ifdef MULTI_ERROR
|
#ifdef MULTI_ERROR
|
||||||
}
|
}
|
||||||
|
@ -452,7 +528,7 @@ void warning(int num, ...)
|
||||||
va_list opparam;
|
va_list opparam;
|
||||||
|
|
||||||
va_start(opparam, num);
|
va_start(opparam, num);
|
||||||
printf(translate(26), fichero_prg, linea);
|
print_translate(26, fichero_prg, linea);
|
||||||
vprintf(translate_warning(num), opparam);
|
vprintf(translate_warning(num), opparam);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
n_warnings++;
|
n_warnings++;
|
||||||
|
@ -467,18 +543,23 @@ void muestra_motd()
|
||||||
char *motdserver = NULL;
|
char *motdserver = NULL;
|
||||||
char *motdpath = NULL;
|
char *motdpath = NULL;
|
||||||
|
|
||||||
if(ini) {
|
if (ini)
|
||||||
|
{
|
||||||
motdserver = iniparser_getstr(ini, "general:motd_host");
|
motdserver = iniparser_getstr(ini, "general:motd_host");
|
||||||
motdpath = iniparser_getstr(ini, "general:motd_path");
|
motdpath = iniparser_getstr(ini, "general:motd_path");
|
||||||
if(!motdserver) {
|
if (!motdserver)
|
||||||
printf(translate(49)); /* el servidor de motd debe estar en ediv.cfg */
|
{
|
||||||
|
print_translate(49); /* el servidor de motd debe estar en ediv.cfg */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if(!motdpath) motdpath="/ediv/actual/motd.txt";
|
if (!motdpath)
|
||||||
|
motdpath = "/ediv/actual/motd.txt";
|
||||||
conecta(motdserver, motdpath);
|
conecta(motdserver, motdpath);
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
}
|
||||||
printf(translate(49)); /* el servidor de motd debe estar en ediv.cfg */
|
else
|
||||||
|
{
|
||||||
|
print_translate(49); /* el servidor de motd debe estar en ediv.cfg */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -499,14 +580,16 @@ void conecta(char *servidor, char *archivo)
|
||||||
else
|
else
|
||||||
htent = gethostbyaddr((const char *)&iahost, sizeof(struct in_addr), AF_INET);
|
htent = gethostbyaddr((const char *)&iahost, sizeof(struct in_addr), AF_INET);
|
||||||
|
|
||||||
if (htent==NULL) {
|
if (htent == NULL)
|
||||||
|
{
|
||||||
sock_error("gethostbyname()");
|
sock_error("gethostbyname()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
|
||||||
if (sock==INVALID_SOCKET) {
|
if (sock == INVALID_SOCKET)
|
||||||
|
{
|
||||||
sock_error("socket()");
|
sock_error("socket()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -521,7 +604,8 @@ void conecta(char *servidor, char *archivo)
|
||||||
sin.sin_addr = *(struct in_addr *)*htent->h_addr_list;
|
sin.sin_addr = *(struct in_addr *)*htent->h_addr_list;
|
||||||
|
|
||||||
status = connect(sock, (struct sockaddr *)&sin, sizeof(sin));
|
status = connect(sock, (struct sockaddr *)&sin, sizeof(sin));
|
||||||
if (status==SOCKET_ERROR) {
|
if (status == SOCKET_ERROR)
|
||||||
|
{
|
||||||
sock_error("connect()");
|
sock_error("connect()");
|
||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
return;
|
return;
|
||||||
|
@ -533,8 +617,8 @@ void conecta(char *servidor, char *archivo)
|
||||||
"Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, */*\n"
|
"Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, */*\n"
|
||||||
"Accept-Language: es\nAccept-Encoding: deflate, gzip, x-gzip, identity, *;q=0\n"
|
"Accept-Language: es\nAccept-Encoding: deflate, gzip, x-gzip, identity, *;q=0\n"
|
||||||
"Connection: Keep-Alive\n"
|
"Connection: Keep-Alive\n"
|
||||||
"\n"
|
"\n",
|
||||||
,archivo,servidor);
|
archivo, servidor);
|
||||||
|
|
||||||
#ifdef DEBUG_HTTP
|
#ifdef DEBUG_HTTP
|
||||||
printf("GET %s HTTP/1.1\n"
|
printf("GET %s HTTP/1.1\n"
|
||||||
|
@ -543,59 +627,68 @@ void conecta(char *servidor, char *archivo)
|
||||||
"Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, */*\n"
|
"Accept: text/html, image/png, image/jpeg, image/gif, image/x-xbitmap, */*\n"
|
||||||
"Accept-Language: es\nAccept-Encoding: deflate, gzip, x-gzip, identity, *;q=0\n"
|
"Accept-Language: es\nAccept-Encoding: deflate, gzip, x-gzip, identity, *;q=0\n"
|
||||||
"Connection: Keep-Alive\n"
|
"Connection: Keep-Alive\n"
|
||||||
"\n"
|
"\n",
|
||||||
,archivo,servidor);
|
archivo, servidor);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
status = send(sock, buffer, strlen(buffer), 0);
|
status = send(sock, buffer, strlen(buffer), 0);
|
||||||
if (status==SOCKET_ERROR) {
|
if (status == SOCKET_ERROR)
|
||||||
|
{
|
||||||
sock_error("send()");
|
sock_error("send()");
|
||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = recv(sock, buffer, sizeof(buffer), 0);
|
status = recv(sock, buffer, sizeof(buffer), 0);
|
||||||
if (status == SOCKET_ERROR) {
|
if (status == SOCKET_ERROR)
|
||||||
|
{
|
||||||
sock_error("recv()");
|
sock_error("recv()");
|
||||||
}
|
}
|
||||||
|
|
||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
|
|
||||||
if(*(buffer+9)!='2' || *(buffer+10)!='0' || *(buffer+10)!='0') {
|
if (*(buffer + 9) != '2' || *(buffer + 10) != '0' || *(buffer + 10) != '0')
|
||||||
|
{
|
||||||
*strchr(buffer, 0x0d) = 0;
|
*strchr(buffer, 0x0d) = 0;
|
||||||
printf("%s\n", buffer);
|
printf("%s\n", buffer);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
size = strstr(buffer, "Content-Type: ");
|
size = strstr(buffer, "Content-Type: ");
|
||||||
if(!size) {
|
if (!size)
|
||||||
printf(translate(50));
|
{
|
||||||
|
print_translate(50);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
size += 14;
|
size += 14;
|
||||||
*(ras = strchr(size, 0x0d)) = 0;
|
*(ras = strchr(size, 0x0d)) = 0;
|
||||||
if(strcmp(size,"text/plain")) {
|
if (strcmp(size, "text/plain"))
|
||||||
printf(translate(50));
|
{
|
||||||
|
print_translate(50);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
*ras = 0x0d;
|
*ras = 0x0d;
|
||||||
|
|
||||||
size = strstr(buffer, "Content-Length: ");
|
size = strstr(buffer, "Content-Length: ");
|
||||||
if(!size) {
|
if (!size)
|
||||||
printf(translate(50));
|
{
|
||||||
|
print_translate(50);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
size += 16;
|
size += 16;
|
||||||
ras = strchr(size, 0x0d) - 1;
|
ras = strchr(size, 0x0d) - 1;
|
||||||
content = strstr(size, "\x0d\x0a\x0d\x0a") + 4;
|
content = strstr(size, "\x0d\x0a\x0d\x0a") + 4;
|
||||||
tam=0; inc=1;
|
tam = 0;
|
||||||
for(;ras>=size;ras--) {
|
inc = 1;
|
||||||
|
for (; ras >= size; ras--)
|
||||||
|
{
|
||||||
if (*ras >= '0' && *ras <= '9')
|
if (*ras >= '0' && *ras <= '9')
|
||||||
tam += (*ras - '0') * inc;
|
tam += (*ras - '0') * inc;
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
inc *= 10;
|
inc *= 10;
|
||||||
}
|
}
|
||||||
if(tam>1024) tam=1024;
|
if (tam > 1024)
|
||||||
|
tam = 1024;
|
||||||
|
|
||||||
fwrite(content, tam, 1, stdout);
|
fwrite(content, tam, 1, stdout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,29 +41,28 @@ int numparams;
|
||||||
byte decl_struct = 0; /* 1 si se está declarando un struct */
|
byte decl_struct = 0; /* 1 si se está declarando un struct */
|
||||||
byte struct_reserved = 0; /* 1 si se está declarando la estructura reserved */
|
byte struct_reserved = 0; /* 1 si se está declarando la estructura reserved */
|
||||||
|
|
||||||
|
|
||||||
/* Errores específicos en la ejecución de una DLL */
|
/* Errores específicos en la ejecución de una DLL */
|
||||||
void dll_error(int error, ...)
|
void dll_error(int error, ...)
|
||||||
{
|
{
|
||||||
va_list opparam;
|
va_list opparam;
|
||||||
|
|
||||||
va_start(opparam, error);
|
va_start(opparam, error);
|
||||||
printf(translate(35), fichdll);
|
print_translate(35, fichdll);
|
||||||
vprintf(translate_dll_error(error - 1), opparam);
|
vprintf(translate_dll_error(error - 1), opparam);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
n_errors++;
|
n_errors++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export(char *cadena, int nparam, void *hfuncion)
|
int EDIV_Export(char *cadena, int nparam, void *hfuncion)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nparam<0) {
|
if (nparam < 0)
|
||||||
|
{
|
||||||
dll_error(5, cadena);
|
dll_error(5, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -74,17 +73,20 @@ int EDIV_Export(char* cadena, int nparam, void* hfuncion)
|
||||||
printf("export_function:\t-- ID FUNCION: %d\n"
|
printf("export_function:\t-- ID FUNCION: %d\n"
|
||||||
"export_function:\tCadena exportada: %s\n"
|
"export_function:\tCadena exportada: %s\n"
|
||||||
"export_function:\tN. parametros: %d\n"
|
"export_function:\tN. parametros: %d\n"
|
||||||
"export_function:\tOffset de la funcion: 0x%X\n",n_externs,cadena,nparam,(unsigned int)hfuncion);
|
"export_function:\tOffset de la funcion: 0x%X\n",
|
||||||
|
n_externs, cadena, nparam, (unsigned int)hfuncion);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(creaobj) {
|
if (creaobj)
|
||||||
|
{
|
||||||
dll_error(creaobj, cadena);
|
dll_error(creaobj, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ob = o;
|
ob = o;
|
||||||
|
|
||||||
if (ob->tipo!=tnone) {
|
if (ob->tipo != tnone)
|
||||||
|
{
|
||||||
dll_error(5, cadena);
|
dll_error(5, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +100,6 @@ int EDIV_Export(char* cadena, int nparam, void* hfuncion)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Entrypoint(int ep, void *hfuncion)
|
int EDIV_Export_Entrypoint(int ep, void *hfuncion)
|
||||||
{
|
{
|
||||||
entrypoints[n_entrypoints].tipo = ep;
|
entrypoints[n_entrypoints].tipo = ep;
|
||||||
|
@ -107,17 +108,16 @@ int EDIV_Export_Entrypoint(int ep, void* hfuncion)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Priority(int priority)
|
int EDIV_Export_Priority(int priority)
|
||||||
{
|
{
|
||||||
dlls[numdlls].prioridad = priority;
|
dlls[numdlls].prioridad = priority;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Const(char *cadena, int valor)
|
int EDIV_Export_Const(char *cadena, int valor)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -128,17 +128,20 @@ int EDIV_Export_Const(char* cadena, int valor)
|
||||||
printf("export_const:\t-- ID OBJETO: %d\n"
|
printf("export_const:\t-- ID OBJETO: %d\n"
|
||||||
"export_const:\tCadena exportada: %s\n"
|
"export_const:\tCadena exportada: %s\n"
|
||||||
"export_const:\tValor: %d\n"
|
"export_const:\tValor: %d\n"
|
||||||
"export_const:\tOffset del objeto: 0x%X\n",num_obj-1,cadena,valor,(unsigned int)o);
|
"export_const:\tOffset del objeto: 0x%X\n",
|
||||||
|
num_obj - 1, cadena, valor, (unsigned int)o);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(creaobj) {
|
if (creaobj)
|
||||||
|
{
|
||||||
dll_error(creaobj, cadena);
|
dll_error(creaobj, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ob = o;
|
ob = o;
|
||||||
|
|
||||||
if (ob->tipo!=tnone) {
|
if (ob->tipo != tnone)
|
||||||
|
{
|
||||||
dll_error(5, cadena);
|
dll_error(5, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -150,10 +153,10 @@ int EDIV_Export_Const(char* cadena, int valor)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Global(char *cadena, int valor)
|
int EDIV_Export_Global(char *cadena, int valor)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -164,17 +167,20 @@ int EDIV_Export_Global(char* cadena, int valor)
|
||||||
printf("export_global:\t-- ID OBJETO: %d\n"
|
printf("export_global:\t-- ID OBJETO: %d\n"
|
||||||
"export_global:\tCadena exportada: %s\n"
|
"export_global:\tCadena exportada: %s\n"
|
||||||
"export_global:\tValor: %d\n"
|
"export_global:\tValor: %d\n"
|
||||||
"export_global:\tOffset del objeto: 0x%X\n",num_obj-1,cadena,valor,(unsigned int)o);
|
"export_global:\tOffset del objeto: 0x%X\n",
|
||||||
|
num_obj - 1, cadena, valor, (unsigned int)o);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(creaobj) {
|
if (creaobj)
|
||||||
|
{
|
||||||
dll_error(creaobj, cadena);
|
dll_error(creaobj, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ob = o;
|
ob = o;
|
||||||
|
|
||||||
if (ob->tipo!=tnone) {
|
if (ob->tipo != tnone)
|
||||||
|
{
|
||||||
dll_error(5, cadena);
|
dll_error(5, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -188,10 +194,10 @@ int EDIV_Export_Global(char* cadena, int valor)
|
||||||
return imem++;
|
return imem++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Global_Tab(char *cadena, int numregs)
|
int EDIV_Export_Global_Tab(char *cadena, int numregs)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -202,17 +208,20 @@ int EDIV_Export_Global_Tab(char* cadena, int numregs)
|
||||||
printf("export_global_tab:\t-- ID OBJETO: %d\n"
|
printf("export_global_tab:\t-- ID OBJETO: %d\n"
|
||||||
"export_global_tab:\tCadena exportada: %s\n"
|
"export_global_tab:\tCadena exportada: %s\n"
|
||||||
"export_global_tab:\tN.regs: %d\n"
|
"export_global_tab:\tN.regs: %d\n"
|
||||||
"export_global_tab:\tOffset del objeto: 0x%X\n",num_obj-1,cadena,numregs,(unsigned int)o);
|
"export_global_tab:\tOffset del objeto: 0x%X\n",
|
||||||
|
num_obj - 1, cadena, numregs, (unsigned int)o);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(creaobj) {
|
if (creaobj)
|
||||||
|
{
|
||||||
dll_error(creaobj, cadena);
|
dll_error(creaobj, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ob = o;
|
ob = o;
|
||||||
|
|
||||||
if (ob->tipo!=tnone) {
|
if (ob->tipo != tnone)
|
||||||
|
{
|
||||||
dll_error(5, cadena);
|
dll_error(5, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -227,17 +236,18 @@ int EDIV_Export_Global_Tab(char* cadena, int numregs)
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Global_Struct(char *cadena, int numregs)
|
int EDIV_Export_Global_Struct(char *cadena, int numregs)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -248,17 +258,20 @@ int EDIV_Export_Global_Struct(char* cadena, int numregs)
|
||||||
printf("export_global_struct:\t-- ID OBJETO: %d\n"
|
printf("export_global_struct:\t-- ID OBJETO: %d\n"
|
||||||
"export_global_struct:\tCadena exportada: %s\n"
|
"export_global_struct:\tCadena exportada: %s\n"
|
||||||
"export_global_struct:\tN.regs: %d\n"
|
"export_global_struct:\tN.regs: %d\n"
|
||||||
"export_global_struct:\tOffset del objeto: 0x%X\n",num_obj-1,cadena,numregs,(unsigned int)o);
|
"export_global_struct:\tOffset del objeto: 0x%X\n",
|
||||||
|
num_obj - 1, cadena, numregs, (unsigned int)o);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(creaobj) {
|
if (creaobj)
|
||||||
|
{
|
||||||
dll_error(creaobj, cadena);
|
dll_error(creaobj, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ob = o;
|
ob = o;
|
||||||
|
|
||||||
if (ob->tipo!=tnone) {
|
if (ob->tipo != tnone)
|
||||||
|
{
|
||||||
dll_error(5, cadena);
|
dll_error(5, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -279,10 +292,10 @@ int EDIV_Export_Global_Struct(char* cadena, int numregs)
|
||||||
return imem;
|
return imem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Member_Int(char *cadena, int valor)
|
int EDIV_Export_Member_Int(char *cadena, int valor)
|
||||||
{
|
{
|
||||||
if(!decl_struct) {
|
if (!decl_struct)
|
||||||
|
{
|
||||||
dll_error(7, cadena);
|
dll_error(7, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -293,29 +306,34 @@ int EDIV_Export_Member_Int(char* cadena, int valor)
|
||||||
printf("export_member_int:\t-- ID OBJETO: %d\n"
|
printf("export_member_int:\t-- ID OBJETO: %d\n"
|
||||||
"export_member_int:\tCadena exportada: %s\n"
|
"export_member_int:\tCadena exportada: %s\n"
|
||||||
"export_member_int:\tValor: %d\n"
|
"export_member_int:\tValor: %d\n"
|
||||||
"export_member_int:\tOffset del objeto: 0x%X\n",num_obj-1,cadena,valor,(unsigned int)o);
|
"export_member_int:\tOffset del objeto: 0x%X\n",
|
||||||
|
num_obj - 1, cadena, valor, (unsigned int)o);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(creaobj) {
|
if (creaobj)
|
||||||
|
{
|
||||||
dll_error(creaobj, cadena);
|
dll_error(creaobj, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ob2 = o;
|
ob2 = o;
|
||||||
|
|
||||||
if ((*ob2).tipo!=tnone) {
|
if ((*ob2).tipo != tnone)
|
||||||
|
{
|
||||||
dll_error(5, cadena);
|
dll_error(5, cadena);
|
||||||
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 */
|
||||||
if (struct_reserved)
|
if (struct_reserved)
|
||||||
indexa_variable(v_reserved, cadena, iloc);
|
indexa_variable(v_reserved, cadena, iloc);
|
||||||
(*ob2).tipo = tvloc;
|
(*ob2).tipo = tvloc;
|
||||||
|
@ -326,10 +344,10 @@ int EDIV_Export_Member_Int(char* cadena, int valor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Member_Str(char *cadena, int tamano)
|
int EDIV_Export_Member_Str(char *cadena, int tamano)
|
||||||
{
|
{
|
||||||
if(!decl_struct) {
|
if (!decl_struct)
|
||||||
|
{
|
||||||
dll_error(7, cadena);
|
dll_error(7, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -340,31 +358,37 @@ int EDIV_Export_Member_Str(char* cadena, int tamano)
|
||||||
printf("export_member_str:\t-- ID OBJETO: %d\n"
|
printf("export_member_str:\t-- ID OBJETO: %d\n"
|
||||||
"export_member_str:\tCadena exportada: %s\n"
|
"export_member_str:\tCadena exportada: %s\n"
|
||||||
"export_member_str:\tTamano: %d\n"
|
"export_member_str:\tTamano: %d\n"
|
||||||
"export_member_str:\tOffset del objeto: 0x%X\n",num_obj-1,cadena,tamano,(unsigned int)o);
|
"export_member_str:\tOffset del objeto: 0x%X\n",
|
||||||
|
num_obj - 1, cadena, tamano, (unsigned int)o);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(creaobj) {
|
if (creaobj)
|
||||||
|
{
|
||||||
dll_error(creaobj, cadena);
|
dll_error(creaobj, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ob2 = o;
|
ob2 = o;
|
||||||
|
|
||||||
if ((*ob2).tipo!=tnone) {
|
if ((*ob2).tipo != tnone)
|
||||||
|
{
|
||||||
dll_error(5, cadena);
|
dll_error(5, cadena);
|
||||||
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;
|
||||||
|
|
||||||
if (((*ob2).cglo.totalen=tamano)<0) {
|
if (((*ob2).cglo.totalen = tamano) < 0)
|
||||||
|
{
|
||||||
dll_error(8, cadena);
|
dll_error(8, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((*ob2).cglo.totalen>0xFFFFF) {
|
if ((*ob2).cglo.totalen > 0xFFFFF)
|
||||||
|
{
|
||||||
dll_error(8, cadena);
|
dll_error(8, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -377,16 +401,19 @@ int EDIV_Export_Member_Str(char* cadena, int tamano)
|
||||||
|
|
||||||
return (*ob2).cglo.offset;
|
return (*ob2).cglo.offset;
|
||||||
}
|
}
|
||||||
else { /* string miembro de struct local */
|
else
|
||||||
|
{ /* string miembro de struct local */
|
||||||
|
|
||||||
(*ob2).tipo = tcloc;
|
(*ob2).tipo = tcloc;
|
||||||
(*ob2).cloc.offset = len + 1;
|
(*ob2).cloc.offset = len + 1;
|
||||||
|
|
||||||
if (((*ob2).cloc.totalen=tamano)<0) {
|
if (((*ob2).cloc.totalen = tamano) < 0)
|
||||||
|
{
|
||||||
dll_error(8, cadena);
|
dll_error(8, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((*ob2).cloc.totalen>0xFFFFF) {
|
if ((*ob2).cloc.totalen > 0xFFFFF)
|
||||||
|
{
|
||||||
dll_error(8, cadena);
|
dll_error(8, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -401,10 +428,10 @@ int EDIV_Export_Member_Str(char* cadena, int tamano)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Member_Tab(char *cadena, int numregs)
|
int EDIV_Export_Member_Tab(char *cadena, int numregs)
|
||||||
{
|
{
|
||||||
if(!decl_struct) {
|
if (!decl_struct)
|
||||||
|
{
|
||||||
dll_error(7, cadena);
|
dll_error(7, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -415,22 +442,26 @@ int EDIV_Export_Member_Tab(char* cadena, int numregs)
|
||||||
printf("export_member_tab:\t-- ID OBJETO: %d\n"
|
printf("export_member_tab:\t-- ID OBJETO: %d\n"
|
||||||
"export_member_tab:\tCadena exportada: %s\n"
|
"export_member_tab:\tCadena exportada: %s\n"
|
||||||
"export_member_tab:\tN.regs: %d\n"
|
"export_member_tab:\tN.regs: %d\n"
|
||||||
"export_member_tab:\tOffset del objeto: 0x%X\n",num_obj-1,cadena,numregs,(unsigned int)o);
|
"export_member_tab:\tOffset del objeto: 0x%X\n",
|
||||||
|
num_obj - 1, cadena, numregs, (unsigned int)o);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(creaobj) {
|
if (creaobj)
|
||||||
|
{
|
||||||
dll_error(creaobj, cadena);
|
dll_error(creaobj, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ob2 = o;
|
ob2 = o;
|
||||||
|
|
||||||
if ((*ob2).tipo!=tnone) {
|
if ((*ob2).tipo != tnone)
|
||||||
|
{
|
||||||
dll_error(5, cadena);
|
dll_error(5, cadena);
|
||||||
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;
|
||||||
|
@ -444,7 +475,8 @@ int EDIV_Export_Member_Tab(char* cadena, int numregs)
|
||||||
|
|
||||||
return (*ob2).tglo.offset;
|
return (*ob2).tglo.offset;
|
||||||
}
|
}
|
||||||
else { /* array miembro de struct local */
|
else
|
||||||
|
{ /* array miembro de struct local */
|
||||||
if (struct_reserved)
|
if (struct_reserved)
|
||||||
indexa_variable(v_reserved, cadena, iloc);
|
indexa_variable(v_reserved, cadena, iloc);
|
||||||
(*ob2).tipo = ttloc;
|
(*ob2).tipo = ttloc;
|
||||||
|
@ -462,10 +494,10 @@ int EDIV_Export_Member_Tab(char* cadena, int numregs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_EndStruct()
|
int EDIV_Export_EndStruct()
|
||||||
{
|
{
|
||||||
if(!decl_struct) {
|
if (!decl_struct)
|
||||||
|
{
|
||||||
dll_error(9);
|
dll_error(9);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -476,27 +508,35 @@ int EDIV_Export_EndStruct()
|
||||||
|
|
||||||
member = NULL;
|
member = NULL;
|
||||||
|
|
||||||
if(ob->tipo==tsglo) { /* cierra estructura global */
|
if (ob->tipo == tsglo)
|
||||||
if (ob->sglo.len_item==0) {
|
{ /* cierra estructura global */
|
||||||
|
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
|
||||||
if (ob->sloc.len_item==0) {
|
{ /* cierra estructura local */
|
||||||
|
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--);
|
||||||
|
@ -509,10 +549,10 @@ int EDIV_Export_EndStruct()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Local(char *cadena, int valor)
|
int EDIV_Export_Local(char *cadena, int valor)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -523,17 +563,20 @@ int EDIV_Export_Local(char* cadena, int valor)
|
||||||
printf("export_local:\t-- ID OBJETO: %d\n"
|
printf("export_local:\t-- ID OBJETO: %d\n"
|
||||||
"export_local:\tCadena exportada: %s\n"
|
"export_local:\tCadena exportada: %s\n"
|
||||||
"export_local:\tValor: %d\n"
|
"export_local:\tValor: %d\n"
|
||||||
"export_local:\tOffset del objeto: 0x%X\n",num_obj-1,cadena,valor,(unsigned int)o);
|
"export_local:\tOffset del objeto: 0x%X\n",
|
||||||
|
num_obj - 1, cadena, valor, (unsigned int)o);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(creaobj) {
|
if (creaobj)
|
||||||
|
{
|
||||||
dll_error(creaobj, cadena);
|
dll_error(creaobj, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ob = o;
|
ob = o;
|
||||||
|
|
||||||
if (ob->tipo!=tnone) {
|
if (ob->tipo != tnone)
|
||||||
|
{
|
||||||
dll_error(5, cadena);
|
dll_error(5, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -547,10 +590,10 @@ int EDIV_Export_Local(char* cadena, int valor)
|
||||||
return iloc++;
|
return iloc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Local_Tab(char *cadena, int numregs)
|
int EDIV_Export_Local_Tab(char *cadena, int numregs)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -561,17 +604,20 @@ int EDIV_Export_Local_Tab(char* cadena, int numregs)
|
||||||
printf("export_local_tab:\t-- ID OBJETO: %d\n"
|
printf("export_local_tab:\t-- ID OBJETO: %d\n"
|
||||||
"export_local_tab:\tCadena exportada: %s\n"
|
"export_local_tab:\tCadena exportada: %s\n"
|
||||||
"export_local_tab:\tN.regs: %d\n"
|
"export_local_tab:\tN.regs: %d\n"
|
||||||
"export_local_tab:\tOffset del objeto: 0x%X\n",num_obj-1,cadena,numregs,(unsigned int)o);
|
"export_local_tab:\tOffset del objeto: 0x%X\n",
|
||||||
|
num_obj - 1, cadena, numregs, (unsigned int)o);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(creaobj) {
|
if (creaobj)
|
||||||
|
{
|
||||||
dll_error(creaobj, cadena);
|
dll_error(creaobj, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ob = o;
|
ob = o;
|
||||||
|
|
||||||
if (ob->tipo!=tnone) {
|
if (ob->tipo != tnone)
|
||||||
|
{
|
||||||
dll_error(5, cadena);
|
dll_error(5, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -586,17 +632,18 @@ int EDIV_Export_Local_Tab(char* cadena, int numregs)
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Local_Struct(char *cadena, int numregs)
|
int EDIV_Export_Local_Struct(char *cadena, int numregs)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -607,26 +654,31 @@ int EDIV_Export_Local_Struct(char* cadena, int numregs)
|
||||||
printf("export_local_struct:\t-- ID OBJETO: %d\n"
|
printf("export_local_struct:\t-- ID OBJETO: %d\n"
|
||||||
"export_local_struct:\tCadena exportada: %s\n"
|
"export_local_struct:\tCadena exportada: %s\n"
|
||||||
"export_local_struct:\tN.regs: %d\n"
|
"export_local_struct:\tN.regs: %d\n"
|
||||||
"export_local_struct:\tOffset del objeto: 0x%X\n",num_obj-1,cadena,numregs,(unsigned int)o);
|
"export_local_struct:\tOffset del objeto: 0x%X\n",
|
||||||
|
num_obj - 1, cadena, numregs, (unsigned int)o);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(creaobj) {
|
if (creaobj)
|
||||||
|
{
|
||||||
dll_error(creaobj, cadena);
|
dll_error(creaobj, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
if(!strcmp(cadena,"reserved")) {
|
if (!strcmp(cadena, "reserved"))
|
||||||
|
{
|
||||||
struct_reserved = 1;
|
struct_reserved = 1;
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
|
{
|
||||||
indexa_variable(v_local, cadena, iloc);
|
indexa_variable(v_local, cadena, iloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#else
|
#else
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
@ -153,6 +154,35 @@ char *translate(int num)
|
||||||
return e[idioma][num];
|
return e[idioma][num];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_translate(int num, ...)
|
||||||
|
{
|
||||||
|
va_list arg_ptr;
|
||||||
|
const char *message = translate(num);
|
||||||
|
size_t msglen = strlen(message);
|
||||||
|
char *strbuf = malloc(msglen + 1);
|
||||||
|
|
||||||
|
va_start(arg_ptr, message);
|
||||||
|
vsprintf(strbuf, message, arg_ptr);
|
||||||
|
va_end(arg_ptr);
|
||||||
|
|
||||||
|
printf("%s", strbuf);
|
||||||
|
free(strbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *get_translate(int num, ...)
|
||||||
|
{
|
||||||
|
va_list arg_ptr;
|
||||||
|
const char *message = translate(num);
|
||||||
|
size_t msglen = strlen(message);
|
||||||
|
char *strbuf = malloc(msglen + 1);
|
||||||
|
|
||||||
|
va_start(arg_ptr, message);
|
||||||
|
vsprintf(strbuf, message, arg_ptr);
|
||||||
|
va_end(arg_ptr);
|
||||||
|
|
||||||
|
return strbuf;
|
||||||
|
}
|
||||||
|
|
||||||
static char *ediv_strlwr(char *str)
|
static char *ediv_strlwr(char *str)
|
||||||
{
|
{
|
||||||
unsigned char *p = (unsigned char *)str;
|
unsigned char *p = (unsigned char *)str;
|
||||||
|
|
|
@ -36,174 +36,275 @@ void listado_objetos (void)
|
||||||
FILE *sta;
|
FILE *sta;
|
||||||
char nombretab[256];
|
char nombretab[256];
|
||||||
int n, o, l;
|
int n, o, l;
|
||||||
|
char *msg_37 = get_translate(27, fichero_prg);
|
||||||
|
|
||||||
strcpy(nombretab, nombreprog);
|
strcpy(nombretab, nombreprog);
|
||||||
strcat(nombretab, ".tab");
|
strcat(nombretab, ".tab");
|
||||||
|
|
||||||
if((sta=fopen(nombretab,"w"))==NULL) {
|
if ((sta = fopen(nombretab, "w")) == NULL)
|
||||||
printf(translate(36),nombretab);
|
{
|
||||||
|
print_translate(36, nombretab);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(sta,translate(37),fichero_prg);
|
fprintf(sta, msg_37);
|
||||||
|
free(msg_37);
|
||||||
|
|
||||||
for (n=1;n<=8;n++) fprintf(sta,"[%u]: %u\n",n,mem[n]); fprintf(sta,"\n");
|
for (n = 1; n <= 8; n++)
|
||||||
|
fprintf(sta, "[%u]: %u\n", n, mem[n]);
|
||||||
|
fprintf(sta, "\n");
|
||||||
|
|
||||||
for (n=0;n<num_obj;n++) {
|
for (n = 0; n < num_obj; n++)
|
||||||
switch(obj[n].tipo) {
|
{
|
||||||
case tnone: fprintf(sta,"%5u\ttnone: %s",n,obj[n].name);
|
switch (obj[n].tipo)
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
{
|
||||||
|
case tnone:
|
||||||
|
fprintf(sta, "%5u\ttnone: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
break;
|
break;
|
||||||
case tcons: fprintf(sta,"%5u\ttcons: %s",n,obj[n].name);
|
case tcons:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\ttcons: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\tvalor=%u\n", obj[n].cons.valor);
|
fprintf(sta, "\tvalor=%u\n", obj[n].cons.valor);
|
||||||
break;
|
break;
|
||||||
case tvglo: fprintf(sta,"%5u\ttvglo: %s",n,obj[n].name);
|
case tvglo:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\ttvglo: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\toffset=%u\n", o = obj[n].vglo.offset);
|
fprintf(sta, "\toffset=%u\n", o = obj[n].vglo.offset);
|
||||||
if (obj[n].member) fprintf(sta,"\tmember of %s\n",(*obj[n].member).name);
|
if (obj[n].member)
|
||||||
else fprintf(sta,"\tvalor=%u\n",mem[o]);
|
fprintf(sta, "\tmember of %s\n", (*obj[n].member).name);
|
||||||
|
else
|
||||||
|
fprintf(sta, "\tvalor=%u\n", mem[o]);
|
||||||
break;
|
break;
|
||||||
case ttglo: fprintf(sta,"%5u\tttglo: %s",n,obj[n].name);
|
case ttglo:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\tttglo: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\toffset=%u\n", o = obj[n].tglo.offset);
|
fprintf(sta, "\toffset=%u\n", o = obj[n].tglo.offset);
|
||||||
fprintf(sta, "\tlen1=%u\n", obj[n].tglo.len1);
|
fprintf(sta, "\tlen1=%u\n", obj[n].tglo.len1);
|
||||||
fprintf(sta, "\tlen2=%u\n", obj[n].tglo.len2);
|
fprintf(sta, "\tlen2=%u\n", obj[n].tglo.len2);
|
||||||
fprintf(sta, "\tlen3=%u\n", obj[n].tglo.len3);
|
fprintf(sta, "\tlen3=%u\n", obj[n].tglo.len3);
|
||||||
fprintf(sta, "\ttotalen=%u\n", obj[n].tglo.totalen);
|
fprintf(sta, "\ttotalen=%u\n", obj[n].tglo.totalen);
|
||||||
if (obj[n].member) fprintf(sta,"\tmember of %s\n",(*obj[n].member).name);
|
if (obj[n].member)
|
||||||
|
fprintf(sta, "\tmember of %s\n", (*obj[n].member).name);
|
||||||
break;
|
break;
|
||||||
case tpbgl: case tpwgl: case tpcgl:
|
case tpbgl:
|
||||||
case tpigl: fprintf(sta,"%5u\ttp?gl: %s",n,obj[n].name);
|
case tpwgl:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
case tpcgl:
|
||||||
|
case tpigl:
|
||||||
|
fprintf(sta, "%5u\ttp?gl: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\toffset=%u\n", o = obj[n].tglo.offset);
|
fprintf(sta, "\toffset=%u\n", o = obj[n].tglo.offset);
|
||||||
fprintf(sta, "\tlen1=%u\n", obj[n].tglo.len1);
|
fprintf(sta, "\tlen1=%u\n", obj[n].tglo.len1);
|
||||||
fprintf(sta, "\tlen2=%u\n", obj[n].tglo.len2);
|
fprintf(sta, "\tlen2=%u\n", obj[n].tglo.len2);
|
||||||
fprintf(sta, "\tlen3=%u\n", obj[n].tglo.len3);
|
fprintf(sta, "\tlen3=%u\n", obj[n].tglo.len3);
|
||||||
fprintf(sta, "\ttotalen=%u\n", obj[n].tglo.totalen);
|
fprintf(sta, "\ttotalen=%u\n", obj[n].tglo.totalen);
|
||||||
if (obj[n].member) fprintf(sta,"\tmember of %s\n",(*obj[n].member).name);
|
if (obj[n].member)
|
||||||
|
fprintf(sta, "\tmember of %s\n", (*obj[n].member).name);
|
||||||
break;
|
break;
|
||||||
case tsglo: fprintf(sta,"%5u\ttsglo: %s",n,obj[n].name);
|
case tsglo:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\ttsglo: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\toffset=%u\n", o = obj[n].sglo.offset);
|
fprintf(sta, "\toffset=%u\n", o = obj[n].sglo.offset);
|
||||||
fprintf(sta, "\titems1=%u\n", obj[n].sglo.items1);
|
fprintf(sta, "\titems1=%u\n", obj[n].sglo.items1);
|
||||||
fprintf(sta, "\titems2=%u\n", obj[n].sglo.items2);
|
fprintf(sta, "\titems2=%u\n", obj[n].sglo.items2);
|
||||||
fprintf(sta, "\titems3=%u\n", obj[n].sglo.items3);
|
fprintf(sta, "\titems3=%u\n", obj[n].sglo.items3);
|
||||||
fprintf(sta, "\ttotalitems=%u\n", l = obj[n].sglo.totalitems);
|
fprintf(sta, "\ttotalitems=%u\n", l = obj[n].sglo.totalitems);
|
||||||
fprintf(sta, "\tlen_item=%u\n", obj[n].sglo.len_item);
|
fprintf(sta, "\tlen_item=%u\n", obj[n].sglo.len_item);
|
||||||
if (obj[n].member) fprintf(sta,"\tmember of %s\n",(*obj[n].member).name);
|
if (obj[n].member)
|
||||||
|
fprintf(sta, "\tmember of %s\n", (*obj[n].member).name);
|
||||||
break;
|
break;
|
||||||
case tpsgl: fprintf(sta,"%5u\ttpsgl: %s",n,obj[n].name);
|
case tpsgl:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\ttpsgl: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\toffset=%u\n", o = obj[n].sglo.offset);
|
fprintf(sta, "\toffset=%u\n", o = obj[n].sglo.offset);
|
||||||
fprintf(sta, "\titems1=%u\n", obj[n].sglo.items1);
|
fprintf(sta, "\titems1=%u\n", obj[n].sglo.items1);
|
||||||
fprintf(sta, "\titems2=%u\n", obj[n].sglo.items2);
|
fprintf(sta, "\titems2=%u\n", obj[n].sglo.items2);
|
||||||
fprintf(sta, "\titems3=%u\n", obj[n].sglo.items3);
|
fprintf(sta, "\titems3=%u\n", obj[n].sglo.items3);
|
||||||
fprintf(sta, "\ttotalitems=%u\n", l = obj[n].sglo.totalitems);
|
fprintf(sta, "\ttotalitems=%u\n", l = obj[n].sglo.totalitems);
|
||||||
fprintf(sta, "\tlen_item=%u\n", obj[n].sglo.len_item);
|
fprintf(sta, "\tlen_item=%u\n", obj[n].sglo.len_item);
|
||||||
if (obj[n].member) fprintf(sta,"\tmember of %s\n",(*obj[n].member).name);
|
if (obj[n].member)
|
||||||
|
fprintf(sta, "\tmember of %s\n", (*obj[n].member).name);
|
||||||
break;
|
break;
|
||||||
case tvloc: fprintf(sta,"%5u\ttvloc: %s",n,obj[n].name);
|
case tvloc:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\ttvloc: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\toffset=%u\n", o = obj[n].vloc.offset);
|
fprintf(sta, "\toffset=%u\n", o = obj[n].vloc.offset);
|
||||||
if (obj[n].member) fprintf(sta,"\tmember of %s\n",(*obj[n].member).name);
|
if (obj[n].member)
|
||||||
else fprintf(sta,"\tvalor=%u\n",loc[o]);
|
fprintf(sta, "\tmember of %s\n", (*obj[n].member).name);
|
||||||
|
else
|
||||||
|
fprintf(sta, "\tvalor=%u\n", loc[o]);
|
||||||
break;
|
break;
|
||||||
case ttloc: fprintf(sta,"%5u\tttloc: %s",n,obj[n].name);
|
case ttloc:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\tttloc: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\toffset=%u\n", o = obj[n].tloc.offset);
|
fprintf(sta, "\toffset=%u\n", o = obj[n].tloc.offset);
|
||||||
fprintf(sta, "\tlen1=%u\n", obj[n].tloc.len1);
|
fprintf(sta, "\tlen1=%u\n", obj[n].tloc.len1);
|
||||||
fprintf(sta, "\tlen2=%u\n", obj[n].tloc.len2);
|
fprintf(sta, "\tlen2=%u\n", obj[n].tloc.len2);
|
||||||
fprintf(sta, "\tlen3=%u\n", obj[n].tloc.len3);
|
fprintf(sta, "\tlen3=%u\n", obj[n].tloc.len3);
|
||||||
fprintf(sta, "\ttotalen=%u\n", obj[n].tloc.totalen);
|
fprintf(sta, "\ttotalen=%u\n", obj[n].tloc.totalen);
|
||||||
if (obj[n].member) fprintf(sta,"\tmember of %s\n",(*obj[n].member).name);
|
if (obj[n].member)
|
||||||
|
fprintf(sta, "\tmember of %s\n", (*obj[n].member).name);
|
||||||
break;
|
break;
|
||||||
case tpblo: case tpwlo: case tpclo:
|
case tpblo:
|
||||||
case tpilo: fprintf(sta,"%5u\ttp?lo: %s",n,obj[n].name);
|
case tpwlo:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
case tpclo:
|
||||||
|
case tpilo:
|
||||||
|
fprintf(sta, "%5u\ttp?lo: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\toffset=%u\n", o = obj[n].tloc.offset);
|
fprintf(sta, "\toffset=%u\n", o = obj[n].tloc.offset);
|
||||||
fprintf(sta, "\tlen1=%u\n", obj[n].tloc.len1);
|
fprintf(sta, "\tlen1=%u\n", obj[n].tloc.len1);
|
||||||
fprintf(sta, "\tlen2=%u\n", obj[n].tloc.len2);
|
fprintf(sta, "\tlen2=%u\n", obj[n].tloc.len2);
|
||||||
fprintf(sta, "\tlen3=%u\n", obj[n].tloc.len3);
|
fprintf(sta, "\tlen3=%u\n", obj[n].tloc.len3);
|
||||||
fprintf(sta, "\ttotalen=%u\n", obj[n].tloc.totalen);
|
fprintf(sta, "\ttotalen=%u\n", obj[n].tloc.totalen);
|
||||||
if (obj[n].member) fprintf(sta,"\tmember of %s\n",(*obj[n].member).name);
|
if (obj[n].member)
|
||||||
|
fprintf(sta, "\tmember of %s\n", (*obj[n].member).name);
|
||||||
break;
|
break;
|
||||||
case tsloc: fprintf(sta,"%5u\ttsloc: %s",n,obj[n].name);
|
case tsloc:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\ttsloc: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\toffset=%u\n", o = obj[n].sloc.offset);
|
fprintf(sta, "\toffset=%u\n", o = obj[n].sloc.offset);
|
||||||
fprintf(sta, "\titems1=%u\n", obj[n].sloc.items1);
|
fprintf(sta, "\titems1=%u\n", obj[n].sloc.items1);
|
||||||
fprintf(sta, "\titems2=%u\n", obj[n].sloc.items2);
|
fprintf(sta, "\titems2=%u\n", obj[n].sloc.items2);
|
||||||
fprintf(sta, "\titems3=%u\n", obj[n].sloc.items3);
|
fprintf(sta, "\titems3=%u\n", obj[n].sloc.items3);
|
||||||
fprintf(sta, "\ttotalitems=%u\n", l = obj[n].sloc.totalitems);
|
fprintf(sta, "\ttotalitems=%u\n", l = obj[n].sloc.totalitems);
|
||||||
fprintf(sta, "\tlen_item=%u\n", obj[n].sloc.len_item);
|
fprintf(sta, "\tlen_item=%u\n", obj[n].sloc.len_item);
|
||||||
if (obj[n].member) fprintf(sta,"\tmember of %s\n",(*obj[n].member).name);
|
if (obj[n].member)
|
||||||
|
fprintf(sta, "\tmember of %s\n", (*obj[n].member).name);
|
||||||
break;
|
break;
|
||||||
case tpslo: fprintf(sta,"%5u\ttpslo: %s",n,obj[n].name);
|
case tpslo:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\ttpslo: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\toffset=%u\n", o = obj[n].sloc.offset);
|
fprintf(sta, "\toffset=%u\n", o = obj[n].sloc.offset);
|
||||||
fprintf(sta, "\titems1=%u\n", obj[n].sloc.items1);
|
fprintf(sta, "\titems1=%u\n", obj[n].sloc.items1);
|
||||||
fprintf(sta, "\titems2=%u\n", obj[n].sloc.items2);
|
fprintf(sta, "\titems2=%u\n", obj[n].sloc.items2);
|
||||||
fprintf(sta, "\titems3=%u\n", obj[n].sloc.items3);
|
fprintf(sta, "\titems3=%u\n", obj[n].sloc.items3);
|
||||||
fprintf(sta, "\ttotalitems=%u\n", l = obj[n].sloc.totalitems);
|
fprintf(sta, "\ttotalitems=%u\n", l = obj[n].sloc.totalitems);
|
||||||
fprintf(sta, "\tlen_item=%u\n", obj[n].sloc.len_item);
|
fprintf(sta, "\tlen_item=%u\n", obj[n].sloc.len_item);
|
||||||
if (obj[n].member) fprintf(sta,"\tmember of %s\n",(*obj[n].member).name);
|
if (obj[n].member)
|
||||||
|
fprintf(sta, "\tmember of %s\n", (*obj[n].member).name);
|
||||||
break;
|
break;
|
||||||
case tproc: fprintf(sta,"%5u\ttproc: %s",n,obj[n].name);
|
case tproc:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\ttproc: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\ttipo=%u\n", (int)(obj[n].proc.bloque));
|
fprintf(sta, "\ttipo=%u\n", (int)(obj[n].proc.bloque));
|
||||||
fprintf(sta, "\toffset=%u\n", obj[n].proc.offset);
|
fprintf(sta, "\toffset=%u\n", obj[n].proc.offset);
|
||||||
fprintf(sta, "\tnum_par=%u\n", obj[n].proc.num_par);
|
fprintf(sta, "\tnum_par=%u\n", obj[n].proc.num_par);
|
||||||
break;
|
break;
|
||||||
case tfext: fprintf(sta,"%5u\ttfext: %s",n,obj[n].name);
|
case tfext:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\ttfext: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\tcodigo=%u\n", obj[n].fext.codigo);
|
fprintf(sta, "\tcodigo=%u\n", obj[n].fext.codigo);
|
||||||
fprintf(sta, "\tnum_par=%u\n", obj[n].fext.num_par);
|
fprintf(sta, "\tnum_par=%u\n", obj[n].fext.num_par);
|
||||||
break;
|
break;
|
||||||
case tbglo: fprintf(sta,"%5u\ttbglo: %s",n,obj[n].name);
|
case tbglo:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\ttbglo: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\toffset=%u\n", o = obj[n].bglo.offset);
|
fprintf(sta, "\toffset=%u\n", o = obj[n].bglo.offset);
|
||||||
fprintf(sta, "\tlen1=%u\n", obj[n].bglo.len1);
|
fprintf(sta, "\tlen1=%u\n", obj[n].bglo.len1);
|
||||||
fprintf(sta, "\tlen2=%u\n", obj[n].bglo.len2);
|
fprintf(sta, "\tlen2=%u\n", obj[n].bglo.len2);
|
||||||
fprintf(sta, "\tlen3=%u\n", obj[n].bglo.len3);
|
fprintf(sta, "\tlen3=%u\n", obj[n].bglo.len3);
|
||||||
fprintf(sta, "\ttotalen=%u\n", obj[n].bglo.totalen);
|
fprintf(sta, "\ttotalen=%u\n", obj[n].bglo.totalen);
|
||||||
if (obj[n].member) fprintf(sta,"\tmember of %s\n",(*obj[n].member).name);
|
if (obj[n].member)
|
||||||
|
fprintf(sta, "\tmember of %s\n", (*obj[n].member).name);
|
||||||
break;
|
break;
|
||||||
case tbloc: fprintf(sta,"%5u\ttbloc: %s",n,obj[n].name);
|
case tbloc:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\ttbloc: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\toffset=%u\n", o = obj[n].bglo.offset);
|
fprintf(sta, "\toffset=%u\n", o = obj[n].bglo.offset);
|
||||||
fprintf(sta, "\tlen1=%u\n", obj[n].bglo.len1);
|
fprintf(sta, "\tlen1=%u\n", obj[n].bglo.len1);
|
||||||
fprintf(sta, "\tlen2=%u\n", obj[n].bglo.len2);
|
fprintf(sta, "\tlen2=%u\n", obj[n].bglo.len2);
|
||||||
fprintf(sta, "\tlen3=%u\n", obj[n].bglo.len3);
|
fprintf(sta, "\tlen3=%u\n", obj[n].bglo.len3);
|
||||||
fprintf(sta, "\ttotalen=%u\n", obj[n].bglo.totalen);
|
fprintf(sta, "\ttotalen=%u\n", obj[n].bglo.totalen);
|
||||||
if (obj[n].member) fprintf(sta,"\tmember of %s\n",(*obj[n].member).name);
|
if (obj[n].member)
|
||||||
|
fprintf(sta, "\tmember of %s\n", (*obj[n].member).name);
|
||||||
break;
|
break;
|
||||||
case twglo: fprintf(sta,"%5u\ttwglo: %s",n,obj[n].name);
|
case twglo:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\ttwglo: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\toffset=%u\n", o = obj[n].bglo.offset);
|
fprintf(sta, "\toffset=%u\n", o = obj[n].bglo.offset);
|
||||||
fprintf(sta, "\tlen1=%u\n", obj[n].bglo.len1);
|
fprintf(sta, "\tlen1=%u\n", obj[n].bglo.len1);
|
||||||
fprintf(sta, "\tlen2=%u\n", obj[n].bglo.len2);
|
fprintf(sta, "\tlen2=%u\n", obj[n].bglo.len2);
|
||||||
fprintf(sta, "\tlen3=%u\n", obj[n].bglo.len3);
|
fprintf(sta, "\tlen3=%u\n", obj[n].bglo.len3);
|
||||||
fprintf(sta, "\ttotalen=%u\n", obj[n].bglo.totalen);
|
fprintf(sta, "\ttotalen=%u\n", obj[n].bglo.totalen);
|
||||||
if (obj[n].member) fprintf(sta,"\tmember of %s\n",(*obj[n].member).name);
|
if (obj[n].member)
|
||||||
|
fprintf(sta, "\tmember of %s\n", (*obj[n].member).name);
|
||||||
break;
|
break;
|
||||||
case twloc: fprintf(sta,"%5u\ttwloc: %s",n,obj[n].name);
|
case twloc:
|
||||||
if (obj[n].usado) fprintf(sta," (*) usado\n"); else fprintf(sta,"\n");
|
fprintf(sta, "%5u\ttwloc: %s", n, obj[n].name);
|
||||||
|
if (obj[n].usado)
|
||||||
|
fprintf(sta, " (*) usado\n");
|
||||||
|
else
|
||||||
|
fprintf(sta, "\n");
|
||||||
fprintf(sta, "\toffset=%u\n", o = obj[n].bglo.offset);
|
fprintf(sta, "\toffset=%u\n", o = obj[n].bglo.offset);
|
||||||
fprintf(sta, "\tlen1=%u\n", obj[n].bglo.len1);
|
fprintf(sta, "\tlen1=%u\n", obj[n].bglo.len1);
|
||||||
fprintf(sta, "\tlen2=%u\n", obj[n].bglo.len2);
|
fprintf(sta, "\tlen2=%u\n", obj[n].bglo.len2);
|
||||||
fprintf(sta, "\tlen3=%u\n", obj[n].bglo.len3);
|
fprintf(sta, "\tlen3=%u\n", obj[n].bglo.len3);
|
||||||
fprintf(sta, "\ttotalen=%u\n", obj[n].bglo.totalen);
|
fprintf(sta, "\ttotalen=%u\n", obj[n].bglo.totalen);
|
||||||
if (obj[n].member) fprintf(sta,"\tmember of %s\n",(*obj[n].member).name);
|
if (obj[n].member)
|
||||||
|
fprintf(sta, "\tmember of %s\n", (*obj[n].member).name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fprintf(sta,translate(38),(unsigned int)obj[n].bloque,(unsigned int)obj[n].anterior);
|
|
||||||
|
char *msg_38 = get_translate(38, (unsigned int)obj[n].bloque, (unsigned int)obj[n].anterior);
|
||||||
|
fprintf(sta, msg_38);
|
||||||
|
free(msg_38);
|
||||||
fprintf(sta, "\n");
|
fprintf(sta, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(sta);
|
fclose(sta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Graba el fichero ensamblador
|
* Graba el fichero ensamblador
|
||||||
*/
|
*/
|
||||||
|
@ -216,150 +317,448 @@ void listado_ensamblador (void)
|
||||||
strcpy(nombreeml, nombreprog);
|
strcpy(nombreeml, nombreprog);
|
||||||
strcat(nombreeml, ".eml");
|
strcat(nombreeml, ".eml");
|
||||||
|
|
||||||
if((sta=fopen(nombreeml,"w"))==NULL) {
|
if ((sta = fopen(nombreeml, "w")) == NULL)
|
||||||
printf(translate(36),nombreeml);
|
{
|
||||||
|
print_translate(36, nombreeml);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(sta,translate(39),fichero_prg);
|
char *msg_39 = get_translate(39, fichero_prg);
|
||||||
|
fprintf(sta, msg_39);
|
||||||
|
free(msg_39);
|
||||||
|
|
||||||
while (i<imem) { switch ((byte)mem[i]) {
|
while (i < imem)
|
||||||
case lnop: fprintf(sta,"%5u\tnop",i); break;
|
{
|
||||||
case lcar: fprintf(sta,"%5u\tcar %u",i,mem[i+1]); i++; break;
|
switch ((byte)mem[i])
|
||||||
case lasi: fprintf(sta,"%5u\tasi",i); break;
|
{
|
||||||
case lori: fprintf(sta,"%5u\tori",i); break;
|
case lnop:
|
||||||
case lxor: fprintf(sta,"%5u\txor",i); break;
|
fprintf(sta, "%5u\tnop", i);
|
||||||
case land: fprintf(sta,"%5u\tand",i); break;
|
break;
|
||||||
case ligu: fprintf(sta,"%5u\tigu",i); break;
|
case lcar:
|
||||||
case ldis: fprintf(sta,"%5u\tdis",i); break;
|
fprintf(sta, "%5u\tcar %u", i, mem[i + 1]);
|
||||||
case lmay: fprintf(sta,"%5u\tmay",i); break;
|
i++;
|
||||||
case lmen: fprintf(sta,"%5u\tmen",i); break;
|
break;
|
||||||
case lmei: fprintf(sta,"%5u\tmei",i); break;
|
case lasi:
|
||||||
case lmai: fprintf(sta,"%5u\tmai",i); break;
|
fprintf(sta, "%5u\tasi", i);
|
||||||
case ladd: fprintf(sta,"%5u\tadd",i); break;
|
break;
|
||||||
case lsub: fprintf(sta,"%5u\tsub",i); break;
|
case lori:
|
||||||
case lmul: fprintf(sta,"%5u\tmul",i); break;
|
fprintf(sta, "%5u\tori", i);
|
||||||
case ldiv: fprintf(sta,"%5u\tdiv",i); break;
|
break;
|
||||||
case lmod: fprintf(sta,"%5u\tmod",i); break;
|
case lxor:
|
||||||
case lneg: fprintf(sta,"%5u\tneg",i); break;
|
fprintf(sta, "%5u\txor", i);
|
||||||
case lptr: fprintf(sta,"%5u\tptr",i); break;
|
break;
|
||||||
case lnot: fprintf(sta,"%5u\tnot",i); break;
|
case land:
|
||||||
case laid: fprintf(sta,"%5u\taid",i); break;
|
fprintf(sta, "%5u\tand", i);
|
||||||
case lcid: fprintf(sta,"%5u\tcid",i); break;
|
break;
|
||||||
case lrng: fprintf(sta,"%5u\trng %u",i,mem[i+1]); i++; break;
|
case ligu:
|
||||||
case ljmp: fprintf(sta,"%5u\tjmp %u",i,mem[i+1]); i++; break;
|
fprintf(sta, "%5u\tigu", i);
|
||||||
case ljpf: fprintf(sta,"%5u\tjpf %u",i,mem[i+1]); i++; break;
|
break;
|
||||||
case lfun: fprintf(sta,"%5u\tfun %u",i,mem[i+1]); i++; break;
|
case ldis:
|
||||||
case lcal: fprintf(sta,"%5u\tcal %u",i,mem[i+1]); i++; break;
|
fprintf(sta, "%5u\tdis", i);
|
||||||
case lret: fprintf(sta,"%5u\tret",i); break;
|
break;
|
||||||
case lasp: fprintf(sta,"%5u\tasp",i); break;
|
case lmay:
|
||||||
case lfrm: fprintf(sta,"%5u\tfrm",i); break;
|
fprintf(sta, "%5u\tmay", i);
|
||||||
case lcbp: fprintf(sta,"%5u\tcbp %u",i,mem[i+1]); i++; break;
|
break;
|
||||||
case lcpa: fprintf(sta,"%5u\tcpa",i); break;
|
case lmen:
|
||||||
case ltyp: fprintf(sta,"\n%5u\ttyp %u",i,mem[i+1]); i++; break;
|
fprintf(sta, "%5u\tmen", i);
|
||||||
case lpri: fprintf(sta,"%5u\tpri %u",i,mem[i+1]); i++; break;
|
break;
|
||||||
case lcse: fprintf(sta,"%5u\tcse %u",i,mem[i+1]); i++; break;
|
case lmei:
|
||||||
case lcsr: fprintf(sta,"%5u\tcsr %u",i,mem[i+1]); i++; break;
|
fprintf(sta, "%5u\tmei", i);
|
||||||
case lshr: fprintf(sta,"%5u\tshr",i); break;
|
break;
|
||||||
case lshl: fprintf(sta,"%5u\tshl",i); break;
|
case lmai:
|
||||||
case lipt: fprintf(sta,"%5u\tipt",i); break;
|
fprintf(sta, "%5u\tmai", i);
|
||||||
case lpti: fprintf(sta,"%5u\tpti",i); break;
|
break;
|
||||||
case ldpt: fprintf(sta,"%5u\tdpt",i); break;
|
case ladd:
|
||||||
case lptd: fprintf(sta,"%5u\tptd",i); break;
|
fprintf(sta, "%5u\tadd", i);
|
||||||
case lada: fprintf(sta,"%5u\tada",i); break;
|
break;
|
||||||
case lsua: fprintf(sta,"%5u\tsua",i); break;
|
case lsub:
|
||||||
case lmua: fprintf(sta,"%5u\tmua",i); break;
|
fprintf(sta, "%5u\tsub", i);
|
||||||
case ldia: fprintf(sta,"%5u\tdia",i); break;
|
break;
|
||||||
case lmoa: fprintf(sta,"%5u\tmoa",i); break;
|
case lmul:
|
||||||
case lana: fprintf(sta,"%5u\tana",i); break;
|
fprintf(sta, "%5u\tmul", i);
|
||||||
case lora: fprintf(sta,"%5u\tora",i); break;
|
break;
|
||||||
case lxoa: fprintf(sta,"%5u\txoa",i); break;
|
case ldiv:
|
||||||
case lsra: fprintf(sta,"%5u\tsra",i); break;
|
fprintf(sta, "%5u\tdiv", i);
|
||||||
case lsla: fprintf(sta,"%5u\tsla",i); break;
|
break;
|
||||||
case lpar: fprintf(sta,"%5u\tpar %u",i,mem[i+1]); i++; break;
|
case lmod:
|
||||||
case lrtf: fprintf(sta,"%5u\trtf",i); break;
|
fprintf(sta, "%5u\tmod", i);
|
||||||
case lclo: fprintf(sta,"%5u\tclo %u",i,mem[i+1]); i++; break;
|
break;
|
||||||
case lfrf: fprintf(sta,"%5u\tfrf",i); break;
|
case lneg:
|
||||||
case limp: fprintf(sta,"%5u\timp %u",i,mem[i+1]); i++; break;
|
fprintf(sta, "%5u\tneg", i);
|
||||||
case lext: fprintf(sta,"%5u\text %u",i,mem[i+1]); i++; break;
|
break;
|
||||||
case lchk: fprintf(sta,"%5u\tchk",i); break;
|
case lptr:
|
||||||
case ldbg: fprintf(sta,"%5u\tdbg",i); break;
|
fprintf(sta, "%5u\tptr", i);
|
||||||
|
break;
|
||||||
|
case lnot:
|
||||||
|
fprintf(sta, "%5u\tnot", i);
|
||||||
|
break;
|
||||||
|
case laid:
|
||||||
|
fprintf(sta, "%5u\taid", i);
|
||||||
|
break;
|
||||||
|
case lcid:
|
||||||
|
fprintf(sta, "%5u\tcid", i);
|
||||||
|
break;
|
||||||
|
case lrng:
|
||||||
|
fprintf(sta, "%5u\trng %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case ljmp:
|
||||||
|
fprintf(sta, "%5u\tjmp %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case ljpf:
|
||||||
|
fprintf(sta, "%5u\tjpf %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lfun:
|
||||||
|
fprintf(sta, "%5u\tfun %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lcal:
|
||||||
|
fprintf(sta, "%5u\tcal %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lret:
|
||||||
|
fprintf(sta, "%5u\tret", i);
|
||||||
|
break;
|
||||||
|
case lasp:
|
||||||
|
fprintf(sta, "%5u\tasp", i);
|
||||||
|
break;
|
||||||
|
case lfrm:
|
||||||
|
fprintf(sta, "%5u\tfrm", i);
|
||||||
|
break;
|
||||||
|
case lcbp:
|
||||||
|
fprintf(sta, "%5u\tcbp %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lcpa:
|
||||||
|
fprintf(sta, "%5u\tcpa", i);
|
||||||
|
break;
|
||||||
|
case ltyp:
|
||||||
|
fprintf(sta, "\n%5u\ttyp %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lpri:
|
||||||
|
fprintf(sta, "%5u\tpri %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lcse:
|
||||||
|
fprintf(sta, "%5u\tcse %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lcsr:
|
||||||
|
fprintf(sta, "%5u\tcsr %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lshr:
|
||||||
|
fprintf(sta, "%5u\tshr", i);
|
||||||
|
break;
|
||||||
|
case lshl:
|
||||||
|
fprintf(sta, "%5u\tshl", i);
|
||||||
|
break;
|
||||||
|
case lipt:
|
||||||
|
fprintf(sta, "%5u\tipt", i);
|
||||||
|
break;
|
||||||
|
case lpti:
|
||||||
|
fprintf(sta, "%5u\tpti", i);
|
||||||
|
break;
|
||||||
|
case ldpt:
|
||||||
|
fprintf(sta, "%5u\tdpt", i);
|
||||||
|
break;
|
||||||
|
case lptd:
|
||||||
|
fprintf(sta, "%5u\tptd", i);
|
||||||
|
break;
|
||||||
|
case lada:
|
||||||
|
fprintf(sta, "%5u\tada", i);
|
||||||
|
break;
|
||||||
|
case lsua:
|
||||||
|
fprintf(sta, "%5u\tsua", i);
|
||||||
|
break;
|
||||||
|
case lmua:
|
||||||
|
fprintf(sta, "%5u\tmua", i);
|
||||||
|
break;
|
||||||
|
case ldia:
|
||||||
|
fprintf(sta, "%5u\tdia", i);
|
||||||
|
break;
|
||||||
|
case lmoa:
|
||||||
|
fprintf(sta, "%5u\tmoa", i);
|
||||||
|
break;
|
||||||
|
case lana:
|
||||||
|
fprintf(sta, "%5u\tana", i);
|
||||||
|
break;
|
||||||
|
case lora:
|
||||||
|
fprintf(sta, "%5u\tora", i);
|
||||||
|
break;
|
||||||
|
case lxoa:
|
||||||
|
fprintf(sta, "%5u\txoa", i);
|
||||||
|
break;
|
||||||
|
case lsra:
|
||||||
|
fprintf(sta, "%5u\tsra", i);
|
||||||
|
break;
|
||||||
|
case lsla:
|
||||||
|
fprintf(sta, "%5u\tsla", i);
|
||||||
|
break;
|
||||||
|
case lpar:
|
||||||
|
fprintf(sta, "%5u\tpar %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lrtf:
|
||||||
|
fprintf(sta, "%5u\trtf", i);
|
||||||
|
break;
|
||||||
|
case lclo:
|
||||||
|
fprintf(sta, "%5u\tclo %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lfrf:
|
||||||
|
fprintf(sta, "%5u\tfrf", i);
|
||||||
|
break;
|
||||||
|
case limp:
|
||||||
|
fprintf(sta, "%5u\timp %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lext:
|
||||||
|
fprintf(sta, "%5u\text %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lchk:
|
||||||
|
fprintf(sta, "%5u\tchk", i);
|
||||||
|
break;
|
||||||
|
case ldbg:
|
||||||
|
fprintf(sta, "%5u\tdbg", i);
|
||||||
|
break;
|
||||||
|
|
||||||
case lcar2: fprintf(sta,"%5u\tcar2 %u %u",i,mem[i+1],mem[i+2]); i+=2; break;
|
case lcar2:
|
||||||
case lcar3: fprintf(sta,"%5u\tcar3 %u %u %u",i,mem[i+1],mem[i+2],mem[i+3]); i+=3; break;
|
fprintf(sta, "%5u\tcar2 %u %u", i, mem[i + 1], mem[i + 2]);
|
||||||
case lcar4: fprintf(sta,"%5u\tcar4 %u %u %u %u",i,mem[i+1],mem[i+2],mem[i+3],mem[i+4]); i+=4; break;
|
i += 2;
|
||||||
case lasiasp: fprintf(sta,"%5u\tasiasp",i); break;
|
break;
|
||||||
case lcaraid: fprintf(sta,"%5u\tcaraid %u",i,mem[i+1]); i++; break;
|
case lcar3:
|
||||||
case lcarptr: fprintf(sta,"%5u\tcarptr %u",i,mem[i+1]); i++; break;
|
fprintf(sta, "%5u\tcar3 %u %u %u", i, mem[i + 1], mem[i + 2], mem[i + 3]);
|
||||||
case laidptr: fprintf(sta,"%5u\taidptr",i); break;
|
i += 3;
|
||||||
case lcaraidptr: fprintf(sta,"%5u\tcaraidptr %u",i,mem[i+1]); i++; break;
|
break;
|
||||||
case lcaraidcpa: fprintf(sta,"%5u\tcaraidcpa %u",i,mem[i+1]); i++; break;
|
case lcar4:
|
||||||
case laddptr: fprintf(sta,"%5u\taddptr",i); break;
|
fprintf(sta, "%5u\tcar4 %u %u %u %u", i, mem[i + 1], mem[i + 2], mem[i + 3], mem[i + 4]);
|
||||||
case lfunasp: fprintf(sta,"%5u\tfunasp %u",i,mem[i+1]); i++; break;
|
i += 4;
|
||||||
case lcaradd: fprintf(sta,"%5u\tcaradd %u",i,mem[i+1]); i++; break;
|
break;
|
||||||
case lcaraddptr: fprintf(sta,"%5u\tcaraddptr %u",i,mem[i+1]); i++; break;
|
case lasiasp:
|
||||||
case lcarmul: fprintf(sta,"%5u\tcarmul %u",i,mem[i+1]); i++; break;
|
fprintf(sta, "%5u\tasiasp", i);
|
||||||
case lcarmuladd: fprintf(sta,"%5u\tcarmuladd %u",i,mem[i+1]); i++; break;
|
break;
|
||||||
case lcarasiasp: fprintf(sta,"%5u\tcarasiasp %u",i,mem[i+1]); i++; break;
|
case lcaraid:
|
||||||
case lcarsub: fprintf(sta,"%5u\tcarsub %u",i,mem[i+1]); i++; break;
|
fprintf(sta, "%5u\tcaraid %u", i, mem[i + 1]);
|
||||||
case lcardiv: fprintf(sta,"%5u\tcardiv %u",i,mem[i+1]); i++; break;
|
i++;
|
||||||
|
break;
|
||||||
|
case lcarptr:
|
||||||
|
fprintf(sta, "%5u\tcarptr %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case laidptr:
|
||||||
|
fprintf(sta, "%5u\taidptr", i);
|
||||||
|
break;
|
||||||
|
case lcaraidptr:
|
||||||
|
fprintf(sta, "%5u\tcaraidptr %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lcaraidcpa:
|
||||||
|
fprintf(sta, "%5u\tcaraidcpa %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case laddptr:
|
||||||
|
fprintf(sta, "%5u\taddptr", i);
|
||||||
|
break;
|
||||||
|
case lfunasp:
|
||||||
|
fprintf(sta, "%5u\tfunasp %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lcaradd:
|
||||||
|
fprintf(sta, "%5u\tcaradd %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lcaraddptr:
|
||||||
|
fprintf(sta, "%5u\tcaraddptr %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lcarmul:
|
||||||
|
fprintf(sta, "%5u\tcarmul %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lcarmuladd:
|
||||||
|
fprintf(sta, "%5u\tcarmuladd %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lcarasiasp:
|
||||||
|
fprintf(sta, "%5u\tcarasiasp %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lcarsub:
|
||||||
|
fprintf(sta, "%5u\tcarsub %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
case lcardiv:
|
||||||
|
fprintf(sta, "%5u\tcardiv %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
|
||||||
case lptrwor: fprintf(sta,"%5u\tptrwor",i); break;
|
case lptrwor:
|
||||||
case lasiwor: fprintf(sta,"%5u\tasiwor",i); break;
|
fprintf(sta, "%5u\tptrwor", i);
|
||||||
case liptwor: fprintf(sta,"%5u\tiptwor",i); break;
|
break;
|
||||||
case lptiwor: fprintf(sta,"%5u\tptiwor",i); break;
|
case lasiwor:
|
||||||
case ldptwor: fprintf(sta,"%5u\tdptwor",i); break;
|
fprintf(sta, "%5u\tasiwor", i);
|
||||||
case lptdwor: fprintf(sta,"%5u\tptdwor",i); break;
|
break;
|
||||||
case ladawor: fprintf(sta,"%5u\tadawor",i); break;
|
case liptwor:
|
||||||
case lsuawor: fprintf(sta,"%5u\tsuawor",i); break;
|
fprintf(sta, "%5u\tiptwor", i);
|
||||||
case lmuawor: fprintf(sta,"%5u\tmuawor",i); break;
|
break;
|
||||||
case ldiawor: fprintf(sta,"%5u\tdiawor",i); break;
|
case lptiwor:
|
||||||
case lmoawor: fprintf(sta,"%5u\tmoawor",i); break;
|
fprintf(sta, "%5u\tptiwor", i);
|
||||||
case lanawor: fprintf(sta,"%5u\tanawor",i); break;
|
break;
|
||||||
case lorawor: fprintf(sta,"%5u\torawor",i); break;
|
case ldptwor:
|
||||||
case lxoawor: fprintf(sta,"%5u\txoawor",i); break;
|
fprintf(sta, "%5u\tdptwor", i);
|
||||||
case lsrawor: fprintf(sta,"%5u\tsrawor",i); break;
|
break;
|
||||||
case lslawor: fprintf(sta,"%5u\tslawor",i); break;
|
case lptdwor:
|
||||||
case lcpawor: fprintf(sta,"%5u\tcpawor",i); break;
|
fprintf(sta, "%5u\tptdwor", i);
|
||||||
|
break;
|
||||||
|
case ladawor:
|
||||||
|
fprintf(sta, "%5u\tadawor", i);
|
||||||
|
break;
|
||||||
|
case lsuawor:
|
||||||
|
fprintf(sta, "%5u\tsuawor", i);
|
||||||
|
break;
|
||||||
|
case lmuawor:
|
||||||
|
fprintf(sta, "%5u\tmuawor", i);
|
||||||
|
break;
|
||||||
|
case ldiawor:
|
||||||
|
fprintf(sta, "%5u\tdiawor", i);
|
||||||
|
break;
|
||||||
|
case lmoawor:
|
||||||
|
fprintf(sta, "%5u\tmoawor", i);
|
||||||
|
break;
|
||||||
|
case lanawor:
|
||||||
|
fprintf(sta, "%5u\tanawor", i);
|
||||||
|
break;
|
||||||
|
case lorawor:
|
||||||
|
fprintf(sta, "%5u\torawor", i);
|
||||||
|
break;
|
||||||
|
case lxoawor:
|
||||||
|
fprintf(sta, "%5u\txoawor", i);
|
||||||
|
break;
|
||||||
|
case lsrawor:
|
||||||
|
fprintf(sta, "%5u\tsrawor", i);
|
||||||
|
break;
|
||||||
|
case lslawor:
|
||||||
|
fprintf(sta, "%5u\tslawor", i);
|
||||||
|
break;
|
||||||
|
case lcpawor:
|
||||||
|
fprintf(sta, "%5u\tcpawor", i);
|
||||||
|
break;
|
||||||
|
|
||||||
case lptrchr: fprintf(sta,"%5u\tptrchr",i); break;
|
case lptrchr:
|
||||||
case lasichr: fprintf(sta,"%5u\tasichr",i); break;
|
fprintf(sta, "%5u\tptrchr", i);
|
||||||
case liptchr: fprintf(sta,"%5u\tiptchr",i); break;
|
break;
|
||||||
case lptichr: fprintf(sta,"%5u\tptichr",i); break;
|
case lasichr:
|
||||||
case ldptchr: fprintf(sta,"%5u\tdptchr",i); break;
|
fprintf(sta, "%5u\tasichr", i);
|
||||||
case lptdchr: fprintf(sta,"%5u\tptdchr",i); break;
|
break;
|
||||||
case ladachr: fprintf(sta,"%5u\tadachr",i); break;
|
case liptchr:
|
||||||
case lsuachr: fprintf(sta,"%5u\tsuachr",i); break;
|
fprintf(sta, "%5u\tiptchr", i);
|
||||||
case lmuachr: fprintf(sta,"%5u\tmuachr",i); break;
|
break;
|
||||||
case ldiachr: fprintf(sta,"%5u\tdiachr",i); break;
|
case lptichr:
|
||||||
case lmoachr: fprintf(sta,"%5u\tmoachr",i); break;
|
fprintf(sta, "%5u\tptichr", i);
|
||||||
case lanachr: fprintf(sta,"%5u\tanachr",i); break;
|
break;
|
||||||
case lorachr: fprintf(sta,"%5u\torachr",i); break;
|
case ldptchr:
|
||||||
case lxoachr: fprintf(sta,"%5u\txoachr",i); break;
|
fprintf(sta, "%5u\tdptchr", i);
|
||||||
case lsrachr: fprintf(sta,"%5u\tsrachr",i); break;
|
break;
|
||||||
case lslachr: fprintf(sta,"%5u\tslachr",i); break;
|
case lptdchr:
|
||||||
case lcpachr: fprintf(sta,"%5u\tcpachr",i); break;
|
fprintf(sta, "%5u\tptdchr", i);
|
||||||
|
break;
|
||||||
|
case ladachr:
|
||||||
|
fprintf(sta, "%5u\tadachr", i);
|
||||||
|
break;
|
||||||
|
case lsuachr:
|
||||||
|
fprintf(sta, "%5u\tsuachr", i);
|
||||||
|
break;
|
||||||
|
case lmuachr:
|
||||||
|
fprintf(sta, "%5u\tmuachr", i);
|
||||||
|
break;
|
||||||
|
case ldiachr:
|
||||||
|
fprintf(sta, "%5u\tdiachr", i);
|
||||||
|
break;
|
||||||
|
case lmoachr:
|
||||||
|
fprintf(sta, "%5u\tmoachr", i);
|
||||||
|
break;
|
||||||
|
case lanachr:
|
||||||
|
fprintf(sta, "%5u\tanachr", i);
|
||||||
|
break;
|
||||||
|
case lorachr:
|
||||||
|
fprintf(sta, "%5u\torachr", i);
|
||||||
|
break;
|
||||||
|
case lxoachr:
|
||||||
|
fprintf(sta, "%5u\txoachr", i);
|
||||||
|
break;
|
||||||
|
case lsrachr:
|
||||||
|
fprintf(sta, "%5u\tsrachr", i);
|
||||||
|
break;
|
||||||
|
case lslachr:
|
||||||
|
fprintf(sta, "%5u\tslachr", i);
|
||||||
|
break;
|
||||||
|
case lcpachr:
|
||||||
|
fprintf(sta, "%5u\tcpachr", i);
|
||||||
|
break;
|
||||||
|
|
||||||
case lstrcpy: fprintf(sta,"%5u\tstrcpy",i); break;
|
case lstrcpy:
|
||||||
case lstrfix: fprintf(sta,"%5u\tstrfix",i); break;
|
fprintf(sta, "%5u\tstrcpy", i);
|
||||||
case lstrcat: fprintf(sta,"%5u\tstrcat",i); break;
|
break;
|
||||||
case lstradd: fprintf(sta,"%5u\tstradd",i); break;
|
case lstrfix:
|
||||||
case lstrdec: fprintf(sta,"%5u\tstrdec",i); break;
|
fprintf(sta, "%5u\tstrfix", i);
|
||||||
case lstrsub: fprintf(sta,"%5u\tstrsub",i); break;
|
break;
|
||||||
case lstrlen: fprintf(sta,"%5u\tstrlen",i); break;
|
case lstrcat:
|
||||||
case lstrigu: fprintf(sta,"%5u\tstrigu",i); break;
|
fprintf(sta, "%5u\tstrcat", i);
|
||||||
case lstrdis: fprintf(sta,"%5u\tstrdis",i); break;
|
break;
|
||||||
case lstrmay: fprintf(sta,"%5u\tstrmay",i); break;
|
case lstradd:
|
||||||
case lstrmen: fprintf(sta,"%5u\tstrmen",i); break;
|
fprintf(sta, "%5u\tstradd", i);
|
||||||
case lstrmei: fprintf(sta,"%5u\tstrmei",i); break;
|
break;
|
||||||
case lstrmai: fprintf(sta,"%5u\tstrmai",i); break;
|
case lstrdec:
|
||||||
case lcpastr: fprintf(sta,"%5u\tcpastr",i); break;
|
fprintf(sta, "%5u\tstrdec", i);
|
||||||
|
break;
|
||||||
|
case lstrsub:
|
||||||
|
fprintf(sta, "%5u\tstrsub", i);
|
||||||
|
break;
|
||||||
|
case lstrlen:
|
||||||
|
fprintf(sta, "%5u\tstrlen", i);
|
||||||
|
break;
|
||||||
|
case lstrigu:
|
||||||
|
fprintf(sta, "%5u\tstrigu", i);
|
||||||
|
break;
|
||||||
|
case lstrdis:
|
||||||
|
fprintf(sta, "%5u\tstrdis", i);
|
||||||
|
break;
|
||||||
|
case lstrmay:
|
||||||
|
fprintf(sta, "%5u\tstrmay", i);
|
||||||
|
break;
|
||||||
|
case lstrmen:
|
||||||
|
fprintf(sta, "%5u\tstrmen", i);
|
||||||
|
break;
|
||||||
|
case lstrmei:
|
||||||
|
fprintf(sta, "%5u\tstrmei", i);
|
||||||
|
break;
|
||||||
|
case lstrmai:
|
||||||
|
fprintf(sta, "%5u\tstrmai", i);
|
||||||
|
break;
|
||||||
|
case lcpastr:
|
||||||
|
fprintf(sta, "%5u\tcpastr", i);
|
||||||
|
break;
|
||||||
|
|
||||||
case lnul: fprintf(sta,"%5u\tnul",i); break;
|
case lnul:
|
||||||
|
fprintf(sta, "%5u\tnul", i);
|
||||||
|
break;
|
||||||
|
|
||||||
case lextasp: fprintf(sta,"%5u\textasp %u",i,mem[i+1]); i++; break;
|
case lextasp:
|
||||||
|
fprintf(sta, "%5u\textasp %u", i, mem[i + 1]);
|
||||||
|
i++;
|
||||||
|
break;
|
||||||
|
|
||||||
default: fprintf(sta,"***"); break;
|
default:
|
||||||
} fprintf(sta,"\n"); i++; }
|
fprintf(sta, "***");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fprintf(sta, "\n");
|
||||||
|
i++;
|
||||||
|
}
|
||||||
fclose(sta);
|
fclose(sta);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,14 +34,15 @@
|
||||||
void ltlex_error(int error)
|
void ltlex_error(int error)
|
||||||
{
|
{
|
||||||
if (error == 1)
|
if (error == 1)
|
||||||
printf(translate(40),translate_ltlex_error(error));
|
print_translate(40, translate_ltlex_error(error));
|
||||||
else
|
else
|
||||||
printf(translate(41),"ltlex.def",linea,translate_ltlex_error(error));
|
print_translate(41, "ltlex.def", linea, translate_ltlex_error(error));
|
||||||
printf(translate(42));
|
print_translate(42);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void analiza_ltlex(void){
|
void analiza_ltlex(void)
|
||||||
|
{
|
||||||
|
|
||||||
byte *_buf, *buf; /* Buffer del texto y puntero al carácter actual */
|
byte *_buf, *buf; /* Buffer del texto y puntero al carácter actual */
|
||||||
byte cont = 1; /* 0 indica final del archivo */
|
byte cont = 1; /* 0 indica final del archivo */
|
||||||
|
@ -74,52 +75,71 @@ void analiza_ltlex(void){
|
||||||
|
|
||||||
linea = 1;
|
linea = 1;
|
||||||
|
|
||||||
do {
|
do
|
||||||
switch (*buf++) {
|
{
|
||||||
|
switch (*buf++)
|
||||||
|
{
|
||||||
/* Fin de fichero */
|
/* Fin de fichero */
|
||||||
case 0:
|
case 0:
|
||||||
cont=0; break;
|
cont = 0;
|
||||||
|
break;
|
||||||
/* Ignoramos los espacios */
|
/* Ignoramos los espacios */
|
||||||
case ' ':
|
case ' ':
|
||||||
case tab:
|
case tab:
|
||||||
break;
|
break;
|
||||||
/* Salta de linea */
|
/* Salta de linea */
|
||||||
case cr:
|
case cr:
|
||||||
if(*buf==lf) buf++;
|
if (*buf == lf)
|
||||||
|
buf++;
|
||||||
case lf:
|
case lf:
|
||||||
linea++;
|
linea++;
|
||||||
break;
|
break;
|
||||||
/* Los ; indican línea de comentario */
|
/* Los ; indican línea de comentario */
|
||||||
case ';':
|
case ';':
|
||||||
while (*buf!=cr && *buf!=lf) buf++; break;
|
while (*buf != cr && *buf != lf)
|
||||||
|
buf++;
|
||||||
|
break;
|
||||||
/* El símbolo & indica definición de token */
|
/* El símbolo & indica definición de token */
|
||||||
case '&':
|
case '&':
|
||||||
*buf = lower[*buf];
|
*buf = lower[*buf];
|
||||||
if (*buf >= '0' && *buf <= '9')
|
if (*buf >= '0' && *buf <= '9')
|
||||||
t = (*buf++ - '0') << 4;
|
t = (*buf++ - '0') << 4;
|
||||||
else
|
else if (*buf >= 'a' && *buf <= 'f')
|
||||||
if (*buf>='a' && *buf<='f')
|
|
||||||
t = (*buf++ - 'a' + 10) << 4;
|
t = (*buf++ - 'a' + 10) << 4;
|
||||||
else
|
else
|
||||||
ltlex_error(2);
|
ltlex_error(2);
|
||||||
*buf = lower[*buf];
|
*buf = lower[*buf];
|
||||||
if (*buf >= '0' && *buf <= '9')
|
if (*buf >= '0' && *buf <= '9')
|
||||||
t += (*buf++ - '0');
|
t += (*buf++ - '0');
|
||||||
else
|
else if (*buf >= 'a' && *buf <= 'f')
|
||||||
if (*buf>='a' && *buf<='f')
|
|
||||||
t += (*buf++ - 'a' + 10);
|
t += (*buf++ - 'a' + 10);
|
||||||
else
|
else
|
||||||
ltlex_error(2);
|
ltlex_error(2);
|
||||||
if (*buf==cr || *buf==lf || *buf==' ' || *buf==tab) break;
|
if (*buf == cr || *buf == lf || *buf == ' ' || *buf == tab)
|
||||||
else if (lower[*buf]) { /* Analiza una palabra reservada */
|
break;
|
||||||
_ivnom=ivnom.b; *ivnom.p++=0; *ivnom.p++=(unsigned char*)t; h=0;
|
else if (lower[*buf])
|
||||||
while ((*ivnom.b=lower[*buf++])) h=((byte)(h<<1)+(h>>7))^(*ivnom.b++);
|
{ /* Analiza una palabra reservada */
|
||||||
ptr=&vhash[h]; while (*ptr) ptr=(unsigned char * *)*ptr; *ptr=_ivnom;
|
_ivnom = ivnom.b;
|
||||||
buf--; ivnom.b++;
|
*ivnom.p++ = 0;
|
||||||
} else if (t>=0x78 && t<=0x7b) { /* Analiza un delimitador de literal */
|
*ivnom.p++ = (unsigned char *)t;
|
||||||
|
h = 0;
|
||||||
|
while ((*ivnom.b = lower[*buf++]))
|
||||||
|
h = ((byte)(h << 1) + (h >> 7)) ^ (*ivnom.b++);
|
||||||
|
ptr = &vhash[h];
|
||||||
|
while (*ptr)
|
||||||
|
ptr = (unsigned char **)*ptr;
|
||||||
|
*ptr = _ivnom;
|
||||||
|
buf--;
|
||||||
|
ivnom.b++;
|
||||||
|
}
|
||||||
|
else if (t >= 0x78 && t <= 0x7b)
|
||||||
|
{ /* Analiza un delimitador de literal */
|
||||||
lex_case[*buf] = (struct lex_ele *)l_lit;
|
lex_case[*buf] = (struct lex_ele *)l_lit;
|
||||||
} else { /* Analiza un nuevo símbolo */
|
}
|
||||||
if ((e=lex_case[*buf])==0) {
|
else
|
||||||
|
{ /* Analiza un nuevo símbolo */
|
||||||
|
if ((e = lex_case[*buf]) == 0)
|
||||||
|
{
|
||||||
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++;
|
||||||
|
@ -127,26 +147,38 @@ void analiza_ltlex(void){
|
||||||
}
|
}
|
||||||
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)
|
||||||
else e=e->siguiente=ilex_simb++;
|
ltlex_error(3);
|
||||||
else {
|
else
|
||||||
|
e = e->siguiente = ilex_simb++;
|
||||||
|
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);
|
{
|
||||||
else e=e->alternativa=ilex_simb++;
|
if (num_nodos++ == max_nodos)
|
||||||
|
ltlex_error(3);
|
||||||
|
else
|
||||||
|
e = e->alternativa = ilex_simb++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e->caracter = *buf++;
|
e->caracter = *buf++;
|
||||||
}
|
}
|
||||||
e->token = t;
|
e->token = t;
|
||||||
} break;
|
}
|
||||||
}} while (cont);
|
break;
|
||||||
|
}
|
||||||
e_free(_buf); _buf=NULL;
|
} while (cont);
|
||||||
fclose(def); def=NULL;
|
|
||||||
|
e_free(_buf);
|
||||||
|
_buf = NULL;
|
||||||
|
fclose(def);
|
||||||
|
def = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,8 @@ void get_rawname(char* completo, char* rawname)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = strlen(completo) - 1; i > 0; i--)
|
for (i = strlen(completo) - 1; i > 0; i--)
|
||||||
if(completo[i]=='\\' || completo[i]=='/') {
|
if (completo[i] == '\\' || completo[i] == '/')
|
||||||
|
{
|
||||||
p = &completo[i + 1];
|
p = &completo[i + 1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -54,21 +55,17 @@ void get_rawname(char* completo, char* rawname)
|
||||||
i = strlen(rawname);
|
i = strlen(rawname);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (rawname[i-4]=='.' && (rawname[i-3]=='d' || rawname[i-3]=='D')
|
if (rawname[i - 4] == '.' && (rawname[i - 3] == 'd' || rawname[i - 3] == 'D') && (rawname[i - 2] == 'l' || rawname[i - 2] == 'L') && (rawname[i - 1] == 'l' || rawname[i - 1] == 'L'))
|
||||||
&& (rawname[i-2]=='l' || rawname[i-2]=='L')
|
|
||||||
&& (rawname[i-1]=='l' || rawname[i-1]=='L'))
|
|
||||||
|
|
||||||
rawname[i - 4] = 0;
|
rawname[i - 4] = 0;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
if(rawname[i-3]=='.' && (rawname[i-2]=='s' || rawname[i-2]=='S')
|
if (rawname[i - 3] == '.' && (rawname[i - 2] == 's' || rawname[i - 2] == 'S') && (rawname[i - 1] == 'o' || rawname[i - 1] == 'O'))
|
||||||
&& (rawname[i-1]=='o' || rawname[i-1]=='O'))
|
|
||||||
|
|
||||||
rawname[i - 3] = 0;
|
rawname[i - 3] = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* compara prioridades de dos dlls, para el qsort descendente */
|
/* compara prioridades de dos dlls, para el qsort descendente */
|
||||||
int compara(const void *_a, const void *_b)
|
int compara(const void *_a, const void *_b)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +81,6 @@ int compara2(const void* _a, const void* _b)
|
||||||
return dlls[a].prioridad < dlls[b].prioridad ? 1 : (dlls[a].prioridad > dlls[b].prioridad ? -1 : 0);
|
return dlls[a].prioridad < dlls[b].prioridad ? 1 : (dlls[a].prioridad > dlls[b].prioridad ? -1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void dll_func()
|
void dll_func()
|
||||||
{
|
{
|
||||||
char dllkey[256] = "dll_priority:";
|
char dllkey[256] = "dll_priority:";
|
||||||
|
@ -124,8 +120,7 @@ void dll_func()
|
||||||
/* Busca las DLLs que hay en el directorio */
|
/* Busca las DLLs que hay en el directorio */
|
||||||
buscafich = _findfirst(mask, &fichero_dll);
|
buscafich = _findfirst(mask, &fichero_dll);
|
||||||
if (buscafich == -1)
|
if (buscafich == -1)
|
||||||
printf(translate(43)); /* no hay dlls */
|
print_translate(43); /* no hay dlls */
|
||||||
|
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("dbg: DLL encontrada: %s\n", fichero_dll.name);
|
printf("dbg: DLL encontrada: %s\n", fichero_dll.name);
|
||||||
|
@ -141,7 +136,8 @@ void dll_func()
|
||||||
carga = 0;
|
carga = 0;
|
||||||
|
|
||||||
if (carga)
|
if (carga)
|
||||||
if(!leedll()) {
|
if (!leedll())
|
||||||
|
{
|
||||||
dlls[numdlls].prioridad = 0;
|
dlls[numdlls].prioridad = 0;
|
||||||
/* guarda el nombre de fichero en la tabla de DLLs */
|
/* guarda el nombre de fichero en la tabla de DLLs */
|
||||||
dlls[0].nombre = e_malloc(strlen(rawname) + 1);
|
dlls[0].nombre = e_malloc(strlen(rawname) + 1);
|
||||||
|
@ -155,8 +151,10 @@ void dll_func()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* hace lo mismo con el resto */
|
/* hace lo mismo con el resto */
|
||||||
while(1) {
|
while (1)
|
||||||
if(_findnext(buscafich,&fichero_dll)==0) {
|
{
|
||||||
|
if (_findnext(buscafich, &fichero_dll) == 0)
|
||||||
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("dbg: DLL encontrada: %s\n", fichero_dll.name);
|
printf("dbg: DLL encontrada: %s\n", fichero_dll.name);
|
||||||
#endif
|
#endif
|
||||||
|
@ -166,12 +164,17 @@ void dll_func()
|
||||||
get_rawname(fichero_dll.name, rawname);
|
get_rawname(fichero_dll.name, rawname);
|
||||||
strcpy(dllkey, "dll_priority:");
|
strcpy(dllkey, "dll_priority:");
|
||||||
strcat(dllkey, rawname);
|
strcat(dllkey, rawname);
|
||||||
if(ini) if(iniparser_getint(ini,dllkey,0)<=P_NUNCA) carga=0;
|
if (ini)
|
||||||
if(carga) if(!leedll()) {
|
if (iniparser_getint(ini, dllkey, 0) <= P_NUNCA)
|
||||||
|
carga = 0;
|
||||||
|
if (carga)
|
||||||
|
if (!leedll())
|
||||||
|
{
|
||||||
dlls[numdlls].nombre = e_malloc(strlen(rawname) + 1);
|
dlls[numdlls].nombre = e_malloc(strlen(rawname) + 1);
|
||||||
strcpy(dlls[numdlls].nombre, rawname);
|
strcpy(dlls[numdlls].nombre, rawname);
|
||||||
dlls[numdlls].usado = 0;
|
dlls[numdlls].usado = 0;
|
||||||
if(ini) dlls[numdlls].prioridad=iniparser_getint(ini,dllkey,dlls[numdlls].prioridad);
|
if (ini)
|
||||||
|
dlls[numdlls].prioridad = iniparser_getint(ini, dllkey, dlls[numdlls].prioridad);
|
||||||
numdlls++;
|
numdlls++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,17 +184,21 @@ void dll_func()
|
||||||
|
|
||||||
#else /* si estamos en Linux */
|
#else /* si estamos en Linux */
|
||||||
|
|
||||||
if(ini) dir=iniparser_getstr(ini,"dll:nixdll");
|
if (ini)
|
||||||
if(!dir) dir="so";
|
dir = iniparser_getstr(ini, "dll:nixdll");
|
||||||
|
if (!dir)
|
||||||
|
dir = "so";
|
||||||
|
|
||||||
directorio = opendir(dir);
|
directorio = opendir(dir);
|
||||||
if(!directorio) {
|
if (!directorio)
|
||||||
printf(translate(44),dir); /* no hay directorio so/ */
|
{
|
||||||
|
print_translate(44, dir); /* no hay directorio so/ */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Busca las .so */
|
/* Busca las .so */
|
||||||
while ((fichero_dll = readdir(directorio)) != 0) {
|
while ((fichero_dll = readdir(directorio)) != 0)
|
||||||
|
{
|
||||||
/* Salta los directorios actual '.' y padre ".." */
|
/* Salta los directorios actual '.' y padre ".." */
|
||||||
if (strcmp(fichero_dll->d_name, ".") == 0)
|
if (strcmp(fichero_dll->d_name, ".") == 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -199,7 +206,8 @@ void dll_func()
|
||||||
if (strcmp(fichero_dll->d_name, "..") == 0)
|
if (strcmp(fichero_dll->d_name, "..") == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(fichero_dll->d_type==DT_REG) {
|
if (fichero_dll->d_type == DT_REG)
|
||||||
|
{
|
||||||
char dllkey[256] = "dll_priority:";
|
char dllkey[256] = "dll_priority:";
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("dbg: Librería encontrada: %s/%s\n", dir, fichero_dll->d_name);
|
printf("dbg: Librería encontrada: %s/%s\n", dir, fichero_dll->d_name);
|
||||||
|
@ -211,13 +219,16 @@ void dll_func()
|
||||||
strcpy(dllkey, "dll_priority:");
|
strcpy(dllkey, "dll_priority:");
|
||||||
strcat(dllkey, rawname);
|
strcat(dllkey, rawname);
|
||||||
|
|
||||||
if (ini) {
|
if (ini)
|
||||||
|
{
|
||||||
if (iniparser_getint(ini, dllkey, 0) <= P_NUNCA)
|
if (iniparser_getint(ini, dllkey, 0) <= P_NUNCA)
|
||||||
carga = 0;
|
carga = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(carga) {
|
if (carga)
|
||||||
if(!leedll()) {
|
{
|
||||||
|
if (!leedll())
|
||||||
|
{
|
||||||
dlls[numdlls].nombre = e_malloc(strlen(rawname) + 1);
|
dlls[numdlls].nombre = e_malloc(strlen(rawname) + 1);
|
||||||
strcpy(dlls[numdlls].nombre, rawname);
|
strcpy(dlls[numdlls].nombre, rawname);
|
||||||
dlls[numdlls].usado = 0;
|
dlls[numdlls].usado = 0;
|
||||||
|
@ -234,7 +245,7 @@ void dll_func()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (numdlls == 0)
|
if (numdlls == 0)
|
||||||
printf(translate(43)); /* no hay librerias */
|
print_translate(43); /* no hay librerias */
|
||||||
|
|
||||||
nuevo_orden = e_malloc(numdlls * 4);
|
nuevo_orden = e_malloc(numdlls * 4);
|
||||||
for (i = 0; i < numdlls; i++)
|
for (i = 0; i < numdlls; i++)
|
||||||
|
@ -247,10 +258,8 @@ void dll_func()
|
||||||
for (i = 0; i < numdlls; i++)
|
for (i = 0; i < numdlls; i++)
|
||||||
printf("dbg: %d - %s - prioridad: %d\n", i, dlls[i].nombre, dlls[i].prioridad);
|
printf("dbg: %d - %s - prioridad: %d\n", i, dlls[i].nombre, dlls[i].prioridad);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void dll_func2()
|
void dll_func2()
|
||||||
{
|
{
|
||||||
int i = numdlls;
|
int i = numdlls;
|
||||||
|
@ -261,30 +270,36 @@ void dll_func2()
|
||||||
for (i = 0; i < numdlls; i++)
|
for (i = 0; i < numdlls; i++)
|
||||||
nuevo_orden[i] = i;
|
nuevo_orden[i] = i;
|
||||||
|
|
||||||
for(numdlls=0;numdlls<i;numdlls++) {
|
for (numdlls = 0; numdlls < i; numdlls++)
|
||||||
if((dlls[numdlls].prioridad>P_NUNCA) && (dlls[numdlls].usado || dlls[numdlls].prioridad>=P_SIEMPRE)) {
|
{
|
||||||
|
if ((dlls[numdlls].prioridad > P_NUNCA) && (dlls[numdlls].usado || dlls[numdlls].prioridad >= P_SIEMPRE))
|
||||||
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
printf("dbg: Se requiere %s (id=%d)\n", dlls[numdlls].nombre, numdlls);
|
printf("dbg: Se requiere %s (id=%d)\n", dlls[numdlls].nombre, numdlls);
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if(ini) dir=iniparser_getstr(ini,"dll:windll");
|
if (ini)
|
||||||
if(!dir) dir="dll";
|
dir = iniparser_getstr(ini, "dll:windll");
|
||||||
|
if (!dir)
|
||||||
|
dir = "dll";
|
||||||
sprintf(fichdll, "%s\\%s.dll", dir, dlls[numdlls].nombre);
|
sprintf(fichdll, "%s\\%s.dll", dir, dlls[numdlls].nombre);
|
||||||
#else
|
#else
|
||||||
if(ini) dir=iniparser_getstr(ini,"dll:nixdll");
|
if (ini)
|
||||||
if(!dir) dir="so";
|
dir = iniparser_getstr(ini, "dll:nixdll");
|
||||||
|
if (!dir)
|
||||||
|
dir = "so";
|
||||||
sprintf(fichdll, "%s/%s.so", dir, dlls[numdlls].nombre);
|
sprintf(fichdll, "%s/%s.so", dir, dlls[numdlls].nombre);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(leedll()) {
|
if (leedll())
|
||||||
printf(translate(45),dlls[numdlls].nombre); /* error al cargar libreria */
|
{
|
||||||
|
print_translate(45, dlls[numdlls].nombre); /* error al cargar libreria */
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int leedll()
|
int leedll()
|
||||||
{
|
{
|
||||||
TYPEOF_ExportaFuncs *ExportaFuncs;
|
TYPEOF_ExportaFuncs *ExportaFuncs;
|
||||||
|
@ -294,8 +309,9 @@ int leedll()
|
||||||
/* Carga la DLL */
|
/* Carga la DLL */
|
||||||
hDLL = LoadDLL(fichdll);
|
hDLL = LoadDLL(fichdll);
|
||||||
|
|
||||||
if(hDLL==NULL) {
|
if (hDLL == NULL)
|
||||||
printf(translate(46),fichdll); /* no puedo cargar libreria */
|
{
|
||||||
|
print_translate(46, fichdll); /* no puedo cargar libreria */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,8 +319,9 @@ int leedll()
|
||||||
ExportaFuncs = NULL;
|
ExportaFuncs = NULL;
|
||||||
ExportaFuncs = (TYPEOF_ExportaFuncs *)GetDLLProcAddress(hDLL, "ExportaFuncs");
|
ExportaFuncs = (TYPEOF_ExportaFuncs *)GetDLLProcAddress(hDLL, "ExportaFuncs");
|
||||||
|
|
||||||
if(ExportaFuncs==NULL) {
|
if (ExportaFuncs == NULL)
|
||||||
printf(translate(47),fichdll); /* exportafuncs no encontrado */
|
{
|
||||||
|
print_translate(47, fichdll); /* exportafuncs no encontrado */
|
||||||
FreeDLL(hDLL);
|
FreeDLL(hDLL);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -324,8 +341,9 @@ int leedll()
|
||||||
/* Carga la DLL */
|
/* Carga la DLL */
|
||||||
hDLL = dlopen(fichdll, RTLD_NOW);
|
hDLL = dlopen(fichdll, RTLD_NOW);
|
||||||
|
|
||||||
if(!hDLL) {
|
if (!hDLL)
|
||||||
printf(translate(46),fichdll,dlerror()); /* no puedo cargar libreria */
|
{
|
||||||
|
print_translate(46, fichdll, dlerror()); /* no puedo cargar libreria */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,8 +353,9 @@ int leedll()
|
||||||
|
|
||||||
ExportaFuncs = (TYPEOF_ExportaFuncs *)dlsym(hDLL, "ExportaFuncs");
|
ExportaFuncs = (TYPEOF_ExportaFuncs *)dlsym(hDLL, "ExportaFuncs");
|
||||||
|
|
||||||
if((errordll=dlerror())!=NULL) {
|
if ((errordll = dlerror()) != NULL)
|
||||||
printf(translate(47),fichdll,errordll); /* exportafuncs no encontrado */
|
{
|
||||||
|
print_translate(47, fichdll, errordll); /* exportafuncs no encontrado */
|
||||||
dlclose(hDLL);
|
dlclose(hDLL);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,13 +49,14 @@
|
||||||
#define TRANSLATE_RUNTIME_ERROR 7
|
#define TRANSLATE_RUNTIME_ERROR 7
|
||||||
#define TRANSLATE_CRITICAL_ERROR 8
|
#define TRANSLATE_CRITICAL_ERROR 8
|
||||||
|
|
||||||
|
|
||||||
int idioma;
|
int idioma;
|
||||||
|
|
||||||
/* comunes */
|
/* comunes */
|
||||||
int detecta_idioma();
|
int detecta_idioma();
|
||||||
char *translate(int num);
|
char *translate(int num);
|
||||||
char *translate_dll_error(int num);
|
char *translate_dll_error(int num);
|
||||||
|
const char *get_translate(int num, ...);
|
||||||
|
void print_translate(int num, ...);
|
||||||
|
|
||||||
/* compilador */
|
/* compilador */
|
||||||
char *translate_error(int num);
|
char *translate_error(int num);
|
||||||
|
|
|
@ -79,9 +79,7 @@ int offset;
|
||||||
return 0;
|
return 0;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
// Errores específicos en la ejecución de una DLL
|
// Errores específicos en la ejecución de una DLL
|
||||||
|
|
||||||
void dll_error(int error, ...)
|
void dll_error(int error, ...)
|
||||||
{
|
{
|
||||||
va_list opparam;
|
va_list opparam;
|
||||||
|
@ -89,11 +87,11 @@ void dll_error(int error, ...)
|
||||||
|
|
||||||
va_start(opparam, error);
|
va_start(opparam, error);
|
||||||
|
|
||||||
sprintf(mensaje,translate(3), fichdll);
|
sprintf(mensaje, get_translate(3, fichdll));
|
||||||
vsprintf(mensaje,translate_dll_error(error),opparam);
|
vsprintf(mensaje, get_translate(translate_dll_error(error)), opparam);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
MessageBox(0,mensaje,translate(4),MB_ICONERROR);
|
MessageBox(0,mensaje,print_translate((4),MB_ICONERROR);
|
||||||
#else
|
#else
|
||||||
printf("%s\n", mensaje);
|
printf("%s\n", mensaje);
|
||||||
#endif
|
#endif
|
||||||
|
@ -104,11 +102,10 @@ void dll_error(int error, ...)
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export(char *cadena, int nparam, void *hfuncion)
|
int EDIV_Export(char *cadena, int nparam, void *hfuncion)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +116,8 @@ int EDIV_Export(char* cadena, int nparam, void* hfuncion)
|
||||||
printf("export_function:\t-- ID FUNCION: %d\n"
|
printf("export_function:\t-- ID FUNCION: %d\n"
|
||||||
"export_function:\tCadena exportada: %s\n"
|
"export_function:\tCadena exportada: %s\n"
|
||||||
"export_function:\tN. parametros: %d\n"
|
"export_function:\tN. parametros: %d\n"
|
||||||
"export_function:\tOffset de la funcion: 0x%X\n",n_externs,cadena,nparam,(unsigned int)hfuncion);
|
"export_function:\tOffset de la funcion: 0x%X\n",
|
||||||
|
n_externs, cadena, nparam, (unsigned int)hfuncion);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* if(creaobj) {
|
/* if(creaobj) {
|
||||||
|
@ -161,7 +159,6 @@ int EDIV_Export(char* cadena, int nparam, void* hfuncion)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Entrypoint(int ep, void *hfuncion)
|
int EDIV_Export_Entrypoint(int ep, void *hfuncion)
|
||||||
{
|
{
|
||||||
entrypoints[n_entrypoints].tipo = ep;
|
entrypoints[n_entrypoints].tipo = ep;
|
||||||
|
@ -170,17 +167,16 @@ int EDIV_Export_Entrypoint(int ep, void* hfuncion)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Priority(int priority)
|
int EDIV_Export_Priority(int priority)
|
||||||
{
|
{
|
||||||
dlls[numdlls].prioridad = priority;
|
dlls[numdlls].prioridad = priority;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Const(char *cadena, int valor)
|
int EDIV_Export_Const(char *cadena, int valor)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -215,10 +211,10 @@ int EDIV_Export_Const(char* cadena, int valor)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Global(char *cadena, int valor)
|
int EDIV_Export_Global(char *cadena, int valor)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -251,10 +247,10 @@ int EDIV_Export_Global(char* cadena, int valor)
|
||||||
return dimem++;
|
return dimem++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Global_Tab(char *cadena, int numregs)
|
int EDIV_Export_Global_Tab(char *cadena, int numregs)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -298,10 +294,10 @@ int EDIV_Export_Global_Tab(char* cadena, int numregs)
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Global_Struct(char *cadena, int numregs)
|
int EDIV_Export_Global_Struct(char *cadena, int numregs)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -345,10 +341,10 @@ int EDIV_Export_Global_Struct(char* cadena, int numregs)
|
||||||
return dimem;
|
return dimem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Member_Int(char *cadena, int valor)
|
int EDIV_Export_Member_Int(char *cadena, int valor)
|
||||||
{
|
{
|
||||||
if(!decl_struct) {
|
if (!decl_struct)
|
||||||
|
{
|
||||||
dll_error(7, cadena);
|
dll_error(7, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -393,10 +389,10 @@ int EDIV_Export_Member_Int(char* cadena, int valor)
|
||||||
return len++;
|
return len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Member_Str(char *cadena, int tamano)
|
int EDIV_Export_Member_Str(char *cadena, int tamano)
|
||||||
{
|
{
|
||||||
if(!decl_struct) {
|
if (!decl_struct)
|
||||||
|
{
|
||||||
dll_error(7, cadena);
|
dll_error(7, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -471,13 +467,12 @@ int EDIV_Export_Member_Str(char* cadena, int tamano)
|
||||||
len += tamano;
|
len += tamano;
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Member_Tab(char *cadena, int numregs)
|
int EDIV_Export_Member_Tab(char *cadena, int numregs)
|
||||||
{
|
{
|
||||||
if(!decl_struct) {
|
if (!decl_struct)
|
||||||
|
{
|
||||||
dll_error(7, cadena);
|
dll_error(7, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -537,10 +532,10 @@ int EDIV_Export_Member_Tab(char* cadena, int numregs)
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_EndStruct()
|
int EDIV_Export_EndStruct()
|
||||||
{
|
{
|
||||||
if(!decl_struct) {
|
if (!decl_struct)
|
||||||
|
{
|
||||||
dll_error(9);
|
dll_error(9);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -579,20 +574,23 @@ int EDIV_Export_EndStruct()
|
||||||
// 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);
|
||||||
|
|
||||||
if(slocal) diloc+=len*nregs;
|
if (slocal)
|
||||||
else dimem+=len*nregs;
|
diloc += len * nregs;
|
||||||
|
else
|
||||||
|
dimem += len * nregs;
|
||||||
|
|
||||||
decl_struct = 0;
|
decl_struct = 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Local(char *cadena, int valor)
|
int EDIV_Export_Local(char *cadena, int valor)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -625,10 +623,10 @@ int EDIV_Export_Local(char* cadena, int valor)
|
||||||
return diloc++;
|
return diloc++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Local_Tab(char *cadena, int numregs)
|
int EDIV_Export_Local_Tab(char *cadena, int numregs)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -673,10 +671,10 @@ int EDIV_Export_Local_Tab(char* cadena, int numregs)
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int EDIV_Export_Local_Struct(char *cadena, int numregs)
|
int EDIV_Export_Local_Struct(char *cadena, int numregs)
|
||||||
{
|
{
|
||||||
if(decl_struct) {
|
if (decl_struct)
|
||||||
|
{
|
||||||
dll_error(6, cadena);
|
dll_error(6, cadena);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -721,7 +719,6 @@ int EDIV_Export_Local_Struct(char* cadena, int numregs)
|
||||||
return diloc;
|
return diloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
/// Call_Entrypoint
|
/// Call_Entrypoint
|
||||||
//////////////
|
//////////////
|
||||||
|
@ -730,11 +727,14 @@ int Call_Entrypoint(int ep, ...)
|
||||||
{
|
{
|
||||||
va_list opparam;
|
va_list opparam;
|
||||||
int i, c = 0;
|
int i, c = 0;
|
||||||
for(i=0;i<n_entrypoints;i++) {
|
for (i = 0; i < n_entrypoints; i++)
|
||||||
if(entrypoints[i].tipo==ep) {
|
{
|
||||||
|
if (entrypoints[i].tipo == ep)
|
||||||
|
{
|
||||||
c++;
|
c++;
|
||||||
va_start(opparam, ep);
|
va_start(opparam, ep);
|
||||||
switch(ep) {
|
switch (ep)
|
||||||
|
{
|
||||||
|
|
||||||
// void funcion(void)
|
// void funcion(void)
|
||||||
case EDIV_set_video_mode:
|
case EDIV_set_video_mode:
|
||||||
|
@ -812,7 +812,6 @@ int Call_Entrypoint(int ep, ...)
|
||||||
funcion_ep(_imem, _nombreprg, _lin, _dbg);
|
funcion_ep(_imem, _nombreprg, _lin, _dbg);
|
||||||
}
|
}
|
||||||
#endif /* DBG */
|
#endif /* DBG */
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,13 +63,13 @@ void error(int num, ...)
|
||||||
char mensaje[256];
|
char mensaje[256];
|
||||||
|
|
||||||
va_start(opparam, num);
|
va_start(opparam, num);
|
||||||
sprintf(mensaje,translate(0), num);
|
sprintf(mensaje, get_translate(0), num);
|
||||||
vsprintf(mensaje, translate_runtime_error(num - 100), opparam);
|
vsprintf(mensaje, translate_runtime_error(num - 100), opparam);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
ventanuka = GetActiveWindow();
|
ventanuka = GetActiveWindow();
|
||||||
//MessageBox(
|
//MessageBox(
|
||||||
MessageBox(ventanuka,mensaje,translate(1),MB_ICONERROR);
|
MessageBox(ventanuka, mensaje, print_translate(1), MB_ICONERROR);
|
||||||
#else
|
#else
|
||||||
printf("%s\n", mensaje);
|
printf("%s\n", mensaje);
|
||||||
#endif
|
#endif
|
||||||
|
@ -77,7 +77,6 @@ void error(int num, ...)
|
||||||
stub_quit(num);
|
stub_quit(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* critical_error ( numero, parametros [...] )
|
/* critical_error ( numero, parametros [...] )
|
||||||
*
|
*
|
||||||
* Interrumpe el programa con un mensaje de error. No es posible trazar.
|
* Interrumpe el programa con un mensaje de error. No es posible trazar.
|
||||||
|
@ -91,11 +90,11 @@ void critical_error(int num, ...)
|
||||||
char mensaje[256];
|
char mensaje[256];
|
||||||
|
|
||||||
va_start(opparam, num);
|
va_start(opparam, num);
|
||||||
sprintf(mensaje,translate(0), num);
|
sprintf(mensaje, get_translate(0), num);
|
||||||
vsprintf(mensaje, translate_critical_error(num), opparam);
|
vsprintf(mensaje, translate_critical_error(num), opparam);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
MessageBox(0,mensaje,translate(2),MB_ICONERROR);
|
MessageBox(0, mensaje, print_translate(2), MB_ICONERROR);
|
||||||
#else
|
#else
|
||||||
printf("%s\n", mensaje);
|
printf("%s\n", mensaje);
|
||||||
#endif
|
#endif
|
||||||
|
@ -103,7 +102,6 @@ void critical_error(int num, ...)
|
||||||
stub_quit(num);
|
stub_quit(num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* custom_error (tipo, mensaje)
|
/* custom_error (tipo, mensaje)
|
||||||
*
|
*
|
||||||
* Permite a las DLLs generar sus propios errores, para que no dependan de los
|
* Permite a las DLLs generar sus propios errores, para que no dependan de los
|
||||||
|
@ -122,7 +120,7 @@ void critical_error(int num, ...)
|
||||||
void custom_error(tipoerror tipo, char *mensaje)
|
void custom_error(tipoerror tipo, char *mensaje)
|
||||||
{
|
{
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
MessageBox(0,mensaje,translate(tipo),MB_ICONERROR);
|
MessageBox(0, mensaje, print_translate(tipo), MB_ICONERROR);
|
||||||
#else
|
#else
|
||||||
printf("%s\n", mensaje);
|
printf("%s\n", mensaje);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -18,21 +18,19 @@
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**** ¡¡¡ OJO CON LAS COMAS !!! ****/
|
/**** ¡¡¡ OJO CON LAS COMAS !!! ****/
|
||||||
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#else
|
#else
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
|
|
||||||
|
|
||||||
int detecta_idioma_iso(char *lang)
|
int detecta_idioma_iso(char *lang)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -44,18 +42,20 @@ int detecta_idioma_iso(char* lang)
|
||||||
"ca", // catalán
|
"ca", // catalán
|
||||||
"eu" // euskera
|
"eu" // euskera
|
||||||
};
|
};
|
||||||
if(lang==NULL) return DEFAULT_LANGUAGE;
|
if (lang == NULL)
|
||||||
if(strlen(lang)>2) lang[2]=0;
|
return DEFAULT_LANGUAGE;
|
||||||
|
if (strlen(lang) > 2)
|
||||||
|
lang[2] = 0;
|
||||||
strlwr(lang);
|
strlwr(lang);
|
||||||
for (i = 0; i < NUM_LANGUAGES; i++)
|
for (i = 0; i < NUM_LANGUAGES; i++)
|
||||||
if (lang[0] == getid[i][0])
|
if (lang[0] == getid[i][0])
|
||||||
if (lang[1] == getid[i][1])
|
if (lang[1] == getid[i][1])
|
||||||
break;
|
break;
|
||||||
if(i==NUM_LANGUAGES) i=DEFAULT_LANGUAGE;
|
if (i == NUM_LANGUAGES)
|
||||||
|
i = DEFAULT_LANGUAGE;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int detecta_idioma()
|
int detecta_idioma()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -72,17 +72,20 @@ int detecta_idioma()
|
||||||
|
|
||||||
lang = GetSystemDefaultLangID() & 0xff;
|
lang = GetSystemDefaultLangID() & 0xff;
|
||||||
for (i = 0; i < NUM_LANGUAGES; i++)
|
for (i = 0; i < NUM_LANGUAGES; i++)
|
||||||
if(lang==getid[i]) break;
|
if (lang == getid[i])
|
||||||
if(i==NUM_LANGUAGES) i=DEFAULT_LANGUAGE;
|
break;
|
||||||
|
if (i == NUM_LANGUAGES)
|
||||||
|
i = DEFAULT_LANGUAGE;
|
||||||
return i;
|
return i;
|
||||||
#else
|
#else
|
||||||
char *langcfg = getenv("LANG");
|
char *langcfg = getenv("LANG");
|
||||||
if(langcfg==NULL) return DEFAULT_LANGUAGE;
|
if (langcfg == NULL)
|
||||||
else return detecta_idioma_iso(langcfg);
|
return DEFAULT_LANGUAGE;
|
||||||
|
else
|
||||||
|
return detecta_idioma_iso(langcfg);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *translate(int id_cadena)
|
char *translate(int id_cadena)
|
||||||
{
|
{
|
||||||
static char *msg[NUM_LANGUAGES][5] = {
|
static char *msg[NUM_LANGUAGES][5] = {
|
||||||
|
@ -94,7 +97,6 @@ char* translate(int id_cadena)
|
||||||
return msg[idioma][id_cadena];
|
return msg[idioma][id_cadena];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NOTA: los huecos vacíos (184..199) son de errores no usados en DIV2, por favor
|
* NOTA: los huecos vacíos (184..199) son de errores no usados en DIV2, por favor
|
||||||
* aprovechadlos para añadir nuevos errores.
|
* aprovechadlos para añadir nuevos errores.
|
||||||
|
@ -110,10 +112,8 @@ char* translate_runtime_error(int num)
|
||||||
};
|
};
|
||||||
|
|
||||||
return e[idioma][num];
|
return e[idioma][num];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *translate_critical_error(int num)
|
char *translate_critical_error(int num)
|
||||||
{
|
{
|
||||||
static char *e[NUM_LANGUAGES][10] = {
|
static char *e[NUM_LANGUAGES][10] = {
|
||||||
|
@ -126,7 +126,6 @@ char* translate_critical_error(int num)
|
||||||
return e[idioma][num];
|
return e[idioma][num];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *translate_dll_error(int num)
|
char *translate_dll_error(int num)
|
||||||
{
|
{
|
||||||
static char *e[NUM_LANGUAGES][10] = {
|
static char *e[NUM_LANGUAGES][10] = {
|
||||||
|
@ -138,3 +137,31 @@ char* translate_dll_error(int num)
|
||||||
return e[idioma][num];
|
return e[idioma][num];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void print_translate(int num, ...)
|
||||||
|
{
|
||||||
|
va_list arg_ptr;
|
||||||
|
const char *message = translate(num);
|
||||||
|
size_t msglen = strlen(message);
|
||||||
|
char *strbuf = malloc(msglen + 1);
|
||||||
|
|
||||||
|
va_start(arg_ptr, message);
|
||||||
|
vsprintf(strbuf, message, arg_ptr);
|
||||||
|
va_end(arg_ptr);
|
||||||
|
|
||||||
|
printf("%s", strbuf);
|
||||||
|
free(strbuf);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *get_translate(int num, ...)
|
||||||
|
{
|
||||||
|
va_list arg_ptr;
|
||||||
|
const char *message = translate(num);
|
||||||
|
size_t msglen = strlen(message);
|
||||||
|
char *strbuf = malloc(msglen + 1);
|
||||||
|
|
||||||
|
va_start(arg_ptr, message);
|
||||||
|
vsprintf(strbuf, message, arg_ptr);
|
||||||
|
va_end(arg_ptr);
|
||||||
|
|
||||||
|
return strbuf;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue