From: Jean-Pierre Rosen <rosen@adalog.fr>
Subject: Re: Conditional compilation of debug traces without cpp
Date: Wed, 05 Jul 2006 15:03:42 +0200
Date: 2006-07-05T15:03:42+02:00 [thread overview]
Message-ID: <mbdg8e.ddb.ln@hunter.axlog.fr> (raw)
In-Reply-To: <44aaae35$0$5389$626a54ce@news.free.fr>
guillaume.portail@grospied.enanglais.com a �crit :
> package Debug is
> procedure Put_Line (M : in String);
> end;
>
> package body Debug is
> Enabled : constant Boolean := False;
> procedure Put_Line (M : in String) is
> begin
> if Enabled then
> Real_Put_Line (M);
> end;
> end;
> end;
Small plug: have a look at package Debug from Adalog's components page
(http://www.adalog.fr/compo2.htm), it does this in a very sophistciated
way...
As for your question:
> How may I organize the code to obtain the effect of having Debug.* calls
> being nulls when Debug.Enabled is False ?
>
Name you package Debug_Effective. Then write another package
(Debug_Dummy) with the same specification, and where all procedures are
null. Then simply compile:
with Debug_Effective;
package Debug renames Debug_Effective;
or:
with Debug_Dummy;
package Debug renames Debug_Dummy;
Switching packages is then not more difficult than changing a #define...
--
---------------------------------------------------------
J-P. Rosen (rosen@adalog.fr)
Visit Adalog's web site at http://www.adalog.fr
next prev parent reply other threads:[~2006-07-05 13:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-04 18:06 Conditional compilation of debug traces without cpp guillaume.portail
2006-07-04 19:07 ` Ludovic Brenta
2006-07-04 19:14 ` guillaume.portail
2006-07-04 21:39 ` Björn Persson
2006-07-04 21:43 ` guillaume.portail
2006-07-04 22:01 ` Björn Persson
2006-07-05 3:10 ` Matthew Goulet
2006-07-04 20:24 ` Gautier
2006-07-04 20:54 ` Simon Wright
2006-07-05 13:03 ` Jean-Pierre Rosen [this message]
2006-07-05 19:39 ` guillaume.portail
2006-07-06 5:53 ` Martin Krischik
2006-07-07 10:32 ` Stephen Leake
2006-07-07 14:08 ` M E Leypold
2006-07-06 7:59 ` Jean-Pierre Rosen
2006-07-06 20:25 ` guillaume.portail
2006-07-07 5:00 ` Matthew Goulet
2006-07-07 13:57 ` Thierry Bernier
2006-07-07 21:08 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox