perm filename SAILPD.FAI[S,AIL] blob sn#263536 filedate 1977-02-11 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	SAILPD -- a FAIL macro to define SAIL procedure descriptors
C00005 ENDMK
C⊗;
;SAILPD -- a FAIL macro to define SAIL procedure descriptors
;	(BAIL needs a procedure descriptor in order to call anything)
;
;Arguments are
;	NAME	must be defined as entry address, also used as name of proc
;	PROCTYP	type of procedure
;	PPARMS	number of parameters passed on P ('17) stack
;	SPPARM	number of parameters passed on SP ('16) stack
;		(same as number of VALUE STRINGs)
;	ARGTYPS	list of argument types
;
;For a procedure corresponding to the SAIL declaration
;	INTEGER PROCEDURE MYPROC
;	    (REFERENCE INTEGER I; STRING S; INTEGER J; INTEGER K[13])
;an acceptable macro call is
;	SAILPD	(MYPROC,INTEGR,3,1,<REFERENCE+INTEGR,STRING,INTEGR,
;			INTEGR+DEFAULT+[=13]>)
;

DEFINE SAILPD (NAME,PROCTYP,PPARMS,SPPARM,ARGTYPS) <
	BEGIN
	XPUNGE		;NO SYMBOLS FROM THIS BLOCK IN .REL FILE
%PDLNK ←← 6		;PROCEDURE DESCRIPTOR LOADER LINK

DEFAUL ←← 1⊗=35
REFERE ←← 1⊗=34
QUES   ←← 1⊗=33
BIND   ←← 1⊗=32
PROCED ←← 1⊗=31
ITEM   ←← 1⊗=30
LEAPAR ←← 1⊗=29		;LEAP ARRAY, FOR λ ARRAY ITEMVAR ARRAY

NOTYPE ←← 1⊗=23
STRING ←← 3⊗=23
REAL   ←← 4⊗=23
INTEGR ←← 5⊗=23		;INTEGER IS FAIL RESERVED WORD
SSET   ←← 6⊗=23		;SET IS FAIL RESERVED WORD
LIST   ←← 7⊗=23
CONTEX ←← 13⊗=23
RECPTR ←← 15⊗=23	;RECORD!POINTER
ITEMVA ←← 20⊗=23

ARRAY  ←← 24⊗=23


	0		;LOADER CHAIN
	LINK %PDLNK,.-1
	NAME		;ENTRY ADDRESS

	FOR @$ ZOT E <NAME><1+>0	;LENGTH
	POINT	7,[ASCII/NAME/],-1

	PROCTYP
	2*SPPARM,,1+PPARMS
	0		;STACK DISPLACEMENTS
	0		;LOCAL VARIABLE INFO
	.+4		;PTR TO PARAM INFO
	.-10,,0		;PDA,,0
	NAME,,0		;PCNT AT MKSEMT,,PARENT'S PDA
	NAME,,0		;PCNT AT PRDEC,,JRST EXIT

FOR ZOT IN (ARGTYP)<
	ZOT>		;PARAMETER TYPES

	BEND>

;TITLE TEST
;MYPROC:0
;	SAILPD	(MYPROC,INTEGR,3,1,<REFERENCE+INTEGR,STRING,INTEGR,
;			INTEGR+DEFAULT+[=13]>)
;END