Sign in Join

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

Mailing lists / fpc-devel / 2007-03

ptop inconsistent with defaults config file specified

5 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 saved the default settings of 'ptop' to a file using the following

ptop -g ptop.cfg

Now using that config file with the -c parameter and not specifying it at all should give me the same results, but it does! Anybody that can shed some light on this. I'm in the process of creating a Borland Object Pascal coding standards config file and came across this stumbling block.

Here is how I used the ptop application with the defaults and defaults generated config file:

1) ptop test3.pp test3_out.pp
2) ptop -c ptop.cfg test3.pp test3_out.pp

Here is the content of the test3.pp file

-------------------[ test3.pp ]--------------------------
procedure TestTryProc;
begin
try ShowMessage ('Start'); try ShowMessage ('trying');
try ShowMessage ('still trying');
finally ShowMessage ('going...'); end;
except ShowMessage ('except'); end;
finally ShowMessage ('Finally!'); end;
end;
-------------------[ end ]--------------------------

Here is the output of 1) above. Notice the difference in indentation of the try/finally and try/except blocks in 1) and 2).

----------[ no config file specified ]------------------
Procedure TestTryProc;
Begin
  Try
    ShowMessage ('Start');
    Try
      ShowMessage ('trying');
      Try
        ShowMessage ('still trying');
      Finally
        ShowMessage ('going...');
      End;
    Except
      ShowMessage ('except');
    End;
  Finally
    ShowMessage ('Finally!');
  End;
End;

------------------------[ end ]---------------

.. and here is the output of 2) above - both should have been the same.

----------[ default generated config file specified ]------------------

Procedure TestTryProc;
Begin
  Try
    ShowMessage ('Start');
    Try
      ShowMessage ('trying');
      Try
        ShowMessage ('still trying');
  Finally
    ShowMessage ('going...');
  End;
  Except
    ShowMessage ('except');
  End;
  Finally
    ShowMessage ('Finally!');
  End;
End;

------------------------[ end ]---------------

Graeme Geldenhuys There's no place like S34° 03.168' E018° 49.342'

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 37 lines
Hi, I saved the default settings of 'ptop' to a file using the following ptop -g ptop.cfg Now using that config file with the -c parameter and not specifying it at all should give me the same results, but it does! Anybody that can shed some light on this. I'm in the process of creating a Borland Object Pascal coding standards config file and came across this stumbling block. Here is how I used the ptop application with the defaults and defaults generated config file: 1) ptop test3.pp test3_out.pp 2) ptop -c ptop.cfg test3.pp test3_out.pp Here is the content of the test3.pp file -------------------[ test3.pp ]-------------------------- procedure TestTryProc; begin try ShowMessage ('Start'); try ShowMessage ('trying'); try ShowMessage ('still trying'); finally ShowMessage ('going...'); end; except ShowMessage ('except'); end; finally ShowMessage ('Finally!'); end; end; -------------------[ end ]-------------------------- Here is the output of 1) above. Notice the difference in indentation of the try/finally and try/except blocks in 1) and 2).

I don't have much time at the moment, and it has been a long time since I looked at the ptopu unit. The unit was originally intended for TP code, and try/finally/end did not exist back then. The support I added for this was a quick hack. I'm sorry to say that at the moment I don't have time to look at the config file problem, so you'll have to do some testing :/

If you mail me in private, I can try to help.

Michael.

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt

I haven't worked through the ptopu.pp unit at all, just spotted the problem in the output generated. I'll have a look during the week to see if I can find at fix the bug. Just thought it would be done faster by however is maintaining the code.

I sure do understand the time issue working on open-source projects. Mine is limited too, so no worries. If I get stuck, I'll email you in private.

Regards,
- Graeme -

