string
This commit is contained in:
parent
5481e87aa1
commit
5313e3a163
|
@ -1,3 +1,11 @@
|
||||||
|
25/5/2003
|
||||||
|
---------
|
||||||
|
* Añadido soporte para datos STRING. Aún quedan por comprobar algunos
|
||||||
|
opcodes, los estoy señalando en el string.txt. Hay que averiguar el
|
||||||
|
origen del bug de Huevox (ver bug1.prg y bug1sol.prg). Curiosamente,
|
||||||
|
(o cabreantemente :P) el EML generado para los dos PRG es idéntico,
|
||||||
|
pero aún así se comportan de forma distinta. (Er_Makina)
|
||||||
|
|
||||||
4/4/2003
|
4/4/2003
|
||||||
--------
|
--------
|
||||||
* Añadido soporte para datos WORD. (Er_Makina)
|
* Añadido soporte para datos WORD. (Er_Makina)
|
||||||
|
|
|
@ -20,7 +20,6 @@ GLOBAL
|
||||||
sen[360],cosen[360];
|
sen[360],cosen[360];
|
||||||
dibupun;
|
dibupun;
|
||||||
gir=1;
|
gir=1;
|
||||||
mx,my;
|
|
||||||
|
|
||||||
BEGIN
|
BEGIN
|
||||||
crea_tablas();
|
crea_tablas();
|
||||||
|
@ -28,8 +27,6 @@ BEGIN
|
||||||
clear_screen();
|
clear_screen();
|
||||||
gira_Donut(xdeg,ydeg,zdeg);
|
gira_Donut(xdeg,ydeg,zdeg);
|
||||||
pon_lineas(rgb(255,255,0));
|
pon_lineas(rgb(255,255,0));
|
||||||
mx=mouse.x;
|
|
||||||
my=mouse.y;
|
|
||||||
frame;
|
frame;
|
||||||
if(key(_p))
|
if(key(_p))
|
||||||
dibupun++;
|
dibupun++;
|
||||||
|
|
|
@ -324,4 +324,6 @@ librer
|
||||||
|
|
||||||
char = signed byte
|
char = signed byte
|
||||||
short = signed word
|
short = signed word
|
||||||
dword = unsigned int
|
dword = unsigned int
|
||||||
|
|
||||||
|
opcion de compilacion: _explicit_type (obliga a indicar el tipo de dato en la declaracion de las variables)
|
||||||
|
|
|
@ -139,6 +139,8 @@ void compila()
|
||||||
|
|
||||||
printf(translate(27));
|
printf(translate(27));
|
||||||
|
|
||||||
|
/* inicio_textos debe ser como mínimo 256 */
|
||||||
|
if(imem<256) imem=256;
|
||||||
itxt=inicio_textos=imem;
|
itxt=inicio_textos=imem;
|
||||||
psintactico(); /* Para obtener "longitud_textos" */
|
psintactico(); /* Para obtener "longitud_textos" */
|
||||||
imem+=longitud_textos;
|
imem+=longitud_textos;
|
||||||
|
@ -191,6 +193,8 @@ void compila()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* inicio_textos debe ser como mínimo 256 */
|
||||||
|
if(imem<256) imem=256;
|
||||||
itxt=inicio_textos=imem;
|
itxt=inicio_textos=imem;
|
||||||
imem+=longitud_textos;
|
imem+=longitud_textos;
|
||||||
test_buffer(&mem,&imem_max,imem);
|
test_buffer(&mem,&imem_max,imem);
|
||||||
|
|
|
@ -92,6 +92,7 @@ int ini_interprete()
|
||||||
last_lin=0;
|
last_lin=0;
|
||||||
#endif /* DBG */
|
#endif /* DBG */
|
||||||
|
|
||||||
|
nstring=0;
|
||||||
|
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
@ -151,6 +152,13 @@ int interprete()
|
||||||
if(procs_s[proc_orden[proceso_actual]].tipo==0 || mem[procs_s[proc_orden[proceso_actual]].id+_status]==2)
|
if(procs_s[proc_orden[proceso_actual]].tipo==0 || mem[procs_s[proc_orden[proceso_actual]].id+_status]==2)
|
||||||
proceso( proc_orden[ proceso_actual ], -1 ) ;
|
proceso( proc_orden[ proceso_actual ], -1 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* El texto "en el aire" no se muestra nunca */
|
||||||
|
memb[nullstring[0]*4]=0;
|
||||||
|
memb[nullstring[1]*4]=0;
|
||||||
|
memb[nullstring[2]*4]=0;
|
||||||
|
memb[nullstring[3]*4]=0;
|
||||||
|
|
||||||
Call_Entrypoint(EDIV_frame);
|
Call_Entrypoint(EDIV_frame);
|
||||||
|
|
||||||
for ( proceso_actual = 0 ; proceso_actual < num_proc_orden ; proceso_actual++ )
|
for ( proceso_actual = 0 ; proceso_actual < num_proc_orden ; proceso_actual++ )
|
||||||
|
@ -179,7 +187,7 @@ int proceso( int num, int padre )
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
int no_devuelve = 0 ;
|
int no_devuelve = 0 ;
|
||||||
int (*externa)(struct _fun_params*);
|
int (*externa)(struct _fun_params*);
|
||||||
int temp ;
|
int temp,oo;
|
||||||
unsigned int utemp;
|
unsigned int utemp;
|
||||||
int cpas=0;
|
int cpas=0;
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
|
@ -754,8 +762,6 @@ int proceso( int num, int padre )
|
||||||
/* OPERACIONES CON DATOS DE TIPO STRING */
|
/* OPERACIONES CON DATOS DE TIPO STRING */
|
||||||
/* Nota: un puntero a cadena menor a 256 se trata siempre como "%c" */
|
/* Nota: un puntero a cadena menor a 256 se trata siempre como "%c" */
|
||||||
|
|
||||||
#ifdef esto_pa_la_0_1_4
|
|
||||||
|
|
||||||
case lstrcpy:
|
case lstrcpy:
|
||||||
/* #ifdef DEBUG
|
/* #ifdef DEBUG
|
||||||
if ((mem[pila[sp-1]-1]&0xFFF00000)!=0xDAD00000) {
|
if ((mem[pila[sp-1]-1]&0xFFF00000)!=0xDAD00000) {
|
||||||
|
@ -769,8 +775,10 @@ int proceso( int num, int padre )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif*/
|
#endif*/
|
||||||
if ((unsigned)pila[sp]>255) strcpy((char*)&mem[pila[sp-1]],(char*)&mem[pila[sp]]);
|
if ((unsigned)pila[sp]>255)
|
||||||
else sprintf((char*)&mem[pila[sp-1]],"%c\0",pila[sp]);
|
strcpy((char*)&mem[pila[sp-1]],(char*)&mem[pila[sp]]);
|
||||||
|
else
|
||||||
|
sprintf((char*)&mem[pila[sp-1]],"%c\0",pila[sp]);
|
||||||
sp--;
|
sp--;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -831,11 +839,11 @@ int proceso( int num, int padre )
|
||||||
oo=strlen((char*)&mem[pila[sp-1]]);
|
oo=strlen((char*)&mem[pila[sp-1]]);
|
||||||
if (oo<1028) {
|
if (oo<1028) {
|
||||||
strcpy((char*)&mem[nullstring[nstring]],(char*)&mem[pila[sp-1]]);
|
strcpy((char*)&mem[nullstring[nstring]],(char*)&mem[pila[sp-1]]);
|
||||||
if (pila[sp]>0) { // Quitar caracteres
|
if (pila[sp]>0) { /* Quitar caracteres */
|
||||||
if (pila[sp]>=oo) memb[nullstring[nstring]*4]=0;
|
if (pila[sp]>=oo) memb[nullstring[nstring]*4]=0;
|
||||||
else memb[nullstring[nstring]*4+oo-pila[sp]]=0;
|
else memb[nullstring[nstring]*4+oo-pila[sp]]=0;
|
||||||
} else if (pila[sp]<0) { // A¤adir (?) caracteres (por homogeneidad)
|
} else if (pila[sp]<0) { /* Añadir (?) caracteres (por homogeneidad) */
|
||||||
pila[sp]=oo-pila[sp]; // Nueva longitud
|
pila[sp]=oo-pila[sp]; /* Nueva longitud */
|
||||||
if (pila[sp]>1025) pila[sp]=1025;
|
if (pila[sp]>1025) pila[sp]=1025;
|
||||||
for (;oo<pila[sp];oo++) {
|
for (;oo<pila[sp];oo++) {
|
||||||
memb[nullstring[nstring]*4+oo]=' ';
|
memb[nullstring[nstring]*4+oo]=' ';
|
||||||
|
@ -863,8 +871,8 @@ int proceso( int num, int padre )
|
||||||
if (pila[sp]>0) { // Quitar caracteres
|
if (pila[sp]>0) { // Quitar caracteres
|
||||||
if (pila[sp]>=oo) memb[pila[sp-1]*4]=0;
|
if (pila[sp]>=oo) memb[pila[sp-1]*4]=0;
|
||||||
else memb[pila[sp-1]*4+oo-pila[sp]]=0;
|
else memb[pila[sp-1]*4+oo-pila[sp]]=0;
|
||||||
} else if (pila[sp]<0) { // A¤adir (?) caracteres (por homogeneidad)
|
} else if (pila[sp]<0) { /* Añadir (?) caracteres (por homogeneidad) */
|
||||||
pila[sp]=oo-pila[sp]; // Nueva longitud
|
pila[sp]=oo-pila[sp]; /* Nueva longitud */
|
||||||
for (;oo<pila[sp];oo++) {
|
for (;oo<pila[sp];oo++) {
|
||||||
memb[pila[sp-1]*4+oo]=' ';
|
memb[pila[sp-1]*4+oo]=' ';
|
||||||
} memb[pila[sp-1]*4+oo]=0;
|
} memb[pila[sp-1]*4+oo]=0;
|
||||||
|
@ -971,6 +979,7 @@ int proceso( int num, int padre )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lcpastr:
|
case lcpastr:
|
||||||
|
_param_offset=reservedptr("param_offset");
|
||||||
/* #ifdef DEBUG
|
/* #ifdef DEBUG
|
||||||
if ((mem[pila[sp]-1]&0xFFF00000)!=0xDAD00000) {
|
if ((mem[pila[sp]-1]&0xFFF00000)!=0xDAD00000) {
|
||||||
sp--; mem[id+_Param]++; v_function=-2; e(164);
|
sp--; mem[id+_Param]++; v_function=-2; e(164);
|
||||||
|
@ -985,12 +994,11 @@ int proceso( int num, int padre )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif*/
|
#endif*/
|
||||||
if ((unsigned)pila[mem[id+_Param]]>255)
|
if ((unsigned)pila[mem[procs_s[num_proc].id+_param_offset]]>255)
|
||||||
strcpy((char*)&mem[pila[sp]],(char*)&mem[pila[mem[id+_Param]]]);
|
strcpy((char*)&mem[pila[sp]],(char*)&mem[pila[mem[procs_s[num_proc].id+_param_offset]]]);
|
||||||
else sprintf((char*)&mem[pila[sp]],"%c\0",pila[mem[id+_Param]]);
|
else sprintf((char*)&mem[pila[sp]],"%c\0",pila[mem[procs_s[num_proc].id+_param_offset]]);
|
||||||
sp--; mem[id+_Param]++;
|
sp--; mem[procs_s[num_proc].id+_param_offset]++;
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Comprobación de punteros nulos */
|
/* Comprobación de punteros nulos */
|
||||||
case lnul:
|
case lnul:
|
||||||
|
|
|
@ -251,6 +251,13 @@ int num_proc_orden ;
|
||||||
|
|
||||||
int devolver; // Si se espera devolucion > 0
|
int devolver; // Si se espera devolucion > 0
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
// Para sumar cadenas "en el aire" (es decir, para evaluar los resultados de
|
||||||
|
// las expresiones con cadenas, que no se almacenan necesariamente en mem[])
|
||||||
|
|
||||||
|
int nullstring[4];
|
||||||
|
int nstring;
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
int ini_interprete() ;
|
int ini_interprete() ;
|
||||||
|
|
|
@ -128,9 +128,11 @@ int main(int argc, char* argv[])
|
||||||
iloc_len=(mimem[5]+mimem[6]);
|
iloc_len=(mimem[5]+mimem[6]);
|
||||||
if (iloc_len&1) iloc_len++;
|
if (iloc_len&1) iloc_len++;
|
||||||
|
|
||||||
|
/* max_process */
|
||||||
if (mimem[3]>0) {
|
if (mimem[3]>0) {
|
||||||
imem_max=mimem[8]+mimem[3]*(iloc_len)+iloc_len+2;
|
imem_max=mimem[8]+mimem[3]*(iloc_len)+iloc_len+2;
|
||||||
} else {
|
} else {
|
||||||
|
/* si max_process==0, calcula un límite de memoria */
|
||||||
imem_max=mimem[8]+128*(iloc_len)+iloc_len+2;
|
imem_max=mimem[8]+128*(iloc_len)+iloc_len+2;
|
||||||
if (imem_max<256*1024) imem_max=256*1024;
|
if (imem_max<256*1024) imem_max=256*1024;
|
||||||
if (imem_max>512*1024) imem_max=512*1024;
|
if (imem_max>512*1024) imem_max=512*1024;
|
||||||
|
@ -144,11 +146,11 @@ int main(int argc, char* argv[])
|
||||||
//filenames=(char*)&mem[imem_max+258*5]; // Buffer de 16*1025 para dirinfo[].name
|
//filenames=(char*)&mem[imem_max+258*5]; // Buffer de 16*1025 para dirinfo[].name
|
||||||
|
|
||||||
memset(mem,0,4*imem_max+1032*5);
|
memset(mem,0,4*imem_max+1032*5);
|
||||||
// Para sumar cadenas "en el aire"
|
/* Para sumar cadenas "en el aire" */
|
||||||
/* nullstring[0]=imem_max+1+258*0; mem[nullstring[0]-1]=0xDAD00402;
|
nullstring[0]=imem_max+1+258*0; mem[nullstring[0]-1]=0xDAD00402;
|
||||||
nullstring[1]=imem_max+1+258*1; mem[nullstring[1]-1]=0xDAD00402;
|
nullstring[1]=imem_max+1+258*1; mem[nullstring[1]-1]=0xDAD00402;
|
||||||
nullstring[2]=imem_max+1+258*2; mem[nullstring[2]-1]=0xDAD00402;
|
nullstring[2]=imem_max+1+258*2; mem[nullstring[2]-1]=0xDAD00402;
|
||||||
nullstring[3]=imem_max+1+258*3; mem[nullstring[3]-1]=0xDAD00402;*/
|
nullstring[3]=imem_max+1+258*3; mem[nullstring[3]-1]=0xDAD00402;
|
||||||
memcpy(mem,mimem,40);
|
memcpy(mem,mimem,40);
|
||||||
|
|
||||||
if ((ptr=(byte*)malloc(len))!=NULL) {
|
if ((ptr=(byte*)malloc(len))!=NULL) {
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue