version 1.28, 2015/08/18 05:35:17 |
version 1.29, 2015/08/19 05:29:23 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/builtin/parif.c,v 1.27 2015/08/18 02:31:32 noro Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/builtin/parif.c,v 1.28 2015/08/18 05:35:17 noro Exp $ */ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
#include "ox.h" |
#include "ox.h" |
|
|
Q ox_pari_stream; |
Q ox_pari_stream; |
int ox_pari_stream_initialized = 0; |
int ox_pari_stream_initialized = 0; |
|
int ox_get_pari_result = 0; |
|
|
typedef void (*mpfr_func)(NODE,Obj *); |
typedef void (*mpfr_func)(NODE,Obj *); |
|
|
Line 62 Obj list_to_vect(Obj a) |
|
Line 63 Obj list_to_vect(Obj a) |
|
return (Obj)v; |
return (Obj)v; |
} |
} |
|
|
|
void reset_ox_pari() |
|
{ |
|
NODE nd; |
|
Obj r; |
|
|
|
if ( ox_get_pari_result ) { |
|
nd = mknode(1,ox_pari_stream); |
|
Pox_shutdown(nd,&r); |
|
ox_get_pari_result = 0; |
|
ox_pari_stream_initialized = 0; |
|
} |
|
} |
|
|
pointer evalparif(FUNC f,NODE arg) |
pointer evalparif(FUNC f,NODE arg) |
{ |
{ |
int ac,intarg,opt,prec; |
int ac,intarg,opt,prec; |
Line 78 pointer evalparif(FUNC f,NODE arg) |
|
Line 92 pointer evalparif(FUNC f,NODE arg) |
|
} |
} |
|
|
if ( !ox_pari_stream_initialized ) { |
if ( !ox_pari_stream_initialized ) { |
MKSTR(name,"ox_pari"); |
MKSTR(name,"ox_pari"); |
nd = mknode(2,NULL,name); |
nd = mknode(2,NULL,name); |
Pox_launch_nox(nd,&r); |
Pox_launch_nox(nd,&r); |
ox_pari_stream = r; |
ox_pari_stream = r; |
ox_pari_stream_initialized = 1; |
ox_pari_stream_initialized = 1; |
} |
} |
|
|
Line 100 pointer evalparif(FUNC f,NODE arg) |
|
Line 114 pointer evalparif(FUNC f,NODE arg) |
|
oxarg = mknode(3,ox_pari_stream,name,narg); |
oxarg = mknode(3,ox_pari_stream,name,narg); |
Pox_execute_function(oxarg,&dmy); |
Pox_execute_function(oxarg,&dmy); |
oxarg = mknode(1,ox_pari_stream); |
oxarg = mknode(1,ox_pari_stream); |
|
ox_get_pari_result = 1; |
Pox_pop_cmo(oxarg,&ret); |
Pox_pop_cmo(oxarg,&ret); |
|
ox_get_pari_result = 0; |
if ( ret && OID(ret) == O_LIST ) |
if ( ret && OID(ret) == O_LIST ) |
ret = list_to_vect(ret); |
ret = list_to_vect(ret); |
return ret; |
return ret; |