[BACK]Return to cmo.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / plugin

Diff for /OpenXM/src/kan96xx/plugin/cmo.c between version 1.5 and 1.11

version 1.5, 2000/01/25 05:07:11 version 1.11, 2004/03/08 08:24:42
Line 1 
Line 1 
 /*$OpenXM: OpenXM/src/kan96xx/plugin/cmo.c,v 1.4 1999/11/27 01:41:11 takayama Exp $*/  /*$OpenXM: OpenXM/src/kan96xx/plugin/cmo.c,v 1.10 2003/12/06 02:35:54 takayama Exp $*/
 #include <stdio.h>  #include <stdio.h>
 #include <string.h>  #include <string.h>
 /* #include <netinet/in.h> */  /* #include <netinet/in.h> */
Line 16 
Line 16 
 #include "cmo.h"  #include "cmo.h"
   
 #include "cmotag.htmp"   /* static char *cmotagToName(int tag) is defined  #include "cmotag.htmp"   /* static char *cmotagToName(int tag) is defined
                             here. */                              here. */
   
 extern int OxVersion;  extern int OxVersion;
   
 int CmoClientMode = 1;  /* This flag is used to translate names for  int CmoClientMode = 1;  /* This flag is used to translate names for
                            indeterminates.                 indeterminates.
                            It does not work well if ox_sm1 have a server, i.e.,                 It does not work well if ox_sm1 have a server, i.e.,
                            sm1 --> ox_sm1 --> ox_sm1                 sm1 --> ox_sm1 --> ox_sm1
                            */                 */
   
 /* void *malloc(int s);  /* void *malloc(int s);
   #define GC_malloc(x) malloc(x) */    #define GC_malloc(x) malloc(x) */
Line 38  int CmoClientMode = 1;  /* This flag is used to transl
Line 38  int CmoClientMode = 1;  /* This flag is used to transl
 /*  If you change the format of mathcap, do the follows.  /*  If you change the format of mathcap, do the follows.
     Mofify  cmoCheckMathCap in oxmisc2.c,      Mofify  cmoCheckMathCap in oxmisc2.c,
             oxSendMathCap  in oxmisc.c,              oxSendMathCap  in oxmisc.c,
             newMathCap in cmo.c,          newMathCap in cmo.c,
     oxReq, SM_setMathCap: in oxmisc2.c, and      oxReq, SM_setMathCap: in oxmisc2.c, and
     grep mathCap and make all modifications.      grep mathCap and make all modifications.
 */  */
Line 89  struct cmoBuffer *cmoOutputToBuf(cmoAction a,void *dat
Line 89  struct cmoBuffer *cmoOutputToBuf(cmoAction a,void *dat
       break;        break;
     case CMOPUT:      case CMOPUT:
       for (i=0; i<size; i++) {        for (i=0; i<size; i++) {
         fp2fputc((int) ((char *)data)[i], b.fp);          fp2fputc((int) ((char *)data)[i], b.fp);
       }        }
       break;        break;
     case CMOFLUSH:      case CMOFLUSH:
       if (fp2fflush(b.fp)<0) {        if (fp2fflush(b.fp)<0) {
         errorCmo("cmoOutputToBuf: CMOFLUSH failed in stream mode.");          errorCmo("cmoOutputToBuf: CMOFLUSH failed in stream mode.");
       }        }
       cb = (struct cmoBuffer *)sGC_malloc(sizeof(struct cmoBuffer));        cb = (struct cmoBuffer *)sGC_malloc(sizeof(struct cmoBuffer));
       cb->isStream = b.isStream;        cb->isStream = b.isStream;
Line 128  struct cmoBuffer *cmoOutputToBuf(cmoAction a,void *dat
Line 128  struct cmoBuffer *cmoOutputToBuf(cmoAction a,void *dat
       break;        break;
     case CMOPUT:      case CMOPUT:
       if (b.pos + size >= b.size) {        if (b.pos + size >= b.size) {
         tmp = sGC_malloc((b.size)*2+size);          tmp = sGC_malloc((b.size)*2+size);
         memcpy(tmp,b.buf,b.pos);          memcpy(tmp,b.buf,b.pos);
         b.buf = tmp;          b.buf = tmp;
         b.size = (b.size)*2+size;          b.size = (b.size)*2+size;
       }        }
       memcpy((void *) &(((char *)(b.buf))[b.pos]),data,size);        memcpy((void *) &(((char *)(b.buf))[b.pos]),data,size);
       b.pos += size;        b.pos += size;
Line 377  int cmoOutRingDefinition(struct ring *rp,int option)
Line 377  int cmoOutRingDefinition(struct ring *rp,int option)
     cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint)*3);      cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint)*3);
     cmoOutInt32((rp->n)*2); /* number of variables */      cmoOutInt32((rp->n)*2); /* number of variables */
     cmoOutInt32(rp->p);     /* coefficient field.      cmoOutInt32(rp->p);     /* coefficient field.
                                CMO_INT32 or CMO_DMS_OF_N_VARIABLES */                                 CMO_INT32 or CMO_DMS_OF_N_VARIABLES */
     /* Optional arguments are  name of variables, weight_vector, output_order */      /* Optional arguments are  name of variables, weight_vector, output_order */
     break;      break;
   default:   /* including 0. */    default:   /* including 0. */
