comparison src/if_py_both.h @ 4133:36fd800b8c6c v7.3.819

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.
author Bram Moolenaar <bram@vim.org>
date Thu, 14 Feb 2013 22:11:39 +0100
parents 3e22fe67fa69
children d8acfc49d94e
comparison
equal deleted inserted replaced
4132:97c9942586a4 4133:36fd800b8c6c
308 308
309 Py_XINCREF(result); 309 Py_XINCREF(result);
310 return result; 310 return result;
311 } 311 }
312 312
313 #ifdef FEAT_EVAL
314 /* 313 /*
315 * Function to translate a typval_T into a PyObject; this will recursively 314 * Function to translate a typval_T into a PyObject; this will recursively
316 * translate lists/dictionaries into their Python equivalents. 315 * translate lists/dictionaries into their Python equivalents.
317 * 316 *
318 * The depth parameter is to avoid infinite recursion, set it to 1 when 317 * The depth parameter is to avoid infinite recursion, set it to 1 when
423 result = Py_None; 422 result = Py_None;
424 } 423 }
425 424
426 return result; 425 return result;
427 } 426 }
428 #endif
429 427
430 static PyObject * 428 static PyObject *
431 VimEval(PyObject *self UNUSED, PyObject *args UNUSED) 429 VimEval(PyObject *self UNUSED, PyObject *args UNUSED)
432 { 430 {
433 #ifdef FEAT_EVAL
434 char *expr; 431 char *expr;
435 typval_T *our_tv; 432 typval_T *our_tv;
436 PyObject *result; 433 PyObject *result;
437 PyObject *lookup_dict; 434 PyObject *lookup_dict;
438 435
464 free_tv(our_tv); 461 free_tv(our_tv);
465 Python_Release_Vim(); 462 Python_Release_Vim();
466 Py_END_ALLOW_THREADS 463 Py_END_ALLOW_THREADS
467 464
468 return result; 465 return result;
469 #else
470 PyErr_SetVim(_("expressions disabled at compile time"));
471 return NULL;
472 #endif
473 } 466 }
474 467
475 static PyObject *ConvertToPyObject(typval_T *); 468 static PyObject *ConvertToPyObject(typval_T *);
476 469
477 static PyObject * 470 static PyObject *
478 VimEvalPy(PyObject *self UNUSED, PyObject *args UNUSED) 471 VimEvalPy(PyObject *self UNUSED, PyObject *args UNUSED)
479 { 472 {
480 #ifdef FEAT_EVAL
481 char *expr; 473 char *expr;
482 typval_T *our_tv; 474 typval_T *our_tv;
483 PyObject *result; 475 PyObject *result;
484 476
485 if (!PyArg_ParseTuple(args, "s", &expr)) 477 if (!PyArg_ParseTuple(args, "s", &expr))
504 free_tv(our_tv); 496 free_tv(our_tv);
505 Python_Release_Vim(); 497 Python_Release_Vim();
506 Py_END_ALLOW_THREADS 498 Py_END_ALLOW_THREADS
507 499
508 return result; 500 return result;
509 #else
510 PyErr_SetVim(_("expressions disabled at compile time"));
511 return NULL;
512 #endif
513 } 501 }
514 502
515 static PyObject * 503 static PyObject *
516 VimStrwidth(PyObject *self UNUSED, PyObject *args) 504 VimStrwidth(PyObject *self UNUSED, PyObject *args)
517 { 505 {
944 copy_tv(&tv, &di->di_tv); 932 copy_tv(&tv, &di->di_tv);
945 return 0; 933 return 0;
946 } 934 }
947 935
948 static PyObject * 936 static PyObject *
949 DictionaryListKeys(PyObject *self) 937 DictionaryListKeys(PyObject *self UNUSED)
950 { 938 {
951 dict_T *dict = ((DictionaryObject *)(self))->dict; 939 dict_T *dict = ((DictionaryObject *)(self))->dict;
952 long_u todo = dict->dv_hashtab.ht_used; 940 long_u todo = dict->dv_hashtab.ht_used;
953 Py_ssize_t i = 0; 941 Py_ssize_t i = 0;
954 PyObject *r; 942 PyObject *r;
2547 return -1; 2535 return -1;
2548 } 2536 }
2549 return 0; 2537 return 0;
2550 } 2538 }
2551 2539
2552 #ifdef FEAT_EVAL
2553 typedef int (*pytotvfunc)(PyObject *, typval_T *, PyObject *); 2540 typedef int (*pytotvfunc)(PyObject *, typval_T *, PyObject *);
2554 2541
2555 static int 2542 static int
2556 convert_dl(PyObject *obj, typval_T *tv, 2543 convert_dl(PyObject *obj, typval_T *tv,
2557 pytotvfunc py_to_tv, PyObject *lookupDict) 2544 pytotvfunc py_to_tv, PyObject *lookupDict)
2779 default: 2766 default:
2780 PyErr_SetVim(_("internal error: invalid value type")); 2767 PyErr_SetVim(_("internal error: invalid value type"));
2781 return NULL; 2768 return NULL;
2782 } 2769 }
2783 } 2770 }
2784 #endif