Re: [fpc-devel] __LINE__ and __FILE__ macros

2011-04-29 Thread Marco van de Voort
In our previous episode, Joerg Schuelke said:
  Look in the manual under preprocessor $i (include)
  
 Thats better then nothing, but if you want to include this information
 in debugging information, and you won't write it again and again you
 will need an expression which is usable inside an macro.

I use an IDE macro to insert a predefined line, and then I just change the
constants I will log. The advantage of that way is that you have full
intellisense to specify the vars to dump, something that is always hard with
a macro.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] __LINE__ and __FILE__ macros

2011-04-29 Thread Mark Morgan Lloyd

Joerg Schuelke wrote:

Am Thu, 28 Apr 2011 20:09:59 +0200
schrieb Joerg Schuelke joerg.schue...@gmx.de:

No further explanation needed. Nested comments do it.
I did not know that {$define mx:= ... (*$%LINE%*)} works.


So that's why (*$define mx:= ... doesn't work :-)

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

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] __LINE__ and __FILE__ macros

2011-04-29 Thread Joerg Schuelke
Am Fri, 29 Apr 2011 09:58:08 +0200 (CEST)
schrieb mar...@stack.nl (Marco van de Voort):

 I use an IDE macro to insert a predefined line, and then I just
 change the constants I will log. The advantage of that way is that
 you have full intellisense to specify the vars to dump, something
 that is always hard with a macro.

Ok, so far. But: if you write code like

{$define _dp:=writeln(stderr,{$I %FILE%}:20,' [',{$I %LINE%},'] ')}

and somewhere else you use the dp macro, I would expect that it prints
out the line number and file name of the place where I used it and not
where I defined it. Yesterday I looked in the sources and found that
this is because insertmacro is always called with line and file
parameters from the defining context.
I think it would be more useful if the {$I %FILE%} and {$I %LINE%}
directives expand to the bottom level file name and line number, not
the one of the mac.text where they are used and even not from where
they may be included.
An other possibility is to make all levels of line and file info
accessible trough a construct like {$I %FILE%nnn%}, where nnn% is an
optional integer level description.

regards
Jörg
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] __LINE__ and __FILE__ macros

2011-04-28 Thread Joerg Schuelke
Best regards to all developers,

is it somehow possible to access the line number and file information
during the compilation? This would be nice for debugging purposes.

I do not write about the compiled in debug information for gdb.

ASSERT can - i read it in the documentation - access this information.

Is it without to much work possible to make this information accessible
as macro?
Are there any plans to extend macro support (parameters?)?

Best regards again

Jörg Schülke
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] __LINE__ and __FILE__ macros

2011-04-28 Thread Marco van de Voort
In our previous episode, Joerg Schuelke said:
 Best regards to all developers,
 
 is it somehow possible to access the line number and file information
 during the compilation? This would be nice for debugging purposes.

Look in the manual under preprocessor $i (include)

 
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] __LINE__ and __FILE__ macros

2011-04-28 Thread Joerg Schuelke
Am Thu, 28 Apr 2011 18:23:10 +0200 (CEST)
schrieb mar...@stack.nl (Marco van de Voort):

 Look in the manual under preprocessor $i (include)

thx, hard to find there. I thought i did read them all, but ...
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] __LINE__ and __FILE__ macros

2011-04-28 Thread Joerg Schuelke
Am Thu, 28 Apr 2011 18:23:10 +0200 (CEST)
schrieb mar...@stack.nl (Marco van de Voort):

 
 Look in the manual under preprocessor $i (include)
 
Thats better then nothing, but if you want to include this information
in debugging information, and you won't write it again and again you
will need an expression which is usable inside an macro.

Jörg 
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] __LINE__ and __FILE__ macros

2011-04-28 Thread Joerg Schuelke
Am Thu, 28 Apr 2011 20:09:59 +0200
schrieb Joerg Schuelke joerg.schue...@gmx.de:

No further explanation needed. Nested comments do it.
I did not know that {$define mx:= ... (*$%LINE%*)} works.

Best regards to Marco
Jörg
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel