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

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

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