[Lazarus] RFC: Code tools Feature?

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Thu Mar 27 09:41:45 CET 2014


Michael Van Canneyt wrote:
> Hi,
> 
> Is it possible to have the following in the code tools:
> 
> I would like to be able to specify a code snippet that is inserted at 
> the start and end of a procedure
> (after begin, before end keywords). The code snippet should contains 
> some macros like $(CLASSNAME) $(METHODNAME).
> Conceivably, other macros can be thought of: parameters, unit name etc.
> 
> The intended use is that the IDE generates stuff like
> 
> Procedure TMyClass.MyMethod;
> 
> begin
>   {$IFDEF LOGPROCESSFLOW}Log('Entering TMyClass.MyMethod');{$ENDIF}
> 
>   {$ENDIF LOGPROCESSFLOW}Log('Exiting TMyClass.MyMethod');{$ENDIF}
> end;

If the compiler could track the current procedure (or function, or 
class.method etc.) name, then couldn't that be done with a macro? Then 
the app source would be a less-obtrusive:

Procedure TMyClass.MyMethod;

begin_logged

end_logged;

Otherwise, since this is such a common requirement, how about a 
non-fatal equivalent of Assert()?

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list