Bram Moolenaar | edf3f97 | 2016-08-29 22:49:24 +0200 | [diff] [blame] | 1 | /* vi:set ts=8 sts=4 sw=4 noet: |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 2 | * |
| 3 | * CSCOPE support for Vim added by Andy Kahn <kahn@zk3.dec.com> |
Bram Moolenaar | 2ce06f6 | 2005-01-31 19:19:04 +0000 | [diff] [blame] | 4 | * Ported to Win32 by Sergey Khorev <sergey.khorev@gmail.com> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 | |
Bram Moolenaar | 4f97475 | 2019-02-17 17:44:42 +0100 | [diff] [blame^] | 14 | #if defined (MSWIN) |
Bram Moolenaar | 9e24f0c | 2016-02-27 17:22:27 +0100 | [diff] [blame] | 15 | # ifndef WIN32_LEAN_AND_MEAN |
| 16 | # define WIN32_LEAN_AND_MEAN |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 17 | # endif |
Bram Moolenaar | 9e24f0c | 2016-02-27 17:22:27 +0100 | [diff] [blame] | 18 | # include <windows.h> |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 19 | #endif |
| 20 | |
| 21 | #define CSCOPE_SUCCESS 0 |
| 22 | #define CSCOPE_FAILURE -1 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 23 | |
| 24 | #define CSCOPE_DBFILE "cscope.out" |
| 25 | #define CSCOPE_PROMPT ">> " |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 26 | |
| 27 | /* |
Bram Moolenaar | f4145d8 | 2016-08-28 17:15:25 +0200 | [diff] [blame] | 28 | * See ":help cscope-find" for the possible queries. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 29 | */ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 30 | |
| 31 | typedef struct { |
| 32 | char * name; |
Bram Moolenaar | d99df42 | 2016-01-29 23:20:40 +0100 | [diff] [blame] | 33 | int (*func)(exarg_T *eap); |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 34 | char * help; |
| 35 | char * usage; |
| 36 | int cansplit; /* if supports splitting window */ |
| 37 | } cscmd_T; |
| 38 | |
| 39 | typedef struct csi { |
| 40 | char * fname; /* cscope db name */ |
| 41 | char * ppath; /* path to prepend (the -P option) */ |
| 42 | char * flags; /* additional cscope flags/options (e.g, -p2) */ |
| 43 | #if defined(UNIX) |
| 44 | 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 Moolenaar | df3267e | 2005-01-25 22:07:05 +0000 | [diff] [blame] | 47 | #else |
Bram Moolenaar | 4f97475 | 2019-02-17 17:44:42 +0100 | [diff] [blame^] | 48 | # if defined(MSWIN) |
Bram Moolenaar | 02b0631 | 2007-09-06 15:39:22 +0000 | [diff] [blame] | 49 | DWORD pid; /* PID of the connected cscope process. */ |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 */ |
| 53 | DWORD nIndexLow; |
Bram Moolenaar | df3267e | 2005-01-25 22:07:05 +0000 | [diff] [blame] | 54 | # endif |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 55 | #endif |
| 56 | |
| 57 | FILE * fr_fp; /* from cscope: FILE. */ |
| 58 | FILE * to_fp; /* to cscope: FILE. */ |
| 59 | } csinfo_T; |
| 60 | |
| 61 | typedef enum { Add, Find, Help, Kill, Reset, Show } csid_e; |
| 62 | |
| 63 | typedef enum { |
| 64 | Store, |
| 65 | Get, |
| 66 | Free, |
| 67 | Print |
| 68 | } mcmd_e; |
| 69 | |
| 70 | |
| 71 | #endif /* FEAT_CSCOPE */ |
| 72 | |
| 73 | /* the end */ |