0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

updated for version 7.3.819

Problem:    Compiling without +eval and with Python isn't working.
Solution:   Add the eval feature when building with Python.
This commit is contained in:
Bram Moolenaar
2013-02-14 22:11:39 +01:00
parent 707060e2ee
commit b2c5a5ac79
7 changed files with 78 additions and 68 deletions

View File

@@ -917,7 +917,9 @@ eval_clear()
hash_clear(&compat_hashtab); hash_clear(&compat_hashtab);
free_scriptnames(); free_scriptnames();
# if defined(FEAT_CMDL_COMPL)
free_locales(); free_locales();
# endif
/* global variables */ /* global variables */
vars_clear(&globvarht); vars_clear(&globvarht);
@@ -1561,8 +1563,6 @@ eval_expr(arg, nextcmd)
} }
#if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) \
|| defined(FEAT_COMPL_FUNC) || defined(PROTO)
/* /*
* Call some vimL function and return the result in "*rettv". * Call some vimL function and return the result in "*rettv".
* Uses argv[argc] for the function arguments. Only Number and String * Uses argv[argc] for the function arguments. Only Number and String
@@ -1640,6 +1640,33 @@ call_vim_function(func, argc, argv, safe, str_arg_only, rettv)
return ret; return ret;
} }
/*
* Call vimL function "func" and return the result as a number.
* Returns -1 when calling the function fails.
* Uses argv[argc] for the function arguments.
*/
long
call_func_retnr(func, argc, argv, safe)
char_u *func;
int argc;
char_u **argv;
int safe; /* use the sandbox */
{
typval_T rettv;
long retval;
/* All arguments are passed as strings, no conversion to number. */
if (call_vim_function(func, argc, argv, safe, TRUE, &rettv) == FAIL)
return -1;
retval = get_tv_number_chk(&rettv, NULL);
clear_tv(&rettv);
return retval;
}
#if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) \
|| defined(FEAT_COMPL_FUNC) || defined(PROTO)
# if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO) # if (defined(FEAT_USR_CMDS) && defined(FEAT_CMDL_COMPL)) || defined(PROTO)
/* /*
* Call vimL function "func" and return the result as a string. * Call vimL function "func" and return the result as a string.
@@ -1666,32 +1693,6 @@ call_func_retstr(func, argc, argv, safe)
} }
# endif # endif
# if defined(FEAT_COMPL_FUNC) || defined(PROTO)
/*
* Call vimL function "func" and return the result as a number.
* Returns -1 when calling the function fails.
* Uses argv[argc] for the function arguments.
*/
long
call_func_retnr(func, argc, argv, safe)
char_u *func;
int argc;
char_u **argv;
int safe; /* use the sandbox */
{
typval_T rettv;
long retval;
/* All arguments are passed as strings, no conversion to number. */
if (call_vim_function(func, argc, argv, safe, TRUE, &rettv) == FAIL)
return -1;
retval = get_tv_number_chk(&rettv, NULL);
clear_tv(&rettv);
return retval;
}
# endif
/* /*
* Call vimL function "func" and return the result as a List. * Call vimL function "func" and return the result as a List.
* Uses argv[argc] for the function arguments. * Uses argv[argc] for the function arguments.
@@ -1720,7 +1721,6 @@ call_func_retlist(func, argc, argv, safe)
} }
#endif #endif
/* /*
* Save the current function call pointer, and set it to NULL. * Save the current function call pointer, and set it to NULL.
* Used when executing autocommands and for ":source". * Used when executing autocommands and for ":source".
@@ -9330,7 +9330,7 @@ f_char2nr(argvars, rettv)
*/ */
static void static void
f_cindent(argvars, rettv) f_cindent(argvars, rettv)
typval_T *argvars; typval_T *argvars UNUSED;
typval_T *rettv; typval_T *rettv;
{ {
#ifdef FEAT_CINDENT #ifdef FEAT_CINDENT
@@ -10379,9 +10379,9 @@ static void findfilendir __ARGS((typval_T *argvars, typval_T *rettv, int find_wh
static void static void
findfilendir(argvars, rettv, find_what) findfilendir(argvars, rettv, find_what)
typval_T *argvars; typval_T *argvars UNUSED;
typval_T *rettv; typval_T *rettv;
int find_what; int find_what UNUSED;
{ {
#ifdef FEAT_SEARCHPATH #ifdef FEAT_SEARCHPATH
char_u *fname; char_u *fname;
@@ -10751,9 +10751,9 @@ static void foldclosed_both __ARGS((typval_T *argvars, typval_T *rettv, int end)
*/ */
static void static void
foldclosed_both(argvars, rettv, end) foldclosed_both(argvars, rettv, end)
typval_T *argvars; typval_T *argvars UNUSED;
typval_T *rettv; typval_T *rettv;
int end; int end UNUSED;
{ {
#ifdef FEAT_FOLDING #ifdef FEAT_FOLDING
linenr_T lnum; linenr_T lnum;
@@ -10802,8 +10802,8 @@ f_foldclosedend(argvars, rettv)
*/ */
static void static void
f_foldlevel(argvars, rettv) f_foldlevel(argvars, rettv)
typval_T *argvars; typval_T *argvars UNUSED;
typval_T *rettv; typval_T *rettv UNUSED;
{ {
#ifdef FEAT_FOLDING #ifdef FEAT_FOLDING
linenr_T lnum; linenr_T lnum;
@@ -11583,7 +11583,7 @@ f_getline(argvars, rettv)
static void static void
f_getmatches(argvars, rettv) f_getmatches(argvars, rettv)
typval_T *argvars UNUSED; typval_T *argvars UNUSED;
typval_T *rettv; typval_T *rettv UNUSED;
{ {
#ifdef FEAT_SEARCH_EXTRA #ifdef FEAT_SEARCH_EXTRA
dict_T *dict; dict_T *dict;
@@ -13589,7 +13589,7 @@ f_line2byte(argvars, rettv)
*/ */
static void static void
f_lispindent(argvars, rettv) f_lispindent(argvars, rettv)
typval_T *argvars; typval_T *argvars UNUSED;
typval_T *rettv; typval_T *rettv;
{ {
#ifdef FEAT_LISP #ifdef FEAT_LISP
@@ -13983,8 +13983,8 @@ f_match(argvars, rettv)
*/ */
static void static void
f_matchadd(argvars, rettv) f_matchadd(argvars, rettv)
typval_T *argvars; typval_T *argvars UNUSED;
typval_T *rettv; typval_T *rettv UNUSED;
{ {
#ifdef FEAT_SEARCH_EXTRA #ifdef FEAT_SEARCH_EXTRA
char_u buf[NUMBUFLEN]; char_u buf[NUMBUFLEN];
@@ -14021,7 +14021,7 @@ f_matchadd(argvars, rettv)
*/ */
static void static void
f_matcharg(argvars, rettv) f_matcharg(argvars, rettv)
typval_T *argvars; typval_T *argvars UNUSED;
typval_T *rettv; typval_T *rettv;
{ {
if (rettv_list_alloc(rettv) == OK) if (rettv_list_alloc(rettv) == OK)
@@ -14053,8 +14053,8 @@ f_matcharg(argvars, rettv)
*/ */
static void static void
f_matchdelete(argvars, rettv) f_matchdelete(argvars, rettv)
typval_T *argvars; typval_T *argvars UNUSED;
typval_T *rettv; typval_T *rettv UNUSED;
{ {
#ifdef FEAT_SEARCH_EXTRA #ifdef FEAT_SEARCH_EXTRA
rettv->vval.v_number = match_delete(curwin, rettv->vval.v_number = match_delete(curwin,
@@ -14871,8 +14871,8 @@ list2proftime(arg, tm)
*/ */
static void static void
f_reltime(argvars, rettv) f_reltime(argvars, rettv)
typval_T *argvars; typval_T *argvars UNUSED;
typval_T *rettv; typval_T *rettv UNUSED;
{ {
#ifdef FEAT_RELTIME #ifdef FEAT_RELTIME
proftime_T res; proftime_T res;
@@ -14920,7 +14920,7 @@ f_reltime(argvars, rettv)
*/ */
static void static void
f_reltimestr(argvars, rettv) f_reltimestr(argvars, rettv)
typval_T *argvars; typval_T *argvars UNUSED;
typval_T *rettv; typval_T *rettv;
{ {
#ifdef FEAT_RELTIME #ifdef FEAT_RELTIME
@@ -15965,7 +15965,7 @@ do_searchpair(spat, mpat, epat, dir, skip, flags, match_pos,
int flags; /* SP_SETPCMARK and other SP_ values */ int flags; /* SP_SETPCMARK and other SP_ values */
pos_T *match_pos; pos_T *match_pos;
linenr_T lnum_stop; /* stop at this line if not zero */ linenr_T lnum_stop; /* stop at this line if not zero */
long time_limit; /* stop after this many msec */ long time_limit UNUSED; /* stop after this many msec */
{ {
char_u *save_cpo; char_u *save_cpo;
char_u *pat, *pat2 = NULL, *pat3 = NULL; char_u *pat, *pat2 = NULL, *pat3 = NULL;
@@ -16390,8 +16390,8 @@ f_setloclist(argvars, rettv)
*/ */
static void static void
f_setmatches(argvars, rettv) f_setmatches(argvars, rettv)
typval_T *argvars; typval_T *argvars UNUSED;
typval_T *rettv; typval_T *rettv UNUSED;
{ {
#ifdef FEAT_SEARCH_EXTRA #ifdef FEAT_SEARCH_EXTRA
list_T *l; list_T *l;
@@ -18463,7 +18463,7 @@ f_type(argvars, rettv)
*/ */
static void static void
f_undofile(argvars, rettv) f_undofile(argvars, rettv)
typval_T *argvars; typval_T *argvars UNUSED;
typval_T *rettv; typval_T *rettv;
{ {
rettv->v_type = VAR_STRING; rettv->v_type = VAR_STRING;

View File

@@ -1734,6 +1734,8 @@ do_one_cmd(cmdlinep, sourcing,
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
/* avoid that a function call in 'statusline' does this */ /* avoid that a function call in 'statusline' does this */
&& !getline_equal(fgetline, cookie, get_func_line) && !getline_equal(fgetline, cookie, get_func_line)
#endif
#ifdef FEAT_AUTOCMD
/* avoid that an autocommand, e.g. QuitPre, does this */ /* avoid that an autocommand, e.g. QuitPre, does this */
&& !getline_equal(fgetline, cookie, getnextac) && !getline_equal(fgetline, cookie, getnextac)
#endif #endif
@@ -5375,7 +5377,9 @@ fail:
#endif #endif
return FAIL; return FAIL;
} }
#endif
#if defined(FEAT_USR_CMDS) || defined(FEAT_EVAL) || defined(PROTO)
/* /*
* List of names for completion for ":command" with the EXPAND_ flag. * List of names for completion for ":command" with the EXPAND_ flag.
* Must be alphabetical for completion. * Must be alphabetical for completion.
@@ -5430,7 +5434,9 @@ static struct
{EXPAND_USER_VARS, "var"}, {EXPAND_USER_VARS, "var"},
{0, NULL} {0, NULL}
}; };
#endif
#if defined(FEAT_USR_CMDS) || defined(PROTO)
static void static void
uc_list(name, name_len) uc_list(name, name_len)
char_u *name; char_u *name;
@@ -6375,10 +6381,12 @@ parse_compl_arg(value, vallen, complp, argt, compl_arg)
int vallen; int vallen;
int *complp; int *complp;
long *argt; long *argt;
char_u **compl_arg; char_u **compl_arg UNUSED;
{ {
char_u *arg = NULL; char_u *arg = NULL;
# if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
size_t arglen = 0; size_t arglen = 0;
# endif
int i; int i;
int valend = vallen; int valend = vallen;
@@ -6388,7 +6396,9 @@ parse_compl_arg(value, vallen, complp, argt, compl_arg)
if (value[i] == ',') if (value[i] == ',')
{ {
arg = &value[i + 1]; arg = &value[i + 1];
# if defined(FEAT_EVAL) && defined(FEAT_CMDL_COMPL)
arglen = vallen - i - 1; arglen = vallen - i - 1;
# endif
valend = i; valend = i;
break; break;
} }

View File

@@ -391,6 +391,13 @@
# endif # endif
#endif #endif
/*
* +python and +python3 require FEAT_EVAL.
*/
#if !defined(FEAT_EVAL) && (defined(FEAT_PYTHON3) || defined(FEAT_PYTHON))
# define FEAT_EVAL
#endif
/* /*
* +profile Profiling for functions and scripts. * +profile Profiling for functions and scripts.
*/ */

View File

@@ -5164,8 +5164,7 @@ gui_mch_haskey(char_u *name)
return FAIL; return FAIL;
} }
#if defined(FEAT_TITLE) \ #if defined(FEAT_TITLE) || defined(FEAT_EVAL) || defined(PROTO)
|| defined(PROTO)
/* /*
* Return the text window-id and display. Only required for X-based GUI's * Return the text window-id and display. Only required for X-based GUI's
*/ */

View File

@@ -310,7 +310,6 @@ VimCommand(PyObject *self UNUSED, PyObject *args)
return result; return result;
} }
#ifdef FEAT_EVAL
/* /*
* Function to translate a typval_T into a PyObject; this will recursively * Function to translate a typval_T into a PyObject; this will recursively
* translate lists/dictionaries into their Python equivalents. * translate lists/dictionaries into their Python equivalents.
@@ -425,12 +424,10 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
return result; return result;
} }
#endif
static PyObject * static PyObject *
VimEval(PyObject *self UNUSED, PyObject *args UNUSED) VimEval(PyObject *self UNUSED, PyObject *args UNUSED)
{ {
#ifdef FEAT_EVAL
char *expr; char *expr;
typval_T *our_tv; typval_T *our_tv;
PyObject *result; PyObject *result;
@@ -466,10 +463,6 @@ VimEval(PyObject *self UNUSED, PyObject *args UNUSED)
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
return result; return result;
#else
PyErr_SetVim(_("expressions disabled at compile time"));
return NULL;
#endif
} }
static PyObject *ConvertToPyObject(typval_T *); static PyObject *ConvertToPyObject(typval_T *);
@@ -477,7 +470,6 @@ static PyObject *ConvertToPyObject(typval_T *);
static PyObject * static PyObject *
VimEvalPy(PyObject *self UNUSED, PyObject *args UNUSED) VimEvalPy(PyObject *self UNUSED, PyObject *args UNUSED)
{ {
#ifdef FEAT_EVAL
char *expr; char *expr;
typval_T *our_tv; typval_T *our_tv;
PyObject *result; PyObject *result;
@@ -506,10 +498,6 @@ VimEvalPy(PyObject *self UNUSED, PyObject *args UNUSED)
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
return result; return result;
#else
PyErr_SetVim(_("expressions disabled at compile time"));
return NULL;
#endif
} }
static PyObject * static PyObject *
@@ -946,7 +934,7 @@ DictionaryAssItem(PyObject *self, PyObject *keyObject, PyObject *valObject)
} }
static PyObject * static PyObject *
DictionaryListKeys(PyObject *self) DictionaryListKeys(PyObject *self UNUSED)
{ {
dict_T *dict = ((DictionaryObject *)(self))->dict; dict_T *dict = ((DictionaryObject *)(self))->dict;
long_u todo = dict->dv_hashtab.ht_used; long_u todo = dict->dv_hashtab.ht_used;
@@ -2549,7 +2537,6 @@ set_string_copy(char_u *str, typval_T *tv)
return 0; return 0;
} }
#ifdef FEAT_EVAL
typedef int (*pytotvfunc)(PyObject *, typval_T *, PyObject *); typedef int (*pytotvfunc)(PyObject *, typval_T *, PyObject *);
static int static int
@@ -2781,4 +2768,3 @@ ConvertToPyObject(typval_T *tv)
return NULL; return NULL;
} }
} }
#endif

View File

@@ -2292,7 +2292,9 @@ op_function(oap)
{ {
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
char_u *(argv[1]); char_u *(argv[1]);
# ifdef FEAT_VIRTUALEDIT
int save_virtual_op = virtual_op; int save_virtual_op = virtual_op;
# endif
if (*p_opfunc == NUL) if (*p_opfunc == NUL)
EMSG(_("E774: 'operatorfunc' is empty")); EMSG(_("E774: 'operatorfunc' is empty"));
@@ -2312,13 +2314,17 @@ op_function(oap)
else else
argv[0] = (char_u *)"char"; argv[0] = (char_u *)"char";
# ifdef FEAT_VIRTUALEDIT
/* Reset virtual_op so that 'virtualedit' can be changed in the /* Reset virtual_op so that 'virtualedit' can be changed in the
* function. */ * function. */
virtual_op = MAYBE; virtual_op = MAYBE;
# endif
(void)call_func_retnr(p_opfunc, 1, argv, FALSE); (void)call_func_retnr(p_opfunc, 1, argv, FALSE);
# ifdef FEAT_VIRTUALEDIT
virtual_op = save_virtual_op; virtual_op = save_virtual_op;
# endif
} }
#else #else
EMSG(_("E775: Eval feature not available")); EMSG(_("E775: Eval feature not available"));

View File

@@ -725,6 +725,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
819,
/**/ /**/
818, 818,
/**/ /**/