signals rulando :D
This commit is contained in:
parent
ce6561c6a6
commit
db433fa64e
|
@ -41,7 +41,7 @@
|
|||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/dinmem.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/dinmem.lib"
|
||||
ImportLibrary=""
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#else
|
||||
#error ¡adapta las rutinas de timer a Linux!
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
@ -41,6 +42,21 @@
|
|||
int last_type ;
|
||||
int last_proc ;
|
||||
|
||||
int DEBUG_PROCESOS(FUNCTION_PARAMS)
|
||||
{
|
||||
int i,n;
|
||||
FILE* f;
|
||||
f=fopen("procs.txt","a");
|
||||
fprintf(f,"\n--- COMIENZO ---\n");
|
||||
for(i=0;i<*fp->num_procs;i++) {
|
||||
n=fp->procs_s[fp->proc_orden[i]].id;
|
||||
fprintf(f,"(%d) ID: %d TYPE: %d TIPO: %d STATUS: %d ORDEN: %d\n",i,n,reserved("process_type",n),fp->procs_s[fp->proc_orden[i]].tipo,reserved("status",n),fp->procs_s[fp->proc_orden[i]].orden);
|
||||
}
|
||||
fprintf(f,"\n--- FIN ---\n");
|
||||
fclose(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ExportaFuncs(EXPORTAFUNCS_PARAMS)
|
||||
{
|
||||
|
||||
|
@ -164,6 +180,8 @@ int ExportaFuncs(EXPORTAFUNCS_PARAMS)
|
|||
FUNCTION("signal",2,eDIV_Signal);
|
||||
FUNCTION("let_me_alone",0,eDIV_Let_Me_Alone);
|
||||
|
||||
FUNCTION("debug_procesos",0,DEBUG_PROCESOS);
|
||||
|
||||
ENTRYPOINT( first_load ) ;
|
||||
ENTRYPOINT(frame);
|
||||
|
||||
|
@ -251,9 +269,10 @@ int eDiv_DefineRegion(FUNCTION_PARAMS)
|
|||
void signal_tree(int proc, int signal, FUNCTION_PARAMS)
|
||||
{
|
||||
int id2;
|
||||
reserved("status",proc)=signal;
|
||||
if(id2=local("son",proc)) {
|
||||
signal_tree(id2,signal,fp);
|
||||
reserved("status",id2)=signal;
|
||||
//reserved("status",id2)=signal;
|
||||
}
|
||||
while(local("bigbro",id2)) {
|
||||
proc=local("bigbro",id2);
|
||||
|
@ -267,18 +286,18 @@ int eDIV_Signal(FUNCTION_PARAMS)
|
|||
int proc=getparm();
|
||||
char tree=FALSE;
|
||||
|
||||
// assert(0);
|
||||
if(signal>=100) {
|
||||
signal-=100;
|
||||
tree=TRUE;
|
||||
}
|
||||
|
||||
signal++;
|
||||
|
||||
/* Si se le pasa un ID */
|
||||
if(proc<fp->imem_max)
|
||||
{
|
||||
reserved("status",proc)=signal;
|
||||
if(tree && (proc=reserved("son",proc)))
|
||||
if(tree && (proc=local("son",proc)))
|
||||
signal_tree(proc,signal,fp);
|
||||
}
|
||||
/* Si se le pasa un type */
|
||||
|
@ -287,7 +306,7 @@ int eDIV_Signal(FUNCTION_PARAMS)
|
|||
for(i=0;i<*fp->num_procs;i++) {
|
||||
if(fp->procs_s[fp->proc_orden[i]].tipo==proc) {
|
||||
reserved("status",fp->procs_s[fp->proc_orden[i]].id)=signal;
|
||||
if(tree && (p=reserved("son",fp->procs_s[fp->proc_orden[i]].id)))
|
||||
if(tree && (p=local("son",fp->procs_s[fp->proc_orden[i]].id)))
|
||||
signal_tree(fp->procs_s[fp->proc_orden[i]].id,signal,fp);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="../../../bin"
|
||||
OutputDirectory="./Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="2"
|
||||
CharacterSet="2">
|
||||
|
@ -40,12 +40,13 @@
|
|||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/edivstd.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/edivstd.lib"
|
||||
ImportLibrary=""
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy Debug\edivstd.dll ..\..\..\..\ediv\bin\dll"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/file.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/file.lib"
|
||||
ImportLibrary=""
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/graphics.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/graphics.lib"
|
||||
ImportLibrary=""
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/input.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/input.lib"
|
||||
ImportLibrary=""
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/math.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/math.lib"
|
||||
ImportLibrary=""
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/strings.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/strings.lib"
|
||||
ImportLibrary=""
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/text.pdb"
|
||||
SubSystem="2"
|
||||
ImportLibrary="$(OutDir)/text.lib"
|
||||
ImportLibrary=""
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
|
|
|
@ -1,3 +1,15 @@
|
|||
05/03/2003
|
||||
----------
|
||||
* Hay algún fallo cuando se elimina un proceso, tiene que ver con la
|
||||
eliminación de procesos de procs_s y proc_orden y la creación y
|
||||
ejecución de nuevos procesos (probad a rular robots.prg y pasaros el
|
||||
primer nivel, os dará un error "redefinición del tipo de proceso" cuando
|
||||
intentéis mover el personaje). (Er_Makina)
|
||||
|
||||
04/03/2003
|
||||
----------
|
||||
* signal() arreglado, ya funcionan las señales tree (Er_Makina)
|
||||
|
||||
18/12/2002
|
||||
----------
|
||||
* Mas comentarizacion siguiendo las normas del ANSI C (Daijo)
|
||||
|
|
|
@ -57,6 +57,7 @@ BEGIN
|
|||
// fade_on();
|
||||
// prota=protag(rand(0,39)*8,rand(0,24)*8);
|
||||
protag(rand(0,39)*8,rand(0,24)*8);
|
||||
debug_procesos();
|
||||
for(i=1;i<=num_robots;i++)
|
||||
loop
|
||||
x=rand(0,39);
|
||||
|
@ -189,8 +190,11 @@ BEGIN
|
|||
mueve_robots();
|
||||
end
|
||||
end
|
||||
debug_procesos();
|
||||
signal(prota,s_kill);
|
||||
debug_procesos();
|
||||
signal(type robot,s_kill);
|
||||
debug_procesos();
|
||||
muertos=0;
|
||||
cogido=0;
|
||||
ya=0;
|
||||
|
|
81
ediv/bin/signal2.prg
Normal file
81
ediv/bin/signal2.prg
Normal file
|
@ -0,0 +1,81 @@
|
|||
program prueba_signal2;
|
||||
global
|
||||
idbola;
|
||||
|
||||
begin
|
||||
load_fnt("system.fnt");
|
||||
load_fpg("test16.fpg");
|
||||
put_screen(0,1);
|
||||
|
||||
write_int(1,0,0,0,&idbola);
|
||||
|
||||
idbola=bola(0);
|
||||
|
||||
loop
|
||||
frame;
|
||||
if(key(_f))
|
||||
signal(idbola,s_freeze_tree);
|
||||
while(key(_f))
|
||||
frame;
|
||||
end
|
||||
signal(idbola,s_wakeup_tree);
|
||||
end
|
||||
if(key(_s))
|
||||
signal(idbola,s_sleep_tree);
|
||||
while(key(_s))
|
||||
frame;
|
||||
end
|
||||
signal(idbola,s_wakeup_tree);
|
||||
end
|
||||
if(key(_k))
|
||||
signal(idbola,s_kill_tree);
|
||||
while(key(_k))
|
||||
frame;
|
||||
end
|
||||
triangulo(7);
|
||||
idbola=bola(0);
|
||||
end
|
||||
if(key(_esc))
|
||||
exit("Taluego lucas!!",0);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
process bola(num)
|
||||
begin
|
||||
graph=100;
|
||||
x=160;
|
||||
y=30+num*20;
|
||||
|
||||
if(num<3)
|
||||
bola(num+1);
|
||||
else
|
||||
triangulo(num+1);
|
||||
end
|
||||
|
||||
loop
|
||||
frame;
|
||||
x+=rand(-5,5);
|
||||
if(x<30) x=30; end
|
||||
if(x>290) x=290; end
|
||||
end
|
||||
end
|
||||
|
||||
process triangulo(num)
|
||||
begin
|
||||
graph=101;
|
||||
x=160;
|
||||
y=30+num*20;
|
||||
|
||||
if(num<6)
|
||||
triangulo(num+1);
|
||||
end
|
||||
|
||||
loop
|
||||
frame;
|
||||
x+=rand(-5,5);
|
||||
if(x<30) x=30; end
|
||||
if(x>290) x=290; end
|
||||
end
|
||||
end
|
||||
|
|
@ -335,7 +335,7 @@ void compila()
|
|||
#endif
|
||||
|
||||
if ((f=fopen(outfilename,"ab"))!=NULL) {
|
||||
fwrite(nombre_program,strlen(nombre_program)+1,1,f);
|
||||
fwrite(nombre_program,strlen((const char*)nombre_program)+1,1,f);
|
||||
p=(byte*)e_malloc((imem+iloc)*4);
|
||||
m=(imem+iloc)*4+1024;
|
||||
q=(byte*)e_malloc(m);
|
||||
|
@ -1065,7 +1065,7 @@ void escribe_lin(FILE* f)
|
|||
b++;
|
||||
progcomp=e_malloc(b*2);
|
||||
l=b*2;
|
||||
if(compress(progcomp,&l,prog,b)) {
|
||||
if(compress(progcomp,(unsigned long*)&l,prog,b)) {
|
||||
fclose(linf);
|
||||
fclose(f);
|
||||
errormem();
|
||||
|
|
|
@ -33,12 +33,12 @@ char* buffer;
|
|||
int linea;
|
||||
char cfg[256];
|
||||
|
||||
void cfg_error(int error)
|
||||
/*void cfg_error(int error)
|
||||
{
|
||||
printf(translate(41),cfg,linea,translate_cfg_error(error));
|
||||
printf(translate(42));
|
||||
exit(1);
|
||||
}
|
||||
}*/
|
||||
|
||||
void salta_spc() {
|
||||
while(lower[buffer[i]]==0 && i<tamano) {
|
||||
|
|
|
@ -545,7 +545,7 @@ BOOL PrepareDLLImage(void *pMemoryImage, DWORD dwImageSize, BOOL bResolve, BOOL
|
|||
if(func==NULL) return FALSE;
|
||||
|
||||
// Write address to appropriate location
|
||||
ptd_out->u1.Function = (PDWORD) func;
|
||||
ptd_out->u1.Function = (unsigned long)(PDWORD) func;
|
||||
|
||||
ptd_in++;
|
||||
ptd_out++;
|
||||
|
|
|
@ -242,9 +242,9 @@ int main(int argc, char *argv[])
|
|||
/* mete el PRG en el buffer prog */
|
||||
fseek(fp,0,SEEK_END);
|
||||
progsize=ftell(fp);
|
||||
prog = (char *)e_malloc(progsize+1);
|
||||
prog = (unsigned char *)e_malloc(progsize+1);
|
||||
fseek(fp,0,SEEK_SET);
|
||||
p=prog;
|
||||
p=(char*)prog;
|
||||
do {
|
||||
*p = getc(fp);
|
||||
p++;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "lower.h"
|
||||
|
|
|
@ -39,4 +39,4 @@
|
|||
|
||||
#define long_header 9 /* Longitud de la cabecera al inicio de los programas */
|
||||
|
||||
#endif /* __EDIV_SHARED_H_
|
||||
#endif /* __EDIV_SHARED_H_ */
|
|
@ -123,9 +123,9 @@ int lista_quita( int num )
|
|||
{
|
||||
int i ;
|
||||
|
||||
procs_s[num].tipo=0;
|
||||
procs_s[proc_orden[num]].tipo=0;
|
||||
|
||||
for ( i = procs_s[num].orden+1 ; i < num_proc_orden ; i++ )
|
||||
for ( i = num+1 ; i < num_proc_orden ; i++ )
|
||||
{
|
||||
procs_s[ proc_orden[ i ] ].orden-- ;
|
||||
proc_orden[ i - 1 ] = proc_orden[ i ] ;
|
||||
|
@ -155,9 +155,12 @@ int interprete()
|
|||
|
||||
for ( proceso_actual = 0 ; proceso_actual < num_proc_orden ; proceso_actual++ )
|
||||
{
|
||||
//printf("Proceso %d - Estado: %d\n",procs_s[proc_orden[proceso_actual]].id,mem[procs_s[proc_orden[proceso_actual]].id+_status]);
|
||||
if(mem[procs_s[proc_orden[proceso_actual]].id+_status]==1) {
|
||||
//mem[procs_s[num].id+_status=0;
|
||||
mem[procs_s[proc_orden[proceso_actual]].id+_status]=0;
|
||||
//assert(0);
|
||||
lista_quita(proceso_actual);
|
||||
proceso_actual--;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
|
@ -27,7 +27,7 @@
|
|||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="FALSE"
|
||||
|
|
Loading…
Reference in a new issue