english
version "1.0"
identify "%Z%%M% %I% %E%"

#: Copyright (c) 1991-2005 by Wayne C. Gramlich.
#, All rights reserved.

module directory

#: This module declares and implements the {directory} abstraction.

define directory
    external


procedure address_get@directory
    takes
	directory directory
    returns address
    external directory__address_get

    #: This procedure will return the address of {directory}



procedure child_open@directory
    takes
	directory directory
	child_name string
    returns directory

    #: This procedure will open the child directory of {directory}
    #, named {child_name}.  If any errors  occur ??#{directory} is returned.


procedure close@directory
    takes
	directory directory
    returns_nothing
    external directory__close

    #: This procedure will close {directory}.



procedure current_open@directory
    takes
	file_system file_system
    returns directory

    #: This procedure will create and return a directory object for
    #, the current directory allocated from {file_system}.  If any errors
    #, occur, ??@{directory} is returned.


procedure file_name_next@directory
    takes
	directory directory
    returns file_name

    #: This procedure will return the next {file_name} object from
    #, {directory}.  If there are no more {file_name} objects to be
    #, has, ??@{file_name} is returned.


procedure file_name_string_next@directory
    takes
	directory directory
	file_name string
    returns logical
    external directory__file_name_string_next

    #: This procedure will return the next file name from {directory}
    #, and store it into {file_name}.  {file_name} must be a string that
    #, is in {read_write} mode.  If there are no more file names,
    #, {false} is returned; otherwise {true} is returned.  For Unix,
    #, the file names ".." and "." are not returned.



procedure file_system_get@directory
    takes
	directory directory
    returns file_system
    external directory__file_system_get

    #; This procedure will return the {file_system} object associated
    #, with {directory}.



procedure identical@directory
    takes
	directory1 directory
	directory2 directory
    returns logical

    #: This procedure will return {true} if {directory1} is identical to
    #, {directory2}.


procedure is_root_get@directory
    takes
	directory directory
    returns logical
    external directory__is_root_get

    #: This procedure will return {true} if {directory} is the root
    #, directory and {false} otherwise.



procedure is_open_get@directory
    takes
	directory directory
    returns logical
    external directory__is_open_get

    #: This procedure will return {true} if {directory} is open and
    #, {false} otherwise.



procedure name_get@directory
    takes
	directory directory
    returns string
    external directory__name_get

    #: This procedure will return the directory name used to create
    #, {directory}.



procedure open@directory
    takes
	directory_name string
	file_system file_system
    returns directory
    external directory__open

    #: This procedure will open {directory_name} and return it as a
    #, {directory}.  If {directory_name} does not exist,
    #, {??}@{directory} is returned.



procedure parent_name_get@directory
    takes
	directory directory
    returns string
    external directory__parent_name_get

    #: This procedure will return the parent name of {directory}.



procedure parent_open@directory
    takes
	directory directory
    returns directory

    #: This procedure will open and return the parent directory for
    #, {directory}.  If any error occurs, ??@{directory} is returned.


procedure print@directory
    takes
	directory directory
	out_stream out_stream
    returns_nothing

    #: This procedure will print {directory} to {out_stream}.


procedure temporary_get@directory
    takes
	directory directory
    returns string
    external directory__temporary_get

    #: This procedure will return a temporary string associated with
    #, {directory} that is in read/write mode.