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

Diff for /OpenXM/src/kxx/sm1stackmachine.c between version 1.2 and 1.7

version 1.2, 2000/02/02 03:30:49 version 1.7, 2006/02/02 04:16:49
Line 3 
Line 3 
 #include "ox_kan.h"  #include "ox_kan.h"
 #include "serversm.h"  #include "serversm.h"
 extern int OXprintMessage;  extern int OXprintMessage;
   extern char *MsgStackTrace;
   extern char *MsgSourceTrace;
   extern struct object *MsgStackTraceInArrayp;
   
 /*  server stack machine */  /*  server stack machine */
   
Line 31  int Sm1_start(int argc, char *fnames[],char *myname) {
Line 34  int Sm1_start(int argc, char *fnames[],char *myname) {
     for (i=0; i<argc; i++) {      for (i=0; i<argc; i++) {
       /* load files from the search path */        /* load files from the search path */
       if (strlen(fnames[i]) > 1024) {        if (strlen(fnames[i]) > 1024) {
         fprintf(stderr,"Too long name for sm1 library file to load.\n");          fprintf(stderr,"Too long name for sm1 library file to load.\n");
         exit(10);          exit(10);
       }        }
       sprintf(cmd," [(parse) (%s) pushfile ] extension pop ",fnames[i]);        sprintf(cmd," [(parse) (%s) pushfile ] extension pop ",fnames[i]);
       KSexecuteString(cmd);        KSexecuteString(cmd);
Line 57  int Sm1_setMathCap(ox_stream os) {
Line 60  int Sm1_setMathCap(ox_stream os) {
   /* Set the mathcap data of the client in the server. */    /* Set the mathcap data of the client in the server. */
   /*  sm1 <====== ox_sm1  mathcap is set in ox_stream = FILE2 * */    /*  sm1 <====== ox_sm1  mathcap is set in ox_stream = FILE2 * */
   /* The mathcap data is on the stack. */    /* The mathcap data is on the stack. */
   struct object ob;    struct object ob = OINIT;
   struct object ob2;    struct object ob2 = OINIT;
   int n,i;    int n,i;
   ob = KSpop();    ob = KSpop();
   KSpush(ob);  KSexecuteString(" (mathcap data is ) message message ");    KSpush(ob);  KSexecuteString(" (mathcap data is ) message message ");
Line 93  char *Sm1_popString(void) {
Line 96  char *Sm1_popString(void) {
 int Sm1_setName(void)  int Sm1_setName(void)
 {  {
   char *s;    char *s;
   struct object ob;    struct object ob = OINIT;
   s = Sm1_popString();    s = Sm1_popString();
   if (s == NULL) {    if (s == NULL) {
     printf("NULL argument for setName.\n");      printf("NULL argument for setName.\n");
Line 109  int Sm1_setName(void)
Line 112  int Sm1_setName(void)
 int Sm1_evalName(void)  int Sm1_evalName(void)
 {  {
   char *s;    char *s;
   struct object ob;    struct object ob = OINIT;
   s = Sm1_popString();    s = Sm1_popString();
   if (s == NULL) {    if (s == NULL) {
     printf("NULL argument for evalName.\n");      printf("NULL argument for evalName.\n");
Line 137  int Sm1_popCMO(ox_stream fp,int serial)
Line 140  int Sm1_popCMO(ox_stream fp,int serial)
   
 int Sm1_pushError2(int serial, int no, char *s)  int Sm1_pushError2(int serial, int no, char *s)
 {  {
   struct object ob;    struct object ob = OINIT;
   ob = KnewErrorPacket(serial,no,s);    struct object core = OINIT;
     struct object core1 = OINIT;
     char *ss;
   
     ss = (char *)sGC_malloc(strlen(s)+1);
     strcpy(ss,s);
     /*
     char *error_message="<ox103:error_message>";
     char *message="<ox103:message>";
     char *stack_trace="<ox103:stack_trace>";
     char *source_trace="<ox103:source_trace>";
     char *error_message2="</ox103:error_message>";
     char *message2="</ox103:message>";
     char *stack_trace2="</ox103:stack_trace>";
     char *source_trace2="</ox103:source_trace>";
     ss = (char *) sGC_malloc(strlen(s)+strlen(MsgStackTrace)+
                              strlen(MsgSourceTrace)+
                              strlen(error_message)+strlen(error_message2)+
                              strlen(message)+strlen(message2)+
                              strlen(stack_trace)+strlen(stack_trace2)+
                              strlen(source_trace)+strlen(source_trace2)+2);
   
     strcat(ss,error_message);
     strcat(ss,message);
     strcat(ss,s);
     strcat(ss,message2);
     if (MsgStackTrace != NULL) {
           strcat(ss,stack_trace);
           strcat(ss,MsgStackTrace);
           strcat(ss,stack_trace2);
     }
     if (MsgSourceTrace != NULL) {
           strcat(ss,source_trace);
           strcat(ss,MsgSourceTrace);
           strcat(ss,source_trace2);
     }
     strcat(ss,error_message2);
     */
   
     if (MsgStackTraceInArrayp != NULL) {
           core = KSnewObjectArray(2);
           core1 = KSnewObjectArray(2);
           putoa(core1,0,KpoString("where"));  /* keyword */
           putoa(core1,1,(*MsgStackTraceInArrayp));
       putoa(core,0,core1);
       core1 = KSnewObjectArray(2);
           putoa(core1,0,KpoString("reason_of_error")); /* keyword */
           putoa(core1,1,KpoString(s));
           putoa(core,1,core1);
     }else{
           core = KSnewObjectArray(0);
     }
     ob = KSnewObjectArray(4);
     putoa(ob,0,KpoInteger(serial)); putoa(ob,1,KpoInteger(no));
     putoa(ob,2,KpoString(ss));
     putoa(ob,3,core);
   
     ob = KnewErrorPacketObj(ob);
   KSpush(ob);    KSpush(ob);
 }  }
   
Line 177  void Sm1_dupErrors(void) {
Line 237  void Sm1_dupErrors(void) {
 }  }
   
 void Sm1_pushCMOtag(int serial) {  void Sm1_pushCMOtag(int serial) {
   struct object obj;    struct object obj = OINIT;
   int t;    int t;
   obj = KSpeek(0);    obj = KSpeek(0);
   t = KgetCmoTagOfObject(obj);    t = KgetCmoTagOfObject(obj);
   if (t != -1) {    if (t != -1) {
         KSpush(KpoInteger(t));      KSpush(KpoInteger(t));
   }else{    }else{
         Sm1_pushError2(serial,-1,"The top object on the server stack cannot be translated to cmo.");      Sm1_pushError2(serial,-1,"The top object on the server stack cannot be translated to cmo.");
   }    }
 }  }
   

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.7

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