CnPack Forum


 
Subject: %ArgList% and %Arguments% don't work with current procedure
harghh
新警察
Rank: 1



UID 41212
Digest Posts 0
Credits 6
Posts 2
点点分 6
Reading Access 10
Registered 2008-11-7
Status Offline
Post at 2008-11-7 06:28  Profile | Blog | P.M. 
%ArgList% and %Arguments% don't work with current procedure

Hi!

When I try to insert one of these macros while the cursor is INTO a procedure the parameters of the NEXT procedure are used. This is not a big problem, but annoying.

Example:

procedure TMyClass.Remove(const AID: Integer);
begin
  // using %ArgList% or %Arguments% here result in "Value" parameter
end;

procedure TMyClass.SetMode(const Value: Integer);
begin
  // ....
end;

Also it would be great if another macro exists (%CurrMethodName% ?) which is only the name of the method, without the name of the class. Ie 'SetMode' instead of 'TMyClass.SetMode'.

Thank you for your wonderful tools!

Harghh
Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2008-11-7 23:40  Profile | Blog | P.M. 
The %ArgList% and %Arguments% means NEXT procedure's ones. We should add %CurrArgList% and %CurrArguments% to the macros, but it's not so easy due to our design limitation.

But we can add a %CurrMethodName% quickly for a method name without a classname.

The coming 0.8.9.459 nightly build version will contain this enhancement.

http://www.cnpack.org/downbuilds.php
Top
harghh
新警察
Rank: 1



UID 41212
Digest Posts 0
Credits 6
Posts 2
点点分 6
Reading Access 10
Registered 2008-11-7
Status Offline
Post at 2008-11-8 21:28  Profile | Blog | P.M. 
Thank you for your reply and for adding %CurrMethodName%!

By curiosity, what make it difficult to implements %CurrArgList% and %CurrArguments%?
I would eventualy want to modify CnPack myself to add them but I need to understand how it work first.

Also, is there a workaround for "simulating" %CurrArgList% and %CurrArguments%?
For example a shorcut which will jump from the body of the procedure to BEFORE the procecure, use %CurrArgList%, and move generated text to the body of the procedure?
It may be something doable with Pascal Script.
What do you think?
Top
Passion (LiuXiao)
管理员
Rank: 9Rank: 9Rank: 9


UID 359
Digest Posts 19
Credits 6838
Posts 3591
点点分 6838
Reading Access 102
Registered 2004-3-28
Status Offline
Post at 2008-11-11 20:05  Profile | Blog | P.M. 
We use mwPasLex to parse the pascal code. But it's not implemented or wrapped in Pascal Script due to Pascal Script's grammar limitation. So now in Pascal Script we can't parse the code as needed. We can only call some wrapped function in CnWizards.
Top
 




All times are GMT++8, the time now is 2024-12-4 16:59

    本论坛支付平台由支付宝提供
携手打造安全诚信的交易社区 Powered by Discuz! 5.0.0  © 2001-2006 Comsenz Inc.
Processed in 0.007684 second(s), 7 queries , Gzip enabled

Clear Cookies - Contact Us - CnPack Website - Archiver - WAP