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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,400766bdbcd86f7c,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mail From: "Per Lindquist" Newsgroups: comp.lang.ada Subject: This can't be done in Ada...or? Date: 11 Feb 2005 08:33:31 -0800 Organization: http://groups.google.com Message-ID: <1108139611.709714.36170@o13g2000cwo.googlegroups.com> NNTP-Posting-Host: 138.14.239.132 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1108139615 16106 127.0.0.1 (11 Feb 2005 16:33:35 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 11 Feb 2005 16:33:35 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: o13g2000cwo.googlegroups.com; posting-host=138.14.239.132; posting-account=e84-wQ0AAADeDLnjH5yWqnRMVsJLfQJg Xref: g2news1.google.com comp.lang.ada:8245 Date: 2005-02-11T08:33:31-08:00 List-Id: Hi, this question has already sort of been discussed in topics about multiple target platforms, conditional compilation, preprocessors and build strategies. Before giving up I thought I'd give it a try one last time... My impression from reading some threads is that Ada DOES NOT offer a decent way to implement trace printouts (log messages), at least not with the features stated below. The problem ----------- We want to be able to output log messages, or traces as we call it, from an Ada program. There will be a few trace categories like Error, Warning, Note etc. The messages (strings) can be sent to a file or stdout or whatever (not important). A call might look something like this: Trace.Error(Package_Name, Subprogram_Name, "Woops, V=" & Some_Type'Image(V)); How do we write a tracing utility in Ada that: 1. has different behaviour on different target platforms 2. can disable some categories depending on target platform at compile-time. 3. does *not* cause any execution overhead if disabled. 4. does not need yucky "if Trace_Wanted then ... end if;" around all calls 5. does not need preprocessing (some of you say it's never needed in Ada...) I say it can't be done in Ada. Please prove me wrong! Appendix -------- I don't want to clutter the post with too much info but some additional stuff may be of interest: There are two target platforms: "target variant": HW: Sun workstation, OS: Solaris, Real-time: no, Compiler: gcc (gnat) "host variant": HW: PowerPC, OS: Integrity 5, Real-time: yes, Compiler: Adamulti (Green Hills) If we could get rid of those hardcoded constants Package_Name : constant String := "Some_Package"; ... Subprogram_Name : constant String := "Some_Procedure1"; ... Subprogram_Name : constant String := "Some_Procedure2"; it would be a great bonus, but I reckon it can't be done either..?