perm filename MACROS.SAI[NEW,AIL] blob sn#408204 filedate 1979-01-08 generic text, type T, neo UTF8
COMMENT USEFUL MACROS FOR SAIL PROGRAMS;
REQUIRE "[][]" DELIMITERS;
DEFINE SYMNO=0;
DEFINE INITIALIZE(X)=
	[ REDEFINE SYMNO=SYMNO+1;
	REDEFINE INIT00="INIT"&CVS(SYMNO);
	SIMPLE PROCEDURE INIT00; X;
	REQUIRE INIT00 INITIALIZATION ];
DEFINE GENSYM =
	[ REDEFINE SYMNO=SYMNO+1;
	"!!!"&CVS(SYMNO) ];
DEFINE SIMPROC=[SIMPLE PROCEDURE],
	RECPROC=[RECURSIVE PROCEDURE ];

DEFINE ON!BLOCK!EXIT!DO(BODY,ATTR)=
        [ REDEFINE SYMNO=SYMNO+1;
	REDEFINE CLN00="CLN"&CVS(SYMNO);
	ATTR PROCEDURE CLN00;
		BODY;
	CLEANUP CLN00 ];

DEFINE DEFQ(LNGID,SHTID) = [
	REDEFINE LNGID "<>" = <SHTID>;
	SHTID ];


COMMENT DEFQ is intended to be used in declarations where you
	want a longer identifier than that allowed by the loader
	e.g.

	EXTERNAL PROCEDURE DEFQ(A!LONG!NAME!1,ALN1!!)

	;

DEFINE NO!COMPILE = [IFCR FALSE THENC];

DEFINE BUG(S)=[USERERR(1,1,S)];

DEFINE BITDEF(BITID,V,XX)"[]" = [
	DEFINE BITID "<>" = <V>;
	ASSIGNC XX "[]" = CVPS(BITID)&[!ON];
	DEFINE XX (I) "[]" = [((I) LAND (]&CVPS(V)&[))]
];

DEFINE ITERATE "[]" = [WHILE TRUE DO];

DEFINE CALLBAIL "[]" = [
	IFCR BAILING THENC
	BEGIN EXTERNAL PROCEDURE BAIL;BAIL;END
	ENDC];


DEFINE WHILE!GENERATE "[]" = [ FOREACH SUCH THAT ];

IFCR ¬DECLARATION(BAILING) THENC DEFINE BAILING "<>" = <FALSE>; ENDC