File: [local] / OpenXM / src / ox_maple / simple2.ml (download)
Revision 1.1, Fri Jul 2 13:10:43 2004 UTC (20 years, 3 months ago) by takayama
Branch: MAIN
CVS Tags: RELEASE_1_2_3_12, RELEASE_1_2_3, KNOPPIX_2006, DEB_REL_1_2_3-9
A sample implementation to call ox_asir from Maple.
Ctrl-C is handled by a heuristic way.
See comments in the source codes.
Example:
maple
read `simple2.ml`;
ox_start_asir();
ox_execute_string("fctr(x^1000-y^1000");");
ox_pop_string();
ctrl-C ===> ox_asir is restarted.
ox_execute_string("1+2;");
ox_pop_string();
|
# $OpenXM: OpenXM/src/ox_maple/simple2.ml,v 1.1 2004/07/02 13:10:43 takayama Exp $
ox_start_asir:=define_external(
'ml_start_asir',
'RETURN'::integer[4],
'LIB'="libsimple2.so");
ox_push_int:=define_external(
'ml_push_int',
'num1'::integer[4],
'RETURN'::integer[4],
'LIB'="libsimple2.so");
ox_execute_string:=define_external(
'ml_execute_string',
'num1'::string[],
'RETURN'::integer[4],
'LIB'="libsimple2.so");
ox_pop_string0:=define_external(
'ml_pop_string0',
'RETURN'::integer[4],
'LIB'="libsimple2.so");
ox_get_string:=define_external(
'ml_get_string',
'RETURN'::string[],
'LIB'="libsimple2.so");
ox_select:=define_external(
'ml_select',
'RETURN'::integer[4],
'LIB'="libsimple2.so");
ox_pop_string:=proc()
local c;
ox_pop_string0();
while true do
c := ox_select();
if (c = 1) then RETURN( ox_get_string()); end if;
if (c = -1) then RETURN(-1); end if ;
end do; # busy wait
end:
asir_gr:=proc(f,v,ord)
local sf,sv,sord;
sf := sprintf("%a",f);
sv := sprintf("%a",v);
sord := sprintf("%a",ord);
ox_execute_string(cat("gr(",sf,",",sv,",",sord,");"));
RETURN(parse(ox_pop_string()));
end :
# asir_gr([x^2+y^2-4,x*y-1],[x,y],2);