Line 403  int cmoOutRingDefinition2(struct ring *rp,int option)
Line 403  int cmoOutRingDefinition2(struct ring *rp,int option)
     cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint)*3);      cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint)*3);
     cmoOutInt32((rp->n)*2); /* number of variables */      cmoOutInt32((rp->n)*2); /* number of variables */
     cmoOutInt32(rp->p);     /* coefficient field.      cmoOutInt32(rp->p);     /* coefficient field.
                                CMO_INT32 or CMO_DMS_OF_N_VARIABLES */                                 CMO_INT32 or CMO_DMS_OF_N_VARIABLES */
     /* Optional arguments are  list of indeterminates (name of variables),      /* Optional arguments are  list of indeterminates (name of variables),
        weight_vector by list , output_order by list. */         weight_vector by list , output_order by list. */
     break;      break;
Line 425  int cmoGetIntFromBuf(cmoAction a,struct cmoBuffer *cb)
Line 425  int cmoGetIntFromBuf(cmoAction a,struct cmoBuffer *cb)
     switch(a) {      switch(a) {
     case CMOGET:      case CMOGET:
       for (i=0; i<4; i++) {        for (i=0; i<4; i++) {
         cc = fp2fgetc(cb->fp);          cc = fp2fgetc(cb->fp);
         if (cc < 0) {          if (cc < 0) {
           return(-1);            return(-1);
           errorCmo("cmoGetIntFromBuf CMOGET: unexpected EOF.\n");            errorCmo("cmoGetIntFromBuf CMOGET: unexpected EOF.\n");
         }          }
         data[i] = cc;          data[i] = cc;
       }        }
       return( (int) ntohl( *((cmoint *) data) ));        return( (int) ntohl( *((cmoint *) data) ));
       break;        break;
     case CMOGETBYTE:      case CMOGETBYTE:
       cc = fp2fgetc(cb->fp);        cc = fp2fgetc(cb->fp);
       if (cc < 0) {        if (cc < 0) {
         return(-1);          return(-1);
         errorCmo("cmoGetIntFromBuf CMOGETBYTE: unexpected EOF.\n");          errorCmo("cmoGetIntFromBuf CMOGETBYTE: unexpected EOF.\n");
       }        }
       return(cc);        return(cc);
       break;        break;
Line 462  int cmoGetIntFromBuf(cmoAction a,struct cmoBuffer *cb)
Line 462  int cmoGetIntFromBuf(cmoAction a,struct cmoBuffer *cb)
     switch(a) {      switch(a) {
     case CMOGET:      case CMOGET:
       if (cb->rpos + sizeof(cmoint) > cb->pos) {        if (cb->rpos + sizeof(cmoint) > cb->pos) {
         fprintf(stderr,"No more data in the buffer. Returns -1.\n");          fprintf(stderr,"No more data in the buffer. Returns -1.\n");
         return(-1);          return(-1);
       }        }
       memcpy(tmp,(void *) &(((char *)(cb->buf))[cb->rpos]),        memcpy(tmp,(void *) &(((char *)(cb->buf))[cb->rpos]),
              sizeof(cmoint));               sizeof(cmoint));
       cb->rpos += sizeof(cmoint);        cb->rpos += sizeof(cmoint);
       return( (int) ntohl(tmp[0]));        return( (int) ntohl(tmp[0]));
       break;        break;
     case CMOGETBYTE:      case CMOGETBYTE:
       if (cb->rpos + 1 > cb->pos) {        if (cb->rpos + 1 > cb->pos) {
         fprintf(stderr,"No more data in the buffer. Returns -1.\n");          fprintf(stderr,"No more data in the buffer. Returns -1.\n");
         return(-1);          return(-1);
       }        }
       tmp[0] = ((unsigned char *)(cb->buf))[cb->rpos];        tmp[0] = ((unsigned char *)(cb->buf))[cb->rpos];
       cb->rpos += 1;        cb->rpos += 1;
Line 544  POLY cmoGetMonomial32(struct cmoBuffer *cb)
Line 544  POLY cmoGetMonomial32(struct cmoBuffer *cb)
     warningCmo("cmoGetMonomials32(): Changed the current ring, because your peer sent a DMS that does not fit to the current ring.");      warningCmo("cmoGetMonomials32(): Changed the current ring, because your peer sent a DMS that does not fit to the current ring.");
   
     /* original code.      /* original code.
     skip = nn - (CurrentRingp->n)*2;         skip = nn - (CurrentRingp->n)*2;
     nn1 = nn0 = CurrentRingp->n;         nn1 = nn0 = CurrentRingp->n;
     if (! (cb->errorno) ) {         if (! (cb->errorno) ) {
       warningCmo("cmoGetMonomial32(): serialized polynomial \\not\\in CurrentRing.");         warningCmo("cmoGetMonomial32(): serialized polynomial \\not\\in CurrentRing.");
     }         }
     cmoGetIntFromBuf(CMOERROR,cb);         cmoGetIntFromBuf(CMOERROR,cb);
     */      */
   }    }
   if (nn == (CurrentRingp->n)*2 ) {    if (nn == (CurrentRingp->n)*2 ) {
Line 660  void cmoObjectToCmo00(struct object ob)
Line 660  void cmoObjectToCmo00(struct object ob)
   case SuniversalNumber:    case SuniversalNumber:
     cmoOutGMPCoeff(ob.lc.universalNumber->val.bigp);      cmoOutGMPCoeff(ob.lc.universalNumber->val.bigp);
     break;      break;
     case SrationalFunction:
       tmp[0] = htonl(CMO_RATIONAL);
       cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));
           cmoObjectToCmo00(*(Knumerator(ob)));
           cmoObjectToCmo00(*(Kdenominator(ob)));
       break;
   case Sdouble:    case Sdouble:
     if (sizeof(double) != 8) errorCmo("double is assumed to be 8 bytes.");      if (sizeof(double) != 8) errorCmo("double is assumed to be 8 bytes.");
     cmoOutRawInt(CMO_64BIT_MACHINE_DOUBLE);      cmoOutRawInt(CMO_64BIT_MACHINE_DOUBLE);
Line 671  void cmoObjectToCmo00(struct object ob)
Line 677  void cmoObjectToCmo00(struct object ob)
     case CLASSNAME_ERROR_PACKET:      case CLASSNAME_ERROR_PACKET:
       /* fprintf(stderr,"ectag=%d\n",ectag(*KopErrorPacket(ob)));  **kxx:CMO_ERROR*/        /* fprintf(stderr,"ectag=%d\n",ectag(*KopErrorPacket(ob)));  **kxx:CMO_ERROR*/
       if (ectag(*KopErrorPacket(ob)) == CLASSNAME_ERROR_PACKET) {        if (ectag(*KopErrorPacket(ob)) == CLASSNAME_ERROR_PACKET) {
         tmp[0] = htonl(CMO_ERROR);          tmp[0] = htonl(CMO_ERROR);
         cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));          cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));
       }else{        }else{
         tmp[0] = htonl(CMO_ERROR2);          tmp[0] = htonl(CMO_ERROR2);
         cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));          cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));
         /* Send without OX_DATA header !! */          /* Send without OX_DATA header !! */
         cmoObjectToCmo00(*(KopErrorPacket(ob)));          cmoObjectToCmo00(*(KopErrorPacket(ob)));
       }        }
       break;        break;
     case CLASSNAME_mathcap:      case CLASSNAME_mathcap:
