Topic: C Function Show & Select (1 of 19), Read 117 times, 1 File Attachment
Conf: Program develop.,Color syntax
From: Ian Binnie
Date: Wednesday, August 27, 2003 01:18 AM

I liked Pauli Lindgren's Show and select 'C' program functions, but it did not find all my functions.

I changed the line (line 57):-
Search("|041|[|W]|[/*|M*/,/*|M*/|W]|[|L]|[|L]|[|W]|123",ERRBREAK)
to:-
Search("|041|[|W]|[/*|M*/,/*|M*/|W,//|M|L]|[|L]|[|L]|[|W]|123",ERRBREAK) //Allow C++ comment IB 27/08/03
so that C++ comments are permitted after ")"

I also added code to advance over any whitespace at start of line beginning function declaration:-


Match_paren() // Backup to beginning of function declaration
BOL
Match("|W",ADVANCE) // Advance over any whitespace at start of line IB 27/08/03

This allows the following common construct to be detected:-

public:
WORD GetElementType() // Get the element type
{ return m_Element; }

 
CFUNC1W.VDM (8KB)

 


Topic: C Function Show & Select (2 of 19), Read 75 times, 1 File Attachment
Conf: Program develop.,Color syntax
From: Ian Binnie
Date: Wednesday, August 27, 2003 10:00 PM

On 8/27/2003 1:18:52 AM, Ian Binnie wrote:
>I also added code to advance
>over any whitespace at start
>of line beginning function
>declaration:-
>
This, of course didn't work!
It found lots of while(...) inside functions, which weren't in my test code.

I modified the macro to skip function bodies.

 
CFUNC1W(1).VDM (8KB)

 


Topic: Re: C Function Show & Select (3 of 19), Read 83 times, 1 File Attachment
Conf: Program develop.,Color syntax
From: Ted Green
Date: Monday, February 23, 2004 01:25 PM

At 01:21 AM 8/27/2003, you wrote:
>From: "Ian Binnie"
>
>I liked Pauli Lindgren's Show and select 'C' program functions, but it did not find all my functions.

I finally finished merging Pauli's and Ian's improvements into the cfunc.vdm macro. It is attached.

Since two of Pauli's changes were more "personal preferences", I added two options to the macro:

#103 = 0 // Change to "1" to update edit window on Up/Down
#104 = 0 // Change to "1" to include return-type

Since the default Cursor-Up/Down no longer update the edit window, you can press Cursor-Left to force an update.

Note that now scrolls the window.

Many thank the people that have worked on this macro.
(CFUNC.VDM updated on 23-Feb-2004)

Ted.

 
CFUNC.VDM (9KB)

 


Topic: Re: C Function Show & Select (7 of 19), Read 42 times
Conf: Program develop.,Color syntax
From: Pauli Lindgren
Date: Tuesday, March 02, 2004 06:30 AM

I updated my C-TOOLS package a few days ago. See
http://koti.mbnet.fi/pkl/vedit/c_tools.htm#cfunc

It includes a new version of cfunk1w.vdm.
I have further enhanced the function recognition. It now finds functions even if there is a comment in the beginning of the same line (some people like to hide the function definition inside comments in the function header).
In addition, pre-processor commands, and spaces here and there do not cause problems.

Alt + Cursor Right/Left can be used to scroll the window right/left.

>
>#103 = 0 // Change to "1" to update edit window on Up/Down
>#104 = 0 // Change to "1" to include return-type

You can now change these settings, as well as the function list window color, using a dialog box, by using my new macro c_setup.vdm.
It calls the label SETUP in cfunc1w.vdm, which contains the actual configuration routine.

--
Pauli

 


Topic: C Function Show & Select (4 of 19), Read 54 times
Conf: Program develop.,Color syntax
From: Pauli Lindgren
Date: Friday, October 31, 2003 10:31 AM

On 8/27/2003 1:18:52 AM, Ian Binnie wrote:
>
>I changed the line (line 57):-
...
... //Allow C++ comment IB 27/08/03
>so that C++ comments are permitted after ")"

