[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.13 and 1.18

version 1.13, 2005/06/16 05:07:24 version 1.18, 2020/10/06 11:33:47
Line 1 
Line 1 
 /*$OpenXM: OpenXM/src/kan96xx/plugin/cmo.c,v 1.12 2004/08/28 12:50:06 takayama Exp $*/  /*$OpenXM: OpenXM/src/kan96xx/plugin/cmo.c,v 1.17 2020/10/04 06:10:36 noro Exp $*/
 #include <stdio.h>  #include <stdio.h>
 #include <string.h>  #include <string.h>
 /* #include <netinet/in.h> */  /* #include <netinet/in.h> */
 #include <stdlib.h>  #include <stdlib.h>
   #include <arpa/inet.h>
 #include "datatype.h"  #include "datatype.h"
 #include "stackm.h"  #include "stackm.h"
 #include "extern.h"  #include "extern.h"
Line 18 
Line 19 
 #include "cmotag.htmp"   /* static char *cmotagToName(int tag) is defined  #include "cmotag.htmp"   /* static char *cmotagToName(int tag) is defined
                             here. */                              here. */
   
   void warningCmo(char *s);
   void errorCmo(char *s);
   size_t cmoOutGMPCoeff(mpz_srcptr x); // defined in cmo-gmp.c
   size_t cmoGetGMPCoeff(MP_INT *x, struct cmoBuffer *cb);
   int cmoCheckMathCap(struct object ob, struct object *mathcapObjp); // in oxmisc2.h
   
   
 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
Line 156  struct cmoBuffer *cmoOutputToBuf(cmoAction a,void *dat
Line 164  struct cmoBuffer *cmoOutputToBuf(cmoAction a,void *dat
   }    }
 }  }
   
 dumpCmoBuf(struct cmoBuffer *cb)  int dumpCmoBuf(struct cmoBuffer *cb)
 {  {
   int i,size, tag;    int i,size, tag;
   char *s;    char *s;
   if (cb->isStream) {    if (cb->isStream) {
     printf("cmoBuffer is directed to a stream.\n");      printf("cmoBuffer is directed to a stream.\n");
     return;      return 0;
   }    }
   size = cb->pos;    size = cb->pos;
   s = (char *)(cb->buf);    s = (char *)(cb->buf);
   tag = htonl(*((int *) s));    tag = htonl(*((int *) s));
   printf("CMO StandardEncoding: size = %d, size/sizeof(int) = %d, tag=%s \n",size,size/sizeof(int),cmotagToName(tag));    printf("CMO StandardEncoding: size = %d, size/sizeof(int) = %d, tag=%s \n",size,size/((int)sizeof(int)),cmotagToName(tag));
   for (i=0; i<size; i++) {    for (i=0; i<size; i++) {
     if (i % 20 == 0) putchar('\n');      if (i % 20 == 0) putchar('\n');
     printf("%3x",(int)(unsigned char)s[i]);      printf("%3x",(int)(unsigned char)s[i]);
   }    }
   putchar('\n');    putchar('\n');
     return 0;
 }  }
   
 /* This obsolete function is used to write data  /* This obsolete function is used to write data
    in cmoBuffer (cmo object in kan)     in cmoBuffer (cmo object in kan)
    to a stream */     to a stream */
 cmoToStream(struct object cmoObj,struct object of)  int cmoToStream(struct object cmoObj,struct object of)
 {  {
   int i,size;    int i,size;
   struct cmoBuffer *cb;    struct cmoBuffer *cb;
Line 244  struct object streamToCmo(struct object of)
Line 253  struct object streamToCmo(struct object of)
 }  }
   
   
 cmoOutCmoNull() {  void cmoOutCmoNull() {
   cmoint tmp[1];    cmoint tmp[1];
   tmp[0] = htonl((cmoint) CMO_NULL);    tmp[0] = htonl((cmoint) CMO_NULL);
   cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));    cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));
