version 1.1.1.1, 1999/10/08 02:12:13 |
version 1.5, 2016/08/27 01:35:07 |
|
|
#include "ox_kan.h" |
#include "ox_kan.h" |
#include "serversm.h" |
#include "serversm.h" |
#include <setjmp.h> |
#include <setjmp.h> |
|
#include <errno.h> |
|
#include <malloc.h> |
jmp_buf EnvOfStackMachine; /* dummy data. */ |
jmp_buf EnvOfStackMachine; /* dummy data. */ |
|
|
int SerialCurrent = -1; |
int SerialCurrent = -1; |
int Quiet = 0; |
int Quiet = 0; |
|
|
void *GC_malloc(n) { |
void *sGC_malloc(int n) { |
return((void *)malloc(n)); |
return((void *)malloc(n)); |
} |
} |
|
|
/* internal use. */ |
/* internal use. */ |
int Sm1_popInt(); |
int Sm1_popInt(); |
|
|
Sm1_start() { |
Sm1_start(int argc,char *fnames[],char *myname) { |
fprintf(stderr,"nullstackmachine: sleep, pstack\n"); |
fprintf(stderr,"nullstackmachine: sleep, pstack\n"); |
} |
} |
|
|
Line 82 void printCMO_object(FILE *fp,CMO_Object *op) |
|
Line 84 void printCMO_object(FILE *fp,CMO_Object *op) |
|
n = ntohl(((CMO_string_object *)op)->size); |
n = ntohl(((CMO_string_object *)op)->size); |
fprintf(stderr,"n=%d :"); fflush(NULL); |
fprintf(stderr,"n=%d :"); fflush(NULL); |
for (i=0; i<n; i++) { |
for (i=0; i<n; i++) { |
fprintf(fp,"%c",((CMO_string_object *)op)->data[i]); |
fprintf(fp,"%c",((CMO_string_object *)op)->data[i]); |
} |
} |
break; |
break; |
default: |
default: |
Line 95 void printCMO_object(FILE *fp,CMO_Object *op) |
|
Line 97 void printCMO_object(FILE *fp,CMO_Object *op) |
|
void *Sm1_mathcap(void) { |
void *Sm1_mathcap(void) { |
int n,i; |
int n,i; |
struct mathCap *mathcap; |
struct mathCap *mathcap; |
|
static char *infoStr; |
|
infoStr = "nullserver00 Version=0.1; 199901160;"; |
mathcap = (struct mathCap *) malloc(sizeof(struct mathCap)); |
mathcap = (struct mathCap *) malloc(sizeof(struct mathCap)); |
strcpy(mathcap->name,"nullserver00 Version=0.1"); |
mathcap->infop = infoStr; /* string is OK? 2016.08.27 */ |
mathcap->version = 199901160; |
|
mathcap->cmo[0] = CMO_ERROR2; |
mathcap->cmo[0] = CMO_ERROR2; |
mathcap->cmo[1] = CMO_NULL; |
mathcap->cmo[1] = CMO_NULL; |
mathcap->cmo[2] = CMO_INT32; |
mathcap->cmo[2] = CMO_INT32; |
Line 124 int Sm1_executeStringByLocalParser(void) { |
|
Line 127 int Sm1_executeStringByLocalParser(void) { |
|
if (s != NULL) { |
if (s != NULL) { |
if (strcmp(s,"sleep") == 0) { |
if (strcmp(s,"sleep") == 0) { |
while (1) { |
while (1) { |
fprintf(stderr,"Sleeping... "); fflush(NULL); |
fprintf(stderr,"Sleeping... "); fflush(NULL); |
sleep(10); |
sleep(10); |
} |
} |
}else if (strcmp(s,"pstack") == 0) { |
}else if (strcmp(s,"pstack") == 0) { |
fprintf(stderr,"pstack -------------- Stackp = %d\n",Stackp); |
fprintf(stderr,"pstack -------------- Stackp = %d\n",Stackp); |
for (i=Stackp-1; i>=0; i--) { |
for (i=Stackp-1; i>=0; i--) { |
printCMO_object(stdout,LocalStack[i]); fprintf(stderr,"\n"); |
printCMO_object(stdout,LocalStack[i]); fprintf(stderr,"\n"); |
} |
} |
fprintf(stderr,"\n--------------------\n"); |
fprintf(stderr,"\n--------------------\n"); |
}else{ |
}else{ |
Line 242 int Sm1_pushCMO(ox_stream ostream) /* old one went to |
|
Line 245 int Sm1_pushCMO(ox_stream ostream) /* old one went to |
|
n = nullCmoGetInt32(ostream); |
n = nullCmoGetInt32(ostream); |
fprintf(stderr,"size=%d ",n); |
fprintf(stderr,"size=%d ",n); |
if (n > 1000-2) { |
if (n > 1000-2) { |
fprintf(stderr," size is too large. \n"); |
fprintf(stderr," size is too large. \n"); |
}else{ |
}else{ |
for (i=0; i<n; i++) { |
for (i=0; i<n; i++) { |
data[i] = fp2fgetc(ostream); |
data[i] = fp2fgetc(ostream); |
data[i+1] = '\0'; |
data[i+1] = '\0'; |
} |
} |
fprintf(stderr," string=%s ",data); |
fprintf(stderr," string=%s ",data); |
Sm1_pushToLocalStack(CMO_new_string(data)); |
Sm1_pushToLocalStack(CMO_new_string(data)); |
} |
} |
break; |
break; |
default: |
default: |
do { |
do { |
if ((c = fp2fgetc(ostream)) == EOF) { |
if ((c = fp2fgetc(ostream)) == EOF) { |
fprintf(stderr,"pushCMOFromStrem: Select returns 0, but there is no data or unexpected EOF.\n"); |
fprintf(stderr,"pushCMOFromStrem: Select returns 0, but there is no data or unexpected EOF.\n"); |
return(-1); |
return(-1); |
} |
} |
fprintf(stderr,"%2x ",c); |
fprintf(stderr,"%2x ",c); |
}while(isData(ostream)); |
}while(isData(ostream)); |
} |
} |
} |
} |
Line 269 int Sm1_pushCMO(ox_stream ostream) /* old one went to |
|
Line 272 int Sm1_pushCMO(ox_stream ostream) /* old one went to |
|
int Sm1_popCMO(ox_stream os,int serial) |
int Sm1_popCMO(ox_stream os,int serial) |
{ |
{ |
FILE *fp2; |
FILE *fp2; |
extern int errno; |
|
int c; |
int c; |
int p; |
int p; |
char data[1000]; |
char data[1000]; |
Line 300 int Sm1_pushError2(int serial,int no,char *s) |
|
Line 302 int Sm1_pushError2(int serial,int no,char *s) |
|
/* These are dummy. It is defined in stackmachine.c */ |
/* These are dummy. It is defined in stackmachine.c */ |
unlockCtrlCForOx() { ; } |
unlockCtrlCForOx() { ; } |
restoreLockCtrlCForOx() { ; } |
restoreLockCtrlCForOx() { ; } |
|
void cancelAlarm() { ; } |
|
|