version 1.1.1.1, 1999/12/03 07:39:11 |
version 1.7, 2000/03/19 12:35:20 |
|
|
/* $OpenXM: OpenXM/src/asir99/io/tcpf.c,v 1.8 1999/11/19 10:41:08 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/io/tcpf.c,v 1.6 2000/01/26 02:05:34 noro Exp $ */ |
#if INET |
#if INET |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
Line 45 void Pox_launch(),Pox_launch_nox(),Pox_launch_main(); |
|
Line 45 void Pox_launch(),Pox_launch_nox(),Pox_launch_main(); |
|
void Pox_launch_generic(); |
void Pox_launch_generic(); |
void Pox_shutdown(); |
void Pox_shutdown(); |
|
|
void Pox_rpc(),Pox_cmo_rpc(),Pox_reset(),Pox_sync(),Pox_select(); |
void Pox_rpc(),Pox_cmo_rpc(),Pox_reset(),Pox_intr(),Pox_sync(),Pox_select(); |
|
|
void Pox_push_local(),Pox_push_cmo(),Pox_push_vl(),Pox_push_cmd(); |
void Pox_push_local(),Pox_push_cmo(),Pox_push_vl(),Pox_push_cmd(); |
|
|
Line 84 struct ftab tcp_tab[] = { |
|
Line 84 struct ftab tcp_tab[] = { |
|
{"ox_sync",Pox_sync,1}, |
{"ox_sync",Pox_sync,1}, |
#if !MPI |
#if !MPI |
{"ox_reset",Pox_reset,-2}, |
{"ox_reset",Pox_reset,-2}, |
|
{"ox_intr",Pox_intr,1}, |
{"ox_select",Pox_select,-2}, |
{"ox_select",Pox_select,-2}, |
#endif |
#endif |
|
|
Line 93 struct ftab tcp_tab[] = { |
|
Line 94 struct ftab tcp_tab[] = { |
|
{"ox_pop0_local",Pox_pop0_local,1}, |
{"ox_pop0_local",Pox_pop0_local,1}, |
{"ox_pop_cmo",Pox_pop_cmo,1}, |
{"ox_pop_cmo",Pox_pop_cmo,1}, |
{"ox_pop0_cmo",Pox_pop0_cmo,1}, |
{"ox_pop0_cmo",Pox_pop0_cmo,1}, |
{"ox_get",Pox_get,1}, |
{"ox_get",Pox_get,-1}, |
{"ox_pops",Pox_pops,-2}, |
{"ox_pops",Pox_pops,-2}, |
|
|
{"ox_push_vl",Pox_push_vl,1}, |
{"ox_push_vl",Pox_push_vl,1}, |
Line 113 struct ftab tcp_tab[] = { |
|
Line 114 struct ftab tcp_tab[] = { |
|
|
|
extern struct IOFP iofp[]; |
extern struct IOFP iofp[]; |
extern MATHCAP my_mathcap; |
extern MATHCAP my_mathcap; |
|
extern int ox_exchange_mathcap; |
|
|
char *getenv(); |
char *getenv(); |
|
|
|
|
/* register server to the server list */ |
/* register server to the server list */ |
ind = register_server(use_unix,cn,sn); |
ind = register_server(use_unix,cn,sn); |
|
|
/* request remote mathcap */ |
if ( ox_exchange_mathcap ) { |
ox_send_cmd(sn,SM_mathcap); |
/* request remote mathcap */ |
ox_send_cmd(sn,SM_popCMO); |
ox_send_cmd(sn,SM_mathcap); |
ox_flush_stream_force(sn); |
ox_send_cmd(sn,SM_popCMO); |
ox_recv(sn,&id,&server_mathcap); |
ox_flush_stream_force(sn); |
store_remote_mathcap(sn,server_mathcap); |
ox_recv(sn,&id,&server_mathcap); |
|
store_remote_mathcap(sn,server_mathcap); |
/* send my mathcap */ |
|
create_my_mathcap("asir"); |
/* send my mathcap */ |
ox_send_data(sn,my_mathcap); |
create_my_mathcap("asir"); |
ox_send_cmd(sn,SM_setMathcap); |
ox_send_data(sn,my_mathcap); |
|
ox_send_cmd(sn,SM_setMathcap); |
|
} |
/* return the server id */ |
/* return the server id */ |
STOQ(ind,*rp); |
STOQ(ind,*rp); |
} |
} |
|
|
/* register server to the server list */ |
/* register server to the server list */ |
ind = register_server(use_unix,cn,sn); |
ind = register_server(use_unix,cn,sn); |
|
|
/* request remote mathcap */ |
if ( ox_exchange_mathcap ) { |
ox_send_cmd(sn,SM_mathcap); |
/* request remote mathcap */ |
ox_send_cmd(sn,SM_popCMO); |
ox_send_cmd(sn,SM_mathcap); |
ox_flush_stream_force(sn); |
ox_send_cmd(sn,SM_popCMO); |
ox_recv(sn,&id,&server_mathcap); |
ox_flush_stream_force(sn); |
store_remote_mathcap(sn,server_mathcap); |
ox_recv(sn,&id,&server_mathcap); |
|
store_remote_mathcap(sn,server_mathcap); |
/* send my mathcap */ |
|
create_my_mathcap("asir"); |
/* send my mathcap */ |
ox_send_data(sn,my_mathcap); |
create_my_mathcap("asir"); |
ox_send_cmd(sn,SM_setMathcap); |
ox_send_data(sn,my_mathcap); |
|
ox_send_cmd(sn,SM_setMathcap); |
|
} |
/* return the server id */ |
/* return the server id */ |
STOQ(ind,*rp); |
STOQ(ind,*rp); |
} |
} |
Line 401 char *control_port_str,*server_port_str; |
|
Line 405 char *control_port_str,*server_port_str; |
|
conn_str = conn_to_serv ? "1" : "0"; |
conn_str = conn_to_serv ? "1" : "0"; |
rsh = use_ssh ? "ssh" : RSH; |
rsh = use_ssh ? "ssh" : RSH; |
gethostname(localhost,BUFSIZ); |
gethostname(localhost,BUFSIZ); |
|
#if !defined(VISUAL) |
if ( use_unix ) { |
if ( use_unix ) { |
if ( !fork() ) { |
if ( !fork() ) { |
|
setpgid(0,getpid()); |
if ( dname ) |
if ( dname ) |
execlp("xterm","xterm","-name",OX_XTERM,"-display",dname, |
execlp("xterm","xterm","-name",OX_XTERM,"-display",dname, |
"-geometry","60x10","-e",launcher,".",conn_str, |
"-geometry","60x10","-e",launcher,".",conn_str, |
Line 425 char *control_port_str,*server_port_str; |
|
Line 431 char *control_port_str,*server_port_str; |
|
fprintf(stderr,"%s\n",cmd); |
fprintf(stderr,"%s\n",cmd); |
sleep(20); |
sleep(20); |
/* system(cmd); */ |
/* system(cmd); */ |
} else { |
} else |
|
#endif /* VISUAL */ |
|
{ |
if ( dname ) |
if ( dname ) |
sprintf(cmd, |
sprintf(cmd, |
"%s -n %s \"xterm -name %s -display %s -geometry 60x10 -e %s %s %s %s %s %s %s>&/dev/null&\">/dev/null", |
"%s -n %s \"xterm -name %s -display %s -geometry 60x10 -e %s %s %s %s %s %s %s>&/dev/null&\">/dev/null", |
Line 735 void Pox_get(arg,rp) |
|
Line 743 void Pox_get(arg,rp) |
|
NODE arg; |
NODE arg; |
Obj *rp; |
Obj *rp; |
{ |
{ |
int index = QTOS((Q)ARG0(arg)); |
int index; |
int s; |
int s; |
|
|
valid_mctab_index(index); |
if ( !arg ) { |
s = m_c_tab[index].c; |
/* client->server */ |
ox_flush_stream_force(s); |
ox_get_result(0,rp); |
ox_get_result(s,rp); |
} else { |
|
/* server->client */ |
|
index = QTOS((Q)ARG0(arg)); |
|
valid_mctab_index(index); |
|
s = m_c_tab[index].c; |
|
ox_flush_stream_force(s); |
|
ox_get_result(s,rp); |
|
} |
} |
} |
|
|
void Pox_pops(arg,rp) |
void Pox_pops(arg,rp) |
|
|
*rp = 0; |
*rp = 0; |
} |
} |
|
|
|
void Pox_intr(arg,rp) |
|
NODE arg; |
|
Q *rp; |
|
{ |
|
int m; |
|
Obj obj; |
|
int index = QTOS((Q)ARG0(arg)); |
|
|
|
valid_mctab_index(index); |
|
m = m_c_tab[index].m; |
|
if ( m >= 0 ) { |
|
if ( argc(arg) == 1 ) { |
|
ox_send_cmd(m,SM_control_intr); |
|
ox_flush_stream_force(m); |
|
} |
|
*rp = ONE; |
|
} else |
|
*rp = 0; |
|
} |
|
|
void Pox_sync(arg,rp) |
void Pox_sync(arg,rp) |
NODE arg; |
NODE arg; |
Q *rp; |
Q *rp; |
Line 951 void Pox_push_cmd(arg,rp) |
|
Line 986 void Pox_push_cmd(arg,rp) |
|
NODE arg; |
NODE arg; |
Q *rp; |
Q *rp; |
{ |
{ |
unsigned int ui; |
int ui; |
int index = QTOS((Q)ARG0(arg)); |
int index = QTOS((Q)ARG0(arg)); |
|
|
valid_mctab_index(index); |
valid_mctab_index(index); |
ui = (unsigned int)QTOS((Q)ARG1(arg)); |
ui = QTOS((Q)ARG1(arg)); |
ox_send_cmd(m_c_tab[index].c,ui); |
ox_send_cmd(m_c_tab[index].c,ui); |
*rp = 0; |
*rp = 0; |
} |
} |