english
version "1.0"
identify "xyz"

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

#: This module provides a fixed size array of strings contruct.  It meant
#, to be used by a few of the procedures in the {unix_system} module.

module string_array

import
    address
    file_set
    in_stream
    integer
    logical
    memory
    out_stream
    save
    string
    unsigned

define string_array		#: Null terminated list of strings
    external

#: {string_array} procedures:

procedure create@string_array
    takes
	initial_value string
	size unsigned
    returns string_array
    external string_array__create

    #: This procedure will create and return a new {string_array} object
    #, with {size} slots initialized to contain {initial_value}.


procedure fetch1@string_array
    takes
	string_array string_array
	index unsigned
    returns string
    external string_array__fetch1

    #: This procedure will return the {index}'th string from {string_array}.


procedure print@string_array
    takes
	string_array string_array
	out_stream out_stream
    returns_nothing

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

    put@("string_array(", out_stream)
    size :@= string_array.size
    index :@= 0
    loop
	while index < size
	print@(index, out_stream)
	put@(":`", out_stream)
	print@(string_array[index], out_stream)
	index :+= 1
	if index = size
	    put@(")", out_stream)
	else
	    put@(", ", out_stream)


procedure store1@string_array
    takes
	string_array string_array
	index unsigned
	value string
    returns_nothing
    external string_array__store1

    #: This procedure will store {value} into the {index}'th slot of
    #, {string_array}.


procedure size_get@string_array
    takes
	string_array string_array
    returns unsigned
    external string_array__size_get

    #: This procedure will return the size of {string_array}.

