version 1.2, 2000/02/02 03:30:49 |
version 1.5, 2005/07/18 10:55:16 |
|
|
#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; |
|
|
/* server stack machine */ |
/* server stack machine */ |
|
|
Line 31 int Sm1_start(int argc, char *fnames[],char *myname) { |
|
Line 33 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 59 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 95 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 111 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 139 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); |
char *ss; |
|
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); |
|
ob = KnewErrorPacket(serial,no,ss); |
KSpush(ob); |
KSpush(ob); |
} |
} |
|
|
Line 177 void Sm1_dupErrors(void) { |
|
Line 210 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."); |
} |
} |
} |
} |
|
|