version 1.1, 1999/10/08 02:12:05 |
version 1.7, 2001/04/15 07:55:07 |
|
|
|
/*$OpenXM: OpenXM/src/kan96xx/plugin/cmo.c,v 1.6 2000/02/02 03:30:48 takayama 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 "datatype.h" |
#include "datatype.h" |
#include "stackm.h" |
#include "stackm.h" |
Line 36 int CmoClientMode = 1; /* This flag is used to transl |
|
Line 37 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, |
oxReq, SM_setMathCap:, and |
oxSendMathCap in oxmisc.c, |
|
newMathCap in cmo.c, |
|
oxReq, SM_setMathCap: in oxmisc2.c, and |
grep mathCap and make all modifications. |
grep mathCap and make all modifications. |
*/ |
*/ |
|
|
Line 86 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(((char *)data)[i], b.fp); |
fp2fputc((int) ((char *)data)[i], b.fp); |
} |
} |
break; |
break; |
case CMOFLUSH: |
case CMOFLUSH: |
Line 195 cmoToStream(struct object cmoObj,struct object of) |
|
Line 198 cmoToStream(struct object cmoObj,struct object of) |
|
s = (char *)(cb->buf); |
s = (char *)(cb->buf); |
for (i=0; i<size; i++) { |
for (i=0; i<size; i++) { |
if (file2) { |
if (file2) { |
fp2fputc(s[i],(FILE2 *)(of.rc.voidp)); |
fp2fputc((int) s[i],(FILE2 *)(of.rc.voidp)); |
}else{ |
}else{ |
fputc(s[i],of.rc.file); |
fputc((int) s[i],of.rc.file); |
} |
} |
} |
} |
} |
} |
Line 689 void cmoObjectToCmo00(struct object ob) |
|
Line 692 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; |
Line 704 void cmoObjectToCmo00(struct object ob) |
|
Line 707 void cmoObjectToCmo00(struct object 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 |
Line 953 struct object cmoCmoToObject00(struct cmoBuffer *cb) |
|
Line 960 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); |
} |
} |
/* vlist is a list of variables by strings. */ |
/* vlist is a list of variables by strings. */ |
Line 1317 struct object newMathCap(struct mathCap *mathcap){ |
|
Line 1326 struct object newMathCap(struct mathCap *mathcap){ |
|
struct object ob3; |
struct object ob3; |
struct object obOx; |
struct object obOx; |
struct object obSm; |
struct object obSm; |
|
struct object ob3tmp; |
struct object *obp; |
struct object *obp; |
int i; |
int i,j; |
struct object mathinfo; |
struct object mathinfo; |
|
|
rob = newObjectArray(3); |
rob = newObjectArray(3); |
Line 1328 struct object newMathCap(struct mathCap *mathcap){ |
|
Line 1338 struct object newMathCap(struct mathCap *mathcap){ |
|
for (i=0; i<getoaSize(mathinfo); i++) { |
for (i=0; i<getoaSize(mathinfo); i++) { |
putoa(ob1,i,getoa(mathinfo,i)); |
putoa(ob1,i,getoa(mathinfo,i)); |
} |
} |
ob2 = newObjectArray(mathcap->n); |
ob3 = newObjectArray(mathcap->oxSize); |
for (i=0; i<mathcap->n; i++) { |
|
putoa(ob2,i,KpoInteger((mathcap->cmo)[i])); |
|
} |
|
obOx = newObjectArray(mathcap->oxSize); |
|
for (i=0; i<mathcap->oxSize; i++) { |
for (i=0; i<mathcap->oxSize; i++) { |
putoa(obOx,i,KpoInteger((mathcap->ox)[i])); |
ob3tmp = newObjectArray(2); |
|
putoa(ob3tmp,0,KpoInteger((mathcap->ox)[i])); |
|
ob2 = newObjectArray(mathcap->n); |
|
for (j=0; j<mathcap->n; j++) { |
|
putoa(ob2,j,KpoInteger((mathcap->cmo)[j])); |
|
} |
|
putoa(ob3tmp,1,ob2); |
|
putoa(ob3,i,ob3tmp); |
} |
} |
ob3 = newObjectArray(2); |
|
putoa(ob3,0,obOx); |
|
putoa(ob3,1,ob2); |
|
|
|
obSm = newObjectArray(mathcap->smSize); |
obSm = newObjectArray(mathcap->smSize); |
for (i=0; i<mathcap->smSize; i++) { |
for (i=0; i<mathcap->smSize; i++) { |
Line 1385 void *KSmathCapByStruct(void) |
|
Line 1395 void *KSmathCapByStruct(void) |
|
putoa(ob,1,KpoString(sys)); |
putoa(ob,1,KpoString(sys)); |
putoa(ob,2,KpoString(sysVersion)); |
putoa(ob,2,KpoString(sysVersion)); |
s1 = getenv("HOSTTYPE"); |
s1 = getenv("HOSTTYPE"); |
|
if (s1 == NULL) s1="unknown"; |
s2 = (char *)sGC_malloc(strlen(s1)+2+strlen("HOSTTYPE=")); |
s2 = (char *)sGC_malloc(strlen(s1)+2+strlen("HOSTTYPE=")); |
strcpy(s2,"HOSTTYPE="); |
strcpy(s2,"HOSTTYPE="); |
strcat(s2,s1); |
strcat(s2,s1); |
Line 1438 void *KSmathCapByStruct(void) |
|
Line 1449 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->smSize = 12; |
|
|
return((void *)mathcap); |
return((void *)mathcap); |
} |
} |