=================================================================== RCS file: /home/cvs/OpenXM/src/ox_math/serv1.c,v retrieving revision 1.1.1.1 retrieving revision 1.8 diff -u -p -r1.1.1.1 -r1.8 --- OpenXM/src/ox_math/serv1.c 1999/10/29 08:06:41 1.1.1.1 +++ OpenXM/src/ox_math/serv1.c 2000/01/22 06:29:18 1.8 @@ -1,7 +1,15 @@ /* -*- mode: C; coding: euc-japan -*- */ -/* $OpenXM$ */ -/* $Id: serv1.c,v 1.1.1.1 1999/10/29 08:06:41 ohara Exp $ */ +/* $OpenXM: OpenXM/src/ox_math/serv1.c,v 1.7 2000/01/05 06:09:11 ohara Exp $ */ +/* + Copyright (C) Katsuyoshi OHARA, 2000. + Portions copyright 1999 Wolfram Research, Inc. + + You must see OpenXM/Copyright/Copyright.generic. + The MathLink Library is licensed from Wolfram Research Inc.. + See OpenXM/Copyright/Copyright.mathlink for detail. +*/ + #include #include #include @@ -11,14 +19,15 @@ #include "ox.h" #include "serv2.h" -extern MLINK lp; +static int send_ox_sync_ball(int fd); + static int sv_read = 3; static int sv_write = 4; static int flag_sigusr1 = 0; static int flag_sigusr2 = 0; -/* 1 のとき割り込み禁止 */ +/* if in_critical equals to 1 then we do not permit an interrupt. */ static int in_critical = 0; static int set_critical() @@ -79,7 +88,7 @@ static int exchange_ox_syncball(int fd) fprintf(stderr, "received a sync_ball.\n"); } -/* スタックマシン部分 */ +/* a part of stack machine. */ int receive_ox(int fd_read, int fd_write) { int tag; @@ -104,16 +113,23 @@ int receive_ox(int fd_read, int fd_write) return 0; } +int shutdown() +{ + close(sv_read); + close(sv_write); + ml_exit(); + exit(0); +} + int main() { - MATH_init(); + ml_init(); initialize_stack(); signal(SIGUSR1, handler_reset1); signal(SIGKILL, handler_kill); - /* バイトオーダの決定 */ - decideByteOrder2(sv_read, sv_write, 0); + decideByteOrderServer(sv_read, 0); while(1) { receive_ox(sv_read, sv_write); @@ -127,5 +143,5 @@ int main() already_send_ox_sync_ball = 0; } } - MATH_exit(); + shutdown(); }