From: ust@trh.cap-computas.no (Ulf Stenhaug)
Subject: pragma ELABORATE not allowed (Sun Ada)
Date: Tue, 18 Oct 1994 12:33:51 GMT
Date: 1994-10-18T12:33:51+00:00 [thread overview]
Message-ID: <CxvC8G.7sw@trh.cap-computas.no> (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
next reply other threads:[~1994-10-18 12:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1994-10-18 12:33 Ulf Stenhaug [this message]
1994-10-18 14:32 ` pragma ELABORATE not allowed (Sun Ada) Bob Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox