Any tool that searches include files? 
Author Message
 Any tool that searches include files?

Doing code development under Solaris, using Vim 4.5 (GREAT tool).

Is there any way I can search just the .h files #include'd in my current
file or a specified file to see which one has a particular define?

I am also using cscope, but there are over 10,000 files it searches
through when looking for a particular variable, #define, or function
prototype.

I would even settle for a command line driven tool on which the user
specifies a .c file and the variable he is looking for and then they
are listed. It would be really COOL if I could do it all in vim.

Thanks

-Andrew

----------------------------------------------------------------------
             Andrew Ward
      phone: 408 527-2773               |           |
             800.250.4800 ext 72773     |           |
 department: Core Products             |||         |||

                                  C i s c o   S y s t e m s
----------------------------------------------------------------------
personal: http://www.*-*-*.com/



Sun, 22 Aug 1999 03:00:00 GMT  
 Any tool that searches include files?

Quote:

> Doing code development under Solaris, using Vim 4.5 (GREAT tool).

> Is there any way I can search just the .h files #include'd in my current
> file or a specified file to see which one has a particular define?

> I am also using cscope, but there are over 10,000 files it searches
> through when looking for a particular variable, #define, or function
> prototype.

> I would even settle for a command line driven tool on which the user
> specifies a .c file and the variable he is looking for and then they
> are listed. It would be really COOL if I could do it all in vim.

> Thanks

> -Andrew

> ----------------------------------------------------------------------
>              Andrew Ward
>       phone: 408 527-2773               |           |
>              800.250.4800 ext 72773     |           |
>  department: Core Products             |||         |||

>                                   C i s c o   S y s t e m s
> ----------------------------------------------------------------------
> personal: http://users.aol.com/awardblvr

Under unix use the grep command to search in header files only :

grep mylabel *.h



Mon, 23 Aug 1999 03:00:00 GMT  
 Any tool that searches include files?

Quote:

> Is there any way I can search just the .h files #include'd in my current
> file or a specified file to see which one has a particular define?

I don't know vim, but two methods come to mind.

1. Most compilers can generate a list of all the file included during
   compilations. Usually it's some sort of -M switch. Many make systems
   use this info to figure out build dependencies automatically. You may
   be able to tap into this info to do what you want.

2. Use etags, tags, or some variation. These things build a database of
   where variables and functions are used and defined. Im surprized that
   cscope doesn't do this too, surely it doesn't physically search
   10,000 files for each search.

Regards,
Christopher Helck



Tue, 24 Aug 1999 03:00:00 GMT  
 Any tool that searches include files?

Quote:

> Doing code development under Solaris, using Vim 4.5 (GREAT tool).
> Is there any way I can search just the .h files #include'd in my current
> file or a specified file to see which one has a particular define?

> I am also using cscope, but there are over 10,000 files it searches
> through when looking for a particular variable, #define, or function
> prototype.

> I would even settle for a command line driven tool on which the user
> specifies a .c file and the variable he is looking for and then they
> are listed. It would be really COOL if I could do it all in vim.

Ctrl-Z to suspend vim and go to your command line;

(remember the number of VIM job)

cd /your/dir/with/include/files

find . -type f | xargs grep "what you look for"

Bring VIM to the foreground:

% <number of your VIM JOB>

AFAIK, "xargs" doesn't have limitations on the number of arguments
thus, the command find "what you look for" string even in
thousands of files. Anyway, it works for me.

--
When sending private email, please remove underscores in "vladi_mip".
#include <disclaimer.h>  |   *Good pings come in small packets*

Vancouver, B.C.     86 108 97 100 32 80 101 116 101 114 115 101 110



Tue, 24 Aug 1999 03:00:00 GMT  
 Any tool that searches include files?

Quote:


> > Doing code development under Solaris, using Vim 4.5 (GREAT tool).
> > Is there any way I can search just the .h files #include'd in my current
> > file or a specified file to see which one has a particular define?
> >[snip snip snip]
> Ctrl-Z to suspend vim and go to your command line;

> (remember the number of VIM job)

> cd /your/dir/with/include/files

> find . -type f | xargs grep "what you look for"

> Bring VIM to the foreground:

> % <number of your VIM JOB>

> AFAIK, "xargs" doesn't have limitations on the number of arguments
> thus, the command find "what you look for" string even in
> thousands of files. Anyway, it works for me.

And now reconsider and try doing it in ANSI-C  :)

BTW, that followup really caught me by surprise ;), made me think, my
'Netscape' was going bananas.

Stephan



Wed, 25 Aug 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. searching include graph tool

2. Search path for include (header) files

3. HELP!!! searching for INCLUDE-files

4. Include File Search Order

5. Include File Search Order

6. the order of searching included files

7. Need utility to search include files for string

8. CPP: How to fix include file path search

9. Changing linker search path for MFC/include/ and lib/ files

10. Include file directory search path

11. Include file directory search path

12. searching include files in MSC 6.00A

 

 
Powered by phpBB® Forum Software