english
version "1.0"
identify "xyz"

#: 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 misc

#: This module implements the miscellaneous functions for SVMS.


#: Miscellaneous procedures:

procedure paragraph_prompt@in_stream
    takes
	in_stream in_stream
	out_stream out_stream
	prompt string
	result string
    returns_nothing

    #: This procedure will prompt the user for a paragraph of text
    #, terminated by a blank line.  The text is read from {in_stream}
    #, appended to {result}.  Each line of text is prompted by outputing
    #, {prompt} to {out_stream}.


procedure timestamp_append@string
    takes
	buffer string
	date unsigned
    returns_nothing

    #: This procedure will convert "date" into a string of the form
    #, 'YYYY/MM/DD@hh:mm:ssGMT' and append it to {buffer}.


procedure timestamp_lop@string
    takes
	buffer string
    returns unsigned

    #: This procedure will return a timestamp read from {buffer}.


procedure number_append@string
    takes
	buffer string
	number unsigned
    returns_nothing

    #: This procedure will append {number} to {buffer} as a decimal number.


procedure unsigned_fixed_append@string
    takes
	buffer string
	number unsigned
	width unsigned
    returns_nothing

    #: This procedure will append {number} out to {buffer} as {width}
    #, digit decimal number.


procedure unsigned_fixed_lop@string
    takes
	buffer string
	width unsigned
    returns unsigned

    #: This procedure will lop a {width} digit decimal number from {buffer}
    #, and return it.


procedure log10@unsigned
    takes
	number unsigned
    returns unsigned

    #: This routine will return the number of digits needed to represent
    #, {number}; thus, the number 0 on input returns 1.

    #, So, 10 is the biggest number that can be returned.