Line 692  void cmoObjectToCmo00(struct object ob)
Line 698  void cmoObjectToCmo00(struct object ob)
       /* cmoObjectToCmo00(KopIndeterminate(ob)); Old code. */        /* cmoObjectToCmo00(KopIndeterminate(ob)); Old code. */
       /* If you need to translate the name, do it here. */        /* If you need to translate the name, do it here. */
       if (CmoClientMode) {        if (CmoClientMode) {
         ob = KopIndeterminate(ob);          ob = KopIndeterminate(ob);
       }else{        }else{
         ob = cmoTranslateVariable_outGoing(KopIndeterminate(ob));          ob = cmoTranslateVariable_outGoing(KopIndeterminate(ob));
       }        }
       cmoObjectToCmo00(ob);        cmoObjectToCmo00(ob);
       break;        break;
     case CLASSNAME_recursivePolynomial:      case CLASSNAME_recursivePolynomial:
       /* We assume that the format of the recursive polynomial        /* We assume that the format of the recursive polynomial
          is OK. */           is OK. */
       tmp[0] = htonl(CMO_RECURSIVE_POLYNOMIAL);        tmp[0] = htonl(CMO_RECURSIVE_POLYNOMIAL);
       cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));        cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));
       ob = KopRecursivePolynomial(ob);        ob = KopRecursivePolynomial(ob);
       vlist = getoa(ob,0);        vlist = getoa(ob,0);
       vlist0 = newObjectArray(getoaSize(vlist));        vlist0 = newObjectArray(getoaSize(vlist));
       for (i=0; i<getoaSize(vlist); i++) {        for (i=0; i<getoaSize(vlist); i++) {
         if (CmoClientMode) {          if (getoa(vlist,i).tag == Sdollar) {
           putoa(vlist0,i,            if (CmoClientMode) {
                 KpoIndeterminate(getoa(vlist,i)));              putoa(vlist0,i,
         }else{                    KpoIndeterminate(getoa(vlist,i)));
           putoa(vlist0,i,            }else{
                 KpoIndeterminate(cmoTranslateVariable_outGoing(getoa(vlist,i))));              putoa(vlist0,i,
         }                    KpoIndeterminate(cmoTranslateVariable_outGoing(getoa(vlist,i))));
             }
           }else{
             putoa(vlist0,i,getoa(vlist,i));
           }
       }        }
       cmoObjectToCmo00(vlist0); /* output the list of variables. */        cmoObjectToCmo00(vlist0); /* output the list of variables. */
       cmoObjectToCmo00(getoa(ob,1)); /* output the body of the recursive poly        cmoObjectToCmo00(getoa(ob,1)); /* output the body of the recursive poly
                               polynomial in one variable or any object*/                                          polynomial in one variable or any object*/
       break;        break;
     case CLASSNAME_polynomialInOneVariable:      case CLASSNAME_polynomialInOneVariable:
       tmp[0] = htonl(CMO_POLYNOMIAL_IN_ONE_VARIABLE);        tmp[0] = htonl(CMO_POLYNOMIAL_IN_ONE_VARIABLE);
       cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));        cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));
       ob = KopPolynomialInOneVariable(ob);        ob = KopPolynomialInOneVariable(ob);
       if (ob.tag != Sarray) {        if (ob.tag != Sarray) {
         cmoObjectToCmo00(ob);          cmoObjectToCmo00(ob);
       }else{        }else{
         /* We do not check the format. */          /* We do not check the format. */
         m = (getoaSize(ob)-1)/2; /* the number of monomials */          m = (getoaSize(ob)-1)/2; /* the number of monomials */
         cmoOutRawInt(m);          cmoOutRawInt(m);
         ob2 = getoa(ob,0);       /* the variable name by integer. */          ob2 = getoa(ob,0);       /* the variable name by integer. */
         if (ob2.tag != Sinteger) {          if (ob2.tag != Sinteger) {
           warningCmo("cmoObjectToCmo00(): polynomial in one variable: this field should be integer. Output 0");            warningCmo("cmoObjectToCmo00(): polynomial in one variable: this field should be integer. Output 0");
           /* cmoOutInt32(0); */            /* cmoOutInt32(0); */
           cmoOutRawInt(0);            cmoOutRawInt(0);
         }else{          }else{
           /* cmoObjectToCmo00(ob2); */            /* cmoObjectToCmo00(ob2); */
           cmoOutRawInt(KopInteger(ob2));            cmoOutRawInt(KopInteger(ob2));
         }          }
         for (i=1; i<getoaSize(ob); i = i+2) {          for (i=1; i<getoaSize(ob); i = i+2) {
           cmoOutRawInt(KopInteger(getoa(ob,i)));  /* exponent */            cmoOutRawInt(KopInteger(getoa(ob,i)));  /* exponent */
           cmoObjectToCmo00(getoa(ob,i+1));          /* coefficient */            cmoObjectToCmo00(getoa(ob,i+1));          /* coefficient */
         }          }
       }        }
       break;        break;
     case CLASSNAME_tree:      case CLASSNAME_tree:
