From fbe03ef4e8ed988e037473ff2c91660403e9f7bca8a517958aabdc65fd865c9b Mon Sep 17 00:00:00 2001 From: Gabriel Lorenzo Date: Tue, 24 Sep 2002 21:13:13 +0000 Subject: [PATCH] max_process y correccion de bug --- ediv/bin/bum.prg | 3 + ediv/src/stub/ediv_export.c | 4 +- ediv/src/stub/inte.c | 11 +- ediv/src/stub/kernel.c | 191 ----------------------------- ediv/src/stub/kernel.h | 58 --------- ediv/src/stub/language.c | 16 ++- ediv/src/stub/main.h | 2 +- ediv/src/stub/stub.c | 37 +++--- ediv/src/visual c/ediv_ws.suo | Bin 22016 -> 25600 bytes ediv/src/visual c/stub/stub.vcproj | 6 - 10 files changed, 46 insertions(+), 282 deletions(-) delete mode 100644 ediv/src/stub/kernel.c delete mode 100644 ediv/src/stub/kernel.h diff --git a/ediv/bin/bum.prg b/ediv/bin/bum.prg index dc1467d..aacf7ea 100644 --- a/ediv/bin/bum.prg +++ b/ediv/bin/bum.prg @@ -7,6 +7,7 @@ begin load_bmp("hola.bmp"); load_fnt("system.fnt"); write_int(1,0,0,0,&numprocs); + define_region(1,0,10,320,190); loop if(key(_space)) cosa(); numprocs++; end if(key(_w)) delete_text(all_text); end @@ -21,6 +22,8 @@ begin x=rand(0,319); y=rand(0,199); + region=1; + loop frame; x+=rand(-1,1); diff --git a/ediv/src/stub/ediv_export.c b/ediv/src/stub/ediv_export.c index d349cab..a7d4c52 100644 --- a/ediv/src/stub/ediv_export.c +++ b/ediv/src/stub/ediv_export.c @@ -98,8 +98,8 @@ void dll_error(int error, ...) printf("%s\n",mensaje); #endif - /*printf("\n"); - n_errors++;*/ + //printf("\n"); + //n_errors++; exit(-1); } diff --git a/ediv/src/stub/inte.c b/ediv/src/stub/inte.c index dd86887..ae6d2ca 100644 --- a/ediv/src/stub/inte.c +++ b/ediv/src/stub/inte.c @@ -32,7 +32,7 @@ #include "extern.h" #include "edivfont.h" -#include "kernel.h" +//#include "kernel.h" #include "inte.h" #include "main.h" #include "dll.h" @@ -144,7 +144,7 @@ int interprete() Call_Entrypoint(EDIV_frame); }else { - stub_quit() ; + stub_quit(0) ; } @@ -310,11 +310,12 @@ int proceso( int num ) mem[pila[sp--]]=pila[reserved("param_offset",procs_s[num_proc].id)++]; break; case ltyp://32 - procs_s[num_proc].id = mem[2] + ( num_proc * iloc_len ) ; - reserved("process_id",procs_s[num_proc].id)=procs_s[num_proc].id; - memcpy(&mem[procs_s[num_proc].id],&mem[iloc],iloc_pub_len<<2); if ( procs_s[num_proc].tipo != 0 ) critical_error(3); // redefinición del tipo de proceso + procs_s[num_proc].id = mem[2] + ( num_proc * iloc_len ) ; + if(procs_s[num_proc].id>imem_max-iloc_len) critical_error(8); // demasiados procesos en ejecución + reserved("process_id",procs_s[num_proc].id)=procs_s[num_proc].id; + memcpy(&mem[procs_s[num_proc].id],&mem[iloc],iloc_pub_len<<2); procs_s[num_proc].tipo = mem[ imem++ ] ; reserved("process_type",procs_s[num_proc].id) = procs_s[num_proc].tipo ; inicio_privadas=mem[6]; diff --git a/ediv/src/stub/kernel.c b/ediv/src/stub/kernel.c deleted file mode 100644 index 58c6491..0000000 --- a/ediv/src/stub/kernel.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * eDiv Compiler - * Copyleft (C) 2000-2002 Sion Entertainment - * http://www.sion-e.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Este fichero contien el codigo del Kernel del eDiv - * by Riseven - * - */ - -// se supone ke todo esto sirve para algo? (Er_Makina) - -#include -#include - -#ifdef WIN32 - #include -#endif - -#include - -#include "edivfont.h" -#include "kernel.h" -#include "inte.h" -#include "extern.h" -#include "main.h" - - - -struct _k_error_s k_error_s[50] ; - - -int ini_kernel() -{ - //FILE *fp ; // AHORA FP ES OTRA COSA MAS IMPORTANTE XDDD - FILE *im ; - char *pool ; - fpos_t pos ; - - - // EDIV NOID -/* - fp = fopen("fuente.fnt", "r" ) ; - im = fopen("tempo.bmp", "w" ) ; - printf( "\n%i\n" , ftell( fp ) ) ; - printf( "\nsizeof control:%i\n" , sizeof(fuente_control_s[0]) ) ; - //printf( "leido:%i\n" , (int)fread( &fuente_control_s[0] , 1 , sizeof(fuente_control_s[0]) , fp ) ) ; - printf( "leido:%i\n" , (int)fread( &fuente_control_s[0] , 1 , 1393 , fp ) ) ; - printf( "Sizeof imagen: %i" , fuente_control_s[0].size_imagen ) ; - if (!(pool = malloc(fuente_control_s[0].size_imagen + 1 ) ) ) - printf("Error: Memoria insuficiente" ) ; - - pos = fuente_control_s[0].offset_imagen + 10; - fsetpos(fp , &pos ) ; - printf( "\n%i\n%i\n" , ftell( fp ), fuente_control_s[0].offset_imagen ) ; - printf( "leido:%i\n" , fread( pool , 1 , fuente_control_s[0].size_imagen , fp ) ) ; - - //fwrite( &fuente_control_s , 1 , 2060 , fp ) ; - printf( "\n%i\n%i\n" , ftell( fp ), fuente_control_s[0].size_imagen ) ; - getchar() ; - - fwrite( pool , 1 , fuente_control_s[0].size_imagen , im ) ; - free( pool ) ; - fclose( im ) ; - fclose(fp) ; - - // Sacamos la fuente - fuente_control_s[0].imagen = SDL_LoadBMP("tempo.bmp") ; - - // Escribimos A - - textos_s[0].cadena = SDL_CreateRGBSurface(SDL_HWSURFACE, fuente_control_s[0].rect[173].w, fuente_control_s[0].rect[173].h, 24, 0xFF0000, 0x00FF00, 0x0000FF, 0x000000); - SDL_BlitSurface( fuente_control_s[0].imagen , &fuente_control_s[0].rect[173] , textos_s[0].cadena , NULL ) ; - textos_s[0].x = 20 ; - textos_s[0].y = 20 ; - textos_s[0].existe = 1 ; - - - imgs[0] = SDL_LoadBMP( "BG.bmp" ) ; - if ( imgs[0] == NULL ) - exit(0); - imgs[1] = SDL_LoadBMP( "bola.bmp" ) ; - if ( imgs[1] == NULL ) - exit(0); - imgs[2] = SDL_LoadBMP( "barra.bmp" ) ; - if ( imgs[2] == NULL ) - exit(0); -*/ - -/* - //Cargamos bola.bmp PROVISIONAL mientras se hace Load_BMP() - imgs[0] = SDL_LoadBMP( "bola.bmp" ) ; - if ( imgs[0] == NULL ) - exit(0) ; -*/ - - - strcpy( k_error_s[K_ERR_SDL_INIT].cadena , "NO SE PUDO INICIALIZAR LA SDL" ); - k_error_s[K_ERR_SDL_INIT].nivel = 1000 ; - strcpy( k_error_s[K_ERR_SDL_SET_VIDEO_MODE].cadena , "NO SE PUDO ESTABLECER EL MODO GRAFICO" ); - k_error_s[K_ERR_SDL_SET_VIDEO_MODE].nivel = 900 ; - strcpy( k_error_s[K_ERR_KERNEL].cadena , "ERROR DURANTE LA EJECUCION DEL KERNEL" ); - k_error_s[K_ERR_KERNEL].nivel = 400 ; - strcpy( k_error_s[K_ERR_INTERPRETE].cadena , "ERROR DURANTE LA EJECUCION DEL INTERPRETE" ); - k_error_s[K_ERR_INTERPRETE].nivel = 1000 ; - strcpy( k_error_s[K_ERR_INI_INTERPRETE].cadena , "ERROR DURANTE LA INICIALIZACION DEL INTERPRETE" ); - k_error_s[K_ERR_INI_INTERPRETE].nivel = 1000 ; - - return 0; -} - - -// KERNEL -// Se encarga de los procesos internos del stub -// by Riseven - -int kernel() -{ - int i ; -// SDL_Rect dst_rect; -// SDL_Rect src_rect ; - -/* - // Para el testeo - for ( i = 0 ; i < num_proc_orden ; i++ ) - { - lista_draw_proc_s[0].imagen = imgs[0] ; - lista_draw_proc_s[0].x = mem[procs_s[proc_orden[i]].id + _X -1 ] ; - lista_draw_proc_s[0].y = mem[procs_s[proc_orden[i]].id + _Y -1 ] ; - } - - num_draw_proc = i ; - - // Se dibujan los graficos que proceden de procesos - for ( i = 0 ; i < num_draw_proc ; i++ ) - { - dst_rect.x = lista_draw_proc_s[i].x ; - dst_rect.y = lista_draw_proc_s[i].y ; - dst_rect.w = lista_draw_proc_s[i].imagen->w ; - dst_rect.h = lista_draw_proc_s[i].imagen->h ; - SDL_BlitSurface( lista_draw_proc_s[i].imagen , NULL , screen , &dst_rect ) ; - } -*/ -/* - - // Se escriben los textos ( ESTO SE TENDRA K MEZCLAR CON LO ANTERIOR - for ( i = 0 ; i < 256 ; i++ ) - { - if ( textos_s[i].existe == 1 ) - { - dst_rect.x = textos_s[i].x ; - dst_rect.y = textos_s[i].y ; - dst_rect.w = textos_s[i].cadena->w ; - dst_rect.h = textos_s[i].cadena->h ; - SDL_BlitSurface( textos_s[i].cadena , NULL , screen , &dst_rect ) ; - } - } -*/ - - - - //SDL_Flip(screen) ; - - return 1 ; -} - -void k_error( int codigo ) -{ - fprintf(stdout, k_error_s[codigo].cadena ) ; - - if ( k_error_s[codigo].nivel >= K_ERROR_EXIT ) - exit(0) ; - -} - diff --git a/ediv/src/stub/kernel.h b/ediv/src/stub/kernel.h deleted file mode 100644 index d250321..0000000 --- a/ediv/src/stub/kernel.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * eDiv Compiler - * Copyleft (C) 2000-2002 Sion Entertainment - * http://www.sion-e.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __KERNEL_H -#define __KERNEL_H - -// CODIGOS DE ERROR DEL KERNEL -#define K_ERR_SDL_INIT 0 -#define K_ERR_SDL_SET_VIDEO_MODE 1 -#define K_ERR_KERNEL 2 -#define K_ERR_INTERPRETE 3 -#define K_ERR_INI_INTERPRETE 4 - -// NIVEL CRITICO DE ERROR DEL KERNEL -#define K_ERROR_EXIT 500 - -struct _k_error_s { - char cadena[64]; - int nivel; -}; - -struct _lista_draw_proc_s{ - SDL_Surface *imagen; - int x,y; -} lista_draw_proc_s[512]; - - -int num_draw_proc; - -struct _textos_s { - SDL_Surface *cadena; - int x,y; - int existe; -} textos_s[256]; - - -int ini_kernel(); -int kernel(); -void k_error(int codigo); - -#endif /* __KERNEL_H */ \ No newline at end of file diff --git a/ediv/src/stub/language.c b/ediv/src/stub/language.c index 7e767ba..f1f2ed4 100644 --- a/ediv/src/stub/language.c +++ b/ediv/src/stub/language.c @@ -782,7 +782,7 @@ char* translate_runtime_error(int num) char* translate_critical_error(int num) { - static char *e[NUM_LANGUAGES][7] = { + static char *e[NUM_LANGUAGES][9] = { /* 0 - ESPAÑOL */ @@ -793,6 +793,8 @@ char* translate_critical_error(int num) /* 4 */ "No se pudo reservar memoria para la pila", /* 5 */ "Librería no encontrada: %s", /* 6 */ "%s no es una librería válida de eDIV", + /* 7 */ "No se pudo inicializar SDL", + /* 8 */ "Demasiados procesos en ejecución" /* 1 - ITALIANO */ @@ -803,6 +805,8 @@ char* translate_critical_error(int num) /* 4 */ "Non si è potuto riservare memoria per la pila", /* 5 */ "Libreria non trovata: %s", /* 6 */ "%s non è una libreria valida di eDIV", + /* 7 */ "No se pudo inicializar SDL", // TODO + /* 8 */ "Demasiados procesos en ejecución", // TODO /* 2 - PORTUGUÉS (FIXMI: traducir) */ @@ -813,6 +817,8 @@ char* translate_critical_error(int num) /* 4 */ "No se pudo reservar memoria para la pila", /* 5 */ "Librería no encontrada: %s", /* 6 */ "%s no es una librería válida de eDIV", + /* 7 */ "No se pudo inicializar SDL", + /* 8 */ "Demasiados procesos en ejecución", /* 3 - INGLÉS */ @@ -823,6 +829,8 @@ char* translate_critical_error(int num) /* 4 */ "Can't allocate stack memory", /* 5 */ "Library not found: %s", /* 6 */ "%s is not a valid eDIV library", + /* 7 */ "Cannot initialize SDL", + /* 8 */ "Too many processes in execution", /* 4 - CATALÁN */ @@ -833,6 +841,8 @@ char* translate_critical_error(int num) /* 4 */ "No es va poder reservar memòria per a la pila", /* 5 */ "Llibreria no trobada: %s", /* 6 */ "%s no és una llibreria vàlida d' eDIV", + /* 7 */ "No se pudo inicializar SDL", // TODO + /* 8 */ "Demasiados procesos en ejecución", // TODO /* 5 - EUSKERA */ @@ -842,7 +852,9 @@ char* translate_critical_error(int num) /* 3 */ "Prozesu motaren berdefinizioa", /* 4 */ "Ezin izan da memoriarik erreserbatu pilarentzat", /* 5 */ "Ezin da liburutegia aurkitu: %s", - /* 6 */ "%s ez da eDIV-en liburutegi zuzen bat" + /* 6 */ "%s ez da eDIV-en liburutegi zuzen bat", + /* 7 */ "No se pudo inicializar SDL", // TODO + /* 8 */ "Demasiados procesos en ejecución", // TODO }; return e[idioma][num]; diff --git a/ediv/src/stub/main.h b/ediv/src/stub/main.h index 8ab8238..b011663 100644 --- a/ediv/src/stub/main.h +++ b/ediv/src/stub/main.h @@ -85,7 +85,7 @@ int* lin; void error(int num, ...); // Mensaje de error no crítico (trazable) void critical_error(int num, ...); // Mensaje de error crítico -void stub_quit(void); // Salir del stub +void stub_quit(int n); // Salir del stub void* e_malloc(size_t size); // identico a malloc pero con errormsg utomático #endif /* __MAIN_H */ \ No newline at end of file diff --git a/ediv/src/stub/stub.c b/ediv/src/stub/stub.c index 6971798..73d121f 100644 --- a/ediv/src/stub/stub.c +++ b/ediv/src/stub/stub.c @@ -18,8 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include - #include #include #include @@ -31,7 +29,7 @@ #include "extern.h" #include "main.h" -#include "kernel.h" +//#include "kernel.h" #include "inte.h" #include "varindex.h" #include "fatal.h" @@ -235,19 +233,18 @@ int main(int argc, char* argv[]) // Nota: las DLL's se cargan en el transcurso del programa (las instrucciones // que ordenan cargar las dll's necesarias se encuentran en el propio bytecode) - if (ini_kernel()) - exit (0); + //if (ini_kernel()) + // exit (0); // AHORA TODO ESTO EN LA GRAPHICS.DLL // SE INICIALIZA LA SDL if (SDL_Init(SDL_INIT_TIMER)) - k_error(K_ERR_SDL_INIT); + critical_error(7); // no puedo inicializar SDL - - atexit(stub_quit); + //atexit(stub_quit); // SE PONE EL MODO GRAFICO 320x200 MODO VENTANA // Ya se hara el modo full screen @@ -259,8 +256,9 @@ int main(int argc, char* argv[]) if ( screen == NULL ) k_error(K_ERR_SDL_SET_VIDEO_MODE); */ - if ( !ini_interprete() ) - k_error(K_ERR_INI_INTERPRETE) ; + ini_interprete(); + /*if ( !ini_interprete() ) + k_error(K_ERR_INI_INTERPRETE) ;*/ while (1) { @@ -292,13 +290,14 @@ int main(int argc, char* argv[]) } - if (!interprete()) - k_error(K_ERR_INTERPRETE); + interprete(); + /*if (!interprete()) + k_error(K_ERR_INTERPRETE);*/ // Control de Frames por segundo POR HACER !!!!!! - if (!kernel()) - k_error(K_ERR_KERNEL); + /*if (!kernel()) + k_error(K_ERR_KERNEL);*/ // tiempo /* @@ -342,14 +341,18 @@ int main(int argc, char* argv[]) return 0; } - -void stub_quit(void) +#include +void stub_quit(int n) { int i; - for(i=0;i)p0yQf6qZpY9Ymh}_A}DrEgN?<0 zXg@5KlUinFWcEYNa^Lr&SN4Kt_y_zKa(v-rGqHWnWocN7tx2|f=X35k=iYnHbI$WU z&pDHq)#P>cU5{1b6_K?tmq;WQ&_hm-nmf7EtIsQY~}z@4e=e$h-w)n7lsI!&kyoE1gGF-7=v+$!YeQVF_?sF zIqk}Ck;#HV@W4ybC!>^xB_snh^%VI%)GxZ?2XhZA)fB&zchsR*yIS4Zk|#=u^uTRC zbn4lH;#||sTi`OKslwgv@jOZ)8IkA23}UNC|K8}WwrdBdAEa-Fl|!;ue6o*cvH2s+ z;0{p5u;W(?e^S;lrN`V8mfscs%{`H2l~XJo%U;I^)A2i{kCy4l+FSY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