english
version "1.0"
identify "wxyz"

#: Copyright (c) 1995, 2002 by Wayne C. Gramlich.
#, All rights reserved.
#,
#, Permission to use, copy, modify, distribute, and sell this software
#, for any purpose is hereby granted without fee provided that the above
#, copyright notice and this permission are retained.  The author makes
#, no representations about the suitability of this software for any purpose.
#, It is provided "as is" without express or implied warranty.

module slice

#: This module implements the slice abstraction.

define slice				#: Slice of files in project
    record
	project_files project_files	#: {project_files} list
	project project			#: {project} slice is part of
	resources resources		#: Resources everything is from
    generate address_get, allocate, erase, identical, print



#: {slice} procedures:

procedure xallocate@slice
    takes
	project project
    returns slice

    #: This procedure will allocate and return a new {slice} object
    #, allocated from {project}.


procedure deallocate@slice
    takes
	slice slice
    returns_nothing

    #: This procedure will deallocate {slice} and make it available for
    #, subsequent reuse.


procedure expand@slice
    takes
	file_name_strings vector[string]
	project project
	expand_trees logical
	open_only logical
    returns slice

    #: This procedure will take a list of file name strings and return
    #, a corresponding {slice} object.  {project} specifies the root
    #, of non-relative file names in {file_names}.  If {expand_trees}
    #, is {true}, any trees are expanded to their components; otherwise
    #, an error message is generated if a tree specification is encountered.
    #, Whenever any errors occur, ??@{slice} is returned.


procedure no_deleted@slice
    takes
	slice slice
	command string
    returns logical

    #: This procedure will ensure that {slice} contains no deleted file
    #, specifications.  If {slice} does contain some deleted files
    #, an error message containing {command} is output and {ture} is
    #, is returned; otherwise, {false} is returned.


procedure no_directories@slice
    takes
	slice slice
	command string
    returns logical

    #: This procedure will ensure that {slice} contains no directory
    #, specifications.  If {slice} does contain some directories,
    #, an error message containing {command} is output and {true} is
    #, returned; otherwise, {false} is returned.


procedure no_files@slice
    takes
	slice slice
	command string
    returns logical

    #: This procedure will ensure that {slice} contains no file
    #, specifications.  If {slice} does contain some files, an error
    #, message containing {command} is output and {true} is returned;
    #, otherwise, {false} is returned.


procedure no_links@slice
    takes
	slice slice
	command string
    returns logical

    #: This procedure will ensure that {slice} contains no symbolic link
    #, specifications.  If {slice} does contain some directories,
    #, an error message containing {command} is output and {true} is
    #, returned; otherwise, {false} is returned.


procedure no_mode@slice
    takes
	slice slice
	command string
	mode status_mode
	mode_name string
    returns logical

    #: This procedure will ensure that {slice} contains no {project_file}'s
    #, of mode {status_mode}.  If {slice} does, an error message is output
    #, that contains {command} and {true} is returned; otherwise {false}
    #, is returned.


procedure show@slice
    takes
	slice slice
	out_stream out_stream
    returns_nothing

    #: This procedure will output each file in {slice} to {out_stream}.