[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.6

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

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