=================================================================== RCS file: /home/cvs/OpenXM_contrib2/windows/engine2000/io.c,v retrieving revision 1.1.1.1 retrieving revision 1.12 diff -u -p -r1.1.1.1 -r1.12 --- OpenXM_contrib2/windows/engine2000/io.c 2000/11/22 06:20:13 1.1.1.1 +++ OpenXM_contrib2/windows/engine2000/io.c 2019/03/28 08:03:07 1.12 @@ -29,7 +29,7 @@ #include #include #include -#include "../asir2000/include/ca.h" +#include "ca.h" /* error message structure */ @@ -54,6 +54,7 @@ static HANDLE hNotify0,hNotify_Ack0,hIntr0; static HANDLE hDebugNotify,hDebugNotify_Ack,hDebugIntr,hDebugIntr_Ack,hDebugKill; HANDLE hResizeNotify,hResizeNotify_Ack; /* should be visible from another file */ +HANDLE hMainThreadReady,hCanvasCreated; /* notification for ox_plot */ /* XXX */ extern HANDLE hStreamNotify,hStreamNotify_Ack; /* declared in io/ox.c */ @@ -69,7 +70,7 @@ static struct ErrMsg Errmsg; * interrupt_state : flag to distinguish an Asir error and a cancellation */ -static int emergency; +int emergency; static int interrupt_state; int debuggui_is_present; int messagegui_is_present; @@ -90,8 +91,6 @@ void AsirMain(int,char **); void OxAsirMain(int,char **); void OxPlotMain(int,char **); -void Init_Asir(int,char **); -int Call_Asir(char *,void *); void int_handler(int); void set_debug_handles(int); int create_debug_gui(); @@ -123,13 +122,16 @@ void watch_intr() { if ( doing_batch ) send_intr(); /* for Asir; recv_intr is reset to 0 in Asir */ + enter_signal_cs(); recv_intr = 1; + leave_signal_cs(); + PulseEvent(hIntr_Ack); break; case WAIT_OBJECT_0+1: /* hKill */ default: terminate_debug_gui(); emergency = 1; /* XXX */ - asir_terminate(2); + asir_terminate(3); exit(0); /* NOTREACHED */ break; @@ -149,19 +151,23 @@ void ox_watch_intr() { ResetEvent(hOxIntr); if ( doing_batch ) send_intr(); + enter_signal_cs(); recv_intr = 1; + leave_signal_cs(); break; case WAIT_OBJECT_0+1: /* hOxReset */ ResetEvent(hOxReset); if ( doing_batch ) send_intr(); + enter_signal_cs(); recv_intr = 2; + leave_signal_cs(); break; case WAIT_OBJECT_0+2: /* hOxKill */ ResetEvent(hOxKill); terminate_debug_gui(); emergency = 1; /* XXX */ - asir_terminate(2); + asir_terminate(3); /* NOTREACHED */ break; } @@ -322,10 +328,16 @@ void set_debug_handles(int on) } } +extern int wfep_mode; + void Init_IO() { +#if _MSC_VER < 1910 _setargv(); - if ( !strcmp(__argv[0],"ox_asir") ) { +#endif + if ( !strncmp(__argv[0],"ox_asir",strlen("ox_asir")) ) { + /* ox_asir or ox_asir_wfep */ + if ( !strcmp(__argv[0],"ox_asir_wfep") ) wfep_mode = 1; OxAsirMain(__argc,__argv); exit(0); } else if ( !strcmp(__argv[0],"ox_plot") ) @@ -342,7 +354,6 @@ void Init_IO() void AsirMain(int argc, char **argv) { DWORD tid; - int ret; hRead = (void *)atoi(__argv[1]); hWrite = (void *)atoi(__argv[2]); @@ -378,7 +389,6 @@ void OxAsirMain(int argc, char **argv) { int create_message; int tid; - int ret; ox_sock_id = atoi(__argv[1]); create_message = atoi(__argv[2]); @@ -410,7 +420,6 @@ void OxPlotMain(int argc, char **argv) DWORD tid; DWORD mypid; char eventname[BUFSIZ]; - int ret; ox_sock_id = atoi(argv[1]); do_message = atoi(argv[2]); @@ -434,6 +443,10 @@ void OxPlotMain(int argc, char **argv) hResizeNotify = CreateEvent(NULL,TRUE,FALSE,eventname); sprintf(eventname,"resize_notify_ack_%d",mypid); hResizeNotify_Ack = CreateEvent(NULL,TRUE,FALSE,eventname); + sprintf(eventname,"mainthreadready_%d",mypid); + hMainThreadReady = CreateEvent(NULL,TRUE,FALSE,eventname); + sprintf(eventname,"canvascreated_%d",mypid); + hCanvasCreated = CreateEvent(NULL,TRUE,FALSE,eventname); hWatchStreamThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)ox_watch_stream,NULL,0,&tid); // ret = SetThreadPriority(hWatchStreamThread,THREAD_PRIORITY_BELOW_NORMAL); @@ -446,7 +459,7 @@ void OxPlotMain(int argc, char **argv) /* process_args() increments argv */ plot_argc = argc-5; - plot_argv = argc+5; + plot_argv = argv+5; hComputingThread = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)ox_plot_main,NULL,0,&tid); // ret = SetThreadPriority(hComputingThread,THREAD_PRIORITY_ABOVE_NORMAL); // if ( !ret ) @@ -558,8 +571,8 @@ void set_error(int id,char *reason,char *action) } /* dummy functions */ -reset_current_computation(){} -set_selection(){} -reset_selection(){} -set_busy(){} -reset_busy(){} +void reset_current_computation(){} +void set_selection(){} +void reset_selection(){} +void set_busy(){} +void reset_busy(){}