version 1.4, 2015/10/08 11:49:38 |
version 1.6, 2016/03/31 06:34:29 |
|
|
/* $OpenXM: OpenXM/src/kxx/sample_kanlib.c,v 1.3 2004/09/17 02:42:58 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kxx/sample_kanlib.c,v 1.5 2016/03/31 05:27:34 takayama Exp $ */ |
/* |
/* |
This is a sample program to use kanlib.a |
This is a sample program to use kanlib.a |
gcc -g -O2 -g -D_BSD_SOURCE sample_kanlib.c -o sample_kanlib -ldl ../kan96xx/Kan/kanlib.a -L../../lib -lgmp -lgc |
gcc -g -O2 -g -D_BSD_SOURCE sample_kanlib.c -o sample_kanlib -ldl ../kan96xx/Kan/kanlib.a -L../../lib -lgmp -lgc |
Line 7 gcc -g -O2 -g -D_BSD_SOURCE sample_kanlib.c -o sample_ |
|
Line 7 gcc -g -O2 -g -D_BSD_SOURCE sample_kanlib.c -o sample_ |
|
#include <stdio.h> |
#include <stdio.h> |
#include <setjmp.h> |
#include <setjmp.h> |
#include <signal.h> |
#include <signal.h> |
|
#include "mysig.h" |
|
|
// serversm.h is not included. |
// serversm.h is not included. |
#if defined(__CYGWIN__) || defined(__MSYS__) |
#if defined(__CYGWIN__) || defined(__MSYS__) |
|
|
|
|
main() { |
main() { |
char s[1024]; |
char s[1024]; |
|
int r; |
Quiet = 0; |
Quiet = 0; |
KSstart(); |
KSstart(); |
|
|
if (signal(SIGINT,SIG_IGN) != SIG_IGN) { |
if (mysignal(SIGINT,SIG_IGN) != SIG_IGN) { |
signal(SIGINT,ctrlC); |
mysignal(SIGINT,ctrlC); |
} |
} |
while( fgets(s,1023,stdin) != NULL) { |
while( fgets(s,1023,stdin) != NULL) { |
if (SETJMP(EnvOfStackMachine)) { |
if (SETJMP(EnvOfStackMachine)) { |
|
|
KSexecuteString(" (Computation is interrupted.) "); |
KSexecuteString(" (Computation is interrupted.) "); |
continue; |
continue; |
} else { } |
} else { } |
KSexecuteString(s); |
r=KSexecuteString(s); |
|
fprintf(stderr,"result code=%d\n",r); |
} |
} |
} |
} |