Google
 

Trailing-Edge - PDP-10 Archives - DEC_CMS-20_V1.0_SRC - cms/sources/bufmgr.bli
There are no other files named bufmgr.bli in the archive.
MODULE BUFMGR (IDENT = '1'
		) =
BEGIN

!
!			  COPYRIGHT (c) 1982 BY
!	      DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
!
! THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED
! ONLY  IN  ACCORDANCE  WITH  THE  TERMS  OF  SUCH  LICENSE AND WITH THE
! INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE OR  ANY  OTHER
! COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
! OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
! TRANSFERRED.
!
! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE  WITHOUT  NOTICE
! AND  SHOULD  NOT  BE  CONSTRUED  AS  A COMMITMENT BY DIGITAL EQUIPMENT
! CORPORATION.
!
! DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF  ITS
! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL.
!

!++
! FACILITY: CMS Library Processor
!   
!
! ABSTRACT:
!   
!	This module provide a preliminary zone management package
!	for later development into a full zone management system.
!
! ENVIRONMENT: VAX/VMS DS-20
!   
!
! AUTHOR: Bob Wheater,  CREATION DATE: 7-JUL-1981
!
! MODIFIED BY:
!
!--
!
! TABLE OF CONTENTS:
!

FORWARD ROUTINE
	zon_bfree,		! mark memory block in zone as free
	zon_deact,		! de-activate all zone memory.
	zon_free,		! reset a zone as all memory available.
	zon_get,		! get address of requested memory.
	zon_init,		! initialize a zone for subsequent memory
				! requests.
	zon_rel ;		! release a zone and all its memory.

!
! INCLUDE FILES:
!

%if %bliss(bliss32) %then
    library 'sys$library:starlet';
%else
    require 'jsys:';
%fi

library 'XPORT:';

require 'BLISSX:';

require 'BUFUSR:';

!
! MACROS:
!

!
! EQUATED SYMBOLS:
!

!
! OWN STORAGE:
!

!
! EXTERNAL REFERENCES:
!
%SBTTL 'Mark memory block a free'
GLOBAL ROUTINE zon_bfree(mem_type,d_zon_nam,count,a_start) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine marks a block within a specified zone as free.
!	This routine is different from the ZON_FREE in that it doesn't
!	free the whole zone.
!
! FORMAL PARAMETERS:
!
!	mem_type		The type of memory desired (character or 
!				fullword). Acceptable values are given
!				below:
!					k_char_mem
!					k_fulwd_mem
!
!	d_zon_nam		Address of the descriptor pointing to
!				a character string that identifies the
!				zone uniquely.
!
!	count			Number of units(specified by the memory type)
!				to mark as free.
!
!	a_start			Address of the location containing the stare
!				address or pointer of the memory to be freed.
!
! IMPLICIT INPUTS:
!
!	None.
!
! IMPLICIT OUTPUTS:
!
!	None.
!
! ROUTINE VALUE and
! COMPLETION CODES:
!
!	True = success
!	false = failure
!
! SIDE EFFECTS:
!
!	None.
!
!--

    BEGIN

    bind
	zon_nam = .d_zon_nam: desc_block ;	! zone id string

    local
	status ;			! status return from xport call




    ! check for legal memory request types
    if
	.mem_type neq k_char_mem and
	.mem_type neq k_fulwd_mem 
    then
	return false ;

    ! check for character requests
    if
	.mem_type eql k_char_mem
    then
	status = $xpo_free_mem(string=(.count,..a_start)) ;

    ! check for fullword request
    if
	.mem_type eql k_fulwd_mem
    then
	status = $xpo_free_mem(binary_data=(.count,..a_start,fullwords)) ;

    if
	not .status 
    then
	return false ;

    ! normal success return
    true

    END;			! end of routine zon_bfree
%SBTTL 'Zone memory deactivation'
ROUTINE zon_deact =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine will release all dynamic memory currently in use by the
!	buffer manager and all control blocks.
!
! FORMAL PARAMETERS:
!
!	%(/**/)%
!
! IMPLICIT INPUTS:
!
!	%(/**/)%
!
! IMPLICIT OUTPUTS:
!
!	%(/**/)%
!
! ROUTINE VALUE and
! COMPLETION CODES:
!
!	True = success
!	false = failure
!
! SIDE EFFECTS:
!
!	%(/**/)%
!
!--

    BEGIN
     
    ! not yet implemented
    false

    END;			! end of routine zon_deact
