=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/io/ox.c,v retrieving revision 1.12 retrieving revision 1.20 diff -u -p -r1.12 -r1.20 --- OpenXM_contrib2/asir2000/io/ox.c 2001/10/09 01:36:21 1.12 +++ OpenXM_contrib2/asir2000/io/ox.c 2003/03/07 03:12:28 1.20 @@ -44,7 +44,7 @@ * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. - * $OpenXM: OpenXM_contrib2/asir2000/io/ox.c,v 1.11 2001/08/03 08:50:19 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/io/ox.c,v 1.19 2003/02/14 22:29:15 ohara Exp $ */ #include "ca.h" #include "parse.h" @@ -57,13 +57,13 @@ extern Obj VOIDobj; extern int ox_need_conv; -extern int ox_usr1_sent, ox_int_received, critical_when_signal; +int ox_usr1_sent, ox_int_received, critical_when_signal; unsigned int ox_serial; int ox_flushing; int ox_batch; int ox_check=1; int ox_exchange_mathcap=1; -jmp_buf ox_env; +JMP_BUF ox_env; MATHCAP my_mathcap; @@ -110,7 +110,7 @@ void ox_resetenv(char *s) cleanup_events(); #endif fprintf(stderr,"%s\n",s); - longjmp(ox_env,1); + LONGJMP(ox_env,1); } static int available_cmo[] = { @@ -125,7 +125,7 @@ static int available_cmo[] = { 0 }; -static int available_sm[] = { +static int asir_available_sm[] = { SM_dupErrors, SM_getsp, SM_popSerializedLocalObject, SM_popCMO, SM_popString, SM_pushCMOtag, SM_setName, SM_evalName, SM_executeStringByLocalParser, @@ -136,6 +136,26 @@ static int available_sm[] = { 0 }; +static int ox_asir_available_sm[] = { + SM_dupErrors, SM_getsp, SM_popSerializedLocalObject, + SM_popCMO, SM_popString, SM_pushCMOtag, SM_setName, + SM_evalName, SM_executeStringByLocalParser, + SM_executeStringByLocalParserInBatchMode, + SM_executeFunction, SM_shutdown, SM_pops, + SM_mathcap, SM_setMathcap, SM_nop, + SM_beginBlock, SM_endBlock, + 0 +}; + +static int ox_plot_available_sm[] = { + SM_dupErrors, SM_getsp, SM_popSerializedLocalObject, + SM_popCMO, SM_popString, SM_setName, + SM_evalName, SM_executeStringByLocalParser, + SM_executeFunction, SM_shutdown, SM_pops, + SM_mathcap, SM_setMathcap, SM_nop, + 0 +}; + /* mathcap = [ @@ -164,11 +184,24 @@ void create_my_mathcap(char *system) MKUSINT(t,OX_VERSION); n0 = mknode(2,t,str); MKLIST(sname,n0); - /* cmo tag */ - for ( n0 = 0, i = 0; k = available_sm[i]; i++ ) { - NEXTNODE(n0,n); MKUSINT(t,k); BDY(n) = (pointer)t; + /* sm tag */ + n0 = 0; + if ( !strcmp(system,"asir") ) { + for ( i = 0; k = asir_available_sm[i]; i++ ) { + NEXTNODE(n0,n); MKUSINT(t,k); BDY(n) = (pointer)t; + } + } else if ( !strcmp(system,"ox_asir") ) { + for ( i = 0; k = ox_asir_available_sm[i]; i++ ) { + NEXTNODE(n0,n); MKUSINT(t,k); BDY(n) = (pointer)t; + } + NEXT(n) = 0; + } else if ( !strcmp(system,"ox_plot") ) { + for ( i = 0; k = ox_plot_available_sm[i]; i++ ) { + NEXTNODE(n0,n); MKUSINT(t,k); BDY(n) = (pointer)t; + } + NEXT(n) = 0; } - NEXT(n) = 0; MKLIST(smlist,n0); + MKLIST(smlist,n0); /* creation of [OX_DATA,CMO list] */ /* ox tag */ @@ -367,10 +400,10 @@ void end_critical() { } } +extern FUNC registered_handler; + void ox_usr1_handler(int sig) { - extern jmp_buf env; - #if !defined(VISUAL) signal(SIGUSR1,ox_usr1_handler); #endif @@ -379,6 +412,12 @@ void ox_usr1_handler(int sig) ox_usr1_sent = 1; } else { ox_flushing = 1; + if ( registered_handler ) { + fprintf(stderr, + "usr1 : calling the registered exception handler..."); + bevalf(registered_handler,0); + fprintf(stderr, "done.\n"); + } ox_resetenv("usr1 : return to toplevel by SIGUSR1"); } } @@ -656,6 +695,12 @@ void ox_get_serverinfo(int s, LIST *rp) MKLIST(*rp,0); } } + +char *ox_get_servername(int s) +{ + return (remote_mc && remote_mc[s].servername)?remote_mc[s].servername:0; +} + int ox_check_cmo_p(int s, P p) {