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

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

module status

#: This module declares and implements the {status} abstraction.  The
#, {status} abstraction is a contains status information about files.

define status		#: File status type:
    external


define status_mode	#: File type
    enumeration
	deleted		#: File does not exist
	directory	#: File is a directory
	other		#: File is something else (e.g. block device)
	pipe		#: File is a named pipe
	regular_file	#: File is a regular file of bytes
	symbolic_link	#: File is a symbolic link
    generate equal, hash, print, unsigned_convert



#: {status} procedures:

procedure access_get@status
    takes
	status status
    returns unsigned
    external status__access_get

    #: This procedure will return the access mode bits from {status}.



procedure address_get@status
    takes
	status status
    returns address
    external status__address_get

    #: This procedure will return the address of {status}.



procedure allocate@status
    takes_nothing
    returns status
    external status__allocate

    #: This procedure will allocate and return a new {status} object.



procedure identical@status
    takes
	status1 status
	status2 status
    returns logical

    #: This procedure will return {true} if {status1} is equal to {status2}
    #, and {false} otherwise.


procedure is_deleted_get@status
    takes
	status status
    returns logical

    #: This procedure will return {true} if {status} refers to a
    #, non-existent file and {false} otherwise.


procedure is_directory_get@status
    takes
	status status
    returns logical
    external status__is_directory

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



procedure is_pipe_get@status
    takes
	status status
    returns logical
    external status__is_pipe

    #: This procedure will return {true} is {status} is a pipe
    #, and {false} otherwise.



procedure is_regular_file_get@status
    takes
	status status
    returns logical
    external status__is_regular_file

    #: This procedure will return {true} is {status} is a regular file
    #, and {false} otherwise.



procedure is_symbolic_link_get@status
    takes
	status status
    returns logical
    external status__is_symbolic_link

    #: This procedure will return {true} is {status} is a symbolic link
    #, and {false} otherwise.



procedure is_other_get@status
    takes
	status status
    returns logical

    #: This procedure will return {true} is {status} is not a regular
    #, file, symbolic link, directory, or pipe; and {false} otherwise.


procedure lookup@status
    takes
	status status
	file_name string
    returns logical
    external status__lookup

    #: This procedure will lookup the status associated with {file_name}
    #, and store it in {status}.  {true} is returned if {file_name} does
    #, not exist; otherwise {false} is returned.



procedure mode_get@status
    takes
	status status
    returns status_mode

    #: This procedure will return the mode of {status}.
	

procedure modification_time_get@status
    takes
	status status
    returns unsigned
    external status__modification_time_get

    #: This procedure will return the modification time associated with
    #, {status} as the number of seconds since 00:00:00 UTC, Jan. 1, 1970.



procedure print@status
    takes
	status status
	out_stream out_stream
    returns_nothing

    #: This procedure will print the contents of {status} to {out_stream}.


procedure size_get@status
    takes
	status status
    returns unsigned
    external status__size

    #: This procedure will return the file size (in bytes) from {status}.