comp.lang.ada
 help / color / mirror / Atom feed
* pragma ELABORATE not allowed (Sun Ada)
@ 1994-10-18 12:33 Ulf Stenhaug
  1994-10-18 14:32 ` Bob Duff
  0 siblings, 1 reply; 2+ messages in thread
From: Ulf Stenhaug @ 1994-10-18 12:33 UTC (permalink / raw)



We use what we think is an elegant solution for configuring an
application, but after shifting compiler that gave us problems.

Can anybody give advise?


We enter configurable parameters in a file and use a 'configure'
package which provides the values found on the file. Simplified
excerpts:

package body configure is
	config_database : t_config_database;
	procedure read_config_file is separate;
	task protect_config_db is 
		entry reserve;
		entry release;
	end;
	task body protect_config_db is
		read_config_file;
		loop
			select
				accept reserve;
				accept release;
			or
				terminate;
			end select;
		end loop;
	end protect_config_db;

	-- Body of the function defined in package spec:
	function value_of(name : string) return integer is
		found_value : integer;
	begin
		protect_config_db.reserve;
		-- search in the 'database' for the name ...
		found_value := config_database(.....);
		protect_config_db.release;
		return found_value;
	end value_of;
end configure;

with configure;
package rename_config is
	-- I don't think that this renaming is of importance
	-- in this context, but this is how we do it ...
	function value_of ( name : string ) return integer
			renames configure.value_of;
end rename_config;

Then this is used for instance in the following way:

with rename_config;
with other_packages_which_also_use_configure;
program main is
	task type t_a_task is
		entry an_entry;
	end t_a_task;
	for t_a_task'storage_size use
		rename_config.value_of("stack_size_of_a_task");
	a_task : t_a_task;
	task 
	begin
		--
	end;
end main;

For this to work, the 'configure' package naturally has to be
elaborated first. While we used the Verdix Ada Compiler v. 6.0.3(c)
we had no problems. When we compiled our application with the
Sun Ada Compiler v. 1.1(f) the program crashed (with 'program_error'
exception), and the debugger refers to ARM 3.9(5) and says that
  "subprogram value_of called before body has been elaborated".

When we try to isolate the problem and strip off the application
stuff that is irrelevant for the problem, the error situaion vanishes.

Now to the real problem: We insert "pragma ELABORATE(rename_config)"
after the with-statement, but then the compiler refers to ARM
appendix B and complains that
  "This pragma not allowed in this context."

Why is it not allowed? What can we do??????

Regards Ulf Stenhaug



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1994-10-18 14:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-10-18 12:33 pragma ELABORATE not allowed (Sun Ada) Ulf Stenhaug
1994-10-18 14:32 ` Bob Duff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox