Return to incmac.sm1 CVS log | Up to [local] / OpenXM / src / k097 |
File: [local] / OpenXM / src / k097 / incmac.sm1 (download)
Revision 1.2, Fri Jan 21 03:01:25 2000 UTC (24 years, 8 months ago) by takayama
Added the tag $OpenXM$ |
%% $OpenXM: OpenXM/src/k097/incmac.sm1,v 1.2 2000/01/21 03:01:25 takayama Exp $ %% incmac.sm1 , 1996, 4/2. %% macros for the translator. %%% /goto { pop } def %% should be changed later. %( incmac.sm1: 4/16, 1997 ) messagen %% Note that you cannot use incmac.k as an argument of the local function. %% BUG: [/incmac.k] pushvarable was [/k] pushVariables, but it caused %% error when you try to run a program foo(k) { for (i=0; i<k; i++) ... }. /mapset { /arg2 set /arg1 set [/incmac.k ] pushVariables 0 1 arg1 length 1 {sub} primmsg { /incmac.k set arg1 incmac.k get arg2 incmac.k get set } for popVariables } def %%% a [i] b Put <=== a[i] = b; %%% a [i] Get <=== a[i] /a [[1 2] [3 4]] def /@@@.indexMode { 0 eq { %%% C-style /@@@.indexMode.flag 0 def /Get { /arg2 set /arg1 set [/incmac.k ] pushVariables [ arg1 0 1 arg2 length 1 {sub} primmsg { /incmac.k set arg2 incmac.k get ..int get } for /arg1 set ] pop popVariables arg1 } def /Put { /arg3 set /arg2 set /arg1 set [/incmac.k ] pushVariables arg1 [ 0 1 arg2 length 1 {sub} primmsg { /incmac.k set arg2 incmac.k get ..int } for ] arg3 put popVariables } def } { %% else (Warning: Do not use indexmode 1.) message (Warning: Do not use indexmode 1.) message /@@@.indexMode.flag 1 def /Get { /arg1 set [/incmac.k ] pushVariables [ arg1 0 get load 1 1 arg1 length 1 {sub} primmsg { /incmac.k set arg1 incmac.k get ..int 1 {sub} primmsg get } for /arg1 set ] pop popVariables arg1 } def /Put { /arg2 set /arg1 set [/incmac.k ] pushVariables arg1 0 get load [ 1 1 arg1 length 1 {sub} primmsg { /incmac.k set arg1 incmac.k get ..int 1 {sub} primmsg } for ] arg2 put popVariables } def } ifelse } def 0 @@@.indexMode %% Default index mode is C-style %%%%%%%%%%%% 1996, 4/28 %% (2).. NewVector /NewVector { 0 get /arg1 set pop %% remove this arg1 (integer) dc /arg1 set [ 1 1 arg1 { pop (0).. } for ] } def %% (2).. (3).. NewMatrix /NewMatrix { dup 0 get /arg1 set 1 get /arg2 set pop %% remove this arg1 (integer) dc /arg1 set arg2 (integer) dc /arg2 set [1 1 arg1 { pop this [arg2] NewVector } for ] } def /Join { 2 -1 roll pop %% remove this. aload pop join } def /lessThanOrEqual { /arg2 set /arg1 set arg1 arg2 lt { 1 } { arg1 arg2 eq {1} {0} ifelse} ifelse } def %%% For objects /this null def /PrimitiveContextp StandardContextp def /PrimitiveObject [PrimitiveContextp] def /showln { pop message } def /KxxTrash0 { % we do not need. /k.mapReplace { {[[(h). (1).]] replace} map } def /Dehomogenize { 0 get /arg1 set [ arg1 isArray not { arg1 [[(h). (1).]] replace } { arg1 0 get isArray not { arg1 k.mapReplace } { arg1 {k.mapReplace} map } ifelse } ifelse /arg1 set ] pop arg1 } def } def