version 1.1, 2018/09/19 05:45:08 |
version 1.4, 2020/10/06 06:31:20 |
|
|
* OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY |
* OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* $OpenXM$ |
* $OpenXM: OpenXM_contrib2/asir2018/io/ox_asir.c,v 1.3 2019/12/13 14:40:50 fujimoto Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
Line 175 void ox_main(int argc,char **argv) { |
|
Line 175 void ox_main(int argc,char **argv) { |
|
break; |
break; |
if ( do_message ) |
if ( do_message ) |
fprintf(stderr," %s\n",name_of_cmd(cmd)); |
fprintf(stderr," %s\n",name_of_cmd(cmd)); |
if ( ret = SETJMP(main_env) ) { |
if ( ( ret = SETJMP(main_env) ) != 0 ) { |
if ( ret == 1 ) { |
if ( ret == 1 ) { |
create_error(&err,serial,LastError,LastStackTrace); |
create_error(&err,serial,LastError,LastStackTrace); |
asir_push_one((Obj)err); |
asir_push_one((Obj)err); |
Line 220 static void asir_do_cmd(int cmd,unsigned int serial) |
|
Line 220 static void asir_do_cmd(int cmd,unsigned int serial) |
|
break; |
break; |
case SM_getsp: |
case SM_getsp: |
i = asir_OperandStackPtr+1; |
i = asir_OperandStackPtr+1; |
STOQ(i,q); |
STOZ(i,q); |
asir_push_one((Obj)q); |
asir_push_one((Obj)q); |
break; |
break; |
case SM_popSerializedLocalObject: |
case SM_popSerializedLocalObject: |
Line 452 void asir_reduce_102(unsigned int serial) |
|
Line 452 void asir_reduce_102(unsigned int serial) |
|
op = (STRING)asir_pop_one(); |
op = (STRING)asir_pop_one(); |
opname = BDY(op); |
opname = BDY(op); |
r = (Q)asir_pop_one(); |
r = (Q)asir_pop_one(); |
root = QTOS(r); |
root = ZTOS(r); |
if ( !strcmp(opname,"+") ) |
if ( !strcmp(opname,"+") ) |
func = arf_add; |
func = arf_add; |
else if ( !strcmp(opname,"*") ) |
else if ( !strcmp(opname,"*") ) |
Line 471 void asir_bcast_102(unsigned int serial) |
|
Line 471 void asir_bcast_102(unsigned int serial) |
|
Obj data; |
Obj data; |
|
|
r = (Q)asir_pop_one(); |
r = (Q)asir_pop_one(); |
root = QTOS(r); |
root = ZTOS(r); |
ox_bcast_102(root); |
ox_bcast_102(root); |
} |
} |
|
|
Line 502 void asir_set_rank_102(unsigned int serial) |
|
Line 502 void asir_set_rank_102(unsigned int serial) |
|
if ( !nserver || !INT(nserver) || !INT(rank) ) { |
if ( !nserver || !INT(nserver) || !INT(rank) ) { |
stat = -1; |
stat = -1; |
} else { |
} else { |
n = QTOS(nserver); r = QTOS(rank); |
n = ZTOS(nserver); r = ZTOS(rank); |
if ( n <= 0 || r < 0 || r >= n ) { |
if ( n <= 0 || r < 0 || r >= n ) { |
stat = -1; |
stat = -1; |
} |
} |
Line 527 void asir_tcp_accept_102(unsigned int serial) |
|
Line 527 void asir_tcp_accept_102(unsigned int serial) |
|
r = (Q)asir_pop_one(); |
r = (Q)asir_pop_one(); |
p = (Q)asir_pop_one(); |
p = (Q)asir_pop_one(); |
if ( IS_CYGWIN || !p || NUM(p) ) { |
if ( IS_CYGWIN || !p || NUM(p) ) { |
port = QTOS(p); |
port = ZTOS(p); |
sprintf(port_str,"%d",port); |
sprintf(port_str,"%d",port); |
use_unix = 0; |
use_unix = 0; |
} else { |
} else { |
Line 536 void asir_tcp_accept_102(unsigned int serial) |
|
Line 536 void asir_tcp_accept_102(unsigned int serial) |
|
} |
} |
s = try_bind_listen(use_unix,port_str); |
s = try_bind_listen(use_unix,port_str); |
s = try_accept(use_unix,s); |
s = try_accept(use_unix,s); |
rank = QTOS((Q)r); |
rank = ZTOS((Q)r); |
if ( register_102(s,rank,1) < 0 ) { |
if ( register_102(s,rank,1) < 0 ) { |
create_error(&err,serial, |
create_error(&err,serial, |
"failed to bind or accept in ox_tcp_accept_102",0); |
"failed to bind or accept in ox_tcp_accept_102",0); |
Line 558 void asir_tcp_connect_102(unsigned int serial) |
|
Line 558 void asir_tcp_connect_102(unsigned int serial) |
|
p = (Q)asir_pop_one(); |
p = (Q)asir_pop_one(); |
h = (STRING)asir_pop_one(); |
h = (STRING)asir_pop_one(); |
if ( IS_CYGWIN || !p || NUM(p) ) { |
if ( IS_CYGWIN || !p || NUM(p) ) { |
port = QTOS(p); |
port = ZTOS(p); |
sprintf(port_str,"%d",port); |
sprintf(port_str,"%d",port); |
use_unix = 0; |
use_unix = 0; |
host = BDY((STRING)h); |
host = BDY((STRING)h); |
Line 568 void asir_tcp_connect_102(unsigned int serial) |
|
Line 568 void asir_tcp_connect_102(unsigned int serial) |
|
host = 0; |
host = 0; |
} |
} |
s = try_connect(use_unix,host,port_str); |
s = try_connect(use_unix,host,port_str); |
rank = QTOS((Q)r); |
rank = ZTOS((Q)r); |
if ( register_102(s,rank,1) < 0 ) { |
if ( register_102(s,rank,1) < 0 ) { |
create_error(&err,serial, |
create_error(&err,serial, |
"failed to connect in ox_tcp_connect_102",0); |
"failed to connect in ox_tcp_connect_102",0); |
Line 1000 void ox_io_init() { |
|
Line 1000 void ox_io_init() { |
|
extern int I_am_server; |
extern int I_am_server; |
|
|
/* XXX : ssh forwards stdin to a remote host on PC Unix */ |
/* XXX : ssh forwards stdin to a remote host on PC Unix */ |
#if defined(linux) |
#if defined(ANDROID) |
|
#include <sys/resource.h> |
|
int i; |
|
struct rlimit rl; |
|
|
|
getrlimit(RLIMIT_NOFILE,&rl); |
|
close(0); |
|
for ( i = 5; i < rl.rlim_cur; i++ ) |
|
close(i); |
|
#elif defined(linux) |
#include <sys/param.h> |
#include <sys/param.h> |
int i; |
int i; |
|
|
Line 1129 void asir_ox_push_cmd(int cmd) |
|
Line 1138 void asir_ox_push_cmd(int cmd) |
|
ERR err; |
ERR err; |
extern char LastError[]; |
extern char LastError[]; |
|
|
if ( ret = SETJMP(main_env) ) { |
if ( ( ret = SETJMP(main_env) ) != 0 ) { |
asir_reset_handler(); |
asir_reset_handler(); |
if ( ret == 1 ) { |
if ( ret == 1 ) { |
create_error(&err,0,LastError,LastStackTrace); /* XXX */ |
create_error(&err,0,LastError,LastStackTrace); /* XXX */ |
Line 1156 void asir_ox_execute_string(char *s) |
|
Line 1165 void asir_ox_execute_string(char *s) |
|
|
|
MKSTR(str,s); |
MKSTR(str,s); |
asir_push_one((Obj)str); |
asir_push_one((Obj)str); |
if ( ret = SETJMP(main_env) ) { |
if ( ( ret = SETJMP(main_env) ) != 0 ) { |
asir_reset_handler(); |
asir_reset_handler(); |
if ( ret == 1 ) { |
if ( ret == 1 ) { |
create_error(&err,0,LastError,LastStackTrace); /* XXX */ |
create_error(&err,0,LastError,LastStackTrace); /* XXX */ |