Re: learning dragonfly or C...
George Georgalis wrote:
[stuff deleted]
> When jumping into a block of code that has functions and
> declarations, what is an efficient way to to find those definition
> amidst all the includes, paths and Makefiles of the whole tree,
> without completely losing your place? (eg I'd like to reference
> O_RDONLY and fp_close)
[stuff deleted]
If you use vi as your editor you can navigate code using a
tags file, other editors have similar functionality (for
example emacs uses etags).
% man 1 vi
....
-t Start editing at the specified tag. (See ctags(1)).
....
....
<control-]>
Push a tag reference onto the tag stack. In gtagsmode, if at
the first column of line, locate function references otherwise
function definitions.
<control-^>
Switch to the most recently edited file.
....
The following command will open the file containing the function
definition for JobCondPassSig.
% vi -t JobCondPassSig
Or when the cursor is on the first character of a function name,
type <ctrl-]>, this should causes the editor to open the file
containing the definition of the function. Typing <ctrl-6> will
return you to the previous file and location.
The tags file is created by running ctags on your source files.
There is also a target in Makefiles that includes 'bsd.prog.mk'
or 'bsd.lib.mk' called ctags.
% cd /usr/src/usr.bin/make
% setenv CTAGS ctags
% make tags
Duplicate entry in file job.c, line 243: MESSAGE
Second entry ignored
Duplicate entry in file job.c, line 262: KILL
Second entry ignored
Duplicate entry in file job.c, line 264: KILL
Second entry ignored
Duplicate entry in file targ.c, line 493: PRINTBIT
Second entry ignored
Duplicate entry in file targ.c, line 494: PRINTDBIT
Second entry ignored
takai.home-2924% vi -t JobCondPassSig
If you are interested in the kernel source then there is a
target in /usr/src/sys/i386/Makefile which will create a tags
file for the whole kernel.
Max
討論串 (同標題文章)
完整討論串 (本文為第 5 之 23 篇):