xref: /minix3/external/bsd/nvi/docs/internals/cscope.NOTES (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel SambucCscope Notes:
2*0a6a1f1dSLionel Sambuc
3*0a6a1f1dSLionel SambucThe nvi tags structure has been reworked to handle the notion of multiple
4*0a6a1f1dSLionel Sambuclocations per tag.  This supports cscope, which returns multiple locations
5*0a6a1f1dSLionel Sambucper query.  It will hopefully support ctags programs that create databases
6*0a6a1f1dSLionel Sambucwith multiple locations per tag as well.
7*0a6a1f1dSLionel Sambuc
8*0a6a1f1dSLionel SambucThere is now a list of "tag queues" chained from each screen.  Each tag
9*0a6a1f1dSLionel Sambucqueue has one or more "tag locations".
10*0a6a1f1dSLionel Sambuc
11*0a6a1f1dSLionel Sambuc   +----+    +----+	+----+     +----+
12*0a6a1f1dSLionel Sambuc   | EP | -> | Q1 | <-- | T1 | <-- | T2 |
13*0a6a1f1dSLionel Sambuc   +----+    +----+ --> +----+ --> +----+
14*0a6a1f1dSLionel Sambuc  	     |
15*0a6a1f1dSLionel Sambuc  	     +----+     +----+
16*0a6a1f1dSLionel Sambuc  	     | Q2 | <-- | T1 |
17*0a6a1f1dSLionel Sambuc  	     +----+ --> +----+
18*0a6a1f1dSLionel Sambuc  	     |
19*0a6a1f1dSLionel Sambuc  	     +----+	+----+
20*0a6a1f1dSLionel Sambuc  	     | Q3 | <-- | T1 |
21*0a6a1f1dSLionel Sambuc  	     +----+ --> +----+
22*0a6a1f1dSLionel Sambuc
23*0a6a1f1dSLionel SambucIn the above diagram, each "Q" is a "tag queue", and each "T" is a
24*0a6a1f1dSLionel Sambuctag location.  Generally, the commands:
25*0a6a1f1dSLionel Sambuc
26*0a6a1f1dSLionel Sambuc	:tag			create a new Q
27*0a6a1f1dSLionel Sambuc	^[			create a new Q
28*0a6a1f1dSLionel Sambuc	:cscope find		create a new Q
29*0a6a1f1dSLionel Sambuc	:tagnext		move to the next T
30*0a6a1f1dSLionel Sambuc	:tagprev		move to the previous T
31*0a6a1f1dSLionel Sambuc	:tagpop			discard one or more Q's
32*0a6a1f1dSLionel Sambuc	^T			discard the most recent Q
33*0a6a1f1dSLionel Sambuc	:tagtop			discard all Q's
34*0a6a1f1dSLionel Sambuc
35*0a6a1f1dSLionel SambucMore specifically:
36*0a6a1f1dSLionel Sambuc
37*0a6a1f1dSLionel Sambuc:cs[cope] a[dd] cscope-dir
38*0a6a1f1dSLionel Sambuc
39*0a6a1f1dSLionel Sambuc	Attach to the cscope database in cscope-dir.
40*0a6a1f1dSLionel Sambuc
41*0a6a1f1dSLionel Sambuc:cs[cope] f[ind] c|d|e|f|g|i|s|t buffer|pattern
42*0a6a1f1dSLionel Sambuc
43*0a6a1f1dSLionel Sambuc	Query all attached cscopes for the pattern.  The pattern is a
44*0a6a1f1dSLionel Sambuc	regular expression.  If the pattern is a double-quote character
45*0a6a1f1dSLionel Sambuc	followed by a valid buffer name (e.g., "t), then the contents
46*0a6a1f1dSLionel Sambuc	of the named buffer are used as the pattern.
47*0a6a1f1dSLionel Sambuc
48*0a6a1f1dSLionel Sambuc	c: find callers of name
49*0a6a1f1dSLionel Sambuc	d: find all function calls made from name
50*0a6a1f1dSLionel Sambuc	e: find pattern
51*0a6a1f1dSLionel Sambuc	f: find files with name as substring
52*0a6a1f1dSLionel Sambuc	g: find definition of name
53*0a6a1f1dSLionel Sambuc	i: find files #including name
54*0a6a1f1dSLionel Sambuc	s: find all uses of name
55*0a6a1f1dSLionel Sambuc	t: find assignments to name
56*0a6a1f1dSLionel Sambuc
57*0a6a1f1dSLionel Sambuc	The find command pushes the current location onto the tags stack,
58*0a6a1f1dSLionel Sambuc	and switches to the first location resulting from the query, if
59*0a6a1f1dSLionel Sambuc	the query returned at least one result.
60*0a6a1f1dSLionel Sambuc
61*0a6a1f1dSLionel Sambuc:cs[cope] h[elp] [command]
62*0a6a1f1dSLionel Sambuc
63*0a6a1f1dSLionel Sambuc	List the cscope commands, or usage help on one command.
64*0a6a1f1dSLionel Sambuc
65*0a6a1f1dSLionel Sambuc:display c[onnections]
66*0a6a1f1dSLionel Sambuc
67*0a6a1f1dSLionel Sambuc	Display the list of cscope connections
68*0a6a1f1dSLionel Sambuc
69*0a6a1f1dSLionel Sambuc:display t[ags]
70*0a6a1f1dSLionel Sambuc
71*0a6a1f1dSLionel Sambuc	The tags display has been enhanced to display multiple tag
72*0a6a1f1dSLionel Sambuc	locations per tag query.
73*0a6a1f1dSLionel Sambuc
74*0a6a1f1dSLionel Sambuc:cs[cope] k[ill] #
75*0a6a1f1dSLionel Sambuc
76*0a6a1f1dSLionel Sambuc	Kill cscope connection number #.
77*0a6a1f1dSLionel Sambuc
78*0a6a1f1dSLionel Sambuc:cs[cope] r[eset]
79*0a6a1f1dSLionel Sambuc	Kill all attached cscopes.  Useful if one got hung but you don't
80*0a6a1f1dSLionel Sambuc	know which one.
81*0a6a1f1dSLionel Sambuc
82*0a6a1f1dSLionel Sambuc:tagn[ext][!]
83*0a6a1f1dSLionel Sambuc
84*0a6a1f1dSLionel Sambuc	Move to the next tag resulting from a query.
85*0a6a1f1dSLionel Sambuc
86*0a6a1f1dSLionel Sambuc:tagpr[ev][!]
87*0a6a1f1dSLionel Sambuc
88*0a6a1f1dSLionel Sambuc	Return to the previous tag resulting from a query.
89*0a6a1f1dSLionel Sambuc
90*0a6a1f1dSLionel Sambuc:tagp[op], ^T
91*0a6a1f1dSLionel Sambuc
92*0a6a1f1dSLionel Sambuc	Return to the previous tag group (no change).
93*0a6a1f1dSLionel Sambuc
94*0a6a1f1dSLionel Sambuc:tagt[op]
95*0a6a1f1dSLionel Sambuc
96*0a6a1f1dSLionel Sambuc	Discard all tag groups (no change).
97*0a6a1f1dSLionel Sambuc
98*0a6a1f1dSLionel SambucSuggested maps:
99*0a6a1f1dSLionel Sambuc
100*0a6a1f1dSLionel Sambuc	" ^N: move to the next tag
101*0a6a1f1dSLionel Sambuc	map ^N :tagnext^M
102*0a6a1f1dSLionel Sambuc	" ^P: move to the previous tag
103*0a6a1f1dSLionel Sambuc	map ^P :tagprev^M
104*0a6a1f1dSLionel Sambuc
105*0a6a1f1dSLionel Sambuc	" Tab+letter performs a C-Scope query on the current word.
106*0a6a1f1dSLionel Sambuc	" C-Scope 12.9 has a text-string query (type t).
107*0a6a1f1dSLionel Sambuc	" C-Scope 13.3 replaces it with an assignment query; hence a==t.
108*0a6a1f1dSLionel Sambuc	map <tab>a "tye:csc find t"t
109*0a6a1f1dSLionel Sambuc	map <tab>c "tye:csc find c"t
110*0a6a1f1dSLionel Sambuc	map <tab>d "tye:csc find d"t
111*0a6a1f1dSLionel Sambuc	map <tab>e "tye:csc find e"t
112*0a6a1f1dSLionel Sambuc	map <tab>f "tye:csc find f"t
113*0a6a1f1dSLionel Sambuc	map <tab>g "tye:csc find g"t
114*0a6a1f1dSLionel Sambuc	map <tab>i "tye:csc find i"t
115*0a6a1f1dSLionel Sambuc	map <tab>s "tye:csc find s"t
116*0a6a1f1dSLionel Sambuc	map <tab>t "tye:csc find t"t
117*0a6a1f1dSLionel Sambuc
118*0a6a1f1dSLionel SambucTo start nvi with an initial set of cscope directories, use the environment
119*0a6a1f1dSLionel Sambucvariable CSCOPE_DIRS.  This variable should contain a <blank>-separated
120*0a6a1f1dSLionel Sambuclist of directories containing cscope databases.  (This MAY be changed to
121*0a6a1f1dSLionel Sambucbe an edit option, I haven't really decided, yet.)
122*0a6a1f1dSLionel Sambuc
123*0a6a1f1dSLionel SambucEach cscope directory must contain a file named "cscope.out" which is the
124*0a6a1f1dSLionel Sambucmain cscope database, or nvi will not attempt to connect to a cscope to
125*0a6a1f1dSLionel Sambuchandle requests for that database.
126*0a6a1f1dSLionel Sambuc
127*0a6a1f1dSLionel SambucThe file "cscope.tpath" may contain a colon-separated directory search
128*0a6a1f1dSLionel Sambucpath which will be used to find the files reported by cscope.  If this
129*0a6a1f1dSLionel Sambuccscope.tpath does not exist, then the paths are assumed to be relative to
130*0a6a1f1dSLionel Sambucthe cscope directory itself.  This is an extension to the standard cscope,
131*0a6a1f1dSLionel Sambucbut seems important enough to keep.
132*0a6a1f1dSLionel Sambuc
133*0a6a1f1dSLionel Sambuc=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
134*0a6a1f1dSLionel SambucCscope Availability:
135*0a6a1f1dSLionel Sambuc
136*0a6a1f1dSLionel SambucUNIXWare System V Release 4.0 variants such as Sun Solaris 2.x
137*0a6a1f1dSLionel Sambuc(/opt/SUNWspro/bin) have version 11.5, and UNIXWare System V
138*0a6a1f1dSLionel SambucRelease 4.1 has version 12.10 with an option for much faster
139*0a6a1f1dSLionel Sambucsearching.
140*0a6a1f1dSLionel Sambuc
141*0a6a1f1dSLionel SambucYou can buy version 13.3 source with an unrestricted license
142*0a6a1f1dSLionel Sambucfor $400 from AT&T Software Solutions by calling +1-800-462-8146.
143