Mercurial > vim
comparison src/if_python.c @ 15470:55ccc2d353bd v8.1.0743
patch 8.1.0743: giving error messages is not flexible
commit https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 13 23:38:42 2019 +0100
patch 8.1.0743: giving error messages is not flexible
Problem: Giving error messages is not flexible.
Solution: Add semsg(). Change argument from "char_u *" to "char *", also
for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
#3302) Also make emsg() accept a "char *" argument. Get rid of
an enormous number of type casts.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 13 Jan 2019 23:45:08 +0100 |
parents | 1d2b5c016f17 |
children | 3f92851b9a57 |
comparison
equal
deleted
inserted
replaced
15469:bc9b5261ed01 | 15470:55ccc2d353bd |
---|---|
683 * It cause a crash, because RTLD_GLOBAL is needed for | 683 * It cause a crash, because RTLD_GLOBAL is needed for |
684 * standard C extension libraries of one or both python versions. */ | 684 * standard C extension libraries of one or both python versions. */ |
685 if (python3_loaded()) | 685 if (python3_loaded()) |
686 { | 686 { |
687 if (verbose) | 687 if (verbose) |
688 EMSG(_("E836: This Vim cannot execute :python after using :py3")); | 688 emsg(_("E836: This Vim cannot execute :python after using :py3")); |
689 return FAIL; | 689 return FAIL; |
690 } | 690 } |
691 #endif | 691 #endif |
692 | 692 |
693 if (hinstPython) | 693 if (hinstPython) |
694 return OK; | 694 return OK; |
695 hinstPython = load_dll(libname); | 695 hinstPython = load_dll(libname); |
696 if (!hinstPython) | 696 if (!hinstPython) |
697 { | 697 { |
698 if (verbose) | 698 if (verbose) |
699 EMSG2(_(e_loadlib), libname); | 699 semsg(_(e_loadlib), libname); |
700 return FAIL; | 700 return FAIL; |
701 } | 701 } |
702 | 702 |
703 for (i = 0; python_funcname_table[i].ptr; ++i) | 703 for (i = 0; python_funcname_table[i].ptr; ++i) |
704 { | 704 { |
706 python_funcname_table[i].name)) == NULL) | 706 python_funcname_table[i].name)) == NULL) |
707 { | 707 { |
708 close_dll(hinstPython); | 708 close_dll(hinstPython); |
709 hinstPython = 0; | 709 hinstPython = 0; |
710 if (verbose) | 710 if (verbose) |
711 EMSG2(_(e_loadfunc), python_funcname_table[i].name); | 711 semsg(_(e_loadfunc), python_funcname_table[i].name); |
712 return FAIL; | 712 return FAIL; |
713 } | 713 } |
714 } | 714 } |
715 | 715 |
716 /* Load unicode functions separately as only the ucs2 or the ucs4 functions | 716 /* Load unicode functions separately as only the ucs2 or the ucs4 functions |
723 if (*ucs_as_encoded_string == NULL) | 723 if (*ucs_as_encoded_string == NULL) |
724 { | 724 { |
725 close_dll(hinstPython); | 725 close_dll(hinstPython); |
726 hinstPython = 0; | 726 hinstPython = 0; |
727 if (verbose) | 727 if (verbose) |
728 EMSG2(_(e_loadfunc), "PyUnicode_UCSX_*"); | 728 semsg(_(e_loadfunc), "PyUnicode_UCSX_*"); |
729 return FAIL; | 729 return FAIL; |
730 } | 730 } |
731 | 731 |
732 return OK; | 732 return OK; |
733 } | 733 } |
926 #endif | 926 #endif |
927 | 927 |
928 #ifdef DYNAMIC_PYTHON | 928 #ifdef DYNAMIC_PYTHON |
929 if (!python_enabled(TRUE)) | 929 if (!python_enabled(TRUE)) |
930 { | 930 { |
931 EMSG(_("E263: Sorry, this command is disabled, the Python library could not be loaded.")); | 931 emsg(_("E263: Sorry, this command is disabled, the Python library could not be loaded.")); |
932 goto fail; | 932 goto fail; |
933 } | 933 } |
934 #endif | 934 #endif |
935 | 935 |
936 if (*p_pyhome != NUL) | 936 if (*p_pyhome != NUL) |
958 #if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000 | 958 #if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000 |
959 /* 'import site' explicitly. */ | 959 /* 'import site' explicitly. */ |
960 site = PyImport_ImportModule("site"); | 960 site = PyImport_ImportModule("site"); |
961 if (site == NULL) | 961 if (site == NULL) |
962 { | 962 { |
963 EMSG(_("E887: Sorry, this command is disabled, the Python's site module could not be loaded.")); | 963 emsg(_("E887: Sorry, this command is disabled, the Python's site module could not be loaded.")); |
964 goto fail; | 964 goto fail; |
965 } | 965 } |
966 Py_DECREF(site); | 966 Py_DECREF(site); |
967 #endif | 967 #endif |
968 | 968 |
1033 #endif | 1033 #endif |
1034 | 1034 |
1035 #ifndef PY_CAN_RECURSE | 1035 #ifndef PY_CAN_RECURSE |
1036 if (recursive) | 1036 if (recursive) |
1037 { | 1037 { |
1038 EMSG(_("E659: Cannot invoke Python recursively")); | 1038 emsg(_("E659: Cannot invoke Python recursively")); |
1039 return; | 1039 return; |
1040 } | 1040 } |
1041 ++recursive; | 1041 ++recursive; |
1042 #endif | 1042 #endif |
1043 if (python_end_called) | 1043 if (python_end_called) |