home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-09 | 1.1 KB | 68 lines | [TEXT/MPS ] |
- # --------------------------------------------------
- # MT2ToolKit, version 1.0b1
- # (C) Copyright by Michael Trofimov, 10/6/95.
- # --------------------------------------------------
- # Gener
- # generate array initialization template
- # Usage :
- # Gener {name} {from} {to} {from} {to}
- # Or
- # commando Gener
- # Or select "Generate array" item in Pascal menu.
- #
- # Example 1 :
- # -- the command :
- #
- # gener theArray 1 2 3 4
- #
- # generates a text:
- #
- # theArray [1,3] := {%%}; theArray [1,4] := {%%};
- # theArray [2,3] := {%%}; theArray [2,4] := {%%};
- # Example 2 :
- # -- the command :
- #
- # gener myArray -1 2
- #
- # generates a text:
- #
- # myArray [-1] := {%%};
- # myArray [0] := {%%};
- # myArray [1] := {%%};
- # myArray [2] := {%%};
-
-
- Set Exit 0
-
- Set val ∂{%%∂}
- Set j "{2}"
- if "{5}" == ""
- set from2 2
- set to2 1
- Else
- set from2 "{4}"
- set to2 "{5}"
- End
-
-
- Loop
- Set i "{from2}"
- Loop
- if "{from2}" > "{to2}"
- Echo "{1} [{j}] := {val}; " -n
- Else
- Echo "{1} [{j},{i}] := {val}; " -n
- End
- if "{i}" >= "{to2}"
- Break
- End
- Evaluate i += 1
- End
- if "{j}" >= "{3}"
- Break
- End
- Evaluate j += 1
- Echo
- End
- Echo
-