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

Annotation of OpenXM/src/kan96xx/trans/polymake.sm1, Revision 1.3

1.3     ! takayama    1: % $OpenXM: OpenXM/src/kan96xx/trans/polymake.sm1,v 1.2 2003/12/04 08:00:13 takayama Exp $
1.1       takayama    2: % It is a polymake interface
                      3:
                      4: /polymake.start {
                      5:   (ox.k0.loaded) boundp {  }
1.3     ! takayama    6:   { [(parse) (ox.sm1) pushfile] extension
        !             7:     /@@@polymake.k0.ccc [ ] def
        !             8:   } ifelse
        !             9:   @@@polymake.k0.ccc [ ] eq {
        !            10:      k0connectr /@@@polymake.k0.ccc oxk0.ccc def /oxk0.ccc [ ] def
        !            11:      @@@polymake.k0.ccc oxsetmathcap @@@polymake.k0.ccc oxmathcap
1.1       takayama   12:   } {  } ifelse
1.3     ! takayama   13:   @@@polymake.k0.ccc 0 get (closed) eq {
        !            14:      k0connectr /@@@polymake.k0.ccc oxk0.ccc def /oxk0.ccc [ ] def
        !            15:      @@@polymake.k0.ccc oxsetmathcap @@@polymake.k0.ccc oxmathcap
1.1       takayama   16:   } {  } ifelse
                     17:   [(which) (polymake)] oxshell tag 0 eq {
                     18:      [(export) (PATH) (=) (/usr/local/polymake/bin:${PATH})] oxshell
                     19:      [(which) (polymake)] oxshell tag 0 eq {
                     20:        (Polymake is not installed in this system.) error
                     21:      } {  } ifelse
                     22:   } {  } ifelse
                     23:   [(which) (polymake2tfb)] oxshell tag 0 eq {
                     24:      (polymake2tfb is not installed in this system.) error
                     25:   } {  } ifelse
                     26: } def
                     27:
                     28: %[(FACETS) (polymake.data(polymake.POINTS([[1,0,0],[1,1,0],[1,0,1],[1,0,0]])))]
                     29: % doPolymake
                     30: % [ tfb-string tree error]
                     31: [(doPolymake)
                     32: [(It calls polymake to make several construction for polytopes.)
                     33:  ([action data_in_polymake_tfb_format] doPolymake )
                     34:  (         [result_in_tfb result_in_tree errors])
                     35:  (polymake, polymake2tfb, ox_k0 must be installed.)
1.3     ! takayama   36:  (cf. @@@polymake.k0.ccc )
1.1       takayama   37:  (Example:)
                     38: % ( [(export) (PATH) (=) (/usr/local/polymake/bin:${PATH})] oxshell )
1.2       takayama   39:  $ [(FACETS) (polymake.data(polymake.POINTS([[1,0,0],[1,1,0],[1,0,1],[1,1,1]])))]$
1.1       takayama   40:  (         doPolymake /rr set )
                     41: ]] putUsages
                     42: /doPolymake {
                     43:   /arg1 set
                     44:   [/in-doPolymake  /pAction /pData /pNative /ptree
                     45:    /pResult  /pError
                     46:   ] pushVariables
                     47:   [
                     48:     arg1 0 get /pAction set
                     49:     arg1 1 get /pData set
                     50:     polymake.start
                     51:
                     52:     /pError [ ] def
                     53: %% step 1:  polymake tfb ===> polymake native data
1.3     ! takayama   54:     @@@polymake.k0.ccc ( polymake=Object; ) oxexecutestring
        !            55:     @@@polymake.k0.ccc ( QuoteMode(1); ) oxexecutestring
        !            56:     @@@polymake.k0.ccc [pData ( ;)] cat oxexecutestring
        !            57:     @@@polymake.k0.ccc oxpopcmo /ptree set
        !            58:     @@@polymake.k0.ccc ( QuoteMode(0); ) oxexecutestring
1.1       takayama   59:     [(treeToPolymake) ptree] extension /pNative set
                     60: %% step 2: calling the polymake
                     61:     [(polymake) (stringInOut://pNative.poly) pAction] addStdoutStderr
                     62:     oxshell pop
                     63:     pError [@@@stdout @@@stderr] append /pError set
                     64: %% step 3: polymake native data to polymake tfb
                     65:     [(polymake2tfb) (<) (stringIn://pNative) (>) (stringOut://pResult)
                     66:      (2>) (stringOut://@@@stderr)] oxshell pop
                     67:     pError [@@@stderr] append /pError set
                     68: %% step 4: get also tree style data.
1.3     ! takayama   69:     @@@polymake.k0.ccc ( polymake=Object; ) oxexecutestring
        !            70:     @@@polymake.k0.ccc ( QuoteMode(1); ) oxexecutestring
        !            71:     @@@polymake.k0.ccc [pResult ( ;)] cat oxexecutestring
        !            72:     @@@polymake.k0.ccc oxpopcmo /ptree set
        !            73:     @@@polymake.k0.ccc ( QuoteMode(0); ) oxexecutestring
1.1       takayama   74:     [pResult ptree pError] /arg1 set
1.3     ! takayama   75:   ] pop
        !            76:   popVariables
        !            77:   arg1
        !            78: } def
        !            79:
        !            80: [(tfbToTree)
        !            81: [(tfb-expression-in-string tfbToTree tree)
        !            82:  (tfbToTree translates expressions in tfb/2 into tree form.)
        !            83:  (Bug: the input is parsed by k0, so the symbol name given agrees with)
        !            84:  (     a k0 symbol, it returns a strange answer.)
        !            85:  $Example:  ( C+intpath.circle(0,1/2) ) tfbToTree :: $
        !            86: ]] putUsages
        !            87:
        !            88: /tfbToTree {
        !            89:   /arg1 set
        !            90:   [/in-tfbToTree  /pAction /pData /pNative /ptree
        !            91:    /pResult  /pError /i
        !            92:   ] pushVariables
        !            93:   [
        !            94:     arg1 /pData set
        !            95:     polymake.start
        !            96:
        !            97:     /pError [ ] def
        !            98: %%  tfb ===> CMO tree.
        !            99:     @@@polymake.k0.ccc ( QuoteMode(1); ) oxexecutestring
        !           100:     @@@polymake.k0.ccc [pData ( ;)] cat oxexecutestring
        !           101:     @@@polymake.k0.ccc oxpopcmo /ptree set
        !           102:     @@@polymake.k0.ccc ( QuoteMode(0); ) oxexecutestring
        !           103:     /arg1 ptree def
1.1       takayama  104:   ] pop
                    105:   popVariables
                    106:   arg1
                    107: } def

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