version 1.4, 1999/11/18 21:56:43 |
version 1.9, 2000/03/10 12:38:47 |
|
|
/* -*- mode: C; coding: euc-japan -*- */ |
/* -*- mode: C; coding: euc-japan -*- */ |
/* $OpenXM: OpenXM/src/ox_math/serv1.c,v 1.3 1999/11/03 10:56:40 ohara Exp $ */ |
/* $OpenXM: OpenXM/src/ox_math/serv1.c,v 1.8 2000/01/22 06:29:18 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 <stdio.h> |
#include <stdio.h> |
#include <stdlib.h> |
#include <stdlib.h> |
#include <unistd.h> |
#include <unistd.h> |
#include <signal.h> |
#include <signal.h> |
#include <gmp.h> |
|
#include <mathlink.h> |
#include <mathlink.h> |
#include "ox.h" |
#include <ox_toolkit.h> |
#include "serv2.h" |
#include "serv2.h" |
|
|
static int send_ox_sync_ball(int fd); |
static int send_ox_sync_ball(int fd); |
|
|
extern MLINK lp; |
|
static int sv_read = 3; |
static int sv_read = 3; |
static int sv_write = 4; |
static int sv_write = 4; |
|
|
static int flag_sigusr1 = 0; |
static int flag_sigusr1 = 0; |
static int flag_sigusr2 = 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 in_critical = 0; |
|
|
static int set_critical() |
static int set_critical() |
Line 80 static int exchange_ox_syncball(int fd) |
|
Line 87 static int exchange_ox_syncball(int fd) |
|
fprintf(stderr, "received a sync_ball.\n"); |
fprintf(stderr, "received a sync_ball.\n"); |
} |
} |
|
|
/* スタックマシン部分 */ |
/* a part of stack machine. */ |
int receive_ox(int fd_read, int fd_write) |
int receive_ox(int fd_read, int fd_write) |
{ |
{ |
int tag; |
int tag; |
Line 107 int receive_ox(int fd_read, int fd_write) |
|
Line 114 int receive_ox(int fd_read, int fd_write) |
|
|
|
int shutdown() |
int shutdown() |
{ |
{ |
close(sv_read); |
close(sv_read); |
MATH_exit(); |
close(sv_write); |
exit(0); |
ml_exit(); |
|
exit(0); |
} |
} |
|
|
int main() |
int main() |
{ |
{ |
MATH_init(); |
ml_init(); |
initialize_stack(); |
initialize_stack(); |
|
|
signal(SIGUSR1, handler_reset1); |
signal(SIGUSR1, handler_reset1); |
signal(SIGKILL, handler_kill); |
signal(SIGKILL, handler_kill); |
|
|
/* バイトオーダの決定 */ |
|
decideByteOrderServer(sv_read, 0); |
decideByteOrderServer(sv_read, 0); |
|
|
while(1) { |
while(1) { |