Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-02

Include directive for current procedure/method/function name?

4 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

I vaguely remember somebody requesting something like this, but not sure if it was every implemented in FPC 2.6.4 or FPC 3.0. A macro that one can use in code to return a string, which is the name of the current procedure, function or method. Useful in debugging.

Something like the {$I %date%} syntax.

Anybody know if there is something like that in FPC?

Regards,
- Graeme -

Sven Barth
to Graeme Geldenhuys

Am 26.02.2016 01:35 schrieb "Graeme Geldenhuys" <

Show quoted text 11 lines
: On 2016-02-26 00:15, Graeme Geldenhuys wrote: > Anybody know if there is something like that in FPC? No worries, found it. Seems Thunderbird doesn't search as well as Firefox. ;) I was looking for {$I %CURRENTROUTINE%} and {$I %LINE%} - but CURRENTROUTINE might only be in FPC 3.1+

Yes, it was a relatively recent addition.

Regards,
Sven

Graeme Geldenhuys
to Sven Barth
Sven Barth wrote
Yes, it was a relatively recent addition.

In the mean time (as I only use FPC 2.6.4 and FPC 3.0) I tried to use GetLineInfo internally instead, that gives the the same result (though I guess with more overhead).

Unfortunately GetLineInfo() [for DWARF] is incomplete, where method names are not implemented, but unit name and line number is. :-/ There is a bug report about this already:

http://mantis.freepascal.org/view.php?id=17547

So I'm back at square one with what I wanted to achieve. :-(

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp