[BACK]Return to serversm.h CVS log [TXT][DIR] Up to [local] / OpenXM / src / kxx

File: [local] / OpenXM / src / kxx / serversm.h (download)

Revision 1.4, Thu Jun 16 05:07:24 2005 UTC (18 years, 11 months ago) by takayama
Branch: MAIN
Changes since 1.3: +2 -0 lines

The initialization of the variables of the type struct object
are added.  It is necessary to initialize the field "attr"
(object attribute) of stuct object.  cf. misc-2005/06/gfan/opt.sm1 test2.

/* server stack machine, serversm.h  */
void *Sm1_mathcap(void);
int Sm1_setMathCap(ox_stream os);
void Sm1_pops(void);
int Sm1_executeStringByLocalParser(void);
char *Sm1_popString(void);
int Sm1_setName(void);
int Sm1_evalName(void);
int Sm1_start(int argc, char *fnames[],char *myname);
int Sm1_pushCMO(ox_stream fp);  /* read data from the stream and push it */
int Sm1_popCMO(ox_stream fp,int serial);         /* pop and send the data to stream. */
int Sm1_pushError2(int serial,int no,char *message);
char *Sm1_popErrorMessage(char *s);
void Sm1_getsp(void);
void Sm1_dupErrors(void);
void Sm1_pushCMOtag(int serial);


/********************  Object from Kan/stackm.h *************************/
#define Snull             0
#define Sinteger          1     /* integer */
#define Sdollar           5     /* pointer to a string obtained from $...$ */
#define Sarray            6     /* lc.ival is the size of array,
				   (rc.op)[0], ..., (rc.op)[k] is the array
				   of object */
#define Sclass          17   /* class, for extension */


union cell {
  int ival;
  char *str;
  struct object *op;
  void *voidp;
};
struct object{
  int tag;                /* class identifier */
  union cell lc;          /* left cell */
  union cell rc;          /* right cell */
  struct object *attr;
};
#define OINIT  { .attr = NULL }

/********** macros to use Sarray **********************/
/* put to Object Array */
#define putoa(ob,i,cc) {\
if ((ob).tag != Sarray) {fprintf(stderr,"Warning: PUTOA is for an array of objects\n");} else \
{if ((0 <= (i)) && ((i) < (ob).lc.ival)) {\
  (ob.rc.op)[i] = cc;\
}else{\
  fprintf(stderr,"Warning: PUTOA, the size is %d.\n",(ob).lc.ival);\
}}}

#define getoa(ob,i) ((ob.rc.op)[i])

#define getoaSize(ob) ((ob).lc.ival)
/**************** end of macros from Kan/stackm.h *******************/

/*   Interface functions from kanlib.a.  */
struct object KSpop();
void KSpush(struct object ob);
struct object KfindUserDictionary(char *s);
struct object KputUserDictionary(char *s,struct object ob);
struct object KnewErrorPacket(int serial,int no,char *s);
struct object KSmathCap(void);  /* defined plugin/cmo.c */
void *KSmathCapByStruct(void);  /* defined plugin/cmo.c */
char *popErrorStackByString(void);
struct object KSdupErrors(void);
struct object KpoInteger(int i);
struct object KSpeek(int k);