blob: 81051284e142fad944d0e7082190efb5b5656ea7 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001/* vi:set ts=8 sts=4 sw=4:
2 *
3 * CSCOPE support for Vim added by Andy Kahn <kahn@zk3.dec.com>
4 * Ported to Win32 by Sergey Khorev <khorev@softlab.ru>
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)
Bram Moolenaardf3267e2005-01-25 22:07:05 +000015# 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>
Bram Moolenaar071d4272004-06-13 20:20:40 +000023# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000024#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#define CSCOPE_QUERIES "sgdct efi"
33
34/*
35 * s 0name Find this C symbol
36 * g 1name Find this definition
37 * d 2name Find functions called by this function
38 * c 3name Find functions calling this function
39 * t 4string find text string (cscope 12.9)
40 * t 4name Find assignments to (cscope 13.3)
41 * 5pattern change pattern -- NOT USED
42 * e 6pattern Find this egrep pattern
43 * f 7name Find this file
44 * i 8name Find files #including this file
45 */
46#define FIND_USAGE "find c|d|e|f|g|i|s|t name"
47#define FIND_HELP "\n\
48 c: Find functions calling this function\n\
49 d: Find functions called by this function\n\
50 e: Find this egrep pattern\n\
51 f: Find this file\n\
52 g: Find this definition\n\
53 i: Find files #including this file\n\
54 s: Find this C symbol\n\
55 t: Find assignments to\n"
56
57
58typedef struct {
59 char * name;
60 int (*func) __ARGS((exarg_T *eap));
61 char * help;
62 char * usage;
63 int cansplit; /* if supports splitting window */
64} cscmd_T;
65
66typedef struct csi {
67 char * fname; /* cscope db name */
68 char * ppath; /* path to prepend (the -P option) */
69 char * flags; /* additional cscope flags/options (e.g, -p2) */
70#if defined(UNIX)
71 pid_t pid; /* PID of the connected cscope process. */
72 dev_t st_dev; /* ID of dev containing cscope db */
73 ino_t st_ino; /* inode number of cscope db */
Bram Moolenaardf3267e2005-01-25 22:07:05 +000074#else
75# if defined(WIN32)
Bram Moolenaar071d4272004-06-13 20:20:40 +000076 int pid; /* Can't get pid so set it to 0 ;) */
77 HANDLE hProc; /* cscope process handle */
78 DWORD nVolume; /* Volume serial number, instead of st_dev */
79 DWORD nIndexHigh; /* st_ino has no meaning in the Windows */
80 DWORD nIndexLow;
Bram Moolenaardf3267e2005-01-25 22:07:05 +000081# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000082#endif
83
84 FILE * fr_fp; /* from cscope: FILE. */
85 FILE * to_fp; /* to cscope: FILE. */
86} csinfo_T;
87
88typedef enum { Add, Find, Help, Kill, Reset, Show } csid_e;
89
90typedef enum {
91 Store,
92 Get,
93 Free,
94 Print
95} mcmd_e;
96
97
98#endif /* FEAT_CSCOPE */
99
100/* the end */