perm filename PROCES.DEF[X,AIL]1 blob sn#015983 filedate 1972-12-12 generic text, type T, neo UTF8
COMMENT ⊗   VALID 00002 PAGES 
RECORD PAGE   DESCRIPTION
 00001 00001
 00002 00002	EXTERNAL PROCEDURE MAINPR
 00006 ENDMK
⊗;
EXTERNAL PROCEDURE MAINPR;
EXTERNAL ITEMVAR PROCEDURE RESUME(ITEMVAR PX,V;INTEGER OPT);
EXTERNAL PROCEDURE MKEVTT(ITEMVAR T);
EXTERNAL PROCEDURE JOIN(SET JSET);
EXTERNAL PROCEDURE SUSPEND(ITEMVAR PX);
EXTERNAL PROCEDURE TERMINATE(ITEMVAR PX);
EXTERNAL ITEMVAR PROCEDURE MYPROC;
EXTERNAL ITEMVAR PROCEDURE CALLER(ITEMVAR PX);
EXTERNAL PROCEDURE INTSET(ITEMVAR PX;INTEGER PY);
EXTERNAL PROCEDURE INTTBL(INTEGER BFSIZ);
EXTERNAL PROCEDURE INTMOD;
EXTERNAL PROCEDURE CLKMOD;
EXTERNAL PROCEDURE DFRINT;
EXTERNAL PROCEDURE ENABLE(INTEGER INDEX);
EXTERNAL PROCEDURE DISABLE(INTEGER INDEX);
EXTERNAL PROCEDURE INTMAP(INTEGER INDEX;PROCEDURE FOO;INTEGER PARAM);
EXTERNAL INTEGER PROCEDURE DFCPKT(INTEGER ADDR;ITEMVAR TYP,NOT;INTEGER OPTS);


COMMENT DEFAULT VARIABLES FOR SPROUT OPTIONS;
EXTERNAL INTEGER DEFSSS, COMMENT STRING STACK;
	DEFPSS,		COMMENT SYSTEM STACK;
	DEFPRI,		COMMENT PRIORITY;
	DEFQNT;		COMMENT QUANTUM;

COMMENT OPTIONS FOR SPROUT;
DEFINE QUANTUM(X)= "(X LSH 18)",
	STRINGSTACK(X)="(X LSH 14)",
	PSTACK(X)="(X LSH 8)",
	PRIORITY(X)="(X LSH 4)",
	SPNDNP="'10",
	SPNDME="'2",
	RUNME="'1";

COMMENT OPTIONS FOR CAUSE;
DEFINE DONTSAVE="1",
   	TELLALL="2",
	RESCHEDULE="4";

COMMENT OPTIONS FOR INTERROGATE;
DEFINE RETAIN ="1",
	WAIT="2",
	SAY_WHICH="'10";

DEFINE EVENT_TYPE="EVTYPI";

COMMENT OPTIONS FOR RESUME;
DEFINE	NOTNOW=1,
	MY_STATUS(X)="((X LAND '3) LSH 2)";

COMMENT STATUS CODES;
DEFINE RUNNING=-1,
	READY=1,
	SUSPENDED=0,
	TERMINATED=2;

COMMENT USEFUL MACROS FOR INTERRUPTS;

DEFINE INTSWW_INX=0,
	INTSWD_INX=1,
	INTSHW_INX=2,
	INTSHD_INX=3,
	INTTTY_INX=4,
	INTPTO_INX=5,
	INTMAIL_INX=6,
	INTPTI_INX=8,
	INTCLK_INX=10,
	INTPOV_INX=19,
	INTILM_INX=22,
	INTNXM_INX=23,
	INTFOV_INX=29,
	INTOV_INX=32;



DEFINE AUTO_POLL(X)="REQUIRE X POLLING_INTERVAL";
DEFINE NO_AUTO_POLLING="AUTO_POLL(0)";
EXTERNAL INTEGER NOPOLL;
DEFINE POLLON="NOPOLL←0";
DEFINE POLLOFF="NOPOLL←1";

DEFINE SCHEDULE_ON_CLOCK_INTERRUPTS=
	"BEGIN
	INTMAP(INTCLK_INX,CLKMOD,0);
	ENABLE(INTCLK_INX);
	END";

DEFINE DEFERRED_CAUSE_ON_INTERRUPT(INX,TYP,NOT,OPT)=
	"INTMAP(INX,DFRINT,DFCPKT(0,TYP,NOT,OPT))";
COMMENT NOTE THAT THIS DOES NOT DO AN ENABLE;


COMMENT NOTE ALSO THAT YOU SHOULD DO AN INTSET(INT_PROCESS_ITEM,OPTS)
	BEFORE TRYING TO USE DEFERRED CAUSES;