[BACK]Return to xml.sm1 CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Doc

Annotation of OpenXM/src/kan96xx/Doc/xml.sm1, Revision 1.4

1.4     ! takayama    1: %% $OpenXM: OpenXM/src/kan96xx/Doc/xml.sm1,v 1.3 1999/11/11 08:06:44 takayama Exp $
1.1       takayama    2: %% xml.sm1  XML support for sm1.
                      3: %% This package requires ox.sm1
                      4: [(parse) (ox.sm1) pushfile] extension
1.4     ! takayama    5: (xml.sm1 :  1999, 11/20 Sat) message
1.1       takayama    6: %%%%% These should be under /usr/local/OpenXM or OpenXM_HOME
                      7: /oxpath.java-support (lib/java-support) def
                      8:
                      9: [(getenv) (OpenXM_HOME)] extension
                     10: tag 0 eq {
                     11:   /oxpath.java-support [(/usr/local/OpenXM/) oxpath.java-support] cat def
                     12: } {
                     13:   /oxpath.java-support [ [(getenv) (OpenXM_HOME)] extension (/) oxpath.java-support] cat def
                     14: } ifelse
                     15:
                     16: /xmlconnect {
                     17:  [/in-xmlconnect  /data /control /com] pushVariables
                     18:  [
                     19:   /data [(oxGenPass)] extension def
                     20:   /control [(oxGenPass)] extension def
                     21:   [data control] message
                     22:   [(tdiv_qr) data .. (2000)..] mpzext 1 get (integer) dc 1025 add /data set
                     23:   [(tdiv_qr) control .. (2000)..] mpzext 1 get (integer) dc 1025 add /control set
                     24:
                     25:  [$($ ( cd ) oxpath.java-support ( ; )
1.3       takayama   26: %% (/bin/csh -c ")
1.1       takayama   27:   ( java OMproxy )
                     28:   ( -data ) data ( -control ) control
1.3       takayama   29: %%  ( >& /dev/null )   %%  Syntax error: Bad fd
                     30:     ( > /dev/null )
                     31: %% (")
1.1       takayama   32:   $)$
                     33:   ( & )
                     34:  ] cat /com set
                     35:   (Executing the command ) messagen com message
                     36:   com system
                     37:   (sleep 5) system
                     38:   [(oxCreateClient) (localhost) data control] extension
                     39:   /@@@.xml set
                     40:  (The server is binded to the variable @@@.xml) message
                     41:   @@@.xml /arg1 set
                     42:  ] pop
                     43:  popVariables
                     44:  arg1
                     45: } def
                     46:
                     47: /xml {
                     48:   /arg1 set
                     49:   [/in-cmo2xml /ob] pushVariables
                     50:   [
                     51:      /ob arg1 def
                     52:      @@@.xml ob oxpushcmo
                     53:      @@@.xml (CMO2OMXML) oxexec
                     54:      @@@.xml oxpopcmo /arg1 set
                     55:   ] pop
                     56:   popVariables
                     57:   arg1
                     58: } def
                     59: [(xml)
                     60: [(object xml xml-string)
                     61:  (Example:   )
                     62:  (   xmlconnect )
                     63:  $   (12345).. xml :: $
                     64:  $   ( (x-1)^2 ). xml :: $
1.2       takayama   65: ]] putUsages
                     66:
                     67: /xml_to_cmo {
                     68:   /arg1 set
                     69:   [/in-xml_to_cmo /ob] pushVariables
                     70:   [
                     71:      /ob arg1 def
                     72:      @@@.xml ob oxpushcmo
                     73:      @@@.xml (OMXML2CMO) oxexec
                     74:      @@@.xml oxpopcmo /arg1 set
                     75:   ] pop
                     76:   popVariables
                     77:   arg1
                     78: } def
                     79: [(xml_to_cmo)
                     80: [(xml-string xml_to_cmo cmo)
                     81:  (Example:   )
                     82:  (   xmlconnect )
                     83:  $   (<OMOBJ><OMI>5</OMI></OMOBJ>) xml_to_cmo :: $
                     84:  $   ( (x-1)^2 ). xml /aa set $
                     85:  $   aa xml_to_cmo :: $
1.1       takayama   86: ]] putUsages
                     87:
1.3       takayama   88:
                     89: /t_aux {
                     90:   /arg1 set
                     91:   [/in-t_aux /ob /r /r2] pushVariables
                     92:   [
                     93:      /ob arg1 def
                     94:      (_______________________________________) message
                     95:      (tag = ) messagen ob tag messagen (, ) messagen
                     96:      (Sending object :) messagen ob message
                     97:      ob xml /r set
                     98:      (XML expression is:) messagen r message
                     99:      r xml_to_cmo /r2 set
                    100:      (XML to CMO :) messagen r2 message
                    101:      (~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~) message
                    102:   ] pop
                    103:   popVariables
                    104: } def
                    105:
                    106: %% Just type in OMproxy-testsuits1
                    107: /OMproxy-testsuits1 {
                    108:   xmlconnect
                    109:
                    110:   @@@.xml oxmathcap
                    111:   (Mathcap is ) messagen @@@.xml message
                    112:
                    113:   null t_aux
                    114:   123  t_aux
1.4     ! takayama  115:   (Hello World) t_aux  %% was error in XML to CMO.
1.3       takayama  116: %  [1 2 3] t_aux  %% not supported.
                    117:   (123123).. t_aux
                    118: %  (-12).. (12345).. div t_aux  %% not supported in sm1.
1.4     ! takayama  119:   (x^2-1). t_aux %% was not supported.  CMO_DMS_GENERIC??
1.3       takayama  120:
                    121:   (End) message
                    122: } def
1.1       takayama  123:
1.4     ! takayama  124: /cmoTreeToPostfix {
        !           125:   /arg1 set
        !           126:   [/in-cmoTreeToPostfix /in /ans /dic] pushVariables
        !           127:   [
        !           128:     /in arg1 def
        !           129:     in etag 263 eq not
        !           130:     {  /ans in toStringForParse def }
        !           131:     {
        !           132:       in (array) dc /in set
        !           133:       /dic in 1 get def
        !           134:       %% concatenate the dictionary name to the function name.
        !           135:       /ans in 2 get { cmoTreeToPostfix } map toString def
        !           136:       [ ans ( )  in 0 get (_) dic] cat /ans set
        !           137:     } ifelse
        !           138:     /arg1 ans def
        !           139:   ] pop
        !           140:   popVariables
        !           141:   arg1
        !           142: } def
        !           143:
        !           144: [(cmoTreeToPostfix)
        !           145: [(tree-obj cmoTreeToPostfix postfix-str)
        !           146:  $Example 1: [(plus) (Basic) [(123).. (345)..]] [(class) (tree)] dc /ff set$
        !           147:  $         ff cmoTreeToPostfix /gg set $
        !           148:  $         [(parse) gg] extension pop :: $
        !           149:  $Example 2: ( (x-T-2)^5). /p set $
        !           150:  $          p [(class) (recursivePolynomial)] dc xml /ff set $
        !           151:  $         ff xml_to_cmo cmoTreeToPostfix /gg set $
        !           152:  $         [(parse) gg] extension pop p sub :: $
        !           153: ]] putUsages
        !           154:
        !           155: /toStringForParse {
        !           156:   /arg1 set
        !           157:   [/in-toStringForParse /f /ans] pushVariables
        !           158:   [
        !           159:     /f arg1 def
        !           160:     f isUniversalNumber {
        !           161:      /ans [ $ ($ f toString $).. $] cat def
        !           162:      /@@@.LLL goto
        !           163:     } { } ifelse
        !           164:     f isPolynomial {
        !           165:      /ans [ $ ($ f toString $). $] cat def
        !           166:      /@@@.LLL goto
        !           167:     } { } ifelse
        !           168:     f etag 262 eq {  %% indeterminate
        !           169:      /ans [ $ ($ f (string) dc toString $). $] cat def
        !           170:      /@@@.LLL goto
        !           171:     } { } ifelse
        !           172:     f toString /ans set
        !           173:     /@@@.LLL
        !           174:     /arg1 ans def
        !           175:   ] pop
        !           176:   popVariables
        !           177:   arg1
        !           178: } def
        !           179:
        !           180: /plus_Basic {
        !           181:   /arg1 set
        !           182:   [/in-plus_Basic /s /a /n /i] pushVariables
        !           183:   [
        !           184:     /a arg1 def
        !           185:     /s a 0 get def
        !           186:     /n a length 1 sub def
        !           187:     1 1 n {
        !           188:       /i set
        !           189:       s a i get add /s set
        !           190:     } for
        !           191:     s /arg1 set
        !           192:   ] pop
        !           193:   popVariables
        !           194:   arg1
        !           195: } def
        !           196: /times_Basic {
        !           197:   /arg1 set
        !           198:   [/in-times_Basic /s /a /n /i] pushVariables
        !           199:   [
        !           200:     /a arg1 def
        !           201:     /s a 0 get def
        !           202:     /n a length 1 sub def
        !           203:     1 1 n {
        !           204:       /i set
        !           205:       s a i get mul /s set
        !           206:     } for
        !           207:     s /arg1 set
        !           208:   ] pop
        !           209:   popVariables
        !           210:   arg1
        !           211: } def
        !           212: /power_Basic {
        !           213:   /arg1 set
        !           214:   [/in-power_Basic /a ] pushVariables
        !           215:   [
        !           216:     /a arg1 def
        !           217:     a 0 get a 1 get power /arg1 set
        !           218:   ] pop
        !           219:   popVariables
        !           220:   arg1
        !           221: } def
        !           222:
        !           223:
        !           224: /cmoTreeToPrefix {
        !           225:   /arg1 set
        !           226:   [/in-cmoTreeToPostfix /in /ans /dic] pushVariables
        !           227:   [
        !           228:     /in arg1 def
        !           229:     in etag 263 eq not
        !           230:     {  /ans in toStringForParse2 def }
        !           231:     {
        !           232:       in (array) dc /in set
        !           233:       /dic in 1 get def
        !           234:       %% concatenate the dictionary name to the function name.
        !           235:       /ans in 2 get { cmoTreeToPrefix } map bracketForm def
        !           236:       [in 0 get (_) dic ans ] cat /ans set
        !           237:     } ifelse
        !           238:     /arg1 ans def
        !           239:   ] pop
        !           240:   popVariables
        !           241:   arg1
        !           242: } def
        !           243:
        !           244: [(cmoTreeToPrefix)
        !           245: [(tree-obj cmoTreeToPrefix prefix-str)
        !           246:  $Example 1: [(plus) (Basic) [(123).. (345)..]] [(class) (tree)] dc /ff set$
        !           247:  $         ff cmoTreeToPrefix /gg set $
        !           248:  $Example 2: ( (x-T-2)^5). /p set $
        !           249:  $          p [(class) (recursivePolynomial)] dc xml /ff set $
        !           250:  $         ff xml_to_cmo cmoTreeToPrefix /gg set $
        !           251: ]] putUsages
        !           252:
        !           253:
        !           254: /bracketForm {
        !           255:   /arg1 set
        !           256:   [/in-bracketForm /ans /f /i /n] pushVariables
        !           257:   [
        !           258:     /f arg1 def
        !           259:     /n f length 1 sub def
        !           260:     [ $($
        !           261:       0 1 n 1 sub {
        !           262:         /i set
        !           263:         f i get toStringForParse2
        !           264:         (,)
        !           265:       } for
        !           266:       f n get toStringForParse2
        !           267:       $)$
        !           268:     ] cat /arg1 set
        !           269:   ] pop
        !           270:   popVariables
        !           271:   arg1
        !           272: } def
        !           273:
        !           274: /toStringForParse2 {
        !           275:   /arg1 set
        !           276:   [/in-toStringForParse2 /f /ans] pushVariables
        !           277:   [
        !           278:     /f arg1 def
        !           279:     f etag 262 eq {  %% indeterminate
        !           280:      /ans  f (string) dc def
        !           281:      /@@@.LLL goto
        !           282:     } { } ifelse
        !           283:     f toString /ans set
        !           284:     /@@@.LLL
        !           285:     /arg1 ans def
        !           286:   ] pop
        !           287:   popVariables
        !           288:   arg1
        !           289: } def

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>