version 1.8, 2004/03/02 09:30:48 |
version 1.10, 2004/03/03 06:09:29 |
|
|
/* $OpenXM: OpenXM/src/kxx/ox_texmacs.c,v 1.7 2004/03/02 09:10:04 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kxx/ox_texmacs.c,v 1.9 2004/03/03 02:31:50 takayama Exp $ */ |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <setjmp.h> |
#include <setjmp.h> |
Line 70 static int startEngine(int type,char *msg); |
|
Line 70 static int startEngine(int type,char *msg); |
|
*/ |
*/ |
FILE *Dfp; |
FILE *Dfp; |
|
|
main() { |
main(int argc,char *argv[]) { |
char *s; |
char *s; |
char *r; |
char *r; |
char *sys; |
char *sys; |
|
|
int vmode=1; |
int vmode=1; |
char *openxm_home; |
char *openxm_home; |
char *asir_config; |
char *asir_config; |
|
int i; |
|
|
openxm_home = (char *) getenv("OpenXM_HOME"); |
openxm_home = (char *) getenv("OpenXM_HOME"); |
asir_config = (char *) getenv("ASIR_CONFIG"); |
asir_config = (char *) getenv("ASIR_CONFIG"); |
|
|
#endif |
#endif |
|
|
/* Set consts */ |
/* Set consts */ |
sys = "asir> "; |
|
Quiet = 1; |
Quiet = 1; |
|
for (i=1; i<argc; i++) { |
|
if (strcmp(argv[i],"--sm1") == 0) { |
|
TM_Engine = SM1; |
|
}else if (strcmp(argv[i],"--asir") == 0) { |
|
TM_Engine = ASIR; |
|
}else if (strcmp(argv[i],"--k0") == 0) { |
|
TM_Engine = K0; |
|
}else{ |
|
printv("Unknown option\n"); |
|
} |
|
} |
|
|
/* Initialize kanlib (gc is also initialized) */ |
/* Initialize kanlib (gc is also initialized) */ |
KSstart(); |
KSstart(); |
Line 241 static char *readString(FILE *fp, char *prolog, char * |
|
Line 252 static char *readString(FILE *fp, char *prolog, char * |
|
s[n++] = c; s[n] = 0; m++; |
s[n++] = c; s[n] = 0; m++; |
INC_BUF ; |
INC_BUF ; |
} |
} |
if (s[n-1] == '$' && TM_Engine == ASIR) TM_do_not_print = 1; |
if (s[n-1] == '$' && TM_Engine == ASIR) { |
else TM_do_not_print = 0; |
TM_do_not_print = 1; s[n-1] = ' '; |
|
} else if (s[n-1] == ';' && TM_Engine == SM1) { |
|
TM_do_not_print = 1; s[n-1] = ' '; |
|
} else TM_do_not_print = 0; |
/* Check the escape sequence */ |
/* Check the escape sequence */ |
if (strcmp(&(s[start]),"!quit;") == 0) { |
if (strcmp(&(s[start]),"!quit;") == 0) { |
printv("Terminated the process ox_texmacs.\n"); |
printv("Terminated the process ox_texmacs.\n"); |
Line 319 static int startEngine(int type,char *msg) { |
|
Line 333 static int startEngine(int type,char *msg) { |
|
if (type == SM1) { |
if (type == SM1) { |
if (!TM_sm1Started) KSexecuteString(" sm1connectr "); |
if (!TM_sm1Started) KSexecuteString(" sm1connectr "); |
KSexecuteString(" /ox.engine oxsm1.ccc def "); |
KSexecuteString(" /ox.engine oxsm1.ccc def "); |
|
/* Initialize the setting of sm1. */ |
|
KSexecuteString(" oxsm1.ccc ( [(cmoLispLike) 0] extension ) oxsubmit "); |
|
KSexecuteString(" oxsm1.ccc ( ox_server_mode ) oxsubmit "); |
|
KSexecuteString(" oxsm1.ccc ( ( ) message (------------- Message from sm1 ----------------)message ) oxsubmit "); |
TM_sm1Started = 1; |
TM_sm1Started = 1; |
|
/* Welcome message. BUG. Copyright should be returned by a function. */ |
|
printf("Kan/StackMachine1 1991 April --- 2004.\n"); |
|
printf("This software may be freely distributed as is with no warranty expressed. \n"); |
|
printf("See OpenXM/Copyright/Copyright.generic\n"); |
|
printf("Info: http://www.math.kobe-u.ac.jp/KAN, kan@math.kobe-u.ac.jp.\n"); |
|
printf("0 usages to show a list of functions. \n(keyword) usages to see a short description\n"); |
printf("%s\n",msg); |
printf("%s\n",msg); |
}else if (type == K0) { |
}else if (type == K0) { |
if (!TM_k0Started) KSexecuteString(" k0connectr "); |
if (!TM_k0Started) KSexecuteString(" k0connectr "); |
Line 341 static int startEngine(int type,char *msg) { |
|
Line 365 static int startEngine(int type,char *msg) { |
|
KSexecuteString(" oxasir.ccc (if(1) { ctrl(\"message\",0); } else { ; } ;) oxsubmit oxasir.ccc oxpopcmo "); |
KSexecuteString(" oxasir.ccc (if(1) { ctrl(\"message\",0); } else { ; } ;) oxsubmit oxasir.ccc oxpopcmo "); |
/* bug; if ctrl is written with Xm_helpdir = ... without oxpopcmo, then it does |
/* bug; if ctrl is written with Xm_helpdir = ... without oxpopcmo, then it does |
not work. */ |
not work. */ |
|
KSexecuteString(" oxasir.ccc (print(\"----------- Messages from asir ------------------------------\")$ ) oxsubmit oxasir.ccc oxpopcmo "); |
} |
} |
printf("%s",DATA_END); |
printf("%s",DATA_END); |
fflush(NULL); |
fflush(NULL); |