Line 857  struct object cmoCmoToObject00(struct cmoBuffer *cb)
Line 867  struct object cmoCmoToObject00(struct cmoBuffer *cb)
       putoa(rob,i,cmoCmoToObject00(cb));        putoa(rob,i,cmoCmoToObject00(cb));
       /* printObject(getoa(rob,i),0,stdout); */        /* printObject(getoa(rob,i),0,stdout); */
       if (i==0) {        if (i==0) {
         ob1 = getoa(rob,0);          ob1 = getoa(rob,0);
         if (ob1.tag == CMO+CMO_DMS) {          if (ob1.tag == CMO+CMO_DMS) {
           goto dmscase ;            goto dmscase ;
         }          }
       }        }
     }      }
     break;      break;
Line 879  struct object cmoCmoToObject00(struct cmoBuffer *cb)
Line 889  struct object cmoCmoToObject00(struct cmoBuffer *cb)
       /* Change the CurrentRingp by looking up the name. */        /* Change the CurrentRingp by looking up the name. */
       ob1 = KfindUserDictionary(KopString(ob1));        ob1 = KfindUserDictionary(KopString(ob1));
       if (ob1.tag != Sring) {        if (ob1.tag != Sring) {
         errorCmo("cmoCmoToObject00(): your ring is not defined in the name space.");          errorCmo("cmoCmoToObject00(): your ring is not defined in the name space.");
       }        }
       CurrentRingp = KopRingp(ob1);        CurrentRingp = KopRingp(ob1);
     }      }
