}
#endif
+#if defined(FEAT_CHANNEL) || defined(FEAT_JOB)
+/*
+ * Get a callback from "arg". It can be a Funcref or a function name.
+ * When "arg" is zero return an empty string.
+ * Return NULL for an invalid argument.
+ */
+ static char_u *
+get_callback(typval_T *arg)
+{
+ if (arg->v_type == VAR_FUNC || arg->v_type == VAR_STRING)
+ return arg->vval.v_string;
+ if (arg->v_type == VAR_NUMBER && arg->vval.v_number == 0)
+ return (char_u *)"";
+ EMSG(_("E999: Invalid callback argument"));
+ return NULL;
+}
+
+/*
+ * Get the option entries from "dict", and parse them.
+ * If an option value is invalid return FAIL.
+ */
+ static int
+get_job_options(dict_T *dict, jobopt_T *opt)
+{
+ dictitem_T *item;
+ char_u *mode;
+
+ if (dict == NULL)
+ return OK;
+
+ if ((item = dict_find(dict, (char_u *)"mode", -1)) != NULL)
+ {
+ mode = get_tv_string(&item->di_tv);
+ if (STRCMP(mode, "nl") == 0)
+ opt->jo_mode = MODE_NL;
+ else if (STRCMP(mode, "raw") == 0)
+ opt->jo_mode = MODE_RAW;
+ else if (STRCMP(mode, "js") == 0)
+ opt->jo_mode = MODE_JS;
+ else if (STRCMP(mode, "json") == 0)
+ opt->jo_mode = MODE_JSON;
+ else
+ {
+ EMSG2(_(e_invarg2), mode);
+ return FAIL;
+ }
+ }
+
+ if ((item = dict_find(dict, (char_u *)"callback", -1)) != NULL)
+ {
+ opt->jo_callback = get_callback(&item->di_tv);
+ if (opt->jo_callback == NULL)
+ {
+ EMSG2(_(e_invarg2), "callback");
+ return FAIL;
+ }
+ }
+
+ return OK;
+}
+#endif
+
#ifdef FEAT_CHANNEL
/*
* Get the channel from the argument.
channel_close(channel);
}
-/*
- * Get a callback from "arg". It can be a Funcref or a function name.
- * When "arg" is zero return an empty string.
- * Return NULL for an invalid argument.
- */
- static char_u *
-get_callback(typval_T *arg)
-{
- if (arg->v_type == VAR_FUNC || arg->v_type == VAR_STRING)
- return arg->vval.v_string;
- if (arg->v_type == VAR_NUMBER && arg->vval.v_number == 0)
- return (char_u *)"";
- EMSG(_("E999: Invalid callback argument"));
- return NULL;
-}
-
/*
* "ch_logfile()" function
*/
ch_logfile(file);
}
-/*
- * Get the option entries from "dict", and parse them.
- * If an option value is invalid return FAIL.
- */
- static int
-get_job_options(dict_T *dict, jobopt_T *opt)
-{
- dictitem_T *item;
- char_u *mode;
-
- if (dict == NULL)
- return OK;
-
- if ((item = dict_find(dict, (char_u *)"mode", -1)) != NULL)
- {
- mode = get_tv_string(&item->di_tv);
- if (STRCMP(mode, "nl") == 0)
- opt->jo_mode = MODE_NL;
- else if (STRCMP(mode, "raw") == 0)
- opt->jo_mode = MODE_RAW;
- else if (STRCMP(mode, "js") == 0)
- opt->jo_mode = MODE_JS;
- else if (STRCMP(mode, "json") == 0)
- opt->jo_mode = MODE_JSON;
- else
- {
- EMSG2(_(e_invarg2), mode);
- return FAIL;
- }
- }
-
- if ((item = dict_find(dict, (char_u *)"callback", -1)) != NULL)
- {
- opt->jo_callback = get_callback(&item->di_tv);
- if (opt->jo_callback == NULL)
- {
- EMSG2(_(e_invarg2), "callback");
- return FAIL;
- }
- }
-
- return OK;
-}
-
/*
* "ch_open()" function
*/