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

File: [local] / OpenXM / src / k097 / incmac.sm1 (download)

Revision 1.3, Mon Jan 8 05:26:48 2001 UTC (23 years, 4 months ago) by takayama
Branch: MAIN
CVS Tags: R_1_3_1-2, RELEASE_1_3_1_13b, RELEASE_1_2_3_12, RELEASE_1_2_3, RELEASE_1_2_2_KNOPPIX_b, RELEASE_1_2_2_KNOPPIX, RELEASE_1_2_2, RELEASE_1_2_1, KNOPPIX_2006, HEAD, DEB_REL_1_2_3-9
Changes since 1.2: +7 -2 lines

* Cleaned unnecessary files and functions.
* Completed the new help system. Type in make in the directory
  OpenXM/src/k097/Doc

%% $OpenXM: OpenXM/src/k097/incmac.sm1,v 1.3 2001/01/08 05:26:48 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

%% Constants
/Percent (37).. def
/LeftBracket (40).. def
/RightBracket (41).. def
/Dollar (36).. def
/Newline (10).. def