[BACK]Return to ox.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / io

Diff for /OpenXM_contrib2/asir2000/io/ox.c between version 1.11 and 1.12

version 1.11, 2001/08/03 08:50:19 version 1.12, 2001/10/09 01:36:21
Line 44 
Line 44 
  * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY   * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
  * $OpenXM: OpenXM_contrib2/asir2000/io/ox.c,v 1.10 2000/11/08 08:02:51 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2000/io/ox.c,v 1.11 2001/08/03 08:50:19 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
Line 54 
Line 54 
   
 #define ISIZ sizeof(int)  #define ISIZ sizeof(int)
   
 void ox_flush_stream(),ox_write_int(),ox_write_cmo();  
 void ox_read_int(),ox_read_cmo();  
 void mclist_to_mc();  
 void ox_read_local();  
   
 extern Obj VOIDobj;  extern Obj VOIDobj;
   
 extern int ox_need_conv;  extern int ox_need_conv;
Line 94  static struct mathcap my_mc;
Line 89  static struct mathcap my_mc;
 static struct mathcap *remote_mc;  static struct mathcap *remote_mc;
 static int remote_mc_len;  static int remote_mc_len;
   
   void mclist_to_mc(LIST mclist,struct mathcap *mc);
   
 #if defined(VISUAL)  #if defined(VISUAL)
 /* XXX : mainly used in engine2000/io.c, but declared here */  /* XXX : mainly used in engine2000/io.c, but declared here */
 HANDLE hStreamNotify,hStreamNotify_Ack;  HANDLE hStreamNotify,hStreamNotify_Ack;
