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

1.8     ! takayama    1: %% $OpenXM: OpenXM/src/kan96xx/Doc/xml.sm1,v 1.7 2000/02/28 13:22:27 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)
1.8     ! takayama  155:  $Example 1: [(plus) (basic) [(123).. (345)..]] [(class) (tree)] dc /ff set$
1.4       takayama  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:
1.8     ! takayama  189: /basic_plus {
1.4       takayama  190:   /arg1 set
1.8     ! takayama  191:   [/in-basic_plus /s /a /n /i] pushVariables
1.4       takayama  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
1.8     ! takayama  205: /basic_times {
1.4       takayama  206:   /arg1 set
1.8     ! takayama  207:   [/in-basic_times /s /a /n /i] pushVariables
1.4       takayama  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
1.8     ! takayama  221: /basic_power {
1.4       takayama  222:   /arg1 set
1.8     ! takayama  223:   [/in-basic_power /a ] pushVariables
1.4       takayama  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
1.8     ! takayama  243:       /dic dic tolower def
1.4       takayama  244:       %% concatenate the dictionary name to the function name.
                    245:       /ans in 2 get { cmoTreeToPrefix } map bracketForm def
1.8     ! takayama  246:       [dic (_) in 0 get ans ] cat /ans set
1.4       takayama  247:     } ifelse
                    248:     /arg1 ans def
                    249:   ] pop
                    250:   popVariables
                    251:   arg1
                    252: } def
                    253:
                    254: [(cmoTreeToPrefix)
                    255: [(tree-obj cmoTreeToPrefix prefix-str)
1.8     ! takayama  256:  (Dictionary names are translated to lower characters.)
        !           257:  $Example 1: [(plus) (basic) [(123).. (345)..]] [(class) (tree)] dc /ff set$
1.4       takayama  258:  $         ff cmoTreeToPrefix /gg set $
                    259:  $Example 2: ( (x-T-2)^5). /p set $
                    260:  $          p [(class) (recursivePolynomial)] dc xml /ff set $
                    261:  $         ff xml_to_cmo cmoTreeToPrefix /gg set $
                    262: ]] putUsages
                    263:
                    264:
                    265: /bracketForm {
                    266:   /arg1 set
                    267:   [/in-bracketForm /ans /f /i /n] pushVariables
                    268:   [
                    269:     /f arg1 def
                    270:     /n f length 1 sub def
                    271:     [ $($
                    272:       0 1 n 1 sub {
                    273:         /i set
                    274:         f i get toStringForParse2
                    275:         (,)
                    276:       } for
                    277:       f n get toStringForParse2
                    278:       $)$
                    279:     ] cat /arg1 set
                    280:   ] pop
                    281:   popVariables
                    282:   arg1
                    283: } def
                    284:
                    285: /toStringForParse2 {
                    286:   /arg1 set
                    287:   [/in-toStringForParse2 /f /ans] pushVariables
                    288:   [
                    289:     /f arg1 def
                    290:     f etag 262 eq {  %% indeterminate
                    291:      /ans  f (string) dc def
                    292:      /@@@.LLL goto
                    293:     } { } ifelse
                    294:     f toString /ans set
                    295:     /@@@.LLL
                    296:     /arg1 ans def
                    297:   ] pop
                    298:   popVariables
                    299:   arg1
                    300: } def
1.5       takayama  301:
1.6       takayama  302: /xml_tree_to_prefix_string {
                    303:    /arg1 set
                    304:    [/in-xml_tree_to_prefix_string /sss] pushVariables
                    305:    [
                    306:      /sss arg1 def
                    307:      sss isString {
                    308:      }{
                    309:        (string xml_tree_to_prefix_string) error
                    310:      }ifelse
                    311:      sss xml_to_cmo cmoTreeToPrefix /ans set
                    312:      /arg1 ans def
                    313:    ] pop
                    314:    arg1
                    315: } def
                    316:
                    317:
1.5       takayama  318: /OMproxy-testsuits2 {
                    319:   xmlconnect
                    320:   1 1 30 {
                    321:     /i set
                    322:     [( (x-T-2)^) i toString] cat . /p set
                    323:     p [(class) (recursivePolynomial)] dc xml /ff set
                    324:     ff xml_to_cmo cmoTreeToPostfix /gg set
                    325:     [(parse) gg] extension pop p sub /result set
                    326:     result (0). eq
                    327:     {
                    328:     }
                    329:     {
                    330:          (p = ) messagen p message
                    331:          (i=) messagen i message (Error in OMproxy-testsuits2 ) error
                    332:     } ifelse
                    333:   } for
                    334:   (Done.) message
                    335: } def
1.6       takayama  336:
                    337:
                    338:
1.5       takayama  339:

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