Mercurial > vim
comparison src/structs.h @ 8151:aa845d10c6fb v7.4.1369
commit https://github.com/vim/vim/commit/42d38a2db17e70312d073095257555c27a5f9443
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Feb 20 18:18:59 2016 +0100
patch 7.4.1369
Problem: Channels don't have a queue for stderr.
Solution: Have a queue for each part of the channel.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 20 Feb 2016 18:30:04 +0100 |
parents | 310dd635e8c9 |
children | 74b44d06d3c7 |
comparison
equal
deleted
inserted
replaced
8150:85b476dac933 | 8151:aa845d10c6fb |
---|---|
1301 MODE_JS | 1301 MODE_JS |
1302 } ch_mode_T; | 1302 } ch_mode_T; |
1303 | 1303 |
1304 /* Ordering matters, it is used in for loops: IN is last, only SOCK/OUT/ERR | 1304 /* Ordering matters, it is used in for loops: IN is last, only SOCK/OUT/ERR |
1305 * are polled. */ | 1305 * are polled. */ |
1306 #define CHAN_SOCK 0 | 1306 #define PART_SOCK 0 |
1307 #define CH_SOCK ch_pfd[CHAN_SOCK].ch_fd | 1307 #define CH_SOCK_FD ch_part[PART_SOCK].ch_fd |
1308 | 1308 |
1309 #if defined(UNIX) || defined(WIN32) | 1309 #if defined(UNIX) || defined(WIN32) |
1310 # define CHANNEL_PIPES | 1310 # define CHANNEL_PIPES |
1311 # define CHAN_FD_INVALID (-1) | 1311 # define INVALID_FD (-1) |
1312 | 1312 |
1313 # define CHAN_OUT 1 | 1313 # define PART_OUT 1 |
1314 # define CHAN_ERR 2 | 1314 # define PART_ERR 2 |
1315 # define CHAN_IN 3 | 1315 # define PART_IN 3 |
1316 # define CH_OUT ch_pfd[CHAN_OUT].ch_fd | 1316 # define CH_OUT_FD ch_part[PART_OUT].ch_fd |
1317 # define CH_ERR ch_pfd[CHAN_ERR].ch_fd | 1317 # define CH_ERR_FD ch_part[PART_ERR].ch_fd |
1318 # define CH_IN ch_pfd[CHAN_IN].ch_fd | 1318 # define CH_IN_FD ch_part[PART_IN].ch_fd |
1319 #endif | 1319 #endif |
1320 | 1320 |
1321 /* The per-fd info for a channel. */ | 1321 /* The per-fd info for a channel. */ |
1322 typedef struct { | 1322 typedef struct { |
1323 sock_T ch_fd; /* socket/stdin/stdout/stderr, -1 if not used */ | 1323 sock_T ch_fd; /* socket/stdin/stdout/stderr, -1 if not used */ |
1333 gint ch_inputHandler; /* Cookie for input */ | 1333 gint ch_inputHandler; /* Cookie for input */ |
1334 #endif | 1334 #endif |
1335 #ifdef WIN32 | 1335 #ifdef WIN32 |
1336 int ch_inputHandler; /* ret.value of WSAAsyncSelect() */ | 1336 int ch_inputHandler; /* ret.value of WSAAsyncSelect() */ |
1337 #endif | 1337 #endif |
1338 } chan_fd_T; | 1338 |
1339 ch_mode_T ch_mode; | |
1340 int ch_timeout; /* request timeout in msec */ | |
1341 | |
1342 readq_T ch_head; /* header for circular raw read queue */ | |
1343 jsonq_T ch_json_head; /* header for circular json read queue */ | |
1344 int ch_block_id; /* ID that channel_read_json_block() is | |
1345 waiting for */ | |
1346 | |
1347 cbq_T ch_cb_head; /* dummy node for per-request callbacks */ | |
1348 char_u *ch_callback; /* call when a msg is not handled */ | |
1349 } chanpart_T; | |
1339 | 1350 |
1340 struct channel_S { | 1351 struct channel_S { |
1341 channel_T *ch_next; | 1352 channel_T *ch_next; |
1342 channel_T *ch_prev; | 1353 channel_T *ch_prev; |
1343 | 1354 |
1344 int ch_id; /* ID of the channel */ | 1355 int ch_id; /* ID of the channel */ |
1345 | 1356 |
1346 chan_fd_T ch_pfd[4]; /* info for socket, out, err and in */ | 1357 chanpart_T ch_part[4]; /* info for socket, out, err and in */ |
1347 | |
1348 readq_T ch_head; /* dummy node, header for circular queue */ | |
1349 | 1358 |
1350 int ch_error; /* When TRUE an error was reported. Avoids | 1359 int ch_error; /* When TRUE an error was reported. Avoids |
1351 * giving pages full of error messages when | 1360 * giving pages full of error messages when |
1352 * the other side has exited, only mention the | 1361 * the other side has exited, only mention the |
1353 * first error until the connection works | 1362 * first error until the connection works |
1354 * again. */ | 1363 * again. */ |
1355 | 1364 |
1356 void (*ch_close_cb)(void); /* callback for when channel is closed */ | 1365 void (*ch_close_cb)(void); /* callback for when channel is closed */ |
1357 | 1366 |
1358 int ch_block_id; /* ID that channel_read_json_block() is | 1367 char_u *ch_callback; /* call when any msg is not handled */ |
1359 waiting for */ | |
1360 char_u *ch_callback; /* function to call when a msg is not handled */ | |
1361 cbq_T ch_cb_head; /* dummy node for pre-request callbacks */ | |
1362 | |
1363 ch_mode_T ch_mode; | |
1364 jsonq_T ch_json_head; /* dummy node, header for circular queue */ | |
1365 | |
1366 int ch_timeout; /* request timeout in msec */ | |
1367 | 1368 |
1368 job_T *ch_job; /* Job that uses this channel; this does not | 1369 job_T *ch_job; /* Job that uses this channel; this does not |
1369 * count as a reference to avoid a circular | 1370 * count as a reference to avoid a circular |
1370 * reference. */ | 1371 * reference. */ |
1371 | 1372 |
1372 int ch_refcount; /* reference count */ | 1373 int ch_refcount; /* reference count */ |
1373 }; | 1374 }; |
1374 | 1375 |
1375 #define JO_MODE 1 | 1376 #define JO_MODE 1 /* all modes */ |
1376 #define JO_CALLBACK 2 | 1377 #define JO_CALLBACK 2 /* channel callback */ |
1377 #define JO_WAITTIME 4 | 1378 #define JO_WAITTIME 4 /* only for ch_open() */ |
1378 #define JO_TIMEOUT 8 | 1379 #define JO_TIMEOUT 8 /* all timeouts */ |
1379 #define JO_ALL 0xffffff | 1380 #define JO_ALL 0xffffff |
1380 | 1381 |
1381 /* | 1382 /* |
1382 * Options for job and channel commands. | 1383 * Options for job and channel commands. |
1383 */ | 1384 */ |