Michael Van Canneyt wrote 55 lines
On Mon, 19 Mar 2007, Graeme Geldenhuys wrote: > Hi, > > I saved the default settings of 'ptop' to a file using the following > > ptop -g ptop.cfg > > Now using that config file with the -c parameter and not specifying it > at all should give me the same results, but it does! Anybody that can > shed some light on this. I'm in the process of creating a Borland > Object Pascal coding standards config file and came across this > stumbling block. > > Here is how I used the ptop application with the defaults and defaults > generated config file: > > 1) ptop test3.pp test3_out.pp > 2) ptop -c ptop.cfg test3.pp test3_out.pp > > > Here is the content of the test3.pp file > > -------------------[ test3.pp ]-------------------------- > procedure TestTryProc; > begin > > try ShowMessage ('Start'); try ShowMessage ('trying'); > try ShowMessage ('still trying'); > finally ShowMessage ('going...'); end; > except ShowMessage ('except'); end; > finally ShowMessage ('Finally!'); end; > > end; > -------------------[ end ]-------------------------- > > > Here is the output of 1) above. Notice the difference in indentation > of the try/finally and try/except blocks in 1) and 2). I don't have much time at the moment, and it has been a long time since I looked at the ptopu unit. The unit was originally intended for TP code, and try/finally/end did not exist back then. The support I added for this was a quick hack. I'm sorry to say that at the moment I don't have time to look at the config file problem, so you'll have to do some testing :/ If you mail me in private, I can try to help. Michael. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel
Graeme Geldenhuys There's no place like S34° 03.168' E018° 49.342'

Reply by email

Graeme Geldenhuys
to Michael Van Canneyt: I don't have much time at the moment, and it has been a long time since I looked at the…

Hi Michael,

I played around with the ptopu.pp unit and I believe I fixed the problem. I'll test it a bit more and if all checks out, submit a patch.

Can ptop remove spaces infront of keywords and symbols or would I have to add that feature myself? For example.

before:
    procedure MyFunc (AParam : string) ;
after:
    procedure MyFunc(AParam: string);

The space in front of the '(' and the ':' and the ';' was removed.

Regards,
- Graeme -

Michael Van Canneyt wrote 55 lines
On Mon, 19 Mar 2007, Graeme Geldenhuys wrote: > Hi, > > I saved the default settings of 'ptop' to a file using the following > > ptop -g ptop.cfg > > Now using that config file with the -c parameter and not specifying it > at all should give me the same results, but it does! Anybody that can > shed some light on this. I'm in the process of creating a Borland > Object Pascal coding standards config file and came across this > stumbling block. > > Here is how I used the ptop application with the defaults and defaults > generated config file: > > 1) ptop test3.pp test3_out.pp > 2) ptop -c ptop.cfg test3.pp test3_out.pp > > > Here is the content of the test3.pp file > > -------------------[ test3.pp ]-------------------------- > procedure TestTryProc; > begin > > try ShowMessage ('Start'); try ShowMessage ('trying'); > try ShowMessage ('still trying'); > finally ShowMessage ('going...'); end; > except ShowMessage ('except'); end; > finally ShowMessage ('Finally!'); end; > > end; > -------------------[ end ]-------------------------- > > > Here is the output of 1) above. Notice the difference in indentation > of the try/finally and try/except blocks in 1) and 2). I don't have much time at the moment, and it has been a long time since I looked at the ptopu unit. The unit was originally intended for TP code, and try/finally/end did not exist back then. The support I added for this was a quick hack. I'm sorry to say that at the moment I don't have time to look at the config file problem, so you'll have to do some testing :/ If you mail me in private, I can try to help. Michael. _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel
Graeme Geldenhuys There's no place like S34° 03.168' E018° 49.342'

Reply by email

Michael Van Canneyt
to Graeme Geldenhuys
Graeme Geldenhuys wrote 5 lines
Hi Michael, I played around with the ptopu.pp unit and I believe I fixed the problem. I'll test it a bit more and if all checks out, submit a patch.

I knew I could rely on you ;-)

Can ptop remove spaces infront of keywords and symbols or would I have to add that feature myself? For example.

You'll have to add that yourself.
ptopu can add spaces, but does not delete them.

Michael.

Reply by email