Line 956  struct object cmoCmoToObject00(struct cmoBuffer *cb)
Line 966  struct object cmoCmoToObject00(struct cmoBuffer *cb)
     for (i=0; i<getoaSize(vlist0); i++) {      for (i=0; i<getoaSize(vlist0); i++) {
       ob1 = getoa(vlist0,i);        ob1 = getoa(vlist0,i);
       if (ectag(ob1) == CLASSNAME_indeterminate) {        if (ectag(ob1) == CLASSNAME_indeterminate) {
         ob1 = KopIndeterminate(ob1);          ob1 = KopIndeterminate(ob1);
         }else if (ectag(ob1) == CLASSNAME_tree) {
           /* do nothing. */
       }        }
       putoa(vlist,i,ob1);        putoa(vlist,i,ob1);
     }      }
Line 1005  struct object cmoCmoToObject00(struct cmoBuffer *cb)
Line 1017  struct object cmoCmoToObject00(struct cmoBuffer *cb)
     }else{      }else{
       ob1 = getoa(rob,0);        ob1 = getoa(rob,0);
       if (ob1.tag != Sdollar) warningCmo("CMO_TREE : the first arg must be the node name by a string.");        if (ob1.tag != Sdollar) warningCmo("CMO_TREE : the first arg must be the node name by a string.");
       ob2 = getoa(rob,1); /* content dictionary name. */        ob2 = getoa(rob,1); /* Attribute List */
       if (ob2.tag != Sdollar) warningCmo("CMO_TREE : the second arg must be the node name by a string.");        if (ob2.tag != Sarray) warningCmo("CMO_TREE : the second arg must be a list of attributes.");
       rob = KpoTree(rob);        rob = KpoTree(rob);
     }      }
     break;      break;
