Annotation of OpenXM/src/kan96xx/trans/polymake.sm1, Revision 1.1
1.1 ! takayama 1: % $OpenXM$
! 2: % It is a polymake interface
! 3:
! 4: /polymake.start {
! 5: (ox.k0.loaded) boundp { }
! 6: { [(parse) (ox.sm1) pushfile] extension } ifelse
! 7: oxk0.ccc [ ] eq {
! 8: k0connectr oxk0.ccc oxsetmathcap oxk0.ccc oxmathcap
! 9: } { } ifelse
! 10: oxk0.ccc 0 get (closed) eq {
! 11: k0connectr oxk0.ccc oxsetmathcap oxk0.ccc oxmathcap
! 12: } { } ifelse
! 13: [(which) (polymake)] oxshell tag 0 eq {
! 14: [(export) (PATH) (=) (/usr/local/polymake/bin:${PATH})] oxshell
! 15: [(which) (polymake)] oxshell tag 0 eq {
! 16: (Polymake is not installed in this system.) error
! 17: } { } ifelse
! 18: } { } ifelse
! 19: [(which) (polymake2tfb)] oxshell tag 0 eq {
! 20: (polymake2tfb is not installed in this system.) error
! 21: } { } ifelse
! 22: } def
! 23:
! 24: %[(FACETS) (polymake.data(polymake.POINTS([[1,0,0],[1,1,0],[1,0,1],[1,0,0]])))]
! 25: % doPolymake
! 26: % [ tfb-string tree error]
! 27: [(doPolymake)
! 28: [(It calls polymake to make several construction for polytopes.)
! 29: ([action data_in_polymake_tfb_format] doPolymake )
! 30: ( [result_in_tfb result_in_tree errors])
! 31: (polymake, polymake2tfb, ox_k0 must be installed.)
! 32: (Example:)
! 33: % ( [(export) (PATH) (=) (/usr/local/polymake/bin:${PATH})] oxshell )
! 34: $ [(FACETS) (polymake.data(polymake.POINTS([[1,0,0],[1,1,0],[1,0,1],[1,0,0]])))]$
! 35: ( doPolymake /rr set )
! 36: ]] putUsages
! 37: /doPolymake {
! 38: /arg1 set
! 39: [/in-doPolymake /pAction /pData /pNative /ptree
! 40: /pResult /pError
! 41: ] pushVariables
! 42: [
! 43: arg1 0 get /pAction set
! 44: arg1 1 get /pData set
! 45: polymake.start
! 46:
! 47: /pError [ ] def
! 48: %% step 1: polymake tfb ===> polymake native data
! 49: oxk0.ccc ( polymake=Object; ) oxexecutestring
! 50: oxk0.ccc ( QuoteMode(1); ) oxexecutestring
! 51: oxk0.ccc [pData ( ;)] cat oxexecutestring
! 52: oxk0.ccc oxpopcmo /ptree set
! 53: oxk0.ccc ( QuoteMode(0); ) oxexecutestring
! 54: [(treeToPolymake) ptree] extension /pNative set
! 55: %% step 2: calling the polymake
! 56: [(polymake) (stringInOut://pNative.poly) pAction] addStdoutStderr
! 57: oxshell pop
! 58: pError [@@@stdout @@@stderr] append /pError set
! 59: %% step 3: polymake native data to polymake tfb
! 60: [(polymake2tfb) (<) (stringIn://pNative) (>) (stringOut://pResult)
! 61: (2>) (stringOut://@@@stderr)] oxshell pop
! 62: pError [@@@stderr] append /pError set
! 63: %% step 4: get also tree style data.
! 64: oxk0.ccc ( polymake=Object; ) oxexecutestring
! 65: oxk0.ccc ( QuoteMode(1); ) oxexecutestring
! 66: oxk0.ccc [pResult ( ;)] cat oxexecutestring
! 67: oxk0.ccc oxpopcmo /ptree set
! 68: oxk0.ccc ( QuoteMode(0); ) oxexecutestring
! 69: [pResult ptree pError] /arg1 set
! 70: ] pop
! 71: popVariables
! 72: arg1
! 73: } def
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>