Google
 

Trailing-Edge - PDP-10 Archives - decuslib10-02 - 43,50242/poomas.doc
There are no other files named poomas.doc in the archive.
00100	
00200	
00300	
00400	
00500	
00600	
00700	
00800	
00900	
01000	
01100	     PPPPPPP    OOOOOO    OOOOOO   M      M     AA      SSSSSSS

01200	     P      P  O      O  O      O  MM    MM    A  A    S
01300	     P      P  O      O  O      O  M M  M M   A    A   S
01400	     P      P  O      O  O      O  M  MM  M  A      A  S
01500	     PPPPPPP   O      O  O      O  M      M  AAAAAAAA   SSSSSS
01600	     P         O      O  O      O  M      M  A      A         S

01700	     P         O      O  O      O  M      M  A      A         S

01800	     P         O      O  O      O  M      M  A      A         S

01900	     P          OOOOOO    OOOOOO   M      M  A      A  SSSSSSS
02000	
02100	                  P O O R   M A N ' S   S I M U L A
02200	
02300	
02400	
02500	
02600	       A DISCRETE EVENT SIMULATION PACKAGE FOR USE WITH BLISS
02700	      BASED ON SIMULA-1, SIMULA-67 AND IDEAS OF DR. W. A. WULF
02800	
02900	
03000	
03100	
03200	
03300	
03400	
03500	
03600	             .
03700	POORIFIED BY AMUND LUNDE
03800	
03900	
04000	
04100	VERSION 2
04200	CARNEGIE-MELLON UNIVERSITY, MAY 1971.
     
00100	                       I N T R O D U C T I O N
00200	
00300	
00400	
00500	POOMAS - POOR MANS SIMULA - CONSISTS OF A SET OF BLISS  ROUTINES  AND
00600	MACROS  WHICH  FACILITATE  WRITING  OF  DISCRETE EVENT SIMULATIONS IN
00700	BLISS. THE INFLUENCE FROM SIMULA AND SIMULA-67 ON THE DESIGN IS  VERY
00800	STRONG,  -  TRANSLATION  OF PROGRAMS FROM SIMULA INTO POOMAS/BLISS OR
00900	VICE VERSA SHOULD BE REASONABLY STRAIGHTFORWARD.
01000	
01100	ONE IMPORTANT FEATURE OF SIMULA, LACKING IN POOMAS, IS THE  SECURITY,
01200	IN THE SENSE THAT
01300	  1) THE RESULT OF EXECUTING AN INCORRECT PROGRAM SHOULD BE PREDICT-
01400	ABLE FROM STUDYING THE PROGRAM WITHOUT RESORT TO KNOWLEDGE ABOUT  THE
01500	IMPLEMENTATION, AND
01600	  2) ALL DETECTABLE ERRORS SHOULD BE DETECTED.
01700	SINCE BLISS HAS NO TYPES, SECURITY CAN NOT BE IN  ANY  WAY  COMPLETE,
01800	ALTHOUGH CONSIDERABLE CHECKING IS BUILT INTO THE POOMAS ROUTINES. THE
01900	LACK OF TYPES, IN PARTICULAR POINTERS, ALSO MAKES AUTOMATIC  GARBAGE-
02000	COLLECTION  IMPOSSIBLE.    ALSO, SINCE THE COMPILER DOES NOT KEEP THE
02100	SYMBOL TABLE FOR 'INVISIBLE' PROCEDURE BODIES, REMOTE ACCESSING IS BY
02200	ORDINAL NO. IN THE ACTIVATION RECORD RATHER THAN BY IDENTIFIER.
02300	
02400	A STUDY OF SIMULA REVEALS THREE IMPORTANT AND INDEPENDENT CONCEPTS.
02500	  1) LIST PROCESSING
02600	  2) COROUTINE CREATION, EXECUTION, AND ACCESS TO VARIABLES IN COROU-
02700	     TINES.
02800	  3) QUASI PARALLELL EXECUTION, - I.E. SEQUENCING OF PROCESSES (CO-
02900	     ROUTINE INSTANCES) ACCORDING TO (SIMULATED) TIME.
03000	
03100	ACCORDINGLY, POOMAS HAS THREE DISJOINT PARTS: 
03200	  1) BLIPP - BLISS LIST PROCESSING PACKAGE
03300	  2) CAP - COROUTINE ACCESS PACKAGE
03400	  3) QPEP - QUASI PARALLELL EXECUTION PACKAGE.
03500	IN  ADDITION  ARE  ROUTINES  FOR  GENERATION  OF  RANDOM NUMBERS FROM
03600	VARIOUS DISTRIBUTIONS, COLLECTION  OF  STATISTICS,  SOME  SIMPLE  I/O
03700	ROUTINES, AND DEBUGGING AIDS.  EXEPT FOR THE DEBUGGING PACKAGE THESE
03800	CAP  AND  BLIPP  ARE INDEPENDENT.  QPEP USES BLIPP FOR SEQUENCING SET
03900	MAINTENANCE AND STORES SYSTEM INFORMATION IN THE BLIPP SYSTEM  WORDS.
04000	
04100	THE READER IS ASSUMED TO BE FAMILIAR WITH SIMULA.
04200	SEE:  DAHL, O. J. AND NYGAARD, K:
04300	      SIMULA - AN ALGOL BASED SIMULATION LANGUAGE.
04400	      CACM SEPT.-66.
04500	A BRIEF SURVEY OF THE MOST IMPORTANT CONCEPTS IS GIVEN IN SECT. 6.
04600	
04700	THROUGHOUT THIS DOCUMENT THE WORD PROCEDURE IS USED TO  MEAN  ROUTINE
04800	OR FUNCTION.
04900	
05000	A  SURVEY OF RECENT CHANGES TO POOMAS, AND TO THIS DOCUMENT, IS GIVEN
05100	IN SECT. 3.
05200	
05300	PLEASE REPORT ERRORS AND DEFICIENCIES TO:
05400		MR. AMUND LUNDE
05500		DEPT. OF COMPUTER SCIENCE
05600		CARNEGIE-MELLON UNIVERSITY
05700		SCHENLEY PARK
05800		PITTSBURGH, PA. 15213.
     
00100	                          C O N T E N T S :
00200	
00300	
00400	
00500	SECTION AND PAGE NUMBERING AS OBTAINED BY PRINTING WITH L COMMAND  IN
00600	SOS.
00700	
00800	
00900	SECT
01000	 2	INTRODUCTION
01100	 3	TABLE OF CONTENTS
01200	 4 	SURVEY OF CHANGES
01300	 5	MODULES AND FILES
01400	 6	MINI INTRODUCTION TO QUASI PARALLELL SIMULATION
01500	 7	BLIPP - THE LIST PROCESSING PACKAGE
01600	 8	CAP - THE COROUTINE ACCESS PACKAGE
01700	 9	QPEP - THE QUASI PARALLELL EXECUTION PACKAGE
01800	10	THE POOMAS FILE
01900	11	RANDOM NUMBER GENERATION
02000	12	COLLECTION OF STATISTICS
02100	13	DEBUGGING AIDS
02200	14	ERROR HANDLING
02300	15	AN EXAMPLE
02400	16	COMMON PITFALLS.
     
00100	                 S U R V E Y   O F   C H A N G E S :
00200	
00300	
00400	
00500	SEPT. 8, 1971
00600	SMALL EXTENSION TO SUC AND PRED MACROS.  (SECT. 7).
00700	CALL-FEATURE OF DEBUGGING PACKAGE NOW AVAILABLE FROM  BREAKPOINTS  IN
00800	DDT.  (SECT. 13).
00900	
01000	MAY 25, 1971.
01100	INCLUDE  WILL  CREATE  REP'S  IF NECESSARY, AND QPEP WILL SEE THROUGH
01200	THEM. MEM (FREELIST) IS NOW AT TOP OF LOWSEG,  AUTOMATICALLY  SET  UP
01300	AND  EXPANDED  AS NEEDED UP TO MAXIMUM SET BY USER. I/O IS CHANGED TO
01400	USE THE BLISS I/O PACKAGE; A CONFIGURATION OF THIS JUST LARGE  ENOUGH
01500	TO  SUPPORT POOMAS IS PROVIDED. ROUTINES FOR STATISTICS GATHERING AND
01600	HISTOGRAM PRINTOUT ARE ADDED (SECT. 12).
01700	
01800	MARCH 15, 1971:
01900	SECTION ON COMMON PITFALLS ADDED TO DOCUMENTATION.
02000	
02100	FEB 22, 1971:
02200	DEBUGGING  FACILITIES  ADDED (INCLUDING HELP), SEE SECT. 13. BUGS AND
02300	DEFICIENCIES  CORRECTED.  DOCUMENTATION  IMPROVED   AND   REORGANIZED
02400	THROUGHOUT.
02500	
02600	FEB 8, 1971.
02700	BUGS AND DEFICIENCIES CORRECTED. NEW MAY  NOT  BE  USED  RECURSIVELY,
02800	RALF/RAFL  INFO  PRESERVED IN PROCESSES AND REMOTE ACCESSORS MODIFIED
02900	ACCORDINGLY.
03000	
03100	FEB. 3, 1971:
03200	ERROR  MESSAGES  DESCRIBED  IN  SECT. 14. RELOCATABLE VERSIONS OF ALL
03300	MODULES NOW ON FILE POOLIB.REL (BUT DONT USE LIBRARY  SEARCH  ON  IT!
03400	LOAD IT ALL.).
03500	
03600	FEB 1, 1971:
03700	RANDOM NUMBER  ROUTINES  ADDED,  MODULE  RANDNO.  DESCRIPTION  BELOW,
03800	SECTION 11.
03900	
04000	JAN 7, 1971:
04100	REVISED TO ACCOUNT FOR COROUTINE EXPRESSIONS NOW IN BLISS.
04200	
04300	DEC. 1970:
04400	MAJOR REVISION OF WHOLE DOCUMENT.
     
00100	                        THE MODULES OF POOMAS
00200	
00300	
00400	
00500	BLIPP  -  CONTAINS  ALL  OF BLIPP AND SOME ROUTINES FOR OUTPUT TO THE
00600	          TTY.
00700	
00800	QPEP - CONTAINS QPEP.
00900	
01000	RANDNO - CONTAINS ROUTINES FOR RANDOM NUMBER GENERATION.
01100	
01200	POOLOG - LOGARITHM USED BY RANDNO
01300	
01400	POOEXP - EXPONENTIAL USED BY RANDNO
01500	
01600	POSQRT - SQUARE ROOT USED BY RANDNO.
01700	
01800	PHELP - POOMAS VERSION OF THE BLISS HELP PACKAGE.
01900	
02000	POODAT - DATA COLLECTION AND OUTPUT.
02100	
02200	MAIN - THE USER MODULE, CREATED FROM  THE  POOMAS-FILE  +  THE  USERS
02300	       PROGRAM.
02400	
02500	
02600	
02700	THE RELEVANT FILES ARE:
02800	
02900	SOURCE        RELOCATABLE      DOCUMENTATION
03000	
03100	              POOLIB.REL
03200	BLIPP.BLI     BLIPP.REL
03300	QPEP.BLI      QPEP.REL
03400	POOMAS.BLI                     POOMAS.DOC
03500	RANDNO.BLI    RANDNO.REL
03600	POOLOG.MAC    POOLOG.REL
03700	POOEXP.MAC    POOEXP.REL
03800	POSQRT.MAC    POSQRT.REL
03900	PHELP.BLI     PHELP.REL
04000	POODAT.BLI    POODAT.REL
04100		      POOIO.REL
04200	
04300	THE RELOCATABLE VERSIONS OF  ALL  NON  I/O  MODULES  RESIDE  ON  FILE
04400	POOLIB.REL.  IT  IS CONSIDERABLY FASTER TO LOAD THIS THAN ALL MODULES
04500	SEPARATELY. SIMILARLY FOR POOIO.REL WHICH CONTAINS THE  I/O  MODULES.
04600	NOTE  HOWEVER  THAT  THE  WHOLE  FILE  HAS  TO BE LOADED LIKE ANY OLD
04700	RELOCATABLE FILE, - LIBRARY SEARCH  DOSN'T  WORK.   THIS  IS  DUE  TO
04800	PROBLEMS INVOLVING BLISS, FUDGE2 AND THE LOADER.
04900	
05000	THE  USER  WILL  NORMALLY  BE  CONCERNED  WITH POOLIB.REL, POOIO.REL,
05100	POOMAS.BLI AND POOMAS.DOC.
05200	
05300	AT CMU THE MOST RECENT VERSIONS OF THESE MAY BE PULLED OFF  THE  DISK
05400	AREA OF N111AL10, [31500,7634] AT ANY TIME (MODULO DISK FAILURE).
     
