version 1.1, 2004/02/29 03:00:37 |
version 1.4, 2015/10/08 11:49:38 |
|
|
/* $OpenXM$ */ |
/* $OpenXM: OpenXM/src/kxx/sample_kanlib.c,v 1.3 2004/09/17 02:42:58 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 8 gcc -g -O2 -g -D_BSD_SOURCE sample_kanlib.c -o sample_ |
|
Line 8 gcc -g -O2 -g -D_BSD_SOURCE sample_kanlib.c -o sample_ |
|
#include <setjmp.h> |
#include <setjmp.h> |
#include <signal.h> |
#include <signal.h> |
|
|
#if defined(__CYGWIN__) |
// serversm.h is not included. |
|
#if defined(__CYGWIN__) || defined(__MSYS__) |
#define JMP_BUF sigjmp_buf |
#define JMP_BUF sigjmp_buf |
#define SETJMP(env) sigsetjmp(env,1) |
#define SETJMP(env) _setjmp(env) |
#define LONGJMP(env,p) siglongjmp(env,p) |
#define LONGJMP(env,p) _longjmp(env,p) |
#else |
#else |
#define JMP_BUF jmp_buf |
#define JMP_BUF jmp_buf |
#define SETJMP(env) setjmp(env) |
#define SETJMP(env) setjmp(env) |
Line 21 gcc -g -O2 -g -D_BSD_SOURCE sample_kanlib.c -o sample_ |
|
Line 22 gcc -g -O2 -g -D_BSD_SOURCE sample_kanlib.c -o sample_ |
|
|
|
extern int Quiet; |
extern int Quiet; |
extern JMP_BUF EnvOfStackMachine; |
extern JMP_BUF EnvOfStackMachine; |
|
extern Calling_ctrlC_hook; |
|
extern int RestrictedMode, RestrictedMode_saved; |
|
|
void ctrlC(); |
void ctrlC(); |
|
|
|
|
} |
} |
while( fgets(s,1023,stdin) != NULL) { |
while( fgets(s,1023,stdin) != NULL) { |
if (SETJMP(EnvOfStackMachine)) { |
if (SETJMP(EnvOfStackMachine)) { |
KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */ |
if (!Calling_ctrlC_hook) { |
|
Calling_ctrlC_hook = 1; RestrictedMode = 0; |
|
KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */ |
|
RestrictedMode = RestrictedMode_saved; |
|
} |
|
Calling_ctrlC_hook = 0; |
KSexecuteString(" (Computation is interrupted.) "); |
KSexecuteString(" (Computation is interrupted.) "); |
continue; |
continue; |
} else { } |
} else { } |