[fpc-pascal] Determining procedure's name

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Mar 3 23:24:07 CET 2010


On Wed, 03 Mar 2010 21:33:45 +0200
Wimpie Nortje <wimpienortje at gmail.com> wrote:

> Hello everybody,
> 
> Is there a macro or function that gives the current procedure's name?
> 
> E.g.
> 
> procedure TClass.SomeProc;
> begin
>   writeln(Format('This procedure's name is %s', [THE_MACRO]));
> end;

If you use Lazarus you can create a code template. Then you can type w
plus Ctrl+J and you will get:

  writeln(Format('This procedure's name is %s', ['TClass.SomeProc']));

I prefer
  writeln('TClass.SomeProc '|);

The | symbol is where the cursor is positioned after the template was
added.

 
> should print
> 
> This procedure's name is TClass.SomeProc
> 
> or
> 
> This procedure's name is SomeProc


Mattias



More information about the fpc-pascal mailing list