DIRECTORY XMesaProcs, RunRegressions; InlineTest: PROGRAM IMPORTS RunRegressions, XMesaProcs = BEGIN filename: STRING = "InlineTest"; callerType: TYPE = PROCEDURE [i : INTEGER _ 7] _ AnotherProc; caller: callerType _ OtherProc; procInt: INTEGER _ 0; typeWithInit: TYPE = INTEGER _ 6; DoInlineTests: PROC = { XMesaProcs.PrintS[filename]; XMesaProcs.PrintCR; TestSimpleConsts[]; -- simple constant use / declaration TestComplexConsts[]; -- complex constant use / declaration TestComplexBuiltins[]; -- complex builtin constant use TestProcVariables[]; -- constant procs variable }; globalConstA: CARDINAL = 41; globalConstB: INTEGER = 42; globalConstC: INTEGER = globalConstA - globalConstB; globalCardinal: CARDINAL; TestSimpleConsts: PROC[] = { a: INTEGER = 6; b: INTEGER = 3; c: INTEGER _ a; XMesaProcs.Isequal[a, c, 10, filename]; XMesaProcs.Isequal[a, 6, 13, filename]; XMesaProcs.Isequal[c, 6, 15, filename]; c _ b; XMesaProcs.Isequal[b, c, 20, filename]; c _ globalConstA; XMesaProcs.Isequal[globalConstA, c, 30, filename]; globalCardinal _ globalConstA; XMesaProcs.Isequal[globalConstA, globalCardinal, 50, filename]; XMesaProcs.Isequal[globalConstA, 41, 55, filename]; globalCardinal _ a; XMesaProcs.Isequal[a, globalCardinal, 60, filename]; c _ a - b; XMesaProcs.Isequal[a - b, c, 70, filename]; XMesaProcs.Isequal[3, c, 80, filename]; }; z: ZONE = NIL; p: PROCESS = NIL; s: STRING = NIL; TestComplexConsts: PROC[] = { a: typeWithInit; b: typeWithInit _ 7; c: typeWithInit = 8; XMesaProcs.Isequal[7, b, 300, filename]; XMesaProcs.Isequal[8, c, 310, filename]; XMesaProcs.Isequal[6, a, 320, filename]; }; TestComplexBuiltins: PROC[] = { zVar: ZONE; pVar: PROCESS; sVar: STRING; sVar _ s; --pVar _ p; zVar _ z; IF ~ProcProcedure[pVar] THEN XMesaProcs.PutFailMessage[100, filename]; --IF ~ProcProcedure[p] THEN XMesaProcs.PutFailMessage[110, filename]; --IF ~ProcProcedure[] THEN XMesaProcs.PutFailMessage[120, filename]; IF ~StringProcedure[sVar] THEN XMesaProcs.PutFailMessage[130, filename]; IF ~StringProcedure[s] THEN XMesaProcs.PutFailMessage[140, filename]; IF ~StringProcedure[] THEN XMesaProcs.PutFailMessage[150, filename]; IF ~ZoneProcedure[zVar] THEN XMesaProcs.PutFailMessage[160, filename]; IF ~ZoneProcedure[z] THEN XMesaProcs.PutFailMessage[170, filename]; IF ~ZoneProcedure[] THEN XMesaProcs.PutFailMessage[180, filename]; }; ProcProcedure: PROCEDURE [theProcess: PROCESS _ p] RETURNS [BOOL] = { RETURN [theProcess = NIL]; }; StringProcedure: PROCEDURE [theString: STRING _ s] RETURNS [BOOL] = { RETURN [theString = NIL]; }; ZoneProcedure: PROCEDURE [theZone: ZONE _ z] RETURNS [BOOL] = { RETURN [theZone = NIL]; }; TestProcVariables: PROCEDURE = { c: callerType _ Doit; d: callerType; d[]; -- call AnotherProc, procInt = 8 c[7]; -- call Doit, procInt = 10 caller[]; -- call OtherProc, procInt = 11 InlineProc[]; -- procInt = 15 XMesaProcs.Isequal[procInt, 15, 400, filename]; }; InlineProc: callerType = INLINE { XMesaProcs.Isequal[i, 7, 430, filename]; procInt _ procInt + 4; }; Doit: callerType = { XMesaProcs.Isequal[i, 7, 410, filename]; procInt _ procInt + 2; }; OtherProc: callerType = { XMesaProcs.Isequal[i, 7, 420, filename]; procInt _ procInt + 1; }; AnotherProc: callerType = { XMesaProcs.Isequal[i, 7, 440, filename]; procInt _ procInt + 8; }; ExternalNames: PROC = MACHINE CODE { "^ExternalNames\n"; "MumbleProc MumbleProc\n"; }; RunRegressions.RegisterTest[DoInlineTests, "InlineTests"]; END. @ InlineTest.mesa mna Foote, October 12, 1992 11:24 am PDT Ê •NewlineDelimiter ™J™™J™$—J˜šÏk ˜ J˜J˜—JšÏn œ˜Jšœ˜"Jšœ˜˜Jšœ œ˜ J˜Jšœ œ œœ˜=J˜J˜Jšœ œ˜J˜Jšœœœ˜!J˜šž œœ˜J˜J˜JšœÏc$˜AJšœŸ%˜BJšœŸ˜