version 1.3, 2004/02/29 13:02:44 |
version 1.4, 2004/03/01 07:55:38 |
|
|
/* $OpenXM: OpenXM/src/kxx/ox_texmacs.c,v 1.2 2004/02/29 08:19:54 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kxx/ox_texmacs.c,v 1.3 2004/02/29 13:02:44 takayama Exp $ */ |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <setjmp.h> |
#include <setjmp.h> |
|
|
char *sys; |
char *sys; |
struct object ob; |
struct object ob; |
int irt=0; |
int irt=0; |
|
int vmode=1; |
|
|
#ifdef DEBUG2 |
#ifdef DEBUG2 |
Dfp = fopen("/tmp/debug-texmacs.txt","w"); |
Dfp = fopen("/tmp/debug-texmacs.txt","w"); |
|
|
printf("%s",DATA_END); fflush(stdout); |
printf("%s",DATA_END); fflush(stdout); |
} |
} |
irt = 0; |
irt = 0; |
s=readString(stdin, "if (1) { ", " ; }else{ };"); /* see test data */ |
s=readString(stdin, "if (1) { ", " ; }else{ }"); /* see test data */ |
if (s == NULL) break; |
if (s == NULL) break; |
printf("%s",DATA_BEGIN_V); |
printf("%s",DATA_BEGIN_V); |
KSexecuteString(" ox.engine "); |
KSexecuteString(" ox.engine "); |
|
|
/* Get the result in string. */ |
/* Get the result in string. */ |
if (Format == 1) { |
if (Format == 1) { |
/* translate to latex form */ |
/* translate to latex form */ |
KSexecuteString(" ox.engine 1 oxpushcmo ox.engine (print_tex_form) oxexec "); |
KSexecuteString(" ox.engine oxpushcmotag ox.engine oxpopcmo "); |
KSexecuteString(" ox.engine oxpopstring "); |
ob = KSpop(); |
r = KSpopString(); |
vmode = 0; |
if (strlen(r) < OutputLimit_for_TeXmacs) printl(r); |
/* printf("id=%d\n",ob.tag); bug: matrix return 17 instead of Sinteger |
else printv("Output is too large.\n"); |
or error. */ |
|
if (ob.tag == Sinteger) { |
|
/* printf("cmotag=%d\n",ob.lc.ival);*/ |
|
if (ob.lc.ival == CMO_ERROR2) { |
|
vmode = 1; |
|
} |
|
} |
|
if (vmode) { |
|
KSexecuteString(" ox.engine oxpopstring "); |
|
r = KSpopString(); |
|
}else{ |
|
KSexecuteString(" ox.engine 1 oxpushcmo ox.engine (print_tex_form) oxexec "); |
|
KSexecuteString(" ox.engine oxpopstring "); |
|
r = KSpopString(); |
|
} |
|
if (strlen(r) < OutputLimit_for_TeXmacs) { |
|
if (vmode) printv(r); else printl(r); |
|
} else printv("Output is too large.\n"); |
}else{ |
}else{ |
KSexecuteString(" ox.engine oxpopstring "); |
KSexecuteString(" ox.engine oxpopstring "); |
r = KSpopString(); |
r = KSpopString(); |
Line 207 static void printv(char *s) { |
|
Line 225 static void printv(char *s) { |
|
} |
} |
static void printl(char *s) { |
static void printl(char *s) { |
printf("%s",DATA_BEGIN_L); |
printf("%s",DATA_BEGIN_L); |
printf("%s",s); |
printf(" $ %s $ ",s); |
printf("%s",DATA_END); |
printf("%s",DATA_END); |
fflush(NULL); |
fflush(NULL); |
} |
} |