indexing
	description: "General messages"
	library: "Gobo Eiffel Utility Library"
	author: "Eric Bezault <ericb@gobo.demon.co.uk>"
	copyright: "Copyright (c) 1998, Eric Bezault"

class interface
	UT_MESSAGE

create 

	make (msg: STRING)
		require
			msg_not_void: msg /= void

feature -- Access

	any_array_: KL_ARRAY_ROUTINES [ANY]
			-- Routines that ought to be in class ARRAY
			-- (from KL_IMPORTED_ARRAY_ROUTINES)
		ensure -- from KL_IMPORTED_ARRAY_ROUTINES
			any_array_routines_not_void: Result /= void

	arguments: KL_ARGUMENTS
			-- Command-line arguments
			-- (from KL_SHARED_ARGUMENTS)
		ensure -- from KL_SHARED_ARGUMENTS
			arguments_not_void: Result /= void

	Code: STRING is "UT0008"
			-- Error code
			-- dollar0: $0 = program name
			-- dollar1: $1 = message

	default_message: STRING
			-- Default error message built using default_template
			-- (from UT_ERROR)
		ensure -- from UT_ERROR
			default_message_not_void: Result /= void

	Default_template: STRING is "$1"
			-- Default template used to built the error message

	integer_array_: KL_ARRAY_ROUTINES [INTEGER]
			-- Routines that ought to be in class ARRAY
			-- (from KL_IMPORTED_ARRAY_ROUTINES)
		ensure -- from KL_IMPORTED_ARRAY_ROUTINES
			integer_array_routines_not_void: Result /= void

	message (a_template: STRING): STRING
			-- Error message built using a_template;
			-- Occurrences of "$N" or "${N}" (where N stands
			-- for [0-9]+) in the template are substituted by
			-- the entry N in parameters or left as "$N"
			-- or "${N}" if N is out of bounds, unless it is
			-- equal to 0 in which case it is substituted by
			-- the program name. The character '$' is escaped
			-- using "$$". Return a new string each time.
			-- (from UT_ERROR)
		require -- from UT_ERROR
			a_template_not_void: a_template /= void
		ensure -- from UT_ERROR
			message_not_void: Result /= void

	parameters: ARRAY [STRING]
			-- Parameters used for building the error message
			-- (See header comment of message for details.)
			-- (from UT_ERROR)

	string_: KL_STRING_ROUTINES
			-- Routines that ought to be in class STRING
			-- (from KL_IMPORTED_STRING_ROUTINES)
		ensure -- from KL_IMPORTED_STRING_ROUTINES
			string_routines_not_void: Result /= void

	string_array_: KL_ARRAY_ROUTINES [STRING]
			-- Routines that ought to be in class ARRAY
			-- (from KL_IMPORTED_ARRAY_ROUTINES)
		ensure -- from KL_IMPORTED_ARRAY_ROUTINES
			string_array_routines_not_void: Result /= void
	
invariant

		-- from GENERAL
	reflexive_equality: standard_is_equal (Current);
	reflexive_conformance: conforms_to (Current);
		-- from UT_ERROR
	parameters_not_void: parameters /= void;
	no_void_parameter: not string_array_.has (parameters, void);

end -- class UT_MESSAGE