[BACK]Return to incmac.sm1 CVS log [TXT][DIR] Up to [local] / OpenXM / src / k097

Annotation of OpenXM/src/k097/incmac.sm1, Revision 1.1

1.1     ! maekawa     1:
        !             2:
        !             3: %%  incmac.sm1 ,   1996, 4/2.
        !             4: %% macros for the translator.
        !             5: %%% /goto { pop } def  %% should be changed later.
        !             6: %( incmac.sm1: 4/16, 1997 ) messagen
        !             7: %% Note that you cannot use incmac.k as an argument of the local function.
        !             8: %% BUG: [/incmac.k] pushvarable was [/k] pushVariables, but it caused
        !             9: %% error when you try to run a program foo(k) { for (i=0; i<k; i++) ... }.
        !            10: /mapset {
        !            11:   /arg2 set /arg1 set
        !            12:   [/incmac.k ] pushVariables
        !            13:   0 1 arg1 length 1 {sub} primmsg {
        !            14:     /incmac.k set
        !            15:     arg1 incmac.k get
        !            16:     arg2 incmac.k get
        !            17:     set
        !            18:   } for
        !            19:   popVariables
        !            20: } def
        !            21:
        !            22: %%%  a [i] b Put  <=== a[i] = b;
        !            23: %%%  a [i] Get    <=== a[i]
        !            24: /a [[1 2] [3 4]] def
        !            25: /@@@.indexMode {
        !            26: 0 eq {  %%% C-style
        !            27:  /@@@.indexMode.flag  0 def
        !            28:  /Get {
        !            29:  /arg2 set
        !            30:  /arg1 set
        !            31:  [/incmac.k ] pushVariables
        !            32:  [
        !            33:    arg1
        !            34:    0 1 arg2 length 1 {sub} primmsg {
        !            35:       /incmac.k set
        !            36:       arg2 incmac.k get ..int get
        !            37:    } for
        !            38:    /arg1 set
        !            39:   ] pop
        !            40:   popVariables
        !            41:   arg1
        !            42:  } def
        !            43:
        !            44:  /Put {
        !            45:  /arg3 set
        !            46:  /arg2 set
        !            47:  /arg1 set
        !            48:  [/incmac.k ] pushVariables
        !            49:  arg1
        !            50:  [ 0 1 arg2 length 1 {sub} primmsg {
        !            51:      /incmac.k set
        !            52:      arg2 incmac.k get ..int
        !            53:    } for
        !            54:  ] arg3 put
        !            55:  popVariables
        !            56:  } def
        !            57: } { %% else
        !            58:   (Warning: Do not use indexmode 1.) message
        !            59:   (Warning: Do not use indexmode 1.) message
        !            60:  /@@@.indexMode.flag  1 def
        !            61:  /Get {
        !            62:  /arg1 set
        !            63:  [/incmac.k ] pushVariables
        !            64:  [
        !            65:    arg1 0 get load
        !            66:    1 1 arg1 length 1 {sub} primmsg {
        !            67:       /incmac.k set
        !            68:       arg1 incmac.k get ..int 1 {sub} primmsg get
        !            69:    } for
        !            70:    /arg1 set
        !            71:   ] pop
        !            72:   popVariables
        !            73:   arg1
        !            74:  } def
        !            75:
        !            76:  /Put {
        !            77:  /arg2 set
        !            78:  /arg1 set
        !            79:  [/incmac.k ] pushVariables
        !            80:  arg1 0 get load
        !            81:  [ 1 1 arg1 length 1 {sub} primmsg {
        !            82:      /incmac.k set
        !            83:      arg1 incmac.k get ..int 1 {sub} primmsg
        !            84:    } for
        !            85:  ] arg2 put
        !            86:  popVariables
        !            87:  } def
        !            88: } ifelse
        !            89: } def
        !            90:
        !            91: 0 @@@.indexMode   %% Default index mode is C-style
        !            92:
        !            93:
        !            94:
        !            95:
        !            96: %%%%%%%%%%%%  1996, 4/28
        !            97: %% (2).. NewVector
        !            98: /NewVector {
        !            99:   0 get /arg1 set
        !           100:   pop  %% remove this
        !           101:   arg1 (integer) dc /arg1 set
        !           102:   [ 1 1 arg1 { pop (0).. } for ]
        !           103: } def
        !           104:
        !           105: %% (2).. (3).. NewMatrix
        !           106: /NewMatrix {
        !           107:   dup 0 get /arg1 set
        !           108:       1 get /arg2 set
        !           109:   pop  %% remove this
        !           110:   arg1 (integer) dc /arg1 set
        !           111:   arg2 (integer) dc /arg2 set
        !           112:   [1 1 arg1 { pop this [arg2] NewVector } for ]
        !           113: } def
        !           114:
        !           115: /Join {
        !           116:   2 -1 roll pop %% remove this.
        !           117:   aload pop join
        !           118: } def
        !           119:
        !           120:
        !           121:
        !           122: /lessThanOrEqual {
        !           123:   /arg2 set /arg1 set
        !           124:   arg1 arg2 lt { 1 }
        !           125:   { arg1 arg2 eq {1} {0} ifelse} ifelse
        !           126: } def
        !           127:
        !           128: %%% For objects
        !           129: /this null def
        !           130: /PrimitiveContextp StandardContextp def
        !           131: /PrimitiveObject  [PrimitiveContextp]  def
        !           132:
        !           133: /showln { pop message } def
        !           134:
        !           135: /KxxTrash0 {  % we do not need.
        !           136: /k.mapReplace {  {[[(h). (1).]] replace} map } def
        !           137: /Dehomogenize {
        !           138:   0 get /arg1 set
        !           139:   [
        !           140:     arg1 isArray not { arg1 [[(h). (1).]] replace }
        !           141:     { arg1 0 get isArray not { arg1 k.mapReplace }
        !           142:                              { arg1 {k.mapReplace} map } ifelse
        !           143:     } ifelse
        !           144:     /arg1 set
        !           145:   ] pop
        !           146:   arg1
        !           147: } def
        !           148: } def
        !           149:
        !           150:
        !           151:
        !           152:
        !           153:
        !           154:

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