%SBTTL 'Single Zone reset as available'
ROUTINE zon_free(d_zon_nam)  =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine re-initializes the zone by returning the next 
!	available free memory pointer to the beginning of the block.
!
! FORMAL PARAMETERS:
!
!	d_zon_nam		Address of the descriptor pointing to
!				a character string that identifies the
!				zone uniquely.
!
! IMPLICIT INPUTS:
!
!	%(/**/)%
!
! IMPLICIT OUTPUTS:
!
!	%(/**/)%
!
! ROUTINE VALUE and
! COMPLETION CODES:
!
!	True = success
!	false = failure
!
! SIDE EFFECTS:
!
!	%(/**/)%
!
!--

    BEGIN

    ! not yet implemented
    false

    END;			! end of routine zon_free
%SBTTL 'Acquire memory '
GLOBAL ROUTINE zon_get(mem_type,d_zon_nam,count,a_start) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine acquires the specified amount of memory requested by the
!	calling routine
!
! FORMAL PARAMETERS:
!
!	mem_type		The type of memory desired (character or 
!				fullword). Acceptable values are given
!				below:
!					k_char_mem
!					k_fulwd_mem
!
!	d_zon_nam		Address of the descriptor pointing to
!				a character string that identifies the
!				zone uniquely.
!
!	count			Number of units(specified by the memory type)
!				to acquire in this request.
!
!	a_start			Address of the location to write the start 
!				address or pointer of the acquire memory.
!
! IMPLICIT INPUTS:
!
!	%(/**/)%
!
! IMPLICIT OUTPUTS:
!
!	%(/**/)%
!
! ROUTINE VALUE and
! COMPLETION CODES:
!
!	True = success
!	false = failure
!
! SIDE EFFECTS:
!
!	%(/**/)%
!
!--

    BEGIN

    bind
	zon_nam = .d_zon_nam: desc_block ;	! zone id string

    local
	status ;			! status return from xport call




    ! check for legal memory request types
    if
	.mem_type neq k_char_mem and
	.mem_type neq k_fulwd_mem 
    then
	return false ;

    ! check for character requests
    if
	.mem_type eql k_char_mem
    then
	status = $xpo_get_mem(characters=.count,result=.a_start) ;

    ! check for fullword request
    if
	.mem_type eql k_fulwd_mem
    then
	status = $xpo_get_mem(fullwords=.count,result=.a_start) ;

    if
	not .status 
    then
	return false ;

    ! normal success return
    true

    END;			! end of routine zon_get
%SBTTL 'Initialize a zone'
GLOBAL ROUTINE zon_init(mem_type,d_zon_name,size) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine sets the initial zone size and identification string. Also
!	the initial zone memory is acquired.
!
! FORMAL PARAMETERS:
!
!	d_zon_nam		Address of the descriptor pointing to
!				a character string that identifies the
!				zone uniquely.
!
!	size			An integer indicated the size of the zone unit.
!
! IMPLICIT INPUTS:
!
!	%(/**/)%
!
! IMPLICIT OUTPUTS:
!
!	%(/**/)%
!
! ROUTINE VALUE and
! COMPLETION CODES:
!
!	True = success
!	false = failure
!
! SIDE EFFECTS:
!
!	%(/**/)%
!
!--

    BEGIN

    ! to be implemented
    true

    END;			! end of routine zon_init
%SBTTL 'Permanent release of a zone'
ROUTINE zon_rel(d_zon_nam) =

!++
! FUNCTIONAL DESCRIPTION:
!
!	This routine releases a zone and deallocates all memory required by
!	it.
!
! FORMAL PARAMETERS:
!
!	d_zon_nam		Address of the descriptor pointing to
!				a character string that identifies the
!				zone uniquely.
!
! IMPLICIT INPUTS:
!
!	%(/**/)%
!
! IMPLICIT OUTPUTS:
!
!	%(/**/)%
!
! ROUTINE VALUE and
! COMPLETION CODES:
!
!	True = success
!	false = failure
!
! SIDE EFFECTS:
!
!	%(/**/)%
!
!--

    BEGIN

    ! to be implemented
    true

    END;			! end of routine zon_rel

END				! End of module
ELUDOM