comparison src/structs.h @ 8031:ece323e2b57f v7.4.1310

commit https://github.com/vim/vim/commit/6463ca229cb9412581419497924c85fcbfc854ab Author: Bram Moolenaar <Bram@vim.org> Date: Sat Feb 13 17:04:46 2016 +0100 patch 7.4.1310 Problem: Jobs don't open a channel. Solution: Create pipes and add them to the channel. Add ch_logfile(). Only Unix for now.
author Christian Brabandt <cb@256bit.org>
date Sat, 13 Feb 2016 17:15:05 +0100
parents 75e0831549f1
children c6443e78cf2d
comparison
equal deleted inserted replaced
8030:05f57db9d8da 8031:ece323e2b57f
1108 #endif 1108 #endif
1109 typedef double float_T; 1109 typedef double float_T;
1110 1110
1111 typedef struct listvar_S list_T; 1111 typedef struct listvar_S list_T;
1112 typedef struct dictvar_S dict_T; 1112 typedef struct dictvar_S dict_T;
1113
1113 typedef struct jobvar_S job_T; 1114 typedef struct jobvar_S job_T;
1115 typedef struct readq_S readq_T;
1116 typedef struct jsonq_S jsonq_T;
1117 typedef struct cbq_S cbq_T;
1118 typedef struct channel_S channel_T;
1114 1119
1115 typedef enum 1120 typedef enum
1116 { 1121 {
1117 VAR_UNKNOWN = 0, 1122 VAR_UNKNOWN = 0,
1118 VAR_NUMBER, /* "v_number" is used */ 1123 VAR_NUMBER, /* "v_number" is used */
1253 HANDLE jv_job_object; 1258 HANDLE jv_job_object;
1254 #endif 1259 #endif
1255 jobstatus_T jv_status; 1260 jobstatus_T jv_status;
1256 1261
1257 int jv_refcount; /* reference count */ 1262 int jv_refcount; /* reference count */
1258 }; 1263 int jv_channel; /* channel for I/O */
1264 };
1265
1266 /*
1267 * Structures to hold info about a Channel.
1268 */
1269 struct readq_S
1270 {
1271 char_u *buffer;
1272 readq_T *next;
1273 readq_T *prev;
1274 };
1275
1276 struct jsonq_S
1277 {
1278 typval_T *value;
1279 jsonq_T *next;
1280 jsonq_T *prev;
1281 };
1282
1283 struct cbq_S
1284 {
1285 char_u *callback;
1286 int seq_nr;
1287 cbq_T *next;
1288 cbq_T *prev;
1289 };
1290
1291 /* mode for a channel */
1292 typedef enum
1293 {
1294 MODE_RAW = 0,
1295 MODE_JSON,
1296 MODE_JS
1297 } ch_mode_T;
1298
1299 struct channel_S {
1300 sock_T ch_sock; /* the socket, -1 for a closed channel */
1301
1302 #ifdef UNIX
1303 # define CHANNEL_PIPES
1304 int ch_in; /* stdin of the job, -1 if not used */
1305 int ch_out; /* stdout of the job, -1 if not used */
1306 int ch_err; /* stderr of the job, -1 if not used */
1307
1308 # if defined(UNIX) && !defined(HAVE_SELECT)
1309 int ch_sock_idx; /* used by channel_poll_setup() */
1310 int ch_in_idx; /* used by channel_poll_setup() */
1311 int ch_out_idx; /* used by channel_poll_setup() */
1312 int ch_err_idx; /* used by channel_poll_setup() */
1313 # endif
1314 #endif
1315
1316 readq_T ch_head; /* dummy node, header for circular queue */
1317
1318 int ch_error; /* When TRUE an error was reported. Avoids
1319 * giving pages full of error messages when
1320 * the other side has exited, only mention the
1321 * first error until the connection works
1322 * again. */
1323 #ifdef FEAT_GUI_X11
1324 XtInputId ch_inputHandler; /* Cookie for input */
1325 #endif
1326 #ifdef FEAT_GUI_GTK
1327 gint ch_inputHandler; /* Cookie for input */
1328 #endif
1329 #ifdef WIN32
1330 int ch_inputHandler; /* simply ret.value of WSAAsyncSelect() */
1331 #endif
1332
1333 void (*ch_close_cb)(void); /* callback for when channel is closed */
1334
1335 int ch_block_id; /* ID that channel_read_json_block() is
1336 waiting for */
1337 char_u *ch_callback; /* function to call when a msg is not handled */
1338 cbq_T ch_cb_head; /* dummy node for pre-request callbacks */
1339
1340 ch_mode_T ch_mode;
1341 jsonq_T ch_json_head; /* dummy node, header for circular queue */
1342
1343 int ch_timeout; /* request timeout in msec */
1344
1345 job_T *ch_job; /* job that uses this channel */
1346 };
1347
1259 1348
1260 /* structure used for explicit stack while garbage collecting hash tables */ 1349 /* structure used for explicit stack while garbage collecting hash tables */
1261 typedef struct ht_stack_S 1350 typedef struct ht_stack_S
1262 { 1351 {
1263 hashtab_T *ht; 1352 hashtab_T *ht;
2727 /* function to fill the buffer or NULL; 2816 /* function to fill the buffer or NULL;
2728 * return TRUE when the buffer was filled */ 2817 * return TRUE when the buffer was filled */
2729 void *js_cookie; /* can be used by js_fill */ 2818 void *js_cookie; /* can be used by js_fill */
2730 }; 2819 };
2731 typedef struct js_reader js_read_T; 2820 typedef struct js_reader js_read_T;
2732
2733 /* mode for a channel */
2734 typedef enum
2735 {
2736 MODE_RAW = 0,
2737 MODE_JSON,
2738 MODE_JS
2739 } ch_mode_T;