7
|
1 /* vi:set ts=8 sts=4 sw=4:
|
|
2 *
|
|
3 * CSCOPE support for Vim added by Andy Kahn <kahn@zk3.dec.com>
|
148
|
4 * Ported to Win32 by Sergey Khorev <sergey.khorev@gmail.com>
|
7
|
5 *
|
|
6 * The basic idea/structure of cscope for Vim was borrowed from Nvi.
|
|
7 * There might be a few lines of code that look similar to what Nvi
|
|
8 * has. If this is a problem and requires inclusion of the annoying
|
|
9 * BSD license, then sue me; I'm not worth much anyway.
|
|
10 */
|
|
11
|
|
12 #if defined(FEAT_CSCOPE) || defined(PROTO)
|
|
13
|
|
14 #if defined(UNIX)
|
132
|
15 # include <sys/types.h> /* pid_t */
|
|
16 # include <sys/stat.h> /* dev_t, ino_t */
|
|
17 #else
|
|
18 # if defined (WIN32)
|
|
19 # ifndef WIN32_LEAN_AND_MEAN
|
|
20 # define WIN32_LEAN_AND_MEAN
|
|
21 # endif
|
|
22 # include <windows.h>
|
7
|
23 # endif
|
|
24 #endif
|
|
25
|
|
26 #define CSCOPE_SUCCESS 0
|
|
27 #define CSCOPE_FAILURE -1
|
|
28 #define CSCOPE_MAX_CONNECTIONS 8 /* you actually need more? */
|
|
29
|
|
30 #define CSCOPE_DBFILE "cscope.out"
|
|
31 #define CSCOPE_PROMPT ">> "
|
|
32
|
|
33 /*
|
|
34 * s 0name Find this C symbol
|
|
35 * g 1name Find this definition
|
|
36 * d 2name Find functions called by this function
|
|
37 * c 3name Find functions calling this function
|
|
38 * t 4string find text string (cscope 12.9)
|
|
39 * t 4name Find assignments to (cscope 13.3)
|
|
40 * 5pattern change pattern -- NOT USED
|
|
41 * e 6pattern Find this egrep pattern
|
|
42 * f 7name Find this file
|
|
43 * i 8name Find files #including this file
|
|
44 */
|
|
45
|
|
46 typedef struct {
|
|
47 char * name;
|
|
48 int (*func) __ARGS((exarg_T *eap));
|
|
49 char * help;
|
|
50 char * usage;
|
|
51 int cansplit; /* if supports splitting window */
|
|
52 } cscmd_T;
|
|
53
|
|
54 typedef struct csi {
|
|
55 char * fname; /* cscope db name */
|
|
56 char * ppath; /* path to prepend (the -P option) */
|
|
57 char * flags; /* additional cscope flags/options (e.g, -p2) */
|
|
58 #if defined(UNIX)
|
|
59 pid_t pid; /* PID of the connected cscope process. */
|
|
60 dev_t st_dev; /* ID of dev containing cscope db */
|
|
61 ino_t st_ino; /* inode number of cscope db */
|
132
|
62 #else
|
|
63 # if defined(WIN32)
|
1385
|
64 DWORD pid; /* PID of the connected cscope process. */
|
7
|
65 HANDLE hProc; /* cscope process handle */
|
|
66 DWORD nVolume; /* Volume serial number, instead of st_dev */
|
|
67 DWORD nIndexHigh; /* st_ino has no meaning in the Windows */
|
|
68 DWORD nIndexLow;
|
132
|
69 # endif
|
7
|
70 #endif
|
|
71
|
|
72 FILE * fr_fp; /* from cscope: FILE. */
|
|
73 FILE * to_fp; /* to cscope: FILE. */
|
|
74 } csinfo_T;
|
|
75
|
|
76 typedef enum { Add, Find, Help, Kill, Reset, Show } csid_e;
|
|
77
|
|
78 typedef enum {
|
|
79 Store,
|
|
80 Get,
|
|
81 Free,
|
|
82 Print
|
|
83 } mcmd_e;
|
|
84
|
|
85
|
|
86 #endif /* FEAT_CSCOPE */
|
|
87
|
|
88 /* the end */
|