Sign in Join

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

Mailing lists / lazarus / 2021-09

git diff enhancement

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Martin Frb

In order for git to show pascal function headers.

Add the following to your config

[diff "fpc"]
  xfuncname = "^(((class[
\\t]+)?(procedure|function)|constructor|destructor|[ \\t].*[ \\t]*=[ \\t]*(class|interface|object|record)|initialization|finalization)[ \\t]*.*)$"

then create a file
    lazarus\.git\info\attributes
and add the following

*.pas diff=fpc
*.pp diff=fpc
*.lpr diff=fpc
*.inc diff=fpc

Diffs then look like (note the @@ line has the "function" header)

 components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas | 9 ++++++++-  1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas index ea4fbee06a..8fd79d673d 100644
--- a/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas +++ b/components/lazdebuggers/lazdebuggerfp/fpdebugdebugger.pas @@ -1745,7 +1745,8 @@ function TFPDBGDisassembler.PrepareEntries(AnAddr: TDbgPtr; ALinesBefore, ALines
   p: pointer;
   ADump,
   AStatement,
-  ASrcFileName: string;
+  ASrcFileName,
+  AFuncName: string;
   ASrcFileLine: integer;
   i,j, sz, bytesDisassembled, bufOffset: Integer;    Sym: TFpSymbol;

Reply by email

Marco van de Voort
to Martin Frb

Op 14-9-2021 om 17:17 schreef Martin Frb via lazarus:

Show quoted text 7 lines
In order for git to show pascal function headers. Add the following to your config [diff "fpc"]   xfuncname = "^(((class[ \\t]+)?(procedure|function)|constructor|destructor|[ \\t].*[ \\t]*=[

operator?

Reply by email

Martin Frb
to Marco van de Voort
Marco van de Voort wrote 12 lines
Op 14-9-2021 om 17:17 schreef Martin Frb via lazarus: > In order for git to show pascal function headers. > > Add the following to your config > > [diff "fpc"] >   xfuncname = "^(((class[ > \\t]+)?(procedure|function)|constructor|destructor|[ \\t].*[ \\t]*=[ operator?

Yes, and you can also allow spaces at the begin of the line.

I did not, to try and get the outer procedure always. Because otherwise it finds nested procs, even if you are in the main body.

Reply by email

Marco van de Voort
to Martin Frb

Op 14-9-2021 om 17:55 schreef Martin Frb via lazarus:

Show quoted text 19 lines
On 14/09/2021 17:49, Marco van de Voort via lazarus wrote: > > Op 14-9-2021 om 17:17 schreef Martin Frb via lazarus: >> In order for git to show pascal function headers. >> >> Add the following to your config >> >> [diff "fpc"] >>   xfuncname = "^(((class[ >> \\t]+)?(procedure|function)|constructor|destructor|[ \\t].*[ \\t]*=[ > > operator? > Yes, and you can also allow spaces at the begin of the line. I did not, to try and get the outer procedure always. Because otherwise it finds nested procs, even if you are in the main body.

I meant "class operator" is also a method like declaration

Reply by email

Martin Frb
to Marco van de Voort
Marco van de Voort wrote 24 lines
Op 14-9-2021 om 17:55 schreef Martin Frb via lazarus: > On 14/09/2021 17:49, Marco van de Voort via lazarus wrote: >> >> Op 14-9-2021 om 17:17 schreef Martin Frb via lazarus: >>> In order for git to show pascal function headers. >>> >>> Add the following to your config >>> >>> [diff "fpc"] >>>   xfuncname = "^(((class[ >>> \\t]+)?(procedure|function)|constructor|destructor|[ \\t].*[ \\t]*=[ >> >> operator? >> > > Yes, and you can also allow spaces at the begin of the line. > > I did not, to try and get the outer procedure always. Because > otherwise it finds nested procs, even if you are in the main body. > I meant "class operator" is also a method like declaration

yes,
When I wrote "Yes, and you can also allow spaces at the begin of the line."

The "yes" applied to "operator may be included too". And then I went on and talked about something else.
I do see, how this does not come across, if you don't have inside info from inside my head.

Reply by email