Line 107  void cleanup_events()
Line 104  void cleanup_events()
 }  }
 #endif  #endif
   
 void ox_resetenv(s)  void ox_resetenv(char *s)
 char *s;  
 {  {
 #if defined(VISUAL)  #if defined(VISUAL)
         cleanup_events();          cleanup_events();
Line 158  void create_my_mathcap(char *system)
Line 154  void create_my_mathcap(char *system)
         NODE n,n0;          NODE n,n0;
         int i,k;          int i,k;
         STRING str;          STRING str;
         LIST sname,smlist,oxlist,cmolist,asirlist,oxtag,oxasir,r;          LIST sname,smlist,oxlist,cmolist,asirlist,oxasir,r;
         USINT tag,t,t1;          USINT tag,t,t1;
   
         if ( my_mathcap )          if ( my_mathcap )
Line 251  void store_remote_mathcap(int s,MATHCAP mc)
Line 247  void store_remote_mathcap(int s,MATHCAP mc)
   
 void mclist_to_mc(LIST mclist,struct mathcap *mc)  void mclist_to_mc(LIST mclist,struct mathcap *mc)
 {  {
         int id,l,i,j;          int l,i,j;
         NODE n,t,oxcmo,ox,cap;          NODE n,t,oxcmo,cap;
         int *ptr;          int *ptr;
   
         /*          /*
Line 298  void mclist_to_mc(LIST mclist,struct mathcap *mc)
Line 294  void mclist_to_mc(LIST mclist,struct mathcap *mc)
         }          }
 }  }
   
 int check_sm_by_mc(s,smtag)  int check_sm_by_mc(int s,unsigned int smtag)
 int s;  
 unsigned int smtag;  
 {  {
         struct mathcap *rmc;          struct mathcap *rmc;
         int nsmcap,i;          int nsmcap,i;
Line 323  unsigned int smtag;
Line 317  unsigned int smtag;
                 return 1;                  return 1;
 }  }
   
 int check_by_mc(s,oxtag,cmotag)  int check_by_mc(int s,unsigned int oxtag,unsigned int cmotag)
 int s;  
 unsigned int oxtag,cmotag;  
 {  {
         struct mathcap *rmc;          struct mathcap *rmc;
         int noxcap,ncap,i,j;          int noxcap,ncap,i,j;
Line 363  void begin_critical() {
Line 355  void begin_critical() {
 void end_critical() {  void end_critical() {
         critical_when_signal = 0;          critical_when_signal = 0;
         if ( ox_usr1_sent ) {          if ( ox_usr1_sent ) {
                 ox_usr1_sent = 0; ox_usr1_handler();                  ox_usr1_sent = 0;
   #if !defined(VISUAL)
           ox_usr1_handler(SIGUSR1);
   #else
           ox_usr1_handler(0);
   #endif
         }          }
         if ( ox_int_received ) {          if ( ox_int_received ) {
                 ox_int_received = 0; int_handler(SIGINT);                  ox_int_received = 0; int_handler(SIGINT);
         }          }
 }  }
   
 void ox_usr1_handler(sig)  void ox_usr1_handler(int sig)
 int sig;  
 {  {
         extern jmp_buf env;          extern jmp_buf env;
         unsigned int cmd;  
   
 #if !defined(VISUAL)  #if !defined(VISUAL)
         signal(SIGUSR1,ox_usr1_handler);          signal(SIGUSR1,ox_usr1_handler);
Line 390  int sig;
Line 385  int sig;
   
 void clear_readbuffer()  void clear_readbuffer()
 {  {
         char c;  
         fd_set r,w,e;  
         struct timeval interval;  
         int n,sock;  
   
 #if defined(linux)  #if defined(linux)
         iofp[0].in->_IO_read_ptr = iofp[0].in->_IO_read_end;          iofp[0].in->_IO_read_ptr = iofp[0].in->_IO_read_end;
 #elif defined(__FreeBSD__)  #elif defined(__FreeBSD__)
Line 441  void wait_for_data(int s)
Line 431  void wait_for_data(int s)
 #if defined(VISUAL)  #if defined(VISUAL)
                 sock = iofp[s].in->fildes;                  sock = iofp[s].in->fildes;
                 FD_ZERO(&r);                  FD_ZERO(&r);
                 FD_SET(sock,&r);                  FD_SET((unsigned int)sock,&r);
                 select(0,&r,NULL,NULL,NULL);                  select(0,&r,NULL,NULL,NULL);
 #else  #else
                 sock = fileno(iofp[s].in);                  sock = fileno(iofp[s].in);
Line 496  void ox_send_local_data(int s,Obj p)
Line 486  void ox_send_local_data(int s,Obj p)
         ox_write_int(s,OX_LOCAL_OBJECT_ASIR);          ox_write_int(s,OX_LOCAL_OBJECT_ASIR);
         ox_write_int(s,ox_serial++);          ox_write_int(s,ox_serial++);
         ox_write_int(s,ASIR_OBJ);          ox_write_int(s,ASIR_OBJ);
         saveobj(iofp[s].out,p);          saveobj((FILE *)iofp[s].out,p);
         ox_flush_stream(s);          ox_flush_stream(s);
         end_critical();          end_critical();
 }  }
Line 507  void ox_send_local_ring(int s,VL vl)
Line 497  void ox_send_local_ring(int s,VL vl)
         ox_write_int(s,OX_LOCAL_OBJECT_ASIR);          ox_write_int(s,OX_LOCAL_OBJECT_ASIR);
         ox_write_int(s,ox_serial++);          ox_write_int(s,ox_serial++);
         ox_write_int(s,ASIR_VL);          ox_write_int(s,ASIR_VL);
         savevl(iofp[s].out,vl);          savevl((FILE *)iofp[s].out,vl);
         ox_flush_stream(s);          ox_flush_stream(s);
         end_critical();          end_critical();
 }  }
   
 unsigned int ox_recv(int s, int *id, pointer *p)  unsigned int ox_recv(int s, int *id, Obj *p)
 {  {
         unsigned int cmd,serial;          unsigned int cmd,serial;
         USINT ui;          USINT ui;
Line 525  unsigned int ox_recv(int s, int *id, pointer *p)
Line 515  unsigned int ox_recv(int s, int *id, pointer *p)
                 case OX_COMMAND:                  case OX_COMMAND:
                         ox_read_int(s,&cmd);                          ox_read_int(s,&cmd);
                         MKUSINT(ui,cmd);                          MKUSINT(ui,cmd);
                         *p = (pointer)ui;                          *p = (Obj)ui;
                         break;                          break;
                 case OX_DATA:                  case OX_DATA:
                         ox_read_cmo(s,p);                          ox_read_cmo(s,p);
Line 541  unsigned int ox_recv(int s, int *id, pointer *p)
Line 531  unsigned int ox_recv(int s, int *id, pointer *p)
         return serial;          return serial;
 }  }
   
 void ox_get_result(s,rp)  void ox_get_result(int s,Obj *rp)
 int s;  
 Obj *rp;  
 {  {
         int id;          int id;
         Obj obj,r;          Obj obj,r;
Line 552  Obj *rp;
Line 540  Obj *rp;
         level = 0;          level = 0;
         r = 0;          r = 0;
         do {          do {
                 ox_recv(s,&id,(pointer *)&obj);                  ox_recv(s,&id,&obj);
                 if ( id == OX_COMMAND ) {                  if ( id == OX_COMMAND ) {
                         switch ( ((USINT)obj)->body ) {                          switch ( ((USINT)obj)->body ) {
                                 case SM_beginBlock:                                  case SM_beginBlock:
Line 570  Obj *rp;
Line 558  Obj *rp;
 void ox_read_int(int s, int *n)  void ox_read_int(int s, int *n)
 {  {
         ox_need_conv = iofp[s].conv;          ox_need_conv = iofp[s].conv;
         read_int(iofp[s].in,n);          read_int((FILE *)iofp[s].in,n);
 }  }
   
 void ox_read_cmo(int s, Obj *rp)  void ox_read_cmo(int s, Obj *rp)
 {  {
         ox_need_conv = iofp[s].conv;          ox_need_conv = iofp[s].conv;
         read_cmo(iofp[s].in,rp);          read_cmo((FILE *)iofp[s].in,rp);
 }  }
   
 void ox_read_local(int s, Obj *rp)  void ox_read_local(int s, Obj *rp)
Line 584  void ox_read_local(int s, Obj *rp)
Line 572  void ox_read_local(int s, Obj *rp)
         int id;          int id;
   
         ox_need_conv = iofp[s].conv;          ox_need_conv = iofp[s].conv;
         read_int(iofp[s].in,&id);          read_int((FILE *)iofp[s].in,&id);
         switch ( id ) {          switch ( id ) {
                 case ASIR_VL:                  case ASIR_VL:
                         loadvl(iofp[s].in);                          loadvl((FILE *)iofp[s].in);
                         *rp = VOIDobj;                          *rp = VOIDobj;
                         break;                          break;
                 case ASIR_OBJ:                  case ASIR_OBJ:
                         loadobj(iofp[s].in,rp);                          loadobj((FILE *)iofp[s].in,rp);
                         break;                          break;
                 default:                  default:
                         error("ox_read_local : unsupported id");                          error("ox_read_local : unsupported id");
Line 602  void ox_read_local(int s, Obj *rp)
Line 590  void ox_read_local(int s, Obj *rp)
 void ox_write_int(int s, int n)  void ox_write_int(int s, int n)
 {  {
         ox_need_conv = iofp[s].conv;          ox_need_conv = iofp[s].conv;
         write_int(iofp[s].out,&n);          write_int((FILE *)iofp[s].out,&n);
 }  }
   
 void ox_write_cmo(int s, Obj obj)  void ox_write_cmo(int s, Obj obj)
 {  {
         ox_need_conv = iofp[s].conv;          ox_need_conv = iofp[s].conv;
         write_cmo(iofp[s].out,obj);          write_cmo((FILE *)iofp[s].out,obj);
 }  }
   
 int ox_check_cmo(int s, Obj obj)  int ox_check_cmo(int s, Obj obj)
Line 693  int ox_check_cmo_dp(int s, DP p)
Line 681  int ox_check_cmo_dp(int s, DP p)
         return 1;          return 1;
 }  }
   
 void ox_flush_stream(s)  void ox_flush_stream(int s)
 int s;  
 {  {
         if ( ox_batch )          if ( ox_batch )
                 return;                  return;
Line 707  int s;
Line 694  int s;
                 cflush(iofp[s].out);                  cflush(iofp[s].out);
         else          else
 #endif  #endif
         fflush(iofp[s].out);          fflush((FILE *)iofp[s].out);
 }  }
   
 void ox_flush_stream_force(s)  void ox_flush_stream_force(int s)
 int s;  
 {  {
 #if defined(VISUAL)  #if defined(VISUAL)
         if ( _fileno(&iofp[s].out->fp) < 0 )          if ( _fileno(&iofp[s].out->fp) < 0 )
Line 722  int s;
Line 708  int s;
                 cflush(iofp[s].out);                  cflush(iofp[s].out);
         else          else
 #endif  #endif
         fflush(iofp[s].out);          fflush((FILE *)iofp[s].out);
 }  }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>