From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,af159f716ef5c24b,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-18 10:16:30 PST Newsgroups: comp.lang.ada Path: bga.com!news.sprintlink.net!hookup!usc!howland.reston.ans.net!pipex!sunic!trane.uninett.no!eunet.no!nuug!capcomp!ust From: ust@trh.cap-computas.no (Ulf Stenhaug) Subject: pragma ELABORATE not allowed (Sun Ada) Message-ID: Organization: Cap Computas AS, Trondheim Branch Date: Tue, 18 Oct 1994 12:33:51 GMT Date: 1994-10-18T12:33:51+00:00 List-Id: 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