home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
sa104os2.zip
/
SATHR104.ZIP
/
SATHER
/
SYSTEM
/
ITERS
< prev
next >
Wrap
Text File
|
1994-10-25
|
2KB
|
54 lines
-- Copyright (C) International Computer Science Institute, 1994. COPYRIGHT --
-- NOTICE: This code is provided "AS IS" WITHOUT ANY WARRANTY and is subject --
-- to the terms of the SATHER LIBRARY GENERAL PUBLIC LICENSE contained in --
-- the file "Doc/License" of the Sather distribution. The license is also --
-- available from ICSI, 1947 Center St., Suite 600, Berkeley CA 94704, USA. --
--------> Please email comments to "sather-bugs@icsi.berkeley.edu". <----------
-- Macros for inlining iters. ## is a per iter unique string, and
-- @ indicates to exit the current loop. # followed by a number
-- indicates the corresponding arg as in the MACROS file.
-- The strings correspond to the following:
-- A string placed at the routine head to declare variables
-- A string placed before entry to the loop.
-- A string just before the use of the expression for the iter.
-- Whatever value ## has is the return value and used at the iter expression.
-- A string that occurs just after.
"INT::times!" "INT ##;"
"## = #1;"
"if (##<=0) @;"
"##--;"
"INT::times!:INT" ""
"## = 0;"
"if (##>=#1) @;"
"##++;"
"INT::for!(INT):INT" "INT ##e;"
"## = #1; ##e = #1+#2;"
"if (##>=##e) @;"
"##++;"
"INT::upto!(INT):INT" ""
"## = #1;"
"if (##>#2) @;"
"##++;"
"STR::aelt!:CHAR" "CHAR *##p; INT ##n;"
"##p = #1->arr_part; ##n = #1->asize;"
"if (##n<=0) @; ## = *##p;"
"##p++; ##n--;"
"STR::elt!:CHAR" "CHAR *##p; INT ##n;"
"##p = #1->arr_part; ##n = #1->asize;"
"if (##n<=0) @; ## = *##p;"
"##p++; ##n--;"
"STR::aset!(CHAR!)" "CHAR *##p; INT ##n;"
"##p = #1->arr_part; ##n = #1->asize;"
"if (##n<=0) @; *##p = #2;"
"##p++; ##n--;"