The version that was in my web site was quite an old version. I have done several improvements to the search string since then.
It now finds functions with C or C++ comment on the same line or on a separate line (between the function name and { brace). A preprocessor command is allowed, too, as well as whitespace at the end of line.

I finally managed to update my web page, so the new version is there. (There are many other new and updated macros, too.)

A handy new feature in cfunc1w.vdm is the search option. It works in similar fashion as Vedit's incremental search. Just start typing characters, and the first function that matches the string is selected. You can then use up/down keys to browse through other functions that match the string. (I found I need this feature since some of the files I work on may have up to 150 functions.)

>
>I also added code to advance over any whitespace at start
>of line beginning function declaration:-

Maybe I add this into my new version of cfunc1w.vdm.
I will update it to my web page after I have tested it.

--
Pauli

 


Topic: C Function Show & Select (5 of 19), Read 52 times
Conf: Program develop.,Color syntax
From: Ian Binnie
Date: Saturday, November 08, 2003 01:52 AM

On 10/31/2003 10:31:16 AM, Pauli Lindgren wrote:
>The version that was in my web site was
>quite an old version. I have done
>several improvements to the search
>string since then.

I downloaded your ctools zip on 2/11/2003.

This still had the old version from 2001

 


Topic: C Function Show & Select (6 of 19), Read 54 times
Conf: Program develop.,Color syntax
From: Pauli Lindgren
Date: Monday, November 10, 2003 10:18 AM

On 11/8/2003 1:52:30 AM, Ian Binnie wrote:
>
>I downloaded your ctools zip on 2/11/2003.
>
>This still had the old version from 2001

Are you sure you used the new address?
http://koti.mbnet.fi/pkl/vedit/c_tools.htm

All the Vedit related files are now in vedit sub-directory.
The old files are still in the root directory. (Maybe I should replace the pages there with re-route to the new pages.)

The current version of ctools.zip is dated Oct 24, 2003.

--
Pauli

 


Topic: C Function Show & Select (8 of 19), Read 40 times, 1 File Attachment
Conf: Program develop.,Color syntax
From: Ian Binnie
Date: Thursday, September 23, 2004 02:35 AM

On 10/31/2003 10:31:16 AM, Pauli Lindgren wrote:
>On 8/27/2003 1:18:52 AM, Ian Binnie
>wrote:
>>
>>I changed the line (line 57):-
>...
>... //Allow C++ comment IB 27/08/03
>>so that C++ comments are permitted after ")"
>
>The version that was in my web site was
>quite an old version. I have done
>several improvements to the search
>string since then.
>It now finds functions with C or C++
>comment on the same line or on a
>separate line (between the function name
>and { brace). A preprocessor command is
>allowed, too, as well as whitespace at
>the end of line.
>
>I finally managed to update my web page,
>so the new version is there. (There are
>many other new and updated macros, too.)
>
>A handy new feature in cfunc1w.vdm is
>the search option. It works in similar
>fashion as Vedit's incremental search.
>Just start typing characters, and the
>first function that matches the string
>is selected. You can then use up/down
>keys to browse through other functions
>that match the string. (I found I need
>this feature since some of the files I
>work on may have up to 150 functions.)
>
>>
>>I also added code to advance over any whitespace at start
>>of line beginning function declaration:-
>
>Maybe I add this into my new version of
>cfunc1w.vdm.
>I will update it to my web page after I
>have tested it.
>
>--
>Pauli
>

I have modified the CFUNC.VDM - Show and select 'C' program functions supplied with VEDIT (32-Bit) Ver. 6.13.1 09/07/04

My earlier change to advance over any whitespace at start of line beginning function declaration unfortunately caused if, while, for, switch, else if to be listed.

These are now skipped.


I included Pauli's "Allow comment at start of line PL 27.01.2004" and also his improvements to comment handling.

I have found some programs using a new way to confuse the macro, by including C comments on the line after ")" but before "{", and now handle this.

It also allows C++ initialisation lists after ")"


The key to this macro is the line:-
Search("|041|[|W]|[|[|L]/*|M*/|[|W],|[|L]//|M|L,|[|X]:|M|L,|L#|M|L]|[|L]|[|L]|[|W]|123",ERRBREAK) //IB 23/09/04

This is difficult to follow, so I made description to help me make the changes, which may be of interest.

Search("
|041 )
|[|W] optional space
|[ optional
|[|L] optional newline
/*|M*/ C comment
|[|W] optional space
, or
|[|L] optional newline
//|M|L c++ comment
, or
|[|X] optional extended space
:|M|L initialisation list
, or
|L
#|M|L preprocessor directive
]
|[|L] newline
|[|L]
|[|W]
|123 {
",ERRBREAK)

 
CFUNC(2).VDM (10KB)

 


Topic: Re: C Function Show & Select (9 of 19), Read 36 times
Conf: Program develop.,Color syntax
From: Ted Green
Date: Friday, December 17, 2004 12:12 AM

At 01:36 AM 9/23/2004, you wrote:
>I have modified the CFUNC.VDM - Show and select 'C' program functions supplied with VEDIT (32-Bit) Ver. 6.13.1 09/07/04
>
>My earlier change to advance over any whitespace at start of line beginning function declaration unfortunately caused if, while, for, switch, else if to be listed.
>
>These are now skipped....

Ian:

Thank you. I will add you new macro to the distribution files.

Ted.

 


Topic: C Function Show & Select (10 of 19), Read 18 times, 2 File Attachments
Conf: Program develop.,Color syntax
From: Pauli Lindgren
Date: Tuesday, January 15, 2008 06:58 AM

Here is a new version of CFUNC.VDM.
Some of the enhancements have already been in cfunc1w.vdm included in my C tools package, some are new.

Differences to cfunc.vdm on Vedit 6.15.1:

- Incremental search. If you have many functions, it may be difficult to find the one you are looking for.
Now you can just type any string that can be found in the function name or parameters to find the function.
The cursor is moved to first function that matches this string. Type more characters to narrow the search.
Then use cursor down/up keys to jump between other functions that match the string.

A new feature in this version (compared to cfunc1w.vdm) is that syntax highlighting is used to highlight the matching functions. Functions that do not match are changed to comment color (which probably has different background color, too).
Needs file cfunc.syn (included).

- Dialog box for setting configuration values opens by pressing F2.
In addition, the setup dialog can be called externally by calling label SETUP.
In my earlier version, this changed cfunc1w.vdm directly, but this is somewhat dangerous, and it changes the file date, too.
Therefore I have now changed it to save the settings in file cfunc.ini (in USER_MAC directory).

- Pattern for finding function definitions improved: use |X instead of |W and |L (allows multiple empty lines etc.)

- Scroll right/left using alt+right, alt+left

- If "show return type" is set off, hides keywords "static" and "inline", too.

- If Match_Paren fails (e.g. due to braces in comments), uses search to find "}"

- You can now exit Cfunc by pressing F12 (in addition to Esc). This is handy if you have configured F12 to start Cfunc.

- Online help using Html Help. Press F1 to open the help window. The help file cfunc.chm is enclosed.

For some reason, cfunc.chm is 12k, even though the original HTML file is only 4k. I guess chm format is not very well suited for small help files.

The HTML source files for cfunc help are included in cfunc_help.zip.

--
Pauli

 
CFUNC_HELP.ZIP (2KB)
 
CFUNC20.ZIP (9KB)

 


Topic: Re: C Function Show & Select (11 of 19), Read 13 times
Conf: Program develop.,Color syntax
From: Ted Green
Date: Wednesday, January 16, 2008 09:28 AM

At 07:13 AM 1/15/2008, you wrote:
>From: "Pauli Lindgren"
>
>Here is a new version of CFUNC.VDM.

Wow, another great macro.
I will include this in the 6.16, not the 6.15.2 I need to finish ASAP.

Ted.

 


Topic: Re: C Function Show & Select (12 of 19), Read 17 times, 2 File Attachments
Conf: Program develop.,Color syntax
From: Pauli Lindgren
Date: Wednesday, February 20, 2008 04:36 AM

Here is a new version of CFUNC.VDM, V2.1

Changes from V2.0:

- Added configuration option "Show parameters". When this option is deselected, the function parameters in the list are not displayed, only ().
This makes function list cleaner and it may be easier to locate a function.

- Added configuration option "Window width". With this you can adjust the width of function list window as percents of the maximum window width.
The width of cfunc window depends on the width of Vedit application window, but 20 columns is added to % value so that the window will not become too narrow on small Vedit window.

- Fixed "Show return type": now correctly skips multi-word type specifiers and any '*'.
Actually it does not skip the return type, but instead just finds the beginning of function name by searching backwards from '('.

- When return from setup, now restores original function position in the list and resets search string

- Setup hotkey changed from F2 to F11. This is more consistent with normal keyboard layout, and F11 is conveniently next to F12 which is the recommended key for running cfunc.vdm.

- Added Help button in setup dialog.

- When skipping non-alphanumeric names and if's etc, find matching '}', i.e. skip the whole block.
(On the other hand, skipping if's etc. would probably be no more necessary since the function search seems to work quite well.)

- Help has been updated.

The attached cfunc21.zip contains new cfunc.vdm, new cfunc.chm, and cfunc.syn (not changed).

The HTML source files for cfunc help are included in cfunc_help21.zip.

--
Pauli

 
CFUNC_HELP21.ZIP (2KB)
 
CFUNC21.ZIP (10KB)

 


Topic: Re: C Function Show & Select (13 of 19), Read 14 times
Conf: Program develop.,Color syntax
From: Ian Binnie
Date: Wednesday, February 20, 2008 10:49 PM

On 2/20/2008 4:36:01 AM, Pauli Lindgren wrote:
>Here is a new version of
>CFUNC.VDM, V2.1
>
>Changes from V2.0:
>
>- Added configuration option
>"Show parameters". When this
>option is deselected, the
>function parameters in the
>list are not displayed, only
>().
>This makes function list
>cleaner and it may be easier
>to locate a function.

I modified cfunc.syn to show parameters as comments, which achieves the same, but also shows parameters.
These can be important in c++ polymorphic functions.

// CFUNC.SYN
// VEDIT color syntax highlighting definition for CFUNC.VDM macro

Comment = (, )
Linecmt = |<;




PS requiring the help & syn files to be in vedit\user-mac\ seems a little strange. It isn't even documented, you have to study the macro to find this.

 


Topic: Re: C Function Show & Select (14 of 19), Read 18 times
Conf: Program develop.,Color syntax
From: Pauli Lindgren
Date: Monday, February 25, 2008 11:19 AM

On 2/20/2008 10:49:29 PM, Ian Binnie wrote:
>
> I modified cfunc.syn to show parameters
> as comments, which achieves the same,
> but also shows parameters.
> These can be important in c++
> polymorphic functions.
>
> // CFUNC.SYN
> // VEDIT color syntax highlighting definition for CFUNC.VDM macro
>
> Comment = (, )
> Linecmt = |<;

I was originally thinking of that, too. However, it is very ugly looking since the background color changes.
If only the syntax colors were buffer specific, like the window colors are. Then we could use suitable syntax highlight in function list and other similar macros.

Your comment color does not work. In case of multi line function definitions (parameters on multiple lines), there is only the opening parenthesis in the list, and then the rest of the window is colored in comment color. You get better results by using line comment:

Linecmt = |<;,(

But that is still quite ugly.

>
>
> PS requiring the help & syn files to be
> in vedit\user-mac\ seems a little
> strange. It isn't even documented, you
> have to study the macro to find this.

Why? The macro itself is in user-mac directory, so it is logical that all the support files are there, too. And this way you do not need to copy the files anywhere after unzipping.

If this version of cfunc.vdm is included with Vedit, it would be in macros directory, so the location of the support files need to be changed. When the new directories for help, syntax files etc. will be taken into use, then the files have to be moved to corresponding directories.

--
Pauli

 


Topic: Re: C Function Show & Select (15 of 19), Read 17 times
Conf: Program develop.,Color syntax
From: Ian Binnie
Date: Monday, February 25, 2008 09:38 PM

On 2/25/2008 11:19:05 AM, Pauli Lindgren wrote:
>On 2/20/2008 10:49:29 PM, Ian Binnie
>wrote:
>> PS requiring the help & syn files to be
>> in vedit\user-mac\ seems a little
>> strange. It isn't even documented, you
>> have to study the macro to find this.
>
>Why? The macro itself is in user-mac
>directory, so it is logical that all the
>support files are there, too. And this
>way you do not need to copy the files
>anywhere after unzipping.

I replaced the Vedit version.
This seemed the natural thing to do, as I want to continue to use my existing menus.

Again, the documentation doesn't mention the need to put in user-mac.

PS The current macro has one very annoying feature.

I quite often copy/cut a block of code to the scratchpad to copy/move in a file.

If I use cfunc to navigate to a function, it seems to empty the scratchpad.

This is annoying on a copy, a bit more for a cut.

I haven't been able to find why, presumably one of the Reg_Empty calls.

 


Topic: Re: C Function Show & Select (16 of 19), Read 15 times
Conf: Program develop.,Color syntax
From: Pauli Lindgren
Date: Tuesday, February 26, 2008 07:46 AM

On 2/25/2008 9:38:07 PM, Ian Binnie wrote:
>
> I replaced the Vedit version.
> This seemed the natural thing to do, as
> I want to continue to use my existing menus.

You can put it in user-mac directory. The existing menu commands should work. Any macro put in user-mac directory overrides the one in macros directory.

Call_File() searches for a macro first from current dir, then from user-mac dir, then from macros dir and finally from Vedit home directory.

But maybe the help and syn files could be changed to be located at Vedit home directory for now (since we do not have the the new directories yet). But where should the .ini file be put?

>
> If I use cfunc to navigate to a function,
> it seems to empty the scratchpad.
>
> I haven't been able to find why,
> presumably one of the Reg_Empty calls.

The problem seems to be caused by the macro loadsyn.vdm.
It uses T-reg 0 and then empties it. It would be possible to save t-reg 0 contents in cfunc.vdm, but I think it is better to fix loadsyn.vdm.

--
Pauli

 


Topic: Re: C Function Show & Select (17 of 19), Read 17 times
Conf: Program develop.,Color syntax
From: Ted Green
Date: Tuesday, February 26, 2008 10:38 AM

At 07:47 AM 2/26/2008, you wrote:
>The problem seems to be caused by the macro loadsyn.vdm.
>It uses T-reg 0 and then empties it. It would be possible to save t-reg 0 contents in cfunc.vdm, but I think it is better to fix loadsyn.vdm.

Correct. I will fix loadsyn.vdm.
You can try adding Reg_Push(0,0) after the existing Num_Push(0,10) at the beginning.
... and adding Reg_Pop(0,0) before the existing Num_Pop(0,10) at the end.

Ted.

 


Topic: Re: C Function Show & Select (18 of 19), Read 15 times, 1 File Attachment
Conf: Program develop.,Color syntax
From: Pauli Lindgren
Date: Friday, April 04, 2008 06:36 AM

Here is CFUNC.VDM 2.2. It contains just a few small changes.

The problem with scrollbars appearing has now been fixed.
I earlier thought that it is enough to create the window with MINBORDER option. I now realized that scrollbar setting is buffer specific, not window specific.
Added command Config(WIN_BRD,1,LOCAL), and now the scrollbars stay away.

Fixed function list display when parameter display is off and the parenthesis '(' is on the next line.

Now moved the location of help file (cfunc.chm) to Vedit home directory, so you need to move it there.
Cfunc.syn may be either in USER_MACRO or HOME directory.
The cfunc.ini file is still stored in USER_MACRO directory.
I guess this is OK until the new directories are taken into use.

--
Pauli

 
Cfunc.vdm 2.2

 


Topic: Re: C Function Show & Select (19 of 19), Read 13 times, 1 File Attachment
Conf: Program develop.,Color syntax
From: Pauli Lindgren
Date: Thursday, May 29, 2008 10:44 AM

Here is CFUNC.VDM 2.3. It contains just a couple of bug fixes.

- The scrollbar setting was not buffer specific after all, but global. It caused scrollbars to disappear in edit windows, too.
So I added commands to restore original scroll bar setting on exit.

- Function position array was corrupted after return from setup dialog.

The enclosed zip file contains only cfunc.vdm, the help file has not been changed.

--
Pauli

 
Cfunc 2.3