=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Doc/xml.sm1,v retrieving revision 1.1 retrieving revision 1.5 diff -u -p -r1.1 -r1.5 --- OpenXM/src/kan96xx/Doc/xml.sm1 1999/11/03 09:24:33 1.1 +++ OpenXM/src/kan96xx/Doc/xml.sm1 1999/12/14 10:00:45 1.5 @@ -1,7 +1,8 @@ -%% $OpenXM$ +%% $OpenXM: OpenXM/src/kan96xx/Doc/xml.sm1,v 1.4 1999/11/20 05:17:31 takayama Exp $ %% xml.sm1 XML support for sm1. %% This package requires ox.sm1 [(parse) (ox.sm1) pushfile] extension +(xml.sm1 : 1999, 11/20 Sat) message %%%%% These should be under /usr/local/OpenXM or OpenXM_HOME /oxpath.java-support (lib/java-support) def @@ -22,10 +23,13 @@ tag 0 eq { [(tdiv_qr) control .. (2000)..] mpzext 1 get (integer) dc 1025 add /control set [$($ ( cd ) oxpath.java-support ( ; ) +%% (/bin/csh -c ") ( java OMproxy ) ( -data ) data ( -control ) control - $)$ %% ( >& /dev/null ) %% Syntax error: Bad fd + ( > /dev/null ) +%% (") + $)$ ( & ) ] cat /com set (Executing the command ) messagen com message @@ -60,4 +64,246 @@ tag 0 eq { $ ( (x-1)^2 ). xml :: $ ]] putUsages +/xml_to_cmo { + /arg1 set + [/in-xml_to_cmo /ob] pushVariables + [ + /ob arg1 def + @@@.xml ob oxpushcmo + @@@.xml (OMXML2CMO) oxexec + @@@.xml oxpopcmo /arg1 set + ] pop + popVariables + arg1 +} def +[(xml_to_cmo) +[(xml-string xml_to_cmo cmo) + (Example: ) + ( xmlconnect ) + $ (5) xml_to_cmo :: $ + $ ( (x-1)^2 ). xml /aa set $ + $ aa xml_to_cmo :: $ +]] 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 + +/plus_Basic { + /arg1 set + [/in-plus_Basic /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 +/times_Basic { + /arg1 set + [/in-times_Basic /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 +/power_Basic { + /arg1 set + [/in-power_Basic /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 + %% concatenate the dictionary name to the function name. + /ans in 2 get { cmoTreeToPrefix } map bracketForm def + [in 0 get (_) dic ans ] cat /ans set + } ifelse + /arg1 ans def + ] pop + popVariables + arg1 +} def + +[(cmoTreeToPrefix) +[(tree-obj cmoTreeToPrefix prefix-str) + $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 + +/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