blob: b3149d6c6cb38e8c42fdcff0dd79589b16c0b3d3 [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)
15#include <sys/types.h> /* pid_t */
16#include <sys/stat.h> /* dev_t, ino_t */
17#elif defined (WIN32)
18# ifndef WIN32_LEAN_AND_MEAN
19# define WIN32_LEAN_AND_MEAN
20# endif
21# include <windows.h>
22#endif
23
24#define CSCOPE_SUCCESS 0
25#define CSCOPE_FAILURE -1
26#define CSCOPE_MAX_CONNECTIONS 8 /* you actually need more? */
27
28#define CSCOPE_DBFILE "cscope.out"
29#define CSCOPE_PROMPT ">> "
30#define CSCOPE_QUERIES "sgdct efi"
31
32/*
33 * s 0name Find this C symbol
34 * g 1name Find this definition
35 * d 2name Find functions called by this function
36 * c 3name Find functions calling this function
37 * t 4string find text string (cscope 12.9)
38 * t 4name Find assignments to (cscope 13.3)
39 * 5pattern change pattern -- NOT USED
40 * e 6pattern Find this egrep pattern
41 * f 7name Find this file
42 * i 8name Find files #including this file
43 */
44#define FIND_USAGE "find c|d|e|f|g|i|s|t name"
45#define FIND_HELP "\n\
46 c: Find functions calling this function\n\
47 d: Find functions called by this function\n\
48 e: Find this egrep pattern\n\
49 f: Find this file\n\
50 g: Find this definition\n\
51 i: Find files #including this file\n\
52 s: Find this C symbol\n\
53 t: Find assignments to\n"
54
55
56typedef struct {
57 char * name;
58 int (*func) __ARGS((exarg_T *eap));
59 char * help;
60 char * usage;
61 int cansplit; /* if supports splitting window */
62} cscmd_T;
63
64typedef struct csi {
65 char * fname; /* cscope db name */
66 char * ppath; /* path to prepend (the -P option) */
67 char * flags; /* additional cscope flags/options (e.g, -p2) */
68#if defined(UNIX)
69 pid_t pid; /* PID of the connected cscope process. */
70 dev_t st_dev; /* ID of dev containing cscope db */
71 ino_t st_ino; /* inode number of cscope db */
72#elif defined(WIN32)
73 int pid; /* Can't get pid so set it to 0 ;) */
74 HANDLE hProc; /* cscope process handle */
75 DWORD nVolume; /* Volume serial number, instead of st_dev */
76 DWORD nIndexHigh; /* st_ino has no meaning in the Windows */
77 DWORD nIndexLow;
78#endif
79
80 FILE * fr_fp; /* from cscope: FILE. */
81 FILE * to_fp; /* to cscope: FILE. */
82} csinfo_T;
83
84typedef enum { Add, Find, Help, Kill, Reset, Show } csid_e;
85
86typedef enum {
87 Store,
88 Get,
89 Free,
90 Print
91} mcmd_e;
92
93
94#endif /* FEAT_CSCOPE */
95
96/* the end */