blob: 5c031a35574669fe84e7ca63085bd76a538cb5be [file] [log] [blame]
Bram Moolenaaredf3f972016-08-29 22:49:24 +02001/* vi:set ts=8 sts=4 sw=4 noet:
Bram Moolenaar071d4272004-06-13 20:20:40 +00002 *
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
Bram Moolenaar4f974752019-02-17 17:44:42 +010014#if defined (MSWIN)
Bram Moolenaar9e24f0c2016-02-27 17:22:27 +010015# ifndef WIN32_LEAN_AND_MEAN
16# define WIN32_LEAN_AND_MEAN
Bram Moolenaar071d4272004-06-13 20:20:40 +000017# endif
Bram Moolenaar9e24f0c2016-02-27 17:22:27 +010018# include <windows.h>
Bram Moolenaar071d4272004-06-13 20:20:40 +000019#endif
20
21#define CSCOPE_SUCCESS 0
22#define CSCOPE_FAILURE -1
Bram Moolenaar071d4272004-06-13 20:20:40 +000023
24#define CSCOPE_DBFILE "cscope.out"
25#define CSCOPE_PROMPT ">> "
Bram Moolenaar071d4272004-06-13 20:20:40 +000026
27/*
Bram Moolenaarf4145d82016-08-28 17:15:25 +020028 * See ":help cscope-find" for the possible queries.
Bram Moolenaar071d4272004-06-13 20:20:40 +000029 */
Bram Moolenaar071d4272004-06-13 20:20:40 +000030
31typedef struct {
32 char * name;
Bram Moolenaard99df422016-01-29 23:20:40 +010033 int (*func)(exarg_T *eap);
Bram Moolenaar071d4272004-06-13 20:20:40 +000034 char * help;
35 char * usage;
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010036 int cansplit; // if supports splitting window
Bram Moolenaar071d4272004-06-13 20:20:40 +000037} cscmd_T;
38
39typedef struct csi {
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010040 char * fname; // cscope db name
41 char * ppath; // path to prepend (the -P option)
42 char * flags; // additional cscope flags/options (e.g, -p2)
Bram Moolenaar071d4272004-06-13 20:20:40 +000043#if defined(UNIX)
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010044 pid_t pid; // PID of the connected cscope process.
45 dev_t st_dev; // ID of dev containing cscope db
46 ino_t st_ino; // inode number of cscope db
Bram Moolenaardf3267e2005-01-25 22:07:05 +000047#else
Bram Moolenaar4f974752019-02-17 17:44:42 +010048# if defined(MSWIN)
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010049 DWORD pid; // PID of the connected cscope process.
50 HANDLE hProc; // cscope process handle
51 DWORD nVolume; // Volume serial number, instead of st_dev
52 DWORD nIndexHigh; // st_ino has no meaning in the Windows
Bram Moolenaar071d4272004-06-13 20:20:40 +000053 DWORD nIndexLow;
Bram Moolenaardf3267e2005-01-25 22:07:05 +000054# endif
Bram Moolenaar071d4272004-06-13 20:20:40 +000055#endif
56
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010057 FILE * fr_fp; // from cscope: FILE.
58 FILE * to_fp; // to cscope: FILE.
Bram Moolenaar071d4272004-06-13 20:20:40 +000059} csinfo_T;
60
61typedef enum { Add, Find, Help, Kill, Reset, Show } csid_e;
62
63typedef enum {
64 Store,
65 Get,
66 Free,
67 Print
68} mcmd_e;
69
70
Bram Moolenaar9bf703d2019-11-30 19:44:38 +010071#endif // FEAT_CSCOPE