Line 254  cmoOutCmoNull() {
Line 263  cmoOutCmoNull() {
   
   
 /* unsigned short int must be 32 bits */  /* unsigned short int must be 32 bits */
 cmoOutInt32(int k)  void cmoOutInt32(int k)
 {  {
   cmoint tmp[2];    cmoint tmp[2];
   tmp[0] = htonl((cmoint) CMO_INT32);    tmp[0] = htonl((cmoint) CMO_INT32);
Line 262  cmoOutInt32(int k)
Line 271  cmoOutInt32(int k)
   cmoOutputToBuf(CMOPUT,tmp,2*sizeof(cmoint));    cmoOutputToBuf(CMOPUT,tmp,2*sizeof(cmoint));
 }  }
   
 cmoOutString(char *d,int size) {  int cmoOutString(char *d,int size) {
   cmoint tmp[2];    cmoint tmp[2];
   tmp[0] = htonl((cmoint) CMO_STRING);    tmp[0] = htonl((cmoint) CMO_STRING);
   tmp[1] = htonl((cmoint ) size);    tmp[1] = htonl((cmoint ) size);
   cmoOutputToBuf(CMOPUT,tmp,2*sizeof(cmoint));    cmoOutputToBuf(CMOPUT,tmp,2*sizeof(cmoint));
   cmoOutputToBuf(CMOPUT,d,size);    cmoOutputToBuf(CMOPUT,d,size);
     return 0;
 }  }
   
   
Line 361  int cmoOutPolynomial2(POLY f) 
Line 371  int cmoOutPolynomial2(POLY f) 
   return(0);    return(0);
 }  }
   
 int cmoOutRingDefinition(struct ring *rp,int option)  void cmoOutRingDefinition(struct ring *rp,int option)
 {  {
   cmoint tmp[3];    cmoint tmp[3];
   /* minimal information */    /* minimal information */
Line 387  int cmoOutRingDefinition(struct ring *rp,int option)
Line 397  int cmoOutRingDefinition(struct ring *rp,int option)
   
 }  }
   
 int cmoOutRingDefinition2(struct ring *rp,int option)  void cmoOutRingDefinition2(struct ring *rp,int option)
 {  {
   cmoint tmp[3];    cmoint tmp[3];
   /* minimal information */    /* minimal information */
Line 1233  struct object cmoObjectFromStream(struct object obStre
Line 1243  struct object cmoObjectFromStream(struct object obStre
 {  {
   struct cmoBuffer cb;    struct cmoBuffer cb;
   struct object rob = OINIT;    struct object rob = OINIT;
   extern DebugCMO;    extern int DebugCMO;
   if (obStream.tag != Sfile) {    if (obStream.tag != Sfile) {
     errorCmo("cmoObjectFromStream: Argument must be of type file.");      errorCmo("cmoObjectFromStream: Argument must be of type file.");
   }    }
Line 1462  void *KSmathCapByStruct(void) 
Line 1472  void *KSmathCapByStruct(void) 
   mathcap->sm[10] = SM_dupErrors;    mathcap->sm[10] = SM_dupErrors;
   mathcap->sm[11] = SM_pushCMOtag;    mathcap->sm[11] = SM_pushCMOtag;
   mathcap->sm[12] = SM_executeFunctionWithOptionalArgument;    mathcap->sm[12] = SM_executeFunctionWithOptionalArgument;
   mathcap->smSize = 13;    mathcap->sm[13] = SM_nop;
     mathcap->smSize = 14;
   
   return((void *)mathcap);    return((void *)mathcap);
 }  }
Line 1474  int cmoOutRawInt(int k)
Line 1485  int cmoOutRawInt(int k)
   cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));    cmoOutputToBuf(CMOPUT,tmp,sizeof(cmoint));
 }  }
   
 warningCmo(char *s) {  void warningCmo(char *s) {
   fprintf(stderr,"Warning: plugin/cmo.c : %s\n",s);    fprintf(stderr,"Warning: plugin/cmo.c : %s\n",s);
 }  }
   
 errorCmo(char *s) {  void errorCmo(char *s) {
   fprintf(stderr,"plugin/cmo.c : %s\n",s);    fprintf(stderr,"plugin/cmo.c : %s\n",s);
   errorKan1("%s\n","cmo fatal error. ox servers need SM_control_reset_connection.");    errorKan1("%s\n","cmo fatal error. ox servers need SM_control_reset_connection.");
   /* ErrorPacket is automatically push on the ErrorStack.    /* ErrorPacket is automatically push on the ErrorStack.

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.18

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