| version 1.7, 2001/04/15 07:55:07 |
version 1.9, 2001/09/01 01:37:49 |
|
|
| /*$OpenXM: OpenXM/src/kan96xx/plugin/cmo.c,v 1.6 2000/02/02 03:30:48 takayama Exp $*/ |
/*$OpenXM: OpenXM/src/kan96xx/plugin/cmo.c,v 1.8 2001/05/04 01:06:29 takayama Exp $*/ |
| #include <stdio.h> |
#include <stdio.h> |
| #include <string.h> |
#include <string.h> |
| /* #include <netinet/in.h> */ |
/* #include <netinet/in.h> */ |
|
|
| #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 671 void cmoObjectToCmo00(struct object ob) |
|
| Line 671 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 700 void cmoObjectToCmo00(struct object ob) |
|
| Line 700 void cmoObjectToCmo00(struct object 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 (getoa(vlist,i).tag == Sdollar) { |
if (getoa(vlist,i).tag == Sdollar) { |
| if (CmoClientMode) { |
if (CmoClientMode) { |
| putoa(vlist0,i, |
putoa(vlist0,i, |
| KpoIndeterminate(getoa(vlist,i))); |
KpoIndeterminate(getoa(vlist,i))); |
| }else{ |
}else{ |
| putoa(vlist0,i, |
putoa(vlist0,i, |
| KpoIndeterminate(cmoTranslateVariable_outGoing(getoa(vlist,i)))); |
KpoIndeterminate(cmoTranslateVariable_outGoing(getoa(vlist,i)))); |
| } |
} |
| }else{ |
}else{ |
| putoa(vlist0,i,getoa(vlist,i)); |
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 861 struct object cmoCmoToObject00(struct cmoBuffer *cb) |
|
| Line 861 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 883 struct object cmoCmoToObject00(struct cmoBuffer *cb) |
|
| Line 883 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 963 struct object cmoCmoToObject00(struct cmoBuffer *cb) |
|
| Line 963 struct object cmoCmoToObject00(struct cmoBuffer *cb) |
|
| ob1 = KopIndeterminate(ob1); |
ob1 = KopIndeterminate(ob1); |
| }else if (ectag(ob1) == CLASSNAME_tree) { |
}else if (ectag(ob1) == CLASSNAME_tree) { |
| /* do nothing. */ |
/* do nothing. */ |
| } |
} |
| putoa(vlist,i,ob1); |
putoa(vlist,i,ob1); |
| } |
} |
| /* vlist is a list of variables by strings. */ |
/* vlist is a list of variables by strings. */ |
| Line 1011 struct object cmoCmoToObject00(struct cmoBuffer *cb) |
|
| Line 1011 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 1091 struct object cmoListToPoly(struct object ob) { |
|
| Line 1091 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 1113 struct object cmoListToPoly2(struct object ob) |
|
| Line 1113 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 1154 POLY cmoListToPOLY(struct object ob) |
|
| Line 1154 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 1173 POLY cmoListToPOLY(struct object ob) |
|
| Line 1173 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 1370 struct object KSmathCap(void) |
|
| Line 1370 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 1432 void *KSmathCapByStruct(void) |
|
| Line 1432 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 1478 errorCmo(char *s) { |
|
| Line 1478 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 1513 static char *translateReservedName(char *s) { |
|
| Line 1513 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 1541 struct object cmoTranslateVariable_inComming(struct ob |
|
| Line 1541 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'; |