1 / ========================================================================= /
2 / Copyright (c) 1998-2000, The Santa Cruz Operation /
3 / All rights reserved./
5 / Redistribution and use in source and binary forms, with or without/
6 / modification, are permitted provided that the following conditions are met:/
8 / *Redistributions of source code must retain the above copyright notice,/
9 / this list of conditions and the following disclaimer./
11 / *Redistributions in binary form must reproduce the above copyright notice,/
12 / this list of conditions and the following disclaimer in the documentation/
13 / and/or other materials provided with the distribution./
15 / *Neither name of The Santa Cruz Operation nor the names of its contributors/
16 / may be used to endorse or promote products derived from this software/
17 / without specific prior written permission. /
19 / THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS/
20 / IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,/
21 / THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR/
22 / PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE/
23 / LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR/
24 / CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF/
25 / SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS/
27 / HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT/
28 / LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY/
29 / OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH/
31 / ========================================================================= /
33 / $Id: emacs.e,v 1.1 2000/04/27 16:33:47 petr Exp $ /
36 / emacs menu for cscope /
37 ((X) cscope (find current word [MACRO])
38 (extern symbol-character)
40 / if this character is not part of a symbol /
41 (cond ((not symbol-character)
43 / if the previous character is not part of a symbol, go to
46 (cond ((not symbol-character) forward-word back-word))
48 / get the current symbol (leave cursor at beginning of symbol) /
49 (while symbol-character forward) / go past last symbol character /
50 mark / mark this point /
51 back / back to last symbol character /
52 (while (cond (symbol-character (return back)))) / back fails at BOF /
53 (cond ((not symbol-character) forward)) / forward if not at BOF /
54 pickup-region / get the symbol /
58 / if arg > 0 then display the menu /
59 (cond ((> arg 0) (display-menu
60 (format symbol "5 Find functions calling %l()")
61 (format symbol "4 Find functions called by %l()")
62 (format symbol "3 Find global definition of %l")
63 (format symbol "2 Find symbol %l")
69 (selection= (read-character "Selection?"))
71 / if the selection is in range /
72 (cond ((&& (>= selection '1') (<= selection '5'))
74 / if the selection requests finding the symbol /
75 (local-string findsymbol)
77 (cond ((>= selection '2')
78 (findsymbol= (format (char-to-string (- selection 2)) symbol "-%l '%l'"))))
80 / if arg > 1 or < 0 then don't update the cross-reference database /
81 (local-string doption)
83 (cond ((|| (> arg 1) (< arg 0)) (doption= "-d")))
85 / call cscope with usilent mode off /
86 (local oldmode) / save old usilent mode /
87 (oldmode= (set-mode "usilent" 0)) / turn off usilent mode /
88 (run-command (format doption findsymbol "cscope %l %l"))
89 (set-mode "usilent" oldmode) / restore usilent mode /
92 / see if the current character is part of a symbol /
95 (c= current-character)
96 (return (cond ((&& (>= c 'a') (<= c 'z')))
97 ((&& (>= c 'A') (<= c 'Z')))
98 ((&& (>= c '0') (<= c '9')))