-- File [Ivy]<Nelson>Lupine>LupinePrintTest.mesa.
-- Last edited by BZM on 10-Mar-82 16:43:19.


DIRECTORY
  Time USING [Unpacked];


LupinePrintTest: DEFINITIONS = BEGIN


--  Nonsense routines with complicated, explicit types to be printed. 
--  Lupine is not supposed to translate them properly! 

  Basics: PROC [
	u: UNSPECIFIED, lu: LONG UNSPECIFIED,
	i: INTEGER, li: LONG INTEGER,
	c: CARDINAL, lc: LONG CARDINAL,
	w: WORD,
	ch:CHARACTER,
	b: BOOLEAN,
	r: REAL ];

  CedarBasics: PROC [
	n:  NAT,
	li: INT,
	ch: CHAR,
	b:  BOOL ];

  Subranges: ERROR [
	i: INTEGER[-100..-1],
	c: CARDINAL[500..1000],
	n: NAT[100..100],
	ch:CHARACTER['a..'z],
	b: BOOLEAN[TRUE..TRUE] ];

  Enumerations: PROC [
	none: {}, one: {a}, two: {a,b},
	more: MACHINE DEPENDENT {a,b,c,d,e,f,g,h} ];

  Simple: PROCEDURE [input: BOOLEAN] RETURNS [output: CHARACTER];

  Transfers: SIGNAL [
	proc: PROCEDURE, error: ERROR, signal: SIGNAL,
	port: PORT, program: PROGRAM, process: PROCESS ];

  HANDLE: TYPE = PRIVATE POINTER;

  Arrays: SIGNAL [PACKED ARRAY BOOLEAN OF ARRAY [1..7] OF REF RECORD [
	x: ARRAY [0..1) OF HANDLE,
	y: ARRAY [2000..2001] OF PACKED ARRAY CHARACTER OF BOOLEAN,
	z: SEQUENCE index: CHARACTER OF BOOLEAN]  ];

  Sequences: PROCEDURE [
	compSeqOK: REF RECORD [PACKED SEQUENCE COMPUTED [-10..10] OF CHARACTER],
	compSeqBad: REF RECORD [SEQUENCE COMPUTED CHARACTER OF POINTER] ]
    RETURNS [
	finiteSeq: REF RECORD [SEQUENCE bound: [-10..10] OF CHARACTER],
	infiniteSeq: REF RECORD [SEQUENCE index: NAT OF Time.Unpacked] ];

  Records: ERROR [
	type: {Mary, had, a, little, lamb},
	record: MACHINE DEPENDENT RECORD [
		one: STRING,
		two: REF POINTER TO RECORD [block: ARRAY [0..4) OF STRING],
		three: DESCRIPTOR FOR ARRAY OF RECORD [
			s: LONG STRING,
			h: HANDLE] ] ];

  Zones: PROCEDURE [gc: ZONE, heap: UNCOUNTED ZONE] RETURNS [mds: MDSZone];

  IllegalTypes: ERROR [
	c: POINTER TO CONDITION,
	m: POINTER TO MONITORLOCK,
	mr: MONITORED RECORD [q: INTEGER] ];

  CedarSignal: SIGNAL [
	nat: NAT,
	refTime: REF Time.Unpacked,
	compSeq: REF RECORD [PACKED SEQUENCE COMPUTED [-10..10] OF CHARACTER] ]
    RETURNS [
	atom: ATOM,
	list: LIST OF RECORD[a,b: LIST OF ATOM] ];

  CedarProc: PROC [
	nat: NAT,
	refInt: REF INTEGER,
	ref: REF,
	refAny: REF ANY,
	compSeq: REF RECORD [PACKED SEQUENCE COMPUTED [-10..1] OF CHARACTER] ]
    RETURNS [
	body: REF READONLY StringBody,
	zone: ZONE,
	atom: ATOM,
	list: LIST OF RECORD[a,b: LIST OF ATOM],
	sequence: POINTER TO RECORD [SEQUENCE bogus: {bogus} OF REF TEXT],
	signal: SIGNAL RETURNS [PROC [one: STRING, two: HANDLE, three: POINTER]
				   RETURNS [list: LIST OF READONLY HANDLE] ]  ];
		
  AnonParams: PROCEDURE [LONG INTEGER, HANDLE, LIST OF ZONE]
    RETURNS [LONG DESCRIPTOR FOR ARRAY OF PROCEDURE [REAL] RETURNS [BOOLEAN]];

  ProcParam: SIGNAL RETURNS [ PROC [one: STRING, two: HANDLE, three: POINTER]
				 RETURNS [list: LIST OF READONLY HANDLE] ];

  ProcArray: PROCEDURE [input: WORD]
    RETURNS [output: LONG DESCRIPTOR FOR READONLY ARRAY OF PROCEDURE [REAL] ];

  ExportObject: TYPE[1];

  OpaqueTest: PROCEDURE [object: ExportObject]
    RETURNS [approved: POINTER TO ExportObject, dubious: HANDLE];

  ComputedOverlaidRecords: PROCEDURE RETURNS [
    bad: RECORD [SELECT OVERLAID * FROM
		empty => [],
		string => [s: STRING],
		another => [SELECT COMPUTED {HaHa} FROM
				HaHa => [test: INTEGER, p: POINTER],
				ENDCASE ],
		ENDCASE] ];

  VariantRecords: SIGNAL [
      small: DESCRIPTOR FOR READONLY ARRAY OF RECORD [
	handle: HANDLE,
	oddPart: SELECT varTag: * FROM
		time => [t: Time.Unpacked],
		empty => [],
		plain => [c: CARDINAL, r: REAL],
		ENDCASE ] ]
    RETURNS [
      big: RECORD [
	common: HANDLE,
	plain: PACKED ARRAY CARDINAL OF CHARACTER,
	variant: SELECT varTag: * FROM
	  time => [t: Time.Unpacked],
	  list => [l: LIST OF REF RECORD [SEQUENCE num: [-10..10] OF REF TEXT]],
	  handle => [h, i, j: HANDLE],
	  empty => [],
	  plain => [c: CARDINAL, r: REAL],
	  small => [fill: BOOLEAN],
	  another => [SELECT tag: {ImBad, YoureBad} FROM
			  ImBad => [test: ExportObject, p: POINTER],
			  YoureBad => [desc: LONG DESCRIPTOR FOR ARRAY OF RECORD [
					  s: LONG STRING,
					  h: HANDLE,
					  time: Time.Unpacked] ],
					  ENDCASE ],
	  ENDCASE ] ];

  Spectrum: TYPE = RECORD [
	primary: SELECT primaryTag: * FROM
	  red => [i: INTEGER],
	  yellow => [],
	  blue => [ SELECT secondaryTag: * FROM
	    light => [],
	    medium => [r: REAL],
	    dark => [c: CARDINAL],
	    ENDCASE ],
  	  ENDCASE ];

  BoundVariants: PROCEDURE [
	spectrum: Spectrum,
	red: red Spectrum,
	lightBlue: light blue Spectrum,
	yellow: yellow Spectrum,
	darkBlue: dark blue Spectrum ];


END.  -- LupinePrintTest.