Line 1085  struct object cmoListToPoly(struct object ob) {
Line 1097  struct object cmoListToPoly(struct object ob) {
     if (n >= 1) {      if (n >= 1) {
       ob0 = getoa(ob,0);        ob0 = getoa(ob,0);
       if (ob0.tag == CMO+CMO_DMS) {        if (ob0.tag == CMO+CMO_DMS) {
         rob = KpoPOLY(cmoListToPOLY(ob)); /* not ToPoly, ToPOLY */          rob = KpoPOLY(cmoListToPOLY(ob)); /* not ToPoly, ToPOLY */
       }else{        }else{
         rob = newObjectArray(n);          rob = newObjectArray(n);
         for (i=0; i<n; i++) {          for (i=0; i<n; i++) {
           putoa(rob,i,cmoListToPoly(getoa(ob,i)));            putoa(rob,i,cmoListToPoly(getoa(ob,i)));
         }          }
       }        }
     }else{      }else{
       rob = ob;        rob = ob;
Line 1107  struct object cmoListToPoly2(struct object ob) 
Line 1119  struct object cmoListToPoly2(struct object ob) 
   struct object ob0,ob1;    struct object ob0,ob1;
   POLY f;    POLY f;
   /*    /*
      printf("<<");printObject(ob,0,stdout); printf(">>\n"); fflush(stdout);      printf("<<");printObject(ob,0,stdout); printf(">>\n"); fflush(stdout);
      */    */
   if (ob.tag != Sarray) {    if (ob.tag != Sarray) {
     errorCmo("cmoListToPoly2(): the argument must be array.");      errorCmo("cmoListToPoly2(): the argument must be array.");
   }    }
Line 1148  POLY cmoListToPOLY(struct object ob) 
Line 1160  POLY cmoListToPOLY(struct object ob) 
   struct object ob0,ob1;    struct object ob0,ob1;
   POLY f;    POLY f;
   /*    /*
      printf("<<");printObject(ob,0,stdout); printf(">>\n"); fflush(stdout);      printf("<<");printObject(ob,0,stdout); printf(">>\n"); fflush(stdout);
      */    */
   if (ob.tag != Sarray) {    if (ob.tag != Sarray) {
     errorCmo("cmoListToPOLY(): the argument must be array.");      errorCmo("cmoListToPOLY(): the argument must be array.");
   }    }
Line 1167  POLY cmoListToPOLY(struct object ob) 
Line 1179  POLY cmoListToPOLY(struct object ob) 
     for (i=size-1; i>=2; i--) {      for (i=size-1; i>=2; i--) {
       ob1 = getoa(ob,i);        ob1 = getoa(ob,i);
       if (ob1.tag == Spoly) {        if (ob1.tag == Spoly) {
         f = ppAdd(f,KopPOLY(ob1));          f = ppAdd(f,KopPOLY(ob1));
       }else{        }else{
         f = ppAdd(f,cmoListToPOLY(ob1));          f = ppAdd(f,cmoListToPOLY(ob1));
       }        }
     }      }
     return(f);      return(f);
Line 1364  struct object KSmathCap(void)
Line 1376  struct object KSmathCap(void)
 }  }
   
 void *KSmathCapByStruct(void)  void *KSmathCapByStruct(void)
 /* Return the math cap of kan/sm1 with cmo.c as a mathcap classObject*/       /* Return the math cap of kan/sm1 with cmo.c as a mathcap classObject*/
 {  {
   struct mathCap *mathcap;    struct mathCap *mathcap;
   struct object ob;    struct object ob;
Line 1426  void *KSmathCapByStruct(void) 
Line 1438  void *KSmathCapByStruct(void) 
   mathcap->cmo[21]= CMO_RATIONAL;    mathcap->cmo[21]= CMO_RATIONAL;
   
   mathcap->n = 22 ;   /* This is the number of cmo object. You can use    mathcap->n = 22 ;   /* This is the number of cmo object. You can use
                        cmo upto 1023. see mathcap.h */                           cmo upto 1023. see mathcap.h */
   
   mathcap->ox[0] = OX_DATA;    mathcap->ox[0] = OX_DATA;
   mathcap->oxSize = 1 ;   /* This is the number of OX object. You can use    mathcap->oxSize = 1 ;   /* This is the number of OX object. You can use
                              OX upto 1023. see mathcap.h */                               OX upto 1023. see mathcap.h */
   
   mathcap->sm[0] = SM_popCMO;    mathcap->sm[0] = SM_popCMO;
   mathcap->sm[1] = SM_popString;    mathcap->sm[1] = SM_popString;
Line 1443  void *KSmathCapByStruct(void) 
Line 1455  void *KSmathCapByStruct(void) 
   mathcap->sm[8] = SM_setMathCap;    mathcap->sm[8] = SM_setMathCap;
   mathcap->sm[9] = SM_getsp;    mathcap->sm[9] = SM_getsp;
   mathcap->sm[10] = SM_dupErrors;    mathcap->sm[10] = SM_dupErrors;
   mathcap->smSize = 11;    mathcap->sm[11] = SM_pushCMOtag;
     mathcap->sm[12] = SM_executeFunctionWithOptionalArgument;
     mathcap->smSize = 13;
   
   return((void *)mathcap);    return((void *)mathcap);
 }  }
Line 1471  errorCmo(char *s) {
Line 1485  errorCmo(char *s) {
 int outfp2(FILE2 *fp2) {  int outfp2(FILE2 *fp2) {
   int i;    int i;
   printf("---------  outfp2 ---------\n"); fflush(stdout);    printf("---------  outfp2 ---------\n"); fflush(stdout);
 /*  if (checkfp2(fp2," f2pdumpBuf ") == -1) {    /*  if (checkfp2(fp2," f2pdumpBuf ") == -1) {
     return(-1);        return(-1);
   }*/        }*/
   printf("fd=%d\n",fp2->fd);    printf("fd=%d\n",fp2->fd);
   printf("initialied=%d\n",fp2->initialized);    printf("initialied=%d\n",fp2->initialized);
   printf("readpos=%d\n",fp2->readpos);    printf("readpos=%d\n",fp2->readpos);
Line 1506  static char *translateReservedName(char *s) {
Line 1520  static char *translateReservedName(char *s) {
     return(NULL);      return(NULL);
   }    }
 }  }
   
 struct object cmoTranslateVariable_inComming(struct object ob) {  struct object cmoTranslateVariable_inComming(struct object ob) {
   /* ob must be Sdollar, return value must be Sdollar. */    /* ob must be Sdollar, return value must be Sdollar. */
   /* Read a variable name from an other system,    /* Read a variable name from an other system,
Line 1534  struct object cmoTranslateVariable_inComming(struct ob
Line 1548  struct object cmoTranslateVariable_inComming(struct ob
     if (t == NULL) errorCmo("No more memory.");      if (t == NULL) errorCmo("No more memory.");
     for (i=count=0; i<n; i++) {      for (i=count=0; i<n; i++) {
       if (s[i] <= ' ' || s[i] == '#') {        if (s[i] <= ' ' || s[i] == '#') {
         t[count++] = '#';          t[count++] = '#';
         t[count++] = (s[i]/16 < 10? s[i]/16+'0': (s[i]/16-10)+'A');          t[count++] = (s[i]/16 < 10? s[i]/16+'0': (s[i]/16-10)+'A');
         t[count++] = (s[i]%16 < 10? s[i]%16+'0': (s[i]%16-10)+'A');          t[count++] = (s[i]%16 < 10? s[i]%16+'0': (s[i]%16-10)+'A');
       }else{        }else{
         t[count++] = s[i];          t[count++] = s[i];
       }        }
     }      }
     t[count] = '\0';      t[count] = '\0';

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

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