Topic: Search for include files - SEARCH_INC.VDM (1 of 3), Read 24 times
Conf: VEDIT Macro Library
From: Pauli Lindgren
Date: Monday, August 28, 2006 07:27 AM

First some background.

I work in projects where there are several hundreds of .c and .h files divided in dozens of directories. Therefore it is very difficult to find a specific .h file. I used to use Windows search function. But it is very complex and slow to use. And if there are multiple files with the same name, it is difficult to decide which one is the correct one.

That is why I developed SEARC_INC.VDM.

Now I only need to put the cursor on the line that contains the #include directive and hit Ctrl-F12 to call the macro, and the correct include file is immediately opened!

Search_inc.vdm searches for the include file from directories listed in a file include.lst. (You can probably copy the list directly from your compiler command file or makefile.)

If the filename is enclosed in arrow braces <>, only directories listed in include.lst are searched. If the filename is enclosed in "", source file's directory is first searched, then dirs listed in include.lst.

If you list the include directories in the same order as in your compiler settings, Vedit will find exactly the same file as what compiler would use, even if there are multiple files with the same name.

If the file is not found using the search algorithm above, a dialog box opens. This allows you to edit the filename and then re-run the search. Or, you can select [Browse] to manually search for the file using file open dialog box.

Put include.lst file in the root of your projects directory tree, and it will be found where ever you are in the directory tree.

Since Vedit does not have a setting for "project home directory", I had to create a special search algorithm. The macro searches for include.lst file first from the directory of the currently edited file. If not found, it is then searched from parent directories (upwards in the directory tree) until the file is found or root is reached.

I have now included the macro in my C-TOOLS package ctools22.zip which I just updated on my web page:
http://koti.mbnet.fi/pkl/vedit/c_tools.htm

For more detailed description of the macro, see the file c_tools.txt, included in the .zip file.

Note: many other macros in the package have been updated, too. (I had actually upgraded some of the macros long time ago, but had not updated my web page until now.)

--
Pauli

 


Topic: Re: Search for include files - SEARCH_INC.VDM (2 of 3), Read 18 times
Conf: VEDIT Macro Library
From: Ted Green
Date: Monday, August 28, 2006 12:28 PM

At 07:27 AM 8/28/2006, you wrote:
>That is why I developed SEARC_INC.VDM...

Pauli:

Thank you for another useful macro!

I will get the "Project Home directory" implemented soon.

Ted.

 


Topic: Re: Search for include files - SEARCH_INC.VDM (3 of 3), Read 16 times
Conf: VEDIT Macro Library
From: Pauli Lindgren
Date: Friday, December 15, 2006 10:44 AM

New version of SEARCH_INC.VDM is now available (in the C Tools package) at my web page:
http://koti.mbnet.fi/pkl/

It now displays dialog box if filename is not found on current line or if INCLUDE.LST not found etc.

I added "What's New" page on my web site so that you can more easily see what has been updated.

--
Pauli