indexing
	description: "Execution environment facilities"
	usage: "This class should not be used directly through inheritance and client/supplier relationship. Inherit from KL_SHARED_EXECUTION_ENVIRONMENT instead."
	pattern: "Singleton"
	library: "Gobo Eiffel Kernel Library"
	author: "Eric Bezault <ericb@gobo.demon.co.uk>"
	copyright: "Copyright (c) 1997, Eric Bezault"

class interface
	KL_EXECUTION_ENVIRONMENT

feature -- Access

	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

	variable_value (a_variable: STRING): STRING
			-- Value of environment variable a_variable;
			-- Void if a_variable has not been set
		require
			a_variable_not_void: a_variable /= void
	
feature -- Conversion

	interpreted_string (a_string: STRING): STRING
			-- String where the environment variables have been
			-- replaced by their values. The environment variables
			-- are considered to be either ${[^}]*} or $[a-zA-Z0-9_]+
			-- and the dollar sign is escaped using $$. Non defined
			-- environment variables are replaced by empty strings.
			-- The result is not defined when a_string does not
			-- conform to the conventions above.
			-- Return a new string each time.
		require
			a_string_not_void: a_string /= void
		ensure
			interpreted_string_not_void: Result /= void
	
feature -- Setting

	set_variable_value (a_variable, a_value: STRING)
			-- Set environment variable a_variable to a_value.
			-- (This setting may fail on certain platforms.)
		require
			a_variable_not_void: a_variable /= void;
			a_variable_not_empty: not a_variable.empty;
			a_value_not_void: a_value /= void
	
invariant

		-- from GENERAL
	reflexive_equality: standard_is_equal (Current);
	reflexive_conformance: conforms_to (Current);

end -- class KL_EXECUTION_ENVIRONMENT