/* BEGINNING OF:	translator_temp_alloc.incl.pl1	  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */

	/*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
	/*									*/
	/* N__a_m_e:  translator_temp_alloc.incl.pl1					*/
	/*									*/
	/*      This include segment allocates space in a translator's temporary segment.  It 	*/
	/* contains a complete space allocation function 'allocate' which can be a quick PL/I	*/
	/* internal procedure in the program which includes this include segment.  The temporary	*/
	/* segment should be one obtained by using the translator_temp_ subroutine.		*/
	/*									*/
	/* S__t_a_t_u_s									*/
	/*									*/
	/* 0) Created by:  G. C. Dixon  in  January, 1975.				*/
	/* 1) Modified by: G. C. Dixon  in  February, 1981 - use limit area structure.		*/
	/*									*/
	/*  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */



allocate:	procedure (Parea, ANwords) returns (ptr);

     dcl	Parea			ptr,		/* ptr to the temporary segment. (In)		*/
	ANwords			fixed bin;	/* number of words to be allocated. (In)	*/

     dcl	Nwords			fixed bin,	/* number of words to be allocated, rounded up	*/
						/* to a 0 mod 2 quantity.			*/
	P			ptr,		/* a temporary pointer.			*/
	code			fixed bin(35),	/* a status code.				*/
         (mod, null, ptr)		builtin;

     dcl	1 area			based (Parea),
	  2 Pfirst_temp_seg		ptr unal,		/*   ptr to first temp seg of a group.		*/
	  2 Ofree			fixed bin(35),	/*   offset of next free word in temp seg.	*/
	  2 Lfree			fixed bin(35);	/*   length of remaining free space in temp seg.	*/

     dcl	translator_temp_$get_next_segment
				entry (ptr, ptr, fixed bin(35));

	Nwords = ANwords + mod (ANwords, 2);		/* round up word count to 0 + mod 2 quantity.	*/
	if Nwords > Lfree then do;			/* handle area overflow.			*/
	     call translator_temp_$get_next_segment (Parea, P, code);
	     if P = null then return (null);
	     Parea = P;
	     if Nwords > area.Lfree then return (null);
	     end;
	P = ptr (Parea, area.Ofree);			/* get pointer to next free word of area.	*/
	area.Ofree = area.Ofree + Nwords;		/* increase offset of remaining free space.	*/
	area.Lfree = area.Lfree - Nwords;		/* decrease length of remaining free space.	*/
	return (P);

	end allocate;

/* END OF:	translator_temp_alloc.incl.pl1	  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  */


*/
                                          -----------------------------------------------------------


Historical Background

This edition of the Multics software materials and documentation is provided and donated
to Massachusetts Institute of Technology by Group Bull including Bull HN Information Systems Inc. 
as a contribution to computer science knowledge.  
This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology,
Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell Bull Inc., Groupe Bull
and Bull HN Information Systems Inc. to the development of this operating system. 
Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970),
renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership
of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for 
managing computer hardware properly and for executing programs. Many subsequent operating systems 
incorporated Multics principles.
Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., 
as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. .

                                          -----------------------------------------------------------

Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without
fee is hereby granted,provided that the below copyright notice and historical background appear in all copies
and that both the copyright notice and historical background and this permission notice appear in supporting
documentation, and that the names of MIT, HIS, Bull or Bull HN not be used in advertising or publicity pertaining
to distribution of the programs without specific prior written permission.
    Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc.
    Copyright 2006 by Bull HN Information Systems Inc.
    Copyright 2006 by Bull SAS
    All Rights Reserved

*/
