version 1.2, 1999/11/08 11:12:06 |
version 1.8, 2000/02/28 14:10:29 |
|
|
%% $OpenXM: OpenXM/src/kan96xx/Doc/xml.sm1,v 1.1 1999/11/03 09:24:33 takayama Exp $ |
%% $OpenXM: OpenXM/src/kan96xx/Doc/xml.sm1,v 1.7 2000/02/28 13:22:27 takayama Exp $ |
%% xml.sm1 XML support for sm1. |
%% xml.sm1 XML support for sm1. |
%% This package requires ox.sm1 |
%% This package requires ox.sm1 |
[(parse) (ox.sm1) pushfile] extension |
[(parse) (ox.sm1) pushfile] extension |
|
(xml.sm1 : 1999, 11/20 Sat) message |
%%%%% These should be under /usr/local/OpenXM or OpenXM_HOME |
%%%%% These should be under /usr/local/OpenXM or OpenXM_HOME |
/oxpath.java-support (lib/java-support) def |
/oxpath.java-support (lib/java-support) def |
|
/@@@.xml null def |
|
|
[(getenv) (OpenXM_HOME)] extension |
[(getenv) (OpenXM_HOME)] extension |
tag 0 eq { |
tag 0 eq { |
|
|
[(tdiv_qr) control .. (2000)..] mpzext 1 get (integer) dc 1025 add /control set |
[(tdiv_qr) control .. (2000)..] mpzext 1 get (integer) dc 1025 add /control set |
|
|
[$($ ( cd ) oxpath.java-support ( ; ) |
[$($ ( cd ) oxpath.java-support ( ; ) |
|
%% (/bin/csh -c ") |
( java OMproxy ) |
( java OMproxy ) |
( -data ) data ( -control ) control |
( -data ) data ( -control ) control |
$)$ |
|
%% ( >& /dev/null ) %% Syntax error: Bad fd |
%% ( >& /dev/null ) %% Syntax error: Bad fd |
|
( > /dev/null ) |
|
%% (") |
|
$)$ |
( & ) |
( & ) |
] cat /com set |
] cat /com set |
(Executing the command ) messagen com message |
(Executing the command ) messagen com message |
|
|
[/in-cmo2xml /ob] pushVariables |
[/in-cmo2xml /ob] pushVariables |
[ |
[ |
/ob arg1 def |
/ob arg1 def |
|
@@@.xml tag 0 eq { |
|
xmlconnect |
|
}{ } ifelse |
@@@.xml ob oxpushcmo |
@@@.xml ob oxpushcmo |
|
@@@.xml 1 oxpushcmo |
@@@.xml (CMO2OMXML) oxexec |
@@@.xml (CMO2OMXML) oxexec |
@@@.xml oxpopcmo /arg1 set |
@@@.xml oxpopcmo /arg1 set |
] pop |
] pop |
|
|
[/in-xml_to_cmo /ob] pushVariables |
[/in-xml_to_cmo /ob] pushVariables |
[ |
[ |
/ob arg1 def |
/ob arg1 def |
|
@@@.xml tag 0 eq { |
|
xmlconnect |
|
}{ } ifelse |
@@@.xml ob oxpushcmo |
@@@.xml ob oxpushcmo |
|
@@@.xml 1 oxpushcmo |
@@@.xml (OMXML2CMO) oxexec |
@@@.xml (OMXML2CMO) oxexec |
@@@.xml oxpopcmo /arg1 set |
@@@.xml oxpopcmo /arg1 set |
] pop |
] pop |
|
|
$ ( (x-1)^2 ). xml /aa set $ |
$ ( (x-1)^2 ). xml /aa set $ |
$ aa xml_to_cmo :: $ |
$ aa xml_to_cmo :: $ |
]] putUsages |
]] putUsages |
|
|
|
|
|
/t_aux { |
|
/arg1 set |
|
[/in-t_aux /ob /r /r2] pushVariables |
|
[ |
|
/ob arg1 def |
|
(_______________________________________) message |
|
(tag = ) messagen ob tag messagen (, ) messagen |
|
(Sending object :) messagen ob message |
|
ob xml /r set |
|
(XML expression is:) messagen r message |
|
r xml_to_cmo /r2 set |
|
(XML to CMO :) messagen r2 message |
|
(~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) message |
|
] pop |
|
popVariables |
|
} def |
|
|
|
%% Just type in OMproxy-testsuits1 |
|
/OMproxy-testsuits1 { |
|
xmlconnect |
|
|
|
@@@.xml oxmathcap |
|
(Mathcap is ) messagen @@@.xml message |
|
|
|
null t_aux |
|
123 t_aux |
|
(Hello World) t_aux %% was error in XML to CMO. |
|
% [1 2 3] t_aux %% not supported. |
|
(123123).. t_aux |
|
% (-12).. (12345).. div t_aux %% not supported in sm1. |
|
(x^2-1). t_aux %% was not supported. CMO_DMS_GENERIC?? |
|
|
|
(End) message |
|
} def |
|
|
|
/cmoTreeToPostfix { |
|
/arg1 set |
|
[/in-cmoTreeToPostfix /in /ans /dic] pushVariables |
|
[ |
|
/in arg1 def |
|
in etag 263 eq not |
|
{ /ans in toStringForParse def } |
|
{ |
|
in (array) dc /in set |
|
/dic in 1 get def |
|
%% concatenate the dictionary name to the function name. |
|
/ans in 2 get { cmoTreeToPostfix } map toString def |
|
[ ans ( ) in 0 get (_) dic] cat /ans set |
|
} ifelse |
|
/arg1 ans def |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
[(cmoTreeToPostfix) |
|
[(tree-obj cmoTreeToPostfix postfix-str) |
|
$Example 1: [(plus) (basic) [(123).. (345)..]] [(class) (tree)] dc /ff set$ |
|
$ ff cmoTreeToPostfix /gg set $ |
|
$ [(parse) gg] extension pop :: $ |
|
$Example 2: ( (x-T-2)^5). /p set $ |
|
$ p [(class) (recursivePolynomial)] dc xml /ff set $ |
|
$ ff xml_to_cmo cmoTreeToPostfix /gg set $ |
|
$ [(parse) gg] extension pop p sub :: $ |
|
]] putUsages |
|
|
|
/toStringForParse { |
|
/arg1 set |
|
[/in-toStringForParse /f /ans] pushVariables |
|
[ |
|
/f arg1 def |
|
f isUniversalNumber { |
|
/ans [ $ ($ f toString $).. $] cat def |
|
/@@@.LLL goto |
|
} { } ifelse |
|
f isPolynomial { |
|
/ans [ $ ($ f toString $). $] cat def |
|
/@@@.LLL goto |
|
} { } ifelse |
|
f etag 262 eq { %% indeterminate |
|
/ans [ $ ($ f (string) dc toString $). $] cat def |
|
/@@@.LLL goto |
|
} { } ifelse |
|
f toString /ans set |
|
/@@@.LLL |
|
/arg1 ans def |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
/basic_plus { |
|
/arg1 set |
|
[/in-basic_plus /s /a /n /i] pushVariables |
|
[ |
|
/a arg1 def |
|
/s a 0 get def |
|
/n a length 1 sub def |
|
1 1 n { |
|
/i set |
|
s a i get add /s set |
|
} for |
|
s /arg1 set |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
/basic_times { |
|
/arg1 set |
|
[/in-basic_times /s /a /n /i] pushVariables |
|
[ |
|
/a arg1 def |
|
/s a 0 get def |
|
/n a length 1 sub def |
|
1 1 n { |
|
/i set |
|
s a i get mul /s set |
|
} for |
|
s /arg1 set |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
/basic_power { |
|
/arg1 set |
|
[/in-basic_power /a ] pushVariables |
|
[ |
|
/a arg1 def |
|
a 0 get a 1 get power /arg1 set |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
|
|
/cmoTreeToPrefix { |
|
/arg1 set |
|
[/in-cmoTreeToPostfix /in /ans /dic] pushVariables |
|
[ |
|
/in arg1 def |
|
in etag 263 eq not |
|
{ /ans in toStringForParse2 def } |
|
{ |
|
in (array) dc /in set |
|
/dic in 1 get def |
|
/dic dic tolower def |
|
%% concatenate the dictionary name to the function name. |
|
/ans in 2 get { cmoTreeToPrefix } map bracketForm def |
|
[dic (_) in 0 get ans ] cat /ans set |
|
} ifelse |
|
/arg1 ans def |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
[(cmoTreeToPrefix) |
|
[(tree-obj cmoTreeToPrefix prefix-str) |
|
(Dictionary names are translated to lower characters.) |
|
$Example 1: [(plus) (basic) [(123).. (345)..]] [(class) (tree)] dc /ff set$ |
|
$ ff cmoTreeToPrefix /gg set $ |
|
$Example 2: ( (x-T-2)^5). /p set $ |
|
$ p [(class) (recursivePolynomial)] dc xml /ff set $ |
|
$ ff xml_to_cmo cmoTreeToPrefix /gg set $ |
|
]] putUsages |
|
|
|
|
|
/bracketForm { |
|
/arg1 set |
|
[/in-bracketForm /ans /f /i /n] pushVariables |
|
[ |
|
/f arg1 def |
|
/n f length 1 sub def |
|
[ $($ |
|
0 1 n 1 sub { |
|
/i set |
|
f i get toStringForParse2 |
|
(,) |
|
} for |
|
f n get toStringForParse2 |
|
$)$ |
|
] cat /arg1 set |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
/toStringForParse2 { |
|
/arg1 set |
|
[/in-toStringForParse2 /f /ans] pushVariables |
|
[ |
|
/f arg1 def |
|
f etag 262 eq { %% indeterminate |
|
/ans f (string) dc def |
|
/@@@.LLL goto |
|
} { } ifelse |
|
f toString /ans set |
|
/@@@.LLL |
|
/arg1 ans def |
|
] pop |
|
popVariables |
|
arg1 |
|
} def |
|
|
|
/xml_tree_to_prefix_string { |
|
/arg1 set |
|
[/in-xml_tree_to_prefix_string /sss] pushVariables |
|
[ |
|
/sss arg1 def |
|
sss isString { |
|
}{ |
|
(string xml_tree_to_prefix_string) error |
|
}ifelse |
|
sss xml_to_cmo cmoTreeToPrefix /ans set |
|
/arg1 ans def |
|
] pop |
|
arg1 |
|
} def |
|
|
|
|
|
/OMproxy-testsuits2 { |
|
xmlconnect |
|
1 1 30 { |
|
/i set |
|
[( (x-T-2)^) i toString] cat . /p set |
|
p [(class) (recursivePolynomial)] dc xml /ff set |
|
ff xml_to_cmo cmoTreeToPostfix /gg set |
|
[(parse) gg] extension pop p sub /result set |
|
result (0). eq |
|
{ |
|
} |
|
{ |
|
(p = ) messagen p message |
|
(i=) messagen i message (Error in OMproxy-testsuits2 ) error |
|
} ifelse |
|
} for |
|
(Done.) message |
|
} def |
|
|
|
|
|
|
|
|