blob: 99d472b9c79c9933f714c8a5d85a2ac276d64d7e [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>
Bram Moolenaar2ce06f62005-01-31 19:19:04 +00004 * Ported to Win32 by Sergey Khorev <sergey.khorev@gmail.com>
Bram Moolenaar071d4272004-06-13 20:20:40 +00005 *
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 ">> "
Bram Moolenaar071d4272004-06-13 20:20:40 +000032
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#define FIND_USAGE "find c|d|e|f|g|i|s|t name"
46#define FIND_HELP "\n\
47 c: Find functions calling this function\n\
48 d: Find functions called by this function\n\
49 e: Find this egrep pattern\n\
50 f: Find this file\n\
51 g: Find this definition\n\
52 i: Find files #including this file\n\
53 s: Find this C symbol\n\
54 t: Find assignments to\n"
55
56
57typedef struct {
58 char * name;
59 int (*func) __ARGS((exarg_T *eap));
60 char * help;
61 char * usage;
62 int cansplit; /* if supports splitting window */
63} cscmd_T;
64
65typedef struct csi {
66 char * fname; /* cscope db name */
67 char * ppath; /* path to prepend (the -P option) */
68 char * flags; /* additional cscope flags/options (e.g, -p2) */
69#if defined(UNIX)
70 pid_t pid; /* PID of the connected cscope process. */
71 dev_t st_dev; /* ID of dev containing cscope db */
72 ino_t st_ino; /* inode number of cscope db */
Bram Moolenaardf3267e2005-01-25 22:07:05 +000073#else
74# if defined(WIN32)
Bram Moolenaar02b06312007-09-06 15:39:22 +000075 DWORD pid; /* PID of the connected cscope process. */
Bram Moolenaar071d4272004-06-13 20:20:40 +000076 HANDLE hProc; /* cscope process handle */
77 DWORD nVolume; /* Volume serial number, instead of st_dev */
78 DWORD nIndexHigh; /* st_ino has no meaning in the Windows */
79 DWORD nIndexLow;
Bram Moolenaardf3267e2005-01-25 22:07:05 +000080# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000081#endif
82
83 FILE * fr_fp; /* from cscope: FILE. */
84 FILE * to_fp; /* to cscope: FILE. */
85} csinfo_T;
86
87typedef enum { Add, Find, Help, Kill, Reset, Show } csid_e;
88
89typedef enum {
90 Store,
91 Get,
92 Free,
93 Print
94} mcmd_e;
95
96
97#endif /* FEAT_CSCOPE */
98
99/* the end */