[BACK]Return to sample_kanlib.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kxx

Annotation of OpenXM/src/kxx/sample_kanlib.c, Revision 1.1

1.1     ! takayama    1: /* $OpenXM$ */
        !             2: /*
        !             3: This is a sample program to use kanlib.a
        !             4: gcc -g -O2 -g -D_BSD_SOURCE sample_kanlib.c -o sample_kanlib  -ldl   ../kan96xx/Kan/kanlib.a -L../../lib -lgmp -lgc
        !             5: */
        !             6:
        !             7: #include <stdio.h>
        !             8: #include <setjmp.h>
        !             9: #include <signal.h>
        !            10:
        !            11: #if defined(__CYGWIN__)
        !            12: #define JMP_BUF sigjmp_buf
        !            13: #define SETJMP(env)  sigsetjmp(env,1)
        !            14: #define LONGJMP(env,p)  siglongjmp(env,p)
        !            15: #else
        !            16: #define JMP_BUF jmp_buf
        !            17: #define SETJMP(env)  setjmp(env)
        !            18: #define LONGJMP(env,p)  longjmp(env,p)
        !            19: #endif
        !            20:
        !            21:
        !            22: extern int Quiet;
        !            23: extern JMP_BUF EnvOfStackMachine;
        !            24:
        !            25: void ctrlC();
        !            26:
        !            27: main() {
        !            28:   char s[1024];
        !            29:   Quiet = 0;
        !            30:   KSstart();
        !            31:
        !            32:   if (signal(SIGINT,SIG_IGN) != SIG_IGN) {
        !            33:        signal(SIGINT,ctrlC);
        !            34:   }
        !            35:   while( fgets(s,1023,stdin) != NULL) {
        !            36:        if (SETJMP(EnvOfStackMachine)) {
        !            37:          KSexecuteString(" ctrlC-hook "); /* Execute User Defined functions. */
        !            38:       KSexecuteString(" (Computation is interrupted.) ");
        !            39:          continue;
        !            40:        } else {  }
        !            41:        KSexecuteString(s);
        !            42:   }
        !            43: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>