version 1.48, 2003/12/12 04:59:59 |
version 1.56, 2004/03/11 07:40:42 |
|
|
* 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_contrib2/asir2000/io/ox_asir.c,v 1.47 2003/12/11 05:48:04 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/io/ox_asir.c,v 1.55 2004/03/09 07:18:26 noro Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
Line 59 void ox_usr1_handler(); |
|
Line 59 void ox_usr1_handler(); |
|
int asir_ox_init(); |
int asir_ox_init(); |
|
|
/* environement is defined in libpari.a */ |
/* environement is defined in libpari.a */ |
|
# if !( PARI_VERSION_CODE > 131588) |
extern jmp_buf environnement; |
extern jmp_buf environnement; |
|
# endif |
extern int myrank_102,nserver_102; |
extern int myrank_102,nserver_102; |
|
|
extern int do_message; |
extern int do_message; |
Line 153 void ox_main(int argc,char **argv) { |
|
Line 155 void ox_main(int argc,char **argv) { |
|
if ( SETJMP(ox_env) ) { |
if ( SETJMP(ox_env) ) { |
while ( NEXT(asir_infile) ) |
while ( NEXT(asir_infile) ) |
closecurrentinput(); |
closecurrentinput(); |
|
resetpvs(); |
|
reset_engine(); |
|
reset_io(); |
ox_send_sync(0); |
ox_send_sync(0); |
} |
} |
while ( 1 ) { |
while ( 1 ) { |
Line 183 void ox_main(int argc,char **argv) { |
|
Line 188 void ox_main(int argc,char **argv) { |
|
if ( ret == 1 ) { |
if ( ret == 1 ) { |
create_error(&err,serial,LastError); |
create_error(&err,serial,LastError); |
asir_push_one((Obj)err); |
asir_push_one((Obj)err); |
|
while ( NEXT(asir_infile) ) |
|
closecurrentinput(); |
} |
} |
break; |
break; |
} |
} |
Line 479 void asir_reset_102(unsigned int serial) |
|
Line 486 void asir_reset_102(unsigned int serial) |
|
do { |
do { |
ox_recv_102(i,&id,&obj); |
ox_recv_102(i,&id,&obj); |
} while ( id != OX_SYNC_BALL ); |
} while ( id != OX_SYNC_BALL ); |
for ( i = myrank_102; i < nserver_102; i++ ) |
for ( i = myrank_102+1; i < nserver_102; i++ ) |
ox_send_sync_102(i); |
ox_send_sync_102(i); |
} |
} |
|
|
Line 556 void asir_tcp_connect_102(unsigned int serial) |
|
Line 563 void asir_tcp_connect_102(unsigned int serial) |
|
port = QTOS(p); |
port = QTOS(p); |
sprintf(port_str,"%d",port); |
sprintf(port_str,"%d",port); |
use_unix = 0; |
use_unix = 0; |
|
host = BDY((STRING)h); |
} else { |
} else { |
strcpy(port_str,BDY((STRING)p)); |
strcpy(port_str,BDY((STRING)p)); |
use_unix = 1; |
use_unix = 1; |
|
host = 0; |
} |
} |
host = BDY((STRING)h); |
|
s = try_connect(use_unix,host,port_str); |
s = try_connect(use_unix,host,port_str); |
rank = QTOS((Q)r); |
rank = QTOS((Q)r); |
if ( register_102(s,rank,1) < 0 ) { |
if ( register_102(s,rank,1) < 0 ) { |
Line 590 void asir_pushCMOtag(unsigned int serial) |
|
Line 598 void asir_pushCMOtag(unsigned int serial) |
|
void asir_popString() |
void asir_popString() |
{ |
{ |
Obj val; |
Obj val; |
char *buf,*obuf; |
char *buf; |
int l; |
int l; |
STRING str; |
STRING str; |
|
|
val = asir_pop_one(); |
val = asir_pop_one(); |
if ( !val ) |
if ( !val ) |
obuf = "0"; |
buf = "0"; |
else { |
else { |
l = estimate_length(CO,val); |
l = estimate_length(CO,val); |
buf = (char *)ALLOCA(l+1); |
buf = (char *)ALLOCA(l+1); |
soutput_init(buf); |
soutput_init(buf); |
sprintexpr(CO,val); |
sprintexpr(CO,val); |
l = strlen(buf); |
|
obuf = (char *)MALLOC(l+1); |
|
strcpy(obuf,buf); |
|
} |
} |
MKSTR(str,obuf); |
MKSTR(str,buf); |
ox_send_data(0,str); |
ox_send_data(0,str); |
} |
} |
|
|
Line 661 void asir_evalName(unsigned int serial) |
|
Line 666 void asir_evalName(unsigned int serial) |
|
asir_push_one(val); |
asir_push_one(val); |
} |
} |
|
|
|
char *augment_backslash(char *s) |
|
{ |
|
char *p,*r; |
|
int i; |
|
|
|
for ( i = 0, p = s; *p; p++, i++ ) if ( *p == '\\' ) i++; |
|
r = (char *)MALLOC_ATOMIC((i+1)*sizeof(char)); |
|
for ( i = 0, p = s; *p; p++, i++ ) { |
|
if ( *p == '\\' ) r[i++] = '\\'; |
|
r[i] = *p; |
|
} |
|
return r; |
|
} |
|
|
int asir_executeString() |
int asir_executeString() |
{ |
{ |
SNODE snode; |
SNODE snode; |
Line 669 int asir_executeString() |
|
Line 688 int asir_executeString() |
|
#if defined(PARI) |
#if defined(PARI) |
recover(0); |
recover(0); |
/* environement is defined in libpari.a */ |
/* environement is defined in libpari.a */ |
|
# if !(PARI_VERSION_CODE > 131588 ) |
if ( setjmp(environnement) ) { |
if ( setjmp(environnement) ) { |
avma = top; recover(1); |
avma = top; recover(1); |
resetenv(""); |
resetenv(""); |
} |
} |
|
# endif |
#endif |
#endif |
cmd = ((STRING)asir_pop_one())->body; |
cmd = ((STRING)asir_pop_one())->body; |
parse_strp = cmd; |
parse_strp = augment_backslash(cmd); |
if ( mainparse(&snode) ) { |
if ( mainparse(&snode) ) { |
return -1; |
return -1; |
} |
} |