00100	         A MINI-INTRODUCTION TO QUASI PARALLELL SIMULATION.
00200	
00300	
00400	
00500	CLASSES AND PROCESSES
00600	
00700	BY  "SYSTEM"  WE MEAN THAT PORTION OF THE REAL WORLD WHICH WE WANT TO
00800	SIMULATE.  MOST SYSTEMS CONSIST OF SEVERAL  ACTIVITIES  GOING  ON  IN
00900	PARALLELL  AND MORE OR LESS INDEPENDENTLY, BUT INTERACTING AT CERTAIN
01000	TIMES.  IN A COMPUTER IT IS NATURAL TO MODEL  THIS  BY  CO-  ROUTINES
01100	WHICH  INTERACT.   SOME OF THE PARALLELL ACTIVITIES IN THE SYSTEM ARE
01200	SO SIMILAR THAT THEY  MAY  BE  DESCRIBED  BY  THE  SAME  PROGRAM  BUT
01300	OPERATING  ON  DIFFERENT  DATA.   HENCE BY A "CLASS" WE MEAN A SET OF
01400	COROUTINES HAVING THE SAME PROGRAM (OR OPERATION RULE) AND  DIFFERENT
01500	BUT  SIMILARLY STRUCTURED DATA (ACTIVATION RECORDS).  EACH PARTICULAR
01600	COROUTINE INSTANCE FROM A CLASS IS CALLED A "PROCESS" OF THAT  CLASS.
01700	A  PROCESS,  THEN,  HAS ITS OWN DATA-RECORD DESCRIBING ITS ATTRIBUTES
01800	BUT SHARES ITS PROGRAM WITH  ALL  PROCESSES  OF  THE  SAME  CLASS.  A
01900	PROCESS IS IDENTIFIED BY ITS "PROCESS DESCRIPTOR", WHICH IS THE VALUE
02000	OF THE CREATING EXPRESSION AND CONSISTS OF  THE  STACK  BASE  OF  THE
02100	PROCESS + POSSIBLY OTHER INFORMATION DESCRIBED ELSEWHERE.
02200	
02300	IF OUR SYSTEM CONSISTS OF MEN AND MACHINES, SAY, IT MAY BE REASONABLE
02400	TO HAVE TWO CLASSES, MAN AND MACHINE, EACH REPRESENTED BY  A  ROUTINE
02500	DECLARATION.   A  MAN-PROCESS  (I.E.  A COROUTINE INSTANCE OF THE MAN
02600	ROUTINE) MIGHT BE CREATED CORRESPONDING TO A MAN REPORTING TO WORK IN
02700	THE  SYSTEM,  IT  MIGHT  BE DESTROYED WHEN THE MAN IN THE SYSTEM GOES
02800	HOME FOR DINNER.  SIMILARLY MACHINE-PROCESSES COULD  BE  CREATED  AND
02900	DESTROYED DYNAMICALLY.
03000	
03100	
03200	EVENTS
03300	
03400	WE FURTHER ASSUME THAT THE SYSTEM CAN BE DESCRIBED  BY  INSTANTANEOUS
03500	ACTIONS  BY  THE  PROCESSES.   SUCH  AN  ACTION IS CALLED AN "EVENT".
03600	SIMULATED TIME FLOWS BETWEEN EVENTS, NOT DURING EVENTS.  TO  SIMULATE
03700	CONTINUITY  EVENTS  HAVE  TO  BE  SPACED  CLOSELY  IN  TIME.  THIS IS
03800	ANALOGOUS TO SOLVING DIFFERENTIAL EQUATIONS ON A DIGITAL  DEVICE.  AN
03900	EVENT  CAN  ONLY  END WHEN THE PROCESS CONCERNED EXECUTES A STATEMENT
04000	THAT EXPLISITLY OR IMPLISITLY ENDS IT.  IMPLISITLY  ENDING  AN  EVENT
04100	COULD  BE  BY SCHEDULING ANOTHER EVENT AHEAD OF IT (AT THE SAME TIME)
04200	OR EXECUTING A RETURN FROM THE OUTMOST PROCEDURE OF THE PROCESS.   AN
04300	EVENT  CAN  NEVER END AS A RESULT OF ANY KIND OF INTERRUPT FROM OTHER
04400	PROCESSES.  THIS IS A CONSEQUENCE OF OUR ASSUMPTION THAT EVENTS  TAKE
04500	NO TIME.
04600	
04700	IN  OUR  SYSTEM  ABOVE,  THE  EVENTS  FOR  A MAN PROCESS MIGHT BE: 1)
04800	ARRIVING AT WORK, 2) WALKING UP TO MACHINE, 3) LOADING MATERIAL  INTO
04900	MACHINE,   4)   REMOVING  PRODUCT  FROM  MACHINE,  5)  LEAVING  WORK.
05000	PRESUMABLY 3 AND 4 WOULD BE ENCLOSED BY A LOOP.
05100	
05200	
05300	STRUCTURE OF OPERATION RULE, REACTIVATION POINT.
05400	
05500	THE  PROGRAM  FOR  A CLASS WILL CONSIST OF STATEMENTS DESCRIBING EACH
05600	EVENT, AND  SEQUENCING  STATEMENTS  WHICH  END  EVENTS  AND  SCHEDULE
05700	OTHERS.   WHEN AN EVENT FOR A PROCESS ENDS, ITS NEXT EVENT WILL START
05800	EXECUTING THE CODE IMMEDIATELY  FOLLOWING  THE  SEQUENCING  STATEMENT
05900	THAT  ENDED  THE  FORMER EVENT.  THIS POINT IN THE CODE IS CALLED THE
06000	"REACTIVATION POINT" OF THE PROCESS, AND ITS ADDRESS IS STORED IN THE
06100	ACTIVATION  RECORD  OF THE PROCESS.  WHEN A PROCESS EXECUTES A RETURN
06200	FROM ITS OUTERMOST PROCEDURE, IT WILL LOSE ITS REACTIVATION POINT AND
06300	CAN NOT BE REVIVED.
06400	
06500	
06600	SCHEDULING
06700	
06800	A  PROCESS  MAY,  BY  EXECUTING  APPROPRIATE  SCEDULING   STATEMENTS,
06900	INDICATE  THAT IT, OR SOME OTHER PROCESS, WILL HAVE ITS NEXT EVENT AT
07000	SOME GIVEN TIME OR BEFORE OR AFTER SOME GIVEN  EVENT.   IT  MAY  ALSO
07100	CANCEL  ANY  EVENT  PREVIOUSLY  SCHEDULED,  INCLUDING ITS OWN CURRENT
07200	EVENT.  IF A PROCESS SCHEDULES ITSELF, ITS  CURRENT  EVENT  WILL  END
07300	IMMEDIATELY.  A PROCESS HAS AT MOST ONE EVENT SCHEDULED FOR IT AT ANY
07400	ONE TIME, AND IF THERE IS ONE THE PROCESS IS SAID TO BE SLATED.   THE
07500	CURRENT PROCESS IS ALWAYS SLATED.
07600	
07700	IT  IS  SEEN  THAT  THE  IDENTITY  OF  THE NEXT EVENT OF A PROCESS IS
07800	DETERMINED BY THAT PROCESS ITSELF, I.E.  THE  REACTIVATION  POINT  IS
07900	DETERMINED  BY  THE OPERATION RULE OF THE PROCESS.  HOWEVER, THE TIME
08000	WHEN THIS EVENT WILL OCCUR CAN BE DETERMINED BY ANY PROCESS  THAT  IS
08100	ABLE TO REFERENCE THE PROCESS (SCHEDULE IT).
08200	
08300	
08400	EVENTNOTICES AND SEQUENCING SET
08500	
08600	SLATED EVENTS ARE REPRESENTED BY EVENTNOTICES, WHICH ARE MEMBERS OF A
08700	LINEAR LIST CALLED THE SEQUENCING SET OR SQS.  THE NOTICES IN SQS ARE
08800	ORDERED BY TIME, WHICH IS A FLOATING POINT VALUE.  THE  FIRST  NOTICE
08900	IN  SQS  REPRESENTS  THE  CURRENT EVENT.  IT IS NECESSARY TO HAVE THE
09000	CURRENT EVENT REPRESENTED IN SQS, SINCE IT MAY SCHEDULE OTHER  EVENTS
09100	IN  FRONT  OF  ITSELF  AT  THE  SAME  TIME.   TIME  MAY, HOWEVER, NOT
09200	DECREASE. EACH EVENTNOTICE ALSO CONTAINS A PROCESS DESCRIPTOR FOR THE
09300	PROCESS  THAT  WILL  EXECUTE  THE  EVENT.  IT IS SEEN THAT SEQUENCING
09400	CONSISTS OF CHANGING THE SQS, SCHEDULING  OF  INTRODUCING  OR  MOVING
09500	EVENTNOTICES IN SQS.
09600	
09700	
09800	SIMULTANEITY
09900	
10000	THERE MAY BE MANY EVENTS TAKING PLACE AT THE SAME SIMULATED TIME, THE
10100	SCHEDULING  STATEMENTS  HAVE PARAMETERS TO CONTROL WHETHER EVENTS ARE
10200	SCHEDULED FIRST OR LAST AMONG THE ALREADY SLATED EVENTS AT THAT TIME,
10300	AND  ALSO PARAMETERS TO SCHEDULE AN EVENT IMMEDIATELY BEFORE OR AFTER
10400	ANY GIVEN SLATED EVENT, AT THE  SAME  SIMULATED  TIME  AS  THE  GIVEN
10500	EVENT. THIS COMPLETELY DETERMINES THE SEQUENCE OF EVENTS.
10600	
10700	
10800	THE MAIN PROGRAM
10900	
11000	INITIALLY THE MAIN PROGRAM  IS  THE  ACTIVE  AND  ONLY  PROCESS,  AND
11100	INITQPEP  WILL PUT AN EVENTNOTICE FOR IT, WITH TIME REFERENCE 0.0, IN
11200	THE SQS.  IT IS THE RESPONSIBILITY OF THE MAIN PROGRAM TO  START  THE
11300	SIMULATION BY CREATING AND SCHEDULING OTHER PROCESSES.
11400	
11500	USUALLY  THE MAIN PROGRAM WILL REGAIN CONTROL, EITHER BY RESCHEDULING
11600	ITSELF OR BY BEING RESCHEDULED FROM SOME  OTHER  PROCESS,  TO  OUTPUT
11700	STATISTICS AND FINISH THE SIMULATION OR START ANOTHER ONE.
11800	
11900	A SMALL EXAMPLE IS GIVEN IN SECT. 15.
     
