/* vi:set ts=8 sts=4 sw=4:
*
* if_sniff.c Interface between Vim and SNiFF+
*
* $Id$
*
* See README.txt for an overview of the Vim source code.
*/
#include "vim.h"
#ifdef WIN32
# include <stdio.h>
# include <fcntl.h>
# include <io.h>
# include <process.h>
# include <string.h>
# include <assert.h>
#else
# ifdef FEAT_GUI_X11
# include "gui_x11.pro"
# endif
# include "os_unixx.h"
#endif
static int sniffemacs_pid;
int fd_from_sniff;
int sniff_connected = 0;
int sniff_request_waiting = 0;
int want_sniff_request = 0;
#define MAX_REQUEST_LEN 512
#define NEED_SYMBOL 2
#define EMPTY_SYMBOL 4
#define NEED_FILE 8
#define SILENT 16
#define DISCONNECT 32
#define CONNECT 64
#define RQ_NONE 0
#define RQ_SIMPLE 1
#define RQ_CONTEXT NEED_FILE + NEED_SYMBOL
#define RQ_SCONTEXT NEED_FILE + NEED_SYMBOL + EMPTY_SYMBOL
#define RQ_NOSYMBOL NEED_FILE
#define RQ_SILENT RQ_NOSYMBOL + SILENT
#define RQ_CONNECT RQ_NONE + CONNECT
#define RQ_DISCONNECT RQ_SIMPLE + DISCONNECT
struct sn_cmd
{
char *cmd_name;
char cmd_code;
char *cmd_msg;
int cmd_type;
};
struct sn_cmd_list
{
struct sn_cmd* sniff_cmd;
struct sn_cmd_list* next_cmd;
};
static struct sn_cmd sniff_cmds[] =
{
{ "toggle", 'e', N_("Toggle implementation/definition"),RQ_SCONTEXT },
{ "superclass", 's', N_("Show base class of"), RQ_CONTEXT },
{ "overridden", 'm', N_("Show overridden member function"),RQ_SCONTEXT },
{ "retrieve-file", 'r', N_("Retrieve from file"), RQ_CONTEXT },
{ "retrieve-project",'p', N_("Retrieve from project"), RQ_CONTEXT },
{ "retrieve-all-projects",
'P', N_("Retrieve from all projects"), RQ_CONTEXT },
{ "retrieve-next", 'R', N_("Retrieve"), RQ_CONTEXT },
{ "goto-symbol", 'g', N_("Show source of"), RQ_CONTEXT },
{ "find-symbol", 'f', N_("Find symbol"), RQ_CONTEXT },
{ "browse-class", 'w', N_("Browse class"), RQ_CONTEXT },
{ "hierarchy", 't', N_("Show class in hierarchy"), RQ_CONTEXT },
{ "restr-hier", 'T', N_("Show class in restricted hierarchy"),RQ_CONTEXT },
{ "xref-to", 'x', N_("Xref refers to"), RQ_CONTEXT },
{ "xref-by", 'X', N_("Xref referred by"), RQ_CONTEXT },
{ "xref-has", 'c', N_("Xref has a"), RQ_CONTEXT },
{ "xref-used-by", 'C', N_("Xref used by"), RQ_CONTEXT },
{ "show-docu", 'd', N_("Show docu of"), RQ_CONTEXT },
{ "gen-docu", 'D', N_("Generate docu for"), RQ_CONTEXT },
{ "connect", 'y', NULL, RQ_CONNECT },
{ "disconnect", 'q', NULL, RQ_DISCONNECT },
{ "font-info", 'z', NULL, RQ_SILENT },
{ "update", 'u', NULL,