Mercurial > vim
diff src/structs.h @ 7957:b74549818500 v7.4.1274
commit https://github.com/vim/vim/commit/835dc636a5350f610b62f110227d2363b5b2880a
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Feb 7 14:27:38 2016 +0100
patch 7.4.1274
Problem: Cannot run a job.
Solution: Add job_start(), job_status() and job_stop(). Currently only works
for Unix.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 07 Feb 2016 14:30:04 +0100 |
parents | e875f0fbd9c0 |
children | 45ea5ebf3a98 |
line wrap: on
line diff
--- a/src/structs.h +++ b/src/structs.h @@ -1110,17 +1110,19 @@ typedef double float_T; typedef struct listvar_S list_T; typedef struct dictvar_S dict_T; +typedef struct jobvar_S job_T; typedef enum { VAR_UNKNOWN = 0, - VAR_NUMBER, /* "v_number" is used */ - VAR_STRING, /* "v_string" is used */ - VAR_FUNC, /* "v_string" is function name */ - VAR_LIST, /* "v_list" is used */ - VAR_DICT, /* "v_dict" is used */ - VAR_FLOAT, /* "v_float" is used */ - VAR_SPECIAL /* "v_number" is used */ + VAR_NUMBER, /* "v_number" is used */ + VAR_STRING, /* "v_string" is used */ + VAR_FUNC, /* "v_string" is function name */ + VAR_LIST, /* "v_list" is used */ + VAR_DICT, /* "v_dict" is used */ + VAR_FLOAT, /* "v_float" is used */ + VAR_SPECIAL, /* "v_number" is used */ + VAR_JOB /* "v_job" is used */ } vartype_T; /* @@ -1139,6 +1141,9 @@ typedef struct char_u *v_string; /* string value (can be NULL!) */ list_T *v_list; /* list value (can be NULL!) */ dict_T *v_dict; /* dict value (can be NULL!) */ +#ifdef FEAT_JOB + job_T *v_job; /* job value (can be NULL!) */ +#endif } vval; } typval_T; @@ -1204,7 +1209,6 @@ struct dictitem_S char_u di_flags; /* flags (only used for variable) */ char_u di_key[1]; /* key (actually longer!) */ }; - typedef struct dictitem_S dictitem_T; #define DI_FLAGS_RO 1 /* "di_flags" value: read-only variable */ @@ -1228,6 +1232,30 @@ struct dictvar_S dict_T *dv_used_prev; /* previous dict in used dicts list */ }; +typedef enum +{ + JOB_FAILED, + JOB_STARTED, + JOB_ENDED +} jobstatus_T; + +/* + * Structure to hold info about a Job. + */ +struct jobvar_S +{ +#ifdef UNIX + pid_t jv_pid; + int jv_exitval; +#endif +#ifdef WIN32 + PROCESS_INFORMATION jf_pi; +#endif + jobstatus_T jv_status; + + int jv_refcount; /* reference count */ +}; + /* structure used for explicit stack while garbage collecting hash tables */ typedef struct ht_stack_S {