=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/builtin/miscf.c,v retrieving revision 1.1.1.1 retrieving revision 1.5 diff -u -p -r1.1.1.1 -r1.5 --- OpenXM_contrib2/asir2000/builtin/miscf.c 1999/12/03 07:39:07 1.1.1.1 +++ OpenXM_contrib2/asir2000/builtin/miscf.c 2000/03/10 06:42:22 1.5 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/asir99/builtin/miscf.c,v 1.1.1.1 1999/11/10 08:12:25 noro Exp $ */ +/* $OpenXM: OpenXM_contrib2/asir2000/builtin/miscf.c,v 1.4 2000/03/01 02:29:17 noro Exp $ */ #include "ca.h" #include "parse.h" #if INET && !defined(VISUAL) @@ -12,6 +12,8 @@ void Pr2g(), Pread_cmo(), Pwrite_cmo(); void Pgc(),Pbatch(),Psend_progress(); void Pnull_command(); void Pgetenv(); +void Plib_ox_push_cmo(),Plib_ox_pop_cmo(),Plib_ox_push_cmd(); +void Plib_ox_execute_string(); void delete_history(int,int); @@ -34,15 +36,73 @@ struct ftab misc_tab[] = { {"gc",Pgc,0}, {"batch",Pbatch,2}, {"send_progress",Psend_progress,-2}, -#if INET && !defined(VISUAL) +#if INET && !defined(VISUAL) && DO_PLOT {"xpause",Pxpause,0}, #endif #if 0 {"opt",Popt,1}, #endif +#if !defined(VISUAL) +/* test functions for library mode ox operations */ + {"lib_ox_push_cmo",Plib_ox_push_cmo,1}, + {"lib_ox_pop_cmo",Plib_ox_pop_cmo,0}, + {"lib_ox_push_cmd",Plib_ox_push_cmd,1}, + {"lib_ox_execute_string",Plib_ox_execute_string,1}, +#endif {0,0,0}, }; +extern int little_endian; + +int lib_ox_initialized; + +#if !defined(VISUAL) +void Plib_ox_push_cmo(arg,rp) +NODE arg; +Q *rp; +{ + void *cmo; + + if ( !lib_ox_initialized ) asir_ox_io_init(little_endian); + risa_to_cmo(ARG0(arg),&cmo); + asir_ox_push_cmo(cmo); + *rp = ONE; +} + +void Plib_ox_pop_cmo(rp) +Obj *rp; +{ + void *buf; + int ret,len; + + if ( !lib_ox_initialized ) asir_ox_io_init(little_endian); + len = asir_ox_peek_cmo_size(); + buf = (void *)MALLOC_ATOMIC(len); + ret = asir_ox_pop_cmo(buf,len); + if ( ret < 0 ) + error("lib_ox_pop_cmo : buffer too small (cannot happen!)"); + cmo_to_risa(buf,rp); +} + +void Plib_ox_push_cmd(arg,rp) +NODE arg; +Q *rp; +{ + if ( !lib_ox_initialized ) asir_ox_io_init(little_endian); + asir_ox_push_cmd((unsigned int)QTOS((Q)ARG0(arg))); + *rp = ONE; +} + +void Plib_ox_execute_string(arg,rp) +NODE arg; +Q *rp; +{ + if ( !lib_ox_initialized ) asir_ox_io_init(little_endian); + asir_ox_execute_string(BDY((STRING)ARG0(arg))); + *rp = ONE; +} +#endif + void Pgetenv(arg,rp) NODE arg; STRING *rp; @@ -74,7 +134,7 @@ pointer *rp; asir_terminate(2); else { closecurrentinput(); - if ( !asir_infile->fp ) + if ( !asir_infile->fp && strcmp(asir_infile->name,"string") ) asir_terminate(2); } *rp = 0; @@ -189,7 +249,9 @@ Q *rp; code = QTOS((Q)ARG0(arg)); reason = BDY((STRING)ARG1(arg)); action = BDY((STRING)ARG2(arg)); +#if defined(VISUAL) set_error(code,reason,action); +#endif error(""); *rp = 0; } @@ -277,7 +339,7 @@ Q *rp; STOQ(ret,*rp); } -#if INET && !defined(VISUAL) +#if INET && !defined(VISUAL) && DO_PLOT void Pxpause(rp) Q *rp; {