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

Annotation of OpenXM/src/ox_math/math2ox.c, Revision 1.1

1.1     ! ohara       1: /* -*- mode: C; coding: euc-japan -*- */
        !             2: /* $OpenXM$ */
        !             3: /* $Id: math2ox.c,v 1.3 1999/10/13 07:38:23 ohara Exp $ */
        !             4:
        !             5: #include <sys/types.h>
        !             6: #include <sys/stat.h>
        !             7: #include <fcntl.h>
        !             8:
        !             9: #include <stdio.h>
        !            10: #include <stdlib.h>
        !            11: #include <mathlink.h>
        !            12: #include <unistd.h>
        !            13: #include <signal.h>
        !            14:
        !            15: #include "ox.h"
        !            16:
        !            17: static char *host    = "localhost";
        !            18: static char *ctlserv = "ox";
        !            19: static char *oxprog  = "ox_sm1";
        !            20:
        !            21: ox_file_t sv;
        !            22:
        !            23: /* Mathematica から直接呼び出される関数の定義. */
        !            24: /* 呼び出しの方法は math2ox.tm で定義される.   */
        !            25: int OX_executeStringByLocalParser(const char *str)
        !            26: {
        !            27:     ox_executeStringByLocalParser(sv, str);
        !            28:     return 0;
        !            29: }
        !            30:
        !            31: char *OX_popString()
        !            32: {
        !            33:     return ox_popString(sv, sv->stream);
        !            34: }
        !            35:
        !            36: int OX_close()
        !            37: {
        !            38:     ox_close(sv);
        !            39:     return 0;
        !            40: }
        !            41:
        !            42: int OX_reset()
        !            43: {
        !            44:     ox_reset(sv);
        !            45:     return 0;
        !            46: }
        !            47:
        !            48:
        !            49: int OX_start(char* s)
        !            50: {
        !            51:     if (s != NULL && s[0] != '\0') {
        !            52:         oxprog = s;
        !            53:     }
        !            54:     sv = ox_start(host, ctlserv, oxprog);
        !            55:     fprintf(stderr, "open (%s)\n", "localhost");
        !            56:     return 0;
        !            57: }
        !            58:
        !            59: static char *cp_str(char *src)
        !            60: {
        !            61:     char *dest = malloc(strlen(src)+1);
        !            62:     strcpy(dest, src);
        !            63:     return dest;
        !            64: }
        !            65:
        !            66: int OX_setClientParam(char *h, char* c, char* p)
        !            67: {
        !            68:     host    = cp_str(h);
        !            69:     ctlserv = cp_str(c);
        !            70:     oxprog  = cp_str(p);
        !            71:     return 0;
        !            72: }
        !            73:
        !            74: int main(int argc, char *argv[])
        !            75: {
        !            76:     MLMain(argc, argv);
        !            77: }

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