[BACK]Return to oxserver00.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kxx

Diff for /OpenXM/src/kxx/oxserver00.c between version 1.10 and 1.11

version 1.10, 2003/08/22 16:08:23 version 1.11, 2003/11/18 11:08:27
Line 1 
Line 1 
 /* $OpenXM: OpenXM/src/kxx/oxserver00.c,v 1.9 2002/11/04 11:09:00 takayama Exp $ */  /* $OpenXM: OpenXM/src/kxx/oxserver00.c,v 1.10 2003/08/22 16:08:23 ohara Exp $ */
 /* nullserver01 */  /* nullserver01 */
 #include <stdio.h>  #include <stdio.h>
 #include <sys/types.h>  #include <sys/types.h>
Line 63  main(int argc, char *argv[]) {
Line 63  main(int argc, char *argv[]) {
     Sm1_start(0, NULL, "ox_sm1");      Sm1_start(0, NULL, "ox_sm1");
   }    }
   
   nullserver(3);    nullserver(3,4);
 }  }
   
 static char *getSuffix(char *s) {  static char *getSuffix(char *s) {
Line 82  static char *getSuffix(char *s) {
Line 82  static char *getSuffix(char *s) {
   }    }
   return(s);    return(s);
 }  }
 nullserver(int fdStream) {  nullserver(int fdStreamIn,int fdStreamOut) {
   int mtag;    int mtag;
   int message = 1;    int message = 1;
   ox_stream ostream;    ox_stream ostreamIn;
     ox_stream ostreamOut;
   char sreason[1024];    char sreason[1024];
   extern void controlResetHandler();    extern void controlResetHandler();
 #if defined(__CYGWIN__)  #if defined(__CYGWIN__)
Line 95  nullserver(int fdStream) {
Line 96  nullserver(int fdStream) {
 #endif  #endif
   int engineByteOrder;    int engineByteOrder;
   
     /* for debug */
     PacketMonitor = 1;
   
   fflush(NULL);    fflush(NULL);
   engineByteOrder = oxTellMyByteOrder(fdStream);    engineByteOrder = oxTellMyByteOrder(fdStreamOut,fdStreamIn);
   /* Set the network byte order. */    /* Set the network byte order. */
   fprintf(stderr,"engineByteOrder=%x\n",engineByteOrder);    fprintf(stderr,"engineByteOrder=%x\n",engineByteOrder);
   
   if (fdStream != -1) {    if (fdStreamIn != -1) {
     ostream = fp2open(fdStream);      ostreamIn = fp2open(fdStreamIn);
     if (ostream == NULL) {      if (ostreamIn == NULL) {
       fprintf(stderr,"fp2open(fdStream) failed.\n");        fprintf(stderr,"fp2open(fdStreamIn) failed.\n");
       fdStream = -1;        fdStreamIn = -1;
     }      }
     if (PacketMonitor) fp2watch(ostream,stdout);      if (PacketMonitor) fp2watch(ostreamIn,stdout);
   }    }
     if (fdStreamOut != -1) {
       ostreamOut = fp2open(fdStreamOut);
       if (ostreamOut == NULL) {
         fprintf(stderr,"fp2open(fdStreamOut) failed.\n");
         fdStreamOut = -1;
       }
       if (PacketMonitor) fp2watch(ostreamOut,stdout);
     }
   
   aaa : ;    aaa : ;
 #if defined(__CYGWIN__)  #if defined(__CYGWIN__)
   if (sigsetjmp(EnvOfChildServer,1)) {    if (sigsetjmp(EnvOfChildServer,1)) {
Line 154  nullserver(int fdStream) {
Line 167  nullserver(int fdStream) {
   }    }
   
   while (1) {    while (1) {
     message = OXprintMessage;      message = OXprintMessage;
     if (OxInterruptFlag) {      if (OxInterruptFlag) {
       OxCritical = 1;        OxCritical = 1;
       if (message) {fprintf(stderr,"Clearing the read buffer.\n");fflush(NULL); }        if (message) {fprintf(stderr,"Clearing the read buffer.\n");fflush(NULL); }
       fp2clearReadBuf(ostream); /* clear the read buffer */        fp2clearReadBuf(ostreamIn); /* clear the read buffer */
       if (message) {fprintf(stderr,"Throwing OX_SYNC_BALL\n"); fflush(NULL);}        if (message) {fprintf(stderr,"Throwing OX_SYNC_BALL\n"); fflush(NULL);}
       oxSendSyncBall(ostream);        oxSendSyncBall(ostreamOut);
       if (message) {fprintf(stderr,"Waiting for OX_SYNC_BALL\n");fflush(NULL);}        if (message) {fprintf(stderr,"Waiting for OX_SYNC_BALL\n");fflush(NULL);}
       oxWaitSyncBall(ostream);        oxWaitSyncBall(ostreamIn);
       if (message) {fprintf(stderr,"Done changing OX_SYNC_BALL\n"); fflush(NULL);}        if (message) {fprintf(stderr,"Done changing OX_SYNC_BALL\n"); fflush(NULL);}
       OxInterruptFlag = 0;        OxInterruptFlag = 0;
       OxCritical = 0;        OxCritical = 0;
       goto aaa ;        goto aaa ;
     }      }
     OxCritical = 0;      OxCritical = 0;
     if (fp2select(ostream,-1)) {      if (fp2select(ostreamIn,-1)) {
       /* If there is an data in the ostream, then read data in the buffer and        /* If there is an data in the ostream, then read data in the buffer and
          read data in the communication stream. */           read data in the communication stream. */
       OxCritical = 1;        OxCritical = 1;
Line 178  nullserver(int fdStream) {
Line 191  nullserver(int fdStream) {
       /* This part is never reached. */        /* This part is never reached. */
     }      }
     OxCritical = 1;      OxCritical = 1;
     mtag = oxGetOXheader(ostream,&SerialCurrent); /* get the message_tag */      mtag = oxGetOXheader(ostreamIn,&SerialCurrent); /* get the message_tag */
     if (message) {      if (message) {
       fprintf(stderr,"\nmtag is %d (serial=%d) : ",mtag,SerialCurrent);        fprintf(stderr,"\nmtag is %d (serial=%d) : ",mtag,SerialCurrent);
       switch(mtag) {        switch(mtag) {
Line 193  nullserver(int fdStream) {
Line 206  nullserver(int fdStream) {
     /*sleep(2);  /* for dubug OX_SYNC_BALL */      /*sleep(2);  /* for dubug OX_SYNC_BALL */
     switch(mtag) {      switch(mtag) {
     case OX_COMMAND:      case OX_COMMAND:
       nullserverCommand(ostream);        nullserverCommand(ostreamIn,ostreamOut);
       goto aaa ;  /* We always reset the jump vector. cf. memo1.txt 1998 2/13*/        goto aaa ;  /* We always reset the jump vector. cf. memo1.txt 1998 2/13*/
       break;        break;
     case OX_DATA:      case OX_DATA:
       Sm1_pushCMO(ostream);        Sm1_pushCMO(ostreamIn);
       break;        break;
     case OX_SYNC_BALL:      case OX_SYNC_BALL:
       /* if (OxInterruptFlag)  think about it later. */        /* if (OxInterruptFlag)  think about it later. */
Line 209  nullserver(int fdStream) {
Line 222  nullserver(int fdStream) {
   }    }
 }  }
   
 nullserverCommand(ox_stream ostream) {  nullserverCommand(ox_stream ostreamIn,ox_stream ostreamOut) {
   int id;    int id;
   int mtag;    int mtag;
   int n;    int n;
Line 221  nullserverCommand(ox_stream ostream) {
Line 234  nullserverCommand(ox_stream ostream) {
   char *emsg;    char *emsg;
   extern void controlResetHandler();    extern void controlResetHandler();
   
   message = OXprintMessage;    message = OXprintMessage;
   /* message_body */    /* message_body */
   id = oxGetInt32(ostream);   /* get the function_id */    id = oxGetInt32(ostreamIn);   /* get the function_id */
   if (message) {fprintf(stderr,"\nfunction_id is %d\n",id);}    if (message) {fprintf(stderr,"\nfunction_id is %d\n",id);}
   switch( id ) {    switch( id ) {
   case SM_mathcap:    case SM_mathcap:
Line 233  nullserverCommand(ox_stream ostream) {
Line 246  nullserverCommand(ox_stream ostream) {
     break;      break;
   case SM_setMathCap:    case SM_setMathCap:
     if (message) fprintf(stderr," setMathCap\n");      if (message) fprintf(stderr," setMathCap\n");
     Sm1_setMathCap(ostream);      Sm1_setMathCap(ostreamOut);
     break;      break;
   case SM_pops:    case SM_pops:
     if (message) fprintf(stderr," pops \n");      if (message) fprintf(stderr," pops \n");
Line 289  nullserverCommand(ox_stream ostream) {
Line 302  nullserverCommand(ox_stream ostream) {
     break;      break;
   case SM_popCMO:    case SM_popCMO:
     if (message) fprintf(stderr,"popCMO.  Start to sending data.\n",n);      if (message) fprintf(stderr,"popCMO.  Start to sending data.\n",n);
     oxSendOXheader(ostream,OX_DATA,SerialOX++);      oxSendOXheader(ostreamOut,OX_DATA,SerialOX++);
     n=Sm1_popCMO(ostream,SerialCurrent);      n=Sm1_popCMO(ostreamOut,SerialCurrent);
     if (message) fprintf(stderr,"Done.\n");      if (message) fprintf(stderr,"Done.\n");
     break;      break;
   case SM_popString:    case SM_popString:
     if (message) fprintf(stderr,"popString. send data from the stack.\n",n);      if (message) fprintf(stderr,"popString. send data from the stack.\n",n);
     oxSendOXheader(ostream,OX_DATA,SerialOX++);      oxSendOXheader(ostreamOut,OX_DATA,SerialOX++);
     oxSendCmoString(ostream,Sm1_popString());      oxSendCmoString(ostreamOut,Sm1_popString());
     if (message) fprintf(stderr,"Done.\n");      if (message) fprintf(stderr,"Done.\n");
     break;      break;
   case SM_shutdown:    case SM_shutdown:

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

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