Please give more precise information. If both ctags and cscope
are giving you trouble, I suggest dealing with one first to
avoid confusion. What command do you enter?
Does "this one KO" mean you got an error message? What? Or it
didn't work in some way? What?
Your examples do not include a directory with spaces. I don't
think I've ever used such a thing with ctags or cscope so I
don't know about that. However, if there is such a problem, you
should be able to make a simple test case with just a couple of
short files.
John
>Is anybody knows if it's a bug ? I have tried without success to
>install cecscope vimscript, is anybody knows the better script to
>interface cscope to vim ?
>
>
What o/s are you using? First I've heard of any problems with cecscope!
Regards,
Chip Campbell
> After parsing my code , this one is very slow to find pattern such as
> "return". In fact it does not respond
What "this one" are you talking about?
> Is anybody knows if it's a bug ? I have tried without success to
> install cecscope vimscript, is anybody knows the better script to
> interface cscope to vim ?
Dr Chips' CECscope works fine here - except, of course, :CSR
- he should generalize that one by replacing "*.[ch]" to
"*.c *.h".
I assume you've read the help in "if_cscop.txt: and added the
code in "cscope-suggestions" to your vimrc.
--
Best regards,
Bill
> Dr Chips' CECscope works fine here - except, of course, :CSR
> - he should generalize that one by replacing "*.[ch]" to
> "*.c *.h".
How is "*.c *.h" more general than "*.[ch]"?
Regards,
Gary
In native windows shells, *.[ch] is passed, as is to cscope
- which doesn't properly deal with it, it thinks *.[ch] is a
file which it cannot find. "*c *.h" should work in both
Windows and 'nix environments.
--
Best regards,
Bill
OK, now I understand. Thanks for the explanation.
Regards,
Gary
I'll include this... Thanks! See v3d of cecscope from my website:
http://mysite.verizon.net/astronaut/vim/index.html#CECSCOPE
Chip Campbell
I don't know what you would send to have someone else test it. As
John suggested initially, I think you should construct a small test
case on your system that demonstrates the problem. Then report back
here with exactly how the directories of the test case are
structured, how you constructed the cscope database, what cscope
commands you execute that appear not to work, and what the results
of those commands are, including the exact text of any error
messages. With that information, perhaps someone here can verify
the problem and discover its cause. Otherwise, we're all just
guessing at what the problem might be.
I use cscope on Unix but not on Windows, so I won't be of much help.
Regards,
Gary
>Vimball Archive
>extracted <plugin/cecscope.vim>: 311 lines
>Erreur détectée en traitant function vimball#Vimball :
>ligne 115 :
>"C:\Program\ Files\Vim\vimfiles\plugin\cecscope.vim" E212: Impossible
>d'ouvrir le fichier pour y écri
>re
>wrote C:\Program\\ Files\Vim\vimfiles\plugin\cecscope.vim
>extracted <doc/cecscope.txt>: 134 lines
>"C:\Program\ Files\Vim\vimfiles\doc\cecscope.txt" E212: Impossible
>d'ouvrir le fichier pour y écrire
>wrote C:\Program\\ Files\Vim\vimfiles\doc\cecscope.txt
>ligne 142 :
>E150: C:\Program\ Files\Vim\vimfiles\doc n'est pas un répertoire
>did helptags
>Appuyez sur ENTRÉE ou tapez une commande pour continuer
>
>
I'm afraid that my French isn't nearly as good as your English --- but
the above looks like a problem that vimball is having dealing with M$'s
spaces-in-filenames fetish, not with cecscope.vim itself. I'll look
into it.
Regards,
Chip Campbell
That seems right, Chip. The relevant parts of the French translate as "Can't open
the file for writing" and "is not a directory" which would point to this.
Ben.
Send instant messages to your online friends http://au.messenger.yahoo.com
i.e., "Cannot open the file for writing to it"
>
>
>
> Meanwhile Charles is looking on that, I would like to talk again about
> ctags.
> Ctags now works well but I would like to know if I can use Ctags (the
> tags file in fact) in place of a vimgrep to know all sources affected
> by a keyword tagged ?
>
> Thanks
> epanda
It may depend on circumstances, and especially on what you want to search for
and on how often the sources are modified.
Vimgrep has the advantage that you don't need a preconstructed tagfile: a Vim
pattern and a "where to search" filepathname (with wildcards) are enough.
Therefore Vimgrep doesn't "get out of date" if the searched files are
modified: indeed, every use of vimgrep reconstructs the required quickfix
results file. (I'm not calling it a "quickfix errorfile" here, but only
because vimgrep results are not really "errors".)
Ctags has the advantage that it has better knowledge of the searched files'
source syntax, and allows you to get to "where the symbol is defined" without
stopping at every place "where the symbol is used".
FYI, with the Vim sources themselves, you can "make tags" (at least on
Unix-like systems, using the top-level Makefile) to generate a tags file for
the Vim sources. You can then use the tag-navigation facility contained in
your version of Vim or gvim in order to browse its own sources.
Best regards,
Tony.
--
Noncombatant, n.:
A dead Quaker.
-- Ambrose Bierce
P.S. What concerns "what you're looking for", using ctags or vimgrep is
approximately parallel to searching the Vim help with ":help <name>" (which
requires a preexisting tags file, and brings you where the help tag is
defined) or with ":helpgrep pattern" (which finds every match for /pattern/ in
the help text) respectively.
Best regards,
Tony.
--
Support wildlife -- vote for an orgy.
Many of the tags commands are commonly used with the Vim help: e.g.,
double-click or Ctrl-] to go to the definition of the keyword under the
cursor; Ctrl-T (synonym of Ctrl-MouseRight, but I don't like operations which
require using both the keyboard with one hand and the mouse with the other); etc.
See
:help 29.1 (introduction)
:help tagsrch.txt (full details)
and, by the way, "learn" and "teach" are not synonymous in English, even
though they both correspond to the French word "apprendre" ;-) (unlike "to
learn", "to teach" can also be translated as "enseigner"). It's only in very
"unacademical" English that "I'll larn ya" can be used for "Je vais
t'apprendre, moi!". (Me too, I'm a native French-speaker, and I know how
difficult it is for a French-speaker to learn never to use "learn" when
"teach" is meant: for some people, it requires constant attention.)
Best regards,
Tony.
--
hundred-and-one symptoms of being an internet addict:
145. You e-mail your boss, informing him you'll be late.
>NB: Cscope : I am waiting for Charles...
>
>
Currently, as in "as time is available", I'm trying to knock off a netrw
bug. Vimball is next...
Regards,
Chip Campbell
> and, by the way, "learn" and "teach" are not synonymous...
> It's only in very "unacademical" English...
"unacademical American" I would've said. Huckleberry Finn, or the
bumpkin in cowboy movies springs to mind. I never heard the usage in
even the broadest local dialects (that I could understand) in England.
My dictionary gives it as archaic or slang. I wonder if an
"American" or "Ebonics" speaker can tell us if it's current in the
U.S.?
Sorry, curiosity got the better of me, John
It is used currently in the U.S., but only by those with a
substandard education.
Regards,
Gary
>>"unacademical American" I would've said. Huckleberry Finn, or the
>>bumpkin in cowboy movies springs to mind. I never heard the usage in
>>even the broadest local dialects (that I could understand) in England.
>>My dictionary gives it as archaic or slang. I wonder if an
>>"American" or "Ebonics" speaker can tell us if it's current in the
>>U.S.?
>It is used currently in the U.S., but only by those with a
>substandard education.
And by people who "conversate" with each other... and then get
"fustrated" and feel "vunerable" when someone objects to that usage.
And those who wear "jewlery".
And who fear "nuculer" energy.
And those who use "ATM machines" and punch in their "PIN numbers".
I can go on... >:D
please don't -- it's like hearing fingernails on a chalkboard
(dear lord our own president is PROUD of our nuculer energy
and the way he mis-pronounces it)
sc
Sorry if I disturb the audience and sorry for my poor english language
but my problems were about browsing efficiently my source code.
vimgrep is slower than Visual Studio grep
cscope does not work very well
I am trying ctags.
Thanks
If you want to have ctags generate tags for only files of a
particular language, I believe the option you want is "--languages"
and not "--langmap", e.g.,
ctags --languages=C++ -R .
The "--langmap" option is used to tell ctags what languages are
associated with file names that it doesn't already understand.
HTH,
Gary
> On 1 déc, 18:12, epanda <callingel...@hotmail.fr> wrote:
> > When I do a simple grep text with cscope it does not found string
> > "WriteFile" and says File does not have expected format !
> >
> > The string is in this sample source wich is here D:
> > \Dev_PC_DEV1\communs_he\SRC\utilitaires\RTX
> >
> > //##ModelId=393CB8FA0240
> > const int RtFile::write(char buffer_p[],long taille_p)
> > {
> > bool retour_l=false;
> > DWORD number_l = 0;
> > if (hFile!=0)
> > {
> > int retourBOOL;
> > //on prend la taille du buffer plus 1 à cause du \0
> >
> > retourBOOL=WriteFile(hFile,buffer_p,taille_p,&number_l,NULL);
> > retour_l=(retourBOOL==1?true:false);
> > }
> > else
> > {
> > retour_l=false;
> > }
> > return retour_l;
> >
> > }
> >
> > On 1 déc, 17:50, epanda <callingel...@hotmail.fr> wrote:
> >
> > > cscope does not detect a class method like this :
> >
> > > //##ModelId=3A7EBA7200F5
> > > void DailyLogFile::handleEntry(WORD ref_p, void* value_p)
> > > {
> ok cscope does not work with C++ code
I don't think that's true. I copied both your examples to a couple
of files in a temporary directory and ran cscope on them. Using
:cs find t WriteFile
to find WriteFile worked just fine as did using
:cs find g handleEntry
to find the definition of handleEntry. I also use cscope daily in
my work with C and C++, and while it seems to occasionally miss some
items (I haven't kept careful track of them), it generally works
well.
Granted, this was using cscope on Unix, but I think it demonstrates
that cscope itself works with C++. It appears from your experience
that there may be problems with it on Windows or with your
particular installation or usage.
Regards,
Gary
> When I do a simple grep text with cscope it does not found string
> "WriteFile" and says File does not have expected format !
>
> The string is in this sample source wich is here D:
> \Dev_PC_DEV1\communs_he\SRC\utilitaires\RTX
>
> //##ModelId=393CB8FA0240
> const int RtFile::write(char buffer_p[],long taille_p)
> {
> bool retour_l=false;
> DWORD number_l = 0;
> if (hFile!=0)
> {
> int retourBOOL;
> //on prend la taille du buffer plus 1 à cause du \0
>
> retourBOOL=WriteFile(hFile,buffer_p,taille_p,&number_l,NULL);
> retour_l=(retourBOOL==1?true:false);
> }
> else
> {
> retour_l=false;
> }
> return retour_l;
>
> }
I used your snippet with cscope without a problem. I called
the snippet prog.cpp and set up with "cscope -b prog.cpp".
To find WriteFile:
:cs find e WriteFile
brought me to the correct line.
:cs find s retour_l
showed me all four in a quickfix window.
:cs find g write
Put me on the "const int RtFile::write" line.
In my vimrc, I have the following (only the "set
csprg=c:/util/cscope" needs to be changed):
" Cscope
if has("cscope")
set csprg=c:/util/cscope
set csto=0
set cst
set nocsverb
" add any database in current directory
if filereadable("cscope.out")
cs add cscope.out
" else add database pointed to by environment
elseif $CSCOPE_DB != ""
cs add $CSCOPE_DB
endif
set csverb
endif
set cscopequickfix=s-,c-,d-,i-,t-,e-
nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>
--
Best regards,
Bill
> Ok I don't understand. After using this command ,
> cscope -b -R, the cscope.out file does not contain writefile.
That wouldn't store anything here with *.cpp files. I would
have to write: cscope -b -R *.cpp *.h
BTW, I write no C++ - mainly C. From the vim71/src
directory, typing "cscope -b" produces the same result as
typing "cscope -b *.c *.h". It takes a few seconds to build
the first time, but after adding patches 165 and 166 today,
it built nearly instantly - it uses the current cscope.out
to update with the latest changes.
> Is it a normal thnig ?
Yes it is normal. By default, cscope stores a compressed
file. If you really feel the need to read it, try:
cscope -b -c -R *.cpp *.h
or whatever you call your c++ compilation units.
> my version of cscope is cscope: version 16.0a
So is mine. BTW, I'm running on WinXP and building using
MinGW - the native Gnu C for windows.
> I have tried in another directory F:\utilities\*.cpp and it does not
> store WriteFile
Assuming you tell it to store cpp files, it should be
storing a representation of WriteFile.
--
Best regards,
Bill
I'm guessing that you see an error like "no source files".
What works is to make a file called cscope.files where each line contains
the path of one of your source files. When I last did this on Windows, I
used a script to generate that file (on Unix you would use 'find').
The simplest would be for you to manually create a file named "cscope.files"
containing lines like:
sample/first.cpp
sample/second.cpp
sample/first.h
sample/second.h
The forward slash works under Windows. This assumes you are going to run
cscope in a directory where 'sample' is a subdirectory, and 'first.cpp' is
one of your source files in that subdirectory.
Then, build the cscope database like this (run this in the directory
containing sample):
cscope -b -c
I think you can add -q for an inverted index providing you have certain
tools. If you don't have the tools that cscope wants, the database built
with -q will not find anything.
John
> epanda wrote:
>> second one : in a parent directory , the following command fails :
>> cscope -b -c -R *.cpp *.h
> I'm guessing that you see an error like "no source files".
I saw no such strangeness in Windows using C. For example,
from vim71\src:
del cscope.out
cscope -b -R
gvim
:cs find s etoa64
This finds etoa64 in vim71\src\xxd\xxd.c
HOWEVER, if instead I wrote:
del cscope.out
cscope -b -R *.c *.h
cscope failed to recurse the directories. It behaves like
many broken unix ports to windows - like grep. When you
specify recursion in grep, and maybe cscope too, it only
recurses into directories that match the patterns. A proper
windows app will recurse into all directories looking for
pattern matches of files in those directories.
--
Best regards,
Bill
FWIW, I would call that behaviour broken. If I give recursion on the commandline
and specify a pattern or folder on the commandline, I expect just the matches to
be recursed, not everything in the directory.
It wouldn't surprise me to find this is standard Windows behaviour though, as
Windows is generally broken...
> Bill McCarthy wrote:
>> HOWEVER, if instead I wrote:
>>
>> del cscope.out
>> cscope -b -R *.c *.h
>>
>> cscope failed to recurse the directories. It behaves like
>> many broken unix ports to windows - like grep. When you
>> specify recursion in grep, and maybe cscope too, it only
>> recurses into directories that match the patterns. A proper
>> windows app will recurse into all directories looking for
>> pattern matches of files in those directories.
>
> FWIW, I would call that behaviour broken. If I give
> recursion on the commandline
> and specify a pattern or folder on the commandline, I expect just the matches to
> be recursed, not everything in the directory.
I suppose it depends on how you set up projects. I might
use a structure like:
project_a
functions_x
functions_y
where I keep my .c and .h files within there respective
directories. You might use:
project_a.c
functions_x.c
functions_y.c
project_a.h
functions_x.h
functiion_y.h
In that case using cscope or grep recursion will work fine
for you but not so well for me.
> It wouldn't surprise me to find this is standard Windows behaviour though, as
> Windows is generally broken...
Not standard windows behavior, but the typical behavior of
most windows utilities. I'm generally interested in finding
file patterns in a directory and its subdirectories - not
only in those subdirectories that match my file pattern.
IMHO, that's what most people want. I rarely need to search
for a file, say 'foo', in only directories also named 'foo'
- but if I did, I could do that with a little effort.
With the "unbroken" method you seem to like, it is very easy
to find 'foo' in 'foo' directories, but more work to just
find all 'foo' in the current tree. That's poor design.
--
Best regards,
Bill
I believe the behavior of cscope and grep are correct on both
Windows and Unix and that the ports are not broken.
> > It wouldn't surprise me to find this is standard Windows
> > behaviour though, as Windows is generally broken...
>
> Not standard windows behavior, but the typical behavior of
> most windows utilities. I'm generally interested in finding
> file patterns in a directory and its subdirectories - not
> only in those subdirectories that match my file pattern.
If you want to search all the .c and .h files in the current
directory and all subdirectories, the command would be
grep -R --include=*.[hc] pattern .
The specification of the directory or directories in which grep
begins its recursive searching is different from the specification
of the file names that grep searches in those directories, as it
should be.
The behaviors of cscope and grep are different when no file name is
given: cscope defaults to the current working directory while grep
defaults to reading stdin.
Cscope doesn't normally need a filename pattern since it's normally
only interested in C files and it knows what those file names look
like. Unfortunately, it appears that to search C++ files, cscope
must be given a list of all the files to search, not just a filename
pattern.
Regards,
Gary
> If you want to search all the .c and .h files in the current
> directory and all subdirectories, the command would be
>
> grep -R --include=*.[hc] pattern .
>
> The specification of the directory or directories in which grep
> begins its recursive searching is different from the specification
> of the file names that grep searches in those directories, as it
> should be.
Thanks for the explanation Gary!
--
Best regards,
Bill
>epanda wrote:
>
>
>
>>Vimball Archive
>>extracted <plugin/cecscope.vim>: 311 lines
>>Erreur détectée en traitant function vimball#Vimball :
>>ligne 115 :
>>"C:\Program\ Files\Vim\vimfiles\plugin\cecscope.vim" E212: Impossible
>>d'ouvrir le fichier pour y écri
>>re
>>wrote C:\Program\\ Files\Vim\vimfiles\plugin\cecscope.vim
>>extracted <doc/cecscope.txt>: 134 lines
>>"C:\Program\ Files\Vim\vimfiles\doc\cecscope.txt" E212: Impossible
>>d'ouvrir le fichier pour y écrire
>>wrote C:\Program\\ Files\Vim\vimfiles\doc\cecscope.txt
>>ligne 142 :
>>E150: C:\Program\ Files\Vim\vimfiles\doc n'est pas un répertoire
>>did helptags
>>Appuyez sur ENTRÉE ou tapez une commande pour continuer
>>
>>
>>
>>
>
>I'm afraid that my French isn't nearly as good as your English --- but
>the above looks like a problem that vimball is having dealing with M$'s
>spaces-in-filenames fetish, not with cecscope.vim itself. I'll look
>into it.
>
>
Hello!
Please try v24d of vimball -- I think I've got the spaces in directory
names problem fixed. That version is available from:
http://mysite.verizon.net/astronaut/vim/index.html#VIMBALL
(as a tarball, since I figure its not good to have vimball needed to
extract itself)
Regards,
Chip Campbell
I'm afraid that I haven't gotten any feedback about this fix -- has
anyone tried it yet?
Happy New Year!
Chip Campbell
>Charles
>
>The link is ko for cecscope
>http://mysite.verizon.net/astronaut/vim/vbafiles
>
>
Hmm -- the problem was with vimball extraction, not cecscope; so the
link I gave was, if I may repeat:
http://mysite.verizon.net/astronaut/vim/index.html#VIMBALL
I just tried the link out and it worked for me.
Hope that helps,
Chip Campbell