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

Annotation of OpenXM/src/ox_maple/simple.c, Revision 1.1

1.1     ! takayama    1: /* -*- mode: C -*- */
        !             2: /* $OpenXM$ */
        !             3:
        !             4: /* A sample implementation for maple
        !             5:    of an OpenXM client with OpenXM C library */
        !             6:
        !             7: #include <stdio.h>
        !             8:
        !             9: #include "ox_toolkit.h"
        !            10:
        !            11: extern OXFILE *ox_start(char* host, char* prog1, char* prog2);
        !            12: OXFILE *sv = NULL;
        !            13:
        !            14: int ml_init() {
        !            15:   static int p = 1;
        !            16:   if (p) {
        !            17:        GC_init();
        !            18:     ox_stderr_init(stderr);
        !            19:     p = 0;
        !            20:   }
        !            21: }
        !            22:
        !            23: int ml_start_asir()
        !            24: {
        !            25:     char *server = "ox_asir";
        !            26:
        !            27:        ml_init();
        !            28:
        !            29:     sv = ox_start("localhost", "ox", server);
        !            30:     if (sv == NULL) {
        !            31:         ox_printf("simple:: I cannot connect to servers.\n");
        !            32:         return -1;
        !            33:     }
        !            34:        return 0;
        !            35: }
        !            36:
        !            37: int ml_push_int(int i) {
        !            38:   if (sv == NULL) ml_start_asir();
        !            39:   ox_push_cmo(sv,(cmo *)new_cmo_int32(i));
        !            40:   return i;
        !            41: }
        !            42:
        !            43: int ml_execute_string(char *s) {
        !            44:   if (sv == NULL) ml_start_asir();
        !            45:   ox_execute_string(sv,s);
        !            46:   return 0;
        !            47: }
        !            48:
        !            49: char *ml_pop_string() {
        !            50:   if (sv == NULL) ml_start_asir();
        !            51:   return ox_popString(sv);
        !            52:   /* Is it protected from GC? */
        !            53: }
        !            54:

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