00100	                              B L I P P
00200	
00300	
00400	
00500	LISTS AND OBJECTS:
00600	
00700	LISTS  ARE  DOUBLY  LINKED, CIRCULAR AND WITH A DESIGNATED HEAD.  THE
00800	MEMBERS, INCLUDING THE HEAD, ARE CALLED OBJECTS.  OBJECTS ARE MEMBERS
00900	OF  AT  MOST  ONE  LIST.   TO  MAINTAIN UNIFORM REFERENCES TO OBJECTS
01000	THROUGHOUT, ALL OBJECTS ARE REFERENCED  BY  THEIR  WORD  0  WHICH  IS
01100	ACTUALLY  THE  FOURTH  WORD.   THE  ADDRESS  OF  WORD 0 IS CALLED THE
01200	ADDRESS OF THE OBJECT.  THIS HOLDS EVEN FOR 2 AND 3 WORD OBJECTS, AND
01300	SHOULD  CAUSE  NO  CONFUSION  AS  LONG AS ONE KEEPS WITHIN THE POOMAS
01400	ROUTINES AND MACROS.  WORDS -3, -2, AND  -1  ARE  CALLED  THE  SYSTEM
01500	WORDS,  WORDS  0  THROUGH  SIZE-4  ARE  CALLED  THE USER WORDS OF THE
01600	OBJECT.  IF QPEP IS NOT USED, THE USER MAY USE WORD  -1.  INFORMATION
01700	RELEVANT TO BLIPP IS KEPT IN WORDS -3 AND -2 OF EACH OBJECT.  OBJECTS
01800	MAY CONTAIN ACTIVATION RECORDS FOR COROUTINES.   IN THAT CASE WORD  0
01900	IS THE STACK BASE OF THE COROUTINE.  WORD -1 IS RESERVED FOR QPEP.
02000	
02100	
02200	FREE-LIST MANAGEMENT:
02300	
02400	SPACE  FOR  OBJECTS  IS  TAKEN  FROM  AN  AREA  MEM OF SIZE .MEMSIZE.
02500	INITIALLY MEM WILL CONSIST OF THE UNUSED SPACE AT  THE  HIGH  END  OF
02600	LOWSEG. A FREE - LIST IS MAINTAINED IN MEM.  THE USER MAY PUT OBJECTS
02700	ON THE FREE - LIST THAT WERE NOT PREVIOUSLY  WITHIN  MEM,  AND  BLIPP
02800	WILL,  WHEN  NEEDED,  REQUEST  ADDITIONAL  MEMORY  FROM THE OPERATING
02900	SYSTEM THAT NEED NOT BE  CONTIGUOUS  WITH  MEM.   IN  PARTICULAR  I/O
03000	BUFFERS  OBTAINED BY USUAL METHODS MAY BE INTERSPERSED BETWEEN PIECES
03100	OF MEM. MEM WILL NOT BE  EXPANDED  BEYOND  THE  SIZE  .MAXMEM,  EXEPT
03200	POSSIBLY  FOR THE INITIAL ALLOCATION.  IF THE PROGRAM IS RESTARTED BY
03300	THE $G COMMAND TO DDT, MEMORY SIZE WILL NOT BE  REDUCED.   CONTIGUOUS
03400	OBJECTS  ON THE FREE - LIST ARE MERGED.   IT IS THE RESPONSIBILITY OF
03500	THE USER TO RETURN OBJECTS TO THE FREELIST WHEN HE  NO  LONGER  NEEDS
03600	THEM.   THE  FREE  - LIST IS ORGANIZED AS ANY OTHER BLIPP LIST AND IS
03700	MAINTAINED USING NORMAL BLIPP ROUTINES.
03800	
03900	
04000	MULTIPLE LIST MEMBERSHIP:
04100	
04200	IF IT IS NECCESSARY THAT AN OBJECT BE A MEMBER OF MORE THAN ONE LIST,
04300	REPRESENTATIVES (REP-OBJECTS) MUST BE USED.  INCLUDE  WILL  CREATE  A
04400	REP  WHENEVER  THE  OBJECT  TO  BE INCLUDED IS ALREADY A LIST MEMBER.
04500	OTHERWISE IT IS UP TO THE USER TO CREATE REP'S.  NO  BLIPP  ROUTINES,
04600	BUT  ALL  QPEP  ROUTINES THAT EXPECT A PROCESS AS PARAMETER, WILL SEE
04700	THROUGH REP'S.
04800	
04900	
05000	
05100	OBJECT STRUCTURE
05200	
05300	
05400	   _______________
05500	-3 ^ PRED ^ SUC  ^   PRED AND SUC CONTAIN THE ADDRESSES OF THE PREDE-
05600	-2 ^CLASS ^ SIZE ^   CESSOR AND SUCCESSOR IN THE LIST, IF THE  OBJECT
05700	-1 ^             ^   IS NOT A MEMBER OF ANY LIST THEY CONTAIN NONE (A
05800	   ---------------   MACRO). SIZE IS THE SIZE OF THE OBJECT, INCLU-
05900	 0 ^             ^   DING SYSTEM WORDS. CLASS IS USED BY BLIPP AND 
06000	   ^             ^   USERS TO CLASSIFY OBJECTS.
06100	   ^             ^
06200	   ---------------
06300	
06400	
06500	THE FOLLOWING VALUES OF CLASS ARE RECOGNICED BY BLIPP:
06600	
06700	.CLASS=FREECLASS (0)
06800	OBJECT IS MEMBER OF FREE - LIST.
06900	
07000	.CLASS=HEADCLASS  (-1)
07100	OBJECT  IS  A LIST HEAD.  IF THE LIST IS EMPTY THE PRED AND SUC POINT
07200	TO THE HEAD ITSELF.      SIZE IS 2.
07300	
07400	.CLASS=REPCLASS (-2)
07500	OBJECT  IS A REPRESENTATIVE.  OBJREF (IN WORD -1) CONTAINS ADDRESS OF
07600	OBJECT REPRESENTED.    SIZE IS 3.
07700	
07800	.CLASS=100 (DECIMAL)
07900	DEFAULT VALUE ASSIGNED BY GETSPACE.
08000	
08100	
08200	OTHER CLASSES:
08300	
08400	QPEP USES THE FOLLOWING CONVENTIONS:
08500	
08600	.CLASS=EVNOTCLASS (-3)
08700	OBJECT  IS  EVENTNOTICE,  AND  A  MEMBER OF THE SEQUENCING SET (SQS).
08800	SIZE IS 4.  WORD -1 CONTAINS THE REFERENCE (SEE CAP) TO  THE  PROCESS
08900	TO  BE  ACTIVATED, WORD 0 CONTAINS THE SIMULATED TIME WHEN ACTIVATION
09000	IS TO OCCUR.
09100	
09200	OBJECT   IS  A  PROCESS:
09300	.CLASS  IS  THE ADDRESS OF THE FIRST INSTRUCTION OF THE PROCEDURE FOR
09400	THE PROCESS.   QPEP CHECKS FOR CORRECTNESS BY THE  ROUTINE  ISPROCESS
09500	(SEE BELOW).
09600	
09700	
09800	SUBLISTS MAY BE IMPLEMENTED USING REP'S.
09900	
10000	THE CLASS NAMES USED ABOVE ARE DEFINED AS MACROS.
10100	
10200	
10300	
10400	THE DECLARATION 'STRUCTURE OBJECT'
10500	
10600	
10700	IF X CONTAINS THE ADDRESS OF AN OBJECT OR A PROCCESS REFERENCE (CAP),
10800	AND THE DECLARATION
10900	 MAP OBJECT X;
11000	IS  VALID, THE MACROS AND ROUTINES OF BLIPP (AND QPEP) MAY BE USED TO
11100	MANIPULATE THE OBJECT AT .X.
11200	
11300	THE  FOLLOWING  MACROS SUPPLY POINTERS TO THE VARIOUS STANDARD FIELDS
11400	OF AN OBJECT:
11500	
11600	    PRED(E) = (E[-3]<18,18>)$,              ! PREDECESSOR FIELD.
11700	    SUC(E) = (E[-3]<0,18>)$,                ! SUCCESSOR FIELD.
11800	    CLASS(E) = (E[-2]<18,18>)$,             ! CLASS FIELD.
11900	    SIZE(E) = (E[-2]<0,18>)$,               ! SIZE FIELD.
12000	    POINTERS(E) = (E[-3])$,                 ! PRED AND SUC COMBINED.
12100	    OBJREF(E) = (E[-1])$;                   ! OBJECT REFERENCE FIELD.
12200	
12300	NOTE:   THE ACTUAL PARAMETER TO THESE  MACROS  SHOULD  EITHER  BE  AN
12400	IDENTIFIER  MAPPED  TO OBJECT, OR AN EXPRESSION WHICH EVALUATES TO AN
12500	OBJECT ADDRESS.   SUCH EXPRESSIONS MUST BE ENCLOSED  IN  PARENTHESIS.
12600	I.E.:  IF OB IS MAPPED TO OBJECT THE FOLLOWING IS LEGAL:
12700		OB _ .SUC((.PRED(OB)));
12800	
12900	
13000	
13100	FOLLOWING IS A DESCRIPTION OF THE ROUTINES OF BLIPP.
13200	
13300	
13400	
13500	INITIALIZATION OF BLIPP:
13600	
13700	INITBLIPP()
13800	WILL INITIALIZE MEM AT THE TOP OF LOWSEGMENT (SEE INITMEM), AND  ALSO
13900	SOME BLIPP VARIABLES INCLUDING MEMOB AND MEMSIZE.
14000	VALUE: .MEMSIZE-2.
14100	
14200	
14300	
14400	MEMORY MANAGEMENT:
14500	
14600	
14700	INITMEM()
14800	THIS  ROUTINE  ASSUMES  THAT  MEM  IS  CONTIGUOUS  FROM  .MEMOB-3  TO
14900	.MEMOB-3+.MEMSIZE  IT  WILL  CLEAR  ALL  WORDS  OF  MEM  AND SET UP A
15000	FREELIST WITH ITS HEAD AT .MEMOB. THIS  ROUTINE  SHOULD  BE  USED  TO
15100	REINITIALIZE THE OLD MEM, SINCE INITBLIPP WOULD OBTAIN COMPLETELY NEW
15200	SPACE FROM THE MONITOR.  BEWARE HOWEVER:  ALL  I/O  BUFFERS  MUST  BE
15300	INITIALIZED BEFORE THE INITIAL CALL TO INITMEM OR ELSE . .  .!    THE
15400	USER DOES THIS BY DECLARING A GLOBAL ROUTINE INITIO, WHICH DOES THIS,
15500	IN HIS PROGRAM.  SEE PARAGRAPH ON I/O BELOW.
15600	VALUE: .MEMSIZE-2.
15700	
15800	GETSPACE(WDS)
15900	WILL  FIND  SPACE FOR AN OBJECT OF SIZE .WDS FROM THE FREE LIST.  THE
16000	USER WORDS ARE CLEARED TO ZEROES, SUC AND PRED ARE SET TO NONE, CLASS
16100	IS SET TO 100 (DECIMAL).
16200	VALUE: 0 IF SPACE NOT AVAILABLE, OTHERWISE ADDRESS OF OBJECT.
16300	
16400	RELEASESPACE(OBJ)
16500	WILL RETURN THE SPACE OF THE OBJECT AT .OBJ TO THE FREE LIST, MERGING
16600	IT WITH NEIGHBOURING FREE SPACE IF POSSIBLE.
16700	VALUE: 0 IF ERRORS, OTHERWISE 1.
16800	
16900	FOR REASONS OF SECURITY, POOMAS USERS SHOULD  PREFER  NEW,  MAKELIST,
17000	MAKEREP  OR  POSSIBLY  MAKEOBJ  TO  CREATE  OBJECTS, AND RELEASELIST,
17100	RELEASEMEMBERS OR KILL TO RETURN OBJECTS TO FREELIST.
17200	
17300	
17400	
17500	OBJECT AND SET CREATION:
17600	
17700	THESE  ROUTINES  ARE  USED  TO  CREATE  OBJECTS   OF   STANDARD   AND
17800	USER-INVENTED KINDS.
17900	
18000	MAKELIST()
18100	WILL CREATE A LIST HEAD.
18200	VALUE: 0 IF ERRORS, OTHERWISE ADDRESS OF HEAD.
18300	
18400	MAKEOBJ(WDS,TYPE)
18500	CREATES AN OBJECT OF .WDS USER WORDS AND CLASS .TYPE.
18600	VALUE: 0 IF ERRORS, OTHERWISE ADDRESS OF OBJECT.
18700	
18800	MAKEREP(OBJ)
18900	CREATES A REPRESENTATIVE OF OBJECT AT .OBJ.
19000	VALUE: 0 IF ERRORS, OTHERWISE ADDRESS OF REP.
19100	
19200	
19300	
19400	REMOVAL FROM AND DESTRUCTION OF LISTS.
19500	
19600	REMOVE(X)
19700	REMOVES OBJECT AT .X FROM WHATEVER LIST IT WAS A MEMBER, UNLESS IT IS
19800	A LIST HEADER.
19900	VALUE: 0 IF .X IS NONE OR A HEADER, OTHERWISE .X.
20000	
20100	CLEARLIST(S)
20200	REMOVES ALL MEMBERS OF LIST AT .S.
20300	NOTE:
20400	SHOULD BE USED WITH CAUTION SINCE NON-REFERENCABLE  OBJECTS  ARE  NOT
20500	RETURNABLE TO THE FREE-LIST.
20600	VALUE: 0 IF ERRORS, OTHERWISE .S.
20700	
20800	RELEASELIST(S)
20900	WILL REMOVE ALL MEMBERS OF LIST AT .S INCLUDING THE HEAD AND  RELEASE
21000	THEIR SPACE TO THE FREE LIST.
21100	VALUE: 0 IF ERRORS, OTHERWISE 1.
21200	
21300	RELEASEMEMBERS(S)
21400	AS RELEASELIST BUT DOES NOT RELEASE LIST HEAD.
21500	VALUE: 0 IF ERRORS, OTHERWISE .S.
21600	
21700	
21800	
21900	INSERTION INTO LISTS:
22000	
22100	IF OBJECT AT .X IS ALREADY MEMBER OF SOME LIST  IT  WILL  BE  REMOVED
22200	FROM THAT LIST, EXEPT FOR INCLUDE, WHICH WILL CREATE A REP.  NEXT  IT
22300	WILL  BE  INSERTED  INTO  ANOTHER  LIST  AS FOR THE SPECIFIC FUNCTION
22400	INVOLVED. IN CASE OF ERROR .X IS NOT REMOVED.
22500	
22600	INSERTAFTER(X,Y)
22700	INSERTS .X AFTER .Y IN THE LIST WHERE .Y IS A MEMBER.
22800	VALUE: 0 IF ERRORS, OTHERWISE .X.
22900	
23000	INSERTBEFORE(X,Y)
23100	AS INSERTAFTER BUT INSERTS .X BEFORE .Y.
23200	
23300	INCLUDE(X,S)
23400	.X,  OR A REPRESENTATIVE OF .X, IS INSERTED AS THE LAST MEMBER OF THE
23500	LIST .S.
23600	VALUE: 0 IF ERRORS, OTHERWISE .X.
23700	
23800	REPLACE(OLD,NEW)
23900	.NEW IS INSERTED INSTEAD OF .OLD IN THE LIST WHERE .OLD WAS A MEMBER.
24000	NEITHER OR BOTH ARGUMENTS SHOULD BE HEADS.
24100	VALUE: 0 IF ERRORS, OTHERWISE .OLD
24200	
24300	
24400	
24500	ACCESSING LIST MEMBERS:
24600	
24700	FIRST(S)
24800	FINDS FIRST MEMBER OF LIST AT .S.
24900	VALUE:  0 IF .S IS NOT A LIST, NONE IF IT IS EMPTY, OTHERWISE ADDRESS
25000	OF FIRST MEMBER.
25100	
25200	LAST(S)
25300	ANALOGOUS TO FIRST.
25400	
25500	FIND(S,C,I,X)
25600	ATTEMPTS TO FIND A MEMBER OF THE LIST AT .S, WHICH IS  OF  CLASS  .C,
25700	WHOSE .I'TH WORD CONTAINS .X.
25800	VALUE: 0 IF .S IS NOT A LIST, NONE IF UNSUCCESSFUL, OTHERWISE ADDRESS
25900	OF MEMBER.
26000	
26100	MAPLIST(S,F)
26200	APPLIES THE FUNCTION OR ROUTINE .F TO ALL MEMBERS OF THE LIST  AT  .S
26300	EXEPT  THE  HEAD.   (.F  SHOULD BE THE ADDRESS OF THE ENTRYPOINT). .F
26400	TAKES ONE ARGUMENT, THE CURRENT OBJECT TO WHICH IT SHOULD BE APPLIED.
26500	MAPLIST  HAS  A  POINTER TO THE NEXT MEMBER OF THE LIST, HENCE .F MAY
26600	REMOVE ITS ARGUMENT IF DESIRED, BUT NOT ITS SUCCESSOR.   VALUE  OF  F
26700	SHOULD  BE  NONZERO  UNLESS  ERRORS  OCCUR.   IF  0 IS RETURNED BY F,
26800	MAPLIST WILL EXECUTE A RETURN(0) IMMEDIATELY.
26900	VALUE: 0 IF ERRORS, OTHERWISE 1.
27000	
27100	
27200	
27300	MISCELLANEOUS ROUTINES:
27400	
27500	ISROFUN(P)
27600	CHECKS  WHETHER  .P  IS THE ADDRESS (ENTRYPOINT) OF A PROCEDURE. NOTE
27700	THAT ALL PROCEDURES WILL PASS  THE  TEST,  PROVIDED  THE  PROGRAM  IS
27800	COMPILED  USING  THE  INSPECT  OPTION,  BUT CERTAIN DATA AREAS MAY BE
27900	INDISTINGUISHABLE FROM A 0-PARAMETER,  0-LOCALS,  0-REGISTERS-  SAVED
28000	ROUTINE.  HENCE SOME SUCH AREAS WILL PASS THE TEST.
28100	VALUE: 0 OR 1, 3 IF IN DOUBT.
28200	
28300	EMPTY(S)
28400	VALUE: 1 IF LIST AT .S IS EMPTY, 0 IF IT IS NON-EMPTY
28500	       OR -2 IF S IS NOT A HEAD.
28600	
28700	CARDINAL(S)
28800	VALUE: -1 IF OBJECT AT .S IS NOT A LIST HEAD, OTHERWISE THE # OF
28900	       MEMBERS DISTINCT FROM THE HEAD.
29000	
29100	
29200	
29300	ERROR HANDLING:
29400	
29500	BLIPPERROR(MSG)
29600	BLIPP WILL CHECK FOR INCONSISTENCIES OF PARAMETERS AND SIMILAR  ERROR
29700	CONDITIONS.   WHEN  AN  ERROR  IS  DETECTED THE ROUTINE BLIPPERROR IS
29800	CALLED WITH  A  PARAMETER  DESCRIBING  THE  ERROR.   BLIPPERROR  WILL
29900	DECREASE ERRCOUNT, AND WHEN THIS REACHES 0 EXECUTION WILL BE ABORTED.
30000	THE ERROR INDICATOR IS STORED IN BERRMS. IN ANY CASE BLIPPERROR  WILL
30100	CALL DDTBREAK.
30200	VALUE: .BLIPPERRCOUNT.
30300	
30400	DDTBREAK()
30500	A DUMMY ROUTINE USED AS A BREAKPOINT LOCATION TO FORCE  PROGRAM  INTO
30600	DDT  AT  PREDETERMINED LOCATIONS. ONLY ONE BREAKPOINT, AT 'DDTBREAK',
30700	NEED BE SET IN DDT.  SEE ALSO TRACEBREAK IN QPEP.
30800	VALUE: 0.
30900	
31000	
31100	
31200	INPUT AND OUTPUT:
31300	
31400	POOMAS  DOES  ITS  I/O  THROUGH  THE  BLISS  I/O PACKAGE, AND A SMALL
31500	CONFIGURATION OF THIS, WHICH WILL JUST SUPPORT THE I/O IN  POOMAS  IS
31600	COMPOSED  OF:  BLIO,  SCAN0,  SCNR,  QTAB1,  TRACE1,  NUMIO0, ERROR0,
31700	ERRTB4, FLOUT, DFLT, TBL. THIS IS PROVIDED ON THE FILE POOIO.REL,  TO
31800	SAVE LOAD TIME. THE USER IS FREE TO USE HIS OWN CONFIGURATION AS LONG
31900	AS IT IS A SUPERSET OF THE ABOVE.
32000	
32100	INITIO()
32200	THIS ROUTINE MUST BE DECLARED AS A GLOBAL ROUTINE BY  ALL  USERS  WHO
32300	HAVE  POOMAS.BLI  AS  A PREFIX TO THEIR PROGRAM.  (SEE SECT. 10).  IF
32400	ALL FILE-INITIALIZATIONS, INCLUDING AN INITIAL READ OR WRITE ON  EACH
32500	FILE,  ARE  DONE IN INITIO, THE BUFFERS WILL ALL BE SET UP BEFORE MEM
32600	IS INITIALIZED, AND MEM WILL BE CONTIGUOUS AND ABOVE THE  BUFFERS  IN
32700	LOWSEG.   HENCE THE BUFFERS WILL BE SAVED ACROSS INITMEM() CALLS (BUT
32800	OF COURSE NOT ACROSS $G'S IN DDT).  IF  IT  IS  NOT  DESIRED  TO  USE
32900	INITMEM,  OR  IF  ONLY CHANNEL 0 IS USED, INITIO MAY BE DUMMY, BUT IT
33000	MUST BE PRESENT.
33100	
33200	
33300	THE  FOLLOWING MACROS AND ROUTINES SERVE TO INTERFACE PREVIOUS I/O IN
33400	POOMAS TO BLIO.
33500	
33600	
33700	TYPE(WORD,LF)  - MACRO -
33800	TYPES UP TO 5 CHARACTERS AT THE TTY.   WORD SHOULD BE A  LEFTADJUSTED
33900	STRING  OF  AT  MOST  5  CHARACTERS,  LF  SHOULD BE ODD IF A CR,LF IS
34000	DESIRED FOLLOWING THE STRING.
34100	VALUE: 0.
34200	
34300	TYPDEC(N,LF)  - MACRO -
34400	OUTPUTS N AS A DECIMAL INTEGER, LEADING ZEROES SUPPRESSED,  USING  AS
34500	LITTLE  SPACE  AS POSSIBLE.  IF LF IS ODD, NUMBER WILL BE FOLLOWED BY
34600	CR,LF.
34700	VALUE: 0.
34800	
34900	TYPFLT(N,LF)  - MACRO -
35000	OUTPUTS  N  AS  A  DECIMAL  FLOATING  POINT  NUMBER,  LEADING  ZEROES
35100	SUPPRESSED, USING AS LITTLE SPACE AS POSSIBLE.  IF LF IS ODD,  NUMBER
35200	WILL BE FOLLOWED BY CR,LF.
35300	VALUE: 0.
35400	
35500	TYPOCT(N,LF)  - ROUTINE -
35600	TYPES .N AS AN UNSIGNED OCTAL NUMBER, FOLLOWED BY CR,LF  IFF  .LF  IS
35700	ODD. LEADING ZEROES ARE SUPPRESSED.
35800	VALUE: 0.
35900	
36000	TYPLIS(L)  - ROUTINE -
36100	THIS IS A USEFUL DEBUGGING AID, PARTICULARLY IN LIMP MODE  (SEE  SECT
36200	13).  IT TYPES THE FIRST 4 WORDS (FEWER IF OBJECT IS SMALLER) OF EACH
36300	MEMBER OF THE LIST AT .L,  INCLUDING  THE  HEAD.  EACH  OBJECT  ON  A
36400	SEPARATE LINE, PRECEEDED BY ITS ADDRESS. FORMAT AS FOR TYPOCT.
36500	VALUE: 0.
     
00100	                  C O R O U T I N E   A C C E S S 
00200	
00300	
00400	
00500	TO  USE  THE COROUTINE ACCESS FACILITIES, PROGRAMS SHOULD BE COMPILED
00600	WITH THE /I SWITCH (OR EQUIVALENT). THE INSPECT AND RSAVE OPTIONS ARE
00700	PROVIDED IN ALL MODULE-HEADS IN POOMAS.
00800	
00900	
01000	THE VALUE OF A CREATE-EXPRESSION IS A PROCESS DESCRIPTOR  HAVING  THE
01100	FOLLOWING FORMAT:
01200	
01300	     --------- --------- ------------------
01400	    ^ RAFL    ^ RALF    ^ BASE             ^
01500	     --------- --------- ------------------
01600	     0       7 8      17 18              35
01700	
01800	WHERE:
01900	    BASE = STACK BASE ADDRESS FOR CREATED PROCESS,
02000	    RAFL = RELATIVE ADDRESS OF FIRST LOCAL,
02100	    RALF = RELATIVE ADDRESS OF LAST PARAMETER.
02200	           (THE TWO LATTER ARE RELATIVE TO BASE.)
02300	RALF OR RAFL OR BOTH MAY BE ZERO IF THERE ARE NO ACTUALS OR LOCALS.
02400	
02500	TO ACCESS A PARAMETER OR LOCAL IN A PARALLELL PROCESS ONE HAS TO KNOW
02600	ITS  ADDRESS RELATIVE TO THE LAST PARAMETER OR THE FIRST LOCAL IN THE
02700	MAIN PROCEDURE OF THE PROCESS.  FOR THE MAIN PROCEDURE ITSELF THIS IS
02800	EASILY  OBTAINED  BY  COUNTING  AT  THE  DECLARATION SITE.  FOR INNER
02900	PROCEDURES OR BLOCKS IT MAY  BE  CALCULATED  USING  THE  OBJECT  SIZE
03000	OBTAINED FROM THE WORD PRECEDING THE ENTRYPOINT TO EACH PROCEDURE.
03100	
03200	
03300	EXAMPLE:
03400	
03500	ASSUME WE HAVE CREATED A COROUTINE INSTANCE OF
03600	
03700	  ROUTINE P(F2,F1,F0) =
03800	  BEGIN LOCAL L0,L1[2],L3;   . . .   END;
03900	
04000	WE THEN WILL FIND
04100	    F2 AT BASE + RALF - 2,
04200	    F1 AT BASE + RALF - 1,
04300	    L3 AT BASE + RAFL + 3,
04400	AND SO ON.
04500	
04600	
04700	THE NEW-MACRO WILL STORE THE RAFL RALF OBTAINED FROM  THE  CREATE  IN
04800	THE  RARA  FIELD  OF  THE  CREATED PROCESS.  THIS WILL PRESERVE THESE
04900	VALUES EVEN IF THE PROCESS IS RETRIEVED FROM A LIST.   FOR  PROCESSES
05000	CREATED  BY  NEW,  REMOTE ACCESS IS SIMPLIFIED BY THE REMOTE - MACROS
05100	BELOW, WHICH DELIVER THE ADDRESSES OF THE I'TH LOCAL OR  I'TH  FORMAL
05200	RESPECTIVELY  IN  A  PROCESS.   FURTHERMORE P MAY BE CLOSED TO ACCESS
05300	FROM OUTSIDE BY STORING 0 IN ITS RARA FIELD. THE  REMOTE-MACROS  WILL
05400	THEN  ACCESS THE BASE-LOCATION OF THE CURRENTLY ACTIVE PROCESS, WHICH
05500	IS SAFE  BUT  MEANINGLESS.   THE  MACRO  CLOSEPROC  ACCOMPLISHES  THE
05600	CLOSING.   IT  IS  THE  RESPONSIBILITY  OF THE USER TO INITIALIZE THE
05700	RARA-FIELD OF THE MAIN PROGRAM SHOULD  THIS  BE  NEEDED.   THE  FIRST
05800	PARAMETER TO REMOTEFML OR REMOTELCL SHOULD EVALUATE TO THE ADDRESS OF
05900	THE PROCESS ACCESSED.  THE SECOND SHOULD EVALUATE TO THE  ADDRESS  OF
06000	THE LOCAL OR FORMAL DESIRED, RELATIVE TO THE FIRST LOCAL (HENCE NOT <
06100	0) OR THE LAST FORMAL (HENCE NOT >  0)  FOR  REMOTELCL  OR  REMOTEFML
06200	RESPECTIVELY.    THE  VALUES  OF  THESE MACROS ARE ADDRESSES, POINTER
06300	PARAMETERS IN <> AND CONTENTS OPERATORS MUST BE SUPPLIED BY THE  USER
06400	AS  NEEDED.   THE  PARAMETER  TO  THE  CLOSEPROC  MACRO  SHOULD BE AN
06500	IDENTIFIER MAPPED TO OBJECT.
06600	
06700	
06800	NEW(P,S)
06900	THE  2 PARAMETERS TO THIS MACRO SPECIFY A ROUTINE WITH ITS PARAMETERS
07000	AND THE STACK-SIZE (EXCLUDING STATE  AREA)  FOR  THE  PROCESS  TO  BE
07100	CREATED.  P SHOULD SYNTACTICALLY TAKE THE FORM OF A PROCEDURE CALL, S
07200	SHOULD EVALUATE TO A NUMBER. A COROUTINE INSTANCE OF  P  IS  CREATED.
07300	IF  THIS  PROCESS  EXECUTES  A RETURN OUT OF ITS OUTMOST PROCEDURE IT
07400	WILL BE TERMINATED.
07500	VALUE: PROCESS DESCRIPTOR.
07600	
07700	REMOTELCL(P,I) =
07800	(IF .(P)[-1]<RAFL> EQL 0 THEN (BLIPPERROR(31);  .BREG)
07900	  ELSE .(P)[-1]<RAFL>+P<BASE>+I)$,
08000	
08100	REMOTEFML(P,I) =
08200	(IF .(P)[-1]<RALF> EQL 0 THEN (BLIPPERROR(31);   .BREG)
08300	  ELSE .(P)[-1]<RALF>+P<BASE>+I)$,
08400	
08500	CLOSEPROC(P) =
08600	(RARA(P) _ 0)$;
08700	
08800	
08900	EXAMPLE:
09000	
09100	LET  PROC  CONTAIN  A  PROCESS DESCRIPTOR FOR A COROUTINE INSTANCE OF
09200	ROUTINE P. AFTER EXECUTING:
09300	    I _ -3;
09400	    REMOTELCL(.PROC,2)<0,36> _ 144;
09500	    REMOTEFML(.PROC,.I)<0,36> _ -.I*4*12;
09600	WE WILL HAVE
09700	    .REMOTELCL(.PROC,-.I-1)<0,36> EQL .REMOTEFML(.PROC,.I)<0,36>
09800	
     
00100	                               Q P E P
00200	
00300	
00400	
00500	PROCESSES
00600	
00700	
00800	   _____________
00900	-3 ^PRED ^ SUC ^   CLASS CONTAINS THE ADDRESS OF THE PROCEDURE OF THE 
01000	-2 ^CLASS^SIZE ^   PROCESS. 
01100	-1 ^ RARA^EVNOT^   
01200	   ------------      EVNOT CONTAINS THE ADDRESS  OF  THE  EVENTNOTICE
01300	 0 ^           ^   REFERENCING THIS PROCESS, OR NONE IF THERE  IS  NO
01400	   ^           ^   SUCH EVENTNOTICE.
01500	   ^           ^     RARA CONTAINS THE RAFL-RALF FIELD OF THE VALUE
01600	   -------------   OF THE CREATE THAT CREATED THE OBJECT.
01700	
01800	A MACRO NEW,  DESCRIBED  IN  THE  CAP  SECTION,  IS  USED  TO  CREATE
01900	PROCESSES  SO  THAT THE ABOVE FIELDS ARE SET, AND SO THAT THE PROCESS
02000	IS TERMINATED SHOULD ITS PROCEDURE RETURN.
02100	
02200	
02300	EVENTNOTICES
02400	
02500	   _____________   
02600	-3 ^PRED ^ SUC ^   .CLASS = -3
02700	-2 ^CLASS^SIZE ^   .SIZE = 4
02800	   -------------   .PROCPTR IS A REFERENCE TO THE PROCESS SLATED.
02900	-1 ^  PROCPTR  ^   .TIMEFLD IS THE TIME WHEN THE PROCESS SHOULD
03000	 0 ^  TIMEFLD  ^   BECOME ACTIVE.  IT HOLDS A FLOATING POINT VALUE.
03100	   -------------
03200	
03300	
03400	TO  SCHEDULE  A PROCESS MEANS TO INSERT AN EVENTNOTICE REFERENCING IT
03500	IN THE SQS, THUS SPECIFYING THAT AN EVENT OF THIS PROCESS IS TO OCCUR
03600	AT  A  TIME  NOT  LESS  THAN  THE CURRENT TIME.  THERE IS AT MOST ONE
03700	EVENTNOTICE REFERENCING A PROCESS AT ANY ONE TIME. A PROCESS IS  SAID
03800	TO  BE  SLATED  IF THERE IS AN EVENTNOTICE REFERENCING IT IN THE SQS,
03900	I.E. IT HAS PREVIOUSLY BEEN SCHEDULED BUT THE EVENT HAS NOT YET ENDED
04000	OR  BEEN CANCELED. (ACTIVE OR SUSPENDED IN SIMULA.) IF THE PROCESS TO
04100	BE SCHEDULED IS ALREADY SLATED, AN ACTIVATE WILL BE IGNORED WHEREAS A
04200	REACTIVATE WILL CANCEL THE OLD EVENT AND RESCHEDULE THE PROCESS.  THE
04300	PROCESS MAY BE SCHEDULED FIRST OR LAST AMONG  THE  PROCESSES  ALREADY
04400	SLATED  FOR THE GIVEN TIME, OR IT MAY BE SCHEDULED IMMEDIATELY BEFORE
04500	OR AFTER ANOTHER GIVEN SLATED PROCESS, AT THE SAME TIME AS THE  GIVEN
04600	PROCESS. THE EVENTNOTICES IN SQS ARE ORDERED BY INCREASING .TIMEFLD.
04700	
04800	A PROCESS IS IN ONE OF FOUR STATES:
04900	ACTIVE:     CURRENTLY EXECUTING (HAS EVENTNOTICE BUT NOT REACTIVATION
05000		    POINT.)
05100	SUSPENDED:  NOT EXECUTING BUT HAS REACTIVATION POINT AND EVENTNOTICE.
05200	PASSIVE:    HAS REACTIVATION POINT, NOT SLATED.
05300	TERMINATED: NO REACTIVATION POINT, NOT SLATED.
05400	
05500	SINCE BLISS HAS NO GOTO, A TERMINATED PROCESS CAN NOT BE  REVIVED  BY
05600	NORMAL MEANS BUT ITS DATA MAY STILL BE USED.
05700	
05800	
05900	THE SEQUENCER
06000	
06100	THE  SEQUENCER IS A COROUTINE INSTANCE OF THE ROUTINE SEQUER WHICH IS
06200	EXCHJ'D INTO EACH TIME THE IDENTY OF THE FIRST  ELEMENT  OF  THE  SQS
06300	CHANGES,  I.E.  WHEN  THE  ACTIVE  PROCESS  SHOULD  BECOME SUSPENDED,
06400	PASSIVE, OR TERMINATED.  THE SEQUENCER SELECTS THE  NEXT  PROCESS  TO
06500	BECOME  ACTIVE FROM THE SQS, AND EXCHJ'S INTO IT. IT WILL ALSO SELECT
06600	EXECUTION-MODE ACCORDING TO INPUT, AND CALL  THE  RELEVANT  ROUTINES.
06700	SEE  SECTION  ON  DEBUGGING.  THE  SEQUENCER  IS NOT A PROCESS IN THE
06800	POOMAS SENSE.
06900	
07000	
07100	THE VARIABLES:
07200	
07300	.CURRENT IS A PROCESS DESCRIPTOR FOR THE ACTIVE PROCESS.
07400	.MAINPROG IS A PROCESS DESCRIPTOR FOR THE PROCESS THAT CALLED INITQPEP.
07500	.TIME IS THE CONTENTS OF THE TIME FIELD OF THE EVENTNOTICE FOR .CURRENT.
07600	.TALLY IS THE TOTAL NO. OF EVENTS EXECUTED.
07700	.STOPCOUNT IS THE LIMIT FOR .TALLY IN TALLY-MODE.
07800	.DEBUGGING CONTROLS THE EXECUTION MODE AS DECRIBED IN SECT. 13.
07900		VALUES ARE: 0: RUN, 1: LIMP, 2: WALK, 3: TALLY, 4: LIMP-CALL.
08000	
08100	
08200	
08300	IN ADDITION TO THE MACROS LISTED UNDER BLIPP, THE FOLLOWING ANALOGOUS
08400	ONES  FROM  QPEP  ARE  OF  INTEREST.   NOTE THAT THE ACTUAL MUST BE A
08500	VARIABLE MAPPED TO OBJECT, OR AN EXPRESSION ENCLOSED IN  PARENTHESIS,
08600	AS  EXPLAINED  ON  P.  7-3.   THEY EXPAND TO POINTERS TO THE FIELD IN
08700	QUESTION.
08800	
08900	MACRO                ! FIELDS IN OBJECTS.
09000	  REACTPT(E) = (E[0])$,        ! REACTIVATION POINT OF PROCESS.
09100	  RARA(P) = (P[-1]<18,18>)$,   ! RALF RAFL SAVE-FIELD.
09200	  EVNOT(P) = (P[-1]<0,18>)$,   ! EVENTNOTICE POINTER IN PROCESS.
09300	  PROCPTR(E) = (E[-1])$,       ! PROCESS POINTER IN EVNOT.
09400	  TIMEFLD(E) = (E[0])$;        ! TIME FIELD IN EVNOT.
09500	
09600	
09700	
09800	FOLLOWING IS A DESCRIPTION OF THE ROUTINES OF QPEP.
09900	
10000	
10100	NOTE:   THOSE ROUTINES THAT EXPECT PROCESS PARAMETERS, I.E. SCHEDULE,
10200	TERMINATE,  CANCEL,  KILL  WILL  "SEE  THROUGH"  REPRESENTATIVES  AND
10300	OPERATE ON THE PROCESS IN QUESTION.
10400	
10500	
10600	INITIALISATION OF QPEP:
10700	
10800	INITQPEP()
10900	WILL INITIALIZE SQS WITH  ONE  EVENTNOTICE  REFERENCING  THE  CALLING
11000	PROGRAM, THE QPEP VARIABLES, AND THE SEQUENCER PROCESS.  IF MEMORY IS
11100	REINITIALIZED BY INITMEM(), A CALL ON INITQPEP SHOULD FOLLOW.
11200	VALUE: 0.
11300	
11400	
11500	
11600	SCHEDULING.
11700	
11800	SCHEDULE(CODE,P,T)
11900	HANDLES ALL SCHEDULING.  .P IS ADDRESS OF PROCESS TO BE SCHEDULED, .T
12000	IS THE TIME OR ADDRESS OF PROCESS, WHICH DETERMINES THE  POSITION  IN
12100	SQS. .CODE DETERMINES WHICH OF THE POSSIBLE CASES WE HAVE AS FOLLOWS:
12200	
12300	  ! BIT 33          ! BIT 34          ! BIT 35          !
12400	---------------------------------------------------------
12500	0 ! REACTIVATE      ! AT TIME .T      ! FIRST OR BEFORE !
12600	1 ! ACTIVATE        ! REL. TO PROC .T ! LAST OR AFTER   !
12700	---------------------------------------------------------
12800	VALUE: 0 IF ERRORS,
12900	      -1 IF NOTHING WAS SCHEDULED (.P IS NONE).
13000	       1 IF NO OTHER EVENT HAPPENED DURING SCHEDULE,
13100	       2 IF OTHER EVENTS HAPPENED DURING SCHEDULE.
13200	         (MAY OCCUR BY SCHEDULING FIRST AT PRESENT TIME).
13300	
13400	
13500	
13600	FOR  EASY  DETERMINATION  OF  THE  CODE  PARAMETER USE MACRO CALLS AS
13700	FOLLOWS:
13800	
13900	NOTE: BEFORE, AFTER, FIRSTAT, LASTAT ARE THEMSELVES MACROS
14000	      OF NO PARAMETERS AND SMALL INTEGER CONSTANT VALUES.
14100	
14200	ACTIVATE(P,BEFORE,T)
14300	ACTIVATES PROCESS AT .P BEFORE PROCESS AT .T.
14400	
14500	ACTIVATE(P,AFTER,T)
14600	ACTIVATES PROCESS AT .P AFTER PROCESS AT .T.
14700	
14800	ACTIVATE(P,FIRSTAT,T)
14900	ACTIVATES PROCESS AT .P FIRST AT TIME .T.
15000	
15100	ACTIVATE(P,LASTAT,T)
15200	AS ABOVE BUT LAST AT TIME .T.
15300	
15400	THE SAME OPTIONS ARE AVAILABLE FOR REACTIVATE,
15500	I.E. REACTIVATE(P,BEFORE,T) ETC.
15600	
15700	
15800	3 MORE MACROS AND ONE ROUTINE FACILITATE SCHEDULING:
15900	
16000	HOLDSHORT(T)
16100	EQUIVALENT TO REACTIVATE(.CURRENT,FIRSTAT,.TIME+T)
16200	
16300	HOLDLONG(T)
16400	EQUIVALENT TO REACTIVATE(.CURRENT,LASTAT,.TIME+T)
16500	
16600	HOLD(T)
16700	EQUIVALENT TO HOLDLONG(T) OR REACTIVATE(.CURRENT,LASTAT,.TIME+T)
16800	
16900	WAIT(S)
17000	INCLUDES .CURRENT IN LIST AT .S AND CANCELS IT (SEE BELOW).
17100	
17200	
17300	OTHER SEQUENCING ROUTINES:
17400	
17500	TERMINATE(P)
17600	REMOVES ANY EVENTNOTICE FOR PROCESS AT .P FROM THE SQS AND CLEAR  ITS
17700	REACTIVATIONPOINT.   IT  IS  HEREAFTER  TO  BE  REGARDED  AS  A DATA-
17800	STRUCTURE ONLY AND CAN NOT BE EXECUTED. IF .P IS .CURRENT, START NEXT
17900	PROCESS IN SQS.
18000	VALUE: 0 IF ERRORS, -1 IF .P IS NONE, OTHERWISE 1.
18100	
18200	CANCEL(P)
18300	REMOVES ANY EVENTNOTICE FOR PROCESS AT .P FROM SQS, IF .P IS .CURRENT
18400	NEXT PROCESS IN SQS WILL BE STARTED.
18500	VALUE: 0 IF ERRORS, -1 IF .P IS NONE, OTHERWISE 1.
18600	
18700	KILL(P)
18800	TERMINATES PROCESS AT .P AND RETURNS ITS SPACE TO FREELIST. IF .P  IS
18900	A  REP,  THE  REP-SPACE  IS  ALSO  RELEASED.  IF .P IS .CURRENT, NEXT
19000	PROCESS WILL BE STARTED.
19100	VALUE: 0 IF ERRORS, -1 IF .P IS NONE, OTHERWISE 1.
19200	
19300	
19400	TESTING FOR PROCESSHOOD:
19500	
19600	ISPROCESS(P)
19700	CAN  BE  USED  TO  TEST  IF AN OBJECT IS A PROCESS, I.E. IF ITS CLASS
19800	FIELD CONTAINS THE ADDRESS (ENTRYPOINT) OF A PROCEDURE.  THIS IS DONE
19900	USING  THE ISROFUN ROUTINE OF BLIPP AND SUFFERS FROM THE DEFICIENCIES
20000	OF THAT ROUTINE. I. E. NO-PARAMETER,  NO-LOCALS,  NO-REGISTERS  SAVED
20100	ROUTINES CAN NOT BE DISTINGUISHED FROM SOME DATA AREAS.
20200	VALUE: 0 OR 1, 3 IF IN DOUBT.
     
00100	                       P O O M A S  -  F I L E

00200	
00300	
00400	
00500	THE  FILE  POOMAS.BLI  CONTAINS THOSE DECLARATIONS (GLOBAL, EXTERNAL,
00600	MACRO) THAT SHOULD PRECEDE THE  USERS  PROGRAM.   THIS  INCLUDES  THE
00700	MACROS FROM CAP, AND AN 'EXTERNAL' DECLARATION AND  CALL  OF  INITIO.
00800	SEE  SECTION ON I/O IN BLIPP.  THE USER SHOULD WRITE HIS PROGRAM AS A
00900	BLOCK WITH AN UNMATCHED 'END ELUDOM' AT THE END, AND COMPILE IT USING
01000	POOMAS.BLI AS A PREFIX.
01100	
01200	
01300	FOLLOWING  ARE  THE  LAST LINES OF THE POOMAS.BLI FILE.  THE USER MAY
01400	SPECIFY THE MAXIMAL SIZE  OF  HIS  FREELIST  AND  THE  NO.  OF  ERROR
01500	MESSAGES  HE  WANTS  TO  SEE  BEFORE  EXECUTION  ABORTS  BY  ALTERING
01600	APPROPRIATE LINES MARKED BY ASTERISKS.  TO  ALTER  THE  SIZE  OF  THE
01700	MAIN-PROGRAM OBJECT IT IS SUFFICIENT TO CHANGE THE STACK-PARAMETER IN
01800	THE MODULE HEAD.
01900	
02000	
02100	
02200	!   SET UP STACK FOR MAIN PROGRAM TO BE AN OBJECT.
02300	
02400	SREG _ .SREG + #3000003;
02500	FREG _ .FREG + 3;
02600	(.FREG+1)<0,36> _ .FREG;
02700	BREG _ .BREG + 3;
02800	
02900	!   INITIALIZE FIELDS OF MAIN PROGRAM AS FOR ANY OLD OBJECT.
03000	
03100	MYSTACK _ NONE;
03200	(MYSTACK+1) _ (INITQPEP<0,0>+1)^18   ! ANY ROUTINE NAME OK AS CLASS.
03300	! ADDING 1 TO GET CORRECT SUBTRACTION OF .SREG<LEFTHALF>.
03400	              + .SREG<RIGHTHALF>-MYSTACK<0,0>-.SREG<LEFTHALF>;
03500	              ! THIS WAS THE SIZE = USED + UNUSED PART OF STACK.
03600	
03700	!   INITIALIZE I/O, BLIPP AND QPEP.
03800	
03900	MAXMEM _ 15360;    ! * * * MAXIMAL FREELISTSIZE * * * * * 
04000	
04100	INITIO();
04200	INITBLIPP();
04300	INITQPEP();
04400	ERRCOUNT _ 10;      ! **** NO. OF ERROR MESSAGES PERMITTED. ***
04500
     
00100	           R A N D O M   N U M B E R   G E N E R A T I O N
00200	
00300	
00400	
00500	RANDOM NUMBER STREAMS:
00600	
00700	A RANDOM NUMBER STREAM IN POOMAS IS A VARIABLE CONTAINING  SUCCESSIVE
00800	VALUES  OF  A  SEQUENCE OF INTEGERS.   EACH MEMBER OF THE SEQUENCE IS
00900	OBTAINED FROM THE PREVIOUS BY ONE  BASIC  DRAWING  ACCORDING  TO  THE
01000	LINEAR CONGRUENTIAL METHOD:
01100	
01200	U _ (5^15 * .U + 7261067085) MOD 2^35
01300	
01400	WHERE ^ STANDS FOR EXPONENTIATION RATHER THAN SHIFT.
01500	
01600	FOR FURTHER INFORMATION THE READER IS REFERRED TO:
01700	    KNUTH, D. E.,
01800	    SEMINUMERICAL ALGORITHMS,
01900	    ADDISON WESLEY 1969.
02000	
02100	BY THEOREM A, P. 15 OF KNUTH, THE SEQUENCE OBTAINED IN THIS WAY HAS A
02200	PERIOD  OF  2^35.   FURTHERMORE,  BY THE SPECTRAL TEST THE MULTIPLIER
02300	5^15 AND THE MODULUS 2^35 HAVE VERY DESIRABLE STATISTICAL PROPERTIES.
02400	SEE  KNUTH,  P. 88.  THE ADDEND IS CHOSEN BY CRITERION (41), KNUTH P.
02500	78.
02600	
02700	A RANDOM FLOATING POINT NUMBER IN  [0.0,1.0>  IS  OBTAINED  FROM  THE
02800	ABOVE  BY  SHIFTING IT 8 BITS RIGHT AND FORCING THE SIGN AND EXPONENT
02900	TO OCTAL 200.  THESE NUMBERS ARE USED BY ALL ROUTINES BELOW. THEY ARE
03000	UNNORMALIZED,  BUT  THE  RESULTS OF ALL THE ROUTINES BELOW ARE EITHER
03100	INTEGER OR NORMALIZED FLOATING.
03200	
03300	EACH OF THE ROUTINES FOR DRAWING  FROM  DISTRIBUTIONS  HAS  A  RANDOM
03400	NUMBER  STREAM  AS ONE OF ITS PARAMETERS.  THE USER SHOULD INITIALIZE
03500	THE STREAM BY ASSIGNING SOME INTEGER VALUE TO IT.  EACH ROUTINE  WILL
03600	ADVANCE  ITS PARAMETER-STREAM BY PERFORMING ONE OR MORE DRAWINGS FROM
03700	IT, ACCORDING TO  THE  NEEDS  OF  THAT  ROUTINE.   HENCE  THE  STREAM
03800	PARAMETER  HAS  TO  BE PASSED BY POINTER, - THE ADDRESS WILL SUFFICE.
03900	I. E. IF SEED4 CONTAINS THE STREAM, THE MOST  EFFICIENT  IS  TO  GIVE
04000	SEED4<0,0> (WITHOUT DOT) AS THE ACTUAL PARAMETER.
04100	
04200	
04300	
04400	THE FOLLOWING ROUTINES ARE IMPLEMENTED:
04500	
04600	RANDINT(A,B,U)
04700	A = INTEGER, LOWER BOUND.
04800	B = INTEGER, UPPER BOUND.
04900	U = RANDOM NUMBER STREAM.
05000	VALUE IS ONE OF  THE  INTEGERS  .A,  .A+1,  .  .  .  ,.B  WITH  EQUAL
05100	PROBABILITY.
05200	NOTE:  .A < .B ASSUMED.
05300	
05400	UNIFORM(A,B,U)
05500	A = REAL, LOWER BOUND.
05600	B = REAL, UPPER BOUND.
05700	U = RANDOM NUMBER STREAM.
05800	VALUES ARE REAL, UNIFORMLY DISTRIBUTED IN [.A,.B>.
05900	NOTE:  .A < .B ASSUMED.
06000	
06100	NORMAL(A,B,U)
06200	A = REAL, MEAN.
06300	B = REAL, STANDARD DEVIATION.
06400	U = RANDOM NUMBER STREAM.
06500	VALUES ARE REAL, NORMALLY DISTRIBUTED WITH THE ABOVE PARAMETERS.  THE
06600	NORMAL DISTRIBUTION IS OBTAINED AS DESCRIBED IN:
06700	    ABRAMOWITZ, M & STEGUN, I. A. (EDS)
06800	    HANDBOOK OF MATHEMATICAL FUNCTIONS
06900	    NTL. BUREAU OF STANDARDS APPLIED MATHS. SERIES NO. 55
07000	    PP. 952 AND 933.
07100	
07200	FASTNORMAL(A,B,U)
07300	A = REAL, MEAN.
07400	B = REAL, STANDARD DEVIATION.
07500	U = RANDOM NUMBER STREAM.
07600	VALUES ARE REAL, NORMALLY DISTRIBUTED WITH  ABOVE  PARAMETERS.  NOTE:
07700	FASTNORMAL  USES  THE SUM OF 4 DRAWINGS FROM UNIFORM, RATHER THAN THE
07800	FORMULA USED BY NORMAL, TO OBTAIN THE DISTRIBUTION.  IT IS ABOUT HALF
07900	AS SLOW AS NORMAL BUT LESS ACCURATE.  THE EXACT ALGORITHM IS:
08000	   .A + .B * ((.U1 + .U2 + .U3 + .U4) - 2.0) * SQRT(3.0)
08100	WHERE THE UI ARE UNIFORM IN [0,1>.
08200	
08300	NEGEXP(A,U)
08400	A = REAL, INVERSE OF MEAN.
08500	U = RANDOM NUMBER STREAM.
08600	VALUES ARE REAL, DISTRIBUTED AS THE NEGATIVE  EXPONENTIAL  WITH  MEAN
08700	1/.A.   THIS  IS THE SAME AS THE DISTRIBUTION OF "WAITING TIMES" IN A
08800	POISSON PROCESS WITH EXPECTED NO. OF ARRIVALS EQUAL TO .A  PR.   TIME
08900	UNIT. VALUE OBTAINED AS -LN(.U)/.A WHERE .U IS UNIFORM IN [0,1>.
09000	
09100	POISSON(A,U)
09200	A = REAL, DISTRIBUTION PARAMETER.
09300	U = RANDOM NUMBER STREAM.
09400	VALUES ARE INTEGER, DISTRIBUTED AS  THE  POISSON  DISTRIBUTION.   THE
09500	VALUE,  N,  IS OBTAINED BY .N DRAWINGS, UNIFORM IN [0,1>, WHERE .N IS
09600	THE SMALLEST INTEGER S.T.
09700	    1.0 * U1 * U2 * . . . * UN < EXP(-.A)
09800	IF .A > 20.0, NORMAL(.A,SQRT(.A),.U) IS USED IF .A < 0.0, 0 IS USED.
09900	
10000	ERLANG(A,B,U)
10100	A = REAL, INVERSE MEAN.
10200	B = REAL, DESCRIBED BELOW.
10300	U = RANDOM NUMBER STREAM.
10400	VALUES ARE REAL, DISTRIBUTED AS THE  ERLANG  DISTRIBUTION  WITH  MEAN
10500	1/.A  AND STANDARD DEVIATION 1/(.A*SQRT(.B)).  IF .B IS INTEGER IT IS
10600	OBTAINED BY .B BASIC DRAWINGS (UNIFORM IN [0,1>) AS:
10700	    -(LN(.U1) + . . . + LN(.UB)) / (.A * .B)
10800	IF  .B IS NOT INTEGER THE ABOVE TERM IS FORMED USING FIX .B DRAWINGS,
10900	AND THE FOLLOWING TERM ADDED:
11000	    - (.B - FIX .B) * LN(.U) / (.A * .B)
11100	I. E. ANOTHER DRAWING IS REQUIRED.
11200	NOTE:   WE  MUST HAVE .A > 0, .B > 0 AND THE B SUPPLIED SHOULD ALWAYS
11300	BE A FLOATING POINT NUMBER EVEN IF ITS VALUE IS INTEGER.
11400	
11500	DISCRETE(A,N,U)
11600	A = REAL VECTOR, CUMULATIVE DISTRIBUTION (ALMOST).
11700	N = INTEGER, LENGTH OF A (A INDEXED FROM 0 THROUGH .N).
11800	U = RANDOM NUMBER STREAM.
11900	A IS PASSED BY ADDRESS OF FIRST ELEMENT. VALUEIS INTEGER IN  [0,.N+1]
12000	DEFINED  BY  BEING THE LEAST INTEGER I SUCH THAT .A[.I] > .U, U BEING
12100	OBTAINED BY A DRAWING UNIFORM IN [0,1>.  IF  THE  INEQUALITY  IS  NOT
12200	SATISFIED FOR ANY VALUE IN [0,.N], .N+1 IS RETURNED.
12300	
12400	LINEAR(A,B,N,U)
12500	A = REAL VECTOR, ORDINATES OF CUMULATIVE DISTRIBUTION.
12600	B = REAL VECTOR, ABSCISSAE OF CUMULATIVE DISTRIBUTION.
12700	N = INTEGER, LENGTH OF A AND B (INDEXED FROM 0 THROUGH .N).
12800	U = RANDOM NUMBER STREAM.
12900	A AND B ARE PASSED BY ADDRESSES OF FIRST ELEMENTS. A AND B CONSTITUTE
13000	A NON-EQUIDISTANT TABLE FOR A CUMULATIVE DISTRIBUTION FUNCTION F,  I.
13100	E.  .A[.I]  =  F(.B[.I]) FOR .I = 0,1,2, ... .N. .A[0] SHOULD BE 0.0,
13200	.A[.N] SHOULD BE 1.0. .A[.I+1]  GEQ  .A[.I]  AND  .B[.I+1]  >  .B[.I]
13300	ASSUMED  FOR  .I  IN [0,.N-1]. VALUES ARE REAL, OBTAINED BY ONE BASIC
13400	DRAWING UNIFORM IN [0,1> AND  INVERSE  LINEAR  INTERPOLATION  IN  THE
13500	TABLE.
     
00100	          C O L L E C T I O N   O F   S T A T I S T I C S :
00200	
00300	
00400	
00500	ACCUM(SUM,OLDT,VAL)
00600	SUM - ADDRESS OF VARIABLE WHERE SUM IS ACCUMULATED.
00700	OLDT - ADDRESS OF VARIABLE WHERE PREVIOUS TIME THIS SUM  WAS  UPDATED
00800	       IS STORED.
00900	VAL - REAL, VALUE OF FUNCTION OVER LAST TIME-INTERVAL.
01000	WILL ADD (.TIME - @.OLDT)*.VAL TO THE VARIABLE AT .SUM, I.E. THE TIME
01100	INTEGRAL OF THE FUNCTION WHOSE VALUE  IS  .VAL  OVER  THE  LAST  TIME
01200	INTERVAL,  IS COMPUTED.   OLDT MUST BE INITIALIZED BY THE USER BUT IS
01300	UPDATED BY ACCUM.  .VAR MUST BE INITIALIZED TO 0 BY THE USER.
01400	
01500	HISTO(ARR,VAL)
01600	ARR - ADDRESS OF A VECTOR WHERE HISTOGRAM IS ACCUMULATED.
01700	VAL - REAL, VALUE TO BE ADDED TO HISTOGRAM.
01800	THE VECTOR MUST HAVE THE FORMAT SHOWN.
01900	
02000	 ------------ 	N - INTEGER, NO. OF COLOUMNS IN THE HISTOGRAM
02100	!	N    !      LESS 1.
02200	!------------!	WIDTH - REAL, WIDTH OF EACH COLOUMN IN HISTO-
02300	!    WIDTH   !		GRAM IN UNITS OF THE OBSERVED VALUE.
02400	!------------!	LOW - REAL, LOWER BOUND FOR .VAL (ACTUAL .VAL'S
02500	!    LOW     !        THAT ARE SMALLER COUNT AS .LOW).
02600	!------------!	SUM VAL - REAL, SUM OF VALUES IN HISTOGRAM.
02700	! SUM VAL    !	SUM VAL^2 - REAL, SUM OF SQUARES OF VALUES.
02800	!------------!
02900	! SUM VAL^2  !	N, WIDTH AND LOW MUST BE PRESET BY THE USER,
03000	!------------!  AND THE REST OF THE VECTOR CLEARED TO ZEROES.
03100	!  COL. 0    !	THIS IS DONE BY THE ROUTINE INITHISTO DESCRIBED
03200	!  COL. 1    !	BELOW.  THE VECTOR MUST HAVE .N+6 OR MORE ELE-
03300	!	     !  MENTS IN ALL.  COLOUMN RANGES WILL BE:
03400	!	     !	   [.LOW, .LOW+.WIDTH>
03500	!	     !	   [.LOW+.WIDTH, .LOW+2*.WIDTH>
03600	!	     !	   . . .
03700	!  COL. N    !	   [.LOW+.N*.WIDTH, INFINITY>
03800	 ------------
03900	
04000	INITHISTO(ARR,N,WIDTH,LOW)
04100	ARR - ADDRESS OF ARRAY AS DESCRIBED ABOVE UNDER HISTO.
04200	N - INTEGER, VALUE TO BE PUT IN THE N FIELD.
04300	WIDTH - REAL, VALUE FOR THE WIDTH FIELD.
04400	LOW - REAL, VALUE FOR THE LOW FIELD.
04500	THE VECTOR IS INITIALIZED AS REQUIRED BY THE HISTO ROUTINE.
04600	
04700	HPRINT(CHNL,ARR)
04800	CHNL - INTEGER, CHANNEL NUMBER AS IN BLISS I/O FOR PRINTING.
04900	ARR - ADDRESS OF HISTOGRAM-VECTOR AS DESCRIBED UNDER HISTO.
05000	THE  HISTOGRAM  WILL BE PRINTED ON THE CHANNEL INDICATED, ONE LINE PR
05100	COLOUMN. EACH LINE HAS THE FOLLOWING FORMAT:
05200		OBSVAL !**. . .*      NOBS(PERCENT)CUMPERCENT
05300	WHERE
05400	OBSVAL  - LOWER BOUND FOR THE HISTOGRAM COLOUMN, THE COLOUMN SPANNING
05500	          THE RANGE [.OBSVAL, .OBSVAL+.WIDTH>
05600	**. . .* - SCALED SO THAT THE LONGEST COLOUMN REQUIRES 100 ASTERISKS.
05700	NOBS - NO. OF OBSERVATIONS IN COLOUMN.
05800	PERCENT - PERCENTAGE OF OBSERVATIONS IN COLOUMN.
05900	CUMPERCENT - CUMULATIVE PERCENTAGE.
06000	
06100	THE PRINTING OF COLOUMNS WIL  STOP  WHEN  .CUMPERCENT  EXEEDS  99.98.
06200	FOLLOWING THE HISTOGRAM IS A LINE GIVING THE MEAN, STANDARD DEVIATION
06300	AND SCALE USED (OBSERVATIONS PR. '*').
     
00100	                   D E B U G G I N G    A I D S :
00200	
00300	
00400	
00500	THE POOMAS SEQUENCER CAN RUN IN 4 DIFFERENT MODES:
00600	
00700	RUN	THE PROGRAM WILL RUN AT MAXIMAL SPEED WITH NO TYPEOUT.
00800	
00900	TALLY	AS RUN, BUT TRANSFERS TO LIMP MODE AFTER A SPECIFIED NO.
01000		OF EVENTS.
01100	
01200	WALK	BEFORE EACH EVENT THE SEQUENCER WILL TYPE THE CLASS, STACK
01300		BASE AND EVENT-TIME OF THE PROCESS ABOUT TO BECOME ACTIVE.
01400	
01500	LIMP	TYPE-OUT AS FOR WALK MODE FOLLOWED BY COLON.  THE SEQUENCER
01600	        NOW WAITS FOR INPUT.
01700	
01800	        IF "<RETURN>" IS GIVEN THE PROCESS WILL EXECUTE THE EVENT.
01900	
02000	        IF "B <RETURN>" IS TYPED, THE PROCESS  WILL  CALL  THE  DUMMY
02100	        ROUTINE TRACEBREAK AS THE FIRST THING IN THE EVENT.  THE USER
02200	        MAY SET A BREAKPOINT  HERE  FOR  FURTHER  DEBUGGING  IN  DDT.
02300	        NOTE:   THIS  BREAKPOINT IS NOT OBEYED THE FIRST TIME CONTROL
02400	        ENTERS A PROCESS UNLESS THE  USER  HAS  INCLUDED  A  CALL  ON
02500	        TRACEBREAK  AS  THE FIRST STATEMENT.  IF THIS CALL IS OF FORM
02600	        "IF .VREG THEN TRACEBREAK()" IT WILL BE CONDITIONALLY  OBEYED
02700	        AS  DESCRIBED ABOVE.    IF IT IS A PLAIN CALL, THE BREAKPOINT
02800	        WILL ALWAYS BE OBEYED REGARDLESS OF EXECUTION MODE.
02900	
03000	        IF "T <OCTAL CONSTANT> <RETURN>" IS TYPED, THE SEQUENCER WILL
03100	        GO  INTO  TALLY-MODE  AND  RETURN  TO  LIMP  MODE  AFTER  THE
03200	        INDICATED NO. OF EVENTS.  NO CONSTANT MEANS 1.
03300	
03400	        IF "C <PROCEDURE>(<PARAM>, . . . ,<PARAM>) <RETURN>" IS TYPED
03500	        THE  PROCEDURE  CALL  WILL BE EXECUTED AND ITS VALUE TYPED IN
03600	        OCTAL.  UP TO 8 PARAMETERS ARE ACCEPTED.    THE PARAMETERS AS
03700	        WELL  AS THE PROCEDURE NAME MAY CONSIST OF NAMES KNOWN BY DDT
03800	        AND OCTAL CONSTANTS COMBINED BY "+" AND "-".  NO DOTS  SHOULD
03900	        BE  USED,  AND  THE  VALUES  OF  THE EXPRESSIONS INDICATE THE
04000	        ENTRYPOINT TO THE PROCEDURE OR THE ADDRESS WHERE THE VALUE OF
04100	        THE PARAMETER IS  TO  BE  FOUND  RESPECTIVELY.    SPACES  ARE
04200	        IGNORED OUTSIDE OF SYMBOLS AND CONSTANTS.  HENCE:
04300			C        CARDINAL(  QUEUE  +  2 ) <RETURN>
04400	        IS  A  LEGAL  INPUT.  AFTER THE VALUE IS TYPED OUT, THE COLON
04500	        WILL AGAIN APPEAR AND THE  SYSTEM  AWAITS  FURTHER  INPUT  IN
04600	        LIMP-MODE.
04700	
04800	        IF  "R <RETURN>" OR "L <RETURN>" IS TYPED, THE SEQUENCER WILL
04900	        GO INTO RUN OR WALK MODE RESPECTIVELY.
05000	
05100	THE SYSTEM IS INITIALLY IN LIMP MODE.
05200	
05300	THE USER MAY TYPE "L", "W", "R", "T" OR "T<OCTAL>"  AT  ANY  TIME  TO
05400	CHANGE  MODES.  HE  MAY ALSO TYPE "B" IN RUN OR WALK MODES WHICH WILL
05500	TAKE THE SYSTEM INTO LIMP MODE AND OBEY  THE  BREAKPOINT.   TYPING  A
05600	"<RETURN>" HAS EFFECT ONLY IN LIMP MODE.
05700	
05800	ALL  TYPE-IN AT ANY TIME MUST BE FOLLOWED BY A "<RETURN>", AND ACTION
05900	IS DETERMINED ON THE BASIS OF THE FIRST CHARACTER OF THE LINE. IN THE
06000	NEW  MONITOR  (CMU6  -  DEC  LEVEL D) THE USER MAY HAVE TO FOLLOW HIS
06100	<RETURN> BY A <CONTROL> O (CONTROL OH).  THIS IS DUE TO A BUG IN  THE
06200	TTCALL UUO.
06300	
06400	A  SLIGHTLY  MODIFIED  AND  EXTENDED  VERSION OF THE STANDARD "HELP"-
06500	PACKAGE IS USED FOR THE ABOVE OUTPUT, AND ALL THE  NORMAL  FACILITIES
06600	OF HELP ARE AVAILABLE.  THE POOMAS VERSION OF HELP IS CALLED PHELP.
06700	
06800	PROGRAMS MAY BE LOADED WITHOUT DDT, THE 'MISSING GLOBAL' MESSAGE  FOR
06900	DDTEND  MAY  BE  IGNORED  AND  THE  PROGRAM  RUN  IN RUN MODE WITHOUT
07000	BREAKPOINTS.  THE DDT SYMBOLTABLE WILL IN SOME CASES BE AVAILABLE.
07100	
07200	ROUTINES USEFUL DURING DEBUGGING THAT ARE DESCRIBED ELSEWHERE ARE:
07300	CARDINAL - SECT. 7
07400	TYPLIS - SECT 7.
07500	
07600	
07700	
07800	BREAKPOINT DEBUGGING.
07900	
08000	THE NORMAL FACILITIES OF DDT AND HELP ARE AVAILABLE.  (HELP  IS  PART
08100	OF POOLIB, THE POOMAS LIBRARY).
08200	
08300	BPCALL()
08400	THE LIMP - MODE CALL FEATURE DESCRIBED ABOVE IS AVAILABLE THROUGH THE
08500	ROUTINE  BPCALL AND THE XALTX ROUTINE OF HELP.  THE ADVANTAGE OF THIS
08600	OVER USING THE $X FEATURE DIRECTLY IS THAT PARAMETERS ARE MORE EASILY
08700	TRANSMITTED  AND  THAT REGISTERS ARE PROPERLY PRESERVED.  BPCALL WILL
08800	CONTINUOUSLY TYPE " :" AND EXPECT INPUT OF FORM:
08900		"C <ROUTINE>(<PARAM>,...,<PARAM>)"
09000	AS  DESCRIBED  ABOVE.   IT WILL RETURN TO DDT WHEN THE LEADING "C" IS
09100	NOT PRESENT.  TO USE THIS FROM A BREAKPOINT DO:
09200	1) SET XALTX0 TO BPCALL:  	XALTX0/   XXXX   BPCALL
09300	2) CALL XALTX:            	PUSHJ 0,XALTX$X
     
00100	          E R R O R   H A N D L I N G  &  M E S S A G E S:
00200	
00300	
00400	
00500	WHEN POOMAS DETECTS AN ERROR, MOST OFTEN IN AN ACTUAL  PARAMETER,  IT
00600	WILL  CALL BLIPPERROR. IT WILL TYPE THE ERROR NUMBER AND ERROR COUNT,
00700	THE LATTER AFTER IT HAS BEEN DECREASED BY ONE.  WHEN THE ERROR  COUNT
00800	REACHES  0,  THE  EXECUTION  WILL  HALT.   IF A BREAKPOINT WAS SET AT
00900	DDTBREAK, THIS WILL BE OBEYED.
01000	
01100	THE MEANINGS OF THE ERROR NUMBERS ARE:
01200	
01300	ERROR   MEANING
01400	
01500	1	REQUEST FOR LESS THAN 2 WORDS TO GETSPACE.
01600	2	NO SPACE ON FREE-LIST
01700	3	TRYING TO RELEASE ALREADY FREE OBJECT, OR NONE.
01800	4	TRYING TO REMOVE HEAD OR NONE.
01900	5	MEANINGLESS ARGUMENT TO INSERTAFTER.
02000	6	NOT ENOUGH SPACE FOR HEAD.
02100	7	NOT ENOUGH SPACE FOR OBJECT.
02200	10	NOT ENOUGH SPACE FOR REPRESENTATIVE.
02300	11	MEANINGLESS PARAMETER TO INSERTBEFORE.
02400	12	ACTUAL WAS NOT A LIST.
02500	13	MEANINGLESS PARAMETER FOR INCLUDE.
02600	14	MEANINGLESS PARAMETER FOR REPLACE.
02700	15	STACK OVERFLOW IN PROCESS.
02800	16	MEANINGLESS PARAMETER FOR MAPLIST.
02900	17	NO MORE CORE FROM MONITOR.
03000	
03100	20	ZERO ARG. TO LOGARITHM (NEGEXP, NORMAL, ERLANG).
03200	21	TOO LARGE ARG. TO EXPONENTIAL (POISSON).
03300	22	NEGATIVE ARG FOR SQRT (NORMAL, POISSON).
03400	23	ILLEGAL ARGUMENT FOR ERLANG.
03500	24	A[.N] IS NOT 1.0 IN PARAMETERS TO LINEAR.
03600	
03700	30	PARAMETER NOT PROCESS WHERE SUCH EXPECTED.
03800	31	SQS IS EMPTY.
03900	32	SCHEDULING IN THE PAST.
04000	33	SCHEDULING RELATIVE TO IDLE PROCESS.
04100	37	ILLEGAL REMOTE ACCESS.
04200	
04300	
04400	ERROR MESSAGES FROM CALLS IN LIMP-MODE:
04500	
04600	SYMB!	ATOM DOESN'T START WITH LETTER OR DIGIT.
04700	PROC!	PROCEDURE NAME NOT FOUND IN DDT-SYMBOLTABLE.
04800	PAR!	PARAMETER  "  "  "  "  "  "  "  "  "  "  "
04900	MANY!	TOO MANY PARAMETERS (> 8).
05000	LPAR!	NO LEFT PARENTHESIS IN CALL.
05100	RPAR!	NO RIGHT PARENTHESIS IN CALL.
     
00100	              A  S M A L L  P O O M A S  E X A M P L E
00200	
00300	
00400	
00500	SUPERMARKET CHECK-OUT QUEUES.
00600	
00700	
00800	BEGIN
00900	
01000	%<THE PROGRAM SIMULATES THE CHECKOUT - SECTION OF A SUPERMARKET.
01100	  CUSTOMERS ARRIVE AT THE FRONT OF THE MARKET AND WAIT
01200	  IN THE SHORTEST QUEUE, UNTIL THEY CAN BE SERVED.
01300	  STATISTICS ARE GATHERED ON HOW LONG CUSTOMERS HAVE TO WAIT IN
01400	  LINES.
01500	>%
01600	
01700	!   N IS NO. OF CLERKS, Q ARE THE QUEUES, WTIME THE WAITING TIME
01800	!   HISTOGRAM, CLERK CONTAINS PROCESS DESCRIPTORS FOR CLERKS.
01900	!   U,V ARE RANDOM NUMBER STREAMS, COUNT IS CUSTOMERCOUNT.
02000	!   GLOBALS ARE ACCESSIBLE BY NAME FROM DDT,  THAT'S WHY.
02100	
02200	MACRO N = 3$;
02300	GLOBAL Q[N], WTIME[21],  CLERK[N];
02400	EXTERNAL NEGEXP,NORMAL;     ! RANDOM NUMBER GENERATORS USED.
02500	OWN U,V,COUNT;
02600	
02700	     
02800	GLOBAL ROUTINE INITIO =
02900	!   ROUTINE TO INITIALIZE I/O TO CHANNELS DIFFERENT FROM 0.
03000	();
03100	
03200	ROUTINE CUSTOMER(TELL)=
03300	!   THIS IS THE CLASS CUSTOMER.
03400	BEGIN
03500	  LOCAL T;
03600	  OWN K,J,LEN;
03700	
03800	  IF .VREG THEN TRACEBREAK();
03900	
04000	!   NOW CREATE NEXT CUSTOMER AND SCHEDULE HIS ARRIVAL.
04100	  ACTIVATE( NEW(CUSTOMER(TELL+1),100),
04200	            LASTAT,
04300	            .TIME FADR NEGEXP(0.50,V<0,0>)
04400	          );
04500	
04600	!   REMEMBER ARRIVAL TIME IN LOCAL.
04700	  T_.TIME;
04800	
04900	!   FIND SHORTEST QUEUE
05000	  K_0;
05100	  LEN_CARDINAL(.Q[.K]);
05200	  INCR II FROM 1 TO N-1 DO
05300	    IF CARDINAL(.Q[.II]) LSS .LEN THEN
05400	      BEGIN K_.II;   LEN_ CARDINAL(.Q[.K]) END;
05500	
05600	!   NOW ENTER THE SHORTEST QUEUE, BUT FIRST ACTIVATE ITS CHECK-
05700	!   OUT CLERK IN CASE HE WAS IDLE.
05800	  ACTIVATE(.CLERK[.K],AFTER,.CURRENT);
05900	  WAIT(.Q[.K]);
06000	
06100	!   REACTIVATION POINT SET HERE.  CUSTOMER IS ACTIVATED AGAIN BY
06200	!   CLERK WHEN HE HAS BEEN SERVED.
06300	
06400	!   COMPUTE TIME SPENT IN QUEUE
06500	  T_(.TIME FSBR .T); J_FIX .T;
06600	
06700	
06800	!   INCREMENT APPROPRIATE ENTRY IN WAITING-TIME HISTOGRAM.
06900	  IF .J LSS 20 THEN WTIME[.J]_.WTIME[.J]+1
07000	    ELSE WTIME[20]_.WTIME[20]+1;
07100	
07200	!   IF ENOUGH CUSTOMERS SERVED TO GET GOOD STATISTICS, FINISH.
07300	  COUNT_.COUNT+1;
07400	  IF .COUNT GTR 1000 THEN
07500	    ACTIVATE(.MAINPROG,AFTER,.CURRENT);
07600	
07700	!   THIS CUSTOMER IS NOW FINISHED.  RETURN HIM TO THE FREE LIST.
07800	  KILL(.CURRENT)
07900	END;      ! END OF CUSTOMER.
08000	      
08100	
08200	ROUTINE SERVICE(I)=
08300	!   THIS ROUTINE DESCRIBES THE CLASS OF CLERKS.
08400	BEGIN
08500	
08600	  IF .VREG THEN TRACEBREAK();
08700	
08800	  WHILE 1 DO
08900	  BEGIN 
09000	
09100	!     IS THERE A CUSTOMER IN THE QUEUE?
09200	    WHILE NOT EMPTY(.Q[.I]) DO
09300	    ( ! YES. SERVE HIM, THEN ACTIVATE HIM.
09400	      HOLD(NORMAL(5.0,1.0,U<0,0>));
09500	      ACTIVATE(FIRST(.Q[.I]),AFTER,.CURRENT);
09600	      REMOVE(FIRST(.Q[.I]))
09700	    );
09800	!     NO.  REST UNTIL ONE ARRIVES.  HE'LL ACTIVATE ME.
09900	    CANCEL(.CURRENT)
10000	  END;    ! END OF CLERK LOOP
10100	
10200	END;     ! END OF SERVICE.
10300	
10400	
10500	!   INITIALIZE RANDOM NUMBER STREAMS, COUNTER, HISTOGRAM,
10600	!   QUEUES AND CLERKS.
10700	
10800	U_11;
10900	V_7;
11000	COUNT_0;
11100	INCR II FROM 0 TO 20 DO WTIME[.II]_0;
11200	INCR II FROM 0 TO N-1 DO Q[.II]_MAKELIST();
11300	INCR II FROM 0 TO N-1 DO CLERK[.II]_NEW(SERVICE(.II),100);
11400	
11500	!   INITIALIZE FIRST CUSTOMER, HE'LL TAKE CARE OF THE REST.
11600	ACTIVATE(NEW(CUSTOMER(10),100),AFTER,.CURRENT);
11700	
11800	!   WAIT TILL STATISTICS IS GATHERED.
11900	CANCEL(.CURRENT);
12000	
12100	! OUTPUT STATISTICS.
12200	TYPE('HISTO',0);  TYPE('GRAM ',0);  TYPE('OF WA',0);
12300	TYPE('ITING',0);  TYPE(' TIME',0);  TYPE('S:',1);
12400	INCR II FROM 0 TO 20 DO
12500	  (TYPDEC(.II,0);TYPE('	',0);TYPDEC(.WTIME[.II],1));
12600	TERMIO();
12700	
12800	END      !   CORRESPONDS TO BEGIN IN THIS PROGRAM.
12900	
13000	END      !   CORRESPONDS TO BEGIN FIRST IN POOMAS.BLI
13100	
13200	ELUDOM
13300	
13400	
13500	
13600	NOW ASSUME THAT THE PROGRAM ABOVE IS  ON  FILE  MARKET.BLI  AND  THAT
13700	POOMAS.BLI, POOIO.REL AND POOLIB.REL ARE ON THE USERS DISK AREA.
13800	
13900	TO COMPILE THIS PROGRAM GIVE THE FOLLOWING COMMAND:
14000	
14100	.R BLISS
14200	*DSK:MARKET,DSK:MARKET_DSK:POOMAS,MARKET
14300	
14400	TO RUN (DEBUG) IT, TYPE THE COMMAND
14500	
14600	.DEBUG POOLIB,POOIO,MARKET
14700	
14800	
14900	
15000	A SAMPLE TERMINAL SESSION WITH THE ABOVE PROGRAM:
15100	
15200	
15300	COMMENTS ARE GIVEN TO THE RIGHT, PRECEEDED BY A !.
15400	
15500	.R BLISS
15600	*DSK:MARKET,_DSK:POOMAS,MARKET		! STANDARD COMPILATION WITHOUT LISTING.
15700	
15800	
15900	MODULE LENGTH =364+2+27
16000	COMPILATION COMPLETE
16100	
16200	
16300	
16400	
16500	*^C
16600	.DEB POOLIB,POOIO,MARKET
16700	LOADING
16800	
16900	LOADER 11K CORE
17000	EXECUTION
17100	
17200	DDTBREAK$B    TRACEBREAK$B     		! SET POOMAS STANDARD BREAKPOINTS.
17300	$G
17400	CUSTOM AT 23234 T= 0.000 :     		! STARTING IN LIMP MODE.
17500	SERVIC AT 23465 T= 0.000 :		! CONTINUE LIMPING WHILE RETURNS ARE TYPED.
17600	CUSTOM AT 23145 T= 1.694 :
17700	SERVIC AT 23402 T= 1.694 :W    		! TRANSFER TO WALK MODE.
17800	SERVIC AT 23465 T= 3.416
17900	CUSTOM AT 23234 T= 3.416
18000	SERVIC AT 23402 T= 6.698
18100	
18200	 .  .  .                       		! WALKING FOR A WHILE.
18300	
18400	SERVIC AT 23402 T= 12.088
18500	CUSTOM L				! L TYPED, REPLIED IN MIDLINE.
18600	AT 22767 T=12.088
18700	SERVIC AT 23465 T= 12.603 :C CARDINAL(Q)   ! BACK IN LIMP MODE AS A RESULT.
18800						! OF TYPING THE L.  CHECK SIZES
18900						! OF QUEUES AND SQS.
19000	#1					! Q[0] HAS 1 MEMBER.
19100	 :C CARDINAL(Q+1)
19200	#0					! Q[1] HAS NONE
19300	 :C CARDINAL(Q+2)
19400	#1					! Q[2] HAS 1.
19500	 :C CARDINAL(SQS)
19600	#3					! SQS HAS 3 EVENTNOTICES.
19700	 :B					! GET INTO DDT AT BREAKPOINT.
19800	$2B>>TRACEB
19900	TALLY/  21           			! 21 EVENTS HAPPENED
20000	DEBUGGING/     1     			! WE'RE IN LIMP MODE.
20100	$P
20200	CUSTOM AT 23056 T= 12.603 :R   		! RUN IT FAST FOR SOME SECONDS.
20300	L					! BACK INTO LIMP MODE BY TYPING L.
20400	CUSTOM AT 20536 T=360.025 :B
20500	$2B>>TRACEB
20600	TALLY/   1120				! WERE MAKING PROGRESS.  GO ON.
20700	$P
20800	CUSTOM AT 17771 T= 362.290 :T 2000 	! STOP AGAIN AFTER 2000 EVENTS.
20900	CUSTOM AT 20536 T= 974.193 :B   	! DO A BREAKP. STOP AGAIN.
21000	CUSTOM AT 20453 T= 974.304 :B   	! THESE CUSTOMERS ENTERED AT TOP
21100	SERVIC AT 23317 T= 975.134 :B   	! WHERE TRACEBREAK IS'NT CALLED.
21200	$2B>>TRACEB
21300	TALLY/  3124    STOPCOUNT/      3120
21400	$P
21500	CUSTOM AT 21303 T=975.134 :R    	! RUN TIL FINISHED.
21600	HISTOGRAM OF WAITING TIMES:
21700	0  0
21800	1  0
21900	2  0
22000	3  18
22100	
22200	.  .  .
22300	
22400	19  26
22500	20  157
22600	
22700	EXIT
22800	^C
22900	
23000	AND THAT WAS THE END OF THE RUN
     
00100	                   C O M M O N   P I T F A L L S :
00200	
00300	
00400	
00500	STACK OVERFLOW
00600	
00700	THE  STACK  FOR  EACH PROCESS MUST BE ABLE TO ACCOMODATE ALL ROUTINES
00800	CALLED WITHIN THIS PROCESS.  IF ERRORS OCCUR OR IF THE HELP  ROUTINES
00900	ARE USED, THE DEPTH OF NESTING USUALLY GETS LARGE.  THIS ALSO HAPPENS
01000	IN OTHER MORE  NORMAL  CIRCUMSTANCES.   AN  OBJECT  SIZE  OF  100  IS
01100	PROBABLY  A  REASONABLE CHOICE, AT LEAST DURING DEBUGGING. BLISS DOES
01200	NOT ALWAYS DETECT STACK OVERFLOW, IN PARTICULAR WHEN  A  CONSTANT  IS
01300	ADDED  TO  THE  STACKPOINTER  TO ACCOMODATE LOCAL VARIABLES. THIS MAY
01400	HAVE DISASTROUS EFFECTS ON THE POOMAS DATASTRUCTURES.   HENCE  CHECKS
01500	ARE  BUILT  INTO  THOSE POOMAS ROUTINES THAT OFTEN ARE DEEPLY NESTED,
01600	LIKE GETSPACE, RELEASESPACE.
01700	
01800	
01900	OBJECTS AND OBJECT REFERENCES.
02000	
02100	SINCE THE LOCATION OF AN OBJECT IN MEMORY IN GENERAL  IS  UNKNOWN  TO
02200	THE  PROGRAMMER,  IT  IS  USUALLY  MANIPULATED  THROUGH SOME VARIABLE
02300	HOLDING ITS ADDRESS (OR THE VALUE OF  A  CREATE  EXPRESSION).   THESE
02400	VARIABLES  MAY,  IN  A  SENSE,  BE  REGARDED AS NAMES OF THE OBJECTS.
02500	VARIABLES OF THIS KIND, I.E. WHICH ARE EXPECTED TO HOLD ADDRESSES  OF
02600	OBJECTS,  MAY  BE MAPPED TO THE STRUCTURE OBJECT.  OBJECTS THEMSELVES
02700	ARE USUALLY NOT AVAILABLE FOR MAPPING.
02800	
02900	
03000	CALL FORMATS FOR MACROS VS. ROUTINES.
03100	
03200	THE  MACROS THAT GIVE ACCESS TO THE FIELDS OF OBJECTS ORIGINALLY TOOK
03300	AS THEIR PARAMETER AN IDENTIFIER MAPPED TO  OBJECT.   THEY  WILL  NOW
03400	ALSO  ACCEPT EXPRESSIONS THAT EVALUATE TO ADDRESSES OF OBJECTS.  SUCH
03500	EXPRESSIONS MUST  BE  ENCLOSED  IN  PARENTHESES  IN  ORDER  THAT  THE
03600	STRUCTURE  EVALUATION  MAY BE CORRECTLY DONE.  THE MACRO CALLS EXPAND
03700	TO POINTERS (IN THE NORMAL BLISS SENSE) TO  THE  FIELD  IN  QUESTION.
03800	HENCE  TO  GET  THE  ADDRESS  OF  THE  SUCCESSOR TO SOME OBJECT WRITE
03900	".SUC(OB)" OR ".SUC((.OB))", RATHER THAN  "SUC(.OB)".  ON  THE  OTHER
04000	HAND  ROUTINES USUALLY WANT THE ADDRESS OF AN OBJECT AS THEIR ACTUAL.
04100	HENCE "REMOVE(.OB)" WOULD BE CORRECT, AS  OPPOSED  TO  ".REMOVE(OB)".
04200	BLISS  MACROS MAY NOT BE USED RECURSIVELY, HENCE ".SUC((.SUC(OB))" IS
04300	ILLEGAL BUT ".PRED((.SUC(OB))" IS LEGAL.
04400	
04500	
04600	REMOTE ACCESSING MACROS
04700	
04800	THE PARAMETERS ARE AN ADDRESS AND A (SMALL) VALUE  RESPECTIVELY.  THE
04900	MACROS  EXPAND  TO  ADDRESSES.   THE  EXAMPLES  IN  SECT. 8 SHOULD BE
05000	STUDIED CAREFULLY.
05100	
05200	
05300	MIXED MODE ARITHMETIC
05400	
05500	THERE  AIN'T NO SUCH THING AS AUTOMATIC TYPE CONVERSION, AND THE MODE
05600	OF ARITHMETIC IS DETERMINED BY THE  OPERATOR  WRITTEN.  THUS:   CHECK
05700	FOUR TIMES, THEN CHECK AGAIN.
05800	
05900	
06000	
06100	
06200	END OF POOMAS DOCUMENTATION.