version 1.12, 2004/08/28 12:50:06 |
version 1.13, 2005/06/16 05:07:24 |
|
|
/*$OpenXM: OpenXM/src/kan96xx/plugin/cmo.c,v 1.11 2004/03/08 08:24:42 takayama Exp $*/ |
/*$OpenXM: OpenXM/src/kan96xx/plugin/cmo.c,v 1.12 2004/08/28 12:50:06 takayama Exp $*/ |
#include <stdio.h> |
#include <stdio.h> |
#include <string.h> |
#include <string.h> |
/* #include <netinet/in.h> */ |
/* #include <netinet/in.h> */ |
Line 47 extern struct ring *CurrentRingp; |
|
Line 47 extern struct ring *CurrentRingp; |
|
extern struct ring *SmallRingp; |
extern struct ring *SmallRingp; |
extern int CmoDMSOutputOption; |
extern int CmoDMSOutputOption; |
|
|
struct object NullObjectInCmo; |
struct object NullObjectInCmo = OINIT; |
|
|
extern int SerialCurrent; |
extern int SerialCurrent; |
extern int DebugCMO; |
extern int DebugCMO; |
Line 213 struct object streamToCmo(struct object of) |
|
Line 213 struct object streamToCmo(struct object of) |
|
{ |
{ |
int c; |
int c; |
unsigned char s[1]; |
unsigned char s[1]; |
struct object ob; |
struct object ob = OINIT; |
int file2 = 0; |
int file2 = 0; |
if (of.tag == Sfile) { |
if (of.tag == Sfile) { |
|
|
Line 625 POLY cmoGetMonomial32(struct cmoBuffer *cb) |
|
Line 625 POLY cmoGetMonomial32(struct cmoBuffer *cb) |
|
/* ------------------------------------- */ |
/* ------------------------------------- */ |
void cmoObjectToCmo00(struct object ob) |
void cmoObjectToCmo00(struct object ob) |
{ |
{ |
struct object rob; |
struct object rob = OINIT; |
cmoint tmp[16]; |
cmoint tmp[16]; |
char tmpc[16]; |
char tmpc[16]; |
int i,size; |
int i,size; |
struct object vlist, vlist0; |
struct object vlist = OINIT; |
|
struct object vlist0 = OINIT; |
int m; |
int m; |
struct object ob2; |
struct object ob2 = OINIT; |
|
|
/* NO initialization */ |
/* NO initialization */ |
switch(ob.tag) { |
switch(ob.tag) { |
Line 777 void cmoObjectToCmo00(struct object ob) |
|
Line 778 void cmoObjectToCmo00(struct object ob) |
|
|
|
struct object cmoObjectToCmo(struct object ob) |
struct object cmoObjectToCmo(struct object ob) |
{ |
{ |
struct object rob; |
struct object rob = OINIT; |
if (DebugCMO) { |
if (DebugCMO) { |
fprintf(stderr,"cmoObjectToCmo: "); |
fprintf(stderr,"cmoObjectToCmo: "); |
printObject(ob,1,stderr); |
printObject(ob,1,stderr); |
Line 805 int Lisplike = 0; |
|
Line 806 int Lisplike = 0; |
|
|
|
struct object cmoCmoToObject00(struct cmoBuffer *cb) |
struct object cmoCmoToObject00(struct cmoBuffer *cb) |
{ |
{ |
struct object rob; |
struct object rob = OINIT; |
struct object ob1; |
struct object ob1 = OINIT; |
struct object ob2; |
struct object ob2 = OINIT; |
int tt,ival; |
int tt,ival; |
int i,size; |
int i,size; |
MP_INT *mi; |
MP_INT *mi; |
MP_INT *mi2; |
MP_INT *mi2; |
struct ring *oldringp; |
struct ring *oldringp; |
char tmpc[16]; |
char tmpc[16]; |
struct object vlist, vlist0; |
struct object vlist = OINIT; |
|
struct object vlist0 = OINIT; |
int k; |
int k; |
int m; |
int m; |
struct object ob; |
struct object ob = OINIT; |
|
|
|
|
tt = cmoGetIntFromBuf(CMOGET,cb); /* read the tag */ |
tt = cmoGetIntFromBuf(CMOGET,cb); /* read the tag */ |
Line 1064 struct object cmoCmoToObject00(struct cmoBuffer *cb) |
|
Line 1066 struct object cmoCmoToObject00(struct cmoBuffer *cb) |
|
|
|
struct object cmoCmoToObject(struct object ob) |
struct object cmoCmoToObject(struct object ob) |
{ |
{ |
struct object rob; |
struct object rob = OINIT; |
struct object ob0; |
struct object ob0 = OINIT; |
struct cmoBuffer *cb; |
struct cmoBuffer *cb; |
if (!(ob.tag == Sclass && ob.lc.ival == CMO)) { |
if (!(ob.tag == Sclass && ob.lc.ival == CMO)) { |
rob.tag = Snull; |
rob.tag = Snull; |
Line 1089 struct object cmoCmoToObject(struct object ob) |
|
Line 1091 struct object cmoCmoToObject(struct object ob) |
|
} |
} |
|
|
struct object cmoListToPoly(struct object ob) { |
struct object cmoListToPoly(struct object ob) { |
struct object ob0; |
struct object ob0 = OINIT; |
struct object rob; |
struct object rob = OINIT; |
int i,n; |
int i,n; |
if (ob.tag == Sarray) { |
if (ob.tag == Sarray) { |
n = getoaSize(ob); |
n = getoaSize(ob); |
Line 1116 struct object cmoListToPoly(struct object ob) { |
|
Line 1118 struct object cmoListToPoly(struct object ob) { |
|
struct object cmoListToPoly2(struct object ob) |
struct object cmoListToPoly2(struct object ob) |
{ |
{ |
int size,i; |
int size,i; |
struct object ob0,ob1; |
struct object ob0 = OINIT; |
|
struct object ob1 = OINIT; |
POLY f; |
POLY f; |
/* |
/* |
printf("<<");printObject(ob,0,stdout); printf(">>\n"); fflush(stdout); |
printf("<<");printObject(ob,0,stdout); printf(">>\n"); fflush(stdout); |
|
|
POLY cmoListToPOLY(struct object ob) |
POLY cmoListToPOLY(struct object ob) |
{ |
{ |
int size,i; |
int size,i; |
struct object ob0,ob1; |
struct object ob0 = OINIT; |
|
struct object ob1 = OINIT; |
POLY f; |
POLY f; |
/* |
/* |
printf("<<");printObject(ob,0,stdout); printf(">>\n"); fflush(stdout); |
printf("<<");printObject(ob,0,stdout); printf(">>\n"); fflush(stdout); |
Line 1196 POLY cmoListToPOLY(struct object ob) |
|
Line 1200 POLY cmoListToPOLY(struct object ob) |
|
int Kan_PushBinary(int size,void *data) |
int Kan_PushBinary(int size,void *data) |
{ |
{ |
struct cmoBuffer cb; |
struct cmoBuffer cb; |
struct object ob; |
struct object ob = OINIT; |
cb.pos = size; |
cb.pos = size; |
cb.rpos = 0; |
cb.rpos = 0; |
cb.buf = data; |
cb.buf = data; |
Line 1209 int Kan_PushBinary(int size,void *data) |
|
Line 1213 int Kan_PushBinary(int size,void *data) |
|
|
|
void *Kan_PopBinary(int *sizep) |
void *Kan_PopBinary(int *sizep) |
{ |
{ |
struct object ob; |
struct object ob = OINIT; |
struct cmoBuffer *cb; |
struct cmoBuffer *cb; |
ob = KSpop(); |
ob = KSpop(); |
ob = cmoObjectToCmo(ob); |
ob = cmoObjectToCmo(ob); |
Line 1228 void *Kan_PopBinary(int *sizep) |
|
Line 1232 void *Kan_PopBinary(int *sizep) |
|
struct object cmoObjectFromStream(struct object obStream) |
struct object cmoObjectFromStream(struct object obStream) |
{ |
{ |
struct cmoBuffer cb; |
struct cmoBuffer cb; |
struct object rob; |
struct object rob = OINIT; |
extern DebugCMO; |
extern 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 1246 struct object cmoObjectFromStream(struct object obStre |
|
Line 1250 struct object cmoObjectFromStream(struct object obStre |
|
struct object cmoObjectFromStream2(FILE2 *fp2) |
struct object cmoObjectFromStream2(FILE2 *fp2) |
{ |
{ |
struct cmoBuffer cb; |
struct cmoBuffer cb; |
struct object rob; |
struct object rob = OINIT; |
cb.isStream=1; cb.fp = fp2; |
cb.isStream=1; cb.fp = fp2; |
cmoGetIntFromBuf(CMOINITSTREAM,&cb); |
cmoGetIntFromBuf(CMOINITSTREAM,&cb); |
rob = cmoCmoToObject00(&cb); |
rob = cmoCmoToObject00(&cb); |
Line 1261 struct object cmoObjectFromStream2(FILE2 *fp2) |
|
Line 1265 struct object cmoObjectFromStream2(FILE2 *fp2) |
|
|
|
struct object cmoObjectToStream(struct object ob, struct object obStream) |
struct object cmoObjectToStream(struct object ob, struct object obStream) |
{ |
{ |
struct object rob; |
struct object rob = OINIT; |
extern int DebugCMO; |
extern int DebugCMO; |
if (obStream.tag != Sfile) { |
if (obStream.tag != Sfile) { |
errorCmo("cmoObjectToStream: Argument must be of type file."); |
errorCmo("cmoObjectToStream: Argument must be of type file."); |
Line 1278 struct object cmoObjectToStream(struct object ob, stru |
|
Line 1282 struct object cmoObjectToStream(struct object ob, stru |
|
|
|
struct object cmoObjectToStream2(struct object ob, FILE2 *fp2) |
struct object cmoObjectToStream2(struct object ob, FILE2 *fp2) |
{ |
{ |
struct object rob; |
struct object rob = OINIT; |
cmoOutputToBuf(CMOINITSTREAM,(void *)fp2,0); |
cmoOutputToBuf(CMOINITSTREAM,(void *)fp2,0); |
if (DebugCMO) { |
if (DebugCMO) { |
fprintf(stderr,"cmoObjectToStream2: "); |
fprintf(stderr,"cmoObjectToStream2: "); |
Line 1292 struct object cmoObjectToStream2(struct object ob, FIL |
|
Line 1296 struct object cmoObjectToStream2(struct object ob, FIL |
|
|
|
int Kan_pushCMOFromStream(FILE2 *fp) |
int Kan_pushCMOFromStream(FILE2 *fp) |
{ |
{ |
struct object ob; |
struct object ob = OINIT; |
struct object rob; |
struct object rob = OINIT; |
ob.tag = Sfile; ob.rc.voidp = (void *)fp; ob.lc.str = MAGIC2; |
ob.tag = Sfile; ob.rc.voidp = (void *)fp; ob.lc.str = MAGIC2; |
rob = cmoObjectFromStream(ob); |
rob = cmoObjectFromStream(ob); |
KSpush(rob); |
KSpush(rob); |
Line 1302 int Kan_pushCMOFromStream(FILE2 *fp) |
|
Line 1306 int Kan_pushCMOFromStream(FILE2 *fp) |
|
|
|
int Kan_popCMOToStream(FILE2 *fp,int serial) |
int Kan_popCMOToStream(FILE2 *fp,int serial) |
{ |
{ |
struct object ob; |
struct object ob = OINIT; |
struct object sob; |
struct object sob = OINIT; |
sob.tag = Sfile; sob.rc.file = (void *)fp; sob.lc.str = MAGIC2; |
sob.tag = Sfile; sob.rc.file = (void *)fp; sob.lc.str = MAGIC2; |
ob = Kpop(); |
ob = Kpop(); |
/*outfp2(fp);*/ /* outfp2 is for debugging. see develop/97feb.. 1999, 1/19*/ |
/*outfp2(fp);*/ /* outfp2 is for debugging. see develop/97feb.. 1999, 1/19*/ |
Line 1326 int Kan_setMathCapToStream(FILE2 *fp,struct object ob) |
|
Line 1330 int Kan_setMathCapToStream(FILE2 *fp,struct object ob) |
|
|
|
/* It is declared in oxmisc2.h, too. */ |
/* It is declared in oxmisc2.h, too. */ |
struct object newMathCap(struct mathCap *mathcap){ |
struct object newMathCap(struct mathCap *mathcap){ |
struct object rob; |
struct object rob = OINIT; |
struct object ob1; |
struct object ob1 = OINIT; |
struct object ob2; |
struct object ob2 = OINIT; |
struct object ob3; |
struct object ob3 = OINIT; |
struct object obOx; |
struct object obOx = OINIT; |
struct object obSm; |
struct object obSm = OINIT; |
struct object ob3tmp; |
struct object ob3tmp = OINIT; |
struct object *obp; |
struct object *obp; |
int i,j; |
int i,j; |
struct object mathinfo; |
struct object mathinfo = OINIT; |
|
|
rob = newObjectArray(3); |
rob = newObjectArray(3); |
|
|
Line 1379 void *KSmathCapByStruct(void) |
|
Line 1383 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 = OINIT; |
char *s1,*s2; |
char *s1,*s2; |
struct object *mathinfo; |
struct object *mathinfo; |
char *sys; |
char *sys; |