From 2eae5db069dc171f74cd863487655f6a88e5384d Mon Sep 17 00:00:00 2001 From: Mehmet Samet Duman Date: Fri, 3 Apr 2026 22:21:25 +0300 Subject: NOISSUE rebrand vim to MNV's not Vim Signed-off-by: Mehmet Samet Duman --- uvim/src/GmnvExt/GmnvExt.reg | 20 + uvim/src/GmnvExt/Make_ming.mak | 96 + uvim/src/GmnvExt/Make_mvc.mak | 102 + uvim/src/GmnvExt/Makefile | 4 + uvim/src/GmnvExt/README.txt | 94 + uvim/src/GmnvExt/gmnvext.cpp | 1065 ++ uvim/src/GmnvExt/gmnvext.def | 8 + uvim/src/GmnvExt/gmnvext.h | 167 + uvim/src/GmnvExt/gmnvext.inf | 22 + uvim/src/GmnvExt/gmnvext.rc | 109 + uvim/src/GmnvExt/gmnvext_ming.def | 10 + uvim/src/GmnvExt/gmnvext_ming.rc | 45 + uvim/src/GmnvExt/resource.h | 15 + uvim/src/GmnvExt/uninst.bat | 1 + uvim/src/GvimExt/GvimExt.reg | 20 - uvim/src/GvimExt/Make_ming.mak | 96 - uvim/src/GvimExt/Make_mvc.mak | 102 - uvim/src/GvimExt/Makefile | 4 - uvim/src/GvimExt/README.txt | 94 - uvim/src/GvimExt/gvimext.cpp | 1065 -- uvim/src/GvimExt/gvimext.def | 8 - uvim/src/GvimExt/gvimext.h | 167 - uvim/src/GvimExt/gvimext.inf | 22 - uvim/src/GvimExt/gvimext.rc | 109 - uvim/src/GvimExt/gvimext_ming.def | 10 - uvim/src/GvimExt/gvimext_ming.rc | 45 - uvim/src/GvimExt/resource.h | 15 - uvim/src/GvimExt/uninst.bat | 1 - uvim/src/INSTALL | 48 +- uvim/src/INSTALLami.txt | 6 +- uvim/src/INSTALLmac.txt | 16 +- uvim/src/INSTALLpc.txt | 254 +- uvim/src/INSTALLvms.txt | 88 +- uvim/src/INSTALLx.txt | 42 +- uvim/src/Make_ami.mak | 30 +- uvim/src/Make_cyg.mak | 6 +- uvim/src/Make_cyg_ming.mak | 180 +- uvim/src/Make_ming.mak | 6 +- uvim/src/Make_mvc.mak | 330 +- uvim/src/Make_vms.mms | 436 +- uvim/src/Makefile | 1230 +- uvim/src/README.md | 50 +- uvim/src/alloc.c | 54 +- uvim/src/alloc.h | 6 +- uvim/src/arabic.c | 10 +- uvim/src/arglist.c | 66 +- uvim/src/ascii.h | 6 +- uvim/src/auto/configure | 350 +- uvim/src/auto/nmake/tools.mak | 2 +- uvim/src/auto/wayland/Makefile | 2 +- uvim/src/auto/wayland/README.txt | 2 +- uvim/src/autocmd.c | 220 +- uvim/src/beval.c | 36 +- uvim/src/beval.h | 6 +- uvim/src/bigmnv.bat | 5 + uvim/src/bigmnv64.bat | 7 + uvim/src/bigvim.bat | 5 - uvim/src/bigvim64.bat | 7 - uvim/src/blob.c | 38 +- uvim/src/blowfish.c | 14 +- uvim/src/buffer.c | 336 +- uvim/src/bufwrite.c | 114 +- uvim/src/change.c | 80 +- uvim/src/channel.c | 152 +- uvim/src/charset.c | 170 +- uvim/src/cindent.c | 118 +- uvim/src/clientserver.c | 152 +- uvim/src/clipboard.c | 150 +- uvim/src/cmdexpand.c | 278 +- uvim/src/cmdhist.c | 78 +- uvim/src/config.h.in | 12 +- uvim/src/config.mk.dist | 4 +- uvim/src/config.mk.in | 8 +- uvim/src/configure.ac | 288 +- uvim/src/create_cmdidxs.mnv | 104 + uvim/src/create_cmdidxs.vim | 104 - uvim/src/create_nvcmdidxs.c | 10 +- uvim/src/create_nvcmdidxs.mnv | 60 + uvim/src/create_nvcmdidxs.vim | 60 - uvim/src/crypt.c | 50 +- uvim/src/crypt_zip.c | 10 +- uvim/src/debugger.c | 74 +- uvim/src/dict.c | 78 +- uvim/src/diff.c | 154 +- uvim/src/digraph.c | 166 +- uvim/src/dosinst.c | 794 +- uvim/src/dosinst.h | 76 +- uvim/src/drawline.c | 92 +- uvim/src/drawscreen.c | 52 +- uvim/src/edit.c | 162 +- uvim/src/errors.h | 202 +- uvim/src/eval.c | 448 +- uvim/src/evalbuffer.c | 58 +- uvim/src/evalfunc.c | 542 +- uvim/src/evalvars.c | 782 +- uvim/src/evalwindow.c | 78 +- uvim/src/ex_cmdidxs.h | 2 +- uvim/src/ex_cmds.c | 402 +- uvim/src/ex_cmds.h | 28 +- uvim/src/ex_cmds2.c | 46 +- uvim/src/ex_docmd.c | 500 +- uvim/src/ex_eval.c | 138 +- uvim/src/ex_getln.c | 148 +- uvim/src/feature.h | 116 +- uvim/src/fileio.c | 332 +- uvim/src/filepath.c | 518 +- uvim/src/findfile.c | 354 +- uvim/src/float.c | 70 +- uvim/src/fold.c | 72 +- uvim/src/fuzzy.c | 46 +- uvim/src/gc.c | 14 +- uvim/src/getchar.c | 96 +- uvim/src/globals.h | 52 +- uvim/src/gmnvtutor | 8 + uvim/src/gui.c | 278 +- uvim/src/gui.h | 48 +- uvim/src/gui_beval.c | 32 +- uvim/src/gui_dwrite.cpp | 8 +- uvim/src/gui_dwrite.h | 2 +- uvim/src/gui_gtk.c | 278 +- uvim/src/gui_gtk_f.c | 10 +- uvim/src/gui_gtk_f.h | 6 +- uvim/src/gui_gtk_res.xml | 28 +- uvim/src/gui_gtk_vms.h | 10 +- uvim/src/gui_gtk_x11.c | 304 +- uvim/src/gui_haiku.cc | 1218 +- uvim/src/gui_haiku.h | 32 +- uvim/src/gui_motif.c | 150 +- uvim/src/gui_photon.c | 352 +- uvim/src/gui_w32.c | 396 +- uvim/src/gui_x11.c | 216 +- uvim/src/gui_x11_pm.h | 8 +- uvim/src/gui_xim.c | 62 +- uvim/src/gui_xmdlg.c | 34 +- uvim/src/gui_xmebw.c | 10 +- uvim/src/gui_xmebw.h | 8 +- uvim/src/gui_xmebwp.h | 8 +- uvim/src/gvimtutor | 8 - uvim/src/hardcopy.c | 118 +- uvim/src/hashtab.c | 20 +- uvim/src/help.c | 78 +- uvim/src/highlight.c | 184 +- uvim/src/if_cscope.c | 212 +- uvim/src/if_lua.c | 298 +- uvim/src/if_mzsch.c | 596 +- uvim/src/if_mzsch.h | 2 +- uvim/src/if_ole.cpp | 148 +- uvim/src/if_ole.h | 120 +- uvim/src/if_ole.idl | 26 +- uvim/src/if_perl.xs | 252 +- uvim/src/if_py_both.h | 548 +- uvim/src/if_python.c | 42 +- uvim/src/if_python3.c | 70 +- uvim/src/if_ruby.c | 170 +- uvim/src/if_tcl.c | 206 +- uvim/src/if_xcmdsrv.c | 104 +- uvim/src/iid_ole.c | 6 +- uvim/src/indent.c | 104 +- uvim/src/insexpand.c | 268 +- uvim/src/installman.sh | 110 +- uvim/src/installml.sh | 116 +- uvim/src/iscygpty.c | 4 +- uvim/src/iscygpty.h | 2 +- uvim/src/job.c | 94 +- uvim/src/json.c | 48 +- uvim/src/json_test.c | 10 +- uvim/src/keymap.h | 6 +- uvim/src/kword_test.c | 20 +- uvim/src/libvterm/README | 6 +- uvim/src/libvterm/include/vterm.h | 18 +- uvim/src/libvterm/src/encoding.c | 2 +- uvim/src/libvterm/src/keyboard.c | 8 +- uvim/src/libvterm/src/pen.c | 2 +- uvim/src/libvterm/src/screen.c | 2 +- uvim/src/libvterm/src/unicode.c | 2 +- uvim/src/libvterm/src/vterm.c | 2 +- uvim/src/libvterm/t/63screen_resize.test | 4 +- uvim/src/libvterm/t/69screen_reflow.test | 2 +- uvim/src/linematch.c | 14 +- uvim/src/link.sh | 14 +- uvim/src/list.c | 130 +- uvim/src/locale.c | 72 +- uvim/src/logfile.c | 22 +- uvim/src/macros.h | 42 +- uvim/src/main.c | 522 +- uvim/src/map.c | 218 +- uvim/src/mark.c | 96 +- uvim/src/match.c | 76 +- uvim/src/mbyte.c | 176 +- uvim/src/memfile.c | 72 +- uvim/src/memfile_test.c | 12 +- uvim/src/memline.c | 254 +- uvim/src/menu.c | 282 +- uvim/src/message.c | 214 +- uvim/src/message_test.c | 206 +- uvim/src/misc1.c | 360 +- uvim/src/misc2.c | 124 +- uvim/src/mnv.h | 3096 +++++ uvim/src/mnv.ico | Bin 0 -> 100197 bytes uvim/src/mnv.manifest | 59 + uvim/src/mnv.rc | 136 + uvim/src/mnv.tlb | Bin 0 -> 1792 bytes uvim/src/mnv9.h | 901 ++ uvim/src/mnv9class.c | 4424 +++++++ uvim/src/mnv9cmds.c | 2813 +++++ uvim/src/mnv9compile.c | 5280 +++++++++ uvim/src/mnv9execute.c | 8207 +++++++++++++ uvim/src/mnv9expr.c | 4071 +++++++ uvim/src/mnv9generics.c | 1312 ++ uvim/src/mnv9instr.c | 3008 +++++ uvim/src/mnv9script.c | 1162 ++ uvim/src/mnv9type.c | 2896 +++++ uvim/src/mnv_alert.ico | Bin 0 -> 10134 bytes uvim/src/mnv_error.ico | Bin 0 -> 10134 bytes uvim/src/mnv_icon.xbm | 14 + uvim/src/mnv_info.ico | Bin 0 -> 10134 bytes uvim/src/mnv_mask.xbm | 14 + uvim/src/mnv_quest.ico | Bin 0 -> 10134 bytes uvim/src/mnvinfo.c | 3396 ++++++ uvim/src/mnvrun.c | 113 + uvim/src/mnvtutor | 213 + uvim/src/mouse.c | 22 +- uvim/src/move.c | 14 +- uvim/src/nbdebug.c | 28 +- uvim/src/nbdebug.h | 10 +- uvim/src/netbeans.c | 206 +- uvim/src/normal.c | 204 +- uvim/src/nv_cmdidxs.h | 2 +- uvim/src/nv_cmds.h | 12 +- uvim/src/ops.c | 180 +- uvim/src/option.c | 621 +- uvim/src/option.h | 38 +- uvim/src/optiondefs.h | 232 +- uvim/src/optionstr.c | 272 +- uvim/src/os_amiga.c | 72 +- uvim/src/os_amiga.h | 84 +- uvim/src/os_dos.h | 80 +- uvim/src/os_haiku.h | 46 +- uvim/src/os_haiku.rdef.in | 6 +- uvim/src/os_mac.h | 78 +- uvim/src/os_mac_conv.c | 36 +- uvim/src/os_macosx.m | 36 +- uvim/src/os_mswin.c | 240 +- uvim/src/os_qnx.c | 40 +- uvim/src/os_qnx.h | 6 +- uvim/src/os_unix.c | 566 +- uvim/src/os_unix.h | 136 +- uvim/src/os_unixx.h | 6 +- uvim/src/os_vms.c | 24 +- uvim/src/os_vms_conf.h | 4 +- uvim/src/os_vms_mms.c | 8 +- uvim/src/os_w32dll.c | 8 +- uvim/src/os_w32exe.c | 32 +- uvim/src/os_win32.c | 560 +- uvim/src/os_win32.h | 14 +- uvim/src/osdef.sh | 2 +- uvim/src/osdef1.h.in | 4 +- uvim/src/pathdef.sh | 2 +- uvim/src/po/Make_all.mak | 10 +- uvim/src/po/Make_cyg.mak | 38 +- uvim/src/po/Make_ming.mak | 54 +- uvim/src/po/Make_mvc.mak | 86 +- uvim/src/po/Makefile | 84 +- uvim/src/po/README.txt | 60 +- uvim/src/po/README_mingw.txt | 28 +- uvim/src/po/README_mvc.txt | 32 +- uvim/src/po/af.po | 948 +- uvim/src/po/big5corr.c | 6 +- uvim/src/po/ca.po | 3808 +++--- uvim/src/po/check.mnv | 340 + uvim/src/po/check.vim | 340 - uvim/src/po/cleanup.mnv | 37 + uvim/src/po/cleanup.vim | 37 - uvim/src/po/cs.cp1250.po | 240 +- uvim/src/po/cs.po | 240 +- uvim/src/po/da.po | 568 +- uvim/src/po/de.po | 3126 ++--- uvim/src/po/en_GB.po | 30 +- uvim/src/po/eo.po | 646 +- uvim/src/po/es.po | 698 +- uvim/src/po/fi.po | 678 +- uvim/src/po/fixfilenames.mnv | 15 + uvim/src/po/fixfilenames.vim | 15 - uvim/src/po/fr.po | 3186 ++--- uvim/src/po/ga.po | 5038 ++++---- uvim/src/po/gmnv.desktop.in | 77 + uvim/src/po/gvim.desktop.in | 77 - uvim/src/po/hu.po | 504 +- uvim/src/po/hy.po | 678 +- uvim/src/po/it.po | 702 +- uvim/src/po/ja.euc-jp.po | 428 +- uvim/src/po/ja.po | 424 +- uvim/src/po/ja.sjis.po | 424 +- uvim/src/po/ko.UTF-8.po | 432 +- uvim/src/po/ko.po | 432 +- uvim/src/po/lv.po | 34 +- uvim/src/po/mnv.desktop.in | 77 + uvim/src/po/mnv.pot | 10730 +++++++++++++++++ uvim/src/po/nb.po | 1292 +- uvim/src/po/nl.po | 348 +- uvim/src/po/no.po | 1292 +- uvim/src/po/pl.UTF-8.po | 304 +- uvim/src/po/pl.cp1250.po | 304 +- uvim/src/po/pl.po | 304 +- uvim/src/po/pt_BR.po | 550 +- uvim/src/po/ru.cp1251.po | 8448 ++++++------- uvim/src/po/ru.po | 416 +- uvim/src/po/sjiscorr.c | 2 +- uvim/src/po/sk.cp1250.po | 302 +- uvim/src/po/sk.po | 302 +- uvim/src/po/sr.po | 696 +- uvim/src/po/sv.po | 706 +- uvim/src/po/ta.po | 628 +- uvim/src/po/tojavascript.mnv | 24 + uvim/src/po/tojavascript.vim | 24 - uvim/src/po/tr.po | 682 +- uvim/src/po/uk.cp1251.po | 422 +- uvim/src/po/uk.po | 420 +- uvim/src/po/vi.po | 462 +- uvim/src/po/vim.desktop.in | 77 - uvim/src/po/vim.pot | 10730 ----------------- uvim/src/po/zh_CN.UTF-8.po | 684 +- uvim/src/po/zh_CN.cp936.po | 684 +- uvim/src/po/zh_CN.po | 684 +- uvim/src/po/zh_TW.UTF-8.po | 486 +- uvim/src/po/zh_TW.po | 486 +- uvim/src/popupmenu.c | 68 +- uvim/src/popupwin.c | 134 +- uvim/src/profiler.c | 28 +- uvim/src/proto.h | 52 +- uvim/src/proto/alloc.pro | 8 +- uvim/src/proto/arabic.pro | 2 +- uvim/src/proto/arglist.pro | 2 +- uvim/src/proto/autocmd.pro | 2 +- uvim/src/proto/beval.pro | 2 +- uvim/src/proto/blob.pro | 2 +- uvim/src/proto/blowfish.pro | 2 +- uvim/src/proto/buffer.pro | 2 +- uvim/src/proto/bufwrite.pro | 2 +- uvim/src/proto/change.pro | 2 +- uvim/src/proto/channel.pro | 2 +- uvim/src/proto/charset.pro | 48 +- uvim/src/proto/cindent.pro | 2 +- uvim/src/proto/clientserver.pro | 4 +- uvim/src/proto/clipboard.pro | 2 +- uvim/src/proto/cmdexpand.pro | 2 +- uvim/src/proto/cmdhist.pro | 2 +- uvim/src/proto/crypt.pro | 2 +- uvim/src/proto/crypt_zip.pro | 2 +- uvim/src/proto/debugger.pro | 2 +- uvim/src/proto/dict.pro | 2 +- uvim/src/proto/diff.pro | 2 +- uvim/src/proto/digraph.pro | 2 +- uvim/src/proto/drawline.pro | 2 +- uvim/src/proto/drawscreen.pro | 2 +- uvim/src/proto/edit.pro | 2 +- uvim/src/proto/eval.pro | 6 +- uvim/src/proto/evalbuffer.pro | 2 +- uvim/src/proto/evalfunc.pro | 4 +- uvim/src/proto/evalvars.pro | 48 +- uvim/src/proto/evalwindow.pro | 2 +- uvim/src/proto/ex_cmds.pro | 6 +- uvim/src/proto/ex_cmds2.pro | 2 +- uvim/src/proto/ex_docmd.pro | 4 +- uvim/src/proto/ex_eval.pro | 2 +- uvim/src/proto/ex_getln.pro | 4 +- uvim/src/proto/fileio.pro | 14 +- uvim/src/proto/filepath.pro | 16 +- uvim/src/proto/findfile.pro | 12 +- uvim/src/proto/float.pro | 4 +- uvim/src/proto/fold.pro | 2 +- uvim/src/proto/fuzzy.pro | 2 +- uvim/src/proto/gc.pro | 2 +- uvim/src/proto/gen_prototypes.py | 8 +- uvim/src/proto/getchar.pro | 2 +- uvim/src/proto/gui.pro | 4 +- uvim/src/proto/gui_beval.pro | 2 +- uvim/src/proto/gui_gtk.pro | 12 +- uvim/src/proto/gui_gtk_gresources.pro | 2 +- uvim/src/proto/gui_gtk_x11.pro | 6 +- uvim/src/proto/gui_haiku.pro | 14 +- uvim/src/proto/gui_motif.pro | 12 +- uvim/src/proto/gui_photon.pro | 18 +- uvim/src/proto/gui_w32.pro | 14 +- uvim/src/proto/gui_x11.pro | 10 +- uvim/src/proto/gui_xim.pro | 2 +- uvim/src/proto/gui_xmdlg.pro | 2 +- uvim/src/proto/hardcopy.pro | 2 +- uvim/src/proto/hashtab.pro | 2 +- uvim/src/proto/help.pro | 2 +- uvim/src/proto/highlight.pro | 2 +- uvim/src/proto/if_cscope.pro | 2 +- uvim/src/proto/if_lua.pro | 2 +- uvim/src/proto/if_mzsch.pro | 6 +- uvim/src/proto/if_python.pro | 2 +- uvim/src/proto/if_python3.pro | 2 +- uvim/src/proto/if_ruby.pro | 4 +- uvim/src/proto/if_tcl.pro | 6 +- uvim/src/proto/if_xcmdsrv.pro | 6 +- uvim/src/proto/indent.pro | 2 +- uvim/src/proto/insexpand.pro | 4 +- uvim/src/proto/job.pro | 2 +- uvim/src/proto/json.pro | 2 +- uvim/src/proto/linematch.pro | 2 +- uvim/src/proto/list.pro | 4 +- uvim/src/proto/locale.pro | 2 +- uvim/src/proto/logfile.pro | 2 +- uvim/src/proto/main.pro | 6 +- uvim/src/proto/map.pro | 6 +- uvim/src/proto/mark.pro | 2 +- uvim/src/proto/match.pro | 2 +- uvim/src/proto/mbyte.pro | 10 +- uvim/src/proto/memfile.pro | 2 +- uvim/src/proto/memline.pro | 2 +- uvim/src/proto/menu.pro | 14 +- uvim/src/proto/message.pro | 8 +- uvim/src/proto/misc1.pro | 20 +- uvim/src/proto/misc2.pro | 10 +- uvim/src/proto/mnv9class.pro | 47 + uvim/src/proto/mnv9cmds.pro | 37 + uvim/src/proto/mnv9compile.pro | 36 + uvim/src/proto/mnv9execute.pro | 30 + uvim/src/proto/mnv9expr.pro | 19 + uvim/src/proto/mnv9generics.pro | 19 + uvim/src/proto/mnv9instr.pro | 89 + uvim/src/proto/mnv9script.pro | 23 + uvim/src/proto/mnv9type.pro | 45 + uvim/src/proto/mnvinfo.pro | 8 + uvim/src/proto/mouse.pro | 2 +- uvim/src/proto/move.pro | 2 +- uvim/src/proto/netbeans.pro | 2 +- uvim/src/proto/normal.pro | 2 +- uvim/src/proto/ops.pro | 2 +- uvim/src/proto/option.pro | 4 +- uvim/src/proto/optionstr.pro | 6 +- uvim/src/proto/os_amiga.pro | 2 +- uvim/src/proto/os_mac_conv.pro | 2 +- uvim/src/proto/os_macosx.pro | 2 +- uvim/src/proto/os_mswin.pro | 12 +- uvim/src/proto/os_qnx.pro | 2 +- uvim/src/proto/os_unix.pro | 16 +- uvim/src/proto/os_vms.pro | 2 +- uvim/src/proto/os_win32.pro | 10 +- uvim/src/proto/popupmenu.pro | 4 +- uvim/src/proto/popupwin.pro | 2 +- uvim/src/proto/profiler.pro | 2 +- uvim/src/proto/pty.pro | 2 +- uvim/src/proto/quickfix.pro | 4 +- uvim/src/proto/regexp.pro | 20 +- uvim/src/proto/register.pro | 2 +- uvim/src/proto/screen.pro | 2 +- uvim/src/proto/scriptfile.pro | 4 +- uvim/src/proto/search.pro | 2 +- uvim/src/proto/session.pro | 2 +- uvim/src/proto/sha256.pro | 2 +- uvim/src/proto/sign.pro | 2 +- uvim/src/proto/sound.pro | 2 +- uvim/src/proto/spell.pro | 2 +- uvim/src/proto/spellfile.pro | 2 +- uvim/src/proto/spellsuggest.pro | 2 +- uvim/src/proto/strings.pro | 36 +- uvim/src/proto/syntax.pro | 2 +- uvim/src/proto/tabpanel.pro | 2 +- uvim/src/proto/tag.pro | 2 +- uvim/src/proto/term.pro | 2 +- uvim/src/proto/terminal.pro | 2 +- uvim/src/proto/termlib.pro | 2 +- uvim/src/proto/testing.pro | 2 +- uvim/src/proto/textformat.pro | 2 +- uvim/src/proto/textobject.pro | 2 +- uvim/src/proto/textprop.pro | 2 +- uvim/src/proto/time.pro | 4 +- uvim/src/proto/tuple.pro | 2 +- uvim/src/proto/typval.pro | 2 +- uvim/src/proto/ui.pro | 10 +- uvim/src/proto/undo.pro | 2 +- uvim/src/proto/usercmd.pro | 2 +- uvim/src/proto/userfunc.pro | 2 +- uvim/src/proto/version.pro | 2 +- uvim/src/proto/vim9class.pro | 47 - uvim/src/proto/vim9cmds.pro | 37 - uvim/src/proto/vim9compile.pro | 36 - uvim/src/proto/vim9execute.pro | 30 - uvim/src/proto/vim9expr.pro | 19 - uvim/src/proto/vim9generics.pro | 19 - uvim/src/proto/vim9instr.pro | 89 - uvim/src/proto/vim9script.pro | 23 - uvim/src/proto/vim9type.pro | 45 - uvim/src/proto/viminfo.pro | 8 - uvim/src/proto/wayland.pro | 2 +- uvim/src/proto/winclip.pro | 2 +- uvim/src/proto/window.pro | 2 +- uvim/src/protodef.h | 6 +- uvim/src/pty.c | 30 +- uvim/src/quickfix.c | 354 +- uvim/src/regexp.c | 198 +- uvim/src/regexp.h | 12 +- uvim/src/regexp_bt.c | 104 +- uvim/src/regexp_nfa.c | 104 +- uvim/src/register.c | 174 +- uvim/src/screen.c | 156 +- uvim/src/scriptfile.c | 308 +- uvim/src/search.c | 216 +- uvim/src/session.c | 94 +- uvim/src/sha256.c | 18 +- uvim/src/sign.c | 134 +- uvim/src/sound.c | 46 +- uvim/src/spell.c | 210 +- uvim/src/spell.h | 14 +- uvim/src/spellfile.c | 304 +- uvim/src/spellsuggest.c | 100 +- uvim/src/strings.c | 294 +- uvim/src/structs.h | 88 +- uvim/src/syntax.c | 232 +- uvim/src/tabpanel.c | 22 +- uvim/src/tag.c | 294 +- uvim/src/tee/Make_mvc.mak | 2 +- uvim/src/tee/tee.c | 8 +- uvim/src/term.c | 186 +- uvim/src/termdefs.h | 6 +- uvim/src/terminal.c | 372 +- uvim/src/termlib.c | 22 +- uvim/src/testdir/Make_all.mak | 80 +- uvim/src/testdir/Make_amiga.mak | 10 +- uvim/src/testdir/Make_ming.mak | 62 +- uvim/src/testdir/Make_mvc.mak | 72 +- uvim/src/testdir/Make_vms.mms | 18 +- uvim/src/testdir/Makefile | 102 +- uvim/src/testdir/README.txt | 38 +- uvim/src/testdir/commondumps.mnv | 229 + uvim/src/testdir/commondumps.vim | 229 - uvim/src/testdir/crash/crash_scrollbar | 4 +- uvim/src/testdir/crash/mnv_msg_trunc_poc | 1 + uvim/src/testdir/crash/mnv_regsub_both | 10 + uvim/src/testdir/crash/mnv_regsub_both_poc | Bin 0 -> 244 bytes uvim/src/testdir/crash/poc_tagfunc.mnv | 6 + uvim/src/testdir/crash/poc_tagfunc.vim | 6 - uvim/src/testdir/crash/vim_msg_trunc_poc | 1 - uvim/src/testdir/crash/vim_regsub_both | 10 - uvim/src/testdir/crash/vim_regsub_both_poc | Bin 244 -> 0 bytes .../testdir/dumps/Test_incsearch_mnvgrep_01.dump | 9 + .../testdir/dumps/Test_incsearch_mnvgrep_02.dump | 9 + .../testdir/dumps/Test_incsearch_mnvgrep_03.dump | 9 + .../testdir/dumps/Test_incsearch_mnvgrep_04.dump | 9 + .../testdir/dumps/Test_incsearch_mnvgrep_05.dump | 9 + .../testdir/dumps/Test_incsearch_vimgrep_01.dump | 9 - .../testdir/dumps/Test_incsearch_vimgrep_02.dump | 9 - .../testdir/dumps/Test_incsearch_vimgrep_03.dump | 9 - .../testdir/dumps/Test_incsearch_vimgrep_04.dump | 9 - .../testdir/dumps/Test_incsearch_vimgrep_05.dump | 9 - .../src/testdir/dumps/Test_mnv9_closure_fails.dump | 6 + uvim/src/testdir/dumps/Test_mnv9_no_redraw.dump | 6 + .../dumps/Test_mnv9_reject_declaration_1.dump | 6 + .../dumps/Test_mnv9_reject_declaration_2.dump | 6 + uvim/src/testdir/dumps/Test_mnv9_silent_echo.dump | 6 + uvim/src/testdir/dumps/Test_popup_setbuf_04.mnv | 4 + uvim/src/testdir/dumps/Test_popup_setbuf_04.vim | 4 - uvim/src/testdir/dumps/Test_popup_setbuf_05.mnv | 4 + uvim/src/testdir/dumps/Test_popup_setbuf_05.vim | 4 - uvim/src/testdir/dumps/Test_popup_setbuf_06.mnv | 4 + uvim/src/testdir/dumps/Test_popup_setbuf_06.vim | 4 - .../dumps/Test_termdebug_evaluate_in_popup_01.mnv | 9 + .../dumps/Test_termdebug_evaluate_in_popup_01.vim | 9 - .../dumps/Test_termdebug_evaluate_in_popup_02.mnv | 6 + .../dumps/Test_termdebug_evaluate_in_popup_02.vim | 6 - uvim/src/testdir/dumps/Test_undo_after_write_1.mnv | 2 + uvim/src/testdir/dumps/Test_undo_after_write_1.vim | 2 - uvim/src/testdir/dumps/Test_undo_after_write_2.mnv | 2 + uvim/src/testdir/dumps/Test_undo_after_write_2.vim | 2 - uvim/src/testdir/dumps/Test_verbose_system_1.mnv | 5 + uvim/src/testdir/dumps/Test_verbose_system_1.vim | 5 - uvim/src/testdir/dumps/Test_verbose_system_2.mnv | 5 + uvim/src/testdir/dumps/Test_verbose_system_2.vim | 5 - .../src/testdir/dumps/Test_vim9_closure_fails.dump | 6 - uvim/src/testdir/dumps/Test_vim9_no_redraw.dump | 6 - .../dumps/Test_vim9_reject_declaration_1.dump | 6 - .../dumps/Test_vim9_reject_declaration_2.dump | 6 - uvim/src/testdir/dumps/Test_vim9_silent_echo.dump | 6 - uvim/src/testdir/dumps/Test_xxd_color_0.mnv | 2 + uvim/src/testdir/dumps/Test_xxd_color_0.vim | 2 - uvim/src/testdir/dumps/Test_xxd_color_1.mnv | 2 + uvim/src/testdir/dumps/Test_xxd_color_1.vim | 2 - uvim/src/testdir/keycode_check.mnv | 471 + uvim/src/testdir/keycode_check.vim | 471 - uvim/src/testdir/runtest.mnv | 691 ++ uvim/src/testdir/runtest.vim | 691 -- uvim/src/testdir/samples/Test_tohtml_basic.c.html | 10 +- .../samples/Test_tohtml_basic_no_css.c.html | 8 +- uvim/src/testdir/samples/matchparen.mnv | 234 + uvim/src/testdir/samples/matchparen.vim | 234 - uvim/src/testdir/samples/re.freeze.txt | 2 +- uvim/src/testdir/sautest/autoload/Test104.mnv | 1 + uvim/src/testdir/sautest/autoload/Test104.vim | 1 - uvim/src/testdir/sautest/autoload/auto9.mnv | 9 + uvim/src/testdir/sautest/autoload/auto9.vim | 9 - uvim/src/testdir/sautest/autoload/foo.mnv | 15 + uvim/src/testdir/sautest/autoload/foo.vim | 15 - uvim/src/testdir/sautest/autoload/footest.mnv | 5 + uvim/src/testdir/sautest/autoload/footest.vim | 5 - uvim/src/testdir/sautest/autoload/globone.mnv | 1 + uvim/src/testdir/sautest/autoload/globone.vim | 1 - uvim/src/testdir/sautest/autoload/globtwo.mnv | 1 + uvim/src/testdir/sautest/autoload/globtwo.vim | 1 - uvim/src/testdir/sautest/autoload/sourced.mnv | 4 + uvim/src/testdir/sautest/autoload/sourced.vim | 4 - uvim/src/testdir/test10.in | 8 +- uvim/src/testdir/test29.in | 2 +- uvim/src/testdir/test_alot.mnv | 31 + uvim/src/testdir/test_alot.vim | 31 - uvim/src/testdir/test_alot_latin.mnv | 7 + uvim/src/testdir/test_alot_latin.vim | 7 - uvim/src/testdir/test_alot_utf8.mnv | 14 + uvim/src/testdir/test_alot_utf8.vim | 14 - uvim/src/testdir/test_arabic.mnv | 592 + uvim/src/testdir/test_arabic.vim | 592 - uvim/src/testdir/test_arglist.mnv | 821 ++ uvim/src/testdir/test_arglist.vim | 821 -- uvim/src/testdir/test_assert.mnv | 527 + uvim/src/testdir/test_assert.vim | 527 - uvim/src/testdir/test_autochdir.mnv | 120 + uvim/src/testdir/test_autochdir.vim | 120 - uvim/src/testdir/test_autocmd.mnv | 5970 ++++++++++ uvim/src/testdir/test_autocmd.vim | 5970 ---------- uvim/src/testdir/test_autoload.mnv | 29 + uvim/src/testdir/test_autoload.vim | 29 - uvim/src/testdir/test_backspace_opt.mnv | 169 + uvim/src/testdir/test_backspace_opt.vim | 169 - uvim/src/testdir/test_backup.mnv | 86 + uvim/src/testdir/test_backup.vim | 86 - uvim/src/testdir/test_balloon.mnv | 97 + uvim/src/testdir/test_balloon.vim | 97 - uvim/src/testdir/test_balloon_gui.mnv | 20 + uvim/src/testdir/test_balloon_gui.vim | 20 - uvim/src/testdir/test_behave.mnv | 31 + uvim/src/testdir/test_behave.vim | 31 - uvim/src/testdir/test_bench_regexp.mnv | 23 + uvim/src/testdir/test_bench_regexp.vim | 23 - uvim/src/testdir/test_blob.mnv | 941 ++ uvim/src/testdir/test_blob.vim | 941 -- uvim/src/testdir/test_blockedit.mnv | 134 + uvim/src/testdir/test_blockedit.vim | 134 - uvim/src/testdir/test_breakindent.mnv | 1232 ++ uvim/src/testdir/test_breakindent.vim | 1232 -- uvim/src/testdir/test_buffer.mnv | 916 ++ uvim/src/testdir/test_buffer.vim | 916 -- uvim/src/testdir/test_bufline.mnv | 339 + uvim/src/testdir/test_bufline.vim | 339 - uvim/src/testdir/test_bufwintabinfo.mnv | 230 + uvim/src/testdir/test_bufwintabinfo.vim | 230 - uvim/src/testdir/test_cd.mnv | 423 + uvim/src/testdir/test_cd.vim | 423 - uvim/src/testdir/test_cdo.mnv | 215 + uvim/src/testdir/test_cdo.vim | 215 - uvim/src/testdir/test_changedtick.mnv | 97 + uvim/src/testdir/test_changedtick.vim | 97 - uvim/src/testdir/test_changelist.mnv | 105 + uvim/src/testdir/test_changelist.vim | 105 - uvim/src/testdir/test_channel.mnv | 2946 +++++ uvim/src/testdir/test_channel.py | 10 +- uvim/src/testdir/test_channel.vim | 2946 ----- uvim/src/testdir/test_channel_6.py | 4 +- uvim/src/testdir/test_channel_dap.py | 2 +- uvim/src/testdir/test_channel_lsp.py | 6 +- uvim/src/testdir/test_channel_unix.py | 4 +- uvim/src/testdir/test_charsearch.mnv | 100 + uvim/src/testdir/test_charsearch.vim | 100 - uvim/src/testdir/test_charsearch_utf8.mnv | 26 + uvim/src/testdir/test_charsearch_utf8.vim | 26 - uvim/src/testdir/test_checkpath.mnv | 116 + uvim/src/testdir/test_checkpath.vim | 116 - uvim/src/testdir/test_cindent.mnv | 5530 +++++++++ uvim/src/testdir/test_cindent.vim | 5530 --------- uvim/src/testdir/test_cjk_linebreak.mnv | 101 + uvim/src/testdir/test_cjk_linebreak.vim | 101 - uvim/src/testdir/test_clientserver.mnv | 366 + uvim/src/testdir/test_clientserver.vim | 366 - uvim/src/testdir/test_clipmethod.mnv | 228 + uvim/src/testdir/test_clipmethod.vim | 228 - uvim/src/testdir/test_close_count.mnv | 176 + uvim/src/testdir/test_close_count.vim | 176 - uvim/src/testdir/test_cmd_lists.mnv | 70 + uvim/src/testdir/test_cmd_lists.vim | 70 - uvim/src/testdir/test_cmdline.mnv | 5393 +++++++++ uvim/src/testdir/test_cmdline.vim | 5393 --------- uvim/src/testdir/test_cmdmods.mnv | 95 + uvim/src/testdir/test_cmdmods.vim | 95 - uvim/src/testdir/test_cmdwin.mnv | 614 + uvim/src/testdir/test_cmdwin.vim | 614 - uvim/src/testdir/test_codestyle.mnv | 198 + uvim/src/testdir/test_codestyle.vim | 198 - uvim/src/testdir/test_command_count.mnv | 198 + uvim/src/testdir/test_command_count.vim | 198 - uvim/src/testdir/test_comments.mnv | 283 + uvim/src/testdir/test_comments.vim | 283 - uvim/src/testdir/test_comparators.mnv | 13 + uvim/src/testdir/test_comparators.vim | 13 - uvim/src/testdir/test_compiler.mnv | 768 ++ uvim/src/testdir/test_compiler.vim | 768 -- uvim/src/testdir/test_conceal.mnv | 683 ++ uvim/src/testdir/test_conceal.vim | 683 -- uvim/src/testdir/test_const.mnv | 335 + uvim/src/testdir/test_const.vim | 335 - uvim/src/testdir/test_cpoptions.mnv | 956 ++ uvim/src/testdir/test_cpoptions.vim | 956 -- uvim/src/testdir/test_crash.mnv | 282 + uvim/src/testdir/test_crash.vim | 282 - uvim/src/testdir/test_crypt.mnv | 494 + uvim/src/testdir/test_crypt.vim | 494 - uvim/src/testdir/test_cscope.mnv | 336 + uvim/src/testdir/test_cscope.vim | 336 - uvim/src/testdir/test_cursor_func.mnv | 628 + uvim/src/testdir/test_cursor_func.vim | 628 - uvim/src/testdir/test_cursorline.mnv | 368 + uvim/src/testdir/test_cursorline.vim | 368 - uvim/src/testdir/test_curswant.mnv | 68 + uvim/src/testdir/test_curswant.vim | 68 - uvim/src/testdir/test_debugger.mnv | 1569 +++ uvim/src/testdir/test_debugger.vim | 1569 --- uvim/src/testdir/test_delete.mnv | 132 + uvim/src/testdir/test_delete.vim | 132 - uvim/src/testdir/test_diffmode.mnv | 3634 ++++++ uvim/src/testdir/test_diffmode.vim | 3631 ------ uvim/src/testdir/test_digraph.mnv | 627 + uvim/src/testdir/test_digraph.vim | 627 - uvim/src/testdir/test_display.mnv | 695 ++ uvim/src/testdir/test_display.vim | 695 -- uvim/src/testdir/test_edit.mnv | 2460 ++++ uvim/src/testdir/test_edit.vim | 2460 ---- uvim/src/testdir/test_environ.mnv | 87 + uvim/src/testdir/test_environ.vim | 87 - uvim/src/testdir/test_erasebackword.mnv | 22 + uvim/src/testdir/test_erasebackword.vim | 22 - uvim/src/testdir/test_escaped_glob.mnv | 33 + uvim/src/testdir/test_escaped_glob.vim | 33 - uvim/src/testdir/test_eval_stuff.mnv | 1306 ++ uvim/src/testdir/test_eval_stuff.vim | 1306 -- uvim/src/testdir/test_ex_equal.mnv | 34 + uvim/src/testdir/test_ex_equal.vim | 34 - uvim/src/testdir/test_ex_mode.mnv | 408 + uvim/src/testdir/test_ex_mode.vim | 403 - uvim/src/testdir/test_ex_undo.mnv | 21 + uvim/src/testdir/test_ex_undo.vim | 21 - uvim/src/testdir/test_ex_z.mnv | 117 + uvim/src/testdir/test_ex_z.vim | 117 - uvim/src/testdir/test_excmd.mnv | 763 ++ uvim/src/testdir/test_excmd.vim | 763 -- uvim/src/testdir/test_exec_while_if.mnv | 43 + uvim/src/testdir/test_exec_while_if.vim | 43 - uvim/src/testdir/test_execute_func.mnv | 228 + uvim/src/testdir/test_execute_func.vim | 228 - uvim/src/testdir/test_exists.mnv | 393 + uvim/src/testdir/test_exists.vim | 393 - uvim/src/testdir/test_exists_autocmd.mnv | 28 + uvim/src/testdir/test_exists_autocmd.vim | 28 - uvim/src/testdir/test_exit.mnv | 153 + uvim/src/testdir/test_exit.vim | 153 - uvim/src/testdir/test_expand.mnv | 234 + uvim/src/testdir/test_expand.vim | 234 - uvim/src/testdir/test_expand_dllpath.mnv | 36 + uvim/src/testdir/test_expand_dllpath.vim | 36 - uvim/src/testdir/test_expand_func.mnv | 149 + uvim/src/testdir/test_expand_func.vim | 149 - uvim/src/testdir/test_expr.mnv | 1119 ++ uvim/src/testdir/test_expr.vim | 1119 -- uvim/src/testdir/test_expr_utf8.mnv | 44 + uvim/src/testdir/test_expr_utf8.vim | 44 - uvim/src/testdir/test_file_perm.mnv | 29 + uvim/src/testdir/test_file_perm.vim | 29 - uvim/src/testdir/test_file_size.mnv | 59 + uvim/src/testdir/test_file_size.vim | 59 - uvim/src/testdir/test_filechanged.mnv | 305 + uvim/src/testdir/test_filechanged.vim | 305 - uvim/src/testdir/test_filecopy.mnv | 69 + uvim/src/testdir/test_filecopy.vim | 69 - uvim/src/testdir/test_fileformat.mnv | 325 + uvim/src/testdir/test_fileformat.vim | 325 - uvim/src/testdir/test_filetype.mnv | 3416 ++++++ uvim/src/testdir/test_filetype.vim | 3416 ------ uvim/src/testdir/test_filter_cmd.mnv | 197 + uvim/src/testdir/test_filter_cmd.vim | 197 - uvim/src/testdir/test_filter_map.mnv | 410 + uvim/src/testdir/test_filter_map.vim | 410 - uvim/src/testdir/test_find_complete.mnv | 164 + uvim/src/testdir/test_find_complete.vim | 164 - uvim/src/testdir/test_findfile.mnv | 869 ++ uvim/src/testdir/test_findfile.vim | 869 -- uvim/src/testdir/test_fixeol.mnv | 118 + uvim/src/testdir/test_fixeol.vim | 118 - uvim/src/testdir/test_flatten.mnv | 109 + uvim/src/testdir/test_flatten.vim | 109 - uvim/src/testdir/test_float_func.mnv | 388 + uvim/src/testdir/test_float_func.vim | 388 - uvim/src/testdir/test_fnameescape.mnv | 27 + uvim/src/testdir/test_fnameescape.vim | 27 - uvim/src/testdir/test_fnamemodify.mnv | 108 + uvim/src/testdir/test_fnamemodify.vim | 108 - uvim/src/testdir/test_fold.mnv | 2109 ++++ uvim/src/testdir/test_fold.vim | 2108 ---- uvim/src/testdir/test_format.mnv | 404 + uvim/src/testdir/test_format.vim | 404 - uvim/src/testdir/test_function_lists.mnv | 107 + uvim/src/testdir/test_function_lists.vim | 107 - uvim/src/testdir/test_functions.mnv | 4629 ++++++++ uvim/src/testdir/test_functions.vim | 4629 -------- uvim/src/testdir/test_ga.mnv | 44 + uvim/src/testdir/test_ga.vim | 44 - uvim/src/testdir/test_getcwd.mnv | 268 + uvim/src/testdir/test_getcwd.vim | 268 - uvim/src/testdir/test_gettext.mnv | 20 + uvim/src/testdir/test_gettext.vim | 20 - uvim/src/testdir/test_gettext_cp1251.mnv | 34 + uvim/src/testdir/test_gettext_cp1251.vim | 34 - uvim/src/testdir/test_gettext_make.mnv | 72 + uvim/src/testdir/test_gettext_make.vim | 72 - uvim/src/testdir/test_gettext_makefile_in1.mnv | 7 + uvim/src/testdir/test_gettext_makefile_in1.vim | 7 - uvim/src/testdir/test_gettext_makefile_in2.mnv | 6 + uvim/src/testdir/test_gettext_makefile_in2.vim | 6 - uvim/src/testdir/test_gettext_makefile_in3.mnv | 4 + uvim/src/testdir/test_gettext_makefile_in3.vim | 4 - uvim/src/testdir/test_gettext_makefile_in4.mnv | 6 + uvim/src/testdir/test_gettext_makefile_in4.vim | 6 - uvim/src/testdir/test_gettext_utf8.mnv | 48 + uvim/src/testdir/test_gettext_utf8.vim | 48 - uvim/src/testdir/test_getvar.mnv | 182 + uvim/src/testdir/test_getvar.vim | 182 - uvim/src/testdir/test_gf.mnv | 388 + uvim/src/testdir/test_gf.vim | 388 - uvim/src/testdir/test_glob2regpat.mnv | 35 + uvim/src/testdir/test_glob2regpat.vim | 35 - uvim/src/testdir/test_global.mnv | 156 + uvim/src/testdir/test_global.vim | 156 - uvim/src/testdir/test_gn.mnv | 221 + uvim/src/testdir/test_gn.vim | 221 - uvim/src/testdir/test_goto.mnv | 449 + uvim/src/testdir/test_goto.vim | 449 - uvim/src/testdir/test_gui.mnv | 1892 +++ uvim/src/testdir/test_gui.vim | 1892 --- uvim/src/testdir/test_gui_init.mnv | 44 + uvim/src/testdir/test_gui_init.vim | 44 - uvim/src/testdir/test_hardcopy.mnv | 237 + uvim/src/testdir/test_hardcopy.vim | 237 - uvim/src/testdir/test_help.mnv | 292 + uvim/src/testdir/test_help.vim | 292 - uvim/src/testdir/test_help_tagjump.mnv | 318 + uvim/src/testdir/test_help_tagjump.vim | 318 - uvim/src/testdir/test_hide.mnv | 97 + uvim/src/testdir/test_hide.vim | 97 - uvim/src/testdir/test_highlight.mnv | 1683 +++ uvim/src/testdir/test_highlight.vim | 1683 --- uvim/src/testdir/test_history.mnv | 318 + uvim/src/testdir/test_history.vim | 318 - uvim/src/testdir/test_hlsearch.mnv | 114 + uvim/src/testdir/test_hlsearch.vim | 114 - uvim/src/testdir/test_iminsert.mnv | 324 + uvim/src/testdir/test_iminsert.vim | 324 - uvim/src/testdir/test_increment.mnv | 950 ++ uvim/src/testdir/test_increment.vim | 950 -- uvim/src/testdir/test_increment_dbcs.mnv | 28 + uvim/src/testdir/test_increment_dbcs.vim | 28 - uvim/src/testdir/test_indent.mnv | 387 + uvim/src/testdir/test_indent.vim | 387 - uvim/src/testdir/test_input.mnv | 111 + uvim/src/testdir/test_input.vim | 111 - uvim/src/testdir/test_ins_complete.mnv | 6292 ++++++++++ uvim/src/testdir/test_ins_complete.vim | 6292 ---------- uvim/src/testdir/test_ins_complete_no_halt.mnv | 51 + uvim/src/testdir/test_ins_complete_no_halt.vim | 51 - uvim/src/testdir/test_interrupt.mnv | 32 + uvim/src/testdir/test_interrupt.vim | 32 - uvim/src/testdir/test_job_fails.mnv | 15 + uvim/src/testdir/test_job_fails.vim | 15 - uvim/src/testdir/test_join.mnv | 448 + uvim/src/testdir/test_join.vim | 448 - uvim/src/testdir/test_json.mnv | 391 + uvim/src/testdir/test_json.vim | 391 - uvim/src/testdir/test_jumplist.mnv | 199 + uvim/src/testdir/test_jumplist.vim | 199 - uvim/src/testdir/test_lambda.mnv | 383 + uvim/src/testdir/test_lambda.vim | 383 - uvim/src/testdir/test_langmap.mnv | 88 + uvim/src/testdir/test_langmap.vim | 88 - uvim/src/testdir/test_largefile.mnv | 31 + uvim/src/testdir/test_largefile.vim | 31 - uvim/src/testdir/test_let.mnv | 868 ++ uvim/src/testdir/test_let.vim | 868 -- uvim/src/testdir/test_lineending.mnv | 22 + uvim/src/testdir/test_lineending.vim | 22 - uvim/src/testdir/test_lispindent.mnv | 129 + uvim/src/testdir/test_lispindent.vim | 129 - uvim/src/testdir/test_listchars.mnv | 859 ++ uvim/src/testdir/test_listchars.vim | 859 -- uvim/src/testdir/test_listdict.mnv | 2131 ++++ uvim/src/testdir/test_listdict.vim | 2131 ---- uvim/src/testdir/test_listener.mnv | 804 ++ uvim/src/testdir/test_listener.vim | 804 -- uvim/src/testdir/test_listlbr.mnv | 388 + uvim/src/testdir/test_listlbr.vim | 388 - uvim/src/testdir/test_listlbr_utf8.mnv | 388 + uvim/src/testdir/test_listlbr_utf8.vim | 388 - uvim/src/testdir/test_lua.mnv | 1281 ++ uvim/src/testdir/test_lua.vim | 1281 -- uvim/src/testdir/test_makeencoding.mnv | 117 + uvim/src/testdir/test_makeencoding.vim | 117 - uvim/src/testdir/test_map_functions.mnv | 651 + uvim/src/testdir/test_map_functions.vim | 651 - uvim/src/testdir/test_mapping.mnv | 1953 +++ uvim/src/testdir/test_mapping.vim | 1953 --- uvim/src/testdir/test_marks.mnv | 326 + uvim/src/testdir/test_marks.vim | 326 - uvim/src/testdir/test_match.mnv | 441 + uvim/src/testdir/test_match.vim | 441 - uvim/src/testdir/test_matchadd_conceal.mnv | 444 + uvim/src/testdir/test_matchadd_conceal.vim | 444 - uvim/src/testdir/test_matchadd_conceal_utf8.mnv | 44 + uvim/src/testdir/test_matchadd_conceal_utf8.vim | 44 - uvim/src/testdir/test_matchfuzzy.mnv | 325 + uvim/src/testdir/test_matchfuzzy.vim | 325 - uvim/src/testdir/test_memory_usage.mnv | 162 + uvim/src/testdir/test_memory_usage.vim | 162 - uvim/src/testdir/test_menu.mnv | 659 + uvim/src/testdir/test_menu.vim | 659 - uvim/src/testdir/test_messages.mnv | 838 ++ uvim/src/testdir/test_messages.vim | 838 -- uvim/src/testdir/test_method.mnv | 180 + uvim/src/testdir/test_method.vim | 180 - uvim/src/testdir/test_mksession.mnv | 1334 +++ uvim/src/testdir/test_mksession.vim | 1334 --- uvim/src/testdir/test_mksession_utf8.mnv | 142 + uvim/src/testdir/test_mksession_utf8.vim | 142 - uvim/src/testdir/test_mnv9_assign.mnv | 3935 ++++++ uvim/src/testdir/test_mnv9_builtin.mnv | 5420 +++++++++ uvim/src/testdir/test_mnv9_class.mnv | 11872 +++++++++++++++++++ uvim/src/testdir/test_mnv9_cmd.mnv | 2131 ++++ uvim/src/testdir/test_mnv9_disassemble.mnv | 4097 +++++++ uvim/src/testdir/test_mnv9_enum.mnv | 1682 +++ uvim/src/testdir/test_mnv9_expr.mnv | 4490 +++++++ uvim/src/testdir/test_mnv9_fails.mnv | 60 + uvim/src/testdir/test_mnv9_func.mnv | 4867 ++++++++ uvim/src/testdir/test_mnv9_generics.mnv | 3577 ++++++ uvim/src/testdir/test_mnv9_import.mnv | 3722 ++++++ uvim/src/testdir/test_mnv9_interface.mnv | 1459 +++ uvim/src/testdir/test_mnv9_python3.mnv | 16 + uvim/src/testdir/test_mnv9_script.mnv | 5828 +++++++++ uvim/src/testdir/test_mnv9_typealias.mnv | 927 ++ uvim/src/testdir/test_mnvinfo.mnv | 1394 +++ uvim/src/testdir/test_mnvscript.mnv | 7708 ++++++++++++ uvim/src/testdir/test_modeless.mnv | 418 + uvim/src/testdir/test_modeless.vim | 418 - uvim/src/testdir/test_modeline.mnv | 496 + uvim/src/testdir/test_modeline.vim | 496 - uvim/src/testdir/test_move.mnv | 70 + uvim/src/testdir/test_move.vim | 70 - uvim/src/testdir/test_mswin_event.mnv | 1021 ++ uvim/src/testdir/test_mswin_event.vim | 1021 -- uvim/src/testdir/test_mzscheme.mnv | 61 + uvim/src/testdir/test_mzscheme.vim | 61 - uvim/src/testdir/test_nested_function.mnv | 68 + uvim/src/testdir/test_nested_function.vim | 68 - uvim/src/testdir/test_netbeans.mnv | 1027 ++ uvim/src/testdir/test_netbeans.py | 6 +- uvim/src/testdir/test_netbeans.vim | 1027 -- uvim/src/testdir/test_normal.mnv | 4461 +++++++ uvim/src/testdir/test_normal.vim | 4461 ------- uvim/src/testdir/test_number.mnv | 405 + uvim/src/testdir/test_number.vim | 405 - uvim/src/testdir/test_options.mnv | 3095 +++++ uvim/src/testdir/test_options.vim | 3095 ----- uvim/src/testdir/test_options_all.mnv | 13 + uvim/src/testdir/test_options_all.vim | 13 - uvim/src/testdir/test_packadd.mnv | 518 + uvim/src/testdir/test_packadd.vim | 518 - uvim/src/testdir/test_partial.mnv | 443 + uvim/src/testdir/test_partial.vim | 443 - uvim/src/testdir/test_paste.mnv | 334 + uvim/src/testdir/test_paste.vim | 334 - uvim/src/testdir/test_perl.mnv | 381 + uvim/src/testdir/test_perl.vim | 381 - uvim/src/testdir/test_plugin_comment.mnv | 635 + uvim/src/testdir/test_plugin_comment.vim | 635 - uvim/src/testdir/test_plugin_glvs.mnv | 378 + uvim/src/testdir/test_plugin_glvs.vim | 378 - uvim/src/testdir/test_plugin_helpcurwin.mnv | 13 + uvim/src/testdir/test_plugin_helpcurwin.vim | 13 - uvim/src/testdir/test_plugin_helptoc.mnv | 40 + uvim/src/testdir/test_plugin_helptoc.vim | 40 - uvim/src/testdir/test_plugin_man.mnv | 149 + uvim/src/testdir/test_plugin_man.vim | 149 - uvim/src/testdir/test_plugin_matchparen.mnv | 202 + uvim/src/testdir/test_plugin_matchparen.vim | 202 - uvim/src/testdir/test_plugin_netrw.mnv | 606 + uvim/src/testdir/test_plugin_netrw.vim | 606 - uvim/src/testdir/test_plugin_osc52.mnv | 96 + uvim/src/testdir/test_plugin_osc52.vim | 96 - uvim/src/testdir/test_plugin_tar.mnv | 149 + uvim/src/testdir/test_plugin_tar.vim | 149 - uvim/src/testdir/test_plugin_termdebug.mnv | 864 ++ uvim/src/testdir/test_plugin_termdebug.vim | 864 -- uvim/src/testdir/test_plugin_tohtml.mnv | 70 + uvim/src/testdir/test_plugin_tohtml.vim | 70 - uvim/src/testdir/test_plugin_tutor.mnv | 54 + uvim/src/testdir/test_plugin_tutor.vim | 54 - uvim/src/testdir/test_plugin_zip.mnv | 298 + uvim/src/testdir/test_plugin_zip.vim | 298 - uvim/src/testdir/test_plus_arg_edit.mnv | 45 + uvim/src/testdir/test_plus_arg_edit.vim | 45 - uvim/src/testdir/test_popup.mnv | 2423 ++++ uvim/src/testdir/test_popup.vim | 2423 ---- uvim/src/testdir/test_popupwin.mnv | 5105 ++++++++ uvim/src/testdir/test_popupwin.vim | 5105 -------- uvim/src/testdir/test_popupwin_textprop.mnv | 174 + uvim/src/testdir/test_popupwin_textprop.vim | 174 - uvim/src/testdir/test_preview.mnv | 106 + uvim/src/testdir/test_preview.vim | 106 - uvim/src/testdir/test_profile.mnv | 778 ++ uvim/src/testdir/test_profile.vim | 778 -- uvim/src/testdir/test_prompt_buffer.mnv | 365 + uvim/src/testdir/test_prompt_buffer.vim | 365 - uvim/src/testdir/test_put.mnv | 447 + uvim/src/testdir/test_put.vim | 445 - uvim/src/testdir/test_python2.mnv | 4055 +++++++ uvim/src/testdir/test_python2.vim | 4055 ------- uvim/src/testdir/test_python3.mnv | 4413 +++++++ uvim/src/testdir/test_python3.vim | 4413 ------- uvim/src/testdir/test_pyx2.mnv | 148 + uvim/src/testdir/test_pyx2.vim | 148 - uvim/src/testdir/test_pyx3.mnv | 147 + uvim/src/testdir/test_pyx3.vim | 147 - uvim/src/testdir/test_quickfix.mnv | 7009 +++++++++++ uvim/src/testdir/test_quickfix.vim | 7009 ----------- uvim/src/testdir/test_quotestar.mnv | 155 + uvim/src/testdir/test_quotestar.vim | 155 - uvim/src/testdir/test_random.mnv | 53 + uvim/src/testdir/test_random.vim | 53 - uvim/src/testdir/test_recover.mnv | 518 + uvim/src/testdir/test_recover.vim | 518 - uvim/src/testdir/test_regex_char_classes.mnv | 295 + uvim/src/testdir/test_regex_char_classes.vim | 295 - uvim/src/testdir/test_regexp_latin.mnv | 1175 ++ uvim/src/testdir/test_regexp_latin.vim | 1175 -- uvim/src/testdir/test_regexp_utf8.mnv | 654 + uvim/src/testdir/test_regexp_utf8.vim | 654 - uvim/src/testdir/test_registers.mnv | 1302 ++ uvim/src/testdir/test_registers.vim | 1302 -- uvim/src/testdir/test_reltime.mnv | 30 + uvim/src/testdir/test_reltime.vim | 30 - uvim/src/testdir/test_remote.mnv | 149 + uvim/src/testdir/test_remote.vim | 149 - uvim/src/testdir/test_rename.mnv | 111 + uvim/src/testdir/test_rename.vim | 111 - uvim/src/testdir/test_restricted.mnv | 223 + uvim/src/testdir/test_restricted.vim | 223 - uvim/src/testdir/test_retab.mnv | 185 + uvim/src/testdir/test_retab.vim | 185 - uvim/src/testdir/test_ruby.mnv | 458 + uvim/src/testdir/test_ruby.vim | 458 - uvim/src/testdir/test_scriptnames.mnv | 106 + uvim/src/testdir/test_scriptnames.vim | 106 - uvim/src/testdir/test_scroll_opt.mnv | 1442 +++ uvim/src/testdir/test_scroll_opt.vim | 1442 --- uvim/src/testdir/test_scrollbind.mnv | 275 + uvim/src/testdir/test_scrollbind.vim | 275 - uvim/src/testdir/test_search.mnv | 2424 ++++ uvim/src/testdir/test_search.vim | 2424 ---- uvim/src/testdir/test_search_stat.mnv | 649 + uvim/src/testdir/test_search_stat.vim | 649 - uvim/src/testdir/test_searchpos.mnv | 30 + uvim/src/testdir/test_searchpos.vim | 30 - uvim/src/testdir/test_selectmode.mnv | 339 + uvim/src/testdir/test_selectmode.vim | 339 - uvim/src/testdir/test_set.mnv | 76 + uvim/src/testdir/test_set.vim | 76 - uvim/src/testdir/test_sha256.mnv | 34 + uvim/src/testdir/test_sha256.vim | 34 - uvim/src/testdir/test_shell.mnv | 313 + uvim/src/testdir/test_shell.vim | 313 - uvim/src/testdir/test_shift.mnv | 914 ++ uvim/src/testdir/test_shift.vim | 914 -- uvim/src/testdir/test_shortpathname.mnv | 104 + uvim/src/testdir/test_shortpathname.vim | 104 - uvim/src/testdir/test_signals.mnv | 200 + uvim/src/testdir/test_signals.vim | 200 - uvim/src/testdir/test_signs.mnv | 2166 ++++ uvim/src/testdir/test_signs.vim | 2166 ---- uvim/src/testdir/test_sleep.mnv | 23 + uvim/src/testdir/test_sleep.vim | 23 - uvim/src/testdir/test_smartindent.mnv | 159 + uvim/src/testdir/test_smartindent.vim | 159 - uvim/src/testdir/test_sort.mnv | 1588 +++ uvim/src/testdir/test_sort.vim | 1588 --- uvim/src/testdir/test_sound.mnv | 104 + uvim/src/testdir/test_sound.vim | 104 - uvim/src/testdir/test_source.mnv | 674 ++ uvim/src/testdir/test_source.vim | 674 -- uvim/src/testdir/test_source_utf8.mnv | 61 + uvim/src/testdir/test_source_utf8.vim | 61 - uvim/src/testdir/test_spell.mnv | 1584 +++ uvim/src/testdir/test_spell.vim | 1584 --- uvim/src/testdir/test_spell_utf8.mnv | 831 ++ uvim/src/testdir/test_spell_utf8.vim | 831 -- uvim/src/testdir/test_spellfile.mnv | 1169 ++ uvim/src/testdir/test_spellfile.vim | 1169 -- uvim/src/testdir/test_spellrare.mnv | 60 + uvim/src/testdir/test_spellrare.vim | 60 - uvim/src/testdir/test_stacktrace.mnv | 142 + uvim/src/testdir/test_stacktrace.vim | 142 - uvim/src/testdir/test_startup.mnv | 1511 +++ uvim/src/testdir/test_startup.vim | 1511 --- uvim/src/testdir/test_startup_utf8.mnv | 108 + uvim/src/testdir/test_startup_utf8.vim | 108 - uvim/src/testdir/test_stat.mnv | 222 + uvim/src/testdir/test_stat.vim | 222 - uvim/src/testdir/test_statusline.mnv | 724 ++ uvim/src/testdir/test_statusline.vim | 724 -- uvim/src/testdir/test_statuslineopt.mnv | 415 + uvim/src/testdir/test_statuslineopt.vim | 415 - uvim/src/testdir/test_substitute.mnv | 1529 +++ uvim/src/testdir/test_substitute.vim | 1529 --- uvim/src/testdir/test_suspend.mnv | 117 + uvim/src/testdir/test_suspend.vim | 117 - uvim/src/testdir/test_swap.mnv | 572 + uvim/src/testdir/test_swap.vim | 572 - uvim/src/testdir/test_syn_attr.mnv | 834 ++ uvim/src/testdir/test_syn_attr.vim | 834 -- uvim/src/testdir/test_syntax.mnv | 992 ++ uvim/src/testdir/test_syntax.vim | 992 -- uvim/src/testdir/test_system.mnv | 256 + uvim/src/testdir/test_system.vim | 256 - uvim/src/testdir/test_tab.mnv | 92 + uvim/src/testdir/test_tab.vim | 92 - uvim/src/testdir/test_tabline.mnv | 253 + uvim/src/testdir/test_tabline.vim | 253 - uvim/src/testdir/test_tabpage.mnv | 1077 ++ uvim/src/testdir/test_tabpage.vim | 1077 -- uvim/src/testdir/test_tabpanel.mnv | 895 ++ uvim/src/testdir/test_tabpanel.vim | 895 -- uvim/src/testdir/test_tagcase.mnv | 75 + uvim/src/testdir/test_tagcase.vim | 75 - uvim/src/testdir/test_tagfunc.mnv | 459 + uvim/src/testdir/test_tagfunc.vim | 459 - uvim/src/testdir/test_tagjump.mnv | 1696 +++ uvim/src/testdir/test_tagjump.vim | 1696 --- uvim/src/testdir/test_taglist.mnv | 335 + uvim/src/testdir/test_taglist.vim | 335 - uvim/src/testdir/test_tcl.mnv | 766 ++ uvim/src/testdir/test_tcl.vim | 766 -- uvim/src/testdir/test_termcodes.mnv | 3122 +++++ uvim/src/testdir/test_termcodes.vim | 3122 ----- uvim/src/testdir/test_termencoding.mnv | 38 + uvim/src/testdir/test_termencoding.vim | 38 - uvim/src/testdir/test_terminal.mnv | 2454 ++++ uvim/src/testdir/test_terminal.vim | 2454 ---- uvim/src/testdir/test_terminal2.mnv | 743 ++ uvim/src/testdir/test_terminal2.vim | 743 -- uvim/src/testdir/test_terminal3.mnv | 1243 ++ uvim/src/testdir/test_terminal3.vim | 1243 -- uvim/src/testdir/test_terminal_fail.mnv | 19 + uvim/src/testdir/test_terminal_fail.vim | 19 - uvim/src/testdir/test_textformat.mnv | 1363 +++ uvim/src/testdir/test_textformat.vim | 1363 --- uvim/src/testdir/test_textobjects.mnv | 780 ++ uvim/src/testdir/test_textobjects.vim | 780 -- uvim/src/testdir/test_textprop.mnv | 4910 ++++++++ uvim/src/testdir/test_textprop.vim | 4910 -------- uvim/src/testdir/test_timers.mnv | 543 + uvim/src/testdir/test_timers.vim | 543 - uvim/src/testdir/test_true_false.mnv | 152 + uvim/src/testdir/test_true_false.vim | 152 - uvim/src/testdir/test_trycatch.mnv | 2405 ++++ uvim/src/testdir/test_trycatch.vim | 2405 ---- uvim/src/testdir/test_tuple.mnv | 2466 ++++ uvim/src/testdir/test_tuple.vim | 2466 ---- uvim/src/testdir/test_undo.mnv | 928 ++ uvim/src/testdir/test_undo.vim | 928 -- uvim/src/testdir/test_uniq.mnv | 610 + uvim/src/testdir/test_uniq.vim | 610 - uvim/src/testdir/test_unlet.mnv | 79 + uvim/src/testdir/test_unlet.vim | 79 - uvim/src/testdir/test_user_func.mnv | 1090 ++ uvim/src/testdir/test_user_func.vim | 1090 -- uvim/src/testdir/test_usercommands.mnv | 1014 ++ uvim/src/testdir/test_usercommands.vim | 1014 -- uvim/src/testdir/test_utf8.mnv | 375 + uvim/src/testdir/test_utf8.vim | 375 - uvim/src/testdir/test_utf8_comparisons.mnv | 131 + uvim/src/testdir/test_utf8_comparisons.vim | 131 - uvim/src/testdir/test_vartabs.mnv | 514 + uvim/src/testdir/test_vartabs.vim | 514 - uvim/src/testdir/test_version.mnv | 23 + uvim/src/testdir/test_version.vim | 23 - uvim/src/testdir/test_vim9_assign.vim | 3935 ------ uvim/src/testdir/test_vim9_builtin.vim | 5420 --------- uvim/src/testdir/test_vim9_class.vim | 11872 ------------------- uvim/src/testdir/test_vim9_cmd.vim | 2131 ---- uvim/src/testdir/test_vim9_disassemble.vim | 4097 ------- uvim/src/testdir/test_vim9_enum.vim | 1682 --- uvim/src/testdir/test_vim9_expr.vim | 4490 ------- uvim/src/testdir/test_vim9_fails.vim | 60 - uvim/src/testdir/test_vim9_func.vim | 4867 -------- uvim/src/testdir/test_vim9_generics.vim | 3577 ------ uvim/src/testdir/test_vim9_import.vim | 3722 ------ uvim/src/testdir/test_vim9_interface.vim | 1459 --- uvim/src/testdir/test_vim9_python3.vim | 16 - uvim/src/testdir/test_vim9_script.vim | 5828 --------- uvim/src/testdir/test_vim9_typealias.vim | 927 -- uvim/src/testdir/test_viminfo.vim | 1394 --- uvim/src/testdir/test_vimscript.vim | 7708 ------------ uvim/src/testdir/test_virtualedit.mnv | 756 ++ uvim/src/testdir/test_virtualedit.vim | 756 -- uvim/src/testdir/test_visual.mnv | 3045 +++++ uvim/src/testdir/test_visual.vim | 3045 ----- uvim/src/testdir/test_wayland.mnv | 630 + uvim/src/testdir/test_wayland.vim | 630 - uvim/src/testdir/test_winbar.mnv | 188 + uvim/src/testdir/test_winbar.vim | 188 - uvim/src/testdir/test_winbuf_close.mnv | 228 + uvim/src/testdir/test_winbuf_close.vim | 228 - uvim/src/testdir/test_window_cmd.mnv | 2524 ++++ uvim/src/testdir/test_window_cmd.vim | 2524 ---- uvim/src/testdir/test_window_id.mnv | 140 + uvim/src/testdir/test_window_id.vim | 140 - uvim/src/testdir/test_windows_home.mnv | 121 + uvim/src/testdir/test_windows_home.vim | 121 - uvim/src/testdir/test_winfixbuf.mnv | 3367 ++++++ uvim/src/testdir/test_winfixbuf.vim | 3367 ------ uvim/src/testdir/test_wnext.mnv | 103 + uvim/src/testdir/test_wnext.vim | 103 - uvim/src/testdir/test_wordcount.mnv | 106 + uvim/src/testdir/test_wordcount.vim | 106 - uvim/src/testdir/test_writefile.mnv | 1000 ++ uvim/src/testdir/test_writefile.vim | 1000 -- uvim/src/testdir/test_xdg.mnv | 335 + uvim/src/testdir/test_xdg.vim | 335 - uvim/src/testdir/test_xxd.mnv | 825 ++ uvim/src/testdir/test_xxd.vim | 825 -- uvim/src/testdir/util/amiga.mnv | 6 + uvim/src/testdir/util/amiga.vim | 6 - uvim/src/testdir/util/check.mnv | 364 + uvim/src/testdir/util/check.vim | 364 - uvim/src/testdir/util/color_ramp.mnv | 85 + uvim/src/testdir/util/color_ramp.vim | 85 - uvim/src/testdir/util/dos.mnv | 9 + uvim/src/testdir/util/dos.vim | 9 - uvim/src/testdir/util/gen_opt_test.mnv | 554 + uvim/src/testdir/util/gen_opt_test.vim | 554 - uvim/src/testdir/util/gui_init.mnv | 6 + uvim/src/testdir/util/gui_init.vim | 6 - uvim/src/testdir/util/gui_preinit.mnv | 7 + uvim/src/testdir/util/gui_preinit.vim | 7 - uvim/src/testdir/util/mnv9.mnv | 549 + uvim/src/testdir/util/mouse.mnv | 372 + uvim/src/testdir/util/mouse.vim | 372 - uvim/src/testdir/util/popupbounce.mnv | 80 + uvim/src/testdir/util/popupbounce.vim | 80 - uvim/src/testdir/util/screendump.mnv | 231 + uvim/src/testdir/util/screendump.vim | 231 - uvim/src/testdir/util/script_util.mnv | 69 + uvim/src/testdir/util/script_util.vim | 69 - uvim/src/testdir/util/setup.mnv | 47 + uvim/src/testdir/util/setup.vim | 47 - uvim/src/testdir/util/setup_gui.mnv | 31 + uvim/src/testdir/util/setup_gui.vim | 31 - uvim/src/testdir/util/shared.mnv | 476 + uvim/src/testdir/util/shared.vim | 476 - uvim/src/testdir/util/socketserver.mnv | 17 + uvim/src/testdir/util/socketserver.vim | 17 - uvim/src/testdir/util/summarize.mnv | 62 + uvim/src/testdir/util/summarize.vim | 62 - uvim/src/testdir/util/term_util.mnv | 211 + uvim/src/testdir/util/term_util.vim | 211 - uvim/src/testdir/util/unix.mnv | 13 + uvim/src/testdir/util/unix.vim | 13 - uvim/src/testdir/util/view_util.mnv | 129 + uvim/src/testdir/util/view_util.vim | 129 - uvim/src/testdir/util/vim9.vim | 549 - uvim/src/testdir/util/vms.mnv | 6 + uvim/src/testdir/util/vms.vim | 6 - uvim/src/testdir/util/window_manager.mnv | 107 + uvim/src/testdir/util/window_manager.vim | 107 - uvim/src/testdir/viewdumps.mnv | 11 + uvim/src/testdir/viewdumps.vim | 11 - uvim/src/testing.c | 98 +- uvim/src/textformat.c | 50 +- uvim/src/textobject.c | 66 +- uvim/src/textprop.c | 84 +- uvim/src/time.c | 94 +- uvim/src/tuple.c | 46 +- uvim/src/typval.c | 110 +- uvim/src/ui.c | 60 +- uvim/src/undo.c | 98 +- uvim/src/uninstall.c | 104 +- uvim/src/usercmd.c | 104 +- uvim/src/userfunc.c | 540 +- uvim/src/version.c | 150 +- uvim/src/version.h | 70 +- uvim/src/vim.h | 3096 ----- uvim/src/vim.ico | Bin 100197 -> 0 bytes uvim/src/vim.manifest | 59 - uvim/src/vim.rc | 136 - uvim/src/vim.tlb | Bin 1792 -> 0 bytes uvim/src/vim9.h | 901 -- uvim/src/vim9class.c | 4424 ------- uvim/src/vim9cmds.c | 2813 ----- uvim/src/vim9compile.c | 5280 --------- uvim/src/vim9execute.c | 8207 ------------- uvim/src/vim9expr.c | 4071 ------- uvim/src/vim9generics.c | 1312 -- uvim/src/vim9instr.c | 3008 ----- uvim/src/vim9script.c | 1162 -- uvim/src/vim9type.c | 2896 ----- uvim/src/vim_alert.ico | Bin 10134 -> 0 bytes uvim/src/vim_error.ico | Bin 10134 -> 0 bytes uvim/src/vim_icon.xbm | 14 - uvim/src/vim_info.ico | Bin 10134 -> 0 bytes uvim/src/vim_mask.xbm | 14 - uvim/src/vim_quest.ico | Bin 10134 -> 0 bytes uvim/src/viminfo.c | 3396 ------ uvim/src/vimrun.c | 113 - uvim/src/vimtutor | 213 - uvim/src/wayland.c | 56 +- uvim/src/wayland.h | 12 +- uvim/src/winclip.c | 98 +- uvim/src/window.c | 110 +- uvim/src/xdiff/README.txt | 4 +- uvim/src/xdiff/xdiff.h | 10 +- uvim/src/xdiff/xdiffi.c | 2 +- uvim/src/xdiff/xinclude.h | 4 +- uvim/src/xpm/README.txt | 10 +- uvim/src/xpm_w32.c | 4 +- uvim/src/xxd/Make_mvc.mak | 2 +- uvim/src/xxd/Make_vms.mms | 2 +- 1331 files changed, 370003 insertions(+), 369991 deletions(-) create mode 100644 uvim/src/GmnvExt/GmnvExt.reg create mode 100644 uvim/src/GmnvExt/Make_ming.mak create mode 100644 uvim/src/GmnvExt/Make_mvc.mak create mode 100644 uvim/src/GmnvExt/Makefile create mode 100644 uvim/src/GmnvExt/README.txt create mode 100644 uvim/src/GmnvExt/gmnvext.cpp create mode 100644 uvim/src/GmnvExt/gmnvext.def create mode 100644 uvim/src/GmnvExt/gmnvext.h create mode 100644 uvim/src/GmnvExt/gmnvext.inf create mode 100644 uvim/src/GmnvExt/gmnvext.rc create mode 100644 uvim/src/GmnvExt/gmnvext_ming.def create mode 100644 uvim/src/GmnvExt/gmnvext_ming.rc create mode 100644 uvim/src/GmnvExt/resource.h create mode 100644 uvim/src/GmnvExt/uninst.bat delete mode 100644 uvim/src/GvimExt/GvimExt.reg delete mode 100644 uvim/src/GvimExt/Make_ming.mak delete mode 100644 uvim/src/GvimExt/Make_mvc.mak delete mode 100644 uvim/src/GvimExt/Makefile delete mode 100644 uvim/src/GvimExt/README.txt delete mode 100644 uvim/src/GvimExt/gvimext.cpp delete mode 100644 uvim/src/GvimExt/gvimext.def delete mode 100644 uvim/src/GvimExt/gvimext.h delete mode 100644 uvim/src/GvimExt/gvimext.inf delete mode 100644 uvim/src/GvimExt/gvimext.rc delete mode 100644 uvim/src/GvimExt/gvimext_ming.def delete mode 100644 uvim/src/GvimExt/gvimext_ming.rc delete mode 100644 uvim/src/GvimExt/resource.h delete mode 100644 uvim/src/GvimExt/uninst.bat create mode 100644 uvim/src/bigmnv.bat create mode 100644 uvim/src/bigmnv64.bat delete mode 100644 uvim/src/bigvim.bat delete mode 100644 uvim/src/bigvim64.bat create mode 100644 uvim/src/create_cmdidxs.mnv delete mode 100644 uvim/src/create_cmdidxs.vim create mode 100644 uvim/src/create_nvcmdidxs.mnv delete mode 100644 uvim/src/create_nvcmdidxs.vim create mode 100644 uvim/src/gmnvtutor delete mode 100644 uvim/src/gvimtutor create mode 100644 uvim/src/mnv.h create mode 100644 uvim/src/mnv.ico create mode 100644 uvim/src/mnv.manifest create mode 100644 uvim/src/mnv.rc create mode 100644 uvim/src/mnv.tlb create mode 100644 uvim/src/mnv9.h create mode 100644 uvim/src/mnv9class.c create mode 100644 uvim/src/mnv9cmds.c create mode 100644 uvim/src/mnv9compile.c create mode 100644 uvim/src/mnv9execute.c create mode 100644 uvim/src/mnv9expr.c create mode 100644 uvim/src/mnv9generics.c create mode 100644 uvim/src/mnv9instr.c create mode 100644 uvim/src/mnv9script.c create mode 100644 uvim/src/mnv9type.c create mode 100644 uvim/src/mnv_alert.ico create mode 100644 uvim/src/mnv_error.ico create mode 100644 uvim/src/mnv_icon.xbm create mode 100644 uvim/src/mnv_info.ico create mode 100644 uvim/src/mnv_mask.xbm create mode 100644 uvim/src/mnv_quest.ico create mode 100644 uvim/src/mnvinfo.c create mode 100644 uvim/src/mnvrun.c create mode 100755 uvim/src/mnvtutor create mode 100644 uvim/src/po/check.mnv delete mode 100644 uvim/src/po/check.vim create mode 100644 uvim/src/po/cleanup.mnv delete mode 100644 uvim/src/po/cleanup.vim create mode 100644 uvim/src/po/fixfilenames.mnv delete mode 100644 uvim/src/po/fixfilenames.vim create mode 100644 uvim/src/po/gmnv.desktop.in delete mode 100644 uvim/src/po/gvim.desktop.in create mode 100644 uvim/src/po/mnv.desktop.in create mode 100644 uvim/src/po/mnv.pot create mode 100644 uvim/src/po/tojavascript.mnv delete mode 100644 uvim/src/po/tojavascript.vim delete mode 100644 uvim/src/po/vim.desktop.in delete mode 100644 uvim/src/po/vim.pot create mode 100644 uvim/src/proto/mnv9class.pro create mode 100644 uvim/src/proto/mnv9cmds.pro create mode 100644 uvim/src/proto/mnv9compile.pro create mode 100644 uvim/src/proto/mnv9execute.pro create mode 100644 uvim/src/proto/mnv9expr.pro create mode 100644 uvim/src/proto/mnv9generics.pro create mode 100644 uvim/src/proto/mnv9instr.pro create mode 100644 uvim/src/proto/mnv9script.pro create mode 100644 uvim/src/proto/mnv9type.pro create mode 100644 uvim/src/proto/mnvinfo.pro delete mode 100644 uvim/src/proto/vim9class.pro delete mode 100644 uvim/src/proto/vim9cmds.pro delete mode 100644 uvim/src/proto/vim9compile.pro delete mode 100644 uvim/src/proto/vim9execute.pro delete mode 100644 uvim/src/proto/vim9expr.pro delete mode 100644 uvim/src/proto/vim9generics.pro delete mode 100644 uvim/src/proto/vim9instr.pro delete mode 100644 uvim/src/proto/vim9script.pro delete mode 100644 uvim/src/proto/vim9type.pro delete mode 100644 uvim/src/proto/viminfo.pro create mode 100644 uvim/src/testdir/commondumps.mnv delete mode 100644 uvim/src/testdir/commondumps.vim create mode 100644 uvim/src/testdir/crash/mnv_msg_trunc_poc create mode 100644 uvim/src/testdir/crash/mnv_regsub_both create mode 100644 uvim/src/testdir/crash/mnv_regsub_both_poc create mode 100644 uvim/src/testdir/crash/poc_tagfunc.mnv delete mode 100644 uvim/src/testdir/crash/poc_tagfunc.vim delete mode 100644 uvim/src/testdir/crash/vim_msg_trunc_poc delete mode 100644 uvim/src/testdir/crash/vim_regsub_both delete mode 100644 uvim/src/testdir/crash/vim_regsub_both_poc create mode 100644 uvim/src/testdir/dumps/Test_incsearch_mnvgrep_01.dump create mode 100644 uvim/src/testdir/dumps/Test_incsearch_mnvgrep_02.dump create mode 100644 uvim/src/testdir/dumps/Test_incsearch_mnvgrep_03.dump create mode 100644 uvim/src/testdir/dumps/Test_incsearch_mnvgrep_04.dump create mode 100644 uvim/src/testdir/dumps/Test_incsearch_mnvgrep_05.dump delete mode 100644 uvim/src/testdir/dumps/Test_incsearch_vimgrep_01.dump delete mode 100644 uvim/src/testdir/dumps/Test_incsearch_vimgrep_02.dump delete mode 100644 uvim/src/testdir/dumps/Test_incsearch_vimgrep_03.dump delete mode 100644 uvim/src/testdir/dumps/Test_incsearch_vimgrep_04.dump delete mode 100644 uvim/src/testdir/dumps/Test_incsearch_vimgrep_05.dump create mode 100644 uvim/src/testdir/dumps/Test_mnv9_closure_fails.dump create mode 100644 uvim/src/testdir/dumps/Test_mnv9_no_redraw.dump create mode 100644 uvim/src/testdir/dumps/Test_mnv9_reject_declaration_1.dump create mode 100644 uvim/src/testdir/dumps/Test_mnv9_reject_declaration_2.dump create mode 100644 uvim/src/testdir/dumps/Test_mnv9_silent_echo.dump create mode 100644 uvim/src/testdir/dumps/Test_popup_setbuf_04.mnv delete mode 100644 uvim/src/testdir/dumps/Test_popup_setbuf_04.vim create mode 100644 uvim/src/testdir/dumps/Test_popup_setbuf_05.mnv delete mode 100644 uvim/src/testdir/dumps/Test_popup_setbuf_05.vim create mode 100644 uvim/src/testdir/dumps/Test_popup_setbuf_06.mnv delete mode 100644 uvim/src/testdir/dumps/Test_popup_setbuf_06.vim create mode 100644 uvim/src/testdir/dumps/Test_termdebug_evaluate_in_popup_01.mnv delete mode 100644 uvim/src/testdir/dumps/Test_termdebug_evaluate_in_popup_01.vim create mode 100644 uvim/src/testdir/dumps/Test_termdebug_evaluate_in_popup_02.mnv delete mode 100644 uvim/src/testdir/dumps/Test_termdebug_evaluate_in_popup_02.vim create mode 100644 uvim/src/testdir/dumps/Test_undo_after_write_1.mnv delete mode 100644 uvim/src/testdir/dumps/Test_undo_after_write_1.vim create mode 100644 uvim/src/testdir/dumps/Test_undo_after_write_2.mnv delete mode 100644 uvim/src/testdir/dumps/Test_undo_after_write_2.vim create mode 100644 uvim/src/testdir/dumps/Test_verbose_system_1.mnv delete mode 100644 uvim/src/testdir/dumps/Test_verbose_system_1.vim create mode 100644 uvim/src/testdir/dumps/Test_verbose_system_2.mnv delete mode 100644 uvim/src/testdir/dumps/Test_verbose_system_2.vim delete mode 100644 uvim/src/testdir/dumps/Test_vim9_closure_fails.dump delete mode 100644 uvim/src/testdir/dumps/Test_vim9_no_redraw.dump delete mode 100644 uvim/src/testdir/dumps/Test_vim9_reject_declaration_1.dump delete mode 100644 uvim/src/testdir/dumps/Test_vim9_reject_declaration_2.dump delete mode 100644 uvim/src/testdir/dumps/Test_vim9_silent_echo.dump create mode 100644 uvim/src/testdir/dumps/Test_xxd_color_0.mnv delete mode 100644 uvim/src/testdir/dumps/Test_xxd_color_0.vim create mode 100644 uvim/src/testdir/dumps/Test_xxd_color_1.mnv delete mode 100644 uvim/src/testdir/dumps/Test_xxd_color_1.vim create mode 100644 uvim/src/testdir/keycode_check.mnv delete mode 100644 uvim/src/testdir/keycode_check.vim create mode 100644 uvim/src/testdir/runtest.mnv delete mode 100644 uvim/src/testdir/runtest.vim create mode 100644 uvim/src/testdir/samples/matchparen.mnv delete mode 100644 uvim/src/testdir/samples/matchparen.vim create mode 100644 uvim/src/testdir/sautest/autoload/Test104.mnv delete mode 100644 uvim/src/testdir/sautest/autoload/Test104.vim create mode 100644 uvim/src/testdir/sautest/autoload/auto9.mnv delete mode 100644 uvim/src/testdir/sautest/autoload/auto9.vim create mode 100644 uvim/src/testdir/sautest/autoload/foo.mnv delete mode 100644 uvim/src/testdir/sautest/autoload/foo.vim create mode 100644 uvim/src/testdir/sautest/autoload/footest.mnv delete mode 100644 uvim/src/testdir/sautest/autoload/footest.vim create mode 100644 uvim/src/testdir/sautest/autoload/globone.mnv delete mode 100644 uvim/src/testdir/sautest/autoload/globone.vim create mode 100644 uvim/src/testdir/sautest/autoload/globtwo.mnv delete mode 100644 uvim/src/testdir/sautest/autoload/globtwo.vim create mode 100644 uvim/src/testdir/sautest/autoload/sourced.mnv delete mode 100644 uvim/src/testdir/sautest/autoload/sourced.vim create mode 100644 uvim/src/testdir/test_alot.mnv delete mode 100644 uvim/src/testdir/test_alot.vim create mode 100644 uvim/src/testdir/test_alot_latin.mnv delete mode 100644 uvim/src/testdir/test_alot_latin.vim create mode 100644 uvim/src/testdir/test_alot_utf8.mnv delete mode 100644 uvim/src/testdir/test_alot_utf8.vim create mode 100644 uvim/src/testdir/test_arabic.mnv delete mode 100644 uvim/src/testdir/test_arabic.vim create mode 100644 uvim/src/testdir/test_arglist.mnv delete mode 100644 uvim/src/testdir/test_arglist.vim create mode 100644 uvim/src/testdir/test_assert.mnv delete mode 100644 uvim/src/testdir/test_assert.vim create mode 100644 uvim/src/testdir/test_autochdir.mnv delete mode 100644 uvim/src/testdir/test_autochdir.vim create mode 100644 uvim/src/testdir/test_autocmd.mnv delete mode 100644 uvim/src/testdir/test_autocmd.vim create mode 100644 uvim/src/testdir/test_autoload.mnv delete mode 100644 uvim/src/testdir/test_autoload.vim create mode 100644 uvim/src/testdir/test_backspace_opt.mnv delete mode 100644 uvim/src/testdir/test_backspace_opt.vim create mode 100644 uvim/src/testdir/test_backup.mnv delete mode 100644 uvim/src/testdir/test_backup.vim create mode 100644 uvim/src/testdir/test_balloon.mnv delete mode 100644 uvim/src/testdir/test_balloon.vim create mode 100644 uvim/src/testdir/test_balloon_gui.mnv delete mode 100644 uvim/src/testdir/test_balloon_gui.vim create mode 100644 uvim/src/testdir/test_behave.mnv delete mode 100644 uvim/src/testdir/test_behave.vim create mode 100644 uvim/src/testdir/test_bench_regexp.mnv delete mode 100644 uvim/src/testdir/test_bench_regexp.vim create mode 100644 uvim/src/testdir/test_blob.mnv delete mode 100644 uvim/src/testdir/test_blob.vim create mode 100644 uvim/src/testdir/test_blockedit.mnv delete mode 100644 uvim/src/testdir/test_blockedit.vim create mode 100644 uvim/src/testdir/test_breakindent.mnv delete mode 100644 uvim/src/testdir/test_breakindent.vim create mode 100644 uvim/src/testdir/test_buffer.mnv delete mode 100644 uvim/src/testdir/test_buffer.vim create mode 100644 uvim/src/testdir/test_bufline.mnv delete mode 100644 uvim/src/testdir/test_bufline.vim create mode 100644 uvim/src/testdir/test_bufwintabinfo.mnv delete mode 100644 uvim/src/testdir/test_bufwintabinfo.vim create mode 100644 uvim/src/testdir/test_cd.mnv delete mode 100644 uvim/src/testdir/test_cd.vim create mode 100644 uvim/src/testdir/test_cdo.mnv delete mode 100644 uvim/src/testdir/test_cdo.vim create mode 100644 uvim/src/testdir/test_changedtick.mnv delete mode 100644 uvim/src/testdir/test_changedtick.vim create mode 100644 uvim/src/testdir/test_changelist.mnv delete mode 100644 uvim/src/testdir/test_changelist.vim create mode 100644 uvim/src/testdir/test_channel.mnv delete mode 100644 uvim/src/testdir/test_channel.vim create mode 100644 uvim/src/testdir/test_charsearch.mnv delete mode 100644 uvim/src/testdir/test_charsearch.vim create mode 100644 uvim/src/testdir/test_charsearch_utf8.mnv delete mode 100644 uvim/src/testdir/test_charsearch_utf8.vim create mode 100644 uvim/src/testdir/test_checkpath.mnv delete mode 100644 uvim/src/testdir/test_checkpath.vim create mode 100644 uvim/src/testdir/test_cindent.mnv delete mode 100644 uvim/src/testdir/test_cindent.vim create mode 100644 uvim/src/testdir/test_cjk_linebreak.mnv delete mode 100644 uvim/src/testdir/test_cjk_linebreak.vim create mode 100644 uvim/src/testdir/test_clientserver.mnv delete mode 100644 uvim/src/testdir/test_clientserver.vim create mode 100644 uvim/src/testdir/test_clipmethod.mnv delete mode 100644 uvim/src/testdir/test_clipmethod.vim create mode 100644 uvim/src/testdir/test_close_count.mnv delete mode 100644 uvim/src/testdir/test_close_count.vim create mode 100644 uvim/src/testdir/test_cmd_lists.mnv delete mode 100644 uvim/src/testdir/test_cmd_lists.vim create mode 100644 uvim/src/testdir/test_cmdline.mnv delete mode 100644 uvim/src/testdir/test_cmdline.vim create mode 100644 uvim/src/testdir/test_cmdmods.mnv delete mode 100644 uvim/src/testdir/test_cmdmods.vim create mode 100644 uvim/src/testdir/test_cmdwin.mnv delete mode 100644 uvim/src/testdir/test_cmdwin.vim create mode 100644 uvim/src/testdir/test_codestyle.mnv delete mode 100644 uvim/src/testdir/test_codestyle.vim create mode 100644 uvim/src/testdir/test_command_count.mnv delete mode 100644 uvim/src/testdir/test_command_count.vim create mode 100644 uvim/src/testdir/test_comments.mnv delete mode 100644 uvim/src/testdir/test_comments.vim create mode 100644 uvim/src/testdir/test_comparators.mnv delete mode 100644 uvim/src/testdir/test_comparators.vim create mode 100644 uvim/src/testdir/test_compiler.mnv delete mode 100644 uvim/src/testdir/test_compiler.vim create mode 100644 uvim/src/testdir/test_conceal.mnv delete mode 100644 uvim/src/testdir/test_conceal.vim create mode 100644 uvim/src/testdir/test_const.mnv delete mode 100644 uvim/src/testdir/test_const.vim create mode 100644 uvim/src/testdir/test_cpoptions.mnv delete mode 100644 uvim/src/testdir/test_cpoptions.vim create mode 100644 uvim/src/testdir/test_crash.mnv delete mode 100644 uvim/src/testdir/test_crash.vim create mode 100644 uvim/src/testdir/test_crypt.mnv delete mode 100644 uvim/src/testdir/test_crypt.vim create mode 100644 uvim/src/testdir/test_cscope.mnv delete mode 100644 uvim/src/testdir/test_cscope.vim create mode 100644 uvim/src/testdir/test_cursor_func.mnv delete mode 100644 uvim/src/testdir/test_cursor_func.vim create mode 100644 uvim/src/testdir/test_cursorline.mnv delete mode 100644 uvim/src/testdir/test_cursorline.vim create mode 100644 uvim/src/testdir/test_curswant.mnv delete mode 100644 uvim/src/testdir/test_curswant.vim create mode 100644 uvim/src/testdir/test_debugger.mnv delete mode 100644 uvim/src/testdir/test_debugger.vim create mode 100644 uvim/src/testdir/test_delete.mnv delete mode 100644 uvim/src/testdir/test_delete.vim create mode 100644 uvim/src/testdir/test_diffmode.mnv delete mode 100644 uvim/src/testdir/test_diffmode.vim create mode 100644 uvim/src/testdir/test_digraph.mnv delete mode 100644 uvim/src/testdir/test_digraph.vim create mode 100644 uvim/src/testdir/test_display.mnv delete mode 100644 uvim/src/testdir/test_display.vim create mode 100644 uvim/src/testdir/test_edit.mnv delete mode 100644 uvim/src/testdir/test_edit.vim create mode 100644 uvim/src/testdir/test_environ.mnv delete mode 100644 uvim/src/testdir/test_environ.vim create mode 100644 uvim/src/testdir/test_erasebackword.mnv delete mode 100644 uvim/src/testdir/test_erasebackword.vim create mode 100644 uvim/src/testdir/test_escaped_glob.mnv delete mode 100644 uvim/src/testdir/test_escaped_glob.vim create mode 100644 uvim/src/testdir/test_eval_stuff.mnv delete mode 100644 uvim/src/testdir/test_eval_stuff.vim create mode 100644 uvim/src/testdir/test_ex_equal.mnv delete mode 100644 uvim/src/testdir/test_ex_equal.vim create mode 100644 uvim/src/testdir/test_ex_mode.mnv delete mode 100644 uvim/src/testdir/test_ex_mode.vim create mode 100644 uvim/src/testdir/test_ex_undo.mnv delete mode 100644 uvim/src/testdir/test_ex_undo.vim create mode 100644 uvim/src/testdir/test_ex_z.mnv delete mode 100644 uvim/src/testdir/test_ex_z.vim create mode 100644 uvim/src/testdir/test_excmd.mnv delete mode 100644 uvim/src/testdir/test_excmd.vim create mode 100644 uvim/src/testdir/test_exec_while_if.mnv delete mode 100644 uvim/src/testdir/test_exec_while_if.vim create mode 100644 uvim/src/testdir/test_execute_func.mnv delete mode 100644 uvim/src/testdir/test_execute_func.vim create mode 100644 uvim/src/testdir/test_exists.mnv delete mode 100644 uvim/src/testdir/test_exists.vim create mode 100644 uvim/src/testdir/test_exists_autocmd.mnv delete mode 100644 uvim/src/testdir/test_exists_autocmd.vim create mode 100644 uvim/src/testdir/test_exit.mnv delete mode 100644 uvim/src/testdir/test_exit.vim create mode 100644 uvim/src/testdir/test_expand.mnv delete mode 100644 uvim/src/testdir/test_expand.vim create mode 100644 uvim/src/testdir/test_expand_dllpath.mnv delete mode 100644 uvim/src/testdir/test_expand_dllpath.vim create mode 100644 uvim/src/testdir/test_expand_func.mnv delete mode 100644 uvim/src/testdir/test_expand_func.vim create mode 100644 uvim/src/testdir/test_expr.mnv delete mode 100644 uvim/src/testdir/test_expr.vim create mode 100644 uvim/src/testdir/test_expr_utf8.mnv delete mode 100644 uvim/src/testdir/test_expr_utf8.vim create mode 100644 uvim/src/testdir/test_file_perm.mnv delete mode 100644 uvim/src/testdir/test_file_perm.vim create mode 100644 uvim/src/testdir/test_file_size.mnv delete mode 100644 uvim/src/testdir/test_file_size.vim create mode 100644 uvim/src/testdir/test_filechanged.mnv delete mode 100644 uvim/src/testdir/test_filechanged.vim create mode 100644 uvim/src/testdir/test_filecopy.mnv delete mode 100644 uvim/src/testdir/test_filecopy.vim create mode 100644 uvim/src/testdir/test_fileformat.mnv delete mode 100644 uvim/src/testdir/test_fileformat.vim create mode 100644 uvim/src/testdir/test_filetype.mnv delete mode 100644 uvim/src/testdir/test_filetype.vim create mode 100644 uvim/src/testdir/test_filter_cmd.mnv delete mode 100644 uvim/src/testdir/test_filter_cmd.vim create mode 100644 uvim/src/testdir/test_filter_map.mnv delete mode 100644 uvim/src/testdir/test_filter_map.vim create mode 100644 uvim/src/testdir/test_find_complete.mnv delete mode 100644 uvim/src/testdir/test_find_complete.vim create mode 100644 uvim/src/testdir/test_findfile.mnv delete mode 100644 uvim/src/testdir/test_findfile.vim create mode 100644 uvim/src/testdir/test_fixeol.mnv delete mode 100644 uvim/src/testdir/test_fixeol.vim create mode 100644 uvim/src/testdir/test_flatten.mnv delete mode 100644 uvim/src/testdir/test_flatten.vim create mode 100644 uvim/src/testdir/test_float_func.mnv delete mode 100644 uvim/src/testdir/test_float_func.vim create mode 100644 uvim/src/testdir/test_fnameescape.mnv delete mode 100644 uvim/src/testdir/test_fnameescape.vim create mode 100644 uvim/src/testdir/test_fnamemodify.mnv delete mode 100644 uvim/src/testdir/test_fnamemodify.vim create mode 100644 uvim/src/testdir/test_fold.mnv delete mode 100644 uvim/src/testdir/test_fold.vim create mode 100644 uvim/src/testdir/test_format.mnv delete mode 100644 uvim/src/testdir/test_format.vim create mode 100644 uvim/src/testdir/test_function_lists.mnv delete mode 100644 uvim/src/testdir/test_function_lists.vim create mode 100644 uvim/src/testdir/test_functions.mnv delete mode 100644 uvim/src/testdir/test_functions.vim create mode 100644 uvim/src/testdir/test_ga.mnv delete mode 100644 uvim/src/testdir/test_ga.vim create mode 100644 uvim/src/testdir/test_getcwd.mnv delete mode 100644 uvim/src/testdir/test_getcwd.vim create mode 100644 uvim/src/testdir/test_gettext.mnv delete mode 100644 uvim/src/testdir/test_gettext.vim create mode 100644 uvim/src/testdir/test_gettext_cp1251.mnv delete mode 100644 uvim/src/testdir/test_gettext_cp1251.vim create mode 100644 uvim/src/testdir/test_gettext_make.mnv delete mode 100644 uvim/src/testdir/test_gettext_make.vim create mode 100644 uvim/src/testdir/test_gettext_makefile_in1.mnv delete mode 100644 uvim/src/testdir/test_gettext_makefile_in1.vim create mode 100644 uvim/src/testdir/test_gettext_makefile_in2.mnv delete mode 100644 uvim/src/testdir/test_gettext_makefile_in2.vim create mode 100644 uvim/src/testdir/test_gettext_makefile_in3.mnv delete mode 100644 uvim/src/testdir/test_gettext_makefile_in3.vim create mode 100644 uvim/src/testdir/test_gettext_makefile_in4.mnv delete mode 100644 uvim/src/testdir/test_gettext_makefile_in4.vim create mode 100644 uvim/src/testdir/test_gettext_utf8.mnv delete mode 100644 uvim/src/testdir/test_gettext_utf8.vim create mode 100644 uvim/src/testdir/test_getvar.mnv delete mode 100644 uvim/src/testdir/test_getvar.vim create mode 100644 uvim/src/testdir/test_gf.mnv delete mode 100644 uvim/src/testdir/test_gf.vim create mode 100644 uvim/src/testdir/test_glob2regpat.mnv delete mode 100644 uvim/src/testdir/test_glob2regpat.vim create mode 100644 uvim/src/testdir/test_global.mnv delete mode 100644 uvim/src/testdir/test_global.vim create mode 100644 uvim/src/testdir/test_gn.mnv delete mode 100644 uvim/src/testdir/test_gn.vim create mode 100644 uvim/src/testdir/test_goto.mnv delete mode 100644 uvim/src/testdir/test_goto.vim create mode 100644 uvim/src/testdir/test_gui.mnv delete mode 100644 uvim/src/testdir/test_gui.vim create mode 100644 uvim/src/testdir/test_gui_init.mnv delete mode 100644 uvim/src/testdir/test_gui_init.vim create mode 100644 uvim/src/testdir/test_hardcopy.mnv delete mode 100644 uvim/src/testdir/test_hardcopy.vim create mode 100644 uvim/src/testdir/test_help.mnv delete mode 100644 uvim/src/testdir/test_help.vim create mode 100644 uvim/src/testdir/test_help_tagjump.mnv delete mode 100644 uvim/src/testdir/test_help_tagjump.vim create mode 100644 uvim/src/testdir/test_hide.mnv delete mode 100644 uvim/src/testdir/test_hide.vim create mode 100644 uvim/src/testdir/test_highlight.mnv delete mode 100644 uvim/src/testdir/test_highlight.vim create mode 100644 uvim/src/testdir/test_history.mnv delete mode 100644 uvim/src/testdir/test_history.vim create mode 100644 uvim/src/testdir/test_hlsearch.mnv delete mode 100644 uvim/src/testdir/test_hlsearch.vim create mode 100644 uvim/src/testdir/test_iminsert.mnv delete mode 100644 uvim/src/testdir/test_iminsert.vim create mode 100644 uvim/src/testdir/test_increment.mnv delete mode 100644 uvim/src/testdir/test_increment.vim create mode 100644 uvim/src/testdir/test_increment_dbcs.mnv delete mode 100644 uvim/src/testdir/test_increment_dbcs.vim create mode 100644 uvim/src/testdir/test_indent.mnv delete mode 100644 uvim/src/testdir/test_indent.vim create mode 100644 uvim/src/testdir/test_input.mnv delete mode 100644 uvim/src/testdir/test_input.vim create mode 100644 uvim/src/testdir/test_ins_complete.mnv delete mode 100644 uvim/src/testdir/test_ins_complete.vim create mode 100644 uvim/src/testdir/test_ins_complete_no_halt.mnv delete mode 100644 uvim/src/testdir/test_ins_complete_no_halt.vim create mode 100644 uvim/src/testdir/test_interrupt.mnv delete mode 100644 uvim/src/testdir/test_interrupt.vim create mode 100644 uvim/src/testdir/test_job_fails.mnv delete mode 100644 uvim/src/testdir/test_job_fails.vim create mode 100644 uvim/src/testdir/test_join.mnv delete mode 100644 uvim/src/testdir/test_join.vim create mode 100644 uvim/src/testdir/test_json.mnv delete mode 100644 uvim/src/testdir/test_json.vim create mode 100644 uvim/src/testdir/test_jumplist.mnv delete mode 100644 uvim/src/testdir/test_jumplist.vim create mode 100644 uvim/src/testdir/test_lambda.mnv delete mode 100644 uvim/src/testdir/test_lambda.vim create mode 100644 uvim/src/testdir/test_langmap.mnv delete mode 100644 uvim/src/testdir/test_langmap.vim create mode 100644 uvim/src/testdir/test_largefile.mnv delete mode 100644 uvim/src/testdir/test_largefile.vim create mode 100644 uvim/src/testdir/test_let.mnv delete mode 100644 uvim/src/testdir/test_let.vim create mode 100644 uvim/src/testdir/test_lineending.mnv delete mode 100644 uvim/src/testdir/test_lineending.vim create mode 100644 uvim/src/testdir/test_lispindent.mnv delete mode 100644 uvim/src/testdir/test_lispindent.vim create mode 100644 uvim/src/testdir/test_listchars.mnv delete mode 100644 uvim/src/testdir/test_listchars.vim create mode 100644 uvim/src/testdir/test_listdict.mnv delete mode 100644 uvim/src/testdir/test_listdict.vim create mode 100644 uvim/src/testdir/test_listener.mnv delete mode 100644 uvim/src/testdir/test_listener.vim create mode 100644 uvim/src/testdir/test_listlbr.mnv delete mode 100644 uvim/src/testdir/test_listlbr.vim create mode 100644 uvim/src/testdir/test_listlbr_utf8.mnv delete mode 100644 uvim/src/testdir/test_listlbr_utf8.vim create mode 100644 uvim/src/testdir/test_lua.mnv delete mode 100644 uvim/src/testdir/test_lua.vim create mode 100644 uvim/src/testdir/test_makeencoding.mnv delete mode 100644 uvim/src/testdir/test_makeencoding.vim create mode 100644 uvim/src/testdir/test_map_functions.mnv delete mode 100644 uvim/src/testdir/test_map_functions.vim create mode 100644 uvim/src/testdir/test_mapping.mnv delete mode 100644 uvim/src/testdir/test_mapping.vim create mode 100644 uvim/src/testdir/test_marks.mnv delete mode 100644 uvim/src/testdir/test_marks.vim create mode 100644 uvim/src/testdir/test_match.mnv delete mode 100644 uvim/src/testdir/test_match.vim create mode 100644 uvim/src/testdir/test_matchadd_conceal.mnv delete mode 100644 uvim/src/testdir/test_matchadd_conceal.vim create mode 100644 uvim/src/testdir/test_matchadd_conceal_utf8.mnv delete mode 100644 uvim/src/testdir/test_matchadd_conceal_utf8.vim create mode 100644 uvim/src/testdir/test_matchfuzzy.mnv delete mode 100644 uvim/src/testdir/test_matchfuzzy.vim create mode 100644 uvim/src/testdir/test_memory_usage.mnv delete mode 100644 uvim/src/testdir/test_memory_usage.vim create mode 100644 uvim/src/testdir/test_menu.mnv delete mode 100644 uvim/src/testdir/test_menu.vim create mode 100644 uvim/src/testdir/test_messages.mnv delete mode 100644 uvim/src/testdir/test_messages.vim create mode 100644 uvim/src/testdir/test_method.mnv delete mode 100644 uvim/src/testdir/test_method.vim create mode 100644 uvim/src/testdir/test_mksession.mnv delete mode 100644 uvim/src/testdir/test_mksession.vim create mode 100644 uvim/src/testdir/test_mksession_utf8.mnv delete mode 100644 uvim/src/testdir/test_mksession_utf8.vim create mode 100644 uvim/src/testdir/test_mnv9_assign.mnv create mode 100644 uvim/src/testdir/test_mnv9_builtin.mnv create mode 100644 uvim/src/testdir/test_mnv9_class.mnv create mode 100644 uvim/src/testdir/test_mnv9_cmd.mnv create mode 100644 uvim/src/testdir/test_mnv9_disassemble.mnv create mode 100644 uvim/src/testdir/test_mnv9_enum.mnv create mode 100644 uvim/src/testdir/test_mnv9_expr.mnv create mode 100644 uvim/src/testdir/test_mnv9_fails.mnv create mode 100644 uvim/src/testdir/test_mnv9_func.mnv create mode 100644 uvim/src/testdir/test_mnv9_generics.mnv create mode 100644 uvim/src/testdir/test_mnv9_import.mnv create mode 100644 uvim/src/testdir/test_mnv9_interface.mnv create mode 100644 uvim/src/testdir/test_mnv9_python3.mnv create mode 100644 uvim/src/testdir/test_mnv9_script.mnv create mode 100644 uvim/src/testdir/test_mnv9_typealias.mnv create mode 100644 uvim/src/testdir/test_mnvinfo.mnv create mode 100644 uvim/src/testdir/test_mnvscript.mnv create mode 100644 uvim/src/testdir/test_modeless.mnv delete mode 100644 uvim/src/testdir/test_modeless.vim create mode 100644 uvim/src/testdir/test_modeline.mnv delete mode 100644 uvim/src/testdir/test_modeline.vim create mode 100644 uvim/src/testdir/test_move.mnv delete mode 100644 uvim/src/testdir/test_move.vim create mode 100644 uvim/src/testdir/test_mswin_event.mnv delete mode 100644 uvim/src/testdir/test_mswin_event.vim create mode 100644 uvim/src/testdir/test_mzscheme.mnv delete mode 100644 uvim/src/testdir/test_mzscheme.vim create mode 100644 uvim/src/testdir/test_nested_function.mnv delete mode 100644 uvim/src/testdir/test_nested_function.vim create mode 100644 uvim/src/testdir/test_netbeans.mnv delete mode 100644 uvim/src/testdir/test_netbeans.vim create mode 100644 uvim/src/testdir/test_normal.mnv delete mode 100644 uvim/src/testdir/test_normal.vim create mode 100644 uvim/src/testdir/test_number.mnv delete mode 100644 uvim/src/testdir/test_number.vim create mode 100644 uvim/src/testdir/test_options.mnv delete mode 100644 uvim/src/testdir/test_options.vim create mode 100644 uvim/src/testdir/test_options_all.mnv delete mode 100644 uvim/src/testdir/test_options_all.vim create mode 100644 uvim/src/testdir/test_packadd.mnv delete mode 100644 uvim/src/testdir/test_packadd.vim create mode 100644 uvim/src/testdir/test_partial.mnv delete mode 100644 uvim/src/testdir/test_partial.vim create mode 100644 uvim/src/testdir/test_paste.mnv delete mode 100644 uvim/src/testdir/test_paste.vim create mode 100644 uvim/src/testdir/test_perl.mnv delete mode 100644 uvim/src/testdir/test_perl.vim create mode 100644 uvim/src/testdir/test_plugin_comment.mnv delete mode 100644 uvim/src/testdir/test_plugin_comment.vim create mode 100644 uvim/src/testdir/test_plugin_glvs.mnv delete mode 100644 uvim/src/testdir/test_plugin_glvs.vim create mode 100644 uvim/src/testdir/test_plugin_helpcurwin.mnv delete mode 100644 uvim/src/testdir/test_plugin_helpcurwin.vim create mode 100644 uvim/src/testdir/test_plugin_helptoc.mnv delete mode 100644 uvim/src/testdir/test_plugin_helptoc.vim create mode 100644 uvim/src/testdir/test_plugin_man.mnv delete mode 100644 uvim/src/testdir/test_plugin_man.vim create mode 100644 uvim/src/testdir/test_plugin_matchparen.mnv delete mode 100644 uvim/src/testdir/test_plugin_matchparen.vim create mode 100644 uvim/src/testdir/test_plugin_netrw.mnv delete mode 100644 uvim/src/testdir/test_plugin_netrw.vim create mode 100644 uvim/src/testdir/test_plugin_osc52.mnv delete mode 100644 uvim/src/testdir/test_plugin_osc52.vim create mode 100644 uvim/src/testdir/test_plugin_tar.mnv delete mode 100644 uvim/src/testdir/test_plugin_tar.vim create mode 100644 uvim/src/testdir/test_plugin_termdebug.mnv delete mode 100644 uvim/src/testdir/test_plugin_termdebug.vim create mode 100644 uvim/src/testdir/test_plugin_tohtml.mnv delete mode 100644 uvim/src/testdir/test_plugin_tohtml.vim create mode 100644 uvim/src/testdir/test_plugin_tutor.mnv delete mode 100644 uvim/src/testdir/test_plugin_tutor.vim create mode 100644 uvim/src/testdir/test_plugin_zip.mnv delete mode 100644 uvim/src/testdir/test_plugin_zip.vim create mode 100644 uvim/src/testdir/test_plus_arg_edit.mnv delete mode 100644 uvim/src/testdir/test_plus_arg_edit.vim create mode 100644 uvim/src/testdir/test_popup.mnv delete mode 100644 uvim/src/testdir/test_popup.vim create mode 100644 uvim/src/testdir/test_popupwin.mnv delete mode 100644 uvim/src/testdir/test_popupwin.vim create mode 100644 uvim/src/testdir/test_popupwin_textprop.mnv delete mode 100644 uvim/src/testdir/test_popupwin_textprop.vim create mode 100644 uvim/src/testdir/test_preview.mnv delete mode 100644 uvim/src/testdir/test_preview.vim create mode 100644 uvim/src/testdir/test_profile.mnv delete mode 100644 uvim/src/testdir/test_profile.vim create mode 100644 uvim/src/testdir/test_prompt_buffer.mnv delete mode 100644 uvim/src/testdir/test_prompt_buffer.vim create mode 100644 uvim/src/testdir/test_put.mnv delete mode 100644 uvim/src/testdir/test_put.vim create mode 100644 uvim/src/testdir/test_python2.mnv delete mode 100644 uvim/src/testdir/test_python2.vim create mode 100644 uvim/src/testdir/test_python3.mnv delete mode 100644 uvim/src/testdir/test_python3.vim create mode 100644 uvim/src/testdir/test_pyx2.mnv delete mode 100644 uvim/src/testdir/test_pyx2.vim create mode 100644 uvim/src/testdir/test_pyx3.mnv delete mode 100644 uvim/src/testdir/test_pyx3.vim create mode 100644 uvim/src/testdir/test_quickfix.mnv delete mode 100644 uvim/src/testdir/test_quickfix.vim create mode 100644 uvim/src/testdir/test_quotestar.mnv delete mode 100644 uvim/src/testdir/test_quotestar.vim create mode 100644 uvim/src/testdir/test_random.mnv delete mode 100644 uvim/src/testdir/test_random.vim create mode 100644 uvim/src/testdir/test_recover.mnv delete mode 100644 uvim/src/testdir/test_recover.vim create mode 100644 uvim/src/testdir/test_regex_char_classes.mnv delete mode 100644 uvim/src/testdir/test_regex_char_classes.vim create mode 100644 uvim/src/testdir/test_regexp_latin.mnv delete mode 100644 uvim/src/testdir/test_regexp_latin.vim create mode 100644 uvim/src/testdir/test_regexp_utf8.mnv delete mode 100644 uvim/src/testdir/test_regexp_utf8.vim create mode 100644 uvim/src/testdir/test_registers.mnv delete mode 100644 uvim/src/testdir/test_registers.vim create mode 100644 uvim/src/testdir/test_reltime.mnv delete mode 100644 uvim/src/testdir/test_reltime.vim create mode 100644 uvim/src/testdir/test_remote.mnv delete mode 100644 uvim/src/testdir/test_remote.vim create mode 100644 uvim/src/testdir/test_rename.mnv delete mode 100644 uvim/src/testdir/test_rename.vim create mode 100644 uvim/src/testdir/test_restricted.mnv delete mode 100644 uvim/src/testdir/test_restricted.vim create mode 100644 uvim/src/testdir/test_retab.mnv delete mode 100644 uvim/src/testdir/test_retab.vim create mode 100644 uvim/src/testdir/test_ruby.mnv delete mode 100644 uvim/src/testdir/test_ruby.vim create mode 100644 uvim/src/testdir/test_scriptnames.mnv delete mode 100644 uvim/src/testdir/test_scriptnames.vim create mode 100644 uvim/src/testdir/test_scroll_opt.mnv delete mode 100644 uvim/src/testdir/test_scroll_opt.vim create mode 100644 uvim/src/testdir/test_scrollbind.mnv delete mode 100644 uvim/src/testdir/test_scrollbind.vim create mode 100644 uvim/src/testdir/test_search.mnv delete mode 100644 uvim/src/testdir/test_search.vim create mode 100644 uvim/src/testdir/test_search_stat.mnv delete mode 100644 uvim/src/testdir/test_search_stat.vim create mode 100644 uvim/src/testdir/test_searchpos.mnv delete mode 100644 uvim/src/testdir/test_searchpos.vim create mode 100644 uvim/src/testdir/test_selectmode.mnv delete mode 100644 uvim/src/testdir/test_selectmode.vim create mode 100644 uvim/src/testdir/test_set.mnv delete mode 100644 uvim/src/testdir/test_set.vim create mode 100644 uvim/src/testdir/test_sha256.mnv delete mode 100644 uvim/src/testdir/test_sha256.vim create mode 100644 uvim/src/testdir/test_shell.mnv delete mode 100644 uvim/src/testdir/test_shell.vim create mode 100644 uvim/src/testdir/test_shift.mnv delete mode 100644 uvim/src/testdir/test_shift.vim create mode 100644 uvim/src/testdir/test_shortpathname.mnv delete mode 100644 uvim/src/testdir/test_shortpathname.vim create mode 100644 uvim/src/testdir/test_signals.mnv delete mode 100644 uvim/src/testdir/test_signals.vim create mode 100644 uvim/src/testdir/test_signs.mnv delete mode 100644 uvim/src/testdir/test_signs.vim create mode 100644 uvim/src/testdir/test_sleep.mnv delete mode 100644 uvim/src/testdir/test_sleep.vim create mode 100644 uvim/src/testdir/test_smartindent.mnv delete mode 100644 uvim/src/testdir/test_smartindent.vim create mode 100644 uvim/src/testdir/test_sort.mnv delete mode 100644 uvim/src/testdir/test_sort.vim create mode 100644 uvim/src/testdir/test_sound.mnv delete mode 100644 uvim/src/testdir/test_sound.vim create mode 100644 uvim/src/testdir/test_source.mnv delete mode 100644 uvim/src/testdir/test_source.vim create mode 100644 uvim/src/testdir/test_source_utf8.mnv delete mode 100644 uvim/src/testdir/test_source_utf8.vim create mode 100644 uvim/src/testdir/test_spell.mnv delete mode 100644 uvim/src/testdir/test_spell.vim create mode 100644 uvim/src/testdir/test_spell_utf8.mnv delete mode 100644 uvim/src/testdir/test_spell_utf8.vim create mode 100644 uvim/src/testdir/test_spellfile.mnv delete mode 100644 uvim/src/testdir/test_spellfile.vim create mode 100644 uvim/src/testdir/test_spellrare.mnv delete mode 100644 uvim/src/testdir/test_spellrare.vim create mode 100644 uvim/src/testdir/test_stacktrace.mnv delete mode 100644 uvim/src/testdir/test_stacktrace.vim create mode 100644 uvim/src/testdir/test_startup.mnv delete mode 100644 uvim/src/testdir/test_startup.vim create mode 100644 uvim/src/testdir/test_startup_utf8.mnv delete mode 100644 uvim/src/testdir/test_startup_utf8.vim create mode 100644 uvim/src/testdir/test_stat.mnv delete mode 100644 uvim/src/testdir/test_stat.vim create mode 100644 uvim/src/testdir/test_statusline.mnv delete mode 100644 uvim/src/testdir/test_statusline.vim create mode 100644 uvim/src/testdir/test_statuslineopt.mnv delete mode 100644 uvim/src/testdir/test_statuslineopt.vim create mode 100644 uvim/src/testdir/test_substitute.mnv delete mode 100644 uvim/src/testdir/test_substitute.vim create mode 100644 uvim/src/testdir/test_suspend.mnv delete mode 100644 uvim/src/testdir/test_suspend.vim create mode 100644 uvim/src/testdir/test_swap.mnv delete mode 100644 uvim/src/testdir/test_swap.vim create mode 100644 uvim/src/testdir/test_syn_attr.mnv delete mode 100644 uvim/src/testdir/test_syn_attr.vim create mode 100644 uvim/src/testdir/test_syntax.mnv delete mode 100644 uvim/src/testdir/test_syntax.vim create mode 100644 uvim/src/testdir/test_system.mnv delete mode 100644 uvim/src/testdir/test_system.vim create mode 100644 uvim/src/testdir/test_tab.mnv delete mode 100644 uvim/src/testdir/test_tab.vim create mode 100644 uvim/src/testdir/test_tabline.mnv delete mode 100644 uvim/src/testdir/test_tabline.vim create mode 100644 uvim/src/testdir/test_tabpage.mnv delete mode 100644 uvim/src/testdir/test_tabpage.vim create mode 100644 uvim/src/testdir/test_tabpanel.mnv delete mode 100644 uvim/src/testdir/test_tabpanel.vim create mode 100644 uvim/src/testdir/test_tagcase.mnv delete mode 100644 uvim/src/testdir/test_tagcase.vim create mode 100644 uvim/src/testdir/test_tagfunc.mnv delete mode 100644 uvim/src/testdir/test_tagfunc.vim create mode 100644 uvim/src/testdir/test_tagjump.mnv delete mode 100644 uvim/src/testdir/test_tagjump.vim create mode 100644 uvim/src/testdir/test_taglist.mnv delete mode 100644 uvim/src/testdir/test_taglist.vim create mode 100644 uvim/src/testdir/test_tcl.mnv delete mode 100644 uvim/src/testdir/test_tcl.vim create mode 100644 uvim/src/testdir/test_termcodes.mnv delete mode 100644 uvim/src/testdir/test_termcodes.vim create mode 100644 uvim/src/testdir/test_termencoding.mnv delete mode 100644 uvim/src/testdir/test_termencoding.vim create mode 100644 uvim/src/testdir/test_terminal.mnv delete mode 100644 uvim/src/testdir/test_terminal.vim create mode 100644 uvim/src/testdir/test_terminal2.mnv delete mode 100644 uvim/src/testdir/test_terminal2.vim create mode 100644 uvim/src/testdir/test_terminal3.mnv delete mode 100644 uvim/src/testdir/test_terminal3.vim create mode 100644 uvim/src/testdir/test_terminal_fail.mnv delete mode 100644 uvim/src/testdir/test_terminal_fail.vim create mode 100644 uvim/src/testdir/test_textformat.mnv delete mode 100644 uvim/src/testdir/test_textformat.vim create mode 100644 uvim/src/testdir/test_textobjects.mnv delete mode 100644 uvim/src/testdir/test_textobjects.vim create mode 100644 uvim/src/testdir/test_textprop.mnv delete mode 100644 uvim/src/testdir/test_textprop.vim create mode 100644 uvim/src/testdir/test_timers.mnv delete mode 100644 uvim/src/testdir/test_timers.vim create mode 100644 uvim/src/testdir/test_true_false.mnv delete mode 100644 uvim/src/testdir/test_true_false.vim create mode 100644 uvim/src/testdir/test_trycatch.mnv delete mode 100644 uvim/src/testdir/test_trycatch.vim create mode 100644 uvim/src/testdir/test_tuple.mnv delete mode 100644 uvim/src/testdir/test_tuple.vim create mode 100644 uvim/src/testdir/test_undo.mnv delete mode 100644 uvim/src/testdir/test_undo.vim create mode 100644 uvim/src/testdir/test_uniq.mnv delete mode 100644 uvim/src/testdir/test_uniq.vim create mode 100644 uvim/src/testdir/test_unlet.mnv delete mode 100644 uvim/src/testdir/test_unlet.vim create mode 100644 uvim/src/testdir/test_user_func.mnv delete mode 100644 uvim/src/testdir/test_user_func.vim create mode 100644 uvim/src/testdir/test_usercommands.mnv delete mode 100644 uvim/src/testdir/test_usercommands.vim create mode 100644 uvim/src/testdir/test_utf8.mnv delete mode 100644 uvim/src/testdir/test_utf8.vim create mode 100644 uvim/src/testdir/test_utf8_comparisons.mnv delete mode 100644 uvim/src/testdir/test_utf8_comparisons.vim create mode 100644 uvim/src/testdir/test_vartabs.mnv delete mode 100644 uvim/src/testdir/test_vartabs.vim create mode 100644 uvim/src/testdir/test_version.mnv delete mode 100644 uvim/src/testdir/test_version.vim delete mode 100644 uvim/src/testdir/test_vim9_assign.vim delete mode 100644 uvim/src/testdir/test_vim9_builtin.vim delete mode 100644 uvim/src/testdir/test_vim9_class.vim delete mode 100644 uvim/src/testdir/test_vim9_cmd.vim delete mode 100644 uvim/src/testdir/test_vim9_disassemble.vim delete mode 100644 uvim/src/testdir/test_vim9_enum.vim delete mode 100644 uvim/src/testdir/test_vim9_expr.vim delete mode 100644 uvim/src/testdir/test_vim9_fails.vim delete mode 100644 uvim/src/testdir/test_vim9_func.vim delete mode 100644 uvim/src/testdir/test_vim9_generics.vim delete mode 100644 uvim/src/testdir/test_vim9_import.vim delete mode 100644 uvim/src/testdir/test_vim9_interface.vim delete mode 100644 uvim/src/testdir/test_vim9_python3.vim delete mode 100644 uvim/src/testdir/test_vim9_script.vim delete mode 100644 uvim/src/testdir/test_vim9_typealias.vim delete mode 100644 uvim/src/testdir/test_viminfo.vim delete mode 100644 uvim/src/testdir/test_vimscript.vim create mode 100644 uvim/src/testdir/test_virtualedit.mnv delete mode 100644 uvim/src/testdir/test_virtualedit.vim create mode 100644 uvim/src/testdir/test_visual.mnv delete mode 100644 uvim/src/testdir/test_visual.vim create mode 100644 uvim/src/testdir/test_wayland.mnv delete mode 100644 uvim/src/testdir/test_wayland.vim create mode 100644 uvim/src/testdir/test_winbar.mnv delete mode 100644 uvim/src/testdir/test_winbar.vim create mode 100644 uvim/src/testdir/test_winbuf_close.mnv delete mode 100644 uvim/src/testdir/test_winbuf_close.vim create mode 100644 uvim/src/testdir/test_window_cmd.mnv delete mode 100644 uvim/src/testdir/test_window_cmd.vim create mode 100644 uvim/src/testdir/test_window_id.mnv delete mode 100644 uvim/src/testdir/test_window_id.vim create mode 100644 uvim/src/testdir/test_windows_home.mnv delete mode 100644 uvim/src/testdir/test_windows_home.vim create mode 100644 uvim/src/testdir/test_winfixbuf.mnv delete mode 100644 uvim/src/testdir/test_winfixbuf.vim create mode 100644 uvim/src/testdir/test_wnext.mnv delete mode 100644 uvim/src/testdir/test_wnext.vim create mode 100644 uvim/src/testdir/test_wordcount.mnv delete mode 100644 uvim/src/testdir/test_wordcount.vim create mode 100644 uvim/src/testdir/test_writefile.mnv delete mode 100644 uvim/src/testdir/test_writefile.vim create mode 100644 uvim/src/testdir/test_xdg.mnv delete mode 100644 uvim/src/testdir/test_xdg.vim create mode 100644 uvim/src/testdir/test_xxd.mnv delete mode 100644 uvim/src/testdir/test_xxd.vim create mode 100644 uvim/src/testdir/util/amiga.mnv delete mode 100644 uvim/src/testdir/util/amiga.vim create mode 100644 uvim/src/testdir/util/check.mnv delete mode 100644 uvim/src/testdir/util/check.vim create mode 100644 uvim/src/testdir/util/color_ramp.mnv delete mode 100644 uvim/src/testdir/util/color_ramp.vim create mode 100644 uvim/src/testdir/util/dos.mnv delete mode 100644 uvim/src/testdir/util/dos.vim create mode 100644 uvim/src/testdir/util/gen_opt_test.mnv delete mode 100644 uvim/src/testdir/util/gen_opt_test.vim create mode 100644 uvim/src/testdir/util/gui_init.mnv delete mode 100644 uvim/src/testdir/util/gui_init.vim create mode 100644 uvim/src/testdir/util/gui_preinit.mnv delete mode 100644 uvim/src/testdir/util/gui_preinit.vim create mode 100644 uvim/src/testdir/util/mnv9.mnv create mode 100644 uvim/src/testdir/util/mouse.mnv delete mode 100644 uvim/src/testdir/util/mouse.vim create mode 100644 uvim/src/testdir/util/popupbounce.mnv delete mode 100644 uvim/src/testdir/util/popupbounce.vim create mode 100644 uvim/src/testdir/util/screendump.mnv delete mode 100644 uvim/src/testdir/util/screendump.vim create mode 100644 uvim/src/testdir/util/script_util.mnv delete mode 100644 uvim/src/testdir/util/script_util.vim create mode 100644 uvim/src/testdir/util/setup.mnv delete mode 100644 uvim/src/testdir/util/setup.vim create mode 100644 uvim/src/testdir/util/setup_gui.mnv delete mode 100644 uvim/src/testdir/util/setup_gui.vim create mode 100644 uvim/src/testdir/util/shared.mnv delete mode 100644 uvim/src/testdir/util/shared.vim create mode 100644 uvim/src/testdir/util/socketserver.mnv delete mode 100644 uvim/src/testdir/util/socketserver.vim create mode 100644 uvim/src/testdir/util/summarize.mnv delete mode 100644 uvim/src/testdir/util/summarize.vim create mode 100644 uvim/src/testdir/util/term_util.mnv delete mode 100644 uvim/src/testdir/util/term_util.vim create mode 100644 uvim/src/testdir/util/unix.mnv delete mode 100644 uvim/src/testdir/util/unix.vim create mode 100644 uvim/src/testdir/util/view_util.mnv delete mode 100644 uvim/src/testdir/util/view_util.vim delete mode 100644 uvim/src/testdir/util/vim9.vim create mode 100644 uvim/src/testdir/util/vms.mnv delete mode 100644 uvim/src/testdir/util/vms.vim create mode 100644 uvim/src/testdir/util/window_manager.mnv delete mode 100644 uvim/src/testdir/util/window_manager.vim create mode 100644 uvim/src/testdir/viewdumps.mnv delete mode 100644 uvim/src/testdir/viewdumps.vim delete mode 100644 uvim/src/vim.h delete mode 100644 uvim/src/vim.ico delete mode 100644 uvim/src/vim.manifest delete mode 100644 uvim/src/vim.rc delete mode 100644 uvim/src/vim.tlb delete mode 100644 uvim/src/vim9.h delete mode 100644 uvim/src/vim9class.c delete mode 100644 uvim/src/vim9cmds.c delete mode 100644 uvim/src/vim9compile.c delete mode 100644 uvim/src/vim9execute.c delete mode 100644 uvim/src/vim9expr.c delete mode 100644 uvim/src/vim9generics.c delete mode 100644 uvim/src/vim9instr.c delete mode 100644 uvim/src/vim9script.c delete mode 100644 uvim/src/vim9type.c delete mode 100644 uvim/src/vim_alert.ico delete mode 100644 uvim/src/vim_error.ico delete mode 100644 uvim/src/vim_icon.xbm delete mode 100644 uvim/src/vim_info.ico delete mode 100644 uvim/src/vim_mask.xbm delete mode 100644 uvim/src/vim_quest.ico delete mode 100644 uvim/src/viminfo.c delete mode 100644 uvim/src/vimrun.c delete mode 100755 uvim/src/vimtutor (limited to 'uvim/src') diff --git a/uvim/src/GmnvExt/GmnvExt.reg b/uvim/src/GmnvExt/GmnvExt.reg new file mode 100644 index 0000000000..3bb64be878 --- /dev/null +++ b/uvim/src/GmnvExt/GmnvExt.reg @@ -0,0 +1,20 @@ +REGEDIT4 + +[HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}] + @="MNV Shell Extension" +[HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32] + @="gmnvext.dll" + "ThreadingModel"="Apartment" + +[HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\gmnv] + @="{51EEE242-AD87-11d3-9C1E-0090278BBD99}" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved] + "{51EEE242-AD87-11d3-9C1E-0090278BBD99}"="MNV Shell Extension" + +[HKEY_LOCAL_MACHINE\Software\MNV\Gmnv] + "path"="gmnv.exe" + +[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\MNV 9.2] + "DisplayName"="MNV 9.2: Edit with MNV popup menu entry" + "UninstallString"="uninstall.exe" diff --git a/uvim/src/GmnvExt/Make_ming.mak b/uvim/src/GmnvExt/Make_ming.mak new file mode 100644 index 0000000000..cd48a818c6 --- /dev/null +++ b/uvim/src/GmnvExt/Make_ming.mak @@ -0,0 +1,96 @@ +# Project: gmnvext +# Generates gmnvext.dll with gcc. +# To be used with MingW and Cygwin. +# +# Originally, the DLL base address was fixed: -Wl,--image-base=0x1C000000 +# Now it is allocated dynamically by the linker by evaluating all DLLs +# already loaded in memory. The binary image contains as well information +# for automatic pseudo-rebasing, if needed by the system. ALV 2004-02-29 + +# If cross-compiling set this to yes, else set it to no +CROSS = no +#CROSS = yes +# For the old MinGW 2.95 (the one you get e.g. with debian woody) +# set the following variable to yes and check if the executables are +# really named that way. +# If you have a newer MinGW or you are using cygwin set it to no and +# check also the executables +MINGWOLD = no + +# Link against the shared versions of libgcc/libstdc++ by default. Set +# STATIC_STDCPLUS to "yes" to link against static versions instead. +STATIC_STDCPLUS=no +#STATIC_STDCPLUS=yes + +# If you use TDM-GCC(-64), change HAS_GCC_EH to "no". +# This is used when STATIC_STDCPLUS=yes. +HAS_GCC_EH=yes + +STATIC_LIBS= + +# Note: -static-libstdc++ is not available until gcc 4.5.x. +LDFLAGS += -shared +ifeq (yes, $(STATIC_STDCPLUS)) +LDFLAGS += -static-libgcc -static-libstdc++ +# Order important: gcc_eh must be placed before winpthread +STATIC_LIBS += -lstdc++ -lgcc + ifeq (yes, $(HAS_GCC_EH)) +STATIC_LIBS += -lgcc_eh + endif +STATIC_LIBS += -lwinpthread +endif + +ifeq ($(CROSS),yes) +DEL = rm -f +ifeq ($(MINGWOLD),yes) +CXXFLAGS := -O2 -fvtable-thunks +else +CXXFLAGS := -O2 +endif +else +CXXFLAGS := -O2 +ifneq (sh.exe, $(SHELL)) +DEL = rm -f +else +DEL = del +endif +endif +# Set the default $(WINVER) to make it work with Windows 7. +ifndef WINVER +WINVER = 0x0601 +endif +CXX := $(CROSS_COMPILE)g++ +WINDRES := $(CROSS_COMPILE)windres +# this used to have --preprocessor, but it's no longer supported +WINDRES_FLAGS = +LIBS := -luuid -lgdi32 +RES := gmnvext.res +ifeq ($(findstring clang++,$(CXX)),) +DEFFILE = gmnvext_ming.def +endif +OBJ := gmnvext.o + +DLL := gmnvext.dll + +.PHONY: all all-before all-after clean clean-custom + +all: all-before $(DLL) all-after + +$(DLL): $(OBJ) $(RES) $(DEFFILE) + $(CXX) $(LDFLAGS) $(CXXFLAGS) -s -o $@ \ + -Wl,--enable-auto-image-base \ + -Wl,--enable-auto-import \ + -Wl,--whole-archive \ + $^ \ + -Wl,--no-whole-archive \ + $(LIBS) \ + -Wl,-Bstatic $(STATIC_LIBS) -Wl,-Bdynamic + +gmnvext.o: gmnvext.cpp + $(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) -c $? -o $@ + +$(RES): gmnvext_ming.rc + $(WINDRES) $(WINDRES_FLAGS) --input-format=rc --output-format=coff -DMING $? -o $@ + +clean: clean-custom + -$(DEL) $(OBJ) $(RES) $(DLL) diff --git a/uvim/src/GmnvExt/Make_mvc.mak b/uvim/src/GmnvExt/Make_mvc.mak new file mode 100644 index 0000000000..45327125d5 --- /dev/null +++ b/uvim/src/GmnvExt/Make_mvc.mak @@ -0,0 +1,102 @@ +# Makefile for GmnvExt, using MSVC +# Options: +# DEBUG=yes Build debug version (for VC7 and maybe later) +# CPUARG= /arch:IA32/AVX/etc, call from main makefile to set +# automatically from CPUNR +# + +# included common tools +!INCLUDE ..\auto\nmake\tools.mak + +TARGETOS = WINNT + +!IFNDEF APPVER +APPVER = 6.01 +!ENDIF +# Set the default $(WINVER) to make it work with Windows 7. +!IFNDEF WINVER +WINVER = 0x0601 +!ENDIF + +!IF "$(DEBUG)" != "yes" +NODEBUG = 1 +!ENDIF + +!IFNDEF CPU +CPU = i386 +! IFNDEF PLATFORM +! IFDEF TARGET_CPU +PLATFORM = $(TARGET_CPU) +! ELSEIF defined(VSCMD_ARG_TGT_ARCH) +PLATFORM = $(VSCMD_ARG_TGT_ARCH) +! ENDIF +! ENDIF +! IFDEF PLATFORM +! IF ("$(PLATFORM)" == "x64") || ("$(PLATFORM)" == "X64") +CPU = AMD64 +! ELSEIF ("$(PLATFORM)" == "arm64") || ("$(PLATFORM)" == "ARM64") +CPU = ARM64 +! ELSEIF ("$(PLATFORM)" != "x86") && ("$(PLATFORM)" != "X86") +! ERROR *** ERROR Unknown target platform "$(PLATFORM)". Make aborted. +! ENDIF +! ENDIF +!ENDIF + +!IFDEF SDK_INCLUDE_DIR +! INCLUDE $(SDK_INCLUDE_DIR)\Win32.mak +!ELSEIF "$(USE_WIN32MAK)"=="yes" +! INCLUDE +!ELSE +cc = cl +link = link +rc = rc +cflags = -nologo -c +lflags = -incremental:no -nologo +rcflags = /r +olelibsdll = ole32.lib uuid.lib oleaut32.lib user32.lib gdi32.lib advapi32.lib +!ENDIF + +# include CPUARG +cflags = $(cflags) $(CPUARG) + +# set WINVER and _WIN32_WINNT +cflags = $(cflags) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) + +!IF "$(CL)" == "/D_USING_V110_SDK71_" +rcflags = $(rcflags) /D_USING_V110_SDK71_ +!ENDIF + +SUBSYSTEM = console +!IF "$(SUBSYSTEM_VER)" != "" +SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER) +!ENDIF + +!IF "$(CPU)" == "AMD64" || "$(CPU)" == "ARM64" +OFFSET = 0x11C000000 +!ELSE +OFFSET = 0x1C000000 +!ENDIF + +all: gmnvext.dll + +gmnvext.dll: gmnvext.obj gmnvext.res + $(link) $(lflags) -dll -def:gmnvext.def -base:$(OFFSET) \ + -out:$*.dll $** $(olelibsdll) shell32.lib comctl32.lib \ + -subsystem:$(SUBSYSTEM) + +gmnvext.obj: gmnvext.h + +.cpp.obj: + $(cc) $(cflags) -DFEAT_GETTEXT $(cvarsmt) $*.cpp + +gmnvext.res: gmnvext.rc + $(rc) /nologo $(rcflags) $(rcvars) gmnvext.rc + +clean: + - if exist gmnvext.dll $(RM) gmnvext.dll + - if exist gmnvext.lib $(RM) gmnvext.lib + - if exist gmnvext.exp $(RM) gmnvext.exp + - if exist gmnvext.obj $(RM) gmnvext.obj + - if exist gmnvext.res $(RM) gmnvext.res + +# mnv: set noet sw=8 ts=8 sts=0 wm=0 tw=79 ft=make: diff --git a/uvim/src/GmnvExt/Makefile b/uvim/src/GmnvExt/Makefile new file mode 100644 index 0000000000..18b91ece29 --- /dev/null +++ b/uvim/src/GmnvExt/Makefile @@ -0,0 +1,4 @@ +!message This makefile is deprecated. Use Make_mvc.mak instead. +!message + +!include Make_mvc.mak diff --git a/uvim/src/GmnvExt/README.txt b/uvim/src/GmnvExt/README.txt new file mode 100644 index 0000000000..7b54408d72 --- /dev/null +++ b/uvim/src/GmnvExt/README.txt @@ -0,0 +1,94 @@ +README.txt for the gmnvext DLL. + +Written by Tianmiao Hu. Edited by Bram Moolenaar. + + +INSTALLATION + +To install the "Edit with MNV" popup menu entry, it is recommended to use the +"install.exe" program. It will ask you a few questions and install the needed +registry entries. + +In special situations you might want to make changes by hand. Check these +items: +- The gmnvext.dll, gmnv.exe and uninstall.exe either need to be in the search + path, or you have to set the full path in the registry entries. You could + move the gmnvext.dll to the "windows\system" or "windows\system32" + directory, where the other DLL files are. +- You can find the names of the used registry entries in the file + "GmnvExt.reg". You can edit this file to add the paths. To install the + registry entries, right-click the gmnvext.reg file and choose the "merge" + menu option. +- The registry key [HKEY_LOCAL_MACHINE\Software\MNV\Gmnv] is used by the + gmnvext.dll. The value "path" specifies the location of "gmnv.exe". If + gmnv.exe is in the search path, the path can be omitted. The value "lang" + can be used to set the language, for example "de" for German. If "lang" is + omitted, the language set for Windows will be used. + +It is the preferred method to keep gmnv.exe with the runtime files, so that +MNV will find them (also the translated menu items are there). + + +UNINSTALLATION + +To uninstall the "Edit with MNV" popup menu entry, it is recommended to use +the "uninstal.exe" program. + +In special situations you might want to uninstall by hand: +- Open the registry by running regedit.exe. +- Delete all the keys listed in GmnvExt.reg, except this one: + [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved] + For this key, only delete one value: + "{51EEE242-AD87-11d3-9C1E-0090278BBD99}"="MNV Shell Extension" +- Delete the gmnvext.dll, if you want. You might need to reboot the machine + in order to remove this file. A quick way is to log off and re-login. + +Another method is by using the uninst.bat script: + uninst gmnvext.inf +This batch file will remove all the registry keys from the system. Then you +can remove the gmnvext.dll file. +Note: In order for this batch file to work, you must have two system files: +rundll32.exe and setupapi.dll. I believe you will have rundll32.exe in your +system. I know windows nt 4.0 with the service pack 4 has setupapi.dll. My +windows 95 has setupapi.dll. I find that the internet explorer 4.0 comes with +the setupapi.dll in file Ie4_5.cab. + +If you do encounter problems running this script, then probably you need to +modify the uninst.bat to suit to your system. Basically, you must find out +where are the locations for your rundll32.exe and setupapi.dll files. In +windows nt, both files are under c:\winnt\system32 directory. In my windows 95 +system, I got setupapi.dll at c:\windows\system and rundll32.exe at +c:\windows. So you might want to try something like: + rundll32.exe c:\windows\system\setupapi.dll,InstallHinfSection DefaultUninstall 128 %1 +where %1 can be substituted by gmnvext.inf + + +THE SOURCE CODE + +I have provided the source code here in hope that gmnv users around world can +further enhance this little dll. I believe the only thing you need to change +is gmnvext.cpp file. The important two functions you need to look at are +QueryContextMenu and InvokeCommand. You can modify right-click menus in the +QueryContextMenu function and invoke gmnv in the InvokeCommand function. Note +the selected files can be accessed from the DragQueryFile function. I am not +familiar with the invoking options for gmnv. I believe there are some +improvements that can be made on that side. + +I use MS Visual C++ 6.0's nmake to make the gmnvext.dll. I don't have a +chance to try earlier versions of MSVC. The files that are required for build +are: + gmnvext.cpp + gmnvext.h + gmnvext.def + gmnvext.rc + resource.h + Makefile + +To compile the DLL from the command line: + vcvars32 + nmake -f Makefile + +If you did something interesting to this dll, please let me know +@ tianmiao@acm.org. + +Happy mnvming!!! diff --git a/uvim/src/GmnvExt/gmnvext.cpp b/uvim/src/GmnvExt/gmnvext.cpp new file mode 100644 index 0000000000..df1da39058 --- /dev/null +++ b/uvim/src/GmnvExt/gmnvext.cpp @@ -0,0 +1,1065 @@ +/* vi:set ts=8 sts=4 sw=4: + * + * MNV - MNV is not Vim gmnvext by Tianmiao Hu + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + */ + +/* + * gmnvext is a DLL which is used for the "Edit with MNV" context menu + * extension. It implements a MS defined interface with the Shell. + * + * If you have any questions or any suggestions concerning gmnvext, please + * contact Tianmiao Hu: tianmiao@acm.org. + */ + +#include "gmnvext.h" + +static char *searchpath(char *name); + +// Always get an error while putting the following stuff to the +// gmnvext.h file as class protected variables, give up and +// declare them as global stuff +FORMATETC fmte = {CF_HDROP, + (DVTARGETDEVICE FAR *)NULL, + DVASPECT_CONTENT, + -1, + TYMED_HGLOBAL + }; +STGMEDIUM medium; +HRESULT hres = 0; +UINT cbFiles = 0; + +/* The buffers size used to be MAX_PATH (260 bytes), but that's not always + * enough */ +#define BUFSIZE 1100 + +// The "Edit with MNV" shell extension provides these choices when +// a new instance of Gmnv is selected: +// - use tabpages +// - enable diff mode +// - none of the above +#define EDIT_WITH_MNV_USE_TABPAGES (2) +#define EDIT_WITH_MNV_IN_DIFF_MODE (1) +#define EDIT_WITH_MNV_NO_OPTIONS (0) + +// +// Get the name of the Gmnv executable to use, with the path. +// When "runtime" is non-zero, we were called to find the runtime directory. +// Returns the path in name[BUFSIZE]. It's empty when it fails. +// + static void +getGmnvName(char *name, int runtime) +{ + HKEY keyhandle; + DWORD hlen; + + // Get the location of gmnv from the registry. Try + // HKEY_CURRENT_USER first, then fall back to HKEY_LOCAL_MACHINE if + // not found. + name[0] = 0; + if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\MNV\\Gmnv", 0, + KEY_READ, &keyhandle) == ERROR_SUCCESS) + { + hlen = BUFSIZE; + if (RegQueryValueEx(keyhandle, "path", 0, NULL, (BYTE *)name, &hlen) + != ERROR_SUCCESS) + name[0] = 0; + else + name[hlen] = 0; + RegCloseKey(keyhandle); + } + + if ((name[0] == 0) && + (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\MNV\\Gmnv", 0, + KEY_READ, &keyhandle) == ERROR_SUCCESS)) + { + hlen = BUFSIZE; + if (RegQueryValueEx(keyhandle, "path", 0, NULL, (BYTE *)name, &hlen) + != ERROR_SUCCESS) + name[0] = 0; + else + name[hlen] = 0; + RegCloseKey(keyhandle); + } + + // Registry didn't work, use the search path. + if (name[0] == 0) + strcpy(name, searchpath((char *)"gmnv.exe")); + + if (!runtime) + { + // Only when looking for the executable, not the runtime dir, we can + // search for the batch file or a name without a path. + if (name[0] == 0) + strcpy(name, searchpath((char *)"gmnv.bat")); + if (name[0] == 0) + strcpy(name, "gmnv"); // finds gmnv.bat or gmnv.exe + } +} + + static void +getGmnvInvocation(char *name, int runtime) +{ + getGmnvName(name, runtime); + // avoid that MNV tries to expand wildcards in the file names + strcat(name, " --literal"); +} + + static void +getGmnvInvocationW(wchar_t *nameW) +{ + char *name; + + name = (char *)malloc(BUFSIZE); + getGmnvInvocation(name, 0); + mbstowcs(nameW, name, BUFSIZE); + free(name); +} + +// +// Get the MNV runtime directory into buf[BUFSIZE]. +// The result is empty when it failed. +// When it works, the path ends in a slash or backslash. +// + static void +getRuntimeDir(char *buf) +{ + int idx; + + getGmnvName(buf, 1); + if (buf[0] != 0) + { + // When no path found, use the search path to expand it. + if (strchr(buf, '/') == NULL && strchr(buf, '\\') == NULL) + strcpy(buf, searchpath(buf)); + + // remove "gmnv.exe" from the end + for (idx = (int)strlen(buf) - 1; idx >= 0; idx--) + if (buf[idx] == '\\' || buf[idx] == '/') + { + buf[idx + 1] = 0; + break; + } + } +} + + WCHAR * +utf8_to_utf16(const char *s) +{ + int size = MultiByteToWideChar(CP_UTF8, 0, s, -1, NULL, 0); + WCHAR *buf = (WCHAR *)malloc(size * sizeof(WCHAR)); + MultiByteToWideChar(CP_UTF8, 0, s, -1, buf, size); + return buf; +} + + HBITMAP +IconToBitmap(HICON hIcon, HBRUSH hBackground, int width, int height) +{ + HDC hDC = GetDC(NULL); + HDC hMemDC = CreateCompatibleDC(hDC); + HBITMAP hMemBmp = CreateCompatibleBitmap(hDC, width, height); + HBITMAP hResultBmp = NULL; + HGDIOBJ hOrgBMP = SelectObject(hMemDC, hMemBmp); + + DrawIconEx(hMemDC, 0, 0, hIcon, width, height, 0, hBackground, DI_NORMAL); + + hResultBmp = hMemBmp; + hMemBmp = NULL; + + SelectObject(hMemDC, hOrgBMP); + DeleteDC(hMemDC); + ReleaseDC(NULL, hDC); + DestroyIcon(hIcon); + return hResultBmp; +} + +// +// GETTEXT: translated messages and menu entries +// +#ifndef FEAT_GETTEXT +# define _(x) x +# define W_impl(x) _wcsdup(L##x) +# define W(x) W_impl(x) +# define set_gettext_codeset() NULL +# define restore_gettext_codeset(x) +#else +# define _(x) (*dyn_libintl_gettext)(x) +# define W(x) utf8_to_utf16(x) +# define MNVPACKAGE "mnv" +# ifndef GETTEXT_DLL +# define GETTEXT_DLL "libintl.dll" +# define GETTEXT_DLL_ALT "libintl-8.dll" +# endif + +// Dummy functions +static char *null_libintl_gettext(const char *); +static char *null_libintl_textdomain(const char *); +static char *null_libintl_bindtextdomain(const char *, const char *); +static char *null_libintl_bind_textdomain_codeset(const char *, const char *); +static int dyn_libintl_init(char *dir); +static void dyn_libintl_end(void); + +static HINSTANCE hLibintlDLL = 0; +static char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext; +static char *(*dyn_libintl_textdomain)(const char *) = null_libintl_textdomain; +static char *(*dyn_libintl_bindtextdomain)(const char *, const char *) + = null_libintl_bindtextdomain; +static char *(*dyn_libintl_bind_textdomain_codeset)(const char *, const char *) + = null_libintl_bind_textdomain_codeset; + +// +// Attempt to load libintl.dll. If it doesn't work, use dummy functions. +// "dir" is the directory where the libintl.dll might be. +// Return 1 for success, 0 for failure. +// + static int +dyn_libintl_init(char *dir) +{ + int i; + static struct + { + char *name; + FARPROC *ptr; + } libintl_entry[] = + { + {(char *)"gettext", (FARPROC*)&dyn_libintl_gettext}, + {(char *)"textdomain", (FARPROC*)&dyn_libintl_textdomain}, + {(char *)"bindtextdomain", (FARPROC*)&dyn_libintl_bindtextdomain}, + {(char *)"bind_textdomain_codeset", (FARPROC*)&dyn_libintl_bind_textdomain_codeset}, + {NULL, NULL} + }; + DWORD len, len2; + LPWSTR buf = NULL; + LPWSTR buf2 = NULL; + + // No need to initialize twice. + if (hLibintlDLL) + return 1; + + // Load gettext library from $MNVRUNTIME\GmnvExt{64,32} directory. + // Add the directory to $PATH temporarily. + len = GetEnvironmentVariableW(L"PATH", NULL, 0); + len2 = MAX_PATH + 1 + len; + buf = (LPWSTR)malloc(len * sizeof(WCHAR)); + buf2 = (LPWSTR)malloc(len2 * sizeof(WCHAR)); + if (buf != NULL && buf2 != NULL) + { + GetEnvironmentVariableW(L"PATH", buf, len); +# ifdef _WIN64 + _snwprintf(buf2, len2, L"%S\\GmnvExt64;%s", dir, buf); +# else + _snwprintf(buf2, len2, L"%S\\GmnvExt32;%s", dir, buf); +# endif + SetEnvironmentVariableW(L"PATH", buf2); + hLibintlDLL = LoadLibrary(GETTEXT_DLL); +# ifdef GETTEXT_DLL_ALT + if (!hLibintlDLL) + hLibintlDLL = LoadLibrary(GETTEXT_DLL_ALT); +# endif + SetEnvironmentVariableW(L"PATH", buf); + } + free(buf); + free(buf2); + if (!hLibintlDLL) + return 0; + + // Get the addresses of the functions we need. + for (i = 0; libintl_entry[i].name != NULL + && libintl_entry[i].ptr != NULL; ++i) + { + if ((*libintl_entry[i].ptr = GetProcAddress(hLibintlDLL, + libintl_entry[i].name)) == NULL) + { + dyn_libintl_end(); + return 0; + } + } + return 1; +} + + static void +dyn_libintl_end(void) +{ + if (hLibintlDLL) + FreeLibrary(hLibintlDLL); + hLibintlDLL = NULL; + dyn_libintl_gettext = null_libintl_gettext; + dyn_libintl_textdomain = null_libintl_textdomain; + dyn_libintl_bindtextdomain = null_libintl_bindtextdomain; + dyn_libintl_bind_textdomain_codeset = null_libintl_bind_textdomain_codeset; +} + + static char * +null_libintl_gettext(const char *msgid) +{ + return (char *)msgid; +} + + static char * +null_libintl_textdomain(const char * /* domainname */) +{ + return NULL; +} + + static char * +null_libintl_bindtextdomain(const char * /* domainname */, const char * /* dirname */) +{ + return NULL; +} + + static char * +null_libintl_bind_textdomain_codeset(const char * /* domainname */, const char * /* codeset */) +{ + return NULL; +} + +// +// Setup for translating strings. +// + static void +dyn_gettext_load(void) +{ + char szBuff[BUFSIZE]; + DWORD len; + + // Try to locate the runtime files. The path is used to find libintl.dll + // and the mnv.mo files. + getRuntimeDir(szBuff); + if (szBuff[0] != 0) + { + len = (DWORD)strlen(szBuff); + if (dyn_libintl_init(szBuff)) + { + strcpy(szBuff + len, "lang"); + + (*dyn_libintl_bindtextdomain)(MNVPACKAGE, szBuff); + (*dyn_libintl_textdomain)(MNVPACKAGE); + } + } +} + + static void +dyn_gettext_free(void) +{ + dyn_libintl_end(); +} + +// +// Use UTF-8 for gettext. Returns previous codeset. +// + static char * +set_gettext_codeset(void) +{ + char *prev = dyn_libintl_bind_textdomain_codeset(MNVPACKAGE, NULL); + prev = _strdup((prev != NULL) ? prev : "char"); + dyn_libintl_bind_textdomain_codeset(MNVPACKAGE, "utf-8"); + + return prev; +} + +// +// Restore previous codeset for gettext. +// + static void +restore_gettext_codeset(char *prev) +{ + dyn_libintl_bind_textdomain_codeset(MNVPACKAGE, prev); + free(prev); +} +#endif // FEAT_GETTEXT + +// +// Global variables +// +UINT g_cRefThisDll = 0; // Reference count of this DLL. +HINSTANCE g_hmodThisDll = NULL; // Handle to this DLL itself. + + +//--------------------------------------------------------------------------- +// DllMain +//--------------------------------------------------------------------------- +extern "C" int APIENTRY +DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /* lpReserved */) +{ + switch (dwReason) + { + case DLL_PROCESS_ATTACH: + // Extension DLL one-time initialization + g_hmodThisDll = hInstance; + break; + + case DLL_PROCESS_DETACH: + break; + } + + return 1; // ok +} + + static void +inc_cRefThisDLL() +{ +#ifdef FEAT_GETTEXT + if (g_cRefThisDll == 0) + dyn_gettext_load(); +#endif + InterlockedIncrement((LPLONG)&g_cRefThisDll); +} + + static void +dec_cRefThisDLL() +{ +#ifdef FEAT_GETTEXT + if (InterlockedDecrement((LPLONG)&g_cRefThisDll) == 0) + dyn_gettext_free(); +#else + InterlockedDecrement((LPLONG)&g_cRefThisDll); +#endif +} + +//--------------------------------------------------------------------------- +// DllCanUnloadNow +//--------------------------------------------------------------------------- + +STDAPI DllCanUnloadNow(void) +{ + return (g_cRefThisDll == 0 ? S_OK : S_FALSE); +} + +STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppvOut) +{ + *ppvOut = NULL; + + if (IsEqualIID(rclsid, CLSID_ShellExtension)) + { + CShellExtClassFactory *pcf = new CShellExtClassFactory; + + return pcf->QueryInterface(riid, ppvOut); + } + + return CLASS_E_CLASSNOTAVAILABLE; +} + +CShellExtClassFactory::CShellExtClassFactory() +{ + m_cRef = 0L; + + inc_cRefThisDLL(); +} + +CShellExtClassFactory::~CShellExtClassFactory() +{ + dec_cRefThisDLL(); +} + +STDMETHODIMP CShellExtClassFactory::QueryInterface(REFIID riid, + LPVOID FAR *ppv) +{ + *ppv = NULL; + + // any interface on this object is the object pointer + + if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IClassFactory)) + { + *ppv = (LPCLASSFACTORY)this; + + AddRef(); + + return NOERROR; + } + + return E_NOINTERFACE; +} + +STDMETHODIMP_(ULONG) CShellExtClassFactory::AddRef() +{ + return InterlockedIncrement((LPLONG)&m_cRef); +} + +STDMETHODIMP_(ULONG) CShellExtClassFactory::Release() +{ + if (InterlockedDecrement((LPLONG)&m_cRef)) + return m_cRef; + + delete this; + + return 0L; +} + +STDMETHODIMP CShellExtClassFactory::CreateInstance(LPUNKNOWN pUnkOuter, + REFIID riid, + LPVOID *ppvObj) +{ + *ppvObj = NULL; + + // Shell extensions typically don't support aggregation (inheritance) + + if (pUnkOuter) + return CLASS_E_NOAGGREGATION; + + // Create the main shell extension object. The shell will then call + // QueryInterface with IID_IShellExtInit--this is how shell extensions are + // initialized. + + LPCSHELLEXT pShellExt = new CShellExt(); // create the CShellExt object + + if (NULL == pShellExt) + return E_OUTOFMEMORY; + + return pShellExt->QueryInterface(riid, ppvObj); +} + + +STDMETHODIMP CShellExtClassFactory::LockServer(BOOL /* fLock */) +{ + return NOERROR; +} + +// *********************** CShellExt ************************* +CShellExt::CShellExt() +{ + m_cRef = 0L; + m_pDataObj = NULL; + + inc_cRefThisDLL(); + + LoadMenuIcon(); +} + +CShellExt::~CShellExt() +{ + if (m_pDataObj) + m_pDataObj->Release(); + + dec_cRefThisDLL(); + + if (m_hMNVIconBitmap) + DeleteObject(m_hMNVIconBitmap); +} + +STDMETHODIMP CShellExt::QueryInterface(REFIID riid, LPVOID FAR *ppv) +{ + *ppv = NULL; + + if (IsEqualIID(riid, IID_IShellExtInit) || IsEqualIID(riid, IID_IUnknown)) + { + *ppv = (LPSHELLEXTINIT)this; + } + else if (IsEqualIID(riid, IID_IContextMenu)) + { + *ppv = (LPCONTEXTMENU)this; + } + + if (*ppv) + { + AddRef(); + + return NOERROR; + } + + return E_NOINTERFACE; +} + +STDMETHODIMP_(ULONG) CShellExt::AddRef() +{ + return InterlockedIncrement((LPLONG)&m_cRef); +} + +STDMETHODIMP_(ULONG) CShellExt::Release() +{ + + if (InterlockedDecrement((LPLONG)&m_cRef)) + return m_cRef; + + delete this; + + return 0L; +} + + +// +// FUNCTION: CShellExt::Initialize(LPCITEMIDLIST, LPDATAOBJECT, HKEY) +// +// PURPOSE: Called by the shell when initializing a context menu or property +// sheet extension. +// +// PARAMETERS: +// pIDFolder - Specifies the parent folder +// pDataObj - Specifies the set of items selected in that folder. +// hRegKey - Specifies the type of the focused item in the selection. +// +// RETURN VALUE: +// +// NOERROR in all cases. +// +// COMMENTS: Note that at the time this function is called, we don't know +// (or care) what type of shell extension is being initialized. +// It could be a context menu or a property sheet. +// + +STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST /* pIDFolder */, + LPDATAOBJECT pDataObj, + HKEY /* hRegKey */) +{ + // Initialize can be called more than once + if (m_pDataObj) + m_pDataObj->Release(); + + // duplicate the object pointer and registry handle + + if (pDataObj) + { + m_pDataObj = pDataObj; + pDataObj->AddRef(); + } + + return NOERROR; +} + + +// +// FUNCTION: CShellExt::QueryContextMenu(HMENU, UINT, UINT, UINT, UINT) +// +// PURPOSE: Called by the shell just before the context menu is displayed. +// This is where you add your specific menu items. +// +// PARAMETERS: +// hMenu - Handle to the context menu +// indexMenu - Index of where to begin inserting menu items +// idCmdFirst - Lowest value for new menu ID's +// idCmtLast - Highest value for new menu ID's +// uFlags - Specifies the context of the menu event +// +// RETURN VALUE: +// +// +// COMMENTS: +// + +STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu, + UINT indexMenu, + UINT idCmdFirst, + UINT /* idCmdLast */, + UINT /* uFlags */) +{ + UINT idCmd = idCmdFirst; + + hres = m_pDataObj->GetData(&fmte, &medium); + if (medium.hGlobal) + cbFiles = DragQueryFileW((HDROP)medium.hGlobal, (UINT)-1, 0, 0); + + // InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL); + + // Initialize m_cntOfHWnd to 0 + m_cntOfHWnd = 0; + + HKEY keyhandle; + bool showExisting = true; + bool showIcons = true; + + // Check whether "Edit with existing MNV" entries are disabled. + if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\MNV\\Gmnv", 0, + KEY_READ, &keyhandle) == ERROR_SUCCESS) + { + if (RegQueryValueEx(keyhandle, "DisableEditWithExisting", 0, NULL, + NULL, NULL) == ERROR_SUCCESS) + showExisting = false; + if (RegQueryValueEx(keyhandle, "DisableContextMenuIcons", 0, NULL, + NULL, NULL) == ERROR_SUCCESS) + showIcons = false; + RegCloseKey(keyhandle); + } + + // Use UTF-8 for gettext. + char *prev = set_gettext_codeset(); + + // Retrieve all the mnv instances, unless disabled. + if (showExisting) + EnumWindows(EnumWindowsProc, (LPARAM)this); + + MENUITEMINFOW mii = { sizeof(MENUITEMINFOW) }; + mii.fMask = MIIM_STRING | MIIM_ID; + if (showIcons) + { + mii.fMask |= MIIM_BITMAP; + mii.hbmpItem = m_hMNVIconBitmap; + } + + if (cbFiles > 1) + { + mii.wID = idCmd++; + mii.dwTypeData = W(_("Edit with MNV using &tabpages")); + mii.cch = wcslen(mii.dwTypeData); + InsertMenuItemW(hMenu, indexMenu++, TRUE, &mii); + free(mii.dwTypeData); + + mii.wID = idCmd++; + mii.dwTypeData = W(_("Edit with single &MNV")); + mii.cch = wcslen(mii.dwTypeData); + InsertMenuItemW(hMenu, indexMenu++, TRUE, &mii); + free(mii.dwTypeData); + + if (cbFiles <= 4) + { + // Can edit up to 4 files in diff mode + mii.wID = idCmd++; + mii.dwTypeData = W(_("Diff with MNV")); + mii.cch = wcslen(mii.dwTypeData); + InsertMenuItemW(hMenu, indexMenu++, TRUE, &mii); + free(mii.dwTypeData); + m_edit_existing_off = 3; + } + else + m_edit_existing_off = 2; + + } + else + { + mii.wID = idCmd++; + mii.dwTypeData = W(_("Edit with &MNV")); + mii.cch = wcslen(mii.dwTypeData); + InsertMenuItemW(hMenu, indexMenu++, TRUE, &mii); + free(mii.dwTypeData); + m_edit_existing_off = 1; + } + + HMENU hSubMenu = NULL; + if (m_cntOfHWnd > 1) + { + hSubMenu = CreatePopupMenu(); + mii.fMask |= MIIM_SUBMENU; + mii.wID = idCmd; + mii.dwTypeData = W(_("Edit with existing MNV")); + mii.cch = wcslen(mii.dwTypeData); + mii.hSubMenu = hSubMenu; + InsertMenuItemW(hMenu, indexMenu++, TRUE, &mii); + free(mii.dwTypeData); + mii.fMask = mii.fMask & ~MIIM_SUBMENU; + mii.hSubMenu = NULL; + } + // Now display all the mnv instances + for (int i = 0; i < m_cntOfHWnd; i++) + { + WCHAR title[BUFSIZE]; + WCHAR temp[BUFSIZE]; + int index; + HMENU hmenu; + + // Obtain window title, continue if can not + if (GetWindowTextW(m_hWnd[i], title, BUFSIZE - 1) == 0) + continue; + // Truncate the title before the path, keep the file name + WCHAR *pos = wcschr(title, L'('); + if (pos != NULL) + { + if (pos > title && pos[-1] == L' ') + --pos; + *pos = 0; + } + // Now concatenate + if (m_cntOfHWnd > 1) + temp[0] = L'\0'; + else + { + WCHAR *s = W(_("Edit with existing MNV - ")); + wcsncpy(temp, s, BUFSIZE - 1); + temp[BUFSIZE - 1] = L'\0'; + free(s); + } + wcsncat(temp, title, BUFSIZE - 1 - wcslen(temp)); + temp[BUFSIZE - 1] = L'\0'; + + mii.wID = idCmd++; + mii.dwTypeData = temp; + mii.cch = wcslen(mii.dwTypeData); + if (m_cntOfHWnd > 1) + { + hmenu = hSubMenu; + index = i; + } + else + { + hmenu = hMenu; + index = indexMenu++; + } + InsertMenuItemW(hmenu, index, TRUE, &mii); + } + // InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL); + + // Restore previous codeset. + restore_gettext_codeset(prev); + + // Must return number of menu items we added. + return ResultFromShort(idCmd-idCmdFirst); +} + +// +// FUNCTION: CShellExt::InvokeCommand(LPCMINVOKECOMMANDINFO) +// +// PURPOSE: Called by the shell after the user has selected on of the +// menu items that was added in QueryContextMenu(). +// +// PARAMETERS: +// lpcmi - Pointer to an CMINVOKECOMMANDINFO structure +// +// RETURN VALUE: +// +// +// COMMENTS: +// + +STDMETHODIMP CShellExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi) +{ + HRESULT hr = E_INVALIDARG; + int gmnvExtraOptions; + + // If HIWORD(lpcmi->lpVerb) then we have been called programmatically + // and lpVerb is a command that should be invoked. Otherwise, the shell + // has called us, and LOWORD(lpcmi->lpVerb) is the menu ID the user has + // selected. Actually, it's (menu ID - idCmdFirst) from QueryContextMenu(). + if (!HIWORD(lpcmi->lpVerb)) + { + UINT idCmd = LOWORD(lpcmi->lpVerb); + + if (idCmd >= m_edit_existing_off) + { + // Existing with mnv instance + hr = PushToWindow(lpcmi->hwnd, + lpcmi->lpDirectory, + lpcmi->lpVerb, + lpcmi->lpParameters, + lpcmi->nShow, + idCmd - m_edit_existing_off); + } + else + { + switch (idCmd) + { + case 0: + gmnvExtraOptions = EDIT_WITH_MNV_USE_TABPAGES; + break; + case 1: + gmnvExtraOptions = EDIT_WITH_MNV_NO_OPTIONS; + break; + case 2: + gmnvExtraOptions = EDIT_WITH_MNV_IN_DIFF_MODE; + break; + default: + // If execution reaches this point we likely have an + // inconsistency between the code that setup the menus + // and this code that determines what the user + // selected. This should be detected and fixed during + // development. + return E_FAIL; + } + + LPCMINVOKECOMMANDINFOEX lpcmiex = (LPCMINVOKECOMMANDINFOEX)lpcmi; + LPCWSTR currentDirectory = lpcmi->cbSize == sizeof(CMINVOKECOMMANDINFOEX) ? lpcmiex->lpDirectoryW : NULL; + + hr = InvokeSingleGmnv(lpcmi->hwnd, + currentDirectory, + lpcmi->lpVerb, + lpcmi->lpParameters, + lpcmi->nShow, + gmnvExtraOptions); + } + } + return hr; +} + +STDMETHODIMP CShellExt::PushToWindow(HWND /* hParent */, + LPCSTR /* pszWorkingDir */, + LPCSTR /* pszCmd */, + LPCSTR /* pszParam */, + int /* iShowCmd */, + int idHWnd) +{ + HWND hWnd = m_hWnd[idHWnd]; + + // Show and bring mnv instance to foreground + if (IsIconic(hWnd) != 0) + ShowWindow(hWnd, SW_RESTORE); + else + ShowWindow(hWnd, SW_SHOW); + SetForegroundWindow(hWnd); + + // Post the selected files to the mnv instance + PostMessage(hWnd, WM_DROPFILES, (WPARAM)medium.hGlobal, 0); + + return NOERROR; +} + +STDMETHODIMP CShellExt::GetCommandString(UINT_PTR /* idCmd */, + UINT uFlags, + UINT FAR * /* reserved */, + LPSTR pszName, + UINT cchMax) +{ + // Use UTF-8 for gettext. + char *prev = set_gettext_codeset(); + + WCHAR *s = W(_("Edits the selected file(s) with MNV")); + if (uFlags == GCS_HELPTEXTW && cchMax > wcslen(s)) + wcscpy((WCHAR *)pszName, s); + free(s); + + // Restore previous codeset. + restore_gettext_codeset(prev); + + return NOERROR; +} + +BOOL CALLBACK CShellExt::EnumWindowsProc(HWND hWnd, LPARAM lParam) +{ + char temp[BUFSIZE]; + + // First do a bunch of check + // No invisible window + if (!IsWindowVisible(hWnd)) + return TRUE; + // No child window ??? + // if (GetParent(hWnd)) return TRUE; + // Class name should be MNV, if failed to get class name, return + if (GetClassName(hWnd, temp, sizeof(temp)) == 0) + return TRUE; + // Compare class name to that of mnv, if not, return + if (_strnicmp(temp, "mnv", sizeof("mnv")) != 0) + return TRUE; + // First check if the number of mnv instance exceeds MAX_HWND + CShellExt *cs = (CShellExt*) lParam; + if (cs->m_cntOfHWnd >= MAX_HWND) + return FALSE; // stop enumeration + // Now we get the mnv window, put it into some kind of array + cs->m_hWnd[cs->m_cntOfHWnd] = hWnd; + cs->m_cntOfHWnd ++; + + return TRUE; // continue enumeration (otherwise this would be false) +} + +BOOL CShellExt::LoadMenuIcon() +{ + char mnvExeFile[BUFSIZE]; + getGmnvName(mnvExeFile, 1); + if (mnvExeFile[0] == '\0') + return FALSE; + HICON hMNVIcon; + if (ExtractIconEx(mnvExeFile, 0, NULL, &hMNVIcon, 1) == 0) + return FALSE; + m_hMNVIconBitmap = IconToBitmap(hMNVIcon, + GetSysColorBrush(COLOR_MENU), + GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON)); + return TRUE; +} + + static char * +searchpath(char *name) +{ + static char widename[2 * BUFSIZE]; + static char location[2 * BUFSIZE + 2]; + + // There appears to be a bug in FindExecutableA() on Windows NT. + // Use FindExecutableW() instead... + MultiByteToWideChar(CP_ACP, 0, (LPCSTR)name, -1, + (LPWSTR)widename, BUFSIZE); + if (FindExecutableW((LPCWSTR)widename, (LPCWSTR)"", + (LPWSTR)location) > (HINSTANCE)32) + { + WideCharToMultiByte(CP_ACP, 0, (LPWSTR)location, -1, + (LPSTR)widename, 2 * BUFSIZE, NULL, NULL); + return widename; + } + return (char *)""; +} + + +STDMETHODIMP CShellExt::InvokeSingleGmnv(HWND hParent, + LPCWSTR workingDir, + LPCSTR /* pszCmd */, + LPCSTR /* pszParam */, + int /* iShowCmd */, + int gmnvExtraOptions) +{ + wchar_t m_szFileUserClickedOn[BUFSIZE]; + wchar_t *cmdStrW; + size_t cmdlen; + size_t len; + UINT i; + + cmdlen = BUFSIZE; + cmdStrW = (wchar_t *) malloc(cmdlen * sizeof(wchar_t)); + if (cmdStrW == NULL) + return E_FAIL; + getGmnvInvocationW(cmdStrW); + + if (gmnvExtraOptions == EDIT_WITH_MNV_IN_DIFF_MODE) + wcscat(cmdStrW, L" -d"); + else if (gmnvExtraOptions == EDIT_WITH_MNV_USE_TABPAGES) + wcscat(cmdStrW, L" -p"); + for (i = 0; i < cbFiles; i++) + { + DragQueryFileW((HDROP)medium.hGlobal, + i, + m_szFileUserClickedOn, + sizeof(m_szFileUserClickedOn)); + + len = wcslen(cmdStrW) + wcslen(m_szFileUserClickedOn) + 4; + if (len > cmdlen) + { + cmdlen = len + BUFSIZE; + wchar_t *cmdStrW_new = (wchar_t *)realloc(cmdStrW, cmdlen * sizeof(wchar_t)); + if (cmdStrW_new == NULL) + { + free(cmdStrW); + return E_FAIL; + } + cmdStrW = cmdStrW_new; + } + wcscat(cmdStrW, L" \""); + wcscat(cmdStrW, m_szFileUserClickedOn); + wcscat(cmdStrW, L"\""); + } + + STARTUPINFOW si; + PROCESS_INFORMATION pi; + + ZeroMemory(&si, sizeof(si)); + si.cb = sizeof(si); + + // Start the child process. + if (!CreateProcessW(NULL, // No module name (use command line). + cmdStrW, // Command line. + NULL, // Process handle not inheritable. + NULL, // Thread handle not inheritable. + FALSE, // Set handle inheritance to FALSE. + 0, // No creation flags. + NULL, // Use parent's environment block. + workingDir, // Use parent's starting directory. + &si, // Pointer to STARTUPINFO structure. + &pi) // Pointer to PROCESS_INFORMATION structure. + ) + { + // Use UTF-8 for gettext. + char *prev = set_gettext_codeset(); + + WCHAR *msg = W(_("Error creating process: Check if gmnv is in your path!")); + WCHAR *title = W(_("gmnvext.dll error")); + + MessageBoxW(hParent, msg, title, MB_OK); + + free(msg); + free(title); + + // Restore previous codeset. + restore_gettext_codeset(prev); + } + else + { + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + } + free(cmdStrW); + + return NOERROR; +} diff --git a/uvim/src/GmnvExt/gmnvext.def b/uvim/src/GmnvExt/gmnvext.def new file mode 100644 index 0000000000..8b83a86124 --- /dev/null +++ b/uvim/src/GmnvExt/gmnvext.def @@ -0,0 +1,8 @@ +;gmnvdef.def : Declares the module parameters for the DLL. + +LIBRARY gmnvext +; DESCRIPTION 'MNV Shell Extension' + +EXPORTS + DllCanUnloadNow private + DllGetClassObject private diff --git a/uvim/src/GmnvExt/gmnvext.h b/uvim/src/GmnvExt/gmnvext.h new file mode 100644 index 0000000000..c51e2f4bf1 --- /dev/null +++ b/uvim/src/GmnvExt/gmnvext.h @@ -0,0 +1,167 @@ +/* vi:set ts=8 sts=4 sw=4: + * + * MNV - MNV is not Vim gmnvext by Tianmiao Hu + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + */ + +/* + * If you have any questions or any suggestions concerning gmnvext, please + * contact Tianmiao Hu: tianmiao@acm.org. + */ + +#if !defined(AFX_STDAFX_H__3389658B_AD83_11D3_9C1E_0090278BBD99__INCLUDED_) +#define AFX_STDAFX_H__3389658B_AD83_11D3_9C1E_0090278BBD99__INCLUDED_ + +#if defined(_MSC_VER) && _MSC_VER > 1000 +#pragma once +#endif + +// Insert your headers here +// #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +//-------------------------------------------------------------- +// common user interface routines +// +// +//-------------------------------------------------------------- + +#ifndef STRICT +# define STRICT +#endif + +#define INC_OLE2 // MS-Windows, get ole2 from windows.h + +/* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */ +#if defined(_MSC_VER) && _MSC_VER >= 1400 +# define _CRT_SECURE_NO_DEPRECATE +# define _CRT_NONSTDC_NO_DEPRECATE +#endif + +#include +#include +#include +#include + +#define ResultFromShort(i) ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i))) + +// Initialize GUIDs (should be done only and at-least once per DLL/EXE) +// +#pragma data_seg(".text") +#define INITGUID +#include + +// +// The class ID of this Shell extension class. +// +// class id: {51EEE242-AD87-11d3-9C1E-0090278BBD99} +// +// +// NOTE!!! If you use this shell extension as a starting point, +// you MUST change the GUID below. Simply run UUIDGEN.EXE +// to generate a new GUID. +// + +// {51EEE242-AD87-11d3-9C1E-0090278BBD99} +// static const GUID <> = +// { 0x51eee242, 0xad87, 0x11d3, { 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99 } }; +// +// + +// {51EEE242-AD87-11d3-9C1E-0090278BBD99} +// IMPLEMENT_OLECREATE(<>, <>, +// 0x51eee242, 0xad87, 0x11d3, 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99); +// + +// {51EEE242-AD87-11d3-9C1E-0090278BBD99} -- this is the registry format +DEFINE_GUID(CLSID_ShellExtension, 0x51eee242, 0xad87, 0x11d3, 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99); + +// this class factory object creates context menu handlers for windows 32 shell +class CShellExtClassFactory : public IClassFactory +{ +protected: + ULONG m_cRef; + +public: + CShellExtClassFactory(); + ~CShellExtClassFactory(); + + //IUnknown members + STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *); + STDMETHODIMP_(ULONG) AddRef(); + STDMETHODIMP_(ULONG) Release(); + + //IClassFactory members + STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, LPVOID FAR *); + STDMETHODIMP LockServer(BOOL); +}; +typedef CShellExtClassFactory *LPCSHELLEXTCLASSFACTORY; +#define MAX_HWND 100 + +// this is the actual OLE Shell context menu handler +class CShellExt : public IContextMenu, + IShellExtInit +{ +private: + BOOL LoadMenuIcon(); + +protected: + ULONG m_cRef; + LPDATAOBJECT m_pDataObj; + UINT m_edit_existing_off; + HBITMAP m_hMNVIconBitmap; + + // For some reason, this callback must be static + static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam); + + STDMETHODIMP PushToWindow(HWND hParent, + LPCSTR pszWorkingDir, + LPCSTR pszCmd, + LPCSTR pszParam, + int iShowCmd, + int idHWnd); + + STDMETHODIMP InvokeSingleGmnv(HWND hParent, + LPCWSTR workingDir, + LPCSTR pszCmd, + LPCSTR pszParam, + int iShowCmd, + int gmnvExtraOptions); + +public: + int m_cntOfHWnd; + HWND m_hWnd[MAX_HWND]; + CShellExt(); + ~CShellExt(); + + //IUnknown members + STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *); + STDMETHODIMP_(ULONG) AddRef(); + STDMETHODIMP_(ULONG) Release(); + + //IShell members + STDMETHODIMP QueryContextMenu(HMENU hMenu, + UINT indexMenu, + UINT idCmdFirst, + UINT idCmdLast, + UINT uFlags); + + STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi); + + STDMETHODIMP GetCommandString(UINT_PTR idCmd, + UINT uFlags, + UINT FAR *reserved, + LPSTR pszName, + UINT cchMax); + + //IShellExtInit methods + STDMETHODIMP Initialize(LPCITEMIDLIST pIDFolder, + LPDATAOBJECT pDataObj, + HKEY hKeyID); +}; + +typedef CShellExt *LPCSHELLEXT; +#pragma data_seg() + +#endif diff --git a/uvim/src/GmnvExt/gmnvext.inf b/uvim/src/GmnvExt/gmnvext.inf new file mode 100644 index 0000000000..892ac3a3ff --- /dev/null +++ b/uvim/src/GmnvExt/gmnvext.inf @@ -0,0 +1,22 @@ +[Version] +Signature="$Windows NT$"" +Provider="Tianmiao" + +[Manufacture] + +[DefaultInstall] +AddReg=ThisDll.Add.Reg + +[DefaultUninstall] +DelReg=ThisDLL.Add.Reg + +[ThisDll.Add.Reg] +HKCR,CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99} +HKCR,CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32 +HKCR,*\shellex\ContextMenuHandlers\gmnv +HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved",{51EEE242-AD87-11d3-9C1E-0090278BBD99} +HKLM,Software\MNV\Gmnv +HKLM,"Software\Microsoft\Windows\CurrentVersion\Uninstall\MNV 9.2" + +[Strings] +ThisDll="gmnvext.dll" diff --git a/uvim/src/GmnvExt/gmnvext.rc b/uvim/src/GmnvExt/gmnvext.rc new file mode 100644 index 0000000000..612f10f3bc --- /dev/null +++ b/uvim/src/GmnvExt/gmnvext.rc @@ -0,0 +1,109 @@ +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winresrc.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x3L +#else + FILEFLAGS 0x2L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Comments", "Developed using COM architecture!\0" + VALUE "CompanyName", "Tianmiao Hu's Developer Studio\0" + VALUE "FileDescription", "A small project for the context menu of gmnv!\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "gmnv right-click menu extension\0" + VALUE "LegalCopyright", "Copyright � 1999 Tianmiao Hu\0" + VALUE "LegalTrademarks", "Tianmiao Hu's Gmnv Context Menu Extension\0" + VALUE "OriginalFilename", "gmnvext.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Tianmiao Hu's gmnvext context menu extension\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + VALUE "SpecialBuild", "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/uvim/src/GmnvExt/gmnvext_ming.def b/uvim/src/GmnvExt/gmnvext_ming.def new file mode 100644 index 0000000000..def9a26c48 --- /dev/null +++ b/uvim/src/GmnvExt/gmnvext_ming.def @@ -0,0 +1,10 @@ +;gmnvdef_ming.def : Declares the module parameters for the DLL. +;The mingw environment doesn't know anything about private declarations +;Hence this is the same file as gmnvext.def with private removed + +LIBRARY gmnvext +; DESCRIPTION 'MNV Shell Extension build with MinGW' + +EXPORTS + DllCanUnloadNow = DllCanUnloadNow@0 + DllGetClassObject = DllGetClassObject@12 diff --git a/uvim/src/GmnvExt/gmnvext_ming.rc b/uvim/src/GmnvExt/gmnvext_ming.rc new file mode 100644 index 0000000000..d6063f9c3b --- /dev/null +++ b/uvim/src/GmnvExt/gmnvext_ming.rc @@ -0,0 +1,45 @@ +#include +#define xstr(x) str(x) +#define str(x) #x +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,0,0,1 + PRODUCTVERSION 1,0,0,1 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x3L +#else + FILEFLAGS 0x2L +#endif + FILEOS 0x4L + FILETYPE VFT_DLL + FILESUBTYPE 0x0L +{ + BLOCK "StringFileInfo" + { + BLOCK "040904b0" + { + VALUE "Comments", "Developed using COM architecture!\0" + VALUE "CompanyName", "Tianmiao Hu's Developer Studio\0" + VALUE "FileDescription", "A small project for the context menu of gmnv!\0" + VALUE "FileVersion", "1, 0, 0, 1\0" + VALUE "InternalName", "gmnv right-click menu extension\0" + VALUE "LegalCopyright", "Copyright � 1999 Tianmiao Hu\0" + VALUE "LegalTrademarks", "Tianmiao Hu's Gmnv Context Menu Extension\0" + VALUE "OriginalFilename", "gmnvext.dll\0" + VALUE "PrivateBuild", "\0" + VALUE "ProductName", "Tianmiao Hu's gmnvext context menu extension\0" + VALUE "ProductVersion", "1, 0, 0, 1\0" + +#if defined(__GNUC__) + VALUE "SpecialBuild", "Build With " "MingW " xstr(__GNUC__) "." xstr(__GNUC_MINOR__) "." xstr(__GNUC_PATCHLEVEL__) " on " __DATE__ " " __TIME__ "\0" +#else + VALUE "SpecialBuild", "Unknown compiler\0" + +#endif + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x409, 1200 + } +} diff --git a/uvim/src/GmnvExt/resource.h b/uvim/src/GmnvExt/resource.h new file mode 100644 index 0000000000..eecab5b3d4 --- /dev/null +++ b/uvim/src/GmnvExt/resource.h @@ -0,0 +1,15 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by gmnvext.rc +// + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/uvim/src/GmnvExt/uninst.bat b/uvim/src/GmnvExt/uninst.bat new file mode 100644 index 0000000000..71d14f65a2 --- /dev/null +++ b/uvim/src/GmnvExt/uninst.bat @@ -0,0 +1 @@ +rundll32.exe setupapi,InstallHinfSection DefaultUninstall 128 %1 diff --git a/uvim/src/GvimExt/GvimExt.reg b/uvim/src/GvimExt/GvimExt.reg deleted file mode 100644 index c53edd0573..0000000000 --- a/uvim/src/GvimExt/GvimExt.reg +++ /dev/null @@ -1,20 +0,0 @@ -REGEDIT4 - -[HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}] - @="Vim Shell Extension" -[HKEY_CLASSES_ROOT\CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32] - @="gvimext.dll" - "ThreadingModel"="Apartment" - -[HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers\gvim] - @="{51EEE242-AD87-11d3-9C1E-0090278BBD99}" - -[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved] - "{51EEE242-AD87-11d3-9C1E-0090278BBD99}"="Vim Shell Extension" - -[HKEY_LOCAL_MACHINE\Software\Vim\Gvim] - "path"="gvim.exe" - -[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall\Vim 9.2] - "DisplayName"="Vim 9.2: Edit with Vim popup menu entry" - "UninstallString"="uninstall.exe" diff --git a/uvim/src/GvimExt/Make_ming.mak b/uvim/src/GvimExt/Make_ming.mak deleted file mode 100644 index b73e6fd92a..0000000000 --- a/uvim/src/GvimExt/Make_ming.mak +++ /dev/null @@ -1,96 +0,0 @@ -# Project: gvimext -# Generates gvimext.dll with gcc. -# To be used with MingW and Cygwin. -# -# Originally, the DLL base address was fixed: -Wl,--image-base=0x1C000000 -# Now it is allocated dynamically by the linker by evaluating all DLLs -# already loaded in memory. The binary image contains as well information -# for automatic pseudo-rebasing, if needed by the system. ALV 2004-02-29 - -# If cross-compiling set this to yes, else set it to no -CROSS = no -#CROSS = yes -# For the old MinGW 2.95 (the one you get e.g. with debian woody) -# set the following variable to yes and check if the executables are -# really named that way. -# If you have a newer MinGW or you are using cygwin set it to no and -# check also the executables -MINGWOLD = no - -# Link against the shared versions of libgcc/libstdc++ by default. Set -# STATIC_STDCPLUS to "yes" to link against static versions instead. -STATIC_STDCPLUS=no -#STATIC_STDCPLUS=yes - -# If you use TDM-GCC(-64), change HAS_GCC_EH to "no". -# This is used when STATIC_STDCPLUS=yes. -HAS_GCC_EH=yes - -STATIC_LIBS= - -# Note: -static-libstdc++ is not available until gcc 4.5.x. -LDFLAGS += -shared -ifeq (yes, $(STATIC_STDCPLUS)) -LDFLAGS += -static-libgcc -static-libstdc++ -# Order important: gcc_eh must be placed before winpthread -STATIC_LIBS += -lstdc++ -lgcc - ifeq (yes, $(HAS_GCC_EH)) -STATIC_LIBS += -lgcc_eh - endif -STATIC_LIBS += -lwinpthread -endif - -ifeq ($(CROSS),yes) -DEL = rm -f -ifeq ($(MINGWOLD),yes) -CXXFLAGS := -O2 -fvtable-thunks -else -CXXFLAGS := -O2 -endif -else -CXXFLAGS := -O2 -ifneq (sh.exe, $(SHELL)) -DEL = rm -f -else -DEL = del -endif -endif -# Set the default $(WINVER) to make it work with Windows 7. -ifndef WINVER -WINVER = 0x0601 -endif -CXX := $(CROSS_COMPILE)g++ -WINDRES := $(CROSS_COMPILE)windres -# this used to have --preprocessor, but it's no longer supported -WINDRES_FLAGS = -LIBS := -luuid -lgdi32 -RES := gvimext.res -ifeq ($(findstring clang++,$(CXX)),) -DEFFILE = gvimext_ming.def -endif -OBJ := gvimext.o - -DLL := gvimext.dll - -.PHONY: all all-before all-after clean clean-custom - -all: all-before $(DLL) all-after - -$(DLL): $(OBJ) $(RES) $(DEFFILE) - $(CXX) $(LDFLAGS) $(CXXFLAGS) -s -o $@ \ - -Wl,--enable-auto-image-base \ - -Wl,--enable-auto-import \ - -Wl,--whole-archive \ - $^ \ - -Wl,--no-whole-archive \ - $(LIBS) \ - -Wl,-Bstatic $(STATIC_LIBS) -Wl,-Bdynamic - -gvimext.o: gvimext.cpp - $(CXX) $(CXXFLAGS) -DFEAT_GETTEXT -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) -c $? -o $@ - -$(RES): gvimext_ming.rc - $(WINDRES) $(WINDRES_FLAGS) --input-format=rc --output-format=coff -DMING $? -o $@ - -clean: clean-custom - -$(DEL) $(OBJ) $(RES) $(DLL) diff --git a/uvim/src/GvimExt/Make_mvc.mak b/uvim/src/GvimExt/Make_mvc.mak deleted file mode 100644 index 874b34c74e..0000000000 --- a/uvim/src/GvimExt/Make_mvc.mak +++ /dev/null @@ -1,102 +0,0 @@ -# Makefile for GvimExt, using MSVC -# Options: -# DEBUG=yes Build debug version (for VC7 and maybe later) -# CPUARG= /arch:IA32/AVX/etc, call from main makefile to set -# automatically from CPUNR -# - -# included common tools -!INCLUDE ..\auto\nmake\tools.mak - -TARGETOS = WINNT - -!IFNDEF APPVER -APPVER = 6.01 -!ENDIF -# Set the default $(WINVER) to make it work with Windows 7. -!IFNDEF WINVER -WINVER = 0x0601 -!ENDIF - -!IF "$(DEBUG)" != "yes" -NODEBUG = 1 -!ENDIF - -!IFNDEF CPU -CPU = i386 -! IFNDEF PLATFORM -! IFDEF TARGET_CPU -PLATFORM = $(TARGET_CPU) -! ELSEIF defined(VSCMD_ARG_TGT_ARCH) -PLATFORM = $(VSCMD_ARG_TGT_ARCH) -! ENDIF -! ENDIF -! IFDEF PLATFORM -! IF ("$(PLATFORM)" == "x64") || ("$(PLATFORM)" == "X64") -CPU = AMD64 -! ELSEIF ("$(PLATFORM)" == "arm64") || ("$(PLATFORM)" == "ARM64") -CPU = ARM64 -! ELSEIF ("$(PLATFORM)" != "x86") && ("$(PLATFORM)" != "X86") -! ERROR *** ERROR Unknown target platform "$(PLATFORM)". Make aborted. -! ENDIF -! ENDIF -!ENDIF - -!IFDEF SDK_INCLUDE_DIR -! INCLUDE $(SDK_INCLUDE_DIR)\Win32.mak -!ELSEIF "$(USE_WIN32MAK)"=="yes" -! INCLUDE -!ELSE -cc = cl -link = link -rc = rc -cflags = -nologo -c -lflags = -incremental:no -nologo -rcflags = /r -olelibsdll = ole32.lib uuid.lib oleaut32.lib user32.lib gdi32.lib advapi32.lib -!ENDIF - -# include CPUARG -cflags = $(cflags) $(CPUARG) - -# set WINVER and _WIN32_WINNT -cflags = $(cflags) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) - -!IF "$(CL)" == "/D_USING_V110_SDK71_" -rcflags = $(rcflags) /D_USING_V110_SDK71_ -!ENDIF - -SUBSYSTEM = console -!IF "$(SUBSYSTEM_VER)" != "" -SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER) -!ENDIF - -!IF "$(CPU)" == "AMD64" || "$(CPU)" == "ARM64" -OFFSET = 0x11C000000 -!ELSE -OFFSET = 0x1C000000 -!ENDIF - -all: gvimext.dll - -gvimext.dll: gvimext.obj gvimext.res - $(link) $(lflags) -dll -def:gvimext.def -base:$(OFFSET) \ - -out:$*.dll $** $(olelibsdll) shell32.lib comctl32.lib \ - -subsystem:$(SUBSYSTEM) - -gvimext.obj: gvimext.h - -.cpp.obj: - $(cc) $(cflags) -DFEAT_GETTEXT $(cvarsmt) $*.cpp - -gvimext.res: gvimext.rc - $(rc) /nologo $(rcflags) $(rcvars) gvimext.rc - -clean: - - if exist gvimext.dll $(RM) gvimext.dll - - if exist gvimext.lib $(RM) gvimext.lib - - if exist gvimext.exp $(RM) gvimext.exp - - if exist gvimext.obj $(RM) gvimext.obj - - if exist gvimext.res $(RM) gvimext.res - -# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=79 ft=make: diff --git a/uvim/src/GvimExt/Makefile b/uvim/src/GvimExt/Makefile deleted file mode 100644 index 18b91ece29..0000000000 --- a/uvim/src/GvimExt/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -!message This makefile is deprecated. Use Make_mvc.mak instead. -!message - -!include Make_mvc.mak diff --git a/uvim/src/GvimExt/README.txt b/uvim/src/GvimExt/README.txt deleted file mode 100644 index a29200e432..0000000000 --- a/uvim/src/GvimExt/README.txt +++ /dev/null @@ -1,94 +0,0 @@ -README.txt for the gvimext DLL. - -Written by Tianmiao Hu. Edited by Bram Moolenaar. - - -INSTALLATION - -To install the "Edit with Vim" popup menu entry, it is recommended to use the -"install.exe" program. It will ask you a few questions and install the needed -registry entries. - -In special situations you might want to make changes by hand. Check these -items: -- The gvimext.dll, gvim.exe and uninstall.exe either need to be in the search - path, or you have to set the full path in the registry entries. You could - move the gvimext.dll to the "windows\system" or "windows\system32" - directory, where the other DLL files are. -- You can find the names of the used registry entries in the file - "GvimExt.reg". You can edit this file to add the paths. To install the - registry entries, right-click the gvimext.reg file and choose the "merge" - menu option. -- The registry key [HKEY_LOCAL_MACHINE\Software\Vim\Gvim] is used by the - gvimext.dll. The value "path" specifies the location of "gvim.exe". If - gvim.exe is in the search path, the path can be omitted. The value "lang" - can be used to set the language, for example "de" for German. If "lang" is - omitted, the language set for Windows will be used. - -It is the preferred method to keep gvim.exe with the runtime files, so that -Vim will find them (also the translated menu items are there). - - -UNINSTALLATION - -To uninstall the "Edit with Vim" popup menu entry, it is recommended to use -the "uninstal.exe" program. - -In special situations you might want to uninstall by hand: -- Open the registry by running regedit.exe. -- Delete all the keys listed in GvimExt.reg, except this one: - [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved] - For this key, only delete one value: - "{51EEE242-AD87-11d3-9C1E-0090278BBD99}"="Vim Shell Extension" -- Delete the gvimext.dll, if you want. You might need to reboot the machine - in order to remove this file. A quick way is to log off and re-login. - -Another method is by using the uninst.bat script: - uninst gvimext.inf -This batch file will remove all the registry keys from the system. Then you -can remove the gvimext.dll file. -Note: In order for this batch file to work, you must have two system files: -rundll32.exe and setupapi.dll. I believe you will have rundll32.exe in your -system. I know windows nt 4.0 with the service pack 4 has setupapi.dll. My -windows 95 has setupapi.dll. I find that the internet explorer 4.0 comes with -the setupapi.dll in file Ie4_5.cab. - -If you do encounter problems running this script, then probably you need to -modify the uninst.bat to suit to your system. Basically, you must find out -where are the locations for your rundll32.exe and setupapi.dll files. In -windows nt, both files are under c:\winnt\system32 directory. In my windows 95 -system, I got setupapi.dll at c:\windows\system and rundll32.exe at -c:\windows. So you might want to try something like: - rundll32.exe c:\windows\system\setupapi.dll,InstallHinfSection DefaultUninstall 128 %1 -where %1 can be substituted by gvimext.inf - - -THE SOURCE CODE - -I have provided the source code here in hope that gvim users around world can -further enhance this little dll. I believe the only thing you need to change -is gvimext.cpp file. The important two functions you need to look at are -QueryContextMenu and InvokeCommand. You can modify right-click menus in the -QueryContextMenu function and invoke gvim in the InvokeCommand function. Note -the selected files can be accessed from the DragQueryFile function. I am not -familiar with the invoking options for gvim. I believe there are some -improvements that can be made on that side. - -I use MS Visual C++ 6.0's nmake to make the gvimext.dll. I don't have a -chance to try earlier versions of MSVC. The files that are required for build -are: - gvimext.cpp - gvimext.h - gvimext.def - gvimext.rc - resource.h - Makefile - -To compile the DLL from the command line: - vcvars32 - nmake -f Makefile - -If you did something interesting to this dll, please let me know -@ tianmiao@acm.org. - -Happy vimming!!! diff --git a/uvim/src/GvimExt/gvimext.cpp b/uvim/src/GvimExt/gvimext.cpp deleted file mode 100644 index f98423c15f..0000000000 --- a/uvim/src/GvimExt/gvimext.cpp +++ /dev/null @@ -1,1065 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4: - * - * VIM - Vi IMproved gvimext by Tianmiao Hu - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - */ - -/* - * gvimext is a DLL which is used for the "Edit with Vim" context menu - * extension. It implements a MS defined interface with the Shell. - * - * If you have any questions or any suggestions concerning gvimext, please - * contact Tianmiao Hu: tianmiao@acm.org. - */ - -#include "gvimext.h" - -static char *searchpath(char *name); - -// Always get an error while putting the following stuff to the -// gvimext.h file as class protected variables, give up and -// declare them as global stuff -FORMATETC fmte = {CF_HDROP, - (DVTARGETDEVICE FAR *)NULL, - DVASPECT_CONTENT, - -1, - TYMED_HGLOBAL - }; -STGMEDIUM medium; -HRESULT hres = 0; -UINT cbFiles = 0; - -/* The buffers size used to be MAX_PATH (260 bytes), but that's not always - * enough */ -#define BUFSIZE 1100 - -// The "Edit with Vim" shell extension provides these choices when -// a new instance of Gvim is selected: -// - use tabpages -// - enable diff mode -// - none of the above -#define EDIT_WITH_VIM_USE_TABPAGES (2) -#define EDIT_WITH_VIM_IN_DIFF_MODE (1) -#define EDIT_WITH_VIM_NO_OPTIONS (0) - -// -// Get the name of the Gvim executable to use, with the path. -// When "runtime" is non-zero, we were called to find the runtime directory. -// Returns the path in name[BUFSIZE]. It's empty when it fails. -// - static void -getGvimName(char *name, int runtime) -{ - HKEY keyhandle; - DWORD hlen; - - // Get the location of gvim from the registry. Try - // HKEY_CURRENT_USER first, then fall back to HKEY_LOCAL_MACHINE if - // not found. - name[0] = 0; - if (RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\Vim\\Gvim", 0, - KEY_READ, &keyhandle) == ERROR_SUCCESS) - { - hlen = BUFSIZE; - if (RegQueryValueEx(keyhandle, "path", 0, NULL, (BYTE *)name, &hlen) - != ERROR_SUCCESS) - name[0] = 0; - else - name[hlen] = 0; - RegCloseKey(keyhandle); - } - - if ((name[0] == 0) && - (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0, - KEY_READ, &keyhandle) == ERROR_SUCCESS)) - { - hlen = BUFSIZE; - if (RegQueryValueEx(keyhandle, "path", 0, NULL, (BYTE *)name, &hlen) - != ERROR_SUCCESS) - name[0] = 0; - else - name[hlen] = 0; - RegCloseKey(keyhandle); - } - - // Registry didn't work, use the search path. - if (name[0] == 0) - strcpy(name, searchpath((char *)"gvim.exe")); - - if (!runtime) - { - // Only when looking for the executable, not the runtime dir, we can - // search for the batch file or a name without a path. - if (name[0] == 0) - strcpy(name, searchpath((char *)"gvim.bat")); - if (name[0] == 0) - strcpy(name, "gvim"); // finds gvim.bat or gvim.exe - } -} - - static void -getGvimInvocation(char *name, int runtime) -{ - getGvimName(name, runtime); - // avoid that Vim tries to expand wildcards in the file names - strcat(name, " --literal"); -} - - static void -getGvimInvocationW(wchar_t *nameW) -{ - char *name; - - name = (char *)malloc(BUFSIZE); - getGvimInvocation(name, 0); - mbstowcs(nameW, name, BUFSIZE); - free(name); -} - -// -// Get the Vim runtime directory into buf[BUFSIZE]. -// The result is empty when it failed. -// When it works, the path ends in a slash or backslash. -// - static void -getRuntimeDir(char *buf) -{ - int idx; - - getGvimName(buf, 1); - if (buf[0] != 0) - { - // When no path found, use the search path to expand it. - if (strchr(buf, '/') == NULL && strchr(buf, '\\') == NULL) - strcpy(buf, searchpath(buf)); - - // remove "gvim.exe" from the end - for (idx = (int)strlen(buf) - 1; idx >= 0; idx--) - if (buf[idx] == '\\' || buf[idx] == '/') - { - buf[idx + 1] = 0; - break; - } - } -} - - WCHAR * -utf8_to_utf16(const char *s) -{ - int size = MultiByteToWideChar(CP_UTF8, 0, s, -1, NULL, 0); - WCHAR *buf = (WCHAR *)malloc(size * sizeof(WCHAR)); - MultiByteToWideChar(CP_UTF8, 0, s, -1, buf, size); - return buf; -} - - HBITMAP -IconToBitmap(HICON hIcon, HBRUSH hBackground, int width, int height) -{ - HDC hDC = GetDC(NULL); - HDC hMemDC = CreateCompatibleDC(hDC); - HBITMAP hMemBmp = CreateCompatibleBitmap(hDC, width, height); - HBITMAP hResultBmp = NULL; - HGDIOBJ hOrgBMP = SelectObject(hMemDC, hMemBmp); - - DrawIconEx(hMemDC, 0, 0, hIcon, width, height, 0, hBackground, DI_NORMAL); - - hResultBmp = hMemBmp; - hMemBmp = NULL; - - SelectObject(hMemDC, hOrgBMP); - DeleteDC(hMemDC); - ReleaseDC(NULL, hDC); - DestroyIcon(hIcon); - return hResultBmp; -} - -// -// GETTEXT: translated messages and menu entries -// -#ifndef FEAT_GETTEXT -# define _(x) x -# define W_impl(x) _wcsdup(L##x) -# define W(x) W_impl(x) -# define set_gettext_codeset() NULL -# define restore_gettext_codeset(x) -#else -# define _(x) (*dyn_libintl_gettext)(x) -# define W(x) utf8_to_utf16(x) -# define VIMPACKAGE "vim" -# ifndef GETTEXT_DLL -# define GETTEXT_DLL "libintl.dll" -# define GETTEXT_DLL_ALT "libintl-8.dll" -# endif - -// Dummy functions -static char *null_libintl_gettext(const char *); -static char *null_libintl_textdomain(const char *); -static char *null_libintl_bindtextdomain(const char *, const char *); -static char *null_libintl_bind_textdomain_codeset(const char *, const char *); -static int dyn_libintl_init(char *dir); -static void dyn_libintl_end(void); - -static HINSTANCE hLibintlDLL = 0; -static char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext; -static char *(*dyn_libintl_textdomain)(const char *) = null_libintl_textdomain; -static char *(*dyn_libintl_bindtextdomain)(const char *, const char *) - = null_libintl_bindtextdomain; -static char *(*dyn_libintl_bind_textdomain_codeset)(const char *, const char *) - = null_libintl_bind_textdomain_codeset; - -// -// Attempt to load libintl.dll. If it doesn't work, use dummy functions. -// "dir" is the directory where the libintl.dll might be. -// Return 1 for success, 0 for failure. -// - static int -dyn_libintl_init(char *dir) -{ - int i; - static struct - { - char *name; - FARPROC *ptr; - } libintl_entry[] = - { - {(char *)"gettext", (FARPROC*)&dyn_libintl_gettext}, - {(char *)"textdomain", (FARPROC*)&dyn_libintl_textdomain}, - {(char *)"bindtextdomain", (FARPROC*)&dyn_libintl_bindtextdomain}, - {(char *)"bind_textdomain_codeset", (FARPROC*)&dyn_libintl_bind_textdomain_codeset}, - {NULL, NULL} - }; - DWORD len, len2; - LPWSTR buf = NULL; - LPWSTR buf2 = NULL; - - // No need to initialize twice. - if (hLibintlDLL) - return 1; - - // Load gettext library from $VIMRUNTIME\GvimExt{64,32} directory. - // Add the directory to $PATH temporarily. - len = GetEnvironmentVariableW(L"PATH", NULL, 0); - len2 = MAX_PATH + 1 + len; - buf = (LPWSTR)malloc(len * sizeof(WCHAR)); - buf2 = (LPWSTR)malloc(len2 * sizeof(WCHAR)); - if (buf != NULL && buf2 != NULL) - { - GetEnvironmentVariableW(L"PATH", buf, len); -# ifdef _WIN64 - _snwprintf(buf2, len2, L"%S\\GvimExt64;%s", dir, buf); -# else - _snwprintf(buf2, len2, L"%S\\GvimExt32;%s", dir, buf); -# endif - SetEnvironmentVariableW(L"PATH", buf2); - hLibintlDLL = LoadLibrary(GETTEXT_DLL); -# ifdef GETTEXT_DLL_ALT - if (!hLibintlDLL) - hLibintlDLL = LoadLibrary(GETTEXT_DLL_ALT); -# endif - SetEnvironmentVariableW(L"PATH", buf); - } - free(buf); - free(buf2); - if (!hLibintlDLL) - return 0; - - // Get the addresses of the functions we need. - for (i = 0; libintl_entry[i].name != NULL - && libintl_entry[i].ptr != NULL; ++i) - { - if ((*libintl_entry[i].ptr = GetProcAddress(hLibintlDLL, - libintl_entry[i].name)) == NULL) - { - dyn_libintl_end(); - return 0; - } - } - return 1; -} - - static void -dyn_libintl_end(void) -{ - if (hLibintlDLL) - FreeLibrary(hLibintlDLL); - hLibintlDLL = NULL; - dyn_libintl_gettext = null_libintl_gettext; - dyn_libintl_textdomain = null_libintl_textdomain; - dyn_libintl_bindtextdomain = null_libintl_bindtextdomain; - dyn_libintl_bind_textdomain_codeset = null_libintl_bind_textdomain_codeset; -} - - static char * -null_libintl_gettext(const char *msgid) -{ - return (char *)msgid; -} - - static char * -null_libintl_textdomain(const char * /* domainname */) -{ - return NULL; -} - - static char * -null_libintl_bindtextdomain(const char * /* domainname */, const char * /* dirname */) -{ - return NULL; -} - - static char * -null_libintl_bind_textdomain_codeset(const char * /* domainname */, const char * /* codeset */) -{ - return NULL; -} - -// -// Setup for translating strings. -// - static void -dyn_gettext_load(void) -{ - char szBuff[BUFSIZE]; - DWORD len; - - // Try to locate the runtime files. The path is used to find libintl.dll - // and the vim.mo files. - getRuntimeDir(szBuff); - if (szBuff[0] != 0) - { - len = (DWORD)strlen(szBuff); - if (dyn_libintl_init(szBuff)) - { - strcpy(szBuff + len, "lang"); - - (*dyn_libintl_bindtextdomain)(VIMPACKAGE, szBuff); - (*dyn_libintl_textdomain)(VIMPACKAGE); - } - } -} - - static void -dyn_gettext_free(void) -{ - dyn_libintl_end(); -} - -// -// Use UTF-8 for gettext. Returns previous codeset. -// - static char * -set_gettext_codeset(void) -{ - char *prev = dyn_libintl_bind_textdomain_codeset(VIMPACKAGE, NULL); - prev = _strdup((prev != NULL) ? prev : "char"); - dyn_libintl_bind_textdomain_codeset(VIMPACKAGE, "utf-8"); - - return prev; -} - -// -// Restore previous codeset for gettext. -// - static void -restore_gettext_codeset(char *prev) -{ - dyn_libintl_bind_textdomain_codeset(VIMPACKAGE, prev); - free(prev); -} -#endif // FEAT_GETTEXT - -// -// Global variables -// -UINT g_cRefThisDll = 0; // Reference count of this DLL. -HINSTANCE g_hmodThisDll = NULL; // Handle to this DLL itself. - - -//--------------------------------------------------------------------------- -// DllMain -//--------------------------------------------------------------------------- -extern "C" int APIENTRY -DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /* lpReserved */) -{ - switch (dwReason) - { - case DLL_PROCESS_ATTACH: - // Extension DLL one-time initialization - g_hmodThisDll = hInstance; - break; - - case DLL_PROCESS_DETACH: - break; - } - - return 1; // ok -} - - static void -inc_cRefThisDLL() -{ -#ifdef FEAT_GETTEXT - if (g_cRefThisDll == 0) - dyn_gettext_load(); -#endif - InterlockedIncrement((LPLONG)&g_cRefThisDll); -} - - static void -dec_cRefThisDLL() -{ -#ifdef FEAT_GETTEXT - if (InterlockedDecrement((LPLONG)&g_cRefThisDll) == 0) - dyn_gettext_free(); -#else - InterlockedDecrement((LPLONG)&g_cRefThisDll); -#endif -} - -//--------------------------------------------------------------------------- -// DllCanUnloadNow -//--------------------------------------------------------------------------- - -STDAPI DllCanUnloadNow(void) -{ - return (g_cRefThisDll == 0 ? S_OK : S_FALSE); -} - -STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppvOut) -{ - *ppvOut = NULL; - - if (IsEqualIID(rclsid, CLSID_ShellExtension)) - { - CShellExtClassFactory *pcf = new CShellExtClassFactory; - - return pcf->QueryInterface(riid, ppvOut); - } - - return CLASS_E_CLASSNOTAVAILABLE; -} - -CShellExtClassFactory::CShellExtClassFactory() -{ - m_cRef = 0L; - - inc_cRefThisDLL(); -} - -CShellExtClassFactory::~CShellExtClassFactory() -{ - dec_cRefThisDLL(); -} - -STDMETHODIMP CShellExtClassFactory::QueryInterface(REFIID riid, - LPVOID FAR *ppv) -{ - *ppv = NULL; - - // any interface on this object is the object pointer - - if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IClassFactory)) - { - *ppv = (LPCLASSFACTORY)this; - - AddRef(); - - return NOERROR; - } - - return E_NOINTERFACE; -} - -STDMETHODIMP_(ULONG) CShellExtClassFactory::AddRef() -{ - return InterlockedIncrement((LPLONG)&m_cRef); -} - -STDMETHODIMP_(ULONG) CShellExtClassFactory::Release() -{ - if (InterlockedDecrement((LPLONG)&m_cRef)) - return m_cRef; - - delete this; - - return 0L; -} - -STDMETHODIMP CShellExtClassFactory::CreateInstance(LPUNKNOWN pUnkOuter, - REFIID riid, - LPVOID *ppvObj) -{ - *ppvObj = NULL; - - // Shell extensions typically don't support aggregation (inheritance) - - if (pUnkOuter) - return CLASS_E_NOAGGREGATION; - - // Create the main shell extension object. The shell will then call - // QueryInterface with IID_IShellExtInit--this is how shell extensions are - // initialized. - - LPCSHELLEXT pShellExt = new CShellExt(); // create the CShellExt object - - if (NULL == pShellExt) - return E_OUTOFMEMORY; - - return pShellExt->QueryInterface(riid, ppvObj); -} - - -STDMETHODIMP CShellExtClassFactory::LockServer(BOOL /* fLock */) -{ - return NOERROR; -} - -// *********************** CShellExt ************************* -CShellExt::CShellExt() -{ - m_cRef = 0L; - m_pDataObj = NULL; - - inc_cRefThisDLL(); - - LoadMenuIcon(); -} - -CShellExt::~CShellExt() -{ - if (m_pDataObj) - m_pDataObj->Release(); - - dec_cRefThisDLL(); - - if (m_hVimIconBitmap) - DeleteObject(m_hVimIconBitmap); -} - -STDMETHODIMP CShellExt::QueryInterface(REFIID riid, LPVOID FAR *ppv) -{ - *ppv = NULL; - - if (IsEqualIID(riid, IID_IShellExtInit) || IsEqualIID(riid, IID_IUnknown)) - { - *ppv = (LPSHELLEXTINIT)this; - } - else if (IsEqualIID(riid, IID_IContextMenu)) - { - *ppv = (LPCONTEXTMENU)this; - } - - if (*ppv) - { - AddRef(); - - return NOERROR; - } - - return E_NOINTERFACE; -} - -STDMETHODIMP_(ULONG) CShellExt::AddRef() -{ - return InterlockedIncrement((LPLONG)&m_cRef); -} - -STDMETHODIMP_(ULONG) CShellExt::Release() -{ - - if (InterlockedDecrement((LPLONG)&m_cRef)) - return m_cRef; - - delete this; - - return 0L; -} - - -// -// FUNCTION: CShellExt::Initialize(LPCITEMIDLIST, LPDATAOBJECT, HKEY) -// -// PURPOSE: Called by the shell when initializing a context menu or property -// sheet extension. -// -// PARAMETERS: -// pIDFolder - Specifies the parent folder -// pDataObj - Specifies the set of items selected in that folder. -// hRegKey - Specifies the type of the focused item in the selection. -// -// RETURN VALUE: -// -// NOERROR in all cases. -// -// COMMENTS: Note that at the time this function is called, we don't know -// (or care) what type of shell extension is being initialized. -// It could be a context menu or a property sheet. -// - -STDMETHODIMP CShellExt::Initialize(LPCITEMIDLIST /* pIDFolder */, - LPDATAOBJECT pDataObj, - HKEY /* hRegKey */) -{ - // Initialize can be called more than once - if (m_pDataObj) - m_pDataObj->Release(); - - // duplicate the object pointer and registry handle - - if (pDataObj) - { - m_pDataObj = pDataObj; - pDataObj->AddRef(); - } - - return NOERROR; -} - - -// -// FUNCTION: CShellExt::QueryContextMenu(HMENU, UINT, UINT, UINT, UINT) -// -// PURPOSE: Called by the shell just before the context menu is displayed. -// This is where you add your specific menu items. -// -// PARAMETERS: -// hMenu - Handle to the context menu -// indexMenu - Index of where to begin inserting menu items -// idCmdFirst - Lowest value for new menu ID's -// idCmtLast - Highest value for new menu ID's -// uFlags - Specifies the context of the menu event -// -// RETURN VALUE: -// -// -// COMMENTS: -// - -STDMETHODIMP CShellExt::QueryContextMenu(HMENU hMenu, - UINT indexMenu, - UINT idCmdFirst, - UINT /* idCmdLast */, - UINT /* uFlags */) -{ - UINT idCmd = idCmdFirst; - - hres = m_pDataObj->GetData(&fmte, &medium); - if (medium.hGlobal) - cbFiles = DragQueryFileW((HDROP)medium.hGlobal, (UINT)-1, 0, 0); - - // InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL); - - // Initialize m_cntOfHWnd to 0 - m_cntOfHWnd = 0; - - HKEY keyhandle; - bool showExisting = true; - bool showIcons = true; - - // Check whether "Edit with existing Vim" entries are disabled. - if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\Vim\\Gvim", 0, - KEY_READ, &keyhandle) == ERROR_SUCCESS) - { - if (RegQueryValueEx(keyhandle, "DisableEditWithExisting", 0, NULL, - NULL, NULL) == ERROR_SUCCESS) - showExisting = false; - if (RegQueryValueEx(keyhandle, "DisableContextMenuIcons", 0, NULL, - NULL, NULL) == ERROR_SUCCESS) - showIcons = false; - RegCloseKey(keyhandle); - } - - // Use UTF-8 for gettext. - char *prev = set_gettext_codeset(); - - // Retrieve all the vim instances, unless disabled. - if (showExisting) - EnumWindows(EnumWindowsProc, (LPARAM)this); - - MENUITEMINFOW mii = { sizeof(MENUITEMINFOW) }; - mii.fMask = MIIM_STRING | MIIM_ID; - if (showIcons) - { - mii.fMask |= MIIM_BITMAP; - mii.hbmpItem = m_hVimIconBitmap; - } - - if (cbFiles > 1) - { - mii.wID = idCmd++; - mii.dwTypeData = W(_("Edit with Vim using &tabpages")); - mii.cch = wcslen(mii.dwTypeData); - InsertMenuItemW(hMenu, indexMenu++, TRUE, &mii); - free(mii.dwTypeData); - - mii.wID = idCmd++; - mii.dwTypeData = W(_("Edit with single &Vim")); - mii.cch = wcslen(mii.dwTypeData); - InsertMenuItemW(hMenu, indexMenu++, TRUE, &mii); - free(mii.dwTypeData); - - if (cbFiles <= 4) - { - // Can edit up to 4 files in diff mode - mii.wID = idCmd++; - mii.dwTypeData = W(_("Diff with Vim")); - mii.cch = wcslen(mii.dwTypeData); - InsertMenuItemW(hMenu, indexMenu++, TRUE, &mii); - free(mii.dwTypeData); - m_edit_existing_off = 3; - } - else - m_edit_existing_off = 2; - - } - else - { - mii.wID = idCmd++; - mii.dwTypeData = W(_("Edit with &Vim")); - mii.cch = wcslen(mii.dwTypeData); - InsertMenuItemW(hMenu, indexMenu++, TRUE, &mii); - free(mii.dwTypeData); - m_edit_existing_off = 1; - } - - HMENU hSubMenu = NULL; - if (m_cntOfHWnd > 1) - { - hSubMenu = CreatePopupMenu(); - mii.fMask |= MIIM_SUBMENU; - mii.wID = idCmd; - mii.dwTypeData = W(_("Edit with existing Vim")); - mii.cch = wcslen(mii.dwTypeData); - mii.hSubMenu = hSubMenu; - InsertMenuItemW(hMenu, indexMenu++, TRUE, &mii); - free(mii.dwTypeData); - mii.fMask = mii.fMask & ~MIIM_SUBMENU; - mii.hSubMenu = NULL; - } - // Now display all the vim instances - for (int i = 0; i < m_cntOfHWnd; i++) - { - WCHAR title[BUFSIZE]; - WCHAR temp[BUFSIZE]; - int index; - HMENU hmenu; - - // Obtain window title, continue if can not - if (GetWindowTextW(m_hWnd[i], title, BUFSIZE - 1) == 0) - continue; - // Truncate the title before the path, keep the file name - WCHAR *pos = wcschr(title, L'('); - if (pos != NULL) - { - if (pos > title && pos[-1] == L' ') - --pos; - *pos = 0; - } - // Now concatenate - if (m_cntOfHWnd > 1) - temp[0] = L'\0'; - else - { - WCHAR *s = W(_("Edit with existing Vim - ")); - wcsncpy(temp, s, BUFSIZE - 1); - temp[BUFSIZE - 1] = L'\0'; - free(s); - } - wcsncat(temp, title, BUFSIZE - 1 - wcslen(temp)); - temp[BUFSIZE - 1] = L'\0'; - - mii.wID = idCmd++; - mii.dwTypeData = temp; - mii.cch = wcslen(mii.dwTypeData); - if (m_cntOfHWnd > 1) - { - hmenu = hSubMenu; - index = i; - } - else - { - hmenu = hMenu; - index = indexMenu++; - } - InsertMenuItemW(hmenu, index, TRUE, &mii); - } - // InsertMenu(hMenu, indexMenu++, MF_SEPARATOR|MF_BYPOSITION, 0, NULL); - - // Restore previous codeset. - restore_gettext_codeset(prev); - - // Must return number of menu items we added. - return ResultFromShort(idCmd-idCmdFirst); -} - -// -// FUNCTION: CShellExt::InvokeCommand(LPCMINVOKECOMMANDINFO) -// -// PURPOSE: Called by the shell after the user has selected on of the -// menu items that was added in QueryContextMenu(). -// -// PARAMETERS: -// lpcmi - Pointer to an CMINVOKECOMMANDINFO structure -// -// RETURN VALUE: -// -// -// COMMENTS: -// - -STDMETHODIMP CShellExt::InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi) -{ - HRESULT hr = E_INVALIDARG; - int gvimExtraOptions; - - // If HIWORD(lpcmi->lpVerb) then we have been called programmatically - // and lpVerb is a command that should be invoked. Otherwise, the shell - // has called us, and LOWORD(lpcmi->lpVerb) is the menu ID the user has - // selected. Actually, it's (menu ID - idCmdFirst) from QueryContextMenu(). - if (!HIWORD(lpcmi->lpVerb)) - { - UINT idCmd = LOWORD(lpcmi->lpVerb); - - if (idCmd >= m_edit_existing_off) - { - // Existing with vim instance - hr = PushToWindow(lpcmi->hwnd, - lpcmi->lpDirectory, - lpcmi->lpVerb, - lpcmi->lpParameters, - lpcmi->nShow, - idCmd - m_edit_existing_off); - } - else - { - switch (idCmd) - { - case 0: - gvimExtraOptions = EDIT_WITH_VIM_USE_TABPAGES; - break; - case 1: - gvimExtraOptions = EDIT_WITH_VIM_NO_OPTIONS; - break; - case 2: - gvimExtraOptions = EDIT_WITH_VIM_IN_DIFF_MODE; - break; - default: - // If execution reaches this point we likely have an - // inconsistency between the code that setup the menus - // and this code that determines what the user - // selected. This should be detected and fixed during - // development. - return E_FAIL; - } - - LPCMINVOKECOMMANDINFOEX lpcmiex = (LPCMINVOKECOMMANDINFOEX)lpcmi; - LPCWSTR currentDirectory = lpcmi->cbSize == sizeof(CMINVOKECOMMANDINFOEX) ? lpcmiex->lpDirectoryW : NULL; - - hr = InvokeSingleGvim(lpcmi->hwnd, - currentDirectory, - lpcmi->lpVerb, - lpcmi->lpParameters, - lpcmi->nShow, - gvimExtraOptions); - } - } - return hr; -} - -STDMETHODIMP CShellExt::PushToWindow(HWND /* hParent */, - LPCSTR /* pszWorkingDir */, - LPCSTR /* pszCmd */, - LPCSTR /* pszParam */, - int /* iShowCmd */, - int idHWnd) -{ - HWND hWnd = m_hWnd[idHWnd]; - - // Show and bring vim instance to foreground - if (IsIconic(hWnd) != 0) - ShowWindow(hWnd, SW_RESTORE); - else - ShowWindow(hWnd, SW_SHOW); - SetForegroundWindow(hWnd); - - // Post the selected files to the vim instance - PostMessage(hWnd, WM_DROPFILES, (WPARAM)medium.hGlobal, 0); - - return NOERROR; -} - -STDMETHODIMP CShellExt::GetCommandString(UINT_PTR /* idCmd */, - UINT uFlags, - UINT FAR * /* reserved */, - LPSTR pszName, - UINT cchMax) -{ - // Use UTF-8 for gettext. - char *prev = set_gettext_codeset(); - - WCHAR *s = W(_("Edits the selected file(s) with Vim")); - if (uFlags == GCS_HELPTEXTW && cchMax > wcslen(s)) - wcscpy((WCHAR *)pszName, s); - free(s); - - // Restore previous codeset. - restore_gettext_codeset(prev); - - return NOERROR; -} - -BOOL CALLBACK CShellExt::EnumWindowsProc(HWND hWnd, LPARAM lParam) -{ - char temp[BUFSIZE]; - - // First do a bunch of check - // No invisible window - if (!IsWindowVisible(hWnd)) - return TRUE; - // No child window ??? - // if (GetParent(hWnd)) return TRUE; - // Class name should be Vim, if failed to get class name, return - if (GetClassName(hWnd, temp, sizeof(temp)) == 0) - return TRUE; - // Compare class name to that of vim, if not, return - if (_strnicmp(temp, "vim", sizeof("vim")) != 0) - return TRUE; - // First check if the number of vim instance exceeds MAX_HWND - CShellExt *cs = (CShellExt*) lParam; - if (cs->m_cntOfHWnd >= MAX_HWND) - return FALSE; // stop enumeration - // Now we get the vim window, put it into some kind of array - cs->m_hWnd[cs->m_cntOfHWnd] = hWnd; - cs->m_cntOfHWnd ++; - - return TRUE; // continue enumeration (otherwise this would be false) -} - -BOOL CShellExt::LoadMenuIcon() -{ - char vimExeFile[BUFSIZE]; - getGvimName(vimExeFile, 1); - if (vimExeFile[0] == '\0') - return FALSE; - HICON hVimIcon; - if (ExtractIconEx(vimExeFile, 0, NULL, &hVimIcon, 1) == 0) - return FALSE; - m_hVimIconBitmap = IconToBitmap(hVimIcon, - GetSysColorBrush(COLOR_MENU), - GetSystemMetrics(SM_CXSMICON), - GetSystemMetrics(SM_CYSMICON)); - return TRUE; -} - - static char * -searchpath(char *name) -{ - static char widename[2 * BUFSIZE]; - static char location[2 * BUFSIZE + 2]; - - // There appears to be a bug in FindExecutableA() on Windows NT. - // Use FindExecutableW() instead... - MultiByteToWideChar(CP_ACP, 0, (LPCSTR)name, -1, - (LPWSTR)widename, BUFSIZE); - if (FindExecutableW((LPCWSTR)widename, (LPCWSTR)"", - (LPWSTR)location) > (HINSTANCE)32) - { - WideCharToMultiByte(CP_ACP, 0, (LPWSTR)location, -1, - (LPSTR)widename, 2 * BUFSIZE, NULL, NULL); - return widename; - } - return (char *)""; -} - - -STDMETHODIMP CShellExt::InvokeSingleGvim(HWND hParent, - LPCWSTR workingDir, - LPCSTR /* pszCmd */, - LPCSTR /* pszParam */, - int /* iShowCmd */, - int gvimExtraOptions) -{ - wchar_t m_szFileUserClickedOn[BUFSIZE]; - wchar_t *cmdStrW; - size_t cmdlen; - size_t len; - UINT i; - - cmdlen = BUFSIZE; - cmdStrW = (wchar_t *) malloc(cmdlen * sizeof(wchar_t)); - if (cmdStrW == NULL) - return E_FAIL; - getGvimInvocationW(cmdStrW); - - if (gvimExtraOptions == EDIT_WITH_VIM_IN_DIFF_MODE) - wcscat(cmdStrW, L" -d"); - else if (gvimExtraOptions == EDIT_WITH_VIM_USE_TABPAGES) - wcscat(cmdStrW, L" -p"); - for (i = 0; i < cbFiles; i++) - { - DragQueryFileW((HDROP)medium.hGlobal, - i, - m_szFileUserClickedOn, - sizeof(m_szFileUserClickedOn)); - - len = wcslen(cmdStrW) + wcslen(m_szFileUserClickedOn) + 4; - if (len > cmdlen) - { - cmdlen = len + BUFSIZE; - wchar_t *cmdStrW_new = (wchar_t *)realloc(cmdStrW, cmdlen * sizeof(wchar_t)); - if (cmdStrW_new == NULL) - { - free(cmdStrW); - return E_FAIL; - } - cmdStrW = cmdStrW_new; - } - wcscat(cmdStrW, L" \""); - wcscat(cmdStrW, m_szFileUserClickedOn); - wcscat(cmdStrW, L"\""); - } - - STARTUPINFOW si; - PROCESS_INFORMATION pi; - - ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - - // Start the child process. - if (!CreateProcessW(NULL, // No module name (use command line). - cmdStrW, // Command line. - NULL, // Process handle not inheritable. - NULL, // Thread handle not inheritable. - FALSE, // Set handle inheritance to FALSE. - 0, // No creation flags. - NULL, // Use parent's environment block. - workingDir, // Use parent's starting directory. - &si, // Pointer to STARTUPINFO structure. - &pi) // Pointer to PROCESS_INFORMATION structure. - ) - { - // Use UTF-8 for gettext. - char *prev = set_gettext_codeset(); - - WCHAR *msg = W(_("Error creating process: Check if gvim is in your path!")); - WCHAR *title = W(_("gvimext.dll error")); - - MessageBoxW(hParent, msg, title, MB_OK); - - free(msg); - free(title); - - // Restore previous codeset. - restore_gettext_codeset(prev); - } - else - { - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - } - free(cmdStrW); - - return NOERROR; -} diff --git a/uvim/src/GvimExt/gvimext.def b/uvim/src/GvimExt/gvimext.def deleted file mode 100644 index e6d66f4362..0000000000 --- a/uvim/src/GvimExt/gvimext.def +++ /dev/null @@ -1,8 +0,0 @@ -;gvimdef.def : Declares the module parameters for the DLL. - -LIBRARY gvimext -; DESCRIPTION 'Vim Shell Extension' - -EXPORTS - DllCanUnloadNow private - DllGetClassObject private diff --git a/uvim/src/GvimExt/gvimext.h b/uvim/src/GvimExt/gvimext.h deleted file mode 100644 index e7bcfb84f0..0000000000 --- a/uvim/src/GvimExt/gvimext.h +++ /dev/null @@ -1,167 +0,0 @@ -/* vi:set ts=8 sts=4 sw=4: - * - * VIM - Vi IMproved gvimext by Tianmiao Hu - * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - */ - -/* - * If you have any questions or any suggestions concerning gvimext, please - * contact Tianmiao Hu: tianmiao@acm.org. - */ - -#if !defined(AFX_STDAFX_H__3389658B_AD83_11D3_9C1E_0090278BBD99__INCLUDED_) -#define AFX_STDAFX_H__3389658B_AD83_11D3_9C1E_0090278BBD99__INCLUDED_ - -#if defined(_MSC_VER) && _MSC_VER > 1000 -#pragma once -#endif - -// Insert your headers here -// #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -//-------------------------------------------------------------- -// common user interface routines -// -// -//-------------------------------------------------------------- - -#ifndef STRICT -# define STRICT -#endif - -#define INC_OLE2 // MS-Windows, get ole2 from windows.h - -/* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */ -#if defined(_MSC_VER) && _MSC_VER >= 1400 -# define _CRT_SECURE_NO_DEPRECATE -# define _CRT_NONSTDC_NO_DEPRECATE -#endif - -#include -#include -#include -#include - -#define ResultFromShort(i) ResultFromScode(MAKE_SCODE(SEVERITY_SUCCESS, 0, (USHORT)(i))) - -// Initialize GUIDs (should be done only and at-least once per DLL/EXE) -// -#pragma data_seg(".text") -#define INITGUID -#include - -// -// The class ID of this Shell extension class. -// -// class id: {51EEE242-AD87-11d3-9C1E-0090278BBD99} -// -// -// NOTE!!! If you use this shell extension as a starting point, -// you MUST change the GUID below. Simply run UUIDGEN.EXE -// to generate a new GUID. -// - -// {51EEE242-AD87-11d3-9C1E-0090278BBD99} -// static const GUID <> = -// { 0x51eee242, 0xad87, 0x11d3, { 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99 } }; -// -// - -// {51EEE242-AD87-11d3-9C1E-0090278BBD99} -// IMPLEMENT_OLECREATE(<>, <>, -// 0x51eee242, 0xad87, 0x11d3, 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99); -// - -// {51EEE242-AD87-11d3-9C1E-0090278BBD99} -- this is the registry format -DEFINE_GUID(CLSID_ShellExtension, 0x51eee242, 0xad87, 0x11d3, 0x9c, 0x1e, 0x0, 0x90, 0x27, 0x8b, 0xbd, 0x99); - -// this class factory object creates context menu handlers for windows 32 shell -class CShellExtClassFactory : public IClassFactory -{ -protected: - ULONG m_cRef; - -public: - CShellExtClassFactory(); - ~CShellExtClassFactory(); - - //IUnknown members - STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *); - STDMETHODIMP_(ULONG) AddRef(); - STDMETHODIMP_(ULONG) Release(); - - //IClassFactory members - STDMETHODIMP CreateInstance(LPUNKNOWN, REFIID, LPVOID FAR *); - STDMETHODIMP LockServer(BOOL); -}; -typedef CShellExtClassFactory *LPCSHELLEXTCLASSFACTORY; -#define MAX_HWND 100 - -// this is the actual OLE Shell context menu handler -class CShellExt : public IContextMenu, - IShellExtInit -{ -private: - BOOL LoadMenuIcon(); - -protected: - ULONG m_cRef; - LPDATAOBJECT m_pDataObj; - UINT m_edit_existing_off; - HBITMAP m_hVimIconBitmap; - - // For some reason, this callback must be static - static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam); - - STDMETHODIMP PushToWindow(HWND hParent, - LPCSTR pszWorkingDir, - LPCSTR pszCmd, - LPCSTR pszParam, - int iShowCmd, - int idHWnd); - - STDMETHODIMP InvokeSingleGvim(HWND hParent, - LPCWSTR workingDir, - LPCSTR pszCmd, - LPCSTR pszParam, - int iShowCmd, - int gvimExtraOptions); - -public: - int m_cntOfHWnd; - HWND m_hWnd[MAX_HWND]; - CShellExt(); - ~CShellExt(); - - //IUnknown members - STDMETHODIMP QueryInterface(REFIID, LPVOID FAR *); - STDMETHODIMP_(ULONG) AddRef(); - STDMETHODIMP_(ULONG) Release(); - - //IShell members - STDMETHODIMP QueryContextMenu(HMENU hMenu, - UINT indexMenu, - UINT idCmdFirst, - UINT idCmdLast, - UINT uFlags); - - STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi); - - STDMETHODIMP GetCommandString(UINT_PTR idCmd, - UINT uFlags, - UINT FAR *reserved, - LPSTR pszName, - UINT cchMax); - - //IShellExtInit methods - STDMETHODIMP Initialize(LPCITEMIDLIST pIDFolder, - LPDATAOBJECT pDataObj, - HKEY hKeyID); -}; - -typedef CShellExt *LPCSHELLEXT; -#pragma data_seg() - -#endif diff --git a/uvim/src/GvimExt/gvimext.inf b/uvim/src/GvimExt/gvimext.inf deleted file mode 100644 index 65dcf72cd5..0000000000 --- a/uvim/src/GvimExt/gvimext.inf +++ /dev/null @@ -1,22 +0,0 @@ -[Version] -Signature="$Windows NT$"" -Provider="Tianmiao" - -[Manufacture] - -[DefaultInstall] -AddReg=ThisDll.Add.Reg - -[DefaultUninstall] -DelReg=ThisDLL.Add.Reg - -[ThisDll.Add.Reg] -HKCR,CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99} -HKCR,CLSID\{51EEE242-AD87-11d3-9C1E-0090278BBD99}\InProcServer32 -HKCR,*\shellex\ContextMenuHandlers\gvim -HKLM,"SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved",{51EEE242-AD87-11d3-9C1E-0090278BBD99} -HKLM,Software\Vim\Gvim -HKLM,"Software\Microsoft\Windows\CurrentVersion\Uninstall\Vim 9.2" - -[Strings] -ThisDll="gvimext.dll" diff --git a/uvim/src/GvimExt/gvimext.rc b/uvim/src/GvimExt/gvimext.rc deleted file mode 100644 index 10476da4fa..0000000000 --- a/uvim/src/GvimExt/gvimext.rc +++ /dev/null @@ -1,109 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winresrc.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x3L -#else - FILEFLAGS 0x2L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", "Developed using COM architecture!\0" - VALUE "CompanyName", "Tianmiao Hu's Developer Studio\0" - VALUE "FileDescription", "A small project for the context menu of gvim!\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "gvim right-click menu extension\0" - VALUE "LegalCopyright", "Copyright © 1999 Tianmiao Hu\0" - VALUE "LegalTrademarks", "Tianmiao Hu's Gvim Context Menu Extension\0" - VALUE "OriginalFilename", "gvimext.dll\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Tianmiao Hu's gvimext context menu extension\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/uvim/src/GvimExt/gvimext_ming.def b/uvim/src/GvimExt/gvimext_ming.def deleted file mode 100644 index b96e1d3992..0000000000 --- a/uvim/src/GvimExt/gvimext_ming.def +++ /dev/null @@ -1,10 +0,0 @@ -;gvimdef_ming.def : Declares the module parameters for the DLL. -;The mingw environment doesn't know anything about private declarations -;Hence this is the same file as gvimext.def with private removed - -LIBRARY gvimext -; DESCRIPTION 'Vim Shell Extension build with MinGW' - -EXPORTS - DllCanUnloadNow = DllCanUnloadNow@0 - DllGetClassObject = DllGetClassObject@12 diff --git a/uvim/src/GvimExt/gvimext_ming.rc b/uvim/src/GvimExt/gvimext_ming.rc deleted file mode 100644 index 6c69854094..0000000000 --- a/uvim/src/GvimExt/gvimext_ming.rc +++ /dev/null @@ -1,45 +0,0 @@ -#include -#define xstr(x) str(x) -#define str(x) #x -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x3L -#else - FILEFLAGS 0x2L -#endif - FILEOS 0x4L - FILETYPE VFT_DLL - FILESUBTYPE 0x0L -{ - BLOCK "StringFileInfo" - { - BLOCK "040904b0" - { - VALUE "Comments", "Developed using COM architecture!\0" - VALUE "CompanyName", "Tianmiao Hu's Developer Studio\0" - VALUE "FileDescription", "A small project for the context menu of gvim!\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "gvim right-click menu extension\0" - VALUE "LegalCopyright", "Copyright © 1999 Tianmiao Hu\0" - VALUE "LegalTrademarks", "Tianmiao Hu's Gvim Context Menu Extension\0" - VALUE "OriginalFilename", "gvimext.dll\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "Tianmiao Hu's gvimext context menu extension\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - -#if defined(__GNUC__) - VALUE "SpecialBuild", "Build With " "MingW " xstr(__GNUC__) "." xstr(__GNUC_MINOR__) "." xstr(__GNUC_PATCHLEVEL__) " on " __DATE__ " " __TIME__ "\0" -#else - VALUE "SpecialBuild", "Unknown compiler\0" - -#endif - } - } - BLOCK "VarFileInfo" - { - VALUE "Translation", 0x409, 1200 - } -} diff --git a/uvim/src/GvimExt/resource.h b/uvim/src/GvimExt/resource.h deleted file mode 100644 index 8ddc823f8c..0000000000 --- a/uvim/src/GvimExt/resource.h +++ /dev/null @@ -1,15 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by gvimext.rc -// - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/uvim/src/GvimExt/uninst.bat b/uvim/src/GvimExt/uninst.bat deleted file mode 100644 index 71d14f65a2..0000000000 --- a/uvim/src/GvimExt/uninst.bat +++ /dev/null @@ -1 +0,0 @@ -rundll32.exe setupapi,InstallHinfSection DefaultUninstall 128 %1 diff --git a/uvim/src/INSTALL b/uvim/src/INSTALL index ab760cd13a..0bae38ea68 100644 --- a/uvim/src/INSTALL +++ b/uvim/src/INSTALL @@ -1,7 +1,7 @@ -INSTALL - Installation of Vim on different machines. +INSTALL - Installation of MNV on different machines. -This file contains instructions for compiling Vim. If you already have an -executable version of Vim, you don't need this. +This file contains instructions for compiling MNV. If you already have an +executable version of MNV, you don't need this. Contents: 1. Generic @@ -20,7 +20,7 @@ See ../runtime/doc/os_haiku.txt for Haiku 1. Generic ========== -If you compile Vim without specifying anything, you will get the default +If you compile MNV without specifying anything, you will get the default behaviour as is documented, which should be fine for most people. For features that you can't enable/disable in another way, you can edit the @@ -35,26 +35,26 @@ Summary: 2. make install installation in /usr/local This will include the GUI and X11 libraries, if you have them. If you want a -version of Vim that is small and starts up quickly, see the Makefile for how +version of MNV that is small and starts up quickly, see the Makefile for how to disable the GUI and X11. If you don't have GUI libraries and/or X11, these features will be disabled automatically. -To build Vim on Ubuntu from scratch on a clean system using git: - Install tools required to be able to get and build Vim: +To build MNV on Ubuntu from scratch on a clean system using git: + Install tools required to be able to get and build MNV: % sudo apt install git % sudo apt install make % sudo apt install clang % sudo apt install libtool-bin - Build Vim with default features: - % git clone https://github.com/vim/vim.git - % cd vim/src + Build MNV with default features: + % git clone https://github.com/Project-Tick/Project-Tick.git + % cd mnv/src % make Run tests to check there are no problems: % make test - Install Vim in /usr/local: + Install MNV in /usr/local: % sudo make install Add X windows clipboard support (also needed for GUI): @@ -81,7 +81,7 @@ To build Vim on Ubuntu from scratch on a clean system using git: See the start of Makefile for more detailed instructions about how to compile -Vim. +MNV. If you need extra compiler and/or linker arguments, set $CFLAGS and/or $LIBS before starting configure. Example: @@ -92,14 +92,14 @@ This is only needed for things that configure doesn't offer a specific argument for or figures out by itself. First try running configure without extra arguments. -GNU Autoconf and a few other tools have been used to make Vim work on many -different Unix systems. The advantage of this is that Vim should compile +GNU Autoconf and a few other tools have been used to make MNV work on many +different Unix systems. The advantage of this is that MNV should compile on most systems without any adjustments. The disadvantage is that when adjustments are required, it takes some time to understand what is happening. If configure finds all library files and then complains when linking that some of them can't be found, your linker doesn't return an error code for missing -libraries. Vim should be linked fine anyway, mostly you can just ignore these +libraries. MNV should be linked fine anyway, mostly you can just ignore these errors. If you run configure by hand (not using the Makefile), remember that any @@ -107,7 +107,7 @@ changes in the Makefile have no influence on configure. This may be what you want, but maybe not! The advantage of running configure separately, is that you can write a script -to build Vim, without changing the Makefile or feature.h. Example (using sh): +to build MNV, without changing the Makefile or feature.h. Example (using sh): CFLAGS=-DCOMPILER_FLAG ./configure --enable-gui=motif @@ -115,7 +115,7 @@ One thing to watch out for: If the configure script itself changes, running "make" will execute it again, but without your arguments. Do "make clean" and run configure again. -If you are compiling Vim for several machines, for each machine: +If you are compiling MNV for several machines, for each machine: a. make shadow b. mv shadow machine_name c. cd machine_name @@ -159,14 +159,14 @@ then you'd specify --enable-gui=motif. Once you specify what you want, the --enable-{gtk,gtk2,kde,motif,athena}-check options are ignored. On Linux you usually need GUI "-devel" packages. You may already have GTK -libraries installed, but that doesn't mean you can compile Vim with GTK, you +libraries installed, but that doesn't mean you can compile MNV with GTK, you also need the header files. For compiling with the GTK+ GUI, you need a recent version of glib and gtk+. Configure checks for at least version 1.1.16. An older version is not selected automatically. If you want to use it anyway, run configure with "--disable-gtktest". -GTK requires an ANSI C compiler. If you fail to compile Vim with GTK+ (it +GTK requires an ANSI C compiler. If you fail to compile MNV with GTK+ (it is the preferred choice), try selecting another one in the Makefile. If you are sure you have GTK installed, but for some reason configure says you do not, you may have left-over header files and/or library files from an older @@ -174,16 +174,16 @@ do not, you may have left-over header files and/or library files from an older auto/config.log for any error messages that may give you a hint as to what's happening. -There used to be a KDE version of Vim, using Qt libraries, but since it didn't +There used to be a KDE version of MNV, using Qt libraries, but since it didn't work very well and there was no maintainer it was dropped. -Unix: PUTTING vimrc IN /etc +Unix: PUTTING mnvrc IN /etc -Some Linux distributions prefer to put the global vimrc file in /etc, and the -Vim runtime files in /usr. This can be done with: +Some Linux distributions prefer to put the global mnvrc file in /etc, and the +MNV runtime files in /usr. This can be done with: ./configure --prefix=/usr - make VIMRCLOC=/etc VIMRUNTIMEDIR=/usr/share/vim MAKE="make -e" + make MNVRCLOC=/etc MNVRUNTIMEDIR=/usr/share/mnv MAKE="make -e" Unix: LOCAL HEADERS AND LIBRARIES NOT IN /usr/local diff --git a/uvim/src/INSTALLami.txt b/uvim/src/INSTALLami.txt index a2c9faf247..2d9e9f3a00 100644 --- a/uvim/src/INSTALLami.txt +++ b/uvim/src/INSTALLami.txt @@ -1,7 +1,7 @@ -INSTALLami.txt - Installation of Vim from source on Amiga and MorphOS +INSTALLami.txt - Installation of MNV from source on Amiga and MorphOS -This file contains instructions for compiling Vim. If you already have an -executable version of Vim, you don't need this. +This file contains instructions for compiling MNV. If you already have an +executable version of MNV, you don't need this. The file "feature.h" can be edited to match your preferences. You can skip this, then you will get the default behavior as is documented, which should diff --git a/uvim/src/INSTALLmac.txt b/uvim/src/INSTALLmac.txt index 2e8a65650f..ef3e57d93a 100644 --- a/uvim/src/INSTALLmac.txt +++ b/uvim/src/INSTALLmac.txt @@ -1,9 +1,9 @@ -INSTALLmac.txt - Installation of Vim on Apple MacOS +INSTALLmac.txt - Installation of MNV on Apple MacOS -This file contains instructions for compiling Vim. If you already have an -executable version of Vim, you don't need this. +This file contains instructions for compiling MNV. If you already have an +executable version of MNV, you don't need this. -MacOS Classic is no longer supported. If you really want it use Vim 6.4. +MacOS Classic is no longer supported. If you really want it use MNV 6.4. Only '/' is supported as path separator. @@ -22,17 +22,17 @@ If not installed yet a window pops up instructing you to install the developer tools. If you don't have the source yet, best is to use git (which you need to -install first), see http://www.vim.org/git.php +install first), see http://www.mnv.org/git.php Or you can download and unpack the Unix tar archive, see - http://www.vim.org/download.php + http://www.mnv.org/download.php ---------------------------------------------------------------------------- Build and install the terminal version. ---------------------------------------------------------------------------- -You can compile vim with the standard Unix routine: - cd vim/src +You can compile mnv with the standard Unix routine: + cd mnv/src make make test sudo make install diff --git a/uvim/src/INSTALLpc.txt b/uvim/src/INSTALLpc.txt index 5ea4d7a04e..6238827cbc 100644 --- a/uvim/src/INSTALLpc.txt +++ b/uvim/src/INSTALLpc.txt @@ -1,9 +1,9 @@ -INSTALLpc.txt - Installation of Vim on PC - Last Update: 2025 Aug 10 +INSTALLpc.txt - Installation of MNV on PC - Last Update: 2025 Aug 10 -This file contains instructions for compiling Vim. If you already have an -executable version of Vim, you don't need this. +This file contains instructions for compiling MNV. If you already have an +executable version of MNV, you don't need this. -You can find the latest here: https://github.com/vim/vim-win32-installer +You can find the latest here: https://github.com/Project-Tick/Project-Tick-win32-installer This page also has links to install support for interfaces such as Perl, Python, Lua, etc. @@ -11,12 +11,12 @@ The file "feature.h" can be edited to match your preferences. You can skip this, then you will get the default behavior as is documented, which should be fine for most people. -This document assumes that you are building Vim for Win32 or later (Windows +This document assumes that you are building MNV for Win32 or later (Windows 7/8/10/11). There are also instructions for pre-Vista and pre-XP systems, but they might no longer work. -The recommended way is to build a 32 bit Vim, also on 64 bit systems. You can -build a 64 bit Vim if you like, the executable will be bigger and Vim won't be +The recommended way is to build a 32 bit MNV, also on 64 bit systems. You can +build a 64 bit MNV if you like, the executable will be bigger and MNV won't be any faster, but you can edit files larger than 2 Gbyte. @@ -60,10 +60,10 @@ Visual Studio 2022" make sure to select "custom" and check all checkboxes under "Universal Windows App Development Tools". Or whatever they are called now. -Note: Vim source code no longer supports Windows XP since Patch 9.0.0496. +Note: MNV source code no longer supports Windows XP since Patch 9.0.0496. Also, Visual Studio 2017 was the last version to support a Windows XP target. If you still want to target Windows XP, you can check out an older version of -vim source code and install Visual Studio 2017 or 2015 - making sure to check +mnv source code and install Visual Studio 2017 or 2015 - making sure to check the checkbox for "Windows XP Support for C++". Additional build instructions for Windows XP are provided below. |new-msvc-windows-xp| @@ -74,15 +74,15 @@ Visual Studio Building with Visual Studio (VS2015, VS2017, VS2019 and VS2022) is straightforward. Older versions probably don't work. -Vim versions built with VS2015 and VS2017 are systematically tested and known +MNV versions built with VS2015 and VS2017 are systematically tested and known to work well on Windows versions 7, 8 and 8.1. -Vim versions built with VS2015 and VS2017 are also known to work well on all -early versions of Windows 10. However, Vim versions built with VS2015 and +MNV versions built with VS2015 and VS2017 are also known to work well on all +early versions of Windows 10. However, MNV versions built with VS2015 and VS2017 may run into a known issue on the latest versions of Windows 10 and 11. -Building Vim with VS2019 or VS2022 resolves the issue. +Building MNV with VS2019 or VS2022 resolves the issue. -Vim versions built with VS2019 and VS2022 are systematically tested and +MNV versions built with VS2019 and VS2022 are systematically tested and known to work on Windows versions 7, 8, 8.1, 10, 11 and all respective server variants. @@ -96,7 +96,7 @@ and so on for the specific version). You must specify the architecture (e.g. Express, you must use "x86_amd64" instead of "x64" for targeting the x64 platform. -To build Vim from the command line with MSVC, use Make_mvc.mak. +To build MNV from the command line with MSVC, use Make_mvc.mak. nmake -f Make_mvc.mak console Win32 SDK or Microsoft Visual C++ nmake -f Make_mvc.mak GUI=yes GUI Microsoft Visual C++ @@ -104,10 +104,10 @@ nmake -f Make_mvc.mak OLE=yes OLE Microsoft Visual C++ nmake -f Make_mvc.mak PERL=C:\Perl PYTHON=C:\Python etc. Perl, Python, etc. -Make_mvc.mak allows a Vim to be built with various different features and +Make_mvc.mak allows a MNV to be built with various different features and debug support. -For compiling gVim with IME support on far-east Windows, add IME=yes +For compiling gMNV with IME support on far-east Windows, add IME=yes to the parameters you pass to Make_mvc.mak. See the specific files for comments and options. @@ -191,7 +191,7 @@ Go to the official page of MSYS2: https://www.msys2.org Download an installer: * msys2-x86_64-YYYYMMDD.exe for 64-bit Windows - (Even if you want to build 32-bit Vim) + (Even if you want to build 32-bit MNV) * msys2-i686-YYYYMMDD.exe for 32-bit Windows Execute the installer and follow the instructions to update basic packages. @@ -202,7 +202,7 @@ Execute: $ pacman -Syu And restart MSYS2 console (select "MSYS2 MSYS 32-Bit" icon from the Start -Menu for building 32 bit Vim, otherwise select "MSYS2 MinGW 64-Bit"). +Menu for building 32 bit MNV, otherwise select "MSYS2 MinGW 64-Bit"). Then execute: $ pacman -Su @@ -210,17 +210,17 @@ If pacman complains that `catgets` and `libcatgets` conflict with another package, select `y` to remove them. -2.1.2. Install additional packages for building Vim +2.1.2. Install additional packages for building MNV -The following package groups are required for building Vim: +The following package groups are required for building MNV: * base-devel -* mingw-w64-i686-toolchain (for building 32-bit Vim) -* mingw-w64-x86_64-toolchain (for building 64-bit Vim) +* mingw-w64-i686-toolchain (for building 32-bit MNV) +* mingw-w64-x86_64-toolchain (for building 64-bit MNV) * git (optional, to clone the repository) * pactoys (optional for the pacboy command) -(These groups also include some useful packages which are not used by Vim.) +(These groups also include some useful packages which are not used by MNV.) Use the following command to install them: $ pacman -S base-devel mingw-w64-i686-toolchain \ @@ -251,22 +251,22 @@ In that case, you just need to execute the command: $ pacman -Syu -2.1.4. Build Vim +2.1.4. Build MNV Select one of the following icon from the Start Menu: -* MSYS2 MinGW 32-bit (To build 32-bit versions of Vim) -* MSYS2 MinGW 64-bit (To build 64-bit versions of Vim) +* MSYS2 MinGW 32-bit (To build 32-bit versions of MNV) +* MSYS2 MinGW 64-bit (To build 64-bit versions of MNV) Before building look through notes for MinGW in part 3 below. -Go to the source directory of Vim, then execute the make command. E.g.: +Go to the source directory of MNV, then execute the make command. E.g.: make -f Make_ming.mak make -f Make_ming.mak GUI=no make -f Make_ming.mak GUI=no DEBUG=yes -NOTE: you can't execute vim.exe in the MSYS2 console, open a normal Windows +NOTE: you can't execute mnv.exe in the MSYS2 console, open a normal Windows console for that. You need to set $PATH to be able to build there, e.g.: set PATH=c:\msys64\mingw32\bin;c:\msys64\usr\bin;%PATH% @@ -278,9 +278,9 @@ This command is in msys32.bat. Or for the 64 bit compiler use msys64.bat: If you have msys64 in another location you will need to adjust the paths for that. -2.1.5. Build Vim with Clang +2.1.5. Build MNV with Clang -The following package group is required for building Vim with Clang: +The following package group is required for building MNV with Clang: * mingw-w64-clang-x86_64-clang @@ -288,22 +288,22 @@ Use the following command to install it: $ pacman -S mingw-w64-clang-x86_64-clang -Go to the source directory of Vim, then execute the make command. E.g.: +Go to the source directory of MNV, then execute the make command. E.g.: CC=clang CXX=clang++ - # To build Vim without the GUI support + # To build MNV without the GUI support make -f Make_ming.mak GUI=no - # To build Vim with the GUI support + # To build MNV with the GUI support make -f Make_ming.mak GUI=yes XPM=no -To build Vim with the address sanitizer (ASAN), execute the following command: +To build MNV with the address sanitizer (ASAN), execute the following command: CC=clang CXX=clang++ make -f Make_ming.mak DEBUG=yes ASAN=yes -2.2 Buidling an Arch64 version of Vim +2.2 Buidling an Arch64 version of MNV 2.2.1. Setup the basic msys2 environment @@ -325,7 +325,7 @@ And restart MSYS2 console. Then execute: $ pacman -Su -2.2.2. Install additional packages for building Vim +2.2.2. Install additional packages for building MNV $ pacman -S mingw-w64-clang-aarch64-clang mingw-w64-clang-aarch64-toolchain base-devel git @@ -349,11 +349,11 @@ In that case, you just need to execute the command: $ pacman -Syu -2.2.4. Build Vim +2.2.4. Build MNV Before building look through notes for MinGW in part 3 below. -Go to the source directory of Vim, then execute the make command. E.g.: +Go to the source directory of MNV, then execute the make command. E.g.: CC=clang CXX=clang++ @@ -361,10 +361,10 @@ Go to the source directory of Vim, then execute the make command. E.g.: make -f Make_ming.mak GUI=yes make -f Make_ming.mak GUI=no DEBUG=yes -NOTE: you can't execute vim.exe in the MSYS2 console, open a normal Windows +NOTE: you can't execute mnv.exe in the MSYS2 console, open a normal Windows console for that. -To build Vim with the address sanitizer (ASAN), execute the following command: +To build MNV with the address sanitizer (ASAN), execute the following command: make -f Make_ming.mak DEBUG=yes ASAN=yes @@ -373,7 +373,7 @@ To build Vim with the address sanitizer (ASAN), execute the following command: (written by Ron Aaron: , updated by Ken Takata, et al.) -This is about how to produce a Win32 binary of gvim with MinGW from the normal +This is about how to produce a Win32 binary of gmnv with MinGW from the normal Command Prompt window. (To use MSYS2 console, see above.) First, you need to get the 'MinGW-w64' compiler, which is free for the @@ -392,8 +392,8 @@ The original 'mingw32' compiler is outdated, and may no longer work: Please note, newer versions of Windows (I believe starting with Win10) offer support for UCRT C-library in addition to traditional MSVCRT. As result, one may find 2 flavors of MinGW: one compiling against UCRT and another compiling -against MSVCRT. Currently VIM comes with libXpm.a compiled against MSVCRT, -so an attempt to build VIM against UCRT will fail with: +against MSVCRT. Currently MNV comes with libXpm.a compiled against MSVCRT, +so an attempt to build MNV against UCRT will fail with: undefined reference to __imp___iob_func @@ -420,33 +420,33 @@ Test if gcc is on your path. From a Command Prompt window: C:\> mingw32-make --version GNU Make 3.82.90 (...etc...) -Now you are ready to rock 'n' roll. Unpack the vim sources (look on -www.vim.org for exactly which version of the vim files you need). +Now you are ready to rock 'n' roll. Unpack the mnv sources (look on +www.mnv.org for exactly which version of the mnv files you need). -Change directory to 'vim\src': +Change directory to 'mnv\src': - C:\> cd vim\src - C:\VIM\SRC> + C:\> cd mnv\src + C:\MNV\SRC> and you type: - mingw32-make -f Make_ming.mak ARCH=x86-64 gvim.exe + mingw32-make -f Make_ming.mak ARCH=x86-64 gmnv.exe Note, ARCH is necessary if you don't have the sed command in your $PATH. Just make sure that the correct value is used with ARCH. In the example above the value corresponds to 64-bit architecture. For 32-bit the value is "i686". -After churning for a while, you will end up with 'gvim.exe' in the 'vim\src' +After churning for a while, you will end up with 'gmnv.exe' in the 'mnv\src' directory. -If you also want to get xxd.exe, install.exe etc. then just remove "gvim.exe" +If you also want to get xxd.exe, install.exe etc. then just remove "gmnv.exe" from the make-command. -You should not need to do *any* editing of any files to get vim compiled this -way. If, for some reason, you want the console-mode-only version of vim (this +You should not need to do *any* editing of any files to get mnv compiled this +way. If, for some reason, you want the console-mode-only version of mnv (this is NOT recommended on Win32, especially on '95/'98!!!), you can use: - mingw32-make -f Make_ming.mak GUI=no vim.exe + mingw32-make -f Make_ming.mak GUI=no mnv.exe If you are dismayed by how big the EXE is, I strongly recommend you get 'UPX' (also free!) and compress the file (typical compression is 50%). UPX can be @@ -454,7 +454,7 @@ found at http://www.upx.org/ As of 2011, UPX still does not support compressing 64-bit EXE's; if you have -built a 64-bit vim then an alternative to UPX is 'MPRESS'. MPRESS can be found +built a 64-bit mnv then an alternative to UPX is 'MPRESS'. MPRESS can be found at: matcode.com/mpress.htm (now a dead link) @@ -471,10 +471,10 @@ You need to uncomment lines in Make_ming.mak to have NLS defined. ========= Use Make_cyg.mak with Cygwin's GCC. See - (now dead) users.skynet.be/antoine.mechelynck/vim/compile.htm + (now dead) users.skynet.be/antoine.mechelynck/mnv/compile.htm With Cygnus gcc you should use the Unix Makefile instead (you need to get the -Unix archive then). Then you get a Cygwin application (feels like Vim is +Unix archive then). Then you get a Cygwin application (feels like MNV is running on Unix), while with Make_cyg.mak you get a Windows application (like with the other makefiles). @@ -494,7 +494,7 @@ your Linux (or other unix) box. To do this, you need to follow a few steps: Make further changes to 'Make_cyg_ming.mak' and 'Make_ming.mak' as you wish. If your cross-compiler prefix differs from the predefined value, set 'CROSS_COMPILE' corresponding. - 4) make -f Make_ming.mak gvim.exe + 4) make -f Make_ming.mak gmnv.exe Now you have created the Windows binary from your Linux box! Have fun... @@ -551,10 +551,10 @@ the root of the Python installation (C:\Python20, for example). If you are cross-compiling on Linux with the mingw32 setup, you need to also convert all the 'Include' files to *unix* line-endings. This bash command will do it easily: - for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil + for fil in *.h ; do mnv -e -c 'set ff=unix|w|q' $fil Now just do: - make -f Make_ming.mak gvim.exe + make -f Make_ming.mak gmnv.exe You will end up with a Python-enabled, Win32 version. Enjoy! @@ -601,15 +601,15 @@ libstdc++-6.dll.) 1) Building with Racket support (newest) -MzScheme and PLT Scheme names have been rebranded as Racket. Vim with Racket +MzScheme and PLT Scheme names have been rebranded as Racket. MNV with Racket support can be built with either MSVC or MinGW (or Cygwin). Get it from https://download.racket-lang.org/ Copy lib/libracket{version}.dll to your Windows system directory. The system -directory depends on your Windows bitness and Vim bitness: - 32-bit Vim on 32-bit Windows: C:\Windows\System32 - 32-bit Vim on 64-bit Windows: C:\Windows\SysWOW64 - 64-bit Vim on 64-bit Windows: C:\Windows\System32 +directory depends on your Windows bitness and MNV bitness: + 32-bit MNV on 32-bit Windows: C:\Windows\System32 + 32-bit MNV on 64-bit Windows: C:\Windows\SysWOW64 + 64-bit MNV on 64-bit Windows: C:\Windows\System32 For building you need to set the following variables: @@ -654,7 +654,7 @@ Or when using MinGW (as one line): (written by Sergey Khorev ) -Vim with MzScheme (http://www.plt-scheme.org/software/mzscheme) support can +MNV with MzScheme (http://www.plt-scheme.org/software/mzscheme) support can be built with either MSVC, or MinGW, or Cygwin. Supported versions are 205 and above (including 299 and 30x series). @@ -670,7 +670,7 @@ Building dynamic MzScheme support on MinGW and Cygwin is similar. Take into account that should contain slashes rather than backslashes (e.g. d:/Develop/MzScheme) -"Static" MzScheme support (Vim executable will depend on MzScheme DLLs +"Static" MzScheme support (MNV executable will depend on MzScheme DLLs explicitly) on MinGW and Cygwin requires additional step. libmzschXXXXXXX.dll and libmzgcXXXXXXX.dll should be copied from @@ -689,9 +689,9 @@ After a successful build, these dlls can be freely removed, leaving them in 9. Building with Lua support ============================ -Vim with Lua support can be built with either MSVC or MinGW (or maybe Cygwin). +MNV with Lua support can be built with either MSVC or MinGW (or maybe Cygwin). You can use binaries from LuaBinaries: http://luabinaries.sourceforge.net/ -This also applies to when you get a Vim executable and don't build yourself, +This also applies to when you get a MNV executable and don't build yourself, do the part up to "Build". 1) Download and install LuaBinaries @@ -707,13 +707,13 @@ Unpack it to a working directory. E.g. C:\projects\lua53. Lua's header files will be installed under the include directory. Copy luaXY.dll to your Windows system directory. The system directory depends -on your Windows bitness and Vim bitness: - 32-bit Vim on 32-bit Windows: C:\Windows\System32 - 32-bit Vim on 64-bit Windows: C:\Windows\SysWOW64 - 64-bit Vim on 64-bit Windows: C:\Windows\System32 +on your Windows bitness and MNV bitness: + 32-bit MNV on 32-bit Windows: C:\Windows\System32 + 32-bit MNV on 64-bit Windows: C:\Windows\SysWOW64 + 64-bit MNV on 64-bit Windows: C:\Windows\System32 -Or another option is copying luaXY.dll to the directory where gvim.exe -(or vim.exe) is. +Or another option is copying luaXY.dll to the directory where gmnv.exe +(or mnv.exe) is. 2) Build @@ -744,7 +744,7 @@ Or when using Cygwin (as one line) (untested): 10. Building with Perl support ============================== -Vim with Perl support can be built with either MSVC or MinGW (or Cygwin). +MNV with Perl support can be built with either MSVC or MinGW (or Cygwin). You can use binaries from ActiveState (ActivePerl) or Strawberry Perl. http://www.activestate.com/activeperl @@ -770,7 +770,7 @@ Or when using MinGW (as one line): 11. Building with Ruby support ============================== -Vim with Ruby support can be built with either MSVC or MinGW (or Cygwin). +MNV with Ruby support can be built with either MSVC or MinGW (or Cygwin). Ruby doesn't provide the official Windows binaries. The most widely used Windows binaries might be RubyInstaller. Currently Ruby 2.4 is recommended. @@ -804,7 +804,7 @@ A) Using MSVC If you want to link with ruby, normally you must use the same compiler as which was used to build the ruby binary. RubyInstaller is built with MinGW, -so normally you cannot use MSVC for building Vim if you want to link with +so normally you cannot use MSVC for building MNV if you want to link with RubyInstaller. If you use a different compiler, there are mainly two problems: config.h and Ruby's DLL name. Here are the steps for working around them: @@ -843,7 +843,7 @@ config.h and Ruby's DLL name. Here are the steps for working around them: Note that 2.4.0 is Ruby API version of Ruby 2.4.X. You may need to close the console and reopen it to pick up the new $PATH. - 4) Build Vim. Note that you need to adjust some variables (as one line): + 4) Build MNV. Note that you need to adjust some variables (as one line): For 32-bit version: @@ -877,7 +877,7 @@ Ruby 2.1 or later. (Default is 0x601.) 12. Building with Tcl support ============================= -Vim with Tcl support can be built with either MSVC or MinGW (or Cygwin). +MNV with Tcl support can be built with either MSVC or MinGW (or Cygwin). You can use binaries from ActiveState (ActiveTcl). http://www.activestate.com/activetcl @@ -916,7 +916,7 @@ Or when using MinGW (as one line): 13. Building with DirectX (DirectWrite) support =============================================== -Vim with DirectX (DirectWrite) support can be built with either MSVC or MinGW. +MNV with DirectX (DirectWrite) support can be built with either MSVC or MinGW. This requires dwrite_2.h and some other header files which come with Windows SDK 8.1 or later (or MinGW-w64), if you want to enable color emoji support. This also requires MBYTE=yes which is enabled by default. @@ -950,7 +950,7 @@ Just set DIRECTX to yes: 14. Building with libsodium support =================================== -For better encryption support, you can build Vim with libsodium. +For better encryption support, you can build MNV with libsodium. A) Using MSVC @@ -967,9 +967,9 @@ B) Using MinGW If you use msys2, you can install the libsodium package by pacman (or pacboy): - $ pacman -S mingw-w64-x86_64-libsodium # for 64-bit Vim - $ pacman -S mingw-w64-i686-libsodium # for 32-bit Vim - $ pacboy -S libsodium:m # for both 32-bit and 64-bit Vim + $ pacman -S mingw-w64-x86_64-libsodium # for 64-bit MNV + $ pacman -S mingw-w64-i686-libsodium # for 32-bit MNV + $ pacboy -S libsodium:m # for both 32-bit and 64-bit MNV Then set SODIUM to yes: @@ -991,7 +991,7 @@ The Windows 3.1x support was removed in patch 7.4.1364. 16. MS-DOS ========== -The MS-DOS support was removed in patch 7.4.1399. Only very old Vim versions +The MS-DOS support was removed in patch 7.4.1399. Only very old MNV versions work on MS-DOS because of the limited amount of memory available. @@ -1000,48 +1000,48 @@ work on MS-DOS because of the limited amount of memory available. [provided by Michael Soyka, updated by Ken Takata] -After you've built the Vim binaries as described above, you're ready to -install Vim on your system. However, if you've obtained the Vim sources +After you've built the MNV binaries as described above, you're ready to +install MNV on your system. However, if you've obtained the MNV sources using Git, Mercurial or by downloading them as a unix tar file, you must -first create a "vim91" directory. If you instead downloaded the sources as +first create a "mnv91" directory. If you instead downloaded the sources as zip files, you can skip this setup as the zip archives already have the correct directory structure. - A. Create a Vim "runtime" subdirectory named "vim91" + A. Create a MNV "runtime" subdirectory named "mnv91" ----------------------------------------------------- - If you obtained your Vim sources as zip files, you can skip this step. + If you obtained your MNV sources as zip files, you can skip this step. Otherwise, continue reading. - Go to the directory that contains the Vim "src" and "runtime" - directories and create a new subdirectory named "vim91". + Go to the directory that contains the MNV "src" and "runtime" + directories and create a new subdirectory named "mnv91". - Copy the "runtime" files into "vim91": - copy runtime\* vim91 - xcopy /s runtime\* vim91 + Copy the "runtime" files into "mnv91": + copy runtime\* mnv91 + xcopy /s runtime\* mnv91 - B. Copy the new binaries into the "vim91" directory + B. Copy the new binaries into the "mnv91" directory ---------------------------------------------------- - Regardless of how you installed the Vim sources, you need to copy the - new binaries you created above into "vim91": + Regardless of how you installed the MNV sources, you need to copy the + new binaries you created above into "mnv91": - copy src\*.exe vim91 - copy src\tee\tee.exe vim91 - copy src\xxd\xxd.exe vim91 + copy src\*.exe mnv91 + copy src\tee\tee.exe mnv91 + copy src\xxd\xxd.exe mnv91 - To install the "Edit with Vim" popup menu, you need both 32-bit and 64-bit - versions of gvimext.dll. They should be copied to "vim91\GvimExt32" and - "vim91\GvimExt64" respectively. + To install the "Edit with MNV" popup menu, you need both 32-bit and 64-bit + versions of gmnvext.dll. They should be copied to "mnv91\GmnvExt32" and + "mnv91\GmnvExt64" respectively. First, build the 32-bit version, then: - mkdir vim91\GvimExt32 - copy src\GvimExt\gvimext.dll vim91\GvimExt32 + mkdir mnv91\GmnvExt32 + copy src\GmnvExt\gmnvext.dll mnv91\GmnvExt32 Next, clean the 32-bit version and build the 64-bit version, then: - mkdir vim91\GvimExt64 - copy src\GvimExt\gvimext.dll vim91\GvimExt64 + mkdir mnv91\GmnvExt64 + copy src\GmnvExt\gmnvext.dll mnv91\GmnvExt64 - C. Copy gettext and iconv DLLs into the "vim91" directory + C. Copy gettext and iconv DLLs into the "mnv91" directory ---------------------------------------------------------- Get gettext and iconv DLLs from the following site: https://github.com/mlocati/gettext-iconv-windows/releases @@ -1049,41 +1049,41 @@ correct directory structure. Download the files gettextX.X.X.X-iconvX.XX-shared-{32,64}.zip, extract DLLs and place them as follows: - vim91\ + mnv91\ | libintl-8.dll | libiconv-2.dll | libgcc_s_sjlj-1.dll (only for 32-bit) | - + GvimExt32\ + + GmnvExt32\ | libintl-8.dll | libiconv-2.dll | libgcc_s_sjlj-1.dll | - ` GvimExt64\ + ` GmnvExt64\ libintl-8.dll libiconv-2.dll - The DLLs in the "vim91" should be the same bitness with the (g)vim.exe. + The DLLs in the "mnv91" should be the same bitness with the (g)mnv.exe. - D. Move the "vim91" directory into the Vim installation subdirectory + D. Move the "mnv91" directory into the MNV installation subdirectory --------------------------------------------------------------------- - Move the "vim91" subdirectory into the subdirectory where you want Vim - to be installed. Typically, this subdirectory will be named "vim". - If you already have a "vim91" subdirectory in "vim", delete it first + Move the "mnv91" subdirectory into the subdirectory where you want MNV + to be installed. Typically, this subdirectory will be named "mnv". + If you already have a "mnv91" subdirectory in "mnv", delete it first by running its uninstall.exe program. - E. Install Vim + E. Install MNV --------------- - "cd" to your Vim installation subdirectory "vim\vim91" and run the + "cd" to your MNV installation subdirectory "mnv\mnv91" and run the "install.exe" program. It will ask you a number of questions about - how you would like to have your Vim setup. Among these are: - - You can tell it to write a "_vimrc" file with your preferences in the + how you would like to have your MNV setup. Among these are: + - You can tell it to write a "_mnvrc" file with your preferences in the parent directory. - - It can also install an "Edit with Vim" entry in the Windows Explorer + - It can also install an "Edit with MNV" entry in the Windows Explorer popup menu. - - You can have it create batch files, so that you can run Vim from the + - You can have it create batch files, so that you can run MNV from the console or in a shell. You can select one of the directories in your PATH or add the directory to PATH using the Windows Control Panel. - - Create entries for Vim on the desktop and in the Start menu. + - Create entries for MNV on the desktop and in the Start menu. -Happy Vimming! +Happy MNVming! diff --git a/uvim/src/INSTALLvms.txt b/uvim/src/INSTALLvms.txt index 9d9626d05d..0c0f57b22b 100644 --- a/uvim/src/INSTALLvms.txt +++ b/uvim/src/INSTALLvms.txt @@ -1,12 +1,12 @@ -INSTALLvms.txt - Installation of Vim on OpenVMS +INSTALLvms.txt - Installation of MNV on OpenVMS Maintainer: Zoltan Arpadffy Last change: 2025 Aug 10 -This file contains instructions for compiling Vim on Openvms. -If you already have an executable version of Vim, you don't need this. +This file contains instructions for compiling MNV on Openvms. +If you already have an executable version of MNV, you don't need this. -If you skip settings described here, then you will get the default Vim +If you skip settings described here, then you will get the default MNV behavior as it is documented, which should be fine for most users. The file "feature.h" can be edited to match your preferences, but this file @@ -15,7 +15,7 @@ parameters from MAKE_VMS.MMS actively use and set up parameters in relation with feature.h More information and case analysis you can find in os_vms.txt -([runtime.doc]os_vms.txt or :help vms from vim prompt) +([runtime.doc]os_vms.txt or :help vms from mnv prompt) Contents: 1. Download files @@ -31,10 +31,10 @@ Contents: ---------------------------------------------------------------------------- 1. Download files -1.1. Visit the Vim Repository Home +1.1. Visit the MNV Repository Home -You may want to clone the latest source code from https://www.github.com/vim/vim -Or the last tested on OpenVMS from http://polarhome.com/vim/files/source/vms/ +You may want to clone the latest source code from https://www.github.com/mnv/mnv +Or the last tested on OpenVMS from http://polarhome.com/mnv/files/source/vms/ 1.2. Expand the three archives. @@ -45,7 +45,7 @@ Or the last tested on OpenVMS from http://polarhome.com/vim/files/source/vms/ of it called mmk (VMS has no make utility in the standard distribution). You can download mmk from (defunct link) openvms.digital.com/freeware/MMK/ -1.5. If you want to have Perl, Python or Tcl support in Vim you will need VMS +1.5. If you want to have Perl, Python or Tcl support in MNV you will need VMS distributions for them as well. 1.6 If you want to have GTK executable, you need to have properly installed @@ -53,8 +53,8 @@ Or the last tested on OpenVMS from http://polarhome.com/vim/files/source/vms/ NOTE: procedure in chapter 1 describes source code preparation from multi OS code, however it is available OpenVMS optimized (and tested) source code from: -ftp://ftp.polarhome.com/pub/vim/source/vms/ -(http://www.polarhome.com/vim/files/source/vms/) +ftp://ftp.polarhome.com/pub/mnv/source/vms/ +(http://www.polarhome.com/mnv/files/source/vms/) Current OpenVMS source code as .zip or .tar.gz file is possible to download from CVS mirror ftp://ftp.polarhome.com/pub/cvs/SOURCE/ @@ -62,14 +62,14 @@ from CVS mirror ftp://ftp.polarhome.com/pub/cvs/SOURCE/ 2. Configuration -2.1. Edit vim-X.X/src/feature.h for your preference. (You can skip +2.1. Edit mnv-X.X/src/feature.h for your preference. (You can skip this, then you will get the default behavior as is documented, which should be fine for most people.) For example, if you want to add the MULTI_BYTE feature, turn on #define MULTI_BYTE -2.2 Edit vim-X.X/src/Make_vms.mms to customize your Vim. Options are: +2.2 Edit mnv-X.X/src/Make_vms.mms to customize your MNV. Options are: Parameter name : MODEL Description : Build model selection @@ -113,45 +113,45 @@ from CVS mirror ftp://ftp.polarhome.com/pub/cvs/SOURCE/ Default : CCVER = YES Parameter name : DEBUG - Description : Building a debug version (DVIM.EXE) + Description : Building a debug version (DMNV.EXE) Options: : YES - debug version will be built Uncommented - building normal executable Default : Uncommented - Parameter name : VIM_TCL + Parameter name : MNV_TCL Description : Add Tcl support Options: : YES - Build with support Uncommented - build without support. Default : Uncommented - Parameter name : VIM_PERL + Parameter name : MNV_PERL Description : Add Perl support Options: : YES - Build with support Uncommented - build without support. Default : Uncommented - Parameter name : VIM_PYTHON + Parameter name : MNV_PYTHON Description : Add Python support Options: : YES - Build with support Uncommented - build without support. Default : Uncommented - Parameter name : VIM_XIM + Parameter name : MNV_XIM Description : X Input Method. For entering special languages like Chinese and Japanese. Please define just - one: VIM_XIM or VIM_HANGULIN + one: MNV_XIM or MNV_HANGULIN Options: : YES - Build with support Uncommented - build without support. Default : Uncommented - Parameter name : VIM_HANGULIN + Parameter name : MNV_HANGULIN Description : Internal Hangul input method. GUI only. - Please define just one: VIM_XIM or VIM_HANGULIN + Please define just one: MNV_XIM or MNV_HANGULIN Options: : YES - Build with support Uncommented - build without support. Default : Uncommented - Parameter name : VIM_TAG_ANYWHITE + Parameter name : MNV_TAG_ANYWHITE Description : Allow any white space to separate the fields in a tags file When not defined, only a TAB is allowed. @@ -159,25 +159,25 @@ from CVS mirror ftp://ftp.polarhome.com/pub/cvs/SOURCE/ Uncommented - build without support. Default : Uncommented - Parameter name : VIM_RUBY + Parameter name : MNV_RUBY Description : Add Ruby support Options: : YES - Build with support Uncommented - build without support. Default : Uncommented - Parameter name : VIM_LUA + Parameter name : MNV_LUA Description : Add Lua support Options: : YES - Build with support Uncommented - build without support. Default : Uncommented - Parameter name : VIM_MZSCHEME + Parameter name : MNV_MZSCHEME Description : Add support for FEATURE_MZSCHEM Options: : YES - Build with support Uncommented - build without FEATURE_MZSCHEM. Default : Uncommented - Parameter name : VIM_ICONV + Parameter name : MNV_ICONV Description : Build with using the ICONV library Options: : YES - Build with support Uncommented - build without support. @@ -198,7 +198,7 @@ from CVS mirror ftp://ftp.polarhome.com/pub/cvs/SOURCE/ mms /descrip=Make_vms.mms - will start building your own customized version of Vim. + will start building your own customized version of MNV. The adequate command for mmk is: mmk /descrip=Make_vms.mms @@ -234,7 +234,7 @@ from CVS mirror ftp://ftp.polarhome.com/pub/cvs/SOURCE/ 5. CTAGS, XXD -5.1. MMS_VIM.EXE is building together with VIM.EXE, but for CTAGS.EXE and +5.1. MMS_MNV.EXE is building together with MNV.EXE, but for CTAGS.EXE and XXD.EXE you should change to subdirectory <.CTAGS> or <.XXD> and build them separately. @@ -245,23 +245,23 @@ from CVS mirror ftp://ftp.polarhome.com/pub/cvs/SOURCE/ 6.1. Copy over all executables to the deployment directory. -6.2. Vim uses a special directory structure to hold the document and runtime +6.2. MNV uses a special directory structure to hold the document and runtime files: - vim (or wherever) + mnv (or wherever) |-- doc |-- syntax - vimrc (system rc files) - gvimrc + mnvrc (system rc files) + gmnvrc -6.3 Define logicals VIM +6.3 Define logicals MNV - define/nolog VIM device:[leading-path-here.vim] + define/nolog MNV device:[leading-path-here.mnv] - to get vim.exe to find its document, filetype, and syntax files. + to get mnv.exe to find its document, filetype, and syntax files. Now, if you are lucky you should have one own built, customized and - working Vim. + working MNV. 7. GTK and other features @@ -305,7 +305,7 @@ from CVS mirror ftp://ftp.polarhome.com/pub/cvs/SOURCE/ Example: PERL_LIB = ,OS_VMS_PERL.OPT/OPT -.IFDEF VIM_PERL +.IFDEF MNV_PERL perl_env : -@ write sys$output "creating OS_VMS_PERL.OPT file." -@ open/write opt_file OS_VMS_PERL.OPT @@ -324,7 +324,7 @@ perl_env : 7.2 GTK - To build VIM with GTK you have to install GTK on your OpenVMS. + To build MNV with GTK you have to install GTK on your OpenVMS. So far it works just on Alpha and IA64. More information at: defunct link: openvms.compaq.com/openvms/products/ips/gtk.html @@ -333,7 +333,7 @@ perl_env : Source code for GTK and porting library that is used to build VMS executables at polarhome.com are at - http://www.polarhome.com/vim/files/source/vms/ + http://www.polarhome.com/mnv/files/source/vms/ Enable GTK in make_vms.mms file with GTK = YES Define GTK_ROOT that points to your GTK root directory. @@ -370,7 +370,7 @@ perl_env : You need defined PERLSHR logical that points to PERL shareable image (or you can just copy over to SYS$LIBRARY:) - Enable Perl feature at make_vms.mms with VIM_PERL = YES + Enable Perl feature at make_vms.mms with MNV_PERL = YES Edit PERL_INC = to point to perl includes directory where is extern.h @@ -384,7 +384,7 @@ perl_env : You have to have defined PYTHON_INCLUDE and PYTHON_OLB logicals. PYTHON_INCLUDE should point to Python include files where for ex: python.h is located. - Enable Python feature at make_vms.mms with VIM_PYTHON = YES + Enable Python feature at make_vms.mms with MNV_PYTHON = YES Build as usual. @@ -395,7 +395,7 @@ perl_env : You have to have defined TCLSHR logical that points to shareable image. - Enable TCL feature at make_vms.mms with VIM_TCL = YES + Enable TCL feature at make_vms.mms with MNV_TCL = YES Edit TCL_INC = to point to TCL includes directory where is tcl.h @@ -412,8 +412,8 @@ perl_env : "unsigned" and the compiler issue a message whenever the comparison is done with '<=' to 0. However, the code is correct and will behave as expected. - ( Jerome Lauret Vim 6.0n ) - NOTE: from version 6.0ad Vim code has been reviewed and these warnings + ( Jerome Lauret MNV 6.0n ) + NOTE: from version 6.0ad MNV code has been reviewed and these warnings have been corrected. 9. Authors diff --git a/uvim/src/INSTALLx.txt b/uvim/src/INSTALLx.txt index e92fec4144..4117033897 100644 --- a/uvim/src/INSTALLx.txt +++ b/uvim/src/INSTALLx.txt @@ -1,4 +1,4 @@ -INSTALLx.txt - cross-compiling Vim on Unix +INSTALLx.txt - cross-compiling MNV on Unix Content: 1. Introduction @@ -10,7 +10,7 @@ Content: 1. INTRODUCTION =============== -This document discusses cross-compiling VIM on Unix-like systems. We assume +This document discusses cross-compiling MNV on Unix-like systems. We assume you are already familiar with cross-compiling and have a working cross-compile environment with at least the following components: @@ -41,7 +41,7 @@ You need to set the following "configure" command line switches: For example, "i586-linux". --host=... : - The system on which VIM will be run. Quite often this the name of your + The system on which MNV will be run. Quite often this the name of your cross-compiler without the "-gcc". For example, "powerpc-603-linux-gnu". @@ -92,42 +92,42 @@ vi_cv_var_python_version: This is the output of the following Python script: import sys; print sys.version[:3] -vim_cv_bcopy_handles_overlap: +mnv_cv_bcopy_handles_overlap: Whether the "bcopy" C library call is able to copy overlapping memory regions. Set to "yes" if it does or "no" if it does not. - You only need to set this if vim_cv_memmove_handles_overlap is set + You only need to set this if mnv_cv_memmove_handles_overlap is set to "no". -vim_cv_getcwd_broken: +mnv_cv_getcwd_broken: Whether the "getcwd" C library call is broken. Set to "yes" if you know that "getcwd" is implemented as 'system("sh -c pwd")', set to "no" otherwise. -vim_cv_memcpy_handles_overlap: +mnv_cv_memcpy_handles_overlap: Whether the "memcpy" C library call is able to copy overlapping memory regions. Set to "yes" if it does or "no" if it does not. - You only need to set this if both vim_cv_memmove_handles_overlap - and vim_cv_bcopy_handles_overlap are set to "no". + You only need to set this if both mnv_cv_memmove_handles_overlap + and mnv_cv_bcopy_handles_overlap are set to "no". -vim_cv_memmove_handles_overlap: +mnv_cv_memmove_handles_overlap: Whether the "memmove" C library call is able to copy overlapping memory regions. Set to "yes" if it does or "no" if it does not. -vim_cv_stat_ignores_slash: +mnv_cv_stat_ignores_slash: Whether the "stat" C library call ignores trailing slashes in the path name. Set to "yes" if it ignores them or "no" if it does not ignore them. -vim_cv_tgetent: +mnv_cv_tgetent: Whether the "tgetent" terminal library call returns a zero or non-zero value when it encounters an unknown terminal. Set to either the string "zero" or "non-zero", corresponding. -vim_cv_terminfo: +mnv_cv_terminfo: Whether the environment has terminfo support. Set to "yes" if so, otherwise set to "no". -vim_cv_toupper_broken: +mnv_cv_toupper_broken: Whether the "toupper" C library function works correctly. Set to "yes" if you know it's broken, otherwise set to "no". @@ -139,12 +139,12 @@ Assuming the target system string is "armeb-xscale-linux-gnu" (a Intel XScale system) with glibc and ncurses, the call to configure would look like this: ac_cv_sizeof_int=4 \ -vim_cv_getcwd_broken=no \ -vim_cv_memmove_handles_overlap=yes \ -vim_cv_stat_ignores_slash=yes \ -vim_cv_tgetent=zero \ -vim_cv_terminfo=yes \ -vim_cv_toupper_broken=no \ +mnv_cv_getcwd_broken=no \ +mnv_cv_memmove_handles_overlap=yes \ +mnv_cv_stat_ignores_slash=yes \ +mnv_cv_tgetent=zero \ +mnv_cv_terminfo=yes \ +mnv_cv_toupper_broken=no \ ./configure \ --build=i586-linux \ --host=armeb-xscale-linux-gnu \ @@ -153,4 +153,4 @@ vim_cv_toupper_broken=no \ -Written 2007 by Marc Haisenko for the VIM project. +Written 2007 by Marc Haisenko for the MNV project. diff --git a/uvim/src/Make_ami.mak b/uvim/src/Make_ami.mak index e9d73df39f..c674434b2c 100644 --- a/uvim/src/Make_ami.mak +++ b/uvim/src/Make_ami.mak @@ -1,7 +1,7 @@ # # Makefile for AROS, AmigaOS4 and MorphOS. # -BIN = vim +BIN = mnv CC ?= gcc LD = $(CC) UNM ?= $(shell uname) @@ -20,7 +20,7 @@ CFLAGS += \ -Wno-attributes \ -Wextra -# Vim 'huge' build +# MNV 'huge' build ifeq ($(BUILD),huge) CFLAGS += \ -DFEAT_BROWSE \ @@ -28,7 +28,7 @@ CFLAGS += \ -DFEAT_HUGE else -# Vim 'normal' build +# MNV 'normal' build ifeq ($(BUILD),normal) CFLAGS +=\ -DFEAT_BROWSE \ @@ -36,12 +36,12 @@ CFLAGS +=\ -DFEAT_NORMAL else -# Vim 'small' build - now an alias for 'tiny' +# MNV 'small' build - now an alias for 'tiny' ifeq ($(BUILD),small) CFLAGS += -DFEAT_TINY else -# Vim 'tiny' build +# MNV 'tiny' build ifeq ($(BUILD),tiny) CFLAGS += -DFEAT_TINY endif @@ -182,16 +182,16 @@ SRC += \ usercmd.c \ userfunc.c \ version.c \ - viminfo.c \ - vim9class.c \ - vim9cmds.c \ - vim9compile.c \ - vim9execute.c \ - vim9expr.c \ - vim9generics.c \ - vim9instr.c \ - vim9script.c \ - vim9type.c \ + mnvinfo.c \ + mnv9class.c \ + mnv9cmds.c \ + mnv9compile.c \ + mnv9execute.c \ + mnv9expr.c \ + mnv9generics.c \ + mnv9instr.c \ + mnv9script.c \ + mnv9type.c \ window.c \ xdiff/xdiffi.c \ xdiff/xemit.c \ diff --git a/uvim/src/Make_cyg.mak b/uvim/src/Make_cyg.mak index 8bb2b721bf..3afb64be06 100644 --- a/uvim/src/Make_cyg.mak +++ b/uvim/src/Make_cyg.mak @@ -1,9 +1,9 @@ # -# Makefile for VIM on Win32, using MinGW cross compiler on Cygwin +# Makefile for MNV on Win32, using MinGW cross compiler on Cygwin # # Also read INSTALLpc.txt! # -# This compiles Vim as a Windows application. If you want Vim to run as a +# This compiles MNV as a Windows application. If you want MNV to run as a # Cygwin application use the Makefile (just like on Unix). # # The old Make_cyg.mak (maintained by Dan Sharp et al.) was merged into @@ -50,4 +50,4 @@ CROSS_COMPILE = i686-w64-mingw32- UNDER_CYGWIN = yes include Make_cyg_ming.mak -# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: +# mnv: set noet sw=8 ts=8 sts=0 wm=0 tw=0: diff --git a/uvim/src/Make_cyg_ming.mak b/uvim/src/Make_cyg_ming.mak index 0cb83ac484..5cdef12066 100644 --- a/uvim/src/Make_cyg_ming.mak +++ b/uvim/src/Make_cyg_ming.mak @@ -1,4 +1,4 @@ -# Makefile for VIM on Win32 (Cygwin and MinGW) +# Makefile for MNV on Win32 (Cygwin and MinGW) # # This file contains common part for Cygwin and MinGW and it is included # from Make_cyg.mak and Make_ming.mak. @@ -11,10 +11,10 @@ # Tested on Win32 NT 4 and Win95. # # To make everything, just 'make -f Make_ming.mak'. -# To make just e.g. gvim.exe, 'make -f Make_ming.mak gvim.exe'. +# To make just e.g. gmnv.exe, 'make -f Make_ming.mak gmnv.exe'. # After a run, you can 'make -f Make_ming.mak clean' to clean up. # -# NOTE: Sometimes 'GNU Make' will stop after building vimrun.exe -- I think +# NOTE: Sometimes 'GNU Make' will stop after building mnvrun.exe -- I think # it's just run out of memory or something. Run again, and it will continue # with 'xxd'. # @@ -55,13 +55,13 @@ COVERAGE=no # Set to SIZE for size, SPEED for speed, MAXSPEED for maximum optimization. OPTIMIZE=MAXSPEED -# Set to yes to make gvim, no for vim. +# Set to yes to make gmnv, no for mnv. GUI=yes # Set to yes to enable the DLL support (EXPERIMENTAL). -# Creates vim{32,64}.dll, and stub gvim.exe and vim.exe. +# Creates mnv{32,64}.dll, and stub gmnv.exe and mnv.exe. # "GUI" should be also set to "yes". -#VIMDLL=yes +#MNVDLL=yes # Set to no if you do not want to use DirectWrite (DirectX). # MinGW-w64 is needed, and ARCH should be set to i686 or x86-64. @@ -774,9 +774,9 @@ CFLAGS += --coverage LFLAGS += --coverage endif -# If the ASAN=yes argument is supplied, then compile Vim with the address +# If the ASAN=yes argument is supplied, then compile MNV with the address # sanitizer (asan). Only supported by MingW64 clang compiler. -# May make Vim twice as slow. Errors are reported on stderr. +# May make MNV twice as slow. Errors are reported on stderr. # More at: https://code.google.com/p/address-sanitizer/ # Useful environment variable: # set ASAN_OPTIONS=print_stacktrace=1 log_path=asan @@ -897,25 +897,25 @@ OBJ = \ $(OUTDIR)/usercmd.o \ $(OUTDIR)/userfunc.o \ $(OUTDIR)/version.o \ - $(OUTDIR)/vim9class.o \ - $(OUTDIR)/vim9cmds.o \ - $(OUTDIR)/vim9compile.o \ - $(OUTDIR)/vim9execute.o \ - $(OUTDIR)/vim9expr.o \ - $(OUTDIR)/vim9generics.o \ - $(OUTDIR)/vim9instr.o \ - $(OUTDIR)/vim9script.o \ - $(OUTDIR)/vim9type.o \ - $(OUTDIR)/viminfo.o \ + $(OUTDIR)/mnv9class.o \ + $(OUTDIR)/mnv9cmds.o \ + $(OUTDIR)/mnv9compile.o \ + $(OUTDIR)/mnv9execute.o \ + $(OUTDIR)/mnv9expr.o \ + $(OUTDIR)/mnv9generics.o \ + $(OUTDIR)/mnv9instr.o \ + $(OUTDIR)/mnv9script.o \ + $(OUTDIR)/mnv9type.o \ + $(OUTDIR)/mnvinfo.o \ $(OUTDIR)/winclip.o \ $(OUTDIR)/window.o -ifeq ($(VIMDLL),yes) -OBJ += $(OUTDIR)/os_w32dll.o $(OUTDIR)/vimresd.o -EXEOBJC = $(OUTDIR)/os_w32exec.o $(OUTDIR)/vimresc.o -EXEOBJG = $(OUTDIR)/os_w32exeg.o $(OUTDIR)/vimresg.o +ifeq ($(MNVDLL),yes) +OBJ += $(OUTDIR)/os_w32dll.o $(OUTDIR)/mnvresd.o +EXEOBJC = $(OUTDIR)/os_w32exec.o $(OUTDIR)/mnvresc.o +EXEOBJG = $(OUTDIR)/os_w32exeg.o $(OUTDIR)/mnvresg.o else -OBJ += $(OUTDIR)/os_w32exe.o $(OUTDIR)/vimres.o +OBJ += $(OUTDIR)/os_w32exe.o $(OUTDIR)/mnvres.o endif ifdef PERL @@ -1023,15 +1023,15 @@ endif LFLAGS += -municode -ifeq ($(VIMDLL),yes) -VIMEXE := vim$(DEBUG_SUFFIX).exe -GVIMEXE := gvim$(DEBUG_SUFFIX).exe +ifeq ($(MNVDLL),yes) +MNVEXE := mnv$(DEBUG_SUFFIX).exe +GMNVEXE := gmnv$(DEBUG_SUFFIX).exe ifeq ($(ARCH),x86-64) -VIMDLLBASE := vim64$(DEBUG_SUFFIX) +MNVDLLBASE := mnv64$(DEBUG_SUFFIX) else -VIMDLLBASE := vim32$(DEBUG_SUFFIX) +MNVDLLBASE := mnv32$(DEBUG_SUFFIX) endif -TARGET = $(VIMDLLBASE).dll +TARGET = $(MNVDLLBASE).dll LFLAGS += -shared EXELFLAGS += -municode ifneq ($(DEBUG),yes) @@ -1043,12 +1043,12 @@ EXELFLAGS += --coverage EXELFLAGS += -nostdlib EXECFLAGS = -DUSE_OWNSTARTUP endif -DEFINES += $(DEF_GUI) -DVIMDLL +DEFINES += $(DEF_GUI) -DMNVDLL OBJ += $(GUIOBJ) $(CUIOBJ) OUTDIR = dobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH) -MAIN_TARGET = $(GVIMEXE) $(VIMEXE) $(VIMDLLBASE).dll +MAIN_TARGET = $(GMNVEXE) $(MNVEXE) $(MNVDLLBASE).dll else ifeq ($(GUI),yes) -TARGET := gvim$(DEBUG_SUFFIX).exe +TARGET := gmnv$(DEBUG_SUFFIX).exe DEFINES += $(DEF_GUI) OBJ += $(GUIOBJ) LFLAGS += -mwindows @@ -1056,7 +1056,7 @@ OUTDIR = gobj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH) MAIN_TARGET = $(TARGET) else OBJ += $(CUIOBJ) -TARGET := vim$(DEBUG_SUFFIX).exe +TARGET := mnv$(DEBUG_SUFFIX).exe OUTDIR = obj$(DEBUG_SUFFIX)$(MZSCHEME_SUFFIX)$(ARCH) MAIN_TARGET = $(TARGET) endif @@ -1139,7 +1139,7 @@ ifeq (yes, $(USE_GC_SECTIONS)) CFLAGS += -ffunction-sections -fno-asynchronous-unwind-tables CXXFLAGS += -fasynchronous-unwind-tables LFLAGS += -Wl,--gc-sections - ifeq (yes, $(VIMDLL)) + ifeq (yes, $(MNVDLL)) EXELFLAGS += -Wl,--gc-sections endif endif @@ -1155,10 +1155,10 @@ endif # To increase the stack size to 16MB, uncomment the following line: #LFLAGS += -Wl,-stack -Wl,0x1000000 -all: $(MAIN_TARGET) vimrun.exe xxd/xxd.exe tee/tee.exe install.exe uninstall.exe GvimExt/gvimext.dll +all: $(MAIN_TARGET) mnvrun.exe xxd/xxd.exe tee/tee.exe install.exe uninstall.exe GmnvExt/gmnvext.dll -vimrun.exe: vimrun.c - $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB) +mnvrun.exe: mnvrun.c + $(CC) $(CFLAGS) -o mnvrun.exe mnvrun.c $(LIB) install.exe: dosinst.c dosinst.h version.h $(CC) $(CFLAGS) -o install.exe dosinst.c $(LIB) -lole32 -luuid @@ -1172,7 +1172,7 @@ $(EXEOBJG): | $(OUTDIR) $(EXEOBJC): | $(OUTDIR) -ifeq ($(VIMDLL),yes) +ifeq ($(MNVDLL),yes) ifneq ($(findstring -nostdlib,$(EXELFLAGS)),) # -Wl,--entry needs to be specified when -nostdlib is used. ifeq ($(ARCH),x86-64) @@ -1187,23 +1187,23 @@ EXEENTRYG = -Wl,--entry=_wWinMainCRTStartup@0 $(TARGET): $(OBJ) $(LINK) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid -lgdi32 $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB) $(SODIUMLIB) -$(GVIMEXE): $(EXEOBJG) $(VIMDLLBASE).dll - $(CC) -L. $(EXELFLAGS) -mwindows -o $@ $(EXEOBJG) -l$(VIMDLLBASE) $(EXEENTRYG) +$(GMNVEXE): $(EXEOBJG) $(MNVDLLBASE).dll + $(CC) -L. $(EXELFLAGS) -mwindows -o $@ $(EXEOBJG) -l$(MNVDLLBASE) $(EXEENTRYG) -$(VIMEXE): $(EXEOBJC) $(VIMDLLBASE).dll - $(CC) -L. $(EXELFLAGS) -o $@ $(EXEOBJC) -l$(VIMDLLBASE) $(EXEENTRYC) +$(MNVEXE): $(EXEOBJC) $(MNVDLLBASE).dll + $(CC) -L. $(EXELFLAGS) -o $@ $(EXEOBJC) -l$(MNVDLLBASE) $(EXEENTRYC) else $(TARGET): $(OBJ) $(LINK) $(CFLAGS) $(LFLAGS) -o $@ $(OBJ) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB) $(SODIUMLIB) endif upx: exes - upx gvim.exe - upx vim.exe + upx gmnv.exe + upx mnv.exe mpress: exes - mpress gvim.exe - mpress vim.exe + mpress gmnv.exe + mpress mnv.exe xxd/xxd.exe: xxd/xxd.c $(MAKE) -C xxd -f Make_ming.mak CC='$(CC)' @@ -1211,8 +1211,8 @@ xxd/xxd.exe: xxd/xxd.c tee/tee.exe: tee/tee.c $(MAKE) -C tee -f Make_ming.mak CC='$(CC)' -GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h - $(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX=$(CXX) STATIC_STDCPLUS=$(STATIC_STDCPLUS) +GmnvExt/gmnvext.dll: GmnvExt/gmnvext.cpp GmnvExt/gmnvext.rc GmnvExt/gmnvext.h + $(MAKE) -C GmnvExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX=$(CXX) STATIC_STDCPLUS=$(STATIC_STDCPLUS) tags: notags $(CTAGS) $(TAGS_FILES) @@ -1227,7 +1227,7 @@ clean: -$(DEL) $(OUTDIR)$(DIRSLASH)*.res -$(DEL) $(OUTDIR)$(DIRSLASH)pathdef.c -rmdir $(OUTDIR) - -$(DEL) $(MAIN_TARGET) vimrun.exe install.exe uninstall.exe + -$(DEL) $(MAIN_TARGET) mnvrun.exe install.exe uninstall.exe -$(DEL) *.gcno *.gcda -$(DEL) *.map ifdef PERL @@ -1237,29 +1237,29 @@ endif ifdef MZSCHEME -$(DEL) mzscheme_base.c endif - $(MAKE) -C GvimExt -f Make_ming.mak clean + $(MAKE) -C GmnvExt -f Make_ming.mak clean $(MAKE) -C xxd -f Make_ming.mak clean $(MAKE) -C tee -f Make_ming.mak clean -# Run Vim script to generate the Ex command lookup table. +# Run MNV script to generate the Ex command lookup table. # This only needs to be run when a command name has been added or changed. -# If this fails because you don't have Vim yet, first build and install Vim +# If this fails because you don't have MNV yet, first build and install MNV # without changes. cmdidxs: ex_cmds.h - vim --clean -N -X --not-a-term -u create_cmdidxs.vim -c quit + mnv --clean -N -X --not-a-term -u create_cmdidxs.mnv -c quit -# Run Vim script to generate the normal/visual mode command lookup table. +# Run MNV script to generate the normal/visual mode command lookup table. # This only needs to be run when a new normal/visual mode command has been -# added. If this fails because you don't have Vim yet: +# added. If this fails because you don't have MNV yet: # - change nv_cmds[] in nv_cmds.h to add the new normal/visual mode command. # - run "make nvcmdidxs" to generate nv_cmdidxs.h nvcmdidxs: nv_cmds.h $(CC) $(CFLAGS) -o create_nvcmdidxs.exe create_nvcmdidxs.c $(LIB) - vim --clean -N -X --not-a-term -u create_nvcmdidxs.vim -c quit + mnv --clean -N -X --not-a-term -u create_nvcmdidxs.mnv -c quit -$(DEL) create_nvcmdidxs.exe ########################################################################### -INCL = vim.h alloc.h ascii.h ex_cmds.h feature.h errors.h globals.h \ +INCL = mnv.h alloc.h ascii.h ex_cmds.h feature.h errors.h globals.h \ keymap.h macros.h option.h optiondefs.h os_dos.h os_win32.h \ proto.h regexp.h spell.h structs.h termdefs.h beval.h \ $(NBDEBUG_INCL) @@ -1280,26 +1280,26 @@ $(OUTDIR)/if_python3.o: if_python3.c if_py_both.h $(INCL) $(OUTDIR)/%.o : %.c $(INCL) $(CC) -c $(CFLAGS) $< -o $@ -ifeq ($(VIMDLL),yes) -$(OUTDIR)/vimresc.o: vim.rc vim.manifest version.h gui_w32_rc.h vim.ico +ifeq ($(MNVDLL),yes) +$(OUTDIR)/mnvresc.o: mnv.rc mnv.manifest version.h gui_w32_rc.h mnv.ico $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) -UFEAT_GUI_MSWIN \ - --input-format=rc --output-format=coff -i vim.rc -o $@ + --input-format=rc --output-format=coff -i mnv.rc -o $@ -$(OUTDIR)/vimresg.o: vim.rc vim.manifest version.h gui_w32_rc.h vim.ico +$(OUTDIR)/mnvresg.o: mnv.rc mnv.manifest version.h gui_w32_rc.h mnv.ico $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \ - --input-format=rc --output-format=coff -i vim.rc -o $@ + --input-format=rc --output-format=coff -i mnv.rc -o $@ -$(OUTDIR)/vimresd.o: vim.rc version.h gui_w32_rc.h \ - tools.bmp tearoff.bmp vim.ico vim_error.ico \ - vim_alert.ico vim_info.ico vim_quest.ico - $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) -DRCDLL -DVIMDLLBASE=\\\"$(VIMDLLBASE)\\\" \ - --input-format=rc --output-format=coff -i vim.rc -o $@ +$(OUTDIR)/mnvresd.o: mnv.rc version.h gui_w32_rc.h \ + tools.bmp tearoff.bmp mnv.ico mnv_error.ico \ + mnv_alert.ico mnv_info.ico mnv_quest.ico + $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) -DRCDLL -DMNVDLLBASE=\\\"$(MNVDLLBASE)\\\" \ + --input-format=rc --output-format=coff -i mnv.rc -o $@ else -$(OUTDIR)/vimres.o: vim.rc vim.manifest version.h gui_w32_rc.h \ - tools.bmp tearoff.bmp vim.ico vim_error.ico \ - vim_alert.ico vim_info.ico vim_quest.ico +$(OUTDIR)/mnvres.o: mnv.rc mnv.manifest version.h gui_w32_rc.h \ + tools.bmp tearoff.bmp mnv.ico mnv_error.ico \ + mnv_alert.ico mnv_info.ico mnv_quest.ico $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \ - --input-format=rc --output-format=coff -i vim.rc -o $@ + --input-format=rc --output-format=coff -i mnv.rc -o $@ endif $(OUTDIR): @@ -1327,25 +1327,25 @@ $(OUTDIR)/netbeans.o: netbeans.c $(INCL) version.h $(OUTDIR)/version.o: version.c $(INCL) version.h -$(OUTDIR)/vim9class.o: vim9class.c $(INCL) vim9.h +$(OUTDIR)/mnv9class.o: mnv9class.c $(INCL) mnv9.h -$(OUTDIR)/vim9cmds.o: vim9cmds.c $(INCL) vim9.h +$(OUTDIR)/mnv9cmds.o: mnv9cmds.c $(INCL) mnv9.h -$(OUTDIR)/vim9compile.o: vim9compile.c $(INCL) vim9.h +$(OUTDIR)/mnv9compile.o: mnv9compile.c $(INCL) mnv9.h -$(OUTDIR)/vim9execute.o: vim9execute.c $(INCL) vim9.h +$(OUTDIR)/mnv9execute.o: mnv9execute.c $(INCL) mnv9.h -$(OUTDIR)/vim9expr.o: vim9expr.c $(INCL) vim9.h +$(OUTDIR)/mnv9expr.o: mnv9expr.c $(INCL) mnv9.h -$(OUTDIR)/vim9generics.o: vim9generics.c $(INCL) vim9.h +$(OUTDIR)/mnv9generics.o: mnv9generics.c $(INCL) mnv9.h -$(OUTDIR)/vim9instr.o: vim9instr.c $(INCL) vim9.h +$(OUTDIR)/mnv9instr.o: mnv9instr.c $(INCL) mnv9.h -$(OUTDIR)/vim9script.o: vim9script.c $(INCL) vim9.h +$(OUTDIR)/mnv9script.o: mnv9script.c $(INCL) mnv9.h -$(OUTDIR)/vim9type.o: vim9type.c $(INCL) vim9.h +$(OUTDIR)/mnv9type.o: mnv9type.c $(INCL) mnv9.h -$(OUTDIR)/viminfo.o: viminfo.c $(INCL) version.h +$(OUTDIR)/mnvinfo.o: mnvinfo.c $(INCL) version.h $(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp gui_dwrite.h $(CC) -c $(CFLAGS) $(CXXFLAGS) gui_dwrite.cpp -o $@ @@ -1423,8 +1423,8 @@ $(OUTDIR)/pathdef.o: $(PATHDEF_SRC) $(INCL) CCCTERM = $(CC) -c $(CFLAGS) -Ilibvterm/include -DINLINE="" \ - -DVSNPRINTF=vim_vsnprintf \ - -DSNPRINTF=vim_snprintf \ + -DVSNPRINTF=mnv_vsnprintf \ + -DSNPRINTF=mnv_snprintf \ -DIS_COMBINING_FUNCTION=utf_iscomposing_uint \ -DWCWIDTH_FUNCTION=utf_uint2cells \ -DGET_SPECIAL_PTY_TYPE_FUNCTION=get_special_pty_type @@ -1441,9 +1441,9 @@ $(PATHDEF_SRC): Make_cyg_ming.mak Make_cyg.mak Make_ming.mak | $(OUTDIR) ifneq (sh.exe, $(SHELL)) @echo creating $(PATHDEF_SRC) @echo '/* pathdef.c */' > $(PATHDEF_SRC) - @echo '#include "vim.h"' >> $(PATHDEF_SRC) - @echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' >> $(PATHDEF_SRC) - @echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' >> $(PATHDEF_SRC) + @echo '#include "mnv.h"' >> $(PATHDEF_SRC) + @echo 'char_u *default_mnv_dir = (char_u *)"$(MNVRCLOC)";' >> $(PATHDEF_SRC) + @echo 'char_u *default_mnvruntime_dir = (char_u *)"$(MNVRUNTIMEDIR)";' >> $(PATHDEF_SRC) @echo 'char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)";' >> $(PATHDEF_SRC) @echo 'char_u *all_lflags = (char_u *)"$(LINK) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)";' >> $(PATHDEF_SRC) @echo 'char_u *compiled_user = (char_u *)"$(USERNAME)";' >> $(PATHDEF_SRC) @@ -1451,13 +1451,13 @@ ifneq (sh.exe, $(SHELL)) else @echo creating $(PATHDEF_SRC) @echo /* pathdef.c */ > $(PATHDEF_SRC) - @echo #include "vim.h" >> $(PATHDEF_SRC) - @echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)"; >> $(PATHDEF_SRC) - @echo char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)"; >> $(PATHDEF_SRC) + @echo #include "mnv.h" >> $(PATHDEF_SRC) + @echo char_u *default_mnv_dir = (char_u *)"$(MNVRCLOC)"; >> $(PATHDEF_SRC) + @echo char_u *default_mnvruntime_dir = (char_u *)"$(MNVRUNTIMEDIR)"; >> $(PATHDEF_SRC) @echo char_u *all_cflags = (char_u *)"$(CC) $(CFLAGS)"; >> $(PATHDEF_SRC) @echo char_u *all_lflags = (char_u *)"$(CC) $(CFLAGS) $(LFLAGS) -o $(TARGET) $(LIB) -lole32 -luuid $(LUA_LIB) $(MZSCHEME_LIBDIR) $(MZSCHEME_LIB) $(PYTHONLIB) $(PYTHON3LIB) $(RUBYLIB)"; >> $(PATHDEF_SRC) @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> $(PATHDEF_SRC) @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> $(PATHDEF_SRC) endif -# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: +# mnv: set noet sw=8 ts=8 sts=0 wm=0 tw=0: diff --git a/uvim/src/Make_ming.mak b/uvim/src/Make_ming.mak index e9e20f6782..13ddc59852 100644 --- a/uvim/src/Make_ming.mak +++ b/uvim/src/Make_ming.mak @@ -1,5 +1,5 @@ # -# Makefile for VIM on Win32, using MinGW +# Makefile for MNV on Win32, using MinGW # # Also read INSTALLpc.txt! # @@ -24,7 +24,7 @@ # uncomment 'PYTHON' if you want a python-enabled version # Put the path to the python distro here. If cross compiling from Linux, you # will also need to convert the header files to unix instead of dos format: -# for fil in *.h ; do vim -e -c 'set ff=unix|w|q' $fil +# for fil in *.h ; do mnv -e -c 'set ff=unix|w|q' $fil # and also, you will need to make a mingw32 'libpython20.a' to link with: # cd $PYTHON/libs # pexports python20.dll > python20.def @@ -48,4 +48,4 @@ UNDER_CYGWIN = no include Make_cyg_ming.mak -# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: +# mnv: set noet sw=8 ts=8 sts=0 wm=0 tw=0: diff --git a/uvim/src/Make_mvc.mak b/uvim/src/Make_mvc.mak index a59b083e72..2045e2799e 100644 --- a/uvim/src/Make_mvc.mak +++ b/uvim/src/Make_mvc.mak @@ -1,17 +1,17 @@ -# Makefile for Vim on Win32 (Windows 7/8/10/11) and Win64, using the Microsoft +# Makefile for MNV on Win32 (Windows 7/8/10/11) and Win64, using the Microsoft # Visual C++ compilers. Known to work with VC14 (VS2015), VC14.1 (VS2017), # VC14.2 (VS2019) and VC14.3 (VS2022). # # To build using other Windows compilers, see INSTALLpc.txt # # This makefile can build the console, GUI, OLE-enable, Perl-enabled and -# Python-enabled versions of Vim for Win32 platforms. +# Python-enabled versions of MNV for Win32 platforms. # -# The basic command line to build Vim is: +# The basic command line to build MNV is: # # nmake -f Make_mvc.mak # -# This will build the console version of Vim with no additional interfaces. +# This will build the console version of MNV with no additional interfaces. # To add features, define any of the following: # # !!!! After changing any features do "nmake clean" first !!!! @@ -43,14 +43,14 @@ # DYNAMIC_SODIUM=yes (to load the Sodium DLL dynamically) # You need to install the msvc package from # https://download.libsodium.org/libsodium/releases/ -# and package the libsodium.dll with Vim +# and package the libsodium.dll with MNV # # -# DLL support (EXPERIMENTAL): VIMDLL=yes (default is no) -# Creates vim{32,64}.dll, and stub gvim.exe and vim.exe. +# DLL support (EXPERIMENTAL): MNVDLL=yes (default is no) +# Creates mnv{32,64}.dll, and stub gmnv.exe and mnv.exe. # The shared codes between the GUI and the console are built into # the DLL. This reduces the total file size and memory usage. -# Also supports `vim -g` and the `:gui` command. +# Also supports `mnv -g` and the `:gui` command. # # Lua interface: # LUA=[Path to Lua directory] @@ -168,7 +168,7 @@ # Read MAJOR and MINOR from version.h. !IFNDEF MAJOR ! IF ![for /F "tokens=3" %G in \ - ('findstr /RC:"VIM_VERSION_MAJOR[ ^]*[0-9^]" .\version.h') \ + ('findstr /RC:"MNV_VERSION_MAJOR[ ^]*[0-9^]" .\version.h') \ do @(echo:MAJOR=%G> .\_major.tmp)] ! INCLUDE .\_major.tmp ! IF [$(RM) .\_major.tmp] @@ -180,7 +180,7 @@ MAJOR = 9 !IFNDEF MINOR ! IF ![for /F "tokens=3" %G in \ - ('findstr /RC:"VIM_VERSION_MINOR[ ^]*[0-9^]" .\version.h') \ + ('findstr /RC:"MNV_VERSION_MINOR[ ^]*[0-9^]" .\version.h') \ do @(echo:MINOR=%G> .\_minor.tmp)] ! INCLUDE .\_minor.tmp ! IF [$(RM) .\_minor.tmp] @@ -205,9 +205,9 @@ PATCHLEVEL = 0 ! ENDIF !ENDIF -!MESSAGE Vim version: $(MAJOR).$(MINOR).$(PATCHLEVEL) +!MESSAGE MNV version: $(MAJOR).$(MINOR).$(PATCHLEVEL) -!IF "$(VIMDLL)" == "yes" +!IF "$(MNVDLL)" == "yes" GUI = yes !ENDIF @@ -217,7 +217,7 @@ DIRECTX = $(GUI) # Select a code directory, depends on GUI, OLE, DEBUG, interfaces and etc. # If you change something else, do "make clean" first! -!IF "$(VIMDLL)" == "yes" +!IF "$(MNVDLL)" == "yes" OBJDIR = .\ObjD !ELSEIF "$(GUI)" == "yes" OBJDIR = .\ObjG @@ -289,7 +289,7 @@ OBJDIR = $(OBJDIR)$(CPU) NODEBUG = 1 !ELSE ! UNDEF NODEBUG -MAKEFLAGS_GVIMEXT = DEBUG=yes +MAKEFLAGS_GMNVEXT = DEBUG=yes !ENDIF LINK = link @@ -522,10 +522,10 @@ CON_LIB = oldnames.lib kernel32.lib advapi32.lib shell32.lib gdi32.lib \ CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib !ENDIF -# If you have a fixed directory for $VIM or $VIMRUNTIME, other than the normal +# If you have a fixed directory for $MNV or $MNVRUNTIME, other than the normal # default, use these lines. -#VIMRCLOC = somewhere -#VIMRUNTIMEDIR = somewhere +#MNVRCLOC = somewhere +#MNVRUNTIMEDIR = somewhere CFLAGS = -c /W3 /GF /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DHAVE_STDINT_H \ $(CSCOPE_DEFS) $(TERM_DEFS) $(SOUND_DEFS) $(NETBEANS_DEFS) \ @@ -533,7 +533,7 @@ CFLAGS = -c /W3 /GF /nologo -I. -Iproto -DHAVE_PATHDEF -DWIN32 -DHAVE_STDINT_H \ $(DEFINES) $(CI_CFLAGS) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \ /source-charset:utf-8 -RCFLAGS = -DVIM_VERSION_PATCHLEVEL=$(PATCHLEVEL) +RCFLAGS = -DMNV_VERSION_PATCHLEVEL=$(PATCHLEVEL) #>>>>> end of choices ########################################################################### @@ -592,18 +592,18 @@ CPUARG = /arch:AVX512 CPUARG = /arch:$(CPUNR) !ENDIF -# Pass CPUARG to GvimExt, to avoid using version-dependent defaults -MAKEFLAGS_GVIMEXT = $(MAKEFLAGS_GVIMEXT) CPUARG="$(CPUARG)" +# Pass CPUARG to GmnvExt, to avoid using version-dependent defaults +MAKEFLAGS_GMNVEXT = $(MAKEFLAGS_GMNVEXT) CPUARG="$(CPUARG)" -!IF "$(VIMDLL)" == "yes" -VIMDLLBASE = vim +!IF "$(MNVDLL)" == "yes" +MNVDLLBASE = mnv ! IF "$(CPU)" == "i386" -VIMDLLBASE = $(VIMDLLBASE)32 +MNVDLLBASE = $(MNVDLLBASE)32 ! ELSE -VIMDLLBASE = $(VIMDLLBASE)64 +MNVDLLBASE = $(MNVDLLBASE)64 ! ENDIF ! IF "$(DEBUG)" == "yes" -VIMDLLBASE = $(VIMDLLBASE)d +MNVDLLBASE = $(MNVDLLBASE)d ! ENDIF !ENDIF @@ -628,7 +628,7 @@ CFLAGS = $(CFLAGS) /fsanitize=address !IFDEF NODEBUG -VIM = vim +MNV = mnv ! IF "$(OPTIMIZE)" == "SPACE" OPTFLAG = /O1 ! ELSEIF "$(OPTIMIZE)" == "SPEED" @@ -654,7 +654,7 @@ LIBC = libcmt.lib !ELSE # DEBUG -VIM = vimd +MNV = mnvd ! IF ("$(CPU)" == "i386") || ("$(CPU)" == "ix86") DEBUGINFO = /ZI ! ENDIF @@ -679,7 +679,7 @@ CFLAGS = $(CFLAGS) $(CFLAGS_DEPR) !INCLUDE .\Make_all.mak !INCLUDE .\testdir\Make_all.mak -INCL = vim.h alloc.h ascii.h ex_cmds.h feature.h errors.h globals.h \ +INCL = mnv.h alloc.h ascii.h ex_cmds.h feature.h errors.h globals.h \ keymap.h macros.h option.h os_dos.h os_win32.h proto.h regexp.h \ spell.h structs.h termdefs.h beval.h $(NBDEBUG_INCL) @@ -791,24 +791,24 @@ OBJ = \ $(OUTDIR)\undo.obj \ $(OUTDIR)\usercmd.obj \ $(OUTDIR)\userfunc.obj \ - $(OUTDIR)\vim9class.obj \ - $(OUTDIR)\vim9cmds.obj \ - $(OUTDIR)\vim9compile.obj \ - $(OUTDIR)\vim9execute.obj \ - $(OUTDIR)\vim9expr.obj \ - $(OUTDIR)\vim9generics.obj \ - $(OUTDIR)\vim9instr.obj \ - $(OUTDIR)\vim9script.obj \ - $(OUTDIR)\vim9type.obj \ - $(OUTDIR)\viminfo.obj \ + $(OUTDIR)\mnv9class.obj \ + $(OUTDIR)\mnv9cmds.obj \ + $(OUTDIR)\mnv9compile.obj \ + $(OUTDIR)\mnv9execute.obj \ + $(OUTDIR)\mnv9expr.obj \ + $(OUTDIR)\mnv9generics.obj \ + $(OUTDIR)\mnv9instr.obj \ + $(OUTDIR)\mnv9script.obj \ + $(OUTDIR)\mnv9type.obj \ + $(OUTDIR)\mnvinfo.obj \ $(OUTDIR)\winclip.obj \ $(OUTDIR)\window.obj \ -!IF "$(VIMDLL)" == "yes" -OBJ = $(OBJ) $(OUTDIR)\os_w32dll.obj $(OUTDIR)\vimd.res -EXEOBJC = $(OUTDIR)\os_w32exec.obj $(OUTDIR)\vimc.res -EXEOBJG = $(OUTDIR)\os_w32exeg.obj $(OUTDIR)\vimg.res -CFLAGS = $(CFLAGS) -DVIMDLL +!IF "$(MNVDLL)" == "yes" +OBJ = $(OBJ) $(OUTDIR)\os_w32dll.obj $(OUTDIR)\mnvd.res +EXEOBJC = $(OUTDIR)\os_w32exec.obj $(OUTDIR)\mnvc.res +EXEOBJG = $(OUTDIR)\os_w32exeg.obj $(OUTDIR)\mnvg.res +CFLAGS = $(CFLAGS) -DMNVDLL ! IFDEF MZSCHEME EXECFLAGS = EXELIBC = $(LIBC) @@ -817,7 +817,7 @@ EXECFLAGS = -DUSE_OWNSTARTUP /GS- EXELIBC = ! ENDIF !ELSE -OBJ = $(OBJ) $(OUTDIR)\os_w32exe.obj $(OUTDIR)\vim.res +OBJ = $(OBJ) $(OUTDIR)\os_w32exe.obj $(OUTDIR)\mnv.res !ENDIF !IF "$(OLE)" == "yes" @@ -847,14 +847,14 @@ IME_LIB = imm32.lib SUBSYSTEM = windows CFLAGS = $(CFLAGS) -DFEAT_GUI_MSWIN RCFLAGS = $(RCFLAGS) -DFEAT_GUI_MSWIN -! IF "$(VIMDLL)" == "yes" +! IF "$(MNVDLL)" == "yes" SUBSYSTEM_CON = console -GVIM = g$(VIM) +GMNV = g$(MNV) CUI_INCL = iscygpty.h CUI_OBJ = $(OUTDIR)\iscygpty.obj -RCFLAGS = $(RCFLAGS) -DVIMDLL +RCFLAGS = $(RCFLAGS) -DMNVDLL ! ELSE -VIM = g$(VIM) +MNV = g$(MNV) ! ENDIF GUI_INCL = \ gui.h @@ -892,11 +892,11 @@ XDIFF_DEPS = \ !IF "$(SUBSYSTEM_VER)" != "" SUBSYSTEM = $(SUBSYSTEM),$(SUBSYSTEM_VER) SUBSYSTEM_TOOLS = $(SUBSYSTEM_TOOLS),$(SUBSYSTEM_VER) -! IF "$(VIMDLL)" == "yes" +! IF "$(MNVDLL)" == "yes" SUBSYSTEM_CON = $(SUBSYSTEM_CON),$(SUBSYSTEM_VER) ! ENDIF -# Pass SUBSYSTEM_VER to GvimExt and other tools -MAKEFLAGS_GVIMEXT = $(MAKEFLAGS_GVIMEXT) SUBSYSTEM_VER=$(SUBSYSTEM_VER) +# Pass SUBSYSTEM_VER to GmnvExt and other tools +MAKEFLAGS_GMNVEXT = $(MAKEFLAGS_GMNVEXT) SUBSYSTEM_VER=$(SUBSYSTEM_VER) MAKEFLAGS_TOOLS = $(MAKEFLAGS_TOOLS) SUBSYSTEM_VER=$(SUBSYSTEM_VER) !ENDIF @@ -1225,10 +1225,10 @@ CFLAGS = $(CFLAGS) -DMODIFIED_BY=\"$(MODIFIED_BY)\" # debug more conveniently (able to look at variables which are in registers) # CFLAGS = $(CFLAGS) /Fd$(OUTDIR)/ $(DEBUGINFO) -!IF "$(VIMDLL)" == "yes" -LINK_PDB = /PDB:$(VIMDLLBASE).pdb -debug +!IF "$(MNVDLL)" == "yes" +LINK_PDB = /PDB:$(MNVDLLBASE).pdb -debug !ELSE -LINK_PDB = /PDB:$(VIM).pdb -debug +LINK_PDB = /PDB:$(MNV).pdb -debug !ENDIF # @@ -1277,65 +1277,65 @@ LINKARGS1 = $(LINKARGS1) /LTCG:STATUS !ENDIF !IF "$(CPU)" == "AMD64" && "$(GUI)" == "yes" -# This option is required for VC2012 or later so that 64-bit gvim can +# This option is required for VC2012 or later so that 64-bit gmnv can # accept D&D from 32-bit applications. NOTE: This disables 64-bit ASLR, # therefore the security level becomes as same as VC2010. LINKARGS1 = $(LINKARGS1) /HIGHENTROPYVA:NO !ENDIF -!IF "$(VIMDLL)" == "yes" -MAIN_TARGET = $(GVIM).exe $(VIM).exe $(VIMDLLBASE).dll +!IF "$(MNVDLL)" == "yes" +MAIN_TARGET = $(GMNV).exe $(MNV).exe $(MNVDLLBASE).dll !ELSE -MAIN_TARGET = $(VIM).exe +MAIN_TARGET = $(MNV).exe !ENDIF # Target to run individual tests. -VIMTESTTARGET = $(VIM).exe +MNVTESTTARGET = $(MNV).exe all: $(MAIN_TARGET) \ - vimrun.exe \ + mnvrun.exe \ install.exe \ uninstall.exe \ xxd/xxd.exe \ tee/tee.exe \ - GvimExt/gvimext.dll + GmnvExt/gmnvext.dll # To get around the command line limit: Make use of nmake's response files to # capture the arguments for $(LINK) in a file using the @<=^^>) $(PATHDEF_SRC): Make_mvc.mak @ echo creating $(PATHDEF_SRC) @ echo /* pathdef.c */ > $(PATHDEF_SRC) - @ echo #include "vim.h" >> $(PATHDEF_SRC) - @ echo char_u *default_vim_dir = (char_u *)"$(VIMRCLOC:\=\\)"; \ + @ echo #include "mnv.h" >> $(PATHDEF_SRC) + @ echo char_u *default_mnv_dir = (char_u *)"$(MNVRCLOC:\=\\)"; \ >> $(PATHDEF_SRC) - @ echo char_u *default_vimruntime_dir = \ - (char_u *)"$(VIMRUNTIMEDIR:\=\\)"; >> $(PATHDEF_SRC) + @ echo char_u *default_mnvruntime_dir = \ + (char_u *)"$(MNVRUNTIMEDIR:\=\\)"; >> $(PATHDEF_SRC) @ echo char_u *all_cflags = (char_u *)"$(CC:\=\\) $(E_CFLAGS)"; \ >> $(PATHDEF_SRC) @ echo char_u *all_lflags = \ @@ -2033,16 +2033,16 @@ proto.h: \ proto/undo.pro \ proto/usercmd.pro \ proto/userfunc.pro \ - proto/vim9class.pro \ - proto/vim9cmds.pro \ - proto/vim9compile.pro \ - proto/vim9execute.pro \ - proto/vim9expr.pro \ - proto/vim9generics.pro \ - proto/vim9instr.pro \ - proto/vim9script.pro \ - proto/vim9type.pro \ - proto/viminfo.pro \ + proto/mnv9class.pro \ + proto/mnv9cmds.pro \ + proto/mnv9compile.pro \ + proto/mnv9execute.pro \ + proto/mnv9expr.pro \ + proto/mnv9generics.pro \ + proto/mnv9instr.pro \ + proto/mnv9script.pro \ + proto/mnv9type.pro \ + proto/mnvinfo.pro \ proto/window.pro \ $(SOUND_PRO) \ $(NETBEANS_PRO) \ @@ -2059,4 +2059,4 @@ proto.h: \ .c.i: $(CC) $(CFLAGS) /P /C $< -# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=79 ft=make: +# mnv: set noet sw=8 ts=8 sts=0 wm=0 tw=79 ft=make: diff --git a/uvim/src/Make_vms.mms b/uvim/src/Make_vms.mms index a238a8ab9e..8f686997fe 100644 --- a/uvim/src/Make_vms.mms +++ b/uvim/src/Make_vms.mms @@ -1,5 +1,5 @@ # -# Makefile for Vim on OpenVMS +# Makefile for MNV on OpenVMS # # Maintainer: Zoltan Arpadffy # Last change: 2025-07-04 Steven M. Schweda @@ -8,8 +8,8 @@ # with MMS and MMK # # The following could be built: -# vim.exe: standard (terminal, GUI/Motif, GUI/GTK) -# dvim.exe: debug +# mnv.exe: standard (terminal, GUI/Motif, GUI/GTK) +# dmnv.exe: debug # ###################################################################### # @@ -41,7 +41,7 @@ MODEL = HUGE # GUI with GTK # If you have GTK installed you might want to enable this option. # NOTE: you will need to properly define GTK_DIR below -# NOTE: since Vim 7.3 GTK 2+ is used that is not ported to VMS, +# NOTE: since MNV 7.3 GTK 2+ is used that is not ported to VMS, # therefore this option should not be used # GTK = YES @@ -58,34 +58,34 @@ MODEL = HUGE CCVER = YES # Unreliable with VAX C. .ENDIF # VAXC_OR_FORCE_VAXC [ELSE] -# Uncomment if want a debug version. Resulting executable is DVIM.EXE +# Uncomment if want a debug version. Resulting executable is DMNV.EXE # Development purpose only! Normally, it should not be defined. !!! # DEBUG = YES # Languages support for Perl, Python, TCL etc. # If you don't need it really, leave them behind the comment. # You will need related libraries, include files etc. -# VIM_TCL = YES -# VIM_PERL = YES -# VIM_PYTHON = YES -# VIM_PYTHON3= YES -# VIM_RUBY = YES -# VIM_LUA = YES +# MNV_TCL = YES +# MNV_PERL = YES +# MNV_PYTHON = YES +# MNV_PYTHON3= YES +# MNV_RUBY = YES +# MNV_LUA = YES # X Input Method. For entering special languages like chinese and # Japanese. # If you don't need it really, leave it behind the comment. -# VIM_XIM = YES +# MNV_XIM = YES # Allow any white space to separate the fields in a tags file # When not defined, only a TAB is allowed. -# VIM_TAG_ANYWHITE = YES +# MNV_TAG_ANYWHITE = YES # Allow FEATURE_MZSCHEME -# VIM_MZSCHEME = YES +# MNV_MZSCHEME = YES # Use ICONV -# VIM_ICONV = YES +# MNV_ICONV = YES # If you modified the source code and plan to distribute the build # please, let the users know that. @@ -258,19 +258,19 @@ C_INC = [.proto] .IFDEF DEBUG DEBUG_DEF = ,"DEBUG" -TARGET = [.$(DEST)]dvim.exe +TARGET = [.$(DEST)]dmnv.exe CFLAGS = /debug/noopt$(PREFIX)$(FLOAT)$(LIST_OPT) LDFLAGS = /debug $(MAP_OPT) .ELSE -TARGET = [.$(DEST)]vim.exe +TARGET = [.$(DEST)]mnv.exe CFLAGS = $(OPTIMIZE)$(PREFIX)$(FLOAT)$(LIST_OPT) LDFLAGS = $(MAP_OPT) .ENDIF -# Predefined VIM directories -# Please, use $VIM and $VIMRUNTIME logicals instead -VIMLOC = "" -VIMRUN = "" +# Predefined MNV directories +# Please, use $MNV and $MNVRUNTIME logicals instead +MNVLOC = "" +MNVRUN = "" CONFIG_H = os_vms_conf.h @@ -355,7 +355,7 @@ DEFS = ,"HAVE_CONFIG_H" LIBS = .ENDIF -.IFDEF VIM_PERL +.IFDEF MNV_PERL # Perl related setup. PERL = perl PERL_DEF = ,"FEAT_PERL" @@ -367,7 +367,7 @@ PERL_LIB = ,OS_VMS_PERL.OPT/OPT PERL_INC = ,dka0:[perlbuild.perl.lib.vms_axp.5_6_1.core] .ENDIF -.IFDEF VIM_PYTHON +.IFDEF MNV_PYTHON # Python related setup. PYTHON_DEF = ,"FEAT_PYTHON" PYTHON_SRC = if_python.c @@ -376,7 +376,7 @@ PYTHON_LIB = ,OS_VMS_PYTHON.OPT/OPT PYTHON_INC = ,PYTHON_INCLUDE .ENDIF -.IFDEF VIM_PYTHON3 +.IFDEF MNV_PYTHON3 # Python related setup. PYTHON3_DEF = ,"FEAT_PYTHON3" PYTHON3_SRC = if_python3.c @@ -386,7 +386,7 @@ PYTHON3_INC = ,PYTHON3_INCLUDE .ENDIF -.IFDEF VIM_TCL +.IFDEF MNV_TCL # TCL related setup. TCL_DEF = ,"FEAT_TCL" TCL_SRC = if_tcl.c @@ -395,7 +395,7 @@ TCL_LIB = ,OS_VMS_TCL.OPT/OPT TCL_INC = ,dka0:[tcl80.generic] .ENDIF -.IFDEF VIM_RUBY +.IFDEF MNV_RUBY # RUBY related setup. RUBY_DEF = ,"FEAT_RUBY" RUBY_SRC = if_ruby.c @@ -404,7 +404,7 @@ RUBY_LIB = ,OS_VMS_RUBY.OPT/OPT RUBY_INC = .ENDIF -.IFDEF VIM_LUA +.IFDEF MNV_LUA # LUA related setup. LUA_DEF = ,"FEAT_LUA" LUA_SRC = if_lua.c @@ -413,21 +413,21 @@ LUA_LIB = ,OS_VMS_LUA.OPT/OPT LUA_INC = ,LUA$ROOT:[INCLUDE] .ENDIF -.IFDEF VIM_XIM +.IFDEF MNV_XIM # XIM related setup. .IFDEF GUI XIM_DEF = ,"FEAT_XIM" .ENDIF .ENDIF -.IFDEF VIM_MZSCHEME +.IFDEF MNV_MZSCHEME # MZSCHEME related setup MZSCHEME_DEF = ,"FEAT_MZSCHEME" MZSCHEME_SRC = if_mzsch.c MZSCHEME_OBJ = [.$(DEST)]if_mzsch.obj .ENDIF -.IFDEF VIM_ICONV +.IFDEF MNV_ICONV # ICONV related setup ICONV_DEF = ,"USE_ICONV" .ENDIF @@ -458,8 +458,8 @@ DEF_MODIFIED = NO MODEL_DEF = "FEAT_$(MODEL)" # These go into pathdef.c -VIMUSER = "''F$EDIT(F$GETJPI(" ","USERNAME"),"TRIM")'" -VIMHOST = "''F$TRNLNM("SYS$NODE")'''F$TRNLNM("UCX$INET_HOST")'.''F$TRNLNM("UCX$INET_DOMAIN")'" +MNVUSER = "''F$EDIT(F$GETJPI(" ","USERNAME"),"TRIM")'" +MNVHOST = "''F$TRNLNM("SYS$NODE")'''F$TRNLNM("UCX$INET_HOST")'.''F$TRNLNM("UCX$INET_DOMAIN")'" .SUFFIXES : .obj .c # Case problems with old MMS? Ignore: %MMS-I-ALRINSUFFLST @@ -602,16 +602,16 @@ SRC = \ usercmd.c \ userfunc.c \ version.c \ - vim9class.c \ - vim9cmds.c \ - vim9compile.c \ - vim9execute.c \ - vim9expr.c \ - vim9instr.c \ - vim9generics.c \ - vim9script.c \ - vim9type.c \ - viminfo.c \ + mnv9class.c \ + mnv9cmds.c \ + mnv9compile.c \ + mnv9execute.c \ + mnv9expr.c \ + mnv9instr.c \ + mnv9generics.c \ + mnv9script.c \ + mnv9type.c \ + mnvinfo.c \ window.c \ $(GUI_SRC) \ $(XDIFF_SRC) \ @@ -740,16 +740,16 @@ OBJ = \ [.$(DEST)]usercmd.obj \ [.$(DEST)]userfunc.obj \ [.$(DEST)]version.obj \ - [.$(DEST)]vim9class.obj \ - [.$(DEST)]vim9cmds.obj \ - [.$(DEST)]vim9compile.obj \ - [.$(DEST)]vim9execute.obj \ - [.$(DEST)]vim9expr.obj \ - [.$(DEST)]vim9instr.obj \ - [.$(DEST)]vim9generics.obj \ - [.$(DEST)]vim9script.obj \ - [.$(DEST)]vim9type.obj \ - [.$(DEST)]viminfo.obj \ + [.$(DEST)]mnv9class.obj \ + [.$(DEST)]mnv9cmds.obj \ + [.$(DEST)]mnv9compile.obj \ + [.$(DEST)]mnv9execute.obj \ + [.$(DEST)]mnv9expr.obj \ + [.$(DEST)]mnv9instr.obj \ + [.$(DEST)]mnv9generics.obj \ + [.$(DEST)]mnv9script.obj \ + [.$(DEST)]mnv9type.obj \ + [.$(DEST)]mnvinfo.obj \ [.$(DEST)]window.obj \ $(GUI_OBJ) \ $(XDIFF_OBJ) \ @@ -832,16 +832,16 @@ $(TARGET) : $(OBJ) -@ write pd "/* This file is automatically created by MAKE_VMS.MMS" -@ write pd " * Change the file MAKE_VMS.MMS Only. */" -@ write pd "typedef unsigned char char_u;" - -@ write pd "char_u *default_vim_dir = (char_u *)"$(VIMLOC)";" - -@ write pd "char_u *default_vimruntime_dir = (char_u *)"$(VIMRUN)";" + -@ write pd "char_u *default_mnv_dir = (char_u *)"$(MNVLOC)";" + -@ write pd "char_u *default_mnvruntime_dir = (char_u *)"$(MNVRUN)";" -@ write pd "char_u *all_cflags = (char_u *)""$(CC_DEF)""" -@ write pd " ""$(ALL_CFLAGS_VER1)""" -@ write pd " ""$(ALL_CFLAGS_VER2)"";" -@ write pd "char_u *all_lflags = (char_u *)""$(LD_DEF)$(LDFLAGS)""" -@ write pd " ""/exe=$(TARGET) ALL_OBJS_LIST.OPT/OPT $(ALL_LIBS)"";" -@ write pd "char_u *compiler_version = (char_u *) ""''CC_VER'"";" - -@ write pd "char_u *compiled_user = (char_u *) "$(VIMUSER)";" - -@ write pd "char_u *compiled_sys = (char_u *) "$(VIMHOST)";" + -@ write pd "char_u *compiled_user = (char_u *) "$(MNVUSER)";" + -@ write pd "char_u *compiled_sys = (char_u *) "$(MNVHOST)";" -@ write pd "char_u *compiled_arch = (char_u *) ""$(MMSARCH_NAME)"";" -@ write pd "char_u *compiled_vers = (char_u *) """ + - f$getsyi( "version")+ """;" @@ -919,7 +919,7 @@ gtk_env : -@ ! .ENDIF -.IFDEF VIM_PERL +.IFDEF MNV_PERL perl_env : -@ write sys$output "using PERL environment:" -@ show logical PERLSHR @@ -938,7 +938,7 @@ perl_env : -@ ! .ENDIF -.IFDEF VIM_PYTHON +.IFDEF MNV_PYTHON python_env : -@ write sys$output "using PYTHON environment:" -@ show logical PYTHON_INCLUDE @@ -952,7 +952,7 @@ python_env : -@ ! .ENDIF -.IFDEF VIM_PYTHON3 +.IFDEF MNV_PYTHON3 python3_env : -@ write sys$output "using PYTHON3 environment:" -@ show logical PYTHON3_INCLUDE @@ -966,7 +966,7 @@ python3_env : -@ ! .ENDIF -.IFDEF VIM_TCL +.IFDEF MNV_TCL tcl_env : -@ write sys$output "using TCL environment:" -@ show logical TCLSHR @@ -980,7 +980,7 @@ tcl_env : -@ ! .ENDIF -.IFDEF VIM_RUBY +.IFDEF MNV_RUBY ruby_env : -@ write sys$output "using RUBY environment:" -@ write sys$output " include path: ""$(RUBY_INC)""" @@ -993,7 +993,7 @@ ruby_env : -@ ! .ENDIF -.IFDEF VIM_LUA +.IFDEF MNV_LUA lua_env : -@ write sys$output "using LUA environment:" -@ write sys$output " include path: ""$(LUA_INC)""" @@ -1006,475 +1006,475 @@ lua_env : -@ ! .ENDIF -[.$(DEST)]alloc.obj : alloc.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]alloc.obj : alloc.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]arabic.obj : arabic.c vim.h -[.$(DEST)]arglist.obj : arglist.c vim.h [.$(DEST)]config.h feature.h os_unix.h -[.$(DEST)]autocmd.obj : autocmd.c vim.h [.$(DEST)]config.h feature.h os_unix.h -[.$(DEST)]blowfish.obj : blowfish.c vim.h [.$(DEST)]config.h feature.h os_unix.h -[.$(DEST)]blob.obj : blob.c vim.h [.$(DEST)]config.h feature.h os_unix.h -[.$(DEST)]buffer.obj : buffer.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]arabic.obj : arabic.c mnv.h +[.$(DEST)]arglist.obj : arglist.c mnv.h [.$(DEST)]config.h feature.h os_unix.h +[.$(DEST)]autocmd.obj : autocmd.c mnv.h [.$(DEST)]config.h feature.h os_unix.h +[.$(DEST)]blowfish.obj : blowfish.c mnv.h [.$(DEST)]config.h feature.h os_unix.h +[.$(DEST)]blob.obj : blob.c mnv.h [.$(DEST)]config.h feature.h os_unix.h +[.$(DEST)]buffer.obj : buffer.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]bufwrite.obj : bufwrite.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]bufwrite.obj : bufwrite.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]change.obj : change.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]change.obj : change.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]charset.obj : charset.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]charset.obj : charset.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]channel.obj : channel.c vim.h [.$(DEST)]config.h feature.h -[.$(DEST)]cindent.obj : cindent.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]channel.obj : channel.c mnv.h [.$(DEST)]config.h feature.h +[.$(DEST)]cindent.obj : cindent.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]clientserver.obj : clientserver.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]clientserver.obj : clientserver.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]clipboard.obj : clipboard.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]clipboard.obj : clipboard.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]cmdexpand.obj : cmdexpand.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]cmdexpand.obj : cmdexpand.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]cmdhist.obj : cmdhist.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]cmdhist.obj : cmdhist.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]crypt.obj : crypt.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]crypt.obj : crypt.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h regexp.h gui.h \ beval.h alloc.h ex_cmds.h spell.h proto.h \ errors.h globals.h -[.$(DEST)]crypt_zip.obj : crypt_zip.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]crypt_zip.obj : crypt_zip.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h \ regexp.h gui.h beval.h alloc.h ex_cmds.h spell.h \ proto.h errors.h globals.h -[.$(DEST)]debugger.obj : debugger.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]debugger.obj : debugger.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]dict.obj : dict.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]dict.obj : dict.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h regexp.h gui.h \ beval.h alloc.h ex_cmds.h spell.h proto.h \ errors.h globals.h -[.$(DEST)]diff.obj : diff.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]diff.obj : diff.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]digraph.obj : digraph.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]digraph.obj : digraph.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]drawline.obj : drawline.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]drawline.obj : drawline.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]drawscreen.obj : drawscreen.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]drawscreen.obj : drawscreen.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]edit.obj : edit.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]edit.obj : edit.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]eval.obj : eval.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]eval.obj : eval.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]evalbuffer.obj : evalbuffer.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]evalbuffer.obj : evalbuffer.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h \ regexp.h gui.h beval.h alloc.h ex_cmds.h spell.h \ proto.h errors.h globals.h -[.$(DEST)]evalfunc.obj : evalfunc.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]evalfunc.obj : evalfunc.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h \ regexp.h gui.h beval.h alloc.h ex_cmds.h spell.h \ proto.h errors.h globals.h version.h -[.$(DEST)]evalvars.obj : evalvars.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]evalvars.obj : evalvars.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h \ regexp.h gui.h beval.h alloc.h ex_cmds.h spell.h \ proto.h errors.h globals.h version.h -[.$(DEST)]evalwindow.obj : evalwindow.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]evalwindow.obj : evalwindow.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h \ regexp.h gui.h beval.h alloc.h ex_cmds.h spell.h \ proto.h errors.h globals.h -[.$(DEST)]ex_cmds.obj : ex_cmds.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]ex_cmds.obj : ex_cmds.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]ex_cmds2.obj : ex_cmds2.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]ex_cmds2.obj : ex_cmds2.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]ex_docmd.obj : ex_docmd.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]ex_docmd.obj : ex_docmd.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h ex_cmdidxs.h -[.$(DEST)]ex_eval.obj : ex_eval.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]ex_eval.obj : ex_eval.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]ex_getln.obj : ex_getln.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]ex_getln.obj : ex_getln.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]fileio.obj : fileio.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]fileio.obj : fileio.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]filepath.obj : filepath.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]filepath.obj : filepath.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]findfile.obj : findfile.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]findfile.obj : findfile.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]float.obj : float.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]float.obj : float.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]fold.obj : fold.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]fold.obj : fold.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]fuzzy.obj : fuzzy.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]fuzzy.obj : fuzzy.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]getchar.obj : getchar.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]getchar.obj : getchar.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]gc.obj : gc.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]gc.obj : gc.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]gui_xim.obj : gui_xim.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]gui_xim.obj : gui_xim.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]hardcopy.obj : hardcopy.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]hardcopy.obj : hardcopy.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]hashtab.obj : hashtab.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]hashtab.obj : hashtab.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]help.obj : help.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]help.obj : help.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]highlight.obj : highlight.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]highlight.obj : highlight.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]if_cscope.obj : if_cscope.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]if_cscope.obj : if_cscope.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]if_xcmdsrv.obj : if_xcmdsrv.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]if_xcmdsrv.obj : if_xcmdsrv.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]if_mzsch.obj : if_mzsch.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]if_mzsch.obj : if_mzsch.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h \ regexp.h gui.h beval.h ex_cmds.h proto.h \ errors.h globals.h if_mzsch.h -[.$(DEST)]indent.obj : indent.c vim.h [.$(DEST)]config.h feature.h os_unix.h -[.$(DEST)]insexpand.obj : insexpand.c vim.h [.$(DEST)]config.h feature.h os_unix.h -[.$(DEST)]job.obj : job.c vim.h [.$(DEST)]config.h feature.h os_unix.h -[.$(DEST)]json.obj : json.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]indent.obj : indent.c mnv.h [.$(DEST)]config.h feature.h os_unix.h +[.$(DEST)]insexpand.obj : insexpand.c mnv.h [.$(DEST)]config.h feature.h os_unix.h +[.$(DEST)]job.obj : job.c mnv.h [.$(DEST)]config.h feature.h os_unix.h +[.$(DEST)]json.obj : json.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]linematch.obj : linematch.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]linematch.obj : linematch.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]list.obj : list.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]list.obj : list.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h regexp.h gui.h \ beval.h alloc.h ex_cmds.h spell.h proto.h \ errors.h globals.h -[.$(DEST)]locale.obj : locale.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]locale.obj : locale.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h regexp.h gui.h \ beval.h alloc.h ex_cmds.h spell.h proto.h \ errors.h globals.h -[.$(DEST)]logfile.obj : logfile.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]logfile.obj : logfile.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h regexp.h gui.h \ beval.h alloc.h ex_cmds.h spell.h proto.h \ errors.h globals.h -[.$(DEST)]main.obj : main.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]main.obj : main.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h \ arabic.c -[.$(DEST)]map.obj : map.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]map.obj : map.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]mark.obj : mark.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]mark.obj : mark.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]match.obj : match.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]match.obj : match.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]memfile.obj : memfile.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]memfile.obj : memfile.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]memline.obj : memline.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]memline.obj : memline.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]menu.obj : menu.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]menu.obj : menu.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]message.obj : message.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]message.obj : message.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]misc1.obj : misc1.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]misc1.obj : misc1.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h \ version.h -[.$(DEST)]misc2.obj : misc2.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]misc2.obj : misc2.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]mouse.obj : mouse.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]mouse.obj : mouse.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]move.obj : move.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]move.obj : move.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]mbyte.obj : mbyte.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]mbyte.obj : mbyte.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]normal.obj : normal.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]normal.obj : normal.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h nv_cmdidxs.h nv_cmds.h -[.$(DEST)]ops.obj : ops.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]ops.obj : ops.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]option.obj : option.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]option.obj : option.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h optiondefs.h -[.$(DEST)]optionstr.obj : optionstr.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]optionstr.obj : optionstr.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]os_unix.obj : os_unix.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]os_unix.obj : os_unix.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h os_unixx.h -[.$(DEST)]os_vms.obj : os_vms.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]os_vms.obj : os_vms.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h os_unixx.h -[.$(DEST)]pathdef.obj : [.$(DEST)]pathdef.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]pathdef.obj : [.$(DEST)]pathdef.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]popupmenu.obj : popupmenu.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]popupmenu.obj : popupmenu.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]popupwin.obj : popupwin.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]popupwin.obj : popupwin.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]pty.obj : pty.c vim.h [.$(DEST)]config.h feature.h os_unix.h -[.$(DEST)]profiler.obj : profiler.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]pty.obj : pty.c mnv.h [.$(DEST)]config.h feature.h os_unix.h +[.$(DEST)]profiler.obj : profiler.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]quickfix.obj : quickfix.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]quickfix.obj : quickfix.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]regexp.obj : regexp.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]regexp.obj : regexp.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]register.obj : register.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]register.obj : register.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]scriptfile.obj : scriptfile.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]scriptfile.obj : scriptfile.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]screen.obj : screen.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]screen.obj : screen.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]search.obj : search.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]search.obj : search.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]session.obj : session.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]session.obj : session.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]sha256.obj : sha256.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]sha256.obj : sha256.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h regexp.h gui.h \ beval.h alloc.h ex_cmds.h spell.h proto.h \ errors.h globals.h -[.$(DEST)]sign.obj : sign.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]sign.obj : sign.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h regexp.h gui.h \ beval.h alloc.h ex_cmds.h spell.h proto.h \ errors.h globals.h -[.$(DEST)]sound.obj : sound.c vim.h [.$(DEST)]config.h feature.h -[.$(DEST)]spell.obj : spell.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]sound.obj : sound.c mnv.h [.$(DEST)]config.h feature.h +[.$(DEST)]spell.obj : spell.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]spellfile.obj : spellfile.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]spellfile.obj : spellfile.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h \ regexp.h gui.h beval.h alloc.h ex_cmds.h spell.h \ proto.h errors.h globals.h -[.$(DEST)]spellsuggest.obj : spellsuggest.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]spellsuggest.obj : spellsuggest.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h \ regexp.h gui.h beval.h alloc.h ex_cmds.h spell.h \ proto.h errors.h globals.h -[.$(DEST)]strings.obj : strings.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]strings.obj : strings.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h \ regexp.h gui.h beval.h alloc.h ex_cmds.h spell.h \ proto.h errors.h globals.h -[.$(DEST)]syntax.obj : syntax.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]syntax.obj : syntax.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]tabpanel.obj : tabpanel.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]tabpanel.obj : tabpanel.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]tag.obj : tag.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]tag.obj : tag.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]term.obj : term.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]term.obj : term.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]terminal.obj : terminal.c vim.h [.$(DEST)]config.h feature.h os_unix.h -[.$(DEST)]termlib.obj : termlib.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]terminal.obj : terminal.c mnv.h [.$(DEST)]config.h feature.h os_unix.h +[.$(DEST)]termlib.obj : termlib.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]testing.obj : testing.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]testing.obj : testing.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]textformat.obj : textformat.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]textformat.obj : textformat.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]textobject.obj : textobject.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]textobject.obj : textobject.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]textprop.obj : textprop.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]textprop.obj : textprop.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]time.obj : time.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]time.obj : time.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]tuple.obj : tuple.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]tuple.obj : tuple.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]typval.obj : typval.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]typval.obj : typval.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]ui.obj : ui.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]ui.obj : ui.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]undo.obj : undo.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]undo.obj : undo.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]usercmd.obj : usercmd.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]usercmd.obj : usercmd.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h \ regexp.h gui.h beval.h alloc.h ex_cmds.h spell.h \ proto.h errors.h globals.h -[.$(DEST)]userfunc.obj : userfunc.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]userfunc.obj : userfunc.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h structs.h \ regexp.h gui.h beval.h alloc.h ex_cmds.h spell.h \ proto.h errors.h globals.h -[.$(DEST)]version.obj : version.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]version.obj : version.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]viminfo.obj : viminfo.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]mnvinfo.obj : mnvinfo.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]vim9class.obj : vim9class.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]mnv9class.obj : mnv9class.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]vim9cmds.obj : vim9cmds.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]mnv9cmds.obj : mnv9cmds.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]vim9compile.obj : vim9compile.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]mnv9compile.obj : mnv9compile.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]vim9execute.obj : vim9execute.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]mnv9execute.obj : mnv9execute.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]vim9expr.obj : vim9expr.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]mnv9expr.obj : mnv9expr.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]vim9instr.obj : vim9instr.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]mnv9instr.obj : mnv9instr.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]vim9generics.obj : vim9generics.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]mnv9generics.obj : mnv9generics.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]vim9script.obj : vim9script.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]mnv9script.obj : mnv9script.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]vim9type.obj : vim9type.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]mnv9type.obj : mnv9type.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]window.obj : window.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]window.obj : window.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]gui.obj : gui.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]gui.obj : gui.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]gui_gtk.obj : gui_gtk.c gui_gtk_f.h vim.h [.$(DEST)]config.h feature.h \ +[.$(DEST)]gui_gtk.obj : gui_gtk.c gui_gtk_f.h mnv.h [.$(DEST)]config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h structs.h \ regexp.h gui.h beval.h option.h ex_cmds.h \ proto.h errors.h globals.h [-.pixmaps]stock_icons.h -[.$(DEST)]gui_gtk_f.obj : gui_gtk_f.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]gui_gtk_f.obj : gui_gtk_f.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h gui_gtk_f.h -[.$(DEST)]gui_motif.obj : gui_motif.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]gui_motif.obj : gui_motif.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h [-.pixmaps]alert.xpm [-.pixmaps]error.xpm \ [-.pixmaps]generic.xpm [-.pixmaps]info.xpm [-.pixmaps]quest.xpm -[.$(DEST)]gui_athena.obj : gui_athena.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]gui_athena.obj : gui_athena.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h gui_at_sb.h -[.$(DEST)]gui_gtk_x11.obj : gui_gtk_x11.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]gui_gtk_x11.obj : gui_gtk_x11.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ - errors.h globals.h gui_gtk_f.h [-.runtime]vim32x32_png.h \ - [-.runtime]vim16x16_png.h [-.runtime]vim48x48_png.h version.h -[.$(DEST)]gui_x11.obj : gui_x11.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ + errors.h globals.h gui_gtk_f.h [-.runtime]mnv32x32_png.h \ + [-.runtime]mnv16x16_png.h [-.runtime]mnv48x48_png.h version.h +[.$(DEST)]gui_x11.obj : gui_x11.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ - errors.h globals.h [-.runtime]vim32x32.xpm \ - [-.runtime]vim16x16.xpm [-.runtime]vim48x48.xpm [-.pixmaps]tb_new.xpm \ + errors.h globals.h [-.runtime]mnv32x32.xpm \ + [-.runtime]mnv16x16.xpm [-.runtime]mnv48x48.xpm [-.pixmaps]tb_new.xpm \ [-.pixmaps]tb_open.xpm [-.pixmaps]tb_close.xpm [-.pixmaps]tb_save.xpm \ [-.pixmaps]tb_print.xpm [-.pixmaps]tb_cut.xpm [-.pixmaps]tb_copy.xpm \ [-.pixmaps]tb_paste.xpm [-.pixmaps]tb_find.xpm \ @@ -1490,52 +1490,52 @@ lua_env : [-.pixmaps]tb_shell.xpm [-.pixmaps]tb_replace.xpm \ [-.pixmaps]tb_vsplit.xpm [-.pixmaps]tb_maxwidth.xpm \ [-.pixmaps]tb_minwidth.xpm -[.$(DEST)]gui_at_sb.obj : gui_at_sb.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]gui_at_sb.obj : gui_at_sb.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h gui_at_sb.h -[.$(DEST)]gui_at_fs.obj : gui_at_fs.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]gui_at_fs.obj : gui_at_fs.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h gui_at_sb.h -[.$(DEST)]pty.obj : pty.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]pty.obj : pty.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h gui.h beval.h \ option.h ex_cmds.h proto.h errors.h globals.h -[.$(DEST)]if_perl.obj : [.auto]if_perl.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]if_perl.obj : [.auto]if_perl.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]if_python.obj : if_python.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]if_python.obj : if_python.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]if_tcl.obj : if_tcl.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]if_tcl.obj : if_tcl.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]if_ruby.obj : if_ruby.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]if_ruby.obj : if_ruby.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]if_lua.obj : if_lua.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]if_lua.obj : if_lua.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ errors.h globals.h version.h -[.$(DEST)]beval.obj : beval.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]beval.obj : beval.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]gui_beval.obj : gui_beval.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]gui_beval.obj : gui_beval.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h -[.$(DEST)]netbeans.obj : netbeans.c vim.h [.$(DEST)]config.h feature.h os_unix.h \ +[.$(DEST)]netbeans.obj : netbeans.c mnv.h [.$(DEST)]config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h structs.h regexp.h \ gui.h beval.h option.h ex_cmds.h proto.h \ errors.h globals.h version.h -[.$(DEST)]gui_xmdlg.obj : gui_xmdlg.c [.$(DEST)]config.h vim.h feature.h os_unix.h -[.$(DEST)]gui_xmebw.obj : gui_xmebw.c [.$(DEST)]config.h vim.h feature.h os_unix.h -[.$(DEST)]xdiffi.obj : [.xdiff]xdiffi.c [.xdiff]xinclude.h [.$(DEST)]config.h vim.h feature.h os_unix.h -[.$(DEST)]xemit.obj : [.xdiff]xemit.c [.xdiff]xinclude.h [.$(DEST)]config.h vim.h feature.h os_unix.h -[.$(DEST)]xprepare.obj : [.xdiff]xprepare.c [.xdiff]xinclude.h [.$(DEST)]config.h vim.h feature.h os_unix.h -[.$(DEST)]xutils.obj : [.xdiff]xutils.c [.xdiff]xinclude.h [.$(DEST)]config.h vim.h feature.h os_unix.h -[.$(DEST)]xhistogram.obj : [.xdiff]xhistogram.c [.xdiff]xinclude.h [.$(DEST)]config.h vim.h feature.h os_unix.h -[.$(DEST)]xpatience.obj : [.xdiff]xpatience.c [.xdiff]xinclude.h [.$(DEST)]config.h vim.h feature.h os_unix.h +[.$(DEST)]gui_xmdlg.obj : gui_xmdlg.c [.$(DEST)]config.h mnv.h feature.h os_unix.h +[.$(DEST)]gui_xmebw.obj : gui_xmebw.c [.$(DEST)]config.h mnv.h feature.h os_unix.h +[.$(DEST)]xdiffi.obj : [.xdiff]xdiffi.c [.xdiff]xinclude.h [.$(DEST)]config.h mnv.h feature.h os_unix.h +[.$(DEST)]xemit.obj : [.xdiff]xemit.c [.xdiff]xinclude.h [.$(DEST)]config.h mnv.h feature.h os_unix.h +[.$(DEST)]xprepare.obj : [.xdiff]xprepare.c [.xdiff]xinclude.h [.$(DEST)]config.h mnv.h feature.h os_unix.h +[.$(DEST)]xutils.obj : [.xdiff]xutils.c [.xdiff]xinclude.h [.$(DEST)]config.h mnv.h feature.h os_unix.h +[.$(DEST)]xhistogram.obj : [.xdiff]xhistogram.c [.xdiff]xinclude.h [.$(DEST)]config.h mnv.h feature.h os_unix.h +[.$(DEST)]xpatience.obj : [.xdiff]xpatience.c [.xdiff]xinclude.h [.$(DEST)]config.h mnv.h feature.h os_unix.h diff --git a/uvim/src/Makefile b/uvim/src/Makefile index 9493691941..5f1308748f 100644 --- a/uvim/src/Makefile +++ b/uvim/src/Makefile @@ -1,43 +1,43 @@ -# Makefile for Vim on Unix and Unix-like systems vim:ts=8:sw=8:tw=78 +# Makefile for MNV on Unix and Unix-like systems mnv:ts=8:sw=8:tw=78 # # This Makefile is loosely based on the GNU Makefile conventions found in # standards.info. # -# Compiling Vim, summary: +# Compiling MNV, summary: # # 3. make # 5. make install # -# Compiling Vim, details: +# Compiling MNV, details: # # Edit this file for adjusting to your system. You should not need to edit any # other file for machine specific things! # The name of this file MUST be Makefile (note the uppercase 'M'). # # 1. Edit this Makefile {{{1 -# The defaults for Vim should work on most machines, but you may want to +# The defaults for MNV should work on most machines, but you may want to # uncomment some lines or make other changes below to tune it to your # system, compiler or preferences. Uncommenting means that the '#' in # the first column of a line is removed. -# - If you want a version of Vim that is small and starts up quickly, +# - If you want a version of MNV that is small and starts up quickly, # you might want to disable the GUI, X11, Perl, Python and Tcl. # - Uncomment the line with --disable-gui if you have Motif and/or GTK -# but don't want to make gvim (the GUI version of Vim with nice -# menus and scrollbars, but makes Vim bigger and startup slower). +# but don't want to make gmnv (the GUI version of MNV with nice +# menus and scrollbars, but makes MNV bigger and startup slower). # - Uncomment --disable-darwin if on Mac OS X but you want to compile a # Unix version. # - Uncomment the line "CONF_OPT_X = --without-x" if you have X11 but -# want to disable using X11 libraries. This speeds up starting Vim, +# want to disable using X11 libraries. This speeds up starting MNV, # but the window title will not be set and the X11 selection can not # be used. # - Uncomment the line "CONF_OPT_XSMP = --disable-xsmp" if you have the # X11 Session Management Protocol (XSMP) library (libSM) but do not # want to use it. -# This can speedup Vim startup but Vim loses the ability to catch the +# This can speedup MNV startup but MNV loses the ability to catch the # user logging out from session-managers like GNOME and work # could be lost. # - Uncomment one or more of these lines to include an interface; -# each makes Vim quite a bit bigger: +# each makes MNV quite a bit bigger: # --enable-luainterp for Lua interpreter # --enable-mzschemeinterp for MzScheme interpreter # --enable-perlinterp for Perl interpreter @@ -63,11 +63,11 @@ # # 2. Edit feature.h {{{1 # Only if you do not agree with the default compile features, e.g.: -# - you want Vim to be as vi compatible as it can be +# - you want MNV to be as vi compatible as it can be # - you want to use Emacs tags files # - you want right-to-left editing (Hebrew) # - you want 'langmap' support (Greek) -# - you want to remove features to make Vim smaller +# - you want to remove features to make MNV smaller # # 3. "make" {{{1 # Will first run ./configure with the options in this file. Then it will @@ -93,7 +93,7 @@ # - If you do not trust the automatic configuration code, then inspect # auto/config.h and auto/config.mk, before starting the actual build # phase. If possible edit this Makefile, rather than auto/config.mk -- -# especially look at the definition of VIMLOC below. Note that the +# especially look at the definition of MNVLOC below. Note that the # configure phase overwrites auto/config.mk and auto/config.h again. # - If you get error messages, find out what is wrong and try to correct # it in this Makefile. You may need to do "make reconfig" when you @@ -101,18 +101,18 @@ # compiler to an ANSI C compiler). Only when auto/configure does # something wrong you may need to change one of the other files. If # you find a clean way to fix the problem, consider sending a note to -# the author of autoconf (bug-gnu-utils@prep.ai.mit.edu) or Vim -# (vim-dev@vim.org). Don't bother to do that when you made a hack +# the author of autoconf (bug-gnu-utils@prep.ai.mit.edu) or MNV +# (mnv-dev@mnv.org). Don't bother to do that when you made a hack # solution for a non-standard system. # # 4. "make test" {{{1 -# This is optional. This will run Vim scripts on a number of test +# This is optional. This will run MNV scripts on a number of test # files, and compare the produced output with the expected output. # If all is well, you will get the "ALL DONE" message in the end. If a # test fails you get "TEST FAILURE". See below (search for "/^test"). # # 5. "make install" {{{1 -# If the new Vim seems to be working OK you can install it and the +# If the new MNV seems to be working OK you can install it and the # documentation in the appropriate location. The default is # "/usr/local". Change "prefix" below to change the location. # "auto/pathdef.c" will be compiled again after changing this to make @@ -122,35 +122,35 @@ # The runtime files are in a different directory for each version. You # might want to delete an older version. # If you don't want to install everything, there are other targets: -# make installvim only installs Vim, not the tools -# make installvimbin only installs the Vim executable +# make installmnv only installs MNV, not the tools +# make installmnvbin only installs the MNV executable # make installruntime installs most of the runtime files -# make installrtbase only installs the Vim help and +# make installrtbase only installs the MNV help and # runtime files -# make installlinks only installs the Vim binary links -# make installmanlinks only installs the Vim manpage links -# make installmacros only installs the Vim macros +# make installlinks only installs the MNV binary links +# make installmanlinks only installs the MNV manpage links +# make installmacros only installs the MNV macros # make installpack only installs the packages -# make installtutorbin only installs the Vim tutor program -# make installtutor only installs the Vim tutor files +# make installtutorbin only installs the MNV tutor program +# make installtutor only installs the MNV tutor files # make installspell only installs the spell files # make installtools only installs xxd -# If you install Vim, not to install for real but to prepare a package +# If you install MNV, not to install for real but to prepare a package # or RPM, set DESTDIR to the root of the tree. # -# 6. Use Vim until a new version comes out. {{{1 +# 6. Use MNV until a new version comes out. {{{1 # # 7. "make uninstall_runtime" {{{1 # Will remove the runtime files for the current version. This is safe # to use while another version is being used, only version-specific # files will be deleted. # To remove the runtime files of another version: -# make uninstall_runtime VIMRTDIR=/vim54 +# make uninstall_runtime MNVRTDIR=/mnv54 # If you want to delete all installed files, use: # make uninstall # Note that this will delete files that have the same name for any # version, thus you might need to do a "make install" soon after this. -# Be careful not to remove a version of Vim that is still being used! +# Be careful not to remove a version of MNV that is still being used! # To find out which files and directories will be deleted, use: # make -n uninstall # }}} @@ -158,7 +158,7 @@ ### This Makefile has been successfully tested on many systems. {{{ ### Only the ones that require special options are mentioned here. ### Check the (*) column for remarks, listed below. -### Later code changes may cause small problems, otherwise Vim is supposed to +### Later code changes may cause small problems, otherwise MNV is supposed to ### compile and run without problems. #system: configurations: version (*) tested by: @@ -271,7 +271,7 @@ CC= # Defaults used when auto/config.mk does not exist. srcdir = . -VIMNAME = vim +MNVNAME = mnv EXNAME = ex VIEWNAME = view @@ -298,7 +298,7 @@ CClink = $(CC) # below. As shipped, this file contains a target that causes to run # configure. Once configure was run, this file contains a list of # make variables with predefined values instead. Thus any second invocation -# of make, will build Vim. +# of make, will build MNV. # CONFIGURE - configure arguments {{{1 # You can give a lot of options to configure. @@ -306,15 +306,15 @@ CClink = $(CC) # examples you can uncomment: #CONF_ARGS1 = --exec-prefix=/usr -#CONF_ARGS2 = --with-vim-name=vim8 --with-ex-name=ex8 --with-view-name=view8 -#CONF_ARGS3 = --with-global-runtime=/etc/vim,/usr/share/vim +#CONF_ARGS2 = --with-mnv-name=mnv8 --with-ex-name=ex8 --with-view-name=view8 +#CONF_ARGS3 = --with-global-runtime=/etc/mnv,/usr/share/mnv #CONF_ARGS4 = --with-local-dir=/usr/share #CONF_ARGS5 = --without-local-dir -# Use this one if you distribute a modified version of Vim. +# Use this one if you distribute a modified version of MNV. #CONF_ARGS6 = --with-modified-by="John Doe" -# GUI - For creating Vim with GUI (gvim) (B) +# GUI - For creating MNV with GUI (gmnv) (B) # Uncomment this line when you don't want to get the GUI version, although you # have GTK and/or Motif. Also use --without-x if you don't want X11 # at all. @@ -337,7 +337,7 @@ CClink = $(CC) # # GTK versions that are known not to work 100% are rejected. # Use "--disable-gtktest" to accept them anyway. -# For GTK 1 use Vim 7.2. +# For GTK 1 use MNV 7.2. # # GNOME means GTK with Gnome support. If using GTK and --enable-gnome-check # is used then GNOME will automatically be used if it is found. If you have @@ -358,11 +358,11 @@ CClink = $(CC) #CONF_OPT_GUI = --enable-gui=motif #CONF_OPT_GUI = --enable-gui=motif --with-motif-lib="-static -lXm -shared" -# Uncomment this line to run an individual test with gvim. +# Uncomment this line to run an individual test with gmnv. #GUI_TESTARG = GUI_FLAG=-g # DARWIN - detecting Mac OS X -# Uncomment this line when you want to compile a Unix version of Vim on +# Uncomment this line when you want to compile a Unix version of MNV on # Darwin. None of the Mac specific options or files will be used. #CONF_OPT_DARWIN = --disable-darwin @@ -375,7 +375,7 @@ CClink = $(CC) #CONF_OPT_DARWIN = --with-mac-arch=both # Uncomment the next line to fail if one of the requested language interfaces -# cannot be configured. Without this Vim will be build anyway, without +# cannot be configured. Without this MNV will be build anyway, without # the failing interfaces. #CONF_OPT_FAIL = --enable-fail-if-missing @@ -434,7 +434,7 @@ CClink = $(CC) # If both python2.x and python3.x are enabled then the linking will be via # dlopen(), dlsym(), dlclose(), i.e. pythonX.Y.so must be available # However, this may still cause problems, such as "import termios" failing. -# Build two separate versions of Vim in that case. +# Build two separate versions of MNV in that case. #CONF_OPT_PYTHON = --enable-pythoninterp #CONF_OPT_PYTHON = --enable-pythoninterp --with-python-command=python2.7 #CONF_OPT_PYTHON = --enable-pythoninterp=dynamic @@ -529,7 +529,7 @@ CClink = $(CC) # Uncomment the next line to not use libsodium # CONF_OPT_SODIUM = --disable-libsodium -# FEATURES - For creating Vim with more or less features +# FEATURES - For creating MNV with more or less features # Uncomment one of these lines when you want to include few to many features. # The default is "huge" for most systems. #CONF_OPT_FEAT = --with-features=tiny @@ -539,11 +539,11 @@ CClink = $(CC) # COMPILED BY - For including a specific e-mail address for ":version". #CONF_OPT_COMPBY = "--with-compiledby=John Doe " -# X WINDOWS DISABLE - For creating a plain Vim without any X11 related fancies -# (otherwise Vim configure will try to include xterm titlebar access) +# X WINDOWS DISABLE - For creating a plain MNV without any X11 related fancies +# (otherwise MNV configure will try to include xterm titlebar access) # Also disable the GUI above, otherwise it will be included anyway. # When both GUI and X11 have been disabled this may save about 15% of the -# code and make Vim startup quicker. +# code and make MNV startup quicker. #CONF_OPT_X = --without-x # X WINDOWS DIRECTORY - specify X directories @@ -555,16 +555,16 @@ CClink = $(CC) #CONF_OPT_X = --x-include=$(XROOT)/include --x-libraries=$(XROOT)/lib # X11 Session Management Protocol support -# Vim will try to use XSMP to catch the user logging out if there are unsaved -# files. Uncomment this line to disable that (it prevents vim trying to open +# MNV will try to use XSMP to catch the user logging out if there are unsaved +# files. Uncomment this line to disable that (it prevents mnv trying to open # communications with the session manager). #CONF_OPT_XSMP = --disable-xsmp # You may wish to include xsmp but use exclude xsmp-interact if the logout # XSMP functionality does not work well with your session-manager (at time of # writing, this would be early GNOME-1 gnome-session: it 'freezes' other -# applications after Vim has cancelled a logout (until Vim quits). This -# *might* be the Vim code, but is more likely a bug in early GNOME-1. +# applications after MNV has cancelled a logout (until MNV quits). This +# *might* be the MNV code, but is more likely a bug in early GNOME-1. # This disables the dialog that asks you if you want to save files or not. #CONF_OPT_XSMP = --disable-xsmp-interact @@ -603,7 +603,7 @@ CClink = $(CC) #CFLAGS = -g -Wall -Wmissing-prototypes #CFLAGS = -O6 -fno-strength-reduce -Wall -Wshadow -Wmissing-prototypes #CFLAGS = -g -DDEBUG -Wall -Wshadow -Wmissing-prototypes -#CFLAGS = -g -O2 '-DSTARTUPTIME="vimstartup"' -fno-strength-reduce -Wall -Wmissing-prototypes +#CFLAGS = -g -O2 '-DSTARTUPTIME="mnvstartup"' -fno-strength-reduce -Wall -Wmissing-prototypes # Use this with GCC to check for mistakes, unused arguments, etc. # Note: If you use -Wextra and get warnings in GTK code about function @@ -652,7 +652,7 @@ LINT_OPTIONS = -beprxzF # PROFILING - Uncomment the next two lines to do profiling with gcc and gprof. # Might not work with GUI or Perl. -# After running Vim see the profile result with: gprof vim gmon.out | vim - +# After running MNV see the profile result with: gprof mnv gmon.out | mnv - # Need to recompile everything after changing this: "make clean" "make". #PROFILE_CFLAGS = -pg -g -DWE_ARE_PROFILING #PROFILE_LIBS = -pg @@ -667,7 +667,7 @@ LINT_OPTIONS = -beprxzF # TEST COVERAGE - Uncomment the two lines below the explanation to get code # coverage information. (provided by Yegappan Lakshmanan) -# 1. make clean, run configure and build Vim as usual. +# 1. make clean, run configure and build MNV as usual. # 2. Generate the baseline code coverage information: # $ lcov -c -i -b . -d objects -o objects/coverage_base.info # 3. Run "make test" to run the unit tests. The code coverage information will @@ -687,10 +687,10 @@ LINT_OPTIONS = -beprxzF # PROFILE_CFLAGS=-g -O0 --coverage -DWE_ARE_PROFILING -DUSE_GCOV_FLUSH -# Uncomment the next lines to compile Vim with the address sanitizer (asan) and +# Uncomment the next lines to compile MNV with the address sanitizer (asan) and # with the undefined sanitizer. Works with gcc. # You should also use -DEXITFREE to avoid false reports. -# May make Vim twice as slow. Errors are reported on stderr. +# May make MNV twice as slow. Errors are reported on stderr. # More at: https://code.google.com/p/address-sanitizer/ # Useful environment variables: # $ export ASAN_OPTIONS="print_stacktrace=1 log_path=asan" @@ -716,7 +716,7 @@ SANITIZER_LIBS = $(SANITIZER_CFLAGS) #LEAK_CFLAGS = -DEXITFREE #LEAK_LIBS = -lccmalloc -# Uncomment this line to have Vim call abort() when an internal error is +# Uncomment this line to have MNV call abort() when an internal error is # detected. Useful when using a tool to find errors. #ABORT_CFLAGS = -DABORT_ON_INTERNAL_ERROR @@ -922,27 +922,27 @@ SANITIZER_LIBS = $(SANITIZER_CFLAGS) ##################### end of system specific lines ################### }}} ### Names of the programs and targets {{{1 -VIMTARGET = $(VIMNAME)$(EXEEXT) +MNVTARGET = $(MNVNAME)$(EXEEXT) EXTARGET = $(EXNAME)$(LNKEXT) VIEWTARGET = $(VIEWNAME)$(LNKEXT) -GVIMNAME = g$(VIMNAME) -GVIMTARGET = $(GVIMNAME)$(LNKEXT) +GMNVNAME = g$(MNVNAME) +GMNVTARGET = $(GMNVNAME)$(LNKEXT) GVIEWNAME = g$(VIEWNAME) GVIEWTARGET = $(GVIEWNAME)$(LNKEXT) -RVIMNAME = r$(VIMNAME) -RVIMTARGET = $(RVIMNAME)$(LNKEXT) +RMNVNAME = r$(MNVNAME) +RMNVTARGET = $(RMNVNAME)$(LNKEXT) RVIEWNAME = r$(VIEWNAME) RVIEWTARGET = $(RVIEWNAME)$(LNKEXT) -RGVIMNAME = r$(GVIMNAME) -RGVIMTARGET = $(RGVIMNAME)$(LNKEXT) +RGMNVNAME = r$(GMNVNAME) +RGMNVTARGET = $(RGMNVNAME)$(LNKEXT) RGVIEWNAME = r$(GVIEWNAME) RGVIEWTARGET = $(RGVIEWNAME)$(LNKEXT) -VIMDIFFNAME = $(VIMNAME)diff -GVIMDIFFNAME = g$(VIMDIFFNAME) -VIMDIFFTARGET = $(VIMDIFFNAME)$(LNKEXT) -GVIMDIFFTARGET = $(GVIMDIFFNAME)$(LNKEXT) -EVIMNAME = e$(VIMNAME) -EVIMTARGET = $(EVIMNAME)$(LNKEXT) +MNVDIFFNAME = $(MNVNAME)diff +GMNVDIFFNAME = g$(MNVDIFFNAME) +MNVDIFFTARGET = $(MNVDIFFNAME)$(LNKEXT) +GMNVDIFFTARGET = $(GMNVDIFFNAME)$(LNKEXT) +EMNVNAME = e$(MNVNAME) +EMNVTARGET = $(EMNVNAME)$(LNKEXT) EVIEWNAME = e$(VIEWNAME) EVIEWTARGET = $(EVIEWNAME)$(LNKEXT) @@ -953,12 +953,12 @@ TOOLS = xxd/xxd$(EXEEXT) # ### prefix the top directory for the data (default "/usr/local") # -# Uncomment the next line to install Vim in your home directory. +# Uncomment the next line to install MNV in your home directory. #prefix = $(HOME) ### exec_prefix is the top directory for the executable (default $(prefix)) # -# Uncomment the next line to install the Vim executable in "/usr/machine/bin" +# Uncomment the next line to install the MNV executable in "/usr/machine/bin" #exec_prefix = /usr/machine ### BINDIR dir for the executable (default "$(exec_prefix)/bin") @@ -968,28 +968,28 @@ TOOLS = xxd/xxd$(EXEEXT) # They may be different when using different architectures for the # executable and a common directory for the other files. # -# Uncomment the next line to install Vim in "/usr/bin" +# Uncomment the next line to install MNV in "/usr/bin" #BINDIR = /usr/bin -# Uncomment the next line to install Vim manuals in "/usr/share/man/man1" +# Uncomment the next line to install MNV manuals in "/usr/share/man/man1" #MANDIR = /usr/share/man -# Uncomment the next line to install Vim help files in "/usr/share/vim" +# Uncomment the next line to install MNV help files in "/usr/share/mnv" #DATADIR = /usr/share ### DESTDIR root of the installation tree. This is prepended to the other # directories. This directory must exist. -#DESTDIR = ~/pkg/vim +#DESTDIR = ~/pkg/mnv ### Directory of the man pages MAN1DIR = /man1 -### Vim version (adjusted by a script) -VIMMAJOR = 9 -VIMMINOR = 2 +### MNV version (adjusted by a script) +MNVMAJOR = 9 +MNVMINOR = 2 -### Location of Vim files (should not need to be changed, and {{{1 +### Location of MNV files (should not need to be changed, and {{{1 ### some things might not work when they are changed!) -VIMDIR = /vim -VIMRTDIR = /vim$(VIMMAJOR)$(VIMMINOR) +MNVDIR = /mnv +MNVRTDIR = /mnv$(MNVMAJOR)$(MNVMINOR) HELPSUBDIR = /doc COLSUBDIR = /colors SYNSUBDIR = /syntax @@ -1009,10 +1009,10 @@ SPELLSUBDIR = /spell PRINTSUBDIR = /print PODIR = po -### VIMLOC common root of the Vim files (all versions) -### VIMRTLOC common root of the runtime Vim files (this version) -### VIMRCLOC compiled-in location for global [g]vimrc files (all versions) -### VIMRUNTIMEDIR compiled-in location for runtime files (optional) +### MNVLOC common root of the MNV files (all versions) +### MNVRTLOC common root of the runtime MNV files (this version) +### MNVRCLOC compiled-in location for global [g]mnvrc files (all versions) +### MNVRUNTIMEDIR compiled-in location for runtime files (optional) ### HELPSUBLOC location for help files ### COLSUBLOC location for colorscheme files ### SYNSUBLOC location for syntax files @@ -1030,71 +1030,71 @@ PODIR = po ### TUTORSUBLOC location for tutor files ### SPELLSUBLOC location for spell files ### PRINTSUBLOC location for PostScript files (prolog, latin1, ..) -### SCRIPTLOC location for script files (menu.vim, bugreport.vim, ..) +### SCRIPTLOC location for script files (menu.mnv, bugreport.mnv, ..) ### You can override these if you want to install them somewhere else. ### Edit feature.h for compile-time settings. -VIMLOC = $(DATADIR)$(VIMDIR) -VIMRTLOC = $(DATADIR)$(VIMDIR)$(VIMRTDIR) -VIMRCLOC = $(VIMLOC) -HELPSUBLOC = $(VIMRTLOC)$(HELPSUBDIR) -COLSUBLOC = $(VIMRTLOC)$(COLSUBDIR) -SYNSUBLOC = $(VIMRTLOC)$(SYNSUBDIR) -INDSUBLOC = $(VIMRTLOC)$(INDSUBDIR) -AUTOSUBLOC = $(VIMRTLOC)$(AUTOSUBDIR) -IMPORTSUBLOC = $(VIMRTLOC)$(IMPORTSUBDIR) -PLUGSUBLOC = $(VIMRTLOC)$(PLUGSUBDIR) -FTPLUGSUBLOC = $(VIMRTLOC)$(FTPLUGSUBDIR) -LANGSUBLOC = $(VIMRTLOC)$(LANGSUBDIR) -COMPSUBLOC = $(VIMRTLOC)$(COMPSUBDIR) -KMAPSUBLOC = $(VIMRTLOC)$(KMAPSUBDIR) -MACROSUBLOC = $(VIMRTLOC)$(MACROSUBDIR) -PACKSUBLOC = $(VIMRTLOC)$(PACKSUBDIR) -TOOLSSUBLOC = $(VIMRTLOC)$(TOOLSSUBDIR) -TUTORSUBLOC = $(VIMRTLOC)$(TUTORSUBDIR) -SPELLSUBLOC = $(VIMRTLOC)$(SPELLSUBDIR) -PRINTSUBLOC = $(VIMRTLOC)$(PRINTSUBDIR) -SCRIPTLOC = $(VIMRTLOC) - -### Only set VIMRUNTIMEDIR when VIMRTLOC is set to a different location and +MNVLOC = $(DATADIR)$(MNVDIR) +MNVRTLOC = $(DATADIR)$(MNVDIR)$(MNVRTDIR) +MNVRCLOC = $(MNVLOC) +HELPSUBLOC = $(MNVRTLOC)$(HELPSUBDIR) +COLSUBLOC = $(MNVRTLOC)$(COLSUBDIR) +SYNSUBLOC = $(MNVRTLOC)$(SYNSUBDIR) +INDSUBLOC = $(MNVRTLOC)$(INDSUBDIR) +AUTOSUBLOC = $(MNVRTLOC)$(AUTOSUBDIR) +IMPORTSUBLOC = $(MNVRTLOC)$(IMPORTSUBDIR) +PLUGSUBLOC = $(MNVRTLOC)$(PLUGSUBDIR) +FTPLUGSUBLOC = $(MNVRTLOC)$(FTPLUGSUBDIR) +LANGSUBLOC = $(MNVRTLOC)$(LANGSUBDIR) +COMPSUBLOC = $(MNVRTLOC)$(COMPSUBDIR) +KMAPSUBLOC = $(MNVRTLOC)$(KMAPSUBDIR) +MACROSUBLOC = $(MNVRTLOC)$(MACROSUBDIR) +PACKSUBLOC = $(MNVRTLOC)$(PACKSUBDIR) +TOOLSSUBLOC = $(MNVRTLOC)$(TOOLSSUBDIR) +TUTORSUBLOC = $(MNVRTLOC)$(TUTORSUBDIR) +SPELLSUBLOC = $(MNVRTLOC)$(SPELLSUBDIR) +PRINTSUBLOC = $(MNVRTLOC)$(PRINTSUBDIR) +SCRIPTLOC = $(MNVRTLOC) + +### Only set MNVRUNTIMEDIR when MNVRTLOC is set to a different location and ### the runtime directory is not below it. -#VIMRUNTIMEDIR = $(VIMRTLOC) +#MNVRUNTIMEDIR = $(MNVRTLOC) -### Name of the defaults/evim/mswin file target. -VIM_DEFAULTS_FILE = $(DESTDIR)$(SCRIPTLOC)/defaults.vim -EVIM_FILE = $(DESTDIR)$(SCRIPTLOC)/evim.vim -MSWIN_FILE = $(DESTDIR)$(SCRIPTLOC)/mswin.vim +### Name of the defaults/emnv/mswin file target. +MNV_DEFAULTS_FILE = $(DESTDIR)$(SCRIPTLOC)/defaults.mnv +EMNV_FILE = $(DESTDIR)$(SCRIPTLOC)/emnv.mnv +MSWIN_FILE = $(DESTDIR)$(SCRIPTLOC)/mswin.mnv ### Name of the menu file target. -SYS_MENU_FILE = $(DESTDIR)$(SCRIPTLOC)/menu.vim -SYS_SYNMENU_FILE = $(DESTDIR)$(SCRIPTLOC)/synmenu.vim -SYS_DELMENU_FILE = $(DESTDIR)$(SCRIPTLOC)/delmenu.vim +SYS_MENU_FILE = $(DESTDIR)$(SCRIPTLOC)/menu.mnv +SYS_SYNMENU_FILE = $(DESTDIR)$(SCRIPTLOC)/synmenu.mnv +SYS_DELMENU_FILE = $(DESTDIR)$(SCRIPTLOC)/delmenu.mnv ### Name of the bugreport file target. -SYS_BUGR_FILE = $(DESTDIR)$(SCRIPTLOC)/bugreport.vim +SYS_BUGR_FILE = $(DESTDIR)$(SCRIPTLOC)/bugreport.mnv ### Name of the file type detection file target. -SYS_FILETYPE_FILE = $(DESTDIR)$(SCRIPTLOC)/filetype.vim +SYS_FILETYPE_FILE = $(DESTDIR)$(SCRIPTLOC)/filetype.mnv ### Name of the file type detection file target. -SYS_FTOFF_FILE = $(DESTDIR)$(SCRIPTLOC)/ftoff.vim +SYS_FTOFF_FILE = $(DESTDIR)$(SCRIPTLOC)/ftoff.mnv ### Name of the file type detection script file target. -SYS_SCRIPTS_FILE = $(DESTDIR)$(SCRIPTLOC)/scripts.vim +SYS_SCRIPTS_FILE = $(DESTDIR)$(SCRIPTLOC)/scripts.mnv ### Name of the ftplugin-on file target. -SYS_FTPLUGIN_FILE = $(DESTDIR)$(SCRIPTLOC)/ftplugin.vim +SYS_FTPLUGIN_FILE = $(DESTDIR)$(SCRIPTLOC)/ftplugin.mnv ### Name of the ftplugin-off file target. -SYS_FTPLUGOF_FILE = $(DESTDIR)$(SCRIPTLOC)/ftplugof.vim +SYS_FTPLUGOF_FILE = $(DESTDIR)$(SCRIPTLOC)/ftplugof.mnv ### Name of the indent-on file target. -SYS_INDENT_FILE = $(DESTDIR)$(SCRIPTLOC)/indent.vim +SYS_INDENT_FILE = $(DESTDIR)$(SCRIPTLOC)/indent.mnv ### Name of the indent-off file target. -SYS_INDOFF_FILE = $(DESTDIR)$(SCRIPTLOC)/indoff.vim +SYS_INDOFF_FILE = $(DESTDIR)$(SCRIPTLOC)/indoff.mnv ### Name of the option window script file target. -SYS_OPTWIN_FILE = $(DESTDIR)$(SCRIPTLOC)/optwin.vim +SYS_OPTWIN_FILE = $(DESTDIR)$(SCRIPTLOC)/optwin.mnv # Program to install the program in the target directory. Could also be "mv". INSTALL_PROG = cp @@ -1119,8 +1119,8 @@ HELPMOD = 644 ### Permissions for Perl and shell scripts SCRIPTMOD = 755 -### Permission for Vim script files (menu.vim, bugreport.vim, ..) -VIMSCRIPTMOD = 644 +### Permission for MNV script files (menu.mnv, bugreport.mnv, ..) +MNVSCRIPTMOD = 644 ### Permissions for all directories that are created DIRMOD = 755 @@ -1185,11 +1185,11 @@ PRINTSOURCE = ../runtime/print # Where to look translated README and LICENSE files TRANSSOURCE = ../lang -# If you are using Linux, you might want to use this to make vim the -# default vi editor, it will create a link from vi to Vim when doing +# If you are using Linux, you might want to use this to make mnv the +# default vi editor, it will create a link from vi to MNV when doing # "make install". An existing file will be overwritten! # When not using it, some make programs can't handle an undefined $(LINKIT). -#LINKIT = ln -f -s $(DEST_BIN)/$(VIMTARGET) $(DESTDIR)/usr/bin/vi +#LINKIT = ln -f -s $(DEST_BIN)/$(MNVTARGET) $(DESTDIR)/usr/bin/vi LINKIT = @echo >/dev/null ### @@ -1400,8 +1400,8 @@ ALL_LIBS = \ # abbreviations DEST_BIN = $(DESTDIR)$(BINDIR) -DEST_VIM = $(DESTDIR)$(VIMLOC) -DEST_RT = $(DESTDIR)$(VIMRTLOC) +DEST_MNV = $(DESTDIR)$(MNVLOC) +DEST_RT = $(DESTDIR)$(MNVRTLOC) DEST_HELP = $(DESTDIR)$(HELPSUBLOC) DEST_COL = $(DESTDIR)$(COLSUBLOC) DEST_SYN = $(DESTDIR)$(SYNSUBLOC) @@ -1576,16 +1576,16 @@ BASIC_SRC = \ usercmd.c \ userfunc.c \ version.c \ - vim9class.c \ - vim9cmds.c \ - vim9compile.c \ - vim9execute.c \ - vim9expr.c \ - vim9generics.c \ - vim9instr.c \ - vim9script.c \ - vim9type.c \ - viminfo.c \ + mnv9class.c \ + mnv9cmds.c \ + mnv9compile.c \ + mnv9execute.c \ + mnv9expr.c \ + mnv9generics.c \ + mnv9instr.c \ + mnv9script.c \ + mnv9type.c \ + mnvinfo.c \ window.c \ bufwrite.c \ $(OS_EXTRA_SRC) @@ -1756,16 +1756,16 @@ OBJ_COMMON = \ objects/usercmd.o \ objects/userfunc.o \ objects/version.o \ - objects/vim9class.o \ - objects/vim9cmds.o \ - objects/vim9compile.o \ - objects/vim9execute.o \ - objects/vim9expr.o \ - objects/vim9generics.o \ - objects/vim9instr.o \ - objects/vim9script.o \ - objects/vim9type.o \ - objects/viminfo.o \ + objects/mnv9class.o \ + objects/mnv9cmds.o \ + objects/mnv9compile.o \ + objects/mnv9execute.o \ + objects/mnv9expr.o \ + objects/mnv9generics.o \ + objects/mnv9instr.o \ + objects/mnv9script.o \ + objects/mnv9type.o \ + objects/mnvinfo.o \ objects/window.o \ objects/bufwrite.o \ $(GUI_OBJ) \ @@ -1962,23 +1962,23 @@ PROTO_FILES = \ proto/usercmd.pro \ proto/userfunc.pro \ proto/version.pro \ - proto/vim9class.pro \ - proto/vim9cmds.pro \ - proto/vim9compile.pro \ - proto/vim9execute.pro \ - proto/vim9expr.pro \ - proto/vim9generics.pro \ - proto/vim9instr.pro \ - proto/vim9script.pro \ - proto/vim9type.pro \ - proto/viminfo.pro \ + proto/mnv9class.pro \ + proto/mnv9cmds.pro \ + proto/mnv9compile.pro \ + proto/mnv9execute.pro \ + proto/mnv9expr.pro \ + proto/mnv9generics.pro \ + proto/mnv9instr.pro \ + proto/mnv9script.pro \ + proto/mnv9type.pro \ + proto/mnvinfo.pro \ proto/wayland.pro \ proto/winclip.pro \ proto/window.pro \ $(ALL_GUI_PRO) # Default target is making the executable and tools -all: $(VIMTARGET) $(TOOLS) languages $(GUI_BUNDLE) +all: $(MNVTARGET) $(TOOLS) languages $(GUI_BUNDLE) tools: $(TOOLS) @@ -2052,24 +2052,24 @@ autoconf: -rm -rf autom4te.cache -rm -f auto/config.status auto/config.cache -# Run Vim script to generate the Ex command lookup table. +# Run MNV script to generate the Ex command lookup table. # This only needs to be run when a command name has been added or changed. -# If this fails because you don't have Vim yet, first build and install Vim +# If this fails because you don't have MNV yet, first build and install MNV # without changes. -# This requires a "vim" executable with the +eval feature. +# This requires a "mnv" executable with the +eval feature. cmdidxs: ex_cmds.h - vim --clean -X --not-a-term -S create_cmdidxs.vim -c quit + mnv --clean -X --not-a-term -S create_cmdidxs.mnv -c quit -# Run Vim script to generate the normal/visual mode command lookup table. +# Run MNV script to generate the normal/visual mode command lookup table. # This only needs to be run when a new normal/visual mode command has been # added. -# This requires a "vim" executable with the +eval feature. -# If this fails because you don't have Vim yet: +# This requires a "mnv" executable with the +eval feature. +# If this fails because you don't have MNV yet: # - change nv_cmds[] in nv_cmds.h to add the new normal/visual mode command. # - run "make nvcmdidxs" to generate nv_cmdidxs.h nvcmdidxs: auto/config.mk nv_cmds.h $(CC) -I$(srcdir) $(ALL_CFLAGS) create_nvcmdidxs.c -o create_nvcmdidxs - vim --clean -X --not-a-term -S create_nvcmdidxs.vim -c quit + mnv --clean -X --not-a-term -S create_nvcmdidxs.mnv -c quit -rm -f create_nvcmdidxs # The normal command to compile a .c file to its .o file. @@ -2080,12 +2080,12 @@ CCC = $(CCC_NF) $(ALL_CFLAGS) # Link the target for normal use or debugging. # A shell script is used to try linking without unnecessary libraries. -$(VIMTARGET): auto/config.mk $(OBJ) objects/version.o +$(MNVTARGET): auto/config.mk $(OBJ) objects/version.o @$(BUILD_DATE_MSG) @LINK="$(PURIFY) $(SHRPENV) $(CClink) $(ALL_LIB_DIRS) $(LDFLAGS) \ - -o $(VIMTARGET) $(OBJ) $(ALL_LIBS)" \ + -o $(MNVTARGET) $(OBJ) $(ALL_LIBS)" \ MAKE="$(MAKE)" LINK_AS_NEEDED=$(LINK_AS_NEEDED) \ - PROG="vim" \ + PROG="mnv" \ sh $(srcdir)/link.sh xxd/xxd$(EXEEXT): xxd/xxd.c @@ -2174,8 +2174,8 @@ cscope.out: cscope: csclean cscope.out ; # Make a highlight file for types. Requires Exuberant ctags and awk -types: types.vim -types.vim: $(TAGS_FILES) +types: types.mnv +types.mnv: $(TAGS_FILES) ctags --c-kinds=gstu -o- $(TAGS_FILES) |\ awk 'BEGIN{printf("syntax keyword Type\t")}\ {printf("%s ", $$1)}END{print ""}' > $@ @@ -2187,8 +2187,8 @@ types.vim: $(TAGS_FILES) # Do the scripttests first, so that the summary shows last. test check: unittests $(TERM_TEST) scripttests -# Execute the test scripts. Run these after compiling Vim, before installing. -# This doesn't depend on $(VIMTARGET), because that won't work when configure +# Execute the test scripts. Run these after compiling MNV, before installing. +# This doesn't depend on $(MNVTARGET), because that won't work when configure # wasn't run yet. Restart make to build it instead. # # This will produce a lot of garbage on your screen, including a few error @@ -2197,34 +2197,34 @@ test check: unittests $(TERM_TEST) scripttests # get "TEST FAILURE". # scripttests: - $(MAKE) -f Makefile $(VIMTARGET) + $(MAKE) -f Makefile $(MNVTARGET) if test -n "$(MAKEMO)" -a -f $(PODIR)/Makefile; then \ - cd $(PODIR); $(MAKE) -f Makefile check VIMPROG=../$(VIMTARGET); \ + cd $(PODIR); $(MAKE) -f Makefile check MNVPROG=../$(MNVTARGET); \ fi - -if test $(VIMTARGET) != vim -a ! -r vim; then \ - ln -s $(VIMTARGET) vim; \ + -if test $(MNVTARGET) != mnv -a ! -r mnv; then \ + ln -s $(MNVTARGET) mnv; \ fi - cd testdir; $(MAKE) -f Makefile $(GUI_TESTTARGET) VIMPROG=../$(VIMTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) + cd testdir; $(MAKE) -f Makefile $(GUI_TESTTARGET) MNVPROG=../$(MNVTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) -# Run the tests with the GUI. Assumes vim/gvim was already built +# Run the tests with the GUI. Assumes mnv/gmnv was already built testgui: - cd testdir; $(MAKE) -f Makefile $(GUI_TESTTARGET) VIMPROG=../$(VIMTARGET) GUI_FLAG=-g $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) + cd testdir; $(MAKE) -f Makefile $(GUI_TESTTARGET) MNVPROG=../$(MNVTARGET) GUI_FLAG=-g $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) testtiny: - cd testdir; $(MAKE) -f Makefile tiny VIMPROG=../$(VIMTARGET) SCRIPTSOURCE=../$(SCRIPTSOURCE) + cd testdir; $(MAKE) -f Makefile tiny MNVPROG=../$(MNVTARGET) SCRIPTSOURCE=../$(SCRIPTSOURCE) # Run benchmarks. benchmark: cd testdir; \ $(MAKE) -f Makefile benchmarkclean; \ - $(MAKE) -f Makefile benchmark VIMPROG=../$(VIMTARGET) SCRIPTSOURCE=../$(SCRIPTSOURCE) + $(MAKE) -f Makefile benchmark MNVPROG=../$(MNVTARGET) SCRIPTSOURCE=../$(SCRIPTSOURCE) unittesttargets: $(MAKE) -f Makefile $(UNITTEST_TARGETS) -# Swap these lines to run individual tests with gvim instead of vim. -VIMTESTTARGET = $(VIMTARGET) -# VIMTESTTARGET = $(GVIMTARGET) +# Swap these lines to run individual tests with gmnv instead of mnv. +MNVTESTTARGET = $(MNVTARGET) +# MNVTESTTARGET = $(GMNVTARGET) # Execute the unittests one by one. unittest unittests: $(RUN_UNITTESTS) @@ -2254,7 +2254,7 @@ test_libvterm: # Run individual OLD style test. # These do not depend on the executable, compile it when needed. $(SCRIPTS_TINY): - cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) + cd testdir; rm -f $@.out; $(MAKE) -f Makefile $@.out MNVPROG=../$(MNVTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) # Run individual NEW style test. # These do not depend on the executable, compile it when needed. @@ -2262,11 +2262,11 @@ $(SCRIPTS_TINY): # export TEST_FILTER=Test_terminal_wipe_buffer # A partial match also works: # export TEST_FILTER=wipe_buffer -$(NEW_TESTS) test_vim9: - cd testdir; $(MAKE) $@ VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) +$(NEW_TESTS) test_mnv9: + cd testdir; $(MAKE) $@ MNVPROG=../$(MNVTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) newtests: - cd testdir; rm -f $@.res test.log messages; $(MAKE) -f Makefile newtestssilent VIMPROG=../$(VIMTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) + cd testdir; rm -f $@.res test.log messages; $(MAKE) -f Makefile newtestssilent MNVPROG=../$(MNVTESTTARGET) $(GUI_TESTARG) SCRIPTSOURCE=../$(SCRIPTSOURCE) @if test -f testdir/test.log; then \ cat testdir/test.log; \ fi @@ -2279,7 +2279,7 @@ testclean: fi # Unittests -# It's build just like Vim to satisfy all dependencies. +# It's build just like MNV to satisfy all dependencies. $(JSON_TEST_TARGET): auto/config.mk $(JSON_TEST_OBJ) objects/version.o @LINK="$(PURIFY) $(SHRPENV) $(CClink) $(ALL_LIB_DIRS) $(LDFLAGS) \ -o $(JSON_TEST_TARGET) $(JSON_TEST_OBJ) $(ALL_LIBS)" \ @@ -2312,11 +2312,11 @@ $(MESSAGE_TEST_TARGET): auto/config.mk $(MESSAGE_TEST_OBJ) objects/version.o install: $(GUI_INSTALL) -install_normal: installvim installtools $(INSTALL_LANGS) install-icons +install_normal: installmnv installtools $(INSTALL_LANGS) install-icons install_gui_extra: installgtutorbin -installvim: installvimbin installtutorbin \ +installmnv: installmnvbin installtutorbin \ installruntime installlinks installmanlinks # @@ -2328,28 +2328,28 @@ installvim: installvimbin installtutorbin \ # If you want to keep an older version, rename it before running "make # install". # -installvimbin: $(VIMTARGET) $(DESTDIR)$(exec_prefix) $(DEST_BIN) - -if test -f $(DEST_BIN)/$(VIMTARGET); then \ - mv -f $(DEST_BIN)/$(VIMTARGET) $(DEST_BIN)/$(VIMNAME).rm; \ - rm -f $(DEST_BIN)/$(VIMNAME).rm; \ +installmnvbin: $(MNVTARGET) $(DESTDIR)$(exec_prefix) $(DEST_BIN) + -if test -f $(DEST_BIN)/$(MNVTARGET); then \ + mv -f $(DEST_BIN)/$(MNVTARGET) $(DEST_BIN)/$(MNVNAME).rm; \ + rm -f $(DEST_BIN)/$(MNVNAME).rm; \ fi - $(INSTALL_PROG) $(VIMTARGET) $(DEST_BIN) - $(STRIP) $(DEST_BIN)/$(VIMTARGET) - chmod $(BINMOD) $(DEST_BIN)/$(VIMTARGET) + $(INSTALL_PROG) $(MNVTARGET) $(DEST_BIN) + $(STRIP) $(DEST_BIN)/$(MNVTARGET) + chmod $(BINMOD) $(DEST_BIN)/$(MNVTARGET) # may create a link to the new executable from /usr/bin/vi -$(LINKIT) # Long list of arguments for the shell script that installs the manual pages # for one language. -INSTALLMANARGS = $(VIMLOC) $(SCRIPTLOC) $(VIMRCLOC) $(HELPSOURCE) $(MANMOD) \ - $(VIMNAME) $(VIMDIFFNAME) $(EVIMNAME) +INSTALLMANARGS = $(MNVLOC) $(SCRIPTLOC) $(MNVRCLOC) $(HELPSOURCE) $(MANMOD) \ + $(MNVNAME) $(MNVDIFFNAME) $(EMNVNAME) # Install most of the runtime files installruntime: installrtbase installmacros installpack installtutor installspell # Install the help files; first adjust the contents for the final location. # Also install most of the other runtime files. -installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(VIMTARGET) $(DEST_RT) \ +installrtbase: $(HELPSOURCE)/mnv.1 $(DEST_MNV) $(MNVTARGET) $(DEST_RT) \ $(DEST_HELP) $(DEST_PRINT) $(DEST_COL) \ $(DEST_SYN) $(DEST_SYN)/modula2 $(DEST_SYN)/modula2/opt $(DEST_SYN)/shared \ $(DEST_IND) $(DEST_FTP) \ @@ -2368,7 +2368,7 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(VIMTARGET) $(DEST_RT) \ mv -f tags tags.dist; fi @echo generating help tags -@BUILD_DIR=`pwd`; cd $(HELPSOURCE); if test -z "$(CROSS_COMPILING)"; then \ - $(MAKE) VIMPROG="$$BUILD_DIR/$(VIMTARGET)" vimtags; fi + $(MAKE) MNVPROG="$$BUILD_DIR/$(MNVTARGET)" mnvtags; fi cd $(HELPSOURCE); \ files=`ls *.txt tags`; \ files="$$files `ls *.??x tags-?? 2>/dev/null || true`"; \ @@ -2379,47 +2379,47 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(VIMTARGET) $(DEST_RT) \ chmod $(SCRIPTMOD) $(DEST_HELP)/*.pl cd $(HELPSOURCE); if test -f tags.dist; then mv -f tags.dist tags; fi # install the menu files - $(INSTALL_DATA) $(SCRIPTSOURCE)/menu.vim $(SYS_MENU_FILE) - chmod $(VIMSCRIPTMOD) $(SYS_MENU_FILE) - $(INSTALL_DATA) $(SCRIPTSOURCE)/synmenu.vim $(SYS_SYNMENU_FILE) - chmod $(VIMSCRIPTMOD) $(SYS_SYNMENU_FILE) - $(INSTALL_DATA) $(SCRIPTSOURCE)/delmenu.vim $(SYS_DELMENU_FILE) - chmod $(VIMSCRIPTMOD) $(SYS_DELMENU_FILE) -# install the defaults/evim/mswin file - $(INSTALL_DATA) $(SCRIPTSOURCE)/defaults.vim $(VIM_DEFAULTS_FILE) - chmod $(VIMSCRIPTMOD) $(VIM_DEFAULTS_FILE) - $(INSTALL_DATA) $(SCRIPTSOURCE)/evim.vim $(EVIM_FILE) - chmod $(VIMSCRIPTMOD) $(EVIM_FILE) - $(INSTALL_DATA) $(SCRIPTSOURCE)/mswin.vim $(MSWIN_FILE) - chmod $(VIMSCRIPTMOD) $(MSWIN_FILE) + $(INSTALL_DATA) $(SCRIPTSOURCE)/menu.mnv $(SYS_MENU_FILE) + chmod $(MNVSCRIPTMOD) $(SYS_MENU_FILE) + $(INSTALL_DATA) $(SCRIPTSOURCE)/synmenu.mnv $(SYS_SYNMENU_FILE) + chmod $(MNVSCRIPTMOD) $(SYS_SYNMENU_FILE) + $(INSTALL_DATA) $(SCRIPTSOURCE)/delmenu.mnv $(SYS_DELMENU_FILE) + chmod $(MNVSCRIPTMOD) $(SYS_DELMENU_FILE) +# install the defaults/emnv/mswin file + $(INSTALL_DATA) $(SCRIPTSOURCE)/defaults.mnv $(MNV_DEFAULTS_FILE) + chmod $(MNVSCRIPTMOD) $(MNV_DEFAULTS_FILE) + $(INSTALL_DATA) $(SCRIPTSOURCE)/emnv.mnv $(EMNV_FILE) + chmod $(MNVSCRIPTMOD) $(EMNV_FILE) + $(INSTALL_DATA) $(SCRIPTSOURCE)/mswin.mnv $(MSWIN_FILE) + chmod $(MNVSCRIPTMOD) $(MSWIN_FILE) # install the bugreport file - $(INSTALL_DATA) $(SCRIPTSOURCE)/bugreport.vim $(SYS_BUGR_FILE) - chmod $(VIMSCRIPTMOD) $(SYS_BUGR_FILE) -# install the example vimrc files - $(INSTALL_DATA) $(SCRIPTSOURCE)/vimrc_example.vim $(DEST_SCRIPT) - chmod $(VIMSCRIPTMOD) $(DEST_SCRIPT)/vimrc_example.vim - $(INSTALL_DATA) $(SCRIPTSOURCE)/gvimrc_example.vim $(DEST_SCRIPT) - chmod $(VIMSCRIPTMOD) $(DEST_SCRIPT)/gvimrc_example.vim + $(INSTALL_DATA) $(SCRIPTSOURCE)/bugreport.mnv $(SYS_BUGR_FILE) + chmod $(MNVSCRIPTMOD) $(SYS_BUGR_FILE) +# install the example mnvrc files + $(INSTALL_DATA) $(SCRIPTSOURCE)/mnvrc_example.mnv $(DEST_SCRIPT) + chmod $(MNVSCRIPTMOD) $(DEST_SCRIPT)/mnvrc_example.mnv + $(INSTALL_DATA) $(SCRIPTSOURCE)/gmnvrc_example.mnv $(DEST_SCRIPT) + chmod $(MNVSCRIPTMOD) $(DEST_SCRIPT)/gmnvrc_example.mnv # install the xdg file - $(INSTALL_DATA) $(SCRIPTSOURCE)/xdg.vim $(DEST_SCRIPT) - chmod $(VIMSCRIPTMOD) $(DEST_SCRIPT)/xdg.vim + $(INSTALL_DATA) $(SCRIPTSOURCE)/xdg.mnv $(DEST_SCRIPT) + chmod $(MNVSCRIPTMOD) $(DEST_SCRIPT)/xdg.mnv # install the file type detection files - $(INSTALL_DATA) $(SCRIPTSOURCE)/filetype.vim $(SYS_FILETYPE_FILE) - chmod $(VIMSCRIPTMOD) $(SYS_FILETYPE_FILE) - $(INSTALL_DATA) $(SCRIPTSOURCE)/ftoff.vim $(SYS_FTOFF_FILE) - chmod $(VIMSCRIPTMOD) $(SYS_FTOFF_FILE) - $(INSTALL_DATA) $(SCRIPTSOURCE)/scripts.vim $(SYS_SCRIPTS_FILE) - chmod $(VIMSCRIPTMOD) $(SYS_SCRIPTS_FILE) - $(INSTALL_DATA) $(SCRIPTSOURCE)/ftplugin.vim $(SYS_FTPLUGIN_FILE) - chmod $(VIMSCRIPTMOD) $(SYS_FTPLUGIN_FILE) - $(INSTALL_DATA) $(SCRIPTSOURCE)/ftplugof.vim $(SYS_FTPLUGOF_FILE) - chmod $(VIMSCRIPTMOD) $(SYS_FTPLUGOF_FILE) - $(INSTALL_DATA) $(SCRIPTSOURCE)/indent.vim $(SYS_INDENT_FILE) - chmod $(VIMSCRIPTMOD) $(SYS_INDENT_FILE) - $(INSTALL_DATA) $(SCRIPTSOURCE)/indoff.vim $(SYS_INDOFF_FILE) - chmod $(VIMSCRIPTMOD) $(SYS_INDOFF_FILE) - $(INSTALL_DATA) $(SCRIPTSOURCE)/optwin.vim $(SYS_OPTWIN_FILE) - chmod $(VIMSCRIPTMOD) $(SYS_OPTWIN_FILE) + $(INSTALL_DATA) $(SCRIPTSOURCE)/filetype.mnv $(SYS_FILETYPE_FILE) + chmod $(MNVSCRIPTMOD) $(SYS_FILETYPE_FILE) + $(INSTALL_DATA) $(SCRIPTSOURCE)/ftoff.mnv $(SYS_FTOFF_FILE) + chmod $(MNVSCRIPTMOD) $(SYS_FTOFF_FILE) + $(INSTALL_DATA) $(SCRIPTSOURCE)/scripts.mnv $(SYS_SCRIPTS_FILE) + chmod $(MNVSCRIPTMOD) $(SYS_SCRIPTS_FILE) + $(INSTALL_DATA) $(SCRIPTSOURCE)/ftplugin.mnv $(SYS_FTPLUGIN_FILE) + chmod $(MNVSCRIPTMOD) $(SYS_FTPLUGIN_FILE) + $(INSTALL_DATA) $(SCRIPTSOURCE)/ftplugof.mnv $(SYS_FTPLUGOF_FILE) + chmod $(MNVSCRIPTMOD) $(SYS_FTPLUGOF_FILE) + $(INSTALL_DATA) $(SCRIPTSOURCE)/indent.mnv $(SYS_INDENT_FILE) + chmod $(MNVSCRIPTMOD) $(SYS_INDENT_FILE) + $(INSTALL_DATA) $(SCRIPTSOURCE)/indoff.mnv $(SYS_INDOFF_FILE) + chmod $(MNVSCRIPTMOD) $(SYS_INDOFF_FILE) + $(INSTALL_DATA) $(SCRIPTSOURCE)/optwin.mnv $(SYS_OPTWIN_FILE) + chmod $(MNVSCRIPTMOD) $(SYS_OPTWIN_FILE) # install README and LICENCE files $(INSTALL_DATA) ../README.txt $(DEST_RT) chmod $(HELPMOD) $(DEST_RT)/README.txt @@ -2429,45 +2429,45 @@ installrtbase: $(HELPSOURCE)/vim.1 $(DEST_VIM) $(VIMTARGET) $(DEST_RT) \ cd $(PRINTSOURCE); $(INSTALL_DATA) *.ps $(DEST_PRINT) cd $(DEST_PRINT); chmod $(FILEMOD) *.ps # install the colorscheme files - cd $(COLSOURCE); $(INSTALL_DATA_R) *.vim lists tools README.txt $(DEST_COL) + cd $(COLSOURCE); $(INSTALL_DATA_R) *.mnv lists tools README.txt $(DEST_COL) cd $(DEST_COL); chmod $(DIRMOD) lists tools - cd $(DEST_COL); chmod $(HELPMOD) *.vim README.txt lists/*.vim tools/*.vim + cd $(DEST_COL); chmod $(HELPMOD) *.mnv README.txt lists/*.mnv tools/*.mnv # install the syntax files - cd $(SYNSOURCE); $(INSTALL_DATA) *.vim README.txt $(DEST_SYN) - cd $(DEST_SYN); chmod $(HELPMOD) *.vim README.txt - cd $(SYNSOURCE)/shared; $(INSTALL_DATA) *.vim README.txt $(DEST_SYN)/shared - cd $(DEST_SYN)/shared; chmod $(HELPMOD) *.vim README.txt - cd $(SYNSOURCE)/modula2/opt; $(INSTALL_DATA) *.vim $(DEST_SYN)/modula2/opt - cd $(DEST_SYN)/modula2/opt; chmod $(HELPMOD) *.vim + cd $(SYNSOURCE); $(INSTALL_DATA) *.mnv README.txt $(DEST_SYN) + cd $(DEST_SYN); chmod $(HELPMOD) *.mnv README.txt + cd $(SYNSOURCE)/shared; $(INSTALL_DATA) *.mnv README.txt $(DEST_SYN)/shared + cd $(DEST_SYN)/shared; chmod $(HELPMOD) *.mnv README.txt + cd $(SYNSOURCE)/modula2/opt; $(INSTALL_DATA) *.mnv $(DEST_SYN)/modula2/opt + cd $(DEST_SYN)/modula2/opt; chmod $(HELPMOD) *.mnv # install the indent files - cd $(INDSOURCE); $(INSTALL_DATA) *.vim README.txt $(DEST_IND) - cd $(DEST_IND); chmod $(HELPMOD) *.vim README.txt + cd $(INDSOURCE); $(INSTALL_DATA) *.mnv README.txt $(DEST_IND) + cd $(DEST_IND); chmod $(HELPMOD) *.mnv README.txt # install the standard autoload files - cd $(AUTOSOURCE); $(INSTALL_DATA) *.vim README.txt $(DEST_AUTO) - cd $(DEST_AUTO); chmod $(HELPMOD) *.vim README.txt - cd $(AUTOSOURCE)/dist; $(INSTALL_DATA) *.vim $(DEST_AUTO)/dist - cd $(DEST_AUTO)/dist; chmod $(HELPMOD) *.vim - cd $(AUTOSOURCE)/xml; $(INSTALL_DATA) *.vim $(DEST_AUTO)/xml - cd $(DEST_AUTO)/xml; chmod $(HELPMOD) *.vim - cd $(AUTOSOURCE)/cargo; $(INSTALL_DATA) *.vim $(DEST_AUTO)/cargo - cd $(DEST_AUTO)/cargo; chmod $(HELPMOD) *.vim - cd $(AUTOSOURCE)/rust; $(INSTALL_DATA) *.vim $(DEST_AUTO)/rust - cd $(DEST_AUTO)/rust; chmod $(HELPMOD) *.vim + cd $(AUTOSOURCE); $(INSTALL_DATA) *.mnv README.txt $(DEST_AUTO) + cd $(DEST_AUTO); chmod $(HELPMOD) *.mnv README.txt + cd $(AUTOSOURCE)/dist; $(INSTALL_DATA) *.mnv $(DEST_AUTO)/dist + cd $(DEST_AUTO)/dist; chmod $(HELPMOD) *.mnv + cd $(AUTOSOURCE)/xml; $(INSTALL_DATA) *.mnv $(DEST_AUTO)/xml + cd $(DEST_AUTO)/xml; chmod $(HELPMOD) *.mnv + cd $(AUTOSOURCE)/cargo; $(INSTALL_DATA) *.mnv $(DEST_AUTO)/cargo + cd $(DEST_AUTO)/cargo; chmod $(HELPMOD) *.mnv + cd $(AUTOSOURCE)/rust; $(INSTALL_DATA) *.mnv $(DEST_AUTO)/rust + cd $(DEST_AUTO)/rust; chmod $(HELPMOD) *.mnv # install the standard import files - cd $(IMPORTSOURCE)/dist; $(INSTALL_DATA) *.vim $(DEST_IMPORT)/dist - cd $(DEST_IMPORT)/dist; chmod $(HELPMOD) *.vim + cd $(IMPORTSOURCE)/dist; $(INSTALL_DATA) *.mnv $(DEST_IMPORT)/dist + cd $(DEST_IMPORT)/dist; chmod $(HELPMOD) *.mnv # install the standard plugin files, but first remove existing ones - -rm -f $(DEST_PLUG)/*.vim - cd $(PLUGSOURCE); $(INSTALL_DATA) *.vim README.txt $(DEST_PLUG) - cd $(DEST_PLUG); chmod $(HELPMOD) *.vim README.txt + -rm -f $(DEST_PLUG)/*.mnv + cd $(PLUGSOURCE); $(INSTALL_DATA) *.mnv README.txt $(DEST_PLUG) + cd $(DEST_PLUG); chmod $(HELPMOD) *.mnv README.txt # install the ftplugin files - cd $(FTPLUGSOURCE); $(INSTALL_DATA) *.vim README.txt logtalk.dict $(DEST_FTP) - cd $(DEST_FTP); chmod $(HELPMOD) *.vim README.txt logtalk.dict + cd $(FTPLUGSOURCE); $(INSTALL_DATA) *.mnv README.txt logtalk.dict $(DEST_FTP) + cd $(DEST_FTP); chmod $(HELPMOD) *.mnv README.txt logtalk.dict # install the compiler files - cd $(COMPSOURCE); $(INSTALL_DATA) *.vim README.txt $(DEST_COMP) - cd $(DEST_COMP); chmod $(HELPMOD) *.vim README.txt + cd $(COMPSOURCE); $(INSTALL_DATA) *.mnv README.txt $(DEST_COMP) + cd $(DEST_COMP); chmod $(HELPMOD) *.mnv README.txt -installmacros: $(DEST_VIM) $(DEST_RT) $(DEST_MACRO) +installmacros: $(DEST_MNV) $(DEST_RT) $(DEST_MACRO) $(INSTALL_DATA_R) $(MACROSOURCE)/* $(DEST_MACRO) chmod $(DIRMOD) `find $(DEST_MACRO) -type d -print` chmod $(FILEMOD) `find $(DEST_MACRO) -type f -print` @@ -2479,19 +2479,19 @@ installmacros: $(DEST_VIM) $(DEST_RT) $(DEST_MACRO) rm -rf $$cvs; \ fi -installpack: $(DEST_VIM) $(DEST_RT) $(DEST_PACK) +installpack: $(DEST_MNV) $(DEST_RT) $(DEST_PACK) $(INSTALL_DATA_R) $(PACKSOURCE)/* $(DEST_PACK) chmod $(DIRMOD) `find $(DEST_PACK) -type d -print` chmod $(FILEMOD) `find $(DEST_PACK) -type f -print` # install the tutor files installtutorbin: $(DEST_BIN) - $(INSTALL_DATA) vimtutor $(DEST_BIN)/$(VIMNAME)tutor - chmod $(SCRIPTMOD) $(DEST_BIN)/$(VIMNAME)tutor + $(INSTALL_DATA) mnvtutor $(DEST_BIN)/$(MNVNAME)tutor + chmod $(SCRIPTMOD) $(DEST_BIN)/$(MNVNAME)tutor installgtutorbin: $(DEST_BIN) - $(INSTALL_DATA) gvimtutor $(DEST_BIN)/$(GVIMNAME)tutor - chmod $(SCRIPTMOD) $(DEST_BIN)/$(GVIMNAME)tutor + $(INSTALL_DATA) gmnvtutor $(DEST_BIN)/$(GMNVNAME)tutor + chmod $(SCRIPTMOD) $(DEST_BIN)/$(GMNVNAME)tutor installtutor: $(DEST_RT) $(DEST_TUTOR)/en $(DEST_TUTOR)/it $(DEST_TUTOR)/sr $(DEST_TUTOR)/sv $(DEST_TUTOR)/ru -$(INSTALL_DATA) $(TUTORSOURCE)/README* $(TUTORSOURCE)/tutor* $(DEST_TUTOR) @@ -2510,15 +2510,15 @@ installtutor: $(DEST_RT) $(DEST_TUTOR)/en $(DEST_TUTOR)/it $(DEST_TUTOR)/sr $(DE # Install the spell files, if they exist. This assumes at least the English # spell file is there. -installspell: $(DEST_VIM) $(DEST_RT) $(DEST_SPELL) +installspell: $(DEST_MNV) $(DEST_RT) $(DEST_SPELL) if test -f $(SPELLSOURCE)/en.latin1.spl; then \ - $(INSTALL_DATA) $(SPELLSOURCE)/*.spl $(SPELLSOURCE)/*.sug $(SPELLSOURCE)/*.vim $(DEST_SPELL); \ - chmod $(HELPMOD) $(DEST_SPELL)/*.spl $(DEST_SPELL)/*.sug $(DEST_SPELL)/*.vim; \ + $(INSTALL_DATA) $(SPELLSOURCE)/*.spl $(SPELLSOURCE)/*.sug $(SPELLSOURCE)/*.mnv $(DEST_SPELL); \ + chmod $(HELPMOD) $(DEST_SPELL)/*.spl $(DEST_SPELL)/*.sug $(DEST_SPELL)/*.mnv; \ fi # install helper program xxd installtools: $(TOOLS) $(DESTDIR)$(exec_prefix) $(DEST_BIN) \ - $(TOOLSSOURCE) $(DEST_VIM) $(DEST_RT) $(DEST_TOOLS) \ + $(TOOLSSOURCE) $(DEST_MNV) $(DEST_RT) $(DEST_TOOLS) \ $(INSTALL_TOOL_LANGS) if test -f $(DEST_BIN)/xxd$(EXEEXT); then \ mv -f $(DEST_BIN)/xxd$(EXEEXT) $(DEST_BIN)/xxd.rm; \ @@ -2651,12 +2651,12 @@ install-languages: languages $(DEST_LANG) $(DEST_KMAP) $(DEST_RT) INSTALL_DATA=$(INSTALL_DATA) FILEMOD=$(FILEMOD) install; \ fi if test -d $(LANGSOURCE); then \ - $(INSTALL_DATA) $(LANGSOURCE)/README.txt $(LANGSOURCE)/*.vim $(DEST_LANG); \ - chmod $(FILEMOD) $(DEST_LANG)/README.txt $(DEST_LANG)/*.vim; \ + $(INSTALL_DATA) $(LANGSOURCE)/README.txt $(LANGSOURCE)/*.mnv $(DEST_LANG); \ + chmod $(FILEMOD) $(DEST_LANG)/README.txt $(DEST_LANG)/*.mnv; \ fi if test -d $(KMAPSOURCE); then \ - $(INSTALL_DATA) $(KMAPSOURCE)/README.txt $(KMAPSOURCE)/*.vim $(DEST_KMAP); \ - chmod $(FILEMOD) $(DEST_KMAP)/README.txt $(DEST_KMAP)/*.vim; \ + $(INSTALL_DATA) $(KMAPSOURCE)/README.txt $(KMAPSOURCE)/*.mnv $(DEST_KMAP); \ + chmod $(FILEMOD) $(DEST_KMAP)/README.txt $(DEST_KMAP)/*.mnv; \ fi # Installing translated README and LICENSE files if test -d $(TRANSSOURCE) ; then \ @@ -2697,8 +2697,8 @@ install-icons: fi if test -d $(ICON48PATH) -a -w $(ICON48PATH) \ - -a ! -f $(ICON48PATH)/gvim.png; then \ - $(INSTALL_DATA) $(SCRIPTSOURCE)/vim48x48.png $(ICON48PATH)/gvim.png; \ + -a ! -f $(ICON48PATH)/gmnv.png; then \ + $(INSTALL_DATA) $(SCRIPTSOURCE)/mnv48x48.png $(ICON48PATH)/gmnv.png; \ if test -z "$(DESTDIR)" -a -x "$(GTK_UPDATE_ICON_CACHE)" \ -a -w $(ICONTHEMEPATH) \ -a -f $(ICONTHEMEPATH)/index.theme; then \ @@ -2706,20 +2706,20 @@ install-icons: fi \ fi if test -d $(ICON32PATH) -a -w $(ICON32PATH) \ - -a ! -f $(ICON32PATH)/gvim.png; then \ - $(INSTALL_DATA) $(SCRIPTSOURCE)/vim32x32.png $(ICON32PATH)/gvim.png; \ + -a ! -f $(ICON32PATH)/gmnv.png; then \ + $(INSTALL_DATA) $(SCRIPTSOURCE)/mnv32x32.png $(ICON32PATH)/gmnv.png; \ fi if test -d $(ICON16PATH) -a -w $(ICON16PATH) \ - -a ! -f $(ICON16PATH)/gvim.png; then \ - $(INSTALL_DATA) $(SCRIPTSOURCE)/vim16x16.png $(ICON16PATH)/gvim.png; \ + -a ! -f $(ICON16PATH)/gmnv.png; then \ + $(INSTALL_DATA) $(SCRIPTSOURCE)/mnv16x16.png $(ICON16PATH)/gmnv.png; \ fi if test -d $(DESKTOPPATH) -a -w $(DESKTOPPATH); then \ - if test -f po/vim.desktop -a -f po/gvim.desktop; then \ - $(INSTALL_DATA) po/vim.desktop po/gvim.desktop \ + if test -f po/mnv.desktop -a -f po/gmnv.desktop; then \ + $(INSTALL_DATA) po/mnv.desktop po/gmnv.desktop \ $(DESKTOPPATH); \ else \ - $(INSTALL_DATA) $(SCRIPTSOURCE)/vim.desktop \ - $(SCRIPTSOURCE)/gvim.desktop \ + $(INSTALL_DATA) $(SCRIPTSOURCE)/mnv.desktop \ + $(SCRIPTSOURCE)/gmnv.desktop \ $(DESKTOPPATH); \ fi; \ if test -z "$(DESTDIR)" -a -x "$(UPDATE_DESKTOP_DATABASE)"; then \ @@ -2727,13 +2727,13 @@ install-icons: fi \ fi -$(HELPSOURCE)/vim.1 $(MACROSOURCE) $(TOOLSSOURCE): +$(HELPSOURCE)/mnv.1 $(MACROSOURCE) $(TOOLSSOURCE): @echo Runtime files not found. @echo You need to unpack the runtime archive before running "make install". test -f error $(DESTDIR)$(exec_prefix) $(DEST_BIN) \ - $(DEST_VIM) $(DEST_RT) $(DEST_HELP) \ + $(DEST_MNV) $(DEST_RT) $(DEST_HELP) \ $(DEST_PRINT) $(DEST_COL) $(DEST_SYN) $(DEST_SYN)/shared \ $(DEST_SYN)/modula2 $(DEST_SYN)/modula2/opt \ $(DEST_IND) $(DEST_FTP) \ @@ -2748,84 +2748,84 @@ $(DESTDIR)$(exec_prefix) $(DEST_BIN) \ $(MKDIR_P) $@ -chmod $(DIRMOD) $@ -# Create links from various names to vim. This is only done when the links +# Create links from various names to mnv. This is only done when the links # (or executables with the same name) don't exist yet. installlinks: $(GUI_TARGETS) \ $(DEST_BIN)/$(EXTARGET) \ $(DEST_BIN)/$(VIEWTARGET) \ - $(DEST_BIN)/$(RVIMTARGET) \ + $(DEST_BIN)/$(RMNVTARGET) \ $(DEST_BIN)/$(RVIEWTARGET) \ - $(INSTALLVIMDIFF) + $(INSTALLMNVDIFF) -installglinks: $(DEST_BIN)/$(GVIMTARGET) \ +installglinks: $(DEST_BIN)/$(GMNVTARGET) \ $(DEST_BIN)/$(GVIEWTARGET) \ - $(DEST_BIN)/$(RGVIMTARGET) \ + $(DEST_BIN)/$(RGMNVTARGET) \ $(DEST_BIN)/$(RGVIEWTARGET) \ - $(DEST_BIN)/$(EVIMTARGET) \ + $(DEST_BIN)/$(EMNVTARGET) \ $(DEST_BIN)/$(EVIEWTARGET) \ - $(INSTALLGVIMDIFF) + $(INSTALLGMNVDIFF) -installvimdiff: $(DEST_BIN)/$(VIMDIFFTARGET) -installgvimdiff: $(DEST_BIN)/$(GVIMDIFFTARGET) +installmnvdiff: $(DEST_BIN)/$(MNVDIFFTARGET) +installgmnvdiff: $(DEST_BIN)/$(GMNVDIFFTARGET) $(DEST_BIN)/$(EXTARGET): $(DEST_BIN) - cd $(DEST_BIN); ln -sf $(VIMTARGET) $(EXTARGET) + cd $(DEST_BIN); ln -sf $(MNVTARGET) $(EXTARGET) $(DEST_BIN)/$(VIEWTARGET): $(DEST_BIN) - cd $(DEST_BIN); ln -sf $(VIMTARGET) $(VIEWTARGET) + cd $(DEST_BIN); ln -sf $(MNVTARGET) $(VIEWTARGET) -$(DEST_BIN)/$(GVIMTARGET): $(DEST_BIN) - cd $(DEST_BIN); ln -sf $(VIMTARGET) $(GVIMTARGET) +$(DEST_BIN)/$(GMNVTARGET): $(DEST_BIN) + cd $(DEST_BIN); ln -sf $(MNVTARGET) $(GMNVTARGET) $(DEST_BIN)/$(GVIEWTARGET): $(DEST_BIN) - cd $(DEST_BIN); ln -sf $(VIMTARGET) $(GVIEWTARGET) + cd $(DEST_BIN); ln -sf $(MNVTARGET) $(GVIEWTARGET) -$(DEST_BIN)/$(RVIMTARGET): $(DEST_BIN) - cd $(DEST_BIN); ln -sf $(VIMTARGET) $(RVIMTARGET) +$(DEST_BIN)/$(RMNVTARGET): $(DEST_BIN) + cd $(DEST_BIN); ln -sf $(MNVTARGET) $(RMNVTARGET) $(DEST_BIN)/$(RVIEWTARGET): $(DEST_BIN) - cd $(DEST_BIN); ln -sf $(VIMTARGET) $(RVIEWTARGET) + cd $(DEST_BIN); ln -sf $(MNVTARGET) $(RVIEWTARGET) -$(DEST_BIN)/$(RGVIMTARGET): $(DEST_BIN) - cd $(DEST_BIN); ln -sf $(VIMTARGET) $(RGVIMTARGET) +$(DEST_BIN)/$(RGMNVTARGET): $(DEST_BIN) + cd $(DEST_BIN); ln -sf $(MNVTARGET) $(RGMNVTARGET) $(DEST_BIN)/$(RGVIEWTARGET): $(DEST_BIN) - cd $(DEST_BIN); ln -sf $(VIMTARGET) $(RGVIEWTARGET) + cd $(DEST_BIN); ln -sf $(MNVTARGET) $(RGVIEWTARGET) -$(DEST_BIN)/$(VIMDIFFTARGET): $(DEST_BIN) - cd $(DEST_BIN); ln -sf $(VIMTARGET) $(VIMDIFFTARGET) +$(DEST_BIN)/$(MNVDIFFTARGET): $(DEST_BIN) + cd $(DEST_BIN); ln -sf $(MNVTARGET) $(MNVDIFFTARGET) -$(DEST_BIN)/$(GVIMDIFFTARGET): $(DEST_BIN) - cd $(DEST_BIN); ln -sf $(VIMTARGET) $(GVIMDIFFTARGET) +$(DEST_BIN)/$(GMNVDIFFTARGET): $(DEST_BIN) + cd $(DEST_BIN); ln -sf $(MNVTARGET) $(GMNVDIFFTARGET) -$(DEST_BIN)/$(EVIMTARGET): $(DEST_BIN) - cd $(DEST_BIN); ln -sf $(VIMTARGET) $(EVIMTARGET) +$(DEST_BIN)/$(EMNVTARGET): $(DEST_BIN) + cd $(DEST_BIN); ln -sf $(MNVTARGET) $(EMNVTARGET) $(DEST_BIN)/$(EVIEWTARGET): $(DEST_BIN) - cd $(DEST_BIN); ln -sf $(VIMTARGET) $(EVIEWTARGET) + cd $(DEST_BIN); ln -sf $(MNVTARGET) $(EVIEWTARGET) -# Create links for the manual pages with various names to vim. This is only +# Create links for the manual pages with various names to mnv. This is only # done when the links (or manpages with the same name) don't exist yet. -INSTALLMLARGS = $(VIMNAME) $(VIMDIFFNAME) $(EVIMNAME) \ - $(EXNAME) $(VIEWNAME) $(RVIMNAME) $(RVIEWNAME) \ - $(GVIMNAME) $(GVIEWNAME) $(RGVIMNAME) $(RGVIEWNAME) \ - $(GVIMDIFFNAME) $(EVIEWNAME) +INSTALLMLARGS = $(MNVNAME) $(MNVDIFFNAME) $(EMNVNAME) \ + $(EXNAME) $(VIEWNAME) $(RMNVNAME) $(RVIEWNAME) \ + $(GMNVNAME) $(GVIEWNAME) $(RGMNVNAME) $(RGVIEWNAME) \ + $(GMNVDIFFNAME) $(EVIEWNAME) installmanlinks: -$(SHELL) ./installml.sh install "$(GUI_MAN_TARGETS)" \ $(DEST_MAN) $(INSTALLMLARGS) uninstall: uninstall_runtime - -rm -f $(DEST_BIN)/$(VIMTARGET) - -rm -f $(DEST_BIN)/vimtutor - -rm -f $(DEST_BIN)/gvimtutor + -rm -f $(DEST_BIN)/$(MNVTARGET) + -rm -f $(DEST_BIN)/mnvtutor + -rm -f $(DEST_BIN)/gmnvtutor -rm -f $(DEST_BIN)/$(EXTARGET) $(DEST_BIN)/$(VIEWTARGET) - -rm -f $(DEST_BIN)/$(GVIMTARGET) $(DEST_BIN)/$(GVIEWTARGET) - -rm -f $(DEST_BIN)/$(RVIMTARGET) $(DEST_BIN)/$(RVIEWTARGET) - -rm -f $(DEST_BIN)/$(RGVIMTARGET) $(DEST_BIN)/$(RGVIEWTARGET) - -rm -f $(DEST_BIN)/$(VIMDIFFTARGET) $(DEST_BIN)/$(GVIMDIFFTARGET) - -rm -f $(DEST_BIN)/$(EVIMTARGET) $(DEST_BIN)/$(EVIEWTARGET) + -rm -f $(DEST_BIN)/$(GMNVTARGET) $(DEST_BIN)/$(GVIEWTARGET) + -rm -f $(DEST_BIN)/$(RMNVTARGET) $(DEST_BIN)/$(RVIEWTARGET) + -rm -f $(DEST_BIN)/$(RGMNVTARGET) $(DEST_BIN)/$(RGVIEWTARGET) + -rm -f $(DEST_BIN)/$(MNVDIFFTARGET) $(DEST_BIN)/$(GMNVDIFFTARGET) + -rm -f $(DEST_BIN)/$(EMNVTARGET) $(DEST_BIN)/$(EVIEWTARGET) -rm -f $(DEST_BIN)/xxd$(EXEEXT) # Note: the "rmdir" will fail if any files were added after "make install" @@ -2917,21 +2917,21 @@ uninstall_runtime: -rm -f $(DEST_HELP)/*.txt $(DEST_HELP)/tags $(DEST_HELP)/*.pl -rm -f $(DEST_HELP)/*.??x $(DEST_HELP)/tags-?? -rm -f $(SYS_MENU_FILE) $(SYS_SYNMENU_FILE) $(SYS_DELMENU_FILE) - -rm -f $(SYS_BUGR_FILE) $(VIM_DEFAULTS_FILE) $(EVIM_FILE) $(MSWIN_FILE) - -rm -f $(DEST_SCRIPT)/gvimrc_example.vim $(DEST_SCRIPT)/vimrc_example.vim + -rm -f $(SYS_BUGR_FILE) $(MNV_DEFAULTS_FILE) $(EMNV_FILE) $(MSWIN_FILE) + -rm -f $(DEST_SCRIPT)/gmnvrc_example.mnv $(DEST_SCRIPT)/mnvrc_example.mnv -rm -f $(SYS_FILETYPE_FILE) $(SYS_FTOFF_FILE) $(SYS_SCRIPTS_FILE) -rm -f $(SYS_INDOFF_FILE) $(SYS_INDENT_FILE) -rm -f $(SYS_FTPLUGOF_FILE) $(SYS_FTPLUGIN_FILE) -rm -f $(SYS_OPTWIN_FILE) - -rm -f $(DEST_COL)/*.vim $(DEST_COL)/README.txt + -rm -f $(DEST_COL)/*.mnv $(DEST_COL)/README.txt -rm -rf $(DEST_COL)/tools - -rm -f $(DESKTOPPATH)/vim.desktop $(DESKTOPPATH)/gvim.desktop - -rm -f $(ICON16PATH)/gvim.png $(ICON32PATH)/gvim.png $(ICON48PATH)/gvim.png + -rm -f $(DESKTOPPATH)/mnv.desktop $(DESKTOPPATH)/gmnv.desktop + -rm -f $(ICON16PATH)/gmnv.png $(ICON32PATH)/gmnv.png $(ICON48PATH)/gmnv.png -rm -rf $(DEST_COL)/lists - -rm -f $(DEST_SYN)/shared/*.vim $(DEST_SYN)/shared/README.txt - -rm -f $(DEST_SYN)/modula2/opt/*.vim - -rm -f $(DEST_SYN)/*.vim $(DEST_SYN)/README.txt - -rm -f $(DEST_IND)/*.vim $(DEST_IND)/README.txt + -rm -f $(DEST_SYN)/shared/*.mnv $(DEST_SYN)/shared/README.txt + -rm -f $(DEST_SYN)/modula2/opt/*.mnv + -rm -f $(DEST_SYN)/*.mnv $(DEST_SYN)/README.txt + -rm -f $(DEST_IND)/*.mnv $(DEST_IND)/README.txt -rm -rf $(DEST_MACRO) -rm -rf $(DEST_PACK) -rm -rf $(DEST_TUTOR)/en @@ -2949,11 +2949,11 @@ uninstall_runtime: -rmdir $(DEST_HELP) $(DEST_PRINT) $(DEST_COL) $(DEST_SYN)/shared -rmdir $(DEST_SYN)/modula2/opt $(DEST_SYN)/modula2 -rmdir $(DEST_SYN) $(DEST_IND) - -rm -rf $(DEST_FTP)/*.vim $(DEST_FTP)/README.txt $(DEST_FTP)/logtalk.dict - -rm -f $(DEST_AUTO)/*.vim $(DEST_AUTO)/README.txt - -rm -f $(DEST_AUTO)/dist/*.vim $(DEST_AUTO)/xml/*.vim $(DEST_AUTO)/cargo/*.vim $(DEST_AUTO)/rust/*.vim - -rm -f $(DEST_IMPORT)/dist/*.vim - -rm -f $(DEST_PLUG)/*.vim $(DEST_PLUG)/README.txt + -rm -rf $(DEST_FTP)/*.mnv $(DEST_FTP)/README.txt $(DEST_FTP)/logtalk.dict + -rm -f $(DEST_AUTO)/*.mnv $(DEST_AUTO)/README.txt + -rm -f $(DEST_AUTO)/dist/*.mnv $(DEST_AUTO)/xml/*.mnv $(DEST_AUTO)/cargo/*.mnv $(DEST_AUTO)/rust/*.mnv + -rm -f $(DEST_IMPORT)/dist/*.mnv + -rm -f $(DEST_PLUG)/*.mnv $(DEST_PLUG)/README.txt -rmdir $(DEST_FTP) $(DEST_AUTO)/dist $(DEST_AUTO)/xml $(DEST_AUTO)/cargo $(DEST_AUTO)/rust $(DEST_AUTO) -rmdir $(DEST_IMPORT)/dist $(DEST_IMPORT) -rm -f $(DEST_RT)/README.??.txt @@ -2962,17 +2962,17 @@ uninstall_runtime: -rm -f $(DEST_RT)/LICENSE.??_??.txt -rm -f $(DEST_RT)/README.txt $(DEST_RT)/LICENSE -rmdir $(DEST_PLUG) $(DEST_RT) -# This will fail when other Vim versions are installed, no worries. - -rmdir $(DEST_VIM) +# This will fail when other MNV versions are installed, no worries. + -rmdir $(DEST_MNV) # Clean up all the files that have been produced, except configure's. # We support common typing mistakes for Juergen! :-) clean celan: testclean - -rm -f *.o core $(VIMTARGET).core $(VIMTARGET) vim + -rm -f *.o core $(MNVTARGET).core $(MNVTARGET) mnv -rm -rf objects -rm -f auto/osdef.h auto/pathdef.c auto/if_perl.c auto/gui_gtk_gresources.c auto/gui_gtk_gresources.h auto/os_haiku.rdef -rm -f conftest* *~ auto/link.sed - -rm -f testdir/opt_test.vim + -rm -f testdir/opt_test.mnv -rm -f $(UNITTEST_TARGETS) -rm -f runtime pixmaps -rm -f mzscheme_base.c @@ -3004,7 +3004,7 @@ clean celan: testclean # % make SHADOWDIR = shadow -LINKEDFILES = ../*.[chm] ../*.cc ../*.in ../*.sh ../*.xs ../*.xbm ../gui_gtk_res.xml ../toolcheck ../proto ../libvterm ../vimtutor ../gvimtutor ../install-sh ../Make_all.mak +LINKEDFILES = ../*.[chm] ../*.cc ../*.in ../*.sh ../*.xs ../*.xbm ../gui_gtk_res.xml ../toolcheck ../proto ../libvterm ../mnvtutor ../gmnvtutor ../install-sh ../Make_all.mak shadow: runtime pixmaps $(MKDIR_P) $(SHADOWDIR) @@ -3014,7 +3014,7 @@ shadow: runtime pixmaps cd $(SHADOWDIR)/auto/wayland; ln -s ../../../auto/wayland/* . cd $(SHADOWDIR)/auto; ln -s ../../auto/configure . $(MKDIR_P) $(SHADOWDIR)/po - cd $(SHADOWDIR)/po; ln -s ../../po/*.po ../../po/*.mak ../../po/*.vim ../../po/*.in ../../po/Makefile ../../po/*.c . + cd $(SHADOWDIR)/po; ln -s ../../po/*.po ../../po/*.mak ../../po/*.mnv ../../po/*.in ../../po/Makefile ../../po/*.c . cd $(SHADOWDIR); rm -f auto/link.sed cp Makefile configure $(SHADOWDIR) rm -f $(SHADOWDIR)/auto/config.mk $(SHADOWDIR)/config.mk.dist @@ -3029,7 +3029,7 @@ shadow: runtime pixmaps ../../testdir/Make_all.mak \ ../../testdir/README.txt \ ../../testdir/*.in \ - ../../testdir/*.vim \ + ../../testdir/*.mnv \ ../../testdir/*.py \ ../../testdir/python* \ ../../testdir/pyxfile \ @@ -3042,7 +3042,7 @@ shadow: runtime pixmaps ../../testdir/testluaplugin \ . -# After updating Vim new files may have been created, use this to refresh the +# After updating MNV new files may have been created, use this to refresh the # symbolic links in the shadow directory. This isn't guaranteed to catch all # changes, running "make shadow" again might sometimes be needed. shadowupdate: @@ -3058,10 +3058,10 @@ runtime: pixmaps: -ln -s ../pixmaps . -# Update the synmenu.vim file with the latest Syntax menu. -# This is only needed when runtime/makemenu.vim was changed. -menu: ./vim ../runtime/makemenu.vim - ./vim --clean -X --not-a-term -S ../runtime/makemenu.vim +# Update the synmenu.mnv file with the latest Syntax menu. +# This is only needed when runtime/makemenu.mnv was changed. +menu: ./mnv ../runtime/makemenu.mnv + ./mnv --clean -X --not-a-term -S ../runtime/makemenu.mnv # Start configure from scratch scrub scratch: @@ -3092,7 +3092,7 @@ mdepend: done mv tmp_make Makefile -# this needs a Vim build with Perl & Wayland +# this needs a MNV build with Perl & Wayland depend: -@rm -f Makefile~ cp Makefile Makefile~ @@ -3138,19 +3138,19 @@ auto/os_haiku.rdef: os_haiku.rdef.in @echo '/* This file is automatically created by Makefile */' >> $@ @echo '/* DO NOT EDIT! Change Makefile only. */' >> $@ @cat $(srcdir)/os_haiku.rdef.in >> auto/os_haiku.rdef - sed -i "s|@MAJOR@|$(VIMMAJOR)|" auto/os_haiku.rdef - sed -i "s|@MINOR@|$(VIMMINOR)|" auto/os_haiku.rdef + sed -i "s|@MAJOR@|$(MNVMAJOR)|" auto/os_haiku.rdef + sed -i "s|@MINOR@|$(MNVMINOR)|" auto/os_haiku.rdef auto/pathdef.c: Makefile auto/config.mk -@echo creating $@ -@echo '/* pathdef.c */' > $@ -@echo '/* This file is automatically created by Makefile' >> $@ -@echo ' * DO NOT EDIT! Change Makefile only. */' >> $@ - -@echo '#include "vim.h"' >> $@ - -@echo 'char_u *default_vim_dir = (char_u *)"$(VIMRCLOC)";' | $(QUOTESED) >> $@ - -@echo 'char_u *default_vimruntime_dir = (char_u *)"$(VIMRUNTIMEDIR)";' | $(QUOTESED) >> $@ + -@echo '#include "mnv.h"' >> $@ + -@echo 'char_u *default_mnv_dir = (char_u *)"$(MNVRCLOC)";' | $(QUOTESED) >> $@ + -@echo 'char_u *default_mnvruntime_dir = (char_u *)"$(MNVRUNTIMEDIR)";' | $(QUOTESED) >> $@ -@echo 'char_u *all_cflags = (char_u *)"$(CC) -c -I$(srcdir) $(ALL_CFLAGS)";' | $(QUOTESED) >> $@ - -@echo 'char_u *all_lflags = (char_u *)"$(CC) $(ALL_LIB_DIRS) $(LDFLAGS) -o $(VIMTARGET) $(ALL_LIBS) ";' | $(QUOTESED) >> $@ + -@echo 'char_u *all_lflags = (char_u *)"$(CC) $(ALL_LIB_DIRS) $(LDFLAGS) -o $(MNVTARGET) $(ALL_LIBS) ";' | $(QUOTESED) >> $@ -@echo 'char_u *compiled_user = (char_u *)"' | tr -d $(NL) >> $@ -@if test -n "$(COMPILEDBY)"; then \ echo "$(COMPILEDBY)" | tr -d $(NL) >> $@; \ @@ -3162,19 +3162,19 @@ auto/pathdef.c: Makefile auto/config.mk -@sh $(srcdir)/pathdef.sh GUI_GTK_RES_INPUTS = \ - ../pixmaps/stock_vim_build_tags.png \ - ../pixmaps/stock_vim_find_help.png \ - ../pixmaps/stock_vim_save_all.png \ - ../pixmaps/stock_vim_session_load.png \ - ../pixmaps/stock_vim_session_new.png \ - ../pixmaps/stock_vim_session_save.png \ - ../pixmaps/stock_vim_shell.png \ - ../pixmaps/stock_vim_window_maximize.png \ - ../pixmaps/stock_vim_window_maximize_width.png \ - ../pixmaps/stock_vim_window_minimize.png \ - ../pixmaps/stock_vim_window_minimize_width.png \ - ../pixmaps/stock_vim_window_split.png \ - ../pixmaps/stock_vim_window_split_vertical.png + ../pixmaps/stock_mnv_build_tags.png \ + ../pixmaps/stock_mnv_find_help.png \ + ../pixmaps/stock_mnv_save_all.png \ + ../pixmaps/stock_mnv_session_load.png \ + ../pixmaps/stock_mnv_session_new.png \ + ../pixmaps/stock_mnv_session_save.png \ + ../pixmaps/stock_mnv_shell.png \ + ../pixmaps/stock_mnv_window_maximize.png \ + ../pixmaps/stock_mnv_window_maximize_width.png \ + ../pixmaps/stock_mnv_window_minimize.png \ + ../pixmaps/stock_mnv_window_minimize_width.png \ + ../pixmaps/stock_mnv_window_split.png \ + ../pixmaps/stock_mnv_window_split_vertical.png auto/gui_gtk_gresources.c: gui_gtk_res.xml $(GUI_GTK_RES_INPUTS) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=../pixmaps --generate --c-name=gui_gtk --manual-register gui_gtk_res.xml @@ -3183,10 +3183,10 @@ auto/gui_gtk_gresources.h: gui_gtk_res.xml $(GUI_GTK_RES_INPUTS) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=../pixmaps --generate --c-name=gui_gtk --manual-register gui_gtk_res.xml; \ fi -# Dependencies through vim.h that most targets depend on. Used by targets +# Dependencies through mnv.h that most targets depend on. Used by targets # that are not taken care of by "make depend". -VIM_H_DEPENDENCIES = \ - vim.h protodef.h auto/config.h feature.h os_unix.h \ +MNV_H_DEPENDENCIES = \ + mnv.h protodef.h auto/config.h feature.h os_unix.h \ auto/osdef.h ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \ proto.h globals.h errors.h @@ -3503,7 +3503,7 @@ objects/option.o: option.c optiondefs.h objects/optionstr.o: optionstr.c $(CCC_NF) $(ALL_IF_CFLAGS) $(ALL_CFLAGS) $(ALL_IF_CFLAGS_EXTRA) -o $@ optionstr.c -objects/os_qnx.o: os_qnx.c $(VIM_H_DEPENDENCIES) +objects/os_qnx.o: os_qnx.c $(MNV_H_DEPENDENCIES) $(CCC) -o $@ os_qnx.c objects/os_haiku.rsrc: auto/os_haiku.rdef @@ -3512,16 +3512,16 @@ objects/os_haiku.rsrc: auto/os_haiku.rdef objects/os_macosx.o: os_macosx.m $(CCC) -o $@ os_macosx.m -objects/os_mac_conv.o: os_mac_conv.c $(VIM_H_DEPENDENCIES) +objects/os_mac_conv.o: os_mac_conv.c $(MNV_H_DEPENDENCIES) $(CCC) -o $@ os_mac_conv.c objects/os_unix.o: os_unix.c $(CCC) -o $@ os_unix.c -objects/os_mswin.o: os_mswin.c $(VIM_H_DEPENDENCIES) +objects/os_mswin.o: os_mswin.c $(MNV_H_DEPENDENCIES) $(CCC) -o $@ os_mswin.c -objects/winclip.o: winclip.c $(VIM_H_DEPENDENCIES) +objects/winclip.o: winclip.c $(MNV_H_DEPENDENCIES) $(CCC) -o $@ winclip.c objects/pathdef.o: auto/pathdef.c @@ -3632,35 +3632,35 @@ objects/userfunc.o: userfunc.c objects/version.o: version.c $(CCC) -o $@ version.c -objects/vim9class.o: vim9class.c - $(CCC) -o $@ vim9class.c +objects/mnv9class.o: mnv9class.c + $(CCC) -o $@ mnv9class.c -objects/vim9cmds.o: vim9cmds.c - $(CCC) -o $@ vim9cmds.c +objects/mnv9cmds.o: mnv9cmds.c + $(CCC) -o $@ mnv9cmds.c -objects/vim9compile.o: vim9compile.c - $(CCC) -o $@ vim9compile.c +objects/mnv9compile.o: mnv9compile.c + $(CCC) -o $@ mnv9compile.c -objects/vim9execute.o: vim9execute.c - $(CCC) -o $@ vim9execute.c +objects/mnv9execute.o: mnv9execute.c + $(CCC) -o $@ mnv9execute.c -objects/vim9expr.o: vim9expr.c - $(CCC) -o $@ vim9expr.c +objects/mnv9expr.o: mnv9expr.c + $(CCC) -o $@ mnv9expr.c -objects/vim9generics.o: vim9generics.c - $(CCC) -o $@ vim9generics.c +objects/mnv9generics.o: mnv9generics.c + $(CCC) -o $@ mnv9generics.c -objects/vim9instr.o: vim9instr.c - $(CCC) -o $@ vim9instr.c +objects/mnv9instr.o: mnv9instr.c + $(CCC) -o $@ mnv9instr.c -objects/vim9script.o: vim9script.c - $(CCC) -o $@ vim9script.c +objects/mnv9script.o: mnv9script.c + $(CCC) -o $@ mnv9script.c -objects/vim9type.o: vim9type.c - $(CCC) -o $@ vim9type.c +objects/mnv9type.o: mnv9type.c + $(CCC) -o $@ mnv9type.c -objects/viminfo.o: viminfo.c - $(CCC) -o $@ viminfo.c +objects/mnvinfo.o: mnvinfo.c + $(CCC) -o $@ mnvinfo.c objects/window.o: window.c $(CCC) -o $@ window.c @@ -3691,11 +3691,11 @@ objects/gui_gtk_x11.o: version.h # Build rules for libvterm. Putting them here allows for adding compilation -# options specific for Vim. Since the .o files go into objects/ we do need to +# options specific for MNV. Since the .o files go into objects/ we do need to # prefix vterm_ to avoid name clashes. CCCTERM = $(CCC_NF) $(VTERM_CFLAGS) $(ALL_CFLAGS) -DINLINE="" \ - -DVSNPRINTF=vim_vsnprintf \ - -DSNPRINTF=vim_snprintf \ + -DVSNPRINTF=mnv_vsnprintf \ + -DSNPRINTF=mnv_snprintf \ -DIS_COMBINING_FUNCTION=utf_iscomposing_uint \ -DWCWIDTH_FUNCTION=utf_uint2cells @@ -3756,683 +3756,683 @@ Makefile: # Haiku installation # # This rule: -# - add resources to already installed vim binary to avoid +# - add resources to already installed mnv binary to avoid # stripping them during install; -# - update system MIME database with info about vim application. +# - update system MIME database with info about mnv application. # -install_haiku_extra: $(DEST_BIN)/$(VIMTARGET) objects/os_haiku.rsrc - xres -o $(DEST_BIN)/$(VIMTARGET) objects/os_haiku.rsrc - mimeset $(DEST_BIN)/$(VIMTARGET) +install_haiku_extra: $(DEST_BIN)/$(MNVTARGET) objects/os_haiku.rsrc + xres -o $(DEST_BIN)/$(MNVTARGET) objects/os_haiku.rsrc + mimeset $(DEST_BIN)/$(MNVTARGET) # List of g*-links that should be replaced with shell script equivalents. # This solves the problem of them from Tracker. # -HAIKU_GLINKS = $(DEST_BIN)/$(GVIMTARGET) \ +HAIKU_GLINKS = $(DEST_BIN)/$(GMNVTARGET) \ $(DEST_BIN)/$(GVIEWTARGET) \ - $(DEST_BIN)/$(GVIMDIFFTARGET) \ - $(DEST_BIN)/$(RGVIMTARGET) \ + $(DEST_BIN)/$(GMNVDIFFTARGET) \ + $(DEST_BIN)/$(RGMNVTARGET) \ $(DEST_BIN)/$(RGVIEWTARGET) # This rule: -# - Replace gvim link with copy of vim binary. +# - Replace gmnv link with copy of mnv binary. # - Replace g*-links with shell script equivalents to solve the # problem of calling them from Tracker, # - Add icon resources to mentioned g*-link shell scripts -# - in case gui-less vim.con executable available use it. +# - in case gui-less mnv.con executable available use it. # installglinks_haiku: $(HAIKU_GLINKS) install_haiku_extra - @catattr -r "BEOS:ICON" $(DEST_BIN)/$(GVIMTARGET) > ~icon.attr + @catattr -r "BEOS:ICON" $(DEST_BIN)/$(GMNVTARGET) > ~icon.attr for i in $(HAIKU_GLINKS); do \ rm $$i ; \ echo "#!/bin/sh" > $$i ; \ case $$i in \ - $(DEST_BIN)/$(GVIMTARGET)) \ - cp $(DEST_BIN)/$(VIMTARGET) $$i ; \ - if [ -f $(VIMTARGET).con ] ; then \ - $(STRIP) $(VIMTARGET).con ; \ - mv $(VIMTARGET).con $(DEST_BIN)/$(VIMTARGET) ; \ + $(DEST_BIN)/$(GMNVTARGET)) \ + cp $(DEST_BIN)/$(MNVTARGET) $$i ; \ + if [ -f $(MNVTARGET).con ] ; then \ + $(STRIP) $(MNVTARGET).con ; \ + mv $(MNVTARGET).con $(DEST_BIN)/$(MNVTARGET) ; \ fi ;; \ - $(DEST_BIN)/$(GVIEWTARGET)) printf "%s -R %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \ - $(DEST_BIN)/$(GVIMDIFFTARGET)) printf "%s -d %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \ - $(DEST_BIN)/$(RGVIMTARGET)) printf "%s -Z %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \ - $(DEST_BIN)/$(RGVIEWTARGET)) printf "%s -Z -R %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \ - *) printf "%s %c%c" $(GVIMTARGET) '$$' '*' >> $$i;; \ + $(DEST_BIN)/$(GVIEWTARGET)) printf "%s -R %c%c" $(GMNVTARGET) '$$' '*' >> $$i;; \ + $(DEST_BIN)/$(GMNVDIFFTARGET)) printf "%s -d %c%c" $(GMNVTARGET) '$$' '*' >> $$i;; \ + $(DEST_BIN)/$(RGMNVTARGET)) printf "%s -Z %c%c" $(GMNVTARGET) '$$' '*' >> $$i;; \ + $(DEST_BIN)/$(RGVIEWTARGET)) printf "%s -Z -R %c%c" $(GMNVTARGET) '$$' '*' >> $$i;; \ + *) printf "%s %c%c" $(GMNVTARGET) '$$' '*' >> $$i;; \ esac ; \ chmod $(BINMOD) $$i ; \ addattr -f ~icon.attr -t \'VICN\' BEOS:ICON $$i ; \ done - addattr -f ~icon.attr -t \'VICN\' BEOS:ICON $(DEST_BIN)/$(VIMNAME)tutor + addattr -f ~icon.attr -t \'VICN\' BEOS:ICON $(DEST_BIN)/$(MNVNAME)tutor @rm ~icon.attr ############################################################################### ### (automatically generated by 'make depend') ### Dependencies: -objects/alloc.o: auto/osdef.h alloc.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/alloc.o: auto/osdef.h alloc.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/arabic.o: auto/osdef.h arabic.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/arabic.o: auto/osdef.h arabic.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/arglist.o: auto/osdef.h arglist.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/arglist.o: auto/osdef.h arglist.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/autocmd.o: auto/osdef.h autocmd.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/autocmd.o: auto/osdef.h autocmd.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/beval.o: auto/osdef.h beval.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/beval.o: auto/osdef.h beval.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/blob.o: auto/osdef.h blob.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/blob.o: auto/osdef.h blob.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/blowfish.o: auto/osdef.h blowfish.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/blowfish.o: auto/osdef.h blowfish.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/buffer.o: auto/osdef.h buffer.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/buffer.o: auto/osdef.h buffer.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h version.h -objects/change.o: auto/osdef.h change.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/change.o: auto/osdef.h change.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/charset.o: auto/osdef.h charset.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/charset.o: auto/osdef.h charset.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/cindent.o: auto/osdef.h cindent.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/cindent.o: auto/osdef.h cindent.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/clientserver.o: auto/osdef.h clientserver.c vim.h protodef.h auto/config.h feature.h \ +objects/clientserver.o: auto/osdef.h clientserver.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/clipboard.o: auto/osdef.h clipboard.c vim.h protodef.h auto/config.h feature.h \ +objects/clipboard.o: auto/osdef.h clipboard.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h wayland.h -objects/cmdexpand.o: auto/osdef.h cmdexpand.c vim.h protodef.h auto/config.h feature.h \ +objects/cmdexpand.o: auto/osdef.h cmdexpand.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/cmdhist.o: auto/osdef.h cmdhist.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/cmdhist.o: auto/osdef.h cmdhist.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/crypt.o: auto/osdef.h crypt.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/crypt.o: auto/osdef.h crypt.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/crypt_zip.o: auto/osdef.h crypt_zip.c vim.h protodef.h auto/config.h feature.h \ +objects/crypt_zip.o: auto/osdef.h crypt_zip.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/debugger.o: auto/osdef.h debugger.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/debugger.o: auto/osdef.h debugger.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/dict.o: auto/osdef.h dict.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/dict.o: auto/osdef.h dict.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/diff.o: auto/osdef.h diff.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/diff.o: auto/osdef.h diff.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h xdiff/xdiff.h -objects/digraph.o: auto/osdef.h digraph.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/digraph.o: auto/osdef.h digraph.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/drawline.o: auto/osdef.h drawline.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/drawline.o: auto/osdef.h drawline.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/drawscreen.o: auto/osdef.h drawscreen.c vim.h protodef.h auto/config.h feature.h \ +objects/drawscreen.o: auto/osdef.h drawscreen.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/edit.o: auto/osdef.h edit.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/edit.o: auto/osdef.h edit.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/eval.o: auto/osdef.h eval.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/eval.o: auto/osdef.h eval.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/evalbuffer.o: auto/osdef.h evalbuffer.c vim.h protodef.h auto/config.h feature.h \ +objects/evalbuffer.o: auto/osdef.h evalbuffer.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/evalfunc.o: auto/osdef.h evalfunc.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/evalfunc.o: auto/osdef.h evalfunc.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h version.h -objects/evalvars.o: auto/osdef.h evalvars.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/evalvars.o: auto/osdef.h evalvars.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h version.h -objects/evalwindow.o: auto/osdef.h evalwindow.c vim.h protodef.h auto/config.h feature.h \ +objects/evalwindow.o: auto/osdef.h evalwindow.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/ex_cmds.o: auto/osdef.h ex_cmds.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/ex_cmds.o: auto/osdef.h ex_cmds.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h version.h -objects/ex_cmds2.o: auto/osdef.h ex_cmds2.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/ex_cmds2.o: auto/osdef.h ex_cmds2.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h version.h -objects/ex_docmd.o: auto/osdef.h ex_docmd.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/ex_docmd.o: auto/osdef.h ex_docmd.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h ex_cmdidxs.h -objects/ex_eval.o: auto/osdef.h ex_eval.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/ex_eval.o: auto/osdef.h ex_eval.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/ex_getln.o: auto/osdef.h ex_getln.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/ex_getln.o: auto/osdef.h ex_getln.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/fileio.o: auto/osdef.h fileio.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/fileio.o: auto/osdef.h fileio.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/filepath.o: auto/osdef.h filepath.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/filepath.o: auto/osdef.h filepath.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/findfile.o: auto/osdef.h findfile.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/findfile.o: auto/osdef.h findfile.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/float.o: auto/osdef.h float.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/float.o: auto/osdef.h float.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/fold.o: auto/osdef.h fold.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/fold.o: auto/osdef.h fold.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/fuzzy.o: auto/osdef.h fuzzy.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/fuzzy.o: auto/osdef.h fuzzy.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/getchar.o: auto/osdef.h getchar.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/getchar.o: auto/osdef.h getchar.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/gc.o: auto/osdef.h gc.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/gc.o: auto/osdef.h gc.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/gui_xim.o: auto/osdef.h gui_xim.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/gui_xim.o: auto/osdef.h gui_xim.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/hardcopy.o: auto/osdef.h hardcopy.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/hardcopy.o: auto/osdef.h hardcopy.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h version.h -objects/hashtab.o: auto/osdef.h hashtab.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/hashtab.o: auto/osdef.h hashtab.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/help.o: auto/osdef.h help.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/help.o: auto/osdef.h help.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/highlight.o: auto/osdef.h highlight.c vim.h protodef.h auto/config.h feature.h \ +objects/highlight.o: auto/osdef.h highlight.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/if_cscope.o: auto/osdef.h if_cscope.c vim.h protodef.h auto/config.h feature.h \ +objects/if_cscope.o: auto/osdef.h if_cscope.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/if_xcmdsrv.o: auto/osdef.h if_xcmdsrv.c vim.h protodef.h auto/config.h feature.h \ +objects/if_xcmdsrv.o: auto/osdef.h if_xcmdsrv.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h version.h -objects/indent.o: auto/osdef.h indent.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/indent.o: auto/osdef.h indent.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/insexpand.o: auto/osdef.h insexpand.c vim.h protodef.h auto/config.h feature.h \ +objects/insexpand.o: auto/osdef.h insexpand.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/json.o: auto/osdef.h json.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/json.o: auto/osdef.h json.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/linematch.o: auto/osdef.h linematch.c vim.h protodef.h auto/config.h feature.h \ +objects/linematch.o: auto/osdef.h linematch.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h xdiff/xdiff.h \ alloc.h ex_cmds.h spell.h proto.h globals.h errors.h -objects/list.o: auto/osdef.h list.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/list.o: auto/osdef.h list.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/locale.o: auto/osdef.h locale.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/locale.o: auto/osdef.h locale.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/logfile.o: auto/osdef.h logfile.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/logfile.o: auto/osdef.h logfile.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/main.o: auto/osdef.h main.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/main.o: auto/osdef.h main.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/map.o: auto/osdef.h map.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/map.o: auto/osdef.h map.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/mark.o: auto/osdef.h mark.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/mark.o: auto/osdef.h mark.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/match.o: auto/osdef.h match.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/match.o: auto/osdef.h match.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/mbyte.o: auto/osdef.h mbyte.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/mbyte.o: auto/osdef.h mbyte.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/memfile.o: auto/osdef.h memfile.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/memfile.o: auto/osdef.h memfile.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/memline.o: auto/osdef.h memline.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/memline.o: auto/osdef.h memline.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/menu.o: auto/osdef.h menu.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/menu.o: auto/osdef.h menu.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/message.o: auto/osdef.h message.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/message.o: auto/osdef.h message.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/misc1.o: auto/osdef.h misc1.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/misc1.o: auto/osdef.h misc1.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h version.h -objects/misc2.o: auto/osdef.h misc2.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/misc2.o: auto/osdef.h misc2.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/mouse.o: auto/osdef.h mouse.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/mouse.o: auto/osdef.h mouse.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/move.o: auto/osdef.h move.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/move.o: auto/osdef.h move.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/normal.o: auto/osdef.h normal.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/normal.o: auto/osdef.h normal.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h nv_cmds.h nv_cmdidxs.h -objects/ops.o: auto/osdef.h ops.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/ops.o: auto/osdef.h ops.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/option.o: auto/osdef.h option.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/option.o: auto/osdef.h option.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h optiondefs.h -objects/optionstr.o: auto/osdef.h optionstr.c vim.h protodef.h auto/config.h feature.h \ +objects/optionstr.o: auto/osdef.h optionstr.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/os_unix.o: auto/osdef.h os_unix.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/os_unix.o: auto/osdef.h os_unix.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h os_unixx.h -objects/pathdef.o: auto/osdef.h auto/pathdef.c vim.h protodef.h auto/config.h feature.h \ +objects/pathdef.o: auto/osdef.h auto/pathdef.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/popupmenu.o: auto/osdef.h popupmenu.c vim.h protodef.h auto/config.h feature.h \ +objects/popupmenu.o: auto/osdef.h popupmenu.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/popupwin.o: auto/osdef.h popupwin.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/popupwin.o: auto/osdef.h popupwin.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/profiler.o: auto/osdef.h profiler.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/profiler.o: auto/osdef.h profiler.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/pty.o: auto/osdef.h pty.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/pty.o: auto/osdef.h pty.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/quickfix.o: auto/osdef.h quickfix.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/quickfix.o: auto/osdef.h quickfix.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/regexp.o: auto/osdef.h regexp.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/regexp.o: auto/osdef.h regexp.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h regexp_bt.c regexp_nfa.c -objects/register.o: auto/osdef.h register.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/register.o: auto/osdef.h register.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/screen.o: auto/osdef.h screen.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/screen.o: auto/osdef.h screen.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/scriptfile.o: auto/osdef.h scriptfile.c vim.h protodef.h auto/config.h feature.h \ +objects/scriptfile.o: auto/osdef.h scriptfile.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/search.o: auto/osdef.h search.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/search.o: auto/osdef.h search.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/session.o: auto/osdef.h session.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/session.o: auto/osdef.h session.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/sha256.o: auto/osdef.h sha256.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/sha256.o: auto/osdef.h sha256.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/sign.o: auto/osdef.h sign.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/sign.o: auto/osdef.h sign.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/sound.o: auto/osdef.h sound.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/sound.o: auto/osdef.h sound.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/spell.o: auto/osdef.h spell.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/spell.o: auto/osdef.h spell.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/spellfile.o: auto/osdef.h spellfile.c vim.h protodef.h auto/config.h feature.h \ +objects/spellfile.o: auto/osdef.h spellfile.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/spellsuggest.o: auto/osdef.h spellsuggest.c vim.h protodef.h auto/config.h feature.h \ +objects/spellsuggest.o: auto/osdef.h spellsuggest.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/strings.o: auto/osdef.h strings.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/strings.o: auto/osdef.h strings.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/syntax.o: auto/osdef.h syntax.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/syntax.o: auto/osdef.h syntax.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/tabpanel.o: auto/osdef.h tabpanel.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/tabpanel.o: auto/osdef.h tabpanel.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/tag.o: auto/osdef.h tag.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/tag.o: auto/osdef.h tag.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/term.o: auto/osdef.h term.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/term.o: auto/osdef.h term.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/terminal.o: auto/osdef.h terminal.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/terminal.o: auto/osdef.h terminal.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/testing.o: auto/osdef.h testing.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/testing.o: auto/osdef.h testing.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/textformat.o: auto/osdef.h textformat.c vim.h protodef.h auto/config.h feature.h \ +objects/textformat.o: auto/osdef.h textformat.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/textobject.o: auto/osdef.h textobject.c vim.h protodef.h auto/config.h feature.h \ +objects/textobject.o: auto/osdef.h textobject.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/textprop.o: auto/osdef.h textprop.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/textprop.o: auto/osdef.h textprop.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/time.o: auto/osdef.h time.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/time.o: auto/osdef.h time.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/tuple.o: auto/osdef.h tuple.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/tuple.o: auto/osdef.h tuple.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/typval.o: auto/osdef.h typval.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/typval.o: auto/osdef.h typval.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/ui.o: auto/osdef.h ui.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/ui.o: auto/osdef.h ui.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/undo.o: auto/osdef.h undo.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/undo.o: auto/osdef.h undo.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/usercmd.o: auto/osdef.h usercmd.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/usercmd.o: auto/osdef.h usercmd.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/userfunc.o: auto/osdef.h userfunc.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/userfunc.o: auto/osdef.h userfunc.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/version.o: auto/osdef.h version.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/version.o: auto/osdef.h version.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h version.h -objects/vim9class.o: auto/osdef.h vim9class.c vim.h protodef.h auto/config.h feature.h \ +objects/mnv9class.o: auto/osdef.h mnv9class.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ - ex_cmds.h spell.h proto.h globals.h errors.h vim9.h -objects/vim9cmds.o: auto/osdef.h vim9cmds.c vim.h protodef.h auto/config.h feature.h os_unix.h \ + ex_cmds.h spell.h proto.h globals.h errors.h mnv9.h +objects/mnv9cmds.o: auto/osdef.h mnv9cmds.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ - globals.h errors.h vim9.h -objects/vim9compile.o: auto/osdef.h vim9compile.c vim.h protodef.h auto/config.h feature.h \ + globals.h errors.h mnv9.h +objects/mnv9compile.o: auto/osdef.h mnv9compile.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ - ex_cmds.h spell.h proto.h globals.h errors.h vim9.h -objects/vim9execute.o: auto/osdef.h vim9execute.c vim.h protodef.h auto/config.h feature.h \ + ex_cmds.h spell.h proto.h globals.h errors.h mnv9.h +objects/mnv9execute.o: auto/osdef.h mnv9execute.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ - ex_cmds.h spell.h proto.h globals.h errors.h vim9.h -objects/vim9expr.o: auto/osdef.h vim9expr.c vim.h protodef.h auto/config.h feature.h os_unix.h \ + ex_cmds.h spell.h proto.h globals.h errors.h mnv9.h +objects/mnv9expr.o: auto/osdef.h mnv9expr.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ - globals.h errors.h vim9.h -objects/vim9generics.o: auto/osdef.h vim9generics.c vim.h protodef.h auto/config.h feature.h \ + globals.h errors.h mnv9.h +objects/mnv9generics.o: auto/osdef.h mnv9generics.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ - ex_cmds.h spell.h proto.h globals.h errors.h vim9.h -objects/vim9instr.o: auto/osdef.h vim9instr.c vim.h protodef.h auto/config.h feature.h \ + ex_cmds.h spell.h proto.h globals.h errors.h mnv9.h +objects/mnv9instr.o: auto/osdef.h mnv9instr.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ - ex_cmds.h spell.h proto.h globals.h errors.h vim9.h -objects/vim9script.o: auto/osdef.h vim9script.c vim.h protodef.h auto/config.h feature.h \ + ex_cmds.h spell.h proto.h globals.h errors.h mnv9.h +objects/mnv9script.o: auto/osdef.h mnv9script.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ - ex_cmds.h spell.h proto.h globals.h errors.h vim9.h -objects/vim9type.o: auto/osdef.h vim9type.c vim.h protodef.h auto/config.h feature.h os_unix.h \ + ex_cmds.h spell.h proto.h globals.h errors.h mnv9.h +objects/mnv9type.o: auto/osdef.h mnv9type.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ - globals.h errors.h vim9.h -objects/viminfo.o: auto/osdef.h viminfo.c vim.h protodef.h auto/config.h feature.h os_unix.h \ + globals.h errors.h mnv9.h +objects/mnvinfo.o: auto/osdef.h mnvinfo.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h version.h -objects/window.o: auto/osdef.h window.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/window.o: auto/osdef.h window.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/bufwrite.o: auto/osdef.h bufwrite.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/bufwrite.o: auto/osdef.h bufwrite.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/gui.o: auto/osdef.h gui.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/gui.o: auto/osdef.h gui.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/gui_gtk.o: auto/osdef.h gui_gtk.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/gui_gtk.o: auto/osdef.h gui_gtk.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h gui_gtk_f.h -objects/gui_gtk_f.o: auto/osdef.h gui_gtk_f.c vim.h protodef.h auto/config.h feature.h \ +objects/gui_gtk_f.o: auto/osdef.h gui_gtk_f.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h gui_gtk_f.h -objects/gui_motif.o: auto/osdef.h gui_motif.c vim.h protodef.h auto/config.h feature.h \ +objects/gui_motif.o: auto/osdef.h gui_motif.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ @@ -4454,105 +4454,105 @@ objects/gui_motif.o: auto/osdef.h gui_motif.c vim.h protodef.h auto/config.h fea ../pixmaps/tb_shell.xpm ../pixmaps/tb_replace.xpm \ ../pixmaps/tb_vsplit.xpm ../pixmaps/tb_maxwidth.xpm \ ../pixmaps/tb_minwidth.xpm -objects/gui_xmdlg.o: auto/osdef.h gui_xmdlg.c vim.h protodef.h auto/config.h feature.h \ +objects/gui_xmdlg.o: auto/osdef.h gui_xmdlg.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/gui_xmebw.o: auto/osdef.h gui_xmebw.c vim.h protodef.h auto/config.h feature.h \ +objects/gui_xmebw.o: auto/osdef.h gui_xmebw.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h gui_xmebwp.h gui_xmebw.h -objects/gui_gtk_x11.o: auto/osdef.h gui_gtk_x11.c vim.h protodef.h auto/config.h feature.h \ +objects/gui_gtk_x11.o: auto/osdef.h gui_gtk_x11.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h auto/gui_gtk_gresources.h \ - gui_gtk_f.h ../runtime/vim16x16_png.h ../runtime/vim32x32_png.h \ - ../runtime/vim48x48_png.h -objects/gui_x11.o: auto/osdef.h gui_x11.c vim.h protodef.h auto/config.h feature.h os_unix.h \ + gui_gtk_f.h ../runtime/mnv16x16_png.h ../runtime/mnv32x32_png.h \ + ../runtime/mnv48x48_png.h +objects/gui_x11.o: auto/osdef.h gui_x11.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ - globals.h errors.h ../runtime/vim32x32.xpm ../runtime/vim16x16.xpm \ - ../runtime/vim48x48.xpm errors.h vim_icon.xbm vim_mask.xbm -objects/gui_haiku.o: auto/osdef.h gui_haiku.cc vim.h protodef.h auto/config.h feature.h \ + globals.h errors.h ../runtime/mnv32x32.xpm ../runtime/mnv16x16.xpm \ + ../runtime/mnv48x48.xpm errors.h mnv_icon.xbm mnv_mask.xbm +objects/gui_haiku.o: auto/osdef.h gui_haiku.cc mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h version.h -objects/json_test.o: auto/osdef.h json_test.c main.c vim.h protodef.h auto/config.h feature.h \ +objects/json_test.o: auto/osdef.h json_test.c main.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h json.c -objects/kword_test.o: auto/osdef.h kword_test.c main.c vim.h protodef.h auto/config.h \ +objects/kword_test.o: auto/osdef.h kword_test.c main.c mnv.h protodef.h auto/config.h \ feature.h os_unix.h ascii.h keymap.h termdefs.h macros.h \ option.h beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h charset.c -objects/memfile_test.o: auto/osdef.h memfile_test.c main.c vim.h protodef.h auto/config.h \ +objects/memfile_test.o: auto/osdef.h memfile_test.c main.c mnv.h protodef.h auto/config.h \ feature.h os_unix.h ascii.h keymap.h termdefs.h macros.h \ option.h beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h memfile.c -objects/message_test.o: auto/osdef.h message_test.c main.c vim.h protodef.h auto/config.h \ +objects/message_test.o: auto/osdef.h message_test.c main.c mnv.h protodef.h auto/config.h \ feature.h os_unix.h ascii.h keymap.h termdefs.h macros.h \ option.h beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h message.c -objects/if_lua.o: auto/osdef.h if_lua.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/if_lua.o: auto/osdef.h if_lua.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h version.h -objects/if_mzsch.o: auto/osdef.h if_mzsch.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/if_mzsch.o: auto/osdef.h if_mzsch.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h if_mzsch.h -objects/if_perl.o: auto/osdef.h auto/if_perl.c vim.h protodef.h auto/config.h feature.h \ +objects/if_perl.o: auto/osdef.h auto/if_perl.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/if_python.o: auto/osdef.h if_python.c vim.h protodef.h auto/config.h feature.h \ +objects/if_python.o: auto/osdef.h if_python.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h if_py_both.h -objects/if_python3.o: auto/osdef.h if_python3.c vim.h protodef.h auto/config.h feature.h \ +objects/if_python3.o: auto/osdef.h if_python3.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h if_py_both.h -objects/if_tcl.o: auto/osdef.h if_tcl.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/if_tcl.o: auto/osdef.h if_tcl.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/if_ruby.o: auto/osdef.h if_ruby.c protodef.h auto/config.h vim.h feature.h os_unix.h \ +objects/if_ruby.o: auto/osdef.h if_ruby.c protodef.h auto/config.h mnv.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h version.h -objects/gui_beval.o: auto/osdef.h gui_beval.c vim.h protodef.h auto/config.h feature.h \ +objects/gui_beval.o: auto/osdef.h gui_beval.c mnv.h protodef.h auto/config.h feature.h \ os_unix.h ascii.h keymap.h termdefs.h macros.h option.h \ beval.h structs.h regexp.h gui.h \ libvterm/include/vterm.h libvterm/include/vterm_keycodes.h alloc.h \ ex_cmds.h spell.h proto.h globals.h errors.h -objects/netbeans.o: auto/osdef.h netbeans.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/netbeans.o: auto/osdef.h netbeans.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h version.h -objects/job.o: auto/osdef.h job.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/job.o: auto/osdef.h job.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ globals.h errors.h -objects/channel.o: auto/osdef.h channel.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/channel.o: auto/osdef.h channel.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h ex_cmds.h spell.h proto.h \ @@ -4564,7 +4564,7 @@ objects/ext-data-control-v1.o: auto/wayland/ext-data-control-v1.c objects/xdg-shell.o: auto/wayland/xdg-shell.c objects/primary-selection-unstable-v1.o: \ auto/wayland/primary-selection-unstable-v1.c -objects/wayland.o: auto/osdef.h wayland.c vim.h protodef.h auto/config.h feature.h os_unix.h \ +objects/wayland.o: auto/osdef.h wayland.c mnv.h protodef.h auto/config.h feature.h os_unix.h \ ascii.h keymap.h termdefs.h macros.h option.h beval.h \ structs.h regexp.h gui.h libvterm/include/vterm.h \ libvterm/include/vterm_keycodes.h alloc.h \ @@ -4597,7 +4597,7 @@ objects/vterm_vterm.o: auto/osdef.h libvterm/src/vterm.c libvterm/src/vterm_inte libvterm/include/vterm.h libvterm/include/vterm_keycodes.h \ libvterm/src/utf8.h objects/xdiffi.o: auto/osdef.h xdiff/xdiffi.c xdiff/xinclude.h auto/config.h \ - xdiff/xmacros.h xdiff/xdiff.h vim.h protodef.h \ + xdiff/xmacros.h xdiff/xdiff.h mnv.h protodef.h \ auto/config.h feature.h os_unix.h \ ascii.h keymap.h \ termdefs.h macros.h option.h beval.h \ @@ -4608,7 +4608,7 @@ objects/xdiffi.o: auto/osdef.h xdiff/xdiffi.c xdiff/xinclude.h auto/config.h \ errors.h xdiff/xtypes.h xdiff/xutils.h xdiff/xprepare.h \ xdiff/xdiffi.h xdiff/xemit.h objects/xemit.o: auto/osdef.h xdiff/xemit.c xdiff/xinclude.h auto/config.h \ - xdiff/xmacros.h xdiff/xdiff.h vim.h protodef.h \ + xdiff/xmacros.h xdiff/xdiff.h mnv.h protodef.h \ auto/config.h feature.h os_unix.h \ ascii.h keymap.h \ termdefs.h macros.h option.h beval.h \ @@ -4619,7 +4619,7 @@ objects/xemit.o: auto/osdef.h xdiff/xemit.c xdiff/xinclude.h auto/config.h \ errors.h xdiff/xtypes.h xdiff/xutils.h xdiff/xprepare.h \ xdiff/xdiffi.h xdiff/xemit.h objects/xprepare.o: auto/osdef.h xdiff/xprepare.c xdiff/xinclude.h auto/config.h \ - xdiff/xmacros.h xdiff/xdiff.h vim.h protodef.h \ + xdiff/xmacros.h xdiff/xdiff.h mnv.h protodef.h \ auto/config.h feature.h os_unix.h \ ascii.h keymap.h \ termdefs.h macros.h option.h beval.h \ @@ -4630,7 +4630,7 @@ objects/xprepare.o: auto/osdef.h xdiff/xprepare.c xdiff/xinclude.h auto/config.h errors.h xdiff/xtypes.h xdiff/xutils.h xdiff/xprepare.h \ xdiff/xdiffi.h xdiff/xemit.h objects/xutils.o: auto/osdef.h xdiff/xutils.c xdiff/xinclude.h auto/config.h \ - xdiff/xmacros.h xdiff/xdiff.h vim.h protodef.h \ + xdiff/xmacros.h xdiff/xdiff.h mnv.h protodef.h \ auto/config.h feature.h os_unix.h \ ascii.h keymap.h \ termdefs.h macros.h option.h beval.h \ @@ -4641,7 +4641,7 @@ objects/xutils.o: auto/osdef.h xdiff/xutils.c xdiff/xinclude.h auto/config.h \ errors.h xdiff/xtypes.h xdiff/xutils.h xdiff/xprepare.h \ xdiff/xdiffi.h xdiff/xemit.h objects/xhistogram.o: auto/osdef.h xdiff/xhistogram.c xdiff/xinclude.h auto/config.h \ - xdiff/xmacros.h xdiff/xdiff.h vim.h protodef.h \ + xdiff/xmacros.h xdiff/xdiff.h mnv.h protodef.h \ auto/config.h feature.h os_unix.h \ ascii.h keymap.h \ termdefs.h macros.h option.h beval.h \ @@ -4652,7 +4652,7 @@ objects/xhistogram.o: auto/osdef.h xdiff/xhistogram.c xdiff/xinclude.h auto/conf errors.h xdiff/xtypes.h xdiff/xutils.h xdiff/xprepare.h \ xdiff/xdiffi.h xdiff/xemit.h objects/xpatience.o: auto/osdef.h xdiff/xpatience.c xdiff/xinclude.h auto/config.h \ - xdiff/xmacros.h xdiff/xdiff.h vim.h protodef.h \ + xdiff/xmacros.h xdiff/xdiff.h mnv.h protodef.h \ auto/config.h feature.h os_unix.h \ ascii.h keymap.h \ termdefs.h macros.h option.h beval.h \ @@ -4790,16 +4790,16 @@ proto/undo.pro: undo.c proto/usercmd.pro: usercmd.c proto/userfunc.pro: userfunc.c proto/version.pro: version.c -proto/vim9class.pro: vim9class.c -proto/vim9cmds.pro: vim9cmds.c -proto/vim9compile.pro: vim9compile.c -proto/vim9execute.pro: vim9execute.c -proto/vim9expr.pro: vim9expr.c -proto/vim9generics.pro: vim9generics.c -proto/vim9instr.pro: vim9instr.c -proto/vim9script.pro: vim9script.c -proto/vim9type.pro: vim9type.c -proto/viminfo.pro: viminfo.c +proto/mnv9class.pro: mnv9class.c +proto/mnv9cmds.pro: mnv9cmds.c +proto/mnv9compile.pro: mnv9compile.c +proto/mnv9execute.pro: mnv9execute.c +proto/mnv9expr.pro: mnv9expr.c +proto/mnv9generics.pro: mnv9generics.c +proto/mnv9instr.pro: mnv9instr.c +proto/mnv9script.pro: mnv9script.c +proto/mnv9type.pro: mnv9type.c +proto/mnvinfo.pro: mnvinfo.c proto/wayland.pro: wayland.c proto/winclip.pro: winclip.c proto/window.pro: window.c diff --git a/uvim/src/README.md b/uvim/src/README.md index b5c9a87a78..0741bd7895 100644 --- a/uvim/src/README.md +++ b/uvim/src/README.md @@ -1,12 +1,12 @@ -![Vim Logo](https://github.com/vim/vim/blob/master/runtime/vimlogo.gif) +![MNV Logo](https://github.com/Project-Tick/Project-Tick/blob/master/runtime/mnvlogo.gif) -# Vim source code # +# MNV source code # Here are a few hints for finding your way around the source code. This doesn't make it less complex than it is, but it gets you started. You might also want to read -[`:help development`](http://vimdoc.sourceforge.net/htmldoc/develop.html#development). +[`:help development`](http://mnvdoc.sourceforge.net/htmldoc/develop.html#development). ## Jumping around ## @@ -35,14 +35,14 @@ clientserver.c | client server functionality clipboard.c | handling the clipboard cmdexpand.c | command-line completion cmdhist.c | command-line history -debugger.c | Vim script debugger -diff.c | diff mode (vimdiff) +debugger.c | MNV script debugger +diff.c | diff mode (mnvdiff) drawline.c | drawing a window line drawscreen.c | drawing the windows eval.c | expression evaluation evalbuffer.c | buffer related built-in functions evalfunc.c | built-in functions -evalvars.c | vim variables +evalvars.c | mnv variables evalwindow.c | window related built-in functions fileio.c | reading and writing files filepath.c | dealing with file names and paths @@ -51,7 +51,7 @@ fold.c | folding fuzzy.c | fuzzy matching getchar.c | getting characters and key mapping gc.c | garbage collection -help.c | vim help related functions +help.c | mnv help related functions highlight.c | syntax highlighting indent.c | text indentation insexpand.c | Insert mode completion @@ -71,7 +71,7 @@ option.c | options optionstr.c | handling string options popupmenu.c | popup menu popupwin.c | popup window -profiler.c | Vim script profiler +profiler.c | MNV script profiler quickfix.c | quickfix commands (":make", ":cn") regexp.c | pattern matching register.c | handling registers @@ -92,18 +92,18 @@ textformat.c | text formatting textobject.c | text objects textprop.c | text properties time.c | time and timer functions -typval.c | Vim script type/value functions +typval.c | MNV script type/value functions undo.c | undo and redo usercmd.c | user defined commands userfunc.c | user defined functions -viminfo.c | viminfo handling +mnvinfo.c | mnvinfo handling window.c | handling split windows ## Debugging ## If you have a reasonable recent version of gdb, you can use the `:Termdebug` -command to debug Vim. See `:help :Termdebug`. +command to debug MNV. See `:help :Termdebug`. When something is time critical or stepping through code is a hassle, use the channel logging to create a time-stamped log file. Add lines to the code like @@ -111,7 +111,7 @@ this: ch_log(NULL, "Value is now %02x", value); -After compiling and starting Vim, do: +After compiling and starting MNV, do: :call ch_logfile('debuglog', 'w') @@ -127,10 +127,10 @@ The current mode is stored in `State`. The values it can have are `NORMAL`, The current window is `curwin`. The current buffer is `curbuf`. These point to structures with the cursor position in the window, option values, the file name, etc. These are defined in -[`structs.h`](https://github.com/vim/vim/blob/master/src/structs.h). +[`structs.h`](https://github.com/Project-Tick/Project-Tick/blob/master/src/structs.h). All the global variables are declared in -[`globals.h`](https://github.com/vim/vim/blob/master/src/globals.h). +[`globals.h`](https://github.com/Project-Tick/Project-Tick/blob/master/src/globals.h). ## The main loop ## @@ -139,16 +139,16 @@ This is conveniently called `main_loop()`. It updates a few things and then calls `normal_cmd()` to process a command. This returns when the command is finished. -The basic idea is that Vim waits for the user to type a character and +The basic idea is that MNV waits for the user to type a character and processes it until another character is needed. Thus there are several places -where Vim waits for a character to be typed. The `vgetc()` function is used +where MNV waits for a character to be typed. The `vgetc()` function is used for this. It also handles mapping. Updating the screen is mostly postponed until a command or a sequence of commands has finished. The work is done by `update_screen()`, which calls `win_update()` for every window, which calls `win_line()` for every line. See the start of -[`screen.c`](https://github.com/vim/vim/blob/master/src/screen.c) +[`screen.c`](https://github.com/Project-Tick/Project-Tick/blob/master/src/screen.c) for more explanations. @@ -181,7 +181,7 @@ handles the optional count and an extra character for some commands. These are passed in a `cmdarg_t` to the function that handles the command. There is a table `nv_cmds` in -[`normal.c`](https://github.com/vim/vim/blob/master/src/normal.c) +[`normal.c`](https://github.com/Project-Tick/Project-Tick/blob/master/src/normal.c) which lists the first character of every command. The second entry of each item is the name of the function that handles the command. @@ -196,7 +196,7 @@ It returns when leaving Insert mode. ## Options ## There is a list with all option names in -[`option.c`](https://github.com/vim/vim/blob/master/src/option.c), +[`option.c`](https://github.com/Project-Tick/Project-Tick/blob/master/src/option.c), called `options[]`. @@ -206,7 +206,7 @@ Most of the GUI code is implemented like it was a clever terminal. Typing a character, moving a scrollbar, clicking the mouse, etc. are all translated into events which are written in the input buffer. These are read by the main code, just like reading from a terminal. The code for this is scattered -through [`gui.c`](https://github.com/vim/vim/blob/master/src/gui.c). +through [`gui.c`](https://github.com/Project-Tick/Project-Tick/blob/master/src/gui.c). For example, `gui_send_mouse_event()` for a mouse click and `gui_menu_cb()` for a menu action. Key hits are handled by the system-specific GUI code, which calls `add_to_input_buf()` to send the key code. @@ -219,19 +219,19 @@ system-specific GUI code will be called to do the work. ## Debugging the GUI ## -Remember to prevent that gvim forks and the debugger thinks Vim has exited, +Remember to prevent that gmnv forks and the debugger thinks MNV has exited, add the `-f` argument. In gdb: `run -f -g`. When stepping through display updating code, the focus event is triggered -when going from the debugger to Vim and back. To avoid this, recompile with +when going from the debugger to MNV and back. To avoid this, recompile with some code in `gui_focus_change()` disabled. ## Contributing ## -If you would like to help making Vim better, see the -[`CONTRIBUTING.md`](https://github.com/vim/vim/blob/master/CONTRIBUTING.md) +If you would like to help making MNV better, see the +[`CONTRIBUTING.md`](https://github.com/Project-Tick/Project-Tick/blob/master/CONTRIBUTING.md) file. -This is `README.md` for version 9.2 of the Vim source code. +This is `README.md` for version 9.2 of the MNV source code. diff --git a/uvim/src/alloc.c b/uvim/src/alloc.c index 0fa59ad6d6..2ba31e2d40 100644 --- a/uvim/src/alloc.c +++ b/uvim/src/alloc.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * alloc.c: functions for memory management */ -#include "vim.h" +#include "mnv.h" /********************************************************************** * Various routines dealing with allocation and deallocation of memory. @@ -79,7 +79,7 @@ mem_pre_free(void **pp) * called on exit via atexit() */ void -vim_mem_profile_dump(void) +mnv_mem_profile_dump(void) { int i, j; @@ -176,7 +176,7 @@ alloc_clear(size_t size) p = lalloc(size, TRUE); if (p != NULL) - (void)vim_memset(p, 0, size); + (void)mnv_memset(p, 0, size); return p; } @@ -203,7 +203,7 @@ lalloc_clear(size_t size, int message) p = lalloc(size, message); if (p != NULL) - (void)vim_memset(p, 0, size); + (void)mnv_memset(p, 0, size); return p; } @@ -356,7 +356,7 @@ do_outofmem_msg(size_t size) * Free everything that we allocated. * Can be used to detect memory leaks, e.g., with ccmalloc. * NOTE: This is tricky! Things are freed that functions depend on. Don't be - * surprised if Vim crashes... + * surprised if MNV crashes... * Some things can't be freed, esp. things local to a library function. */ void @@ -364,7 +364,7 @@ free_all_mem(void) { buf_T *buf, *nextbuf; - // When we cause a crash here it is caught and Vim tries to exit cleanly. + // When we cause a crash here it is caught and MNV tries to exit cleanly. // Don't try freeing everything again. if (entered_free_all_mem) return; @@ -458,10 +458,10 @@ free_all_mem(void) // Free some global vars. free_username(); # ifdef FEAT_CLIPBOARD - vim_regfree(clip_exclude_prog); + mnv_regfree(clip_exclude_prog); # endif - vim_free(last_cmdline); - vim_free(new_last_cmdline); + mnv_free(last_cmdline); + mnv_free(new_last_cmdline); set_keep_msg(NULL, 0); // Clear cmdline history. @@ -515,7 +515,7 @@ free_all_mem(void) ResetRedobuff(); # if defined(FEAT_CLIENTSERVER) && defined(FEAT_X11) - vim_free(serverDelayedStartName); + mnv_free(serverDelayedStartName); # endif // highlight info @@ -570,12 +570,12 @@ free_all_mem(void) gui_mch_free_all(); # endif # ifdef FEAT_TCL - vim_tcl_finalize(); + mnv_tcl_finalize(); # endif clear_hl_tables(); - vim_free(IObuff); - vim_free(NameBuff); + mnv_free(IObuff); + mnv_free(NameBuff); # ifdef FEAT_QUICKFIX check_quickfix_busy(); # endif @@ -591,7 +591,7 @@ free_all_mem(void) * Returns NULL when out of memory. */ char_u * -vim_memsave(char_u *p, size_t len) +mnv_memsave(char_u *p, size_t len) { char_u *ret = alloc(len); @@ -605,10 +605,10 @@ vim_memsave(char_u *p, size_t len) * Also skip free() when exiting for sure, this helps when we caught a deadly * signal that was caused by a crash in free(). * If you want to set NULL after calling this function, you should use - * VIM_CLEAR() instead. + * MNV_CLEAR() instead. */ void -vim_free(void *x) +mnv_free(void *x) { if (x != NULL && !really_exiting) { @@ -629,7 +629,7 @@ vim_free(void *x) void ga_clear(garray_T *gap) { - vim_free(gap->ga_data); + mnv_free(gap->ga_data); ga_init(gap); } @@ -643,7 +643,7 @@ ga_clear_strings(garray_T *gap) if (gap->ga_data != NULL) for (i = 0; i < gap->ga_len; ++i) - vim_free(((char_u **)(gap->ga_data))[i]); + mnv_free(((char_u **)(gap->ga_data))[i]); ga_clear(gap); } @@ -669,7 +669,7 @@ ga_copy_strings(garray_T *from, garray_T *to) copy = NULL; else { - copy = vim_strsave(orig); + copy = mnv_strsave(orig); if (copy == NULL) { to->ga_len = i; @@ -747,11 +747,11 @@ ga_grow_inner(garray_T *gap, int n) n = gap->ga_len / 2; new_len = (size_t)gap->ga_itemsize * (gap->ga_len + n); - pp = vim_realloc(gap->ga_data, new_len); + pp = mnv_realloc(gap->ga_data, new_len); if (pp == NULL) return FAIL; old_len = (size_t)gap->ga_itemsize * gap->ga_maxlen; - vim_memset(pp + old_len, 0, new_len - old_len); + mnv_memset(pp + old_len, 0, new_len - old_len); gap->ga_maxlen = gap->ga_len + n; gap->ga_data = pp; return OK; @@ -803,14 +803,14 @@ ga_concat_strings(garray_T *gap, char *sep) int ga_copy_string(garray_T *gap, char_u *p) { - char_u *cp = vim_strsave(p); + char_u *cp = mnv_strsave(p); if (cp == NULL) return FAIL; if (ga_grow(gap, 1) == FAIL) { - vim_free(cp); + mnv_free(cp); return FAIL; } ((char_u **)(gap->ga_data))[gap->ga_len++] = cp; diff --git a/uvim/src/alloc.h b/uvim/src/alloc.h index 651e01f241..281066fa49 100644 --- a/uvim/src/alloc.h +++ b/uvim/src/alloc.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* diff --git a/uvim/src/arabic.c b/uvim/src/arabic.c index bd339f4249..6882936d98 100644 --- a/uvim/src/arabic.c +++ b/uvim/src/arabic.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -28,7 +28,7 @@ * Stand-Alone - unicode form-B isolated */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_ARABIC) diff --git a/uvim/src/arglist.c b/uvim/src/arglist.c index 6fccf69c26..afe3abf4a2 100644 --- a/uvim/src/arglist.c +++ b/uvim/src/arglist.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * arglist.c: functions for dealing with the argument list */ -#include "vim.h" +#include "mnv.h" #define AL_SET 1 #define AL_ADD 2 @@ -41,7 +41,7 @@ alist_clear(alist_T *al) if (check_arglist_locked() == FAIL) return; while (--al->al_ga.ga_len >= 0) - vim_free(AARGLIST(al)[al->al_ga.ga_len].ae_fname); + mnv_free(AARGLIST(al)[al->al_ga.ga_len].ae_fname); ga_clear(&al->al_ga); } @@ -65,7 +65,7 @@ alist_unlink(alist_T *al) if (al != &global_alist && --al->al_refcount <= 0) { alist_clear(al); - vim_free(al); + mnv_free(al); } } @@ -110,11 +110,11 @@ alist_expand(int *fnum_list, int fnum_len) return; // Don't use 'suffixes' here. This should work like the shell did the - // expansion. Also, the vimrc file isn't read yet, thus the user + // expansion. Also, the mnvrc file isn't read yet, thus the user // can't set the options. p_su = empty_option; for (i = 0; i < GARGCOUNT; ++i) - old_arg_files[i] = vim_strsave(GARGLIST[i].ae_fname); + old_arg_files[i] = mnv_strsave(GARGLIST[i].ae_fname); old_arg_count = GARGCOUNT; if (expand_wildcards(old_arg_count, old_arg_files, &new_arg_file_count, &new_arg_files, @@ -157,7 +157,7 @@ alist_set( // When adding many buffers this can take a long time. Allow // interrupting here. while (i < count) - vim_free(files[i++]); + mnv_free(files[i++]); break; } @@ -173,7 +173,7 @@ alist_set( alist_add(al, files[i], use_curbuf ? 2 : 1); ui_breakcheck(); } - vim_free(files); + mnv_free(files); } else FreeWild(count, files); @@ -261,7 +261,7 @@ do_one_arg(char_u *str) else { // An item ends at a space not in backticks - if (!inbacktick && vim_isspace(*str)) + if (!inbacktick && mnv_isspace(*str)) break; if (*str == '`') inbacktick ^= TRUE; @@ -390,7 +390,7 @@ alist_add_list( } for (i = 0; i < count; ++i) - vim_free(files[i]); + mnv_free(files[i]); } /* @@ -414,19 +414,19 @@ arglist_del_files(garray_T *alist_ga) p = file_pat_to_reg_pat(p, NULL, NULL, FALSE); if (p == NULL) break; - regmatch.regprog = vim_regcomp(p, magic_isset() ? RE_MAGIC : 0); + regmatch.regprog = mnv_regcomp(p, magic_isset() ? RE_MAGIC : 0); if (regmatch.regprog == NULL) { - vim_free(p); + mnv_free(p); break; } didone = FALSE; for (match = 0; match < ARGCOUNT; ++match) - if (vim_regexec(®match, alist_name(&ARGLIST[match]), (colnr_T)0)) + if (mnv_regexec(®match, alist_name(&ARGLIST[match]), (colnr_T)0)) { didone = TRUE; - vim_free(ARGLIST[match].ae_fname); + mnv_free(ARGLIST[match].ae_fname); mch_memmove(ARGLIST + match, ARGLIST + match + 1, (ARGCOUNT - match - 1) * sizeof(aentry_T)); --ALIST(curwin)->al_ga.ga_len; @@ -435,8 +435,8 @@ arglist_del_files(garray_T *alist_ga) --match; } - vim_regfree(regmatch.regprog); - vim_free(p); + mnv_regfree(regmatch.regprog); + mnv_free(p); if (!didone) semsg(_(e_no_match_str_2), ((char_u **)alist_ga->ga_data)[i]); } @@ -495,7 +495,7 @@ do_arglist( if (what == AL_ADD) { alist_add_list(exp_count, exp_files, after, will_edit); - vim_free(exp_files); + mnv_free(exp_files); } else // what == AL_SET alist_set(ALIST(curwin), exp_count, exp_files, will_edit, NULL, 0); @@ -612,7 +612,7 @@ ex_args(exarg_T *eap) for (i = 0; i < ARGCOUNT; ++i) items[i] = alist_name(&ARGLIST[i]); list_in_columns(items, ARGCOUNT, curwin->w_arg_idx); - vim_free(items); + mnv_free(items); return; } @@ -629,7 +629,7 @@ ex_args(exarg_T *eap) if (GARGLIST[i].ae_fname != NULL) { AARGLIST(curwin->w_alist)[gap->ga_len].ae_fname = - vim_strsave(GARGLIST[i].ae_fname); + mnv_strsave(GARGLIST[i].ae_fname); AARGLIST(curwin->w_alist)[gap->ga_len].ae_fnum = GARGLIST[i].ae_fnum; ++gap->ga_len; @@ -734,7 +734,7 @@ do_argfile(exarg_T *eap, int argn) { p = fix_fname(alist_name(&ARGLIST[argn])); other = otherfile(p); - vim_free(p); + mnv_free(p); } if ((!buf_hide(curbuf) || !other) && check_changed(curbuf, CCGD_AW @@ -813,12 +813,12 @@ ex_argdedupe(exarg_T *eap UNUSED) break; // out of memory int areNamesDuplicate = fnamecmp(firstFullname, secondFullname) == 0; - vim_free(secondFullname); + mnv_free(secondFullname); if (areNamesDuplicate) { // remove one duplicate argument - vim_free(ARGLIST[j].ae_fname); + mnv_free(ARGLIST[j].ae_fname); mch_memmove(ARGLIST + j, ARGLIST + j + 1, (ARGCOUNT - j - 1) * sizeof(aentry_T)); --ARGCOUNT; @@ -832,7 +832,7 @@ ex_argdedupe(exarg_T *eap UNUSED) } } - vim_free(firstFullname); + mnv_free(firstFullname); } } @@ -911,7 +911,7 @@ ex_argdelete(exarg_T *eap) else { for (i = eap->line1; i <= eap->line2; ++i) - vim_free(ARGLIST[i - 1].ae_fname); + mnv_free(ARGLIST[i - 1].ae_fname); mch_memmove(ARGLIST + eap->line1 - 1, ARGLIST + eap->line2, (size_t)((ARGCOUNT - eap->line2) * sizeof(aentry_T))); ALIST(curwin)->al_ga.ga_len -= n; @@ -1233,7 +1233,7 @@ do_arg_all( if (ARGCOUNT <= 0) { // Don't give an error message. We don't want it when the ":all" - // command is in the .vimrc. + // command is in the .mnvrc. return; } setpcmark(); @@ -1316,7 +1316,7 @@ do_arg_all( win_enter(aall.new_curwin, FALSE); --autocmd_no_leave; - vim_free(aall.opened); + mnv_free(aall.opened); } /* @@ -1407,7 +1407,7 @@ f_argc(typval_T *argvars, typval_T *rettv) { win_T *wp; - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type == VAR_UNKNOWN) @@ -1445,7 +1445,7 @@ f_arglistid(typval_T *argvars, typval_T *rettv) { win_T *wp; - if (in_vim9script() + if (in_mnv9script() && (check_for_opt_number_arg(argvars, 0) == FAIL || (argvars[0].v_type != VAR_UNKNOWN && check_for_opt_number_arg(argvars, 1) == FAIL))) @@ -1481,7 +1481,7 @@ f_argv(typval_T *argvars, typval_T *rettv) aentry_T *arglist = NULL; int argcount = -1; - if (in_vim9script() + if (in_mnv9script() && (check_for_opt_number_arg(argvars, 0) == FAIL || (argvars[0].v_type != VAR_UNKNOWN && check_for_opt_number_arg(argvars, 1) == FAIL))) @@ -1520,7 +1520,7 @@ f_argv(typval_T *argvars, typval_T *rettv) rettv->vval.v_string = NULL; idx = tv_get_number_chk(&argvars[0], NULL); if (arglist != NULL && idx >= 0 && idx < argcount) - rettv->vval.v_string = vim_strsave(alist_name(&arglist[idx])); + rettv->vval.v_string = mnv_strsave(alist_name(&arglist[idx])); else if (idx == -1) get_arglist_as_rettv(arglist, argcount, rettv); } diff --git a/uvim/src/ascii.h b/uvim/src/ascii.h index ec839704ed..a48291c112 100644 --- a/uvim/src/ascii.h +++ b/uvim/src/ascii.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* diff --git a/uvim/src/auto/configure b/uvim/src/auto/configure index 8e73d97b1e..16bb7625dc 100755 --- a/uvim/src/auto/configure +++ b/uvim/src/auto/configure @@ -606,7 +606,7 @@ PACKAGE_STRING='' PACKAGE_BUGREPORT='' PACKAGE_URL='' -ac_unique_file="vim.h" +ac_unique_file="mnv.h" # Factoring default headers for most tests. ac_includes_default="\ #include @@ -740,13 +740,13 @@ vi_cv_path_luajit vi_cv_path_lua XDIFF_OBJS_USED compiledby -dogvimdiff -dovimdiff +dogmnvdiff +domnvdiff QUOTESED line_break VIEWNAME EXNAME -VIMNAME +MNVNAME OS_EXTRA_OBJ OS_EXTRA_SRC XCODE_SELECT @@ -815,7 +815,7 @@ enable_darwin with_mac_arch with_developer_dir with_local_dir -with_vim_name +with_mnv_name with_ex_name with_view_name with_global_runtime @@ -1531,7 +1531,7 @@ Optional Features: --disable-netbeans Disable NetBeans integration support. --disable-channel Disable process communication support. --enable-terminal Enable terminal emulation support. - --enable-autoservername Automatically define servername at vim startup. + --enable-autoservername Automatically define servername at mnv startup. --enable-socketserver Use sockets for clientserver communication. --enable-multibyte Include multibyte editing support. --disable-rightleft Do not include Right-to-Left language support. @@ -1566,7 +1566,7 @@ Optional Packages: --with-developer-dir=PATH use PATH as location for Xcode developer tools --with-local-dir=PATH search PATH instead of /usr/local for local libraries. --without-local-dir do not search /usr/local for local libraries. - --with-vim-name=NAME what to call the Vim executable + --with-mnv-name=NAME what to call the MNV executable --with-ex-name=NAME what to call the Ex executable --with-view-name=NAME what to call the View executable --with-global-runtime=DIR global runtime directory in 'runtimepath', comma-separated for multiple directories @@ -4944,40 +4944,40 @@ OS_EXTRA_SRC=""; OS_EXTRA_OBJ="" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking uname" >&5 printf %s "checking uname... " >&6; } -if test "x$vim_cv_uname_output" = "x" ; then - vim_cv_uname_output=`(uname) 2>/dev/null` - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_uname_output" >&5 -printf "%s\n" "$vim_cv_uname_output" >&6; } +if test "x$mnv_cv_uname_output" = "x" ; then + mnv_cv_uname_output=`(uname) 2>/dev/null` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_uname_output" >&5 +printf "%s\n" "$mnv_cv_uname_output" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_uname_output (cached)" >&5 -printf "%s\n" "$vim_cv_uname_output (cached)" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_uname_output (cached)" >&5 +printf "%s\n" "$mnv_cv_uname_output (cached)" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking uname -r" >&5 printf %s "checking uname -r... " >&6; } -if test "x$vim_cv_uname_r_output" = "x" ; then - vim_cv_uname_r_output=`(uname -r) 2>/dev/null` - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_uname_r_output" >&5 -printf "%s\n" "$vim_cv_uname_r_output" >&6; } +if test "x$mnv_cv_uname_r_output" = "x" ; then + mnv_cv_uname_r_output=`(uname -r) 2>/dev/null` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_uname_r_output" >&5 +printf "%s\n" "$mnv_cv_uname_r_output" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_uname_r_output (cached)" >&5 -printf "%s\n" "$vim_cv_uname_r_output (cached)" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_uname_r_output (cached)" >&5 +printf "%s\n" "$mnv_cv_uname_r_output (cached)" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking uname -m" >&5 printf %s "checking uname -m... " >&6; } -if test "x$vim_cv_uname_m_output" = "x" ; then - vim_cv_uname_m_output=`(uname -m) 2>/dev/null` - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_uname_m_output" >&5 -printf "%s\n" "$vim_cv_uname_m_output" >&6; } +if test "x$mnv_cv_uname_m_output" = "x" ; then + mnv_cv_uname_m_output=`(uname -m) 2>/dev/null` + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_uname_m_output" >&5 +printf "%s\n" "$mnv_cv_uname_m_output" >&6; } else - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_uname_m_output (cached)" >&5 -printf "%s\n" "$vim_cv_uname_m_output (cached)" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_uname_m_output (cached)" >&5 +printf "%s\n" "$mnv_cv_uname_m_output (cached)" >&6; } fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Haiku" >&5 printf %s "checking for Haiku... " >&6; } -case $vim_cv_uname_output in +case $mnv_cv_uname_output in Haiku) HAIKU=yes; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; };; *) HAIKU=no; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 @@ -4986,7 +4986,7 @@ esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for QNX" >&5 printf %s "checking for QNX... " >&6; } -case $vim_cv_uname_output in +case $mnv_cv_uname_output in QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o test -z "$with_x" && with_x=no QNX=yes; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 @@ -4997,7 +4997,7 @@ esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Darwin (Mac OS X)" >&5 printf %s "checking for Darwin (Mac OS X)... " >&6; } -if test "$vim_cv_uname_output" = Darwin; then +if test "$mnv_cv_uname_output" = Darwin; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } MACOS_X=yes @@ -5304,17 +5304,17 @@ fi fi fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking --with-vim-name argument" >&5 -printf %s "checking --with-vim-name argument... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking --with-mnv-name argument" >&5 +printf %s "checking --with-mnv-name argument... " >&6; } -# Check whether --with-vim-name was given. -if test ${with_vim_name+y} +# Check whether --with-mnv-name was given. +if test ${with_mnv_name+y} then : - withval=$with_vim_name; VIMNAME="$withval"; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $VIMNAME" >&5 -printf "%s\n" "$VIMNAME" >&6; } + withval=$with_mnv_name; MNVNAME="$withval"; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MNVNAME" >&5 +printf "%s\n" "$MNVNAME" >&6; } else case e in #( - e) VIMNAME="vim"; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Defaulting to $VIMNAME" >&5 -printf "%s\n" "Defaulting to $VIMNAME" >&6; } ;; + e) MNVNAME="mnv"; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Defaulting to $MNVNAME" >&5 +printf "%s\n" "Defaulting to $MNVNAME" >&6; } ;; esac fi @@ -5434,7 +5434,7 @@ esac if test "$cf_cv_ebcdic" = "yes"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for z/OS Unix" >&5 printf %s "checking for z/OS Unix... " >&6; } -case $vim_cv_uname_output in +case $mnv_cv_uname_output in OS/390) zOSUnix="yes"; if test "$CC" = "cc"; then ccm="$_CC_CCMODE" @@ -5851,17 +5851,17 @@ case "$features" in big) features="normal" ;; esac -dovimdiff="" -dogvimdiff="" +domnvdiff="" +dogmnvdiff="" case "$features" in tiny) printf "%s\n" "#define FEAT_TINY 1" >>confdefs.h ;; normal) printf "%s\n" "#define FEAT_NORMAL 1" >>confdefs.h - dovimdiff="installvimdiff"; - dogvimdiff="installgvimdiff" ;; + domnvdiff="installmnvdiff"; + dogmnvdiff="installgmnvdiff" ;; huge) printf "%s\n" "#define FEAT_HUGE 1" >>confdefs.h - dovimdiff="installvimdiff"; - dogvimdiff="installgvimdiff" ;; + domnvdiff="installmnvdiff"; + dogmnvdiff="installgmnvdiff" ;; *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Sorry, $features is not supported" >&5 printf "%s\n" "Sorry, $features is not supported" >&6; } ;; esac @@ -6179,7 +6179,7 @@ printf "%s\n" "yes" >&6; } printf "%s\n" "no" >&6; } # Detect moonjit: - # https://groups.google.com/forum/#!topic/vim_use/O0vek60WuTk + # https://groups.google.com/forum/#!topic/mnv_use/O0vek60WuTk lua_suf=/moonjit-2.3 inc_path="$vi_cv_path_lua_pfx/include" for dir in "$inc_path"/moonjit-[0-9]* ; do @@ -6322,7 +6322,7 @@ printf "%s\n" "yes" >&6; } fi if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \ test "x$MACOS_X" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \ - test "$vim_cv_uname_m_output" = "x86_64"; then + test "$mnv_cv_uname_m_output" = "x86_64"; then LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS" fi fi @@ -6571,8 +6571,8 @@ printf "%s\n" "not found" >&6; } fi if test "$GCC" = yes; then MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${path}" - elif test "$vim_cv_uname_output" = SunOS && - echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then + elif test "$mnv_cv_uname_output" = SunOS && + echo $mnv_cv_uname_r_output | grep '^5' >/dev/null; then MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}" fi fi @@ -7291,13 +7291,13 @@ printf "%s\n" "$vi_cv_dll_name_python" >&6; } printf %s "checking if -pthread should be used... " >&6; } threadsafe_flag= thread_lib= - if test "$vim_cv_uname_output" != Darwin; then + if test "$mnv_cv_uname_output" != Darwin; then test "$GCC" = yes && threadsafe_flag="-pthread" - if test "$vim_cv_uname_output" = FreeBSD; then + if test "$mnv_cv_uname_output" = FreeBSD; then threadsafe_flag="-D_THREAD_SAFE" thread_lib="-pthread" fi - if test "$vim_cv_uname_output" = SunOS; then + if test "$mnv_cv_uname_output" = SunOS; then threadsafe_flag="-pthreads" fi fi @@ -7744,13 +7744,13 @@ printf "%s\n" "$vi_cv_dll_name_python3" >&6; } printf %s "checking if -pthread should be used... " >&6; } threadsafe_flag= thread_lib= - if test "$vim_cv_uname_output" != Darwin; then + if test "$mnv_cv_uname_output" != Darwin; then test "$GCC" = yes && threadsafe_flag="-pthread" - if test "$vim_cv_uname_output" = FreeBSD; then + if test "$mnv_cv_uname_output" = FreeBSD; then threadsafe_flag="-D_THREAD_SAFE" thread_lib="-pthread" fi - if test "$vim_cv_uname_output" = SunOS; then + if test "$mnv_cv_uname_output" = SunOS; then threadsafe_flag="-pthreads" fi fi @@ -7873,7 +7873,7 @@ else case e in #( #include /* If this program fails, then RTLD_GLOBAL is needed. * RTLD_GLOBAL will be used and then it is not possible to - * have both python versions enabled in the same vim instance. + * have both python versions enabled in the same mnv instance. * Only the first python version used will be switched on. */ @@ -7943,7 +7943,7 @@ else case e in #( #include /* If this program fails, then RTLD_GLOBAL is needed. * RTLD_GLOBAL will be used and then it is not possible to - * have both python versions enabled in the same vim instance. + * have both python versions enabled in the same mnv instance. * Only the first python version used will be switched on. */ @@ -8433,8 +8433,8 @@ printf %s "checking for Tcl library by myself... " >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $try/lib$trylib" >&5 printf "%s\n" "$try/lib$trylib" >&6; } TCL_LIBS="-L\"$try\" -ltcl$ver -ldl -lm" - if test "$vim_cv_uname_output" = SunOS && - echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then + if test "$mnv_cv_uname_output" = SunOS && + echo $mnv_cv_uname_r_output | grep '^5' >/dev/null; then TCL_LIBS="$TCL_LIBS -R $try" fi break 3 @@ -8877,7 +8877,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether compiling with IPv6 networking is possible" >&5 printf %s "checking whether compiling with IPv6 networking is possible... " >&6; } -if test ${vim_cv_ipv6_networking+y} +if test ${mnv_cv_ipv6_networking+y} then : printf %s "(cached) " >&6 else case e in #( @@ -8919,19 +8919,19 @@ main (void) _ACEOF if ac_fn_c_try_link "$LINENO" then : - vim_cv_ipv6_networking="yes" + mnv_cv_ipv6_networking="yes" else case e in #( - e) vim_cv_ipv6_networking="no" ;; + e) mnv_cv_ipv6_networking="no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_ipv6_networking" >&5 -printf "%s\n" "$vim_cv_ipv6_networking" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_ipv6_networking" >&5 +printf "%s\n" "$mnv_cv_ipv6_networking" >&6; } - if test "x$vim_cv_ipv6_networking" = "xyes"; then + if test "x$mnv_cv_ipv6_networking" = "xyes"; then printf "%s\n" "#define FEAT_IPV6 1" >>confdefs.h ac_fn_c_check_func "$LINENO" "inet_ntop" "ac_cv_func_inet_ntop" @@ -8944,7 +8944,7 @@ fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether compiling with IPv4 networking is possible" >&5 printf %s "checking whether compiling with IPv4 networking is possible... " >&6; } -if test ${vim_cv_ipv4_networking+y} +if test ${mnv_cv_ipv4_networking+y} then : printf %s "(cached) " >&6 else case e in #( @@ -8984,17 +8984,17 @@ main (void) _ACEOF if ac_fn_c_try_link "$LINENO" then : - vim_cv_ipv4_networking="yes" + mnv_cv_ipv4_networking="yes" else case e in #( - e) vim_cv_ipv4_networking="no"; enable_netbeans="no"; enable_channel="no" ;; + e) mnv_cv_ipv4_networking="no"; enable_netbeans="no"; enable_channel="no" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_ipv4_networking" >&5 -printf "%s\n" "$vim_cv_ipv4_networking" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_ipv4_networking" >&5 +printf "%s\n" "$mnv_cv_ipv4_networking" >&6; } fi fi if test "$enable_netbeans" = "yes"; then @@ -9124,7 +9124,7 @@ fi printf "%s\n" "$enable_multibyte" >&6; } if test "$enable_multibyte" != "yes"; then as_fn_error $? "The multi-byte feature can no longer be disabled. If you have - a problem with this, discuss on the Vim mailing list." "$LINENO" 5 + a problem with this, discuss on the MNV mailing list." "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking --disable-rightleft argument" >&5 @@ -10198,8 +10198,8 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Corrected X libraries to $x_libraries" >&5 printf "%s\n" "Corrected X libraries to $x_libraries" >&6; } X_LIBS="$X_LIBS -L$x_libraries" - if test "$vim_cv_uname_output" = SunOS && - echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then + if test "$mnv_cv_uname_output" = SunOS && + echo $mnv_cv_uname_r_output | grep '^5' >/dev/null; then X_LIBS="$X_LIBS -R $x_libraries" fi fi @@ -11105,7 +11105,7 @@ printf "%s\n" "yes" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for FreeBSD" >&5 printf %s "checking for FreeBSD... " >&6; } - if test "$vim_cv_uname_output" = FreeBSD; then + if test "$mnv_cv_uname_output" = FreeBSD; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE" @@ -11438,8 +11438,8 @@ printf "%s\n" "in default path" >&6; } if test -n "$GUI_LIB_LOC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $GUI_LIB_LOC" >&5 printf "%s\n" "$GUI_LIB_LOC" >&6; } - if test "$vim_cv_uname_output" = SunOS && - echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then + if test "$mnv_cv_uname_output" = SunOS && + echo $mnv_cv_uname_r_output | grep '^5' >/dev/null; then GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC" fi fi @@ -11990,7 +11990,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CYGWIN or MSYS environment" >&5 printf %s "checking for CYGWIN or MSYS environment... " >&6; } -case $vim_cv_uname_output in +case $mnv_cv_uname_output in CYGWIN*|MSYS*) CYGWIN=yes; { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for CYGWIN clipboard support" >&5 @@ -12013,7 +12013,7 @@ esac { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether toupper is broken" >&5 printf %s "checking whether toupper is broken... " >&6; } -if test ${vim_cv_toupper_broken+y} +if test ${mnv_cv_toupper_broken+y} then : printf %s "(cached) " >&6 else case e in #( @@ -12021,9 +12021,9 @@ else case e in #( if test "$cross_compiling" = yes then : - vim_cv_toupper_broken=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'vim_cv_toupper_broken'" >&5 -printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'vim_cv_toupper_broken'" >&2;} + mnv_cv_toupper_broken=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'mnv_cv_toupper_broken'" >&5 +printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'mnv_cv_toupper_broken'" >&2;} else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -12041,11 +12041,11 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : - vim_cv_toupper_broken=yes + mnv_cv_toupper_broken=yes else case e in #( e) - vim_cv_toupper_broken=no + mnv_cv_toupper_broken=no ;; esac fi @@ -12056,10 +12056,10 @@ fi ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_toupper_broken" >&5 -printf "%s\n" "$vim_cv_toupper_broken" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_toupper_broken" >&5 +printf "%s\n" "$mnv_cv_toupper_broken" >&6; } -if test "x$vim_cv_toupper_broken" = "xyes" ; then +if test "x$mnv_cv_toupper_broken" = "xyes" ; then printf "%s\n" "#define BROKEN_TOUPPER 1" >>confdefs.h fi @@ -13365,7 +13365,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \ else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: empty: automatic terminal library selection" >&5 printf "%s\n" "empty: automatic terminal library selection" >&6; } - case "$vim_cv_uname_output" in + case "$mnv_cv_uname_output" in OSF1|SCO_SV) tlibs="tinfo ncurses curses termlib termcap";; *) tlibs="tinfo ncurses termlib termcap curses";; esac @@ -13499,7 +13499,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we talk terminfo" >&5 printf %s "checking whether we talk terminfo... " >&6; } -if test ${vim_cv_terminfo+y} +if test ${mnv_cv_terminfo+y} then : printf %s "(cached) " >&6 else case e in #( @@ -13507,9 +13507,9 @@ else case e in #( if test "$cross_compiling" = yes then : - vim_cv_terminfo=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'vim_cv_terminfo'" >&5 -printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'vim_cv_terminfo'" >&2;} + mnv_cv_terminfo=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'mnv_cv_terminfo'" >&5 +printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'mnv_cv_terminfo'" >&2;} else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13538,11 +13538,11 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : - vim_cv_terminfo=yes + mnv_cv_terminfo=yes else case e in #( e) - vim_cv_terminfo=no + mnv_cv_terminfo=no ;; esac fi @@ -13554,17 +13554,17 @@ fi ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_terminfo" >&5 -printf "%s\n" "$vim_cv_terminfo" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_terminfo" >&5 +printf "%s\n" "$mnv_cv_terminfo" >&6; } -if test "x$vim_cv_terminfo" = "xyes" ; then +if test "x$mnv_cv_terminfo" = "xyes" ; then printf "%s\n" "#define TERMINFO 1" >>confdefs.h fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking what tgetent() returns for an unknown terminal" >&5 printf %s "checking what tgetent() returns for an unknown terminal... " >&6; } -if test ${vim_cv_tgetent+y} +if test ${mnv_cv_tgetent+y} then : printf %s "(cached) " >&6 else case e in #( @@ -13572,9 +13572,9 @@ else case e in #( if test "$cross_compiling" = yes then : - vim_cv_tgetent=zero - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'vim_cv_tgetent'" >&5 -printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'vim_cv_tgetent'" >&2;} + mnv_cv_tgetent=zero + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'mnv_cv_tgetent'" >&5 +printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'mnv_cv_tgetent'" >&2;} else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13595,11 +13595,11 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : - vim_cv_tgetent=zero + mnv_cv_tgetent=zero else case e in #( e) - vim_cv_tgetent=non-zero + mnv_cv_tgetent=non-zero ;; esac fi @@ -13611,10 +13611,10 @@ fi ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_tgetent" >&5 -printf "%s\n" "$vim_cv_tgetent" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_tgetent" >&5 +printf "%s\n" "$mnv_cv_tgetent" >&6; } -if test "x$vim_cv_tgetent" = "xzero" ; then +if test "x$mnv_cv_tgetent" = "xzero" ; then printf "%s\n" "#define TGETENT_ZERO_ERR 0" >>confdefs.h fi @@ -13955,7 +13955,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking getcwd implementation is broken" >&5 printf %s "checking getcwd implementation is broken... " >&6; } -if test ${vim_cv_getcwd_broken+y} +if test ${mnv_cv_getcwd_broken+y} then : printf %s "(cached) " >&6 else case e in #( @@ -13963,9 +13963,9 @@ else case e in #( if test "$cross_compiling" = yes then : - vim_cv_getcwd_broken=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'vim_cv_getcwd_broken'" >&5 -printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'vim_cv_getcwd_broken'" >&2;} + mnv_cv_getcwd_broken=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'mnv_cv_getcwd_broken'" >&5 +printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'mnv_cv_getcwd_broken'" >&2;} else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -13988,11 +13988,11 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : - vim_cv_getcwd_broken=no + mnv_cv_getcwd_broken=no else case e in #( e) - vim_cv_getcwd_broken=yes + mnv_cv_getcwd_broken=yes ;; esac fi @@ -14004,10 +14004,10 @@ fi ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_getcwd_broken" >&5 -printf "%s\n" "$vim_cv_getcwd_broken" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_getcwd_broken" >&5 +printf "%s\n" "$mnv_cv_getcwd_broken" >&6; } -if test "x$vim_cv_getcwd_broken" = "xyes" ; then +if test "x$mnv_cv_getcwd_broken" = "xyes" ; then printf "%s\n" "#define BAD_GETCWD 1" >>confdefs.h ac_fn_c_check_func "$LINENO" "getwd" "ac_cv_func_getwd" @@ -14875,7 +14875,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for timer_create without -lrt" >&5 printf %s "checking for timer_create without -lrt... " >&6; } -if test ${vim_cv_timer_create+y} +if test ${mnv_cv_timer_create+y} then : printf %s "(cached) " >&6 else case e in #( @@ -14897,24 +14897,24 @@ main (void) _ACEOF if ac_fn_c_try_compile "$LINENO" then : - vim_cv_timer_create=yes + mnv_cv_timer_create=yes else case e in #( - e) vim_cv_timer_create=no + e) mnv_cv_timer_create=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_timer_create" >&5 -printf "%s\n" "$vim_cv_timer_create" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_timer_create" >&5 +printf "%s\n" "$mnv_cv_timer_create" >&6; } -if test "x$vim_cv_timer_create" = "xno" ; then +if test "x$mnv_cv_timer_create" = "xno" ; then save_LIBS="$LIBS" LIBS="$LIBS -lrt" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for timer_create with -lrt" >&5 printf %s "checking for timer_create with -lrt... " >&6; } -if test ${vim_cv_timer_create_with_lrt+y} +if test ${mnv_cv_timer_create_with_lrt+y} then : printf %s "(cached) " >&6 else case e in #( @@ -14936,41 +14936,41 @@ main (void) _ACEOF if ac_fn_c_try_compile "$LINENO" then : - vim_cv_timer_create_with_lrt=yes + mnv_cv_timer_create_with_lrt=yes else case e in #( - e) vim_cv_timer_create_with_lrt=no + e) mnv_cv_timer_create_with_lrt=no ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_timer_create_with_lrt" >&5 -printf "%s\n" "$vim_cv_timer_create_with_lrt" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_timer_create_with_lrt" >&5 +printf "%s\n" "$mnv_cv_timer_create_with_lrt" >&6; } LIBS="$save_LIBS" else - vim_cv_timer_create_with_lrt=no + mnv_cv_timer_create_with_lrt=no fi -if test "x$vim_cv_timer_create" = "xyes" || - test "x$vim_cv_timer_create_with_lrt" = "xyes"; then +if test "x$mnv_cv_timer_create" = "xyes" || + test "x$mnv_cv_timer_create_with_lrt" = "xyes"; then save_LIBS="$LIBS" - if test "x$vim_cv_timer_create_with_lrt" = "xyes" ; then + if test "x$mnv_cv_timer_create_with_lrt" = "xyes" ; then LIBS="$LIBS -lrt" fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if timer_create works" >&5 printf %s "checking if timer_create works... " >&6; } -if test ${vim_cv_timer_create_works+y} +if test ${mnv_cv_timer_create_works+y} then : printf %s "(cached) " >&6 else case e in #( e) if test "$cross_compiling" = yes then : - vim_cv_timer_create_works=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'vim_cv_timer_create_works'" >&5 -printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'vim_cv_timer_create_works'" >&2;} + mnv_cv_timer_create_works=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'mnv_cv_timer_create_works'" >&5 +printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'mnv_cv_timer_create_works'" >&2;} else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -15003,9 +15003,9 @@ main (void) _ACEOF if ac_fn_c_try_run "$LINENO" then : - vim_cv_timer_create_works=yes + mnv_cv_timer_create_works=yes else case e in #( - e) vim_cv_timer_create_works=no ;; + e) mnv_cv_timer_create_works=no ;; esac fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ @@ -15015,10 +15015,10 @@ fi ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_timer_create_works" >&5 -printf "%s\n" "$vim_cv_timer_create_works" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_timer_create_works" >&5 +printf "%s\n" "$mnv_cv_timer_create_works" >&6; } - if test "x$vim_cv_timer_create_works" = "xyes" ; then + if test "x$mnv_cv_timer_create_works" = "xyes" ; then printf "%s\n" "#define HAVE_TIMER_CREATE 1" >>confdefs.h else @@ -15028,7 +15028,7 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stat() ignores a trailing slash" >&5 printf %s "checking whether stat() ignores a trailing slash... " >&6; } -if test ${vim_cv_stat_ignores_slash+y} +if test ${mnv_cv_stat_ignores_slash+y} then : printf %s "(cached) " >&6 else case e in #( @@ -15036,9 +15036,9 @@ else case e in #( if test "$cross_compiling" = yes then : - vim_cv_stat_ignores_slash=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'vim_cv_stat_ignores_slash'" >&5 -printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'vim_cv_stat_ignores_slash'" >&2;} + mnv_cv_stat_ignores_slash=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'mnv_cv_stat_ignores_slash'" >&5 +printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'mnv_cv_stat_ignores_slash'" >&2;} else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -15057,11 +15057,11 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : - vim_cv_stat_ignores_slash=yes + mnv_cv_stat_ignores_slash=yes else case e in #( e) - vim_cv_stat_ignores_slash=no + mnv_cv_stat_ignores_slash=no ;; esac fi @@ -15073,10 +15073,10 @@ fi ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_stat_ignores_slash" >&5 -printf "%s\n" "$vim_cv_stat_ignores_slash" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_stat_ignores_slash" >&5 +printf "%s\n" "$mnv_cv_stat_ignores_slash" >&6; } -if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then +if test "x$mnv_cv_stat_ignores_slash" = "xyes" ; then printf "%s\n" "#define STAT_IGNORES_SLASH 1" >>confdefs.h fi @@ -16247,9 +16247,9 @@ printf "%s\n" "#define SIZEOF_OFF_T $ac_cv_sizeof_off_t" >>confdefs.h -printf "%s\n" "#define VIM_SIZEOF_INT $ac_cv_sizeof_int" >>confdefs.h +printf "%s\n" "#define MNV_SIZEOF_INT $ac_cv_sizeof_int" >>confdefs.h -printf "%s\n" "#define VIM_SIZEOF_LONG $ac_cv_sizeof_long" >>confdefs.h +printf "%s\n" "#define MNV_SIZEOF_LONG $ac_cv_sizeof_long" >>confdefs.h { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking uint32_t is 32 bits" >&5 @@ -16314,7 +16314,7 @@ int main() { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether memmove handles overlaps" >&5 printf %s "checking whether memmove handles overlaps... " >&6; } -if test ${vim_cv_memmove_handles_overlap+y} +if test ${mnv_cv_memmove_handles_overlap+y} then : printf %s "(cached) " >&6 else case e in #( @@ -16322,9 +16322,9 @@ else case e in #( if test "$cross_compiling" = yes then : - vim_cv_memmove_handles_overlap=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'vim_cv_memmove_handles_overlap'" >&5 -printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'vim_cv_memmove_handles_overlap'" >&2;} + mnv_cv_memmove_handles_overlap=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'mnv_cv_memmove_handles_overlap'" >&5 +printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'mnv_cv_memmove_handles_overlap'" >&2;} else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -16334,11 +16334,11 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : - vim_cv_memmove_handles_overlap=yes + mnv_cv_memmove_handles_overlap=yes else case e in #( e) - vim_cv_memmove_handles_overlap=no + mnv_cv_memmove_handles_overlap=no ;; esac fi @@ -16350,16 +16350,16 @@ fi ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_memmove_handles_overlap" >&5 -printf "%s\n" "$vim_cv_memmove_handles_overlap" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_memmove_handles_overlap" >&5 +printf "%s\n" "$mnv_cv_memmove_handles_overlap" >&6; } -if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then +if test "x$mnv_cv_memmove_handles_overlap" = "xyes" ; then printf "%s\n" "#define USEMEMMOVE 1" >>confdefs.h else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether bcopy handles overlaps" >&5 printf %s "checking whether bcopy handles overlaps... " >&6; } -if test ${vim_cv_bcopy_handles_overlap+y} +if test ${mnv_cv_bcopy_handles_overlap+y} then : printf %s "(cached) " >&6 else case e in #( @@ -16367,9 +16367,9 @@ else case e in #( if test "$cross_compiling" = yes then : - vim_cv_bcopy_handles_overlap=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'vim_cv_bcopy_handles_overlap'" >&5 -printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'vim_cv_bcopy_handles_overlap'" >&2;} + mnv_cv_bcopy_handles_overlap=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'mnv_cv_bcopy_handles_overlap'" >&5 +printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'mnv_cv_bcopy_handles_overlap'" >&2;} else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -16379,11 +16379,11 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : - vim_cv_bcopy_handles_overlap=yes + mnv_cv_bcopy_handles_overlap=yes else case e in #( e) - vim_cv_bcopy_handles_overlap=no + mnv_cv_bcopy_handles_overlap=no ;; esac fi @@ -16395,16 +16395,16 @@ fi ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_bcopy_handles_overlap" >&5 -printf "%s\n" "$vim_cv_bcopy_handles_overlap" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_bcopy_handles_overlap" >&5 +printf "%s\n" "$mnv_cv_bcopy_handles_overlap" >&6; } - if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then + if test "x$mnv_cv_bcopy_handles_overlap" = "xyes" ; then printf "%s\n" "#define USEBCOPY 1" >>confdefs.h else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether memcpy handles overlaps" >&5 printf %s "checking whether memcpy handles overlaps... " >&6; } -if test ${vim_cv_memcpy_handles_overlap+y} +if test ${mnv_cv_memcpy_handles_overlap+y} then : printf %s "(cached) " >&6 else case e in #( @@ -16412,9 +16412,9 @@ else case e in #( if test "$cross_compiling" = yes then : - vim_cv_memcpy_handles_overlap=yes - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'vim_cv_memcpy_handles_overlap'" >&5 -printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'vim_cv_memcpy_handles_overlap'" >&2;} + mnv_cv_memcpy_handles_overlap=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cross-compiling: consider setting 'mnv_cv_memcpy_handles_overlap'" >&5 +printf "%s\n" "$as_me: WARNING: cross-compiling: consider setting 'mnv_cv_memcpy_handles_overlap'" >&2;} else case e in #( e) cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -16424,11 +16424,11 @@ _ACEOF if ac_fn_c_try_run "$LINENO" then : - vim_cv_memcpy_handles_overlap=yes + mnv_cv_memcpy_handles_overlap=yes else case e in #( e) - vim_cv_memcpy_handles_overlap=no + mnv_cv_memcpy_handles_overlap=no ;; esac fi @@ -16440,10 +16440,10 @@ fi ;; esac fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $vim_cv_memcpy_handles_overlap" >&5 -printf "%s\n" "$vim_cv_memcpy_handles_overlap" >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $mnv_cv_memcpy_handles_overlap" >&5 +printf "%s\n" "$mnv_cv_memcpy_handles_overlap" >&6; } - if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then + if test "x$mnv_cv_memcpy_handles_overlap" = "xyes" ; then printf "%s\n" "#define USEMEMCPY 1" >>confdefs.h fi @@ -16855,7 +16855,7 @@ printf "%s\n" "broken" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } - MSGFMT_DESKTOP="gvim.desktop vim.desktop" + MSGFMT_DESKTOP="gmnv.desktop mnv.desktop" fi else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 diff --git a/uvim/src/auto/nmake/tools.mak b/uvim/src/auto/nmake/tools.mak index d1672ca9fb..7d9634dff8 100644 --- a/uvim/src/auto/nmake/tools.mak +++ b/uvim/src/auto/nmake/tools.mak @@ -43,4 +43,4 @@ TOUCH = if exist %1 (copy /b %1+,, %1) else (break> %1) # {New-Item $$input -Type file} !ENDIF -# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=79 ft=make: +# mnv: set noet sw=8 ts=8 sts=0 wm=0 tw=79 ft=make: diff --git a/uvim/src/auto/wayland/Makefile b/uvim/src/auto/wayland/Makefile index e88b3b86e7..77dbbbc96c 100644 --- a/uvim/src/auto/wayland/Makefile +++ b/uvim/src/auto/wayland/Makefile @@ -49,4 +49,4 @@ clean: .PHONY: all clean -# vim:ts=8:sw=8:tw=78 +# mnv:ts=8:sw=8:tw=78 diff --git a/uvim/src/auto/wayland/README.txt b/uvim/src/auto/wayland/README.txt index ee0de0a775..d5ce095af3 100644 --- a/uvim/src/auto/wayland/README.txt +++ b/uvim/src/auto/wayland/README.txt @@ -6,6 +6,6 @@ To re-generate them run make. It requires wayland-scanner to be installed, which is generally found as wayland-utils package in Linux distributions. -Included as of Vim patch v9.1.1485 (2025 Jun 27). +Included as of MNV patch v9.1.1485 (2025 Jun 27). Initial work done by Foxe Chen. diff --git a/uvim/src/autocmd.c b/uvim/src/autocmd.c index 8fe51dc92f..fc52d7ffb1 100644 --- a/uvim/src/autocmd.c +++ b/uvim/src/autocmd.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * autocmd.c: Autocommand related functions */ -#include "vim.h" +#include "mnv.h" /* * The autocommands are stored in a list for each event. @@ -159,6 +159,12 @@ static keyvalue_T event_tab[NUM_EVENTS] = { KEYVALUE_ENTRY(-EVENT_INSERTLEAVEPRE, "InsertLeavePre"), KEYVALUE_ENTRY(EVENT_KEYINPUTPRE, "KeyInputPre"), KEYVALUE_ENTRY(EVENT_MENUPOPUP, "MenuPopup"), + KEYVALUE_ENTRY(EVENT_MNVENTER, "MNVEnter"), + KEYVALUE_ENTRY(EVENT_MNVLEAVE, "MNVLeave"), + KEYVALUE_ENTRY(EVENT_MNVLEAVEPRE, "MNVLeavePre"), + KEYVALUE_ENTRY(EVENT_MNVRESIZED, "MNVResized"), + KEYVALUE_ENTRY(EVENT_MNVRESUME, "MNVResume"), + KEYVALUE_ENTRY(EVENT_MNVSUSPEND, "MNVSuspend"), KEYVALUE_ENTRY(EVENT_MODECHANGED, "ModeChanged"), KEYVALUE_ENTRY(EVENT_OPTIONSET, "OptionSet"), KEYVALUE_ENTRY(EVENT_QUICKFIXCMDPOST, "QuickFixCmdPost"), @@ -197,12 +203,6 @@ static keyvalue_T event_tab[NUM_EVENTS] = { KEYVALUE_ENTRY(-EVENT_TEXTCHANGEDT, "TextChangedT"), KEYVALUE_ENTRY(-EVENT_TEXTYANKPOST, "TextYankPost"), KEYVALUE_ENTRY(EVENT_USER, "User"), - KEYVALUE_ENTRY(EVENT_VIMENTER, "VimEnter"), - KEYVALUE_ENTRY(EVENT_VIMLEAVE, "VimLeave"), - KEYVALUE_ENTRY(EVENT_VIMLEAVEPRE, "VimLeavePre"), - KEYVALUE_ENTRY(EVENT_VIMRESIZED, "VimResized"), - KEYVALUE_ENTRY(EVENT_VIMRESUME, "VimResume"), - KEYVALUE_ENTRY(EVENT_VIMSUSPEND, "VimSuspend"), KEYVALUE_ENTRY(-EVENT_WINCLOSED, "WinClosed"), KEYVALUE_ENTRY(-EVENT_WINENTER, "WinEnter"), KEYVALUE_ENTRY(-EVENT_WINLEAVE, "WinLeave"), @@ -360,7 +360,7 @@ theend: static void au_remove_pat(AutoPat *ap) { - VIM_CLEAR(ap->pat); + MNV_CLEAR(ap->pat); ap->buflocal_nr = -1; au_need_clean = TRUE; } @@ -374,14 +374,14 @@ au_remove_cmds(AutoPat *ap) AutoCmd *ac; for (ac = ap->cmds; ac != NULL; ac = ac->next) - VIM_CLEAR(ac->cmd); + MNV_CLEAR(ac->cmd); au_need_clean = TRUE; } // Delete one command from an autocmd pattern. static void au_del_cmd(AutoCmd *ac) { - VIM_CLEAR(ac->cmd); + MNV_CLEAR(ac->cmd); au_need_clean = TRUE; } @@ -418,8 +418,8 @@ au_cleanup(void) if (ap->pat == NULL || ac->cmd == NULL) { *prev_ac = ac->next; - vim_free(ac->cmd); - vim_free(ac); + mnv_free(ac->cmd); + mnv_free(ac); } else { @@ -446,8 +446,8 @@ au_cleanup(void) last_autopat[(int)event] = (AutoPat *)prev_ap; } *prev_ap = ap->next; - vim_regfree(ap->reg_prog); - vim_free(ap); + mnv_regfree(ap->reg_prog); + mnv_free(ap); } else prev_ap = &(ap->next); @@ -512,7 +512,7 @@ au_new_group(char_u *name) if (i == augroups.ga_len && ga_grow(&augroups, 1) == FAIL) return AUGROUP_ERROR; - AUGROUP_NAME(i) = vim_strsave(name); + AUGROUP_NAME(i) = mnv_strsave(name); if (AUGROUP_NAME(i) == NULL) return AUGROUP_ERROR; if (i == augroups.ga_len) @@ -554,7 +554,7 @@ au_del_group(char_u *name) break; } } - vim_free(AUGROUP_NAME(i)); + mnv_free(AUGROUP_NAME(i)); if (in_use) AUGROUP_NAME(i) = get_deleted_augroup(); else @@ -645,7 +645,7 @@ free_all_autocmds(void) { s = ((char_u **)(augroups.ga_data))[i]; if (s != get_deleted_augroup()) - vim_free(s); + mnv_free(s); } ga_clear(&augroups); @@ -680,7 +680,7 @@ event_name2nr(char_u *start, char_u **end) static keyvalue_T *bufread = &event_tab[BUFREAD_INDEX]; // the event name ends with end of line, '|', a blank or a comma - for (p = start; *p && !VIM_ISWHITE(*p) && *p != ',' && *p != '|'; ++p) + for (p = start; *p && !MNV_ISWHITE(*p) && *p != ',' && *p != '|'; ++p) ; target.key = 0; @@ -774,7 +774,7 @@ find_end_event( if (*arg == '*') { - if (arg[1] && !VIM_ISWHITE(arg[1])) + if (arg[1] && !MNV_ISWHITE(arg[1])) { semsg(_(e_illegal_character_after_star_str), arg); return NULL; @@ -783,7 +783,7 @@ find_end_event( } else { - for (pat = arg; *pat && *pat != '|' && !VIM_ISWHITE(*pat); pat = p) + for (pat = arg; *pat && *pat != '|' && !MNV_ISWHITE(*pat); pat = p) { if ((int)event_name2nr(pat, &p) >= NUM_EVENTS) { @@ -866,14 +866,14 @@ au_event_disable(char *what) size_t p_ei_len; p_ei_len = STRLEN(p_ei); - save_ei = vim_strnsave(p_ei, p_ei_len); + save_ei = mnv_strnsave(p_ei, p_ei_len); if (save_ei == NULL) return NULL; - new_ei = vim_strnsave(p_ei, p_ei_len + STRLEN(what)); + new_ei = mnv_strnsave(p_ei, p_ei_len + STRLEN(what)); if (new_ei == NULL) { - vim_free(save_ei); + mnv_free(save_ei); return NULL; } @@ -883,7 +883,7 @@ au_event_disable(char *what) STRCPY(new_ei + p_ei_len, what); set_string_option_direct((char_u *)"ei", -1, new_ei, OPT_FREE, SID_NONE); - vim_free(new_ei); + mnv_free(new_ei); return save_ei; } @@ -894,7 +894,7 @@ au_event_restore(char_u *old_ei) { set_string_option_direct((char_u *)"ei", -1, old_ei, OPT_FREE, SID_NONE); - vim_free(old_ei); + mnv_free(old_ei); } } #endif // FEAT_SYN_HL @@ -985,14 +985,14 @@ do_autocmd(exarg_T *eap, char_u *arg_in, int forceit) * Scan over the pattern. Put a NUL at the end. */ cmd = pat; - while (*cmd && (!VIM_ISWHITE(*cmd) || cmd[-1] == '\\')) + while (*cmd && (!MNV_ISWHITE(*cmd) || cmd[-1] == '\\')) cmd++; if (*cmd) *cmd++ = NUL; // Expand environment variables in the pattern. Set 'shellslash', we // want forward slashes here. - if (vim_strchr(pat, '$') != NULL || vim_strchr(pat, '~') != NULL) + if (mnv_strchr(pat, '$') != NULL || mnv_strchr(pat, '~') != NULL) { #ifdef BACKSLASH_IN_FILENAME int p_ssl_save = p_ssl; @@ -1014,7 +1014,7 @@ do_autocmd(exarg_T *eap, char_u *arg_in, int forceit) continue; // Check for "++once" flag. - if (STRNCMP(cmd, "++once", 6) == 0 && VIM_ISWHITE(cmd[6])) + if (STRNCMP(cmd, "++once", 6) == 0 && MNV_ISWHITE(cmd[6])) { if (once) semsg(_(e_duplicate_argument_str), "++once"); @@ -1023,7 +1023,7 @@ do_autocmd(exarg_T *eap, char_u *arg_in, int forceit) } // Check for "++nested" flag. - if ((STRNCMP(cmd, "++nested", 8) == 0 && VIM_ISWHITE(cmd[8]))) + if ((STRNCMP(cmd, "++nested", 8) == 0 && MNV_ISWHITE(cmd[8]))) { if (nested) { @@ -1035,9 +1035,9 @@ do_autocmd(exarg_T *eap, char_u *arg_in, int forceit) } // Check for the old "nested" flag in legacy script. - if (STRNCMP(cmd, "nested", 6) == 0 && VIM_ISWHITE(cmd[6])) + if (STRNCMP(cmd, "nested", 6) == 0 && MNV_ISWHITE(cmd[6])) { - if (in_vim9script()) + if (in_mnv9script()) { // If there ever is a :nested command this error should // be removed and "nested" accepted as the start of the @@ -1097,16 +1097,16 @@ do_autocmd(exarg_T *eap, char_u *arg_in, int forceit) } else { - while (*arg && *arg != '|' && !VIM_ISWHITE(*arg)) + while (*arg && *arg != '|' && !MNV_ISWHITE(*arg)) if (do_autocmd_event(event_name2nr(arg, &arg), pat, once, nested, cmd, forceit, group, flags) == FAIL) break; } if (cmd_need_free) - vim_free(cmd); - vim_free(tofree); - vim_free(envpat); + mnv_free(cmd); + mnv_free(tofree); + mnv_free(envpat); } /* @@ -1123,12 +1123,12 @@ au_get_grouparg(char_u **argp) char_u *arg = *argp; int group = AUGROUP_ALL; - for (p = arg; *p && !VIM_ISWHITE(*p) && *p != '|'; ++p) + for (p = arg; *p && !MNV_ISWHITE(*p) && *p != '|'; ++p) ; if (p <= arg) return AUGROUP_ALL; - group_name = vim_strnsave(arg, p - arg); + group_name = mnv_strnsave(arg, p - arg); if (group_name == NULL) // out of memory return AUGROUP_ERROR; group = au_find_group(group_name); @@ -1136,7 +1136,7 @@ au_get_grouparg(char_u **argp) group = AUGROUP_ALL; // no match, use all groups else *argp = skipwhite(p); // match, skip over group name - vim_free(group_name); + mnv_free(group_name); return group; } @@ -1331,11 +1331,11 @@ do_autocmd_event( ap = ALLOC_ONE(AutoPat); if (ap == NULL) return FAIL; - ap->pat = vim_strnsave(pat, patlen); + ap->pat = mnv_strnsave(pat, patlen); ap->patlen = patlen; if (ap->pat == NULL) { - vim_free(ap); + mnv_free(ap); return FAIL; } @@ -1376,12 +1376,12 @@ do_autocmd_event( reg_pat = file_pat_to_reg_pat(pat, endpat, &ap->allow_dirs, TRUE); if (reg_pat != NULL) - ap->reg_prog = vim_regcomp(reg_pat, RE_MAGIC); - vim_free(reg_pat); + ap->reg_prog = mnv_regcomp(reg_pat, RE_MAGIC); + mnv_free(reg_pat); if (reg_pat == NULL || ap->reg_prog == NULL) { - vim_free(ap->pat); - vim_free(ap); + mnv_free(ap->pat); + mnv_free(ap); return FAIL; } } @@ -1404,16 +1404,16 @@ do_autocmd_event( ac = ALLOC_ONE(AutoCmd); if (ac == NULL) return FAIL; - ac->cmd = vim_strsave(cmd); + ac->cmd = mnv_strsave(cmd); ac->script_ctx = current_sctx; - if (flags & UC_VIM9) - ac->script_ctx.sc_version = SCRIPT_VERSION_VIM9; + if (flags & UC_MNV9) + ac->script_ctx.sc_version = SCRIPT_VERSION_MNV9; #ifdef FEAT_EVAL ac->script_ctx.sc_lnum += SOURCING_LNUM; #endif if (ac->cmd == NULL) { - vim_free(ac); + mnv_free(ac); return FAIL; } ac->next = NULL; @@ -1471,7 +1471,7 @@ do_doautocmd( /* * Loop over the events. */ - while (*arg && !ends_excmd(*arg) && !VIM_ISWHITE(*arg)) + while (*arg && !ends_excmd(*arg) && !MNV_ISWHITE(*arg)) if (apply_autocmds_group(event_name2nr(arg, &arg), fname, NULL, TRUE, group, curbuf, NULL)) nothing_done = FALSE; @@ -1766,9 +1766,9 @@ win_found: // directory before restoring tp_localdir and globaldir. if (awp->w_localdir != NULL) win_fix_current_dir(); - vim_free(curtab->tp_localdir); + mnv_free(curtab->tp_localdir); curtab->tp_localdir = aco->tp_localdir; - vim_free(globaldir); + mnv_free(globaldir); globaldir = aco->globaldir; // the buffer contents may have changed @@ -2214,7 +2214,7 @@ apply_autocmds_group( else autocmd_fname = fname_io; if (autocmd_fname != NULL) - autocmd_fname = vim_strsave(autocmd_fname); + autocmd_fname = mnv_strsave(autocmd_fname); autocmd_fname_full = FALSE; // call FullName_save() later /* @@ -2246,17 +2246,17 @@ apply_autocmds_group( else { if (buf->b_sfname != NULL) - sfname = vim_strsave(buf->b_sfname); + sfname = mnv_strsave(buf->b_sfname); fname = buf->b_ffname; } } if (fname == NULL) fname = (char_u *)""; - fname = vim_strsave(fname); // make a copy, so we can change it + fname = mnv_strsave(fname); // make a copy, so we can change it } else { - sfname = vim_strsave(fname); + sfname = mnv_strsave(fname); // Don't try expanding FileType, Syntax, FuncUndefined, WindowID, // ColorScheme, QuickFixCmd*, DirChanged and similar. if (event == EVENT_FILETYPE @@ -2288,7 +2288,7 @@ apply_autocmds_group( || event == EVENT_WINSCROLLED || event == EVENT_TERMRESPONSEALL) { - fname = vim_strsave(fname); + fname = mnv_strsave(fname); autocmd_fname_full = TRUE; // don't expand it later } else @@ -2296,7 +2296,7 @@ apply_autocmds_group( } if (fname == NULL) // out of memory { - vim_free(sfname); + mnv_free(sfname); retval = FALSE; goto BYPASS_AU; } @@ -2390,11 +2390,11 @@ apply_autocmds_group( #ifdef FEAT_EVAL // set v:cmdarg (only when there is a matching pattern) - save_cmdbang = (long)get_vim_var_nr(VV_CMDBANG); + save_cmdbang = (long)get_mnv_var_nr(VV_CMDBANG); if (eap != NULL) { save_cmdarg = set_cmdarg(eap, NULL); - set_vim_var_nr(VV_CMDBANG, (long)eap->forceit); + set_mnv_var_nr(VV_CMDBANG, (long)eap->forceit); } else save_cmdarg = NULL; // avoid gcc warning @@ -2431,7 +2431,7 @@ apply_autocmds_group( if (eap != NULL) { (void)set_cmdarg(NULL, save_cmdarg); - set_vim_var_nr(VV_CMDBANG, save_cmdbang); + set_mnv_var_nr(VV_CMDBANG, save_cmdbang); } #endif // delete from active_apc_list @@ -2444,10 +2444,10 @@ apply_autocmds_group( autocmd_busy = save_autocmd_busy; filechangeshell_busy = FALSE; autocmd_nested = save_autocmd_nested; - vim_free(SOURCING_NAME); + mnv_free(SOURCING_NAME); ESTACK_CHECK_NOW; estack_pop(); - vim_free(autocmd_fname); + mnv_free(autocmd_fname); autocmd_fname = save_autocmd_fname; autocmd_fname_full = save_autocmd_fname_full; autocmd_bufnr = save_autocmd_bufnr; @@ -2461,8 +2461,8 @@ apply_autocmds_group( # endif #endif KeyTyped = save_KeyTyped; - vim_free(fname); - vim_free(sfname); + mnv_free(fname); + mnv_free(sfname); --nesting; // see matching increment above /* @@ -2480,14 +2480,14 @@ apply_autocmds_group( { buf_T *b = au_pending_free_buf->b_next; - vim_free(au_pending_free_buf); + mnv_free(au_pending_free_buf); au_pending_free_buf = b; } while (au_pending_free_win != NULL) { win_T *w = au_pending_free_win->w_next; - vim_free(au_pending_free_win); + mnv_free(au_pending_free_win); au_pending_free_win = w; } } @@ -2500,8 +2500,8 @@ apply_autocmds_group( && (event == EVENT_BUFREADPOST || event == EVENT_BUFWRITEPOST || event == EVENT_FILEAPPENDPOST - || event == EVENT_VIMLEAVE - || event == EVENT_VIMLEAVEPRE)) + || event == EVENT_MNVLEAVE + || event == EVENT_MNVLEAVEPRE)) { if (curbuf->b_changed != save_changed) need_maketitle = TRUE; @@ -2542,12 +2542,12 @@ block_autocmds(void) // Remember the value of v:termresponse. if (autocmd_blocked == 0) { - old_termresponse = get_vim_var_str(VV_TERMRESPONSE); - old_termu7resp = get_vim_var_str(VV_TERMU7RESP); - old_termblinkresp = get_vim_var_str(VV_TERMBLINKRESP); - old_termrbgresp = get_vim_var_str(VV_TERMRBGRESP); - old_termrfgresp = get_vim_var_str(VV_TERMRFGRESP); - old_termstyleresp = get_vim_var_str(VV_TERMSTYLERESP); + old_termresponse = get_mnv_var_str(VV_TERMRESPONSE); + old_termu7resp = get_mnv_var_str(VV_TERMU7RESP); + old_termblinkresp = get_mnv_var_str(VV_TERMBLINKRESP); + old_termrbgresp = get_mnv_var_str(VV_TERMRBGRESP); + old_termrfgresp = get_mnv_var_str(VV_TERMRFGRESP); + old_termstyleresp = get_mnv_var_str(VV_TERMSTYLERESP); } #endif ++autocmd_blocked; @@ -2561,31 +2561,31 @@ unblock_autocmds(void) #ifdef FEAT_EVAL // When v:termresponse, etc, were set while autocommands were blocked, // trigger the autocommands now. Esp. useful when executing a shell - // command during startup (vimdiff). + // command during startup (mnvdiff). if (autocmd_blocked == 0) { - if (get_vim_var_str(VV_TERMRESPONSE) != old_termresponse) + if (get_mnv_var_str(VV_TERMRESPONSE) != old_termresponse) { apply_autocmds(EVENT_TERMRESPONSE, NULL, NULL, FALSE, curbuf); apply_autocmds(EVENT_TERMRESPONSEALL, (char_u *)"version", NULL, FALSE, curbuf); } - if (get_vim_var_str(VV_TERMU7RESP) != old_termu7resp) + if (get_mnv_var_str(VV_TERMU7RESP) != old_termu7resp) { apply_autocmds(EVENT_TERMRESPONSEALL, (char_u *)"ambiguouswidth", NULL, FALSE, curbuf); } - if (get_vim_var_str(VV_TERMBLINKRESP) != old_termblinkresp) + if (get_mnv_var_str(VV_TERMBLINKRESP) != old_termblinkresp) { apply_autocmds(EVENT_TERMRESPONSEALL, (char_u *)"cursorblink", NULL, FALSE, curbuf); } - if (get_vim_var_str(VV_TERMRBGRESP) != old_termrbgresp) + if (get_mnv_var_str(VV_TERMRBGRESP) != old_termrbgresp) { apply_autocmds(EVENT_TERMRESPONSEALL, (char_u *)"background", NULL, FALSE, curbuf); } - if (get_vim_var_str(VV_TERMRFGRESP) != old_termrfgresp) + if (get_mnv_var_str(VV_TERMRFGRESP) != old_termrfgresp) { apply_autocmds(EVENT_TERMRESPONSEALL, (char_u *)"foreground", NULL, FALSE, curbuf); } - if (get_vim_var_str(VV_TERMSTYLERESP) != old_termstyleresp) + if (get_mnv_var_str(VV_TERMSTYLERESP) != old_termstyleresp) { apply_autocmds(EVENT_TERMRESPONSEALL, (char_u *)"cursorshape", NULL, FALSE, curbuf); } @@ -2617,7 +2617,7 @@ auto_next_pat( entry = ((estack_T *)exestack.ga_data) + exestack.ga_len - 1; // Clear the exestack entry for this ETYPE_AUCMD entry. - VIM_CLEAR(entry->es_name); + MNV_CLEAR(entry->es_name); entry->es_info.aucmd = NULL; for (ap = apc->curpat; ap != NULL && !got_int; ap = ap->next) @@ -2734,7 +2734,7 @@ getnextac( msg_puts("\n"); // don't overwrite this either verbose_leave_scroll(); } - retval = vim_strsave(ac->cmd); + retval = mnv_strsave(ac->cmd); // Remove one-shot ("once") autocmd in anticipation of its execution. if (ac->once) au_del_cmd(ac); @@ -2770,7 +2770,7 @@ has_autocmd(event_T event, char_u *sfname, buf_T *buf) * Replace all backslashes with forward slashes. This makes the * autocommand patterns portable between Unix and MS-DOS. */ - sfname = vim_strsave(sfname); + sfname = mnv_strsave(sfname); if (sfname != NULL) forward_slash(sfname); forward_slash(fname); @@ -2788,9 +2788,9 @@ has_autocmd(event_T event, char_u *sfname, buf_T *buf) break; } - vim_free(fname); + mnv_free(fname); #ifdef BACKSLASH_IN_FILENAME - vim_free(sfname); + mnv_free(sfname); #endif return retval; @@ -2831,14 +2831,14 @@ set_context_in_autocmd( if (group == AUGROUP_ERROR) return NULL; // If there only is a group name that's what we expand. - if (*arg == NUL && group != AUGROUP_ALL && !VIM_ISWHITE(arg[-1])) + if (*arg == NUL && group != AUGROUP_ALL && !MNV_ISWHITE(arg[-1])) { arg = p; group = AUGROUP_ALL; } // skip over event name - for (p = arg; *p != NUL && !VIM_ISWHITE(*p); ++p) + for (p = arg; *p != NUL && !MNV_ISWHITE(*p); ++p) if (*p == ',') arg = p + 1; if (*p == NUL) @@ -2852,7 +2852,7 @@ set_context_in_autocmd( // skip over pattern arg = skipwhite(p); - while (*arg && (!VIM_ISWHITE(*arg) || arg[-1] == '\\')) + while (*arg && (!MNV_ISWHITE(*arg) || arg[-1] == '\\')) arg++; if (*arg) return arg; // expand (next) command @@ -2959,10 +2959,10 @@ au_exists(char_u *arg) int retval = FALSE; // Make a copy so that we can change the '#' chars to a NUL. - arg_save = vim_strsave(arg); + arg_save = mnv_strsave(arg); if (arg_save == NULL) return FALSE; - p = vim_strchr(arg_save, '#'); + p = mnv_strchr(arg_save, '#'); if (p != NULL) *p++ = NUL; @@ -2985,7 +2985,7 @@ au_exists(char_u *arg) // Must be "Group#Event" or "Group#Event#pat". event_name = p; - p = vim_strchr(event_name, '#'); + p = mnv_strchr(event_name, '#'); if (p != NULL) *p++ = NUL; // "Group#Event#pat" } @@ -3027,7 +3027,7 @@ au_exists(char_u *arg) } theend: - vim_free(arg_save); + mnv_free(arg_save); return retval; } @@ -3073,8 +3073,8 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete) FOR_ALL_LIST_ITEMS(aucmd_list, li) { - VIM_CLEAR(group_name); - VIM_CLEAR(cmd); + MNV_CLEAR(group_name); + MNV_CLEAR(cmd); event_name = NULL; event_list = NULL; pat = NULL; @@ -3154,7 +3154,7 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete) if (bnum == -1) continue; - vim_snprintf((char *)IObuff, IOSIZE, "", (int)bnum); + mnv_snprintf((char *)IObuff, IOSIZE, "", (int)bnum); pat = IObuff; } else @@ -3200,7 +3200,7 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete) if (cmd == NULL) { if (delete) - cmd = vim_strsave((char_u *)""); + cmd = mnv_strsave((char_u *)""); else continue; } @@ -3305,8 +3305,8 @@ autocmd_add_or_delete(typval_T *argvars, typval_T *rettv, int delete) au_del_group(group_name); } - VIM_CLEAR(group_name); - VIM_CLEAR(cmd); + MNV_CLEAR(group_name); + MNV_CLEAR(cmd); current_augroup = save_augroup; rettv->vval.v_number = retval; @@ -3370,11 +3370,11 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv) if (group == AUGROUP_ERROR) { semsg(_(e_no_such_group_str), name); - vim_free(name); + mnv_free(name); return; } } - vim_free(name); + mnv_free(name); } // return only the autocmds for the specified event @@ -3399,12 +3399,12 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv) if (entry == NULL) { semsg(_(e_no_such_event_str), name); - vim_free(name); + mnv_free(name); return; } event_arg = (event_T)abs(entry->key); } - vim_free(name); + mnv_free(name); } // return only the autocmds for the specified pattern @@ -3451,7 +3451,7 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv) if (event_dict == NULL || list_append_dict(event_list, event_dict) == FAIL) { - vim_free(pat); + mnv_free(pat); return; } @@ -3469,14 +3469,14 @@ f_autocmd_get(typval_T *argvars, typval_T *rettv) || dict_add_bool(event_dict, "nested", ac->nested) == FAIL) { - vim_free(pat); + mnv_free(pat); return; } } } } - vim_free(pat); + mnv_free(pat); } #endif diff --git a/uvim/src/beval.c b/uvim/src/beval.c index 14288e8afd..2e8caaac87 100644 --- a/uvim/src/beval.c +++ b/uvim/src/beval.c @@ -1,14 +1,14 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * Visual Workshop integration by Gordon Prieur * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_BEVAL) || defined(FEAT_PROP_POPUP) /* @@ -96,7 +96,7 @@ find_word_under_cursor( len = epos->col - spos->col; if (*p_sel != 'e') len += mb_ptr2len(lbuf + epos->col); - lbuf = vim_strnsave(lbuf + spos->col, len); + lbuf = mnv_strnsave(lbuf + spos->col, len); lnum = spos->lnum; col = spos->col; scol = col; @@ -110,7 +110,7 @@ find_word_under_cursor( --emsg_off; if (len == 0) return FAIL; - lbuf = vim_strnsave(lbuf, len); + lbuf = mnv_strnsave(lbuf, len); } } else @@ -162,12 +162,12 @@ get_beval_info( winp, lnump, textp, colp, NULL) == OK) { # ifdef FEAT_VARTABS - vim_free(beval->vts); + mnv_free(beval->vts); beval->vts = tabstop_copy((*winp)->w_buffer->b_p_vts_array); if ((*winp)->w_buffer->b_p_vts_array != NULL && beval->vts == NULL) { if (getword) - vim_free(*textp); + mnv_free(*textp); return FAIL; } # endif @@ -245,13 +245,13 @@ bexpr_eval( for (cw = firstwin; cw != wp; cw = cw->w_next) ++winnr; - set_vim_var_nr(VV_BEVAL_BUFNR, (long)wp->w_buffer->b_fnum); - set_vim_var_nr(VV_BEVAL_WINNR, winnr); - set_vim_var_nr(VV_BEVAL_WINID, wp->w_id); - set_vim_var_nr(VV_BEVAL_LNUM, (long)lnum); - set_vim_var_nr(VV_BEVAL_COL, (long)(col + 1)); - set_vim_var_string(VV_BEVAL_TEXT, text, -1); - vim_free(text); + set_mnv_var_nr(VV_BEVAL_BUFNR, (long)wp->w_buffer->b_fnum); + set_mnv_var_nr(VV_BEVAL_WINNR, winnr); + set_mnv_var_nr(VV_BEVAL_WINID, wp->w_id); + set_mnv_var_nr(VV_BEVAL_LNUM, (long)lnum); + set_mnv_var_nr(VV_BEVAL_COL, (long)(col + 1)); + set_mnv_var_string(VV_BEVAL_TEXT, text, -1); + mnv_free(text); use_sandbox = was_set_insecurely(wp, (char_u *)"balloonexpr", *wp->w_buffer->b_p_bexpr == NUL ? 0 : OPT_LOCAL); @@ -269,7 +269,7 @@ bexpr_eval( else current_sctx = curbuf->b_p_script_ctx[BV_BEXPR]; - vim_free(result); + mnv_free(result); result = eval_to_string(bexpr, TRUE, TRUE); // Remove one trailing newline, it is added when the result was a @@ -287,7 +287,7 @@ bexpr_eval( --textlock; current_sctx = save_sctx; - set_vim_var_string(VV_BEVAL_TEXT, NULL, -1); + set_mnv_var_string(VV_BEVAL_TEXT, NULL, -1); if (result != NULL && result[0] != NUL) post_balloon(beval, result, NULL); diff --git a/uvim/src/beval.h b/uvim/src/beval.h index 694bec4dc5..56674a4000 100644 --- a/uvim/src/beval.h +++ b/uvim/src/beval.h @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * Visual Workshop integration by Gordon Prieur * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ #if !defined(BEVAL__H) && defined(FEAT_BEVAL) diff --git a/uvim/src/bigmnv.bat b/uvim/src/bigmnv.bat new file mode 100644 index 0000000000..090342ea40 --- /dev/null +++ b/uvim/src/bigmnv.bat @@ -0,0 +1,5 @@ +:: command to build huge MNV with OLE, Lua, Perl, Python, Racket, Ruby and Tcl +SET VCDIR="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\" +SET TOOLDIR=E:\ +%VCDIR%nmake -f Make_mvc.mak GUI=yes OLE=yes LUA=%TOOLDIR%lua53 DYNAMIC_LUA=yes LUA_VER=53 PERL=%TOOLDIR%perl524 DYNAMIC_PERL=yes PERL_VER=524 PYTHON=%TOOLDIR%python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=%TOOLDIR%python36 DYNAMIC_PYTHON3=yes PYTHON3_VER=36 MZSCHEME=%TOOLDIR%Racket DYNAMIC_MZSCHEME=yes MZSCHEME_VER=3m_a36fs8 RUBY=%TOOLDIR%ruby24 DYNAMIC_RUBY=yes RUBY_VER=24 RUBY_API_VER_LONG=2.4.0 RUBY_MSVCRT_NAME=msvcrt TCL=%TOOLDIR%ActiveTcl TCL_VER=86 TCL_VER_LONG=8.6 DYNAMIC_TCL=yes TCL_DLL=tcl86t.dll %1 IME=yes CSCOPE=yes DIRECTX=yes + diff --git a/uvim/src/bigmnv64.bat b/uvim/src/bigmnv64.bat new file mode 100644 index 0000000000..b166aa2324 --- /dev/null +++ b/uvim/src/bigmnv64.bat @@ -0,0 +1,7 @@ +:: command to build huge MNV 64 bit with OLE, Perl and Python. +:: First run: %VCDIR%\vcvarsall.bat x86_amd64 +:: Ruby and Tcl are excluded, doesn't seem to work. +SET VCDIR="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\" +SET TOOLDIR=E:\ +%VCDIR%\bin\nmake -f Make_mvc.mak CPU=AMD64 GUI=yes OLE=yes PERL=E:\perl524 DYNAMIC_PERL=yes PERL_VER=524 PYTHON=%TOOLDIR%python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=%TOOLDIR%python35 DYNAMIC_PYTHON3=yes PYTHON3_VER=35 %1 IME=yes CSCOPE=yes + diff --git a/uvim/src/bigvim.bat b/uvim/src/bigvim.bat deleted file mode 100644 index a092547f11..0000000000 --- a/uvim/src/bigvim.bat +++ /dev/null @@ -1,5 +0,0 @@ -:: command to build huge Vim with OLE, Lua, Perl, Python, Racket, Ruby and Tcl -SET VCDIR="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\" -SET TOOLDIR=E:\ -%VCDIR%nmake -f Make_mvc.mak GUI=yes OLE=yes LUA=%TOOLDIR%lua53 DYNAMIC_LUA=yes LUA_VER=53 PERL=%TOOLDIR%perl524 DYNAMIC_PERL=yes PERL_VER=524 PYTHON=%TOOLDIR%python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=%TOOLDIR%python36 DYNAMIC_PYTHON3=yes PYTHON3_VER=36 MZSCHEME=%TOOLDIR%Racket DYNAMIC_MZSCHEME=yes MZSCHEME_VER=3m_a36fs8 RUBY=%TOOLDIR%ruby24 DYNAMIC_RUBY=yes RUBY_VER=24 RUBY_API_VER_LONG=2.4.0 RUBY_MSVCRT_NAME=msvcrt TCL=%TOOLDIR%ActiveTcl TCL_VER=86 TCL_VER_LONG=8.6 DYNAMIC_TCL=yes TCL_DLL=tcl86t.dll %1 IME=yes CSCOPE=yes DIRECTX=yes - diff --git a/uvim/src/bigvim64.bat b/uvim/src/bigvim64.bat deleted file mode 100644 index 7025374f91..0000000000 --- a/uvim/src/bigvim64.bat +++ /dev/null @@ -1,7 +0,0 @@ -:: command to build huge Vim 64 bit with OLE, Perl and Python. -:: First run: %VCDIR%\vcvarsall.bat x86_amd64 -:: Ruby and Tcl are excluded, doesn't seem to work. -SET VCDIR="C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\" -SET TOOLDIR=E:\ -%VCDIR%\bin\nmake -f Make_mvc.mak CPU=AMD64 GUI=yes OLE=yes PERL=E:\perl524 DYNAMIC_PERL=yes PERL_VER=524 PYTHON=%TOOLDIR%python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=%TOOLDIR%python35 DYNAMIC_PYTHON3=yes PYTHON3_VER=35 %1 IME=yes CSCOPE=yes - diff --git a/uvim/src/blob.c b/uvim/src/blob.c index bbdf2873d0..1017a09181 100644 --- a/uvim/src/blob.c +++ b/uvim/src/blob.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * blob.c: Blob support by Yasuhiro Matsumoto */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) @@ -77,7 +77,7 @@ blob_copy(blob_T *from, typval_T *to) if (len > 0) { to->vval.v_blob->bv_ga.ga_data = - vim_memsave(from->bv_ga.ga_data, len); + mnv_memsave(from->bv_ga.ga_data, len); if (to->vval.v_blob->bv_ga.ga_data == NULL) len = 0; } @@ -91,7 +91,7 @@ blob_copy(blob_T *from, typval_T *to) blob_free(blob_T *b) { ga_clear(&b->bv_ga); - vim_free(b); + mnv_free(b); } /* @@ -226,7 +226,7 @@ read_blob(FILE *fd, typval_T *rettv, off_T offset, off_T size_arg) } if (size <= 0) return OK; - if (offset != 0 && vim_fseek(fd, offset, whence) != 0) + if (offset != 0 && mnv_fseek(fd, offset, whence) != 0) return OK; if (ga_grow(&blob->bv_ga, (int)size) == FAIL) @@ -283,7 +283,7 @@ blob2string(blob_T *blob, char_u **tofree, char_u *numbuf) if (i > 0 && (i & 3) == 0) GA_CONCAT_LITERAL(&ga, "."); - numbuflen = vim_snprintf_safelen((char *)numbuf, NUMBUFLEN, + numbuflen = mnv_snprintf_safelen((char *)numbuf, NUMBUFLEN, "%02X", blob_get(blob, i)); ga_concat_len(&ga, numbuf, numbuflen); } @@ -314,7 +314,7 @@ blob2items(typval_T *argvars, typval_T *rettv) if (list_append_list(rettv->vval.v_list, l2) == FAIL) { - vim_free(l2); + mnv_free(l2); return; } @@ -339,13 +339,13 @@ string2blob(char_u *str) if (s[0] != '0' || (s[1] != 'z' && s[1] != 'Z')) goto failed; s += 2; - while (vim_isxdigit(*s)) + while (mnv_isxdigit(*s)) { - if (!vim_isxdigit(s[1])) + if (!mnv_isxdigit(s[1])) goto failed; ga_append(&blob->bv_ga, (hex2nr(s[0]) << 4) + hex2nr(s[1])); s += 2; - if (*s == '.' && vim_isxdigit(s[1])) + if (*s == '.' && mnv_isxdigit(s[1])) ++s; } if (*skipwhite(s) != NUL) @@ -528,7 +528,7 @@ blob_add(typval_T *argvars, typval_T *rettv) if (b == NULL) { - if (in_vim9script()) + if (in_mnv9script()) emsg(_(e_cannot_add_to_null_blob)); return; } @@ -603,7 +603,7 @@ blob_remove(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg) newblob->bv_ga.ga_len = end - idx + 1; if (ga_grow(&newblob->bv_ga, end - idx + 1) == FAIL) { - vim_free(newblob); + mnv_free(newblob); return; } p = (char_u *)b->bv_ga.ga_data; @@ -657,8 +657,8 @@ blob_filter_map( b_ret = rettv->vval.v_blob; } - // set_vim_var_nr() doesn't set the type - set_vim_var_type(VV_KEY, VAR_NUMBER); + // set_mnv_var_nr() doesn't set the type + set_mnv_var_type(VV_KEY, VAR_NUMBER); int prev_lock = b->bv_lock; if (b->bv_lock == 0) @@ -672,7 +672,7 @@ blob_filter_map( tv.v_type = VAR_NUMBER; val = blob_get(b, i); tv.vval.v_number = val; - set_vim_var_nr(VV_KEY, idx); + set_mnv_var_nr(VV_KEY, idx); if (filter_map_one(&tv, expr, filtermap, fc, &newtv, &rem) == FAIL || did_emsg) break; @@ -721,7 +721,7 @@ blob_insert_func(typval_T *argvars, typval_T *rettv) if (b == NULL) { - if (in_vim9script()) + if (in_mnv9script()) emsg(_(e_cannot_add_to_null_blob)); return; } diff --git a/uvim/src/blowfish.c b/uvim/src/blowfish.c index 0309e63070..cc99a96925 100644 --- a/uvim/src/blowfish.c +++ b/uvim/src/blowfish.c @@ -1,12 +1,12 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. * - * Blowfish encryption for Vim; in Blowfish cipher feedback mode. + * Blowfish encryption for MNV; in Blowfish cipher feedback mode. * Contributed by Mohsin Ahmed * Original link (www.cs.albany.edu/~mosh) is no longer available. * Based on http://www.schneier.com/blowfish.html by Bruce Schneier. @@ -20,7 +20,7 @@ * repeats. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_CRYPT) @@ -566,7 +566,7 @@ bf_cfb_init( int i, mi; bfs->randbyte_offset = bfs->update_offset = 0; - vim_memset(bfs->cfb_buffer, 0, bfs->cfb_len); + mnv_memset(bfs->cfb_buffer, 0, bfs->cfb_len); if (seed_len > 0) { mi = seed_len > bfs->cfb_len ? seed_len : bfs->cfb_len; diff --git a/uvim/src/buffer.c b/uvim/src/buffer.c index 0f119e7622..6a33be20ab 100644 --- a/uvim/src/buffer.c +++ b/uvim/src/buffer.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -25,7 +25,7 @@ * The current implementation remembers all file names ever used. */ -#include "vim.h" +#include "mnv.h" #ifdef FEAT_EVAL @@ -356,10 +356,10 @@ open_buffer( // When reading stdin, the buffer contents always needs writing, so set // the changed flag. Unless in readonly mode: "ls | gview -". // When interrupted and 'cpoptions' contains 'i' set changed flag. - if ((got_int && vim_strchr(p_cpo, CPO_INTMOD) != NULL) + if ((got_int && mnv_strchr(p_cpo, CPO_INTMOD) != NULL) || curbuf->b_modified_was_set // autocmd did ":set modified" #ifdef FEAT_EVAL - || (aborting() && vim_strchr(p_cpo, CPO_INTMOD) != NULL) + || (aborting() && mnv_strchr(p_cpo, CPO_INTMOD) != NULL) #endif ) changed(); @@ -486,7 +486,7 @@ static hashtab_T buf_hashtab; static void buf_hashtab_add(buf_T *buf) { - vim_snprintf((char *)buf->b_key, sizeof(buf->b_key), "%x", buf->b_fnum); + mnv_snprintf((char *)buf->b_key, sizeof(buf->b_key), "%x", buf->b_fnum); if (hash_add(&buf_hashtab, buf->b_key, "create buffer") == FAIL) emsg(_(e_buffer_cannot_be_registered)); } @@ -797,10 +797,10 @@ aucmd_abort: ((int *)buf_reuse.ga_data)[buf_reuse.ga_len++] = buf->b_fnum; } if (buf->b_sfname != buf->b_ffname) - VIM_CLEAR(buf->b_sfname); + MNV_CLEAR(buf->b_sfname); else buf->b_sfname = NULL; - VIM_CLEAR(buf->b_ffname); + MNV_CLEAR(buf->b_ffname); if (buf->b_prev == NULL) firstbuf = buf->b_next; else @@ -816,7 +816,7 @@ aucmd_abort: if (del_buf) { // Free all internal variables and reset option values, to make - // ":bdel" compatible with Vim 5.7. + // ":bdel" compatible with MNV 5.7. free_buffer_stuff(buf, TRUE); // Make it look like a new buffer. @@ -1023,7 +1023,7 @@ free_buffer(buf_T *buf) free_terminal(buf); #endif #ifdef FEAT_JOB_CHANNEL - vim_free(buf->b_prompt_text); + mnv_free(buf->b_prompt_text); free_callback(&buf->b_prompt_callback); free_callback(&buf->b_prompt_interrupt); #endif @@ -1041,7 +1041,7 @@ free_buffer(buf_T *buf) } else { - vim_free(buf); + mnv_free(buf); if (curbuf == buf) curbuf = NULL; // make clear it's not to be used } @@ -1121,7 +1121,7 @@ free_buffer_stuff( #endif map_clear_mode(buf, MAP_ALL_MODES, TRUE, FALSE); // clear local mappings map_clear_mode(buf, MAP_ALL_MODES, TRUE, TRUE); // clear local abbrevs - VIM_CLEAR(buf->b_start_fenc); + MNV_CLEAR(buf->b_start_fenc); } /* @@ -1137,7 +1137,7 @@ free_wininfo(wininfo_T *wip) deleteFoldRecurse(&wip->wi_folds); #endif } - vim_free(wip); + mnv_free(wip); } /* @@ -1814,7 +1814,7 @@ do_bufdel( arg = skipwhite(arg); if (*arg == NUL) break; - if (!VIM_ISDIGIT(*arg)) + if (!MNV_ISDIGIT(*arg)) { p = skiptowhite_esc(arg); bnr = buflist_findpat(arg, p, @@ -2065,8 +2065,8 @@ enter_buffer(buf_T *buf) if (!curbuf->b_help && curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) (void)parse_spelllang(curwin); #endif -#ifdef FEAT_VIMINFO - curbuf->b_last_used = vim_time(); +#ifdef FEAT_MNVINFO + curbuf->b_last_used = mnv_time(); #endif redraw_later(UPD_NOT_VALID); @@ -2082,7 +2082,7 @@ do_autochdir(void) { if ((starting == 0 || test_autochdir) && curbuf->b_ffname != NULL - && vim_chdirfile(curbuf->b_ffname, "auto") == OK) + && mnv_chdirfile(curbuf->b_ffname, "auto") == OK) { shorten_fnames(TRUE); last_chdir_reason = "autochdir"; @@ -2192,7 +2192,7 @@ buflist_new( #endif ) != NULL) { - vim_free(ffname); + mnv_free(ffname); if (lnum != 0) buflist_setfpos(buf, (flags & BLN_NOCURWIN) ? NULL : curwin, lnum, (colnr_T)0, FALSE); @@ -2240,7 +2240,7 @@ buflist_new( #ifdef FEAT_EVAL if (aborting()) // autocmds may abort script processing { - vim_free(ffname); + mnv_free(ffname); return NULL; } #endif @@ -2252,7 +2252,7 @@ buflist_new( buf = ALLOC_CLEAR_ONE(buf_T); if (buf == NULL) { - vim_free(ffname); + mnv_free(ffname); return NULL; } #ifdef FEAT_EVAL @@ -2260,8 +2260,8 @@ buflist_new( buf->b_vars = dict_alloc_id(aid_newbuf_bvars); if (buf->b_vars == NULL) { - vim_free(ffname); - vim_free(buf); + mnv_free(ffname); + mnv_free(buf); return NULL; } init_var_dict(buf->b_vars, &buf->b_bufvar, VAR_SCOPE); @@ -2272,7 +2272,7 @@ buflist_new( if (ffname != NULL) { buf->b_ffname = ffname; - buf->b_sfname = vim_strsave(sfname); + buf->b_sfname = mnv_strsave(sfname); } clear_wininfo(buf); @@ -2282,10 +2282,10 @@ buflist_new( || buf->b_wininfo == NULL) { if (buf->b_sfname != buf->b_ffname) - VIM_CLEAR(buf->b_sfname); + MNV_CLEAR(buf->b_sfname); else buf->b_sfname = NULL; - VIM_CLEAR(buf->b_ffname); + MNV_CLEAR(buf->b_ffname); if (buf != curbuf) free_buffer(buf); return NULL; @@ -2471,10 +2471,10 @@ free_buf_options( clear_string_option(&buf->b_p_isk); #ifdef FEAT_VARTABS clear_string_option(&buf->b_p_vsts); - VIM_CLEAR(buf->b_p_vsts_nopaste); - VIM_CLEAR(buf->b_p_vsts_array); + MNV_CLEAR(buf->b_p_vsts_nopaste); + MNV_CLEAR(buf->b_p_vsts_array); clear_string_option(&buf->b_p_vts); - VIM_CLEAR(buf->b_p_vts_array); + MNV_CLEAR(buf->b_p_vts_array); #endif #ifdef FEAT_KEYMAP clear_string_option(&buf->b_p_keymap); @@ -2491,7 +2491,7 @@ free_buf_options( #ifdef FEAT_SPELL clear_string_option(&buf->b_s.b_p_spc); clear_string_option(&buf->b_s.b_p_spf); - vim_regfree(buf->b_s.b_cap_prog); + mnv_regfree(buf->b_s.b_cap_prog); buf->b_s.b_cap_prog = NULL; clear_string_option(&buf->b_s.b_p_spl); clear_string_option(&buf->b_s.b_p_spo); @@ -2682,7 +2682,7 @@ buflist_findname_exp(char_u *fname) if (ffname != NULL) { buf = buflist_findname(ffname); - vim_free(ffname); + mnv_free(ffname); } return buf; } @@ -2752,7 +2752,7 @@ buflist_findpat( // "%" is current file, "%%" or "#" is alternate file if ((pattern_end == pattern + 1 && (*pattern == '%' || *pattern == '#')) - || (in_vim9script() && pattern_end == pattern + 2 + || (in_mnv9script() && pattern_end == pattern + 2 && pattern[0] == '%' && pattern[1] == '%')) { if (*pattern == '#' || pattern_end == pattern + 2) @@ -2797,14 +2797,14 @@ buflist_findpat( p = pat; if (*p == '^' && !(attempt & 1)) // add/remove '^' ++p; - regmatch.regprog = vim_regcomp(p, magic_isset() ? RE_MAGIC : 0); + regmatch.regprog = mnv_regcomp(p, magic_isset() ? RE_MAGIC : 0); FOR_ALL_BUFS_FROM_LAST(buf) { if (regmatch.regprog == NULL) { // invalid pattern, possibly after switching engine - vim_free(pat); + mnv_free(pat); return -1; } if (buf->b_p_bl == find_listed @@ -2834,7 +2834,7 @@ buflist_findpat( } } - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); if (match >= 0) // found one match break; } @@ -2846,7 +2846,7 @@ buflist_findpat( find_listed = FALSE; } - vim_free(pat); + mnv_free(pat); } if (match == -2) @@ -2856,7 +2856,7 @@ buflist_findpat( return match; } -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO typedef struct { buf_T *buf; char_u *match; @@ -2880,7 +2880,7 @@ ExpandBufnames( int round; char_u *p; char_u *patc = NULL; -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO bufmatch_T *matches = NULL; #endif int fuzzy; @@ -2917,7 +2917,7 @@ ExpandBufnames( patc = (char_u *)""; else patc = pat; - regmatch.regprog = vim_regcomp(patc, RE_MAGIC); + regmatch.regprog = mnv_regcomp(patc, RE_MAGIC); } // round == 1: Count the matches. @@ -2943,7 +2943,7 @@ ExpandBufnames( { // invalid pattern, possibly after recompiling if (to_free) - vim_free(patc); + mnv_free(patc); return FAIL; } p = buflist_match(®match, buf, p_wic); @@ -2976,7 +2976,7 @@ ExpandBufnames( if (options & WILD_HOME_REPLACE) p = home_replace_save(buf, p); else - p = vim_strsave(p); + p = mnv_strsave(p); if (p == NULL) { if (fuzzy && round == 2) @@ -2986,7 +2986,7 @@ ExpandBufnames( if (!fuzzy) { -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO if (matches != NULL) { matches[count].buf = buf; @@ -3014,12 +3014,12 @@ ExpandBufnames( *file = ALLOC_MULT(char_u *, count); if (*file == NULL) { - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); if (to_free) - vim_free(patc); + mnv_free(patc); return FAIL; } -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO if (options & WILD_BUFLASTUSED) matches = ALLOC_MULT(bufmatch_T, count); #endif @@ -3039,14 +3039,14 @@ ExpandBufnames( if (!fuzzy) { - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); if (to_free) - vim_free(patc); + mnv_free(patc); } if (!fuzzy) { -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO if (matches != NULL) { int i; @@ -3064,7 +3064,7 @@ ExpandBufnames( for (i = 0; i < count; i++) (*file)[i] = matches[i].match; } - vim_free(matches); + mnv_free(matches); } #endif } @@ -3118,15 +3118,15 @@ fname_match( // Ignore case when 'fileignorecase' or the argument is set. rmp->rm_ic = p_fic || ignore_case; - if (vim_regexec(rmp, name, (colnr_T)0)) + if (mnv_regexec(rmp, name, (colnr_T)0)) match = name; else if (rmp->regprog != NULL) { // Replace $(HOME) with '~' and try matching again. p = home_replace_save(NULL, name); - if (p != NULL && vim_regexec(rmp, p, (colnr_T)0)) + if (p != NULL && mnv_regexec(rmp, p, (colnr_T)0)) match = name; - vim_free(p); + mnv_free(p); } return match; @@ -3138,12 +3138,12 @@ fname_match( buf_T * buflist_findnr(int nr) { - char_u key[VIM_SIZEOF_INT * 2 + 1]; + char_u key[MNV_SIZEOF_INT * 2 + 1]; hashitem_T *hi; if (nr == 0) nr = curwin->w_alt_fnum; - vim_snprintf((char *)key, sizeof(key), "%x", nr); + mnv_snprintf((char *)key, sizeof(key), "%x", nr); hi = hash_find(&buf_hashtab, key); if (!HASHITEM_EMPTY(hi)) @@ -3434,11 +3434,11 @@ buflist_list(exarg_T *eap) int job_none_open; #endif -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO garray_T buflist; buf_T **buflist_data = NULL, **p; - if (vim_strchr(eap->arg, 't')) + if (mnv_strchr(eap->arg, 't')) { ga_init2(&buflist, sizeof(buf_T *), 50); FOR_ALL_BUFFERS(buf) @@ -3469,32 +3469,32 @@ buflist_list(exarg_T *eap) job_none_open = term_none_open(buf->b_term); #endif // skip unlisted buffers, unless ! was used - if ((!buf->b_p_bl && !eap->forceit && !vim_strchr(eap->arg, 'u')) - || (vim_strchr(eap->arg, 'u') && buf->b_p_bl) - || (vim_strchr(eap->arg, '+') + if ((!buf->b_p_bl && !eap->forceit && !mnv_strchr(eap->arg, 'u')) + || (mnv_strchr(eap->arg, 'u') && buf->b_p_bl) + || (mnv_strchr(eap->arg, '+') && ((buf->b_flags & BF_READERR) || !bufIsChanged(buf))) - || (vim_strchr(eap->arg, 'a') + || (mnv_strchr(eap->arg, 'a') && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows == 0)) - || (vim_strchr(eap->arg, 'h') + || (mnv_strchr(eap->arg, 'h') && (buf->b_ml.ml_mfp == NULL || buf->b_nwindows != 0)) #ifdef FEAT_TERMINAL - || (vim_strchr(eap->arg, 'R') + || (mnv_strchr(eap->arg, 'R') && (!job_running || (job_running && job_none_open))) - || (vim_strchr(eap->arg, '?') + || (mnv_strchr(eap->arg, '?') && (!job_running || (job_running && !job_none_open))) - || (vim_strchr(eap->arg, 'F') + || (mnv_strchr(eap->arg, 'F') && (job_running || buf->b_term == NULL)) #endif - || (vim_strchr(eap->arg, '-') && buf->b_p_ma) - || (vim_strchr(eap->arg, '=') && !buf->b_p_ro) - || (vim_strchr(eap->arg, 'x') && !(buf->b_flags & BF_READERR)) - || (vim_strchr(eap->arg, '%') && buf != curbuf) - || (vim_strchr(eap->arg, '#') + || (mnv_strchr(eap->arg, '-') && buf->b_p_ma) + || (mnv_strchr(eap->arg, '=') && !buf->b_p_ro) + || (mnv_strchr(eap->arg, 'x') && !(buf->b_flags & BF_READERR)) + || (mnv_strchr(eap->arg, '%') && buf != curbuf) + || (mnv_strchr(eap->arg, '#') && (buf == curbuf || curwin->w_alt_fnum != buf->b_fnum))) continue; name = buf_spname(buf); if (name != NULL) - vim_strncpy(NameBuff, name, MAXPATHL - 1); + mnv_strncpy(NameBuff, name, MAXPATHL - 1); else home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE); if (message_filtered(NameBuff)) @@ -3519,7 +3519,7 @@ buflist_list(exarg_T *eap) ro_char = !buf->b_p_ma ? '-' : (buf->b_p_ro ? '=' : ' '); msg_putchar('\n'); - len = (int)vim_snprintf_safelen((char *)IObuff, IOSIZE - 20, "%3d%c%c%c%c%c \"%s\"", + len = (int)mnv_snprintf_safelen((char *)IObuff, IOSIZE - 20, "%3d%c%c%c%c%c \"%s\"", buf->b_fnum, buf->b_p_bl ? ' ' : 'u', buf == curbuf ? '%' : @@ -3531,16 +3531,16 @@ buflist_list(exarg_T *eap) NameBuff); // put "line 999" in column 40 or after the file name - i = 40 - vim_strsize(IObuff); + i = 40 - mnv_strsize(IObuff); do IObuff[len++] = ' '; while (--i > 0 && len < IOSIZE - 18); -#ifdef FEAT_VIMINFO - if (vim_strchr(eap->arg, 't') && buf->b_last_used) +#ifdef FEAT_MNVINFO + if (mnv_strchr(eap->arg, 't') && buf->b_last_used) add_time(IObuff + len, (size_t)(IOSIZE - len), buf->b_last_used); else #endif - vim_snprintf((char *)IObuff + len, (size_t)(IOSIZE - len), + mnv_snprintf((char *)IObuff + len, (size_t)(IOSIZE - len), _("line %ld"), buf == curbuf ? curwin->w_cursor.lnum : (long)buflist_findlnum(buf)); msg_outtrans(IObuff); @@ -3548,7 +3548,7 @@ buflist_list(exarg_T *eap) ui_breakcheck(); } -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO if (buflist_data) ga_clear(&buflist); #endif @@ -3603,10 +3603,10 @@ setfname( { // Removing the name. if (buf->b_sfname != buf->b_ffname) - VIM_CLEAR(buf->b_sfname); + MNV_CLEAR(buf->b_sfname); else buf->b_sfname = NULL; - VIM_CLEAR(buf->b_ffname); + MNV_CLEAR(buf->b_ffname); #ifdef UNIX st.st_dev = (dev_T)-1; #endif @@ -3648,25 +3648,25 @@ setfname( { if (message) emsg(_(e_buffer_with_this_name_already_exists)); - vim_free(ffname); + mnv_free(ffname); return FAIL; } // delete from the list close_buffer(NULL, obuf, DOBUF_WIPE, FALSE, FALSE, FALSE); } - sfname = vim_strsave(sfname); + sfname = mnv_strsave(sfname); if (ffname == NULL || sfname == NULL) { - vim_free(sfname); - vim_free(ffname); + mnv_free(sfname); + mnv_free(ffname); return FAIL; } #ifdef USE_FNAME_CASE fname_case(sfname, 0); // set correct case for short file name #endif if (buf->b_sfname != buf->b_ffname) - vim_free(buf->b_sfname); - vim_free(buf->b_ffname); + mnv_free(buf->b_sfname); + mnv_free(buf->b_ffname); buf->b_ffname = ffname; buf->b_sfname = sfname; } @@ -3702,9 +3702,9 @@ buf_set_name(int fnum, char_u *name) return; if (buf->b_sfname != buf->b_ffname) - vim_free(buf->b_sfname); - vim_free(buf->b_ffname); - buf->b_ffname = vim_strsave(name); + mnv_free(buf->b_sfname); + mnv_free(buf->b_ffname); + buf->b_ffname = mnv_strsave(name); buf->b_sfname = NULL; // Allocate ffname and expand into full path. Also resolves .lnk // files on Win32. @@ -3936,13 +3936,13 @@ fileinfo( return; if (fullname > 1) // 2 CTRL-G: include buffer number - bufferlen = vim_snprintf_safelen(buffer, IOSIZE, "buf %d: ", curbuf->b_fnum); + bufferlen = mnv_snprintf_safelen(buffer, IOSIZE, "buf %d: ", curbuf->b_fnum); buffer[bufferlen++] = '"'; name = buf_spname(curbuf); if (name != NULL) - bufferlen += vim_snprintf_safelen(buffer + bufferlen, + bufferlen += mnv_snprintf_safelen(buffer + bufferlen, IOSIZE - bufferlen, "%s", name); else { @@ -3955,7 +3955,7 @@ fileinfo( bufferlen += STRLEN(buffer + bufferlen); } - bufferlen += vim_snprintf_safelen( + bufferlen += mnv_snprintf_safelen( buffer + bufferlen, IOSIZE - bufferlen, "\"%s%s%s%s%s%s", @@ -3971,11 +3971,11 @@ fileinfo( ? " " : ""); if (curbuf->b_ml.ml_flags & ML_EMPTY) - bufferlen += vim_snprintf_safelen(buffer + bufferlen, + bufferlen += mnv_snprintf_safelen(buffer + bufferlen, IOSIZE - bufferlen, "%s", _(no_lines_msg)); else if (p_ru) // Current line and column are already on the screen -- webb - bufferlen += vim_snprintf_safelen( + bufferlen += mnv_snprintf_safelen( buffer + bufferlen, IOSIZE - bufferlen, NGETTEXT("%ld line --%d%%--", "%ld lines --%d%%--", curbuf->b_ml.ml_line_count), @@ -3983,7 +3983,7 @@ fileinfo( calc_percentage(curwin->w_cursor.lnum, curbuf->b_ml.ml_line_count)); else { - bufferlen += vim_snprintf_safelen( + bufferlen += mnv_snprintf_safelen( buffer + bufferlen, IOSIZE - bufferlen, _("line %ld of %ld --%d%%-- col "), @@ -4023,7 +4023,7 @@ fileinfo( set_keep_msg((char_u *)p, 0); } - vim_free(buffer); + mnv_free(buffer); } int @@ -4034,9 +4034,9 @@ col_print( int vcol) { if (col == vcol) - return (int)vim_snprintf_safelen((char *)buf, buflen, "%d", col); + return (int)mnv_snprintf_safelen((char *)buf, buflen, "%d", col); - return (int)vim_snprintf_safelen((char *)buf, buflen, "%d-%d", col, vcol); + return (int)mnv_snprintf_safelen((char *)buf, buflen, "%d-%d", col, vcol); } static char_u *lasttitle = NULL; @@ -4095,33 +4095,33 @@ maketitle(void) // format: " [flags] <(path)> [argument info] <- servername>" // example: - // buffer.c + (/home/vim/src) (1 of 2) - VIM + // buffer.c + (/home/mnv/src) (1 of 2) - MNV // reserve some space for different parts of the title. // use sizeof() to introduce 'size_t' so we don't have to // cast sizes to it. #define SPACE_FOR_FNAME (sizeof(buf) - 100) #define SPACE_FOR_DIR (sizeof(buf) - 20) -#define SPACE_FOR_ARGNR (sizeof(buf) - 10) // at least room for " - VIM" +#define SPACE_FOR_ARGNR (sizeof(buf) - 10) // at least room for " - MNV" // file name if (curbuf->b_fname == NULL) - buflen = vim_snprintf_safelen((char *)buf, + buflen = mnv_snprintf_safelen((char *)buf, SPACE_FOR_FNAME, "%s", _("[No Name]")); #ifdef FEAT_TERMINAL else if (curbuf->b_term != NULL) - buflen = vim_snprintf_safelen((char *)buf, + buflen = mnv_snprintf_safelen((char *)buf, SPACE_FOR_FNAME, "%s", term_get_status_text(curbuf->b_term)); #endif else { - buflen = vim_snprintf_safelen((char *)buf, + buflen = mnv_snprintf_safelen((char *)buf, SPACE_FOR_FNAME, "%s", ((p = transstr(gettail(curbuf->b_fname))) != NULL) ? p : (char_u *)""); - vim_free(p); + mnv_free(p); } // flags @@ -4135,33 +4135,33 @@ maketitle(void) { case 1: // file was modified - buflen += vim_snprintf_safelen( + buflen += mnv_snprintf_safelen( (char *)buf + buflen, sizeof(buf) - buflen, " +"); break; case 2: // file is readonly - buflen += vim_snprintf_safelen( + buflen += mnv_snprintf_safelen( (char *)buf + buflen, sizeof(buf) - buflen, " ="); break; case 3: // file was modified and is readonly - buflen += vim_snprintf_safelen( + buflen += mnv_snprintf_safelen( (char *)buf + buflen, sizeof(buf) - buflen, " =+"); break; case 4: case 6: // file cannot be modified - buflen += vim_snprintf_safelen( + buflen += mnv_snprintf_safelen( (char *)buf + buflen, sizeof(buf) - buflen, " -"); break; case 5: case 7: // file cannot be modified but was modified - buflen += vim_snprintf_safelen( + buflen += mnv_snprintf_safelen( (char *)buf + buflen, sizeof(buf) - buflen, " -+"); break; @@ -4178,7 +4178,7 @@ maketitle(void) ) { // Get path of file, replace home dir with ~ - buflen += vim_snprintf_safelen((char *)buf + buflen, + buflen += mnv_snprintf_safelen((char *)buf + buflen, sizeof(buf) - buflen, " ("); home_replace(curbuf, curbuf->b_ffname, @@ -4195,7 +4195,7 @@ maketitle(void) if (p == buf + buflen) { // help buffer - buflen += vim_snprintf_safelen((char *)buf + buflen, + buflen += mnv_snprintf_safelen((char *)buf + buflen, SPACE_FOR_DIR - buflen, "%s)", _("help")); } else @@ -4210,15 +4210,15 @@ maketitle(void) // remove the file name *p = NUL; - buflen += vim_snprintf_safelen((char *)buf + buflen, + buflen += mnv_snprintf_safelen((char *)buf + buflen, SPACE_FOR_DIR - buflen, "%s)", ((p = transstr(buf + buflen)) != NULL) ? p : (char_u *)""); - vim_free(p); + mnv_free(p); } else - buflen += vim_snprintf_safelen((char *)buf + buflen, + buflen += mnv_snprintf_safelen((char *)buf + buflen, SPACE_FOR_ARGNR - buflen, "...)"); } } @@ -4228,18 +4228,18 @@ maketitle(void) SPACE_FOR_ARGNR - buflen, FALSE); // servername - buflen += vim_snprintf_safelen((char *)buf + buflen, + buflen += mnv_snprintf_safelen((char *)buf + buflen, sizeof(buf) - buflen, " - %s", #if defined(FEAT_CLIENTSERVER) (serverName != NULL) ? serverName : #endif - (char_u *)"VIM"); + (char_u *)"MNV"); if (maxlen > 0) { // make it shorter by removing a bit in the middle - if (vim_strsize(buf) > maxlen) + if (mnv_strsize(buf) > maxlen) trunc_string(buf, buf, maxlen, sizeof(buf)); } } @@ -4298,7 +4298,7 @@ value_changed(char_u *str, char_u **last) if ((str == NULL) != (*last == NULL) || (str != NULL && *last != NULL && STRCMP(str, *last) != 0)) { - vim_free(*last); + mnv_free(*last); if (str == NULL) { *last = NULL; @@ -4307,7 +4307,7 @@ value_changed(char_u *str, char_u **last) } else { - *last = vim_strsave(str); + *last = mnv_strsave(str); return TRUE; } } @@ -4327,8 +4327,8 @@ resettitle(void) void free_titles(void) { - vim_free(lasttitle); - vim_free(lasticon); + mnv_free(lasttitle); + mnv_free(lasticon); } #endif @@ -4613,29 +4613,29 @@ build_stl_str_hl_local( size_t new_len = stl_items_len * 3 / 2; stl_item_T *new_items = - vim_realloc(stl_items, sizeof(stl_item_T) * new_len); + mnv_realloc(stl_items, sizeof(stl_item_T) * new_len); if (new_items == NULL) break; stl_items = new_items; int *new_groupitem = - vim_realloc(stl_groupitem, sizeof(int) * new_len); + mnv_realloc(stl_groupitem, sizeof(int) * new_len); if (new_groupitem == NULL) break; stl_groupitem = new_groupitem; - stl_hlrec_T *new_hlrec = vim_realloc(stl_hltab, + stl_hlrec_T *new_hlrec = mnv_realloc(stl_hltab, sizeof(stl_hlrec_T) * (new_len + 1)); if (new_hlrec == NULL) break; stl_hltab = new_hlrec; - new_hlrec = vim_realloc(stl_tabtab, + new_hlrec = mnv_realloc(stl_tabtab, sizeof(stl_hlrec_T) * (new_len + 1)); if (new_hlrec == NULL) break; stl_tabtab = new_hlrec; - int *new_separator_locs = vim_realloc(stl_separator_locations, + int *new_separator_locs = mnv_realloc(stl_separator_locations, sizeof(int) * new_len); if (new_separator_locs == NULL) break; @@ -4728,7 +4728,7 @@ build_stl_str_hl_local( t = stl_items[stl_groupitem[groupdepth]].stl_start; *p = NUL; - l = vim_strsize(t); + l = mnv_strsize(t); if (curitem > stl_groupitem[groupdepth] + 1 && stl_items[stl_groupitem[groupdepth]].stl_minwid == 0) { @@ -4845,7 +4845,7 @@ build_stl_str_hl_local( s++; l = -1; } - if (VIM_ISDIGIT(*s)) + if (MNV_ISDIGIT(*s)) { minwid = (int)getdigits(&s); if (minwid < 0) // overflow @@ -4890,7 +4890,7 @@ build_stl_str_hl_local( if (*s == '.') { s++; - if (VIM_ISDIGIT(*s)) + if (MNV_ISDIGIT(*s)) { maxwid = (int)getdigits(&s); if (maxwid <= 0) // overflow @@ -4918,7 +4918,7 @@ build_stl_str_hl_local( continue; } # endif - if (vim_strchr(STL_ALL, *s) == NULL) + if (mnv_strchr(STL_ALL, *s) == NULL) { if (*s == NUL) // can happen with "%0" break; @@ -4944,7 +4944,7 @@ build_stl_str_hl_local( fillable = FALSE; // don't change ' ' to fillchar name = buf_spname(wp->w_buffer); if (name != NULL) - vim_strncpy(NameBuff, name, MAXPATHL - 1); + mnv_strncpy(NameBuff, name, MAXPATHL - 1); else { char_u *t = (opt == STL_FULLPATH) ? wp->w_buffer->b_ffname @@ -4959,7 +4959,7 @@ build_stl_str_hl_local( break; } - case STL_VIM_EXPR: // '{' + case STL_MNV_EXPR: // '{' { # ifdef FEAT_EVAL char_u *block_start = s - 1; @@ -4985,10 +4985,10 @@ build_stl_str_hl_local( *p = NUL; p = t; # ifdef FEAT_EVAL - vim_snprintf((char *)buf_tmp, sizeof(buf_tmp), + mnv_snprintf((char *)buf_tmp, sizeof(buf_tmp), "%d", curbuf->b_fnum); set_internal_string_var((char_u *)"g:actual_curbuf", buf_tmp); - vim_snprintf((char *)buf_tmp, sizeof(buf_tmp), "%d", curwin->w_id); + mnv_snprintf((char *)buf_tmp, sizeof(buf_tmp), "%d", curwin->w_id); set_internal_string_var((char_u *)"g:actual_curwin", buf_tmp); save_curbuf = curbuf; @@ -5013,7 +5013,7 @@ build_stl_str_hl_local( if (*skipdigits(str) == NUL) { num = atoi((char *)str); - VIM_CLEAR(str); + MNV_CLEAR(str); itemisflag = FALSE; } } @@ -5046,8 +5046,8 @@ build_stl_str_hl_local( new_fmt_p = NULL; if (usefmt != fmt) - vim_free(usefmt); - VIM_CLEAR(str); + mnv_free(usefmt); + MNV_CLEAR(str); usefmt = new_fmt; s = usefmt + parsed_usefmt; evaldepth++; @@ -5165,7 +5165,7 @@ build_stl_str_hl_local( if (*wp->w_buffer->b_p_ft != NUL && STRLEN(wp->w_buffer->b_p_ft) < TMPLEN - 3) { - vim_snprintf((char *)buf_tmp, sizeof(buf_tmp), "[%s]", + mnv_snprintf((char *)buf_tmp, sizeof(buf_tmp), "[%s]", wp->w_buffer->b_p_ft); str = buf_tmp; } @@ -5178,7 +5178,7 @@ build_stl_str_hl_local( { char_u *t; - vim_snprintf((char *)buf_tmp, sizeof(buf_tmp), ",%s", + mnv_snprintf((char *)buf_tmp, sizeof(buf_tmp), ",%s", wp->w_buffer->b_p_ft); for (t = buf_tmp; *t != 0; t++) *t = TOUPPER_LOC(*t); @@ -5252,7 +5252,7 @@ build_stl_str_hl_local( t++; prevchar_isflag = TRUE; } - l = vim_strsize(t); + l = mnv_strsize(t); if (l > 0) prevchar_isitem = TRUE; if (l > maxwid) @@ -5274,7 +5274,7 @@ build_stl_str_hl_local( for (; l < minwid && p + 1 < out + outlen; l++) { // Don't put a "-" in front of a digit. - if (l + 1 == minwid && fillchar == '-' && VIM_ISDIGIT(*t)) + if (l + 1 == minwid && fillchar == '-' && MNV_ISDIGIT(*t)) *p++ = ' '; else MB_CHAR2BYTES(fillchar, p); @@ -5288,7 +5288,7 @@ build_stl_str_hl_local( // Change a space by fillchar, unless fillchar is '-' and a // digit follows. if (fillable && *t == ' ' - && (!VIM_ISDIGIT(*(t + 1)) || fillchar != '-')) + && (!MNV_ISDIGIT(*(t + 1)) || fillchar != '-')) MB_CHAR2BYTES(fillchar, p); else *p++ = *t; @@ -5332,11 +5332,11 @@ build_stl_str_hl_local( *t++ = '%'; *t = t[-3]; *++t = NUL; - p += vim_snprintf_safelen((char *)p, outlen - (p - out), + p += mnv_snprintf_safelen((char *)p, outlen - (p - out), (char *)nstr, 0, num, n); } else - p += vim_snprintf_safelen((char *)p, outlen - (p - out), + p += mnv_snprintf_safelen((char *)p, outlen - (p - out), (char *)nstr, minwid, num); } else @@ -5345,8 +5345,8 @@ build_stl_str_hl_local( if (num >= 0 || (!itemisflag && str != NULL && *str != NUL)) prevchar_isflag = FALSE; // Item not NULL, but not a flag // - if (opt == STL_VIM_EXPR) - vim_free(str); + if (opt == STL_MNV_EXPR) + mnv_free(str); curitem++; } # ifdef ENABLE_STL_MODE_MULTI_NL @@ -5371,7 +5371,7 @@ find_linebreak: // caller's next iteration. # ifdef FEAT_EVAL if (usefmt != fmt) - vim_free(fmt); + mnv_free(fmt); # endif size_t fmt_remain_len = strlen((char *)s); @@ -5385,7 +5385,7 @@ find_linebreak: // Free the eval result if "%!" was used. # ifdef FEAT_EVAL if (usefmt != fmt) - vim_free(usefmt); + mnv_free(usefmt); # endif } @@ -5396,7 +5396,7 @@ find_linebreak: return 0; } - width = vim_strsize(out); + width = mnv_strsize(out); if (maxwidth > 0 && width > maxwidth) { // Result is too long, must truncate somewhere. @@ -5420,7 +5420,7 @@ find_linebreak: } } - if (width - vim_strsize(s) >= maxwidth) + if (width - mnv_strsize(s) >= maxwidth) { // Truncation mark is beyond max length if (has_mbyte) @@ -5608,18 +5608,18 @@ get_rel_pos( #endif below = wp->w_buffer->b_ml.ml_line_count - wp->w_botline + 1; if (below <= 0) - return (int)vim_snprintf_safelen((char *)buf, buflen, + return (int)mnv_snprintf_safelen((char *)buf, buflen, "%s", (above == 0) ? _("All") : _("Bot")); if (above <= 0) - return (int)vim_snprintf_safelen((char *)buf, buflen, + return (int)mnv_snprintf_safelen((char *)buf, buflen, "%s", _("Top")); int perc = calc_percentage(above, above + below); char tmp[8]; // localized percentage value - vim_snprintf(tmp, sizeof(tmp), _("%d%%"), perc); - return (int)vim_snprintf_safelen((char *)buf, buflen, _("%3s"), tmp); + mnv_snprintf(tmp, sizeof(tmp), _("%d%%"), perc); + return (int)mnv_snprintf_safelen((char *)buf, buflen, _("%3s"), tmp); } /* @@ -5645,7 +5645,7 @@ append_arg_number( case 3: msg = _(" (file (%d) of %d)"); break; } - return (int)vim_snprintf_safelen((char *)buf, buflen, msg, + return (int)mnv_snprintf_safelen((char *)buf, buflen, msg, wp->w_arg_idx + 1, ARGCOUNT); } @@ -5668,21 +5668,21 @@ fix_fname(char_u *fname) #ifdef UNIX return FullName_save(fname, TRUE); #else - if (!vim_isAbsName(fname) + if (!mnv_isAbsName(fname) || strstr((char *)fname, "..") != NULL || strstr((char *)fname, "//") != NULL # ifdef BACKSLASH_IN_FILENAME || strstr((char *)fname, "\\\\") != NULL # endif # if defined(MSWIN) - || vim_strchr(fname, '~') != NULL + || mnv_strchr(fname, '~') != NULL || fname[0] == '/' || fname[0] == '\\' # endif ) return FullName_save(fname, FALSE); - fname = vim_strsave(fname); + fname = mnv_strsave(fname); # ifdef USE_FNAME_CASE if (fname != NULL) @@ -5722,7 +5722,7 @@ fname_expand( rfname = mch_resolve_path(*ffname, FALSE); if (rfname != NULL) { - vim_free(*ffname); + mnv_free(*ffname); *ffname = rfname; *sfname = rfname; } @@ -6000,12 +6000,12 @@ chk_modeline( line_end = s + ml_get_len(lnum); for (; *s != NUL; ++s) { - if (prev == -1 || vim_isspace(prev)) + if (prev == -1 || mnv_isspace(prev)) { if ((prev != -1 && STRNCMP(s, "ex:", (size_t)3) == 0) || STRNCMP(s, "vi:", (size_t)3) == 0) break; - // Accept both "vim" and "Vim". + // Accept both "mnv" and "MNV". if ((s[0] == 'v' || s[0] == 'V') && s[1] == 'i' && s[2] == 'm') { int vers; @@ -6019,10 +6019,10 @@ chk_modeline( && (s[0] != 'V' || STRNCMP(skipwhite(e + 1), "set", 3) == 0) && (s[3] == ':' - || (VIM_VERSION_100 >= vers && SAFE_isdigit(s[3])) - || (VIM_VERSION_100 < vers && s[3] == '<') - || (VIM_VERSION_100 > vers && s[3] == '>') - || (VIM_VERSION_100 == vers && s[3] == '='))) + || (MNV_VERSION_100 >= vers && SAFE_isdigit(s[3])) + || (MNV_VERSION_100 < vers && s[3] == '<') + || (MNV_VERSION_100 > vers && s[3] == '>') + || (MNV_VERSION_100 == vers && s[3] == '='))) break; } } @@ -6035,14 +6035,14 @@ chk_modeline( char_u *linecopy; // local copy of any modeline found int end; - do // skip over "ex:", "vi:" or "vim:" + do // skip over "ex:", "vi:" or "mnv:" ++s; while (s[-1] != ':'); len = (size_t)(line_end - s); // remember the line length // so we can restore 'line_end' // after the copy - s = linecopy = vim_strnsave(s, len); // copy the line, it will change + s = linecopy = mnv_strnsave(s, len); // copy the line, it will change if (linecopy == NULL) return FAIL; @@ -6117,7 +6117,7 @@ chk_modeline( ESTACK_CHECK_NOW; estack_pop(); - vim_free(linecopy); + mnv_free(linecopy); } return retval; } @@ -6396,7 +6396,7 @@ buf_contents_changed(buf_T *buf) } } } - vim_free(ea.cmd); + mnv_free(ea.cmd); // restore curwin/curbuf and a few other things aucmd_restbuf(&aco); diff --git a/uvim/src/bufwrite.c b/uvim/src/bufwrite.c index 4d00421d97..3c3d0bc28d 100644 --- a/uvim/src/bufwrite.c +++ b/uvim/src/bufwrite.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * bufwrite.c: functions for writing a buffer */ -#include "vim.h" +#include "mnv.h" #if defined(HAVE_UTIME) && defined(HAVE_UTIME_H) # include // for struct utimbuf @@ -517,7 +517,7 @@ buf_write_bytes(struct bw_info *ip) if (len == 0) return OK; // Crypt layer is buffering, will flush later. wlen = write_eintr(ip->bw_fd, outbuf, len); - vim_free(outbuf); + mnv_free(outbuf); return (wlen < len) ? FAIL : OK; } # endif @@ -689,7 +689,7 @@ buf_write( char_u *fenc_tofree = NULL; // allocated "fenc" int wb_flags = 0; #ifdef HAVE_ACL - vim_acl_T acl = NULL; // ACL copied from original file to + mnv_acl_T acl = NULL; // ACL copied from original file to // backup or new file #endif #ifdef FEAT_PERSISTENT_UNDO @@ -705,12 +705,12 @@ buf_write( if (buf->b_ml.ml_mfp == NULL) { // This can happen during startup when there is a stray "w" in the - // vimrc file. + // mnvrc file. emsg(_(e_empty_buffer)); return FAIL; } - // Disallow writing from .exrc and .vimrc in current directory for + // Disallow writing from .exrc and .mnvrc in current directory for // security reasons. if (check_secure()) return FAIL; @@ -750,8 +750,8 @@ buf_write( && buf == curbuf && !bt_nofilename(buf) && !filtering - && (!append || vim_strchr(p_cpo, CPO_FNAMEAPP) != NULL) - && vim_strchr(p_cpo, CPO_FNAMEW) != NULL) + && (!append || mnv_strchr(p_cpo, CPO_FNAMEAPP) != NULL) + && mnv_strchr(p_cpo, CPO_FNAMEW) != NULL) { if (set_rw_fname(fname, sfname) == FAIL) return FAIL; @@ -928,7 +928,7 @@ buf_write( buf->b_flags &= ~BF_WRITE_MASK; } if (reset_changed && buf->b_changed && !append - && (overwriting || vim_strchr(p_cpo, CPO_PLUS) != NULL)) + && (overwriting || mnv_strchr(p_cpo, CPO_PLUS) != NULL)) // Buffer still changed, the autocommands didn't work // properly. return FAIL; @@ -1120,7 +1120,7 @@ buf_write( if (!forceit && file_readonly) { - if (vim_strchr(p_cpo, CPO_FWRITE) != NULL) + if (mnv_strchr(p_cpo, CPO_FWRITE) != NULL) { errnum = (char_u *)"E504: "; errmsg = (char_u *)_(e_is_read_only_cannot_override_W_in_cpoptions); @@ -1214,11 +1214,11 @@ buf_write( // First find a file name that doesn't exist yet (use some // arbitrary numbers). dirlen = (size_t)(gettail(fname) - fname); - vim_strncpy(tmp_fname, fname, dirlen); + mnv_strncpy(tmp_fname, fname, dirlen); fd = -1; for (i = 4913; ; i += 123) { - vim_snprintf((char *)tmp_fname + dirlen, + mnv_snprintf((char *)tmp_fname + dirlen, sizeof(tmp_fname) - dirlen, "%d", i); if (mch_lstat((char *)tmp_fname, &st) < 0) { @@ -1238,7 +1238,7 @@ buf_write( { # ifdef UNIX # ifdef HAVE_FCHOWN - vim_ignored = fchown(fd, st_old.st_uid, st_old.st_gid); + mnv_ignored = fchown(fd, st_old.st_uid, st_old.st_gid); # endif if (mch_stat((char *)tmp_fname, &st) < 0 || st.st_uid != st_old.st_uid @@ -1363,7 +1363,7 @@ buf_write( if ((p = make_percent_swname(copybuf, p, fname)) != NULL) { backup = modname(p, backup_ext, FALSE); - vim_free(p); + mnv_free(p); } #endif rootname = get_file_in_dir(fname, copybuf); @@ -1386,7 +1386,7 @@ buf_write( rootname, backup_ext, FALSE); if (backup == NULL) { - vim_free(rootname); + mnv_free(rootname); some_error = TRUE; // out of memory goto nobackup; } @@ -1403,7 +1403,7 @@ buf_write( if (st_new.st_dev == st_old.st_dev && st_new.st_ino == st_old.st_ino) { - VIM_CLEAR(backup); // no backup file to delete + MNV_CLEAR(backup); // no backup file to delete // may try again with 'shortname' set if (!(buf->b_shortname || buf->b_p_sn)) { @@ -1435,12 +1435,12 @@ buf_write( --*wp; // They all exist??? Must be something wrong. if (*wp == 'a') - VIM_CLEAR(backup); + MNV_CLEAR(backup); } } break; } - vim_free(rootname); + mnv_free(rootname); // Try to create the backup file if (backup != NULL) @@ -1460,7 +1460,7 @@ buf_write( (void)umask(umask_save); #endif if (bfd < 0) - VIM_CLEAR(backup); + MNV_CLEAR(backup); else { // Set file protection same as original file, but @@ -1533,7 +1533,7 @@ buf_write( } nobackup: close(fd); // ignore errors for closing read file - vim_free(copybuf); + mnv_free(copybuf); if (backup == NULL && errmsg == NULL) errmsg = (char_u *)_(e_cannot_create_backup_file_add_bang_to_write_anyway); @@ -1556,7 +1556,7 @@ buf_write( // If 'cpoptions' includes the "W" flag, we don't want to // overwrite a read-only file. But rename may be possible // anyway, thus we need an extra check here. - if (file_readonly && vim_strchr(p_cpo, CPO_FWRITE) != NULL) + if (file_readonly && mnv_strchr(p_cpo, CPO_FWRITE) != NULL) { errnum = (char_u *)"E504: "; errmsg = (char_u *)_(e_is_read_only_cannot_override_W_in_cpoptions); @@ -1581,7 +1581,7 @@ buf_write( if ((p = make_percent_swname(IObuff, p, fname)) != NULL) { backup = modname(p, backup_ext, FALSE); - vim_free(p); + mnv_free(p); } #endif if (backup == NULL) @@ -1594,7 +1594,7 @@ buf_write( backup = buf_modname( (buf->b_p_sn || buf->b_shortname), rootname, backup_ext, FALSE); - vim_free(rootname); + mnv_free(rootname); } } @@ -1613,7 +1613,7 @@ buf_write( --*p; // They all exist??? Must be something wrong! if (*p == 'a') - VIM_CLEAR(backup); + MNV_CLEAR(backup); } } if (backup != NULL) @@ -1625,10 +1625,10 @@ buf_write( // If the renaming of the original file to the backup file // works, quit here. - if (vim_rename(fname, backup) == 0) + if (mnv_rename(fname, backup) == 0) break; - VIM_CLEAR(backup); // don't do the rename below + MNV_CLEAR(backup); // don't do the rename below } } if (backup == NULL && !forceit) @@ -1642,7 +1642,7 @@ buf_write( #if defined(UNIX) // When using ":w!" and the file was read-only: make it writable if (forceit && perm >= 0 && !(perm & 0200) && st_old.st_uid == getuid() - && vim_strchr(p_cpo, CPO_FWRITE) == NULL) + && mnv_strchr(p_cpo, CPO_FWRITE) == NULL) { perm |= 0200; (void)mch_setperm(fname, perm); @@ -1652,7 +1652,7 @@ buf_write( // When using ":w!" and writing to the current file, 'readonly' makes no // sense, reset it, unless 'Z' appears in 'cpoptions'. - if (forceit && overwriting && vim_strchr(p_cpo, CPO_KEEPRO) == NULL) + if (forceit && overwriting && mnv_strchr(p_cpo, CPO_KEEPRO) == NULL) { buf->b_p_ro = FALSE; need_maketitle = TRUE; // set window title later @@ -1770,7 +1770,7 @@ buf_write( // overwrite the original file. if (*p_ccv != NUL) { - wfname = vim_tempname('w', FALSE); + wfname = mnv_tempname('w', FALSE); if (wfname == NULL) // Can't write without a tempfile! { errmsg = (char_u *)_(e_cant_find_temp_file_for_writing); @@ -1854,7 +1854,7 @@ buf_write( #endif { errmsg = (char_u *)_(e_cant_open_file_for_writing); - if (forceit && vim_strchr(p_cpo, CPO_FWRITE) == NULL + if (forceit && mnv_strchr(p_cpo, CPO_FWRITE) == NULL && perm >= 0) { #ifdef UNIX @@ -1887,13 +1887,13 @@ restore_backup: { // There is a small chance that we removed the // original, try to move the copy in its place. - // This may not work if the vim_rename() fails. + // This may not work if the mnv_rename() fails. // In that case we leave the copy around. // If file does not exist, put the copy in its // place if (mch_stat((char *)fname, &st) < 0) - vim_rename(backup, fname); + mnv_rename(backup, fname); // if original file does exist throw away the copy if (mch_stat((char *)fname, &st) >= 0) mch_remove(backup); @@ -1901,7 +1901,7 @@ restore_backup: else { // try to put the original file back - vim_rename(backup, fname); + mnv_rename(backup, fname); } } @@ -1911,7 +1911,7 @@ restore_backup: } if (wfname != fname) - vim_free(wfname); + mnv_free(wfname); goto fail; } write_info.bw_fd = fd; @@ -1937,7 +1937,7 @@ restore_backup: #endif #ifdef HAVE_FTRUNCATE if (!append) - vim_ignored = ftruncate(fd, (off_t)0); + mnv_ignored = ftruncate(fd, (off_t)0); #endif #if defined(MSWIN) @@ -1965,7 +1965,7 @@ restore_backup: end = 0; else { - // Write magic number, so that Vim knows how this file is + // Write magic number, so that MNV knows how this file is // encrypted when reading it back. write_info.bw_buf = header; write_info.bw_len = header_len; @@ -1973,7 +1973,7 @@ restore_backup: if (buf_write_bytes(&write_info) == FAIL) end = 0; wb_flags |= FIO_ENCRYPTED; - vim_free(header); + mnv_free(header); } } #endif @@ -2211,7 +2211,7 @@ restore_backup: // For a device do try the fsync() but don't complain if it does not // work (could be a pipe). // If the 'fsync' option is FALSE, don't fsync(). Useful for laptops. - if ((buf->b_p_fs >= 0 ? buf->b_p_fs : p_fs) && vim_fsync(fd) != 0 + if ((buf->b_p_fs >= 0 ? buf->b_p_fs : p_fs) && mnv_fsync(fd) != 0 && !device) { errmsg = (char_u *)_(e_fsync_failed); @@ -2247,7 +2247,7 @@ restore_backup: || st.st_gid != st_old.st_gid) { // changing owner might not be possible - vim_ignored = fchown(fd, st_old.st_uid, -1); + mnv_ignored = fchown(fd, st_old.st_uid, -1); // if changing group fails clear the group permissions if (fchown(fd, -1, st_old.st_gid) == -1 && perm > 0) perm &= ~070; @@ -2315,7 +2315,7 @@ restore_backup: } } mch_remove(wfname); - vim_free(wfname); + mnv_free(wfname); } #endif } @@ -2335,7 +2335,7 @@ restore_backup: errmsg = alloc(300); if (errmsg == NULL) goto fail; - vim_snprintf((char *)errmsg, 300, _(e_write_error_conversion_failed_in_line_nr_make_fenc_empty_to_override), + mnv_snprintf((char *)errmsg, 300, _(e_write_error_conversion_failed_in_line_nr_make_fenc_empty_to_override), (long)write_info.bw_conv_error_lnum); } } @@ -2386,7 +2386,7 @@ restore_backup: } else { - if (vim_rename(backup, fname) == 0) + if (mnv_rename(backup, fname) == 0) end = 1; } } @@ -2408,7 +2408,7 @@ restore_backup: STRCAT(IObuff, _(" CONVERSION ERROR")); c = TRUE; if (write_info.bw_conv_error_lnum != 0) - vim_snprintf_add((char *)IObuff, IOSIZE, _(" in line %ld;"), + mnv_snprintf_add((char *)IObuff, IOSIZE, _(" in line %ld;"), (long)write_info.bw_conv_error_lnum); } else if (notconverted) @@ -2462,7 +2462,7 @@ restore_backup: // writing to the original file and '+' is not in 'cpoptions'. if (reset_changed && whole && !append && !write_info.bw_conv_error - && (overwriting || vim_strchr(p_cpo, CPO_PLUS) != NULL)) + && (overwriting || mnv_strchr(p_cpo, CPO_PLUS) != NULL)) { unchanged(buf, TRUE, FALSE); // b:changedtick may be incremented in unchanged() but that should not @@ -2501,8 +2501,8 @@ restore_backup: emsg(_(e_patchmode_cant_save_original_file)); else if (mch_stat(org, &st) < 0) { - vim_rename(backup, (char_u *)org); - VIM_CLEAR(backup); // don't delete the file + mnv_rename(backup, (char_u *)org); + MNV_CLEAR(backup); // don't delete the file #ifdef UNIX set_file_time((char_u *)org, st_old.st_atime, st_old.st_mtime); #endif @@ -2525,7 +2525,7 @@ restore_backup: if (org != NULL) { mch_setperm((char_u *)org, mch_getperm(fname) & 0777); - vim_free(org); + mnv_free(org); } } @@ -2545,11 +2545,11 @@ nofail: // Done saving, we accept changed buffer warnings again buf->b_saving = FALSE; - vim_free(backup); + mnv_free(backup); if (buffer != smallbuf) - vim_free(buffer); - vim_free(fenc_tofree); - vim_free(write_info.bw_conv_buf); + mnv_free(buffer); + mnv_free(fenc_tofree); + mnv_free(write_info.bw_conv_buf); #ifdef USE_ICONV if (write_info.bw_iconv_fd != (iconv_t)-1) { @@ -2585,7 +2585,7 @@ nofail: STRCAT(IObuff, errmsg); emsg((char *)IObuff); if (errmsg_allocated) - vim_free(errmsg); + mnv_free(errmsg); retval = FAIL; if (end == 0) @@ -2658,8 +2658,8 @@ nofail: #endif } -#ifdef FEAT_VIMINFO - // Make sure marks will be written out to the viminfo file later, even when +#ifdef FEAT_MNVINFO + // Make sure marks will be written out to the mnvinfo file later, even when // the file is new. curbuf->b_marks_read = TRUE; #endif diff --git a/uvim/src/change.c b/uvim/src/change.c index 3a4fefb2b8..f4a5454f77 100644 --- a/uvim/src/change.c +++ b/uvim/src/change.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * change.c: functions related to changing text */ -#include "vim.h" +#include "mnv.h" /* * If the file is readonly, give a warning message with the first change. @@ -48,7 +48,7 @@ change_warning(int col) msg_source(HL_ATTR(HLF_W)); msg_puts_attr(_(w_readonly), HL_ATTR(HLF_W) | MSG_HIST); #ifdef FEAT_EVAL - set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_readonly), -1); + set_mnv_var_string(VV_WARNINGMSG, (char_u *)_(w_readonly), -1); #endif msg_clr_eos(); (void)msg_end(); @@ -172,7 +172,7 @@ remove_listener_from_list( else *list = lnr->lr_next; free_callback(&lnr->lr_callback); - vim_free(lnr); + mnv_free(lnr); } /* @@ -327,7 +327,7 @@ f_listener_add(typval_T *argvars, typval_T *rettv) return; } - if (in_vim9script() && ( + if (in_mnv9script() && ( check_for_opt_buffer_arg(argvars, 1) == FAIL || check_for_opt_bool_arg(argvars, 2) == FAIL)) return; @@ -389,7 +389,7 @@ f_listener_flush(typval_T *argvars, typval_T *rettv UNUSED) if (recursive) return; - if (in_vim9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type != VAR_UNKNOWN) @@ -439,7 +439,7 @@ f_listener_remove(typval_T *argvars, typval_T *rettv) int id; buf_T *buf; - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; id = tv_get_number(argvars); @@ -915,7 +915,7 @@ changed_bytes(linenr_T lnum, colnr_T col) // Don't do this when displaying '$' at the end of changed text. if (spell_check_window(curwin) && lnum < curbuf->b_ml.ml_line_count - && vim_strchr(p_cpo, CPO_DOLLAR) == NULL) + && mnv_strchr(p_cpo, CPO_DOLLAR) == NULL) redrawWinline(curwin, lnum + 1); #endif #ifdef FEAT_DIFF @@ -1124,8 +1124,8 @@ save_file_ff(buf_T *buf) if (buf->b_start_fenc == NULL || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0) { - vim_free(buf->b_start_fenc); - buf->b_start_fenc = vim_strsave(buf->b_p_fenc); + mnv_free(buf->b_start_fenc); + buf->b_start_fenc = mnv_strsave(buf->b_p_fenc); } } @@ -1256,7 +1256,7 @@ ins_char_bytes(char_u *buf, int charlen) // Returns the old value of list, so when finished, // curwin->w_p_list should be set back to this. old_list = curwin->w_p_list; - if (old_list && vim_strchr(p_cpo, CPO_LISTWM) == NULL) + if (old_list && mnv_strchr(p_cpo, CPO_LISTWM) == NULL) curwin->w_p_list = FALSE; // In virtual replace mode each character may replace one or more @@ -1619,7 +1619,7 @@ open_line( #endif // make a copy of the current line so we can mess with it - saved_line = vim_strnsave(ml_get_curline(), ml_get_curline_len()); + saved_line = mnv_strnsave(ml_get_curline(), ml_get_curline_len()); if (saved_line == NULL) // out of memory! return FALSE; @@ -1630,16 +1630,16 @@ open_line( if (State & VREPLACE_FLAG) { // With MODE_VREPLACE we make a copy of the next line, which we will be - // starting to replace. First make the new line empty and let vim play + // starting to replace. First make the new line empty and let mnv play // with the indenting and comment leader to its heart's content. Then // we grab what it ended up putting on the new line, put back the // original line, and call ins_char() to put each new character onto // the line, replacing what was there before and pushing the right // stuff onto the replace stack. -- webb. if (curwin->w_cursor.lnum < orig_line_count) - next_line = vim_strnsave(ml_get(curwin->w_cursor.lnum + 1), ml_get_len(curwin->w_cursor.lnum + 1)); + next_line = mnv_strnsave(ml_get(curwin->w_cursor.lnum + 1), ml_get_len(curwin->w_cursor.lnum + 1)); else - next_line = vim_strsave((char_u *)""); + next_line = mnv_strsave((char_u *)""); if (next_line == NULL) // out of memory! goto theend; @@ -1769,7 +1769,7 @@ open_line( { // Find last non-blank in line p = ptr + STRLEN(ptr) - 1; - while (p > ptr && VIM_ISWHITE(*p)) + while (p > ptr && MNV_ISWHITE(*p)) --p; last_char = *p; @@ -1778,7 +1778,7 @@ open_line( { if (p > ptr) --p; - while (p > ptr && VIM_ISWHITE(*p)) + while (p > ptr && MNV_ISWHITE(*p)) --p; } // Try to catch lines that are split over multiple @@ -1972,7 +1972,7 @@ open_line( // If we have hit RETURN immediately after the start // comment leader, then put a space after the middle // comment leader on the next line. - if (!VIM_ISWHITE(saved_line[lead_len - 1]) + if (!MNV_ISWHITE(saved_line[lead_len - 1]) && ((p_extra != NULL && (int)curwin->w_cursor.col == lead_len) || (p_extra == NULL @@ -2049,11 +2049,11 @@ open_line( { int li; - vim_strncpy(leader, saved_line, lead_len); + mnv_strncpy(leader, saved_line, lead_len); // TODO: handle multi-byte and double width chars for (li = 0; li < comment_start; ++li) - if (!VIM_ISWHITE(leader[li])) + if (!MNV_ISWHITE(leader[li])) leader[li] = ' '; // Replace leader with lead_repl, right or left adjusted @@ -2066,7 +2066,7 @@ open_line( { if (*p == COM_RIGHT || *p == COM_LEFT) c = *p++; - else if (VIM_ISDIGIT(*p) || *p == '-') + else if (MNV_ISDIGIT(*p) || *p == '-') off = getdigits(&p); else ++p; @@ -2075,14 +2075,14 @@ open_line( { // find last non-white in the leader to line up with for (p = leader + lead_len - 1; p > leader - && VIM_ISWHITE(*p); --p) + && MNV_ISWHITE(*p); --p) ; ++p; // Compute the length of the replaced characters in // screen characters, not bytes. { - int repl_size = vim_strnsize(lead_repl, + int repl_size = mnv_strnsize(lead_repl, lead_repl_len); int old_size = 0; char_u *endp = p; @@ -2121,7 +2121,7 @@ open_line( lead_len -= l; *p = ' '; } - else if (!VIM_ISWHITE(*p)) + else if (!MNV_ISWHITE(*p)) *p = ' '; } } @@ -2133,7 +2133,7 @@ open_line( // screen characters, not bytes. Move the part that is // not to be overwritten. { - int repl_size = vim_strnsize(lead_repl, + int repl_size = mnv_strnsize(lead_repl, lead_repl_len); int i; int l; @@ -2141,7 +2141,7 @@ open_line( for (i = 0; i < lead_len && p[i] != NUL; i += l) { l = (*mb_ptr2len)(p + i); - if (vim_strnsize(p, i + l) > repl_size) + if (mnv_strnsize(p, i + l) > repl_size) break; } if (i != lead_repl_len) @@ -2157,7 +2157,7 @@ open_line( // leader by spaces. Keep Tabs, the indent must // remain the same. for (p += lead_repl_len; p < leader + lead_len; ++p) - if (!VIM_ISWHITE(*p)) + if (!MNV_ISWHITE(*p)) { // Don't put a space before a TAB. if (p + 1 < leader + lead_len && p[1] == TAB) @@ -2214,7 +2214,7 @@ open_line( && leader[lead_len - 1] == ' ') { // Don't do it when there is a tab before the space - if (vim_strchr(skipwhite(leader), '\t') != NULL) + if (mnv_strchr(skipwhite(leader), '\t') != NULL) break; --lead_len; --off; @@ -2222,7 +2222,7 @@ open_line( // If the leader ends in white space, don't add an // extra space - if (lead_len > 0 && VIM_ISWHITE(leader[lead_len - 1])) + if (lead_len > 0 && MNV_ISWHITE(leader[lead_len - 1])) extra_space = FALSE; leader[lead_len] = NUL; } @@ -2239,7 +2239,7 @@ open_line( // is in the comment leader if (newindent || did_si) { - while (lead_len && VIM_ISWHITE(*leader)) + while (lead_len && MNV_ISWHITE(*leader)) { --lead_len; --newcol; @@ -2494,7 +2494,7 @@ open_line( if (State & VREPLACE_FLAG) { // Put new line in p_extra - p_extra = vim_strnsave(ml_get_curline(), ml_get_curline_len()); + p_extra = mnv_strnsave(ml_get_curline(), ml_get_curline_len()); if (p_extra == NULL) goto theend; @@ -2505,16 +2505,16 @@ open_line( curwin->w_cursor.col = 0; curwin->w_cursor.coladd = 0; ins_bytes(p_extra); // will call changed_bytes() - vim_free(p_extra); + mnv_free(p_extra); next_line = NULL; } retval = OK; // success! theend: curbuf->b_p_pi = saved_pi; - vim_free(saved_line); - vim_free(next_line); - vim_free(allocated); + mnv_free(saved_line); + mnv_free(next_line); + mnv_free(allocated); return retval; } @@ -2536,9 +2536,9 @@ truncate_line(int fixpos) old_line = ml_get(lnum); if (col == 0) - newp = vim_strsave((char_u *)""); + newp = mnv_strsave((char_u *)""); else - newp = vim_strnsave(old_line, col); + newp = mnv_strnsave(old_line, col); deleted = (int)ml_get_len(lnum) - col; if (newp == NULL) diff --git a/uvim/src/channel.c b/uvim/src/channel.c index 4607b1e605..1103cee7e8 100644 --- a/uvim/src/channel.c +++ b/uvim/src/channel.c @@ -1,16 +1,16 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* * Implements communication through a socket or any file handle. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_JOB_CHANNEL) @@ -308,7 +308,7 @@ channel_free_channel(channel_T *channel) first_channel = channel->ch_next; else channel->ch_prev->ch_next = channel->ch_next; - vim_free(channel); + mnv_free(channel); } static void @@ -865,7 +865,7 @@ channel_open_unix( channel->CH_SOCK_FD = (sock_T)sd; channel->ch_nb_close_cb = nb_close_cb; - channel->ch_hostname = (char *)vim_strsave((char_u *)path); + channel->ch_hostname = (char *)mnv_strsave((char_u *)path); channel->ch_port = 0; channel->ch_to_be_closed |= (1U << PART_SOCK); @@ -1075,7 +1075,7 @@ channel_open( channel->CH_SOCK_FD = (sock_T)sd; channel->ch_nb_close_cb = nb_close_cb; - channel->ch_hostname = (char *)vim_strsave((char_u *)hostname); + channel->ch_hostname = (char *)mnv_strsave((char_u *)hostname); channel->ch_port = port; channel->ch_to_be_closed |= (1U << PART_SOCK); @@ -1305,7 +1305,7 @@ channel_open_func(typval_T *argvars) jobopt_T opt; channel_T *channel = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_dict_arg(argvars, 1) == FAIL)) return NULL; @@ -1330,7 +1330,7 @@ channel_open_func(typval_T *argvars) { // ipv6 address is_ipv6 = TRUE; - p = vim_strchr(address + 1, ']'); + p = mnv_strchr(address + 1, ']'); if (p == NULL || *++p != ':') { semsg(_(e_invalid_argument_str), address); @@ -1340,7 +1340,7 @@ channel_open_func(typval_T *argvars) else { // ipv4 address - p = vim_strchr(address, ':'); + p = mnv_strchr(address, ':'); if (p == NULL) { semsg(_(e_invalid_argument_str), address); @@ -1408,7 +1408,7 @@ channel_listen_func(typval_T *argvars) jobopt_T opt; channel_T *channel = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_dict_arg(argvars, 1) == FAIL)) return NULL; @@ -1433,7 +1433,7 @@ channel_listen_func(typval_T *argvars) else if (*address == '[') { // ipv6 address - p = vim_strchr(address + 1, ']'); + p = mnv_strchr(address + 1, ']'); if (p == NULL || *++p != ':') { semsg(_(e_invalid_argument_str), address); @@ -1452,7 +1452,7 @@ channel_listen_func(typval_T *argvars) else { // ipv4 address - p = vim_strchr(address, ':'); + p = mnv_strchr(address, ':'); if (p == NULL) { semsg(_(e_invalid_argument_str), address); @@ -1526,7 +1526,7 @@ channel_listen( // Get the server internet address and put into addr structure // fill in the socket address structure and bind to port - vim_memset((char *)&server, 0, sizeof(server)); + mnv_memset((char *)&server, 0, sizeof(server)); server.sin_family = AF_INET; server.sin_port = htons(port_in); if (hostname != NULL && *hostname != NUL) @@ -1631,7 +1631,7 @@ channel_listen( channel->ch_listen = TRUE; channel->CH_SOCK_FD = (sock_T)sd; channel->ch_nb_close_cb = nb_close_cb; - channel->ch_hostname = (char *)vim_strsave((char_u *)(hostname != NULL ? hostname : "")); + channel->ch_hostname = (char *)mnv_strsave((char_u *)(hostname != NULL ? hostname : "")); channel->ch_port = port_in; channel->ch_to_be_closed |= (1U << PART_SOCK); @@ -1720,7 +1720,7 @@ channel_listen_unix( channel->ch_listen = TRUE; channel->CH_SOCK_FD = (sock_T)sd; channel->ch_nb_close_cb = nb_close_cb; - channel->ch_hostname = (char *)vim_strsave((char_u *)path); + channel->ch_hostname = (char *)mnv_strsave((char_u *)path); channel->ch_port = 0; channel->ch_to_be_closed |= (1U << PART_SOCK); @@ -1895,7 +1895,7 @@ write_buf_line(buf_T *buf, linenr_T lnum, channel_T *channel) } p[len + 1] = NUL; channel_send(channel, PART_IN, p, len + 1, "write_buf_line"); - vim_free(p); + mnv_free(p); } /* @@ -2202,7 +2202,7 @@ channel_get(channel_T *channel, ch_part_T part, int *outlen) head->rq_prev = NULL; else node->rq_next->rq_prev = NULL; - vim_free(node); + mnv_free(node); return p; } @@ -2237,7 +2237,7 @@ channel_get_all(channel_T *channel, ch_part_T part, int *outlen) do { p = channel_get(channel, part, NULL); - vim_free(p); + mnv_free(p); } while (p != NULL); if (outlen != NULL) @@ -2332,14 +2332,14 @@ channel_collapse(channel_T *channel, ch_part_T part, int want_nl) return FAIL; // out of memory mch_memmove(p, node->rq_buffer, node->rq_buflen); p += node->rq_buflen; - vim_free(node->rq_buffer); + mnv_free(node->rq_buffer); node->rq_buffer = newbuf; for (n = node; n != last_node; ) { n = n->rq_next; mch_memmove(p, n->rq_buffer, n->rq_buflen); p += n->rq_buflen; - vim_free(n->rq_buffer); + mnv_free(n->rq_buffer); } *p = NUL; node->rq_buflen = (long_u)(p - newbuf); @@ -2348,14 +2348,14 @@ channel_collapse(channel_T *channel, ch_part_T part, int want_nl) for (n = node->rq_next; n != last_node; ) { n = n->rq_next; - vim_free(n->rq_prev); + mnv_free(n->rq_prev); } node->rq_next = last_node->rq_next; if (last_node->rq_next == NULL) head->rq_prev = node; else last_node->rq_next->rq_prev = node; - vim_free(last_node); + mnv_free(last_node); return OK; } @@ -2381,7 +2381,7 @@ channel_save(channel_T *channel, ch_part_T part, char_u *buf, int len, node->rq_buffer = alloc(len + 1); if (node->rq_buffer == NULL) { - vim_free(node); + mnv_free(node); return FAIL; // out of memory } @@ -2456,16 +2456,16 @@ channel_fill(js_read_T *reader) p = alloc(keeplen + addlen + 1); if (p == NULL) { - vim_free(next); + mnv_free(next); return FALSE; } mch_memmove(p, reader->js_buf, keeplen); mch_memmove(p + keeplen, next, addlen + 1); - vim_free(next); + mnv_free(next); next = p; } - vim_free(reader->js_buf); + mnv_free(reader->js_buf); reader->js_buf = next; return TRUE; } @@ -2624,7 +2624,7 @@ channel_parse_json(channel_T *channel, ch_part_T part) item->jq_value = alloc_tv(); if (item->jq_value == NULL) { - vim_free(item); + mnv_free(item); clear_tv(&listtv); } else @@ -2715,7 +2715,7 @@ channel_parse_json(channel_T *channel, ch_part_T part) else ret = FALSE; - vim_free(reader.js_buf); + mnv_free(reader.js_buf); return ret; } @@ -2750,7 +2750,7 @@ remove_json_node(jsonq_T *head, jsonq_T *node) head->jq_prev = node->jq_prev; else node->jq_next->jq_prev = node->jq_prev; - vim_free(node); + mnv_free(node); } /* @@ -2940,7 +2940,7 @@ channel_push_json(channel_T *channel, ch_part_T part, typval_T *rettv) newitem->jq_value = alloc_tv(); if (newitem->jq_value == NULL) { - vim_free(newitem); + mnv_free(newitem); clear_tv(rettv); return; } @@ -3012,7 +3012,7 @@ channel_exe_cmd(channel_T *channel, ch_part_T part, typval_T *argv) --emsg_silent; if (called_emsg > called_emsg_before) ch_log(channel, "Ex command error: '%s'", - (char *)get_vim_var_str(VV_ERRMSG)); + (char *)get_mnv_var_str(VV_ERRMSG)); } else if (STRCMP(cmd, "normal") == 0) { @@ -3083,7 +3083,7 @@ channel_exe_cmd(channel_T *channel, ch_part_T part, typval_T *argv) { // If evaluation failed or the result can't be encoded // then return the string "ERROR". - vim_free(json); + mnv_free(json); err_tv.v_type = VAR_STRING; err_tv.vval.v_string = (char_u *)"ERROR"; json = json_encode_nr_expr(id, &err_tv, options | JSON_NL); @@ -3093,7 +3093,7 @@ channel_exe_cmd(channel_T *channel, ch_part_T part, typval_T *argv) channel_send(channel, part == PART_SOCK ? PART_SOCK : PART_IN, json, (int)STRLEN(json), (char *)cmd); - vim_free(json); + mnv_free(json); } } --emsg_silent; @@ -3128,7 +3128,7 @@ invoke_one_time_callback( remove_cb_node(cbhead, item); invoke_callback(channel, &item->cq_callback, argv); free_callback(&item->cq_callback); - vim_free(item); + mnv_free(item); } static void @@ -3180,7 +3180,7 @@ append_to_buffer( u_sync(TRUE); // ignore undo failure, undo is not very useful here - vim_ignored = u_save(lnum - empty, lnum + 1); + mnv_ignored = u_save(lnum - empty, lnum + 1); if (empty) { @@ -3258,7 +3258,7 @@ drop_messages(channel_T *channel, ch_part_T part) while ((msg = channel_get(channel, part, NULL)) != NULL) { ch_log(channel, "Dropping message '%s'", (char *)msg); - vim_free(msg); + mnv_free(msg); } } @@ -3447,7 +3447,7 @@ may_invoke_callback(channel_T *channel, ch_part_T part) { // Copy the message into allocated memory (excluding the NL) // and remove it from the buffer (including the NL). - msg = vim_strnsave(buf, nl - buf); + msg = mnv_strnsave(buf, nl - buf); channel_consume(channel, part, (int)(nl - buf) + 1); } } @@ -3557,7 +3557,7 @@ may_invoke_callback(channel_T *channel, ch_part_T part) } *q = NUL; write_to_term(buffer, crlf_msg, channel); - vim_free(crlf_msg); + mnv_free(crlf_msg); } } else @@ -3593,16 +3593,16 @@ may_invoke_callback(channel_T *channel, ch_part_T part) char_u *cp = msg; char_u *nl; - while ((nl = vim_strchr(cp, NL)) != NULL) + while ((nl = mnv_strchr(cp, NL)) != NULL) { long_u len = (long_u)(nl - cp); if (len > 0 && cp[len - 1] == CAR) --len; - argv[1].vval.v_string = vim_strnsave(cp, len); + argv[1].vval.v_string = mnv_strnsave(cp, len); if (argv[1].vval.v_string != NULL) invoke_callback(channel, callback, argv); - vim_free(argv[1].vval.v_string); + mnv_free(argv[1].vval.v_string); cp = nl + 1; } if (*cp != NUL) @@ -3611,10 +3611,10 @@ may_invoke_callback(channel_T *channel, ch_part_T part) if (len > 0 && cp[len - 1] == CAR) --len; - argv[1].vval.v_string = vim_strnsave(cp, len); + argv[1].vval.v_string = mnv_strnsave(cp, len); if (argv[1].vval.v_string != NULL) invoke_callback(channel, callback, argv); - vim_free(argv[1].vval.v_string); + mnv_free(argv[1].vval.v_string); } argv[1].vval.v_string = msg; } @@ -3629,7 +3629,7 @@ may_invoke_callback(channel_T *channel, ch_part_T part) if (listtv != NULL) free_tv(listtv); - vim_free(msg); + mnv_free(msg); return TRUE; } @@ -3742,7 +3742,7 @@ channel_part_info(channel_T *channel, dict_T *dict, char *name, ch_part_T part) char *status; char *s = ""; - vim_strncpy((char_u *)namebuf, (char_u *)name, 4); + mnv_strncpy((char_u *)namebuf, (char_u *)name, 4); STRCAT(namebuf, "_"); tail = STRLEN(namebuf); @@ -3917,7 +3917,7 @@ remove_from_writeque(writeq_T *wq, writeq_T *entry) wq->wq_prev = NULL; else wq->wq_next->wq_prev = NULL; - vim_free(entry); + mnv_free(entry); } /* @@ -3931,7 +3931,7 @@ channel_clear_one(channel_T *channel, ch_part_T part) cbq_T *cb_head = &ch_part->ch_cb_head; while (channel_peek(channel, part) != NULL) - vim_free(channel_get(channel, part, NULL)); + mnv_free(channel_get(channel, part, NULL)); while (cb_head->cq_next != NULL) { @@ -3939,7 +3939,7 @@ channel_clear_one(channel_T *channel, ch_part_T part) remove_cb_node(cb_head, node); free_callback(&node->cq_callback); - vim_free(node); + mnv_free(node); } while (json_head->jq_next != NULL) @@ -3963,7 +3963,7 @@ channel_clear_one(channel_T *channel, ch_part_T part) channel_clear(channel_T *channel) { ch_log(channel, "Clearing channel"); - VIM_CLEAR(channel->ch_hostname); + MNV_CLEAR(channel->ch_hostname); channel_clear_one(channel, PART_SOCK); channel_clear_one(channel, PART_OUT); channel_clear_one(channel, PART_ERR); @@ -4307,11 +4307,11 @@ channel_read(channel_T *channel, ch_part_T part, char *func) inet_ntop(AF_INET, &((struct sockaddr_in*)&client)->sin_addr, addr, sizeof(addr)); - vim_snprintf((char *)namebuf, sizeof(namebuf), "%s:%d", + mnv_snprintf((char *)namebuf, sizeof(namebuf), "%s:%d", addr, ntohs(((struct sockaddr_in*)&client)->sin_port)); #else - vim_snprintf((char *)namebuf, sizeof(namebuf), "%s:%d", + mnv_snprintf((char *)namebuf, sizeof(namebuf), "%s:%d", inet_ntoa(((struct sockaddr_in*)&client)->sin_addr), ntohs(((struct sockaddr_in*)&client)->sin_port)); #endif @@ -4324,22 +4324,22 @@ channel_read(channel_T *channel, ch_part_T part, char *func) inet_ntop(AF_INET6, &((struct sockaddr_in6*)&client)->sin6_addr, addr, sizeof(addr)); - vim_snprintf((char *)namebuf, sizeof(namebuf), "[%s]:%d", + mnv_snprintf((char *)namebuf, sizeof(namebuf), "[%s]:%d", addr, ntohs(((struct sockaddr_in6*)&client)->sin6_port)); } #endif else if (client.ss_family == AF_UNIX) - vim_snprintf((char *)namebuf, sizeof(namebuf), + mnv_snprintf((char *)namebuf, sizeof(namebuf), "unix:anonymous"); else - vim_snprintf((char *)namebuf, sizeof(namebuf), "unknown"); + mnv_snprintf((char *)namebuf, sizeof(namebuf), "unknown"); ++safe_to_invoke_callback; ++newchannel->ch_refcount; argv[0].v_type = VAR_CHANNEL; argv[0].vval.v_channel = newchannel; argv[1].v_type = VAR_STRING; - argv[1].vval.v_string = vim_strsave(namebuf); + argv[1].vval.v_string = mnv_strsave(namebuf); invoke_callback(newchannel, &channel->ch_callback, argv); --safe_to_invoke_callback; clear_tv(&argv[1]); @@ -4452,7 +4452,7 @@ channel_read_block( { // Copy the message into allocated memory and remove it from the // buffer. - msg = vim_strnsave(buf, nl - buf); + msg = mnv_strnsave(buf, nl - buf); channel_consume(channel, part, (int)(nl - buf) + 1); } } @@ -4645,7 +4645,7 @@ common_channel_read(typval_T *argvars, typval_T *rettv, int raw, int blob) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_chan_or_job_arg(argvars, 0) == FAIL || check_for_opt_dict_arg(argvars, 1) == FAIL)) return; @@ -4688,7 +4688,7 @@ common_channel_read(typval_T *argvars, typval_T *rettv, int raw, int blob) rettv_blob_set(rettv, b); } } - vim_free(p); + mnv_free(p); } } else if (raw || mode == CH_MODE_RAW || mode == CH_MODE_NL) @@ -4702,7 +4702,7 @@ common_channel_read(typval_T *argvars, typval_T *rettv, int raw, int blob) if (listtv != NULL) { *rettv = *listtv; - vim_free(listtv); + mnv_free(listtv); } else { @@ -4744,7 +4744,7 @@ channel_handle_events(int only_keep_open) // // But, in Windows conpty terminals, the final output of a // terminated process may be missed. In this case, in order for - // Vim to read the final output, it is necessary to set the timeout + // MNV to read the final output, it is necessary to set the timeout // to 1 msec or more. It seems that the final output can be // received by calling Sleep() once within channel_wait(). Note // that ch_killing can only be TRUE in conpty terminals, so it has @@ -5062,7 +5062,7 @@ ch_expr_common(typval_T *argvars, typval_T *rettv, int eval) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_chan_or_job_arg(argvars, 0) == FAIL || check_for_opt_dict_arg(argvars, 2) == FAIL)) return; @@ -5150,7 +5150,7 @@ ch_expr_common(typval_T *argvars, typval_T *rettv, int eval) channel = send_common(argvars, text, (int)STRLEN(text), id, eval, &opt, eval ? "ch_evalexpr" : "ch_sendexpr", &part_read); - vim_free(text); + mnv_free(text); if (channel != NULL && eval) { if (opt.jo_set & JO_TIMEOUT) @@ -5214,7 +5214,7 @@ ch_raw_common(typval_T *argvars, typval_T *rettv, int eval) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_chan_or_job_arg(argvars, 0) == FAIL || check_for_string_or_blob_arg(argvars, 1) == FAIL || check_for_opt_dict_arg(argvars, 2) == FAIL)) @@ -5550,7 +5550,7 @@ channel_parse_messages(void) if (channel_unref(channel) || (r == OK #ifdef ELAPSED_FUNC // Limit the time we loop here to 100 msec, otherwise - // Vim becomes unresponsive when the callback takes + // MNV becomes unresponsive when the callback takes // more than a bit of time. && ELAPSED_FUNC(start_tv) < 100L #endif @@ -5681,7 +5681,7 @@ f_ch_canread(typval_T *argvars, typval_T *rettv) channel_T *channel; rettv->vval.v_number = 0; - if (in_vim9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL) return; channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0); @@ -5699,7 +5699,7 @@ f_ch_close(typval_T *argvars, typval_T *rettv UNUSED) { channel_T *channel; - if (in_vim9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL) return; channel = get_channel_arg(&argvars[0], TRUE, FALSE, 0); @@ -5718,7 +5718,7 @@ f_ch_close_in(typval_T *argvars, typval_T *rettv UNUSED) { channel_T *channel; - if (in_vim9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL) return; channel = get_channel_arg(&argvars[0], TRUE, FALSE, 0); @@ -5736,7 +5736,7 @@ f_ch_getbufnr(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = -1; - if (in_vim9script() + if (in_mnv9script() && (check_for_chan_or_job_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; @@ -5768,7 +5768,7 @@ f_ch_getjob(typval_T *argvars, typval_T *rettv) { channel_T *channel; - if (in_vim9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL) return; channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0); @@ -5789,7 +5789,7 @@ f_ch_info(typval_T *argvars, typval_T *rettv UNUSED) { channel_T *channel; - if (in_vim9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_chan_or_job_arg(argvars, 0) == FAIL) return; channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0); @@ -5893,7 +5893,7 @@ f_ch_setoptions(typval_T *argvars, typval_T *rettv UNUSED) channel_T *channel; jobopt_T opt; - if (in_vim9script() + if (in_mnv9script() && (check_for_chan_or_job_arg(argvars, 0) == FAIL || check_for_dict_arg(argvars, 1) == FAIL)) return; @@ -5922,7 +5922,7 @@ f_ch_status(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_chan_or_job_arg(argvars, 0) == FAIL || check_for_opt_dict_arg(argvars, 1) == FAIL)) return; @@ -5937,7 +5937,7 @@ f_ch_status(typval_T *argvars, typval_T *rettv) part = opt.jo_part; } - rettv->vval.v_string = vim_strsave((char_u *)channel_status(channel, part)); + rettv->vval.v_string = mnv_strsave((char_u *)channel_status(channel, part)); } /* @@ -5951,9 +5951,9 @@ channel_to_string_buf(typval_T *varp, char_u *buf) char *status = channel_status(channel, -1); if (channel == NULL) - vim_snprintf((char *)buf, NUMBUFLEN, "channel %s", status); + mnv_snprintf((char *)buf, NUMBUFLEN, "channel %s", status); else - vim_snprintf((char *)buf, NUMBUFLEN, + mnv_snprintf((char *)buf, NUMBUFLEN, "channel %d %s", channel->ch_id, status); return buf; } diff --git a/uvim/src/charset.c b/uvim/src/charset.c index 49320fcb64..7e629deaa2 100644 --- a/uvim/src/charset.c +++ b/uvim/src/charset.c @@ -1,13 +1,13 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ -#include "vim.h" +#include "mnv.h" #if defined(HAVE_WCHAR_H) # include // for towupper() and towlower() @@ -189,7 +189,7 @@ parse_isopt( tilde = TRUE; ++p; } - if (VIM_ISDIGIT(*p)) + if (MNV_ISDIGIT(*p)) c = getdigits(&p); else if (has_mbyte) c = mb_ptr2char_adv(&p); @@ -199,7 +199,7 @@ parse_isopt( if (*p == '-' && p[1] != NUL) { ++p; - if (VIM_ISDIGIT(*p)) + if (MNV_ISDIGIT(*p)) c2 = getdigits(&p); else if (has_mbyte) c2 = mb_ptr2char_adv(&p); @@ -358,7 +358,7 @@ transstr(char_u *s) { c = (*mb_ptr2char)(p); p += l; - if (vim_isprintc(c)) + if (mnv_isprintc(c)) len += l; else { @@ -378,7 +378,7 @@ transstr(char_u *s) res = alloc(len + 1); } else - res = alloc(vim_strsize(s) + 1); + res = alloc(mnv_strsize(s) + 1); if (res == NULL) return NULL; @@ -390,7 +390,7 @@ transstr(char_u *s) if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1) { c = (*mb_ptr2char)(p); - if (vim_isprintc(c)) + if (mnv_isprintc(c)) STRNCAT(res, p, l); // append printable multi-byte char else transchar_hex(res + STRLEN(res), c); @@ -544,7 +544,7 @@ transchar_buf(buf_T *buf, int c) } if ((!chartab_initialized && ((c >= ' ' && c <= '~'))) - || (c < 256 && vim_isprintc_strict(c))) + || (c < 256 && mnv_isprintc_strict(c))) { // printable character transchar_charbuf[i] = c; @@ -714,9 +714,9 @@ ptr2cells(char_u *p) * counting TABs as two characters: "^I". */ int -vim_strsize(char_u *s) +mnv_strsize(char_u *s) { - return vim_strnsize(s, (int)MAXCOL); + return mnv_strnsize(s, (int)MAXCOL); } /* @@ -724,7 +724,7 @@ vim_strsize(char_u *s) * screen, counting TABs as two characters: "^I". */ int -vim_strnsize(char_u *s, int len) +mnv_strnsize(char_u *s, int len) { int size = 0; @@ -799,7 +799,7 @@ linetabsize_str(char_u *s) linetabsize_col(int startcol, char_u *s) { chartabsize_T cts; - vimlong_T vcol; + mnvlong_T vcol; init_chartabsize_arg(&cts, curwin, 0, startcol, s, s); vcol = cts.cts_vcol; @@ -886,7 +886,7 @@ linetabsize_no_outer(win_T *wp, linenr_T lnum) } cts.cts_text_prop_count = write_idx; if (cts.cts_text_prop_count == 0) - VIM_CLEAR(cts.cts_text_props); + MNV_CLEAR(cts.cts_text_props); } win_linetabsize_cts(&cts, (colnr_T)MAXCOL); @@ -898,7 +898,7 @@ linetabsize_no_outer(win_T *wp, linenr_T lnum) void win_linetabsize_cts(chartabsize_T *cts, colnr_T len) { - vimlong_T vcol = cts->cts_vcol; + mnvlong_T vcol = cts->cts_vcol; #ifdef FEAT_PROP_POPUP cts->cts_with_trailing = len == MAXCOL; #endif @@ -935,17 +935,17 @@ win_linetabsize_cts(chartabsize_T *cts, colnr_T len) * Letters and characters from the 'isident' option. */ int -vim_isIDc(int c) +mnv_isIDc(int c) { return (c > 0 && c < 0x100 && (g_chartab[c] & CT_ID_CHAR)); } /* - * Like vim_isIDc() but not using the 'isident' option: letters, numbers and + * Like mnv_isIDc() but not using the 'isident' option: letters, numbers and * underscore. */ int -vim_isNormalIDc(int c) +mnv_isNormalIDc(int c) { return ASCII_ISALNUM(c) || c == '_'; } @@ -956,13 +956,13 @@ vim_isNormalIDc(int c) * For multi-byte characters mb_get_class() is used (builtin rules). */ int -vim_iswordc(int c) +mnv_iswordc(int c) { - return vim_iswordc_buf(c, curbuf); + return mnv_iswordc_buf(c, curbuf); } int -vim_iswordc_buf(int c, buf_T *buf) +mnv_iswordc_buf(int c, buf_T *buf) { if (c >= 0x100) { @@ -976,22 +976,22 @@ vim_iswordc_buf(int c, buf_T *buf) } /* - * Just like vim_iswordc() but uses a pointer to the (multi-byte) character. + * Just like mnv_iswordc() but uses a pointer to the (multi-byte) character. */ int -vim_iswordp(char_u *p) +mnv_iswordp(char_u *p) { - return vim_iswordp_buf(p, curbuf); + return mnv_iswordp_buf(p, curbuf); } int -vim_iswordp_buf(char_u *p, buf_T *buf) +mnv_iswordp_buf(char_u *p, buf_T *buf) { int c = *p; if (has_mbyte && MB_BYTE2LEN(c) > 1) c = (*mb_ptr2char)(p); - return vim_iswordc_buf(c, buf); + return mnv_iswordc_buf(c, buf); } /* @@ -1001,7 +1001,7 @@ vim_iswordp_buf(char_u *p, buf_T *buf) * To be used for commands like "gf". */ int -vim_isfilec(int c) +mnv_isfilec(int c) { return (c >= 0x100 || (c > 0 && (g_chartab[c] & CT_FNAME_CHAR))); } @@ -1012,9 +1012,9 @@ vim_isfilec(int c) * out of 'isfname' to make "gf" work, such as comma, space, '@', etc. */ int -vim_is_fname_char(int c) +mnv_is_fname_char(int c) { - return vim_isfilec(c) || c == ',' || c == ' ' || c == '@'; + return mnv_isfilec(c) || c == ',' || c == ' ' || c == '@'; } #endif @@ -1025,13 +1025,13 @@ vim_is_fname_char(int c) * returns false. */ int -vim_isfilec_or_wc(int c) +mnv_isfilec_or_wc(int c) { char_u buf[2]; buf[0] = (char_u)c; buf[1] = NUL; - return vim_isfilec(c) || c == ']' || mch_has_wildcard(buf); + return mnv_isfilec(c) || c == ']' || mch_has_wildcard(buf); } /* @@ -1040,7 +1040,7 @@ vim_isfilec_or_wc(int c) * Unicode. */ int -vim_isprintc(int c) +mnv_isprintc(int c) { if (enc_utf8 && c >= 0x100) return utf_printable(c); @@ -1048,11 +1048,11 @@ vim_isprintc(int c) } /* - * Strict version of vim_isprintc(c), don't return TRUE if "c" is the head + * Strict version of mnv_isprintc(c), don't return TRUE if "c" is the head * byte of a double-byte character. */ int -vim_isprintc_strict(int c) +mnv_isprintc_strict(int c) { if (enc_dbcs != 0 && c < 0x100 && MB_BYTE2LEN(c) > 1) return FALSE; @@ -1117,7 +1117,7 @@ init_chartabsize_arg( if (!cts->cts_has_prop_with_text) { // won't use the text properties, free them - VIM_CLEAR(cts->cts_text_props); + MNV_CLEAR(cts->cts_text_props); cts->cts_text_prop_count = 0; } else @@ -1138,7 +1138,7 @@ init_chartabsize_arg( for (i = 0; i < count; ++i) cts->cts_text_props[count - i - 1] = cts->cts_text_props[text_prop_idxs[i]]; - vim_free(text_prop_idxs); + mnv_free(text_prop_idxs); } } } @@ -1156,7 +1156,7 @@ clear_chartabsize_arg(chartabsize_T *cts UNUSED) #ifdef FEAT_PROP_POPUP if (cts->cts_text_prop_count > 0) { - VIM_CLEAR(cts->cts_text_props); + MNV_CLEAR(cts->cts_text_props); cts->cts_text_prop_count = 0; } #endif @@ -1334,7 +1334,7 @@ win_lbr_chartabsize( # endif } else - cells = vim_strsize(p); + cells = mnv_strsize(p); cts->cts_cur_text_width += cells; if (tp->tp_flags & TP_FLAG_ALIGN_ABOVE) cts->cts_first_char += cells; @@ -1401,7 +1401,7 @@ win_lbr_chartabsize( if (wcol >= width2 && width2 > 0) wcol %= width2; if (*sbr != NUL) - head_prev += vim_strsize(sbr); + head_prev += mnv_strsize(sbr); if (wp->w_p_bri) { if (cts->cts_bri_size < 0) @@ -1426,7 +1426,7 @@ win_lbr_chartabsize( // cells taken by 'showbreak'/'breakindent' halfway current char int head_mid = 0; if (*sbr != NUL) - head_mid += vim_strsize(sbr); + head_mid += mnv_strsize(sbr); if (wp->w_p_bri) { if (cts->cts_bri_size < 0) @@ -1476,10 +1476,10 @@ win_lbr_chartabsize( * needs a break here. */ if (wp->w_p_lbr && wp->w_p_wrap && wp->w_width != 0 - && VIM_ISBREAK((int)s[0]) && !VIM_ISBREAK((int)s[1])) + && MNV_ISBREAK((int)s[0]) && !MNV_ISBREAK((int)s[1])) { char_u *t = cts->cts_line; - while (VIM_ISBREAK((int)t[0])) + while (MNV_ISBREAK((int)t[0])) t++; // 'linebreak' is only needed when not in leading whitespace. need_lbr = s >= t; @@ -1508,9 +1508,9 @@ win_lbr_chartabsize( MB_PTR_ADV(s); int c = *s; if (!(c != NUL - && (VIM_ISBREAK(c) - || (!VIM_ISBREAK(c) - && (vcol2 == vcol || !VIM_ISBREAK((int)*ps)))))) + && (MNV_ISBREAK(c) + || (!MNV_ISBREAK(c) + && (vcol2 == vcol || !MNV_ISBREAK((int)*ps)))))) break; vcol2 += win_chartabsize(wp, s, vcol2); @@ -1811,7 +1811,7 @@ getvvcol( { int c = (*mb_ptr2char)(ptr + pos->col); - if (c != TAB && vim_isprintc(c)) + if (c != TAB && mnv_isprintc(c)) { endadd = (colnr_T)(char2cells(c) - 1); if (coladd > endadd) // past end of line @@ -1879,7 +1879,7 @@ skipwhite(char_u *q) { char_u *p = q; - while (VIM_ISWHITE(*p)) + while (MNV_ISWHITE(*p)) ++p; return p; } @@ -1893,7 +1893,7 @@ skipwhite_and_nl(char_u *q) { char_u *p = q; - while (VIM_ISWHITE(*p) || *p == NL) + while (MNV_ISWHITE(*p) || *p == NL) ++p; return p; } @@ -1923,7 +1923,7 @@ skipdigits(char_u *q) { char_u *p = q; - while (VIM_ISDIGIT(*p)) // skip to next non-digit + while (MNV_ISDIGIT(*p)) // skip to next non-digit ++p; return p; } @@ -1937,7 +1937,7 @@ skipbin(char_u *q) { char_u *p = q; - while (vim_isbdigit(*p)) // skip to next non-digit + while (mnv_isbdigit(*p)) // skip to next non-digit ++p; return p; } @@ -1950,7 +1950,7 @@ skiphex(char_u *q) { char_u *p = q; - while (vim_isxdigit(*p)) // skip to next non-digit + while (mnv_isxdigit(*p)) // skip to next non-digit ++p; return p; } @@ -1964,7 +1964,7 @@ skiptobin(char_u *q) { char_u *p = q; - while (*p != NUL && !vim_isbdigit(*p)) // skip to next digit + while (*p != NUL && !mnv_isbdigit(*p)) // skip to next digit ++p; return p; } @@ -1977,7 +1977,7 @@ skiptodigit(char_u *q) { char_u *p = q; - while (*p != NUL && !VIM_ISDIGIT(*p)) // skip to next digit + while (*p != NUL && !MNV_ISDIGIT(*p)) // skip to next digit ++p; return p; } @@ -1990,7 +1990,7 @@ skiptohex(char_u *q) { char_u *p = q; - while (*p != NUL && !vim_isxdigit(*p)) // skip to next digit + while (*p != NUL && !mnv_isxdigit(*p)) // skip to next digit ++p; return p; } @@ -1999,10 +1999,10 @@ skiptohex(char_u *q) * Variant of isdigit() that can handle characters > 0x100. * We don't use isdigit() here, because on some systems it also considers * superscript 1 to be a digit. - * Use the VIM_ISDIGIT() macro for simple arguments. + * Use the MNV_ISDIGIT() macro for simple arguments. */ int -vim_isdigit(int c) +mnv_isdigit(int c) { return (c >= '0' && c <= '9'); } @@ -2013,7 +2013,7 @@ vim_isdigit(int c) * superscript 1 to be a digit. */ int -vim_isxdigit(int c) +mnv_isxdigit(int c) { return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') @@ -2021,23 +2021,23 @@ vim_isxdigit(int c) } /* - * Corollary of vim_isdigit and vim_isxdigit() that can handle + * Corollary of mnv_isdigit and mnv_isxdigit() that can handle * characters > 0x100. */ int -vim_isbdigit(int c) +mnv_isbdigit(int c) { return (c == '0' || c == '1'); } static int -vim_isodigit(int c) +mnv_isodigit(int c) { return (c >= '0' && c <= '7'); } /* - * Vim's own character class functions. These exist because many library + * MNV's own character class functions. These exist because many library * islower()/toupper() etc. do not work properly: they crash when used with * invalid values or can't handle latin1 when the locale is C. * Speed is most important here. @@ -2050,7 +2050,7 @@ static char_u latin1upper[257] = " !\"#$%&'()*+, static char_u latin1lower[257] = " !\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xd7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"; int -vim_islower(int c) +mnv_islower(int c) { if (c <= '@') return FALSE; @@ -2074,7 +2074,7 @@ vim_islower(int c) } int -vim_isupper(int c) +mnv_isupper(int c) { if (c <= '@') return FALSE; @@ -2098,13 +2098,13 @@ vim_isupper(int c) } int -vim_isalpha(int c) +mnv_isalpha(int c) { - return vim_islower(c) || vim_isupper(c); + return mnv_islower(c) || mnv_isupper(c); } int -vim_toupper(int c) +mnv_toupper(int c) { if (c <= '@') return c; @@ -2130,7 +2130,7 @@ vim_toupper(int c) } int -vim_tolower(int c) +mnv_tolower(int c) { if (c <= '@') return c; @@ -2211,14 +2211,14 @@ getdigits_quoted(char_u **pp) if (*p == '-') ++p; - while (VIM_ISDIGIT(*p)) + while (MNV_ISDIGIT(*p)) { if (retval >= LONG_MAX / 10 - 10) retval = LONG_MAX; else retval = retval * 10 - '0' + *p; ++p; - if (in_vim9script() && *p == '\'' && VIM_ISDIGIT(p[1])) + if (in_mnv9script() && *p == '\'' && MNV_ISDIGIT(p[1])) ++p; } if (**pp == '-') @@ -2236,7 +2236,7 @@ getdigits_quoted(char_u **pp) * Return TRUE if "lbuf" is empty or only contains blanks. */ int -vim_isblankline(char_u *lbuf) +mnv_isblankline(char_u *lbuf) { char_u *p; @@ -2268,7 +2268,7 @@ vim_isblankline(char_u *lbuf) * If strict is TRUE, check the number strictly. return *len = 0 if fail. */ void -vim_str2nr( +mnv_str2nr( char_u *start, int *prep, // return: type of number 0 = decimal, 'x' // or 'X' is hex, '0', 'o' or 'O' is octal, @@ -2302,17 +2302,17 @@ vim_str2nr( { pre = ptr[1]; if ((what & STR2NR_HEX) - && (pre == 'X' || pre == 'x') && vim_isxdigit(ptr[2]) + && (pre == 'X' || pre == 'x') && mnv_isxdigit(ptr[2]) && (maxlen == 0 || maxlen > 2)) // hexadecimal ptr += 2; else if ((what & STR2NR_BIN) - && (pre == 'B' || pre == 'b') && vim_isbdigit(ptr[2]) + && (pre == 'B' || pre == 'b') && mnv_isbdigit(ptr[2]) && (maxlen == 0 || maxlen > 2)) // binary ptr += 2; else if ((what & STR2NR_OOCT) - && (pre == 'O' || pre == 'o') && vim_isodigit(ptr[2]) + && (pre == 'O' || pre == 'o') && mnv_isodigit(ptr[2]) && (maxlen == 0 || maxlen > 2)) // octal with prefix "0o" ptr += 2; @@ -2323,7 +2323,7 @@ vim_str2nr( if (what & STR2NR_OCT) { // Don't interpret "0", "08" or "0129" as octal. - for (n = 1; n != maxlen && VIM_ISDIGIT(ptr[n]); ++n) + for (n = 1; n != maxlen && MNV_ISDIGIT(ptr[n]); ++n) { if (ptr[n] > '7') { @@ -2401,7 +2401,7 @@ vim_str2nr( // hex if (pre != 0) n += 2; // skip over "0x" - while (vim_isxdigit(*ptr)) + while (mnv_isxdigit(*ptr)) { // avoid ubsan error for overflow if (un <= UVARNUM_MAX / 16) @@ -2415,7 +2415,7 @@ vim_str2nr( ++ptr; if (n++ == maxlen) break; - if ((what & STR2NR_QUOTE) && *ptr == '\'' && vim_isxdigit(ptr[1])) + if ((what & STR2NR_QUOTE) && *ptr == '\'' && mnv_isxdigit(ptr[1])) { ++ptr; if (n++ == maxlen) @@ -2426,7 +2426,7 @@ vim_str2nr( else { // decimal - while (VIM_ISDIGIT(*ptr)) + while (MNV_ISDIGIT(*ptr)) { uvarnumber_T digit = (uvarnumber_T)(*ptr - '0'); @@ -2443,7 +2443,7 @@ vim_str2nr( ++ptr; if (n++ == maxlen) break; - if ((what & STR2NR_QUOTE) && *ptr == '\'' && VIM_ISDIGIT(ptr[1])) + if ((what & STR2NR_QUOTE) && *ptr == '\'' && MNV_ISDIGIT(ptr[1])) { ++ptr; if (n++ == maxlen) @@ -2512,7 +2512,7 @@ hex2nr(int c) int hexhex2nr(char_u *p) { - if (!vim_isxdigit(p[0]) || !vim_isxdigit(p[1])) + if (!mnv_isxdigit(p[0]) || !mnv_isxdigit(p[1])) return -1; return (hex2nr(p[0]) << 4) + hex2nr(p[1]); } @@ -2523,7 +2523,7 @@ hexhex2nr(char_u *p) * backslash is not a normal file name character. * '$' is a valid file name character, we don't remove the backslash before * it. This means it is not possible to use an environment variable after a - * backslash. "C:\$VIM\doc" is taken literally, only "$VIM\doc" works. + * backslash. "C:\$MNV\doc" is taken literally, only "$MNV\doc" works. * Although "\ name" is valid, the backslash in "Program\ files" must be * removed. Assume a file name doesn't start with a space. * For multi-byte names, never remove a backslash before a non-ascii @@ -2540,7 +2540,7 @@ rem_backslash(char_u *str) || (str[1] != NUL && str[1] != '*' && str[1] != '?' - && !vim_isfilec(str[1])))); + && !mnv_isfilec(str[1])))); #else return (str[0] == '\\' && str[1] != NUL); #endif @@ -2568,7 +2568,7 @@ backslash_halve_save(char_u *p) { char_u *res; - res = vim_strsave(p); + res = mnv_strsave(p); if (res == NULL) return p; backslash_halve(res); diff --git a/uvim/src/cindent.c b/uvim/src/cindent.c index 1b4ad0fa4a..5c6fe8ca88 100644 --- a/uvim/src/cindent.c +++ b/uvim/src/cindent.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -15,7 +15,7 @@ * Below "XXX" means that this function may unlock the current line. */ -#include "vim.h" +#include "mnv.h" // values for the "lookfor" state #define LOOKFOR_INITIAL 0 @@ -54,13 +54,13 @@ cin_is_cinword(char_u *line) { len = copy_option_part(&cinw, cinw_buf, cinw_len, ","); if (STRNCMP(line, cinw_buf, len) == 0 - && (!vim_iswordc(line[len]) || !vim_iswordc(line[len - 1]))) + && (!mnv_iswordc(line[len]) || !mnv_iswordc(line[len - 1]))) { retval = TRUE; break; } } - vim_free(cinw_buf); + mnv_free(cinw_buf); return retval; } @@ -84,7 +84,7 @@ skip_string(char_u *p) if (p[1] == '\\' && p[2] != NUL) // '\n' or '\000' { ++i; - while (vim_isdigit(p[i - 1])) // '\000' + while (mnv_isdigit(p[i - 1])) // '\000' ++i; } if (p[i - 1] != NUL && p[i] == '\'') // check for trailing ' @@ -109,7 +109,7 @@ skip_string(char_u *p) { // Raw string: R"[delim](...)[delim]" char_u *delim = p + 2; - char_u *paren = vim_strchr(delim, '('); + char_u *paren = mnv_strchr(delim, '('); if (paren != NULL) { @@ -380,10 +380,10 @@ cin_has_js_key(char_u *text) quote = *s; ++s; } - if (!vim_isIDc(*s)) // need at least one ID character + if (!mnv_isIDc(*s)) // need at least one ID character return FALSE; - while (vim_isIDc(*s)) + while (mnv_isIDc(*s)) ++s; if (*s == quote) ++s; @@ -401,10 +401,10 @@ cin_has_js_key(char_u *text) static int cin_islabel_skip(char_u **s) { - if (!vim_isIDc(**s)) // need at least one ID character + if (!mnv_isIDc(**s)) // need at least one ID character return FALSE; - while (vim_isIDc(**s)) + while (mnv_isIDc(**s)) { if (has_mbyte) (*s) += (*mb_ptr2len)(*s); @@ -451,7 +451,7 @@ cin_isscopedecl(char_u *p) } } - vim_free(cinsd_buf); + mnv_free(cinsd_buf); return found; } @@ -511,7 +511,7 @@ cin_iselse( { if (*p == '}') // accept "} else" p = cin_skipcomment(p + 1); - return (STRNCMP(p, "else", 4) == 0 && !vim_isIDc(p[4])); + return (STRNCMP(p, "else", 4) == 0 && !mnv_isIDc(p[4])); } /* @@ -573,7 +573,7 @@ cin_starts_with(char_u *s, char *word) { int l = (int)STRLEN(word); - return (STRNCMP(s, word, l) == 0 && !vim_isIDc(s[l])); + return (STRNCMP(s, word, l) == 0 && !mnv_isIDc(s[l])); } /* @@ -748,8 +748,8 @@ cin_is_compound_init(char_u *s) { if (*p == '=') p = r = cin_skipcomment(p + 1); - else if (!STRNCMP(p, "return", 6) && !vim_isIDc(p[6]) - && (p == s || (p > s && !vim_isIDc(p[-1])))) + else if (!STRNCMP(p, "return", 6) && !mnv_isIDc(p[6]) + && (p == s || (p > s && !mnv_isIDc(p[-1])))) p = r = cin_skipcomment(p + 6); else p = cin_skip_comment_and_string(p + 1); @@ -841,15 +841,15 @@ cin_is_cpp_namespace(char_u *s) // skip over "inline" and "export" in any order while ((STRNCMP(s, "inline", 6) == 0 || STRNCMP(s, "export", 6) == 0) - && (s[6] == NUL || !vim_iswordc(s[6]))) + && (s[6] == NUL || !mnv_iswordc(s[6]))) s = cin_skipcomment(skipwhite(s + 6)); - if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9]))) + if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !mnv_iswordc(s[9]))) { p = cin_skipcomment(skipwhite(s + 9)); while (*p != NUL) { - if (VIM_ISWHITE(*p)) + if (MNV_ISWHITE(*p)) { has_name = TRUE; // found end of a name p = cin_skipcomment(skipwhite(p)); @@ -858,14 +858,14 @@ cin_is_cpp_namespace(char_u *s) { break; } - else if (vim_iswordc(*p)) + else if (mnv_iswordc(*p)) { has_name_start = TRUE; if (has_name) return FALSE; // word character after skipping past name ++p; } - else if (p[0] == ':' && p[1] == ':' && vim_iswordc(p[2])) + else if (p[0] == ':' && p[1] == ':' && mnv_iswordc(p[2])) { if (!has_name_start || has_name) return FALSE; @@ -892,12 +892,12 @@ cin_is_cpp_extern_c(char_u *s) int has_string_literal = FALSE; s = cin_skipcomment(s); - if (STRNCMP(s, "extern", 6) == 0 && (s[6] == NUL || !vim_iswordc(s[6]))) + if (STRNCMP(s, "extern", 6) == 0 && (s[6] == NUL || !mnv_iswordc(s[6]))) { p = cin_skipcomment(skipwhite(s + 6)); while (*p != NUL) { - if (VIM_ISWHITE(*p)) + if (MNV_ISWHITE(*p)) { p = cin_skipcomment(skipwhite(p)); } @@ -1048,15 +1048,15 @@ cin_first_id_amount(void) || (len == 6 && STRNCMP(p, "signed", 6) == 0)) { s = skipwhite(p + len); - if ((STRNCMP(s, "int", 3) == 0 && VIM_ISWHITE(s[3])) - || (STRNCMP(s, "long", 4) == 0 && VIM_ISWHITE(s[4])) - || (STRNCMP(s, "short", 5) == 0 && VIM_ISWHITE(s[5])) - || (STRNCMP(s, "char", 4) == 0 && VIM_ISWHITE(s[4]))) + if ((STRNCMP(s, "int", 3) == 0 && MNV_ISWHITE(s[3])) + || (STRNCMP(s, "long", 4) == 0 && MNV_ISWHITE(s[4])) + || (STRNCMP(s, "short", 5) == 0 && MNV_ISWHITE(s[5])) + || (STRNCMP(s, "char", 4) == 0 && MNV_ISWHITE(s[4]))) p = s; } - for (len = 0; vim_isIDc(p[len]); ++len) + for (len = 0; mnv_isIDc(p[len]); ++len) ; - if (len == 0 || !VIM_ISWHITE(p[len]) || cin_nocode(p)) + if (len == 0 || !MNV_ISWHITE(p[len]) || cin_nocode(p)) return 0; p = skipwhite(p + len); @@ -1091,7 +1091,7 @@ cin_get_equal_amount(linenr_T lnum) } line = s = ml_get(lnum); - while (*s != NUL && vim_strchr((char_u *)"=;{}\"'", *s) == NULL) + while (*s != NUL && mnv_strchr((char_u *)"=;{}\"'", *s) == NULL) { if (cin_iscomment(s)) // ignore comments s = cin_skipcomment(s); @@ -1361,13 +1361,13 @@ done: static int cin_isif(char_u *p) { - return (STRNCMP(p, "if", 2) == 0 && !vim_isIDc(p[2])); + return (STRNCMP(p, "if", 2) == 0 && !mnv_isIDc(p[2])); } static int cin_isdo(char_u *p) { - return (STRNCMP(p, "do", 2) == 0 && !vim_isIDc(p[2])); + return (STRNCMP(p, "do", 2) == 0 && !mnv_isIDc(p[2])); } /* @@ -1418,7 +1418,7 @@ cin_is_if_for_while_before_offset(char_u *line, int *poffset) if (offset-- < 2) return 0; - while (offset > 2 && VIM_ISWHITE(line[offset])) + while (offset > 2 && MNV_ISWHITE(line[offset])) --offset; offset -= 1; @@ -1441,7 +1441,7 @@ cin_is_if_for_while_before_offset(char_u *line, int *poffset) return 0; probablyFound: - if (!offset || !vim_isIDc(line[offset - 1])) + if (!offset || !mnv_isIDc(line[offset - 1])) { *poffset = offset; return 1; @@ -1509,7 +1509,7 @@ cin_iswhileofdo_end(int terminated) static int cin_isbreak(char_u *p) { - return (STRNCMP(p, "break", 5) == 0 && !vim_isIDc(p[5])); + return (STRNCMP(p, "break", 5) == 0 && !mnv_isIDc(p[5])); } /* @@ -1627,8 +1627,8 @@ cin_is_cpp_baseclass( else s = cin_skipcomment(s + 1); } - else if ((STRNCMP(s, "class", 5) == 0 && !vim_isIDc(s[5])) - || (STRNCMP(s, "struct", 6) == 0 && !vim_isIDc(s[6]))) + else if ((STRNCMP(s, "class", 5) == 0 && !mnv_isIDc(s[5])) + || (STRNCMP(s, "struct", 6) == 0 && !mnv_isIDc(s[6]))) { class_or_struct = TRUE; lookfor_ctor_init = FALSE; @@ -1656,7 +1656,7 @@ cin_is_cpp_baseclass( // Avoid seeing '() :' after '?' as constructor init. return FALSE; } - else if (!vim_isIDc(s[0])) + else if (!mnv_isIDc(s[0])) { // if it is not an identifier, we are wrong class_or_struct = FALSE; @@ -1800,7 +1800,7 @@ parse_cino(buf_T *buf) char_u *p; char_u *l; char_u *digits; - vimlong_T n; + mnvlong_T n; int divider; int fraction = 0; int sw; @@ -1955,7 +1955,7 @@ parse_cino(buf_T *buf) if (*p == '.') // ".5s" means a fraction { fraction = atol((char *)++p); - while (VIM_ISDIGIT(*p)) + while (MNV_ISDIGIT(*p)) { ++p; if (divider) @@ -1972,7 +1972,7 @@ parse_cino(buf_T *buf) { n *= sw; if (divider) - n += ((vimlong_T)sw * fraction + divider / 2) / divider; + n += ((mnvlong_T)sw * fraction + divider / 2) / divider; } ++p; } @@ -2182,7 +2182,7 @@ get_c_indent(void) // Get a copy of the current contents of the line. // This is required, because only the most recent line obtained with // ml_get is valid! - linecopy = vim_strsave(ml_get(cur_curpos.lnum)); + linecopy = mnv_strsave(ml_get(cur_curpos.lnum)); if (linecopy == NULL) return 0; @@ -2305,7 +2305,7 @@ get_c_indent(void) what = *p++; else if (*p == COM_LEFT || *p == COM_RIGHT) align = *p++; - else if (VIM_ISDIGIT(*p) || *p == '-') + else if (MNV_ISDIGIT(*p) || *p == '-') off = getdigits(&p); else ++p; @@ -2359,8 +2359,8 @@ get_c_indent(void) if (start_off != 0) amount += start_off; else if (start_align == COM_RIGHT) - amount += vim_strsize(lead_start) - - vim_strsize(lead_middle); + amount += mnv_strsize(lead_start) + - mnv_strsize(lead_middle); break; } @@ -2374,8 +2374,8 @@ get_c_indent(void) if (off != 0) amount += off; else if (align == COM_RIGHT) - amount += vim_strsize(lead_start) - - vim_strsize(lead_middle); + amount += mnv_strsize(lead_start) + - mnv_strsize(lead_middle); done = TRUE; break; } @@ -2602,7 +2602,7 @@ get_c_indent(void) else { col = our_paren_pos.col + 1; - while (VIM_ISWHITE(l[col])) + while (MNV_ISWHITE(l[col])) col++; if (l[col] != NUL) // In case of trailing space our_paren_pos.col = col; @@ -3769,8 +3769,8 @@ term_again: // contains { or }: "void f(condition) {\n if (1)" if (cur_curpos.lnum < curbuf->b_ml.ml_line_count && !cin_nocode(theline) - && vim_strchr(theline, '{') == NULL - && vim_strchr(theline, '}') == NULL + && mnv_strchr(theline, '{') == NULL + && mnv_strchr(theline, '}') == NULL && !cin_ends_in(theline, (char_u *)":") && !cin_ends_in(theline, (char_u *)",") && cin_isfuncdecl(NULL, cur_curpos.lnum + 1, @@ -3981,7 +3981,7 @@ laterend: // put the cursor back where it belongs curwin->w_cursor = cur_curpos; - vim_free(linecopy); + mnv_free(linecopy); return amount; } @@ -4121,7 +4121,7 @@ in_cinkeys( // make up some named keys , , , <0>, <>>, <<>, <*>, // <:> and so that people can re-indent on o, O, e, 0, <, // >, *, : and ! keys if they really really want to. - if (vim_strchr((char_u *)"<>!*oOe0:", look[1]) != NULL + if (mnv_strchr((char_u *)"<>!*oOe0:", look[1]) != NULL && keytyped == look[1]) return TRUE; @@ -4145,7 +4145,7 @@ in_cinkeys( } else icase = FALSE; - p = vim_strchr(look, ','); + p = mnv_strchr(look, ','); if (p == NULL) p = look + STRLEN(look); if ((try_match || try_match_word) @@ -4167,13 +4167,13 @@ in_cinkeys( for (s = line + curwin->w_cursor.col; s > line; s = n) { n = mb_prevptr(line, s); - if (!vim_iswordp(n)) + if (!mnv_iswordp(n)) break; } } else for (s = line + curwin->w_cursor.col; s > line; --s) - if (!vim_iswordc(s[-1])) + if (!mnv_iswordc(s[-1])) break; if (s + (p - look) <= line + curwin->w_cursor.col && (icase @@ -4189,7 +4189,7 @@ in_cinkeys( { line = ml_get_cursor(); if ((curwin->w_cursor.col == (colnr_T)(p - look) - || !vim_iswordc(line[-(p - look) - 1])) + || !mnv_iswordc(line[-(p - look) - 1])) && (icase ? MB_STRNICMP(line - (p - look), look, p - look) : STRNCMP(line - (p - look), look, p - look)) @@ -4249,7 +4249,7 @@ f_cindent(typval_T *argvars UNUSED, typval_T *rettv) pos_T pos; linenr_T lnum; - if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_lnum_arg(argvars, 0) == FAIL) return; pos = curwin->w_cursor; diff --git a/uvim/src/clientserver.c b/uvim/src/clientserver.c index ae5130dd3e..8783a953ee 100644 --- a/uvim/src/clientserver.c +++ b/uvim/src/clientserver.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * clientserver.c: functions for Client Server functionality */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_CLIENTSERVER) @@ -60,7 +60,7 @@ server_to_input_buf(char_u *str) // buffer. typebuf_was_filled = TRUE; } - vim_free(ptr); + mnv_free(ptr); } /* @@ -87,11 +87,11 @@ eval_client_expr_to_string(char_u *expr) did_save_funccal = TRUE; } - // Disable debugging, otherwise Vim hangs, waiting for "cont" to be + // Disable debugging, otherwise MNV hangs, waiting for "cont" to be // typed. debug_break_level = -1; redir_off = 0; - // Do not display error message, otherwise Vim hangs, waiting for "cont" + // Do not display error message, otherwise MNV hangs, waiting for "cont" // to be typed. Do generate errors so that try/catch works. ++emsg_silent; @@ -117,7 +117,7 @@ eval_client_expr_to_string(char_u *expr) * Evaluate a command or expression sent to ourselves. */ int -sendToLocalVim(char_u *cmd, int asExpr, char_u **result) +sendToLocalMNV(char_u *cmd, int asExpr, char_u **result) { if (asExpr) { @@ -134,14 +134,14 @@ sendToLocalVim(char_u *cmd, int asExpr, char_u **result) msg = alloc(len); if (msg != NULL) - vim_snprintf((char *)msg, len, "%s: \"%s\"", err, cmd); + mnv_snprintf((char *)msg, len, "%s: \"%s\"", err, cmd); *result = msg; } else *result = ret; } else - vim_free(ret); + mnv_free(ret); return ret == NULL ? -1 : 0; } server_to_input_buf(cmd); @@ -165,24 +165,24 @@ serverConvert( if (client_enc == NULL || p_enc == NULL) return res; - vimconv_T vimconv; + mnvconv_T mnvconv; - vimconv.vc_type = CONV_NONE; - if (convert_setup(&vimconv, client_enc, p_enc) != FAIL - && vimconv.vc_type != CONV_NONE) + mnvconv.vc_type = CONV_NONE; + if (convert_setup(&mnvconv, client_enc, p_enc) != FAIL + && mnvconv.vc_type != CONV_NONE) { - res = string_convert(&vimconv, data, NULL); + res = string_convert(&mnvconv, data, NULL); if (res == NULL) res = data; else *tofree = res; } - convert_setup(&vimconv, NULL, NULL); + convert_setup(&mnvconv, NULL, NULL); return res; } #endif -#if defined(FEAT_CLIENTSERVER) && !defined(NO_VIM_MAIN) +#if defined(FEAT_CLIENTSERVER) && !defined(NO_MNV_MAIN) /* * Common code for the X command server and the Win32 command server. @@ -225,14 +225,14 @@ exec_on_server(mparm_T *parmp) /* * When a command server argument was found, execute it. This may - * exit Vim when it was successful. Otherwise it's executed further + * exit MNV when it was successful. Otherwise it's executed further * on. Remember the encoding used here in "serverStrEnc". */ if (parmp->serverArg) { cmdsrv_main(&parmp->argc, parmp->argv, parmp->serverName_arg, &parmp->serverStr); - parmp->serverStrEnc = vim_strsave(p_enc); + parmp->serverStrEnc = mnv_strsave(p_enc); } // If we're still running, get the name to register ourselves. @@ -245,12 +245,12 @@ exec_on_server(mparm_T *parmp) if (parmp->servername != NULL) { serverSetName(parmp->servername); - vim_free(parmp->servername); + mnv_free(parmp->servername); } # endif } /* - * Prepare for running as a Vim server. + * Prepare for running as a MNV server. */ void prepare_server(mparm_T *parmp) @@ -259,7 +259,7 @@ prepare_server(mparm_T *parmp) /* * Register for remote command execution with :serversend and --remote * unless there was a -X or a --servername '' on the command line. - * Only register nongui-vim's with an explicit --servername argument, + * Only register nongui-mnv's with an explicit --servername argument, * or when compiling with autoservername. * When running as root --servername is also required. */ @@ -298,7 +298,7 @@ prepare_server(mparm_T *parmp) TIME_MSG("register x11 server name"); } # endif - vim_free(parmp->servername); + mnv_free(parmp->servername); } # ifdef FEAT_X11 else @@ -316,7 +316,7 @@ prepare_server(mparm_T *parmp) server_to_input_buf(serverConvert(parmp->serverStrEnc, parmp->serverStr, &p)); - vim_free(p); + mnv_free(p); } } @@ -447,13 +447,13 @@ cmdsrv_main( ret = -1; } else - ret = serverSendToVim(xterm_dpy, sname, *serverStr, + ret = serverSendToMNV(xterm_dpy, sname, *serverStr, NULL, &srv, 0, 0, 0, silent); } # endif # ifdef MSWIN // Win32 always works? - ret = serverSendToVim(sname, *serverStr, NULL, &srv, 0, 0, silent); + ret = serverSendToMNV(sname, *serverStr, NULL, &srv, 0, 0, silent); # endif if (ret < 0) { @@ -465,7 +465,7 @@ cmdsrv_main( exiterr = 1; } else if (!silent) - // Let vim start normally. + // Let mnv start normally. mch_errmsg(_(": Send failed. Trying to execute locally\n")); break; } @@ -501,13 +501,13 @@ cmdsrv_main( ni.hWnd = message_window; ni.uID = 0; ni.uFlags = NIF_ICON|NIF_TIP; - ni.hIcon = LoadIcon((HINSTANCE)GetModuleHandle(0), "IDR_VIM"); + ni.hIcon = LoadIcon((HINSTANCE)GetModuleHandle(0), "IDR_MNV"); sprintf(ni.szTip, _("%d of %d edited"), count, numFiles); Shell_NotifyIcon(NIM_ADD, &ni); # endif // Wait for all files to unload in remote - vim_memset(done, 0, numFiles); + mnv_memset(done, 0, numFiles); while (memchr(done, 0, numFiles) != NULL) { char_u *p = NULL; @@ -531,7 +531,7 @@ cmdsrv_main( break; # endif j = atoi((char *)p); - vim_free(p); + mnv_free(p); if (j >= 0 && j < numFiles) { # ifdef FEAT_GUI_MSWIN @@ -546,7 +546,7 @@ cmdsrv_main( # ifdef FEAT_GUI_MSWIN Shell_NotifyIcon(NIM_DELETE, &ni); # endif - vim_free(done); + mnv_free(done); } } else if (STRICMP(argv[i], "--remote-expr") == 0) @@ -555,7 +555,7 @@ cmdsrv_main( mainerr_arg_missing((char_u *)argv[i]); # ifdef MSWIN // Win32 always works? - if (serverSendToVim(sname, (char_u *)argv[i + 1], + if (serverSendToMNV(sname, (char_u *)argv[i + 1], &res, NULL, 1, 0, FALSE) < 0) # else # ifdef FEAT_SOCKETSERVER @@ -574,7 +574,7 @@ cmdsrv_main( { if (xterm_dpy == NULL) mch_errmsg(_("No display: Send expression failed.\n")); - else if (serverSendToVim(xterm_dpy, sname, + else if (serverSendToMNV(xterm_dpy, sname, (char_u *)argv[i + 1], &res, NULL, 1, 0, 1, FALSE) < 0) goto expr_fail; @@ -590,7 +590,7 @@ expr_fail: { // Output error from remote mch_errmsg((char *)res); - VIM_CLEAR(res); + MNV_CLEAR(res); } mch_errmsg(_(": Send expression failed.\n")); } @@ -599,7 +599,7 @@ expr_fail: { # ifdef MSWIN // Win32 always works? - res = serverGetVimNames(); + res = serverGetMNVNames(); # else # ifdef FEAT_SOCKETSERVER if (clientserver_method == CLIENTSERVER_METHOD_SOCKET) @@ -618,7 +618,7 @@ expr_fail: # ifdef FEAT_X11 if (clientserver_method == CLIENTSERVER_METHOD_X11 && xterm_dpy != NULL) - res = serverGetVimNames(xterm_dpy); + res = serverGetMNVNames(xterm_dpy); # endif # endif if (did_emsg) @@ -643,7 +643,7 @@ expr_fail: if (res[STRLEN(res) - 1] != '\n') mch_msg("\n"); } - vim_free(res); + mnv_free(res); } if (didone) @@ -657,11 +657,11 @@ expr_fail: // Return back into main() *argc = newArgC; - vim_free(sname); + mnv_free(sname); } /* - * Build a ":drop" command to send to a Vim server. + * Build a ":drop" command to send to a MNV server. */ static char_u * build_drop_cmd( @@ -701,17 +701,17 @@ build_drop_cmd( return NULL; if (mch_dirname(cwd, MAXPATHL) != OK) { - vim_free(cwd); + mnv_free(cwd); return NULL; } - cdp.string = vim_strsave_escaped_ext(cwd, + cdp.string = mnv_strsave_escaped_ext(cwd, # ifdef BACKSLASH_IN_FILENAME (char_u *)"", // rem_backslash() will tell what chars to escape # else PATH_ESC_CHARS, # endif '\\', TRUE); - vim_free(cwd); + mnv_free(cwd); if (cdp.string == NULL) return NULL; cdp.length = STRLEN(cdp.string); @@ -729,9 +729,9 @@ build_drop_cmd( for (i = 0; i < filec; i++) { // On Unix the shell has already expanded the wildcards, don't want to - // do it again in the Vim server. On MS-Windows only escape + // do it again in the MNV server. On MS-Windows only escape // non-wildcard characters. - p = vim_strsave_escaped((char_u *)filev[i], + p = mnv_strsave_escaped((char_u *)filev[i], # ifdef UNIX PATH_ESC_CHARS # else @@ -740,13 +740,13 @@ build_drop_cmd( ); if (p == NULL) { - vim_free(cdp.string); - vim_free(ga.ga_data); + mnv_free(cdp.string); + mnv_free(ga.ga_data); return NULL; } GA_CONCAT_LITERAL(&ga, " "); ga_concat(&ga, p); - vim_free(p); + mnv_free(p); } GA_CONCAT_LITERAL(&ga, "|if exists('*inputrestore')|call inputrestore()|endif"); @@ -775,7 +775,7 @@ build_drop_cmd( # endif ga_concat_len(&ga, cdp.string, cdp.length); GA_CONCAT_LITERAL(&ga, "'|cd -|endif|endif"); - vim_free(cdp.string); + mnv_free(cdp.string); // reset wildignorecase ga_concat_len(&ga, wig[1].string, wig[1].length); @@ -816,22 +816,22 @@ serverMakeName(char_u *arg, char *cmd) { if (arg[0] == '/' || STRNCMP(arg, "./", 2) == 0 || STRNCMP(arg, "../", 3) == 0) - p = vim_strsave(arg); + p = mnv_strsave(arg); else - p = vim_strsave_up(arg); + p = mnv_strsave_up(arg); } else - p = vim_strsave_up(arg); + p = mnv_strsave_up(arg); # else - p = vim_strsave_up(arg); + p = mnv_strsave_up(arg); # endif } else { - p = vim_strsave_up(gettail((char_u *)cmd)); + p = mnv_strsave_up(gettail((char_u *)cmd)); // Remove .exe or .bat from the name. - if (p != NULL && vim_strchr(p, '.') != NULL) - *vim_strchr(p, '.') = NUL; + if (p != NULL && mnv_strchr(p, '.') != NULL) + *mnv_strchr(p, '.') = NUL; } return p; } @@ -902,7 +902,7 @@ remote_common(typval_T *argvars, typval_T *rettv, int expr) return; // type error; errmsg already given keys = tv_get_string_buf(&argvars[1], buf); # ifdef MSWIN - if (serverSendToVim(server_name, keys, &r, &w, expr, timeout, TRUE) < 0) + if (serverSendToMNV(server_name, keys, &r, &w, expr, timeout, TRUE) < 0) # else # ifdef FEAT_SOCKETSERVER if (clientserver_method == CLIENTSERVER_METHOD_SOCKET) @@ -912,7 +912,7 @@ remote_common(typval_T *argvars, typval_T *rettv, int expr) # endif # ifdef FEAT_X11 if (clientserver_method == CLIENTSERVER_METHOD_X11) - if (serverSendToVim(X_DISPLAY, server_name, keys, &r, &w, expr, timeout, + if (serverSendToMNV(X_DISPLAY, server_name, keys, &r, &w, expr, timeout, 0, TRUE) < 0) goto fail; # endif @@ -927,9 +927,9 @@ fail: if (r != NULL) { emsg((char *)r); // sending worked but evaluation failed - vim_free(r); + mnv_free(r); # ifdef FEAT_SOCKETSERVER - vim_free(client); + mnv_free(client); # endif } else @@ -963,18 +963,18 @@ fail: # endif # ifdef FEAT_SOCKETSERVER if (clientserver_method == CLIENTSERVER_METHOD_SOCKET) - vim_snprintf((char *)str, sizeof(addr.sun_path), + mnv_snprintf((char *)str, sizeof(addr.sun_path), "%s", client); # endif # endif v.di_tv.v_type = VAR_STRING; - v.di_tv.vval.v_string = vim_strsave(str); + v.di_tv.vval.v_string = mnv_strsave(str); set_var(idvar, &v.di_tv, FALSE); - vim_free(v.di_tv.vval.v_string); + mnv_free(v.di_tv.vval.v_string); } } # ifdef FEAT_SOCKETSERVER - vim_free(client); + mnv_free(client); # endif } #endif @@ -990,7 +990,7 @@ f_remote_expr(typval_T *argvars UNUSED, typval_T *rettv) rettv->vval.v_string = NULL; # ifdef FEAT_CLIENTSERVER - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL || check_for_opt_string_arg(argvars, 2) == FAIL @@ -1009,7 +1009,7 @@ f_remote_expr(typval_T *argvars UNUSED, typval_T *rettv) f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { # ifdef FEAT_CLIENTSERVER - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; # ifdef MSWIN @@ -1023,12 +1023,12 @@ f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED) # else // Send a foreground() expression to the server. argvars[1].v_type = VAR_STRING; - argvars[1].vval.v_string = vim_strsave((char_u *)"foreground()"); + argvars[1].vval.v_string = mnv_strsave((char_u *)"foreground()"); argvars[2].v_type = VAR_UNKNOWN; rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; remote_common(argvars, rettv, TRUE); - vim_free(argvars[1].vval.v_string); + mnv_free(argvars[1].vval.v_string); # endif # endif } @@ -1048,7 +1048,7 @@ f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv) if (check_restricted() || check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL)) return; @@ -1087,11 +1087,11 @@ f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv) char_u *retvar; v.di_tv.v_type = VAR_STRING; - v.di_tv.vval.v_string = vim_strsave(s); + v.di_tv.vval.v_string = mnv_strsave(s); retvar = tv_get_string_chk(&argvars[1]); if (retvar != NULL) set_var(retvar, &v.di_tv, FALSE); - vim_free(v.di_tv.vval.v_string); + mnv_free(v.di_tv.vval.v_string); } # else rettv->vval.v_number = -1; @@ -1106,7 +1106,7 @@ f_remote_read(typval_T *argvars UNUSED, typval_T *rettv) # ifdef FEAT_CLIENTSERVER char_u *serverid; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_number_arg(argvars, 1) == FAIL)) return; @@ -1159,7 +1159,7 @@ f_remote_send(typval_T *argvars UNUSED, typval_T *rettv) rettv->vval.v_string = NULL; # ifdef FEAT_CLIENTSERVER - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL || check_for_opt_string_arg(argvars, 2) == FAIL)) @@ -1217,7 +1217,7 @@ f_server2client(typval_T *argvars UNUSED, typval_T *rettv) if (check_restricted() || check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; @@ -1267,7 +1267,7 @@ f_serverlist(typval_T *argvars UNUSED, typval_T *rettv) # ifdef FEAT_CLIENTSERVER # ifdef MSWIN - r = serverGetVimNames(); + r = serverGetMNVNames(); # else # ifdef FEAT_SOCKETSERVER if (clientserver_method == CLIENTSERVER_METHOD_SOCKET) @@ -1278,7 +1278,7 @@ f_serverlist(typval_T *argvars UNUSED, typval_T *rettv) { make_connection(); if (X_DISPLAY != NULL) - r = serverGetVimNames(X_DISPLAY); + r = serverGetMNVNames(X_DISPLAY); } # endif # endif diff --git a/uvim/src/clipboard.c b/uvim/src/clipboard.c index 454b686092..447a520843 100644 --- a/uvim/src/clipboard.c +++ b/uvim/src/clipboard.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -13,7 +13,7 @@ * clipboard code. */ -#include "vim.h" +#include "mnv.h" #ifdef FEAT_CYGWIN_WIN32_CLIPBOARD # define WIN32_LEAN_AND_MEAN @@ -113,8 +113,8 @@ typedef struct { // Mimes with a lower index in the array are prioritized first when we are // receiving data. static const char *supported_mimes[] = { - VIMENC_ATOM_NAME, - VIM_ATOM_NAME, + MNVENC_ATOM_NAME, + MNV_ATOM_NAME, "text/plain;charset=utf-8", "text/plain", "UTF8_STRING", @@ -365,7 +365,7 @@ clip_copy_selection(Clipboard_T *clip) /* * Save and restore clip_unnamed before doing possibly many changes. This - * prevents accessing the clipboard very often which might slow down Vim + * prevents accessing the clipboard very often which might slow down MNV * considerably. */ static int global_change_count = 0; // if set, inside a start_global_changes @@ -458,8 +458,8 @@ clip_isautosel_star(void) # endif # ifdef FEAT_GUI if (gui.in_use) - return vim_strchr(p_go, GO_ASEL) != NULL - && vim_strchr(p_go, GO_ASELPLUS) == NULL; + return mnv_strchr(p_go, GO_ASEL) != NULL + && mnv_strchr(p_go, GO_ASELPLUS) == NULL; # endif return clip_autoselect_star; } @@ -477,7 +477,7 @@ clip_isautosel_plus(void) # endif # ifdef FEAT_GUI if (gui.in_use) - return vim_strchr(p_go, GO_ASELPLUS) != NULL; + return mnv_strchr(p_go, GO_ASELPLUS) != NULL; # endif return clip_autoselect_plus; } @@ -700,7 +700,7 @@ clip_update_modeless_selection( * Find the starting and ending positions of the word at the given row and * column. Only white-separated words are recognized here. */ -# define CHAR_CLASS(c) (c <= ' ' ? ' ' : vim_iswordc(c)) +# define CHAR_CLASS(c) (c <= ' ' ? ' ' : mnv_iswordc(c)) static void clip_get_word_boundaries(Clipboard_T *cb, int row, int col) @@ -902,7 +902,7 @@ clip_process_selection( if (clip_isautosel_star() || clip_isautosel_plus() || ( # ifdef FEAT_GUI - gui.in_use ? (vim_strchr(p_go, GO_ASELML) != NULL) : + gui.in_use ? (mnv_strchr(p_go, GO_ASELML) != NULL) : # endif clip_autoselectml)) clip_copy_modeless_selection(FALSE); @@ -1330,7 +1330,7 @@ clip_copy_modeless_selection(int both UNUSED) clip_gen_set_selection(other); } # endif - vim_free(buffer); + mnv_free(buffer); } void @@ -1339,7 +1339,7 @@ clip_gen_set_selection(Clipboard_T *cbd) if (!clip_did_set_selection) { // Updating postponed, so that accessing the system clipboard won't - // hang Vim when accessing it many times (e.g. on a :g command). + // hang MNV when accessing it many times (e.g. on a :g command). if ((cbd == &clip_plus && (clip_unnamed_saved & CLIP_UNNAMED_PLUS)) || (cbd == &clip_star && (clip_unnamed_saved & CLIP_UNNAMED))) { @@ -1463,8 +1463,8 @@ open_app_context(void) } } -static Atom vim_atom; // Vim's own special selection format -static Atom vimenc_atom; // Vim's extended selection format +static Atom mnv_atom; // MNV's own special selection format +static Atom mnvenc_atom; // MNV's extended selection format static Atom utf8_atom; static Atom compound_text_atom; static Atom text_atom; @@ -1474,8 +1474,8 @@ static Atom timestamp_atom; // Used to get a timestamp void x11_setup_atoms(Display *dpy) { - vim_atom = XInternAtom(dpy, VIM_ATOM_NAME, False); - vimenc_atom = XInternAtom(dpy, VIMENC_ATOM_NAME,False); + mnv_atom = XInternAtom(dpy, MNV_ATOM_NAME, False); + mnvenc_atom = XInternAtom(dpy, MNVENC_ATOM_NAME,False); utf8_atom = XInternAtom(dpy, "UTF8_STRING", False); compound_text_atom = XInternAtom(dpy, "COMPOUND_TEXT", False); text_atom = XInternAtom(dpy, "TEXT", False); @@ -1522,8 +1522,8 @@ clip_x11_convert_selection_cb( *value = (XtPointer)array; i = 0; array[i++] = targets_atom; - array[i++] = vimenc_atom; - array[i++] = vim_atom; + array[i++] = mnvenc_atom; + array[i++] = mnv_atom; if (enc_utf8) array[i++] = utf8_atom; array[i++] = XA_STRING; @@ -1539,9 +1539,9 @@ clip_x11_convert_selection_cb( } if ( *target != XA_STRING - && *target != vimenc_atom + && *target != mnvenc_atom && (*target != utf8_atom || !enc_utf8) - && *target != vim_atom + && *target != mnv_atom && *target != text_atom && *target != compound_text_atom) return False; @@ -1552,11 +1552,11 @@ clip_x11_convert_selection_cb( return False; // For our own format, the first byte contains the motion type - if (*target == vim_atom) + if (*target == mnv_atom) (*length)++; // Our own format with encoding: motion 'encoding' NUL text - if (*target == vimenc_atom) + if (*target == mnvenc_atom) *length += STRLEN(p_enc) + 2; if (save_length < *length || save_length / 2 >= *length) @@ -1565,7 +1565,7 @@ clip_x11_convert_selection_cb( *value = save_result; if (*value == NULL) { - vim_free(string); + mnv_free(string); return False; } save_result = (char_u *)*value; @@ -1589,7 +1589,7 @@ clip_x11_convert_selection_cb( 1, XCompoundTextStyle, &text_prop); if (conv_result != Success) { - vim_free(string); + mnv_free(string); return False; } *value = (XtPointer)(text_prop.value); // from plain text @@ -1599,23 +1599,23 @@ clip_x11_convert_selection_cb( save_result = (char_u *)*value; save_length = *length; } - else if (*target == vimenc_atom) + else if (*target == mnvenc_atom) { int l = STRLEN(p_enc); save_result[0] = motion_type; STRCPY(save_result + 1, p_enc); mch_memmove(save_result + l + 2, string, (size_t)(*length - l - 2)); - *type = vimenc_atom; + *type = mnvenc_atom; } else { save_result[0] = motion_type; mch_memmove(save_result + 1, string, (size_t)(*length - 1)); - *type = vim_atom; + *type = mnv_atom; } *format = 8; // 8 bits per char - vim_free(string); + mnv_free(string); return True; } @@ -1722,16 +1722,16 @@ clip_x11_request_selection_cb( } p = (char_u *)value; len = *length; - if (*type == vim_atom) + if (*type == mnv_atom) { motion_type = *p++; len--; } - else if (*type == vimenc_atom) + else if (*type == mnvenc_atom) { char_u *enc; - vimconv_T conv; + mnvconv_T conv; int convlen; motion_type = *p++; @@ -1788,7 +1788,7 @@ clip_x11_request_selection_cb( if (text_list != NULL) XFreeStringList(text_list); - vim_free(tmpbuf); + mnv_free(tmpbuf); XtFree((char *)value); *(int *)success = TRUE; } @@ -1810,8 +1810,8 @@ clip_x11_request_selection( { switch (i) { - case 0: type = vimenc_atom; break; - case 1: type = vim_atom; break; + case 0: type = mnvenc_atom; break; + case 1: type = mnv_atom; break; case 2: type = utf8_atom; break; case 3: type = compound_text_atom; break; case 4: type = text_atom; break; @@ -1953,7 +1953,7 @@ yank_cut_buffer0(Display *dpy, Clipboard_T *cbd) if (has_mbyte) { char_u *conv_buf; - vimconv_T vc; + mnvconv_T vc; vc.vc_type = CONV_NONE; if (convert_setup(&vc, (char_u *)"latin1", p_enc) == OK) @@ -1962,7 +1962,7 @@ yank_cut_buffer0(Display *dpy, Clipboard_T *cbd) if (conv_buf != NULL) { clip_yank_selection(MCHAR, conv_buf, (long)nbytes, cbd); - vim_free(conv_buf); + mnv_free(conv_buf); done = TRUE; } convert_setup(&vc, NULL, NULL); @@ -2001,7 +2001,7 @@ yank_cut_buffer0(Display *dpy, Clipboard_T *cbd) /* * Routine to export any final X selection we had to the environment - * so that the text is still available after Vim has exited. X selections + * so that the text is still available after MNV has exited. X selections * only exist while the owning application exists, so we write to the * permanent (while X runs) store CUT_BUFFER0. * Dump the CLIPBOARD selection if we own it (it's logically the more @@ -2045,7 +2045,7 @@ x11_export_final_selection(void) // encoding conversion usually doesn't work, so keep the text as-is. if (has_mbyte) { - vimconv_T vc; + mnvconv_T vc; vc.vc_type = CONV_NONE; if (convert_setup(&vc, p_enc, (char_u *)"latin1") == OK) @@ -2058,7 +2058,7 @@ x11_export_final_selection(void) len = intlen; if (conv_str != NULL) { - vim_free(str); + mnv_free(str); str = conv_str; } else @@ -2082,7 +2082,7 @@ x11_export_final_selection(void) } } - vim_free(str); + mnv_free(str); } # endif @@ -2406,7 +2406,7 @@ clip_wl_destroy_buffer_store(clip_wl_buffer_store_T *store) close(store->fd); - vim_free(store); + mnv_free(store); } /* @@ -2505,7 +2505,7 @@ clip_wl_destroy_fs_surface(clip_wl_fs_surface_T *store) else wl_keyboard_destroy(store->keyboard); } - vim_free(store); + mnv_free(store); } VWL_FUNCS_DUMMY_KEYBOARD_EVENTS() @@ -2583,7 +2583,7 @@ clip_wl_init_fs_surface( wayland_ct->gobjects.xdg_wm_base, store->surface); store->shell.toplevel = xdg_surface_get_toplevel(store->shell.surface); - xdg_toplevel_set_title(store->shell.toplevel, "Vim clipboard"); + xdg_toplevel_set_title(store->shell.toplevel, "MNV clipboard"); xdg_surface_add_listener(store->shell.surface, &xdg_surface_listener, NULL); @@ -2727,7 +2727,7 @@ vwl_data_device_listener_event_finished( // Shouldn't happen return; - vim_free(sel->contents); + mnv_free(sel->contents); vwl_data_source_destroy(sel->source); vwl_data_offer_destroy(sel->offer); sel->available = FALSE; @@ -2873,7 +2873,7 @@ clip_uninit_wayland(void) sel = &clip_wl.regular; while (true) { - vim_free(sel->contents); + mnv_free(sel->contents); vwl_data_source_destroy(sel->source); vwl_data_offer_destroy(sel->offer); sel->available = false; @@ -2883,7 +2883,7 @@ clip_uninit_wayland(void) sel = &clip_wl.primary; } - vim_memset(&clip_wl, 0, sizeof(clip_wl)); + mnv_memset(&clip_wl, 0, sizeof(clip_wl)); } int @@ -2974,14 +2974,14 @@ clip_wl_receive_data(Clipboard_T *cbd, const char *mime_type, int fd) final = buf.ga_data; - if (STRCMP(mime_type, VIM_ATOM_NAME) == 0 && buf.ga_len >= 2) + if (STRCMP(mime_type, MNV_ATOM_NAME) == 0 && buf.ga_len >= 2) { motion_type = *final++; buf.ga_len--; } - else if (STRCMP(mime_type, VIMENC_ATOM_NAME) == 0 && buf.ga_len >= 3) + else if (STRCMP(mime_type, MNVENC_ATOM_NAME) == 0 && buf.ga_len >= 3) { - vimconv_T conv; + mnvconv_T conv; int convlen; // first byte is motion type @@ -3100,7 +3100,7 @@ vwl_data_source_listener_event_send( char_u *string; // Will be reallocated to a bigger size if // needed. int offset = 0; - bool is_vim, is_vimenc; + bool is_mnv, is_mnvenc; size_t total = 0; # ifndef HAVE_SELECT struct pollfd pfd; @@ -3126,16 +3126,16 @@ vwl_data_source_listener_event_send( if (!have_mime) goto exit; - // First byte sent is motion type for vim specific formats. For the vimenc + // First byte sent is motion type for mnv specific formats. For the mnvenc // format, after the first byte is the encoding type, which is null // terminated. - is_vimenc = STRCMP(mime_type, VIMENC_ATOM_NAME) == 0; - is_vim = STRCMP(mime_type, VIM_ATOM_NAME) == 0; + is_mnvenc = STRCMP(mime_type, MNVENC_ATOM_NAME) == 0; + is_mnv = STRCMP(mime_type, MNV_ATOM_NAME) == 0; - if (is_vimenc) + if (is_mnvenc) offset += 2 + STRLEN(p_enc); - else if (is_vim) + else if (is_mnv) offset += 1; clip_get_selection(cbd); @@ -3144,13 +3144,13 @@ vwl_data_source_listener_event_send( if (motion_type < 0) goto exit; - if (is_vimenc) + if (is_mnvenc) { string[0] = (char_u)motion_type; - // Use vim_strncpy for safer copying - vim_strncpy(string + 1, p_enc, STRLEN(p_enc)); + // Use mnv_strncpy for safer copying + mnv_strncpy(string + 1, p_enc, STRLEN(p_enc)); } - else if (is_vim) + else if (is_mnv) string[0] = (char_u)motion_type; @@ -3169,7 +3169,7 @@ vwl_data_source_listener_event_send( total += w; } - vim_free(string); + mnv_free(string); exit: close(fd); } @@ -3383,8 +3383,8 @@ get_clipmethod(char_u *str) method = CLIPMETHOD_PROVIDER; if (ret == CLIPMETHOD_FAIL) { - vim_free(clip_provider); - clip_provider = vim_strsave(buf); + mnv_free(clip_provider); + clip_provider = mnv_strsave(buf); if (clip_provider == NULL) goto fail; } @@ -3409,7 +3409,7 @@ fail: ret = (ret == CLIPMETHOD_FAIL) ? CLIPMETHOD_NONE : ret; exit: - vim_free(buf); + mnv_free(buf); return ret; } @@ -3516,7 +3516,7 @@ exit: clipmethod = method; # ifdef FEAT_EVAL - set_vim_var_string(VV_CLIPMETHOD, (char_u*)clipmethod_to_str(method), -1); + set_mnv_var_string(VV_CLIPMETHOD, (char_u*)clipmethod_to_str(method), -1); # endif return NULL; @@ -3634,7 +3634,7 @@ did_set_clipboard(optset_T *args UNUSED) else if (STRNCMP(p, "exclude:", 8) == 0 && new_exclude_prog == NULL) { p += 8; - new_exclude_prog = vim_regcomp(p, RE_MAGIC); + new_exclude_prog = mnv_regcomp(p, RE_MAGIC); if (new_exclude_prog == NULL) errmsg = e_invalid_argument; break; @@ -3663,7 +3663,7 @@ did_set_clipboard(optset_T *args UNUSED) clip_autoselect_plus = new_autoselect_plus; clip_autoselectml = new_autoselectml; clip_html = new_html; - vim_regfree(clip_exclude_prog); + mnv_regfree(clip_exclude_prog); clip_exclude_prog = new_exclude_prog; # endif # ifdef FEAT_GUI_GTK @@ -3676,7 +3676,7 @@ did_set_clipboard(optset_T *args UNUSED) # endif } else - vim_regfree(new_exclude_prog); + mnv_regfree(new_exclude_prog); return errmsg; } @@ -3692,7 +3692,7 @@ did_set_clipboard(optset_T *args UNUSED) static int clip_provider_is_available(char_u *provider) { - dict_T *providers = get_vim_var_dict(VV_CLIPPROVIDERS); + dict_T *providers = get_mnv_var_dict(VV_CLIPPROVIDERS); typval_T provider_tv = {0}; callback_T callback = {0}; typval_T rettv = {0}; @@ -3744,7 +3744,7 @@ clip_provider_get_callback( char_u *function, callback_T *callback) { - dict_T *providers = get_vim_var_dict(VV_CLIPPROVIDERS); + dict_T *providers = get_mnv_var_dict(VV_CLIPPROVIDERS); typval_T provider_tv; typval_T action_tv; typval_T func_tv; @@ -3957,7 +3957,7 @@ clip_provider_paste(char_u *reg, char_u *provider) { // Need to make a copy, next tv_get_string_buf_chk() will // overwrite the string. - strval = vim_strsave(buf); + strval = mnv_strsave(buf); if (strval == NULL) goto free_lstval; *curallocval++ = strval; @@ -3997,8 +3997,8 @@ clip_provider_paste(char_u *reg, char_u *provider) free_lstval: while (curallocval > allocval) - vim_free(*--curallocval); - vim_free(lstval); + mnv_free(*--curallocval); + mnv_free(lstval); } exit: diff --git a/uvim/src/cmdexpand.c b/uvim/src/cmdexpand.c index 63757179a5..68ccd509b6 100644 --- a/uvim/src/cmdexpand.c +++ b/uvim/src/cmdexpand.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * cmdexpand.c: functions for command-line completion */ -#include "vim.h" +#include "mnv.h" static int cmd_showtail; // Only show path tail in lists ? static int may_expand_pattern = FALSE; @@ -76,7 +76,7 @@ cmdline_fuzzy_completion_supported(expand_T *xp) break; } - return vim_strchr(p_wop, WOP_FUZZY) != NULL; + return mnv_strchr(p_wop, WOP_FUZZY) != NULL; } /* @@ -87,7 +87,7 @@ cmdline_fuzzy_completion_supported(expand_T *xp) int cmdline_fuzzy_complete(char_u *fuzzystr) { - return vim_strchr(p_wop, WOP_FUZZY) != NULL && *fuzzystr != NUL; + return mnv_strchr(p_wop, WOP_FUZZY) != NULL && *fuzzystr != NUL; } /* @@ -134,16 +134,16 @@ wildescape( if (xp->xp_backslash & XP_BS_THREE) { char *pat = (xp->xp_backslash & XP_BS_COMMA) ? " ," : " "; - p = vim_strsave_escaped(files[i], (char_u *)pat); + p = mnv_strsave_escaped(files[i], (char_u *)pat); if (p != NULL) { - vim_free(files[i]); + mnv_free(files[i]); files[i] = p; #if defined(BACKSLASH_IN_FILENAME) - p = vim_strsave_escaped(files[i], (char_u *)" "); + p = mnv_strsave_escaped(files[i], (char_u *)" "); if (p != NULL) { - vim_free(files[i]); + mnv_free(files[i]); files[i] = p; } #endif @@ -151,25 +151,25 @@ wildescape( } else if (xp->xp_backslash & XP_BS_COMMA) { - if (vim_strchr(files[i], ',') != NULL) + if (mnv_strchr(files[i], ',') != NULL) { - p = vim_strsave_escaped(files[i], (char_u *)","); + p = mnv_strsave_escaped(files[i], (char_u *)","); if (p != NULL) { - vim_free(files[i]); + mnv_free(files[i]); files[i] = p; } } } #ifdef BACKSLASH_IN_FILENAME - p = vim_strsave_fnameescape(files[i], vse_what); + p = mnv_strsave_fnameescape(files[i], vse_what); #else - p = vim_strsave_fnameescape(files[i], + p = mnv_strsave_fnameescape(files[i], xp->xp_shell ? VSE_SHELL : vse_what); #endif if (p != NULL) { - vim_free(files[i]); + mnv_free(files[i]); files[i] = p; } @@ -191,10 +191,10 @@ wildescape( // would terminate the ":tag" command. for (int i = 0; i < numfiles; ++i) { - p = vim_strsave_escaped(files[i], (char_u *)"\\|\""); + p = mnv_strsave_escaped(files[i], (char_u *)"\\|\""); if (p != NULL) { - vim_free(files[i]); + mnv_free(files[i]); files[i] = p; } } @@ -298,7 +298,7 @@ nextwild( if (cmdline_fuzzy_completion_supported(xp) || xp->xp_context == EXPAND_PATTERN_IN_BUF) // Don't modify the search string - tmp = vim_strnsave(xp->xp_pattern, xp->xp_pattern_len); + tmp = mnv_strnsave(xp->xp_pattern, xp->xp_pattern_len); else tmp = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context); @@ -315,9 +315,9 @@ nextwild( use_options += WILD_ICASE; p = ExpandOne(xp, tmp, - vim_strnsave(&ccline->cmdbuff[i], xp->xp_pattern_len), + mnv_strnsave(&ccline->cmdbuff[i], xp->xp_pattern_len), use_options, type); - vim_free(tmp); + mnv_free(tmp); // longest match: make sure it is not shorter, happens with :help if (p != NULL && type == WILD_LONGEST) { @@ -330,7 +330,7 @@ nextwild( break; } if ((int)STRLEN(p) < j) - VIM_CLEAR(p); + MNV_CLEAR(p); } } } @@ -338,8 +338,8 @@ nextwild( // Save cmdline before inserting selected item if (!wild_navigate && ccline->cmdbuff != NULL) { - vim_free(cmdline_orig); - cmdline_orig = vim_strnsave(ccline->cmdbuff, ccline->cmdlen); + mnv_free(cmdline_orig); + cmdline_orig = mnv_strnsave(ccline->cmdbuff, ccline->cmdlen); } if (p != NULL && !got_int && !(options & WILD_NOSELECT)) @@ -381,7 +381,7 @@ nextwild( // free expanded pattern (void)ExpandOne(xp, NULL, NULL, 0, WILD_FREE); - vim_free(p); + mnv_free(p); return OK; } @@ -416,11 +416,11 @@ cmdline_pum_create( } // Compute the popup menu starting column - compl_startcol = ccline == NULL ? 0 : vim_strsize(ccline->cmdbuff) + 1; - prefix_len = vim_strsize(xp->xp_pattern); + compl_startcol = ccline == NULL ? 0 : mnv_strsize(ccline->cmdbuff) + 1; + prefix_len = mnv_strsize(xp->xp_pattern); if (showtail) - prefix_len += vim_strsize(showmatches_gettail(matches[0])) - - vim_strsize(matches[0]); + prefix_len += mnv_strsize(showmatches_gettail(matches[0])) + - mnv_strsize(matches[0]); compl_startcol = cmdline_col_off + MAX(0, compl_startcol - prefix_len); return EXPAND_OK; @@ -459,7 +459,7 @@ cmdline_pum_remove(cmdline_info_T *cclp UNUSED, int defer_redraw) #endif pum_undisplay(); - VIM_CLEAR(compl_match_array); + MNV_CLEAR(compl_match_array); compl_match_arraysize = 0; if (!defer_redraw) { @@ -787,7 +787,7 @@ win_redr_status_matches( } win_redraw_last_status(topframe); - vim_free(buf); + mnv_free(buf); } /* @@ -869,7 +869,7 @@ get_next_or_prev_match(int mode, expand_T *xp) compl_selected = findex; cmdline_pum_display(); } - else if (vim_strchr(p_wop, WOP_PUM) != NULL) + else if (mnv_strchr(p_wop, WOP_PUM) != NULL) { if (cmdline_pum_create(get_cmdline_info(), xp, xp->xp_files, xp->xp_numfiles, cmd_showtail) == EXPAND_OK) @@ -886,7 +886,7 @@ get_next_or_prev_match(int mode, expand_T *xp) xp->xp_selected = findex; // Return the original text or the selected match - return vim_strsave(findex == -1 ? xp->xp_orig : xp->xp_files[findex]); + return mnv_strsave(findex == -1 ? xp->xp_orig : xp->xp_files[findex]); } /* @@ -952,7 +952,7 @@ ExpandOne_start(int mode, expand_T *xp, char_u *str, int options) beep_flush(); } if (!(non_suf_match != 1 && mode == WILD_EXPAND_FREE)) - ss = vim_strsave(xp->xp_files[0]); + ss = mnv_strsave(xp->xp_files[0]); } } @@ -1000,14 +1000,14 @@ find_longest_match(expand_T *xp, int options) if (i < xp->xp_numfiles) { if (!(options & WILD_NO_BEEP)) - vim_beep(BO_WILD); + mnv_beep(BO_WILD); break; } } ss = alloc(len + 1); if (ss) - vim_strncpy(ss, xp->xp_files[0], (size_t)len); + mnv_strncpy(ss, xp->xp_files[0], (size_t)len); return ss; } @@ -1068,9 +1068,9 @@ ExpandOne( return get_next_or_prev_match(mode, xp); if (mode == WILD_CANCEL) - ss = vim_strsave(xp->xp_orig ? xp->xp_orig : (char_u *)""); + ss = mnv_strsave(xp->xp_orig ? xp->xp_orig : (char_u *)""); else if (mode == WILD_APPLY) - ss = vim_strsave(xp->xp_selected == -1 + ss = mnv_strsave(xp->xp_selected == -1 ? (xp->xp_orig ? xp->xp_orig : (char_u *)"") : xp->xp_files[xp->xp_selected]); @@ -1079,7 +1079,7 @@ ExpandOne( { FreeWild(xp->xp_numfiles, xp->xp_files); xp->xp_numfiles = -1; - VIM_CLEAR(xp->xp_orig); + MNV_CLEAR(xp->xp_orig); // The entries from xp_files may be used in the PUM, remove it. if (compl_match_array != NULL) @@ -1092,7 +1092,7 @@ ExpandOne( if (xp->xp_numfiles == -1 && mode != WILD_APPLY && mode != WILD_CANCEL) { - vim_free(xp->xp_orig); + mnv_free(xp->xp_orig); xp->xp_orig = orig; orig_saved = TRUE; @@ -1138,7 +1138,7 @@ ExpandOne( for (i = 0; i < xp->xp_numfiles; ++i) { - ss_len += vim_snprintf_safelen( + ss_len += mnv_snprintf_safelen( (char *)ss + ss_len, ss_size - ss_len, "%s%s%s", @@ -1154,7 +1154,7 @@ ExpandOne( // Free "orig" if it wasn't stored in "xp->xp_orig". if (!orig_saved) - vim_free(orig); + mnv_free(orig); return ss; } @@ -1182,13 +1182,13 @@ ExpandCleanup(expand_T *xp) FreeWild(xp->xp_numfiles, xp->xp_files); xp->xp_numfiles = -1; } - VIM_CLEAR(xp->xp_orig); + MNV_CLEAR(xp->xp_orig); } void clear_cmdline_orig(void) { - VIM_CLEAR(cmdline_orig); + MNV_CLEAR(cmdline_orig); } /* @@ -1252,9 +1252,9 @@ showmatches_oneline( halved_slash = backslash_halve_save(path); isdir = mch_isdir(halved_slash != NULL ? halved_slash : matches[j]); - vim_free(exp_path); + mnv_free(exp_path); if (halved_slash != path) - vim_free(halved_slash); + mnv_free(halved_slash); } else // Expansion was done here, file names are literal. @@ -1319,7 +1319,7 @@ showmatches(expand_T *xp, int display_wildmenu, int display_list, int noselect) } if (display_wildmenu && !display_list - && vim_strchr(p_wop, WOP_PUM) != NULL) + && mnv_strchr(p_wop, WOP_PUM) != NULL) { int retval = cmdline_pum_create(ccline, xp, matches, numMatches, showtail && !noselect); @@ -1360,10 +1360,10 @@ showmatches(expand_T *xp, int display_wildmenu, int display_list, int noselect) || xp->xp_context == EXPAND_BUFFERS)) { home_replace(NULL, matches[i], NameBuff, MAXPATHL, TRUE); - len = vim_strsize(NameBuff); + len = mnv_strsize(NameBuff); } else - len = vim_strsize(SHOW_MATCH(i)); + len = mnv_strsize(SHOW_MATCH(i)); if (len > maxlen) maxlen = len; } @@ -1426,7 +1426,7 @@ showmatches_gettail(char_u *s) for (p = s; *p != NUL; ) { - if (vim_ispathsep(*p) + if (mnv_ispathsep(*p) #ifdef BACKSLASH_IN_FILENAME && !rem_backslash(p) #endif @@ -1469,7 +1469,7 @@ expand_showtail(expand_T *xp) // separator, on DOS the '*' "path\*\file" must not be skipped. if (rem_backslash(s)) ++s; - else if (vim_strchr((char_u *)"*?[", *s) != NULL) + else if (mnv_strchr((char_u *)"*?[", *s) != NULL) return FALSE; } return TRUE; @@ -1502,7 +1502,7 @@ addstar( { // Matching will be done internally (on something other than files). // So we convert the file-matching-type wildcards into our kind for - // use with vim_regcomp(). First work out how long it will be: + // use with mnv_regcomp(). First work out how long it will be: // For help tags the translation is done in find_help_tags(). // For a tag pattern starting with "/" no translation is needed. @@ -1518,7 +1518,7 @@ addstar( || ((context == EXPAND_TAGS_LISTFILES || context == EXPAND_TAGS) && fname[0] == '/')) - retval = vim_strnsave(fname, len); + retval = mnv_strnsave(fname, len); else { new_len = len + 2; // +2 for '^' at start, NUL at end @@ -1580,7 +1580,7 @@ addstar( retval = alloc(len + 4); if (retval != NULL) { - vim_strncpy(retval, fname, len); + mnv_strncpy(retval, fname, len); // Don't add a star to *, ~, ~user, $var or `cmd`. // * would become **, which walks the whole tree. @@ -1600,8 +1600,8 @@ addstar( #endif if ((*retval != '~' || tail != retval) && !ends_in_star - && vim_strchr(tail, '$') == NULL - && vim_strchr(retval, '`') == NULL) + && mnv_strchr(tail, '$') == NULL + && mnv_strchr(retval, '`') == NULL) retval[len++] = '*'; else if (len > 0 && retval[len - 1] == '$') --len; @@ -1722,8 +1722,8 @@ set_cmd_index(char_u *cmd, exarg_T *eap, expand_T *xp, int *complp) while (ASCII_ISALPHA(*p) || *p == '*') // Allow * wild card ++p; // A user command may contain digits. - // Include "9" for "vim9*" commands; "vim9cmd" and "vim9script". - if (ASCII_ISUPPER(cmd[0]) || STRNCMP("vim9", cmd, 4) == 0) + // Include "9" for "mnv9*" commands; "mnv9cmd" and "mnv9script". + if (ASCII_ISUPPER(cmd[0]) || STRNCMP("mnv9", cmd, 4) == 0) while (ASCII_ISALNUM(*p) || *p == '*') ++p; // for python 3.x: ":py3*" commands completion @@ -1734,7 +1734,7 @@ set_cmd_index(char_u *cmd, exarg_T *eap, expand_T *xp, int *complp) ++p; } // check for non-alpha command - if (p == cmd && vim_strchr((char_u *)"@*!=><&~#", *p) != NULL) + if (p == cmd && mnv_strchr((char_u *)"@*!=><&~#", *p) != NULL) ++p; len = (int)(p - cmd); @@ -1762,7 +1762,7 @@ set_cmd_index(char_u *cmd, exarg_T *eap, expand_T *xp, int *complp) if (eap->cmdidx == CMD_SIZE) { - if (*cmd == 's' && vim_strchr((char_u *)"cgriI", cmd[1]) != NULL) + if (*cmd == 's' && mnv_strchr((char_u *)"cgriI", cmd[1]) != NULL) { eap->cmdidx = CMD_substitute; p = cmd + 1; @@ -1825,7 +1825,7 @@ set_context_for_wildcard_arg( } // An argument can contain just about everything, except // characters that end the command and white space. - else if (c == '|' || c == '\n' || c == '"' || (VIM_ISWHITE(c) + else if (c == '|' || c == '\n' || c == '"' || (MNV_ISWHITE(c) #ifdef SPACE_IN_FILENAME && (!(eap != NULL && (eap->argt & EX_NOSPC)) || usefilter) #endif @@ -1838,7 +1838,7 @@ set_context_for_wildcard_arg( c = mb_ptr2char(p); else c = *p; - if (c == '`' || vim_isfilec_or_wc(c)) + if (c == '`' || mnv_isfilec_or_wc(c)) break; if (has_mbyte) len = (*mb_ptr2len)(p); @@ -1879,7 +1879,7 @@ set_context_for_wildcard_arg( if (*xp->xp_pattern == '$') { for (p = xp->xp_pattern + 1; *p != NUL; ++p) - if (!vim_isIDc(*p)) + if (!mnv_isIDc(*p)) break; if (*p == NUL) { @@ -1916,7 +1916,7 @@ set_context_in_argopt(expand_T *xp, char_u *arg) { char_u *p; - p = vim_strchr(arg, '='); + p = mnv_strchr(arg, '='); if (p == NULL) xp->xp_pattern = arg; else @@ -1935,7 +1935,7 @@ set_context_in_terminalopt(expand_T *xp, char_u *arg) { char_u *p; - p = vim_strchr(arg, '='); + p = mnv_strchr(arg, '='); if (p == NULL) xp->xp_pattern = arg; else @@ -1954,7 +1954,7 @@ set_context_in_terminalopt(expand_T *xp, char_u *arg) set_context_in_filter_cmd(expand_T *xp, char_u *arg) { if (*arg != NUL) - arg = skip_vimgrep_pat(arg, NULL, NULL); + arg = skip_mnvgrep_pat(arg, NULL, NULL); if (arg == NULL || *arg == NUL) { xp->xp_context = EXPAND_NOTHING; @@ -2041,7 +2041,7 @@ find_cmd_after_substitute_cmd(char_u *arg) ++arg; } } - while (arg[0] && vim_strchr((char_u *)"|\"#", arg[0]) == NULL) + while (arg[0] && mnv_strchr((char_u *)"|\"#", arg[0]) == NULL) ++arg; if (arg[0] != NUL) return arg; @@ -2070,7 +2070,7 @@ find_cmd_after_isearch_cmd(expand_T *xp, char_u *arg) arg = skipwhite(arg + 1); // Check for trailing illegal characters - if (*arg == NUL || vim_strchr((char_u *)"|\"\n", *arg) == NULL) + if (*arg == NUL || mnv_strchr((char_u *)"|\"\n", *arg) == NULL) xp->xp_context = EXPAND_NOTHING; else return arg; @@ -2086,7 +2086,7 @@ find_cmd_after_isearch_cmd(expand_T *xp, char_u *arg) static char_u * set_context_in_unlet_cmd(expand_T *xp, char_u *arg) { - while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) + while ((xp->xp_pattern = mnv_strchr(arg, ' ')) != NULL) arg = xp->xp_pattern + 1; xp->xp_context = EXPAND_USER_VARS; @@ -2187,7 +2187,7 @@ set_context_in_breakadd_cmd(expand_T *xp, char_u *arg, cmdidx_T cmdidx) p = skipwhite(p); // skip line number (if specified) - if (VIM_ISDIGIT(*p)) + if (MNV_ISDIGIT(*p)) { p = skipdigits(p); if (*p != ' ') @@ -2222,7 +2222,7 @@ set_context_in_scriptnames_cmd(expand_T *xp, char_u *arg) xp->xp_pattern = NULL; p = skipwhite(arg); - if (VIM_ISDIGIT(*p)) + if (MNV_ISDIGIT(*p)) return NULL; xp->xp_context = EXPAND_SCRIPTNAMES; @@ -2386,7 +2386,7 @@ set_context_by_cmdname( case CMD_verbose: case CMD_vertical: case CMD_windo: - case CMD_vim9cmd: + case CMD_mnv9cmd: case CMD_legacy: return arg; @@ -2456,7 +2456,7 @@ set_context_by_cmdname( case CMD_tjump: case CMD_stjump: case CMD_ptjump: - if (vim_strchr(p_wop, WOP_TAGFILE) != NULL) + if (mnv_strchr(p_wop, WOP_TAGFILE) != NULL) xp->xp_context = EXPAND_TAGS_LISTFILES; else xp->xp_context = EXPAND_TAGS; @@ -2531,7 +2531,7 @@ set_context_by_cmdname( case CMD_bdelete: case CMD_bwipeout: case CMD_bunload: - while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) + while ((xp->xp_pattern = mnv_strchr(arg, ' ')) != NULL) arg = xp->xp_pattern + 1; // FALLTHROUGH case CMD_buffer: @@ -2682,7 +2682,7 @@ set_context_by_cmdname( #endif case CMD_argdelete: - while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) + while ((xp->xp_pattern = mnv_strchr(arg, ' ')) != NULL) arg = xp->xp_pattern + 1; xp->xp_context = EXPAND_ARGLIST; xp->xp_pattern = arg; @@ -2733,7 +2733,7 @@ set_one_cmd_context( ea.argt = 0; // 1. skip comment lines and leading space, colons or bars - for (cmd = buff; vim_strchr((char_u *)" \t:|", *cmd) != NULL; cmd++) + for (cmd = buff; mnv_strchr((char_u *)" \t:|", *cmd) != NULL; cmd++) ; xp->xp_pattern = cmd; @@ -2784,7 +2784,7 @@ set_one_cmd_context( while (*arg != NUL && STRNCMP(arg, "++", 2) == 0) { p = arg + 2; - while (*p && !vim_isspace(*p)) + while (*p && !mnv_isspace(*p)) MB_PTR_ADV(p); // Still touching the command after "++"? @@ -2880,7 +2880,7 @@ set_one_cmd_context( } if (!(ea.argt & EX_EXTRA) && *arg != NUL - && vim_strchr((char_u *)"|\"", *arg) == NULL) + && mnv_strchr((char_u *)"|\"", *arg) == NULL) // no arguments allowed but there is something return NULL; @@ -3004,7 +3004,7 @@ expand_cmdline( xp->xp_pattern_len = (int)(str + col - xp->xp_pattern); if (cmdline_fuzzy_completion_supported(xp)) // If fuzzy matching, don't modify the search string - file_str = vim_strsave(xp->xp_pattern); + file_str = mnv_strsave(xp->xp_pattern); else file_str = addstar(xp->xp_pattern, xp->xp_pattern_len, xp->xp_context); if (file_str == NULL) @@ -3019,7 +3019,7 @@ expand_cmdline( *matchcount = 0; *matches = NULL; } - vim_free(file_str); + mnv_free(file_str); return EXPAND_OK; } @@ -3051,7 +3051,7 @@ expand_files_and_dirs( free_pat = TRUE; pat_len = STRLEN(pat); - pat = vim_strnsave(pat, pat_len); + pat = mnv_strnsave(pat, pat_len); if (pat == NULL) return ret; @@ -3126,7 +3126,7 @@ expand_files_and_dirs( ret = expand_wildcards_eval(&pat, numMatches, matches, flags); } if (free_pat) - vim_free(pat); + mnv_free(pat); #ifdef BACKSLASH_IN_FILENAME if (p_csl[0] != NUL && (options & WILD_IGNORE_COMPLETESLASH) == 0) { @@ -3507,16 +3507,16 @@ ExpandFromContext( tofree = alloc(len); if (tofree == NULL) return FAIL; - vim_snprintf((char *)tofree, len, "^\\d\\+_%s", pat + 3); + mnv_snprintf((char *)tofree, len, "^\\d\\+_%s", pat + 3); pat = tofree; } if (!fuzzy) { - regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0); + regmatch.regprog = mnv_regcomp(pat, magic_isset() ? RE_MAGIC : 0); if (regmatch.regprog == NULL) { - vim_free(tofree); + mnv_free(tofree); return FAIL; } // set ignore-case according to p_ic, p_scs and pat @@ -3548,8 +3548,8 @@ ExpandFromContext( ret = ExpandOther(pat, xp, ®match, matches, numMatches); if (!fuzzy) - vim_regfree(regmatch.regprog); - vim_free(tofree); + mnv_regfree(regmatch.regprog); + mnv_free(tofree); return ret; } @@ -3628,7 +3628,7 @@ ExpandGenericExt( if (xp->xp_pattern[0] != NUL) { if (!fuzzy) - match = vim_regexec(regmatch, str, (colnr_T)0); + match = mnv_regexec(regmatch, str, (colnr_T)0); else { score = fuzzy_match_str(str, pat); @@ -3642,9 +3642,9 @@ ExpandGenericExt( continue; if (escaped) - str = vim_strsave_escaped(str, (char_u *)" \t\\."); + str = mnv_strsave_escaped(str, (char_u *)" \t\\."); else - str = vim_strsave(str); + str = mnv_strsave(str); if (str == NULL) { if (!fuzzy) @@ -3658,7 +3658,7 @@ ExpandGenericExt( if (ga_grow(&ga, 1) == FAIL) { - vim_free(str); + mnv_free(str); break; } @@ -3792,9 +3792,9 @@ expand_shellcmd_onedir( name = NULL; } } - vim_free(name); + mnv_free(name); } - vim_free(*matches); + mnv_free(*matches); } /* @@ -3825,10 +3825,10 @@ expand_shellcmd( // for ":set path=" and ":set tags=" halve backslashes for escaped space patlen = STRLEN(filepat); - pat = vim_strnsave(filepat, patlen); + pat = mnv_strnsave(filepat, patlen); if (pat == NULL) { - vim_free(buf); + mnv_free(buf); return FAIL; } @@ -3852,14 +3852,14 @@ expand_shellcmd( flags |= EW_FILE | EW_EXEC | EW_SHELLCMD; - if (pat[0] == '.' && (vim_ispathsep(pat[1]) - || (pat[1] == '.' && vim_ispathsep(pat[2])))) + if (pat[0] == '.' && (mnv_ispathsep(pat[1]) + || (pat[1] == '.' && mnv_ispathsep(pat[2])))) path = (char_u *)"."; else { // For an absolute name we don't use $PATH. if (!mch_isFullName(pat)) - path = vim_getenv((char_u *)"PATH", &mustfree); + path = mnv_getenv((char_u *)"PATH", &mustfree); if (path == NULL) path = (char_u *)""; } @@ -3891,9 +3891,9 @@ expand_shellcmd( else { #if defined(MSWIN) - e = vim_strchr(s, ';'); + e = mnv_strchr(s, ';'); #else - e = vim_strchr(s, ':'); + e = mnv_strchr(s, ':'); #endif if (e == NULL) e = s + STRLEN(s); @@ -3918,7 +3918,7 @@ expand_shellcmd( { if (pathlen > 0) { - vim_strncpy(buf, s, pathlen); + mnv_strncpy(buf, s, pathlen); if (seplen > 0) { STRCPY(buf + pathlen, PATHSEPSTR); @@ -3937,17 +3937,17 @@ expand_shellcmd( *matches = ga.ga_data; *numMatches = ga.ga_len; - vim_free(buf); - vim_free(pat); + mnv_free(buf); + mnv_free(pat); if (mustfree) - vim_free(path); + mnv_free(path); hash_clear(&found_ht); return OK; } #if defined(FEAT_EVAL) /* - * Call "user_expand_func()" to invoke a user defined Vim script function and + * Call "user_expand_func()" to invoke a user defined MNV script function and * return the result (either a string, a List or NULL). */ static void * @@ -3971,7 +3971,7 @@ call_user_expand_func( ccline->cmdbuff[ccline->cmdlen] = 0; } - pat = vim_strnsave(xp->xp_pattern, xp->xp_pattern_len); + pat = mnv_strnsave(xp->xp_pattern, xp->xp_pattern_len); args[0].v_type = VAR_STRING; args[0].vval.v_string = pat; @@ -3989,7 +3989,7 @@ call_user_expand_func( if (ccline->cmdbuff != NULL) ccline->cmdbuff[ccline->cmdlen] = keep; - vim_free(pat); + mnv_free(pat); return ret; } @@ -4029,7 +4029,7 @@ ExpandUserDefined( for (s = retstr; *s != NUL; s = e) { - e = vim_strchr(s, '\n'); + e = mnv_strchr(s, '\n'); if (e == NULL) e = s + STRLEN(s); keep = *e; @@ -4038,7 +4038,7 @@ ExpandUserDefined( if (xp->xp_pattern[0] != NUL) { if (!fuzzy) - match = vim_regexec(regmatch, s, (colnr_T)0); + match = mnv_regexec(regmatch, s, (colnr_T)0); else { score = fuzzy_match_str(s, pat); @@ -4052,13 +4052,13 @@ ExpandUserDefined( if (match) { - char_u *p = vim_strnsave(s, (size_t)(e - s)); + char_u *p = mnv_strnsave(s, (size_t)(e - s)); if (p == NULL) break; if (ga_grow(&ga, 1) == FAIL) { - vim_free(p); + mnv_free(p); break; } @@ -4078,7 +4078,7 @@ ExpandUserDefined( if (*e != NUL) ++e; } - vim_free(retstr); + mnv_free(retstr); if (ga.ga_len == 0) return OK; @@ -4126,13 +4126,13 @@ ExpandUserList( if (li->li_tv.v_type != VAR_STRING || li->li_tv.vval.v_string == NULL) continue; // Skip non-string items and empty strings - p = vim_strsave(li->li_tv.vval.v_string); + p = mnv_strsave(li->li_tv.vval.v_string); if (p == NULL) break; if (ga_grow(&ga, 1) == FAIL) { - vim_free(p); + mnv_free(p); break; } @@ -4177,7 +4177,7 @@ globpath( filelen = STRLEN(file); #if defined(MSWIN) - // Using the platform's path separator (\) makes vim incorrectly + // Using the platform's path separator (\) makes mnv incorrectly // treat it as an escape character, use '/' instead. # define TMP_PATHSEPSTR "/" #else @@ -4224,12 +4224,12 @@ globpath( FreeWild(num_p, p); p = NULL; } - vim_free(p); + mnv_free(p); } } } - vim_free(buf); + mnv_free(buf); } #undef TMP_PATHSEPSTR @@ -4391,7 +4391,7 @@ wildmenu_process_key_filenames(cmdline_info_T *cclp, int key, expand_T *xp) { if (has_mbyte) j -= (*mb_head_off)(cclp->cmdbuff, cclp->cmdbuff + j); - if (vim_ispathsep(cclp->cmdbuff[j])) + if (mnv_ispathsep(cclp->cmdbuff[j])) { found = TRUE; break; @@ -4400,7 +4400,7 @@ wildmenu_process_key_filenames(cmdline_info_T *cclp, int key, expand_T *xp) if (found && cclp->cmdbuff[j - 1] == '.' && cclp->cmdbuff[j - 2] == '.' - && (vim_ispathsep(cclp->cmdbuff[j - 3]) || j == i + 2)) + && (mnv_ispathsep(cclp->cmdbuff[j - 3]) || j == i + 2)) { cmdline_del(cclp, j - 2); key = p_wc; @@ -4418,9 +4418,9 @@ wildmenu_process_key_filenames(cmdline_info_T *cclp, int key, expand_T *xp) { if (has_mbyte) j -= (*mb_head_off)(cclp->cmdbuff, cclp->cmdbuff + j); - if (vim_ispathsep(cclp->cmdbuff[j]) + if (mnv_ispathsep(cclp->cmdbuff[j]) #ifdef BACKSLASH_IN_FILENAME - && vim_strchr((char_u *)" *?[{`$%#", + && mnv_strchr((char_u *)" *?[{`$%#", cclp->cmdbuff[j + 1]) == NULL #endif ) @@ -4544,7 +4544,7 @@ f_getcompletion(typval_T *argvars, typval_T *rettv) int options = WILD_SILENT | WILD_USE_NL | WILD_ADD_SLASH | WILD_NO_BEEP | WILD_HOME_REPLACE; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL || check_for_opt_bool_arg(argvars, 2) == FAIL)) @@ -4656,7 +4656,7 @@ f_getcompletion(typval_T *argvars, typval_T *rettv) if (cmdline_fuzzy_completion_supported(&xpc)) // when fuzzy matching, don't modify the search string - pat = vim_strnsave(xpc.xp_pattern, xpc.xp_pattern_len); + pat = mnv_strnsave(xpc.xp_pattern, xpc.xp_pattern_len); else pat = addstar(xpc.xp_pattern, xpc.xp_pattern_len, xpc.xp_context); @@ -4669,7 +4669,7 @@ f_getcompletion(typval_T *argvars, typval_T *rettv) for (i = 0; i < xpc.xp_numfiles; i++) list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1); } - vim_free(pat); + mnv_free(pat); ExpandCleanup(&xpc); } @@ -4747,7 +4747,7 @@ copy_substring_from_pos(pos_T *start, pos_T *end, char_u **match, int segment_len; linenr_T lnum; garray_T ga; - int exacttext = vim_strchr(p_wop, WOP_EXACTTEXT) != NULL; + int exacttext = mnv_strchr(p_wop, WOP_EXACTTEXT) != NULL; if (start->lnum > end->lnum || (start->lnum == end->lnum && start->col >= end->col)) @@ -4831,7 +4831,7 @@ is_regex_match(char_u *pat, char_u *str) ++emsg_off; ++msg_silent; - regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + regmatch.regprog = mnv_regcomp(pat, RE_MAGIC + RE_STRING); --emsg_off; --msg_silent; @@ -4843,11 +4843,11 @@ is_regex_match(char_u *pat, char_u *str) ++emsg_off; ++msg_silent; - result = vim_regexec_nl(®match, str, (colnr_T)0); + result = mnv_regexec_nl(®match, str, (colnr_T)0); --emsg_off; --msg_silent; - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); return result; } @@ -4878,16 +4878,16 @@ concat_pattern_with_buffer_match( #if defined(FEAT_EVAL) || defined(FEAT_SPELL) if (lowercase) { - char_u *mword = vim_strnsave(line + end_match_pos->col, + char_u *mword = mnv_strnsave(line + end_match_pos->col, match_len); if (mword == NULL) goto cleanup; char_u *lower = strlow_save(mword); - vim_free(mword); + mnv_free(mword); if (lower == NULL) goto cleanup; mch_memmove(match + pat_len, lower, match_len); - vim_free(lower); + mnv_free(lower); } else #endif @@ -4898,7 +4898,7 @@ concat_pattern_with_buffer_match( #if defined(FEAT_EVAL) || defined(FEAT_SPELL) cleanup: - vim_free(match); + mnv_free(match); return NULL; #endif } @@ -4923,7 +4923,7 @@ expand_pattern_in_buf( int compl_started = FALSE; int search_flags; char_u *match, *full_match; - int exacttext = vim_strchr(p_wop, WOP_EXACTTEXT) != NULL; + int exacttext = mnv_strchr(p_wop, WOP_EXACTTEXT) != NULL; #ifdef FEAT_SEARCH_EXTRA has_range = search_first_line != 0; @@ -5025,17 +5025,17 @@ expand_pattern_in_buf( // version of the word to handle smartcase behavior. if (match == NULL || !is_regex_match(match, full_match)) { - vim_free(match); + mnv_free(match); match = concat_pattern_with_buffer_match(pat, pat_len, &end_match_pos, TRUE); if (match == NULL || !is_regex_match(match, full_match)) { - vim_free(match); - vim_free(full_match); + mnv_free(match); + mnv_free(full_match); continue; } } - vim_free(full_match); + mnv_free(full_match); } // Include this match if it is not a duplicate @@ -5043,7 +5043,7 @@ expand_pattern_in_buf( { if (STRCMP(match, ((char_u **)ga.ga_data)[i]) == 0) { - VIM_CLEAR(match); + MNV_CLEAR(match); break; } } diff --git a/uvim/src/cmdhist.c b/uvim/src/cmdhist.c index 9d55969c39..8e9d42c887 100644 --- a/uvim/src/cmdhist.c +++ b/uvim/src/cmdhist.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * cmdhist.c: Functions for the history of the command-line. */ -#include "vim.h" +#include "mnv.h" static histentry_T *(history[HIST_COUNT]) = {NULL, NULL, NULL, NULL, NULL}; static int hisidx[HIST_COUNT] = {-1, -1, -1, -1, -1}; // lastused entry @@ -37,7 +37,7 @@ get_histentry(int hist_type) return history[hist_type]; } -#if defined(FEAT_VIMINFO) +#if defined(FEAT_MNVINFO) void set_histentry(int hist_type, histentry_T *entry) { @@ -51,7 +51,7 @@ get_hisidx(int hist_type) return &hisidx[hist_type]; } -#if defined(FEAT_VIMINFO) +#if defined(FEAT_MNVINFO) int * get_hisnum(int hist_type) { @@ -187,7 +187,7 @@ init_history(void) temp[i] = history[type][j]; else // remove older entries { - vim_free(history[type][j].hisstr); + mnv_free(history[type][j].hisstr); history[type][j].hisstrlen = 0; } if (--j < 0) @@ -197,7 +197,7 @@ init_history(void) } hisidx[type] = newlen - 1; } - vim_free(history[type]); + mnv_free(history[type]); history[type] = temp; } hislen = newlen; @@ -207,7 +207,7 @@ init_history(void) clear_hist_entry(histentry_T *hisptr) { hisptr->hisnum = 0; - hisptr->viminfo = FALSE; + hisptr->mnvinfo = FALSE; hisptr->hisstr = NULL; hisptr->hisstrlen = 0; hisptr->time_set = 0; @@ -223,7 +223,7 @@ in_history( char_u *str, int move_to_front, // Move the entry to the front if it exists int sep, - int writing) // ignore entries read from viminfo + int writing) // ignore entries read from mnvinfo { int i; int last_i = -1; @@ -242,7 +242,7 @@ in_history( // well. p = history[type][i].hisstr; if (STRCMP(str, p) == 0 - && !(writing && history[type][i].viminfo) + && !(writing && history[type][i].mnvinfo) && (type != HIST_SEARCH || sep == p[history[type][i].hisstrlen + 1])) { if (!move_to_front) @@ -267,10 +267,10 @@ in_history( last_i = i; } history[type][i].hisnum = ++hisnum[type]; - history[type][i].viminfo = FALSE; + history[type][i].mnvinfo = FALSE; history[type][i].hisstr = str; history[type][i].hisstrlen = len; - history[type][i].time_set = vim_time(); + history[type][i].time_set = mnv_time(); return TRUE; } @@ -293,7 +293,7 @@ get_histtype(char_u *name) if (STRNICMP(name, history_names[i], len) == 0) return i; - if (vim_strchr((char_u *)":=@>?/", name[0]) != NULL && name[1] == NUL) + if (mnv_strchr((char_u *)":=@>?/", name[0]) != NULL && name[1] == NUL) return hist_char2type(name[0]); return -1; @@ -331,7 +331,7 @@ add_to_history( { // Current line is from the same mapping, remove it hisptr = &history[HIST_SEARCH][hisidx[HIST_SEARCH]]; - vim_free(hisptr->hisstr); + mnv_free(hisptr->hisstr); clear_hist_entry(hisptr); --hisnum[histype]; if (--hisidx[HIST_SEARCH] < 0) @@ -346,10 +346,10 @@ add_to_history( if (++hisidx[histype] == hislen) hisidx[histype] = 0; hisptr = &history[histype][hisidx[histype]]; - vim_free(hisptr->hisstr); + mnv_free(hisptr->hisstr); // Store the separator after the NUL of the string. - hisptr->hisstr = vim_strnsave(new_entry, new_entrylen + 2); + hisptr->hisstr = mnv_strnsave(new_entry, new_entrylen + 2); if (hisptr->hisstr == NULL) hisptr->hisstrlen = 0; else @@ -359,8 +359,8 @@ add_to_history( } hisptr->hisnum = ++hisnum[histype]; - hisptr->viminfo = FALSE; - hisptr->time_set = vim_time(); + hisptr->mnvinfo = FALSE; + hisptr->time_set = mnv_time(); if (histype == HIST_SEARCH && in_map) last_maptick = maptick; } @@ -438,7 +438,7 @@ clr_history(int histype) hisptr = history[histype]; for (i = hislen; i--;) { - vim_free(hisptr->hisstr); + mnv_free(hisptr->hisstr); clear_hist_entry(hisptr); hisptr++; } @@ -468,7 +468,7 @@ del_history_entry(int histype, char_u *str) return FALSE; idx = hisidx[histype]; - regmatch.regprog = vim_regcomp(str, RE_MAGIC + RE_STRING); + regmatch.regprog = mnv_regcomp(str, RE_MAGIC + RE_STRING); if (regmatch.regprog == NULL) return FALSE; @@ -480,10 +480,10 @@ del_history_entry(int histype, char_u *str) hisptr = &history[histype][i]; if (hisptr->hisstr == NULL) break; - if (vim_regexec(®match, hisptr->hisstr, (colnr_T)0)) + if (mnv_regexec(®match, hisptr->hisstr, (colnr_T)0)) { found = TRUE; - vim_free(hisptr->hisstr); + mnv_free(hisptr->hisstr); clear_hist_entry(hisptr); } else @@ -503,7 +503,7 @@ del_history_entry(int histype, char_u *str) if (history[histype][idx].hisstr == NULL) hisidx[histype] = -1; - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); return found; } @@ -520,7 +520,7 @@ del_history_idx(int histype, int idx) if (i < 0) return FALSE; idx = hisidx[histype]; - vim_free(history[histype][i].hisstr); + mnv_free(history[histype][i].hisstr); history[histype][i].hisstrlen = 0; // When deleting the last added search string in a mapping, reset @@ -555,7 +555,7 @@ f_histadd(typval_T *argvars UNUSED, typval_T *rettv) if (check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; @@ -583,7 +583,7 @@ f_histdel(typval_T *argvars UNUSED, typval_T *rettv UNUSED) int n; char_u *str; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_or_number_arg(argvars, 1) == FAIL)) return; @@ -618,7 +618,7 @@ f_histget(typval_T *argvars UNUSED, typval_T *rettv) { char_u *str; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_number_arg(argvars, 1) == FAIL)) return; @@ -640,9 +640,9 @@ f_histget(typval_T *argvars UNUSED, typval_T *rettv) idx = calc_hist_idx(type, idx); if (idx < 0) - rettv->vval.v_string = vim_strnsave((char_u *)"", 0); + rettv->vval.v_string = mnv_strnsave((char_u *)"", 0); else - rettv->vval.v_string = vim_strnsave(history[type][idx].hisstr, history[type][idx].hisstrlen); + rettv->vval.v_string = mnv_strnsave(history[type][idx].hisstr, history[type][idx].hisstrlen); } rettv->v_type = VAR_STRING; } @@ -656,7 +656,7 @@ f_histnr(typval_T *argvars UNUSED, typval_T *rettv) int i; char_u *histname; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; histname = tv_get_string_chk(&argvars[0]); @@ -693,11 +693,11 @@ remove_key_from_history(void) { if (STRNCMP(p, "key", 3) == 0 && !SAFE_isalpha(p[3])) { - p = vim_strchr(p + 3, '='); + p = mnv_strchr(p + 3, '='); if (p == NULL) break; ++p; - for (i = 0; p[i] && !VIM_ISWHITE(p[i]); ++i) + for (i = 0; p[i] && !MNV_ISWHITE(p[i]); ++i) if (p[i] == '\\' && p[i + 1]) ++i; @@ -733,11 +733,11 @@ ex_history(exarg_T *eap) return; } - if (!(VIM_ISDIGIT(*arg) || *arg == '-' || *arg == ',')) + if (!(MNV_ISDIGIT(*arg) || *arg == '-' || *arg == ',')) { end = arg; while (ASCII_ISALPHA(*end) - || vim_strchr((char_u *)":=@>/?", *end) != NULL) + || mnv_strchr((char_u *)":=@>/?", *end) != NULL) end++; i = *end; *end = NUL; @@ -773,7 +773,7 @@ ex_history(exarg_T *eap) for (; !got_int && histype1 <= histype2; ++histype1) { - vim_snprintf((char *)IObuff, IOSIZE, "\n # %s history", history_names[histype1]); + mnv_snprintf((char *)IObuff, IOSIZE, "\n # %s history", history_names[histype1]); msg_puts_title((char *)IObuff); idx = hisidx[histype1]; hist = history[histype1]; @@ -795,9 +795,9 @@ ex_history(exarg_T *eap) int len; msg_putchar('\n'); - len = vim_snprintf((char *)IObuff, IOSIZE, + len = mnv_snprintf((char *)IObuff, IOSIZE, "%c%6d ", i == idx ? '>' : ' ', hist[i].hisnum); - if (vim_strsize(hist[i].hisstr) > (int)Columns - 10) + if (mnv_strsize(hist[i].hisstr) > (int)Columns - 10) trunc_string(hist[i].hisstr, IObuff + len, (int)Columns - 10, IOSIZE - (int)len); else diff --git a/uvim/src/config.h.in b/uvim/src/config.h.in index f15d8800cd..c59ce5e8a2 100644 --- a/uvim/src/config.h.in +++ b/uvim/src/config.h.in @@ -49,10 +49,10 @@ #undef UNIX /* Defined to the size of an int */ -#undef VIM_SIZEOF_INT +#undef MNV_SIZEOF_INT /* Defined to the size of a long */ -#undef VIM_SIZEOF_LONG +#undef MNV_SIZEOF_LONG /* Defined to the size of off_t */ #undef SIZEOF_OFF_T @@ -65,7 +65,7 @@ /* * If we cannot trust one of the following from the libraries, we use our - * own safe but probably slower vim_memmove(). + * own safe but probably slower mnv_memmove(). */ #undef USEBCOPY #undef USEMEMMOVE @@ -311,7 +311,7 @@ /* Define if you have that is POSIX.1 compatible. */ #undef HAVE_SYS_WAIT_H -/* This is currently unused in vim: */ +/* This is currently unused in mnv: */ /* Define if you have the ANSI C header files. */ /* #undef STDC_HEADERS */ @@ -403,7 +403,7 @@ /* Define if you don't want to include Arabic support. */ #undef DISABLE_ARABIC -/* Define if you want to always define a server name at vim startup. */ +/* Define if you want to always define a server name at mnv startup. */ #undef FEAT_AUTOSERVERNAME /* Define if you want to use sockets for clientserver communication. */ @@ -472,7 +472,7 @@ // Define default global runtime after path. #undef RUNTIME_GLOBAL_AFTER -/* Define name of who modified a released Vim */ +/* Define name of who modified a released MNV */ #undef MODIFIED_BY /* Define if you want XSMP interaction as well as vanilla swapfile safety */ diff --git a/uvim/src/config.mk.dist b/uvim/src/config.mk.dist index 8a584c29a4..66025ef002 100644 --- a/uvim/src/config.mk.dist +++ b/uvim/src/config.mk.dist @@ -1,5 +1,5 @@ -the first target to make vim is: reconfig +the first target to make mnv is: reconfig srcdir = . -VIMNAME = vim +MNVNAME = mnv EXNAME = ex VIEWNAME = view diff --git a/uvim/src/config.mk.in b/uvim/src/config.mk.in index a46a140a71..3504afdcf5 100644 --- a/uvim/src/config.mk.in +++ b/uvim/src/config.mk.in @@ -1,5 +1,5 @@ # -# config.mk.in -- autoconf template for Vim on Unix vim:ts=8:sw=8: +# config.mk.in -- autoconf template for MNV on Unix mnv:ts=8:sw=8: # # DO NOT EDIT config.mk!! It will be overwritten by configure. # Edit Makefile and run "make" or run ./configure with other arguments. @@ -13,7 +13,7 @@ @SET_MAKE@ -VIMNAME = @VIMNAME@ +MNVNAME = @MNVNAME@ EXNAME = @EXNAME@ VIEWNAME = @VIEWNAME@ @@ -116,8 +116,8 @@ CROSS_COMPILING = @CROSS_COMPILING@ COMPILEDBY = @compiledby@ -INSTALLVIMDIFF = @dovimdiff@ -INSTALLGVIMDIFF = @dogvimdiff@ +INSTALLMNVDIFF = @domnvdiff@ +INSTALLGMNVDIFF = @dogmnvdiff@ INSTALL_LANGS = @INSTALL_LANGS@ INSTALL_TOOL_LANGS = @INSTALL_TOOL_LANGS@ diff --git a/uvim/src/configure.ac b/uvim/src/configure.ac index 3787701e3b..827329afa1 100644 --- a/uvim/src/configure.ac +++ b/uvim/src/configure.ac @@ -1,5 +1,5 @@ dnl +----------------------------------------------------------------------+ -dnl configure.ac: autoconf script for Vim +dnl configure.ac: autoconf script for MNV dnl +----------------------------------------------------------------------+ dnl dnl This file is processed by autoconf to generate the 'configure' script. @@ -24,17 +24,17 @@ dnl Normally, AC_INIT([package],[version],[bug-report],[tarname],[url]) dnl provides PACKAGE_* macros, used by Autoconf on UNIX to inject version dnl info into config.h, --version output, and "make dist". dnl -dnl Vim does not rely on that: versioning is centralized in +dnl MNV does not rely on that: versioning is centralized in dnl version.h/version.c, dnl which ensures a single cross-platform source of dnl truth for both UNIX and non-UNIX platforms. dnl dnl Therefore we call AC_INIT without arguments. AC_INIT -dnl Use vim.h as the source-tree anchor: AC_CONFIG_SRCDIR verifies that +dnl Use mnv.h as the source-tree anchor: AC_CONFIG_SRCDIR verifies that dnl configure is run in (or pointed to) the correct source directory. -dnl vim.h is always present at the top level. -AC_CONFIG_SRCDIR([vim.h]) +dnl mnv.h is always present at the top level. +AC_CONFIG_SRCDIR([mnv.h]) AC_CONFIG_HEADERS(auto/config.h:config.h.in) dnl Being able to run configure means the system is Unix (compatible). @@ -60,10 +60,10 @@ if test -z "$PKG_CONFIG"; then AC_PATH_TOOL(PKG_CONFIG, pkg-config, no) fi -dnl Check that the C99 features that Vim uses are supported: +dnl Check that the C99 features that MNV uses are supported: if test x"$ac_cv_prog_cc_c99" = xno; then dnl If the compiler doesn't explicitly support C99, then check - dnl for the specific features Vim uses + dnl for the specific features MNV uses AC_TYPE_LONG_LONG_INT if test "$ac_cv_type_long_long_int" = no; then @@ -195,34 +195,34 @@ fi OS_EXTRA_SRC=""; OS_EXTRA_OBJ="" -dnl When cross-compiling set $vim_cv_uname_output, $vim_cv_uname_r_output and -dnl $vim_cv_uname_m_output to the desired value for the target system +dnl When cross-compiling set $mnv_cv_uname_output, $mnv_cv_uname_r_output and +dnl $mnv_cv_uname_m_output to the desired value for the target system AC_MSG_CHECKING(uname) -if test "x$vim_cv_uname_output" = "x" ; then - vim_cv_uname_output=`(uname) 2>/dev/null` - AC_MSG_RESULT($vim_cv_uname_output) +if test "x$mnv_cv_uname_output" = "x" ; then + mnv_cv_uname_output=`(uname) 2>/dev/null` + AC_MSG_RESULT($mnv_cv_uname_output) else - AC_MSG_RESULT([$vim_cv_uname_output (cached)]) + AC_MSG_RESULT([$mnv_cv_uname_output (cached)]) fi AC_MSG_CHECKING(uname -r) -if test "x$vim_cv_uname_r_output" = "x" ; then - vim_cv_uname_r_output=`(uname -r) 2>/dev/null` - AC_MSG_RESULT($vim_cv_uname_r_output) +if test "x$mnv_cv_uname_r_output" = "x" ; then + mnv_cv_uname_r_output=`(uname -r) 2>/dev/null` + AC_MSG_RESULT($mnv_cv_uname_r_output) else - AC_MSG_RESULT([$vim_cv_uname_r_output (cached)]) + AC_MSG_RESULT([$mnv_cv_uname_r_output (cached)]) fi AC_MSG_CHECKING(uname -m) -if test "x$vim_cv_uname_m_output" = "x" ; then - vim_cv_uname_m_output=`(uname -m) 2>/dev/null` - AC_MSG_RESULT($vim_cv_uname_m_output) +if test "x$mnv_cv_uname_m_output" = "x" ; then + mnv_cv_uname_m_output=`(uname -m) 2>/dev/null` + AC_MSG_RESULT($mnv_cv_uname_m_output) else - AC_MSG_RESULT([$vim_cv_uname_m_output (cached)]) + AC_MSG_RESULT([$mnv_cv_uname_m_output (cached)]) fi AC_MSG_CHECKING(for Haiku) -case $vim_cv_uname_output in +case $mnv_cv_uname_output in Haiku) HAIKU=yes; AC_MSG_RESULT(yes);; *) HAIKU=no; AC_MSG_RESULT(no);; esac @@ -230,7 +230,7 @@ esac dnl If QNX is found, assume we don't want to use Xphoton dnl unless it was specifically asked for (--with-x) AC_MSG_CHECKING(for QNX) -case $vim_cv_uname_output in +case $mnv_cv_uname_output in QNX) OS_EXTRA_SRC=os_qnx.c; OS_EXTRA_OBJ=objects/os_qnx.o test -z "$with_x" && with_x=no QNX=yes; AC_MSG_RESULT(yes);; @@ -241,7 +241,7 @@ dnl Check for Darwin and MacOS X dnl We do a check for MacOS X in the very beginning because there dnl are a lot of other things we need to change besides GUI stuff AC_MSG_CHECKING([for Darwin (Mac OS X)]) -if test "$vim_cv_uname_output" = Darwin; then +if test "$mnv_cv_uname_output" = Darwin; then AC_MSG_RESULT(yes) MACOS_X=yes CPPFLAGS="$CPPFLAGS -DMACOS_X" @@ -393,11 +393,11 @@ if test "$cross_compiling" = no; then fi fi -AC_MSG_CHECKING(--with-vim-name argument) -AC_ARG_WITH(vim-name, [ --with-vim-name=NAME what to call the Vim executable], - VIMNAME="$withval"; AC_MSG_RESULT($VIMNAME), - VIMNAME="vim"; AC_MSG_RESULT(Defaulting to $VIMNAME)) -AC_SUBST(VIMNAME) +AC_MSG_CHECKING(--with-mnv-name argument) +AC_ARG_WITH(mnv-name, [ --with-mnv-name=NAME what to call the MNV executable], + MNVNAME="$withval"; AC_MSG_RESULT($MNVNAME), + MNVNAME="mnv"; AC_MSG_RESULT(Defaulting to $MNVNAME)) +AC_SUBST(MNVNAME) AC_MSG_CHECKING(--with-ex-name argument) AC_ARG_WITH(ex-name, [ --with-ex-name=NAME what to call the Ex executable], EXNAME="$withval"; AC_MSG_RESULT($EXNAME), @@ -453,7 +453,7 @@ AC_SUBST(line_break) if test "$cf_cv_ebcdic" = "yes"; then dnl If we have EBCDIC we most likely have z/OS Unix, let's test it! AC_MSG_CHECKING(for z/OS Unix) -case $vim_cv_uname_output in +case $mnv_cv_uname_output in OS/390) zOSUnix="yes"; dnl If using cc the environment variable _CC_CCMODE must be dnl set to "1", so that some compiler extensions are enabled. @@ -574,19 +574,19 @@ case "$features" in big) features="normal" ;; esac -dovimdiff="" -dogvimdiff="" +domnvdiff="" +dogmnvdiff="" case "$features" in tiny) AC_DEFINE(FEAT_TINY) ;; - normal) AC_DEFINE(FEAT_NORMAL) dovimdiff="installvimdiff"; - dogvimdiff="installgvimdiff" ;; - huge) AC_DEFINE(FEAT_HUGE) dovimdiff="installvimdiff"; - dogvimdiff="installgvimdiff" ;; + normal) AC_DEFINE(FEAT_NORMAL) domnvdiff="installmnvdiff"; + dogmnvdiff="installgmnvdiff" ;; + huge) AC_DEFINE(FEAT_HUGE) domnvdiff="installmnvdiff"; + dogmnvdiff="installgmnvdiff" ;; *) AC_MSG_RESULT([Sorry, $features is not supported]) ;; esac -AC_SUBST(dovimdiff) -AC_SUBST(dogvimdiff) +AC_SUBST(domnvdiff) +AC_SUBST(dogmnvdiff) if test "x$features" = "xtiny"; then has_eval=no @@ -718,7 +718,7 @@ if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then AC_MSG_RESULT(no) # Detect moonjit: - # https://groups.google.com/forum/#!topic/vim_use/O0vek60WuTk + # https://groups.google.com/forum/#!topic/mnv_use/O0vek60WuTk lua_suf=/moonjit-2.3 inc_path="$vi_cv_path_lua_pfx/include" for dir in "$inc_path"/moonjit-[[0-9]]* ; do @@ -837,7 +837,7 @@ if test "$enable_luainterp" = "yes" -o "$enable_luainterp" = "dynamic"; then fi if test "X$LUA_CFLAGS$LUA_LIBS" != "X" && \ test "x$MACOS_X" = "xyes" && test "x$vi_cv_with_luajit" != "xno" && \ - test "$vim_cv_uname_m_output" = "x86_64"; then + test "$mnv_cv_uname_m_output" = "x86_64"; then dnl OSX/x64 requires these flags. See http://luajit.org/install.html LUA_LIBS="-pagezero_size 10000 -image_base 100000000 $LUA_LIBS" fi @@ -1002,11 +1002,11 @@ if test "$enable_mzschemeinterp" = "yes"; then MZSCHEME_LIBS="-L${path} -lmzscheme -lmzgc" fi if test "$GCC" = yes; then - dnl Make Vim remember the path to the library. For when it's not in + dnl Make MNV remember the path to the library. For when it's not in dnl $LD_LIBRARY_PATH. MZSCHEME_LIBS="${MZSCHEME_LIBS} -Wl,-rpath -Wl,${path}" - elif test "$vim_cv_uname_output" = SunOS && - echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then + elif test "$mnv_cv_uname_output" = SunOS && + echo $mnv_cv_uname_r_output | grep '^5' >/dev/null; then MZSCHEME_LIBS="${MZSCHEME_LIBS} -R ${path}" fi fi @@ -1414,7 +1414,7 @@ eof else vi_cv_path_python_plibs="-L${PYTHON_CONFDIR} -lpython${vi_cv_var_python_version}" dnl -- Check if the path contained in python_LINKFORSHARED is - dnl usable for vim build. If not, make and try other + dnl usable for mnv build. If not, make and try other dnl candidates. if test -n "${python_LINKFORSHARED}" && test -n "${python_PYTHONFRAMEWORKPREFIX}"; then python_link_symbol=`echo ${python_LINKFORSHARED} | sed 's/\([[^ \t]][[^ \t]]*[[ \t]][[ \t]]*[[^ \t]][[^ \t]]*\)[[ \t]].*/\1/'` @@ -1471,13 +1471,13 @@ eof threadsafe_flag= thread_lib= dnl if test "x$MACOS_X" != "xyes"; then - if test "$vim_cv_uname_output" != Darwin; then + if test "$mnv_cv_uname_output" != Darwin; then test "$GCC" = yes && threadsafe_flag="-pthread" - if test "$vim_cv_uname_output" = FreeBSD; then + if test "$mnv_cv_uname_output" = FreeBSD; then threadsafe_flag="-D_THREAD_SAFE" thread_lib="-pthread" fi - if test "$vim_cv_uname_output" = SunOS; then + if test "$mnv_cv_uname_output" = SunOS; then threadsafe_flag="-pthreads" fi fi @@ -1732,13 +1732,13 @@ eof threadsafe_flag= thread_lib= dnl if test "x$MACOS_X" != "xyes"; then - if test "$vim_cv_uname_output" != Darwin; then + if test "$mnv_cv_uname_output" != Darwin; then test "$GCC" = yes && threadsafe_flag="-pthread" - if test "$vim_cv_uname_output" = FreeBSD; then + if test "$mnv_cv_uname_output" = FreeBSD; then threadsafe_flag="-D_THREAD_SAFE" thread_lib="-pthread" fi - if test "$vim_cv_uname_output" = SunOS; then + if test "$mnv_cv_uname_output" = SunOS; then threadsafe_flag="-pthreads" fi fi @@ -1811,7 +1811,7 @@ if test "$python_ok" = yes && test "$python3_ok" = yes; then #include /* If this program fails, then RTLD_GLOBAL is needed. * RTLD_GLOBAL will be used and then it is not possible to - * have both python versions enabled in the same vim instance. + * have both python versions enabled in the same mnv instance. * Only the first python version used will be switched on. */ @@ -1857,7 +1857,7 @@ if test "$python_ok" = yes && test "$python3_ok" = yes; then #include /* If this program fails, then RTLD_GLOBAL is needed. * RTLD_GLOBAL will be used and then it is not possible to - * have both python versions enabled in the same vim instance. + * have both python versions enabled in the same mnv instance. * Only the first python version used will be switched on. */ @@ -2052,8 +2052,8 @@ if test "$enable_tclinterp" = "yes" -o "$enable_tclinterp" = "dynamic"; then if test -f "$try/lib$trylib" ; then AC_MSG_RESULT($try/lib$trylib) TCL_LIBS="-L\"$try\" -ltcl$ver -ldl -lm" - if test "$vim_cv_uname_output" = SunOS && - echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then + if test "$mnv_cv_uname_output" = SunOS && + echo $mnv_cv_uname_r_output | grep '^5' >/dev/null; then TCL_LIBS="$TCL_LIBS -R $try" fi break 3 @@ -2242,7 +2242,7 @@ if test "$enable_channel" = "yes"; then AC_CHECK_LIB(nsl, gethostbyname) fi - AC_CACHE_CHECK([whether compiling with IPv6 networking is possible], [vim_cv_ipv6_networking], + AC_CACHE_CHECK([whether compiling with IPv6 networking is possible], [mnv_cv_ipv6_networking], [AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include @@ -2269,14 +2269,14 @@ if test "$enable_channel" = "yes"; then (void)connect(1, (struct sockaddr *)&server, sizeof(server)); (void)freeaddrinfo(res); ])], - [vim_cv_ipv6_networking="yes"], - [vim_cv_ipv6_networking="no"])]) + [mnv_cv_ipv6_networking="yes"], + [mnv_cv_ipv6_networking="no"])]) - if test "x$vim_cv_ipv6_networking" = "xyes"; then + if test "x$mnv_cv_ipv6_networking" = "xyes"; then AC_DEFINE(FEAT_IPV6) AC_CHECK_FUNCS(inet_ntop) else - AC_CACHE_CHECK([whether compiling with IPv4 networking is possible], [vim_cv_ipv4_networking], + AC_CACHE_CHECK([whether compiling with IPv4 networking is possible], [mnv_cv_ipv4_networking], [AC_LINK_IFELSE([AC_LANG_PROGRAM([ #include #include @@ -2301,8 +2301,8 @@ if test "$enable_channel" = "yes"; then if (errno == ECONNREFUSED) (void)connect(1, (struct sockaddr *)&server, sizeof(server)); ])], - [vim_cv_ipv4_networking="yes"], - [vim_cv_ipv4_networking="no"; enable_netbeans="no"; enable_channel="no"])]) + [mnv_cv_ipv4_networking="yes"], + [mnv_cv_ipv4_networking="no"; enable_netbeans="no"; enable_channel="no"])]) fi fi if test "$enable_netbeans" = "yes"; then @@ -2356,7 +2356,7 @@ fi AC_MSG_CHECKING(--enable-autoservername argument) AC_ARG_ENABLE(autoservername, - [ --enable-autoservername Automatically define servername at vim startup.], , + [ --enable-autoservername Automatically define servername at mnv startup.], , [enable_autoservername="no"]) AC_MSG_RESULT($enable_autoservername) if test "$enable_autoservername" = "yes"; then @@ -2386,10 +2386,10 @@ AC_ARG_ENABLE(multibyte, AC_MSG_RESULT($enable_multibyte) if test "$enable_multibyte" != "yes"; then AC_MSG_ERROR([The multi-byte feature can no longer be disabled. If you have - a problem with this, discuss on the Vim mailing list.]) + a problem with this, discuss on the MNV mailing list.]) fi -dnl Right-to-Left language support for Vim will be included with huge features, +dnl Right-to-Left language support for MNV will be included with huge features, dnl unless ENABLE_RIGHTLEFT is undefined. AC_MSG_CHECKING(--disable-rightleft argument) AC_ARG_ENABLE(rightleft, @@ -2402,7 +2402,7 @@ else AC_DEFINE(DISABLE_RIGHTLEFT) fi -dnl Arabic language support for Vim will be included with huge features, +dnl Arabic language support for MNV will be included with huge features, dnl unless ENABLE_ARABIC is undefined. AC_MSG_CHECKING(--disable-arabic argument) AC_ARG_ENABLE(arabic, @@ -2536,8 +2536,8 @@ else x_libraries=`echo "$x_includes" | sed s/include/lib/` AC_MSG_RESULT(Corrected X libraries to $x_libraries) X_LIBS="$X_LIBS -L$x_libraries" - if test "$vim_cv_uname_output" = SunOS && - echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then + if test "$mnv_cv_uname_output" = SunOS && + echo $mnv_cv_uname_r_output | grep '^5' >/dev/null; then X_LIBS="$X_LIBS -R $x_libraries" fi fi @@ -2932,7 +2932,7 @@ AC_DEFUN([GNOME_INIT_HOOK], dnl On FreeBSD we need -pthread but pkg-config doesn't include it. dnl This might not be the right way but it works for me... AC_MSG_CHECKING(for FreeBSD) - if test "$vim_cv_uname_output" = FreeBSD; then + if test "$mnv_cv_uname_output" = FreeBSD; then AC_MSG_RESULT(yes, adding -pthread) GNOME_INCLUDEDIR="$GNOME_INCLUDEDIR -D_THREAD_SAFE" GNOME_LIBS="$GNOME_LIBS -pthread" @@ -3165,8 +3165,8 @@ if test -z "$SKIP_MOTIF"; then else if test -n "$GUI_LIB_LOC"; then AC_MSG_RESULT($GUI_LIB_LOC) - if test "$vim_cv_uname_output" = SunOS && - echo $vim_cv_uname_r_output | grep '^5' >/dev/null; then + if test "$mnv_cv_uname_output" = SunOS && + echo $mnv_cv_uname_r_output | grep '^5' >/dev/null; then GUI_LIB_LOC="$GUI_LIB_LOC -R $GUI_LIB_LOC" fi fi @@ -3369,7 +3369,7 @@ fi dnl Check for Cygwin, which needs an extra source file if not using X11 AC_MSG_CHECKING(for CYGWIN or MSYS environment) -case $vim_cv_uname_output in +case $mnv_cv_uname_output in CYGWIN*|MSYS*) CYGWIN=yes; AC_MSG_RESULT(yes) AC_MSG_CHECKING(for CYGWIN clipboard support) if test "x$with_x" = "xno" ; then @@ -3385,7 +3385,7 @@ esac dnl Checks for libraries and include files. -AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken], +AC_CACHE_CHECK([whether toupper is broken], [mnv_cv_toupper_broken], [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include "confdefs.h" @@ -3396,15 +3396,15 @@ AC_CACHE_CHECK([whether toupper is broken], [vim_cv_toupper_broken], #endif int main() { exit(toupper('A') == 'A' && tolower('z') == 'z'); } ]])],[ - vim_cv_toupper_broken=yes + mnv_cv_toupper_broken=yes ],[ - vim_cv_toupper_broken=no + mnv_cv_toupper_broken=no ],[ - vim_cv_toupper_broken=no - AC_MSG_WARN(cross-compiling: consider setting 'vim_cv_toupper_broken') + mnv_cv_toupper_broken=no + AC_MSG_WARN(cross-compiling: consider setting 'mnv_cv_toupper_broken') ])]) -if test "x$vim_cv_toupper_broken" = "xyes" ; then +if test "x$mnv_cv_toupper_broken" = "xyes" ; then AC_DEFINE(BROKEN_TOUPPER) fi @@ -3585,7 +3585,7 @@ else dnl Older versions of ncurses have bugs, get a new one! dnl Digital Unix (OSF1) should use curses (Ronald Schild). dnl On SCO Openserver should prefer termlib (Roger Cornelius). - case "$vim_cv_uname_output" in + case "$mnv_cv_uname_output" in OSF1|SCO_SV) tlibs="tinfo ncurses curses termlib termcap";; *) tlibs="tinfo ncurses termlib termcap curses";; esac @@ -3628,7 +3628,7 @@ if test "x$olibs" = "x$LIBS"; then Or specify the name of the library with --with-tlib.])) fi -AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo], +AC_CACHE_CHECK([whether we talk terminfo], [mnv_cv_terminfo], [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include "confdefs.h" @@ -3650,20 +3650,20 @@ AC_CACHE_CHECK([whether we talk terminfo], [vim_cv_terminfo], int main() {char *s; s=(char *)tgoto("%p1%d", 0, 1); exit(!!strcmp(s==0 ? "" : s, "1")); } ]])],[ - vim_cv_terminfo=yes + mnv_cv_terminfo=yes ],[ - vim_cv_terminfo=no + mnv_cv_terminfo=no ],[ - vim_cv_terminfo=yes - AC_MSG_WARN(cross-compiling: consider setting 'vim_cv_terminfo') + mnv_cv_terminfo=yes + AC_MSG_WARN(cross-compiling: consider setting 'mnv_cv_terminfo') ]) ]) -if test "x$vim_cv_terminfo" = "xyes" ; then +if test "x$mnv_cv_terminfo" = "xyes" ; then AC_DEFINE(TERMINFO) fi -AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgetent], +AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [mnv_cv_tgetent], [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include "confdefs.h" @@ -3677,16 +3677,16 @@ AC_CACHE_CHECK([what tgetent() returns for an unknown terminal], [vim_cv_tgetent int main() {char s[10000]; int res = tgetent(s, "thisterminaldoesnotexist"); exit(res != 0); } ]])],[ - vim_cv_tgetent=zero + mnv_cv_tgetent=zero ],[ - vim_cv_tgetent=non-zero + mnv_cv_tgetent=non-zero ],[ - vim_cv_tgetent=zero - AC_MSG_WARN(cross-compiling: consider setting 'vim_cv_tgetent') + mnv_cv_tgetent=zero + AC_MSG_WARN(cross-compiling: consider setting 'mnv_cv_tgetent') ]) ]) -if test "x$vim_cv_tgetent" = "xzero" ; then +if test "x$mnv_cv_tgetent" = "xzero" ; then AC_DEFINE(TGETENT_ZERO_ERR, 0) fi @@ -3828,7 +3828,7 @@ int test_sig() dnl tricky stuff: try to find out if getcwd() is implemented with dnl system("sh -c pwd") -AC_CACHE_CHECK([getcwd implementation is broken], [vim_cv_getcwd_broken], +AC_CACHE_CHECK([getcwd implementation is broken], [mnv_cv_getcwd_broken], [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include "confdefs.h" @@ -3844,16 +3844,16 @@ int main() return getcwd(buffer, 500) ? 0 : 1; } ]])],[ - vim_cv_getcwd_broken=no + mnv_cv_getcwd_broken=no ],[ - vim_cv_getcwd_broken=yes + mnv_cv_getcwd_broken=yes ],[ - vim_cv_getcwd_broken=no - AC_MSG_WARN(cross-compiling: consider setting 'vim_cv_getcwd_broken') + mnv_cv_getcwd_broken=no + AC_MSG_WARN(cross-compiling: consider setting 'mnv_cv_getcwd_broken') ]) ]) -if test "x$vim_cv_getcwd_broken" = "xyes" ; then +if test "x$mnv_cv_getcwd_broken" = "xyes" ; then AC_DEFINE(BAD_GETCWD) AC_CHECK_FUNCS(getwd) fi @@ -3983,44 +3983,44 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM( AC_MSG_RESULT(no)) dnl Check for timer_create. It probably requires the 'rt' library. -AC_CACHE_CHECK([for timer_create without -lrt], [vim_cv_timer_create], [ +AC_CACHE_CHECK([for timer_create without -lrt], [mnv_cv_timer_create], [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include ], [ timer_create(CLOCK_MONOTONIC, NULL, NULL); ])], - vim_cv_timer_create=yes, - vim_cv_timer_create=no + mnv_cv_timer_create=yes, + mnv_cv_timer_create=no )]) dnl If the previous failed, check for timer_create() and linking with -lrt. -if test "x$vim_cv_timer_create" = "xno" ; then +if test "x$mnv_cv_timer_create" = "xno" ; then save_LIBS="$LIBS" LIBS="$LIBS -lrt" - AC_CACHE_CHECK([for timer_create with -lrt], [vim_cv_timer_create_with_lrt], [ + AC_CACHE_CHECK([for timer_create with -lrt], [mnv_cv_timer_create_with_lrt], [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ #include ], [ timer_create(CLOCK_MONOTONIC, NULL, NULL); ])], - vim_cv_timer_create_with_lrt=yes, - vim_cv_timer_create_with_lrt=no + mnv_cv_timer_create_with_lrt=yes, + mnv_cv_timer_create_with_lrt=no )]) LIBS="$save_LIBS" else - vim_cv_timer_create_with_lrt=no + mnv_cv_timer_create_with_lrt=no fi dnl Run the program to find out if timer_create(CLOCK_MONOTONIC) actually dnl works, on Solaris timer_create() exists but fails at runtime. -if test "x$vim_cv_timer_create" = "xyes" || - test "x$vim_cv_timer_create_with_lrt" = "xyes"; then +if test "x$mnv_cv_timer_create" = "xyes" || + test "x$mnv_cv_timer_create_with_lrt" = "xyes"; then save_LIBS="$LIBS" - if test "x$vim_cv_timer_create_with_lrt" = "xyes" ; then + if test "x$mnv_cv_timer_create_with_lrt" = "xyes" ; then LIBS="$LIBS -lrt" fi - AC_CACHE_CHECK([if timer_create works], [vim_cv_timer_create_works], [ + AC_CACHE_CHECK([if timer_create works], [mnv_cv_timer_create_works], [ AC_RUN_IFELSE([AC_LANG_PROGRAM([ #if STDC_HEADERS # include @@ -4039,20 +4039,20 @@ if test "x$vim_cv_timer_create" = "xyes" || if (timer_create(CLOCK_MONOTONIC, &action, &timer_id) < 0) exit(1); // cannot create a monotonic timer ])], - vim_cv_timer_create_works=yes, - vim_cv_timer_create_works=no, - vim_cv_timer_create_works=yes - AC_MSG_WARN([cross-compiling: consider setting 'vim_cv_timer_create_works']) + mnv_cv_timer_create_works=yes, + mnv_cv_timer_create_works=no, + mnv_cv_timer_create_works=yes + AC_MSG_WARN([cross-compiling: consider setting 'mnv_cv_timer_create_works']) )]) - if test "x$vim_cv_timer_create_works" = "xyes" ; then + if test "x$mnv_cv_timer_create_works" = "xyes" ; then AC_DEFINE(HAVE_TIMER_CREATE) else LIBS="$save_LIBS" fi fi -AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_slash], +AC_CACHE_CHECK([whether stat() ignores a trailing slash], [mnv_cv_stat_ignores_slash], [ AC_RUN_IFELSE([AC_LANG_SOURCE([[ #include "confdefs.h" @@ -4064,16 +4064,16 @@ AC_CACHE_CHECK([whether stat() ignores a trailing slash], [vim_cv_stat_ignores_s #include int main() {struct stat st; exit(stat("configure/", &st) != 0); } ]])],[ - vim_cv_stat_ignores_slash=yes + mnv_cv_stat_ignores_slash=yes ],[ - vim_cv_stat_ignores_slash=no + mnv_cv_stat_ignores_slash=no ],[ - vim_cv_stat_ignores_slash=yes - AC_MSG_WARN(cross-compiling: consider setting 'vim_cv_stat_ignores_slash') + mnv_cv_stat_ignores_slash=yes + AC_MSG_WARN(cross-compiling: consider setting 'mnv_cv_stat_ignores_slash') ]) ]) -if test "x$vim_cv_stat_ignores_slash" = "xyes" ; then +if test "x$mnv_cv_stat_ignores_slash" = "xyes" ; then AC_DEFINE(STAT_IGNORES_SLASH) fi @@ -4419,8 +4419,8 @@ AC_CHECK_SIZEOF([time_t]) AC_CHECK_SIZEOF([off_t]) dnl Use different names to avoid clashing with other header files. -AC_DEFINE_UNQUOTED(VIM_SIZEOF_INT, [$ac_cv_sizeof_int]) -AC_DEFINE_UNQUOTED(VIM_SIZEOF_LONG, [$ac_cv_sizeof_long]) +AC_DEFINE_UNQUOTED(MNV_SIZEOF_INT, [$ac_cv_sizeof_int]) +AC_DEFINE_UNQUOTED(MNV_SIZEOF_LONG, [$ac_cv_sizeof_long]) dnl Make sure that uint32_t is really 32 bits unsigned. AC_MSG_CHECKING([uint32_t is 32 bits]) @@ -4466,52 +4466,52 @@ int main() { exit(0); /* libc version works properly. */ }'] -AC_CACHE_CHECK([whether memmove handles overlaps],[vim_cv_memmove_handles_overlap], +AC_CACHE_CHECK([whether memmove handles overlaps],[mnv_cv_memmove_handles_overlap], [ AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_memmove(s,d,l) memmove(d,s,l) $bcopy_test_prog]])], [ - vim_cv_memmove_handles_overlap=yes + mnv_cv_memmove_handles_overlap=yes ],[ - vim_cv_memmove_handles_overlap=no + mnv_cv_memmove_handles_overlap=no ],[ - vim_cv_memmove_handles_overlap=yes - AC_MSG_WARN(cross-compiling: consider setting 'vim_cv_memmove_handles_overlap') + mnv_cv_memmove_handles_overlap=yes + AC_MSG_WARN(cross-compiling: consider setting 'mnv_cv_memmove_handles_overlap') ]) ]) -if test "x$vim_cv_memmove_handles_overlap" = "xyes" ; then +if test "x$mnv_cv_memmove_handles_overlap" = "xyes" ; then AC_DEFINE(USEMEMMOVE) else - AC_CACHE_CHECK([whether bcopy handles overlaps],[vim_cv_bcopy_handles_overlap], + AC_CACHE_CHECK([whether bcopy handles overlaps],[mnv_cv_bcopy_handles_overlap], [ AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_bcopy(s,d,l) bcopy(d,s,l) $bcopy_test_prog]])], [ - vim_cv_bcopy_handles_overlap=yes + mnv_cv_bcopy_handles_overlap=yes ],[ - vim_cv_bcopy_handles_overlap=no + mnv_cv_bcopy_handles_overlap=no ],[ - vim_cv_bcopy_handles_overlap=yes - AC_MSG_WARN(cross-compiling: consider setting 'vim_cv_bcopy_handles_overlap') + mnv_cv_bcopy_handles_overlap=yes + AC_MSG_WARN(cross-compiling: consider setting 'mnv_cv_bcopy_handles_overlap') ]) ]) - if test "x$vim_cv_bcopy_handles_overlap" = "xyes" ; then + if test "x$mnv_cv_bcopy_handles_overlap" = "xyes" ; then AC_DEFINE(USEBCOPY) else - AC_CACHE_CHECK([whether memcpy handles overlaps],[vim_cv_memcpy_handles_overlap], + AC_CACHE_CHECK([whether memcpy handles overlaps],[mnv_cv_memcpy_handles_overlap], [ AC_RUN_IFELSE([AC_LANG_SOURCE([[#define mch_memcpy(s,d,l) memcpy(d,s,l) $bcopy_test_prog]])], [ - vim_cv_memcpy_handles_overlap=yes + mnv_cv_memcpy_handles_overlap=yes ],[ - vim_cv_memcpy_handles_overlap=no + mnv_cv_memcpy_handles_overlap=no ],[ - vim_cv_memcpy_handles_overlap=yes - AC_MSG_WARN(cross-compiling: consider setting 'vim_cv_memcpy_handles_overlap') + mnv_cv_memcpy_handles_overlap=yes + AC_MSG_WARN(cross-compiling: consider setting 'mnv_cv_memcpy_handles_overlap') ]) ]) - if test "x$vim_cv_memcpy_handles_overlap" = "xyes" ; then + if test "x$mnv_cv_memcpy_handles_overlap" = "xyes" ; then AC_DEFINE(USEMEMCPY) fi fi @@ -4655,7 +4655,7 @@ if test "$enable_nls" = "yes"; then AC_MSG_RESULT([broken]) else AC_MSG_RESULT([yes]) - MSGFMT_DESKTOP="gvim.desktop vim.desktop" + MSGFMT_DESKTOP="gmnv.desktop mnv.desktop" fi else AC_MSG_RESULT([no]) @@ -4779,7 +4779,7 @@ if `echo "$CFLAGS" | grep -v D_REENTRANT >/dev/null`; then fi dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to -dnl use "-isystem" instead of "-I" for all non-Vim include dirs. +dnl use "-isystem" instead of "-I" for all non-MNV include dirs. dnl But only when making dependencies, cproto and lint don't take "-isystem". dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow dnl the number before the version number. @@ -4793,7 +4793,7 @@ if test "$GCC" = yes; then else AC_MSG_RESULT(no) fi - dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is + dnl -D_FORTIFY_SOURCE=2 crashes MNV on strcpy(buf, "000") when buf is dnl declared as char x[1] but actually longer. Introduced in gcc 4.0. dnl Also remove duplicate _FORTIFY_SOURCE arguments. dnl And undefine it first to avoid a warning. @@ -4811,7 +4811,7 @@ AC_SUBST(DEPEND_CFLAGS_FILTER) dnl On some systems AC_SYS_LARGEFILE determines that -D_FILE_OFFSET_BITS=64 dnl isn't required, but the CFLAGS for some of the libraries we're using dnl include the define. Since the define changes the size of some datatypes -dnl (e.g. ino_t and off_t), all of Vim's modules must be compiled with a +dnl (e.g. ino_t and off_t), all of MNV's modules must be compiled with a dnl consistent value. It's therefore safest to force the use of the define dnl if it's present in any of the *_CFLAGS variables. AC_MSG_CHECKING(whether we need to force -D_FILE_OFFSET_BITS=64) @@ -4854,4 +4854,4 @@ dnl write output files AC_CONFIG_FILES(auto/config.mk:config.mk.in) AC_OUTPUT -dnl vim: set sw=2 sts=2 tw=78 fo+=l: +dnl mnv: set sw=2 sts=2 tw=78 fo+=l: diff --git a/uvim/src/create_cmdidxs.mnv b/uvim/src/create_cmdidxs.mnv new file mode 100644 index 0000000000..d9a25a8bf5 --- /dev/null +++ b/uvim/src/create_cmdidxs.mnv @@ -0,0 +1,104 @@ +" This script generates the tables cmdidxs1[] and cmdidxs2[][] which, +" given a Ex command, determine the first value to probe to find +" a matching command in cmdnames[] based on the first character +" and the first 2 characters of the command. +" This is used to speed up lookup in cmdnames[]. +" +" Script should be run every time new Ex commands are added in MNV, +" from the src/mnv directory, since it reads commands from "ex_cmds.h". + +let cmds = [] +let skipped_cmds = 0 + +let lines = readfile('ex_cmds.h') +let idx = 0 +while idx < len(lines) + let line = lines[idx] + if line =~ '^EXCMD(CMD_' + let m = matchlist(line, '^EXCMD(CMD_\S*,\s*"\([a-z][^"]*\)"') + if len(m) >= 2 + let cmds += [ m[1] ] + else + let skipped_cmds += 1 + endif + + let idx += 1 + let flags = lines[idx] + let idx += 1 + let addr_type = lines[idx] + + if flags =~ '\' + if addr_type =~ 'ADDR_NONE' + echoerr 'ex_cmds.h:' .. (idx - 1) .. ': Using EX_RANGE with ADDR_NONE: ' .. line + endif + else + if addr_type !~ 'ADDR_NONE' + echoerr 'ex_cmds.h:' .. (idx - 1) .. ': Missing ADDR_NONE: ' .. line + endif + endif + + if flags =~ '\' && (addr_type =~ 'ADDR_OTHER' || addr_type =~ 'ADDR_NONE') + echoerr 'ex_cmds.h:' .. (idx - 1) .. ': Missing misplaced EX_DFLALL: ' .. line + endif + endif + let idx += 1 +endwhile + +let cmdidxs1 = {} +let cmdidxs2 = {} + +for i in range(len(cmds) - 1, 0, -1) + let cmd = cmds[i] + let c1 = cmd[0] " First character of command + let c2 = cmd[1] " Second character of command (if any) + + let cmdidxs1{c1} = i + if c2 >= 'a' && c2 <= 'z' + let cmdidxs2{c1}{c2} = i + endif +endfor + +let output = [ '/* Automatically generated code by create_cmdidxs.mnv' ] +let output += [ ' *' ] +let output += [ ' * Table giving the index of the first command in cmdnames[] to lookup' ] +let output += [ ' * based on the first letter of a command.' ] +let output += [ ' */' ] +let output += [ 'static const unsigned short cmdidxs1[26] =' ] +let output += [ '{' ] + +let a_to_z = map(range(char2nr('a'), char2nr('z')), 'nr2char(v:val)') +for c1 in a_to_z + let line = ' /* ' . c1 . ' */ ' . cmdidxs1{c1} . ((c1 == 'z') ? '' : ',') + let output += [ line ] +endfor +let output += [ '};' ] +let output += [ '' ] +let output += [ '/*' ] +let output += [ ' * Table giving the index of the first command in cmdnames[] to lookup' ] +let output += [ ' * based on the first 2 letters of a command.' ] +let output += [ ' * Values in cmdidxs2[c1][c2] are relative to cmdidxs1[c1] so that they' ] +let output += [ ' * fit in a byte.' ] +let output += [ ' */' ] +let output += [ 'static const unsigned char cmdidxs2[26][26] =' ] +let output += [ '{ /* a b c d e f g h i j k l m n o p q r s t u v w x y z */' ] + +for c1 in a_to_z + let line = ' /* ' . c1 . ' */ {' + for c2 in a_to_z + if exists('cmdidxs2{c1}{c2}') + let line .= printf('%3d', cmdidxs2{c1}{c2} - cmdidxs1{c1}) + else + let line .= ' 0' + endif + let line .= (c2 == 'z') ? '' : ',' + endfor + let line .= ' }' . ((c1 == 'z') ? '' : ',') + let output += [ line ] +endfor + +let output += [ '};' ] +let output += [ '' ] +let output += [ 'static const int command_count = ' . (len(cmds) + skipped_cmds) . ';' ] + +call writefile(output, "ex_cmdidxs.h") +quit diff --git a/uvim/src/create_cmdidxs.vim b/uvim/src/create_cmdidxs.vim deleted file mode 100644 index 2f8ad1f7e1..0000000000 --- a/uvim/src/create_cmdidxs.vim +++ /dev/null @@ -1,104 +0,0 @@ -" This script generates the tables cmdidxs1[] and cmdidxs2[][] which, -" given a Ex command, determine the first value to probe to find -" a matching command in cmdnames[] based on the first character -" and the first 2 characters of the command. -" This is used to speed up lookup in cmdnames[]. -" -" Script should be run every time new Ex commands are added in Vim, -" from the src/vim directory, since it reads commands from "ex_cmds.h". - -let cmds = [] -let skipped_cmds = 0 - -let lines = readfile('ex_cmds.h') -let idx = 0 -while idx < len(lines) - let line = lines[idx] - if line =~ '^EXCMD(CMD_' - let m = matchlist(line, '^EXCMD(CMD_\S*,\s*"\([a-z][^"]*\)"') - if len(m) >= 2 - let cmds += [ m[1] ] - else - let skipped_cmds += 1 - endif - - let idx += 1 - let flags = lines[idx] - let idx += 1 - let addr_type = lines[idx] - - if flags =~ '\' - if addr_type =~ 'ADDR_NONE' - echoerr 'ex_cmds.h:' .. (idx - 1) .. ': Using EX_RANGE with ADDR_NONE: ' .. line - endif - else - if addr_type !~ 'ADDR_NONE' - echoerr 'ex_cmds.h:' .. (idx - 1) .. ': Missing ADDR_NONE: ' .. line - endif - endif - - if flags =~ '\' && (addr_type =~ 'ADDR_OTHER' || addr_type =~ 'ADDR_NONE') - echoerr 'ex_cmds.h:' .. (idx - 1) .. ': Missing misplaced EX_DFLALL: ' .. line - endif - endif - let idx += 1 -endwhile - -let cmdidxs1 = {} -let cmdidxs2 = {} - -for i in range(len(cmds) - 1, 0, -1) - let cmd = cmds[i] - let c1 = cmd[0] " First character of command - let c2 = cmd[1] " Second character of command (if any) - - let cmdidxs1{c1} = i - if c2 >= 'a' && c2 <= 'z' - let cmdidxs2{c1}{c2} = i - endif -endfor - -let output = [ '/* Automatically generated code by create_cmdidxs.vim' ] -let output += [ ' *' ] -let output += [ ' * Table giving the index of the first command in cmdnames[] to lookup' ] -let output += [ ' * based on the first letter of a command.' ] -let output += [ ' */' ] -let output += [ 'static const unsigned short cmdidxs1[26] =' ] -let output += [ '{' ] - -let a_to_z = map(range(char2nr('a'), char2nr('z')), 'nr2char(v:val)') -for c1 in a_to_z - let line = ' /* ' . c1 . ' */ ' . cmdidxs1{c1} . ((c1 == 'z') ? '' : ',') - let output += [ line ] -endfor -let output += [ '};' ] -let output += [ '' ] -let output += [ '/*' ] -let output += [ ' * Table giving the index of the first command in cmdnames[] to lookup' ] -let output += [ ' * based on the first 2 letters of a command.' ] -let output += [ ' * Values in cmdidxs2[c1][c2] are relative to cmdidxs1[c1] so that they' ] -let output += [ ' * fit in a byte.' ] -let output += [ ' */' ] -let output += [ 'static const unsigned char cmdidxs2[26][26] =' ] -let output += [ '{ /* a b c d e f g h i j k l m n o p q r s t u v w x y z */' ] - -for c1 in a_to_z - let line = ' /* ' . c1 . ' */ {' - for c2 in a_to_z - if exists('cmdidxs2{c1}{c2}') - let line .= printf('%3d', cmdidxs2{c1}{c2} - cmdidxs1{c1}) - else - let line .= ' 0' - endif - let line .= (c2 == 'z') ? '' : ',' - endfor - let line .= ' }' . ((c1 == 'z') ? '' : ',') - let output += [ line ] -endfor - -let output += [ '};' ] -let output += [ '' ] -let output += [ 'static const int command_count = ' . (len(cmds) + skipped_cmds) . ';' ] - -call writefile(output, "ex_cmdidxs.h") -quit diff --git a/uvim/src/create_nvcmdidxs.c b/uvim/src/create_nvcmdidxs.c index 1d084f5657..e9ae9fb19a 100644 --- a/uvim/src/create_nvcmdidxs.c +++ b/uvim/src/create_nvcmdidxs.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar et al. + * MNV - MNV is not Vim by Bram Moolenaar et al. * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -14,7 +14,7 @@ * decimal form, one per line. */ -#include "vim.h" +#include "mnv.h" // Declare nv_cmds[]. #include "nv_cmds.h" diff --git a/uvim/src/create_nvcmdidxs.mnv b/uvim/src/create_nvcmdidxs.mnv new file mode 100644 index 0000000000..3ed660f431 --- /dev/null +++ b/uvim/src/create_nvcmdidxs.mnv @@ -0,0 +1,60 @@ +" This script generates the table nv_cmd_idx[] which contains the index in +" nv_cmds[] table (normal.c) for each of the command character supported in +" normal/visual mode. +" This is used to speed up the command lookup in nv_cmds[]. +" +" Script should be run using "make nvcmdidxs", every time the nv_cmds[] table +" in src/nv_cmds.h changes. +" +" This is written in legacy MNV script so that it can be run by a slightly +" older MNV version. + +" Generate the table of normal/visual mode command characters and their +" corresponding index. +let cmd = 'create_nvcmdidxs' +if has('unix') + let cmd = './' .. cmd +endif +let nv_cmdtbl = systemlist(cmd)->map({i, ch -> {'idx': i, 'cmdchar': ch}}) + +" sort the table by the command character +call sort(nv_cmdtbl, {a, b -> a.cmdchar - b.cmdchar}) + +" Compute the highest index upto which the command character can be directly +" used as an index. +let nv_max_linear = 0 +for i in range(nv_cmdtbl->len()) + if i != nv_cmdtbl[i].cmdchar + let nv_max_linear = i - 1 + break + endif +endfor + +" Generate a header file with the table +let output =<< trim END + /* + * Automatically generated code by the create_nvcmdidxs.mnv script. + * + * Table giving the index in nv_cmds[] to lookup based on + * the command character. + */ + + // nv_cmd_idx[] => nv_cmds[] index + static const unsigned short nv_cmd_idx[] = + { +END + +" Add each command character in comment and the corresponding index +let output += nv_cmdtbl->map({_, v -> + \ printf(' /* %5d */ %3d,', v.cmdchar, v.idx)}) + +let output += ['};', '', + \ '// The highest index for which', + \ '// nv_cmds[idx].cmd_char == nv_cmd_idx[nv_cmds[idx].cmd_char]'] + +let output += ['static const int nv_max_linear = ' .. nv_max_linear .. ';'] + +call writefile(output, "nv_cmdidxs.h") +quit + +" mnv: shiftwidth=2 sts=2 expandtab diff --git a/uvim/src/create_nvcmdidxs.vim b/uvim/src/create_nvcmdidxs.vim deleted file mode 100644 index 13192761b3..0000000000 --- a/uvim/src/create_nvcmdidxs.vim +++ /dev/null @@ -1,60 +0,0 @@ -" This script generates the table nv_cmd_idx[] which contains the index in -" nv_cmds[] table (normal.c) for each of the command character supported in -" normal/visual mode. -" This is used to speed up the command lookup in nv_cmds[]. -" -" Script should be run using "make nvcmdidxs", every time the nv_cmds[] table -" in src/nv_cmds.h changes. -" -" This is written in legacy Vim script so that it can be run by a slightly -" older Vim version. - -" Generate the table of normal/visual mode command characters and their -" corresponding index. -let cmd = 'create_nvcmdidxs' -if has('unix') - let cmd = './' .. cmd -endif -let nv_cmdtbl = systemlist(cmd)->map({i, ch -> {'idx': i, 'cmdchar': ch}}) - -" sort the table by the command character -call sort(nv_cmdtbl, {a, b -> a.cmdchar - b.cmdchar}) - -" Compute the highest index upto which the command character can be directly -" used as an index. -let nv_max_linear = 0 -for i in range(nv_cmdtbl->len()) - if i != nv_cmdtbl[i].cmdchar - let nv_max_linear = i - 1 - break - endif -endfor - -" Generate a header file with the table -let output =<< trim END - /* - * Automatically generated code by the create_nvcmdidxs.vim script. - * - * Table giving the index in nv_cmds[] to lookup based on - * the command character. - */ - - // nv_cmd_idx[] => nv_cmds[] index - static const unsigned short nv_cmd_idx[] = - { -END - -" Add each command character in comment and the corresponding index -let output += nv_cmdtbl->map({_, v -> - \ printf(' /* %5d */ %3d,', v.cmdchar, v.idx)}) - -let output += ['};', '', - \ '// The highest index for which', - \ '// nv_cmds[idx].cmd_char == nv_cmd_idx[nv_cmds[idx].cmd_char]'] - -let output += ['static const int nv_max_linear = ' .. nv_max_linear .. ';'] - -call writefile(output, "nv_cmdidxs.h") -quit - -" vim: shiftwidth=2 sts=2 expandtab diff --git a/uvim/src/crypt.c b/uvim/src/crypt.c index 794594f910..566aadfb09 100644 --- a/uvim/src/crypt.c +++ b/uvim/src/crypt.c @@ -1,16 +1,16 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * crypt.c: Generic encryption support. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_CRYPT) /* @@ -92,7 +92,7 @@ static cryptmethod_T cryptmethods[CRYPT_M_COUNT] = { // PK_Zip; very weak { "zip", - "VimCrypt~01!", + "MNVCrypt~01!", 0, 0, 0, @@ -110,7 +110,7 @@ static cryptmethod_T cryptmethods[CRYPT_M_COUNT] = { // Blowfish/CFB + SHA-256 custom key derivation; implementation issues. { "blowfish", - "VimCrypt~02!", + "MNVCrypt~02!", 8, 8, 0, @@ -128,7 +128,7 @@ static cryptmethod_T cryptmethods[CRYPT_M_COUNT] = { // Blowfish/CFB + SHA-256 custom key derivation; fixed. { "blowfish2", - "VimCrypt~03!", + "MNVCrypt~03!", 8, 8, 0, @@ -146,7 +146,7 @@ static cryptmethod_T cryptmethods[CRYPT_M_COUNT] = { // XChaCha20 using libsodium; implementation issues { "xchacha20", - "VimCrypt~04!", + "MNVCrypt~04!", #ifdef FEAT_SODIUM crypto_pwhash_argon2id_SALTBYTES, // 16 #else @@ -167,7 +167,7 @@ static cryptmethod_T cryptmethods[CRYPT_M_COUNT] = { // XChaCha20 using libsodium; stores parameters in header { "xchacha20v2", - "VimCrypt~05!", + "MNVCrypt~05!", #ifdef FEAT_SODIUM crypto_pwhash_argon2id_SALTBYTES, // 16 #else @@ -204,7 +204,7 @@ typedef struct { # ifdef DYNAMIC_SODIUM # ifdef MSWIN # define SODIUM_PROC FARPROC -# define load_dll vimLoadLib +# define load_dll mnvLoadLib # define symbol_from_dll GetProcAddress # define close_dll FreeLibrary # define load_dll_error GetWin32Error @@ -342,7 +342,7 @@ sodium_enabled(int verbose) #endif #define CRYPT_MAGIC_LEN 12 // cannot change -static char crypt_magic_head[] = "VimCrypt~"; +static char crypt_magic_head[] = "MNVCrypt~"; /* * Return int value for crypt method name. @@ -466,7 +466,7 @@ crypt_get_max_header_len(void) crypt_set_cm_option(buf_T *buf, int method_nr) { free_string_option(buf->b_p_cm); - buf->b_p_cm = vim_strsave((char_u *)cryptmethods[method_nr].name); + buf->b_p_cm = mnv_strsave((char_u *)cryptmethods[method_nr].name); } /* @@ -501,7 +501,7 @@ crypt_create( state->method_nr = method_nr; if (cryptmethods[method_nr].init_fn(state, key, crypt_arg) == FAIL) { - vim_free(state); + mnv_free(state); return NULL; } return state; @@ -564,12 +564,12 @@ crypt_create_from_file(FILE *fp, char_u *key) && fread(buffer + CRYPT_MAGIC_LEN, header_len - CRYPT_MAGIC_LEN, 1, fp) != 1) { - vim_free(buffer); + mnv_free(buffer); return NULL; } state = crypt_create_from_header(method_nr, key, buffer); - vim_free(buffer); + mnv_free(buffer); return state; } @@ -630,7 +630,7 @@ crypt_create_for_writing( } state = crypt_create(method_nr, key, &arg); if (state == NULL) - VIM_CLEAR(*header); + MNV_CLEAR(*header); return state; } @@ -650,8 +650,8 @@ crypt_free_state(cryptstate_T *state) } else #endif - vim_free(state->method_state); - vim_free(state); + mnv_free(state->method_state); + mnv_free(state); } #ifdef CRYPT_NOT_INPLACE @@ -781,7 +781,7 @@ crypt_decode_inplace( crypt_free_key(char_u *key) { // Create a safe memset which cannot be optimized away by compiler - static void *(* volatile vim_memset_safe)(void *s, int c, size_t n) = + static void *(* volatile mnv_memset_safe)(void *s, int c, size_t n) = memset; if (key != NULL) { @@ -790,8 +790,8 @@ crypt_free_key(char_u *key) sodium_memzero(key, STRLEN(key)); else #endif - vim_memset_safe(key, 0, STRLEN(key)); - vim_free(key); + mnv_memset_safe(key, 0, STRLEN(key)); + mnv_free(key); } } @@ -979,7 +979,7 @@ crypt_sodium_init_( { char_u buffer[20]; char_u *p = buffer; - vim_memset(buffer, 0, 20); + mnv_memset(buffer, 0, 20); crypt_long_long_to_char(opslimit, p); p += sizeof(opslimit); @@ -995,7 +995,7 @@ crypt_sodium_init_( { char_u buffer[20]; char_u *p = buffer; - vim_memset(buffer, 0, 20); + mnv_memset(buffer, 0, 20); int size = sizeof(opslimit) + sizeof(memlimit) + sizeof(alg); @@ -1173,7 +1173,7 @@ crypt_sodium_decode( mch_memmove(p2, buf_out, buf_len); fail: - vim_free(buf_out); + mnv_free(buf_out); # endif } #endif diff --git a/uvim/src/crypt_zip.c b/uvim/src/crypt_zip.c index e9b39a30d3..d11f47a584 100644 --- a/uvim/src/crypt_zip.c +++ b/uvim/src/crypt_zip.c @@ -1,16 +1,16 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * crypt_zip.c: Zip encryption support. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_CRYPT) /* diff --git a/uvim/src/debugger.c b/uvim/src/debugger.c index dc8a5b3e94..c6395eb505 100644 --- a/uvim/src/debugger.c +++ b/uvim/src/debugger.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* - * debugger.c: Vim script debugger functions + * debugger.c: MNV script debugger functions */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) static int debug_greedy = FALSE; // batch mode debugging: don't save @@ -97,17 +97,17 @@ do_debug(char_u *cmd) if (debug_oldval != NULL) { smsg(_("Oldval = \"%s\""), debug_oldval); - VIM_CLEAR(debug_oldval); + MNV_CLEAR(debug_oldval); } if (debug_newval != NULL) { smsg(_("Newval = \"%s\""), debug_newval); - VIM_CLEAR(debug_newval); + MNV_CLEAR(debug_newval); } sname = estack_sfile(ESTACK_NONE); if (sname != NULL) msg((char *)sname); - vim_free(sname); + mnv_free(sname); if (SOURCING_LNUM != 0) smsg(_("line %ld: %s"), SOURCING_LNUM, cmd); else @@ -138,7 +138,7 @@ do_debug(char_u *cmd) n = debug_break_level; debug_break_level = -1; - vim_free(cmdline); + mnv_free(cmdline); cmdline = getcmdline_prompt('>', NULL, 0, EXPAND_NOTHING, NULL); debug_break_level = n; @@ -285,7 +285,7 @@ do_debug(char_u *cmd) } lines_left = Rows - 1; } - vim_free(cmdline); + mnv_free(cmdline); if (RedrawingDisabled > 0) --RedrawingDisabled; @@ -358,7 +358,7 @@ do_checkbacktracelevel(void) debug_backtrace_level = max; smsg(_("frame at highest level: %d"), max); } - vim_free(sname); + mnv_free(sname); } } @@ -391,7 +391,7 @@ do_showbacktrace(char_u *cmd) *next = '.'; cur = next + 2; } - vim_free(sname); + mnv_free(sname); } if (SOURCING_LNUM != 0) @@ -573,7 +573,7 @@ eval_expr_no_emsg(struct debuggy *bp) { typval_T *tv; - // Disable error messages, a bad expression would make Vim unusable. + // Disable error messages, a bad expression would make MNV unusable. ++emsg_off; tv = eval_expr(bp->dbg_name, NULL); --emsg_off; @@ -640,7 +640,7 @@ dbg_parsearg( #ifdef FEAT_PROFILE gap != &prof_ga && #endif - VIM_ISDIGIT(*p)) + MNV_ISDIGIT(*p)) { bp->dbg_lnum = getdigits(&p); p = skipwhite(p); @@ -658,12 +658,12 @@ dbg_parsearg( } if (bp->dbg_type == DBG_FUNC) - bp->dbg_name = vim_strsave(STRNCMP(p, "g:", 2) == 0 ? p + 2 : p); + bp->dbg_name = mnv_strsave(STRNCMP(p, "g:", 2) == 0 ? p + 2 : p); else if (here) - bp->dbg_name = vim_strsave(curbuf->b_ffname); + bp->dbg_name = mnv_strsave(curbuf->b_ffname); else if (bp->dbg_type == DBG_EXPR) { - bp->dbg_name = vim_strsave(p); + bp->dbg_name = mnv_strsave(p); if (bp->dbg_name != NULL) bp->dbg_val = eval_expr_no_emsg(bp); } @@ -676,13 +676,13 @@ dbg_parsearg( if (q == NULL) return FAIL; p = expand_env_save(q); - vim_free(q); + mnv_free(q); if (p == NULL) return FAIL; if (*p != '*') { bp->dbg_name = fix_fname(p); - vim_free(p); + mnv_free(p); } else bp->dbg_name = p; @@ -720,11 +720,11 @@ ex_breakadd(exarg_T *eap) pat = file_pat_to_reg_pat(bp->dbg_name, NULL, NULL, FALSE); if (pat != NULL) { - bp->dbg_prog = vim_regcomp(pat, RE_MAGIC + RE_STRING); - vim_free(pat); + bp->dbg_prog = mnv_regcomp(pat, RE_MAGIC + RE_STRING); + mnv_free(pat); } if (pat == NULL || bp->dbg_prog == NULL) - vim_free(bp->dbg_name); + mnv_free(bp->dbg_name); else { if (bp->dbg_lnum == 0) // default line number is 1 @@ -810,7 +810,7 @@ ex_breakdel(exarg_T *eap) #endif } - if (vim_isdigit(*eap->arg)) + if (mnv_isdigit(*eap->arg)) { // ":breakdel {nr}" nr = atol((char *)eap->arg); @@ -846,7 +846,7 @@ ex_breakdel(exarg_T *eap) best_lnum = bpi->dbg_lnum; } } - vim_free(bp->dbg_name); + mnv_free(bp->dbg_name); } if (todel < 0) @@ -857,13 +857,13 @@ ex_breakdel(exarg_T *eap) while (gap->ga_len > 0) { - vim_free(DEBUGGY(gap, todel).dbg_name); + mnv_free(DEBUGGY(gap, todel).dbg_name); #ifdef FEAT_EVAL if (DEBUGGY(gap, todel).dbg_type == DBG_EXPR && DEBUGGY(gap, todel).dbg_val != NULL) free_tv(DEBUGGY(gap, todel).dbg_val); #endif - vim_regfree(DEBUGGY(gap, todel).dbg_prog); + mnv_regfree(DEBUGGY(gap, todel).dbg_prog); --gap->ga_len; if (todel < gap->ga_len) mch_memmove(&DEBUGGY(gap, todel), &DEBUGGY(gap, todel + 1), @@ -1059,7 +1059,7 @@ debuggy_find( // Also match a script-specific name. if (!is_file && fname[0] == K_SPECIAL) { - short_name = vim_strchr(fname, '_') + 1; + short_name = mnv_strchr(fname, '_') + 1; name = alloc(STRLEN(fname) + 3); if (name != NULL) { @@ -1086,8 +1086,8 @@ debuggy_find( prev_got_int = got_int; got_int = FALSE; if ((name != NULL - && vim_regexec_prog(&bp->dbg_prog, FALSE, name, (colnr_T)0)) - || vim_regexec_prog(&bp->dbg_prog, FALSE, + && mnv_regexec_prog(&bp->dbg_prog, FALSE, name, (colnr_T)0)) + || mnv_regexec_prog(&bp->dbg_prog, FALSE, short_name, (colnr_T)0)) { lnum = bp->dbg_lnum; @@ -1111,10 +1111,10 @@ debuggy_find( { if (bp->dbg_val == NULL) { - vim_free(debug_oldval); + mnv_free(debug_oldval); debug_oldval = typval_tostring(NULL, TRUE); bp->dbg_val = tv; - vim_free(debug_newval); + mnv_free(debug_newval); debug_newval = typval_tostring(bp->dbg_val, TRUE); line = TRUE; } @@ -1131,12 +1131,12 @@ debuggy_find( typval_T *v; line = TRUE; - vim_free(debug_oldval); + mnv_free(debug_oldval); debug_oldval = typval_tostring(bp->dbg_val, TRUE); // Need to evaluate again, typval_compare() overwrites // "tv". v = eval_expr_no_emsg(bp); - vim_free(debug_newval); + mnv_free(debug_newval); debug_newval = typval_tostring(v, TRUE); free_tv(bp->dbg_val); bp->dbg_val = v; @@ -1146,9 +1146,9 @@ debuggy_find( } else if (bp->dbg_val != NULL) { - vim_free(debug_oldval); + mnv_free(debug_oldval); debug_oldval = typval_tostring(bp->dbg_val, TRUE); - vim_free(debug_newval); + mnv_free(debug_newval); debug_newval = typval_tostring(NULL, TRUE); free_tv(bp->dbg_val); bp->dbg_val = NULL; @@ -1164,7 +1164,7 @@ debuggy_find( #endif } if (name != fname) - vim_free(name); + mnv_free(name); return lnum; } diff --git a/uvim/src/dict.c b/uvim/src/dict.c index aea40b3389..230378e4a2 100644 --- a/uvim/src/dict.c +++ b/uvim/src/dict.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * dict.c: Dictionary support */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) @@ -155,7 +155,7 @@ dict_free_dict(dict_T *d) d->dv_used_prev->dv_used_next = d->dv_used_next; if (d->dv_used_next != NULL) d->dv_used_next->dv_used_prev = d->dv_used_prev; - vim_free(d); + mnv_free(d); } static void @@ -282,7 +282,7 @@ dictitem_free(dictitem_T *item) { clear_tv(&item->di_tv); if (item->di_flags & DI_FLAGS_ALLOC) - vim_free(item); + mnv_free(item); } /* @@ -331,7 +331,7 @@ dict_copy(dict_T *orig, int deep, int top, int copyID) if (item_copy(&HI2DI(hi)->di_tv, &di->di_tv, deep, FALSE, copyID) == FAIL) { - vim_free(di); + mnv_free(di); break; } } @@ -356,14 +356,14 @@ dict_copy(dict_T *orig, int deep, int top, int copyID) } /* - * Check for adding a function to g: or s: (in Vim9 script) or l:. + * Check for adding a function to g: or s: (in MNV9 script) or l:. * If the name is wrong give an error message and return TRUE. */ int dict_wrong_func_name(dict_T *d, typval_T *tv, char_u *name) { return (d == get_globvar_dict() - || (in_vim9script() && SCRIPT_ID_VALID(current_sctx.sc_sid) + || (in_mnv9script() && SCRIPT_ID_VALID(current_sctx.sc_sid) && d == &SCRIPT_ITEM(current_sctx.sc_sid)->sn_vars->sv_dict) || &d->dv_hashtab == get_funccal_local_ht()) && (tv->v_type == VAR_FUNC || tv->v_type == VAR_PARTIAL) @@ -457,9 +457,9 @@ dict_add_string_len(dict_T *d, char *key, char_u *str, int len) if (str != NULL) { if (len == -1) - val = vim_strsave(str); + val = mnv_strsave(str); else - val = vim_strnsave(str, len); + val = mnv_strnsave(str, len); } item->di_tv.vval.v_string = val; if (dict_add(d, item) == FAIL) @@ -548,7 +548,7 @@ dict_add_func(dict_T *d, char *key, ufunc_T *fp) if (item == NULL) return FAIL; item->di_tv.v_type = VAR_FUNC; - item->di_tv.vval.v_string = vim_strnsave(fp->uf_name, fp->uf_namelen); + item->di_tv.vval.v_string = mnv_strnsave(fp->uf_name, fp->uf_namelen); if (dict_add(d, item) == FAIL) { dictitem_free(item); @@ -661,7 +661,7 @@ dict_find(dict_T *d, char_u *key, int len) akey = key; else if (len >= AKEYLEN) { - tofree = akey = vim_strnsave(key, len); + tofree = akey = mnv_strnsave(key, len); if (akey == NULL) return NULL; } @@ -674,7 +674,7 @@ dict_find(dict_T *d, char_u *key, int len) } hi = hash_find(&d->dv_hashtab, akey); - vim_free(tofree); + mnv_free(tofree); if (HASHITEM_EMPTY(hi)) return NULL; return HI2DI(hi); @@ -722,7 +722,7 @@ dict_get_string(dict_T *d, char *key, int save) return NULL; s = tv_get_string(&di->di_tv); if (save && s != NULL) - s = vim_strsave(s); + s = mnv_strsave(s); return s; } @@ -824,14 +824,14 @@ dict2string(typval_T *tv, int copyID, int restore_copyID) if (tofree != NULL) { ga_concat(&ga, tofree); - vim_free(tofree); + mnv_free(tofree); } GA_CONCAT_LITERAL(&ga, ": "); s = echo_string_core(&HI2DI(hi)->di_tv, &tofree, numbuf, copyID, FALSE, restore_copyID, TRUE); if (s != NULL) ga_concat(&ga, s); - vim_free(tofree); + mnv_free(tofree); if (s == NULL || did_echo_string_emsg) break; line_breakcheck(); @@ -840,7 +840,7 @@ dict2string(typval_T *tv, int copyID, int restore_copyID) } if (todo > 0) { - vim_free(ga.ga_data); + mnv_free(ga.ga_data); return NULL; } @@ -875,14 +875,14 @@ get_literal_key_tv(char_u **arg, typval_T *tv) if (p == *arg) return FAIL; tv->v_type = VAR_STRING; - tv->vval.v_string = vim_strnsave(*arg, p - *arg); + tv->vval.v_string = mnv_strnsave(*arg, p - *arg); *arg = p; return OK; } /* - * Get a literal key for a Vim9 dict: + * Get a literal key for a MNV9 dict: * {"name": value}, * {'name': value}, * {name: value} use "name" as a literal key @@ -916,7 +916,7 @@ get_literal_key(char_u **arg) semsg(_(e_invalid_key_str), *arg); return NULL; } - key = vim_strnsave(*arg, end - *arg); + key = mnv_strnsave(*arg, end - *arg); *arg = end; } return key; @@ -940,7 +940,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal) dictitem_T *item; char_u *curly_expr = skipwhite(*arg + 1); char_u buf[NUMBUFLEN]; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); int had_comma; // First check if it's not a curly-braces expression: {expr}. @@ -949,7 +949,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal) // first item. // "{}" is an empty Dictionary. // "#{abc}" is never a curly-braces expression. - if (!vim9script + if (!mnv9script && *curly_expr != '}' && !literal && eval1(&curly_expr, &tv, NULL) == OK @@ -968,14 +968,14 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal) *arg = skipwhite_and_linebreak(*arg + 1, evalarg); while (**arg != '}' && **arg != NUL) { - int has_bracket = vim9script && **arg == '['; + int has_bracket = mnv9script && **arg == '['; if (literal) { if (get_literal_key_tv(arg, &tvkey) == FAIL) goto failret; } - else if (vim9script && !has_bracket) + else if (mnv9script && !has_bracket) { tvkey.vval.v_string = get_literal_key(arg); if (tvkey.vval.v_string == NULL) @@ -1002,8 +1002,8 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal) } // the colon should come right after the key, but this wasn't checked - // previously, so only require it in Vim9 script. - if (!vim9script) + // previously, so only require it in MNV9 script. + if (!mnv9script) *arg = skipwhite(*arg); if (**arg != ':') { @@ -1029,7 +1029,7 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal) goto failret; } } - if (vim9script && (*arg)[1] != NUL && !VIM_ISWHITE((*arg)[1])) + if (mnv9script && (*arg)[1] != NUL && !MNV_ISWHITE((*arg)[1])) { semsg(_(e_white_space_required_after_str_str), ":", *arg); clear_tv(&tvkey); @@ -1070,13 +1070,13 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal) clear_tv(&tvkey); // the comma should come right after the value, but this wasn't checked - // previously, so only require it in Vim9 script. - if (!vim9script) + // previously, so only require it in MNV9 script. + if (!mnv9script) *arg = skipwhite(*arg); had_comma = **arg == ','; if (had_comma) { - if (vim9script && !IS_WHITE_NL_OR_NUL((*arg)[1])) + if (mnv9script && !IS_WHITE_NL_OR_NUL((*arg)[1])) { semsg(_(e_white_space_required_after_str_str), ",", *arg); goto failret; @@ -1124,12 +1124,12 @@ failret: int eval_lit_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg) { - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); int ret = OK; - if (vim9script) + if (mnv9script) { - ret = vim9_bad_comment(*arg) ? FAIL : NOTDONE; + ret = mnv9_bad_comment(*arg) ? FAIL : NOTDONE; } else if ((*arg)[1] == '{') { @@ -1451,9 +1451,9 @@ dict_filter_map( || var_check_ro(di->di_flags, arg_errmsg, TRUE))) break; - set_vim_var_string(VV_KEY, di->di_key, -1); + set_mnv_var_string(VV_KEY, di->di_key, -1); r = filter_map_one(&di->di_tv, expr, filtermap, fc, &newtv, &rem); - clear_tv(get_vim_var_tv(VV_KEY)); + clear_tv(get_mnv_var_tv(VV_KEY)); if (r == FAIL || did_emsg) { clear_tv(&newtv); @@ -1584,7 +1584,7 @@ dict2list(typval_T *argvars, typval_T *rettv, dict2list_T what) // keys() li->li_tv.v_type = VAR_STRING; li->li_tv.v_lock = 0; - li->li_tv.vval.v_string = vim_strsave(di->di_key); + li->li_tv.vval.v_string = mnv_strsave(di->di_key); } else if (what == DICT2LIST_VALUES) { @@ -1662,7 +1662,7 @@ dict_set_items_ro(dict_T *di) void f_has_key(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_dict_arg(argvars, 0) == FAIL || check_for_string_or_number_arg(argvars, 1) == FAIL)) return; diff --git a/uvim/src/diff.c b/uvim/src/diff.c index 9ac64d7f6a..fac2da64df 100644 --- a/uvim/src/diff.c +++ b/uvim/src/diff.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -16,7 +16,7 @@ * - Let 'diffexpr' do the work, using files. */ -#include "vim.h" +#include "mnv.h" #include "xdiff/xdiff.h" #if defined(FEAT_DIFF) @@ -130,7 +130,7 @@ static int parse_diffanchors(int check_only, buf_T *buf, linenr_T *anchors, int clear_diffblock(diff_T *dp) { ga_clear(&dp->df_changes); - vim_free(dp); + mnv_free(dp); } /* @@ -657,7 +657,7 @@ diff_check_unchanged(tabpage_T *tp, diff_T *dp) // Copy the line, the next ml_get() will invalidate it. if (dir == BACKWARD) off_org = dp->df_count[i_org] - 1; - line_org = vim_strsave(ml_get_buf(tp->tp_diffbuf[i_org], + line_org = mnv_strsave(ml_get_buf(tp->tp_diffbuf[i_org], dp->df_lnum[i_org] + off_org, FALSE)); if (line_org == NULL) return; @@ -674,7 +674,7 @@ diff_check_unchanged(tabpage_T *tp, diff_T *dp) dp->df_lnum[i_new] + off_new, FALSE)) != 0) break; } - vim_free(line_org); + mnv_free(line_org); // Stop when a line isn't equal in all diff buffers. if (i_new != DB_COUNT) @@ -775,7 +775,7 @@ diff_redraw( clear_diffin(diffin_T *din) { if (din->din_fname == NULL) - VIM_CLEAR(din->din_mmfile.ptr); + MNV_CLEAR(din->din_mmfile.ptr); else mch_remove(din->din_fname); } @@ -912,7 +912,7 @@ diff_write(buf_T *buf, diffin_T *din, linenr_T start, linenr_T end) // Always use 'fileformat' set to "unix". save_ml_flags = buf->b_ml.ml_flags; save_ff = buf->b_p_ff; - buf->b_p_ff = vim_strsave((char_u *)FF_UNIX); + buf->b_p_ff = mnv_strsave((char_u *)FF_UNIX); save_cmod_flags = cmdmod.cmod_flags; // Writing the buffer is an implementation detail of performing the diff, // so it shouldn't update the '[ and '] marks. @@ -965,9 +965,9 @@ diff_try_update( else { // We need three temp file names. - dio->dio_orig.din_fname = vim_tempname('o', TRUE); - dio->dio_new.din_fname = vim_tempname('n', TRUE); - dio->dio_diff.dout_fname = vim_tempname('d', TRUE); + dio->dio_orig.din_fname = mnv_tempname('o', TRUE); + dio->dio_new.din_fname = mnv_tempname('n', TRUE); + dio->dio_diff.dout_fname = mnv_tempname('d', TRUE); if (dio->dio_orig.din_fname == NULL || dio->dio_new.din_fname == NULL || dio->dio_diff.dout_fname == NULL) @@ -1096,9 +1096,9 @@ diff_try_update( } theend: - vim_free(dio->dio_orig.din_fname); - vim_free(dio->dio_new.din_fname); - vim_free(dio->dio_diff.dout_fname); + mnv_free(dio->dio_orig.din_fname); + mnv_free(dio->dio_new.din_fname); + mnv_free(dio->dio_diff.dout_fname); } /* @@ -1240,7 +1240,7 @@ check_external_diff(diffio_T *diffio) { // For normal diff there must be a line that contains // "1c1". For unified diff "@@ -1 +1 @@". - if (vim_fgets(linebuf, LBUFLEN, fd)) + if (mnv_fgets(linebuf, LBUFLEN, fd)) break; if (STRNCMP(linebuf, "1c1", 3) == 0 || STRNCMP(linebuf, "@@ -1 +1 @@", 11) == 0) @@ -1383,12 +1383,12 @@ diff_file(diffio_T *dio) // We don't want $DIFF_OPTIONS to get in the way. if (getenv("DIFF_OPTIONS")) - vim_setenv((char_u *)"DIFF_OPTIONS", (char_u *)""); + mnv_setenv((char_u *)"DIFF_OPTIONS", (char_u *)""); // Build the diff command and execute it. Always use -a, binary // differences are of no use. Ignore errors, diff returns // non-zero when differences have been found. - vim_snprintf((char *)cmd, len, "diff %s%s%s%s%s%s%s%s %s", + mnv_snprintf((char *)cmd, len, "diff %s%s%s%s%s%s%s%s %s", diff_a_works == FALSE ? "" : "-a ", # if defined(MSWIN) diff_bin_works == TRUE ? "--binary " : "", @@ -1405,7 +1405,7 @@ diff_file(diffio_T *dio) block_autocmds(); // avoid ShellCmdPost stuff (void)call_shell(cmd, SHELL_FILTER|SHELL_SILENT|SHELL_DOOUT); unblock_autocmds(); - vim_free(cmd); + mnv_free(cmd); return OK; } @@ -1448,8 +1448,8 @@ ex_diffpatch(exarg_T *eap) # endif // We need two temp file names. - tmp_orig = vim_tempname('o', FALSE); - tmp_new = vim_tempname('n', FALSE); + tmp_orig = mnv_tempname('o', FALSE); + tmp_new = mnv_tempname('n', FALSE); if (tmp_orig == NULL || tmp_new == NULL) goto theend; @@ -1463,7 +1463,7 @@ ex_diffpatch(exarg_T *eap) // Get the absolute path of the patchfile, changing directory below. fullname = FullName_save(eap->arg, FALSE); # endif - esc_name = vim_strsave_shellescape( + esc_name = mnv_strsave_shellescape( # ifdef UNIX fullname != NULL ? fullname : # endif @@ -1486,11 +1486,11 @@ ex_diffpatch(exarg_T *eap) else { # ifdef TEMPDIRNAMES - if (vim_tempdir != NULL) - vim_ignored = mch_chdir((char *)vim_tempdir); + if (mnv_tempdir != NULL) + mnv_ignored = mch_chdir((char *)mnv_tempdir); else # endif - vim_ignored = mch_chdir("/tmp"); + mnv_ignored = mch_chdir("/tmp"); shorten_fnames(TRUE); } # endif @@ -1511,7 +1511,7 @@ ex_diffpatch(exarg_T *eap) // Build the patch command and execute it. Ignore errors. Switch to // cooked mode to allow the user to respond to prompts. - vim_snprintf((char *)buf, buflen, "patch -o %s %s < %s", + mnv_snprintf((char *)buf, buflen, "patch -o %s %s < %s", tmp_new, tmp_orig, esc_name); block_autocmds(); // Avoid ShellCmdPost stuff (void)call_shell(buf, SHELL_FILTER | SHELL_COOKED); @@ -1545,7 +1545,7 @@ ex_diffpatch(exarg_T *eap) { if (curbuf->b_fname != NULL) { - newname = vim_strnsave(curbuf->b_fname, + newname = mnv_strnsave(curbuf->b_fname, STRLEN(curbuf->b_fname) + 4); if (newname != NULL) STRCAT(newname, ".new"); @@ -1589,18 +1589,18 @@ ex_diffpatch(exarg_T *eap) theend: if (tmp_orig != NULL) mch_remove(tmp_orig); - vim_free(tmp_orig); + mnv_free(tmp_orig); if (tmp_new != NULL) mch_remove(tmp_new); - vim_free(tmp_new); - vim_free(newname); - vim_free(buf); + mnv_free(tmp_new); + mnv_free(newname); + mnv_free(buf); # ifdef UNIX - vim_free(fullname); + mnv_free(fullname); # endif - vim_free(esc_name); + mnv_free(esc_name); # ifdef FEAT_BROWSE - vim_free(browseFile); + mnv_free(browseFile); cmdmod.cmod_flags = save_cmod_flags; # endif } @@ -1712,7 +1712,7 @@ diff_win_options( { if (wp->w_p_diff_saved) free_string_option(wp->w_p_fdm_save); - wp->w_p_fdm_save = vim_strsave(wp->w_p_fdm); + wp->w_p_fdm_save = mnv_strsave(wp->w_p_fdm); } set_string_option_direct_in_win(wp, (char_u *)"fdm", -1, (char_u *)"diff", OPT_LOCAL|OPT_FREE, 0); @@ -1729,7 +1729,7 @@ diff_win_options( // make sure topline is not halfway a fold changed_window_setting_win(wp); # endif - if (vim_strchr(p_sbo, 'h') == NULL) + if (mnv_strchr(p_sbo, 'h') == NULL) do_cmdline_cmd((char_u *)"set sbo+=hor"); // Save the current values, to be restored in ex_diffoff(). wp->w_p_diff_saved = TRUE; @@ -1777,7 +1777,7 @@ ex_diffoff(exarg_T *eap) } # ifdef FEAT_FOLDING free_string_option(wp->w_p_fdm); - wp->w_p_fdm = vim_strsave( + wp->w_p_fdm = mnv_strsave( *wp->w_p_fdm_save ? wp->w_p_fdm_save : (char_u*)"manual"); if (wp->w_p_fdc == diff_foldcolumn) @@ -1820,7 +1820,7 @@ ex_diffoff(exarg_T *eap) } // Remove "hor" from 'scrollopt' if there are no diff windows left. - if (!diffwin && vim_strchr(p_sbo, 'h') != NULL) + if (!diffwin && mnv_strchr(p_sbo, 'h') != NULL) do_cmdline_cmd((char_u *)"set sbo-=hor"); } @@ -1895,7 +1895,7 @@ diff_read( } else { - if (vim_fgets(linebuf, LBUFLEN, fd)) + if (mnv_fgets(linebuf, LBUFLEN, fd)) break; // end of file line = linebuf; } @@ -1917,9 +1917,9 @@ diff_read( else if ((STRNCMP(line, "@@ ", 3) == 0)) diffstyle = DIFF_UNIFIED; else if ((STRNCMP(line, "--- ", 4) == 0) - && (vim_fgets(linebuf, LBUFLEN, fd) == 0) + && (mnv_fgets(linebuf, LBUFLEN, fd) == 0) && (STRNCMP(line, "+++ ", 4) == 0) - && (vim_fgets(linebuf, LBUFLEN, fd) == 0) + && (mnv_fgets(linebuf, LBUFLEN, fd) == 0) && (STRNCMP(line, "@@ ", 3) == 0)) diffstyle = DIFF_UNIFIED; else @@ -2082,7 +2082,7 @@ diff_read( done: if (!dio->dio_internal) - vim_free(hunk); + mnv_free(hunk); if (fd != NULL) fclose(fd); @@ -2417,7 +2417,7 @@ run_linematch_algorithm(diff_T *dp) linematch_nbuffers(diffbufs, diff_length, ndiffs, &decisions, iwhite); for (size_t i = 0; i < ndiffs; i++) - free(diffbufs_mm[i].din_mmfile.ptr); // TODO should this be vim_free ? + free(diffbufs_mm[i].din_mmfile.ptr); // TODO should this be mnv_free ? apply_linematch_results(dp, decisions_length, decisions); @@ -2582,13 +2582,13 @@ diff_equal_entry(diff_T *dp, int idx1, int idx2) return FALSE; for (i = 0; i < dp->df_count[idx1]; ++i) { - line = vim_strsave(ml_get_buf(curtab->tp_diffbuf[idx1], + line = mnv_strsave(ml_get_buf(curtab->tp_diffbuf[idx1], dp->df_lnum[idx1] + i, FALSE)); if (line == NULL) return FALSE; cmp = diff_cmp(line, ml_get_buf(curtab->tp_diffbuf[idx2], dp->df_lnum[idx2] + i, FALSE)); - vim_free(line); + mnv_free(line); if (cmp != 0) return FALSE; } @@ -2653,9 +2653,9 @@ diff_cmp(char_u *s1, char_u *s2) while (*p1 != NUL && *p2 != NUL) { if (((diff_flags & DIFF_IWHITE) - && VIM_ISWHITE(*p1) && VIM_ISWHITE(*p2)) + && MNV_ISWHITE(*p1) && MNV_ISWHITE(*p2)) || ((diff_flags & DIFF_IWHITEALL) - && (VIM_ISWHITE(*p1) || VIM_ISWHITE(*p2)))) + && (MNV_ISWHITE(*p1) || MNV_ISWHITE(*p2)))) { p1 = skipwhite(p1); p2 = skipwhite(p2); @@ -2904,7 +2904,7 @@ diffopt_changed(void) p += 6; diff_flags_new |= DIFF_ANCHOR; } - else if (STRNCMP(p, "context:", 8) == 0 && VIM_ISDIGIT(p[8])) + else if (STRNCMP(p, "context:", 8) == 0 && MNV_ISDIGIT(p[8])) { p += 8; diff_context_new = getdigits(&p); @@ -2944,7 +2944,7 @@ diffopt_changed(void) p += 8; diff_flags_new |= DIFF_VERTICAL; } - else if (STRNCMP(p, "foldcolumn:", 11) == 0 && VIM_ISDIGIT(p[11])) + else if (STRNCMP(p, "foldcolumn:", 11) == 0 && MNV_ISDIGIT(p[11])) { p += 11; diff_foldcolumn_new = getdigits(&p); @@ -3032,7 +3032,7 @@ diffopt_changed(void) else return FAIL; } - else if (STRNCMP(p, "linematch:", 10) == 0 && VIM_ISDIGIT(p[10])) + else if (STRNCMP(p, "linematch:", 10) == 0 && MNV_ISDIGIT(p[10])) { p += 10; linematch_lines_new = getdigits(&p); @@ -3215,7 +3215,7 @@ diff_find_change_simple( else { // Make a copy of the line, the next ml_get() will invalidate it. - line_org = vim_strsave(ml_get_buf(wp->w_buffer, lnum, FALSE)); + line_org = mnv_strsave(ml_get_buf(wp->w_buffer, lnum, FALSE)); if (line_org == NULL) return FALSE; } @@ -3240,11 +3240,11 @@ diff_find_change_simple( while (line_org[si_org] != NUL) { if (((diff_flags & DIFF_IWHITE) - && VIM_ISWHITE(line_org[si_org]) - && VIM_ISWHITE(line_new[si_new])) + && MNV_ISWHITE(line_org[si_org]) + && MNV_ISWHITE(line_new[si_new])) || ((diff_flags & DIFF_IWHITEALL) - && (VIM_ISWHITE(line_org[si_org]) - || VIM_ISWHITE(line_new[si_new])))) + && (MNV_ISWHITE(line_org[si_org]) + || MNV_ISWHITE(line_new[si_new])))) { si_org = (int)(skipwhite(line_org + si_org) - line_org); si_new = (int)(skipwhite(line_new + si_new) - line_new); @@ -3277,17 +3277,17 @@ diff_find_change_simple( && ei_org >= 0 && ei_new >= 0) { if (((diff_flags & DIFF_IWHITE) - && VIM_ISWHITE(line_org[ei_org]) - && VIM_ISWHITE(line_new[ei_new])) + && MNV_ISWHITE(line_org[ei_org]) + && MNV_ISWHITE(line_new[ei_new])) || ((diff_flags & DIFF_IWHITEALL) - && (VIM_ISWHITE(line_org[ei_org]) - || VIM_ISWHITE(line_new[ei_new])))) + && (MNV_ISWHITE(line_org[ei_org]) + || MNV_ISWHITE(line_new[ei_new])))) { while (ei_org >= *startp - && VIM_ISWHITE(line_org[ei_org])) + && MNV_ISWHITE(line_org[ei_org])) --ei_org; while (ei_new >= si_new - && VIM_ISWHITE(line_new[ei_new])) + && MNV_ISWHITE(line_new[ei_new])) --ei_new; } else @@ -3307,7 +3307,7 @@ diff_find_change_simple( } } - vim_free(line_org); + mnv_free(line_org); return added; } @@ -3619,7 +3619,7 @@ diff_find_change_inline_diff( // For multibyte chars, only treat alphanumeric chars // (class 2) as "word", as other classes such as emojis and // CJK ideographs do not usually benefit from word diff as - // Vim doesn't have a good way to segment them. + // MNV doesn't have a good way to segment them. new_in_keyword = (mb_get_class_buf(s, curtab->tp_diffbuf[file1_idx]) == 2); } if (in_keyword && !new_in_keyword) @@ -3628,7 +3628,7 @@ diff_find_change_inline_diff( numlines++; } - if (VIM_ISWHITE(*s)) + if (MNV_ISWHITE(*s)) { if (diff_flags & DIFF_IWHITEALL) { @@ -3666,7 +3666,7 @@ diff_find_change_inline_diff( { char_len = mb_ptr2len(s); - if (VIM_ISWHITE(*s) && (diff_flags & DIFF_IWHITE)) + if (MNV_ISWHITE(*s) && (diff_flags & DIFF_IWHITE)) // Treat the entire white space span as a single char. char_len = skipwhite(s) - s; @@ -4032,7 +4032,7 @@ nv_diffgetput(int put, long count) # ifdef FEAT_JOB_CHANNEL if (bt_prompt(curbuf)) { - vim_beep(BO_OPER); + mnv_beep(BO_OPER); return; } # endif @@ -4040,7 +4040,7 @@ nv_diffgetput(int put, long count) ea.arg = (char_u *)""; else { - vim_snprintf((char *)buf, 30, "%ld", count); + mnv_snprintf((char *)buf, 30, "%ld", count); ea.arg = buf; } if (put) @@ -4137,9 +4137,9 @@ ex_diffgetput(exarg_T *eap) { // Buffer number or pattern given. Ignore trailing white space. p = eap->arg + STRLEN(eap->arg); - while (p > eap->arg && VIM_ISWHITE(p[-1])) + while (p > eap->arg && MNV_ISWHITE(p[-1])) --p; - for (i = 0; vim_isdigit(eap->arg[i]) && eap->arg + i < p; ++i) + for (i = 0; mnv_isdigit(eap->arg[i]) && eap->arg + i < p; ++i) ; if (eap->arg + i == p) // digits only i = atol((char *)eap->arg); @@ -4306,12 +4306,12 @@ ex_diffgetput(exarg_T *eap) nr = dp->df_lnum[idx_from] + start_skip + i; if (nr > curtab->tp_diffbuf[idx_from]->b_ml.ml_line_count) break; - p = vim_strsave(ml_get_buf(curtab->tp_diffbuf[idx_from], + p = mnv_strsave(ml_get_buf(curtab->tp_diffbuf[idx_from], nr, FALSE)); if (p != NULL) { ml_append(lnum + i - 1, p, 0, FALSE); - vim_free(p); + mnv_free(p); ++added; if (buf_empty && curbuf->b_ml.ml_line_count == 2) { @@ -4789,7 +4789,7 @@ xdiff_out_indices( if (ga_grow(&dout->dout_ga, 1) == FAIL) { - vim_free(p); + mnv_free(p); return -1; } @@ -4831,7 +4831,7 @@ xdiff_out_unified( f_diff_filler(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { # ifdef FEAT_DIFF - if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_lnum_arg(argvars, 0) == FAIL) return; rettv->vval.v_number = diff_check_fill(curwin, tv_get_lnum(argvars)); @@ -4859,7 +4859,7 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED) CLEAR_FIELD(diffline); - if (in_vim9script() + if (in_mnv9script() && (check_for_lnum_arg(argvars,0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; @@ -5036,7 +5036,7 @@ list_to_diffin(list_T *l, diffin_T *din, int icase) ga_concat(&ga, str); ga_append(&ga, NL); if (icase) - vim_free(str); + mnv_free(str); } din->din_mmfile.ptr = (char *)ga.ga_data; @@ -5148,7 +5148,7 @@ f_diff(typval_T *argvars UNUSED, typval_T *rettv UNUSED) ga_append(&dio.dio_diff.dout_ga, NUL); rettv->v_type = VAR_STRING; rettv->vval.v_string = - vim_strsave((char_u *)dio.dio_diff.dout_ga.ga_data); + mnv_strsave((char_u *)dio.dio_diff.dout_ga.ga_data); } done: diff --git a/uvim/src/digraph.c b/uvim/src/digraph.c index 4320e57a37..fc5ee04e74 100644 --- a/uvim/src/digraph.c +++ b/uvim/src/digraph.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * digraph.c: code for digraphs */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_DIGRAPHS) @@ -118,152 +118,152 @@ static digr_T digraphdefault[] = { {'N', 'S', 0xa0}, # define DG_START_LATIN 0xa1 {'!', 'I', 0xa1}, - {'~', '!', 0xa1}, // ¡ Vim 5.x compatible + {'~', '!', 0xa1}, // ¡ MNV 5.x compatible {'C', 't', 0xa2}, - {'c', '|', 0xa2}, // ¢ Vim 5.x compatible + {'c', '|', 0xa2}, // ¢ MNV 5.x compatible {'P', 'd', 0xa3}, - {'$', '$', 0xa3}, // £ Vim 5.x compatible + {'$', '$', 0xa3}, // £ MNV 5.x compatible {'C', 'u', 0xa4}, - {'o', 'x', 0xa4}, // ¤ Vim 5.x compatible + {'o', 'x', 0xa4}, // ¤ MNV 5.x compatible {'Y', 'e', 0xa5}, - {'Y', '-', 0xa5}, // Â¥ Vim 5.x compatible + {'Y', '-', 0xa5}, // Â¥ MNV 5.x compatible {'B', 'B', 0xa6}, - {'|', '|', 0xa6}, // ¦ Vim 5.x compatible + {'|', '|', 0xa6}, // ¦ MNV 5.x compatible {'S', 'E', 0xa7}, {'\'', ':', 0xa8}, {'C', 'o', 0xa9}, - {'c', 'O', 0xa9}, // © Vim 5.x compatible + {'c', 'O', 0xa9}, // © MNV 5.x compatible {'-', 'a', 0xaa}, {'<', '<', 0xab}, {'N', 'O', 0xac}, - {'-', ',', 0xac}, // ¬ Vim 5.x compatible + {'-', ',', 0xac}, // ¬ MNV 5.x compatible {'-', '-', 0xad}, {'R', 'g', 0xae}, {'\'', 'm', 0xaf}, - {'-', '=', 0xaf}, // ¯ Vim 5.x compatible + {'-', '=', 0xaf}, // ¯ MNV 5.x compatible {'D', 'G', 0xb0}, - {'~', 'o', 0xb0}, // ° Vim 5.x compatible + {'~', 'o', 0xb0}, // ° MNV 5.x compatible {'+', '-', 0xb1}, {'2', 'S', 0xb2}, - {'2', '2', 0xb2}, // ² Vim 5.x compatible + {'2', '2', 0xb2}, // ² MNV 5.x compatible {'3', 'S', 0xb3}, - {'3', '3', 0xb3}, // ³ Vim 5.x compatible + {'3', '3', 0xb3}, // ³ MNV 5.x compatible {'\'', '\'', 0xb4}, {'M', 'y', 0xb5}, {'P', 'I', 0xb6}, - {'p', 'p', 0xb6}, // ¶ Vim 5.x compatible + {'p', 'p', 0xb6}, // ¶ MNV 5.x compatible {'.', 'M', 0xb7}, - {'~', '.', 0xb7}, // · Vim 5.x compatible + {'~', '.', 0xb7}, // · MNV 5.x compatible {'\'', ',', 0xb8}, {'1', 'S', 0xb9}, - {'1', '1', 0xb9}, // ¹ Vim 5.x compatible + {'1', '1', 0xb9}, // ¹ MNV 5.x compatible {'-', 'o', 0xba}, {'>', '>', 0xbb}, {'1', '4', 0xbc}, {'1', '2', 0xbd}, {'3', '4', 0xbe}, {'?', 'I', 0xbf}, - {'~', '?', 0xbf}, // ¿ Vim 5.x compatible + {'~', '?', 0xbf}, // ¿ MNV 5.x compatible {'A', '!', 0xc0}, - {'A', '`', 0xc0}, // À Vim 5.x compatible + {'A', '`', 0xc0}, // À MNV 5.x compatible {'A', '\'', 0xc1}, {'A', '>', 0xc2}, - {'A', '^', 0xc2}, //  Vim 5.x compatible + {'A', '^', 0xc2}, //  MNV 5.x compatible {'A', '?', 0xc3}, - {'A', '~', 0xc3}, // à Vim 5.x compatible + {'A', '~', 0xc3}, // à MNV 5.x compatible {'A', ':', 0xc4}, - {'A', '"', 0xc4}, // Ä Vim 5.x compatible + {'A', '"', 0xc4}, // Ä MNV 5.x compatible {'A', 'A', 0xc5}, - {'A', '@', 0xc5}, // Ã… Vim 5.x compatible + {'A', '@', 0xc5}, // Ã… MNV 5.x compatible {'A', 'E', 0xc6}, {'C', ',', 0xc7}, {'E', '!', 0xc8}, - {'E', '`', 0xc8}, // È Vim 5.x compatible + {'E', '`', 0xc8}, // È MNV 5.x compatible {'E', '\'', 0xc9}, {'E', '>', 0xca}, - {'E', '^', 0xca}, // Ê Vim 5.x compatible + {'E', '^', 0xca}, // Ê MNV 5.x compatible {'E', ':', 0xcb}, - {'E', '"', 0xcb}, // Ë Vim 5.x compatible + {'E', '"', 0xcb}, // Ë MNV 5.x compatible {'I', '!', 0xcc}, - {'I', '`', 0xcc}, // ÃŒ Vim 5.x compatible + {'I', '`', 0xcc}, // ÃŒ MNV 5.x compatible {'I', '\'', 0xcd}, {'I', '>', 0xce}, - {'I', '^', 0xce}, // ÃŽ Vim 5.x compatible + {'I', '^', 0xce}, // ÃŽ MNV 5.x compatible {'I', ':', 0xcf}, - {'I', '"', 0xcf}, // à Vim 5.x compatible + {'I', '"', 0xcf}, // à MNV 5.x compatible {'D', '-', 0xd0}, {'N', '?', 0xd1}, - {'N', '~', 0xd1}, // Ñ Vim 5.x compatible + {'N', '~', 0xd1}, // Ñ MNV 5.x compatible {'O', '!', 0xd2}, - {'O', '`', 0xd2}, // Ã’ Vim 5.x compatible + {'O', '`', 0xd2}, // Ã’ MNV 5.x compatible {'O', '\'', 0xd3}, {'O', '>', 0xd4}, - {'O', '^', 0xd4}, // Ô Vim 5.x compatible + {'O', '^', 0xd4}, // Ô MNV 5.x compatible {'O', '?', 0xd5}, - {'O', '~', 0xd5}, // Õ Vim 5.x compatible + {'O', '~', 0xd5}, // Õ MNV 5.x compatible {'O', ':', 0xd6}, {'*', 'X', 0xd7}, - {'/', '\\', 0xd7}, // × Vim 5.x compatible + {'/', '\\', 0xd7}, // × MNV 5.x compatible {'O', '/', 0xd8}, {'U', '!', 0xd9}, - {'U', '`', 0xd9}, // Ù Vim 5.x compatible + {'U', '`', 0xd9}, // Ù MNV 5.x compatible {'U', '\'', 0xda}, {'U', '>', 0xdb}, - {'U', '^', 0xdb}, // Û Vim 5.x compatible + {'U', '^', 0xdb}, // Û MNV 5.x compatible {'U', ':', 0xdc}, {'Y', '\'', 0xdd}, {'T', 'H', 0xde}, - {'I', 'p', 0xde}, // Þ Vim 5.x compatible + {'I', 'p', 0xde}, // Þ MNV 5.x compatible {'s', 's', 0xdf}, {'a', '!', 0xe0}, - {'a', '`', 0xe0}, // à Vim 5.x compatible + {'a', '`', 0xe0}, // à MNV 5.x compatible {'a', '\'', 0xe1}, {'a', '>', 0xe2}, - {'a', '^', 0xe2}, // â Vim 5.x compatible + {'a', '^', 0xe2}, // â MNV 5.x compatible {'a', '?', 0xe3}, - {'a', '~', 0xe3}, // ã Vim 5.x compatible + {'a', '~', 0xe3}, // ã MNV 5.x compatible {'a', ':', 0xe4}, - {'a', '"', 0xe4}, // ä Vim 5.x compatible + {'a', '"', 0xe4}, // ä MNV 5.x compatible {'a', 'a', 0xe5}, - {'a', '@', 0xe5}, // Ã¥ Vim 5.x compatible + {'a', '@', 0xe5}, // Ã¥ MNV 5.x compatible {'a', 'e', 0xe6}, {'c', ',', 0xe7}, {'e', '!', 0xe8}, - {'e', '`', 0xe8}, // è Vim 5.x compatible + {'e', '`', 0xe8}, // è MNV 5.x compatible {'e', '\'', 0xe9}, {'e', '>', 0xea}, - {'e', '^', 0xea}, // ê Vim 5.x compatible + {'e', '^', 0xea}, // ê MNV 5.x compatible {'e', ':', 0xeb}, - {'e', '"', 0xeb}, // ë Vim 5.x compatible + {'e', '"', 0xeb}, // ë MNV 5.x compatible {'i', '!', 0xec}, - {'i', '`', 0xec}, // ì Vim 5.x compatible + {'i', '`', 0xec}, // ì MNV 5.x compatible {'i', '\'', 0xed}, {'i', '>', 0xee}, - {'i', '^', 0xee}, // î Vim 5.x compatible + {'i', '^', 0xee}, // î MNV 5.x compatible {'i', ':', 0xef}, {'d', '-', 0xf0}, {'n', '?', 0xf1}, - {'n', '~', 0xf1}, // ñ Vim 5.x compatible + {'n', '~', 0xf1}, // ñ MNV 5.x compatible {'o', '!', 0xf2}, - {'o', '`', 0xf2}, // ò Vim 5.x compatible + {'o', '`', 0xf2}, // ò MNV 5.x compatible {'o', '\'', 0xf3}, {'o', '>', 0xf4}, - {'o', '^', 0xf4}, // ô Vim 5.x compatible + {'o', '^', 0xf4}, // ô MNV 5.x compatible {'o', '?', 0xf5}, - {'o', '~', 0xf5}, // õ Vim 5.x compatible + {'o', '~', 0xf5}, // õ MNV 5.x compatible {'o', ':', 0xf6}, {'-', ':', 0xf7}, {'o', '/', 0xf8}, {'u', '!', 0xf9}, - {'u', '`', 0xf9}, // ù Vim 5.x compatible + {'u', '`', 0xf9}, // ù MNV 5.x compatible {'u', '\'', 0xfa}, {'u', '>', 0xfb}, - {'u', '^', 0xfb}, // û Vim 5.x compatible + {'u', '^', 0xfb}, // û MNV 5.x compatible {'u', ':', 0xfc}, {'y', '\'', 0xfd}, {'t', 'h', 0xfe}, {'y', ':', 0xff}, - {'y', '"', 0xff}, // x XX Vim 5.x compatible + {'y', '"', 0xff}, // x XX MNV 5.x compatible # define USE_UNICODE_DIGRAPHS @@ -1480,7 +1480,7 @@ get_digraph_for_char(int val_arg) if (!enc_utf8) { char_u buf[6], *to; - vimconv_T vc; + mnvconv_T vc; // convert the character from 'encoding' to Unicode i = mb_char2bytes(val, buf); @@ -1492,7 +1492,7 @@ get_digraph_for_char(int val_arg) if (to != NULL) { val = utf_ptr2char(to); - vim_free(to); + mnv_free(to); } (void)convert_setup(&vc, NULL, NULL); } @@ -1613,7 +1613,7 @@ getexactdigraph(int char1, int char2, int meta_char) if (retval != 0 && !enc_utf8) { char_u buf[6], *to; - vimconv_T vc; + mnvconv_T vc; /* * Convert the Unicode digraph to 'encoding'. @@ -1628,7 +1628,7 @@ getexactdigraph(int char1, int char2, int meta_char) if (to != NULL) { retval = (*mb_ptr2char)(to); - vim_free(to); + mnv_free(to); } (void)convert_setup(&vc, NULL, NULL); } @@ -1744,7 +1744,7 @@ putdigraph(char_u *str) return; str = skipwhite(str); - if (!VIM_ISDIGIT(*str)) + if (!MNV_ISDIGIT(*str)) { emsg(_(e_number_expected)); return; @@ -1848,7 +1848,7 @@ digraph_getlist_appendpair(digr_T *dp, list_T *l) buf[0] = dp->char1; buf[1] = dp->char2; buf[2] = NUL; - li2->li_tv.vval.v_string = vim_strsave(&buf[0]); + li2->li_tv.vval.v_string = mnv_strsave(&buf[0]); li2 = listitem_alloc(); if (li2 == NULL) @@ -1864,7 +1864,7 @@ digraph_getlist_appendpair(digr_T *dp, list_T *l) *p++ = (char_u)dp->result; *p = NUL; - li2->li_tv.vval.v_string = vim_strsave(buf); + li2->li_tv.vval.v_string = mnv_strsave(buf); } static void @@ -1999,7 +1999,7 @@ printdigraph(digr_T *dp, result_T *previous) p = buf; if (char2cells(dp->result) == 1) *p++ = ' '; - vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result); + mnv_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result); msg_outtrans(buf); } @@ -2081,7 +2081,7 @@ f_digraph_get(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; // Return empty string for failure - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; digraphs = tv_get_string_chk(&argvars[0]); @@ -2103,7 +2103,7 @@ f_digraph_get(typval_T *argvars, typval_T *rettv) buf[1] = NUL; } - rettv->vval.v_string = vim_strsave(buf); + rettv->vval.v_string = mnv_strsave(buf); # else emsg(_(e_no_digraphs_version)); # endif @@ -2146,7 +2146,7 @@ f_digraph_set(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_BOOL; rettv->vval.v_number = VVAL_FALSE; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; @@ -2258,21 +2258,21 @@ keymap_init(void) if (buf == NULL) return e_out_of_memory; - // try finding "keymap/'keymap'_'encoding'.vim" in 'runtimepath' - vim_snprintf((char *)buf, buflen, "keymap/%s_%s.vim", + // try finding "keymap/'keymap'_'encoding'.mnv" in 'runtimepath' + mnv_snprintf((char *)buf, buflen, "keymap/%s_%s.mnv", curbuf->b_p_keymap, p_enc); if (source_runtime(buf, 0) == FAIL) { - // try finding "keymap/'keymap'.vim" in 'runtimepath' - vim_snprintf((char *)buf, buflen, "keymap/%s.vim", + // try finding "keymap/'keymap'.mnv" in 'runtimepath' + mnv_snprintf((char *)buf, buflen, "keymap/%s.mnv", curbuf->b_p_keymap); if (source_runtime(buf, 0) == FAIL) { - vim_free(buf); + mnv_free(buf); return N_(e_keymap_file_not_found); } } - vim_free(buf); + mnv_free(buf); } return NULL; @@ -2324,10 +2324,10 @@ ex_loadkeymap(exarg_T *eap) { kp = (kmap_T *)curbuf->b_kmap_ga.ga_data + curbuf->b_kmap_ga.ga_len; s = skiptowhite(p); - kp->from = vim_strnsave(p, s - p); + kp->from = mnv_strnsave(p, s - p); p = skipwhite(s); s = skiptowhite(p); - kp->to = vim_strnsave(p, s - p); + kp->to = mnv_strnsave(p, s - p); if (kp->from == NULL || kp->to == NULL || STRLEN(kp->from) + STRLEN(kp->to) >= KMAP_LLEN @@ -2335,13 +2335,13 @@ ex_loadkeymap(exarg_T *eap) { if (kp->to != NULL && *kp->to == NUL) emsg(_(e_empty_keymap_entry)); - vim_free(kp->from); - vim_free(kp->to); + mnv_free(kp->from); + mnv_free(kp->to); } else ++curbuf->b_kmap_ga.ga_len; } - vim_free(line); + mnv_free(line); } /* @@ -2349,7 +2349,7 @@ ex_loadkeymap(exarg_T *eap) */ for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i) { - vim_snprintf((char *)buf, sizeof(buf), " %s %s", + mnv_snprintf((char *)buf, sizeof(buf), " %s %s", ((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].from, ((kmap_T *)curbuf->b_kmap_ga.ga_data)[i].to); (void)do_map(MAPTYPE_NOREMAP, buf, MODE_LANGMAP, FALSE); @@ -2382,7 +2382,7 @@ keymap_unload(void) kp = (kmap_T *)curbuf->b_kmap_ga.ga_data; for (i = 0; i < curbuf->b_kmap_ga.ga_len; ++i) { - vim_snprintf((char *)buf, sizeof(buf), " %s", kp[i].from); + mnv_snprintf((char *)buf, sizeof(buf), " %s", kp[i].from); (void)do_map(MAPTYPE_UNMAP, buf, MODE_LANGMAP, FALSE); } keymap_clear(&curbuf->b_kmap_ga); @@ -2402,8 +2402,8 @@ keymap_clear(garray_T *kmap) for (i = 0; i < kmap->ga_len; ++i) { - vim_free(kp[i].from); - vim_free(kp[i].to); + mnv_free(kp[i].from); + mnv_free(kp[i].to); } } #endif // FEAT_KEYMAP diff --git a/uvim/src/dosinst.c b/uvim/src/dosinst.c index 8d0dea574d..f32af75395 100644 --- a/uvim/src/dosinst.c +++ b/uvim/src/dosinst.c @@ -1,14 +1,14 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* - * dosinst.c: Install program for Vim on MS-DOS and MS-Windows + * dosinst.c: Install program for MNV on MS-DOS and MS-Windows * * Compile with Make_mvc.mak, Make_cyg.mak or Make_ming.mak. */ @@ -20,8 +20,8 @@ #include "dosinst.h" #include -#define GVIMEXT64_PATH "GvimExt64\\gvimext.dll" -#define GVIMEXT32_PATH "GvimExt32\\gvimext.dll" +#define GMNVEXT64_PATH "GmnvExt64\\gmnvext.dll" +#define GMNVEXT32_PATH "GmnvExt32\\gmnvext.dll" // Macro to do an error check I was typing over and over #define CHECK_REG_ERROR(code) \ @@ -33,15 +33,15 @@ } \ } while (0) -int has_vim = 0; // installable vim.exe exists -int has_gvim = 0; // installable gvim.exe exists +int has_mnv = 0; // installable mnv.exe exists +int has_gmnv = 0; // installable gmnv.exe exists -char oldvimrc[BUFSIZE]; // name of existing vimrc file -char vimrc[BUFSIZE]; // name of vimrc file to create +char oldmnvrc[BUFSIZE]; // name of existing mnvrc file +char mnvrc[BUFSIZE]; // name of mnvrc file to create char *default_bat_dir = NULL; // when not NULL, use this as the default // directory to write .bat files in -char *default_vim_dir = NULL; // when not NULL, use this as the default +char *default_mnv_dir = NULL; // when not NULL, use this as the default // install dir for NSIS /* @@ -64,20 +64,20 @@ int choice_count = 0; // number of choices available enum { compat_vi = 1, - compat_vim, + compat_mnv, compat_some_enhancements, compat_all_enhancements }; char *(compat_choices[]) = { - "\nChoose the default way to run Vim:", + "\nChoose the default way to run MNV:", "Vi compatible", - "Vim default", - "with some Vim enhancements", + "MNV default", + "with some MNV enhancements", "with syntax highlighting and other features switched on", }; int compat_choice = (int)compat_all_enhancements; -char *compat_text = "- run Vim %s"; +char *compat_text = "- run MNV %s"; enum { @@ -101,7 +101,7 @@ enum }; char *(mouse_choices[]) = { - "\nChoose the way how Vim uses the mouse:", + "\nChoose the way how MNV uses the mouse:", "right button extends selection (the Unix way)", "right button has a popup menu, left button starts select mode (the Windows way)", "right button has a popup menu, left button starts visual mode", @@ -111,15 +111,15 @@ char *mouse_text = "- The mouse %s"; enum { - vimfiles_dir_none = 1, - vimfiles_dir_vim, - vimfiles_dir_home + mnvfiles_dir_none = 1, + mnvfiles_dir_mnv, + mnvfiles_dir_home }; -static char *(vimfiles_dir_choices[]) = +static char *(mnvfiles_dir_choices[]) = { "\nCreate plugin directories:", "No", - "In the VIM directory", + "In the MNV directory", "In your HOME directory", }; @@ -133,10 +133,10 @@ static int install_openwith = 0; static int need_uninstall_entry = 0; /* - * Definitions of the directory name (under $VIM) of the vimfiles directory + * Definitions of the directory name (under $MNV) of the mnvfiles directory * and its subdirectories: */ -static char *(vimfiles_subdirs[]) = +static char *(mnvfiles_subdirs[]) = { "colors", "compiler", @@ -192,44 +192,44 @@ check_unpack(void) struct stat st; // check for presence of the correct version number in installdir[] - runtimeidx = strlen(installdir) - strlen(VIM_VERSION_NODOT); + runtimeidx = strlen(installdir) - strlen(MNV_VERSION_NODOT); if (runtimeidx <= 0 - || stricmp(installdir + runtimeidx, VIM_VERSION_NODOT) != 0 + || stricmp(installdir + runtimeidx, MNV_VERSION_NODOT) != 0 || (installdir[runtimeidx - 1] != '/' && installdir[runtimeidx - 1] != '\\')) { printf("ERROR: Install program not in directory \"%s\"\n", - VIM_VERSION_NODOT); + MNV_VERSION_NODOT); printf("This program can only work when it is located in its original directory\n"); myexit(1); } - // check if filetype.vim is present, which means the runtime archive has + // check if filetype.mnv is present, which means the runtime archive has // been unpacked - sprintf(buf, "%s\\filetype.vim", installdir); + sprintf(buf, "%s\\filetype.mnv", installdir); if (stat(buf, &st) < 0) { - printf("ERROR: Cannot find filetype.vim in \"%s\"\n", installdir); + printf("ERROR: Cannot find filetype.mnv in \"%s\"\n", installdir); printf("It looks like you did not unpack the runtime archive.\n"); printf("You must unpack the runtime archive \"%srt.zip\" before installing.\n", - VIM_VERSION_NODOT); + MNV_VERSION_NODOT); myexit(1); } - // Check if vim.exe or gvim.exe is in the current directory. - if ((fd = fopen("gvim.exe", "r")) != NULL) + // Check if mnv.exe or gmnv.exe is in the current directory. + if ((fd = fopen("gmnv.exe", "r")) != NULL) { fclose(fd); - has_gvim = 1; + has_gmnv = 1; } - if ((fd = fopen("vim.exe", "r")) != NULL) + if ((fd = fopen("mnv.exe", "r")) != NULL) { fclose(fd); - has_vim = 1; + has_mnv = 1; } - if (!has_gvim && !has_vim) + if (!has_gmnv && !has_mnv) { - printf("ERROR: Cannot find any Vim executables in \"%s\"\n\n", + printf("ERROR: Cannot find any MNV executables in \"%s\"\n\n", installdir); myexit(1); } @@ -339,7 +339,7 @@ findoldfile(char **destination) } /* - * Check if there is a vim.[exe|bat|, gvim.[exe|bat|, etc. in the path. + * Check if there is a mnv.[exe|bat|, gmnv.[exe|bat|, etc. in the path. * When "check_bat_only" is TRUE, only find "default_bat_dir". */ static void @@ -374,54 +374,54 @@ find_bat_exe(int check_bat_only) } /* - * Get the value of $VIMRUNTIME or $VIM and write it in $TEMP/vimini.ini, so + * Get the value of $MNVRUNTIME or $MNV and write it in $TEMP/mnvini.ini, so * that NSIS can read it. - * When not set, use the directory of a previously installed Vim. + * When not set, use the directory of a previously installed MNV. */ static void -get_vim_env(void) +get_mnv_env(void) { - char *vim; + char *mnv; char buf[BUFSIZE]; FILE *fd; char fname[BUFSIZE]; - // First get $VIMRUNTIME. If it's set, remove the tail. - vim = getenv("VIMRUNTIME"); - if (vim != NULL && *vim != 0 && strlen(vim) < sizeof(buf)) + // First get $MNVRUNTIME. If it's set, remove the tail. + mnv = getenv("MNVRUNTIME"); + if (mnv != NULL && *mnv != 0 && strlen(mnv) < sizeof(buf)) { - strcpy(buf, vim); + strcpy(buf, mnv); remove_tail(buf); - vim = buf; + mnv = buf; } else { - vim = getenv("VIM"); - if (vim == NULL || *vim == 0) + mnv = getenv("MNV"); + if (mnv == NULL || *mnv == 0) { // Use the directory from an old uninstall entry. - if (default_vim_dir != NULL) - vim = default_vim_dir; + if (default_mnv_dir != NULL) + mnv = default_mnv_dir; else // Let NSIS know there is no default, it should use // $PROGRAMFILES. - vim = ""; + mnv = ""; } } // NSIS also uses GetTempPath(), thus we should get the same directory - // name as where NSIS will look for vimini.ini. + // name as where NSIS will look for mnvini.ini. GetTempPath(sizeof(fname) - 12, fname); add_pathsep(fname); - strcat(fname, "vimini.ini"); + strcat(fname, "mnvini.ini"); fd = fopen(fname, "w"); if (fd != NULL) { // Make it look like an .ini file, so that NSIS can read it with a // ReadINIStr command. - fprintf(fd, "[vimini]\n"); - fprintf(fd, "dir=\"%s\"\n", vim); + fprintf(fd, "[mnvini]\n"); + fprintf(fd, "dir=\"%s\"\n", mnv); fclose(fd); } else @@ -445,7 +445,7 @@ window_cb(HWND hwnd, LPARAM lparam UNUSED) title[0] = 0; GetWindowText(hwnd, title, 256); - if (strstr(title, "Vim ") != NULL && strstr(title, " Uninstall") != NULL) + if (strstr(title, "MNV ") != NULL && strstr(title, " Uninstall") != NULL) ++num_windows; return TRUE; } @@ -456,15 +456,15 @@ window_cb(HWND hwnd, LPARAM lparam UNUSED) static int run_silent_uninstall(char *uninst_exe) { - char vimrt_dir[BUFSIZE]; + char mnvrt_dir[BUFSIZE]; char temp_uninst[BUFSIZE]; char temp_dir[MAX_PATH]; char buf[BUFSIZE * 2 + 10]; int i; DWORD tick; - strcpy(vimrt_dir, uninst_exe); - remove_tail(vimrt_dir); + strcpy(mnvrt_dir, uninst_exe); + remove_tail(mnvrt_dir); if (!GetTempPath(sizeof(temp_dir), temp_dir)) return FAIL; @@ -473,7 +473,7 @@ run_silent_uninstall(char *uninst_exe) tick = GetTickCount(); for (i = 0; ; i++) { - sprintf(temp_uninst, "%s\\vimun%04X.exe", temp_dir, + sprintf(temp_uninst, "%s\\mnvun%04X.exe", temp_dir, (unsigned int)((i + tick) & 0xFFFF)); if (CopyFile(uninst_exe, temp_uninst, TRUE)) break; @@ -485,9 +485,9 @@ run_silent_uninstall(char *uninst_exe) // Run the copied uninstaller silently. if (strchr(temp_uninst, ' ') != NULL) - sprintf(buf, "\"%s\" /S _?=%s", temp_uninst, vimrt_dir); + sprintf(buf, "\"%s\" /S _?=%s", temp_uninst, mnvrt_dir); else - sprintf(buf, "%s /S _?=%s", temp_uninst, vimrt_dir); + sprintf(buf, "%s /S _?=%s", temp_uninst, mnvrt_dir); run_command(buf); DeleteFile(temp_uninst); @@ -495,7 +495,7 @@ run_silent_uninstall(char *uninst_exe) } /* - * Check for already installed Vims. + * Check for already installed MNVs. * Return non-zero when found one. */ static int @@ -529,9 +529,9 @@ uninstall_check(int skip_question) NULL, NULL, NULL, &temp_pfiletime) == ERROR_NO_MORE_ITEMS) break; - if (strncmp("Vim", subkey_name_buff, 3) == 0) + if (strncmp("MNV", subkey_name_buff, 3) == 0) { - // Open the key named Vim* + // Open the key named MNV* code = RegOpenKeyEx(key_handle, subkey_name_buff, 0, KEY_WOW64_64KEY | KEY_READ, &uninstall_key_handle); CHECK_REG_ERROR(code); @@ -555,12 +555,12 @@ uninstall_check(int skip_question) foundone = 1; printf("\n*********************************************************\n"); - printf("Vim Install found what looks like an existing Vim version.\n"); + printf("MNV Install found what looks like an existing MNV version.\n"); printf("The name of the entry is:\n"); printf("\n \"%s\"\n\n", temp_string_buffer); printf("Installing the new version will disable part of the existing version.\n"); - printf("(The batch files used in a console and the \"Edit with Vim\" entry in\n"); + printf("(The batch files used in a console and the \"Edit with MNV\" entry in\n"); printf("the popup menu will use the new version)\n"); if (skip_question) @@ -576,10 +576,10 @@ uninstall_check(int skip_question) CHECK_REG_ERROR(code); // Remember the directory, it is used as the default for NSIS. - default_vim_dir = alloc(strlen(temp_string_buffer) + 1); - strcpy(default_vim_dir, temp_string_buffer); - remove_tail(default_vim_dir); - remove_tail(default_vim_dir); + default_mnv_dir = alloc(strlen(temp_string_buffer) + 1); + strcpy(default_mnv_dir, temp_string_buffer); + remove_tail(default_mnv_dir); + remove_tail(default_mnv_dir); input = 'n'; do @@ -710,49 +710,49 @@ inspect_system(void) printf("Inspecting system...\n"); /* - * If $VIM is set, check that it's pointing to our directory. + * If $MNV is set, check that it's pointing to our directory. */ - p = getenv("VIM"); + p = getenv("MNV"); if (p != NULL && pathcmp(p, -1, installdir, runtimeidx - 1) != 0) { printf("------------------------------------------------------\n"); - printf("$VIM is set to \"%s\".\n", p); - printf("This is different from where this version of Vim is:\n"); + printf("$MNV is set to \"%s\".\n", p); + printf("This is different from where this version of MNV is:\n"); strcpy(buf, installdir); *(buf + runtimeidx - 1) = NUL; printf("\"%s\"\n", buf); - printf("You must adjust or remove the setting of $VIM,\n"); + printf("You must adjust or remove the setting of $MNV,\n"); if (interactive) { printf("to be able to use this install program.\n"); myexit(1); } - printf("otherwise Vim WILL NOT WORK properly!\n"); + printf("otherwise MNV WILL NOT WORK properly!\n"); printf("------------------------------------------------------\n"); } /* - * If $VIMRUNTIME is set, check that it's pointing to our runtime directory. + * If $MNVRUNTIME is set, check that it's pointing to our runtime directory. */ - p = getenv("VIMRUNTIME"); + p = getenv("MNVRUNTIME"); if (p != NULL && pathcmp(p, -1, installdir, -1) != 0) { printf("------------------------------------------------------\n"); - printf("$VIMRUNTIME is set to \"%s\".\n", p); - printf("This is different from where this version of Vim is:\n"); + printf("$MNVRUNTIME is set to \"%s\".\n", p); + printf("This is different from where this version of MNV is:\n"); printf("\"%s\"\n", installdir); - printf("You must adjust or remove the setting of $VIMRUNTIME,\n"); + printf("You must adjust or remove the setting of $MNVRUNTIME,\n"); if (interactive) { printf("to be able to use this install program.\n"); myexit(1); } - printf("otherwise Vim WILL NOT WORK properly!\n"); + printf("otherwise MNV WILL NOT WORK properly!\n"); printf("------------------------------------------------------\n"); } /* - * Check if there is a vim.[exe|bat|, gvim.[exe|bat|, etc. in the path. + * Check if there is a mnv.[exe|bat|, gmnv.[exe|bat|, etc. in the path. */ find_bat_exe(FALSE); @@ -771,7 +771,7 @@ inspect_system(void) if (foundone) { - printf("Warning: Found Vim executable(s) in your $PATH:\n"); + printf("Warning: Found MNV executable(s) in your $PATH:\n"); for (i = 1; i < TARGET_COUNT; ++i) if (targets[i].oldexe != NULL) printf("%s\n", targets[i].oldexe); @@ -780,23 +780,23 @@ inspect_system(void) } /* - * Check if there is an existing ../_vimrc or ../.vimrc file. + * Check if there is an existing ../_mnvrc or ../.mnvrc file. */ - strcpy(oldvimrc, installdir); - strcpy(oldvimrc + runtimeidx, "_vimrc"); - if ((fd = fopen(oldvimrc, "r")) == NULL) + strcpy(oldmnvrc, installdir); + strcpy(oldmnvrc + runtimeidx, "_mnvrc"); + if ((fd = fopen(oldmnvrc, "r")) == NULL) { - strcpy(oldvimrc + runtimeidx, "vimrc~1"); // short version of .vimrc - if ((fd = fopen(oldvimrc, "r")) == NULL) + strcpy(oldmnvrc + runtimeidx, "mnvrc~1"); // short version of .mnvrc + if ((fd = fopen(oldmnvrc, "r")) == NULL) { - strcpy(oldvimrc + runtimeidx, ".vimrc"); - fd = fopen(oldvimrc, "r"); + strcpy(oldmnvrc + runtimeidx, ".mnvrc"); + fd = fopen(oldmnvrc, "r"); } } if (fd != NULL) fclose(fd); else - *oldvimrc = NUL; + *oldmnvrc = NUL; } /* @@ -819,7 +819,7 @@ add_dummy_choice(void) // stuff for creating the batch files. /* - * Install the vim.bat, gvim.bat, etc. files. + * Install the mnv.bat, gmnv.bat, etc. files. */ static void install_bat_choice(int idx) @@ -827,7 +827,7 @@ install_bat_choice(int idx) char *batpath = targets[choices[idx].arg].batpath; char *oldname = targets[choices[idx].arg].oldbat; char *exename = targets[choices[idx].arg].exenamearg; - char *vimarg = targets[choices[idx].arg].exearg; + char *mnvarg = targets[choices[idx].arg].exearg; FILE *fd; if (*batpath == NUL) @@ -843,8 +843,8 @@ install_bat_choice(int idx) need_uninstall_entry = 1; fprintf(fd, "@echo off\n"); - fprintf(fd, "rem -- Run Vim --\n"); - fprintf(fd, VIMBAT_UNINSTKEY "\n"); + fprintf(fd, "rem -- Run MNV --\n"); + fprintf(fd, MNVBAT_UNINSTKEY "\n"); fprintf(fd, "\n"); fprintf(fd, "setlocal\n"); @@ -852,19 +852,19 @@ install_bat_choice(int idx) * Don't use double quotes for the "set" argument, also when it * contains a space. The quotes would be included in the value. * The order of preference is: - * 1. $VIMRUNTIME/vim.exe (user preference) - * 2. $VIM/vim81/vim.exe (hard coded version) - * 3. installdir/vim.exe (hard coded install directory) + * 1. $MNVRUNTIME/mnv.exe (user preference) + * 2. $MNV/mnv81/mnv.exe (hard coded version) + * 3. installdir/mnv.exe (hard coded install directory) */ - fprintf(fd, "set VIM_EXE_DIR=%s\n", installdir); - fprintf(fd, "if exist \"%%VIM%%\\%s\\%s\" set VIM_EXE_DIR=%%VIM%%\\%s\n", - VIM_VERSION_NODOT, exename, VIM_VERSION_NODOT); - fprintf(fd, "if exist \"%%VIMRUNTIME%%\\%s\" set VIM_EXE_DIR=%%VIMRUNTIME%%\n", exename); + fprintf(fd, "set MNV_EXE_DIR=%s\n", installdir); + fprintf(fd, "if exist \"%%MNV%%\\%s\\%s\" set MNV_EXE_DIR=%%MNV%%\\%s\n", + MNV_VERSION_NODOT, exename, MNV_VERSION_NODOT); + fprintf(fd, "if exist \"%%MNVRUNTIME%%\\%s\" set MNV_EXE_DIR=%%MNVRUNTIME%%\n", exename); fprintf(fd, "\n"); // Give an error message when the executable could not be found. - fprintf(fd, "if not exist \"%%VIM_EXE_DIR%%\\%s\" (\n", exename); - fprintf(fd, " echo \"%%VIM_EXE_DIR%%\\%s\" not found\n", exename); + fprintf(fd, "if not exist \"%%MNV_EXE_DIR%%\\%s\" (\n", exename); + fprintf(fd, " echo \"%%MNV_EXE_DIR%%\\%s\" not found\n", exename); fprintf(fd, " goto :eof\n"); fprintf(fd, ")\n"); fprintf(fd, "\n"); @@ -872,13 +872,13 @@ install_bat_choice(int idx) if (*exename == 'g') { fprintf(fd, "rem check --nofork argument\n"); - fprintf(fd, "set VIMNOFORK=\n"); + fprintf(fd, "set MNVNOFORK=\n"); fprintf(fd, ":loopstart\n"); fprintf(fd, "if .%%1==. goto loopend\n"); fprintf(fd, "if .%%1==.--nofork (\n"); - fprintf(fd, " set VIMNOFORK=1\n"); + fprintf(fd, " set MNVNOFORK=1\n"); fprintf(fd, ") else if .%%1==.-f (\n"); - fprintf(fd, " set VIMNOFORK=1\n"); + fprintf(fd, " set MNVNOFORK=1\n"); fprintf(fd, ")\n"); fprintf(fd, "shift\n"); fprintf(fd, "goto loopstart\n"); @@ -888,25 +888,25 @@ install_bat_choice(int idx) if (*exename == 'g') { - // For gvim.exe use "start /b" to avoid that the console window + // For gmnv.exe use "start /b" to avoid that the console window // stays open. - fprintf(fd, "if .%%VIMNOFORK%%==.1 (\n"); + fprintf(fd, "if .%%MNVNOFORK%%==.1 (\n"); fprintf(fd, " start \"dummy\" /b /wait "); - // Always use quotes, $VIM or $VIMRUNTIME might have a space. - fprintf(fd, "\"%%VIM_EXE_DIR%%\\%s\" %s %%*\n", - exename, vimarg); + // Always use quotes, $MNV or $MNVRUNTIME might have a space. + fprintf(fd, "\"%%MNV_EXE_DIR%%\\%s\" %s %%*\n", + exename, mnvarg); fprintf(fd, ") else (\n"); fprintf(fd, " start \"dummy\" /b "); - // Always use quotes, $VIM or $VIMRUNTIME might have a space. - fprintf(fd, "\"%%VIM_EXE_DIR%%\\%s\" %s %%*\n", - exename, vimarg); + // Always use quotes, $MNV or $MNVRUNTIME might have a space. + fprintf(fd, "\"%%MNV_EXE_DIR%%\\%s\" %s %%*\n", + exename, mnvarg); fprintf(fd, ")\n"); } else { - // Always use quotes, $VIM or $VIMRUNTIME might have a space. - fprintf(fd, "\"%%VIM_EXE_DIR%%\\%s\" %s %%*\n", - exename, vimarg); + // Always use quotes, $MNV or $MNVRUNTIME might have a space. + fprintf(fd, "\"%%MNV_EXE_DIR%%\\%s\" %s %%*\n", + exename, mnvarg); } fclose(fd); @@ -929,7 +929,7 @@ alloc_text(int idx, char *fmt, char *arg) } /* - * Toggle the "Overwrite .../vim.bat" to "Don't overwrite". + * Toggle the "Overwrite .../mnv.bat" to "Don't overwrite". */ static void toggle_bat_choice(int idx) @@ -1046,8 +1046,8 @@ change_bat_choice(int idx) free(names); } -char *bat_text_yes = "Install .bat files to use Vim at the command line:"; -char *bat_text_no = "do NOT install .bat files to use Vim at the command line"; +char *bat_text_yes = "Install .bat files to use MNV at the command line:"; +char *bat_text_no = "do NOT install .bat files to use MNV at the command line"; static void change_main_bat_choice(int idx) @@ -1065,8 +1065,8 @@ change_main_bat_choice(int idx) // update the individual batch file selections for (i = 1; i < TARGET_COUNT; ++i) { - // Only make it active when the first item has a path and the vim.exe - // or gvim.exe exists (there is a changefunc then). + // Only make it active when the first item has a path and the mnv.exe + // or gmnv.exe exists (there is a changefunc then). if (targets[0].batpath[0] != NUL && choices[idx + i].changefunc != NULL) { @@ -1100,7 +1100,7 @@ init_bat_choice(int target) choices[choice_count].text = NULL; // will be set below if (oldbat != NULL) { - // A [g]vim.bat exists: Only choice is to overwrite it or not. + // A [g]mnv.bat exists: Only choice is to overwrite it or not. choices[choice_count].changefunc = toggle_bat_choice; *batpath = NUL; toggle_bat_choice(choice_count); @@ -1112,7 +1112,7 @@ init_bat_choice(int target) strcpy(batpath, default_bat_dir); else { - // No [g]vim.bat exists: Write it to a directory in $PATH. Use + // No [g]mnv.bat exists: Write it to a directory in $PATH. Use // $WINDIR by default, if it's empty the first item in $PATH. p = getenv("WINDIR"); if (p != NULL && *p != NUL) @@ -1161,27 +1161,27 @@ init_bat_choices(void) // the first item. When a .exe exists, don't offer to create a .bat. for (i = 1; i < TARGET_COUNT; ++i) if (targets[i].oldexe == NULL - && (targets[i].exenamearg[0] == 'g' ? has_gvim : has_vim)) + && (targets[i].exenamearg[0] == 'g' ? has_gmnv : has_mnv)) init_bat_choice(i); else add_dummy_choice(); } /* - * Install the vimrc file. + * Install the mnvrc file. */ static void -install_vimrc(int idx UNUSED) +install_mnvrc(int idx UNUSED) { FILE *fd, *tfd; char *fname; - // If an old vimrc file exists, overwrite it. + // If an old mnvrc file exists, overwrite it. // Otherwise create a new one. - if (*oldvimrc != NUL) - fname = oldvimrc; + if (*oldmnvrc != NUL) + fname = oldmnvrc; else - fname = vimrc; + fname = mnvrc; fd = fopen(fname, "w"); if (fd == NULL) @@ -1195,19 +1195,19 @@ install_vimrc(int idx UNUSED) fprintf(fd, "\" Vi compatible\n"); fprintf(fd, "set compatible\n"); break; - case compat_vim: - fprintf(fd, "\" Vim's default behavior\n"); + case compat_mnv: + fprintf(fd, "\" MNV's default behavior\n"); fprintf(fd, "if &compatible\n"); fprintf(fd, " set nocompatible\n"); fprintf(fd, "endif\n"); break; case compat_some_enhancements: - fprintf(fd, "\" Vim with some enhancements\n"); - fprintf(fd, "source $VIMRUNTIME/defaults.vim\n"); + fprintf(fd, "\" MNV with some enhancements\n"); + fprintf(fd, "source $MNVRUNTIME/defaults.mnv\n"); break; case compat_all_enhancements: - fprintf(fd, "\" Vim with all enhancements\n"); - fprintf(fd, "source $VIMRUNTIME/vimrc_example.vim\n"); + fprintf(fd, "\" MNV with all enhancements\n"); + fprintf(fd, "source $MNVRUNTIME/mnvrc_example.mnv\n"); break; } switch (remap_choice) @@ -1217,7 +1217,7 @@ install_vimrc(int idx UNUSED) case remap_win: fprintf(fd, "\n"); fprintf(fd, "\" Remap a few keys for Windows behavior\n"); - fprintf(fd, "source $VIMRUNTIME/mswin.vim\n"); + fprintf(fd, "source $MNVRUNTIME/mswin.mnv\n"); break; } switch (mouse_choice) @@ -1237,7 +1237,7 @@ install_vimrc(int idx UNUSED) } if ((tfd = fopen("diff.exe", "r")) != NULL) { - // Use the diff.exe that comes with the self-extracting gvim.exe. + // Use the diff.exe that comes with the self-extracting gmnv.exe. fclose(tfd); fprintf(fd, "\n"); fprintf(fd, "\" Use the internal diff if available.\n"); @@ -1268,18 +1268,18 @@ install_vimrc(int idx UNUSED) // Otherwise put a double quote just before the space and at the // end of the command. Putting quotes around the whole thing // doesn't work on Win 95/98/ME. This is mostly guessed! - fprintf(fd, " if $VIMRUNTIME =~ ' '\n"); + fprintf(fd, " if $MNVRUNTIME =~ ' '\n"); fprintf(fd, " if &sh =~ '\\ ' . arg3\n"); @@ -1294,15 +1294,15 @@ install_vimrc(int idx UNUSED) } static void -change_vimrc_choice(int idx) +change_mnvrc_choice(int idx) { if (choices[idx].installfunc != NULL) { - // Switch to NOT change or create a vimrc file. - if (*oldvimrc != NUL) - alloc_text(idx, "Do NOT change startup file %s", oldvimrc); + // Switch to NOT change or create a mnvrc file. + if (*oldmnvrc != NUL) + alloc_text(idx, "Do NOT change startup file %s", oldmnvrc); else - alloc_text(idx, "Do NOT create startup file %s", vimrc); + alloc_text(idx, "Do NOT create startup file %s", mnvrc); choices[idx].installfunc = NULL; choices[idx + 1].active = 0; choices[idx + 2].active = 0; @@ -1310,12 +1310,12 @@ change_vimrc_choice(int idx) } else { - // Switch to change or create a vimrc file. - if (*oldvimrc != NUL) - alloc_text(idx, "Overwrite startup file %s with:", oldvimrc); + // Switch to change or create a mnvrc file. + if (*oldmnvrc != NUL) + alloc_text(idx, "Overwrite startup file %s with:", oldmnvrc); else - alloc_text(idx, "Create startup file %s with:", vimrc); - choices[idx].installfunc = install_vimrc; + alloc_text(idx, "Create startup file %s with:", mnvrc); + choices[idx].installfunc = install_mnvrc; choices[idx + 1].active = 1; choices[idx + 2].active = 1; choices[idx + 3].active = 1; @@ -1323,7 +1323,7 @@ change_vimrc_choice(int idx) } /* - * Change the choice how to run Vim. + * Change the choice how to run MNV. */ static void change_run_choice(int idx) @@ -1353,42 +1353,42 @@ change_mouse_choice(int idx) } static void -init_vimrc_choices(void) +init_mnvrc_choices(void) { - // set path for a new _vimrc file (also when not used) - strcpy(vimrc, installdir); - strcpy(vimrc + runtimeidx, "_vimrc"); + // set path for a new _mnvrc file (also when not used) + strcpy(mnvrc, installdir); + strcpy(mnvrc + runtimeidx, "_mnvrc"); - // Set opposite value and then toggle it by calling change_vimrc_choice() - if (*oldvimrc == NUL) + // Set opposite value and then toggle it by calling change_mnvrc_choice() + if (*oldmnvrc == NUL) choices[choice_count].installfunc = NULL; else - choices[choice_count].installfunc = install_vimrc; + choices[choice_count].installfunc = install_mnvrc; choices[choice_count].text = NULL; - change_vimrc_choice(choice_count); - choices[choice_count].changefunc = change_vimrc_choice; + change_mnvrc_choice(choice_count); + choices[choice_count].changefunc = change_mnvrc_choice; choices[choice_count].active = 1; ++choice_count; - // default way to run Vim + // default way to run MNV alloc_text(choice_count, compat_text, compat_choices[compat_choice]); choices[choice_count].changefunc = change_run_choice; choices[choice_count].installfunc = NULL; - choices[choice_count].active = (*oldvimrc == NUL); + choices[choice_count].active = (*oldmnvrc == NUL); ++choice_count; // Whether to remap keys alloc_text(choice_count, remap_text , remap_choices[remap_choice]); choices[choice_count].changefunc = change_remap_choice; choices[choice_count].installfunc = NULL; - choices[choice_count].active = (*oldvimrc == NUL); + choices[choice_count].active = (*oldmnvrc == NUL); ++choice_count; // default way to use the mouse alloc_text(choice_count, mouse_text, mouse_choices[mouse_choice]); choices[choice_count].changefunc = change_mouse_choice; choices[choice_count].installfunc = NULL; - choices[choice_count].active = (*oldvimrc == NUL); + choices[choice_count].active = (*oldmnvrc == NUL); ++choice_count; } @@ -1475,7 +1475,7 @@ register_shellex( { LONG lRet = reg_create_key_and_value( hRootKey, - "*\\shellex\\ContextMenuHandlers\\gvim", + "*\\shellex\\ContextMenuHandlers\\gmnv", NULL, clsid, flag); @@ -1493,7 +1493,7 @@ register_shellex( { lRet = reg_create_key_and_value( HKEY_LOCAL_MACHINE, - "Software\\Vim\\Gvim", + "Software\\MNV\\Gmnv", "path", exe_path, flag); @@ -1514,7 +1514,7 @@ register_openwith( sprintf(exe_cmd, "\"%s\" \"%%1\"", exe_path); lRet = reg_create_key_and_value( hRootKey, - "Applications\\gvim.exe\\shell\\edit\\command", + "Applications\\gmnv.exe\\shell\\edit\\command", NULL, exe_cmd, flag); @@ -1523,9 +1523,9 @@ register_openwith( { int i; static const char *openwith[] = { - ".htm\\OpenWithList\\gvim.exe", - ".vim\\OpenWithList\\gvim.exe", - "*\\OpenWithList\\gvim.exe", + ".htm\\OpenWithList\\gmnv.exe", + ".mnv\\OpenWithList\\gmnv.exe", + "*\\OpenWithList\\gmnv.exe", }; for (i = 0; ERROR_SUCCESS == lRet && i < (int)ARRAYSIZE(openwith); i++) @@ -1565,19 +1565,19 @@ register_uninstall( /* * Add some entries to the registry: - * - to add "Edit with Vim" to the context * menu - * - to add Vim to the "Open with..." list - * - to uninstall Vim + * - to add "Edit with MNV" to the context * menu + * - to add MNV to the "Open with..." list + * - to uninstall MNV */ //ARGSUSED static int install_registry(void) { LONG lRet = ERROR_SUCCESS; - const char *vim_ext_ThreadingModel = "Apartment"; - const char *vim_ext_name = "Vim Shell Extension"; - const char *vim_ext_clsid = "{51EEE242-AD87-11d3-9C1E-0090278BBD99}"; - char vim_exe_path[MAX_PATH]; + const char *mnv_ext_ThreadingModel = "Apartment"; + const char *mnv_ext_name = "MNV Shell Extension"; + const char *mnv_ext_clsid = "{51EEE242-AD87-11d3-9C1E-0090278BBD99}"; + char mnv_exe_path[MAX_PATH]; char display_name[BUFSIZE]; char uninstall_string[BUFSIZE]; char icon_string[BUFSIZE]; @@ -1586,35 +1586,35 @@ install_registry(void) int loop_count = is_64bit_os() ? 2 : 1; DWORD flag; - sprintf(vim_exe_path, "%s\\gvim.exe", installdir); + sprintf(mnv_exe_path, "%s\\gmnv.exe", installdir); if (install_popup) { char bufg[BUFSIZE]; - printf("Creating \"Edit with Vim\" popup menu entry\n"); + printf("Creating \"Edit with MNV\" popup menu entry\n"); for (i = 0; i < loop_count; i++) { if (i == 0) { - sprintf(bufg, "%s\\" GVIMEXT32_PATH, installdir); + sprintf(bufg, "%s\\" GMNVEXT32_PATH, installdir); flag = KEY_WOW64_32KEY; } else { - sprintf(bufg, "%s\\" GVIMEXT64_PATH, installdir); + sprintf(bufg, "%s\\" GMNVEXT64_PATH, installdir); flag = KEY_WOW64_64KEY; } lRet = register_inproc_server( - HKEY_CLASSES_ROOT, vim_ext_clsid, vim_ext_name, - bufg, vim_ext_ThreadingModel, flag); + HKEY_CLASSES_ROOT, mnv_ext_clsid, mnv_ext_name, + bufg, mnv_ext_ThreadingModel, flag); if (ERROR_SUCCESS != lRet) return FAIL; lRet = register_shellex( - HKEY_CLASSES_ROOT, vim_ext_clsid, vim_ext_name, - vim_exe_path, flag); + HKEY_CLASSES_ROOT, mnv_ext_clsid, mnv_ext_name, + mnv_exe_path, flag); if (ERROR_SUCCESS != lRet) return FAIL; } @@ -1631,14 +1631,14 @@ install_registry(void) else flag = KEY_WOW64_64KEY; - lRet = register_openwith(HKEY_CLASSES_ROOT, vim_exe_path, flag); + lRet = register_openwith(HKEY_CLASSES_ROOT, mnv_exe_path, flag); if (ERROR_SUCCESS != lRet) return FAIL; } } printf("Creating an uninstall entry\n"); - sprintf(display_name, "Vim " VIM_VERSION_SHORT + sprintf(display_name, "MNV " MNV_VERSION_SHORT #ifdef _M_ARM64 " (arm64)" #elif _M_X64 @@ -1652,18 +1652,18 @@ install_registry(void) else sprintf(uninstall_string, "%s\\uninstall-gui.exe", installdir); - sprintf(icon_string, "%s\\gvim.exe,0", installdir); + sprintf(icon_string, "%s\\gmnv.exe,0", installdir); - sprintf(version_string, VIM_VERSION_SHORT "." VIM_VERSION_PATCHLEVEL_STR); + sprintf(version_string, MNV_VERSION_SHORT "." MNV_VERSION_PATCHLEVEL_STR); lRet = register_uninstall( HKEY_LOCAL_MACHINE, - "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Vim " VIM_VERSION_SHORT, + "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\MNV " MNV_VERSION_SHORT, display_name, uninstall_string, icon_string, version_string, - "The Vim Project"); + "The MNV Project"); if (ERROR_SUCCESS != lRet) return FAIL; @@ -1675,28 +1675,28 @@ change_popup_choice(int idx) { if (install_popup == 0) { - choices[idx].text = "Install an entry for Vim in the popup menu for the right\n mouse button so that you can edit any file with Vim"; + choices[idx].text = "Install an entry for MNV in the popup menu for the right\n mouse button so that you can edit any file with MNV"; install_popup = 1; } else { - choices[idx].text = "Do NOT install an entry for Vim in the popup menu for the\n right mouse button to edit any file with Vim"; + choices[idx].text = "Do NOT install an entry for MNV in the popup menu for the\n right mouse button to edit any file with MNV"; install_popup = 0; } } /* - * Only add the choice for the popup menu entry when gvim.exe was found and - * both gvimext.dll and regedit.exe exist. + * Only add the choice for the popup menu entry when gmnv.exe was found and + * both gmnvext.dll and regedit.exe exist. */ static void init_popup_choice(void) { struct stat st; - if (has_gvim - && (stat(GVIMEXT32_PATH, &st) >= 0 - || stat(GVIMEXT64_PATH, &st) >= 0)) + if (has_gmnv + && (stat(GMNVEXT32_PATH, &st) >= 0 + || stat(GMNVEXT64_PATH, &st) >= 0)) { choices[choice_count].changefunc = change_popup_choice; choices[choice_count].installfunc = NULL; @@ -1713,24 +1713,24 @@ change_openwith_choice(int idx) { if (install_openwith == 0) { - choices[idx].text = "Add Vim to the \"Open With...\" list in the popup menu for the right\n mouse button so that you can edit any file with Vim"; + choices[idx].text = "Add MNV to the \"Open With...\" list in the popup menu for the right\n mouse button so that you can edit any file with MNV"; install_openwith = 1; } else { - choices[idx].text = "Do NOT add Vim to the \"Open With...\" list in the popup menu for the\n right mouse button to edit any file with Vim"; + choices[idx].text = "Do NOT add MNV to the \"Open With...\" list in the popup menu for the\n right mouse button to edit any file with MNV"; install_openwith = 0; } } /* - * Only add the choice for the open-with menu entry when gvim.exe was found + * Only add the choice for the open-with menu entry when gmnv.exe was found * and regedit.exe exist. */ static void init_openwith_choice(void) { - if (has_gvim) + if (has_gmnv) { choices[choice_count].changefunc = change_openwith_choice; choices[choice_count].installfunc = NULL; @@ -1844,11 +1844,11 @@ build_link_name( return FAIL; } - // Make sure the directory exists (create Start Menu\Programs\Vim). + // Make sure the directory exists (create Start Menu\Programs\MNV). // Ignore errors if it already exists. - vim_mkdir(shell_folder_path, 0755); + mnv_mkdir(shell_folder_path, 0755); - // build the path to the shortcut and the path to gvim.exe + // build the path to the shortcut and the path to gmnv.exe sprintf(link_path, "%s\\%s.lnk", shell_folder_path, link_name); return OK; @@ -1857,7 +1857,7 @@ build_link_name( static int build_shortcut( const char *name, // Name of the shortcut - const char *exename, // Name of the executable (e.g., vim.exe) + const char *exename, // Name of the executable (e.g., mnv.exe) const char *args, const char *shell_folder, const char *workingdir) @@ -1889,67 +1889,67 @@ build_shortcut( #define WORKDIR "%HOMEDRIVE%%HOMEPATH%" /* - * Create shortcut(s) in the Start Menu\Programs\Vim folder. + * Create shortcut(s) in the Start Menu\Programs\MNV folder. */ static void install_start_menu(int idx UNUSED) { need_uninstall_entry = 1; printf("Creating start menu\n"); - if (has_vim) + if (has_mnv) { - if (build_shortcut("Vim", "vim.exe", "", - VIM_STARTMENU, WORKDIR) == FAIL) + if (build_shortcut("MNV", "mnv.exe", "", + MNV_STARTMENU, WORKDIR) == FAIL) return; - if (build_shortcut("Vim Read-only", "vim.exe", "-R", - VIM_STARTMENU, WORKDIR) == FAIL) + if (build_shortcut("MNV Read-only", "mnv.exe", "-R", + MNV_STARTMENU, WORKDIR) == FAIL) return; - if (build_shortcut("Vim Diff", "vim.exe", "-d", - VIM_STARTMENU, WORKDIR) == FAIL) + if (build_shortcut("MNV Diff", "mnv.exe", "-d", + MNV_STARTMENU, WORKDIR) == FAIL) return; } - if (has_gvim) + if (has_gmnv) { - if (build_shortcut("gVim", "gvim.exe", "", - VIM_STARTMENU, WORKDIR) == FAIL) + if (build_shortcut("gMNV", "gmnv.exe", "", + MNV_STARTMENU, WORKDIR) == FAIL) return; - if (build_shortcut("gVim Easy", "gvim.exe", "-y", - VIM_STARTMENU, WORKDIR) == FAIL) + if (build_shortcut("gMNV Easy", "gmnv.exe", "-y", + MNV_STARTMENU, WORKDIR) == FAIL) return; - if (build_shortcut("gVim Read-only", "gvim.exe", "-R", - VIM_STARTMENU, WORKDIR) == FAIL) + if (build_shortcut("gMNV Read-only", "gmnv.exe", "-R", + MNV_STARTMENU, WORKDIR) == FAIL) return; - if (build_shortcut("gVim Diff", "gvim.exe", "-d", - VIM_STARTMENU, WORKDIR) == FAIL) + if (build_shortcut("gMNV Diff", "gmnv.exe", "-d", + MNV_STARTMENU, WORKDIR) == FAIL) return; } if (build_shortcut("Uninstall", interactive ? "uninstall.exe" : "uninstall-gui.exe", "", - VIM_STARTMENU, installdir) == FAIL) + MNV_STARTMENU, installdir) == FAIL) return; - // For Windows NT the working dir of the vimtutor.bat must be right, - // otherwise gvim.exe won't be found and using gvimbat doesn't work. - if (build_shortcut("Vim tutor", "vimtutor.bat", "", - VIM_STARTMENU, installdir) == FAIL) + // For Windows NT the working dir of the mnvtutor.bat must be right, + // otherwise gmnv.exe won't be found and using gmnvbat doesn't work. + if (build_shortcut("MNV tutor", "mnvtutor.bat", "", + MNV_STARTMENU, installdir) == FAIL) return; - if (build_shortcut("Help", has_gvim ? "gvim.exe" : "vim.exe", "-c h", - VIM_STARTMENU, WORKDIR) == FAIL) + if (build_shortcut("Help", has_gmnv ? "gmnv.exe" : "mnv.exe", "-c h", + MNV_STARTMENU, WORKDIR) == FAIL) return; { char shell_folder_path[BUFSIZE]; // Creating the URL shortcut works a bit differently... - if (get_shell_folder_path(shell_folder_path, VIM_STARTMENU) == FAIL) + if (get_shell_folder_path(shell_folder_path, MNV_STARTMENU) == FAIL) { printf("Finding the path of the Start menu failed\n"); return ; } add_pathsep(shell_folder_path); - strcat(shell_folder_path, "Vim Online.url"); + strcat(shell_folder_path, "MNV Online.url"); if (!WritePrivateProfileString("InternetShortcut", "URL", - "https://www.vim.org/", shell_folder_path)) + "https://www.mnv.org/", shell_folder_path)) { - printf("Creating the Vim online URL failed\n"); + printf("Creating the MNV online URL failed\n"); return; } } @@ -1961,12 +1961,12 @@ toggle_startmenu_choice(int idx) if (choices[idx].installfunc == NULL) { choices[idx].installfunc = install_start_menu; - choices[idx].text = "Add Vim to the Start menu"; + choices[idx].text = "Add MNV to the Start menu"; } else { choices[idx].installfunc = NULL; - choices[idx].text = "Do NOT add Vim to the Start menu"; + choices[idx].text = "Do NOT add MNV to the Start menu"; } } @@ -1980,23 +1980,23 @@ toggle_startmenu_choice(int idx) * drag and drop onto the shortcut). */ void -install_shortcut_gvim(int idx) +install_shortcut_gmnv(int idx) { // Create shortcut(s) on the desktop if (choices[idx].arg) { - (void)build_shortcut(icon_names[0], "gvim.exe", + (void)build_shortcut(icon_names[0], "gmnv.exe", "", "desktop", WORKDIR); need_uninstall_entry = 1; } } void -install_shortcut_evim(int idx) +install_shortcut_emnv(int idx) { if (choices[idx].arg) { - (void)build_shortcut(icon_names[1], "gvim.exe", + (void)build_shortcut(icon_names[1], "gmnv.exe", "-y", "desktop", WORKDIR); need_uninstall_entry = 1; } @@ -2007,7 +2007,7 @@ install_shortcut_gview(int idx) { if (choices[idx].arg) { - (void)build_shortcut(icon_names[2], "gvim.exe", + (void)build_shortcut(icon_names[2], "gmnv.exe", "-R", "desktop", WORKDIR); need_uninstall_entry = 1; } @@ -2018,12 +2018,12 @@ toggle_shortcut_choice(int idx) { char *arg; - if (choices[idx].installfunc == install_shortcut_gvim) - arg = "gVim"; - else if (choices[idx].installfunc == install_shortcut_evim) - arg = "gVim Easy"; + if (choices[idx].installfunc == install_shortcut_gmnv) + arg = "gMNV"; + else if (choices[idx].installfunc == install_shortcut_emnv) + arg = "gMNV Easy"; else - arg = "gVim Read-only"; + arg = "gMNV Read-only"; if (choices[idx].arg) { choices[idx].arg = 0; @@ -2053,28 +2053,28 @@ init_startmenu_choice(void) static void init_shortcut_choices(void) { - // Shortcut to gvim + // Shortcut to gmnv choices[choice_count].text = NULL; choices[choice_count].arg = 0; - choices[choice_count].active = has_gvim; + choices[choice_count].active = has_gmnv; choices[choice_count].changefunc = toggle_shortcut_choice; - choices[choice_count].installfunc = install_shortcut_gvim; + choices[choice_count].installfunc = install_shortcut_gmnv; toggle_shortcut_choice(choice_count); ++choice_count; - // Shortcut to evim + // Shortcut to emnv choices[choice_count].text = NULL; choices[choice_count].arg = 0; - choices[choice_count].active = has_gvim; + choices[choice_count].active = has_gmnv; choices[choice_count].changefunc = toggle_shortcut_choice; - choices[choice_count].installfunc = install_shortcut_evim; + choices[choice_count].installfunc = install_shortcut_emnv; toggle_shortcut_choice(choice_count); ++choice_count; // Shortcut to gview choices[choice_count].text = NULL; choices[choice_count].arg = 0; - choices[choice_count].active = has_gvim; + choices[choice_count].active = has_gmnv; choices[choice_count].changefunc = toggle_shortcut_choice; choices[choice_count].installfunc = install_shortcut_gview; toggle_shortcut_choice(choice_count); @@ -2082,17 +2082,17 @@ init_shortcut_choices(void) } /* - * Attempt to register OLE for Vim. + * Attempt to register OLE for MNV. */ static void install_OLE_register(void) { char register_command_string[BUFSIZE + 30]; - printf("\n--- Attempting to register Vim with OLE ---\n"); + printf("\n--- Attempting to register MNV with OLE ---\n"); printf("(There is no message whether this works or not.)\n"); - sprintf(register_command_string, "\"%s\\gvim.exe\" -silent -register", installdir); + sprintf(register_command_string, "\"%s\\gmnv.exe\" -silent -register", installdir); system(register_command_string); } @@ -2124,13 +2124,13 @@ dir_remove_last(const char *path, char to[MAX_PATH]) static void set_directories_text(int idx) { - int vimfiles_dir_choice = choices[idx].arg; + int mnvfiles_dir_choice = choices[idx].arg; - if (vimfiles_dir_choice == (int)vimfiles_dir_none) + if (mnvfiles_dir_choice == (int)mnvfiles_dir_none) alloc_text(idx, "Do NOT create plugin directories%s", ""); else alloc_text(idx, "Create plugin directories: %s", - vimfiles_dir_choices[vimfiles_dir_choice]); + mnvfiles_dir_choices[mnvfiles_dir_choice]); } /* @@ -2159,7 +2159,7 @@ init_homedir(void) /* * Typically, $HOME is not defined on Windows, unless the user has - * specifically defined it for Vim's sake. However, on Windows NT + * specifically defined it for MNV's sake. However, on Windows NT * platforms, $HOMEDRIVE and $HOMEPATH are automatically defined for * each user. Try constructing $HOME from these. */ @@ -2218,18 +2218,18 @@ init_homedir(void) } /* - * Change the directory that the vim plugin directories will be created in: - * $HOME, $VIM or nowhere. + * Change the directory that the mnv plugin directories will be created in: + * $HOME, $MNV or nowhere. */ static void change_directories_choice(int idx) { - int choice_count = TABLE_SIZE(vimfiles_dir_choices); + int choice_count = TABLE_SIZE(mnvfiles_dir_choices); // Don't offer the $HOME choice if $HOME isn't set. if (homedir == NULL) --choice_count; - choices[idx].arg = get_choice(vimfiles_dir_choices, choice_count); + choices[idx].arg = get_choice(mnvfiles_dir_choices, choice_count); set_directories_text(idx); } @@ -2238,33 +2238,33 @@ change_directories_choice(int idx) */ //ARGSUSED static void -install_vimfilesdir(int idx) +install_mnvfilesdir(int idx) { int i; - int vimfiles_dir_choice = choices[idx].arg; + int mnvfiles_dir_choice = choices[idx].arg; char *p; - char vimdir_path[MAX_PATH]; - char vimfiles_path[MAX_PATH + 9]; + char mnvdir_path[MAX_PATH]; + char mnvfiles_path[MAX_PATH + 9]; char tmp_dirname[BUFSIZE]; // switch on the location that the user wants the plugin directories // built in - switch (vimfiles_dir_choice) + switch (mnvfiles_dir_choice) { - case vimfiles_dir_vim: + case mnvfiles_dir_mnv: { - // Go to the %VIM% directory - check env first, then go one dir - // below installdir if there is no %VIM% environment variable. - // The accuracy of $VIM is checked in inspect_system(), so we + // Go to the %MNV% directory - check env first, then go one dir + // below installdir if there is no %MNV% environment variable. + // The accuracy of $MNV is checked in inspect_system(), so we // can be sure it is ok to use here. - p = getenv("VIM"); - if (p == NULL) // No $VIM in path - dir_remove_last(installdir, vimdir_path); + p = getenv("MNV"); + if (p == NULL) // No $MNV in path + dir_remove_last(installdir, mnvdir_path); else - strcpy(vimdir_path, p); + strcpy(mnvdir_path, p); break; } - case vimfiles_dir_home: + case mnvfiles_dir_home: { // Find the $HOME directory. Its existence was already checked. p = homedir; @@ -2273,27 +2273,27 @@ install_vimfilesdir(int idx) printf("Internal error: $HOME is NULL\n"); p = "c:\\"; } - strcpy(vimdir_path, p); + strcpy(mnvdir_path, p); break; } - case vimfiles_dir_none: + case mnvfiles_dir_none: { - // Do not create vim plugin directory. + // Do not create mnv plugin directory. return; } } // Now, just create the directory. If it already exists, it will fail // silently. - sprintf(vimfiles_path, "%s\\vimfiles", vimdir_path); - vim_mkdir(vimfiles_path, 0755); + sprintf(mnvfiles_path, "%s\\mnvfiles", mnvdir_path); + mnv_mkdir(mnvfiles_path, 0755); - printf("Creating the following directories in \"%s\":\n", vimfiles_path); - for (i = 0; i < TABLE_SIZE(vimfiles_subdirs); i++) + printf("Creating the following directories in \"%s\":\n", mnvfiles_path); + for (i = 0; i < TABLE_SIZE(mnvfiles_subdirs); i++) { - sprintf(tmp_dirname, "%s\\%s", vimfiles_path, vimfiles_subdirs[i]); - printf(" %s", vimfiles_subdirs[i]); - vim_mkdir(tmp_dirname, 0755); + sprintf(tmp_dirname, "%s\\%s", mnvfiles_path, mnvfiles_subdirs[i]); + printf(" %s", mnvfiles_subdirs[i]); + mnv_mkdir(tmp_dirname, 0755); } printf("\n"); } @@ -2307,11 +2307,11 @@ init_directories_choice(void) struct stat st; char tmp_dirname[BUFSIZE]; char *p; - int vimfiles_dir_choice; + int mnvfiles_dir_choice; choices[choice_count].text = alloc(150); choices[choice_count].changefunc = change_directories_choice; - choices[choice_count].installfunc = install_vimfilesdir; + choices[choice_count].installfunc = install_mnvfilesdir; choices[choice_count].active = 1; // Check if the "compiler" directory already exists. That's a good @@ -2319,25 +2319,25 @@ init_directories_choice(void) p = getenv("HOME"); if (p != NULL) { - vimfiles_dir_choice = (int)vimfiles_dir_home; - sprintf(tmp_dirname, "%s\\vimfiles\\compiler", p); + mnvfiles_dir_choice = (int)mnvfiles_dir_home; + sprintf(tmp_dirname, "%s\\mnvfiles\\compiler", p); if (stat(tmp_dirname, &st) == 0) - vimfiles_dir_choice = (int)vimfiles_dir_none; + mnvfiles_dir_choice = (int)mnvfiles_dir_none; } else { - vimfiles_dir_choice = (int)vimfiles_dir_vim; - p = getenv("VIM"); - if (p == NULL) // No $VIM in path, use the install dir. + mnvfiles_dir_choice = (int)mnvfiles_dir_mnv; + p = getenv("MNV"); + if (p == NULL) // No $MNV in path, use the install dir. dir_remove_last(installdir, tmp_dirname); else strcpy(tmp_dirname, p); - strcat(tmp_dirname, "\\vimfiles\\compiler"); + strcat(tmp_dirname, "\\mnvfiles\\compiler"); if (stat(tmp_dirname, &st) == 0) - vimfiles_dir_choice = (int)vimfiles_dir_none; + mnvfiles_dir_choice = (int)mnvfiles_dir_none; } - choices[choice_count].arg = vimfiles_dir_choice; + choices[choice_count].arg = mnvfiles_dir_choice; set_directories_text(choice_count); ++choice_count; } @@ -2351,16 +2351,16 @@ setup_choices(void) // install the batch files init_bat_choices(); - // (over) write _vimrc file - init_vimrc_choices(); + // (over) write _mnvrc file + init_mnvrc_choices(); - // Whether to add Vim to the popup menu + // Whether to add MNV to the popup menu init_popup_choice(); - // Whether to add Vim to the "Open With..." menu + // Whether to add MNV to the "Open With..." menu init_openwith_choice(); - // Whether to add Vim to the Start Menu. + // Whether to add MNV to the Start Menu. init_startmenu_choice(); // Whether to add shortcuts to the Desktop. @@ -2373,28 +2373,28 @@ setup_choices(void) static void print_cmd_line_help(void) { - printf("Vim installer non-interactive command line arguments:\n"); + printf("MNV installer non-interactive command line arguments:\n"); printf("\n"); - printf("-create-batfiles [vim gvim evim view gview vimdiff gvimdiff]\n"); - printf(" Create .bat files for Vim variants in the Windows directory.\n"); - printf("-create-vimrc\n"); - printf(" Create a default _vimrc file if one does not already exist.\n"); - printf("-vimrc-remap [no|win]\n"); - printf(" Remap keys when creating a default _vimrc file.\n"); - printf("-vimrc-behave [unix|mswin|default]\n"); - printf(" Set mouse behavior when creating a default _vimrc file.\n"); - printf("-vimrc-compat [vi|vim|defaults|all]\n"); - printf(" Set Vi compatibility when creating a default _vimrc file.\n"); + printf("-create-batfiles [mnv gmnv emnv view gview mnvdiff gmnvdiff]\n"); + printf(" Create .bat files for MNV variants in the Windows directory.\n"); + printf("-create-mnvrc\n"); + printf(" Create a default _mnvrc file if one does not already exist.\n"); + printf("-mnvrc-remap [no|win]\n"); + printf(" Remap keys when creating a default _mnvrc file.\n"); + printf("-mnvrc-behave [unix|mswin|default]\n"); + printf(" Set mouse behavior when creating a default _mnvrc file.\n"); + printf("-mnvrc-compat [vi|mnv|defaults|all]\n"); + printf(" Set Vi compatibility when creating a default _mnvrc file.\n"); printf("-install-popup\n"); - printf(" Install the Edit-with-Vim context menu entry\n"); + printf(" Install the Edit-with-MNV context menu entry\n"); printf("-install-openwith\n"); - printf(" Add Vim to the \"Open With...\" context menu list\n"); + printf(" Add MNV to the \"Open With...\" context menu list\n"); printf("-add-start-menu"); - printf(" Add Vim to the start menu\n"); + printf(" Add MNV to the start menu\n"); printf("-install-icons"); - printf(" Create icons for gVim executables on the desktop\n"); - printf("-create-directories [vim|home]\n"); - printf(" Create runtime directories to drop plugins into; in the $VIM\n"); + printf(" Create icons for gMNV executables on the desktop\n"); + printf("-create-directories [mnv|home]\n"); + printf(" Create runtime directories to drop plugins into; in the $MNV\n"); printf(" or $HOME directory\n"); printf("-register-OLE"); printf(" Ignored\n"); @@ -2419,7 +2419,7 @@ command_line_setup_choices(int argc, char **argv) { i++; for (j = 1; j < TARGET_COUNT; ++j) - if ((targets[j].exenamearg[0] == 'g' ? has_gvim : has_vim) + if ((targets[j].exenamearg[0] == 'g' ? has_gmnv : has_mnv) && strcmp(argv[i], targets[j].name) == 0) { init_bat_choice(j); @@ -2433,13 +2433,13 @@ command_line_setup_choices(int argc, char **argv) break; } } - else if (strcmp(argv[i], "-create-vimrc") == 0) + else if (strcmp(argv[i], "-create-mnvrc") == 0) { - // Setup default vimrc choices. If there is already a _vimrc file, + // Setup default mnvrc choices. If there is already a _mnvrc file, // it will NOT be overwritten. - init_vimrc_choices(); + init_mnvrc_choices(); } - else if (strcmp(argv[i], "-vimrc-remap") == 0) + else if (strcmp(argv[i], "-mnvrc-remap") == 0) { if (i + 1 == argc) break; @@ -2449,7 +2449,7 @@ command_line_setup_choices(int argc, char **argv) else if (strcmp(argv[i], "win") == 0) remap_choice = remap_win; } - else if (strcmp(argv[i], "-vimrc-behave") == 0) + else if (strcmp(argv[i], "-mnvrc-behave") == 0) { if (i + 1 == argc) break; @@ -2461,15 +2461,15 @@ command_line_setup_choices(int argc, char **argv) else if (strcmp(argv[i], "default") == 0) mouse_choice = mouse_default; } - else if (strcmp(argv[i], "-vimrc-compat") == 0) + else if (strcmp(argv[i], "-mnvrc-compat") == 0) { if (i + 1 == argc) break; i++; if (strcmp(argv[i], "vi") == 0) compat_choice = compat_vi; - else if (strcmp(argv[i], "vim") == 0) - compat_choice = compat_vim; + else if (strcmp(argv[i], "mnv") == 0) + compat_choice = compat_mnv; else if (strcmp(argv[i], "defaults") == 0) compat_choice = compat_some_enhancements; else if (strcmp(argv[i], "all") == 0) @@ -2493,20 +2493,20 @@ command_line_setup_choices(int argc, char **argv) } else if (strcmp(argv[i], "-create-directories") == 0) { - int vimfiles_dir_choice = (int)vimfiles_dir_none; + int mnvfiles_dir_choice = (int)mnvfiles_dir_none; init_directories_choice(); if (i + 1 < argc && argv[i + 1][0] != '-') { i++; - if (strcmp(argv[i], "vim") == 0) - vimfiles_dir_choice = (int)vimfiles_dir_vim; + if (strcmp(argv[i], "mnv") == 0) + mnvfiles_dir_choice = (int)mnvfiles_dir_mnv; else if (strcmp(argv[i], "home") == 0) { if (homedir == NULL) // No $HOME in environment - vimfiles_dir_choice = (int)vimfiles_dir_none; + mnvfiles_dir_choice = (int)mnvfiles_dir_none; else - vimfiles_dir_choice = (int)vimfiles_dir_home; + mnvfiles_dir_choice = (int)mnvfiles_dir_home; } else { @@ -2515,13 +2515,13 @@ command_line_setup_choices(int argc, char **argv) print_cmd_line_help(); } } - else // No choice specified, default to vim directory - vimfiles_dir_choice = (int)vimfiles_dir_vim; - choices[choice_count - 1].arg = vimfiles_dir_choice; + else // No choice specified, default to mnv directory + mnvfiles_dir_choice = (int)mnvfiles_dir_mnv; + choices[choice_count - 1].arg = mnvfiles_dir_choice; } else if (strcmp(argv[i], "-register-OLE") == 0) { - // This is always done when gvim is found + // This is always done when gmnv is found } else // Unknown switch { @@ -2542,39 +2542,39 @@ show_help(void) { "Installing .bat files\n" "---------------------\n" -"The vim.bat file is written in one of the directories in $PATH.\n" -"This makes it possible to start Vim from the command line.\n" -"If vim.exe can be found in $PATH, the choice for vim.bat will not be\n" -"present. It is assumed you will use the existing vim.exe.\n" -"If vim.bat can already be found in $PATH this is probably for an old\n" -"version of Vim (but this is not checked!). You can overwrite it.\n" -"If no vim.bat already exists, you can select one of the directories in\n" -"$PATH for creating the batch file, or disable creating a vim.bat file.\n" +"The mnv.bat file is written in one of the directories in $PATH.\n" +"This makes it possible to start MNV from the command line.\n" +"If mnv.exe can be found in $PATH, the choice for mnv.bat will not be\n" +"present. It is assumed you will use the existing mnv.exe.\n" +"If mnv.bat can already be found in $PATH this is probably for an old\n" +"version of MNV (but this is not checked!). You can overwrite it.\n" +"If no mnv.bat already exists, you can select one of the directories in\n" +"$PATH for creating the batch file, or disable creating a mnv.bat file.\n" "\n" -"If you choose not to create the vim.bat file, Vim can still be executed\n" +"If you choose not to create the mnv.bat file, MNV can still be executed\n" "in other ways, but not from the command line.\n" "\n" -"The same applies to choices for gvim, evim, (g)view, and (g)vimdiff.\n" +"The same applies to choices for gmnv, emnv, (g)view, and (g)mnvdiff.\n" "The first item can be used to change the path for all of them.\n" , -"Creating a _vimrc file\n" +"Creating a _mnvrc file\n" "----------------------\n" -"The _vimrc file is used to set options for how Vim behaves.\n" -"The install program can create a _vimrc file with a few basic choices.\n" +"The _mnvrc file is used to set options for how MNV behaves.\n" +"The install program can create a _mnvrc file with a few basic choices.\n" "You can edit this file later to tune your preferences.\n" -"If you already have a _vimrc or .vimrc file it can be overwritten.\n" +"If you already have a _mnvrc or .mnvrc file it can be overwritten.\n" "Don't do that if you have made changes to it.\n" , -"Vim features\n" +"MNV features\n" "------------\n" -"(this choice is only available when creating a _vimrc file)\n" -"1. Vim can run in Vi-compatible mode. Many nice Vim features are then\n" +"(this choice is only available when creating a _mnvrc file)\n" +"1. MNV can run in Vi-compatible mode. Many nice MNV features are then\n" " disabled. Only choose Vi-compatible if you really need full Vi\n" " compatibility.\n" -"2. Vim runs in not-Vi-compatible mode. Vim is still mostly Vi compatible,\n" +"2. MNV runs in not-Vi-compatible mode. MNV is still mostly Vi compatible,\n" " but adds nice features like multi-level undo.\n" -"3. Running Vim with some enhancements is useful when you want some of\n" -" the nice Vim features, but have a slow computer and want to keep it\n" +"3. Running MNV with some enhancements is useful when you want some of\n" +" the nice MNV features, but have a slow computer and want to keep it\n" " really fast.\n" "4. Syntax highlighting shows many files in color. Not only does this look\n" " nice, it also makes it easier to spot errors and you can work faster.\n" @@ -2582,18 +2582,18 @@ show_help(void) , "Windows key mapping\n" "-------------------\n" -"(this choice is only available when creating a _vimrc file)\n" +"(this choice is only available when creating a _mnvrc file)\n" "Under MS-Windows the CTRL-C key copies text to the clipboard and CTRL-V\n" "pastes text from the clipboard. There are a few more keys like these.\n" -"Unfortunately, in Vim these keys normally have another meaning.\n" -"1. Choose to have the keys like they normally are in Vim (useful if you\n" -" also use Vim on other systems).\n" +"Unfortunately, in MNV these keys normally have another meaning.\n" +"1. Choose to have the keys like they normally are in MNV (useful if you\n" +" also use MNV on other systems).\n" "2. Choose to have the keys work like they are used on MS-Windows (useful\n" " if you mostly work on MS-Windows).\n" , "Mouse use\n" "---------\n" -"(this choice is only available when creating a _vimrc file)\n" +"(this choice is only available when creating a _mnvrc file)\n" "The right mouse button can be used in two ways:\n" "1. The Unix way is to extend an existing selection. The popup menu is\n" " not available.\n" @@ -2601,38 +2601,38 @@ show_help(void) " copy/paste text, undo/redo, etc. Extending the selection can still be\n" " done by keeping SHIFT pressed while using the left mouse button\n" , -"Edit-with-Vim context menu entry\n" +"Edit-with-MNV context menu entry\n" "--------------------------------\n" -"(this choice is only available when gvim.exe and gvimext.dll are present)\n" -"You can associate different file types with Vim, so that you can (double)\n" -"click on a file to edit it with Vim. This means you have to individually\n" +"(this choice is only available when gmnv.exe and gmnvext.dll are present)\n" +"You can associate different file types with MNV, so that you can (double)\n" +"click on a file to edit it with MNV. This means you have to individually\n" "select each file type.\n" -"An alternative is the option offered here: Install an \"Edit with Vim\"\n" +"An alternative is the option offered here: Install an \"Edit with MNV\"\n" "entry in the popup menu for the right mouse button. This means you can\n" -"edit any file with Vim.\n" +"edit any file with MNV.\n" , "\"Open With...\" context menu entry\n" "--------------------------------\n" -"(this choice is only available when gvim.exe is present)\n" -"This option adds Vim to the \"Open With...\" entry in the popup menu for\n" +"(this choice is only available when gmnv.exe is present)\n" +"This option adds MNV to the \"Open With...\" entry in the popup menu for\n" "the right mouse button. This also makes it possible to edit HTML files\n" "directly from Internet Explorer.\n" , -"Add Vim to the Start menu\n" +"Add MNV to the Start menu\n" "-------------------------\n" -"In Windows 95 and later, Vim can be added to the Start menu. This will\n" -"create a submenu with an entry for vim, gvim, evim, vimdiff, etc..\n" +"In Windows 95 and later, MNV can be added to the Start menu. This will\n" +"create a submenu with an entry for mnv, gmnv, emnv, mnvdiff, etc..\n" , "Icons on the desktop\n" "--------------------\n" -"(these choices are only available when installing gvim)\n" +"(these choices are only available when installing gmnv)\n" "In Windows 95 and later, shortcuts (icons) can be created on the Desktop.\n" , "Create plugin directories\n" "-------------------------\n" -"Plugin directories allow extending Vim by dropping a file into a directory.\n" +"Plugin directories allow extending MNV by dropping a file into a directory.\n" "This choice allows creating them in $HOME (if you have a home directory) or\n" -"$VIM (used for everybody on the system).\n" +"$MNV (used for everybody on the system).\n" , NULL }; @@ -2680,8 +2680,8 @@ install(void) || !interactive) install_registry(); - // Register gvim with OLE. - if (has_gvim) + // Register gmnv with OLE. + if (has_gmnv) install_OLE_register(); } @@ -2721,12 +2721,12 @@ main(int argc, char **argv) if (argc > 1 && strcmp(argv[1], "-uninstall-check") == 0) { - // Only check for already installed Vims. Used by NSIS installer. + // Only check for already installed MNVs. Used by NSIS installer. i = uninstall_check(1); - // Find the value of $VIM, because NSIS isn't able to do this by + // Find the value of $MNV, because NSIS isn't able to do this by // itself. - get_vim_env(); + get_mnv_env(); // When nothing found exit quietly. If something found wait for // a little while, so that the user can read the messages. @@ -2735,13 +2735,13 @@ main(int argc, char **argv) exit(0); } - printf("This program sets up the installation of Vim " - VIM_VERSION_MEDIUM "\n\n"); + printf("This program sets up the installation of MNV " + MNV_VERSION_MEDIUM "\n\n"); // Check if the user unpacked the archives properly. check_unpack(); - // Check for already installed Vims. + // Check for already installed MNVs. if (interactive) uninstall_check(0); @@ -2778,7 +2778,7 @@ main(int argc, char **argv) { // Install! install(); - printf("\nThat finishes the installation. Happy Vimming!\n"); + printf("\nThat finishes the installation. Happy MNVming!\n"); break; } else if (buf[0] == 'q' || buf[0] == 'Q') diff --git a/uvim/src/dosinst.h b/uvim/src/dosinst.h index 82641f647a..49874531d8 100644 --- a/uvim/src/dosinst.h +++ b/uvim/src/dosinst.h @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * dosinst.h: Common code for dosinst.c and uninstall.c @@ -39,9 +39,9 @@ char *searchpath(char *name); #include "version.h" #if defined(UNIX_LINT) -# define vim_mkdir(x, y) mkdir((char *)(x), y) +# define mnv_mkdir(x, y) mkdir((char *)(x), y) #else -# define vim_mkdir(x, y) _mkdir((char *)(x)) +# define mnv_mkdir(x, y) _mkdir((char *)(x)) #endif #define sleep(n) Sleep((n) * 1000) @@ -79,7 +79,7 @@ char *searchpath(char *name); # define UNUSED #endif -#define VIM_STARTMENU "Programs\\Vim " VIM_VERSION_SHORT +#define MNV_STARTMENU "Programs\\MNV " MNV_VERSION_SHORT int interactive; // non-zero when running interactively @@ -296,7 +296,7 @@ retry: FILE *fd; strcpy(tbuf, shell_folder_path); - strcat(tbuf, "\\vim write test"); + strcat(tbuf, "\\mnv write test"); fd = fopen(tbuf, "w"); if (fd == NULL) { @@ -329,12 +329,12 @@ retry: struct { - char *name; // Vim exe name (without .exe) + char *name; // MNV exe name (without .exe) char *batname; // batch file name char *lnkname; // shortcut file name char *exename; // exe file name char *exenamearg; // exe file name when using exearg - char *exearg; // argument for vim.exe or gvim.exe + char *exearg; // argument for mnv.exe or gmnv.exe char *oldbat; // path to existing xxx.bat or NULL char *oldexe; // path to existing xxx.exe or NULL char batpath[BUFSIZE]; // path of batch file to create; not @@ -342,36 +342,36 @@ struct } targets[TARGET_COUNT] = { {"all", "batch files", NULL, NULL, NULL, NULL, NULL, NULL, ""}, - {"vim", "vim.bat", "Vim.lnk", - "vim.exe", "vim.exe", "", NULL, NULL, ""}, - {"gvim", "gvim.bat", "gVim.lnk", - "gvim.exe", "gvim.exe", "", NULL, NULL, ""}, - {"evim", "evim.bat", "gVim Easy.lnk", - "evim.exe", "gvim.exe", "-y", NULL, NULL, ""}, - {"view", "view.bat", "Vim Read-only.lnk", - "view.exe", "vim.exe", "-R", NULL, NULL, ""}, - {"gview", "gview.bat", "gVim Read-only.lnk", - "gview.exe", "gvim.exe", "-R", NULL, NULL, ""}, - {"vimdiff", "vimdiff.bat", "Vim Diff.lnk", - "vimdiff.exe","vim.exe", "-d", NULL, NULL, ""}, - {"gvimdiff","gvimdiff.bat", "gVim Diff.lnk", - "gvimdiff.exe","gvim.exe", "-d", NULL, NULL, ""}, - {"vimtutor","vimtutor.bat", "Vim tutor.lnk", - "vimtutor.bat", "vimtutor.bat", "", NULL, NULL, ""}, + {"mnv", "mnv.bat", "MNV.lnk", + "mnv.exe", "mnv.exe", "", NULL, NULL, ""}, + {"gmnv", "gmnv.bat", "gMNV.lnk", + "gmnv.exe", "gmnv.exe", "", NULL, NULL, ""}, + {"emnv", "emnv.bat", "gMNV Easy.lnk", + "emnv.exe", "gmnv.exe", "-y", NULL, NULL, ""}, + {"view", "view.bat", "MNV Read-only.lnk", + "view.exe", "mnv.exe", "-R", NULL, NULL, ""}, + {"gview", "gview.bat", "gMNV Read-only.lnk", + "gview.exe", "gmnv.exe", "-R", NULL, NULL, ""}, + {"mnvdiff", "mnvdiff.bat", "MNV Diff.lnk", + "mnvdiff.exe","mnv.exe", "-d", NULL, NULL, ""}, + {"gmnvdiff","gmnvdiff.bat", "gMNV Diff.lnk", + "gmnvdiff.exe","gmnv.exe", "-d", NULL, NULL, ""}, + {"mnvtutor","mnvtutor.bat", "MNV tutor.lnk", + "mnvtutor.bat", "mnvtutor.bat", "", NULL, NULL, ""}, }; -/* Uninstall key for vim.bat, etc. */ -#define VIMBAT_UNINSTKEY "rem # uninstall key: " VIM_VERSION_NODOT " #" +/* Uninstall key for mnv.bat, etc. */ +#define MNVBAT_UNINSTKEY "rem # uninstall key: " MNV_VERSION_NODOT " #" #define ICON_COUNT 3 char *(icon_names[ICON_COUNT]) = - {"gVim " VIM_VERSION_SHORT, - "gVim Easy " VIM_VERSION_SHORT, - "gVim Read only " VIM_VERSION_SHORT}; + {"gMNV " MNV_VERSION_SHORT, + "gMNV Easy " MNV_VERSION_SHORT, + "gMNV Read only " MNV_VERSION_SHORT}; char *(icon_link_names[ICON_COUNT]) = - {"gVim " VIM_VERSION_SHORT ".lnk", - "gVim Easy " VIM_VERSION_SHORT ".lnk", - "gVim Read only " VIM_VERSION_SHORT ".lnk"}; + {"gMNV " MNV_VERSION_SHORT ".lnk", + "gMNV Easy " MNV_VERSION_SHORT ".lnk", + "gMNV Read only " MNV_VERSION_SHORT ".lnk"}; /* This is only used for dosinst.c. */ #if defined(DOSINST) @@ -397,7 +397,7 @@ run_command(char *cmd) // Replace the slashes with backslashes. while ((p = strchr(cmd_path, '/')) != NULL) *p = '\\'; - sprintf(cmd_buf, "%s /c start \"vimcmd\" /wait %s", cmd_path, cmd); + sprintf(cmd_buf, "%s /c start \"mnvcmd\" /wait %s", cmd_path, cmd); free(cmd_path); } else @@ -485,8 +485,8 @@ remove_tail(char *path) char installdir[MAX_PATH-9]; // top of the installation dir, where the // install.exe is located, E.g.: - // "c:\vim\vim60" -int runtimeidx; // index in installdir[] where "vim60" starts + // "c:\mnv\mnv60" +int runtimeidx; // index in installdir[] where "mnv60" starts char *sysdrive; // system drive or "c:\" /* @@ -508,7 +508,7 @@ do_inits(char **argv) // change to the installdir mch_chdir(installdir); - // Find the system drive. Only used for searching the Vim executable, not + // Find the system drive. Only used for searching the MNV executable, not // very important. sysdrive = getenv("SYSTEMDRIVE"); if (sysdrive == NULL || *sysdrive == NUL) diff --git a/uvim/src/drawline.c b/uvim/src/drawline.c index b7910832ba..83ad6d6c6b 100644 --- a/uvim/src/drawline.c +++ b/uvim/src/drawline.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -13,7 +13,7 @@ * lower level. */ -#include "vim.h" +#include "mnv.h" /* * Get the 'listchars' "extends" characters to use for "wp", or NUL if it @@ -248,7 +248,7 @@ handle_foldcolumn(win_T *wp, winlinevars_T *wlv) return; // Allocate a buffer, "wlv->extra[]" may already be in use. - vim_free(wlv->p_extra_free); + mnv_free(wlv->p_extra_free); wlv->p_extra_free = alloc(MAX_MCO * fdc + 1); if (wlv->p_extra_free == NULL) return; @@ -313,7 +313,7 @@ get_sign_display_info( if (nrcol) { wlv->c_extra = NUL; - wlv->n_extra = vim_snprintf((char *)wlv->extra, sizeof(wlv->extra), + wlv->n_extra = mnv_snprintf((char *)wlv->extra, sizeof(wlv->extra), "%-*c ", number_width(wp), SIGN_BYTE); wlv->p_extra = wlv->extra; } @@ -326,7 +326,7 @@ get_sign_display_info( if (nrcol) { wlv->c_extra = NUL; - wlv->n_extra = vim_snprintf((char *)wlv->extra, sizeof(wlv->extra), + wlv->n_extra = mnv_snprintf((char *)wlv->extra, sizeof(wlv->extra), "%-*c ", number_width(wp), MULTISIGN_BYTE); wlv->p_extra = wlv->extra; } @@ -348,9 +348,9 @@ get_sign_display_info( { int width = number_width(wp) - 2; - vim_memset(wlv->extra, ' ', width); + mnv_memset(wlv->extra, ' ', width); wlv->n_extra = width; - wlv->n_extra += vim_snprintf((char *)wlv->extra + width, + wlv->n_extra += mnv_snprintf((char *)wlv->extra + width, sizeof(wlv->extra) - width, "%s ", wlv->p_extra); wlv->p_extra = wlv->extra; } @@ -382,7 +382,7 @@ handle_lnum_col( int sign_present UNUSED, int num_attr UNUSED) { - int has_cpo_n = vim_strchr(p_cpo, CPO_NUMCOL) != NULL; + int has_cpo_n = mnv_strchr(p_cpo, CPO_NUMCOL) != NULL; int lnum_row = wlv->startrow + wlv->filler_lines #ifdef FEAT_PROP_POPUP + wlv->text_prop_above_count @@ -434,7 +434,7 @@ handle_lnum_col( } } - vim_snprintf((char *)wlv->extra, sizeof(wlv->extra), fmt, number_width(wp), num); + mnv_snprintf((char *)wlv->extra, sizeof(wlv->extra), fmt, number_width(wp), num); if (wp->w_skipcol > 0 && wlv->startrow == 0) for (wlv->p_extra = wlv->extra; *wlv->p_extra == ' '; ++wlv->p_extra) @@ -693,7 +693,7 @@ text_prop_position( int after = 0; // spaces after the text int n_used = *n_extra; char_u *l = NULL; - int strsize = vim_strsize(*p_extra); + int strsize = mnv_strsize(*p_extra); int cells = wrap ? strsize : textprop_size_after_trunc(wp, tp->tp_flags, before, padding, *p_extra, &n_used); @@ -759,14 +759,14 @@ text_prop_position( if (n_attr != NULL) { - vim_memset(l, ' ', before); + mnv_memset(l, ' ', before); off += before; if (padding > 0) { - vim_memset(l + off, ' ', padding); + mnv_memset(l + off, ' ', padding); off += padding; } - vim_strncpy(l + off, *p_extra, n_used); + mnv_strncpy(l + off, *p_extra, n_used); off += n_used; } else @@ -790,7 +790,7 @@ text_prop_position( STRCPY(buf, "…"); if (!enc_utf8) { - vimconv_T vc; + mnvconv_T vc; vc.vc_type = CONV_NONE; convert_setup(&vc, (char_u *)"utf-8", p_enc); @@ -812,7 +812,7 @@ text_prop_position( STRCPY(lp, cp); n_used = lp - l + 3 - before - padding; if (cp != buf) - vim_free(cp); + mnv_free(cp); } else // change last character to '>' @@ -820,7 +820,7 @@ text_prop_position( } else if (after > 0) { - vim_memset(l + off, ' ', after); + mnv_memset(l + off, ' ', after); l[off + after] = NUL; } @@ -884,7 +884,7 @@ wlv_screen_line(win_T *wp, winlinevars_T *wlv, int clear_end) if (wp->w_p_nu && wp->w_p_rnu) // Do not overwrite the line number, change "123 text" to // "123<<w_width && VIM_ISDIGIT(ScreenLines[off])) + while (skip < wp->w_width && MNV_ISDIGIT(ScreenLines[off])) { ++off; ++skip; @@ -1059,7 +1059,7 @@ win_line_start(win_T *wp UNUSED, winlinevars_T *wlv, int save_extra) wlv->draw_state = WL_START; wlv->saved_n_extra = wlv->n_extra; wlv->saved_p_extra = wlv->p_extra; - vim_free(wlv->saved_p_extra_free); + mnv_free(wlv->saved_p_extra_free); wlv->saved_p_extra_free = wlv->p_extra_free; wlv->p_extra_free = NULL; wlv->saved_extra_attr = wlv->extra_attr; @@ -1101,7 +1101,7 @@ win_line_continue(winlinevars_T *wlv) wlv->c_extra = wlv->saved_c_extra; wlv->c_final = wlv->saved_c_final; wlv->p_extra = wlv->saved_p_extra; - vim_free(wlv->p_extra_free); + mnv_free(wlv->p_extra_free); wlv->p_extra_free = wlv->saved_p_extra_free; wlv->saved_p_extra_free = NULL; wlv->extra_attr = wlv->saved_extra_attr; @@ -1589,7 +1589,7 @@ win_line( // Get the start of the next line, so that words that wrap to the // next line are found too: "etal.". - // Trick: skip a few chars for C/shell/Vim comments + // Trick: skip a few chars for C/shell/MNV comments nextline[SPWORDLEN] = NUL; if (lnum < wp->w_buffer->b_ml.ml_line_count) { @@ -1656,7 +1656,7 @@ win_line( if (wp->w_lcs_chars.trail) { trailcol = ml_get_buf_len(wp->w_buffer, lnum); - while (trailcol > (colnr_T)0 && VIM_ISWHITE(ptr[trailcol - 1])) + while (trailcol > (colnr_T)0 && MNV_ISWHITE(ptr[trailcol - 1])) --trailcol; trailcol += (colnr_T)(ptr - line); } @@ -1665,7 +1665,7 @@ win_line( wp->w_lcs_chars.leadtab1 != NUL) { leadcol = 0; - while (VIM_ISWHITE(ptr[leadcol])) + while (MNV_ISWHITE(ptr[leadcol])) ++leadcol; if (ptr[leadcol] == NUL) // in a line full of spaces all of them are treated as trailing @@ -1704,7 +1704,7 @@ win_line( // Allocate an array for the indexes. text_prop_idxs = ALLOC_MULT(int, text_prop_count); if (text_prop_idxs == NULL) - VIM_CLEAR(text_props); + MNV_CLEAR(text_props); if (text_props != NULL) { @@ -1747,8 +1747,8 @@ win_line( wlv.row += wlv.text_prop_above_count; if (wlv.row >= endrow) { - vim_free(text_props); - vim_free(text_prop_idxs); + mnv_free(text_props); + mnv_free(text_prop_idxs); return wlv.row; } wlv.screen_row += wlv.text_prop_above_count; @@ -2320,12 +2320,12 @@ win_line( if (wlv.p_extra != prev_p_extra) { // wlv.p_extra was allocated - vim_free(p_extra_free2); + mnv_free(p_extra_free2); p_extra_free2 = wlv.p_extra; } if (above) - wlv.vcol_off_tp += vim_strsize(wlv.p_extra); + wlv.vcol_off_tp += mnv_strsize(wlv.p_extra); if (lcs_eol_one < 0 && wp->w_p_wrap @@ -2848,7 +2848,7 @@ win_line( if ((mb_l == 1 && c >= 0x80) || (mb_l >= 1 && mb_c == 0) - || (mb_l > 1 && (!vim_isprintc(mb_c)))) + || (mb_l > 1 && (!mnv_isprintc(mb_c)))) { // Illegal UTF-8 byte: display as . // Non-BMP character : display as ? or fullwidth ?. @@ -3096,13 +3096,13 @@ win_line( // So only allow to linebreak, once we have found chars not in // 'breakat' in the line. if ( wp->w_p_lbr && !wlv.need_lbr && c != NUL && - !VIM_ISBREAK((int)*ptr)) + !MNV_ISBREAK((int)*ptr)) wlv.need_lbr = TRUE; #endif #ifdef FEAT_LINEBREAK // Found last space before word: check for line break. if (wp->w_p_lbr && c0 == c && wlv.need_lbr - && VIM_ISBREAK(c) && !VIM_ISBREAK((int)*ptr)) + && MNV_ISBREAK(c) && !MNV_ISBREAK((int)*ptr)) { int mb_off = has_mbyte ? (*mb_head_off)(line, ptr - 1) : 0; @@ -3145,7 +3145,7 @@ win_line( if (wlv.n_extra > 0 && c != TAB) in_linebreak = TRUE; # endif - if (VIM_ISWHITE(c)) + if (MNV_ISWHITE(c)) { # ifdef FEAT_CONCEAL if (c == TAB) @@ -3251,7 +3251,7 @@ win_line( } // Handling of non-printable characters. - if (!vim_isprintc(c)) + if (!mnv_isprintc(c)) { // when getting a character from the file, we may have to // turn it into something else on the way to putting it @@ -3333,9 +3333,9 @@ win_line( wlv.n_extra = 0; else { - vim_memset(p, ' ', len); + mnv_memset(p, ' ', len); p[len] = NUL; - vim_free(wlv.p_extra_free); + mnv_free(wlv.p_extra_free); wlv.p_extra_free = p; for (i = 0; i < tab_len; i++) { @@ -3505,10 +3505,10 @@ win_line( wlv.n_extra = 0; else { - vim_memset(p, ' ', wlv.n_extra); + mnv_memset(p, ' ', wlv.n_extra); STRNCPY(p, wlv.p_extra + 1, STRLEN(wlv.p_extra) - 1); p[wlv.n_extra] = NUL; - vim_free(wlv.p_extra_free); + mnv_free(wlv.p_extra_free); wlv.p_extra_free = wlv.p_extra = p; } } @@ -3633,7 +3633,7 @@ win_line( || conceal_cursor_line(wp)) && ((syntax_flags & HL_CONCEAL) != 0 || has_match_conc > 0) && !(lnum_in_visual_area - && vim_strchr(wp->w_p_cocu, 'v') == NULL)) + && mnv_strchr(wp->w_p_cocu, 'v') == NULL)) { int syntax_conceal = (syntax_flags & HL_CONCEAL) != 0; wlv.char_attr = conceal_attr; @@ -3767,7 +3767,7 @@ win_line( #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) // XIM don't send preedit_start and preedit_end, but they send - // preedit_changed and commit. Thus Vim can't set "im_is_active", use + // preedit_changed and commit. Thus MNV can't set "im_is_active", use // im_is_preediting() here. if (p_imst == IM_ON_THE_SPOT && xic != NULL @@ -4501,12 +4501,12 @@ win_line( } // for every character in the line #ifdef FEAT_PROP_POPUP - vim_free(text_props); - vim_free(text_prop_idxs); - vim_free(p_extra_free2); + mnv_free(text_props); + mnv_free(text_prop_idxs); + mnv_free(p_extra_free2); #endif - vim_free(wlv.p_extra_free); - vim_free(wlv.saved_p_extra_free); + mnv_free(wlv.p_extra_free); + mnv_free(wlv.saved_p_extra_free); return wlv.row; } diff --git a/uvim/src/drawscreen.c b/uvim/src/drawscreen.c index 68ba60572c..d6f1113881 100644 --- a/uvim/src/drawscreen.c +++ b/uvim/src/drawscreen.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -63,7 +63,7 @@ * update_screen() called to redraw. */ -#include "vim.h" +#include "mnv.h" static void win_update(win_T *wp); #ifdef FEAT_STL_OPT @@ -526,15 +526,15 @@ win_redr_status(win_T *wp, int ignore_pum UNUSED) *(p + plen) = NUL; // NUL terminate the string } if (bt_help(wp->w_buffer)) - plen += vim_snprintf((char *)p + plen, MAXPATHL - plen, "%s", _("[Help]")); + plen += mnv_snprintf((char *)p + plen, MAXPATHL - plen, "%s", _("[Help]")); #ifdef FEAT_QUICKFIX if (wp->w_p_pvw) - plen += vim_snprintf((char *)p + plen, MAXPATHL - plen, "%s", _("[Preview]")); + plen += mnv_snprintf((char *)p + plen, MAXPATHL - plen, "%s", _("[Preview]")); #endif if (bufIsChanged(wp->w_buffer) && !bt_terminal(wp->w_buffer)) - plen += vim_snprintf((char *)p + plen, MAXPATHL - plen, "%s", "[+]"); + plen += mnv_snprintf((char *)p + plen, MAXPATHL - plen, "%s", "[+]"); if (wp->w_buffer->b_p_ro) - plen += vim_snprintf((char *)p + plen, MAXPATHL - plen, "%s", _("[RO]")); + plen += mnv_snprintf((char *)p + plen, MAXPATHL - plen, "%s", _("[RO]")); this_ru_col = ru_col - (cmdline_width - wp->w_width); n = (wp->w_width + 1) / 2; @@ -776,7 +776,7 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum) // row number, column number is appended // l10n: leave as-is unless a space after the comma is preferred // l10n: do not add any row/column label, due to the limited space - bufferlen = vim_snprintf((char *)buffer, RULER_BUF_LEN, _("%ld,"), + bufferlen = mnv_snprintf((char *)buffer, RULER_BUF_LEN, _("%ld,"), (wp->w_buffer->b_ml.ml_flags & ML_EMPTY) ? 0L : (long)(wp->w_cursor.lnum)); @@ -790,7 +790,7 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum) * screen up on some terminals). */ rel_poslen = get_rel_pos(wp, rel_pos, RULER_BUF_LEN); - n1 = bufferlen + vim_strsize(rel_pos); + n1 = bufferlen + mnv_strsize(rel_pos); if (wp->w_status_height == 0) // can't use last char of screen ++n1; @@ -812,7 +812,7 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum) buffer[bufferlen++] = fillchar; ++n1; } - bufferlen += vim_snprintf((char *)buffer + bufferlen, RULER_BUF_LEN - bufferlen, + bufferlen += mnv_snprintf((char *)buffer + bufferlen, RULER_BUF_LEN - bufferlen, "%s", rel_pos); } // Truncate at window boundary. @@ -1028,7 +1028,7 @@ text_to_screenline(win_T *wp, char_u *text, int col) static void redraw_win_toolbar(win_T *wp) { - vimmenu_T *menu; + mnvmenu_T *menu; int item_idx = 0; int item_count = 0; int col = 0; @@ -1039,7 +1039,7 @@ redraw_win_toolbar(win_T *wp) int fill_attr = syn_name2attr((char_u *)"ToolbarLine"); int button_attr = syn_name2attr((char_u *)"ToolbarButton"); - vim_free(wp->w_winbar_items); + mnv_free(wp->w_winbar_items); FOR_ALL_CHILD_MENUS(wp->w_winbar, menu) ++item_count; wp->w_winbar_items = ALLOC_CLEAR_MULT(winbar_item_T, item_count + 1); @@ -1108,7 +1108,7 @@ copy_text_attr( mch_memmove(ScreenLines + off, buf, (size_t)len); if (enc_utf8) - vim_memset(ScreenLinesUC + off, 0, sizeof(u8char_T) * (size_t)len); + mnv_memset(ScreenLinesUC + off, 0, sizeof(u8char_T) * (size_t)len); for (i = 0; i < len; ++i) ScreenAttrs[off + i] = attr; } @@ -1277,7 +1277,7 @@ fold_line( } } - vim_snprintf((char *)buf, sizeof(buf), fmt, w, num); + mnv_snprintf((char *)buf, sizeof(buf), fmt, w, num); # ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) // the line number isn't reversed @@ -1332,7 +1332,7 @@ fold_line( } if (text != buf) - vim_free(text); + mnv_free(text); // 6. set highlighting for the Visual area an other text. // If all folded lines are in the Visual area, highlight the line. @@ -3135,16 +3135,16 @@ redraw_asap(int type) } } - vim_free(screenline); - vim_free(screenattr); + mnv_free(screenline); + mnv_free(screenattr); if (enc_utf8) { - vim_free(screenlineUC); + mnv_free(screenlineUC); for (i = 0; i < p_mco; ++i) - vim_free(screenlineC[i]); + mnv_free(screenlineC[i]); } if (enc_dbcs == DBCS_JPNU) - vim_free(screenline2); + mnv_free(screenline2); // Show the intro message when appropriate. maybe_intro_message(); @@ -3523,7 +3523,7 @@ f_redraw_listener_add(typval_T *argvars, typval_T *rettv) if (cb.cb_name == NULL) { clear_tv(&tv); - vim_free(rln); + mnv_free(rln); return; } copy_callback(&rln->rl_callbacks.on_start, &cb); @@ -3540,7 +3540,7 @@ f_redraw_listener_add(typval_T *argvars, typval_T *rettv) { clear_tv(&tv); free_callback(&rln->rl_callbacks.on_start); - vim_free(rln); + mnv_free(rln); return; } copy_callback(&rln->rl_callbacks.on_end, &cb); @@ -3552,7 +3552,7 @@ f_redraw_listener_add(typval_T *argvars, typval_T *rettv) if (!got_one) { emsg(_(e_no_redraw_listener_callbacks_defined)); - vim_free(rln); + mnv_free(rln); return; } @@ -3572,7 +3572,7 @@ redraw_listener_free(redraw_listener_T *rln) free_callback(&rln->rl_callbacks.on_start); free_callback(&rln->rl_callbacks.on_end); - vim_free(rln); + mnv_free(rln); } diff --git a/uvim/src/edit.c b/uvim/src/edit.c index 2392361fbf..7a7e8e6462 100644 --- a/uvim/src/edit.c +++ b/uvim/src/edit.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * edit.c: functions for Insert mode */ -#include "vim.h" +#include "mnv.h" #define BACKSPACE_CHAR 1 #define BACKSPACE_WORD 2 @@ -114,7 +114,7 @@ static int dont_sync_undo = FALSE; // CTRL-G U prevents syncing undo for && curwin->w_cursor.col > 0) \ { \ (c) = char_before_cursor(); \ - if (vim_isprintc(c)) \ + if (mnv_isprintc(c)) \ TRIGGER_AUTOCOMPLETE(); \ } \ } while (0) @@ -209,8 +209,8 @@ edit( ptr = (char_u *)"v"; else ptr = (char_u *)"i"; - set_vim_var_string(VV_INSERTMODE, ptr, 1); - set_vim_var_string(VV_CHAR, NULL, -1); // clear v:char + set_mnv_var_string(VV_INSERTMODE, ptr, 1); + set_mnv_var_string(VV_CHAR, NULL, -1); // clear v:char #endif ins_apply_autocmds(EVENT_INSERTENTER); @@ -226,7 +226,7 @@ edit( // Do not restore if v:char was set to a non-empty string. if (!EQUAL_POS(curwin->w_cursor, save_cursor) #ifdef FEAT_EVAL - && *get_vim_var_str(VV_CHAR) == NUL + && *get_mnv_var_str(VV_CHAR) == NUL #endif && save_cursor.lnum <= curbuf->b_ml.ml_line_count) { @@ -438,7 +438,7 @@ edit( string_T inserted = get_inserted(); new_insert_skip = (int)inserted.length; if (inserted.string != NULL) - vim_free(inserted.string); + mnv_free(inserted.string); old_indent = 0; @@ -624,7 +624,7 @@ edit( && curwin->w_cursor.col > 0) { c = char_before_cursor(); - if (vim_isprintc(c)) + if (mnv_isprintc(c)) { ins_compl_enable_autocomplete(); ins_compl_init_get_longest(); @@ -722,7 +722,7 @@ edit( { for (p = str; *p != NUL; MB_PTR_ADV(p)) ins_compl_addleader(PTR2CHAR(p)); - vim_free(str); + mnv_free(str); } else #endif @@ -887,7 +887,7 @@ do_intr: got_int = FALSE; } else - vim_beep(BO_IM); + mnv_beep(BO_IM); break; } doESCkey: @@ -1414,7 +1414,7 @@ normalchar: } AppendToRedobuffLit(str, -1); } - vim_free(str); + mnv_free(str); c = NUL; } @@ -1440,7 +1440,7 @@ normalchar: // Insert a normal character and check for abbreviations on a // special character. Let CTRL-] expand abbreviations without // inserting it. - if (vim_iswordc(c) || (!echeck_abbr( + if (mnv_iswordc(c) || (!echeck_abbr( // Add ABBR_OFF for characters above 0x100, this is // what check_abbr() expects. (has_mbyte && c >= 0x100) ? (c + ABBR_OFF) : c) @@ -1462,7 +1462,7 @@ normalchar: #endif // Trigger autocompletion if (ins_compl_has_autocomplete() && !char_avail() - && vim_isprintc(c)) + && mnv_isprintc(c)) TRIGGER_AUTOCOMPLETE(); break; @@ -1712,7 +1712,7 @@ decodeModifyOtherKeys(int c) { if (p[idx] == ';') ++argidx; - else if (VIM_ISDIGIT(p[idx])) + else if (MNV_ISDIGIT(p[idx])) arg[argidx] = arg[argidx] * 10 + (p[idx] - '0'); else break; @@ -1894,7 +1894,7 @@ truncate_spaces(char_u *line, size_t len) int i; // find start of trailing white space - for (i = (int)len - 1; i >= 0 && VIM_ISWHITE(line[i]); i--) + for (i = (int)len - 1; i >= 0 && MNV_ISWHITE(line[i]); i--) { if (State & REPLACE_FLAG) replace_join(0); // remove a NUL from the replace stack @@ -2018,7 +2018,7 @@ get_literal(int noReduceKeys) { if (hex || unicode != 0) { - if (!vim_isxdigit(nc)) + if (!mnv_isxdigit(nc)) break; cc = cc * 16 + hex2nr(nc); } @@ -2030,7 +2030,7 @@ get_literal(int noReduceKeys) } else { - if (!VIM_ISDIGIT(nc)) + if (!MNV_ISDIGIT(nc)) break; cc = cc * 10 + nc - '0'; } @@ -2189,7 +2189,7 @@ insertchar( */ if (textwidth > 0 && (force_format - || (!VIM_ISWHITE(c) + || (!MNV_ISWHITE(c) && !((State & REPLACE_FLAG) && !(State & VREPLACE_FLAG) && *ml_get_cursor() != NUL) @@ -2236,14 +2236,14 @@ insertchar( * comment leader. First, check what comment leader we can find. */ i = get_leader_len(line = ml_get_curline(), &p, FALSE, TRUE); - if (i > 0 && vim_strchr(p, COM_MIDDLE) != NULL) // Just checking + if (i > 0 && mnv_strchr(p, COM_MIDDLE) != NULL) // Just checking { // Skip middle-comment string while (*p && p[-1] != ':') // find end of middle flags ++p; middle_len = copy_option_part(&p, lead_end, COM_MAX_LEN, ","); // Don't count trailing white space for middle_len - while (middle_len > 0 && VIM_ISWHITE(lead_end[middle_len - 1])) + while (middle_len > 0 && MNV_ISWHITE(lead_end[middle_len - 1])) --middle_len; // Find the end-comment string @@ -2253,7 +2253,7 @@ insertchar( // Skip white space before the cursor i = curwin->w_cursor.col; - while (--i >= 0 && VIM_ISWHITE(line[i])) + while (--i >= 0 && MNV_ISWHITE(line[i])) ; i++; @@ -2332,7 +2332,7 @@ insertchar( && i < INPUT_BUFLEN && (textwidth == 0 || (virtcol += byte2cells(buf[i - 1])) < (colnr_T)textwidth) - && !(!no_abbr && !vim_iswordc(c) && vim_iswordc(buf[i - 1]))) + && !(!no_abbr && !mnv_iswordc(c) && mnv_iswordc(buf[i - 1]))) { #ifdef FEAT_RIGHTLEFT c = vgetc(); @@ -2394,9 +2394,9 @@ redo_literal(int c) // Only digits need special treatment. Translate them into a string of // three digits. - if (VIM_ISDIGIT(c)) + if (MNV_ISDIGIT(c)) { - vim_snprintf((char *)buf, sizeof(buf), "%03d", c); + mnv_snprintf((char *)buf, sizeof(buf), "%03d", c); AppendToRedobuff(buf); } else @@ -2539,12 +2539,12 @@ stop_insert( int added = inserted.string == NULL ? 0 : (int)inserted.length - new_insert_skip; if (did_restart_edit == 0 || added > 0) { - vim_free(last_insert.string); + mnv_free(last_insert.string); last_insert = inserted; // structure copy last_insert_skip = added < 0 ? 0 : new_insert_skip; } else - vim_free(inserted.string); + mnv_free(inserted.string); if (!arrow_used && end_insert_pos != NULL) { @@ -2564,13 +2564,13 @@ stop_insert( { dec_cursor(); cc = gchar_cursor(); - if (!VIM_ISWHITE(cc)) + if (!MNV_ISWHITE(cc)) curwin->w_cursor = tpos; } auto_format(TRUE, FALSE); - if (VIM_ISWHITE(cc)) + if (MNV_ISWHITE(cc)) { if (gchar_cursor() != NUL) inc_cursor(); @@ -2591,7 +2591,7 @@ stop_insert( // Do this when ESC was used or moving the cursor up/down. // Check for the old position still being valid, just in case the text // got changed unexpectedly. - if (!nomove && did_ai && (esc || (vim_strchr(p_cpo, CPO_INDENT) == NULL + if (!nomove && did_ai && (esc || (mnv_strchr(p_cpo, CPO_INDENT) == NULL && curwin->w_cursor.lnum != end_insert_pos->lnum)) && end_insert_pos->lnum <= curbuf->b_ml.ml_line_count) { @@ -2605,7 +2605,7 @@ stop_insert( if (gchar_cursor() == NUL && curwin->w_cursor.col > 0) --curwin->w_cursor.col; cc = gchar_cursor(); - if (!VIM_ISWHITE(cc)) + if (!MNV_ISWHITE(cc)) break; if (del_char(TRUE) == FAIL) break; // should not happen @@ -2651,7 +2651,7 @@ set_last_insert(int c) { char_u *s; - vim_free(last_insert.string); + mnv_free(last_insert.string); last_insert.string = alloc(MB_MAXBYTES * 3 + 5); if (last_insert.string == NULL) { @@ -2674,7 +2674,7 @@ set_last_insert(int c) void free_last_insert(void) { - VIM_CLEAR_STRING(last_insert); + MNV_CLEAR_STRING(last_insert); } #endif @@ -2736,7 +2736,7 @@ beginline(int flags) { char_u *ptr; - for (ptr = ml_get_curline(); VIM_ISWHITE(*ptr) + for (ptr = ml_get_curline(); MNV_ISWHITE(*ptr) && !((flags & BL_FIX) && ptr[1] == NUL); ++ptr) ++curwin->w_cursor.col; } @@ -2766,7 +2766,7 @@ oneright(void) // Adjust for multi-wide char (excluding TAB) ptr = ml_get_cursor(); coladvance(getviscol() + ((*ptr != TAB - && vim_isprintc((*mb_ptr2char)(ptr))) + && mnv_isprintc((*mb_ptr2char)(ptr))) ? ptr2cells(ptr) : 1)); curwin->w_set_curswant = TRUE; // Return OK if the cursor moved, FAIL otherwise (at window edge). @@ -2831,7 +2831,7 @@ oneleft(void) // Adjust for multi-wide char (not a TAB) ptr = ml_get_cursor(); - if (*ptr != TAB && vim_isprintc((*mb_ptr2char)(ptr)) + if (*ptr != TAB && mnv_isprintc((*mb_ptr2char)(ptr)) && ptr2cells(ptr) > 1) curwin->w_cursor.coladd = 0; } @@ -2907,7 +2907,7 @@ cursor_up( // larger than the line number and '-' is in 'cpoptions' linenr_T lnum = curwin->w_cursor.lnum; if (n > 0 && (lnum <= 1 - || (n >= lnum && vim_strchr(p_cpo, CPO_MINUS) != NULL))) + || (n >= lnum && mnv_strchr(p_cpo, CPO_MINUS) != NULL))) return FAIL; cursor_up_inner(curwin, n); @@ -2976,7 +2976,7 @@ cursor_down( if (n > 0 && (lnum >= line_count || (lnum + n > line_count - && vim_strchr(p_cpo, CPO_MINUS) != NULL))) + && mnv_strchr(p_cpo, CPO_MINUS) != NULL))) return FAIL; cursor_down_inner(curwin, n); @@ -3101,7 +3101,7 @@ get_last_insert_save(void) if (insert.string == NULL) return NULL; - s = vim_strnsave(insert.string, insert.length); + s = mnv_strnsave(insert.string, insert.length); if (s == NULL) return NULL; @@ -3172,7 +3172,7 @@ replace_push( { mch_memmove(p, replace_stack, (size_t)(replace_stack_nr * sizeof(char_u))); - vim_free(replace_stack); + mnv_free(replace_stack); } replace_stack = p; } @@ -3310,7 +3310,7 @@ mb_replace_pop_ins(int cc) static void replace_flush(void) { - VIM_CLEAR(replace_stack); + MNV_CLEAR(replace_stack); replace_stack_len = 0; replace_stack_nr = 0; } @@ -3559,7 +3559,7 @@ ins_reg(void) } if (regname == NUL || !valid_yank_reg(regname, FALSE)) { - vim_beep(BO_REG); + mnv_beep(BO_REG); need_redraw = TRUE; // remove the '"' } else @@ -3577,7 +3577,7 @@ ins_reg(void) } else if (insert_reg(regname, literally) == FAIL) { - vim_beep(BO_REG); + mnv_beep(BO_REG); need_redraw = TRUE; // remove the '"' } else if (stop_insert_mode) @@ -3660,7 +3660,7 @@ ins_ctrl_g(void) break; // Unknown CTRL-G command, reserved for future expansion. - default: vim_beep(BO_CTRLG); + default: mnv_beep(BO_CTRLG); } } @@ -3771,7 +3771,7 @@ ins_esc( if (--*count > 0) // repeat what was typed { // Vi repeats the insert without replacing characters. - if (vim_strchr(p_cpo, CPO_REPLCNT) != NULL) + if (mnv_strchr(p_cpo, CPO_REPLCNT) != NULL) State &= ~REPLACE_FLAG; (void)start_redo_ins(); @@ -3969,7 +3969,7 @@ ins_start_select(int c) ins_insert(int replaceState) { #ifdef FEAT_EVAL - set_vim_var_string(VV_INSERTMODE, + set_mnv_var_string(VV_INSERTMODE, (char_u *)((State & REPLACE_FLAG) ? "i" : replaceState == MODE_VREPLACE ? "v" : "r"), 1); #endif @@ -4057,7 +4057,7 @@ ins_del(void) temp = curwin->w_cursor.col; if (!can_bs(BS_EOL) // only if "eol" included || do_join(2, FALSE, TRUE, FALSE, FALSE) == FAIL) - vim_beep(BO_BS); + mnv_beep(BO_BS); else { curwin->w_cursor.col = temp; @@ -4070,7 +4070,7 @@ ins_del(void) } } else if (del_char(FALSE) == FAIL) // delete char under cursor - vim_beep(BO_BS); + mnv_beep(BO_BS); did_ai = FALSE; did_si = FALSE; can_si = FALSE; @@ -4141,7 +4141,7 @@ ins_bs( && curwin->w_cursor.col <= ai_col) || (!can_bs(BS_EOL) && curwin->w_cursor.col == 0)))) { - vim_beep(BO_BS); + mnv_beep(BO_BS); return FALSE; } @@ -4241,7 +4241,7 @@ ins_bs( if (curbuf->b_ml.ml_flags & (ML_LINE_DIRTY | ML_ALLOCATED)) - vim_free(curbuf->b_ml.ml_line_ptr); + mnv_free(curbuf->b_ml.ml_line_ptr); curbuf->b_ml.ml_line_ptr = newp; curbuf->b_ml.ml_line_len--; curbuf->b_ml.ml_line_textlen--; @@ -4354,7 +4354,7 @@ ins_bs( // Use chartabsize() so that virtual text and wrapping are ignored. while (ptr < cursor_ptr) { - int cur_space = VIM_ISWHITE(*ptr); + int cur_space = MNV_ISWHITE(*ptr); if (!prev_space && cur_space) { @@ -4439,14 +4439,14 @@ ins_bs( } // start of word? - if (mode == BACKSPACE_WORD && !vim_isspace(cc)) + if (mode == BACKSPACE_WORD && !mnv_isspace(cc)) { mode = BACKSPACE_WORD_NOT_SPACE; - temp = vim_iswordc(cc); + temp = mnv_iswordc(cc); } // end of word? else if (mode == BACKSPACE_WORD_NOT_SPACE - && ((vim_isspace(cc) || vim_iswordc(cc) != temp) + && ((mnv_isspace(cc) || mnv_iswordc(cc) != temp) || prev_cclass != cclass)) { #ifdef FEAT_RIGHTLEFT @@ -4521,12 +4521,12 @@ ins_bs( // vi behaviour: the cursor moves backward but the character that // was there remains visible - // Vim behaviour: the cursor moves backward and the character that + // MNV behaviour: the cursor moves backward and the character that // was there is erased from the screen. // We can emulate the vi behaviour by pretending there is a dollar // displayed even when there isn't. // --pkv Sun Jan 19 01:56:40 EST 2003 - if (vim_strchr(p_cpo, CPO_BACKSPACE) != NULL && dollar_vcol == -1) + if (mnv_strchr(p_cpo, CPO_BACKSPACE) != NULL && dollar_vcol == -1) dollar_vcol = curwin->w_virtcol; #ifdef FEAT_FOLDING @@ -4734,7 +4734,7 @@ ins_left(void) * if 'whichwrap' set for cursor in insert mode may go to * previous line */ - else if (vim_strchr(p_ww, '[') != NULL && curwin->w_cursor.lnum > 1) + else if (mnv_strchr(p_ww, '[') != NULL && curwin->w_cursor.lnum > 1) { // always break undo when moving upwards/downwards, else undo may break start_arrow(&tpos); @@ -4743,7 +4743,7 @@ ins_left(void) curwin->w_set_curswant = TRUE; // so we stay at the end } else - vim_beep(BO_CRSR); + mnv_beep(BO_CRSR); dont_sync_undo = FALSE; } @@ -4803,7 +4803,7 @@ ins_s_left(void) curwin->w_set_curswant = TRUE; } else - vim_beep(BO_CRSR); + mnv_beep(BO_CRSR); dont_sync_undo = FALSE; } @@ -4841,7 +4841,7 @@ ins_right(void) } // if 'whichwrap' set for cursor in insert mode, may move the // cursor to the next line - else if (vim_strchr(p_ww, ']') != NULL + else if (mnv_strchr(p_ww, ']') != NULL && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { start_arrow(&curwin->w_cursor); @@ -4850,7 +4850,7 @@ ins_right(void) curwin->w_cursor.col = 0; } else - vim_beep(BO_CRSR); + mnv_beep(BO_CRSR); dont_sync_undo = FALSE; } @@ -4873,7 +4873,7 @@ ins_s_right(void) curwin->w_set_curswant = TRUE; } else - vim_beep(BO_CRSR); + mnv_beep(BO_CRSR); dont_sync_undo = FALSE; } @@ -4903,7 +4903,7 @@ ins_up( can_cindent = TRUE; } else - vim_beep(BO_CRSR); + mnv_beep(BO_CRSR); } static void @@ -4931,7 +4931,7 @@ ins_pageup(void) can_cindent = TRUE; } else - vim_beep(BO_CRSR); + mnv_beep(BO_CRSR); } static void @@ -4960,7 +4960,7 @@ ins_down( can_cindent = TRUE; } else - vim_beep(BO_CRSR); + mnv_beep(BO_CRSR); } static void @@ -4988,7 +4988,7 @@ ins_pagedown(void) can_cindent = TRUE; } else - vim_beep(BO_CRSR); + mnv_beep(BO_CRSR); } #ifdef FEAT_DND @@ -5119,7 +5119,7 @@ ins_tab(void) { pos = curwin->w_cursor; cursor = &pos; - saved_line = vim_strnsave(ml_get_curline(), ml_get_curline_len()); + saved_line = mnv_strnsave(ml_get_curline(), ml_get_curline_len()); if (saved_line == NULL) return FALSE; ptr = saved_line + pos.col; @@ -5131,12 +5131,12 @@ ins_tab(void) } // When 'L' is not in 'cpoptions' a tab always takes up 'ts' spaces. - if (vim_strchr(p_cpo, CPO_LISTWM) == NULL) + if (mnv_strchr(p_cpo, CPO_LISTWM) == NULL) curwin->w_p_list = FALSE; // Find first white before the cursor fpos = curwin->w_cursor; - while (fpos.col > 0 && VIM_ISWHITE(ptr[-1])) + while (fpos.col > 0 && MNV_ISWHITE(ptr[-1])) { --fpos.col; --ptr; @@ -5159,7 +5159,7 @@ ins_tab(void) // Use as many TABs as possible. Beware of 'breakindent', 'showbreak' // and 'linebreak' adding extra virtual columns. - while (VIM_ISWHITE(*ptr)) + while (MNV_ISWHITE(*ptr)) { i = lbr_chartabsize(&cts); if (cts.cts_vcol + i > want_vcol) @@ -5227,7 +5227,7 @@ ins_tab(void) curbuf->b_ml.ml_line_len - col - i); if (curbuf->b_ml.ml_flags & (ML_LINE_DIRTY | ML_ALLOCATED)) - vim_free(curbuf->b_ml.ml_line_ptr); + mnv_free(curbuf->b_ml.ml_line_ptr); curbuf->b_ml.ml_line_ptr = newp; curbuf->b_ml.ml_line_len -= i; curbuf->b_ml.ml_line_textlen = 0; @@ -5270,7 +5270,7 @@ ins_tab(void) } if (State & VREPLACE_FLAG) - vim_free(saved_line); + mnv_free(saved_line); curwin->w_p_list = save_list; } @@ -5431,7 +5431,7 @@ ins_copychar(linenr_T lnum) if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count) { - vim_beep(BO_COPY); + mnv_beep(BO_COPY); return NUL; } @@ -5453,7 +5453,7 @@ ins_copychar(linenr_T lnum) c = (*mb_ptr2char)(ptr); if (c == NUL) - vim_beep(BO_COPY); + mnv_beep(BO_COPY); return c; } @@ -5513,7 +5513,7 @@ get_nolist_virtcol(void) || curwin->w_buffer->b_ml.ml_mfp == NULL || curwin->w_cursor.lnum > curwin->w_buffer->b_ml.ml_line_count) return 0; - if (curwin->w_p_list && vim_strchr(p_cpo, CPO_LISTWM) == NULL) + if (curwin->w_p_list && mnv_strchr(p_cpo, CPO_LISTWM) == NULL) return getvcol_nolist(&curwin->w_cursor); validate_virtcol(); return curwin->w_virtcol; @@ -5552,7 +5552,7 @@ do_insert_char_pre(int c) // Lock the text to avoid weird things from happening. ++textlock; - set_vim_var_string(VV_CHAR, buf, (int)buflen); // set v:char + set_mnv_var_string(VV_CHAR, buf, (int)buflen); // set v:char res = NULL; if (ins_apply_autocmds(EVENT_INSERTCHARPRE)) @@ -5560,11 +5560,11 @@ do_insert_char_pre(int c) // Get the value of v:char. It may be empty or more than one // character. Only use it when changed, otherwise continue with the // original character to avoid breaking autoindent. - if (STRCMP(buf, get_vim_var_str(VV_CHAR)) != 0) - res = vim_strsave(get_vim_var_str(VV_CHAR)); + if (STRCMP(buf, get_mnv_var_str(VV_CHAR)) != 0) + res = mnv_strsave(get_mnv_var_str(VV_CHAR)); } - set_vim_var_string(VV_CHAR, NULL, -1); // clear v:char + set_mnv_var_string(VV_CHAR, NULL, -1); // clear v:char --textlock; // Restore the State, it may have been changed. diff --git a/uvim/src/errors.h b/uvim/src/errors.h index fba5b93f19..bc031a89a7 100644 --- a/uvim/src/errors.h +++ b/uvim/src/errors.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ // Use PLURAL_MSG() for messages that are passed to ngettext(), so that the @@ -29,8 +29,8 @@ EXTERN char e_backslash_should_be_followed_by[] INIT(= N_("E10: \\ should be followed by /, ? or &")); EXTERN char e_invalid_in_cmdline_window[] INIT(= N_("E11: Invalid in command-line window; :q closes the window")); -EXTERN char e_command_not_allowed_from_vimrc_in_current_dir_or_tag_search[] - INIT(= N_("E12: Command not allowed from exrc/vimrc in current dir or tag search")); +EXTERN char e_command_not_allowed_from_mnvrc_in_current_dir_or_tag_search[] + INIT(= N_("E12: Command not allowed from exrc/mnvrc in current dir or tag search")); EXTERN char e_file_exists[] INIT(= N_("E13: File exists (add ! to override)")); // E14 unused @@ -63,7 +63,7 @@ EXTERN char e_no_alternate_file[] INIT(= N_("E23: No alternate file")); EXTERN char e_no_such_abbreviation[] INIT(= N_("E24: No such abbreviation")); -#if !defined(FEAT_GUI) || defined(VIMDLL) +#if !defined(FEAT_GUI) || defined(MNVDLL) EXTERN char e_gui_cannot_be_used_not_enabled_at_compile_time[] INIT(= N_("E25: GUI cannot be used: Not enabled at compile time")); #endif @@ -321,13 +321,13 @@ EXTERN char e_cannot_move_range_of_lines_into_itself[] INIT(= N_("E134: Cannot move a range of lines into itself")); EXTERN char e_filter_autocommands_must_not_change_current_buffer[] INIT(= N_("E135: *Filter* Autocommands must not change current buffer")); -#if defined(FEAT_VIMINFO) -EXTERN char e_viminfo_too_many_errors_skipping_rest_of_file[] - INIT(= N_("E136: viminfo: Too many errors, skipping rest of file")); -EXTERN char e_viminfo_file_is_not_writable_str[] - INIT(= N_("E137: Viminfo file is not writable: %s")); -EXTERN char e_cant_write_viminfo_file_str[] - INIT(= N_("E138: Can't write viminfo file %s!")); +#if defined(FEAT_MNVINFO) +EXTERN char e_mnvinfo_too_many_errors_skipping_rest_of_file[] + INIT(= N_("E136: mnvinfo: Too many errors, skipping rest of file")); +EXTERN char e_mnvinfo_file_is_not_writable_str[] + INIT(= N_("E137: MNVinfo file is not writable: %s")); +EXTERN char e_cant_write_mnvinfo_file_str[] + INIT(= N_("E138: Can't write mnvinfo file %s!")); #endif EXTERN char e_file_is_loaded_in_another_buffer[] INIT(= N_("E139: File is loaded in another buffer")); @@ -341,8 +341,8 @@ EXTERN char e_autocommands_unexpectedly_deleted_new_buffer_str[] INIT(= N_("E143: Autocommands unexpectedly deleted new buffer %s")); EXTERN char e_non_numeric_argument_to_z[] INIT(= N_("E144: Non-numeric argument to :z")); -EXTERN char e_shell_commands_and_some_functionality_not_allowed_in_rvim[] - INIT(= N_("E145: Shell commands and some functionality not allowed in rvim")); +EXTERN char e_shell_commands_and_some_functionality_not_allowed_in_rmnv[] + INIT(= N_("E145: Shell commands and some functionality not allowed in rmnv")); EXTERN char e_regular_expressions_cant_be_delimited_by_letters[] INIT(= N_("E146: Regular expressions can't be delimited by letters")); EXTERN char e_cannot_do_global_recursive_with_range[] @@ -461,9 +461,9 @@ EXTERN char e_str_not_inside_function[] #endif EXTERN char e_no_alternate_file_name_to_substitute_for_hash[] INIT(= N_("E194: No alternate file name to substitute for '#'")); -#ifdef FEAT_VIMINFO -EXTERN char e_cannot_open_viminfo_file_for_reading[] - INIT(= N_("E195: Cannot open viminfo file for reading")); +#ifdef FEAT_MNVINFO +EXTERN char e_cannot_open_mnvinfo_file_for_reading[] + INIT(= N_("E195: Cannot open mnvinfo file for reading")); #endif #ifndef FEAT_DIGRAPHS EXTERN char e_no_digraphs_version[] @@ -614,8 +614,8 @@ EXTERN char e_fonts_for_the_following_charsets_are_missing_in_fontset[] INIT(= N_("E250: Fonts for the following charsets are missing in fontset %s:")); #endif #ifdef FEAT_CLIENTSERVER -EXTERN char e_vim_instance_registry_property_is_badly_formed_deleted[] - INIT(= N_("E251: VIM instance registry property is badly formed. Deleted!")); +EXTERN char e_mnv_instance_registry_property_is_badly_formed_deleted[] + INIT(= N_("E251: MNV instance registry property is badly formed. Deleted!")); #endif #ifdef FEAT_GUI_X11 EXTERN char e_fontsent_name_str_font_str_is_not_fixed_width[] @@ -709,7 +709,7 @@ EXTERN char e_sorry_plusplusshell_not_supported_on_this_system[] #endif #ifdef FEAT_TCL EXTERN char e_tcl_fatal_error_reflist_corrupt_please_report_this[] - INIT(= "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim.org"); + INIT(= "E280: TCL FATAL ERROR: reflist corrupt!? Please report this to mnv-dev@mnv.org"); #endif // E281 unused EXTERN char e_cannot_read_from_str_2[] @@ -775,8 +775,8 @@ EXTERN char e_no_swap_file_found_for_str[] INIT(= N_("E305: No swap file found for %s")); EXTERN char e_cannot_open_str[] INIT(= N_("E306: Cannot open %s")); -EXTERN char e_str_does_not_look_like_vim_swap_file[] - INIT(= N_("E307: %s does not look like a Vim swap file")); +EXTERN char e_str_does_not_look_like_mnv_swap_file[] + INIT(= N_("E307: %s does not look like a MNV swap file")); EXTERN char e_warning_original_file_may_have_been_changed[] INIT(= N_("E308: Warning: Original file may have been changed")); EXTERN char e_unable_to_read_block_one_from_str[] @@ -1333,7 +1333,7 @@ EXTERN char e_missing_colon[] INIT(= N_("E524: Missing colon")); EXTERN char e_zero_length_string[] INIT(= N_("E525: Zero length string")); -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO EXTERN char e_missing_number_after_angle_str_angle[] INIT(= N_("E526: Missing number after <%s>")); EXTERN char e_missing_comma[] @@ -1465,7 +1465,7 @@ EXTERN char e_exit_code_nr[] EXTERN char e_invalid_server_id_used_str[] INIT(= N_("E573: Invalid server id used: %s")); #endif -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO EXTERN char e_unknown_register_type_nr[] INIT(= N_("E574: Unknown register type %d")); // E575 @@ -1554,8 +1554,8 @@ EXTERN char e_finally_without_try[] INIT(= N_("E606: :finally without :try")); EXTERN char e_multiple_finally[] INIT(= N_("E607: Multiple :finally")); -EXTERN char e_cannot_throw_exceptions_with_vim_prefix[] - INIT(= N_("E608: Cannot :throw exceptions with 'Vim' prefix")); +EXTERN char e_cannot_throw_exceptions_with_mnv_prefix[] + INIT(= N_("E608: Cannot :throw exceptions with 'MNV' prefix")); #endif #ifdef FEAT_CSCOPE EXTERN char e_cscope_error_str[] @@ -1750,8 +1750,8 @@ EXTERN char e_error_writing_temp_file[] EXTERN char e_invalid_character_after_str_2[] INIT(= N_("E678: Invalid character after %s%%[dxouU]")); #ifdef FEAT_SYN_HL -EXTERN char e_recursive_loop_loading_syncolor_vim[] - INIT(= N_("E679: Recursive loop loading syncolor.vim")); +EXTERN char e_recursive_loop_loading_syncolor_mnv[] + INIT(= N_("E679: Recursive loop loading syncolor.mnv")); #endif EXTERN char e_buffer_nr_invalid_buffer_number[] INIT(= N_("E680: : invalid buffer number")); @@ -1964,8 +1964,8 @@ EXTERN char e_unsupported_section_in_spell_file[] INIT(= N_("E770: Unsupported section in spell file")); EXTERN char e_old_spell_file_needs_to_be_updated[] INIT(= N_("E771: Old spell file, needs to be updated")); -EXTERN char e_spell_file_is_for_newer_version_of_vim[] - INIT(= N_("E772: Spell file is for newer version of Vim")); +EXTERN char e_spell_file_is_for_newer_version_of_mnv[] + INIT(= N_("E772: Spell file is for newer version of MNV")); #endif EXTERN char e_symlink_loop_for_str[] INIT(= N_("E773: Symlink loop for \"%s\"")); @@ -1989,8 +1989,8 @@ EXTERN char e_this_does_not_look_like_sug_file_str[] INIT(= N_("E778: This does not look like a .sug file: %s")); EXTERN char e_old_sug_file_needs_to_be_updated_str[] INIT(= N_("E779: Old .sug file, needs to be updated: %s")); -EXTERN char e_sug_file_is_for_newer_version_of_vim_str[] - INIT(= N_("E780: .sug file is for newer version of Vim: %s")); +EXTERN char e_sug_file_is_for_newer_version_of_mnv_str[] + INIT(= N_("E780: .sug file is for newer version of MNV: %s")); EXTERN char e_sug_file_doesnt_match_spl_file_str[] INIT(= N_("E781: .sug file doesn't match .spl file: %s")); EXTERN char e_error_while_reading_sug_file_str[] @@ -2149,18 +2149,18 @@ EXTERN char e_non_encrypted_file_has_encrypted_undo_file_str[] INIT(= N_("E832: Non-encrypted file has encrypted undo file: %s")); # endif #else -EXTERN char e_str_is_encrypted_and_this_version_of_vim_does_not_support_encryption[] - INIT(= N_("E833: %s is encrypted and this version of Vim does not support encryption")); +EXTERN char e_str_is_encrypted_and_this_version_of_mnv_does_not_support_encryption[] + INIT(= N_("E833: %s is encrypted and this version of MNV does not support encryption")); #endif EXTERN char e_conflicts_with_value_of_listchars[] INIT(= N_("E834: Conflicts with value of 'listchars'")); EXTERN char e_conflicts_with_value_of_fillchars[] INIT(= N_("E835: Conflicts with value of 'fillchars'")); #ifdef DYNAMIC_PYTHON -EXTERN char e_this_vim_cannot_execute_python_after_using_py3[] - INIT(= N_("E836: This Vim cannot execute :python after using :py3")); -EXTERN char e_this_vim_cannot_execute_py3_after_using_python[] - INIT(= N_("E837: This Vim cannot execute :py3 after using :python")); +EXTERN char e_this_mnv_cannot_execute_python_after_using_py3[] + INIT(= N_("E836: This MNV cannot execute :python after using :py3")); +EXTERN char e_this_mnv_cannot_execute_py3_after_using_python[] + INIT(= N_("E837: This MNV cannot execute :py3 after using :python")); #endif #if defined(FEAT_NETBEANS_INTG) && defined(FEAT_GUI) EXTERN char e_netbeans_is_not_supported_with_this_GUI[] @@ -2224,8 +2224,8 @@ EXTERN char e_dictionary_key_str_required[] #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) EXTERN char e_eval_did_not_return_valid_python_object[] INIT(= N_("E858: Eval did not return a valid python object")); -EXTERN char e_failed_to_convert_returned_python_object_to_vim_value[] - INIT(= N_("E859: Failed to convert returned python object to a Vim value")); +EXTERN char e_failed_to_convert_returned_python_object_to_mnv_value[] + INIT(= N_("E859: Failed to convert returned python object to a MNV value")); #endif #ifdef FEAT_PROP_POPUP EXTERN char e_need_id_and_type_or_types_with_both[] @@ -2281,8 +2281,8 @@ EXTERN char e_nfa_regexp_too_many_z[] INIT(= N_("E879: (NFA regexp) Too many \\z(")); #endif #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) -EXTERN char e_cant_handle_systemexit_of_python_exception_in_vim[] - INIT(= N_("E880: Can't handle SystemExit of python exception in vim")); +EXTERN char e_cant_handle_systemexit_of_python_exception_in_mnv[] + INIT(= N_("E880: Can't handle SystemExit of python exception in mnv")); #endif EXTERN char e_line_count_changed_unexpectedly[] INIT(= N_("E881: Line count changed unexpectedly")); @@ -2298,9 +2298,9 @@ EXTERN char e_function_name_cannot_contain_colon_str[] EXTERN char e_not_possible_to_change_sign_str[] INIT(= N_("E885: Not possible to change sign %s")); #endif -#ifdef FEAT_VIMINFO -EXTERN char e_cant_rename_viminfo_file_to_str[] - INIT(= N_("E886: Can't rename viminfo file to %s!")); +#ifdef FEAT_MNVINFO +EXTERN char e_cant_rename_mnvinfo_file_to_str[] + INIT(= N_("E886: Can't rename mnvinfo file to %s!")); #endif #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) EXTERN char e_sorry_this_command_is_disabled_python_site_module_could_not_be_loaded[] @@ -2423,9 +2423,9 @@ EXTERN char e_invalid_action_str_1[] EXTERN char e_string_required[] INIT(= N_("E928: String required")); #endif -#ifdef FEAT_VIMINFO -EXTERN char e_too_many_viminfo_temp_files_like_str[] - INIT(= N_("E929: Too many viminfo temp files, like %s!")); +#ifdef FEAT_MNVINFO +EXTERN char e_too_many_mnvinfo_temp_files_like_str[] + INIT(= N_("E929: Too many mnvinfo temp files, like %s!")); #endif #ifdef FEAT_EVAL EXTERN char e_cannot_use_redir_inside_execute[] @@ -2577,8 +2577,8 @@ EXTERN char e_lowlevel_input_not_supported[] INIT(= N_("E980: Lowlevel input not supported")); # endif #endif -EXTERN char e_command_not_allowed_in_rvim[] - INIT(= N_("E981: Command not allowed in rvim")); +EXTERN char e_command_not_allowed_in_rmnv[] + INIT(= N_("E981: Command not allowed in rmnv")); #if defined(FEAT_TERMINAL) && defined(MSWIN) EXTERN char e_conpty_is_not_available[] INIT(= N_("E982: ConPTY is not available")); @@ -2596,8 +2596,8 @@ EXTERN char e_invalid_return_value_from_tagfunc[] INIT(= N_("E987: Invalid return value from tagfunc")); #endif #ifdef GUI_MAY_SPAWN -EXTERN char e_gui_cannot_be_used_cannot_execute_gvim_exe[] - INIT(= N_("E988: GUI cannot be used. Cannot execute gvim.exe.")); +EXTERN char e_gui_cannot_be_used_cannot_execute_gmnv_exe[] + INIT(= N_("E988: GUI cannot be used. Cannot execute gmnv.exe.")); #endif #ifdef FEAT_EVAL EXTERN char e_non_default_argument_follows_default_argument[] @@ -2722,18 +2722,18 @@ EXTERN char e_char_requires_number_or_float_arguments[] INIT(= N_("E1036: %c requires number or float arguments")); EXTERN char e_cannot_use_str_with_str[] INIT(= N_("E1037: Cannot use \"%s\" with %s")); -EXTERN char e_vim9script_can_only_be_used_in_script[] - INIT(= N_("E1038: \"vim9script\" can only be used in a script")); -EXTERN char e_vim9script_must_be_first_command_in_script[] - INIT(= N_("E1039: \"vim9script\" must be the first command in a script")); +EXTERN char e_mnv9script_can_only_be_used_in_script[] + INIT(= N_("E1038: \"mnv9script\" can only be used in a script")); +EXTERN char e_mnv9script_must_be_first_command_in_script[] + INIT(= N_("E1039: \"mnv9script\" must be the first command in a script")); #endif -EXTERN char e_cannot_use_scriptversion_after_vim9script[] - INIT(= N_("E1040: Cannot use :scriptversion after :vim9script")); +EXTERN char e_cannot_use_scriptversion_after_mnv9script[] + INIT(= N_("E1040: Cannot use :scriptversion after :mnv9script")); #ifdef FEAT_EVAL EXTERN char e_redefining_script_item_str[] INIT(= N_("E1041: Redefining script item: \"%s\"")); -EXTERN char e_export_can_only_be_used_in_vim9script[] - INIT(= N_("E1042: Export can only be used in vim9script")); +EXTERN char e_export_can_only_be_used_in_mnv9script[] + INIT(= N_("E1042: Export can only be used in mnv9script")); EXTERN char e_invalid_command_after_export[] INIT(= N_("E1043: Invalid command after :export")); EXTERN char e_export_with_invalid_argument[] @@ -2819,8 +2819,8 @@ EXTERN char e_command_modifier_without_command[] #ifdef FEAT_EVAL EXTERN char e_missing_backtick[] INIT(= N_("E1083: Missing backtick")); -EXTERN char e_cannot_delete_vim9_script_function_str[] - INIT(= N_("E1084: Cannot delete Vim9 script function %s")); +EXTERN char e_cannot_delete_mnv9_script_function_str[] + INIT(= N_("E1084: Cannot delete MNV9 script function %s")); EXTERN char e_not_callable_type_str[] INIT(= N_("E1085: Not a callable type: %s")); // E1086 unused @@ -2850,8 +2850,8 @@ EXTERN char e_string_list_or_blob_required[] INIT(= N_("E1098: String, List or Blob required")); EXTERN char e_unknown_error_while_executing_str[] INIT(= N_("E1099: Unknown error while executing %s")); -EXTERN char e_command_not_supported_in_vim9_script_missing_var_str[] - INIT(= N_("E1100: Command not supported in Vim9 script (missing :var?): %s")); +EXTERN char e_command_not_supported_in_mnv9_script_missing_var_str[] + INIT(= N_("E1100: Command not supported in MNV9 script (missing :var?): %s")); EXTERN char e_cannot_declare_script_variable_in_function_str[] INIT(= N_("E1101: Cannot declare a script variable in a function: %s")); EXTERN char e_lambda_function_not_found_str[] @@ -2899,12 +2899,12 @@ EXTERN char e_variable_is_locked_str[] INIT(= N_("E1122: Variable is locked: %s")); EXTERN char e_missing_comma_before_argument_str[] INIT(= N_("E1123: Missing comma before argument: %s")); -EXTERN char e_str_cannot_be_used_in_legacy_vim_script[] - INIT(= N_("E1124: \"%s\" cannot be used in legacy Vim script")); +EXTERN char e_str_cannot_be_used_in_legacy_mnv_script[] + INIT(= N_("E1124: \"%s\" cannot be used in legacy MNV script")); EXTERN char e_final_requires_a_value[] INIT(= N_("E1125: Final requires a value")); -EXTERN char e_cannot_use_let_in_vim9_script[] - INIT(= N_("E1126: Cannot use :let in Vim9 script")); +EXTERN char e_cannot_use_let_in_mnv9_script[] + INIT(= N_("E1126: Cannot use :let in MNV9 script")); EXTERN char e_missing_name_after_dot[] INIT(= N_("E1127: Missing name after dot")); EXTERN char e_endblock_without_block[] @@ -2970,8 +2970,8 @@ EXTERN char e_cannot_change_arglist_recursively[] #ifdef FEAT_EVAL EXTERN char e_missing_return_type[] INIT(= N_("E1157: Missing return type")); -EXTERN char e_cannot_use_flatten_in_vim9_script[] - INIT(= N_("E1158: Cannot use flatten() in Vim9 script, use flattennew()")); +EXTERN char e_cannot_use_flatten_in_mnv9_script[] + INIT(= N_("E1158: Cannot use flatten() in MNV9 script, use flattennew()")); #endif EXTERN char e_cannot_split_window_when_closing_buffer[] INIT(= N_("E1159: Cannot split a window when closing the buffer")); @@ -2987,8 +2987,8 @@ EXTERN char e_variable_nr_type_mismatch_expected_str_but_got_str[] EXTERN char e_variable_nr_type_mismatch_expected_str_but_got_str_in_str[] INIT(= N_("E1163: Variable %d: type mismatch, expected %s but got %s in %s")); #endif -EXTERN char e_vim9cmd_must_be_followed_by_command[] - INIT(= N_("E1164: vim9cmd must be followed by a command")); +EXTERN char e_mnv9cmd_must_be_followed_by_command[] + INIT(= N_("E1164: mnv9cmd must be followed by a command")); #ifdef FEAT_EVAL EXTERN char e_cannot_use_range_with_assignment_str[] INIT(= N_("E1165: Cannot use a range with an assignment: %s")); @@ -3028,8 +3028,8 @@ EXTERN char e_variable_arguments_type_must_be_list_str[] INIT(= N_("E1180: Variable arguments type must be a list: %s")); EXTERN char e_cannot_use_underscore_here[] INIT(= N_("E1181: Cannot use an underscore here")); -EXTERN char e_cannot_define_dict_func_in_vim9_script_str[] - INIT(= N_("E1182: Cannot define a dict function in Vim9 script: %s")); +EXTERN char e_cannot_define_dict_func_in_mnv9_script_str[] + INIT(= N_("E1182: Cannot define a dict function in MNV9 script: %s")); EXTERN char e_cannot_use_range_with_assignment_operator_str[] INIT(= N_("E1183: Cannot use a range with an assignment operator: %s")); #endif @@ -3042,7 +3042,7 @@ EXTERN char e_expression_does_not_result_in_value_str[] INIT(= N_("E1186: Expression does not result in a value: %s")); #endif EXTERN char e_failed_to_source_defaults[] - INIT(= N_("E1187: Failed to source defaults.vim")); + INIT(= N_("E1187: Failed to source defaults.mnv")); #if defined(FEAT_TERMINAL) EXTERN char e_cannot_open_terminal_from_command_line_window[] INIT(= N_("E1188: Cannot open a terminal from the command line window")); @@ -3063,7 +3063,7 @@ EXTERN char e_empty_function_name[] #ifdef FEAT_CRYPT # ifndef FEAT_SODIUM EXTERN char e_libsodium_not_built_in[] - INIT(= N_("E1193: cryptmethod xchacha20 not built into this Vim")); + INIT(= N_("E1193: cryptmethod xchacha20 not built into this MNV")); # else # if 0 EXTERN char e_libsodium_cannot_encrypt_header[] @@ -3200,8 +3200,8 @@ EXTERN char e_ascii_code_not_in_range[] EXTERN char e_bad_color_string_str[] INIT(= N_("E1244: Bad color string: %s")); # endif -EXTERN char e_cannot_expand_sfile_in_vim9_function[] - INIT(= N_("E1245: Cannot expand in a Vim9 function")); +EXTERN char e_cannot_expand_sfile_in_mnv9_function[] + INIT(= N_("E1245: Cannot expand in a MNV9 function")); EXTERN char e_cannot_find_variable_to_unlock_str[] INIT(= N_("E1246: Cannot find variable to (un)lock: %s")); #endif @@ -3230,20 +3230,20 @@ EXTERN char e_cmd_mapping_must_end_with_cr[] #ifdef FEAT_EVAL EXTERN char e_string_or_function_required_for_argument_nr[] INIT(= N_("E1256: String or function required for argument %d")); -EXTERN char e_imported_script_must_use_as_or_end_in_dot_vim_str[] - INIT(= N_("E1257: Imported script must use \"as\" or end in .vim: %s")); +EXTERN char e_imported_script_must_use_as_or_end_in_dot_mnv_str[] + INIT(= N_("E1257: Imported script must use \"as\" or end in .mnv: %s")); EXTERN char e_no_dot_after_imported_name_str[] INIT(= N_("E1258: No '.' after imported name: %s")); EXTERN char e_missing_name_after_imported_name_str[] INIT(= N_("E1259: Missing name after imported name: %s")); EXTERN char e_cannot_unlet_imported_item_str[] INIT(= N_("E1260: Cannot unlet an imported item: %s")); -EXTERN char e_cannot_import_dot_vim_without_using_as[] - INIT(= N_("E1261: Cannot import .vim without using \"as\"")); +EXTERN char e_cannot_import_dot_mnv_without_using_as[] + INIT(= N_("E1261: Cannot import .mnv without using \"as\"")); EXTERN char e_cannot_import_same_script_twice_str[] INIT(= N_("E1262: Cannot import the same script twice: %s")); -EXTERN char e_cannot_use_name_with_hash_in_vim9_script_use_export_instead[] - INIT(= N_("E1263: Cannot use name with # in Vim9 script, use export instead")); +EXTERN char e_cannot_use_name_with_hash_in_mnv9_script_use_export_instead[] + INIT(= N_("E1263: Cannot use name with # in MNV9 script, use export instead")); EXTERN char e_autoload_import_cannot_use_absolute_or_relative_path[] INIT(= N_("E1264: Autoload import cannot use absolute or relative path: %s")); EXTERN char e_cannot_use_partial_here[] @@ -3256,13 +3256,13 @@ EXTERN char e_critical_error_in_python3_initialization_check_your_installation[] #ifdef FEAT_EVAL EXTERN char e_function_name_must_start_with_capital_str[] INIT(= N_("E1267: Function name must start with a capital: %s")); -EXTERN char e_cannot_use_s_colon_in_vim9_script_str[] - INIT(= N_("E1268: Cannot use s: in Vim9 script: %s")); -EXTERN char e_cannot_create_vim9_script_variable_in_function_str[] - INIT(= N_("E1269: Cannot create a Vim9 script variable in a function: %s")); +EXTERN char e_cannot_use_s_colon_in_mnv9_script_str[] + INIT(= N_("E1268: Cannot use s: in MNV9 script: %s")); +EXTERN char e_cannot_create_mnv9_script_variable_in_function_str[] + INIT(= N_("E1269: Cannot create a MNV9 script variable in a function: %s")); #endif -EXTERN char e_cannot_use_s_backslash_in_vim9_script[] - INIT(= N_("E1270: Cannot use :s\\/sub/ in Vim9 script")); +EXTERN char e_cannot_use_s_backslash_in_mnv9_script[] + INIT(= N_("E1270: Cannot use :s\\/sub/ in MNV9 script")); #ifdef FEAT_EVAL EXTERN char e_compiling_closure_without_context_str[] INIT(= N_("E1271: Compiling closure without context: %s")); @@ -3388,8 +3388,8 @@ EXTERN char e_class_name_must_start_with_uppercase_letter_str[] INIT(= N_("E1314: Class name must start with an uppercase letter: %s")); EXTERN char e_white_space_required_after_name_str[] INIT(= N_("E1315: White space required after name: %s")); -EXTERN char e_class_can_only_be_defined_in_vim9_script[] - INIT(= N_("E1316: Class can only be defined in Vim9 script")); +EXTERN char e_class_can_only_be_defined_in_mnv9_script[] + INIT(= N_("E1316: Class can only be defined in MNV9 script")); EXTERN char e_invalid_object_variable_declaration_str[] INIT(= N_("E1317: Invalid object variable declaration: %s")); EXTERN char e_not_valid_command_in_class_str[] @@ -3438,8 +3438,8 @@ EXTERN char e_argument_already_declared_in_class_str[] INIT(= N_("E1340: Argument already declared in the class: %s")); EXTERN char e_variable_already_declared_in_class_str[] INIT(= N_("E1341: Variable already declared in the class: %s")); -EXTERN char e_interface_can_only_be_defined_in_vim9_script[] - INIT(= N_("E1342: Interface can only be defined in Vim9 script")); +EXTERN char e_interface_can_only_be_defined_in_mnv9_script[] + INIT(= N_("E1342: Interface can only be defined in MNV9 script")); EXTERN char e_interface_name_must_start_with_uppercase_letter_str[] INIT(= N_("E1343: Interface name must start with an uppercase letter: %s")); EXTERN char e_cannot_initialize_variable_in_interface[] @@ -3544,8 +3544,8 @@ EXTERN char e_cannot_lock_object_variable_str[] INIT(= N_("E1391: Cannot (un)lock variable \"%s\" in class \"%s\"")); EXTERN char e_cannot_lock_class_variable_str[] INIT(= N_("E1392: Cannot (un)lock class variable \"%s\" in class \"%s\"")); -EXTERN char e_type_can_only_be_defined_in_vim9_script[] - INIT(= N_("E1393: Type can only be defined in Vim9 script")); +EXTERN char e_type_can_only_be_defined_in_mnv9_script[] + INIT(= N_("E1393: Type can only be defined in MNV9 script")); EXTERN char e_type_name_must_start_with_uppercase_letter_str[] INIT(= N_("E1394: Type name must start with an uppercase letter: %s")); EXTERN char e_using_null_class[] @@ -3582,8 +3582,8 @@ EXTERN char e_builtin_object_method_str_not_supported[] INIT(= N_("E1412: Builtin object method \"%s\" not supported")); EXTERN char e_builtin_class_method_not_supported[] INIT(= N_("E1413: Builtin class method not supported")); -EXTERN char e_enum_can_only_be_defined_in_vim9_script[] - INIT(= N_("E1414: Enum can only be defined in Vim9 script")); +EXTERN char e_enum_can_only_be_defined_in_mnv9_script[] + INIT(= N_("E1414: Enum can only be defined in MNV9 script")); EXTERN char e_enum_name_must_start_with_uppercase_letter_str[] INIT(= N_("E1415: Enum name must start with an uppercase letter: %s")); EXTERN char e_enum_cannot_extend_class[] @@ -3631,7 +3631,7 @@ EXTERN char e_interface_can_only_be_used_in_script[] EXTERN char e_can_only_compare_object_with_object[] INIT(= N_("E1437: Can only compare Object with Object")); #endif -// E1438 - E1499 unused (reserved for Vim9 class support) +// E1438 - E1499 unused (reserved for MNV9 class support) EXTERN char e_cannot_mix_positional_and_non_positional_str[] INIT(= N_("E1500: Cannot mix positional and non-positional arguments: %s")); EXTERN char e_fmt_arg_nr_unused_str[] @@ -3737,7 +3737,7 @@ EXTERN char e_no_quickfix_stack[] EXTERN char e_cannot_switch_to_a_closing_buffer[] INIT(= N_("E1546: Cannot switch to a closing buffer")); EXTERN char e_cannot_not_support_redrawtabpanel[] - INIT(= N_("E1547: This version of Vim does support :redrawtabpanel")); + INIT(= N_("E1547: This version of MNV does support :redrawtabpanel")); #ifdef FEAT_WAYLAND EXTERN char e_wayland_connection_unavailable[] INIT(= N_("E1548: Wayland connection is unavailable")); diff --git a/uvim/src/eval.c b/uvim/src/eval.c index e8b9cc8303..566cdbddae 100644 --- a/uvim/src/eval.c +++ b/uvim/src/eval.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -12,7 +12,7 @@ */ #define USING_FLOAT_STUFF -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) @@ -46,7 +46,7 @@ num_divide(varnumber_T n1, varnumber_T n2, int *failed) if (n2 == 0) { - if (in_vim9script()) + if (in_mnv9script()) { emsg(_(e_divide_by_zero)); if (failed != NULL) @@ -78,7 +78,7 @@ num_divide(varnumber_T n1, varnumber_T n2, int *failed) varnumber_T num_modulus(varnumber_T n1, varnumber_T n2, int *failed) { - if (n2 == 0 && in_vim9script()) + if (n2 == 0 && in_mnv9script()) { emsg(_(e_divide_by_zero)); if (failed != NULL) @@ -167,7 +167,7 @@ eval_to_bool( *error = FALSE; if (!skip) { - if (in_vim9script()) + if (in_mnv9script()) retval = tv_get_bool_chk(&tv, error); else retval = (tv_get_number_chk(&tv, error) != 0); @@ -319,7 +319,7 @@ eval_expr_func( if (expr->v_type == VAR_FUNC) s = expr->vval.v_string; else - s = tv_get_string_buf_chk_strict(expr, buf, in_vim9script()); + s = tv_get_string_buf_chk_strict(expr, buf, in_mnv9script()); if (s == NULL || *s == NUL) return FAIL; @@ -343,7 +343,7 @@ eval_expr_string( char_u *s; char_u buf[NUMBUFLEN]; - s = tv_get_string_buf_chk_strict(expr, buf, in_vim9script()); + s = tv_get_string_buf_chk_strict(expr, buf, in_mnv9script()); if (s == NULL) return FAIL; @@ -429,7 +429,7 @@ eval_to_string_skip( retval = NULL; else { - retval = vim_strsave(tv_get_string(&tv)); + retval = mnv_strsave(tv_get_string(&tv)); clear_tv(&tv); } if (skip) @@ -464,7 +464,7 @@ free_eval_tofree_later(evalarg_T *evalarg) [evalarg->eval_tofree_ga.ga_len++] = evalarg->eval_tofree; else - vim_free(evalarg->eval_tofree); + mnv_free(evalarg->eval_tofree); } /* @@ -485,7 +485,7 @@ clear_evalarg(evalarg_T *evalarg, exarg_T *eap) // We may need to keep the original command line, e.g. for // ":let" it has the variable names. But we may also need // the new one, "nextcmd" points into it. Keep both. - vim_free(eap->cmdline_tofree); + mnv_free(eap->cmdline_tofree); eap->cmdline_tofree = *eap->cmdlinep; if (evalarg->eval_using_cmdline && etga->ga_len > 0) @@ -494,18 +494,18 @@ clear_evalarg(evalarg_T *evalarg, exarg_T *eap) // need to keep it around. --etga->ga_len; *eap->cmdlinep = ((char_u **)etga->ga_data)[etga->ga_len]; - vim_free(evalarg->eval_tofree); + mnv_free(evalarg->eval_tofree); } else *eap->cmdlinep = evalarg->eval_tofree; } else - vim_free(evalarg->eval_tofree); + mnv_free(evalarg->eval_tofree); evalarg->eval_tofree = NULL; } ga_clear_strings(etga); - VIM_CLEAR(evalarg->eval_tofree_lambda); + MNV_CLEAR(evalarg->eval_tofree_lambda); } /* @@ -523,7 +523,7 @@ skip_expr(char_u **pp, evalarg_T *evalarg) /* * Skip over an expression at "*arg". - * If in Vim9 script and line breaks are encountered, the lines are + * If in MNV9 script and line breaks are encountered, the lines are * concatenated. "evalarg->eval_tofree" will be set accordingly. * "arg" is advanced to just after the expression. * "start" is set to the start of the expression, "end" to just after the end. @@ -539,14 +539,14 @@ skip_expr_concatenate( { typval_T rettv; int res; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); garray_T *gap = evalarg == NULL ? NULL : &evalarg->eval_ga; garray_T *freegap = evalarg == NULL ? NULL : &evalarg->eval_freega; int save_flags = evalarg == NULL ? 0 : evalarg->eval_flags; int evaluate = evalarg == NULL ? FALSE : (evalarg->eval_flags & EVAL_EVALUATE); - if (vim9script && evaluate + if (mnv9script && evaluate && (evalarg->eval_cookie != NULL || evalarg->eval_cctx != NULL)) { ga_init2(gap, sizeof(char_u *), 10); @@ -566,7 +566,7 @@ skip_expr_concatenate( if (evalarg != NULL) evalarg->eval_flags = save_flags; - if (vim9script && evaluate + if (mnv9script && evaluate && (evalarg->eval_cookie != NULL || evalarg->eval_cctx != NULL)) { if (evalarg->eval_ga.ga_len == 1) @@ -610,7 +610,7 @@ skip_expr_concatenate( if (p == NULL) return FAIL; *start = p; - vim_free(evalarg->eval_tofree_lambda); + mnv_free(evalarg->eval_tofree_lambda); evalarg->eval_tofree_lambda = p; // Compute "end" relative to the end. *end = *start + STRLEN(*start) - endoff; @@ -671,10 +671,10 @@ typval2string(typval_T *tv, int join_list) retval = tv2string(tv, &tofree, numbuf, 0); // Make a copy if we have a value but it's not in allocated memory. if (retval != NULL && tofree == NULL) - retval = vim_strsave(retval); + retval = mnv_strsave(retval); } else - retval = vim_strsave(tv_get_string(tv)); + retval = mnv_strsave(tv_get_string(tv)); return retval; } @@ -726,7 +726,7 @@ eval_to_string( /* * Call eval_to_string() without using current local variables and using * textlock. When "use_sandbox" is TRUE use the sandbox. - * Use legacy Vim script syntax. + * Use legacy MNV script syntax. */ char_u * eval_to_string_safe( @@ -818,7 +818,7 @@ eval_expr_ext(char_u *arg, exarg_T *eap, int use_simple_function) r = eval0(arg, tv, eap, &evalarg); if (r == FAIL) - VIM_CLEAR(tv); + MNV_CLEAR(tv); } clear_evalarg(&evalarg, eap); @@ -888,7 +888,7 @@ deref_function_name( } else { - name = vim_strsave(partial_name(ref.vval.v_partial)); + name = mnv_strsave(partial_name(ref.vval.v_partial)); *tofree = name; } } @@ -907,13 +907,13 @@ theend: } /* - * Call some Vim script function and return the result in "*rettv". + * Call some MNV script function and return the result in "*rettv". * Uses argv[0] to argv[argc - 1] for the function arguments. argv[argc] * should have type VAR_UNKNOWN. * Returns OK or FAIL. */ int -call_vim_function( +call_mnv_function( char_u *func, int argc, typval_T *argv, @@ -936,7 +936,7 @@ call_vim_function( // ignore errors for an undefined name. But we do want errors when an // autoload script has errors. Guess that when there is a dot in the name // showing errors is the right choice. - ignore_errors = vim_strchr(func, '.') == NULL; + ignore_errors = mnv_strchr(func, '.') == NULL; arg = func; if (ignore_errors) ++emsg_off; @@ -950,13 +950,13 @@ call_vim_function( if (ret == FAIL) clear_tv(rettv); - vim_free(tofree); + mnv_free(tofree); return ret; } /* - * Call Vim script function "func" and return the result as a string. + * Call MNV script function "func" and return the result as a string. * Uses "argv[0]" to "argv[argc - 1]" for the function arguments. "argv[argc]" * should have type VAR_UNKNOWN. * Returns NULL when calling the function fails. @@ -970,16 +970,16 @@ call_func_retstr( typval_T rettv; char_u *retval; - if (call_vim_function(func, argc, argv, &rettv) == FAIL) + if (call_mnv_function(func, argc, argv, &rettv) == FAIL) return NULL; - retval = vim_strsave(tv_get_string(&rettv)); + retval = mnv_strsave(tv_get_string(&rettv)); clear_tv(&rettv); return retval; } /* - * Call Vim script function "func" and return the result as a List. + * Call MNV script function "func" and return the result as a List. * Uses "argv" and "argc" as call_func_retstr(). * Returns NULL when there is something wrong. * Gives an error when the returned value is not a list. @@ -992,7 +992,7 @@ call_func_retlist( { typval_T rettv; - if (call_vim_function(func, argc, argv, &rettv) == FAIL) + if (call_mnv_function(func, argc, argv, &rettv) == FAIL) return NULL; if (rettv.v_type != VAR_LIST) @@ -1049,7 +1049,7 @@ eval_foldexpr(win_T *wp, int *cp) // If the result is a string, check if there is a non-digit before // the number. s = tv.vval.v_string; - if (*s != NUL && !VIM_ISDIGIT(*s) && *s != '-') + if (*s != NUL && !MNV_ISDIGIT(*s) && *s != '-') *cp = *s++; retval = atol((char *)s); } @@ -1193,10 +1193,10 @@ get_lval_check_access( char *msg = NULL; switch (om->ocm_access) { - case VIM_ACCESS_PRIVATE: + case MNV_ACCESS_PRIVATE: msg = e_cannot_access_protected_variable_str; break; - case VIM_ACCESS_READ: + case MNV_ACCESS_READ: // If [idx] or .key following, read only OK. if (*p == '[' || *p == '.') break; @@ -1214,7 +1214,7 @@ get_lval_check_access( msg = e_variable_is_not_writable_str; } break; - case VIM_ACCESS_ALL: + case MNV_ACCESS_ALL: break; } if (msg != NULL) @@ -1395,7 +1395,7 @@ get_lval_dict_item( if (lp->ll_di == NULL) { // Can't add "v:" or "a:" variable. - if (lp->ll_dict == get_vimvar_dict() + if (lp->ll_dict == get_mnvvar_dict() || &lp->ll_dict->dv_hashtab == get_funccal_args_ht()) { semsg(_(e_illegal_variable_name_str), name); @@ -1410,9 +1410,9 @@ get_lval_dict_item( return GLV_FAIL; } if (len == -1) - lp->ll_newkey = vim_strsave(key); + lp->ll_newkey = mnv_strsave(key); else - lp->ll_newkey = vim_strnsave(key, len); + lp->ll_newkey = mnv_strnsave(key, len); if (lp->ll_newkey == NULL) p = NULL; @@ -1907,19 +1907,19 @@ get_lval_subscript( vartype_name(v_type)); #endif - if (current_script_is_vim9() && lp->ll_valtype == NULL + if (current_script_is_mnv9() && lp->ll_valtype == NULL && v != NULL && lp->ll_tv == &v->di_tv && ht != NULL && ht == get_script_local_ht()) { svar_T *sv = find_typval_in_script(lp->ll_tv, 0, TRUE); - // Vim9 script local variable: get the type + // MNV9 script local variable: get the type if (sv != NULL) { lp->ll_valtype = sv->sv_type; #ifdef LOG_LOCKVAR - ch_log(NULL, "LKVAR: ... loop: vim9 assign type: %s", + ch_log(NULL, "LKVAR: ... loop: mnv9 assign type: %s", vartype_name(lp->ll_valtype->tt_type)); #endif } @@ -2110,7 +2110,7 @@ get_lval( hashtab_T *ht = NULL; int quiet = flags & GLV_QUIET; int writing = 0; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); class_T *cl_exec = NULL; // class that is executing, or NULL. #ifdef LOG_LOCKVAR @@ -2137,11 +2137,11 @@ get_lval( return lp->ll_name_end; } - // Cannot use "s:var" at the Vim9 script level. "s: type" is OK. - if (vim9script && at_script_level() - && name[0] == 's' && name[1] == ':' && !VIM_ISWHITE(name[2])) + // Cannot use "s:var" at the MNV9 script level. "s: type" is OK. + if (mnv9script && at_script_level() + && name[0] == 's' && name[1] == ':' && !MNV_ISWHITE(name[2])) { - semsg(_(e_cannot_use_s_colon_in_vim9_script_str), name); + semsg(_(e_cannot_use_s_colon_in_mnv9_script_str), name); return NULL; } @@ -2151,7 +2151,7 @@ get_lval( if (expr_start != NULL) { // Don't expand the name when we already know there is an error. - if (unlet && !VIM_ISWHITE(*p) && !ends_excmd(*p) + if (unlet && !MNV_ISWHITE(*p) && !ends_excmd(*p) && *p != '[' && *p != '.') { semsg(_(e_trailing_characters_str), p); @@ -2177,7 +2177,7 @@ get_lval( { lp->ll_name = name; - if (vim9script) + if (mnv9script) { // "a: type" is declaring variable "a" with a type, not "a:". // However, "g:[key]" is indexing a dictionary. @@ -2195,7 +2195,7 @@ get_lval( semsg(_(e_cannot_use_type_with_this_variable_str), name); return NULL; } - if (VIM_ISWHITE(*p)) + if (MNV_ISWHITE(*p)) { semsg(_(e_no_white_space_allowed_before_colon_str), p); return NULL; @@ -2210,7 +2210,7 @@ get_lval( semsg(_(e_using_type_not_in_script_context_str), p); return NULL; } - if (vim9script && (flags & GLV_NO_DECL) && + if (mnv9script && (flags & GLV_NO_DECL) && !(flags & GLV_FOR_LOOP)) { // Using a type and not in a "var" declaration. @@ -2239,7 +2239,7 @@ get_lval( // In legacy script, when a local variable and import exists with this name, // prioritize local variable over imports to avoid conflicts. int var_exists = FALSE; - if (!vim9script) + if (!mnv9script) { cc = *p; *p = NUL; @@ -2274,9 +2274,9 @@ get_lval( return p; } - if (vim9script && lval_root != NULL) + if (mnv9script && lval_root != NULL) cl_exec = lval_root->lr_cl_exec; - if (vim9script && lval_root != NULL && lval_root->lr_tv != NULL) + if (mnv9script && lval_root != NULL && lval_root->lr_tv != NULL) { // using local variable lp->ll_tv = lval_root->lr_tv; @@ -2298,7 +2298,7 @@ get_lval( lp->ll_tv = &v->di_tv; } - if (vim9script && (flags & GLV_NO_DECL) == 0) + if (mnv9script && (flags & GLV_NO_DECL) == 0) { if (!quiet) semsg(_(e_variable_already_declared_str), lp->ll_name); @@ -2310,11 +2310,11 @@ get_lval( if (p == NULL) return NULL; - if (vim9script && lp->ll_valtype != NULL && rettv != NULL) + if (mnv9script && lp->ll_valtype != NULL && rettv != NULL) { where_T where = WHERE_INIT; - // In a Vim9 script, do type check and make sure the variable is + // In a MNV9 script, do type check and make sure the variable is // writable. if (check_typval_type(lp->ll_valtype, rettv, where) == FAIL) return NULL; @@ -2330,8 +2330,8 @@ get_lval( void clear_lval(lval_T *lp) { - vim_free(lp->ll_exp_name); - vim_free(lp->ll_newkey); + mnv_free(lp->ll_exp_name); + mnv_free(lp->ll_newkey); clear_type_list(&lp->ll_type_list); } @@ -2358,7 +2358,7 @@ set_var_lval( { cc = *endp; *endp = NUL; - if (in_vim9script() && check_reserved_name(lp->ll_name, FALSE) == FAIL) + if (in_mnv9script() && check_reserved_name(lp->ll_name, FALSE) == FAIL) return; if (lp->ll_blob != NULL) @@ -2474,7 +2474,7 @@ set_var_lval( // If the lval is a List and the type of the list is not yet set, // then set the item type from the declared type of the variable. - if (in_vim9script() && rettv->v_type == VAR_LIST + if (in_mnv9script() && rettv->v_type == VAR_LIST && rettv->vval.v_list != NULL && rettv->vval.v_list->lv_type == NULL) { @@ -2501,7 +2501,7 @@ set_var_lval( return; if (dict_add(lp->ll_tv->vval.v_dict, di) == FAIL) { - vim_free(di); + mnv_free(di); return; } lp->ll_tv = &di->di_tv; @@ -2651,7 +2651,7 @@ grow_string_tv(typval_T *tv1, char_u *s2) size_t len1 = STRLEN(tv1->vval.v_string); size_t len2 = STRLEN(s2); - char_u *p = vim_realloc(tv1->vval.v_string, len1 + len2 + 1); + char_u *p = mnv_realloc(tv1->vval.v_string, len1 + len2 + 1); if (p == NULL) return FAIL; @@ -2700,7 +2700,7 @@ tv_op_nr_or_string(typval_T *tv1, typval_T *tv2, char_u *op) if (tv2->v_type == VAR_LIST) return FAIL; - if (vim_strchr((char_u *)"+-*/%", *op) != NULL) + if (mnv_strchr((char_u *)"+-*/%", *op) != NULL) return tv_op_number(tv1, tv2, op); return tv_op_string(tv1, tv2, op); @@ -2832,9 +2832,9 @@ eval_for_line( expr = skipwhite_and_linebreak(var_list_end, evalarg); if (expr[0] != 'i' || expr[1] != 'n' - || !(expr[2] == NUL || VIM_ISWHITE(expr[2]))) + || !(expr[2] == NUL || MNV_ISWHITE(expr[2]))) { - if (in_vim9script() && *expr == ':' && expr != var_list_end) + if (in_mnv9script() && *expr == ':' && expr != var_list_end) semsg(_(e_no_white_space_allowed_before_colon_str), expr); else emsg(_(e_missing_in_after_for)); @@ -2905,7 +2905,7 @@ eval_for_line( fi->fi_string = tv.vval.v_string; tv.vval.v_string = NULL; if (fi->fi_string == NULL) - fi->fi_string = vim_strsave((char_u *)""); + fi->fi_string = mnv_strsave((char_u *)""); } else { @@ -2945,7 +2945,7 @@ next_for_item(void *fi_void, char_u *arg) { forinfo_T *fi = (forinfo_T *)fi_void; int result; - int flag = ASSIGN_FOR_LOOP | (in_vim9script() + int flag = ASSIGN_FOR_LOOP | (in_mnv9script() ? (ASSIGN_FINAL // first round: error if variable exists | (fi->fi_bi == 0 ? 0 : ASSIGN_DECL) @@ -2953,7 +2953,7 @@ next_for_item(void *fi_void, char_u *arg) | ASSIGN_UPDATE_BLOCK_ID) : 0); listitem_T *item; - int skip_assign = in_vim9script() && arg[0] == '_' + int skip_assign = in_mnv9script() && arg[0] == '_' && !eval_isnamec(arg[1]); if (fi->fi_blob != NULL) @@ -2982,7 +2982,7 @@ next_for_item(void *fi_void, char_u *arg) return FALSE; tv.v_type = VAR_STRING; tv.v_lock = VAR_FIXED; - tv.vval.v_string = vim_strnsave(fi->fi_string + fi->fi_byte_idx, len); + tv.vval.v_string = mnv_strnsave(fi->fi_string + fi->fi_byte_idx, len); fi->fi_byte_idx += len; ++fi->fi_bi; if (skip_assign) @@ -2990,7 +2990,7 @@ next_for_item(void *fi_void, char_u *arg) else result = ex_let_vars(arg, &tv, TRUE, fi->fi_semicolon, fi->fi_varcount, flag, NULL) == OK; - vim_free(tv.vval.v_string); + mnv_free(tv.vval.v_string); return result; } @@ -3046,8 +3046,8 @@ free_for_info(void *fi_void) else if (fi->fi_tuple != NULL) tuple_unref(fi->fi_tuple); else - vim_free(fi->fi_string); - vim_free(fi); + mnv_free(fi->fi_string); + mnv_free(fi); } void @@ -3064,14 +3064,14 @@ set_context_for_expression( || cmdidx == CMD_const || cmdidx == CMD_final) { xp->xp_context = EXPAND_USER_VARS; - if (vim_strpbrk(arg, (char_u *)"\"'+-*/%.=!?~|&$([<>,#") == NULL) + if (mnv_strpbrk(arg, (char_u *)"\"'+-*/%.=!?~|&$([<>,#") == NULL) { // ":let var1 var2 ...": find last space. for (p = arg + STRLEN(arg); p >= arg; ) { xp->xp_pattern = p; MB_PTR_BACK(arg, p); - if (VIM_ISWHITE(*p)) + if (MNV_ISWHITE(*p)) break; } return; @@ -3080,7 +3080,7 @@ set_context_for_expression( else xp->xp_context = cmdidx == CMD_call ? EXPAND_FUNCTIONS : EXPAND_EXPRESSION; - while ((xp->xp_pattern = vim_strpbrk(arg, + while ((xp->xp_pattern = mnv_strpbrk(arg, (char_u *)"\"'+-*/%.=!?~|&$([<>,#")) != NULL) { c = *xp->xp_pattern; @@ -3118,7 +3118,7 @@ set_context_for_expression( } else if ((c == '<' || c == '#') && xp->xp_context == EXPAND_FUNCTIONS - && vim_strchr(xp->xp_pattern, '(') == NULL) + && mnv_strchr(xp->xp_pattern, '(') == NULL) { // Function name can start with "" and contain '#'. break; @@ -3199,12 +3199,12 @@ pattern_match(char_u *pat, char_u *text, int ic) // avoid 'l' flag in 'cpoptions' save_cpo = p_cpo; p_cpo = empty_option; - regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + regmatch.regprog = mnv_regcomp(pat, RE_MAGIC + RE_STRING); if (regmatch.regprog != NULL) { regmatch.rm_ic = ic; - matches = vim_regexec_nl(®match, text, (colnr_T)0); - vim_regfree(regmatch.regprog); + matches = mnv_regexec_nl(®match, text, (colnr_T)0); + mnv_regfree(regmatch.regprog); } p_cpo = save_cpo; return matches; @@ -3239,11 +3239,11 @@ eval_func( // If "s" is the name of a variable of type VAR_FUNC // use its contents. s = deref_func_name(s, &len, &partial, - in_vim9script() ? &type : NULL, !evaluate, FALSE, &found_var); + in_mnv9script() ? &type : NULL, !evaluate, FALSE, &found_var); // Need to make a copy, in case evaluating the arguments makes // the name invalid. - s = vim_strsave(s); + s = mnv_strsave(s); if (s == NULL || (evaluate && *s == NUL)) ret = FAIL; else @@ -3269,7 +3269,7 @@ eval_func( funcexe.fe_cctx = evalarg->eval_cctx; ret = get_func_tv(s, len, rettv, arg, evalarg, &funcexe); } - vim_free(s); + mnv_free(s); // If evaluate is FALSE rettv->v_type was not set in // get_func_tv, but it's needed in handle_subscript() to parse @@ -3306,9 +3306,9 @@ newline_skip_comments(char_u *arg) if (*p == NUL) break; - if (vim9_comment_start(p)) + if (mnv9_comment_start(p)) { - char_u *nl = vim_strchr(p, NL); + char_u *nl = mnv_strchr(p, NL); if (nl == NULL) break; @@ -3324,7 +3324,7 @@ newline_skip_comments(char_u *arg) /* * Get the next line source line without advancing. But do skip over comment * lines. - * Only called for Vim9 script. + * Only called for MNV9 script. */ static char_u * getline_peek_skip_comments(evalarg_T *evalarg) @@ -3338,7 +3338,7 @@ getline_peek_skip_comments(evalarg_T *evalarg) if (next == NULL) break; p = skipwhite(next); - if (*p != NUL && !vim9_comment_start(p)) + if (*p != NUL && !mnv9_comment_start(p)) return next; if (eval_next_line(NULL, evalarg) == NULL) break; @@ -3347,7 +3347,7 @@ getline_peek_skip_comments(evalarg_T *evalarg) } /* - * If inside Vim9 script, "arg" points to the end of a line (ignoring a # + * If inside MNV9 script, "arg" points to the end of a line (ignoring a # * comment) and there is a next line, return the next line (skipping blanks) * and set "getnext". * Otherwise return the next non-white at or after "arg" and set "getnext" to @@ -3360,12 +3360,12 @@ eval_next_non_blank(char_u *arg, evalarg_T *evalarg, int *getnext) char_u *p = skipwhite(arg); *getnext = FALSE; - if (in_vim9script() + if (in_mnv9script() && evalarg != NULL && (evalarg->eval_cookie != NULL || evalarg->eval_cctx != NULL || *p == NL) && (*p == NUL || *p == NL - || (vim9_comment_start(p) && VIM_ISWHITE(p[-1])))) + || (mnv9_comment_start(p) && MNV_ISWHITE(p[-1])))) { char_u *next; @@ -3387,7 +3387,7 @@ eval_next_non_blank(char_u *arg, evalarg_T *evalarg, int *getnext) /* * To be called after eval_next_non_blank() sets "getnext" to TRUE. - * Only called for Vim9 script. + * Only called for MNV9 script. * * If "arg" is not NULL, then the caller should assign the return value to * "arg". @@ -3423,10 +3423,10 @@ eval_next_line(char_u *arg, evalarg_T *evalarg) // Going to concatenate the lines after parsing. For an empty or // comment line use an empty string. - if (*p == NUL || vim9_comment_start(p)) + if (*p == NUL || mnv9_comment_start(p)) { - vim_free(line); - line = vim_strsave((char_u *)""); + mnv_free(line); + line = mnv_strsave((char_u *)""); } ((char_u **)gap->ga_data)[gap->ga_len] = line; @@ -3558,13 +3558,13 @@ eval0_retarg( expr_end = p; p = skipwhite(p); - // In Vim9 script a command block is not split at NL characters for + // In MNV9 script a command block is not split at NL characters for // commands using an expression argument. Skip over a '#' comment to // check for a following NL. Require white space before the '#'. - if (in_vim9script() && p > expr_end && retarg == NULL) + if (in_mnv9script() && p > expr_end && retarg == NULL) while (*p == '#') { - char_u *nl = vim_strchr(p, NL); + char_u *nl = mnv_strchr(p, NL); if (nl == NULL) break; @@ -3591,7 +3591,7 @@ eval0_retarg( if (!aborting() && did_emsg == did_emsg_before && called_emsg == called_emsg_before - && (!in_vim9script() || !vim9_bad_comment(p))) + && (!in_mnv9script() || !mnv9_bad_comment(p))) { if (end_error) semsg(_(e_trailing_characters_str), p); @@ -3653,7 +3653,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg) evalarg_T local_evalarg; int orig_flags; int evaluate; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); if (evalarg == NULL) { @@ -3667,7 +3667,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg) *arg = eval_next_line(*arg, evalarg_used); else { - if (evaluate && vim9script && !VIM_ISWHITE(p[-1])) + if (evaluate && mnv9script && !MNV_ISWHITE(p[-1])) { error_white_both(p, op_falsy ? 2 : 1); clear_tv(rettv); @@ -3691,7 +3691,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg) } result = tv2bool(rettv); } - else if (vim9script) + else if (mnv9script) result = tv_get_bool_chk(rettv, &error); else if (tv_get_number_chk(rettv, &error) != 0) result = TRUE; @@ -3706,7 +3706,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg) */ if (op_falsy) ++*arg; - if (evaluate && vim9script && !IS_WHITE_OR_NUL((*arg)[1])) + if (evaluate && mnv9script && !IS_WHITE_OR_NUL((*arg)[1])) { error_white_both(*arg - (op_falsy ? 1 : 0), op_falsy ? 2 : 1); clear_tv(rettv); @@ -3741,7 +3741,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg) *arg = eval_next_line(*arg, evalarg_used); else { - if (evaluate && vim9script && !VIM_ISWHITE(p[-1])) + if (evaluate && mnv9script && !MNV_ISWHITE(p[-1])) { error_white_both(p, 1); clear_tv(rettv); @@ -3754,7 +3754,7 @@ eval1(char_u **arg, typval_T *rettv, evalarg_T *evalarg) /* * Get the third variable. Recursive! */ - if (evaluate && vim9script && !IS_WHITE_OR_NUL((*arg)[1])) + if (evaluate && mnv9script && !IS_WHITE_OR_NUL((*arg)[1])) { error_white_both(*arg, 1); clear_tv(rettv); @@ -3818,7 +3818,7 @@ eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg) long result = FALSE; typval_T var2; int error = FALSE; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); if (evalarg == NULL) { @@ -3829,7 +3829,7 @@ eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg) evaluate = orig_flags & EVAL_EVALUATE; if (evaluate) { - if (vim9script) + if (mnv9script) result = tv_get_bool_chk(rettv, &error); else if (tv_get_number_chk(rettv, &error) != 0) result = TRUE; @@ -3847,7 +3847,7 @@ eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg) *arg = eval_next_line(*arg, evalarg_used); else { - if (evaluate && vim9script && !VIM_ISWHITE(p[-1])) + if (evaluate && mnv9script && !MNV_ISWHITE(p[-1])) { error_white_both(p, 2); clear_tv(rettv); @@ -3859,7 +3859,7 @@ eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg) /* * Get the second variable. */ - if (evaluate && vim9script && !IS_WHITE_OR_NUL((*arg)[2])) + if (evaluate && mnv9script && !IS_WHITE_OR_NUL((*arg)[2])) { error_white_both(*arg, 2); clear_tv(rettv); @@ -3876,7 +3876,7 @@ eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg) */ if (evaluate && !result) { - if (vim9script) + if (mnv9script) result = tv_get_bool_chk(&var2, &error); else if (tv_get_number_chk(&var2, &error) != 0) result = TRUE; @@ -3886,7 +3886,7 @@ eval2(char_u **arg, typval_T *rettv, evalarg_T *evalarg) } if (evaluate) { - if (vim9script) + if (mnv9script) { rettv->v_type = VAR_BOOL; rettv->vval.v_number = result ? VVAL_TRUE : VVAL_FALSE; @@ -3944,7 +3944,7 @@ eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg) long result = TRUE; typval_T var2; int error = FALSE; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); if (evalarg == NULL) { @@ -3955,7 +3955,7 @@ eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg) evaluate = orig_flags & EVAL_EVALUATE; if (evaluate) { - if (vim9script) + if (mnv9script) result = tv_get_bool_chk(rettv, &error); else if (tv_get_number_chk(rettv, &error) == 0) result = FALSE; @@ -3973,7 +3973,7 @@ eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg) *arg = eval_next_line(*arg, evalarg_used); else { - if (evaluate && vim9script && !VIM_ISWHITE(p[-1])) + if (evaluate && mnv9script && !MNV_ISWHITE(p[-1])) { error_white_both(p, 2); clear_tv(rettv); @@ -3985,7 +3985,7 @@ eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg) /* * Get the second variable. */ - if (evaluate && vim9script && !IS_WHITE_OR_NUL((*arg)[2])) + if (evaluate && mnv9script && !IS_WHITE_OR_NUL((*arg)[2])) { error_white_both(*arg, 2); clear_tv(rettv); @@ -4003,7 +4003,7 @@ eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg) */ if (evaluate && result) { - if (vim9script) + if (mnv9script) result = tv_get_bool_chk(&var2, &error); else if (tv_get_number_chk(&var2, &error) == 0) result = FALSE; @@ -4013,7 +4013,7 @@ eval3(char_u **arg, typval_T *rettv, evalarg_T *evalarg) } if (evaluate) { - if (vim9script) + if (mnv9script) { rettv->v_type = VAR_BOOL; rettv->vval.v_number = result ? VVAL_TRUE : VVAL_FALSE; @@ -4081,7 +4081,7 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg) { typval_T var2; int ic; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); int evaluate = evalarg == NULL ? 0 : (evalarg->eval_flags & EVAL_EVALUATE); long comp_lnum = SOURCING_LNUM; @@ -4091,14 +4091,14 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg) *arg = eval_next_line(*arg, evalarg); p = *arg; } - else if (evaluate && vim9script && !VIM_ISWHITE(**arg)) + else if (evaluate && mnv9script && !MNV_ISWHITE(**arg)) { error_white_both(*arg, len); clear_tv(rettv); return FAIL; } - if (vim9script && type_is && (p[len] == '?' || p[len] == '#')) + if (mnv9script && type_is && (p[len] == '?' || p[len] == '#')) { semsg(_(e_invalid_expression_str), p); clear_tv(rettv); @@ -4117,14 +4117,14 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg) ic = FALSE; ++len; } - // nothing appended: use 'ignorecase' if not in Vim script + // nothing appended: use 'ignorecase' if not in MNV script else - ic = vim9script ? FALSE : p_ic; + ic = mnv9script ? FALSE : p_ic; /* * Get the second variable. */ - if (evaluate && vim9script && !IS_WHITE_OR_NUL(p[len])) + if (evaluate && mnv9script && !IS_WHITE_OR_NUL(p[len])) { error_white_both(p, len); clear_tv(rettv); @@ -4142,7 +4142,7 @@ eval4(char_u **arg, typval_T *rettv, evalarg_T *evalarg) // use the line of the comparison for messages SOURCING_LNUM = comp_lnum; - if (vim9script && check_compare_types(type, rettv, &var2) == FAIL) + if (mnv9script && check_compare_types(type, rettv, &var2) == FAIL) { ret = FAIL; clear_tv(rettv); @@ -4218,10 +4218,10 @@ eval_addlist(typval_T *tv1, typval_T *tv2) int eval_addtuple(typval_T *tv1, typval_T *tv2) { - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); typval_T var3; - if (vim9script && tv1->vval.v_tuple != NULL && tv2->vval.v_tuple != NULL + if (mnv9script && tv1->vval.v_tuple != NULL && tv2->vval.v_tuple != NULL && tv1->vval.v_tuple->tv_type != NULL && tv2->vval.v_tuple->tv_type != NULL) { @@ -4305,7 +4305,7 @@ eval5(char_u **arg, typval_T *rettv, evalarg_T *evalarg) exprtype_T exprtype; int evaluate; typval_T var2; - int vim9script; + int mnv9script; p = eval_next_non_blank(*arg, evalarg, &getnext); if (p[0] == '<' && p[1] == '<') @@ -4325,13 +4325,13 @@ eval5(char_u **arg, typval_T *rettv, evalarg_T *evalarg) return FAIL; } - vim9script = in_vim9script(); + mnv9script = in_mnv9script(); if (getnext) { *arg = eval_next_line(*arg, evalarg); p = *arg; } - else if (evaluate && vim9script && !VIM_ISWHITE(**arg)) + else if (evaluate && mnv9script && !MNV_ISWHITE(**arg)) { error_white_both(*arg, 2); clear_tv(rettv); @@ -4341,7 +4341,7 @@ eval5(char_u **arg, typval_T *rettv, evalarg_T *evalarg) /* * Get the second variable. */ - if (evaluate && vim9script && !IS_WHITE_OR_NUL(p[2])) + if (evaluate && mnv9script && !IS_WHITE_OR_NUL(p[2])) { error_white_both(p, 2); clear_tv(rettv); @@ -4376,16 +4376,16 @@ eval_concat_str(typval_T *tv1, typval_T *tv2) char_u *s1 = tv_get_string_buf(tv1, buf1); char_u *s2 = NULL; char_u *p; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); - if (vim9script && (tv2->v_type == VAR_VOID + if (mnv9script && (tv2->v_type == VAR_VOID || tv2->v_type == VAR_CHANNEL || tv2->v_type == VAR_JOB)) semsg(_(e_using_invalid_value_as_string_str), vartype_name(tv2->v_type)); - else if (vim9script && tv2->v_type == VAR_FLOAT) + else if (mnv9script && tv2->v_type == VAR_FLOAT) { - vim_snprintf((char *)buf2, NUMBUFLEN, "%g", + mnv_snprintf((char *)buf2, NUMBUFLEN, "%g", tv2->vval.v_float); s2 = buf2; } @@ -4517,7 +4517,7 @@ eval6(char_u **arg, typval_T *rettv, evalarg_T *evalarg) int oplen; int concat; typval_T var2; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); long op_lnum = SOURCING_LNUM; // "." is only string concatenation when scriptversion is 1 @@ -4538,7 +4538,7 @@ eval6(char_u **arg, typval_T *rettv, evalarg_T *evalarg) *arg = eval_next_line(*arg, evalarg); else { - if (evaluate && vim9script && !VIM_ISWHITE(**arg)) + if (evaluate && mnv9script && !MNV_ISWHITE(**arg)) { error_white_both(*arg, oplen); clear_tv(rettv); @@ -4573,14 +4573,14 @@ eval6(char_u **arg, typval_T *rettv, evalarg_T *evalarg) /* * Get the second variable. */ - if (evaluate && vim9script && !IS_WHITE_OR_NUL((*arg)[oplen])) + if (evaluate && mnv9script && !IS_WHITE_OR_NUL((*arg)[oplen])) { error_white_both(*arg, oplen); clear_tv(rettv); return FAIL; } *arg = skipwhite_and_linebreak(*arg + oplen, evalarg); - if (eval7(arg, &var2, evalarg, !vim9script && op == '.') == FAIL) + if (eval7(arg, &var2, evalarg, !mnv9script && op == '.') == FAIL) { clear_tv(rettv); return FAIL; @@ -4777,7 +4777,7 @@ eval7( *arg = eval_next_line(*arg, evalarg); else { - if (evaluate && in_vim9script() && !VIM_ISWHITE(**arg)) + if (evaluate && in_mnv9script() && !MNV_ISWHITE(**arg)) { error_white_both(*arg, 1); clear_tv(rettv); @@ -4789,7 +4789,7 @@ eval7( /* * Get the second variable. */ - if (evaluate && in_vim9script() && !IS_WHITE_OR_NUL((*arg)[1])) + if (evaluate && in_mnv9script() && !IS_WHITE_OR_NUL((*arg)[1])) { error_white_both(*arg, 1); clear_tv(rettv); @@ -4828,8 +4828,8 @@ eval8( int evaluate = evalarg == NULL ? 0 : (evalarg->eval_flags & EVAL_EVALUATE); - // Recognize in Vim9 script only. - if (in_vim9script() && **arg == '<' && eval_isnamec1((*arg)[1]) + // Recognize in MNV9 script only. + if (in_mnv9script() && **arg == '<' && eval_isnamec1((*arg)[1]) && STRNCMP(*arg, "", 5) != 0) { ++*arg; @@ -4891,7 +4891,7 @@ eval8( } int -eval_leader(char_u **arg, int vim9) +eval_leader(char_u **arg, int mnv9) { char_u *s = *arg; char_u *p = *arg; @@ -4900,8 +4900,8 @@ eval_leader(char_u **arg, int vim9) { char_u *n = skipwhite(p + 1); - // ++, --, -+ and +- are not accepted in Vim9 script - if (vim9 && (*p == '-' || *p == '+') && (*n == '-' || *n == '+')) + // ++, --, -+ and +- are not accepted in MNV9 script + if (mnv9 && (*p == '-' || *p == '+') && (*n == '-' || *n == '+')) { semsg(_(e_invalid_expression_str), s); return FAIL; @@ -5047,14 +5047,14 @@ eval9_reg_contents( typval_T *rettv, int evaluate) { - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); ++*arg; // skip '@' if (evaluate) { - if (vim9script && IS_WHITE_OR_NUL(**arg)) + if (mnv9script && IS_WHITE_OR_NUL(**arg)) semsg(_(e_syntax_error_at_str), *arg); - else if (vim9script && !valid_yank_reg(**arg, FALSE)) + else if (mnv9script && !valid_yank_reg(**arg, FALSE)) emsg_invreg(**arg); else { @@ -5078,9 +5078,9 @@ eval9_nested_expr( int evaluate) { int ret = NOTDONE; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); - if (vim9script) + if (mnv9script) { ret = get_lambda_tv(arg, rettv, TRUE, evalarg, NULL); if (ret == OK && evaluate) @@ -5147,7 +5147,7 @@ eval9_var_func_name( int len; char_u *alias; int ret = OK; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); s = *arg; len = get_name_len(arg, &alias, evaluate, TRUE); @@ -5160,19 +5160,19 @@ eval9_var_func_name( { int flags = evalarg == NULL ? 0 : evalarg->eval_flags; - if (evaluate && vim9script && len == 1 && *s == '_') + if (evaluate && mnv9script && len == 1 && *s == '_') { emsg(_(e_cannot_use_underscore_here)); ret = FAIL; } - else if (evaluate && vim9script && len > 2 + else if (evaluate && mnv9script && len > 2 && s[0] == 's' && s[1] == ':') { - semsg(_(e_cannot_use_s_colon_in_vim9_script_str), s); + semsg(_(e_cannot_use_s_colon_in_mnv9_script_str), s); ret = FAIL; } - else if ((vim9script ? **arg : *skipwhite(*arg)) == '(' - || (vim9script && generic_func_call(arg))) + else if ((mnv9script ? **arg : *skipwhite(*arg)) == '(' + || (mnv9script && generic_func_call(arg))) { // "name(..." recursive! *arg = skipwhite(*arg); @@ -5182,7 +5182,7 @@ eval9_var_func_name( { // get the value of "true", "false", etc. or a variable ret = FAIL; - if (vim9script) + if (mnv9script) ret = handle_predefined(s, len, rettv); if (ret == FAIL) { @@ -5192,7 +5192,7 @@ eval9_var_func_name( // skip the generic function arguments (if present) // they are already processed by eval_variable - if (ret == OK && vim9script && **arg == '<' + if (ret == OK && mnv9script && **arg == '<' && rettv->v_type == VAR_FUNC) ret = skip_generic_func_type_args(arg); } @@ -5204,7 +5204,7 @@ eval9_var_func_name( ret = OK; } } - vim_free(alias); + mnv_free(alias); return ret; } @@ -5253,7 +5253,7 @@ eval9( char_u *start_leader, *end_leader; int ret = OK; static int recurse = 0; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); /* * Initialise variable so that clear_tv() can't mistake this for a @@ -5265,7 +5265,7 @@ eval9( * Skip '!', '-' and '+' characters. They are handled later. */ start_leader = *arg; - if (eval_leader(arg, vim9script) == FAIL) + if (eval_leader(arg, mnv9script) == FAIL) return FAIL; end_leader = *arg; @@ -5343,10 +5343,10 @@ eval9( * Lambda: {arg, arg -> expr} * Dictionary: {'key': val, 'key': val} */ - case '{': if (vim9script) + case '{': if (mnv9script) ret = NOTDONE; else - ret = get_lambda_tv(arg, rettv, vim9script, evalarg, NULL); + ret = get_lambda_tv(arg, rettv, mnv9script, evalarg, NULL); if (ret == NOTDONE) ret = eval_dict(arg, rettv, evalarg, FALSE); break; @@ -5426,16 +5426,16 @@ eval9_leader( int error = FALSE; varnumber_T val = 0; vartype_T type = rettv->v_type; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); float_T f = 0.0; if (rettv->v_type == VAR_FLOAT) f = rettv->vval.v_float; else { - while (VIM_ISWHITE(end_leader[-1])) + while (MNV_ISWHITE(end_leader[-1])) --end_leader; - if (vim9script && end_leader[-1] == '!') + if (mnv9script && end_leader[-1] == '!') { // Is this typeval supported with the ! operator? if (check_typval_is_value(rettv) == FAIL) @@ -5496,7 +5496,7 @@ eval9_leader( else { clear_tv(rettv); - if (vim9script) + if (mnv9script) rettv->v_type = type; else rettv->v_type = VAR_NUMBER; @@ -5684,7 +5684,7 @@ eval_method( *arg = skipwhite(*arg); if (**arg != '(' && alias == NULL - && (paren = vim_strchr(*arg, '(')) != NULL) + && (paren = mnv_strchr(*arg, '(')) != NULL) { *arg = name; @@ -5725,7 +5725,7 @@ eval_method( semsg(_(e_missing_parenthesis_str), name); ret = FAIL; } - else if (VIM_ISWHITE((*arg)[-1])) + else if (MNV_ISWHITE((*arg)[-1])) { if (verbose) emsg(_(e_no_white_space_allowed_before_parenthesis)); @@ -5741,10 +5741,10 @@ eval_method( // evaluating the arguments is possible (see test55). if (evaluate) clear_tv(&base); - vim_free(tofree); + mnv_free(tofree); if (alias != NULL) - vim_free(alias); + mnv_free(alias); return ret; } @@ -5768,7 +5768,7 @@ eval_index( int range = FALSE; char_u *key = NULL; int keylen = -1; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); if (check_can_index(rettv, evaluate, verbose) == FAIL) return FAIL; @@ -5785,7 +5785,7 @@ eval_index( ; if (keylen == 0) return FAIL; - if (vim9script && key[keylen] == '<') + if (mnv9script && key[keylen] == '<') { // skip generic type arguments char_u *p = &key[keylen]; @@ -5808,7 +5808,7 @@ eval_index( empty1 = TRUE; else if (eval1(arg, &var1, evalarg) == FAIL) // recursive! return FAIL; - else if (vim9script && **arg == ':') + else if (mnv9script && **arg == ':') { semsg(_(e_white_space_required_before_and_after_str_at_str), ":", *arg); @@ -5820,14 +5820,14 @@ eval_index( int error = FALSE; // allow for indexing with float - if (vim9script && rettv->v_type == VAR_DICT + if (mnv9script && rettv->v_type == VAR_DICT && var1.v_type == VAR_FLOAT) { var1.vval.v_string = typval_tostring(&var1, TRUE); var1.v_type = VAR_STRING; } - if (vim9script && (rettv->v_type == VAR_LIST + if (mnv9script && (rettv->v_type == VAR_LIST || rettv->v_type == VAR_TUPLE)) tv_get_number_chk(&var1, &error); else @@ -5848,7 +5848,7 @@ eval_index( { range = TRUE; ++*arg; - if (vim9script && !IS_WHITE_OR_NUL(**arg) && **arg != ']') + if (mnv9script && !IS_WHITE_OR_NUL(**arg) && **arg != ']') { semsg(_(e_white_space_required_before_and_after_str_at_str), ":", *arg - 1); @@ -5952,7 +5952,7 @@ check_can_index(typval_T *rettv, int evaluate, int verbose) case VAR_BLOB: break; case VAR_NUMBER: - if (in_vim9script()) + if (in_mnv9script()) emsg(_(e_cannot_index_number)); break; } @@ -6023,7 +6023,7 @@ eval_index_inner( char_u *s = tv_get_string(rettv); len = (long)STRLEN(s); - if (in_vim9script() || exclusive) + if (in_mnv9script() || exclusive) { if (is_range) s = string_slice(s, n1, n2, exclusive); @@ -6047,7 +6047,7 @@ eval_index_inner( if (n1 >= len || n2 < 0 || n1 > n2) s = NULL; else - s = vim_strnsave(s + n1, n2 - n1 + 1); + s = mnv_strnsave(s + n1, n2 - n1 + 1); } else { @@ -6057,7 +6057,7 @@ eval_index_inner( if (n1 >= len || n1 < 0) s = NULL; else - s = vim_strnsave(s + n1, 1); + s = mnv_strnsave(s + n1, 1); } clear_tv(rettv); rettv->v_type = VAR_STRING; @@ -6147,12 +6147,12 @@ partial_free(partial_T *pt) for (i = 0; i < pt->pt_argc; ++i) clear_tv(&pt->pt_argv[i]); - vim_free(pt->pt_argv); + mnv_free(pt->pt_argv); dict_unref(pt->pt_dict); if (pt->pt_name != NULL) { func_unref(pt->pt_name); - vim_free(pt->pt_name); + mnv_free(pt->pt_name); } else func_ptr_unref(pt->pt_func); @@ -6180,7 +6180,7 @@ partial_free(partial_T *pt) loopvars_check_refcount(pt->pt_loopvars[i]); } - vim_free(pt); + mnv_free(pt); } /* @@ -6275,7 +6275,7 @@ func_tv2string(typval_T *tv, char_u **tofree, int echo_style) r = make_ufunc_name_readable(tv->vval.v_string, buf, MAX_FUNC_NAME_LEN); if (r == buf) - r = *tofree = vim_strsave(buf); + r = *tofree = mnv_strsave(buf); } } else @@ -6305,7 +6305,7 @@ method_tv2string(typval_T *tv, char_u **tofree, int echo_style) char_u buf[MAX_FUNC_NAME_LEN]; partial_T *pt = tv->vval.v_partial; - size_t len = vim_snprintf((char *)buf, sizeof(buf), "%d_%s.%s", + size_t len = mnv_snprintf((char *)buf, sizeof(buf), "%d_%s.%s", pt->pt_func->uf_script_ctx.sc_sid, pt->pt_func->uf_class->class_name.string, pt->pt_func->uf_name); @@ -6320,7 +6320,7 @@ method_tv2string(typval_T *tv, char_u **tofree, int echo_style) return *tofree = string_quote((char_u*)"", TRUE); } - return *tofree = echo_style ? vim_strsave(buf) : string_quote(buf, TRUE); + return *tofree = echo_style ? mnv_strsave(buf) : string_quote(buf, TRUE); } /* @@ -6351,14 +6351,14 @@ partial_tv2string( { // When using uf_name prepend "g:" for a global function. if (pt != NULL && pt->pt_name == NULL && fname[0] == '\'' - && vim_isupper(fname[1])) + && mnv_isupper(fname[1])) { GA_CONCAT_LITERAL(&ga, "'g:"); ga_concat(&ga, fname + 1); } else ga_concat(&ga, fname); - vim_free(fname); + mnv_free(fname); } if (pt != NULL && pt->pt_argc > 0) { @@ -6368,7 +6368,7 @@ partial_tv2string( if (i > 0) GA_CONCAT_LITERAL(&ga, ", "); ga_concat(&ga, tv2string(&pt->pt_argv[i], &tf, numbuf, copyID)); - vim_free(tf); + mnv_free(tf); } GA_CONCAT_LITERAL(&ga, "]"); } @@ -6380,7 +6380,7 @@ partial_tv2string( dtv.v_type = VAR_DICT; dtv.vval.v_dict = pt->pt_dict; ga_concat(&ga, tv2string(&dtv, &tf, numbuf, copyID)); - vim_free(tf); + mnv_free(tf); } // terminate with ')' and a NUL GA_CONCAT_LITERAL(&ga, ")"); @@ -6593,7 +6593,7 @@ class_tv2string(typval_T *tv, char_u **tofree) rsize = s.length + 1 + class_name.length + 1; r = *tofree = alloc(rsize); if (r != NULL) - vim_snprintf((char *)r, rsize, "%s %s", s.string, (char *)class_name.string); + mnv_snprintf((char *)r, rsize, "%s %s", s.string, (char *)class_name.string); return r; } @@ -6629,7 +6629,7 @@ object_tv2string( size_t n = 25 + obj->obj_class->class_name.length; r = alloc(n); if (r != NULL) - (void)vim_snprintf((char *)r, n, "object of %s {...}", + (void)mnv_snprintf((char *)r, n, "object of %s {...}", obj->obj_class->class_name.string); *tofree = r; } @@ -6753,7 +6753,7 @@ echo_string_core( case VAR_FLOAT: *tofree = NULL; - vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv->vval.v_float); + mnv_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv->vval.v_float); r = numbuf; break; @@ -6764,7 +6764,7 @@ echo_string_core( break; case VAR_TYPEALIAS: - *tofree = vim_strsave(tv->vval.v_typealias->ta_name); + *tofree = mnv_strsave(tv->vval.v_typealias->ta_name); r = *tofree; if (r == NULL) r = (char_u *)""; @@ -6927,7 +6927,7 @@ var2fpos( return &pos; } - if (in_vim9script() && check_for_string_arg(varp, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(varp, 0) == FAIL) return NULL; name = tv_get_string_chk(varp); @@ -6938,7 +6938,7 @@ var2fpos( pos.lnum = 0; if (name[0] == '.') { - if (!in_vim9script() || name[1] == NUL) + if (!in_mnv9script() || name[1] == NUL) { error = FALSE; // cursor @@ -6955,7 +6955,7 @@ var2fpos( } else if (name[0] == '\'') { - if (!in_vim9script() || (name[1] != NUL && name[2] == NUL)) + if (!in_mnv9script() || (name[1] != NUL && name[2] == NUL)) { error = FALSE; // mark @@ -7026,7 +7026,7 @@ var2fpos( } return &pos; } - if (in_vim9script() && error) + if (in_mnv9script() && error) semsg(_(e_invalid_value_for_line_number_str), name); return NULL; } @@ -7118,7 +7118,7 @@ get_env_len(char_u **arg) char_u *p; int len; - for (p = *arg; vim_isIDc(*p); ++p) + for (p = *arg; mnv_isIDc(*p); ++p) ; if (p == *arg) // no name found return 0; @@ -7147,7 +7147,7 @@ get_id_len(char_u **arg) // "s:" is start of "s:var", but "n:" is not and can be used in // slice "[n:]". Also "xx:" is not a namespace. len = (int)(p - *arg); - if ((len == 1 && vim_strchr(NAMESPACE_CHAR, **arg) == NULL) + if ((len == 1 && mnv_strchr(NAMESPACE_CHAR, **arg) == NULL) || len > 1) break; } @@ -7254,7 +7254,7 @@ find_name_end( int br_nest = 0; char_u *p; int len; - int allow_curly = !in_vim9script(); + int allow_curly = !in_mnv9script(); if (expr_start != NULL) { @@ -7297,7 +7297,7 @@ find_name_end( // "s:" is start of "s:var", but "n:" is not and can be used in // slice "[n:]". Also "xx:" is not a namespace. But {ns}: is. len = (int)(p - arg); - if ((len == 1 && vim_strchr(NAMESPACE_CHAR, *arg) == NULL) + if ((len == 1 && mnv_strchr(NAMESPACE_CHAR, *arg) == NULL) || (len > 1 && p[-1] != '}')) break; } @@ -7370,10 +7370,10 @@ make_expanded_name( retval = alloc(retvalsize); if (retval != NULL) - vim_snprintf((char *)retval, retvalsize, "%s%s%s", + mnv_snprintf((char *)retval, retvalsize, "%s%s%s", in_start, temp_result, expr_end + 1); } - vim_free(temp_result); + mnv_free(temp_result); *in_end = c1; // put char back for error messages *expr_start = '{'; @@ -7387,7 +7387,7 @@ make_expanded_name( // Further expansion! temp_result = make_expanded_name(retval, expr_start, expr_end, temp_result); - vim_free(retval); + mnv_free(retval); retval = temp_result; } } @@ -7462,7 +7462,7 @@ handle_subscript( || rettv->v_type == VAR_CLASS || rettv->v_type == VAR_OBJECT)) || (p[0] == '-' && p[1] == '>' && (p[2] == '{' - || ASCII_ISALPHA(in_vim9script() ? *skipwhite(p + 2) + || ASCII_ISALPHA(in_mnv9script() ? *skipwhite(p + 2) : p[2]))))) { *arg = eval_next_line(*arg, evalarg); @@ -7535,7 +7535,7 @@ handle_subscript( else { rettv->vval.v_string = - vim_strnsave(ufunc->uf_name, ufunc->uf_namelen); + mnv_strnsave(ufunc->uf_name, ufunc->uf_namelen); } } continue; @@ -7543,7 +7543,7 @@ handle_subscript( if ((**arg == '(' && (!evaluate || rettv->v_type == VAR_FUNC || rettv->v_type == VAR_PARTIAL)) - && (!check_white || !VIM_ISWHITE(*(*arg - 1)))) + && (!check_white || !MNV_ISWHITE(*(*arg - 1)))) { ret = call_func_rettv(arg, evalarg, rettv, evaluate, selfdict, NULL); @@ -7562,16 +7562,16 @@ handle_subscript( } else if (p[0] == '-' && p[1] == '>') { - if (in_vim9script()) + if (in_mnv9script()) *arg = skipwhite(p + 2); else *arg = p + 2; - if (VIM_ISWHITE(**arg)) + if (MNV_ISWHITE(**arg)) { emsg(_(e_no_white_space_allowed_before_parenthesis)); ret = FAIL; } - else if ((**arg == '{' && !in_vim9script()) || **arg == '(') + else if ((**arg == '{' && !in_mnv9script()) || **arg == '(') // expr->{lambda}() or expr->(lambda)() ret = eval_lambda(arg, rettv, evalarg, verbose); else @@ -7790,7 +7790,7 @@ echo_one(typval_T *rettv, int with_space, int *atstart, int *needclr) (void)msg_outtrans_len_attr(p, 1, echo_attr); } } - vim_free(tofree); + mnv_free(tofree); } /* @@ -8000,9 +8000,9 @@ ex_execute(exarg_T *eap) { int save_sticky_cmdmod_flags = sticky_cmdmod_flags; - // "legacy exe cmd" and "vim9cmd exe cmd" applies to "cmd". + // "legacy exe cmd" and "mnv9cmd exe cmd" applies to "cmd". sticky_cmdmod_flags = cmdmod.cmod_flags - & (CMOD_LEGACY | CMOD_VIM9CMD); + & (CMOD_LEGACY | CMOD_MNV9CMD); do_cmdline((char_u *)ga.ga_data, eap->ea_getline, eap->cookie, DOCMD_NOWAIT|DOCMD_VERBOSE); sticky_cmdmod_flags = save_sticky_cmdmod_flags; @@ -8078,7 +8078,7 @@ last_set_msg(sctx_T script_ctx) msg_outnum((long)script_ctx.sc_lnum); } verbose_leave(); - vim_free(p); + mnv_free(p); } #endif // FEAT_EVAL @@ -8111,7 +8111,7 @@ do_string_sub( ga_init2(&ga, 1, 200); regmatch.rm_ic = p_ic; - regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + regmatch.regprog = mnv_regcomp(pat, RE_MAGIC + RE_STRING); if (regmatch.regprog != NULL) { char_u *tail = str; @@ -8121,7 +8121,7 @@ do_string_sub( int i; char_u *zero_width = NULL; - while (vim_regexec_nl(®match, str, (colnr_T)(tail - str))) + while (mnv_regexec_nl(®match, str, (colnr_T)(tail - str))) { // Skip empty match except for first match. if (regmatch.startp[0] == regmatch.endp[0]) @@ -8146,7 +8146,7 @@ do_string_sub( * - The substituted text. * - The text after the match. */ - sublen = vim_regsub(®match, sub, expr, tail, 0, REGSUB_MAGIC); + sublen = mnv_regsub(®match, sub, expr, tail, 0, REGSUB_MAGIC); if (sublen <= 0) { ga_clear(&ga); @@ -8163,7 +8163,7 @@ do_string_sub( i = (int)(regmatch.startp[0] - tail); mch_memmove((char_u *)ga.ga_data + ga.ga_len, tail, (size_t)i); // add the substituted text - (void)vim_regsub(®match, sub, expr, + (void)mnv_regsub(®match, sub, expr, (char_u *)ga.ga_data + ga.ga_len + i, sublen, REGSUB_COPY | REGSUB_MAGIC); ga.ga_len += i + sublen - 1; @@ -8180,7 +8180,7 @@ do_string_sub( ga.ga_len += (int)(end - tail); } - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); } if (ga.ga_data != NULL) @@ -8188,7 +8188,7 @@ do_string_sub( str = (char_u *)ga.ga_data; len = (size_t)ga.ga_len; } - ret = vim_strnsave(str, len); + ret = mnv_strnsave(str, len); ga_clear(&ga); if (p_cpo == empty_option) p_cpo = save_cpo; diff --git a/uvim/src/evalbuffer.c b/uvim/src/evalbuffer.c index 29d0f92f8a..45e8f8f008 100644 --- a/uvim/src/evalbuffer.c +++ b/uvim/src/evalbuffer.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * evalbuffer.c: Buffer related builtin functions */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) /* @@ -87,7 +87,7 @@ find_buffer(typval_T *avar) if (avar->v_type == VAR_NUMBER) buf = buflist_findnr((int)avar->vval.v_number); - else if (in_vim9script() && check_for_string_arg(avar, 0) == FAIL) + else if (in_mnv9script() && check_for_string_arg(avar, 0) == FAIL) return NULL; else if (avar->v_type == VAR_STRING && avar->vval.v_string != NULL) { @@ -209,7 +209,7 @@ set_buffer_lines( if (buf == NULL || (!is_curbuf && buf->b_ml.ml_mfp == NULL) || lnum < 1) { rettv->vval.v_number = 1; // FAIL - if (in_vim9script() && lnum < 1) + if (in_mnv9script() && lnum < 1) semsg(_(e_invalid_line_number_nr), lnum_arg); return; } @@ -250,7 +250,7 @@ set_buffer_lines( // list argument, get next string if (li == NULL) break; - vim_free(line); + mnv_free(line); line = typval_tostring(&li->li_tv, FALSE); li = li->li_next; } @@ -292,7 +292,7 @@ set_buffer_lines( break; ++lnum; } - vim_free(line); + mnv_free(line); if (added > 0) { @@ -331,7 +331,7 @@ f_append(typval_T *argvars, typval_T *rettv) linenr_T lnum; int did_emsg_before = did_emsg; - if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_lnum_arg(argvars, 0) == FAIL) return; lnum = tv_get_lnum(&argvars[0]); @@ -349,7 +349,7 @@ buf_set_append_line(typval_T *argvars, typval_T *rettv, int append) buf_T *buf; int did_emsg_before = did_emsg; - if (in_vim9script() + if (in_mnv9script() && (check_for_buffer_arg(argvars, 0) == FAIL || check_for_lnum_arg(argvars, 1) == FAIL || check_for_string_or_number_or_list_arg(argvars, 2) == FAIL)) @@ -383,7 +383,7 @@ f_bufadd(typval_T *argvars, typval_T *rettv) { char_u *name; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; name = tv_get_string(&argvars[0]); @@ -396,7 +396,7 @@ f_bufadd(typval_T *argvars, typval_T *rettv) void f_bufexists(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_buffer_arg(argvars, 0) == FAIL) return; rettv->vval.v_number = (find_buffer(&argvars[0]) != NULL); @@ -410,7 +410,7 @@ f_buflisted(typval_T *argvars, typval_T *rettv) { buf_T *buf; - if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_buffer_arg(argvars, 0) == FAIL) return; buf = find_buffer(&argvars[0]); @@ -425,7 +425,7 @@ f_bufload(typval_T *argvars, typval_T *rettv UNUSED) { buf_T *buf; - if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_buffer_arg(argvars, 0) == FAIL) return; buf = get_buf_arg(&argvars[0]); @@ -441,7 +441,7 @@ f_bufloaded(typval_T *argvars, typval_T *rettv) { buf_T *buf; - if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_buffer_arg(argvars, 0) == FAIL) return; buf = find_buffer(&argvars[0]); @@ -457,7 +457,7 @@ f_bufname(typval_T *argvars, typval_T *rettv) buf_T *buf; typval_T *tv = &argvars[0]; - if (in_vim9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL) return; if (tv->v_type == VAR_UNKNOWN) @@ -466,7 +466,7 @@ f_bufname(typval_T *argvars, typval_T *rettv) buf = tv_get_buf_from_arg(tv); rettv->v_type = VAR_STRING; if (buf != NULL && buf->b_fname != NULL) - rettv->vval.v_string = vim_strsave(buf->b_fname); + rettv->vval.v_string = mnv_strsave(buf->b_fname); else rettv->vval.v_string = NULL; } @@ -481,7 +481,7 @@ f_bufnr(typval_T *argvars, typval_T *rettv) int error = FALSE; char_u *name; - if (in_vim9script() + if (in_mnv9script() && (check_for_opt_buffer_arg(argvars, 0) == FAIL || (argvars[0].v_type != VAR_UNKNOWN && check_for_opt_bool_arg(argvars, 1) == FAIL))) @@ -515,7 +515,7 @@ buf_win_common(typval_T *argvars, typval_T *rettv, int get_nr) int winnr = 0; buf_T *buf; - if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_buffer_arg(argvars, 0) == FAIL) return; buf = tv_get_buf_from_arg(&argvars[0]); @@ -563,7 +563,7 @@ f_deletebufline(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = 1; // FAIL by default - if (in_vim9script() + if (in_mnv9script() && (check_for_buffer_arg(argvars, 0) == FAIL || check_for_lnum_arg(argvars, 1) == FAIL || check_for_opt_lnum_arg(argvars, 2) == FAIL)) @@ -703,7 +703,7 @@ get_buffer_info(buf_T *buf) } # endif -# ifdef FEAT_VIMINFO +# ifdef FEAT_MNVINFO dict_add_number(dict, "lastused", buf->b_last_used); # endif @@ -727,7 +727,7 @@ f_getbufinfo(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() + if (in_mnv9script() && check_for_opt_buffer_or_dict_arg(argvars, 0) == FAIL) return; @@ -775,7 +775,7 @@ f_getbufinfo(typval_T *argvars, typval_T *rettv) * Get line or list of lines from buffer "buf" into "rettv". * Return a range (from start to end) of lines in rettv from the specified * buffer. - * If 'retlist' is TRUE, then the lines are returned as a Vim List. + * If 'retlist' is TRUE, then the lines are returned as a MNV List. */ static void get_buffer_lines( @@ -803,10 +803,10 @@ get_buffer_lines( { if (start >= 1 && start <= buf->b_ml.ml_line_count) rettv->vval.v_string = - vim_strnsave(ml_get_buf(buf, start, FALSE), + mnv_strnsave(ml_get_buf(buf, start, FALSE), ml_get_buf_len(buf, start)); else - rettv->vval.v_string = vim_strnsave((char_u *)"", 0); + rettv->vval.v_string = mnv_strnsave((char_u *)"", 0); } else { @@ -840,7 +840,7 @@ getbufline(typval_T *argvars, typval_T *rettv, int retlist) buf_T *buf; int did_emsg_before = did_emsg; - if (in_vim9script() + if (in_mnv9script() && (check_for_buffer_arg(argvars, 0) == FAIL || check_for_lnum_arg(argvars, 1) == FAIL || check_for_opt_lnum_arg(argvars, 2) == FAIL)) @@ -889,7 +889,7 @@ f_getline(typval_T *argvars, typval_T *rettv) linenr_T end; int retlist; - if (in_vim9script() + if (in_mnv9script() && (check_for_lnum_arg(argvars, 0) == FAIL || check_for_opt_lnum_arg(argvars, 1) == FAIL)) return; @@ -927,7 +927,7 @@ f_setline(typval_T *argvars, typval_T *rettv) linenr_T lnum; int did_emsg_before = did_emsg; - if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_lnum_arg(argvars, 0) == FAIL) return; lnum = tv_get_lnum(&argvars[0]); diff --git a/uvim/src/evalfunc.c b/uvim/src/evalfunc.c index de6975a0d4..6a5945282f 100644 --- a/uvim/src/evalfunc.c +++ b/uvim/src/evalfunc.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -12,7 +12,7 @@ */ #define USING_FLOAT_STUFF -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) @@ -262,7 +262,7 @@ arg_type_modifiable(type_T *type, int arg_idx) return OK; semsg(_(e_argument_nr_trying_to_modify_const_str), arg_idx, type_name(type, &tofree)); - vim_free(tofree); + mnv_free(tofree); return FAIL; } @@ -3610,7 +3610,7 @@ non_zero_arg(typval_T *argvars) static void f_and(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; @@ -3633,7 +3633,7 @@ f_balloon_gettext(typval_T *argvars UNUSED, typval_T *rettv) if (balloonEval->msg == NULL) rettv->vval.v_string = NULL; else - rettv->vval.v_string = vim_strsave(balloonEval->msg); + rettv->vval.v_string = mnv_strsave(balloonEval->msg); } static void @@ -3642,7 +3642,7 @@ f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED) if (balloonEval == NULL) return; - if (in_vim9script() + if (in_mnv9script() && check_for_string_or_list_arg(argvars, 0) == FAIL) return; @@ -3662,7 +3662,7 @@ f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED) { char_u *mesg; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; mesg = tv_get_string_chk(&argvars[0]); @@ -3681,7 +3681,7 @@ f_balloon_split(typval_T *argvars, typval_T *rettv UNUSED) char_u *msg; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; msg = tv_get_string_chk(&argvars[0]); if (msg != NULL) @@ -3693,8 +3693,8 @@ f_balloon_split(typval_T *argvars, typval_T *rettv UNUSED) for (int i = 1; i < size - 1; ++i) list_append_string(rettv->vval.v_list, array[i].pum_text, -1); while (size > 0) - vim_free(array[--size].pum_text); - vim_free(array); + mnv_free(array[--size].pum_text); + mnv_free(array); } } # endif @@ -3718,7 +3718,7 @@ init_base64_dec_table(void) return; // Unsupported characters are set to 0xFF - vim_memset(base64_dec_table, 0xFF, sizeof(base64_dec_table)); + mnv_memset(base64_dec_table, 0xFF, sizeof(base64_dec_table)); // Initialize the index for the base64 alphabets for (size_t i = 0; i < sizeof(base64_table) - 1; i++) @@ -3906,7 +3906,7 @@ f_bindtextdomain(typval_T *argvars, typval_T *rettv) || check_for_nonempty_string_arg(argvars, 1) == FAIL) return; - if (strcmp((const char *)argvars[0].vval.v_string, VIMPACKAGE) == 0) + if (strcmp((const char *)argvars[0].vval.v_string, MNVPACKAGE) == 0) semsg(_(e_invalid_argument_str), tv_get_string(&argvars[0])); else { @@ -3931,7 +3931,7 @@ f_byte2line(typval_T *argvars UNUSED, typval_T *rettv) #else long boff = 0; - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; boff = tv_get_number(&argvars[0]) - 1; // boff gets -1 on type error @@ -3954,7 +3954,7 @@ f_call(typval_T *argvars, typval_T *rettv) dict_T *selfdict = NULL; char_u *tofree = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_or_func_arg(argvars, 0) == FAIL || check_for_list_arg(argvars, 1) == FAIL || check_for_opt_dict_arg(argvars, 2) == FAIL)) @@ -3993,7 +3993,7 @@ f_call(typval_T *argvars, typval_T *rettv) &p); if (s != NULL) { - vim_free(tofree); + mnv_free(tofree); tofree = s; } } @@ -4011,7 +4011,7 @@ f_call(typval_T *argvars, typval_T *rettv) (void)func_call(func, &argvars[1], partial, selfdict, rettv); done: - vim_free(tofree); + mnv_free(tofree); } /* @@ -4029,7 +4029,7 @@ f_changenr(typval_T *argvars UNUSED, typval_T *rettv) static void f_char2nr(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_bool_arg(argvars, 1) == FAIL)) return; @@ -4169,11 +4169,11 @@ f_confirm(typval_T *argvars UNUSED, typval_T *rettv UNUSED) char_u buf[NUMBUFLEN]; char_u buf2[NUMBUFLEN]; int def = 1; - int type = VIM_GENERIC; + int type = MNV_GENERIC; char_u *typestr; int error = FALSE; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || (check_for_opt_string_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -4202,11 +4202,11 @@ f_confirm(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { switch (TOUPPER_ASC(*typestr)) { - case 'E': type = VIM_ERROR; break; - case 'Q': type = VIM_QUESTION; break; - case 'I': type = VIM_INFO; break; - case 'W': type = VIM_WARNING; break; - case 'G': type = VIM_GENERIC; break; + case 'E': type = MNV_ERROR; break; + case 'Q': type = MNV_QUESTION; break; + case 'I': type = MNV_INFO; break; + case 'W': type = MNV_WARNING; break; + case 'G': type = MNV_GENERIC; break; } } } @@ -4243,7 +4243,7 @@ set_cursorpos(typval_T *argvars, typval_T *rettv, int charcol) long coladd = 0; int set_curswant = TRUE; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_or_number_or_list_arg(argvars, 0) == FAIL || check_for_opt_number_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -4333,7 +4333,7 @@ f_debugbreak(typval_T *argvars, typval_T *rettv) int pid; rettv->vval.v_number = FAIL; - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; pid = (int)tv_get_number(&argvars[0]); @@ -4387,7 +4387,7 @@ f_echoraw(typval_T *argvars, typval_T *rettv UNUSED) { char_u *str; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; str = tv_get_string_chk(&argvars[0]); @@ -4518,18 +4518,18 @@ f_environ(typval_T *argvars UNUSED, typval_T *rettv) # else if ((entry = (char_u *)environ[i]) == NULL) return; - entry = vim_strsave(entry); + entry = mnv_strsave(entry); # endif if (entry == NULL) // out of memory return; - if ((value = vim_strchr(entry, '=')) == NULL) + if ((value = mnv_strchr(entry, '=')) == NULL) { - vim_free(entry); + mnv_free(entry); continue; } *value++ = NUL; dict_add_string(rettv->vval.v_dict, (char *)entry, value); - vim_free(entry); + mnv_free(entry); } #endif } @@ -4569,12 +4569,12 @@ f_escape(typval_T *argvars, typval_T *rettv) { char_u buf[NUMBUFLEN]; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; - rettv->vval.v_string = vim_strsave_escaped(tv_get_string(&argvars[0]), + rettv->vval.v_string = mnv_strsave_escaped(tv_get_string(&argvars[0]), tv_get_string_buf(&argvars[1], buf)); rettv->v_type = VAR_STRING; } @@ -4587,7 +4587,7 @@ f_eval(typval_T *argvars, typval_T *rettv) { char_u *s, *p; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; s = tv_get_string_chk(&argvars[0]); @@ -4658,12 +4658,12 @@ get_str_line( p = start; if (p == NULL || *p == NUL) return NULL; - p = vim_strchr(p, '\n'); + p = mnv_strchr(p, '\n'); if (p == NULL) - line = vim_strsave(start); + line = mnv_strsave(start); else { - line = vim_strnsave(start, p - start); + line = mnv_strnsave(start, p - start); p++; } @@ -4703,7 +4703,7 @@ get_list_line( return NULL; s = tv_get_string_buf_chk(&item->li_tv, buf); *p = item->li_next; - return s == NULL ? NULL : vim_strsave(s); + return s == NULL ? NULL : mnv_strsave(s); } /* @@ -4753,7 +4753,7 @@ execute_common(typval_T *argvars, typval_T *rettv, int arg_off) { char_u buf[NUMBUFLEN]; char_u *s = tv_get_string_buf_chk_strict(&argvars[arg_off + 1], buf, - in_vim9script()); + in_mnv9script()); if (s == NULL) return; @@ -4778,9 +4778,9 @@ execute_common(typval_T *argvars, typval_T *rettv, int arg_off) if (!echo_output) msg_col = 0; // prevent leading spaces - // For "legacy call execute('cmd')" and "vim9cmd execute('cmd')" apply the + // For "legacy call execute('cmd')" and "mnv9cmd execute('cmd')" apply the // command modifiers to "cmd". - sticky_cmdmod_flags = cmdmod.cmod_flags & (CMOD_LEGACY | CMOD_VIM9CMD); + sticky_cmdmod_flags = cmdmod.cmod_flags & (CMOD_LEGACY | CMOD_MNV9CMD); if (cmd != NULL) do_cmdline_cmd(cmd); else @@ -4832,7 +4832,7 @@ execute_common(typval_T *argvars, typval_T *rettv, int arg_off) static void f_execute(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_string_or_list_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL)) return; @@ -4849,7 +4849,7 @@ f_exists(typval_T *argvars, typval_T *rettv) char_u *p; int n = FALSE; - if (in_vim9script() && check_for_nonempty_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_nonempty_string_arg(argvars, 0) == FAIL) return; p = tv_get_string(&argvars[0]); @@ -4860,11 +4860,11 @@ f_exists(typval_T *argvars, typval_T *rettv) n = TRUE; else { - // try expanding things like $VIM and ${HOME} + // try expanding things like $MNV and ${HOME} p = expand_env_save(p); if (p != NULL && *p != '$') n = TRUE; - vim_free(p); + mnv_free(p); } } else if (*p == '&' || *p == '+') // option @@ -4922,7 +4922,7 @@ f_expand(typval_T *argvars, typval_T *rettv) char_u *p_csl_save = p_csl; #endif - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_bool_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -4957,7 +4957,7 @@ f_expand(typval_T *argvars, typval_T *rettv) { if (rettv_list_alloc(rettv) == OK && result != NULL) list_append_string(rettv->vval.v_list, result, -1); - vim_free(result); + mnv_free(result); } else rettv->vval.v_string = result; @@ -5006,7 +5006,7 @@ f_expandcmd(typval_T *argvars, typval_T *rettv) char *errormsg = NULL; int emsgoff = TRUE; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_dict_arg(argvars, 1) == FAIL)) return; @@ -5016,7 +5016,7 @@ f_expandcmd(typval_T *argvars, typval_T *rettv) emsgoff = FALSE; rettv->v_type = VAR_STRING; - cmdstr = vim_strsave(tv_get_string(&argvars[0])); + cmdstr = mnv_strsave(tv_get_string(&argvars[0])); CLEAR_FIELD(eap); eap.cmd = cmdstr; @@ -5059,7 +5059,7 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED) if (check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL)) return; @@ -5114,7 +5114,7 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED) { // Need to escape K_SPECIAL and CSI before putting the string in // the typeahead buffer. - char_u *keys_esc = vim_strsave_escape_csi(keys); + char_u *keys_esc = mnv_strsave_escape_csi(keys); if (keys_esc == NULL) return; @@ -5129,7 +5129,7 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED) || input_busy) typebuf_was_filled = TRUE; - vim_free(keys_esc); + mnv_free(keys_esc); } if (execute) @@ -5177,10 +5177,10 @@ f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED) static void f_fnameescape(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; - rettv->vval.v_string = vim_strsave_fnameescape( + rettv->vval.v_string = mnv_strsave_fnameescape( tv_get_string(&argvars[0]), VSE_NONE); rettv->v_type = VAR_STRING; } @@ -5198,7 +5198,7 @@ f_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED) return; } #endif -#if defined(MSWIN) && (!defined(FEAT_GUI) || defined(VIMDLL)) +#if defined(MSWIN) && (!defined(FEAT_GUI) || defined(MNVDLL)) win32_set_foreground(); #endif } @@ -5218,7 +5218,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) int is_global = FALSE; char_u *start_bracket = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_or_func_arg(argvars, 0) == FAIL || check_for_opt_list_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -5249,7 +5249,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) return; } - if ((use_string && vim_strchr(s, AUTOLOAD_CHAR) == NULL) || is_funcref) + if ((use_string && mnv_strchr(s, AUTOLOAD_CHAR) == NULL) || is_funcref) { name = s; trans_name = save_function_name(&name, &is_global, FALSE, @@ -5265,7 +5265,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) s = NULL; } - if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s)) + if (s == NULL || *s == NUL || (use_string && MNV_ISDIGIT(*s)) || (is_funcref && trans_name == NULL)) semsg(_(e_invalid_argument_str), use_string ? tv_get_string(&argvars[0]) : s); @@ -5289,7 +5289,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) else if (trans_name != NULL && *trans_name == K_SPECIAL) name = alloc_printable_func_name(trans_name); else - name = vim_strsave(s); + name = mnv_strsave(s); if (argvars[1].v_type != VAR_UNKNOWN) { @@ -5309,7 +5309,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) { if (check_for_dict_arg(argvars, dict_idx) == FAIL) { - vim_free(name); + mnv_free(name); goto theend; } if (argvars[dict_idx].vval.v_dict == NULL) @@ -5320,7 +5320,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) if (argvars[arg_idx].v_type != VAR_LIST) { emsg(_(e_second_argument_of_function_must_be_list_or_dict)); - vim_free(name); + mnv_free(name); goto theend; } list = argvars[arg_idx].vval.v_list; @@ -5329,7 +5329,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) else if (list->lv_len > MAX_FUNC_ARGS) { emsg_funcname(e_too_many_arguments_for_function_str, s); - vim_free(name); + mnv_free(name); goto theend; } } @@ -5340,7 +5340,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) // result is a VAR_PARTIAL if (pt == NULL) - vim_free(name); + mnv_free(name); else { if (arg_idx > 0 || (arg_pt != NULL && arg_pt->pt_argc > 0)) @@ -5358,8 +5358,8 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) pt->pt_argv = ALLOC_MULT(typval_T, pt->pt_argc); if (pt->pt_argv == NULL) { - vim_free(pt); - vim_free(name); + mnv_free(pt); + mnv_free(name); goto theend; } for (i = 0; i < arg_len; i++) @@ -5398,7 +5398,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) { pt->pt_func = arg_pt->pt_func; func_ptr_ref(pt->pt_func); - vim_free(name); + mnv_free(name); } else if (is_funcref) { @@ -5407,7 +5407,7 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) pt->pt_func = eval_generic_func(pt->pt_func, s, &start_bracket); func_ptr_ref(pt->pt_func); - vim_free(name); + mnv_free(name); } else { @@ -5443,12 +5443,12 @@ common_function(typval_T *argvars, typval_T *rettv, int is_funcref) STRCPY(rettv->vval.v_string, name); STRCAT(rettv->vval.v_string, start_bracket); } - vim_free(name); + mnv_free(name); } } } theend: - vim_free(trans_name); + mnv_free(trans_name); } /* @@ -5475,7 +5475,7 @@ f_function(typval_T *argvars, typval_T *rettv) static void f_garbagecollect(typval_T *argvars, typval_T *rettv UNUSED) { - if (in_vim9script() && check_for_opt_bool_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_bool_arg(argvars, 0) == FAIL) return; // This is postponed until we are back at the toplevel, because we may be @@ -5584,7 +5584,7 @@ f_get(typval_T *argvars, typval_T *rettv) && pt->pt_func != NULL) // use instead of the byte code name = printable_func_name(pt->pt_func); - rettv->vval.v_string = vim_strsave(name); + rettv->vval.v_string = mnv_strsave(name); } } else if (STRCMP(what, "dict") == 0) @@ -5709,7 +5709,7 @@ f_getchangelist(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type == VAR_UNKNOWN) @@ -5724,7 +5724,7 @@ f_getchangelist(typval_T *argvars, typval_T *rettv) return; if (list_append_list(rettv->vval.v_list, l) == FAIL) { - vim_free(l); + mnv_free(l); return; } @@ -5842,7 +5842,7 @@ getpos_both( static void f_getcharpos(typval_T *argvars UNUSED, typval_T *rettv) { - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; getpos_both(argvars, rettv, FALSE, TRUE); @@ -5873,10 +5873,10 @@ f_getenv(typval_T *argvars, typval_T *rettv) int mustfree = FALSE; char_u *p; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; - p = vim_getenv(tv_get_string(&argvars[0]), &mustfree); + p = mnv_getenv(tv_get_string(&argvars[0]), &mustfree); if (p == NULL) { rettv->v_type = VAR_SPECIAL; @@ -5884,7 +5884,7 @@ f_getenv(typval_T *argvars, typval_T *rettv) return; } if (!mustfree) - p = vim_strsave(p); + p = mnv_strsave(p); rettv->vval.v_string = p; rettv->v_type = VAR_STRING; } @@ -5898,7 +5898,7 @@ f_getfontname(typval_T *argvars UNUSED, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_string_arg(argvars, 0) == FAIL) return; #ifdef FEAT_GUI @@ -5944,7 +5944,7 @@ f_getjumplist(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_opt_number_arg(argvars, 0) == FAIL || (argvars[0].v_type != VAR_UNKNOWN && check_for_opt_number_arg(argvars, 1) == FAIL))) @@ -5961,7 +5961,7 @@ f_getjumplist(typval_T *argvars, typval_T *rettv) return; if (list_append_list(rettv->vval.v_list, l) == FAIL) { - vim_free(l); + mnv_free(l); return; } @@ -5999,7 +5999,7 @@ f_getpid(typval_T *argvars UNUSED, typval_T *rettv) static void f_getcurpos(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; getpos_both(argvars, rettv, TRUE, FALSE); @@ -6008,7 +6008,7 @@ f_getcurpos(typval_T *argvars, typval_T *rettv) static void f_getcursorcharpos(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; getpos_both(argvars, rettv, TRUE, TRUE); @@ -6020,7 +6020,7 @@ f_getcursorcharpos(typval_T *argvars, typval_T *rettv) static void f_getpos(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; getpos_both(argvars, rettv, FALSE, FALSE); @@ -6039,11 +6039,11 @@ block_def2str(struct block_def *bd, string_T *ret) return FAIL; } - vim_memset(ret->string, ' ', bd->startspaces); + mnv_memset(ret->string, ' ', bd->startspaces); ret->length = bd->startspaces; mch_memmove(ret->string + ret->length, bd->textstart, bd->textlen); ret->length += bd->textlen; - vim_memset(ret->string + ret->length, ' ', bd->endspaces); + mnv_memset(ret->string + ret->length, ' ', bd->endspaces); ret->length += bd->endspaces; ret->string[ret->length] = NUL; @@ -6256,7 +6256,7 @@ f_getregion(typval_T *argvars, typval_T *rettv) s.string = ml_get(lnum); s.length = ml_get_len(lnum); - akt.string = vim_strnsave(s.string, s.length); + akt.string = mnv_strnsave(s.string, s.length); if (akt.string == NULL) akt.length = 0; else @@ -6278,7 +6278,7 @@ f_getregion(typval_T *argvars, typval_T *rettv) } ret = list_append_string(rettv->vval.v_list, akt.string, (int)akt.length); - vim_free(akt.string); + mnv_free(akt.string); if (ret == FAIL) { @@ -6305,37 +6305,37 @@ add_regionpos_range(typval_T *rettv, pos_T p1, pos_T p2) if (list_append_list(rettv->vval.v_list, l1) == FAIL) { - vim_free(l1); + mnv_free(l1); return; } l2 = list_alloc(); if (l2 == NULL) { - vim_free(l1); + mnv_free(l1); return; } if (list_append_list(l1, l2) == FAIL) { - vim_free(l1); - vim_free(l2); + mnv_free(l1); + mnv_free(l2); return; } l3 = list_alloc(); if (l3 == NULL) { - vim_free(l1); - vim_free(l2); + mnv_free(l1); + mnv_free(l2); return; } if (list_append_list(l1, l3) == FAIL) { - vim_free(l1); - vim_free(l2); - vim_free(l3); + mnv_free(l1); + mnv_free(l2); + mnv_free(l3); return; } @@ -6487,7 +6487,7 @@ getreg_get_regname(typval_T *argvars) if (argvars[0].v_type != VAR_UNKNOWN) { strregname = tv_get_string_chk(&argvars[0]); - if (strregname != NULL && in_vim9script() && STRLEN(strregname) > 1) + if (strregname != NULL && in_mnv9script() && STRLEN(strregname) > 1) { semsg(_(e_register_name_must_be_one_char_str), strregname); strregname = NULL; @@ -6497,7 +6497,7 @@ getreg_get_regname(typval_T *argvars) } else // Default to v:register - strregname = get_vim_var_str(VV_REG); + strregname = get_mnv_var_str(VV_REG); return *strregname == 0 ? '"' : *strregname; } @@ -6512,7 +6512,7 @@ f_getreg(typval_T *argvars, typval_T *rettv) int arg2 = FALSE; int return_list = FALSE; - if (in_vim9script() + if (in_mnv9script() && (check_for_opt_string_arg(argvars, 0) == FAIL || (argvars[0].v_type != VAR_UNKNOWN && (check_for_opt_bool_arg(argvars, 1) == FAIL @@ -6568,7 +6568,7 @@ f_getregtype(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_string_arg(argvars, 0) == FAIL) return; regname = getreg_get_regname(argvars); @@ -6583,10 +6583,10 @@ f_getregtype(typval_T *argvars, typval_T *rettv) case MCHAR: buf[0] = 'v'; break; case MBLOCK: buf[0] = Ctrl_V; - vim_snprintf((char *)buf + 1, NUMBUFLEN + 1, "%ld", reglen + 1); + mnv_snprintf((char *)buf + 1, NUMBUFLEN + 1, "%ld", reglen + 1); break; } - rettv->vval.v_string = vim_strsave(buf); + rettv->vval.v_string = mnv_strsave(buf); } /* @@ -6600,7 +6600,7 @@ f_gettagstack(typval_T *argvars, typval_T *rettv) if (rettv_dict_alloc(rettv) == FAIL) return; - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type != VAR_UNKNOWN) @@ -6638,11 +6638,11 @@ f_gettext(typval_T *argvars, typval_T *rettv) #endif #if defined(HAVE_DGETTEXT) - rettv->vval.v_string = vim_strsave((char_u *)dgettext((const char *)argvars[1].vval.v_string, (const char *)argvars[0].vval.v_string)); + rettv->vval.v_string = mnv_strsave((char_u *)dgettext((const char *)argvars[1].vval.v_string, (const char *)argvars[0].vval.v_string)); #else textdomain((const char *)argvars[1].vval.v_string); - rettv->vval.v_string = vim_strsave((char_u *)_(argvars[0].vval.v_string)); - textdomain(VIMPACKAGE); + rettv->vval.v_string = mnv_strsave((char_u *)_(argvars[0].vval.v_string)); + textdomain(MNVPACKAGE); #endif #if defined(HAVE_BIND_TEXTDOMAIN_CODESET) @@ -6651,10 +6651,10 @@ f_gettext(typval_T *argvars, typval_T *rettv) #endif } else - rettv->vval.v_string = vim_strsave((char_u *)_(argvars[0].vval.v_string)); + rettv->vval.v_string = mnv_strsave((char_u *)_(argvars[0].vval.v_string)); } -// for VIM_VERSION_ defines +// for MNV_VERSION_ defines #include "version.h" /* @@ -7053,7 +7053,7 @@ f_has(typval_T *argvars, typval_T *rettv) }, {"file_in_path", 1}, {"filterpipe", -#if defined(FEAT_FILTERPIPE) && !defined(VIMDLL) +#if defined(FEAT_FILTERPIPE) && !defined(MNVDLL) 1 #else 0 @@ -7632,18 +7632,18 @@ f_has(typval_T *argvars, typval_T *rettv) #endif }, {"vertsplit", 1}, - {"viminfo", -#ifdef FEAT_VIMINFO + {"mnvinfo", +#ifdef FEAT_MNVINFO 1 #else 0 #endif }, - {"vim9script", 1}, - {"vimscript-1", 1}, - {"vimscript-2", 1}, - {"vimscript-3", 1}, - {"vimscript-4", 1}, + {"mnv9script", 1}, + {"mnvscript-1", 1}, + {"mnvscript-2", 1}, + {"mnvscript-3", 1}, + {"mnvscript-4", 1}, {"virtualedit", 1}, {"visual", 1}, {"visualextra", 1}, @@ -7774,7 +7774,7 @@ f_has(typval_T *argvars, typval_T *rettv) {NULL, 0} }; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_bool_arg(argvars, 1) == FAIL)) return; @@ -7796,23 +7796,23 @@ f_has(typval_T *argvars, typval_T *rettv) // This works for patch-8.1.2, patch-9.0.3, patch-10.0.4, etc. // Not for patch-9.10.5. major = (int)strtoul((char *)name + 6, &end, 10); - if (*end == '.' && vim_isdigit(end[1]) - && end[2] == '.' && vim_isdigit(end[3])) + if (*end == '.' && mnv_isdigit(end[1]) + && end[2] == '.' && mnv_isdigit(end[3])) { minor = atoi(end + 1); // Expect "patch-9.9.01234". - n = (major < VIM_VERSION_MAJOR - || (major == VIM_VERSION_MAJOR - && (minor < VIM_VERSION_MINOR - || (minor == VIM_VERSION_MINOR + n = (major < MNV_VERSION_MAJOR + || (major == MNV_VERSION_MAJOR + && (minor < MNV_VERSION_MINOR + || (minor == MNV_VERSION_MINOR && has_patch(atoi(end + 3)))))); } } else if (SAFE_isdigit(name[5])) n = has_patch(atoi((char *)name + 5)); } - else if (STRICMP(name, "vim_starting") == 0) + else if (STRICMP(name, "mnv_starting") == 0) { x = TRUE; n = (starting != 0); @@ -7927,7 +7927,7 @@ f_has(typval_T *argvars, typval_T *rettv) { // intentionally empty } -#ifdef VIMDLL +#ifdef MNVDLL else if (STRICMP(name, "filterpipe") == 0) n = gui.in_use || gui.starting; #endif @@ -8014,10 +8014,10 @@ dynamic_feature(char_u *feature) #if defined(FEAT_GUI) && defined(FEAT_BROWSE) || (STRICMP(feature, "browse") == 0 && !gui.in_use) #endif -#ifdef VIMDLL +#ifdef MNVDLL || STRICMP(feature, "filterpipe") == 0 #endif -#if defined(FEAT_GUI) && !defined(ALWAYS_USE_GUI) && !defined(VIMDLL) +#if defined(FEAT_GUI) && !defined(ALWAYS_USE_GUI) && !defined(MNVDLL) // this can only change on Unix where the ":gui" command could be // used. || (STRICMP(feature, "gui_running") == 0 && !gui.in_use) @@ -8059,7 +8059,7 @@ dynamic_feature(char_u *feature) || STRICMP(feature, "tcl") == 0 #endif // once "starting" is zero it will stay that way - || (STRICMP(feature, "vim_starting") == 0 && starting != 0) + || (STRICMP(feature, "mnv_starting") == 0 && starting != 0) || STRICMP(feature, "multi_byte_encoding") == 0 #if defined(FEAT_TERMINAL) && defined(MSWIN) || STRICMP(feature, "conpty") == 0 @@ -8076,7 +8076,7 @@ f_haslocaldir(typval_T *argvars, typval_T *rettv) tabpage_T *tp = NULL; win_T *wp = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_opt_number_arg(argvars, 0) == FAIL || (argvars[0].v_type != VAR_UNKNOWN && check_for_opt_number_arg(argvars, 1) == FAIL))) @@ -8099,7 +8099,7 @@ f_haslocaldir(typval_T *argvars, typval_T *rettv) static void f_hlID(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; rettv->vval.v_number = syn_name2id(tv_get_string(&argvars[0])); @@ -8111,7 +8111,7 @@ f_hlID(typval_T *argvars, typval_T *rettv) static void f_hlexists(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; rettv->vval.v_number = highlight_exists(tv_get_string(&argvars[0])); @@ -8127,7 +8127,7 @@ f_hostname(typval_T *argvars UNUSED, typval_T *rettv) mch_get_host_name(hostname, 256); rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strsave(hostname); + rettv->vval.v_string = mnv_strsave(hostname); } /* @@ -8176,7 +8176,7 @@ f_id(typval_T *argvars, typval_T *rettv) *p = NUL; rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strsave((char_u *)numbuf); + rettv->vval.v_string = mnv_strsave((char_u *)numbuf); } /* @@ -8293,7 +8293,7 @@ f_index(typval_T *argvars, typval_T *rettv) { rettv->vval.v_number = -1; - if (in_vim9script() + if (in_mnv9script() && (check_for_list_or_tuple_or_blob_arg(argvars, 0) == FAIL || (argvars[0].v_type == VAR_BLOB && check_for_number_arg(argvars, 1) == FAIL) @@ -8315,7 +8315,7 @@ f_index(typval_T *argvars, typval_T *rettv) /* * Evaluate 'expr' with the v:key and v:val arguments and return the result. * The expression is expected to return a boolean value. The caller should set - * the VV_KEY and VV_VAL vim variables before calling this function. + * the VV_KEY and VV_VAL mnv variables before calling this function. */ int indexof_eval_expr(typval_T *expr) @@ -8325,8 +8325,8 @@ indexof_eval_expr(typval_T *expr) varnumber_T found; int error = FALSE; - argv[0] = *get_vim_var_tv(VV_KEY); - argv[1] = *get_vim_var_tv(VV_VAL); + argv[0] = *get_mnv_var_tv(VV_KEY); + argv[1] = *get_mnv_var_tv(VV_VAL); newtv.v_type = VAR_UNKNOWN; if (eval_expr_typval(expr, FALSE, argv, 2, NULL, &newtv) == FAIL) @@ -8359,14 +8359,14 @@ indexof_blob(blob_T *b, long startidx, typval_T *expr) startidx = 0; } - set_vim_var_type(VV_KEY, VAR_NUMBER); - set_vim_var_type(VV_VAL, VAR_NUMBER); + set_mnv_var_type(VV_KEY, VAR_NUMBER); + set_mnv_var_type(VV_VAL, VAR_NUMBER); int called_emsg_start = called_emsg; for (idx = startidx; idx < blob_len(b); ++idx) { - set_vim_var_nr(VV_KEY, idx); - set_vim_var_nr(VV_VAL, blob_get(b, idx)); + set_mnv_var_nr(VV_KEY, idx); + set_mnv_var_nr(VV_VAL, blob_get(b, idx)); if (indexof_eval_expr(expr)) return idx; @@ -8406,16 +8406,16 @@ indexof_list(list_T *l, long startidx, typval_T *expr) idx = l->lv_u.mat.lv_idx; } - set_vim_var_type(VV_KEY, VAR_NUMBER); + set_mnv_var_type(VV_KEY, VAR_NUMBER); int called_emsg_start = called_emsg; for ( ; item != NULL; item = item->li_next, ++idx) { - set_vim_var_nr(VV_KEY, idx); - copy_tv(&item->li_tv, get_vim_var_tv(VV_VAL)); + set_mnv_var_nr(VV_KEY, idx); + copy_tv(&item->li_tv, get_mnv_var_tv(VV_VAL)); found = indexof_eval_expr(expr); - clear_tv(get_vim_var_tv(VV_VAL)); + clear_tv(get_mnv_var_tv(VV_VAL)); if (found) return idx; @@ -8455,8 +8455,8 @@ f_indexof(typval_T *argvars, typval_T *rettv) if (argvars[2].v_type == VAR_DICT) startidx = dict_get_number_def(argvars[2].vval.v_dict, "startidx", 0); - prepare_vimvar(VV_VAL, &save_val); - prepare_vimvar(VV_KEY, &save_key); + prepare_mnvvar(VV_VAL, &save_val); + prepare_mnvvar(VV_KEY, &save_key); // We reset "did_emsg" to be able to detect whether an error occurred // during evaluation of the expression. @@ -8473,8 +8473,8 @@ f_indexof(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = indexof_list(argvars[0].vval.v_list, startidx, &argvars[1]); - restore_vimvar(VV_KEY, &save_key); - restore_vimvar(VV_VAL, &save_val); + restore_mnvvar(VV_KEY, &save_key); + restore_mnvvar(VV_VAL, &save_val); did_emsg |= save_did_emsg; } @@ -8498,13 +8498,13 @@ f_inputdialog(typval_T *argvars, typval_T *rettv) { #if defined(FEAT_GUI_TEXTDIALOG) // Use a GUI dialog if the GUI is running and 'c' is not in 'guioptions' - if (gui.in_use && vim_strchr(p_go, GO_CONDIALOG) == NULL) + if (gui.in_use && mnv_strchr(p_go, GO_CONDIALOG) == NULL) { char_u *message; char_u buf[NUMBUFLEN]; char_u *defstr = (char_u *)""; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -8514,19 +8514,19 @@ f_inputdialog(typval_T *argvars, typval_T *rettv) message = tv_get_string_chk(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN && (defstr = tv_get_string_buf_chk(&argvars[1], buf)) != NULL) - vim_strncpy(IObuff, defstr, IOSIZE - 1); + mnv_strncpy(IObuff, defstr, IOSIZE - 1); else IObuff[0] = NUL; if (message != NULL && defstr != NULL - && do_dialog(VIM_QUESTION, NULL, message, + && do_dialog(MNV_QUESTION, NULL, message, (char_u *)_("&OK\n&Cancel"), 1, IObuff, FALSE) == 1) - rettv->vval.v_string = vim_strsave(IObuff); + rettv->vval.v_string = mnv_strsave(IObuff); else { if (message != NULL && defstr != NULL && argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN) - rettv->vval.v_string = vim_strsave( + rettv->vval.v_string = mnv_strsave( tv_get_string_buf(&argvars[2], buf)); else rettv->vval.v_string = NULL; @@ -8555,7 +8555,7 @@ f_inputlist(typval_T *argvars, typval_T *rettv) if (no_console_input() && !is_not_a_term()) return; #endif - if (in_vim9script() && check_for_list_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_list_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL) @@ -8632,7 +8632,7 @@ f_inputsave(typval_T *argvars UNUSED, typval_T *rettv) static void f_inputsecret(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL)) return; @@ -8659,7 +8659,7 @@ f_interrupt(typval_T *argvars UNUSED, typval_T *rettv UNUSED) static void f_invert(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; rettv->vval.v_number = ~tv_get_number_chk(&argvars[0], NULL); @@ -8738,7 +8738,7 @@ f_islocked(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = -1; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; char_u *name = tv_get_string(&argvars[0]); @@ -8861,9 +8861,9 @@ f_keytrans(typval_T *argvars, typval_T *rettv) || argvars[0].vval.v_string == NULL) return; // Need to escape K_SPECIAL and CSI for mb_unescape(). - escaped = vim_strsave_escape_csi(argvars[0].vval.v_string); + escaped = mnv_strsave_escape_csi(argvars[0].vval.v_string); rettv->vval.v_string = str2special_save(escaped, TRUE, TRUE); - vim_free(escaped); + mnv_free(escaped); } /* @@ -8944,7 +8944,7 @@ libcall_common(typval_T *argvars UNUSED, typval_T *rettv, int type) if (check_restricted() || check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL || check_for_string_or_number_arg(argvars, 2) == FAIL)) @@ -9010,7 +9010,7 @@ f_line(typval_T *argvars, typval_T *rettv) win_T *wp; switchwin_T switchwin; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_number_arg(argvars, 1) == FAIL)) return; @@ -9059,7 +9059,7 @@ f_line2byte(typval_T *argvars UNUSED, typval_T *rettv) #else linenr_T lnum; - if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_lnum_arg(argvars, 0) == FAIL) return; lnum = tv_get_lnum(argvars); @@ -9085,7 +9085,7 @@ f_luaeval(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) return; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; str = tv_get_string_buf(&argvars[0], buf); @@ -9154,7 +9154,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type) rettv->vval.v_string = NULL; } - if (in_vim9script() + if (in_mnv9script() && (check_for_string_or_list_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL || check_for_opt_number_arg(argvars, 2) == FAIL @@ -9217,7 +9217,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type) goto theend; } - regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + regmatch.regprog = mnv_regcomp(pat, RE_MAGIC + RE_STRING); if (regmatch.regprog != NULL) { regmatch.rm_ic = p_ic; @@ -9231,13 +9231,13 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type) match = FALSE; break; } - vim_free(tofree); + mnv_free(tofree); expr = str = echo_string(&li->li_tv, &tofree, strbuf, 0); if (str == NULL) break; } - match = vim_regexec_nl(®match, str, startcol); + match = mnv_regexec_nl(®match, str, startcol); if (match && --nth <= 0) break; @@ -9272,8 +9272,8 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type) listitem_T *li3 = li2->li_next; listitem_T *li4 = li3->li_next; - vim_free(li1->li_tv.vval.v_string); - li1->li_tv.vval.v_string = vim_strnsave(regmatch.startp[0], + mnv_free(li1->li_tv.vval.v_string); + li1->li_tv.vval.v_string = mnv_strnsave(regmatch.startp[0], regmatch.endp[0] - regmatch.startp[0]); li3->li_tv.vval.v_number = (varnumber_T)(regmatch.startp[0] - expr); @@ -9308,7 +9308,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type) if (l != NULL) copy_tv(&li->li_tv, rettv); else - rettv->vval.v_string = vim_strnsave(regmatch.startp[0], + rettv->vval.v_string = mnv_strnsave(regmatch.startp[0], regmatch.endp[0] - regmatch.startp[0]); } else if (l != NULL) @@ -9324,7 +9324,7 @@ find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type) rettv->vval.v_number += (varnumber_T)(str - expr); } } - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); } theend: @@ -9332,7 +9332,7 @@ theend: // matchstrpos() without a list: drop the second item. listitem_remove(rettv->vval.v_list, rettv->vval.v_list->lv_first->li_next); - vim_free(tofree); + mnv_free(tofree); p_cpo = save_cpo; } @@ -9357,7 +9357,7 @@ get_matches_in_str( for (;;) { - match = vim_regexec_nl(rmp, str, startidx); + match = mnv_regexec_nl(rmp, str, startidx); if (!match) break; @@ -9492,7 +9492,7 @@ f_matchbufline(typval_T *argvars, typval_T *rettv) save_cpo = p_cpo; p_cpo = empty_option; - regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + regmatch.regprog = mnv_regcomp(pat, RE_MAGIC + RE_STRING); if (regmatch.regprog == NULL) goto theend; regmatch.rm_ic = p_ic; @@ -9507,7 +9507,7 @@ f_matchbufline(typval_T *argvars, typval_T *rettv) } cleanup: - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); theend: p_cpo = save_cpo; @@ -9583,7 +9583,7 @@ f_matchstrlist(typval_T *argvars, typval_T *rettv) save_cpo = p_cpo; p_cpo = empty_option; - regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + regmatch.regprog = mnv_regcomp(pat, RE_MAGIC + RE_STRING); if (regmatch.regprog == NULL) goto theend; regmatch.rm_ic = p_ic; @@ -9622,7 +9622,7 @@ f_matchstrlist(typval_T *argvars, typval_T *rettv) } cleanup: - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); theend: p_cpo = save_cpo; @@ -9642,7 +9642,7 @@ max_min(typval_T *argvars, typval_T *rettv, int domax) { varnumber_T n = 0; - if (in_vim9script() && + if (in_mnv9script() && check_for_list_or_tuple_or_dict_arg(argvars, 0) == FAIL) return; @@ -9765,7 +9765,7 @@ f_mzeval(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) return; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; str = tv_get_string_buf(&argvars[0], buf); @@ -9773,7 +9773,7 @@ f_mzeval(typval_T *argvars, typval_T *rettv) } void -mzscheme_call_vim(char_u *name, typval_T *args, typval_T *rettv) +mzscheme_call_mnv(char_u *name, typval_T *args, typval_T *rettv) { typval_T argvars[3]; @@ -9794,7 +9794,7 @@ f_nextnonblank(typval_T *argvars, typval_T *rettv) { linenr_T lnum; - if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_lnum_arg(argvars, 0) == FAIL) return; for (lnum = tv_get_lnum(argvars); ; ++lnum) @@ -9838,11 +9838,11 @@ f_ngettext(typval_T *argvars, typval_T *rettv) #endif #if defined(HAVE_DNGETTEXT) - rettv->vval.v_string = vim_strsave((char_u *)dngettext((const char *)argvars[3].vval.v_string, (const char *)argvars[0].vval.v_string, (const char *)argvars[1].vval.v_string, (int)argvars[2].vval.v_number)); + rettv->vval.v_string = mnv_strsave((char_u *)dngettext((const char *)argvars[3].vval.v_string, (const char *)argvars[0].vval.v_string, (const char *)argvars[1].vval.v_string, (int)argvars[2].vval.v_number)); #else textdomain((const char *)argvars[3].vval.v_string); - rettv->vval.v_string = vim_strsave((char_u *)NGETTEXT((const char *)argvars[0].vval.v_string, (const char *)argvars[1].vval.v_string, argvars[2].vval.v_number)); - textdomain(VIMPACKAGE); + rettv->vval.v_string = mnv_strsave((char_u *)NGETTEXT((const char *)argvars[0].vval.v_string, (const char *)argvars[1].vval.v_string, argvars[2].vval.v_number)); + textdomain(MNVPACKAGE); #endif #if defined(HAVE_BIND_TEXTDOMAIN_CODESET) @@ -9851,7 +9851,7 @@ f_ngettext(typval_T *argvars, typval_T *rettv) #endif } else - rettv->vval.v_string = vim_strsave((char_u *)NGETTEXT((const char *)argvars[0].vval.v_string, (const char *)argvars[1].vval.v_string, argvars[2].vval.v_number)); + rettv->vval.v_string = mnv_strsave((char_u *)NGETTEXT((const char *)argvars[0].vval.v_string, (const char *)argvars[1].vval.v_string, argvars[2].vval.v_number)); } @@ -9863,7 +9863,7 @@ f_nr2char(typval_T *argvars, typval_T *rettv) { char_u buf[NUMBUFLEN]; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_opt_bool_arg(argvars, 1) == FAIL)) return; @@ -9885,7 +9885,7 @@ f_nr2char(typval_T *argvars, typval_T *rettv) buf[1] = NUL; } rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strsave(buf); + rettv->vval.v_string = mnv_strsave(buf); } /* @@ -9894,7 +9894,7 @@ f_nr2char(typval_T *argvars, typval_T *rettv) static void f_or(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; @@ -9916,7 +9916,7 @@ f_perleval(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) return; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; str = tv_get_string_buf(&argvars[0], buf); @@ -9932,7 +9932,7 @@ f_prevnonblank(typval_T *argvars, typval_T *rettv) { linenr_T lnum; - if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_lnum_arg(argvars, 0) == FAIL) return; lnum = tv_get_lnum(argvars); @@ -9965,20 +9965,20 @@ f_printf(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() && check_for_string_or_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_or_number_arg(argvars, 0) == FAIL) return; // Get the required length, allocate the buffer and do it for real. did_emsg = FALSE; fmt = (char *)tv_get_string_buf(&argvars[0], buf); - len = vim_vsnprintf_typval(NULL, 0, fmt, ap, argvars + 1); + len = mnv_vsnprintf_typval(NULL, 0, fmt, ap, argvars + 1); if (!did_emsg) { s = alloc(len + 1); if (s != NULL) { rettv->vval.v_string = s; - (void)vim_vsnprintf_typval((char *)s, len + 1, fmt, + (void)mnv_vsnprintf_typval((char *)s, len + 1, fmt, ap, argvars + 1); } } @@ -10020,7 +10020,7 @@ f_py3eval(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_dict_arg(argvars, 1) == FAIL)) return; @@ -10061,7 +10061,7 @@ f_pyeval(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) return; - if (in_vim9script() && ( + if (in_mnv9script() && ( check_for_string_arg(argvars, 0) == FAIL || check_for_opt_dict_arg(argvars, 1) == FAIL ) ) return; @@ -10098,7 +10098,7 @@ f_pyxeval(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_dict_arg(argvars, 1) == FAIL)) return; @@ -10123,7 +10123,7 @@ static int srand_seed_for_testing_is_used = FALSE; static void f_test_srand_seed(typval_T *argvars, typval_T *rettv UNUSED) { - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type == VAR_UNKNOWN) @@ -10176,7 +10176,7 @@ init_srand(UINT32_T *x) *x = (UINT32_T)res.tv_fsec; # endif #else - *x = vim_time(); + *x = mnv_time(); #endif *x ^= mch_get_pid(); } @@ -10210,7 +10210,7 @@ f_rand(typval_T *argvars, typval_T *rettv) listitem_T *lx, *ly, *lz, *lw; UINT32_T x = 0, y, z, w, t, result; - if (in_vim9script() && check_for_opt_list_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_list_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type == VAR_UNKNOWN) @@ -10280,7 +10280,7 @@ f_srand(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type == VAR_UNKNOWN) @@ -10320,7 +10320,7 @@ f_range(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_opt_number_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -10406,7 +10406,7 @@ f_getreginfo(typval_T *argvars, typval_T *rettv) dict_T *dict; list_T *list; - if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_string_arg(argvars, 0) == FAIL) return; regname = getreg_get_regname(argvars); @@ -10432,7 +10432,7 @@ f_getreginfo(typval_T *argvars, typval_T *rettv) case MLINE: buf[0] = 'V'; break; case MCHAR: buf[0] = 'v'; break; case MBLOCK: - vim_snprintf((char *)buf, sizeof(buf), "%c%ld", Ctrl_V, + mnv_snprintf((char *)buf, sizeof(buf), "%c%ld", Ctrl_V, reglen + 1); break; } @@ -10463,7 +10463,7 @@ return_register(int regname, typval_T *rettv) buf[0] = (char_u)regname; rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strsave(buf); + rettv->vval.v_string = mnv_strsave(buf); } /* @@ -10496,12 +10496,12 @@ f_rename(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; - rettv->vval.v_number = vim_rename(tv_get_string(&argvars[0]), + rettv->vval.v_number = mnv_rename(tv_get_string(&argvars[0]), tv_get_string_buf(&argvars[1], buf)); } @@ -10600,7 +10600,7 @@ f_repeat(typval_T *argvars, typval_T *rettv) { varnumber_T n; - if (in_vim9script() + if (in_mnv9script() && (check_for_repeat_func_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; @@ -10703,7 +10703,7 @@ search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp) int use_skip = FALSE; pos_T firstpos; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -10848,7 +10848,7 @@ f_rubyeval(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) return; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; str = tv_get_string_buf(&argvars[0], buf); @@ -10866,7 +10866,7 @@ f_screenattr(typval_T *argvars, typval_T *rettv) int col; int c; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; @@ -10891,7 +10891,7 @@ f_screenchar(typval_T *argvars, typval_T *rettv) int col; int c; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; @@ -10923,7 +10923,7 @@ f_screenchars(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; @@ -10980,7 +10980,7 @@ f_screenstring(typval_T *argvars, typval_T *rettv) rettv->vval.v_string = NULL; rettv->v_type = VAR_STRING; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; @@ -10991,7 +10991,7 @@ f_screenstring(typval_T *argvars, typval_T *rettv) return; screen_getbytes(row, col, buf, NULL); - rettv->vval.v_string = vim_strsave(buf); + rettv->vval.v_string = mnv_strsave(buf); } /* @@ -11018,7 +11018,7 @@ f_searchdecl(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = 1; // default: FAIL - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_bool_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -11054,7 +11054,7 @@ searchpair_cmn(typval_T *argvars, pos_T *match_pos) long lnum_stop = 0; long time_limit = 0; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL || check_for_string_arg(argvars, 2) == FAIL @@ -11219,14 +11219,14 @@ do_searchpair( pat3 = alloc(pat3size); if (pat3 == NULL) goto theend; - pat2len = vim_snprintf((char *)pat2, pat2size, "\\m\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat); + pat2len = mnv_snprintf((char *)pat2, pat2size, "\\m\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat); if (*mpat == NUL) { STRCPY(pat3, pat2); pat3len = pat2len; } else - pat3len = vim_snprintf((char *)pat3, pat3size, "\\m\\(%s\\m\\)\\|\\(%s\\m\\)\\|\\(%s\\m\\)", + pat3len = mnv_snprintf((char *)pat3, pat3size, "\\m\\(%s\\m\\)\\|\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat, mpat); if (flags & SP_START) options |= SEARCH_START; @@ -11339,8 +11339,8 @@ theend: if (time_limit > 0) disable_regexp_timeout(); #endif - vim_free(pat2); - vim_free(pat3); + mnv_free(pat2); + mnv_free(pat3); if (p_cpo == empty_option) p_cpo = save_cpo; else @@ -11399,7 +11399,7 @@ set_position(typval_T *argvars, typval_T *rettv, int charpos) rettv->vval.v_number = -1; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_list_arg(argvars, 1) == FAIL)) return; @@ -11500,7 +11500,7 @@ f_setenv(typval_T *argvars, typval_T *rettv UNUSED) char_u valbuf[NUMBUFLEN]; char_u *name; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; // setting an environment variable may be dangerous, e.g. you could @@ -11512,9 +11512,9 @@ f_setenv(typval_T *argvars, typval_T *rettv UNUSED) name = tv_get_string_buf(&argvars[0], namebuf); if (argvars[1].v_type == VAR_SPECIAL && argvars[1].vval.v_number == VVAL_NULL) - vim_unsetenv_ext(name); + mnv_unsetenv_ext(name); else - vim_setenv_ext(name, tv_get_string_buf(&argvars[1], valbuf)); + mnv_setenv_ext(name, tv_get_string_buf(&argvars[1], valbuf)); } /* @@ -11532,7 +11532,7 @@ f_setfperm(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = 0; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; @@ -11585,7 +11585,7 @@ get_yank_type(char_u **pp, char_u *yank_type, long *block_len) break; case 'b': case Ctrl_V: // block-wise selection *yank_type = MBLOCK; - if (VIM_ISDIGIT(stropt[1])) + if (MNV_ISDIGIT(stropt[1])) { ++stropt; *block_len = getdigits(&stropt) - 1; @@ -11615,7 +11615,7 @@ f_setreg(typval_T *argvars, typval_T *rettv) typval_T *regcontents; int pointreg; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 2) == FAIL)) return; @@ -11631,7 +11631,7 @@ f_setreg(typval_T *argvars, typval_T *rettv) if (strregname == NULL) return; // type error; errmsg already given - if (in_vim9script() && STRLEN(strregname) > 1) + if (in_mnv9script() && STRLEN(strregname) > 1) { semsg(_(e_register_name_must_be_one_char_str), strregname); return; @@ -11741,7 +11741,7 @@ f_setreg(typval_T *argvars, typval_T *rettv) { // Need to make a copy, next tv_get_string_buf_chk() will // overwrite the string. - strval = vim_strsave(buf); + strval = mnv_strsave(buf); if (strval == NULL) goto free_lstval; *curallocval++ = strval; @@ -11755,8 +11755,8 @@ f_setreg(typval_T *argvars, typval_T *rettv) append, yank_type, block_len); free_lstval: while (curallocval > allocval) - vim_free(*--curallocval); - vim_free(lstval); + mnv_free(*--curallocval); + mnv_free(lstval); } else if (regcontents) { @@ -11784,7 +11784,7 @@ f_settagstack(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = -1; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_dict_arg(argvars, 1) == FAIL || check_for_opt_string_arg(argvars, 2) == FAIL)) @@ -11838,7 +11838,7 @@ f_sha256(typval_T *argvars, typval_T *rettv) char_u *p; int len; - if (in_vim9script() && check_for_string_or_blob_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_or_blob_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_STRING; @@ -11849,12 +11849,12 @@ f_sha256(typval_T *argvars, typval_T *rettv) blob_T *blob = argvars[0].vval.v_blob; p = blob != NULL ? (char_u *)blob->bv_ga.ga_data : (char_u *)""; len = blob != NULL ? blob->bv_ga.ga_len : 0; - rettv->vval.v_string = vim_strsave(sha256_bytes(p, len, NULL, 0)); + rettv->vval.v_string = mnv_strsave(sha256_bytes(p, len, NULL, 0)); } else { p = tv_get_string(&argvars[0]); - rettv->vval.v_string = vim_strsave( + rettv->vval.v_string = mnv_strsave( sha256_bytes(p, (int)STRLEN(p), NULL, 0)); } } @@ -11868,13 +11868,13 @@ f_shellescape(typval_T *argvars, typval_T *rettv) { int do_special; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_bool_arg(argvars, 1) == FAIL)) return; do_special = non_zero_arg(&argvars[1]); - rettv->vval.v_string = vim_strsave_shellescape( + rettv->vval.v_string = mnv_strsave_shellescape( tv_get_string(&argvars[0]), do_special, do_special); rettv->v_type = VAR_STRING; } @@ -11887,7 +11887,7 @@ f_shiftwidth(typval_T *argvars UNUSED, typval_T *rettv) { rettv->vval.v_number = 0; - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type != VAR_UNKNOWN) @@ -11914,7 +11914,7 @@ f_soundfold(typval_T *argvars, typval_T *rettv) { char_u *s; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_STRING; @@ -11922,7 +11922,7 @@ f_soundfold(typval_T *argvars, typval_T *rettv) #ifdef FEAT_SPELL rettv->vval.v_string = eval_soundfold(s); #else - rettv->vval.v_string = vim_strsave(s); + rettv->vval.v_string = mnv_strsave(s); #endif } @@ -11938,7 +11938,7 @@ f_spellbadword(typval_T *argvars UNUSED, typval_T *rettv) #ifdef FEAT_SPELL int wo_spell_save = curwin->w_p_spell; - if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_string_arg(argvars, 0) == FAIL) return; if (!curwin->w_p_spell) @@ -12040,7 +12040,7 @@ f_spellsuggest(typval_T *argvars UNUSED, typval_T *rettv) int need_capital = FALSE; int wo_spell_save = curwin->w_p_spell; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_number_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -12094,7 +12094,7 @@ f_spellsuggest(typval_T *argvars UNUSED, typval_T *rettv) li = listitem_alloc(); if (li == NULL) - vim_free(str); + mnv_free(str); else { li->li_tv.v_type = VAR_STRING; @@ -12122,7 +12122,7 @@ f_split(typval_T *argvars, typval_T *rettv) int keepempty = FALSE; int typeerr = FALSE; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -12150,7 +12150,7 @@ f_split(typval_T *argvars, typval_T *rettv) if (typeerr) goto theend; - regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + regmatch.regprog = mnv_regcomp(pat, RE_MAGIC + RE_STRING); if (regmatch.regprog != NULL) { regmatch.rm_ic = FALSE; @@ -12159,7 +12159,7 @@ f_split(typval_T *argvars, typval_T *rettv) if (*str == NUL) match = FALSE; // empty item at the end else - match = vim_regexec_nl(®match, str, col); + match = mnv_regexec_nl(®match, str, col); if (match) end = regmatch.startp[0]; else @@ -12182,7 +12182,7 @@ f_split(typval_T *argvars, typval_T *rettv) str = regmatch.endp[0]; } - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); } theend: @@ -12199,7 +12199,7 @@ f_submatch(typval_T *argvars, typval_T *rettv) int no; int retList = 0; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_opt_bool_arg(argvars, 1) == FAIL)) return; @@ -12244,7 +12244,7 @@ f_substitute(typval_T *argvars, typval_T *rettv) typval_T *expr = NULL; char_u *flg; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL || check_for_string_arg(argvars, 3) == FAIL)) @@ -12288,7 +12288,7 @@ f_swapfilelist(typval_T *argvars UNUSED, typval_T *rettv) static void f_swapinfo(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; if (rettv_dict_alloc(rettv) == OK) @@ -12305,7 +12305,7 @@ f_swapname(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; - if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_buffer_arg(argvars, 0) == FAIL) return; buf = tv_get_buf(&argvars[0], FALSE); @@ -12313,7 +12313,7 @@ f_swapname(typval_T *argvars, typval_T *rettv) || buf->b_ml.ml_mfp->mf_fname == NULL) rettv->vval.v_string = NULL; else - rettv->vval.v_string = vim_strsave(buf->b_ml.ml_mfp->mf_fname); + rettv->vval.v_string = mnv_strsave(buf->b_ml.ml_mfp->mf_fname); } /* @@ -12329,7 +12329,7 @@ f_synID(typval_T *argvars UNUSED, typval_T *rettv) int trans; int transerr = FALSE; - if (in_vim9script() + if (in_mnv9script() && (check_for_lnum_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL || check_for_bool_arg(argvars, 2) == FAIL)) @@ -12361,7 +12361,7 @@ f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv) char_u modebuf[NUMBUFLEN]; int modec; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL || check_for_opt_string_arg(argvars, 2) == FAIL)) @@ -12457,7 +12457,7 @@ f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv) } if (p != NULL) - p = vim_strsave(p); + p = mnv_strsave(p); #endif rettv->v_type = VAR_STRING; rettv->vval.v_string = p; @@ -12472,7 +12472,7 @@ f_synIDtrans(typval_T *argvars UNUSED, typval_T *rettv) int id; #ifdef FEAT_SYN_HL - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; id = (int)tv_get_number(&argvars[0]); @@ -12503,7 +12503,7 @@ f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv) rettv_list_set(rettv, NULL); - if (in_vim9script() + if (in_mnv9script() && (check_for_lnum_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; @@ -12564,7 +12564,7 @@ f_synstack(typval_T *argvars UNUSED, typval_T *rettv) rettv_list_set(rettv, NULL); - if (in_vim9script() + if (in_mnv9script() && (check_for_lnum_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; @@ -12599,7 +12599,7 @@ f_tabpagebuflist(typval_T *argvars UNUSED, typval_T *rettv UNUSED) tabpage_T *tp; win_T *wp = NULL; - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type == VAR_UNKNOWN) @@ -12640,7 +12640,7 @@ f_tagfiles(typval_T *argvars UNUSED, typval_T *rettv) || list_append_string(rettv->vval.v_list, fname, -1) == FAIL) break; tagname_free(&tn); - vim_free(fname); + mnv_free(fname); } /* @@ -12652,7 +12652,7 @@ f_taglist(typval_T *argvars, typval_T *rettv) char_u *fname = NULL; char_u *tag_pattern; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL)) return; @@ -12744,7 +12744,7 @@ f_virtcol(typval_T *argvars, typval_T *rettv) int winchanged = FALSE; int len; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_or_list_arg(argvars, 0) == FAIL || (argvars[1].v_type != VAR_UNKNOWN && (check_for_bool_arg(argvars, 1) == FAIL @@ -12813,13 +12813,13 @@ f_visualmode(typval_T *argvars, typval_T *rettv) { char_u str[2]; - if (in_vim9script() && check_for_opt_bool_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_bool_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_STRING; str[0] = curbuf->b_visual_mode_eval; str[1] = NUL; - rettv->vval.v_string = vim_strsave(str); + rettv->vval.v_string = mnv_strsave(str); // A non-zero number or non-empty string argument: reset mode. if (non_zero_arg(&argvars[0])) @@ -12843,7 +12843,7 @@ f_wildmenumode(typval_T *argvars UNUSED, typval_T *rettv UNUSED) f_windowsversion(typval_T *argvars UNUSED, typval_T *rettv UNUSED) { rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strsave((char_u *)windowsVersion); + rettv->vval.v_string = mnv_strsave((char_u *)windowsVersion); } /* @@ -12863,7 +12863,7 @@ f_wordcount(typval_T *argvars UNUSED, typval_T *rettv) static void f_xor(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; diff --git a/uvim/src/evalvars.c b/uvim/src/evalvars.c index 1df4af9972..03389e0a11 100644 --- a/uvim/src/evalvars.c +++ b/uvim/src/evalvars.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * evalvars.c: functions for dealing with variables */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) @@ -20,7 +20,7 @@ static dict_T globvardict; // Dictionary with g: variables #define globvarht globvardict.dv_hashtab /* - * Old Vim variables such as "v:version" are also available without the "v:". + * Old MNV variables such as "v:version" are also available without the "v:". * Also in functions. We need a special hashtable for them. */ static hashtab_T compat_hashtab; @@ -39,17 +39,17 @@ static hashtab_T compat_hashtab; #define VV_NAME(s, t) s, {{t, 0, {0}}, 0, {0}} -typedef struct vimvar vimvar_T; +typedef struct mnvvar mnvvar_T; -static struct vimvar +static struct mnvvar { char *vv_name; // name of variable, without v: dictitem16_T vv_di; // value and name for key (max 16 chars!) type_T *vv_type; // type or NULL char vv_flags; // VV_COMPAT, VV_RO, VV_RO_SBX -} vimvars[VV_LEN] = +} mnvvars[VV_LEN] = { - // The order here must match the VV_ defines in vim.h! + // The order here must match the VV_ defines in mnv.h! // Initializing a union does not work, leave tv.vval empty to get zero's. {VV_NAME("count", VAR_NUMBER), NULL, VV_COMPAT+VV_RO}, {VV_NAME("count1", VAR_NUMBER), NULL, VV_RO}, @@ -126,7 +126,7 @@ static struct vimvar {VV_NAME("numbermax", VAR_NUMBER), NULL, VV_RO}, {VV_NAME("numbermin", VAR_NUMBER), NULL, VV_RO}, {VV_NAME("numbersize", VAR_NUMBER), NULL, VV_RO}, - {VV_NAME("vim_did_enter", VAR_NUMBER), NULL, VV_RO}, + {VV_NAME("mnv_did_enter", VAR_NUMBER), NULL, VV_RO}, {VV_NAME("testing", VAR_NUMBER), NULL, 0}, {VV_NAME("t_number", VAR_NUMBER), NULL, VV_RO}, {VV_NAME("t_string", VAR_NUMBER), NULL, VV_RO}, @@ -167,7 +167,7 @@ static struct vimvar {VV_NAME("clipmethod", VAR_STRING), NULL, VV_RO}, {VV_NAME("termda1", VAR_STRING), NULL, VV_RO}, {VV_NAME("termosc", VAR_STRING), NULL, VV_RO}, - {VV_NAME("vim_did_init", VAR_NUMBER), NULL, VV_RO}, + {VV_NAME("mnv_did_init", VAR_NUMBER), NULL, VV_RO}, {VV_NAME("clipproviders", VAR_DICT), NULL, VV_RO}, }; @@ -181,11 +181,11 @@ static struct vimvar #define vv_blob vv_di.di_tv.vval.v_blob #define vv_tv vv_di.di_tv -static dictitem_T vimvars_var; // variable used for v: -static dict_T vimvardict; // Dictionary with v: variables -#define vimvarht vimvardict.dv_hashtab +static dictitem_T mnvvars_var; // variable used for v: +static dict_T mnvvardict; // Dictionary with v: variables +#define mnvvarht mnvvardict.dv_hashtab -// for VIM_VERSION_ defines +// for MNV_VERSION_ defines #include "version.h" static void list_glob_vars(int *first); @@ -200,22 +200,22 @@ static void list_one_var(dictitem_T *v, char *prefix, int *first); static void list_one_var_a(char *prefix, char_u *name, int type, char_u *string, int *first); /* - * Initialize global and vim special variables + * Initialize global and mnv special variables */ void evalvars_init(void) { int i; - struct vimvar *p; + struct mnvvar *p; init_var_dict(&globvardict, &globvars_var, VAR_DEF_SCOPE); - init_var_dict(&vimvardict, &vimvars_var, VAR_SCOPE); - vimvardict.dv_lock = VAR_FIXED; + init_var_dict(&mnvvardict, &mnvvars_var, VAR_SCOPE); + mnvvardict.dv_lock = VAR_FIXED; hash_init(&compat_hashtab); for (i = 0; i < VV_LEN; ++i) { - p = &vimvars[i]; + p = &mnvvars[i]; if (STRLEN(p->vv_name) > DICTITEM16_KEY_LEN) { iemsg("Name too long, increase size of dictitem16_T"); @@ -231,57 +231,57 @@ evalvars_init(void) // add to v: scope dict, unless the value is not always available if (p->vv_tv_type != VAR_UNKNOWN) - hash_add(&vimvarht, p->vv_di.di_key, "initialization"); + hash_add(&mnvvarht, p->vv_di.di_key, "initialization"); if (p->vv_flags & VV_COMPAT) // add to compat scope dict hash_add(&compat_hashtab, p->vv_di.di_key, "initialization"); } - set_vim_var_nr(VV_VERSION, VIM_VERSION_100); - set_vim_var_nr(VV_VERSIONLONG, VIM_VERSION_100 * 10000 + highest_patch()); - - set_vim_var_nr(VV_SEARCHFORWARD, 1L); - set_vim_var_nr(VV_HLSEARCH, 1L); - set_vim_var_nr(VV_EXITING, VVAL_NULL); - set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED)); - set_vim_var_list(VV_ERRORS, list_alloc()); - set_vim_var_dict(VV_EVENT, dict_alloc_lock(VAR_FIXED)); - - set_vim_var_nr(VV_FALSE, VVAL_FALSE); - set_vim_var_nr(VV_TRUE, VVAL_TRUE); - set_vim_var_nr(VV_NONE, VVAL_NONE); - set_vim_var_nr(VV_NULL, VVAL_NULL); - set_vim_var_nr(VV_NUMBERMAX, VARNUM_MAX); - set_vim_var_nr(VV_NUMBERMIN, VARNUM_MIN); - set_vim_var_nr(VV_NUMBERSIZE, sizeof(varnumber_T) * 8); - set_vim_var_nr(VV_SIZEOFINT, sizeof(int)); - set_vim_var_nr(VV_SIZEOFLONG, sizeof(long)); - set_vim_var_nr(VV_SIZEOFPOINTER, sizeof(char *)); - set_vim_var_nr(VV_MAXCOL, MAXCOL); - - set_vim_var_nr(VV_TYPE_NUMBER, VAR_TYPE_NUMBER); - set_vim_var_nr(VV_TYPE_STRING, VAR_TYPE_STRING); - set_vim_var_nr(VV_TYPE_FUNC, VAR_TYPE_FUNC); - set_vim_var_nr(VV_TYPE_LIST, VAR_TYPE_LIST); - set_vim_var_nr(VV_TYPE_DICT, VAR_TYPE_DICT); - set_vim_var_nr(VV_TYPE_FLOAT, VAR_TYPE_FLOAT); - set_vim_var_nr(VV_TYPE_BOOL, VAR_TYPE_BOOL); - set_vim_var_nr(VV_TYPE_NONE, VAR_TYPE_NONE); - set_vim_var_nr(VV_TYPE_JOB, VAR_TYPE_JOB); - set_vim_var_nr(VV_TYPE_CHANNEL, VAR_TYPE_CHANNEL); - set_vim_var_nr(VV_TYPE_BLOB, VAR_TYPE_BLOB); - set_vim_var_nr(VV_TYPE_CLASS, VAR_TYPE_CLASS); - set_vim_var_nr(VV_TYPE_OBJECT, VAR_TYPE_OBJECT); - set_vim_var_nr(VV_TYPE_TYPEALIAS, VAR_TYPE_TYPEALIAS); - set_vim_var_nr(VV_TYPE_ENUM, VAR_TYPE_ENUM); - set_vim_var_nr(VV_TYPE_ENUMVALUE, VAR_TYPE_ENUMVALUE); - set_vim_var_nr(VV_TYPE_TUPLE, VAR_TYPE_TUPLE); - - set_vim_var_nr(VV_ECHOSPACE, sc_col - 1); - - set_vim_var_dict(VV_COLORNAMES, dict_alloc()); + set_mnv_var_nr(VV_VERSION, MNV_VERSION_100); + set_mnv_var_nr(VV_VERSIONLONG, MNV_VERSION_100 * 10000 + highest_patch()); + + set_mnv_var_nr(VV_SEARCHFORWARD, 1L); + set_mnv_var_nr(VV_HLSEARCH, 1L); + set_mnv_var_nr(VV_EXITING, VVAL_NULL); + set_mnv_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED)); + set_mnv_var_list(VV_ERRORS, list_alloc()); + set_mnv_var_dict(VV_EVENT, dict_alloc_lock(VAR_FIXED)); + + set_mnv_var_nr(VV_FALSE, VVAL_FALSE); + set_mnv_var_nr(VV_TRUE, VVAL_TRUE); + set_mnv_var_nr(VV_NONE, VVAL_NONE); + set_mnv_var_nr(VV_NULL, VVAL_NULL); + set_mnv_var_nr(VV_NUMBERMAX, VARNUM_MAX); + set_mnv_var_nr(VV_NUMBERMIN, VARNUM_MIN); + set_mnv_var_nr(VV_NUMBERSIZE, sizeof(varnumber_T) * 8); + set_mnv_var_nr(VV_SIZEOFINT, sizeof(int)); + set_mnv_var_nr(VV_SIZEOFLONG, sizeof(long)); + set_mnv_var_nr(VV_SIZEOFPOINTER, sizeof(char *)); + set_mnv_var_nr(VV_MAXCOL, MAXCOL); + + set_mnv_var_nr(VV_TYPE_NUMBER, VAR_TYPE_NUMBER); + set_mnv_var_nr(VV_TYPE_STRING, VAR_TYPE_STRING); + set_mnv_var_nr(VV_TYPE_FUNC, VAR_TYPE_FUNC); + set_mnv_var_nr(VV_TYPE_LIST, VAR_TYPE_LIST); + set_mnv_var_nr(VV_TYPE_DICT, VAR_TYPE_DICT); + set_mnv_var_nr(VV_TYPE_FLOAT, VAR_TYPE_FLOAT); + set_mnv_var_nr(VV_TYPE_BOOL, VAR_TYPE_BOOL); + set_mnv_var_nr(VV_TYPE_NONE, VAR_TYPE_NONE); + set_mnv_var_nr(VV_TYPE_JOB, VAR_TYPE_JOB); + set_mnv_var_nr(VV_TYPE_CHANNEL, VAR_TYPE_CHANNEL); + set_mnv_var_nr(VV_TYPE_BLOB, VAR_TYPE_BLOB); + set_mnv_var_nr(VV_TYPE_CLASS, VAR_TYPE_CLASS); + set_mnv_var_nr(VV_TYPE_OBJECT, VAR_TYPE_OBJECT); + set_mnv_var_nr(VV_TYPE_TYPEALIAS, VAR_TYPE_TYPEALIAS); + set_mnv_var_nr(VV_TYPE_ENUM, VAR_TYPE_ENUM); + set_mnv_var_nr(VV_TYPE_ENUMVALUE, VAR_TYPE_ENUMVALUE); + set_mnv_var_nr(VV_TYPE_TUPLE, VAR_TYPE_TUPLE); + + set_mnv_var_nr(VV_ECHOSPACE, sc_col - 1); + + set_mnv_var_dict(VV_COLORNAMES, dict_alloc()); #ifdef FEAT_PYTHON3 - set_vim_var_nr(VV_PYTHON3_VERSION, python3_version()); + set_mnv_var_nr(VV_PYTHON3_VERSION, python3_version()); #endif // Default for v:register is not 0 but '"'. This is adjusted once the @@ -291,27 +291,27 @@ evalvars_init(void) #if defined(EXITFREE) /* - * Free all vim variables information on exit + * Free all mnv variables information on exit */ void evalvars_clear(void) { int i; - struct vimvar *p; + struct mnvvar *p; for (i = 0; i < VV_LEN; ++i) { - p = &vimvars[i]; + p = &mnvvars[i]; if (p->vv_di.di_tv.v_type == VAR_STRING) - VIM_CLEAR(p->vv_str); + MNV_CLEAR(p->vv_str); else if (p->vv_di.di_tv.v_type == VAR_LIST) { list_unref(p->vv_list); p->vv_list = NULL; } } - hash_clear(&vimvarht); - hash_init(&vimvarht); // garbage_collect() will access it + hash_clear(&mnvvarht); + hash_init(&mnvvarht); // garbage_collect() will access it hash_clear(&compat_hashtab); // global variables @@ -333,9 +333,9 @@ garbage_collect_globvars(int copyID) } int -garbage_collect_vimvars(int copyID) +garbage_collect_mnvvars(int copyID) { - return set_ref_in_ht(&vimvarht, copyID, NULL, NULL); + return set_ref_in_ht(&mnvvarht, copyID, NULL, NULL); } int @@ -373,7 +373,7 @@ set_internal_string_var(char_u *name, char_u *value) char_u *val; typval_T *tvp; - val = vim_strsave(value); + val = mnv_strsave(value); if (val == NULL) return; @@ -396,10 +396,10 @@ eval_charconvert( sctx_T saved_sctx = current_sctx; sctx_T *ctx; - set_vim_var_string(VV_CC_FROM, enc_from, -1); - set_vim_var_string(VV_CC_TO, enc_to, -1); - set_vim_var_string(VV_FNAME_IN, fname_from, -1); - set_vim_var_string(VV_FNAME_OUT, fname_to, -1); + set_mnv_var_string(VV_CC_FROM, enc_from, -1); + set_mnv_var_string(VV_CC_TO, enc_to, -1); + set_mnv_var_string(VV_FNAME_IN, fname_from, -1); + set_mnv_var_string(VV_FNAME_OUT, fname_to, -1); ctx = get_option_sctx("charconvert"); if (ctx != NULL) current_sctx = *ctx; @@ -407,10 +407,10 @@ eval_charconvert( if (eval_to_bool(p_ccv, &err, NULL, FALSE, TRUE)) err = TRUE; - set_vim_var_string(VV_CC_FROM, NULL, -1); - set_vim_var_string(VV_CC_TO, NULL, -1); - set_vim_var_string(VV_FNAME_IN, NULL, -1); - set_vim_var_string(VV_FNAME_OUT, NULL, -1); + set_mnv_var_string(VV_CC_FROM, NULL, -1); + set_mnv_var_string(VV_CC_TO, NULL, -1); + set_mnv_var_string(VV_FNAME_IN, NULL, -1); + set_mnv_var_string(VV_FNAME_OUT, NULL, -1); current_sctx = saved_sctx; if (err) @@ -426,8 +426,8 @@ eval_printexpr(char_u *fname, char_u *args) sctx_T saved_sctx = current_sctx; sctx_T *ctx; - set_vim_var_string(VV_FNAME_IN, fname, -1); - set_vim_var_string(VV_CMDARG, args, -1); + set_mnv_var_string(VV_FNAME_IN, fname, -1); + set_mnv_var_string(VV_CMDARG, args, -1); ctx = get_option_sctx("printexpr"); if (ctx != NULL) current_sctx = *ctx; @@ -435,8 +435,8 @@ eval_printexpr(char_u *fname, char_u *args) if (eval_to_bool(p_pexpr, &err, NULL, FALSE, TRUE)) err = TRUE; - set_vim_var_string(VV_FNAME_IN, NULL, -1); - set_vim_var_string(VV_CMDARG, NULL, -1); + set_mnv_var_string(VV_FNAME_IN, NULL, -1); + set_mnv_var_string(VV_CMDARG, NULL, -1); current_sctx = saved_sctx; if (err) @@ -459,9 +459,9 @@ eval_diff( sctx_T *ctx; typval_T *tv; - set_vim_var_string(VV_FNAME_IN, origfile, -1); - set_vim_var_string(VV_FNAME_NEW, newfile, -1); - set_vim_var_string(VV_FNAME_OUT, outfile, -1); + set_mnv_var_string(VV_FNAME_IN, origfile, -1); + set_mnv_var_string(VV_FNAME_NEW, newfile, -1); + set_mnv_var_string(VV_FNAME_OUT, outfile, -1); ctx = get_option_sctx("diffexpr"); if (ctx != NULL) @@ -471,9 +471,9 @@ eval_diff( tv = eval_expr_ext(p_dex, NULL, TRUE); free_tv(tv); - set_vim_var_string(VV_FNAME_IN, NULL, -1); - set_vim_var_string(VV_FNAME_NEW, NULL, -1); - set_vim_var_string(VV_FNAME_OUT, NULL, -1); + set_mnv_var_string(VV_FNAME_IN, NULL, -1); + set_mnv_var_string(VV_FNAME_NEW, NULL, -1); + set_mnv_var_string(VV_FNAME_OUT, NULL, -1); current_sctx = saved_sctx; } @@ -487,9 +487,9 @@ eval_patch( sctx_T *ctx; typval_T *tv; - set_vim_var_string(VV_FNAME_IN, origfile, -1); - set_vim_var_string(VV_FNAME_DIFF, difffile, -1); - set_vim_var_string(VV_FNAME_OUT, outfile, -1); + set_mnv_var_string(VV_FNAME_IN, origfile, -1); + set_mnv_var_string(VV_FNAME_DIFF, difffile, -1); + set_mnv_var_string(VV_FNAME_OUT, outfile, -1); ctx = get_option_sctx("patchexpr"); if (ctx != NULL) @@ -499,9 +499,9 @@ eval_patch( tv = eval_expr_ext(p_pex, NULL, TRUE); free_tv(tv); - set_vim_var_string(VV_FNAME_IN, NULL, -1); - set_vim_var_string(VV_FNAME_DIFF, NULL, -1); - set_vim_var_string(VV_FNAME_OUT, NULL, -1); + set_mnv_var_string(VV_FNAME_IN, NULL, -1); + set_mnv_var_string(VV_FNAME_DIFF, NULL, -1); + set_mnv_var_string(VV_FNAME_OUT, NULL, -1); current_sctx = saved_sctx; } #endif @@ -524,8 +524,8 @@ eval_spell_expr(char_u *badword, char_u *expr) int r; // Set "v:val" to the bad word. - prepare_vimvar(VV_VAL, &save_val); - set_vim_var_string(VV_VAL, badword, -1); + prepare_mnvvar(VV_VAL, &save_val); + set_mnv_var_string(VV_VAL, badword, -1); if (p_verbose == 0) ++emsg_off; ctx = get_option_sctx("spellsuggest"); @@ -545,8 +545,8 @@ eval_spell_expr(char_u *badword, char_u *expr) if (p_verbose == 0) --emsg_off; - clear_tv(get_vim_var_tv(VV_VAL)); - restore_vimvar(VV_VAL, &save_val); + clear_tv(get_mnv_var_tv(VV_VAL)); + restore_mnvvar(VV_VAL, &save_val); current_sctx = saved_sctx; return list; @@ -581,12 +581,12 @@ get_spellword(list_T *list, char_u **pp) * When not used yet add the variable to the v: hashtable. */ void -prepare_vimvar(int idx, typval_T *save_tv) +prepare_mnvvar(int idx, typval_T *save_tv) { - *save_tv = vimvars[idx].vv_tv; - vimvars[idx].vv_str = NULL; // don't free it now - if (vimvars[idx].vv_tv_type == VAR_UNKNOWN) - hash_add(&vimvarht, vimvars[idx].vv_di.di_key, "prepare vimvar"); + *save_tv = mnvvars[idx].vv_tv; + mnvvars[idx].vv_str = NULL; // don't free it now + if (mnvvars[idx].vv_tv_type == VAR_UNKNOWN) + hash_add(&mnvvarht, mnvvars[idx].vv_di.di_key, "prepare mnvvar"); } /* @@ -595,28 +595,28 @@ prepare_vimvar(int idx, typval_T *save_tv) * When no longer defined, remove the variable from the v: hashtable. */ void -restore_vimvar(int idx, typval_T *save_tv) +restore_mnvvar(int idx, typval_T *save_tv) { hashitem_T *hi; - vimvars[idx].vv_tv = *save_tv; - if (vimvars[idx].vv_tv_type != VAR_UNKNOWN) + mnvvars[idx].vv_tv = *save_tv; + if (mnvvars[idx].vv_tv_type != VAR_UNKNOWN) return; - hi = hash_find(&vimvarht, vimvars[idx].vv_di.di_key); + hi = hash_find(&mnvvarht, mnvvars[idx].vv_di.di_key); if (HASHITEM_EMPTY(hi)) - internal_error("restore_vimvar()"); + internal_error("restore_mnvvar()"); else - hash_remove(&vimvarht, hi, "restore vimvar"); + hash_remove(&mnvvarht, hi, "restore mnvvar"); } /* - * List Vim variables. + * List MNV variables. */ static void -list_vim_vars(int *first) +list_mnv_vars(int *first) { - list_hashtable_vars(&vimvarht, "v:", FALSE, first); + list_hashtable_vars(&mnvvarht, "v:", FALSE, first); } /* @@ -637,13 +637,13 @@ list_script_vars(int *first) int is_scoped_variable(char_u *name) { - return vim_strchr((char_u *)"gwbt", name[0]) != NULL + return mnv_strchr((char_u *)"gwbt", name[0]) != NULL && name[1] == ':' && eval_isnamec(name[2]); } /* - * Evaluate one Vim expression {expr} in string "p" and append the + * Evaluate one MNV expression {expr} in string "p" and append the * resulting string to "gap". "p" points to the opening "{". * When "evaluate" is FALSE only skip over the expression. * Return a pointer to the character after "}", NULL for an error. @@ -676,14 +676,14 @@ eval_one_expr_in_str(char_u *p, garray_T *gap, int evaluate) if (expr_val == NULL) return NULL; ga_concat(gap, expr_val); - vim_free(expr_val); + mnv_free(expr_val); } return block_end + 1; } /* - * Evaluate all the Vim expressions {expr} in "str" and return the resulting + * Evaluate all the MNV expressions {expr} in "str" and return the resulting * string in allocated memory. "{{" is reduced to "{" and "}}" to "}". * Used for a heredoc assignment. * Returns NULL for an error. @@ -764,15 +764,15 @@ eval_all_expr_in_str(char_u *str) * tcl, mzscheme), "script_get" is set to TRUE. In this case, if the marker is * missing, then '.' is accepted as a marker. * - * When compiling a heredoc assignment to a variable in a Vim9 def function, - * "vim9compile" is set to TRUE. In this case, instead of generating a list of - * string values from the heredoc, vim9 instructions are generated. On success + * When compiling a heredoc assignment to a variable in a MNV9 def function, + * "mnv9compile" is set to TRUE. In this case, instead of generating a list of + * string values from the heredoc, mnv9 instructions are generated. On success * the returned list will be empty. * * Returns a List with {lines} or NULL on failure. */ list_T * -heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile) +heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int mnv9compile) { char_u *theline = NULL; char_u *marker; @@ -783,14 +783,14 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile) int text_indent_len = 0; char_u *text_indent = NULL; char_u dot[] = "."; - int comment_char = in_vim9script() ? '#' : '"'; + int comment_char = in_mnv9script() ? '#' : '"'; int evalstr = FALSE; int eval_failed = FALSE; - cctx_T *cctx = vim9compile ? eap->cookie : NULL; + cctx_T *cctx = mnv9compile ? eap->cookie : NULL; int count = 0; int heredoc_in_string = FALSE; char_u *line_arg = NULL; - char_u *nl_ptr = vim_strchr(cmd, '\n'); + char_u *nl_ptr = mnv_strchr(cmd, '\n'); if (nl_ptr != NULL) { @@ -810,7 +810,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile) while (TRUE) { if (STRNCMP(cmd, "trim", 4) == 0 - && (cmd[4] == NUL || VIM_ISWHITE(cmd[4]))) + && (cmd[4] == NUL || MNV_ISWHITE(cmd[4]))) { cmd = skipwhite(cmd + 4); @@ -819,7 +819,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile) // of the first line after the :let command line. To find the end // marker the indent of the :let command line is trimmed. p = *eap->cmdlinep; - while (VIM_ISWHITE(*p)) + while (MNV_ISWHITE(*p)) { p++; marker_indent_len++; @@ -829,7 +829,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile) continue; } if (STRNCMP(cmd, "eval", 4) == 0 - && (cmd[4] == NUL || VIM_ISWHITE(cmd[4]))) + && (cmd[4] == NUL || MNV_ISWHITE(cmd[4]))) { cmd = skipwhite(cmd + 4); evalstr = TRUE; @@ -849,7 +849,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile) return NULL; } *p = NUL; - if (!script_get && vim_islower(*marker)) + if (!script_get && mnv_islower(*marker)) { emsg(_(e_marker_cannot_start_with_lower_case_letter)); return NULL; @@ -891,7 +891,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile) } theline = line_arg; - next_line = vim_strchr(theline, '\n'); + next_line = mnv_strchr(theline, '\n'); if (next_line == NULL) line_arg += STRLEN(line_arg); else @@ -902,7 +902,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile) } else { - vim_free(theline); + mnv_free(theline); theline = eap->ea_getline(NUL, eap->cookie, 0, FALSE); if (theline == NULL) { @@ -929,12 +929,12 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile) // set the text indent from the first line. p = theline; text_indent_len = 0; - while (VIM_ISWHITE(*p)) + while (MNV_ISWHITE(*p)) { p++; text_indent_len++; } - text_indent = vim_strnsave(theline, text_indent_len); + text_indent = mnv_strnsave(theline, text_indent_len); } // with "trim": skip the indent matching the first line if (text_indent != NULL) @@ -943,12 +943,12 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile) break; str = theline + ti; - if (vim9compile) + if (mnv9compile) { if (compile_all_expr_in_str(str, evalstr, cctx) == FAIL) { - vim_free(theline); - vim_free(text_indent); + mnv_free(theline); + mnv_free(text_indent); list_free(l); return FAIL; } @@ -973,21 +973,21 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile) if (list_append_string(l, str, -1) == FAIL) { if (free_str) - vim_free(str); + mnv_free(str); break; } if (free_str) - vim_free(str); + mnv_free(str); } } if (heredoc_in_string) // Next command follows the heredoc in the string. eap->nextcmd = line_arg; else - vim_free(theline); - vim_free(text_indent); + mnv_free(theline); + mnv_free(text_indent); - if (vim9compile && cctx->ctx_skip != SKIP_YES && !eval_failed) + if (mnv9compile && cctx->ctx_skip != SKIP_YES && !eval_failed) generate_NEWLIST(cctx, count, FALSE); if (eval_failed) @@ -1000,7 +1000,7 @@ heredoc_get(exarg_T *eap, char_u *cmd, int script_get, int vim9compile) } /* - * Vim9 variable declaration: + * MNV9 variable declaration: * ":var name" * ":var name: type" * ":var name = expr" @@ -1013,9 +1013,9 @@ ex_var(exarg_T *eap) char_u *p = eap->cmd; int has_var; - if (!in_vim9script()) + if (!in_mnv9script()) { - semsg(_(e_str_cannot_be_used_in_legacy_vim_script), ":var"); + semsg(_(e_str_cannot_be_used_in_legacy_mnv_script), ":var"); return; } has_var = checkforcmd_noparen(&p, "var", 3); @@ -1040,7 +1040,7 @@ ex_var(exarg_T *eap) * ":let var ..= expr" assignment command. * ":let [var1, var2] = expr" unpack list. * ":let var =<< ..." heredoc - * ":let var: string" Vim9 declaration + * ":let var: string" MNV9 declaration * * ":final var = expr" assignment command. * ":final [var1, var2] = expr" unpack list. @@ -1064,17 +1064,17 @@ ex_let(exarg_T *eap) int concat; int has_assign; int flags = 0; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); - if (eap->cmdidx == CMD_final && !vim9script) + if (eap->cmdidx == CMD_final && !mnv9script) { - // In legacy Vim script ":final" is short for ":finally". + // In legacy MNV script ":final" is short for ":finally". ex_finally(eap); return; } - if (eap->cmdidx == CMD_let && vim9script) + if (eap->cmdidx == CMD_let && mnv9script) { - emsg(_(e_cannot_use_let_in_vim9_script)); + emsg(_(e_cannot_use_let_in_mnv9_script)); return; } @@ -1083,7 +1083,7 @@ ex_let(exarg_T *eap) else if (eap->cmdidx == CMD_final) flags |= ASSIGN_FINAL; - // Vim9 assignment without ":let", ":const" or ":final" + // MNV9 assignment without ":let", ":const" or ":final" if (eap->arg == eap->cmd) flags |= ASSIGN_NO_DECL; @@ -1094,7 +1094,7 @@ ex_let(exarg_T *eap) concat = expr[0] == '.' && ((expr[1] == '=' && in_old_script(2)) || (expr[1] == '.' && expr[2] == '=')); - has_assign = *expr == '=' || (vim_strchr((char_u *)"+-*/%", *expr) != NULL + has_assign = *expr == '=' || (mnv_strchr((char_u *)"+-*/%", *expr) != NULL && expr[1] == '='); if (!has_assign && !concat) { @@ -1105,13 +1105,13 @@ ex_let(exarg_T *eap) emsg(_(e_dot_equal_not_supported_with_script_version_two)); else if (!ends_excmd2(eap->cmd, arg)) { - if (vim9script) + if (mnv9script) { if (!ends_excmd2(eap->cmd, skipwhite(argend))) semsg(_(e_trailing_characters_str), argend); else - // Vim9 declaration ":var name: type" - arg = vim9_declare_scriptvar(eap, arg); + // MNV9 declaration ":var name: type" + arg = mnv9_declare_scriptvar(eap, arg); } else { @@ -1128,7 +1128,7 @@ ex_let(exarg_T *eap) list_tab_vars(&first); list_script_vars(&first); list_func_vars(&first); - list_vim_vars(&first); + list_mnv_vars(&first); } set_nextcmd(eap, arg); return; @@ -1141,7 +1141,7 @@ ex_let(exarg_T *eap) // :let text =<< [trim] [eval] END // :var text =<< [trim] [eval] END - if (vim9script && !eap->skip && (!VIM_ISWHITE(expr[-1]) + if (mnv9script && !eap->skip && (!MNV_ISWHITE(expr[-1]) || !IS_WHITE_OR_NUL(expr[3]))) semsg(_(e_white_space_required_before_and_after_str_at_str), "=<<", expr); @@ -1176,12 +1176,12 @@ ex_let(exarg_T *eap) op[1] = NUL; if (*expr != '=') { - if (vim9script && (flags & ASSIGN_NO_DECL) == 0) + if (mnv9script && (flags & ASSIGN_NO_DECL) == 0) { // +=, /=, etc. require an existing variable semsg(_(e_cannot_use_operator_on_new_variable_str), eap->arg); } - else if (vim_strchr((char_u *)"+-*/%.", *expr) != NULL) + else if (mnv_strchr((char_u *)"+-*/%.", *expr) != NULL) { op[0] = *expr; // +=, -=, *=, /=, %= or .= ++len; @@ -1196,10 +1196,10 @@ ex_let(exarg_T *eap) else ++expr; - if (vim9script && !eap->skip && (!VIM_ISWHITE(*argend) + if (mnv9script && !eap->skip && (!MNV_ISWHITE(*argend) || !IS_WHITE_OR_NUL(*expr))) { - vim_strncpy(op, expr - len, len); + mnv_strncpy(op, expr - len, len); semsg(_(e_white_space_required_before_and_after_str_at_str), op, argend); } @@ -1460,13 +1460,13 @@ skip_var_list( /* * Skip one (assignable) variable name, including @r, $VAR, &option, d.key, * l[idx]. - * In Vim9 script also skip over ": type" if "include_type" is TRUE. + * In MNV9 script also skip over ": type" if "include_type" is TRUE. */ char_u * skip_var_one(char_u *arg, int include_type) { char_u *end; - int vim9 = in_vim9script(); + int mnv9 = in_mnv9script(); if (*arg == '@' && arg[1] != NUL) return arg + 2; @@ -1480,10 +1480,10 @@ skip_var_one(char_u *arg, int include_type) // "a: type" is declaring variable "a" with a type, not "a:". // Same for "s: type". - if (vim9 && end == arg + 2 && end[-1] == ':') + if (mnv9 && end == arg + 2 && end[-1] == ':') --end; - if (include_type && vim9) + if (include_type && mnv9) { if (*skipwhite(end) == ':') end = skip_type(skipwhite(skipwhite(end) + 1), FALSE); @@ -1519,8 +1519,8 @@ list_hashtable_vars( di = HI2DI(hi); // apply :filter /pat/ to variable name - vim_strncpy((char_u *)buf, (char_u *)prefix, IOSIZE - 1); - vim_strcat((char_u *)buf, di->di_key, IOSIZE); + mnv_strncpy((char_u *)buf, (char_u *)prefix, IOSIZE - 1); + mnv_strcat((char_u *)buf, di->di_key, IOSIZE); if (message_filtered(buf)) continue; @@ -1588,7 +1588,7 @@ list_arg_vars(exarg_T *eap, char_u *arg, int *first) if (error || eap->skip) { arg = find_name_end(arg, NULL, NULL, FNE_INCL_BR | FNE_CHECK_START); - if (!VIM_ISWHITE(*arg) && !ends_excmd(*arg)) + if (!MNV_ISWHITE(*arg) && !ends_excmd(*arg)) { emsg_severe = TRUE; if (!did_emsg) @@ -1638,7 +1638,7 @@ list_arg_vars(exarg_T *eap, char_u *arg, int *first) case 'b': list_buf_vars(first); break; case 'w': list_win_vars(first); break; case 't': list_tab_vars(first); break; - case 'v': list_vim_vars(first); break; + case 'v': list_mnv_vars(first); break; case 's': list_script_vars(first); break; case 'l': list_func_vars(first); break; default: @@ -1661,14 +1661,14 @@ list_arg_vars(exarg_T *eap, char_u *arg, int *first) s == NULL ? (char_u *)"" : s, first); *arg = c; - vim_free(tf); + mnv_free(tf); } clear_tv(&tv); } } } - vim_free(tofree); + mnv_free(tofree); } arg = skipwhite(arg); @@ -1707,10 +1707,10 @@ ex_let_env( semsg(_(e_invalid_argument_str), name - 1); else { - if (op != NULL && vim_strchr((char_u *)"+-*/%", *op) != NULL) + if (op != NULL && mnv_strchr((char_u *)"+-*/%", *op) != NULL) semsg(_(e_wrong_variable_type_for_str_equal), op); else if (endchars != NULL - && vim_strchr(endchars, *skipwhite(arg)) == NULL) + && mnv_strchr(endchars, *skipwhite(arg)) == NULL) emsg(_(e_unexpected_characters_in_let)); else if (!check_secure() && !check_restricted()) { @@ -1723,22 +1723,22 @@ ex_let_env( if (p != NULL && op != NULL && *op == '.') { int mustfree = FALSE; - char_u *s = vim_getenv(name, &mustfree); + char_u *s = mnv_getenv(name, &mustfree); if (s != NULL) { p = tofree = concat_str(s, p); if (mustfree) - vim_free(s); + mnv_free(s); } } if (p != NULL) { - vim_setenv_ext(name, p); + mnv_setenv_ext(name, p); arg_end = arg; } name[len] = c1; - vim_free(tofree); + mnv_free(tofree); } } return arg_end; @@ -1769,7 +1769,7 @@ ex_let_option( // Find the end of the name. p = find_option_end(&arg, &scope); if (p == NULL || (endchars != NULL - && vim_strchr(endchars, *skipwhite(p)) == NULL)) + && mnv_strchr(endchars, *skipwhite(p)) == NULL)) { emsg(_(e_unexpected_characters_in_let)); return NULL; @@ -1807,7 +1807,7 @@ ex_let_option( || opt_type == gov_number || opt_type == gov_hidden_bool || opt_type == gov_hidden_number) - && (tv->v_type != VAR_STRING || !in_vim9script())) + && (tv->v_type != VAR_STRING || !in_mnv9script())) { if (opt_type == gov_bool || opt_type == gov_hidden_bool) // bool, possibly hidden @@ -1830,9 +1830,9 @@ ex_let_option( goto theend; } // Avoid setting a string option to the text "v:false" or similar. - // In Vim9 script also don't convert a number to string. + // In MNV9 script also don't convert a number to string. else if (tv->v_type != VAR_BOOL && tv->v_type != VAR_SPECIAL - && (!in_vim9script() || tv->v_type != VAR_NUMBER)) + && (!in_mnv9script() || tv->v_type != VAR_NUMBER)) { s = tv_get_string_chk(tv); if (s == NULL) @@ -1848,7 +1848,7 @@ ex_let_option( { // number, in legacy script also bool if (opt_type == gov_number - || (opt_type == gov_bool && !in_vim9script())) + || (opt_type == gov_bool && !in_mnv9script())) { switch (*op) { @@ -1866,7 +1866,7 @@ ex_let_option( { // string s = concat_str(stringval, s); - vim_free(stringval); + mnv_free(stringval); stringval = s; } } @@ -1878,8 +1878,8 @@ ex_let_option( theend: *p = c1; - vim_free(stringval); - vim_free(tofree); + mnv_free(stringval); + mnv_free(tofree); return arg_end; } @@ -1903,10 +1903,10 @@ ex_let_register( return NULL; } ++arg; - if (op != NULL && vim_strchr((char_u *)"+-*/%", *op) != NULL) + if (op != NULL && mnv_strchr((char_u *)"+-*/%", *op) != NULL) semsg(_(e_wrong_variable_type_for_str_equal), op); else if (endchars != NULL - && vim_strchr(endchars, *skipwhite(arg + 1)) == NULL) + && mnv_strchr(endchars, *skipwhite(arg + 1)) == NULL) emsg(_(e_unexpected_characters_in_let)); else { @@ -1922,7 +1922,7 @@ ex_let_register( if (s != NULL) { p = ptofree = concat_str(s, p); - vim_free(s); + mnv_free(s); } } if (p != NULL) @@ -1930,7 +1930,7 @@ ex_let_register( write_reg_contents(*arg == '@' ? '"' : *arg, p, -1, FALSE); arg_end = arg + 1; } - vim_free(ptofree); + mnv_free(ptofree); } return arg_end; } @@ -1952,11 +1952,11 @@ ex_let_one( { char_u *arg_end = NULL; - if (in_vim9script() && (flags & (ASSIGN_NO_DECL | ASSIGN_DECL)) == 0 + if (in_mnv9script() && (flags & (ASSIGN_NO_DECL | ASSIGN_DECL)) == 0 && (flags & (ASSIGN_CONST | ASSIGN_FINAL)) == 0 - && vim_strchr((char_u *)"$@&", *arg) != NULL) + && mnv_strchr((char_u *)"$@&", *arg) != NULL) { - vim9_declare_error(arg); + mnv9_declare_error(arg); return NULL; } @@ -1997,7 +1997,7 @@ ex_let_one( p = get_lval(arg, tv, &lv, FALSE, FALSE, lval_flags, FNE_CHECK_START); if (p != NULL && lv.ll_name != NULL) { - if (endchars != NULL && vim_strchr(endchars, + if (endchars != NULL && mnv_strchr(endchars, *skipwhite(lv.ll_name_end)) == NULL) { emsg(_(e_unexpected_characters_in_let)); @@ -2036,7 +2036,7 @@ ex_lockvar(exarg_T *eap) if (eap->forceit) deep = -1; - else if (vim_isdigit(*arg)) + else if (mnv_isdigit(*arg)) { deep = getdigits(&arg); arg = skipwhite(arg); @@ -2047,7 +2047,7 @@ ex_lockvar(exarg_T *eap) /* * ":unlet", ":lockvar" and ":unlockvar" are quite similar. - * Also used for Vim9 script. "callback" is invoked as: + * Also used for MNV9 script. "callback" is invoked as: * callback(&lv, name_end, eap, deep, cookie) */ void @@ -2088,7 +2088,7 @@ ex_unletlock( glv_flags | GLV_NO_DECL, FNE_CHECK_START); if (lv.ll_name == NULL) error = TRUE; // error but continue parsing - if (name_end == NULL || (!VIM_ISWHITE(*name_end) + if (name_end == NULL || (!MNV_ISWHITE(*name_end) && !ends_excmd(*name_end))) { if (name_end != NULL) @@ -2134,7 +2134,7 @@ do_unlet_var( // Environment variable, normal name or expanded name. if (*lp->ll_name == '$') - vim_unsetenv_ext(lp->ll_name + 1); + mnv_unsetenv_ext(lp->ll_name + 1); else if (do_unlet(lp->ll_name, forceit) == FAIL) ret = FAIL; *name_end = cc; @@ -2202,18 +2202,18 @@ do_unlet(char_u *name, int forceit) dict_T *d; dictitem_T *di; - // can't :unlet a script variable in Vim9 script - if (in_vim9script() && check_vim9_unlet(name) == FAIL) + // can't :unlet a script variable in MNV9 script + if (in_mnv9script() && check_mnv9_unlet(name) == FAIL) return FAIL; ht = find_var_ht(name, &varname); - // can't :unlet a script variable in Vim9 script from a function + // can't :unlet a script variable in MNV9 script from a function if (ht == get_script_local_ht() && SCRIPT_ID_VALID(current_sctx.sc_sid) && SCRIPT_ITEM(current_sctx.sc_sid)->sn_version - == SCRIPT_VERSION_VIM9 - && check_vim9_unlet(name) == FAIL) + == SCRIPT_VERSION_MNV9 + && check_mnv9_unlet(name) == FAIL) return FAIL; if (ht != NULL && *varname != NUL) @@ -2224,7 +2224,7 @@ do_unlet(char_u *name, int forceit) if (ht == &globvarht) d = &globvardict; else if (ht == &compat_hashtab) - d = &vimvardict; + d = &mnvvardict; else { di = find_var_in_ht(ht, *name, (char_u *)"", FALSE); @@ -2271,7 +2271,7 @@ report_lockvar_member(char *msg, lval_T *lp) vname = lp->ll_name; else { - vname = vim_strnsave(lp->ll_name, lp->ll_name_end - lp->ll_name); + vname = mnv_strnsave(lp->ll_name, lp->ll_name_end - lp->ll_name); if (vname == NULL) return; did_alloc = TRUE; @@ -2279,7 +2279,7 @@ report_lockvar_member(char *msg, lval_T *lp) } semsg(_(msg), vname, class_name); if (did_alloc) - vim_free(vname); + mnv_free(vname); } /* @@ -2319,7 +2319,7 @@ do_lock_var( di = find_var(lp->ll_name, NULL, TRUE); if (di == NULL) { - if (in_vim9script()) + if (in_mnv9script()) semsg(_(e_cannot_find_variable_to_unlock_str), lp->ll_name); ret = FAIL; @@ -2337,7 +2337,7 @@ do_lock_var( } else { - if (in_vim9script()) + if (in_mnv9script()) { svar_T *sv = find_typval_in_script(&di->di_tv, 0, FALSE); @@ -2575,7 +2575,7 @@ cat_prefix_varname(int prefix, char_u *name) len = (int)STRLEN(name) + 3; if (len > varnamebuflen) { - vim_free(varnamebuf); + mnv_free(varnamebuf); len += 10; // some additional space varnamebuf = alloc(len); if (varnamebuf == NULL) @@ -2667,9 +2667,9 @@ get_user_var_name(expand_T *xp, int idx) // v: variables if (vidx < VV_LEN) - return cat_prefix_varname('v', (char_u *)vimvars[vidx++].vv_name); + return cat_prefix_varname('v', (char_u *)mnvvars[vidx++].vv_name); - VIM_CLEAR(varnamebuf); + MNV_CLEAR(varnamebuf); varnamebuflen = 0; return NULL; } @@ -2679,9 +2679,9 @@ get_var_special_name(int nr) { switch (nr) { - case VVAL_FALSE: return in_vim9script() ? "false" : "v:false"; - case VVAL_TRUE: return in_vim9script() ? "true" : "v:true"; - case VVAL_NULL: return in_vim9script() ? "null" : "v:null"; + case VVAL_FALSE: return in_mnv9script() ? "false" : "v:false"; + case VVAL_TRUE: return in_mnv9script() ? "true" : "v:true"; + case VVAL_NULL: return in_mnv9script() ? "null" : "v:null"; case VVAL_NONE: return "v:none"; } internal_error("get_var_special_name()"); @@ -2710,9 +2710,9 @@ get_globvar_ht(void) * Returns the v: variable dictionary */ dict_T * -get_vimvar_dict(void) +get_mnvvar_dict(void) { - return &vimvardict; + return &mnvvardict; } /* @@ -2720,16 +2720,16 @@ get_vimvar_dict(void) * Returns DI_ flags in "di_flags". */ int -find_vim_var(char_u *name, int *di_flags) +find_mnv_var(char_u *name, int *di_flags) { - dictitem_T *di = find_var_in_ht(&vimvarht, 0, name, TRUE); - struct vimvar *vv; + dictitem_T *di = find_var_in_ht(&mnvvarht, 0, name, TRUE); + struct mnvvar *vv; if (di == NULL) return -1; *di_flags = di->di_flags; - vv = (struct vimvar *)((char *)di - offsetof(vimvar_T, vv_di)); - return (int)(vv - vimvars); + vv = (struct mnvvar *)((char *)di - offsetof(mnvvar_T, vv_di)); + return (int)(vv - mnvvars); } @@ -2737,42 +2737,42 @@ find_vim_var(char_u *name, int *di_flags) * Set type of v: variable to "type". */ void -set_vim_var_type(int idx, vartype_T type) +set_mnv_var_type(int idx, vartype_T type) { - vimvars[idx].vv_tv_type = type; + mnvvars[idx].vv_tv_type = type; } /* * Set number v: variable to "val". - * Note that this does not set the type, use set_vim_var_type() for that. + * Note that this does not set the type, use set_mnv_var_type() for that. */ void -set_vim_var_nr(int idx, varnumber_T val) +set_mnv_var_nr(int idx, varnumber_T val) { - vimvars[idx].vv_nr = val; + mnvvars[idx].vv_nr = val; } char * -get_vim_var_name(int idx) +get_mnv_var_name(int idx) { - return vimvars[idx].vv_name; + return mnvvars[idx].vv_name; } /* * Get typval_T v: variable value. */ typval_T * -get_vim_var_tv(int idx) +get_mnv_var_tv(int idx) { - return &vimvars[idx].vv_tv; + return &mnvvars[idx].vv_tv; } type_T * -get_vim_var_type(int idx, garray_T *type_list) +get_mnv_var_type(int idx, garray_T *type_list) { - if (vimvars[idx].vv_type != NULL) - return vimvars[idx].vv_type; - return typval2type_vimvar(&vimvars[idx].vv_tv, type_list); + if (mnvvars[idx].vv_type != NULL) + return mnvvars[idx].vv_type; + return typval2type_mnvvar(&mnvvars[idx].vv_tv, type_list); } /* @@ -2780,27 +2780,27 @@ get_vim_var_type(int idx, garray_T *type_list) * Takes over the value of "tv". */ int -set_vim_var_tv(int idx, typval_T *tv) +set_mnv_var_tv(int idx, typval_T *tv) { - if (vimvars[idx].vv_tv_type != tv->v_type) + if (mnvvars[idx].vv_tv_type != tv->v_type) { emsg(_(e_type_mismatch_for_v_variable)); clear_tv(tv); return FAIL; } // VV_RO is also checked when compiling, but let's check here as well. - if (vimvars[idx].vv_flags & VV_RO) + if (mnvvars[idx].vv_flags & VV_RO) { - semsg(_(e_cannot_change_readonly_variable_str), vimvars[idx].vv_name); + semsg(_(e_cannot_change_readonly_variable_str), mnvvars[idx].vv_name); return FAIL; } - if (sandbox && (vimvars[idx].vv_flags & VV_RO_SBX)) + if (sandbox && (mnvvars[idx].vv_flags & VV_RO_SBX)) { - semsg(_(e_cannot_set_variable_in_sandbox_str), vimvars[idx].vv_name); + semsg(_(e_cannot_set_variable_in_sandbox_str), mnvvars[idx].vv_name); return FAIL; } - clear_tv(&vimvars[idx].vv_di.di_tv); - vimvars[idx].vv_di.di_tv = *tv; + clear_tv(&mnvvars[idx].vv_di.di_tv); + mnvvars[idx].vv_di.di_tv = *tv; return OK; } @@ -2808,9 +2808,9 @@ set_vim_var_tv(int idx, typval_T *tv) * Get number v: variable value. */ varnumber_T -get_vim_var_nr(int idx) +get_mnv_var_nr(int idx) { - return vimvars[idx].vv_nr; + return mnvvars[idx].vv_nr; } /* @@ -2819,9 +2819,9 @@ get_vim_var_nr(int idx) * Never returns NULL; */ char_u * -get_vim_var_str(int idx) +get_mnv_var_str(int idx) { - return tv_get_string(&vimvars[idx].vv_tv); + return tv_get_string(&mnvvars[idx].vv_tv); } /* @@ -2829,9 +2829,9 @@ get_vim_var_str(int idx) * needed. */ list_T * -get_vim_var_list(int idx) +get_mnv_var_list(int idx) { - return vimvars[idx].vv_list; + return mnvvars[idx].vv_list; } /* @@ -2839,16 +2839,16 @@ get_vim_var_list(int idx) * needed. */ dict_T * -get_vim_var_dict(int idx) +get_mnv_var_dict(int idx) { - return vimvars[idx].vv_dict; + return mnvvars[idx].vv_dict; } /* * Set v:char to character "c". */ void -set_vim_var_char(int c) +set_mnv_var_char(int c) { char_u buf[MB_MAXBYTES + 1]; size_t buflen; @@ -2862,7 +2862,7 @@ set_vim_var_char(int c) } buf[buflen] = NUL; - set_vim_var_string(VV_CHAR, buf, (int)buflen); + set_mnv_var_string(VV_CHAR, buf, (int)buflen); } /* @@ -2876,9 +2876,9 @@ set_vcount( int set_prevcount) { if (set_prevcount) - vimvars[VV_PREVCOUNT].vv_nr = vimvars[VV_COUNT].vv_nr; - vimvars[VV_COUNT].vv_nr = count; - vimvars[VV_COUNT1].vv_nr = count1; + mnvvars[VV_PREVCOUNT].vv_nr = mnvvars[VV_COUNT].vv_nr; + mnvvars[VV_COUNT].vv_nr = count; + mnvvars[VV_COUNT1].vv_nr = count1; } /* @@ -2886,22 +2886,22 @@ set_vcount( * a timer callback. */ void -save_vimvars(vimvars_save_T *vvsave) +save_mnvvars(mnvvars_save_T *vvsave) { - vvsave->vv_prevcount = vimvars[VV_PREVCOUNT].vv_nr; - vvsave->vv_count = vimvars[VV_COUNT].vv_nr; - vvsave->vv_count1 = vimvars[VV_COUNT1].vv_nr; + vvsave->vv_prevcount = mnvvars[VV_PREVCOUNT].vv_nr; + vvsave->vv_count = mnvvars[VV_COUNT].vv_nr; + vvsave->vv_count1 = mnvvars[VV_COUNT1].vv_nr; } /* - * Restore variables saved by save_vimvars(). + * Restore variables saved by save_mnvvars(). */ void -restore_vimvars(vimvars_save_T *vvsave) +restore_mnvvars(mnvvars_save_T *vvsave) { - vimvars[VV_PREVCOUNT].vv_nr = vvsave->vv_prevcount; - vimvars[VV_COUNT].vv_nr = vvsave->vv_count; - vimvars[VV_COUNT1].vv_nr = vvsave->vv_count1; + mnvvars[VV_PREVCOUNT].vv_nr = vvsave->vv_prevcount; + mnvvars[VV_COUNT].vv_nr = vvsave->vv_count; + mnvvars[VV_COUNT1].vv_nr = vvsave->vv_count1; } /* @@ -2909,41 +2909,41 @@ restore_vimvars(vimvars_save_T *vvsave) * value. */ void -set_vim_var_string( +set_mnv_var_string( int idx, char_u *val, int len) // length of "val" to use or -1 (whole string) { - clear_tv(&vimvars[idx].vv_di.di_tv); - vimvars[idx].vv_tv_type = VAR_STRING; + clear_tv(&mnvvars[idx].vv_di.di_tv); + mnvvars[idx].vv_tv_type = VAR_STRING; if (val == NULL) - vimvars[idx].vv_str = NULL; + mnvvars[idx].vv_str = NULL; else if (len == -1) - vimvars[idx].vv_str = vim_strsave(val); + mnvvars[idx].vv_str = mnv_strsave(val); else - vimvars[idx].vv_str = vim_strnsave(val, len); + mnvvars[idx].vv_str = mnv_strnsave(val, len); } void -set_vim_var_string_direct( +set_mnv_var_string_direct( int idx, char_u *val) { - clear_tv(&vimvars[idx].vv_di.di_tv); - vimvars[idx].vv_tv_type = VAR_STRING; + clear_tv(&mnvvars[idx].vv_di.di_tv); + mnvvars[idx].vv_tv_type = VAR_STRING; - vimvars[idx].vv_str = val; + mnvvars[idx].vv_str = val; } /* * Set List v: variable to "val". */ void -set_vim_var_list(int idx, list_T *val) +set_mnv_var_list(int idx, list_T *val) { - clear_tv(&vimvars[idx].vv_di.di_tv); - vimvars[idx].vv_tv_type = VAR_LIST; - vimvars[idx].vv_list = val; + clear_tv(&mnvvars[idx].vv_di.di_tv); + mnvvars[idx].vv_tv_type = VAR_LIST; + mnvvars[idx].vv_list = val; if (val != NULL) ++val->lv_refcount; } @@ -2952,11 +2952,11 @@ set_vim_var_list(int idx, list_T *val) * Set Dictionary v: variable to "val". */ void -set_vim_var_dict(int idx, dict_T *val) +set_mnv_var_dict(int idx, dict_T *val) { - clear_tv(&vimvars[idx].vv_di.di_tv); - vimvars[idx].vv_tv_type = VAR_DICT; - vimvars[idx].vv_dict = val; + clear_tv(&mnvvars[idx].vv_di.di_tv); + mnvvars[idx].vv_tv_type = VAR_DICT; + mnvvars[idx].vv_dict = val; if (val == NULL) return; @@ -2982,7 +2982,7 @@ set_argv_var(char **argv, int argc) getout(1); l->lv_u.mat.lv_last->li_tv.v_lock = VAR_FIXED; } - set_vim_var_list(VV_ARGV, l); + set_mnv_var_list(VV_ARGV, l); } /* @@ -3015,8 +3015,8 @@ set_reg_var(int c) regname[0] = c; regname[1] = NUL; // Avoid free/alloc when the value is already right. - if (vimvars[VV_REG].vv_str == NULL || vimvars[VV_REG].vv_str[0] != c) - set_vim_var_string(VV_REG, regname, 1); + if (mnvvars[VV_REG].vv_str == NULL || mnvvars[VV_REG].vv_str[0] != c) + set_mnv_var_string(VV_REG, regname, 1); } /* @@ -3029,9 +3029,9 @@ set_reg_var(int c) v_exception(char_u *oldval) { if (oldval == NULL) - return vimvars[VV_EXCEPTION].vv_str; + return mnvvars[VV_EXCEPTION].vv_str; - vimvars[VV_EXCEPTION].vv_str = oldval; + mnvvars[VV_EXCEPTION].vv_str = oldval; return NULL; } @@ -3045,9 +3045,9 @@ v_exception(char_u *oldval) v_throwpoint(char_u *oldval) { if (oldval == NULL) - return vimvars[VV_THROWPOINT].vv_str; + return mnvvars[VV_THROWPOINT].vv_str; - vimvars[VV_THROWPOINT].vv_str = oldval; + mnvvars[VV_THROWPOINT].vv_str = oldval; return NULL; } @@ -3064,11 +3064,11 @@ set_cmdarg(exarg_T *eap, char_u *oldarg) char_u *newval; unsigned len; - oldval = vimvars[VV_CMDARG].vv_str; + oldval = mnvvars[VV_CMDARG].vv_str; if (eap == NULL) { - vim_free(oldval); - vimvars[VV_CMDARG].vv_str = oldarg; + mnv_free(oldval); + mnvvars[VV_CMDARG].vv_str = oldarg; return NULL; } @@ -3117,7 +3117,7 @@ set_cmdarg(exarg_T *eap, char_u *oldarg) STRCPY(newval + STRLEN(newval), " ++bad=drop"); else if (eap->bad_char != 0) sprintf((char *)newval + STRLEN(newval), " ++bad=%c", eap->bad_char); - vimvars[VV_CMDARG].vv_str = newval; + mnvvars[VV_CMDARG].vv_str = newval; return oldval; } @@ -3166,7 +3166,7 @@ eval_variable( ht = NULL; } - if (tv == NULL && (in_vim9script() || STRNCMP(name, "s:", 2) == 0)) + if (tv == NULL && (in_mnv9script() || STRNCMP(name, "s:", 2) == 0)) { imported_T *import = NULL; char_u *p = STRNCMP(name, "s:", 2) == 0 ? name + 2 : name; @@ -3218,7 +3218,7 @@ eval_variable( found = TRUE; } } - else if (in_vim9script() && (flags & EVAL_VAR_NO_FUNC) == 0) + else if (in_mnv9script() && (flags & EVAL_VAR_NO_FUNC) == 0) { int has_g_prefix = STRNCMP(name, "g:", 2) == 0; ufunc_T *ufunc = find_func(name, FALSE); @@ -3237,7 +3237,7 @@ eval_variable( } } - // In Vim9 script we can get a function reference by using the + // In MNV9 script we can get a function reference by using the // function name. For a global non-autoload function "g:" is // required. if (ufunc != NULL && (has_g_prefix @@ -3252,7 +3252,7 @@ eval_variable( // Keep the "g:", otherwise script-local may be // assumed. if (cc != '<') - rettv->vval.v_string = vim_strsave(name); + rettv->vval.v_string = mnv_strsave(name); else { // append the generic function arguments @@ -3265,7 +3265,7 @@ eval_variable( } } else - rettv->vval.v_string = vim_strnsave(ufunc->uf_name, ufunc->uf_namelen); + rettv->vval.v_string = mnv_strnsave(ufunc->uf_name, ufunc->uf_namelen); if (rettv->vval.v_string != NULL) func_ref(ufunc->uf_name); } @@ -3323,7 +3323,7 @@ eval_variable( { if (tv->v_type == VAR_DICT && tv->vval.v_dict == NULL && ((type != NULL && !was_assigned) - || !in_vim9script())) + || !in_mnv9script())) { tv->vval.v_dict = dict_alloc(); if (tv->vval.v_dict != NULL) @@ -3336,7 +3336,7 @@ eval_variable( } else if (tv->v_type == VAR_LIST && tv->vval.v_list == NULL && ((type != NULL && !was_assigned) - || !in_vim9script())) + || !in_mnv9script())) { tv->vval.v_list = list_alloc(); if (tv->vval.v_list != NULL) @@ -3349,7 +3349,7 @@ eval_variable( } else if (tv->v_type == VAR_TUPLE && tv->vval.v_tuple == NULL && ((type != NULL && !was_assigned) - || !in_vim9script())) + || !in_mnv9script())) { tv->vval.v_tuple = tuple_alloc(); if (tv->vval.v_tuple != NULL) @@ -3362,7 +3362,7 @@ eval_variable( } else if (tv->v_type == VAR_BLOB && tv->vval.v_blob == NULL && ((type != NULL && !was_assigned) - || !in_vim9script())) + || !in_mnv9script())) { tv->vval.v_blob = blob_alloc(); if (tv->vval.v_blob != NULL) @@ -3468,8 +3468,8 @@ find_var(char_u *name, hashtab_T **htp, int no_autoload) if (ret != NULL) return ret; - // in Vim9 script items without a scope can be script-local - if (in_vim9script() && name[0] != NUL && name[1] != ':') + // in MNV9 script items without a scope can be script-local + if (in_mnv9script() && name[0] != NUL && name[1] != ':') { ht = get_script_local_ht(); if (ht != NULL) @@ -3502,11 +3502,11 @@ find_var_autoload_prefix(char_u *name, int sid, hashtab_T **htp, { hashtab_T *ht; dictitem_T *ret = NULL; - // When using "vim9script autoload" script-local items are prefixed but can + // When using "mnv9script autoload" script-local items are prefixed but can // be used with s:name. int check_sid = sid > 0 ? sid : current_sctx.sc_sid; if (SCRIPT_ID_VALID(check_sid) - && (in_vim9script() || (name[0] == 's' && name[1] == ':'))) + && (in_mnv9script() || (name[0] == 's' && name[1] == ':'))) { scriptitem_T *si = SCRIPT_ITEM(check_sid); @@ -3532,7 +3532,7 @@ find_var_autoload_prefix(char_u *name, int sid, hashtab_T **htp, } } if (free_auto_name) - vim_free(auto_name); + mnv_free(auto_name); } } } @@ -3594,7 +3594,7 @@ find_var_in_ht( { case 's': return &SCRIPT_SV(current_sctx.sc_sid)->sv_var; case 'g': return &globvars_var; - case 'v': return &vimvars_var; + case 'v': return &mnvvars_var; case 'b': return &curbuf->b_bufvar; case 'w': return &curwin->w_winvar; case 't': return &curtab->tp_winvar; @@ -3664,12 +3664,12 @@ lookup_scriptitem( if (len < sizeof(buffer) - 1) { // avoid an alloc/free for short names - vim_strncpy(buffer, name, len); + mnv_strncpy(buffer, name, len); p = buffer; } else { - p = vim_strnsave(name, len); + p = mnv_strnsave(name, len); if (p == NULL) return FAIL; } @@ -3685,7 +3685,7 @@ lookup_scriptitem( if (res == FAIL && find_imported(p, 0, FALSE) != NULL) res = OK; if (p != buffer) - vim_free(p); + mnv_free(p); // Find a function, so that a following "->" works. // When used as a command require "(" or "->" to follow, "Cmd" is a user @@ -3745,9 +3745,9 @@ find_var_ht(char_u *name, char_u **varname) if (ht != NULL) return ht; // local variable - // In Vim9 script items at the script level are script-local, except + // In MNV9 script items at the script level are script-local, except // for autoload names. - if (in_vim9script() && vim_strchr(name, AUTOLOAD_CHAR) == NULL) + if (in_mnv9script() && mnv_strchr(name, AUTOLOAD_CHAR) == NULL) { ht = get_script_local_ht(); if (ht != NULL) @@ -3760,8 +3760,8 @@ find_var_ht(char_u *name, char_u **varname) if (*name == 'g') // global variable return &globvarht; // There must be no ':' or '#' in the rest of the name, unless g: is used - if (vim_strchr(name + 2, ':') != NULL - || vim_strchr(name + 2, AUTOLOAD_CHAR) != NULL) + if (mnv_strchr(name + 2, ':') != NULL + || mnv_strchr(name + 2, AUTOLOAD_CHAR) != NULL) return NULL; if (*name == 'b') // buffer variable return &curbuf->b_vars->dv_hashtab; @@ -3770,7 +3770,7 @@ find_var_ht(char_u *name, char_u **varname) if (*name == 't') // tab page variable return &curtab->tp_vars->dv_hashtab; if (*name == 'v') // v: variable - return &vimvarht; + return &mnvvarht; if (get_current_funccal() != NULL && get_current_funccal()->fc_func->uf_def_status == UF_NOT_COMPILED) @@ -3889,7 +3889,7 @@ vars_clear_ext(hashtab_T *ht, int free_val) if (free_val) clear_tv(&v->di_tv); if (v->di_flags & DI_FLAGS_ALLOC) - vim_free(v); + mnv_free(v); } } hash_clear(ht); @@ -3909,7 +3909,7 @@ delete_var(hashtab_T *ht, hashitem_T *hi) return; clear_tv(&di->di_tv); - vim_free(di); + mnv_free(di); } /* @@ -3925,7 +3925,7 @@ list_one_var(dictitem_T *v, char *prefix, int *first) s = echo_string(&v->di_tv, &tofree, numbuf, get_copyID()); list_one_var_a(prefix, v->di_key, v->di_tv.v_type, s == NULL ? (char_u *)"" : s, first); - vim_free(tofree); + mnv_free(tofree); } static void @@ -3988,7 +3988,7 @@ before_set_vvar( { if (di->di_tv.v_type == VAR_STRING) { - VIM_CLEAR(di->di_tv.vval.v_string); + MNV_CLEAR(di->di_tv.vval.v_string); if (copy || tv->v_type != VAR_STRING) { char_u *val = tv_get_string(tv); @@ -3997,7 +3997,7 @@ before_set_vvar( // tv_get_string() causes an error message the variable // will already be set. if (di->di_tv.vval.v_string == NULL) - di->di_tv.vval.v_string = vim_strsave(val); + di->di_tv.vval.v_string = mnv_strsave(val); } else { @@ -4068,8 +4068,8 @@ set_var_const( char_u *name_tofree = NULL; hashtab_T *ht = NULL; int is_script_local; - int vim9script = in_vim9script(); - int var_in_vim9script; + int mnv9script = in_mnv9script(); + int var_in_mnv9script; int var_in_autoload = FALSE; int flags = flags_arg; int free_tv_arg = !copy; // free tv_arg if not used @@ -4098,7 +4098,7 @@ set_var_const( scriptitem_T *si; char_u *auto_name = NULL; - if (in_vim9script() + if (in_mnv9script() && SCRIPT_ID_VALID(current_sctx.sc_sid) && (si = SCRIPT_ITEM(current_sctx.sc_sid)) ->sn_autoload_prefix != NULL @@ -4106,7 +4106,7 @@ set_var_const( || find_var_autoload_prefix(name, 0, NULL, &auto_name) != NULL)) { - // In a vim9 autoload script an exported variable is put in the + // In a mnv9 autoload script an exported variable is put in the // global namespace with the autoload prefix. var_in_autoload = TRUE; varname = auto_name != NULL ? auto_name @@ -4127,21 +4127,21 @@ set_var_const( is_script_local = ht == get_script_local_ht() || sid != 0 || var_in_autoload; - if (vim9script + if (mnv9script && !is_script_local && (flags & (ASSIGN_NO_DECL | ASSIGN_DECL)) == 0 && (flags & (ASSIGN_CONST | ASSIGN_FINAL)) == 0 && name[1] == ':') { - vim9_declare_error(name); + mnv9_declare_error(name); goto failed; } if ((flags & ASSIGN_FOR_LOOP) && is_scoped_variable(name)) // Do not make g:var, w:var, b:var or t:var final. flags &= ~ASSIGN_FINAL; - var_in_vim9script = is_script_local && current_script_is_vim9(); - if (var_in_vim9script && name[0] == '_' && name[1] == NUL) + var_in_mnv9script = is_script_local && current_script_is_mnv9(); + if (var_in_mnv9script && name[0] == '_' && name[1] == NUL) { // For "[a, _] = list" the underscore is ignored. if ((flags & ASSIGN_UNPACK) == 0) @@ -4151,7 +4151,7 @@ set_var_const( di = find_var_in_ht(ht, 0, varname, TRUE); - if (di == NULL && var_in_vim9script) + if (di == NULL && var_in_mnv9script) { imported_T *import = find_imported(varname, 0, FALSE); @@ -4166,9 +4166,9 @@ set_var_const( semsg(_(e_cannot_use_str_itself_it_is_imported), name); goto failed; } - if (!in_vim9script()) + if (!in_mnv9script()) { - semsg(_(e_cannot_create_vim9_script_variable_in_function_str), + semsg(_(e_cannot_create_mnv9_script_variable_in_function_str), name); goto failed; } @@ -4204,7 +4204,7 @@ set_var_const( goto failed; } - if (is_script_local && vim9script + if (is_script_local && mnv9script && (flags & (ASSIGN_NO_DECL | ASSIGN_DECL)) == 0) { semsg(_(e_redefining_script_item_str), name); @@ -4219,7 +4219,7 @@ set_var_const( int type_inplace_modifiable = (di->di_tv.v_type == VAR_LIST || di->di_tv.v_type == VAR_BLOB); - if (var_in_vim9script && (flags & ASSIGN_FOR_LOOP) == 0 + if (var_in_mnv9script && (flags & ASSIGN_FOR_LOOP) == 0 && ((flags & ASSIGN_COMPOUND_OP) == 0 || !type_inplace_modifiable)) { @@ -4256,10 +4256,10 @@ set_var_const( // can only redefine once di->di_flags &= ~DI_FLAGS_RELOAD; - // A Vim9 script-local variable is also present in sn_all_vars + // A MNV9 script-local variable is also present in sn_all_vars // and sn_var_vals. It may set "type" from "tv". - if (var_in_vim9script || var_in_autoload) - update_vim9_script_var(FALSE, di, + if (var_in_mnv9script || var_in_autoload) + update_mnv9_script_var(FALSE, di, var_in_autoload ? name : di->di_key, flags, tv, &type, (flags & ASSIGN_NO_MEMBER_TYPE) == 0); } @@ -4269,7 +4269,7 @@ set_var_const( // Handle setting internal v: variables separately where needed to // prevent changing the type. int type_error = FALSE; - if (ht == &vimvarht + if (ht == &mnvvarht && !before_set_vvar(varname, di, tv, copy, &type_error)) { if (type_error) @@ -4298,7 +4298,7 @@ set_var_const( } // add a new variable - if (var_in_vim9script && (flags & ASSIGN_NO_DECL)) + if (var_in_mnv9script && (flags & ASSIGN_NO_DECL)) { semsg(_(e_unknown_variable_str), name); goto failed; @@ -4308,16 +4308,16 @@ set_var_const( goto failed; // Can't add "v:" or "a:" variable. - if (ht == &vimvarht || ht == get_funccal_args_ht()) + if (ht == &mnvvarht || ht == get_funccal_args_ht()) { semsg(_(e_illegal_variable_name_str), name); goto failed; } - // Make sure the variable name is valid. In Vim9 script an + // Make sure the variable name is valid. In MNV9 script an // autoload variable must be prefixed with "g:" unless in an // autoload script. - if (!valid_varname(varname, -1, !vim9script + if (!valid_varname(varname, -1, !mnv9script || STRNCMP(name, "g:", 2) == 0 || var_in_autoload)) goto failed; @@ -4327,17 +4327,17 @@ set_var_const( STRCPY(di->di_key, varname); if (hash_add(ht, DI2HIKEY(di), "add variable") == FAIL) { - vim_free(di); + mnv_free(di); goto failed; } di->di_flags = DI_FLAGS_ALLOC; if (flags & (ASSIGN_CONST | ASSIGN_FINAL)) di->di_flags |= DI_FLAGS_LOCK; - // A Vim9 script-local variable is also added to sn_all_vars and + // A MNV9 script-local variable is also added to sn_all_vars and // sn_var_vals. It may set "type" from "tv". - if (var_in_vim9script || var_in_autoload) - update_vim9_script_var(TRUE, di, + if (var_in_mnv9script || var_in_autoload) + update_mnv9_script_var(TRUE, di, var_in_autoload ? name : di->di_key, flags, tv, &type, (flags & ASSIGN_NO_MEMBER_TYPE) == 0); } @@ -4353,7 +4353,7 @@ set_var_const( } free_tv_arg = FALSE; - if (vim9script && type != NULL) + if (mnv9script && type != NULL) set_tv_type(dest_tv, type); // ":const var = value" locks the value @@ -4367,7 +4367,7 @@ set_var_const( rc = OK; failed: - vim_free(name_tofree); + mnv_free(name_tofree); if (free_tv_arg) clear_tv(tv_arg); @@ -4463,14 +4463,14 @@ var_wrong_func_name( char_u *name, // points to start of variable name int new_var) // TRUE when creating the variable { - // Allow for w: b: s: and t:. In Vim9 script s: is not allowed, because + // Allow for w: b: s: and t:. In MNV9 script s: is not allowed, because // the name can be used without the s: prefix. // Allow autoload variable. - if (!((vim_strchr((char_u *)"wbt", name[0]) != NULL - || (!in_vim9script() && name[0] == 's')) && name[1] == ':') + if (!((mnv_strchr((char_u *)"wbt", name[0]) != NULL + || (!in_mnv9script() && name[0] == 's')) && name[1] == ':') && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') ? name[2] : name[0]) - && vim_strchr(name, '#') == NULL) + && mnv_strchr(name, '#') == NULL) { semsg(_(e_funcref_variable_name_must_start_with_capital_str), name); return TRUE; @@ -4527,7 +4527,7 @@ valid_varname(char_u *varname, int len, int autoload) char_u *p; for (p = varname; len < 0 ? *p != NUL : p < varname + len; ++p) - if (!eval_isnamec1(*p) && (p == varname || !VIM_ISDIGIT(*p)) + if (!eval_isnamec1(*p) && (p == varname || !MNV_ISDIGIT(*p)) && !(autoload && *p == AUTOLOAD_CHAR)) { semsg(_(e_illegal_variable_name_str), varname); @@ -4698,7 +4698,7 @@ set_option_from_tv(char_u *varname, typval_T *varp) else { if ((opt_p_flags & (P_NUM|P_BOOL)) - && (!in_vim9script() || varp->v_type != VAR_STRING)) + && (!in_mnv9script() || varp->v_type != VAR_STRING)) numval = (long)tv_get_number_chk(varp, &error); if (!error) strval = tv_get_string_buf_chk(varp, nbuf); @@ -4748,7 +4748,7 @@ setwinvar(typval_T *argvars, int off) STRCPY(winvarname, "w:"); STRCPY(winvarname + 2, varname); set_var(winvarname, varp, TRUE); - vim_free(winvarname); + mnv_free(winvarname); } } } @@ -4763,12 +4763,12 @@ setwinvar(typval_T *argvars, int off) void reset_v_option_vars(void) { - set_vim_var_string(VV_OPTION_NEW, NULL, -1); - set_vim_var_string(VV_OPTION_OLD, NULL, -1); - set_vim_var_string(VV_OPTION_OLDLOCAL, NULL, -1); - set_vim_var_string(VV_OPTION_OLDGLOBAL, NULL, -1); - set_vim_var_string(VV_OPTION_TYPE, NULL, -1); - set_vim_var_string(VV_OPTION_COMMAND, NULL, -1); + set_mnv_var_string(VV_OPTION_NEW, NULL, -1); + set_mnv_var_string(VV_OPTION_OLD, NULL, -1); + set_mnv_var_string(VV_OPTION_OLDLOCAL, NULL, -1); + set_mnv_var_string(VV_OPTION_OLDGLOBAL, NULL, -1); + set_mnv_var_string(VV_OPTION_TYPE, NULL, -1); + set_mnv_var_string(VV_OPTION_COMMAND, NULL, -1); } /* @@ -4777,12 +4777,12 @@ reset_v_option_vars(void) void assert_error(garray_T *gap) { - struct vimvar *vp = &vimvars[VV_ERRORS]; + struct mnvvar *vp = &mnvvars[VV_ERRORS]; - if (vp->vv_tv_type != VAR_LIST || vimvars[VV_ERRORS].vv_list == NULL) + if (vp->vv_tv_type != VAR_LIST || mnvvars[VV_ERRORS].vv_list == NULL) // Make sure v:errors is a list. - set_vim_var_list(VV_ERRORS, list_alloc()); - list_append_string(vimvars[VV_ERRORS].vv_list, gap->ga_data, gap->ga_len); + set_mnv_var_list(VV_ERRORS, list_alloc()); + list_append_string(mnvvars[VV_ERRORS].vv_list, gap->ga_data, gap->ga_len); } int @@ -4817,7 +4817,7 @@ var_exists(char_u *var) if (*arg != NUL) n = FALSE; - vim_free(tofree); + mnv_free(tofree); return n; } @@ -4839,7 +4839,7 @@ alloc_redir_lval(void) void clear_redir_lval(void) { - VIM_CLEAR(redir_lval); + MNV_CLEAR(redir_lval); } void @@ -4867,7 +4867,7 @@ var_redir_start(char_u *name, int append) } // Make a copy of the name, it is used in redir_lval until redir ends. - redir_varname = vim_strsave(name); + redir_varname = mnv_strsave(name); if (redir_varname == NULL) return FAIL; @@ -4983,11 +4983,11 @@ var_redir_stop(void) } // free the collected output - VIM_CLEAR(redir_ga.ga_data); + MNV_CLEAR(redir_ga.ga_data); - VIM_CLEAR(redir_lval); + MNV_CLEAR(redir_lval); } - VIM_CLEAR(redir_varname); + MNV_CLEAR(redir_varname); } /* @@ -5014,7 +5014,7 @@ f_gettabvar(typval_T *argvars, typval_T *rettv) tabpage_T *tp; win_T *win = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; @@ -5034,7 +5034,7 @@ f_gettabvar(typval_T *argvars, typval_T *rettv) void f_gettabwinvar(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL || check_for_string_arg(argvars, 2) == FAIL)) @@ -5049,7 +5049,7 @@ f_gettabwinvar(typval_T *argvars, typval_T *rettv) void f_getwinvar(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; @@ -5066,7 +5066,7 @@ f_getbufvar(typval_T *argvars, typval_T *rettv) char_u *varname; buf_T *buf; - if (in_vim9script() + if (in_mnv9script() && (check_for_buffer_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; @@ -5092,7 +5092,7 @@ f_settabvar(typval_T *argvars, typval_T *rettv UNUSED) if (check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; @@ -5114,7 +5114,7 @@ f_settabvar(typval_T *argvars, typval_T *rettv UNUSED) STRCPY(tabvarname, "t:"); STRCPY(tabvarname + 2, varname); set_var(tabvarname, varp, TRUE); - vim_free(tabvarname); + mnv_free(tabvarname); } // Restore current tabpage and last accessed tabpage. @@ -5132,7 +5132,7 @@ f_settabvar(typval_T *argvars, typval_T *rettv UNUSED) void f_settabwinvar(typval_T *argvars, typval_T *rettv UNUSED) { - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL || check_for_string_arg(argvars, 2) == FAIL)) @@ -5147,7 +5147,7 @@ f_settabwinvar(typval_T *argvars, typval_T *rettv UNUSED) void f_setwinvar(typval_T *argvars, typval_T *rettv UNUSED) { - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; @@ -5168,7 +5168,7 @@ f_setbufvar(typval_T *argvars, typval_T *rettv UNUSED) if (check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_buffer_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; @@ -5211,7 +5211,7 @@ f_setbufvar(typval_T *argvars, typval_T *rettv UNUSED) STRCPY(bufvarname, "b:"); STRCPY(bufvarname + 2, varname); set_var(bufvarname, varp, TRUE); - vim_free(bufvarname); + mnv_free(bufvarname); curbuf = save_curbuf; } } @@ -5284,7 +5284,7 @@ put_callback(callback_T *cb, typval_T *tv) else { tv->v_type = VAR_FUNC; - tv->vval.v_string = vim_strsave(cb->cb_name); + tv->vval.v_string = mnv_strsave(cb->cb_name); func_ref(cb->cb_name); } } @@ -5306,7 +5306,7 @@ set_callback(callback_T *dest, callback_T *src) *dest = *src; if (!does_callback_own_cb_name(src)) { - dest->cb_name = vim_strsave(src->cb_name); + dest->cb_name = mnv_strsave(src->cb_name); dest->cb_free_name = TRUE; } *src = (callback_T){0}; @@ -5327,7 +5327,7 @@ copy_callback(callback_T *dest, callback_T *src) } else { - dest->cb_name = vim_strsave(src->cb_name); + dest->cb_name = mnv_strsave(src->cb_name); dest->cb_free_name = TRUE; func_ref(src->cb_name); } @@ -5345,7 +5345,7 @@ expand_autload_callback(callback_T *cb) char_u *p; imported_T *import; - if (!in_vim9script() || cb->cb_name == NULL + if (!in_mnv9script() || cb->cb_name == NULL || (!cb->cb_free_name && (cb->cb_partial == NULL || cb->cb_partial->pt_name == NULL))) return; @@ -5353,7 +5353,7 @@ expand_autload_callback(callback_T *cb) name = cb->cb_partial->pt_name; else name = cb->cb_name; - p = vim_strchr(name, '.'); + p = mnv_strchr(name, '.'); if (p == NULL) return; @@ -5373,12 +5373,12 @@ expand_autload_callback(callback_T *cb) { if (cb->cb_name == cb->cb_partial->pt_name) cb->cb_name = newname; - vim_free(cb->cb_partial->pt_name); + mnv_free(cb->cb_partial->pt_name); cb->cb_partial->pt_name = newname; } else { - vim_free(cb->cb_name); + mnv_free(cb->cb_name); cb->cb_name = newname; } } @@ -5398,7 +5398,7 @@ free_callback(callback_T *callback) func_unref(callback->cb_name); if (callback->cb_free_name) { - vim_free(callback->cb_name); + mnv_free(callback->cb_name); callback->cb_free_name = FALSE; } callback->cb_name = NULL; diff --git a/uvim/src/evalwindow.c b/uvim/src/evalwindow.c index 53116c7a1d..b8acb71710 100644 --- a/uvim/src/evalwindow.c +++ b/uvim/src/evalwindow.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * evalwindow.c: Window related builtin functions */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) @@ -284,7 +284,7 @@ get_framelayout(frame_T *fr, list_T *l, int outer) return; if (list_append_list(l, fr_list) == FAIL) { - vim_free(fr_list); + mnv_free(fr_list); return; } } @@ -309,7 +309,7 @@ get_framelayout(frame_T *fr, list_T *l, int outer) return; if (list_append_list(fr_list, win_list) == FAIL) { - vim_free(win_list); + mnv_free(win_list); return; } @@ -490,7 +490,7 @@ f_gettabinfo(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type != VAR_UNKNOWN) @@ -529,7 +529,7 @@ f_getwininfo(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type != VAR_UNKNOWN) @@ -589,7 +589,7 @@ f_getwinpos(typval_T *argvars UNUSED, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; # if defined(FEAT_GUI) \ @@ -657,7 +657,7 @@ f_tabpagenr(typval_T *argvars UNUSED, typval_T *rettv) int nr = 1; char_u *arg; - if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_string_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type != VAR_UNKNOWN) @@ -689,7 +689,7 @@ f_tabpagewinnr(typval_T *argvars UNUSED, typval_T *rettv) int nr = 1; tabpage_T *tp; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL)) return; @@ -717,7 +717,7 @@ f_win_execute(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_string_or_list_arg(argvars, 1) == FAIL || check_for_opt_string_arg(argvars, 2) == FAIL)) @@ -758,7 +758,7 @@ f_win_execute(typval_T *argvars, typval_T *rettv) if (cwd_status == OK && p_acd) { if (curbuf->b_sfname != NULL && curbuf->b_fname == curbuf->b_sfname) - save_sfname = vim_strsave(curbuf->b_sfname); + save_sfname = mnv_strsave(curbuf->b_sfname); do_autochdir(); apply_acd = mch_dirname(autocwd, MAXPATHL) == OK && STRCMP(cwd, autocwd) == 0; @@ -774,7 +774,7 @@ f_win_execute(typval_T *argvars, typval_T *rettv) # ifdef FEAT_AUTOCHDIR if (apply_acd) { - vim_free(save_sfname); + mnv_free(save_sfname); do_autochdir(); } else @@ -785,7 +785,7 @@ f_win_execute(typval_T *argvars, typval_T *rettv) # ifdef FEAT_AUTOCHDIR if (save_sfname != NULL) { - vim_free(curbuf->b_sfname); + mnv_free(curbuf->b_sfname); curbuf->b_sfname = save_sfname; curbuf->b_fname = curbuf->b_sfname; } @@ -809,7 +809,7 @@ f_win_execute(typval_T *argvars, typval_T *rettv) void f_win_findbuf(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; if (rettv_list_alloc(rettv) == OK) @@ -822,7 +822,7 @@ f_win_findbuf(typval_T *argvars, typval_T *rettv) void f_win_getid(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_opt_number_arg(argvars, 0) == FAIL || (argvars[0].v_type != VAR_UNKNOWN && check_for_opt_number_arg(argvars, 1) == FAIL))) @@ -841,7 +841,7 @@ f_win_gotoid(typval_T *argvars, typval_T *rettv) tabpage_T *tp; int id; - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; id = tv_get_number(&argvars[0]); @@ -879,7 +879,7 @@ f_win_gotoid(typval_T *argvars, typval_T *rettv) void f_win_id2tabwin(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; if (rettv_list_alloc(rettv) == OK) @@ -892,7 +892,7 @@ f_win_id2tabwin(typval_T *argvars, typval_T *rettv) void f_win_id2win(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; rettv->vval.v_number = win_id2win(argvars); @@ -909,7 +909,7 @@ f_win_move_separator(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = FALSE; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; @@ -939,7 +939,7 @@ f_win_move_statusline(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = FALSE; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL)) return; @@ -969,7 +969,7 @@ f_win_screenpos(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; wp = find_win_by_nr_or_id(&argvars[0]); @@ -989,7 +989,7 @@ f_win_splitmove(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = -1; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL || check_for_opt_dict_arg(argvars, 2) == FAIL)) @@ -1053,7 +1053,7 @@ f_win_gettype(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type != VAR_UNKNOWN) @@ -1061,25 +1061,25 @@ f_win_gettype(typval_T *argvars, typval_T *rettv) wp = find_win_by_nr_or_id(&argvars[0]); if (wp == NULL) { - rettv->vval.v_string = vim_strsave((char_u *)"unknown"); + rettv->vval.v_string = mnv_strsave((char_u *)"unknown"); return; } } if (is_aucmd_win(wp)) - rettv->vval.v_string = vim_strsave((char_u *)"autocmd"); + rettv->vval.v_string = mnv_strsave((char_u *)"autocmd"); # if defined(FEAT_QUICKFIX) else if (wp->w_p_pvw) - rettv->vval.v_string = vim_strsave((char_u *)"preview"); + rettv->vval.v_string = mnv_strsave((char_u *)"preview"); # endif # ifdef FEAT_PROP_POPUP else if (WIN_IS_POPUP(wp)) - rettv->vval.v_string = vim_strsave((char_u *)"popup"); + rettv->vval.v_string = mnv_strsave((char_u *)"popup"); # endif else if (wp == cmdwin_win) - rettv->vval.v_string = vim_strsave((char_u *)"command"); + rettv->vval.v_string = mnv_strsave((char_u *)"command"); # ifdef FEAT_QUICKFIX else if (bt_quickfix(wp->w_buffer)) - rettv->vval.v_string = vim_strsave((char_u *) + rettv->vval.v_string = mnv_strsave((char_u *) (wp->w_llist_ref != NULL ? "loclist" : "quickfix")); # endif @@ -1109,7 +1109,7 @@ f_winbufnr(typval_T *argvars, typval_T *rettv) { win_T *wp; - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; wp = find_win_by_nr_or_id(&argvars[0]); @@ -1137,7 +1137,7 @@ f_winheight(typval_T *argvars, typval_T *rettv) { win_T *wp; - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; wp = find_win_by_nr_or_id(&argvars[0]); @@ -1158,7 +1158,7 @@ f_winlayout(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type == VAR_UNKNOWN) @@ -1191,7 +1191,7 @@ f_winnr(typval_T *argvars UNUSED, typval_T *rettv) { int nr = 1; - if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_string_arg(argvars, 0) == FAIL) return; nr = get_winnr(curtab, &argvars[0]); @@ -1220,10 +1220,10 @@ f_winrestcmd(typval_T *argvars UNUSED, typval_T *rettv) { size_t buflen; - buflen = vim_snprintf_safelen((char *)buf, sizeof(buf), + buflen = mnv_snprintf_safelen((char *)buf, sizeof(buf), ":%dresize %d|", winnr, wp->w_height); ga_concat_len(&ga, buf, buflen); - buflen = vim_snprintf_safelen((char *)buf, sizeof(buf), + buflen = mnv_snprintf_safelen((char *)buf, sizeof(buf), "vert :%dresize %d|", winnr, wp->w_width); ga_concat_len(&ga, buf, buflen); ++winnr; @@ -1318,7 +1318,7 @@ f_winwidth(typval_T *argvars, typval_T *rettv) { win_T *wp; - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; wp = find_win_by_nr_or_id(&argvars[0]); diff --git a/uvim/src/ex_cmdidxs.h b/uvim/src/ex_cmdidxs.h index a406f397d0..31aaeb0801 100644 --- a/uvim/src/ex_cmdidxs.h +++ b/uvim/src/ex_cmdidxs.h @@ -1,4 +1,4 @@ -/* Automatically generated code by create_cmdidxs.vim +/* Automatically generated code by create_cmdidxs.mnv * * Table giving the index of the first command in cmdnames[] to lookup * based on the first letter of a command. diff --git a/uvim/src/ex_cmds.c b/uvim/src/ex_cmds.c index d4d57d0a70..cebd5033f4 100644 --- a/uvim/src/ex_cmds.c +++ b/uvim/src/ex_cmds.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * ex_cmds.c: some functions for command line commands */ -#include "vim.h" +#include "mnv.h" #include "version.h" #include @@ -59,27 +59,27 @@ do_ascii(exarg_T *eap UNUSED) cval = NL; // NL is stored as CR else cval = c; - if (vim_isprintc_strict(c) && (c < ' ' || c > '~')) + if (mnv_isprintc_strict(c) && (c < ' ' || c > '~')) { transchar_nonprint(curbuf, buf3, c); - vim_snprintf(buf1, sizeof(buf1), " <%s>", (char *)buf3); + mnv_snprintf(buf1, sizeof(buf1), " <%s>", (char *)buf3); } else buf1[0] = NUL; if (c >= 0x80) - vim_snprintf(buf2, sizeof(buf2), " ", + mnv_snprintf(buf2, sizeof(buf2), " ", (char *)transchar(c & 0x7f)); else buf2[0] = NUL; #ifdef FEAT_DIGRAPHS dig = get_digraph_for_char(cval); if (dig != NULL) - vim_snprintf((char *)IObuff, IOSIZE, + mnv_snprintf((char *)IObuff, IOSIZE, _("<%s>%s%s %d, Hex %02x, Oct %03o, Digr %s"), transchar(c), buf1, buf2, cval, cval, cval, dig); else #endif - vim_snprintf((char *)IObuff, IOSIZE, + mnv_snprintf((char *)IObuff, IOSIZE, _("<%s>%s%s %d, Hex %02x, Octal %03o"), transchar(c), buf1, buf2, cval, cval, cval); if (enc_utf8) @@ -106,13 +106,13 @@ do_ascii(exarg_T *eap UNUSED) #ifdef FEAT_DIGRAPHS dig = get_digraph_for_char(c); if (dig != NULL) - vim_snprintf((char *)IObuff + len, IOSIZE - len, + mnv_snprintf((char *)IObuff + len, IOSIZE - len, c < 0x10000 ? _("> %d, Hex %04x, Oct %o, Digr %s") : _("> %d, Hex %08x, Oct %o, Digr %s"), c, c, c, dig); else #endif - vim_snprintf((char *)IObuff + len, IOSIZE - len, + mnv_snprintf((char *)IObuff + len, IOSIZE - len, c < 0x10000 ? _("> %d, Hex %04x, Octal %o") : _("> %d, Hex %08x, Octal %o"), c, c, c); @@ -252,13 +252,13 @@ linelen(int *has_tab) // find the character after the last non-blank character for (last = first + STRLEN(first); - last > first && VIM_ISWHITE(last[-1]); --last) + last > first && MNV_ISWHITE(last[-1]); --last) ; save = *last; *last = NUL; len = linetabsize_str(line); // get line length on screen if (has_tab != NULL) // check for embedded TAB - *has_tab = (vim_strchr(first, TAB) != NULL); + *has_tab = (mnv_strchr(first, TAB) != NULL); *last = save; return len; @@ -395,7 +395,7 @@ ex_sort(exarg_T *eap) for (p = eap->arg; *p != NUL; ++p) { - if (VIM_ISWHITE(*p)) + if (MNV_ISWHITE(*p)) ; else if (*p == 'i') sort_ic = TRUE; @@ -451,10 +451,10 @@ ex_sort(exarg_T *eap) emsg(_(e_no_previous_regular_expression)); goto sortend; } - regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC); + regmatch.regprog = mnv_regcomp(last_search_pat(), RE_MAGIC); } else - regmatch.regprog = vim_regcomp(p + 1, RE_MAGIC); + regmatch.regprog = mnv_regcomp(p + 1, RE_MAGIC); if (regmatch.regprog == NULL) goto sortend; p = s; // continue after the regexp @@ -495,7 +495,7 @@ ex_sort(exarg_T *eap) start_col = 0; end_col = len; - if (regmatch.regprog != NULL && vim_regexec(®match, s, 0)) + if (regmatch.regprog != NULL && mnv_regexec(®match, s, 0)) { if (sort_rx) { @@ -511,7 +511,7 @@ ex_sort(exarg_T *eap) if (sort_nr || sort_flt) { - // Make sure vim_str2nr() doesn't read any digits past the end + // Make sure mnv_str2nr() doesn't read any digits past the end // of the match, by temporarily terminating the string there s2 = s + end_col; c = *s2; @@ -537,7 +537,7 @@ ex_sort(exarg_T *eap) else { nrs[lnum - eap->line1].st_u.num.is_number = TRUE; - vim_str2nr(s, NULL, NULL, sort_what, + mnv_str2nr(s, NULL, NULL, sort_what, &nrs[lnum - eap->line1].st_u.num.value, NULL, 0, FALSE, NULL); } @@ -635,10 +635,10 @@ ex_sort(exarg_T *eap) beginline(BL_WHITE | BL_FIX); sortend: - vim_free(nrs); - vim_free(sortbuf1); - vim_free(sortbuf2); - vim_regfree(regmatch.regprog); + mnv_free(nrs); + mnv_free(sortbuf1); + mnv_free(sortbuf2); + mnv_regfree(regmatch.regprog); if (got_int) emsg(_(e_interrupted)); } @@ -678,7 +678,7 @@ ex_uniq(exarg_T *eap) for (p = eap->arg; *p != NUL; ++p) { - if (VIM_ISWHITE(*p)) + if (MNV_ISWHITE(*p)) ; else if (*p == 'i') sort_ic = TRUE; @@ -713,10 +713,10 @@ ex_uniq(exarg_T *eap) emsg(_(e_no_previous_regular_expression)); goto uniqend; } - regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC); + regmatch.regprog = mnv_regcomp(last_search_pat(), RE_MAGIC); } else - regmatch.regprog = vim_regcomp(p + 1, RE_MAGIC); + regmatch.regprog = mnv_regcomp(p + 1, RE_MAGIC); if (regmatch.regprog == NULL) goto uniqend; p = s; // continue after the regexp @@ -760,7 +760,7 @@ ex_uniq(exarg_T *eap) start_col = 0; end_col = len; - if (regmatch.regprog != NULL && vim_regexec(®match, s, 0)) + if (regmatch.regprog != NULL && mnv_regexec(®match, s, 0)) { if (sort_rx) { @@ -862,8 +862,8 @@ ex_uniq(exarg_T *eap) beginline(BL_WHITE | BL_FIX); uniqend: - vim_free(sortbuf1); - vim_regfree(regmatch.regprog); + mnv_free(sortbuf1); + mnv_regfree(regmatch.regprog); if (got_int) emsg(_(e_interrupted)); } @@ -916,11 +916,11 @@ do_move(linenr_T line1, linenr_T line2, linenr_T dest) return FAIL; for (extra = 0, l = line1; l <= line2; l++) { - str = vim_strnsave(ml_get(l + extra), ml_get_len(l + extra)); + str = mnv_strnsave(ml_get(l + extra), ml_get_len(l + extra)); if (str != NULL) { ml_append(dest + l - line1, str, (colnr_T)0, FALSE); - vim_free(str); + mnv_free(str); if (dest < line1) extra++; } @@ -1051,11 +1051,11 @@ ex_copy(linenr_T line1, linenr_T line2, linenr_T n) { // need to make a copy because the line will be unlocked within // ml_append() - p = vim_strnsave(ml_get(line1), ml_get_len(line1)); + p = mnv_strnsave(ml_get(line1), ml_get_len(line1)); if (p != NULL) { ml_append(curwin->w_cursor.lnum, p, (colnr_T)0, FALSE); - vim_free(p); + mnv_free(p); } // situation 2: skip already copied lines if (line1 == n) @@ -1081,7 +1081,7 @@ static char_u *prevcmd = NULL; // the previous command void free_prev_shellcmd(void) { - vim_free(prevcmd); + mnv_free(prevcmd); } #endif @@ -1126,8 +1126,8 @@ do_bang( int scroll_save = msg_scroll; /* - * Disallow shell commands for "rvim". - * Disallow shell commands from .exrc and .vimrc in current directory for + * Disallow shell commands for "rmnv". + * Disallow shell commands from .exrc and .mnvrc in current directory for * security reasons. */ if (check_restricted() || check_secure()) @@ -1157,14 +1157,14 @@ do_bang( { if (!prevcmd_is_set()) { - vim_free(newcmd); + mnv_free(newcmd); return; } len += (int)STRLEN(prevcmd); } if ((t = alloc(len)) == NULL) { - vim_free(newcmd); + mnv_free(newcmd); return; } *t = NUL; @@ -1174,7 +1174,7 @@ do_bang( STRCAT(t, prevcmd); p = t + STRLEN(t); STRCAT(t, trailarg); - vim_free(newcmd); + mnv_free(newcmd); newcmd = t; /* @@ -1204,7 +1204,7 @@ do_bang( // we have. if (STRLEN(newcmd) > 0) { - vim_free(prevcmd); + mnv_free(prevcmd); prevcmd = newcmd; } else @@ -1218,12 +1218,12 @@ do_bang( // If % or # appears in the command, it must have been escaped. // Reescape them, so that redoing them does not substitute them by the // buffername. - char_u *cmd = vim_strsave_escaped(prevcmd, (char_u *)"%#"); + char_u *cmd = mnv_strsave_escaped(prevcmd, (char_u *)"%#"); if (cmd != NULL) { AppendToRedobuffLit(cmd, -1); - vim_free(cmd); + mnv_free(cmd); } else AppendToRedobuffLit(prevcmd, -1); @@ -1236,7 +1236,7 @@ do_bang( if (*p_shq != NUL) { if (free_newcmd) - vim_free(newcmd); + mnv_free(newcmd); newcmd = alloc(STRLEN(prevcmd) + 2 * STRLEN(p_shq) + 1); if (newcmd == NULL) return; @@ -1267,7 +1267,7 @@ do_bang( theend: if (free_newcmd) - vim_free(newcmd); + mnv_free(newcmd); } /* @@ -1340,7 +1340,7 @@ do_filter( shell_flags |= SHELL_DOOUT; #ifdef FEAT_FILTERPIPE -# ifdef VIMDLL +# ifdef MNVDLL if (!gui.in_use && !gui.starting) stmp = 1; // Console mode doesn't support filterpipe. # endif @@ -1369,8 +1369,8 @@ do_filter( } else #endif - if ((do_in && (itmp = vim_tempname('i', FALSE)) == NULL) - || (do_out && (otmp = vim_tempname('o', FALSE)) == NULL)) + if ((do_in && (itmp = mnv_tempname('i', FALSE)) == NULL) + || (do_out && (otmp = mnv_tempname('o', FALSE)) == NULL)) { emsg(_(e_cant_get_temp_file_name)); goto filterend; @@ -1421,7 +1421,7 @@ do_filter( { if (u_save(line2, (linenr_T)(line2 + 1)) == FAIL) { - vim_free(cmd_buf); + mnv_free(cmd_buf); goto error; } redraw_curbuf_later(UPD_VALID); @@ -1442,7 +1442,7 @@ do_filter( redraw_later_clear(); wait_return(FALSE); } - vim_free(cmd_buf); + mnv_free(cmd_buf); did_check_timestamps = FALSE; need_check_timestamps = TRUE; @@ -1485,7 +1485,7 @@ do_filter( if (do_in) { if ((cmdmod.cmod_flags & CMOD_KEEPMARKS) - || vim_strchr(p_cpo, CPO_REMMARK) == NULL) + || mnv_strchr(p_cpo, CPO_REMMARK) == NULL) { if (read_linecount >= linecount) // move all marks from old lines to new lines @@ -1540,7 +1540,7 @@ do_filter( { if (do_in) { - vim_snprintf(msg_buf, sizeof(msg_buf), + mnv_snprintf(msg_buf, sizeof(msg_buf), _("%ld lines filtered"), (long)linecount); if (msg(msg_buf) && !msg_scroll) // save message to display it after redraw @@ -1577,8 +1577,8 @@ filterend: mch_remove(itmp); if (otmp != NULL) mch_remove(otmp); - vim_free(itmp); - vim_free(otmp); + mnv_free(itmp); + mnv_free(otmp); } /* @@ -1591,7 +1591,7 @@ do_shell( int flags) // may be SHELL_DOOUT when output is redirected { buf_T *buf; -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) int save_nwr; #endif #ifdef MSWIN @@ -1600,8 +1600,8 @@ do_shell( int keep_termcap = !termcap_active; /* - * Disallow shell commands for "rvim". - * Disallow shell commands from .exrc and .vimrc in current directory for + * Disallow shell commands for "rmnv". + * Disallow shell commands from .exrc and .mnvrc in current directory for * security reasons. */ if (check_restricted() || check_secure()) @@ -1619,7 +1619,7 @@ do_shell( # if defined(FEAT_GUI) && defined(FEAT_TERMINAL) // Don't stop termcap mode when using a terminal window for the shell. - if (gui.in_use && vim_strchr(p_go, GO_TERMINAL) != NULL) + if (gui.in_use && mnv_strchr(p_go, GO_TERMINAL) != NULL) keep_termcap = TRUE; # endif #endif @@ -1688,8 +1688,8 @@ do_shell( * Otherwise there is probably text on the screen that the user wants * to read before redrawing, so call wait_return(). */ -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) -# ifdef VIMDLL +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) +# ifdef MNVDLL if (!gui.in_use) # endif { @@ -1827,7 +1827,7 @@ make_filter_cmd( if (otmp != NULL) len += (long_u)STRLEN(otmp) + (long_u)STRLEN(p_srr) + 2; // " " - vim_free(shell_name); + mnv_free(shell_name); buf = alloc(len); if (buf == NULL) @@ -1836,10 +1836,10 @@ make_filter_cmd( if (is_powershell) { if (itmp != NULL) - vim_snprintf((char *)buf, len, "& { Get-Content %s | & %s }", + mnv_snprintf((char *)buf, len, "& { Get-Content %s | & %s }", itmp, cmd); else - vim_snprintf((char *)buf, len, "& { %s }", cmd); + mnv_snprintf((char *)buf, len, "& { %s }", cmd); } else { @@ -1849,9 +1849,9 @@ make_filter_cmd( if (itmp != NULL || otmp != NULL) { if (is_fish_shell) - vim_snprintf((char *)buf, len, "begin; %s; end", (char *)cmd); + mnv_snprintf((char *)buf, len, "begin; %s; end", (char *)cmd); else - vim_snprintf((char *)buf, len, "(%s)", (char *)cmd); + mnv_snprintf((char *)buf, len, "(%s)", (char *)cmd); } else STRCPY(buf, cmd); @@ -1866,7 +1866,7 @@ make_filter_cmd( if (*p_sxe != NUL && *p_sxq == '(') { if (itmp != NULL || otmp != NULL) - vim_snprintf((char *)buf, len, "(%s)", (char *)cmd); + mnv_snprintf((char *)buf, len, "(%s)", (char *)cmd); else STRCPY(buf, cmd); if (itmp != NULL) @@ -1932,7 +1932,7 @@ append_redir( end = buf + STRLEN(buf); // find "%s" - for (p = opt; (p = vim_strchr(p, '%')) != NULL; ++p) + for (p = opt; (p = mnv_strchr(p, '%')) != NULL; ++p) { if (p[1] == 's') // found %s break; @@ -1944,11 +1944,11 @@ append_redir( #ifdef MSWIN *end++ = ' '; // not really needed? Not with sh, ksh or bash #endif - vim_snprintf((char *)end, (size_t)(buflen - (end - buf)), + mnv_snprintf((char *)end, (size_t)(buflen - (end - buf)), (char *)opt, (char *)fname); } else - vim_snprintf((char *)end, (size_t)(buflen - (end - buf)), " %s %s", + mnv_snprintf((char *)end, (size_t)(buflen - (end - buf)), " %s %s", (char *)opt, (char *)fname); } @@ -1978,7 +1978,7 @@ print_line_no_prefix( if (curwin->w_p_nu || use_number) { - vim_snprintf(numbuf, sizeof(numbuf), + mnv_snprintf(numbuf, sizeof(numbuf), "%*ld ", number_width(curwin), (long)lnum); msg_puts_attr(numbuf, HL_ATTR(HLF_N)); // Highlight line nrs } @@ -2051,8 +2051,8 @@ rename_buffer(char_u *new_fname) if (buf != NULL && (cmdmod.cmod_flags & CMOD_KEEPALT) == 0) curwin->w_alt_fnum = buf->b_fnum; } - vim_free(fname); - vim_free(sfname); + mnv_free(fname); + mnv_free(sfname); apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf); // Change directories when the 'acd' option is set. @@ -2197,7 +2197,7 @@ do_write(exarg_T *eap) */ if (other) { - if (vim_strchr(p_cpo, CPO_ALTWRITE) != NULL + if (mnv_strchr(p_cpo, CPO_ALTWRITE) != NULL || eap->cmdidx == CMD_saveas) alt_buf = setaltfname(ffname, fname, (linenr_T)1); else @@ -2239,8 +2239,8 @@ do_write(exarg_T *eap) #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) if (p_confirm || (cmdmod.cmod_flags & CMOD_CONFIRM)) { - if (vim_dialog_yesno(VIM_QUESTION, NULL, - (char_u *)_("Write partial file?"), 2) != VIM_YES) + if (mnv_dialog_yesno(MNV_QUESTION, NULL, + (char_u *)_("Write partial file?"), 2) != MNV_YES) goto theend; eap->forceit = TRUE; } @@ -2345,9 +2345,9 @@ do_write(exarg_T *eap) theend: #ifdef FEAT_BROWSE - vim_free(browse_file); + mnv_free(browse_file); #endif - vim_free(free_fname); + mnv_free(free_fname); return retval; } @@ -2378,10 +2378,10 @@ check_overwrite( || (!bt_nofilename(buf) && ((buf->b_flags & BF_NOTEDITED) || ((buf->b_flags & BF_NEW) - && vim_strchr(p_cpo, CPO_OVERNEW) == NULL) + && mnv_strchr(p_cpo, CPO_OVERNEW) == NULL) || (buf->b_flags & BF_READERR)))) && !p_wa - && vim_fexists(ffname)) + && mnv_fexists(ffname)) { if (!eap->forceit && !eap->append) { @@ -2399,7 +2399,7 @@ check_overwrite( char_u buff[DIALOG_MSG_SIZE]; dialog_msg(buff, _("Overwrite existing file \"%s\"?"), fname); - if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 2) != VIM_YES) + if (mnv_dialog_yesno(MNV_QUESTION, NULL, buff, 2) != MNV_YES) return FAIL; eap->forceit = TRUE; } @@ -2440,8 +2440,8 @@ check_overwrite( copy_option_part(&p, dir, MAXPATHL, ","); } swapname = makeswapname(fname, ffname, curbuf, dir); - vim_free(dir); - r = vim_fexists(swapname); + mnv_free(dir); + r = mnv_fexists(swapname); if (r) { #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) @@ -2452,10 +2452,10 @@ check_overwrite( dialog_msg(buff, _("Swap file \"%s\" exists, overwrite anyway?"), swapname); - if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 2) - != VIM_YES) + if (mnv_dialog_yesno(MNV_QUESTION, NULL, buff, 2) + != MNV_YES) { - vim_free(swapname); + mnv_free(swapname); return FAIL; } eap->forceit = TRUE; @@ -2464,11 +2464,11 @@ check_overwrite( #endif { semsg(_(e_swap_file_exists_str_silent_overrides), swapname); - vim_free(swapname); + mnv_free(swapname); return FAIL; } } - vim_free(swapname); + mnv_free(swapname); } } return OK; @@ -2567,7 +2567,7 @@ do_wqall(exarg_T *eap) if (exiting) { if (!error) - getout(0); // exit Vim + getout(0); // exit MNV not_exiting(save_exiting); } } @@ -2616,7 +2616,7 @@ check_readonly(int *forceit, buf_T *buf) dialog_msg(buff, _("File permissions of \"%s\" are read-only.\nIt may still be possible to write it.\nDo you wish to try?"), buf->b_fname); - if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 2) == VIM_YES) + if (mnv_dialog_yesno(MNV_QUESTION, NULL, buff, 2) == MNV_YES) { // Set forceit, to force the writing of a readonly file *forceit = TRUE; @@ -2718,7 +2718,7 @@ getfile( retval = GETFILE_ERROR; // error encountered theend: - vim_free(free_me); + mnv_free(free_me); return retval; } @@ -2898,7 +2898,7 @@ do_ecmd( #if defined(FEAT_EVAL) if ((command != NULL || newlnum > (linenr_T)0) - && *get_vim_var_str(VV_SWAPCOMMAND) == NUL) + && *get_mnv_var_str(VV_SWAPCOMMAND) == NUL) { string_T val; size_t valsize; @@ -2912,14 +2912,14 @@ do_ecmd( if (val.string != NULL) { if (command != NULL) - val.length = vim_snprintf_safelen((char *)val.string, + val.length = mnv_snprintf_safelen((char *)val.string, valsize, ":%s\r", command); else - val.length = vim_snprintf_safelen((char *)val.string, + val.length = mnv_snprintf_safelen((char *)val.string, valsize, "%ldG", (long)newlnum); - set_vim_var_string(VV_SWAPCOMMAND, val.string, (int)val.length); + set_mnv_var_string(VV_SWAPCOMMAND, val.string, (int)val.length); did_set_swapcommand = TRUE; - vim_free(val.string); + mnv_free(val.string); } } #endif @@ -3051,7 +3051,7 @@ do_ecmd( * things, set auto_buf. */ if (buf->b_fname != NULL) - new_name = vim_strsave(buf->b_fname); + new_name = mnv_strsave(buf->b_fname); save_au_new_curbuf = au_new_curbuf; set_bufref(&au_new_curbuf, buf); apply_autocmds(EVENT_BUFLEAVE, NULL, NULL, FALSE, curbuf); @@ -3069,7 +3069,7 @@ do_ecmd( #ifdef FEAT_EVAL if (aborting()) // autocmds may abort script processing { - vim_free(new_name); + mnv_free(new_name); au_new_curbuf = save_au_new_curbuf; goto theend; } @@ -3104,7 +3104,7 @@ do_ecmd( // autocmds may abort script processing if (aborting() && curwin->w_buffer != NULL) { - vim_free(new_name); + mnv_free(new_name); au_new_curbuf = save_au_new_curbuf; goto theend; } @@ -3160,7 +3160,7 @@ do_ecmd( did_get_winopts = TRUE; #endif } - vim_free(new_name); + mnv_free(new_name); au_new_curbuf = save_au_new_curbuf; } @@ -3224,7 +3224,7 @@ do_ecmd( } buf = curbuf; if (buf->b_fname != NULL) - new_name = vim_strsave(buf->b_fname); + new_name = mnv_strsave(buf->b_fname); else new_name = NULL; set_bufref(&bufref, buf); @@ -3240,7 +3240,7 @@ do_ecmd( if (u_savecommon(0, curbuf->b_ml.ml_line_count + 1, 0, TRUE) == FAIL) { - vim_free(new_name); + mnv_free(new_name); goto theend; } u_unchanged(curbuf); @@ -3259,7 +3259,7 @@ do_ecmd( delbuf_msg(new_name); // frees new_name goto theend; } - vim_free(new_name); + mnv_free(new_name); // If autocommands change buffers under our fingers, forget about // re-editing the file. Should do the buf_clear_file(), but perhaps @@ -3470,8 +3470,8 @@ do_ecmd( msg_scrolled_ign = FALSE; } -#ifdef FEAT_VIMINFO - curbuf->b_last_used = vim_time(); +#ifdef FEAT_MNVINFO + curbuf->b_last_used = mnv_time(); #endif if (command != NULL) @@ -3508,10 +3508,10 @@ do_ecmd( char_u curdir[MAXPATHL]; char_u filedir[MAXPATHL]; - vim_strncpy(filedir, curbuf->b_ffname, MAXPATHL - 1); + mnv_strncpy(filedir, curbuf->b_ffname, MAXPATHL - 1); *gettail_sep(filedir) = NUL; if (mch_dirname(curdir, MAXPATHL) != FAIL - && vim_fnamecmp(curdir, filedir) != 0) + && mnv_fnamecmp(curdir, filedir) != 0) do_autochdir(); } #endif @@ -3531,12 +3531,12 @@ theend: --RedrawingDisabled; #if defined(FEAT_EVAL) if (did_set_swapcommand) - set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); + set_mnv_var_string(VV_SWAPCOMMAND, NULL, -1); #endif #ifdef FEAT_BROWSE - vim_free(browse_file); + mnv_free(browse_file); #endif - vim_free(free_fname); + mnv_free(free_fname); return retval; } @@ -3545,7 +3545,7 @@ delbuf_msg(char_u *name) { semsg(_(e_autocommands_unexpectedly_deleted_new_buffer_str), name == NULL ? (char_u *)"" : name); - vim_free(name); + mnv_free(name); au_new_curbuf.br_buf = NULL; au_new_curbuf.br_buf_free_count = 0; } @@ -3567,7 +3567,7 @@ ex_append(exarg_T *eap) int empty = (curbuf->b_ml.ml_flags & ML_EMPTY); #ifdef FEAT_EVAL - if (not_in_vim9(eap) == FAIL) + if (not_in_mnv9(eap) == FAIL) return; #endif // the ! flag toggles autoindent @@ -3607,7 +3607,7 @@ ex_append(exarg_T *eap) if (*eap->arg == '|') { // Get the text after the trailing bar. - theline = vim_strsave(eap->arg + 1); + theline = mnv_strsave(eap->arg + 1); *eap->arg = NUL; } else if (eap->ea_getline == NULL) @@ -3616,10 +3616,10 @@ ex_append(exarg_T *eap) // when there is no more. if (eap->nextcmd == NULL) break; - p = vim_strchr(eap->nextcmd, NL); + p = mnv_strchr(eap->nextcmd, NL); if (p == NULL) p = eap->nextcmd + STRLEN(eap->nextcmd); - theline = vim_strnsave(eap->nextcmd, p - eap->nextcmd); + theline = mnv_strnsave(eap->nextcmd, p - eap->nextcmd); if (*p != NUL) ++p; else @@ -3663,7 +3663,7 @@ ex_append(exarg_T *eap) || (!did_undo && u_save(lnum, lnum + 1 + (empty ? 1 : 0)) == FAIL)) { - vim_free(theline); + mnv_free(theline); break; } @@ -3679,7 +3679,7 @@ ex_append(exarg_T *eap) else appended_lines_mark(lnum, 1L); - vim_free(theline); + mnv_free(theline); ++lnum; if (empty) @@ -3724,7 +3724,7 @@ ex_change(exarg_T *eap) linenr_T lnum; #ifdef FEAT_EVAL - if (not_in_vim9(eap) == FAIL) + if (not_in_mnv9(eap) == FAIL) return; #endif if (eap->line2 >= eap->line1 @@ -3783,7 +3783,7 @@ ex_z(exarg_T *eap) if (*x != 0) { - if (!VIM_ISDIGIT(*x)) + if (!MNV_ISDIGIT(*x)) { emsg(_(e_non_numeric_argument_to_z)); return; @@ -3895,14 +3895,14 @@ check_restricted(void) { if (restricted) { - emsg(_(e_shell_commands_and_some_functionality_not_allowed_in_rvim)); + emsg(_(e_shell_commands_and_some_functionality_not_allowed_in_rmnv)); return TRUE; } return FALSE; } /* - * Check if the secure flag is set (.exrc or .vimrc in current directory). + * Check if the secure flag is set (.exrc or .mnvrc in current directory). * If so, give an error message and return TRUE. * Otherwise, return FALSE. */ @@ -3912,7 +3912,7 @@ check_secure(void) if (secure) { secure = 2; - emsg(_(e_command_not_allowed_from_vimrc_in_current_dir_or_tag_search)); + emsg(_(e_command_not_allowed_from_mnvrc_in_current_dir_or_tag_search)); return TRUE; } #ifdef HAVE_SANDBOX @@ -4044,14 +4044,14 @@ ex_substitute(exarg_T *eap) which_pat = RE_SUBST; // use last substitute regexp // new pattern and substitution - if (eap->cmd[0] == 's' && *cmd != NUL && !VIM_ISWHITE(*cmd) - && vim_strchr((char_u *)"0123456789cegriIp|\"", *cmd) == NULL) + if (eap->cmd[0] == 's' && *cmd != NUL && !MNV_ISWHITE(*cmd) + && mnv_strchr((char_u *)"0123456789cegriIp|\"", *cmd) == NULL) { // don't accept alphanumeric for separator if (check_regexp_delim(*cmd) == FAIL) return; #ifdef FEAT_EVAL - if (in_vim9script() && check_global_and_subst(eap->cmd, eap->arg) + if (in_mnv9script() && check_global_and_subst(eap->cmd, eap->arg) == FAIL) return; #endif @@ -4063,13 +4063,13 @@ ex_substitute(exarg_T *eap) */ if (*cmd == '\\') { - if (in_vim9script()) + if (in_mnv9script()) { - emsg(_(e_cannot_use_s_backslash_in_vim9_script)); + emsg(_(e_cannot_use_s_backslash_in_mnv9_script)); return; } ++cmd; - if (vim_strchr((char_u *)"/?&", *cmd) == NULL) + if (mnv_strchr((char_u *)"/?&", *cmd) == NULL) { emsg(_(e_backslash_should_be_followed_by)); return; @@ -4094,11 +4094,11 @@ ex_substitute(exarg_T *eap) /* * Small incompatibility: vi sees '\n' as end of the command, but in - * Vim we want to use '\n' to find/substitute a NUL. + * MNV we want to use '\n' to find/substitute a NUL. */ p = cmd; // remember the start of the substitution cmd = skip_substitute(cmd, delimiter); - sub = vim_strsave(p); + sub = mnv_strsave(p); if (sub == NULL) // out of memory return; @@ -4107,28 +4107,28 @@ ex_substitute(exarg_T *eap) { // In POSIX vi ":s/pat/%/" uses the previous subst. string. if (STRCMP(sub, "%") == 0 - && vim_strchr(p_cpo, CPO_SUBPERCENT) != NULL) + && mnv_strchr(p_cpo, CPO_SUBPERCENT) != NULL) { if (old_sub == NULL) // there is no previous command { emsg(_(e_no_previous_substitute_regular_expression)); - vim_free(sub); + mnv_free(sub); return; } - vim_free(sub); - sub = vim_strsave(old_sub); + mnv_free(sub); + sub = mnv_strsave(old_sub); if (sub == NULL) // out of memory return; } else if (!keeppatterns) { - vim_free(old_sub); - old_sub = vim_strsave(sub); + mnv_free(old_sub); + old_sub = mnv_strsave(sub); if (old_sub == NULL) { // out of memory - vim_free(sub); + mnv_free(sub); return; } } @@ -4143,7 +4143,7 @@ ex_substitute(exarg_T *eap) } pat = NULL; // search_regcomp() will use previous pattern patlen = 0; - sub = vim_strsave(old_sub); + sub = mnv_strsave(old_sub); // Vi compatibility quirk: repeating with ":s" keeps the cursor in the // last column after using "$". @@ -4163,7 +4163,7 @@ ex_substitute(exarg_T *eap) if (eap->skip) { - vim_free(sub); + mnv_free(sub); return; } curwin->w_cursor.lnum = eap->line1; @@ -4192,7 +4192,7 @@ ex_substitute(exarg_T *eap) save_re_pat(RE_SUBST, pat, patlen, magic_isset()); // put pattern in history add_to_history(HIST_SEARCH, pat, patlen, TRUE, NUL); - vim_free(sub); + mnv_free(sub); return; } @@ -4205,7 +4205,7 @@ ex_substitute(exarg_T *eap) else { #ifdef FEAT_EVAL - if (in_vim9script()) + if (in_mnv9script()) { // ignore 'gdefault' and 'edcompatible' subflags.do_all = FALSE; @@ -4274,21 +4274,21 @@ ex_substitute(exarg_T *eap) * check for a trailing count */ cmd = skipwhite(cmd); - if (VIM_ISDIGIT(*cmd)) + if (MNV_ISDIGIT(*cmd)) { i = getdigits(&cmd); if (i <= 0 && !eap->skip && subflags.do_error) { emsg(_(e_positive_count_required)); - vim_free(sub); + mnv_free(sub); return; } else if (i >= INT_MAX) { char buf[20]; - vim_snprintf(buf, sizeof(buf), "%ld", i); + mnv_snprintf(buf, sizeof(buf), "%ld", i); semsg(_(e_val_too_large), buf); - vim_free(sub); + mnv_free(sub); return; } eap->line1 = eap->line2; @@ -4307,14 +4307,14 @@ ex_substitute(exarg_T *eap) if (eap->nextcmd == NULL) { semsg(_(e_trailing_characters_str), cmd); - vim_free(sub); + mnv_free(sub); return; } } if (eap->skip) // not executing commands, only parsing { - vim_free(sub); + mnv_free(sub); return; } @@ -4322,7 +4322,7 @@ ex_substitute(exarg_T *eap) { // Substitution is not allowed in non-'modifiable' buffer emsg(_(e_cannot_make_changes_modifiable_is_off)); - vim_free(sub); + mnv_free(sub); return; } @@ -4330,7 +4330,7 @@ ex_substitute(exarg_T *eap) { if (subflags.do_error) emsg(_(e_invalid_command)); - vim_free(sub); + mnv_free(sub); return; } @@ -4351,8 +4351,8 @@ ex_substitute(exarg_T *eap) */ if (sub[0] == '\\' && sub[1] == '=') { - p = vim_strsave(sub); - vim_free(sub); + p = mnv_strsave(sub); + mnv_free(sub); if (p == NULL) return; sub = p; @@ -4363,7 +4363,7 @@ ex_substitute(exarg_T *eap) if (p != sub) { - vim_free(sub); + mnv_free(sub); sub = p; } } @@ -4378,7 +4378,7 @@ ex_substitute(exarg_T *eap) #endif ); ++lnum) { - nmatch = vim_regexec_multi(®match, curwin, curbuf, lnum, + nmatch = mnv_regexec_multi(®match, curwin, curbuf, lnum, (colnr_T)0, NULL); if (nmatch) { @@ -4475,7 +4475,7 @@ ex_substitute(exarg_T *eap) lnum += regmatch.startpos[0].lnum; sub_firstlnum += regmatch.startpos[0].lnum; nmatch -= regmatch.startpos[0].lnum; - VIM_CLEAR(sub_firstline); + MNV_CLEAR(sub_firstline); } // Match might be after the last line for "\n\zs" matching at @@ -4485,11 +4485,11 @@ ex_substitute(exarg_T *eap) if (sub_firstline == NULL) { - sub_firstline = vim_strnsave(ml_get(sub_firstlnum), + sub_firstline = mnv_strnsave(ml_get(sub_firstlnum), ml_get_len(sub_firstlnum)); if (sub_firstline == NULL) { - vim_free(new_start); + mnv_free(new_start); goto outofmem; } } @@ -4569,7 +4569,7 @@ ex_substitute(exarg_T *eap) // When 'cpoptions' contains "u" don't sync undo when // asking for confirmation. - if (vim_strchr(p_cpo, CPO_UNDO) != NULL) + if (mnv_strchr(p_cpo, CPO_UNDO) != NULL) ++no_u_sync; /* @@ -4607,7 +4607,7 @@ ex_substitute(exarg_T *eap) if (resp != NULL) { typed = *resp; - vim_free(resp); + mnv_free(resp); // When ":normal" runs out of characters we get // an empty line. Use "q" to get out of the // loop. @@ -4640,7 +4640,7 @@ ex_substitute(exarg_T *eap) // really update the line, it would change // what matches. Temporarily replace the line // and change it back afterwards. - orig_line = vim_strnsave(ml_get(lnum), + orig_line = mnv_strnsave(ml_get(lnum), ml_get_len(lnum)); if (orig_line != NULL) { @@ -4648,7 +4648,7 @@ ex_substitute(exarg_T *eap) sub_firstline + copycol); if (new_line == NULL) - VIM_CLEAR(orig_line); + MNV_CLEAR(orig_line); else { // Position the cursor relative to the @@ -4753,7 +4753,7 @@ ex_substitute(exarg_T *eap) } State = save_State; setmouse(); - if (vim_strchr(p_cpo, CPO_UNDO) != NULL) + if (mnv_strchr(p_cpo, CPO_UNDO) != NULL) --no_u_sync; if (typed == 'n') @@ -4799,7 +4799,7 @@ ex_substitute(exarg_T *eap) #endif // Get length of substitution part, including the NUL. // When it fails sublen is zero. - sublen = vim_regsub_multi(®match, + sublen = mnv_regsub_multi(®match, sub_firstlnum - regmatch.startpos[0].lnum, sub, sub_firstline, 0, REGSUB_BACKSLASH @@ -4888,7 +4888,7 @@ ex_substitute(exarg_T *eap) if (text_prop_count > 0) { // TODO: what when we already did this? - vim_free(text_props); + mnv_free(text_props); text_props = ALLOC_MULT(textprop_T, text_prop_count); if (text_props != NULL) @@ -4944,11 +4944,11 @@ ex_substitute(exarg_T *eap) new_start_len = needed_len + 50; if ((p1 = alloc_clear(new_start_len)) == NULL) { - vim_free(new_start); + mnv_free(new_start); goto outofmem; } mch_memmove(p1, new_start, (size_t)(len + 1)); - vim_free(new_start); + mnv_free(new_start); new_start = p1; } new_end = new_start + len; @@ -4966,7 +4966,7 @@ ex_substitute(exarg_T *eap) #ifdef FEAT_EVAL ++textlock; #endif - (void)vim_regsub_multi(®match, + (void)mnv_regsub_multi(®match, sub_firstlnum - regmatch.startpos[0].lnum, sub, new_end, sublen, REGSUB_COPY | REGSUB_BACKSLASH @@ -4986,8 +4986,8 @@ ex_substitute(exarg_T *eap) if (nmatch > 1) { sub_firstlnum += nmatch - 1; - vim_free(sub_firstline); - sub_firstline = vim_strnsave(ml_get(sub_firstlnum), + mnv_free(sub_firstline); + sub_firstline = mnv_strnsave(ml_get(sub_firstlnum), ml_get_len(sub_firstlnum)); // When going beyond the last line, stop substituting. if (sub_firstlnum <= line2) @@ -5003,8 +5003,8 @@ ex_substitute(exarg_T *eap) { // Already hit end of the buffer, sub_firstlnum is one // less than what it ought to be. - vim_free(sub_firstline); - sub_firstline = vim_strsave((char_u *)""); + mnv_free(sub_firstline); + sub_firstline = mnv_strsave((char_u *)""); copycol = 0; } @@ -5101,7 +5101,7 @@ skip: */ if (lastone || nmatch_tl > 0 - || (nmatch = vim_regexec_multi(®match, curwin, + || (nmatch = mnv_regexec_multi(®match, curwin, curbuf, sub_firstlnum, matchcol, NULL)) == 0 || regmatch.startpos[0].lnum > 0) @@ -5161,7 +5161,7 @@ skip: } sub_firstlnum = lnum; - vim_free(sub_firstline); // free the temp buffer + mnv_free(sub_firstline); // free the temp buffer sub_firstline = new_start; new_start = NULL; matchcol = (colnr_T)STRLEN(sub_firstline) - matchcol; @@ -5170,7 +5170,7 @@ skip: copycol = 0; } if (nmatch == -1 && !lastone) - nmatch = vim_regexec_multi(®match, curwin, curbuf, + nmatch = mnv_regexec_multi(®match, curwin, curbuf, sub_firstlnum, matchcol, NULL); /* @@ -5192,8 +5192,8 @@ skip: if (did_sub) ++sub_nlines; - vim_free(new_start); // for when substitute was cancelled - VIM_CLEAR(sub_firstline); // free the copy of the original line + mnv_free(new_start); // for when substitute was cancelled + MNV_CLEAR(sub_firstline); // free the copy of the original line } line_breakcheck(); @@ -5209,10 +5209,10 @@ skip: } outofmem: - vim_free(sub_firstline); // may have to free allocated copy of the line + mnv_free(sub_firstline); // may have to free allocated copy of the line #ifdef FEAT_PROP_POPUP - vim_free(text_props); + mnv_free(text_props); #endif // ":s/pat//n" doesn't move the cursor @@ -5264,8 +5264,8 @@ outofmem: changed_window_setting(); #endif - vim_regfree(regmatch.regprog); - vim_free(sub); + mnv_regfree(regmatch.regprog); + mnv_free(sub); // Restore the flag values, they can be used for ":&&". subflags.do_all = save_do_all; @@ -5310,7 +5310,7 @@ do_sub_msg( : NGETTEXT("%ld substitution on %ld lines", "%ld substitutions on %ld lines", sub_nsubs); - vim_snprintf_add(msg_buf, sizeof(msg_buf), + mnv_snprintf_add(msg_buf, sizeof(msg_buf), NGETTEXT(msg_single, msg_plural, sub_nlines), sub_nsubs, (long)sub_nlines); @@ -5388,7 +5388,7 @@ ex_global(exarg_T *eap) which_pat = RE_LAST; // default: use last used regexp #ifdef FEAT_EVAL - if (in_vim9script() && check_global_and_subst(eap->cmd, eap->arg) == FAIL) + if (in_mnv9script() && check_global_and_subst(eap->cmd, eap->arg) == FAIL) return; #endif @@ -5400,7 +5400,7 @@ ex_global(exarg_T *eap) if (*cmd == '\\') { ++cmd; - if (vim_strchr((char_u *)"/?&", *cmd) == NULL) + if (mnv_strchr((char_u *)"/?&", *cmd) == NULL) { emsg(_(e_backslash_should_be_followed_by)); return; @@ -5443,7 +5443,7 @@ ex_global(exarg_T *eap) if (global_busy) { lnum = curwin->w_cursor.lnum; - match = vim_regexec_multi(®match, curwin, curbuf, lnum, + match = mnv_regexec_multi(®match, curwin, curbuf, lnum, (colnr_T)0, NULL); if ((type == 'g' && match) || (type == 'v' && !match)) global_exe_one(cmd, lnum); @@ -5456,7 +5456,7 @@ ex_global(exarg_T *eap) for (lnum = eap->line1; lnum <= eap->line2 && !got_int; ++lnum) { // a match on this line? - match = vim_regexec_multi(®match, curwin, curbuf, lnum, + match = mnv_regexec_multi(®match, curwin, curbuf, lnum, (colnr_T)0, NULL); if (regmatch.regprog == NULL) break; // re-compiling regprog failed @@ -5477,14 +5477,14 @@ ex_global(exarg_T *eap) { if (type == 'v') { - if (in_vim9script()) + if (in_mnv9script()) semsg(_(e_pattern_found_in_every_line_str), used_pat); else smsg(_("Pattern found in every line: %s"), used_pat); } else { - if (in_vim9script()) + if (in_mnv9script()) semsg(_(e_pattern_not_found_str), used_pat); else smsg(_("Pattern not found: %s"), used_pat); @@ -5510,7 +5510,7 @@ ex_global(exarg_T *eap) ml_clearmarked(); // clear rest of the marks } - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); } /* @@ -5567,7 +5567,7 @@ global_exe(char_u *cmd) msgmore(curbuf->b_ml.ml_line_count - old_lcount); } -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO /* * Get the previous substitute pattern. */ @@ -5583,16 +5583,16 @@ get_old_sub(void) void set_old_sub(char_u *val) { - vim_free(old_sub); + mnv_free(old_sub); old_sub = val; } -#endif // FEAT_VIMINFO +#endif // FEAT_MNVINFO #if defined(EXITFREE) void free_old_sub(void) { - vim_free(old_sub); + mnv_free(old_sub); } #endif @@ -5803,30 +5803,30 @@ ex_drop(exarg_T *eap) } /* - * Skip over the pattern argument of ":vimgrep /pat/[g][j]". + * Skip over the pattern argument of ":mnvgrep /pat/[g][j]". * Put the start of the pattern in "*s", unless "s" is NULL. * If "flags" is not NULL put the flags in it: VGR_GLOBAL, VGR_NOJUMP. * If "s" is not NULL terminate the pattern with a NUL. * Return a pointer to the char just past the pattern plus flags. */ char_u * -skip_vimgrep_pat(char_u *p, char_u **s, int *flags) +skip_mnvgrep_pat(char_u *p, char_u **s, int *flags) { - return skip_vimgrep_pat_ext(p, s, flags, NULL, NULL); + return skip_mnvgrep_pat_ext(p, s, flags, NULL, NULL); } /* - * As skip_vimgrep_pat() and store the character overwritten by NUL in "cp" + * As skip_mnvgrep_pat() and store the character overwritten by NUL in "cp" * and the pointer to it in "nulp". */ char_u * -skip_vimgrep_pat_ext(char_u *p, char_u **s, int *flags, char_u **nulp, int *cp) +skip_mnvgrep_pat_ext(char_u *p, char_u **s, int *flags, char_u **nulp, int *cp) { int c; - if (vim_isIDc(*p)) + if (mnv_isIDc(*p)) { - // ":vimgrep pattern fname" + // ":mnvgrep pattern fname" if (s != NULL) *s = p; p = skiptowhite(p); @@ -5842,7 +5842,7 @@ skip_vimgrep_pat_ext(char_u *p, char_u **s, int *flags, char_u **nulp, int *cp) } else { - // ":vimgrep /pattern/[g][j] fname" + // ":mnvgrep /pattern/[g][j] fname" if (s != NULL) *s = p + 1; c = *p; @@ -5887,7 +5887,7 @@ skip_vimgrep_pat_ext(char_u *p, char_u **s, int *flags, char_u **nulp, int *cp) void ex_oldfiles(exarg_T *eap UNUSED) { - list_T *l = get_vim_var_list(VV_OLDFILES); + list_T *l = get_mnv_var_list(VV_OLDFILES); listitem_T *li; int nr = 0; char_u *fname; @@ -5942,7 +5942,7 @@ ex_oldfiles(exarg_T *eap UNUSED) msg_starthere(); if (nr > 0) { - char_u *p = list_find_str(get_vim_var_list(VV_OLDFILES), + char_u *p = list_find_str(get_mnv_var_list(VV_OLDFILES), (long)nr); if (p != NULL) @@ -5952,7 +5952,7 @@ ex_oldfiles(exarg_T *eap UNUSED) eap->cmdidx = CMD_edit; cmdmod.cmod_flags &= ~CMOD_BROWSE; do_exedit(eap, NULL); - vim_free(p); + mnv_free(p); } } } diff --git a/uvim/src/ex_cmds.h b/uvim/src/ex_cmds.h index 7613d18aa1..8202d75840 100644 --- a/uvim/src/ex_cmds.h +++ b/uvim/src/ex_cmds.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* @@ -58,7 +58,7 @@ #define EX_NONWHITE_OK 0x2000000 // command can be followed by non-white #define EX_KEEPSCRIPT 0x4000000 // keep sctx of where command was invoked #define EX_EXPR_ARG 0x8000000 // argument is an expression -#define EX_WHOLE 0x10000000 // command name cannot be shortened in Vim9 +#define EX_WHOLE 0x10000000 // command name cannot be shortened in MNV9 #define EX_EXPORT 0x20000000 // command can be used after :export #define EX_FILES (EX_XFILE | EX_EXTRA) // multiple extra files allowed @@ -686,7 +686,7 @@ EXCMD(CMD_grepadd, "grepadd", ex_make, EXCMD(CMD_gui, "gui", ex_gui, EX_BANG|EX_FILES|EX_CMDARG|EX_ARGOPT|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK, ADDR_NONE), -EXCMD(CMD_gvim, "gvim", ex_gui, +EXCMD(CMD_gmnv, "gmnv", ex_gui, EX_BANG|EX_FILES|EX_CMDARG|EX_ARGOPT|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK, ADDR_NONE), EXCMD(CMD_help, "help", ex_help, @@ -980,10 +980,10 @@ EXCMD(CMD_luado, "luado", ex_luado, EXCMD(CMD_luafile, "luafile", ex_luafile, EX_RANGE|EX_FILE1|EX_NEEDARG|EX_CMDWIN|EX_LOCK_OK|EX_RESTRICT, ADDR_LINES), -EXCMD(CMD_lvimgrep, "lvimgrep", ex_vimgrep, +EXCMD(CMD_lmnvgrep, "lmnvgrep", ex_mnvgrep, EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE|EX_LOCK_OK, ADDR_OTHER), -EXCMD(CMD_lvimgrepadd, "lvimgrepadd", ex_vimgrep, +EXCMD(CMD_lmnvgrepadd, "lmnvgrepadd", ex_mnvgrep, EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE|EX_LOCK_OK, ADDR_OTHER), EXCMD(CMD_lwindow, "lwindow", ex_cwindow, @@ -1031,7 +1031,7 @@ EXCMD(CMD_mksession, "mksession", ex_mkrc, EXCMD(CMD_mkspell, "mkspell", ex_mkspell, EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE, ADDR_NONE), -EXCMD(CMD_mkvimrc, "mkvimrc", ex_mkrc, +EXCMD(CMD_mkmnvrc, "mkmnvrc", ex_mkrc, EX_BANG|EX_FILE1|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK, ADDR_NONE), EXCMD(CMD_mkview, "mkview", ex_mkrc, @@ -1334,7 +1334,7 @@ EXCMD(CMD_rubyfile, "rubyfile", ex_rubyfile, EXCMD(CMD_rundo, "rundo", ex_rundo, EX_NEEDARG|EX_FILE1, ADDR_NONE), -EXCMD(CMD_rviminfo, "rviminfo", ex_viminfo, +EXCMD(CMD_rmnvinfo, "rmnvinfo", ex_mnvinfo, EX_BANG|EX_FILE1|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK, ADDR_NONE), EXCMD(CMD_substitute, "substitute", ex_substitute, @@ -1745,16 +1745,16 @@ EXCMD(CMD_visual, "visual", ex_edit, EXCMD(CMD_view, "view", ex_edit, EX_BANG|EX_FILE1|EX_CMDARG|EX_ARGOPT|EX_TRLBAR, ADDR_NONE), -EXCMD(CMD_vimgrep, "vimgrep", ex_vimgrep, +EXCMD(CMD_mnvgrep, "mnvgrep", ex_mnvgrep, EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE|EX_LOCK_OK, ADDR_OTHER), -EXCMD(CMD_vimgrepadd, "vimgrepadd", ex_vimgrep, +EXCMD(CMD_mnvgrepadd, "mnvgrepadd", ex_mnvgrep, EX_RANGE|EX_BANG|EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_TRLBAR|EX_XFILE|EX_LOCK_OK, ADDR_OTHER), -EXCMD(CMD_vim9cmd, "vim9cmd", ex_wrongmodifier, +EXCMD(CMD_mnv9cmd, "mnv9cmd", ex_wrongmodifier, EX_NEEDARG|EX_EXTRA|EX_NOTRLCOM|EX_CMDWIN|EX_LOCK_OK, ADDR_NONE), -EXCMD(CMD_vim9script, "vim9script", ex_vim9script, +EXCMD(CMD_mnv9script, "mnv9script", ex_mnv9script, EX_WORD1|EX_CMDWIN|EX_LOCK_OK, ADDR_NONE), EXCMD(CMD_viusage, "viusage", ex_viusage, @@ -1829,7 +1829,7 @@ EXCMD(CMD_wqall, "wqall", do_wqall, EXCMD(CMD_wundo, "wundo", ex_wundo, EX_BANG|EX_NEEDARG|EX_FILE1, ADDR_NONE), -EXCMD(CMD_wviminfo, "wviminfo", ex_viminfo, +EXCMD(CMD_wmnvinfo, "wmnvinfo", ex_mnvinfo, EX_BANG|EX_FILE1|EX_TRLBAR|EX_CMDWIN|EX_LOCK_OK, ADDR_NONE), EXCMD(CMD_xit, "xit", ex_exit, diff --git a/uvim/src/ex_cmds2.c b/uvim/src/ex_cmds2.c index 7012c98962..0698491605 100644 --- a/uvim/src/ex_cmds2.c +++ b/uvim/src/ex_cmds2.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * ex_cmds2.c: some more functions for command line commands */ -#include "vim.h" +#include "mnv.h" #include "version.h" /* @@ -147,7 +147,7 @@ browse_save_fname(buf_T *buf) if (setfname(buf, fname, NULL, TRUE) == OK) buf->b_flags |= BF_NOTEDITED; - vim_free(fname); + mnv_free(fname); } # endif @@ -167,15 +167,15 @@ dialog_changed( dialog_msg(buff, _("Save changes to \"%s\"?"), buf->b_fname); if (checkall) - ret = vim_dialog_yesnoallcancel(VIM_QUESTION, NULL, buff, 1); + ret = mnv_dialog_yesnoallcancel(MNV_QUESTION, NULL, buff, 1); else - ret = vim_dialog_yesnocancel(VIM_QUESTION, NULL, buff, 1); + ret = mnv_dialog_yesnocancel(MNV_QUESTION, NULL, buff, 1); // Init ea pseudo-structure, this is needed for the check_overwrite() // function. CLEAR_FIELD(ea); - if (ret == VIM_YES) + if (ret == MNV_YES) { int empty_bufname; @@ -198,16 +198,16 @@ dialog_changed( if (empty_bufname) { buf->b_fname = NULL; - VIM_CLEAR(buf->b_ffname); - VIM_CLEAR(buf->b_sfname); + MNV_CLEAR(buf->b_ffname); + MNV_CLEAR(buf->b_sfname); unchanged(buf, TRUE, FALSE); } } - else if (ret == VIM_NO) + else if (ret == MNV_NO) { unchanged(buf, TRUE, FALSE); } - else if (ret == VIM_ALL) + else if (ret == MNV_ALL) { /* * Write all modified files that can be written. @@ -243,7 +243,7 @@ dialog_changed( } } } - else if (ret == VIM_DISCARDALL) + else if (ret == MNV_DISCARDALL) { /* * mark all buffers as unchanged @@ -422,7 +422,7 @@ buf_found: set_curbuf(buf, unload ? DOBUF_UNLOAD : DOBUF_GOTO); theend: - vim_free(bufnrs); + mnv_free(bufnrs); return ret; } @@ -782,7 +782,7 @@ ex_compiler(exarg_T *eap) if (*eap->arg == NUL) { // List all compiler scripts. - do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')"); + do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.mnv')"); // ) keep the indenter happy... return; } @@ -807,17 +807,17 @@ ex_compiler(exarg_T *eap) // Explicitly prepend "g:" to make it work in a function. old_cur_comp = get_var_value((char_u *)"g:current_compiler"); if (old_cur_comp != NULL) - old_cur_comp = vim_strsave(old_cur_comp); + old_cur_comp = mnv_strsave(old_cur_comp); do_cmdline_cmd((char_u *) "command -nargs=* -keepscript CompilerSet setlocal "); } do_unlet((char_u *)"g:current_compiler", TRUE); do_unlet((char_u *)"b:current_compiler", TRUE); - sprintf((char *)buf, "compiler/%s.vim", eap->arg); + sprintf((char *)buf, "compiler/%s.mnv", eap->arg); if (source_runtime(buf, DIP_ALL) == FAIL) semsg(_(e_compiler_not_supported_str), eap->arg); - vim_free(buf); + mnv_free(buf); do_cmdline_cmd((char_u *)":delcommand CompilerSet"); @@ -833,7 +833,7 @@ ex_compiler(exarg_T *eap) { set_internal_string_var((char_u *)"g:current_compiler", old_cur_comp); - vim_free(old_cur_comp); + mnv_free(old_cur_comp); } else do_unlet((char_u *)"g:current_compiler", TRUE); @@ -886,7 +886,7 @@ requires_py_version(char_u *filename) for (i = 0; i < lines; i++) { - if (vim_fgets(IObuff, IOSIZE, file)) + if (mnv_fgets(IObuff, IOSIZE, file)) break; if (i == 0 && IObuff[0] == '#' && IObuff[1] == '!') { @@ -959,7 +959,7 @@ source_pyx_file(exarg_T *eap, char_u *fname) # ifdef FEAT_PYTHON ex_pyfile(&ex); # else - vim_snprintf((char *)IObuff, IOSIZE, + mnv_snprintf((char *)IObuff, IOSIZE, _("W20: Required python version 2.x not supported, ignoring file: %s"), fname); msg((char *)IObuff); @@ -971,7 +971,7 @@ source_pyx_file(exarg_T *eap, char_u *fname) # ifdef FEAT_PYTHON3 ex_py3file(&ex); # else - vim_snprintf((char *)IObuff, IOSIZE, + mnv_snprintf((char *)IObuff, IOSIZE, _("W21: Required python version 3.x not supported, ignoring file: %s"), fname); msg((char *)IObuff); diff --git a/uvim/src/ex_docmd.c b/uvim/src/ex_docmd.c index 7dfc1d56c9..5c3e044196 100644 --- a/uvim/src/ex_docmd.c +++ b/uvim/src/ex_docmd.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * ex_docmd.c: functions for executing an Ex command line. */ -#include "vim.h" +#include "mnv.h" static int quitmore = 0; static int ex_pressedreturn = FALSE; @@ -55,7 +55,7 @@ static int getargopt(exarg_T *eap); # define qf_age ex_ni # define qf_history ex_ni # define ex_helpgrep ex_ni -# define ex_vimgrep ex_ni +# define ex_mnvgrep ex_ni # define ex_cclose ex_ni # define ex_copen ex_ni # define ex_cwindow ex_ni @@ -316,8 +316,8 @@ static void ex_tag_cmd(exarg_T *eap, char_u *name); #ifndef FEAT_SESSION # define ex_loadview ex_ni #endif -#ifndef FEAT_VIMINFO -# define ex_viminfo ex_ni +#ifndef FEAT_MNVINFO +# define ex_mnvinfo ex_ni #endif static void ex_behave(exarg_T *eap); static void ex_filetype(exarg_T *eap); @@ -521,7 +521,7 @@ do_exmode( varnumber_T changedtick; if (improved) - exmode_active = EXMODE_VIM; + exmode_active = EXMODE_MNV; else exmode_active = EXMODE_NORMAL; State = MODE_NORMAL; @@ -638,7 +638,7 @@ do_cmdline_cmd(char_u *cmd) /* * Execute the "+cmd" argument of "edit +cmd fname" and the like. - * This allows for using a range without ":" in Vim9 script. + * This allows for using a range without ":" in MNV9 script. */ static int do_cmd_argument(char_u *cmd) @@ -847,7 +847,7 @@ do_cmdline( { // Each '|' separated command is stored separately in lines_ga, to // be able to jump to it. Don't use next_cmdline now. - VIM_CLEAR(cmdline_copy); + MNV_CLEAR(cmdline_copy); // Check if a function has returned or, unless it has an unclosed // try conditional, aborted. @@ -927,7 +927,7 @@ do_cmdline( #else 0 #endif - , in_vim9script() ? GETLINE_CONCAT_CONTBAR + , in_mnv9script() ? GETLINE_CONCAT_CONTBAR : GETLINE_CONCAT_CONT)) == NULL) { // Don't call wait_return() for aborted command line. The NULL @@ -945,9 +945,9 @@ do_cmdline( */ if (flags & DOCMD_KEEPLINE) { - vim_free(repeat_cmdline); + mnv_free(repeat_cmdline); if (count == 0) - repeat_cmdline = vim_strsave(next_cmdline); + repeat_cmdline = mnv_strsave(next_cmdline); else repeat_cmdline = NULL; } @@ -956,7 +956,7 @@ do_cmdline( // 3. Make a copy of the command so we can mess with it. else if (cmdline_copy == NULL) { - next_cmdline = vim_strsave(next_cmdline); + next_cmdline = mnv_strsave(next_cmdline); if (next_cmdline == NULL) { emsg(_(e_out_of_memory)); @@ -1054,7 +1054,7 @@ do_cmdline( if (next_cmdline == NULL) { - VIM_CLEAR(cmdline_copy); + MNV_CLEAR(cmdline_copy); /* * If the command was typed, remember it for the ':' register. @@ -1063,7 +1063,7 @@ do_cmdline( if (getline_equal(fgetline, cookie, getexline) && new_last_cmdline != NULL) { - vim_free(last_cmdline); + mnv_free(last_cmdline); last_cmdline = new_last_cmdline; new_last_cmdline = NULL; } @@ -1215,7 +1215,7 @@ do_cmdline( */ while (!((got_int #ifdef FEAT_EVAL - || (did_emsg && (force_abort || in_vim9script())) + || (did_emsg && (force_abort || in_mnv9script())) || did_throw #endif ) @@ -1239,7 +1239,7 @@ do_cmdline( #endif || (flags & DOCMD_REPEAT))); - vim_free(cmdline_copy); + mnv_free(cmdline_copy); did_emsg_syntax = FALSE; #ifdef FEAT_EVAL free_cmdlines(&lines_ga); @@ -1250,11 +1250,11 @@ do_cmdline( /* * If a sourced file or executed function ran to its end, report the * unclosed conditional. - * In Vim9 script do not give a second error, executing aborts after + * In MNV9 script do not give a second error, executing aborts after * the first one. */ if (!got_int && !did_throw && !aborting() - && !(did_emsg && in_vim9script()) + && !(did_emsg && in_mnv9script()) && ((getline_equal(fgetline, cookie, getsourceline) && !source_finished(fgetline, cookie)) || (getline_equal(fgetline, cookie, get_func_line) @@ -1374,7 +1374,7 @@ do_cmdline( for (elem = cstack.cs_emsg_silent_list; elem != NULL; elem = temp) { temp = elem->next; - vim_free(elem); + mnv_free(elem); } } #endif // FEAT_EVAL @@ -1450,10 +1450,10 @@ handle_did_throw(void) switch (current_exception->type) { case ET_USER: - vim_snprintf((char *)IObuff, IOSIZE, + mnv_snprintf((char *)IObuff, IOSIZE, _(e_exception_not_caught_str), current_exception->value); - p = (char *)vim_strsave(IObuff); + p = (char *)mnv_strsave(IObuff); break; case ET_ERROR: messages = current_exception->messages; @@ -1486,9 +1486,9 @@ handle_did_throw(void) estack_compiling = messages->msg_compiling; emsg(messages->msg); - vim_free(messages->msg); - vim_free(messages->sfile); - vim_free(messages); + mnv_free(messages->msg); + mnv_free(messages->sfile); + mnv_free(messages); messages = next; estack_compiling = save_compiling; } @@ -1497,9 +1497,9 @@ handle_did_throw(void) else if (p != NULL) { emsg(p); - vim_free(p); + mnv_free(p); } - vim_free(SOURCING_NAME); + mnv_free(SOURCING_NAME); ESTACK_CHECK_NOW; estack_pop(); } @@ -1534,7 +1534,7 @@ get_loop_line(int c, void *cookie, int indent, getline_opt_T options) ++cp->current_line; wp = (wcmd_T *)(cp->lines_gap->ga_data) + cp->current_line; SOURCING_LNUM = wp->lnum; - return vim_strsave(wp->line); + return mnv_strsave(wp->line); } /* @@ -1545,7 +1545,7 @@ store_loop_line(garray_T *gap, char_u *line) { if (ga_grow(gap, 1) == FAIL) return FAIL; - ((wcmd_T *)(gap->ga_data))[gap->ga_len].line = vim_strsave(line); + ((wcmd_T *)(gap->ga_data))[gap->ga_len].line = mnv_strsave(line); ((wcmd_T *)(gap->ga_data))[gap->ga_len].lnum = SOURCING_LNUM; ++gap->ga_len; return OK; @@ -1559,7 +1559,7 @@ free_cmdlines(garray_T *gap) { while (gap->ga_len > 0) { - vim_free(((wcmd_T *)(gap->ga_data))[gap->ga_len - 1].line); + mnv_free(((wcmd_T *)(gap->ga_data))[gap->ga_len - 1].line); --gap->ga_len; } } @@ -1741,7 +1741,7 @@ current_tab_nr(tabpage_T *tab) static int comment_start(char_u *p, int starts_with_colon UNUSED) { - if (in_vim9script()) + if (in_mnv9script()) return p[0] == '#' && !starts_with_colon; return *p == '"'; } @@ -1857,17 +1857,17 @@ do_one_cmd( */ cmd = ea.cmd; - // In Vim9 script a colon is required before the range. This may also be + // In MNV9 script a colon is required before the range. This may also be // after command modifiers. - int vim9script = in_vim9script(); - if (vim9script && (flags & DOCMD_RANGEOK) == 0) + int mnv9script = in_mnv9script(); + if (mnv9script && (flags & DOCMD_RANGEOK) == 0) { may_have_range = FALSE; for (p = ea.cmd; p >= *cmdlinep; --p) { if (*p == ':') may_have_range = TRUE; - if (p < ea.cmd && !VIM_ISWHITE(*p)) + if (p < ea.cmd && !MNV_ISWHITE(*p)) break; } } @@ -1881,11 +1881,11 @@ do_one_cmd( // ":export var Name: type" // ":export def Name(..." // etc. - if (vim9script && checkforcmd_noparen(&ea.cmd, "export", 6)) + if (mnv9script && checkforcmd_noparen(&ea.cmd, "export", 6)) is_export = TRUE; #endif - if (vim9script && !may_have_range) + if (mnv9script && !may_have_range) { if (ea.cmd == cmd + 1 && *cmd == '$') // should be "$VAR = val" @@ -2021,8 +2021,8 @@ do_one_cmd( /* * strange vi behaviour: * ":3" jumps to line 3 - * ":3|..." prints line 3 (not in Vim9 script) - * ":|" prints current line (not in Vim9 script) + * ":3|..." prints line 3 (not in MNV9 script) + * ":|" prints current line (not in MNV9 script) */ if (ea.skip) // skip this if inside :if goto doend; @@ -2041,9 +2041,9 @@ do_one_cmd( p = ea.cmd; while (ASCII_ISALNUM(*p)) ++p; - p = vim_strnsave(ea.cmd, p - ea.cmd); + p = mnv_strnsave(ea.cmd, p - ea.cmd); ret = apply_autocmds(EVENT_CMDUNDEFINED, p, p, TRUE, NULL); - vim_free(p); + mnv_free(p); // If the autocommands did something and didn't cause an error, try // finding the command again. p = (ret @@ -2139,7 +2139,7 @@ do_one_cmd( #endif if (restricted != 0 && (ea.argt & EX_RESTRICT)) { - errormsg = _(e_command_not_allowed_in_rvim); + errormsg = _(e_command_not_allowed_in_rmnv); goto doend; } if (!curbuf->b_p_ma && (ea.argt & EX_MODIFY)) @@ -2370,7 +2370,7 @@ do_one_cmd( && *ea.arg != NUL // Do not allow register = for user commands && (!IS_USER_CMDIDX(ea.cmdidx) || *ea.arg != '=') - && !((ea.argt & EX_COUNT) && VIM_ISDIGIT(*ea.arg))) + && !((ea.argt & EX_COUNT) && MNV_ISDIGIT(*ea.arg))) { #if !defined(FEAT_CLIPBOARD) && !defined(FEAT_CLIPBOARD_PROVIDER) // check these explicitly for a more specific error message @@ -2390,7 +2390,7 @@ do_one_cmd( { if (!ea.skip) { - set_expr_line(vim_strsave(ea.arg), &ea); + set_expr_line(mnv_strsave(ea.arg), &ea); did_set_expr_line = TRUE; } ea.arg += STRLEN(ea.arg); @@ -2404,9 +2404,9 @@ do_one_cmd( * Check for a count. When accepting a EX_BUFNAME, don't use "123foo" as a * count, it's a buffer name. */ - if ((ea.argt & EX_COUNT) && VIM_ISDIGIT(*ea.arg) + if ((ea.argt & EX_COUNT) && MNV_ISDIGIT(*ea.arg) && (!(ea.argt & EX_BUFNAME) || *(p = skipdigits(ea.arg + 1)) == NUL - || VIM_ISWHITE(*p))) + || MNV_ISWHITE(*p))) { n = getdigits_quoted(&ea.arg); ea.arg = skipwhite(ea.arg); @@ -2589,7 +2589,7 @@ do_one_cmd( else { p = ea.arg + STRLEN(ea.arg); - while (p > ea.arg && VIM_ISWHITE(p[-1])) + while (p > ea.arg && MNV_ISWHITE(p[-1])) --p; } ea.line2 = buflist_findpat(ea.arg, p, (ea.argt & EX_BUFUNL) != 0, @@ -2641,7 +2641,7 @@ do_one_cmd( is_export = FALSE; } - // Set flag that any command was executed, used by ex_vim9script(). + // Set flag that any command was executed, used by ex_mnv9script(). // Not if this was a command that wasn't executed or :endif. if (sourcing_a_script(&ea) && current_sctx.sc_sid > 0 @@ -2710,7 +2710,7 @@ doend: #ifdef FEAT_EVAL --ex_nesting_level; - vim_free(ea.cmdline_tofree); + mnv_free(ea.cmdline_tofree); #endif return ea.nextcmd; @@ -2726,7 +2726,7 @@ static char ex_error_buf[MSG_BUF_LEN]; char * ex_errmsg(char *msg, char_u *arg) { - vim_snprintf(ex_error_buf, MSG_BUF_LEN, _(msg), arg); + mnv_snprintf(ex_error_buf, MSG_BUF_LEN, _(msg), arg); return ex_error_buf; } @@ -2748,7 +2748,7 @@ ex_range_without_command(exarg_T *eap) if ((*eap->cmd == '|' || (exmode_active && eap->cmd != (char_u *)exmode_plus + 1)) #ifdef FEAT_EVAL - && !in_vim9script() + && !in_mnv9script() #endif ) { @@ -2766,7 +2766,7 @@ ex_range_without_command(exarg_T *eap) { // With '-' in 'cpoptions' a line number past the file is an // error, otherwise put it at the end of the file. - if (vim_strchr(p_cpo, CPO_MINUS) != NULL) + if (mnv_strchr(p_cpo, CPO_MINUS) != NULL) eap->line2 = -1; else eap->line2 = curbuf->b_ml.ml_line_count; @@ -2866,7 +2866,7 @@ parse_command_modifiers( char_u *cmd_start = NULL; int use_plus_cmd = FALSE; int starts_with_colon = FALSE; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); int has_visual_range = FALSE; CLEAR_POINTER(cmod); @@ -2911,10 +2911,10 @@ parse_command_modifiers( if (comment_start(eap->cmd, starts_with_colon)) { // a comment ends at a NL - eap->nextcmd = vim_strchr(eap->cmd, '\n'); + eap->nextcmd = mnv_strchr(eap->cmd, '\n'); if (eap->nextcmd != NULL) ++eap->nextcmd; - if (vim9script) + if (mnv9script) { if (has_cmdmod(cmod, FALSE)) *errormsg = _(e_command_modifier_without_command); @@ -2936,7 +2936,7 @@ parse_command_modifiers( if (!skip_only) { ex_pressedreturn = TRUE; - if (vim9script && has_cmdmod(cmod, FALSE)) + if (mnv9script && has_cmdmod(cmod, FALSE)) *errormsg = _(e_command_modifier_without_command); } return FAIL; @@ -2944,7 +2944,7 @@ parse_command_modifiers( p = skip_range(eap->cmd, TRUE, NULL); - // In Vim9 script a variable can shadow a command modifier: + // In MNV9 script a variable can shadow a command modifier: // verbose = 123 // verbose += 123 // silent! verbose = func() @@ -2952,7 +2952,7 @@ parse_command_modifiers( // verbose[expr] = 2 // But not: // verbose [a, b] = list - if (vim9script) + if (mnv9script) { char_u *s, *n; @@ -3028,7 +3028,7 @@ parse_command_modifiers( #ifdef FEAT_EVAL // in ":filter #pat# cmd" # does not // start a comment - && (!vim9script || VIM_ISWHITE(p[1])) + && (!mnv9script || MNV_ISWHITE(p[1])) #endif )) break; @@ -3041,21 +3041,21 @@ parse_command_modifiers( } #ifdef FEAT_EVAL // Avoid that "filter(arg)" is recognized. - if (vim9script && !VIM_ISWHITE(p[-1])) + if (mnv9script && !MNV_ISWHITE(p[-1])) break; #endif if (skip_only) - p = skip_vimgrep_pat(p, NULL, NULL); + p = skip_mnvgrep_pat(p, NULL, NULL); else // NOTE: This puts a NUL after the pattern. - p = skip_vimgrep_pat_ext(p, ®_pat, NULL, + p = skip_mnvgrep_pat_ext(p, ®_pat, NULL, &nulp, &c); if (p == NULL || *p == NUL) break; if (!skip_only) { cmod->cmod_filter_regmatch.regprog = - vim_regcomp(reg_pat, RE_MAGIC); + mnv_regcomp(reg_pat, RE_MAGIC); if (cmod->cmod_filter_regmatch.regprog == NULL) break; // restore the character overwritten by NUL @@ -3124,7 +3124,7 @@ parse_command_modifiers( if (!checkforcmd_noparen(&eap->cmd, "silent", 3)) break; cmod->cmod_flags |= CMOD_SILENT; - if (*eap->cmd == '!' && !VIM_ISWHITE(eap->cmd[-1])) + if (*eap->cmd == '!' && !MNV_ISWHITE(eap->cmd[-1])) { // ":silent!", but not "silent !cmd" eap->cmd = skipwhite(eap->cmd + 1); @@ -3169,20 +3169,20 @@ parse_command_modifiers( cmod->cmod_split |= WSP_VERT; continue; } - if (checkforcmd_noparen(&eap->cmd, "vim9cmd", 4)) + if (checkforcmd_noparen(&eap->cmd, "mnv9cmd", 4)) { if (ends_excmd2(p, eap->cmd)) { *errormsg = - _(e_vim9cmd_must_be_followed_by_command); + _(e_mnv9cmd_must_be_followed_by_command); return FAIL; } - cmod->cmod_flags |= CMOD_VIM9CMD; + cmod->cmod_flags |= CMOD_MNV9CMD; continue; } if (!checkforcmd_noparen(&p, "verbose", 4)) break; - if (vim_isdigit(*eap->cmd)) + if (mnv_isdigit(*eap->cmd)) { // zero means not set, one is verbose == 0, etc. cmod->cmod_verbose = atoi((char *)eap->cmd) + 1; @@ -3252,12 +3252,12 @@ has_cmdmod(cmdmod_T *cmod, int ignore_silent) #if defined(FEAT_EVAL) /* - * If Vim9 script and "cmdmod" has anything set give an error and return TRUE. + * If MNV9 script and "cmdmod" has anything set give an error and return TRUE. */ int cmdmod_error(int ignore_silent) { - if (in_vim9script() && has_cmdmod(&cmdmod, ignore_silent)) + if (in_mnv9script() && has_cmdmod(&cmdmod, ignore_silent)) { emsg(_(e_misplaced_command_modifier)); return TRUE; @@ -3308,7 +3308,7 @@ apply_cmdmod(cmdmod_T *cmod) { // Set 'eventignore' to "all". // First save the existing option value for restoring it later. - cmod->cmod_save_ei = vim_strsave(p_ei); + cmod->cmod_save_ei = mnv_strsave(p_ei); set_string_option_direct((char_u *)"ei", -1, (char_u *)"all", OPT_FREE, SID_NONE); } @@ -3343,7 +3343,7 @@ undo_cmdmod(cmdmod_T *cmod) cmod->cmod_save_ei = NULL; } - vim_regfree(cmod->cmod_filter_regmatch.regprog); + mnv_regfree(cmod->cmod_filter_regmatch.regprog); if (cmod->cmod_save_msg_silent > 0) { @@ -3432,7 +3432,7 @@ parse_cmd_address(exarg_T *eap, char **errormsg, int silent) } else { - // there is no Vim command which uses '%' and + // there is no MNV command which uses '%' and // ADDR_WINDOWS or ADDR_TABS *errormsg = _(e_invalid_range); goto theend; @@ -3466,7 +3466,7 @@ parse_cmd_address(exarg_T *eap, char **errormsg, int silent) } ++eap->addr_count; } - else if (*eap->cmd == '*' && vim_strchr(p_cpo, CPO_STAR) == NULL) + else if (*eap->cmd == '*' && mnv_strchr(p_cpo, CPO_STAR) == NULL) { pos_T *fp; @@ -3596,7 +3596,7 @@ skip_option_env_lead(char_u *start) /* * Return TRUE and set "*idx" if "p" points to a one letter command. - * If not in Vim9 script: + * If not in MNV9 script: * - The 'k' command can directly be followed by any character * but :keepa[lt] is another command, as are :keepj[umps], * :kee[pmarks] and :keepp[atterns]. @@ -3607,7 +3607,7 @@ skip_option_env_lead(char_u *start) static int one_letter_cmd(char_u *p, cmdidx_T *idx) { - if (in_vim9script()) + if (in_mnv9script()) return FALSE; if (p[0] == 'k' && (p[1] != 'e' || (p[1] == 'e' && p[2] != 'e'))) @@ -3666,12 +3666,12 @@ find_ex_command( char_u *p; int i; #ifndef FEAT_EVAL - int vim9 = FALSE; + int mnv9 = FALSE; #else - int vim9 = in_vim9script(); + int mnv9 = in_mnv9script(); /* - * Recognize a Vim9 script function/method call and assignment: + * Recognize a MNV9 script function/method call and assignment: * "lvar = value", "lvar(arg)", "[1, 2 3]->Func()" */ p = eap->cmd; @@ -3679,7 +3679,7 @@ find_ex_command( { char_u *pskip = skip_option_env_lead(eap->cmd); - if (vim_strchr((char_u *)"{('[\"@&$", *p) != NULL + if (mnv_strchr((char_u *)"{('[\"@&$", *p) != NULL || ((p = to_name_const_end(pskip)) > eap->cmd && *p != NUL) || (p[0] == '0' && p[1] == 'z')) { @@ -3715,7 +3715,7 @@ find_ex_command( // "&option" can be followed by "->" or "=", check below } - if (vim9 && *p == '<') + if (mnv9 && *p == '<') { // generic function type args if (skip_generic_func_type_args(&p) == FAIL) @@ -3816,7 +3816,7 @@ find_ex_command( if (eq != NULL) { eq = skipwhite(eq); - if (vim_strchr((char_u *)"+-*/%.", *eq) != NULL) + if (mnv_strchr((char_u *)"+-*/%.", *eq) != NULL) { if (eq[0] == '.' && eq[1] == '.') ++eq; @@ -3877,7 +3877,7 @@ find_ex_command( // "g:", "s:" and "l:" are always assumed to be a variable, thus start // an expression. A global/substitute/list command needs to use a // longer name. - if (vim_strchr((char_u *)"gsl", *p) != NULL && p[1] == ':') + if (mnv_strchr((char_u *)"gsl", *p) != NULL && p[1] == ':') { eap->cmdidx = CMD_eval; return eap->cmd; @@ -3923,21 +3923,21 @@ find_ex_command( while (ASCII_ISALNUM(*p)) ++p; } - else if (*p == '9' && STRNCMP("vim9", eap->cmd, 4) == 0) + else if (*p == '9' && STRNCMP("mnv9", eap->cmd, 4) == 0) { - // include "9" for "vim9*" commands; "vim9cmd" and "vim9script". + // include "9" for "mnv9*" commands; "mnv9cmd" and "mnv9script". ++p; while (ASCII_ISALPHA(*p)) ++p; } // check for non-alpha command - if (p == eap->cmd && vim_strchr((char_u *)"@*!=><&~#}", *p) != NULL) + if (p == eap->cmd && mnv_strchr((char_u *)"@*!=><&~#}", *p) != NULL) ++p; len = (int)(p - eap->cmd); // The "d" command can directly be followed by 'l' or 'p' flag, when - // not in Vim9 script. - if (!vim9 && *eap->cmd == 'd' && (p[-1] == 'l' || p[-1] == 'p')) + // not in MNV9 script. + if (!mnv9 && *eap->cmd == 'd' && (p[-1] == 'l' || p[-1] == 'p')) { // Check for ":dl", ":dell", etc. to ":deletel": that's // :delete with the 'l' flag. Same for 'p'. @@ -3988,9 +3988,9 @@ find_ex_command( break; } - // :Print and :mode are not supported in Vim9 script. - // Some commands cannot be shortened in Vim9 script. - if (vim9 && eap->cmdidx != CMD_SIZE) + // :Print and :mode are not supported in MNV9 script. + // Some commands cannot be shortened in MNV9 script. + if (mnv9 && eap->cmdidx != CMD_SIZE) { if (eap->cmdidx == CMD_mode || eap->cmdidx == CMD_Print) eap->cmdidx = CMD_SIZE; @@ -4004,7 +4004,7 @@ find_ex_command( // Do not recognize ":*" as the star command unless '*' is in // 'cpoptions'. - if (eap->cmdidx == CMD_star && vim_strchr(p_cpo, CPO_STAR) == NULL) + if (eap->cmdidx == CMD_star && mnv_strchr(p_cpo, CPO_STAR) == NULL) p = eap->cmd; // Look for a user defined command as a last resort. Let ":Print" be @@ -4022,21 +4022,21 @@ find_ex_command( } // ":fina" means ":finally" in legacy script, for backwards compatibility. - if (eap->cmdidx == CMD_final && p - eap->cmd == 4 && !vim9) + if (eap->cmdidx == CMD_final && p - eap->cmd == 4 && !mnv9) eap->cmdidx = CMD_finally; #ifdef FEAT_EVAL if (eap->cmdidx < CMD_SIZE - && vim9 + && mnv9 && !IS_WHITE_NL_OR_NUL(*p) && *p != '!' && *p != '|' && (eap->cmdidx < 0 || (cmdnames[eap->cmdidx].cmd_argt & EX_NONWHITE_OK) == 0)) { - char_u *cmd = vim_strnsave(eap->cmd, p - eap->cmd); + char_u *cmd = mnv_strnsave(eap->cmd, p - eap->cmd); semsg(_(e_command_str_not_followed_by_white_space_str), cmd, eap->cmd); eap->cmdidx = CMD_SIZE; - vim_free(cmd); + mnv_free(cmd); } #endif @@ -4077,7 +4077,7 @@ static cmdmod_info_T cmdmod_info_tab[] = { {"unsilent", 3, FALSE}, {"verbose", 4, TRUE}, {"vertical", 4, FALSE}, - {"vim9cmd", 4, FALSE} + {"mnv9cmd", 4, FALSE} }; // cmdmod_info_tab /* @@ -4090,7 +4090,7 @@ modifier_len(char_u *cmd) int i, j; char_u *p = cmd; - if (VIM_ISDIGIT(*cmd)) + if (MNV_ISDIGIT(*cmd)) p = skipwhite(skipdigits(cmd + 1)); for (i = 0; i < (int)ARRAY_LENGTH(cmdmod_info_tab); ++i) { @@ -4136,7 +4136,7 @@ cmd_exists(char_u *name) p = find_ex_command(&ea, &full, NULL, NULL); if (p == NULL) return 3; - if (vim_isdigit(*name) && ea.cmdidx != CMD_match) + if (mnv_isdigit(*name) && ea.cmdidx != CMD_match) return 0; if (*skipwhite(p) != NUL) return 0; // trailing garbage @@ -4152,13 +4152,13 @@ f_fullcommand(typval_T *argvars, typval_T *rettv) exarg_T ea; char_u *name; char_u *p; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); int save_cmod_flags = cmdmod.cmod_flags; rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_bool_arg(argvars, 1) == FAIL)) return; @@ -4169,9 +4169,9 @@ f_fullcommand(typval_T *argvars, typval_T *rettv) if (argvars[1].v_type != VAR_UNKNOWN) { - vim9script = tv_get_bool(&argvars[1]); - cmdmod.cmod_flags &= ~(CMOD_VIM9CMD | CMOD_LEGACY); - cmdmod.cmod_flags |= vim9script ? CMOD_VIM9CMD : CMOD_LEGACY; + mnv9script = tv_get_bool(&argvars[1]); + cmdmod.cmod_flags &= ~(CMOD_MNV9CMD | CMOD_LEGACY); + cmdmod.cmod_flags |= mnv9script ? CMOD_MNV9CMD : CMOD_LEGACY; } while (*name == ':') @@ -4181,25 +4181,25 @@ f_fullcommand(typval_T *argvars, typval_T *rettv) ea.cmd = (*name == '2' || *name == '3') ? name + 1 : name; ea.cmdidx = (cmdidx_T)0; ea.addr_count = 0; - ++emsg_silent; // don't complain about using "en" in Vim9 script + ++emsg_silent; // don't complain about using "en" in MNV9 script p = find_ex_command(&ea, NULL, NULL, NULL); --emsg_silent; if (p == NULL || ea.cmdidx == CMD_SIZE) goto theend; - if (vim9script) + if (mnv9script) { int res; ++emsg_silent; - res = not_in_vim9(&ea); + res = not_in_mnv9(&ea); --emsg_silent; if (res == FAIL) goto theend; } - rettv->vval.v_string = vim_strsave(IS_USER_CMDIDX(ea.cmdidx) + rettv->vval.v_string = mnv_strsave(IS_USER_CMDIDX(ea.cmdidx) ? get_user_command_name(ea.useridx, ea.cmdidx) : cmdnames[ea.cmdidx].cmd_name); theend: @@ -4245,7 +4245,7 @@ skip_range( char_u *cmd = cmd_start; unsigned delim; - while (vim_strchr((char_u *)" \t0123456789.$%'/?-+,;\\", *cmd) != NULL) + while (mnv_strchr((char_u *)" \t0123456789.$%'/?-+,;\\", *cmd) != NULL) { if (*cmd == '\\') { @@ -4262,10 +4262,10 @@ skip_range( while (p > cmd_start) { --p; - if (!VIM_ISWHITE(*p)) + if (!MNV_ISWHITE(*p)) break; } - if (cmd > cmd_start && !VIM_ISWHITE(*p) && *p != ',' && *p != ';') + if (cmd > cmd_start && !MNV_ISWHITE(*p) && *p != ',' && *p != ';') break; if (*++cmd == NUL && ctx != NULL) *ctx = EXPAND_NOTHING; @@ -4288,7 +4288,7 @@ skip_range( cmd = skipwhite(cmd + 1); // Skip "*" used for Visual range. - if (skip_star && *cmd == '*' && vim_strchr(p_cpo, CPO_STAR) == NULL) + if (skip_star && *cmd == '*' && mnv_strchr(p_cpo, CPO_STAR) == NULL) cmd = skipwhite(cmd + 1); return cmd; @@ -4628,14 +4628,14 @@ get_address( break; default: - if (VIM_ISDIGIT(*cmd)) // absolute line number + if (MNV_ISDIGIT(*cmd)) // absolute line number lnum = getdigits(&cmd); } for (;;) { cmd = skipwhite(cmd); - if (*cmd != '-' && *cmd != '+' && !VIM_ISDIGIT(*cmd)) + if (*cmd != '-' && *cmd != '+' && !MNV_ISDIGIT(*cmd)) break; if (lnum == MAXLNUM) @@ -4680,11 +4680,11 @@ get_address( } } - if (VIM_ISDIGIT(*cmd)) + if (MNV_ISDIGIT(*cmd)) i = '+'; // "number" is same as "+number" else i = *cmd++; - if (!VIM_ISDIGIT(*cmd)) // '+' is '+1' + if (!MNV_ISDIGIT(*cmd)) // '+' is '+1' n = 1; else { @@ -4806,7 +4806,7 @@ address_default_all(exarg_T *eap) static void get_flags(exarg_T *eap) { - while (vim_strchr((char_u *)"lp#", *eap->arg) != NULL) + while (mnv_strchr((char_u *)"lp#", *eap->arg) != NULL) { if (*eap->arg == 'l') eap->flags |= EXFLAG_LIST; @@ -4840,7 +4840,7 @@ ex_script_ni(exarg_T *eap) if (!eap->skip) ex_ni(eap); else - vim_free(script_get(eap, eap->arg)); + mnv_free(script_get(eap, eap->arg)); } #endif @@ -4958,7 +4958,7 @@ correct_range(exarg_T *eap) #ifdef FEAT_QUICKFIX /* - * For a ":vimgrep" or ":vimgrepadd" command return a pointer past the + * For a ":mnvgrep" or ":mnvgrepadd" command return a pointer past the * pattern. Otherwise return eap->arg. */ static char_u * @@ -4966,12 +4966,12 @@ skip_grep_pat(exarg_T *eap) { char_u *p = eap->arg; - if (*p != NUL && (eap->cmdidx == CMD_vimgrep || eap->cmdidx == CMD_lvimgrep - || eap->cmdidx == CMD_vimgrepadd - || eap->cmdidx == CMD_lvimgrepadd + if (*p != NUL && (eap->cmdidx == CMD_mnvgrep || eap->cmdidx == CMD_lmnvgrep + || eap->cmdidx == CMD_mnvgrepadd + || eap->cmdidx == CMD_lmnvgrepadd || grep_internal(eap->cmdidx))) { - p = skip_vimgrep_pat(p, NULL, NULL); + p = skip_mnvgrep_pat(p, NULL, NULL); if (p == NULL) p = eap->arg; } @@ -4993,7 +4993,7 @@ replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep) int i; /* - * Don't do it when ":vimgrep" is used for ":grep". + * Don't do it when ":mnvgrep" is used for ":grep". */ if ((eap->cmdidx == CMD_make || eap->cmdidx == CMD_lmake || eap->cmdidx == CMD_grep || eap->cmdidx == CMD_lgrep @@ -5054,7 +5054,7 @@ replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep) msg_make(p); // 'eap->cmd' is not set here, because it is not used at CMD_make - vim_free(*cmdlinep); + mnv_free(*cmdlinep); *cmdlinep = new_cmdline; p = new_cmdline; } @@ -5081,7 +5081,7 @@ expand_filename( int escaped; #ifdef FEAT_QUICKFIX - // Skip a regexp pattern for ":vimgrep[add] pat file..." + // Skip a regexp pattern for ":mnvgrep[add] pat file..." p = skip_grep_pat(eap); #else p = eap->arg; @@ -5110,7 +5110,7 @@ expand_filename( * Quick check if this cannot be the start of a special string. * Also removes backslash before '%', '#' and '<'. */ - if (vim_strchr((char_u *)"%#<", *p) == NULL) + if (mnv_strchr((char_u *)"%#<", *p) == NULL) { ++p; continue; @@ -5131,12 +5131,12 @@ expand_filename( // Wildcards won't be expanded below, the replacement is taken // literally. But do expand "~/file", "~user/file" and "$HOME/file". - if (vim_strchr(repl, '$') != NULL || vim_strchr(repl, '~') != NULL) + if (mnv_strchr(repl, '$') != NULL || mnv_strchr(repl, '~') != NULL) { char_u *l = repl; repl = expand_env_save(repl); - vim_free(l); + mnv_free(l); } // Need to escape white space et al. with a backslash. @@ -5172,12 +5172,12 @@ expand_filename( #endif for (l = repl; *l; ++l) - if (vim_strchr(ESCAPE_CHARS, *l) != NULL) + if (mnv_strchr(ESCAPE_CHARS, *l) != NULL) { - l = vim_strsave_escaped(repl, ESCAPE_CHARS); + l = mnv_strsave_escaped(repl, ESCAPE_CHARS); if (l != NULL) { - vim_free(repl); + mnv_free(repl); repl = l; } break; @@ -5187,20 +5187,20 @@ expand_filename( // For a shell command a '!' must be escaped. if ((eap->usefilter || eap->cmdidx == CMD_bang || eap->cmdidx == CMD_terminal) - && vim_strpbrk(repl, (char_u *)"!") != NULL) + && mnv_strpbrk(repl, (char_u *)"!") != NULL) { char_u *l; - l = vim_strsave_escaped(repl, (char_u *)"!"); + l = mnv_strsave_escaped(repl, (char_u *)"!"); if (l != NULL) { - vim_free(repl); + mnv_free(repl); repl = l; } } p = repl_cmdline(eap, p, srclen, repl, cmdlinep); - vim_free(repl); + mnv_free(repl); if (p == NULL) return FAIL; } @@ -5242,8 +5242,8 @@ expand_filename( * After expanding environment variables, check again * if there are still wildcards present. */ - if (vim_strchr(eap->arg, '$') != NULL - || vim_strchr(eap->arg, '~') != NULL) + if (mnv_strchr(eap->arg, '$') != NULL + || mnv_strchr(eap->arg, '~') != NULL) { expand_env_esc(eap->arg, NameBuff, MAXPATHL, TRUE, TRUE, NULL); @@ -5273,7 +5273,7 @@ expand_filename( (void)repl_cmdline(eap, eap->arg, STRLEN(eap->arg), p, cmdlinep); if (n == 2) // p came from ExpandOne() - vim_free(p); + mnv_free(p); } } } @@ -5340,7 +5340,7 @@ repl_cmdline( eap->arg = new_cmdline + (eap->arg - *cmdlinep); if (eap->do_ecmd_cmd != NULL && eap->do_ecmd_cmd != dollar_command) eap->do_ecmd_cmd = new_cmdline + (eap->do_ecmd_cmd - *cmdlinep); - vim_free(*cmdlinep); + mnv_free(*cmdlinep); *cmdlinep = new_cmdline; return src; @@ -5353,7 +5353,7 @@ repl_cmdline( void separate_nextcmd(exarg_T *eap, int keep_backslash) { - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); char_u *p; #ifdef FEAT_QUICKFIX @@ -5390,16 +5390,16 @@ separate_nextcmd(exarg_T *eap, int keep_backslash) // :@" and :*" do not start a comment! // :redir @" doesn't either. else if ((*p == '"' - && !vim9script + && !mnv9script && !(eap->argt & EX_NOTRLCOM) && ((eap->cmdidx != CMD_at && eap->cmdidx != CMD_star) || p != eap->arg) && (eap->cmdidx != CMD_redir || p != eap->arg + 1 || p[-1] != '@')) || (*p == '#' - && vim9script + && mnv9script && !(eap->argt & EX_NOTRLCOM) - && p > eap->cmd && VIM_ISWHITE(p[-1])) + && p > eap->cmd && MNV_ISWHITE(p[-1])) || (*p == '|' && eap->cmdidx != CMD_append && eap->cmdidx != CMD_change @@ -5410,7 +5410,7 @@ separate_nextcmd(exarg_T *eap, int keep_backslash) * We remove the '\' before the '|', unless EX_CTRLV is used * AND 'b' is present in 'cpoptions'. */ - if ((vim_strchr(p_cpo, CPO_BAR) == NULL + if ((mnv_strchr(p_cpo, CPO_BAR) == NULL || !(eap->argt & EX_CTRLV)) && *(p - 1) == '\\') { if (!keep_backslash) @@ -5444,7 +5444,7 @@ getargcmd(char_u **argp) if (*arg == '+') // +[command] { ++arg; - if (vim_isspace(*arg) || *arg == NUL) + if (mnv_isspace(*arg) || *arg == NUL) command = dollar_command; else { @@ -5468,7 +5468,7 @@ skip_cmd_arg( char_u *p, int rembs) // TRUE to halve the number of backslashes { - while (*p && !vim_isspace(*p)) + while (*p && !mnv_isspace(*p)) { if (*p == '\\' && p[1] != NUL) { @@ -5688,7 +5688,7 @@ expand_argopt( if (*matches == NULL) return FAIL; *numMatches = 1; - (*matches)[0] = vim_strsave((char_u*)"fileformat="); + (*matches)[0] = mnv_strsave((char_u*)"fileformat="); return OK; } @@ -5706,14 +5706,14 @@ expand_argopt( ex_autocmd(exarg_T *eap) { /* - * Disallow autocommands from .exrc and .vimrc in current + * Disallow autocommands from .exrc and .mnvrc in current * directory for security reasons. */ if (secure) { secure = 2; eap->errmsg = - _(e_command_not_allowed_from_vimrc_in_current_dir_or_tag_search); + _(e_command_not_allowed_from_mnvrc_in_current_dir_or_tag_search); } else if (eap->cmdidx == CMD_autocmd) do_autocmd(eap, eap->arg, eap->forceit); @@ -5863,20 +5863,20 @@ ex_blast(exarg_T *eap) /* * Check if "c" ends an Ex command. - * In Vim9 script does not check for white space before #. + * In MNV9 script does not check for white space before #. */ int ends_excmd(int c) { int comment_char = '"'; - if (in_vim9script()) + if (in_mnv9script()) comment_char = '#'; return (c == NUL || c == '|' || c == comment_char || c == '\n'); } /* - * Like ends_excmd() but checks that a # in Vim9 script either has "cmd" equal + * Like ends_excmd() but checks that a # in MNV9 script either has "cmd" equal * to "cmd_start" or has a white space character before it. */ int @@ -5886,10 +5886,10 @@ ends_excmd2(char_u *cmd_start UNUSED, char_u *cmd) if (c == NUL || c == '|' || c == '\n') return TRUE; - if (in_vim9script()) + if (in_mnv9script()) // # starts a comment, #{ might be a mistake, #{{ can start a fold return c == '#' && (cmd[1] != '{' || cmd[2] == '{') - && (cmd == cmd_start || VIM_ISWHITE(cmd[-1])); + && (cmd == cmd_start || MNV_ISWHITE(cmd[-1])); return c == '"'; } @@ -5934,9 +5934,9 @@ set_nextcmd(exarg_T *eap, char_u *arg) { char_u *p = skipwhite(arg); - if (in_vim9script() && *p == '#') + if (in_mnv9script() && *p == '#') { - char_u *nl = vim_strchr(p, NL); + char_u *nl = mnv_strchr(p, NL); if (nl != NULL) p = nl; } @@ -5976,10 +5976,10 @@ check_more( { char_u buff[DIALOG_MSG_SIZE]; - vim_snprintf((char *)buff, DIALOG_MSG_SIZE, + mnv_snprintf((char *)buff, DIALOG_MSG_SIZE, NGETTEXT("%d more file to edit. Quit anyway?", "%d more files to edit. Quit anyway?", n), n); - if (vim_dialog_yesno(VIM_QUESTION, NULL, buff, 1) == VIM_YES) + if (mnv_dialog_yesno(MNV_QUESTION, NULL, buff, 1) == MNV_YES) return OK; return FAIL; } @@ -6014,7 +6014,7 @@ ex_colorscheme(exarg_T *eap) if (*eap->arg == NUL) { #ifdef FEAT_EVAL - char_u *expr = vim_strsave((char_u *)"g:colors_name"); + char_u *expr = mnv_strsave((char_u *)"g:colors_name"); char_u *p = NULL; if (expr != NULL) @@ -6022,12 +6022,12 @@ ex_colorscheme(exarg_T *eap) ++emsg_off; p = eval_to_string(expr, FALSE, FALSE); --emsg_off; - vim_free(expr); + mnv_free(expr); } if (p != NULL) { msg((char *)p); - vim_free(p); + mnv_free(p); } else msg("default"); @@ -6052,7 +6052,7 @@ ex_colorscheme(exarg_T *eap) ex_highlight(exarg_T *eap) { if (*eap->arg == NUL && eap->cmd[2] == '!') - msg(_("Greetings, Vim user!")); + msg(_("Greetings, MNV user!")); do_highlight(eap->arg, eap->forceit, FALSE); } @@ -6096,7 +6096,7 @@ before_quit_autocmds(win_T *wp, int quit_all, int forceit) } /* - * ":quit": quit current window, quit Vim if the last window is closed. + * ":quit": quit current window, quit MNV if the last window is closed. * ":{nr}quit": quit window {nr} * Also used when closing a terminal window that's the last one. */ @@ -6436,7 +6436,7 @@ get_tabpage_arg(exarg_T *eap) char_u *cmdp = eap->cmd; while (--cmdp > *eap->cmdlinep - && (VIM_ISWHITE(*cmdp) || VIM_ISDIGIT(*cmdp))) + && (MNV_ISWHITE(*cmdp) || MNV_ISDIGIT(*cmdp))) ; if (*cmdp == '-') { @@ -6694,20 +6694,20 @@ ex_hide(exarg_T *eap UNUSED) } /* - * ":stop" and ":suspend": Suspend Vim. + * ":stop" and ":suspend": Suspend MNV. */ void ex_stop(exarg_T *eap) { /* - * Disallow suspending for "rvim". + * Disallow suspending for "rmnv". */ if (check_restricted()) return; if (!eap->forceit) autowrite_all(); - apply_autocmds(EVENT_VIMSUSPEND, NULL, NULL, FALSE, NULL); + apply_autocmds(EVENT_MNVSUSPEND, NULL, NULL, FALSE, NULL); windgoto((int)Rows - 1, cmdline_col_off); out_char('\n'); out_flush(); @@ -6721,7 +6721,7 @@ ex_stop(exarg_T *eap) scroll_start(); // scroll screen before redrawing redraw_later_clear(); shell_resized(); // may have resized window - apply_autocmds(EVENT_VIMRESUME, NULL, NULL, FALSE, NULL); + apply_autocmds(EVENT_MNVRESUME, NULL, NULL, FALSE, NULL); } /* @@ -6731,7 +6731,7 @@ ex_stop(exarg_T *eap) ex_exit(exarg_T *eap) { #ifdef FEAT_EVAL - if (not_in_vim9(eap) == FAIL) + if (not_in_mnv9(eap) == FAIL) return; #endif if (cmdwin_type != 0) @@ -6765,7 +6765,7 @@ ex_exit(exarg_T *eap) } else { - if (only_one_window()) // quit last window, exit Vim + if (only_one_window()) // quit last window, exit MNV getout(0); not_exiting(save_exiting); #ifdef FEAT_GUI @@ -6916,7 +6916,7 @@ handle_drop( if (drop_busy) { FreeWild(filec, filev); - vim_free(cookie); + mnv_free(cookie); return; } @@ -6925,7 +6925,7 @@ handle_drop( if (drop_filev != NULL) { FreeWild(drop_filec, drop_filev); - vim_free(drop_cookie); + mnv_free(drop_cookie); } drop_filec = filec; @@ -7099,7 +7099,7 @@ expand_findfunc(char_u *pat, char_u ***files, int *numMatches) { if (li->li_tv.v_type == VAR_STRING) { - (*files)[idx] = vim_strsave(li->li_tv.vval.v_string); + (*files)[idx] = mnv_strsave(li->li_tv.vval.v_string); idx++; } } @@ -7138,7 +7138,7 @@ findfunc_find_file(char_u *findarg, int findarg_len, int count) { listitem_T *li = list_find(fname_list, count - 1); if (li != NULL && li->li_tv.v_type == VAR_STRING) - ret_fname = vim_strsave(li->li_tv.vval.v_string); + ret_fname = mnv_strsave(li->li_tv.vval.v_string); } } @@ -7270,8 +7270,8 @@ ex_splitview(exarg_T *eap) fname = find_file_in_path(eap->arg, (int)STRLEN(eap->arg), FNAME_MESS, TRUE, curbuf->b_ffname, &file_to_find, &search_ctx); - vim_free(file_to_find); - vim_findfile_cleanup(search_ctx); + mnv_free(file_to_find); + mnv_findfile_cleanup(search_ctx); } if (fname == NULL) goto theend; @@ -7343,7 +7343,7 @@ ex_splitview(exarg_T *eap) #endif theend: - vim_free(fname); + mnv_free(fname); } /* @@ -7448,7 +7448,7 @@ ex_tabs(exarg_T *eap UNUSED) for (tp = first_tabpage; tp != NULL && !got_int; tp = tp->tp_next) { msg_putchar('\n'); - vim_snprintf((char *)IObuff, IOSIZE, _("Tab page %d"), tabcount++); + mnv_snprintf((char *)IObuff, IOSIZE, _("Tab page %d"), tabcount++); msg_outtrans_attr(IObuff, HL_ATTR(HLF_T)); out_flush(); // output one line at a time ui_breakcheck(); @@ -7465,7 +7465,7 @@ ex_tabs(exarg_T *eap UNUSED) msg_putchar(bufIsChanged(wp->w_buffer) ? '+' : ' '); msg_putchar(' '); if (buf_spname(wp->w_buffer) != NULL) - vim_strncpy(IObuff, buf_spname(wp->w_buffer), IOSIZE - 1); + mnv_strncpy(IObuff, buf_spname(wp->w_buffer), IOSIZE - 1); else home_replace(wp->w_buffer, wp->w_buffer->b_fname, IObuff, IOSIZE, TRUE); @@ -7560,13 +7560,13 @@ ex_find(exarg_T *eap) count = eap->line2; while (fname != NULL && --count > 0) { - vim_free(fname); + mnv_free(fname); fname = find_file_in_path(NULL, 0, FNAME_MESS, FALSE, curbuf->b_ffname, &file_to_find, &search_ctx); } } - VIM_CLEAR(file_to_find); - vim_findfile_cleanup(search_ctx); + MNV_CLEAR(file_to_find); + mnv_findfile_cleanup(search_ctx); } if (fname == NULL) @@ -7574,7 +7574,7 @@ ex_find(exarg_T *eap) eap->arg = fname; do_exedit(eap, NULL); - vim_free(fname); + mnv_free(fname); } /* @@ -7587,7 +7587,7 @@ ex_open(exarg_T *eap) char_u *p; #ifdef FEAT_EVAL - if (not_in_vim9(eap) == FAIL) + if (not_in_mnv9(eap) == FAIL) return; #endif curwin->w_cursor.lnum = eap->line2; @@ -7598,20 +7598,20 @@ ex_open(exarg_T *eap) ++eap->arg; p = skip_regexp(eap->arg, '/', magic_isset()); *p = NUL; - regmatch.regprog = vim_regcomp(eap->arg, magic_isset() ? RE_MAGIC : 0); + regmatch.regprog = mnv_regcomp(eap->arg, magic_isset() ? RE_MAGIC : 0); if (regmatch.regprog != NULL) { // make a copy of the line, when searching for a mark it might be // flushed - char_u *line = vim_strsave(ml_get_curline()); + char_u *line = mnv_strsave(ml_get_curline()); regmatch.rm_ic = p_ic; - if (vim_regexec(®match, line, (colnr_T)0)) + if (mnv_regexec(®match, line, (colnr_T)0)) curwin->w_cursor.col = (colnr_T)(regmatch.startp[0] - line); else emsg(_(e_no_match)); - vim_regfree(regmatch.regprog); - vim_free(line); + mnv_regfree(regmatch.regprog); + mnv_free(line); } // Move to the NUL, ignore any other arguments. eap->arg += STRLEN(eap->arg); @@ -7676,7 +7676,7 @@ do_exedit( eap->nextcmd = NULL; } - if (exmode_was != EXMODE_VIM) + if (exmode_was != EXMODE_MNV) settmode(TMODE_RAW); int save_RedrawingDisabled = RedrawingDisabled; RedrawingDisabled = 0; @@ -7742,7 +7742,7 @@ do_exedit( NULL, eap, // ":edit" goes to first line if Vi compatible (*eap->arg == NUL && eap->do_ecmd_lnum == 0 - && vim_strchr(p_cpo, CPO_GOTO1) != NULL) + && mnv_strchr(p_cpo, CPO_GOTO1) != NULL) ? ECMD_ONE : eap->do_ecmd_lnum, (buf_hide(curbuf) ? ECMD_HIDE : 0) + (eap->forceit ? ECMD_FORCEIT : 0) @@ -7816,7 +7816,7 @@ do_exedit( #ifndef FEAT_GUI /* - * ":gui" and ":gvim" when there is no GUI. + * ":gui" and ":gmnv" when there is no GUI. */ static void ex_nogui(exarg_T *eap) @@ -7965,7 +7965,7 @@ ex_read(exarg_T *eap) { i = readfile(browseFile, NULL, eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); - vim_free(browseFile); + mnv_free(browseFile); } else i = OK; @@ -7981,7 +7981,7 @@ ex_read(exarg_T *eap) } else { - if (vim_strchr(p_cpo, CPO_ALTREAD) != NULL) + if (mnv_strchr(p_cpo, CPO_ALTREAD) != NULL) (void)setaltfname(eap->arg, eap->arg, (linenr_T)1); i = readfile(eap->arg, NULL, eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); @@ -8023,8 +8023,8 @@ static char_u *prev_dir = NULL; void free_cd_dir(void) { - VIM_CLEAR(prev_dir); - VIM_CLEAR(globaldir); + MNV_CLEAR(prev_dir); + MNV_CLEAR(globaldir); } #endif @@ -8051,8 +8051,8 @@ post_chdir(cdscope_T scope) { if (scope != CDSCOPE_WINDOW) // Clear tab local directory for both :cd and :tcd - VIM_CLEAR(curtab->tp_localdir); - VIM_CLEAR(curwin->w_localdir); + MNV_CLEAR(curtab->tp_localdir); + MNV_CLEAR(curwin->w_localdir); if (scope != CDSCOPE_GLOBAL) { char_u *pdir = get_prevdir(scope); @@ -8060,25 +8060,25 @@ post_chdir(cdscope_T scope) // If still in the global directory, need to remember current // directory as the global directory. if (globaldir == NULL && pdir != NULL) - globaldir = vim_strsave(pdir); + globaldir = mnv_strsave(pdir); // Remember this local directory for the window. if (mch_dirname(NameBuff, MAXPATHL) == OK) { if (scope == CDSCOPE_TABPAGE) - curtab->tp_localdir = vim_strsave(NameBuff); + curtab->tp_localdir = mnv_strsave(NameBuff); else - curwin->w_localdir = vim_strsave(NameBuff); + curwin->w_localdir = mnv_strsave(NameBuff); } } else { // We are now in the global directory, no need to remember its name. - VIM_CLEAR(globaldir); + MNV_CLEAR(globaldir); } last_chdir_reason = NULL; - shorten_fnames(vim_strchr(p_cpo, CPO_NOSYMLINKS) == NULL); + shorten_fnames(mnv_strchr(p_cpo, CPO_NOSYMLINKS) == NULL); } /* @@ -8124,7 +8124,7 @@ changedir_func( if (new_dir == NULL || allbuf_locked()) return FALSE; - if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged() && !forceit) + if (mnv_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged() && !forceit) { emsg(_(e_cannot_change_directory_buffer_is_modified_add_bang_to_override)); return FALSE; @@ -8144,7 +8144,7 @@ changedir_func( // Save current directory for next ":cd -" if (mch_dirname(NameBuff, MAXPATHL) == OK) - pdir = vim_strsave(NameBuff); + pdir = mnv_strsave(NameBuff); else pdir = NULL; @@ -8164,7 +8164,7 @@ changedir_func( if (p == NULL || *p == NUL) // empty is the same as not set NameBuff[0] = NUL; else - vim_strncpy(NameBuff, p, MAXPATHL - 1); + mnv_strncpy(NameBuff, p, MAXPATHL - 1); #else expand_env((char_u *)"$HOME", NameBuff, MAXPATHL); #endif @@ -8182,10 +8182,10 @@ changedir_func( acmd_fname = (char_u *)"global"; trigger_DirChangedPre(acmd_fname, new_dir); - if (vim_chdir(new_dir)) + if (mnv_chdir(new_dir)) { emsg(_(e_command_failed)); - vim_free(pdir); + mnv_free(pdir); return FALSE; } } @@ -8203,7 +8203,7 @@ changedir_func( if (dir_differs) apply_autocmds(EVENT_DIRCHANGED, acmd_fname, new_dir, FALSE, curbuf); - vim_free(tofree); + mnv_free(tofree); return TRUE; } @@ -8429,7 +8429,7 @@ ex_wincmd(exarg_T *eap) p = skipwhite(p); if (*p != NUL && *p != ( #ifdef FEAT_EVAL - in_vim9script() ? '#' : + in_mnv9script() ? '#' : #endif '"') && eap->nextcmd == NULL) @@ -8459,7 +8459,7 @@ ex_winpos(exarg_T *eap) if (*arg == NUL) { # if defined(FEAT_GUI) || defined(MSWIN) -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use ? gui_mch_get_winpos(&x, &y) != FAIL : mch_get_winpos(&x, &y) != FAIL) # elif defined(FEAT_GUI) @@ -8495,11 +8495,11 @@ ex_winpos(exarg_T *eap) gui_win_x = x; gui_win_y = y; } -# if defined(HAVE_TGETENT) || defined(VIMDLL) +# if defined(HAVE_TGETENT) || defined(MNVDLL) else # endif # endif -# if defined(MSWIN) && (!defined(FEAT_GUI) || defined(VIMDLL)) +# if defined(MSWIN) && (!defined(FEAT_GUI) || defined(MNVDLL)) mch_set_winpos(x, y); # endif # ifdef HAVE_TGETENT @@ -8611,7 +8611,7 @@ ex_copymove(exarg_T *eap) long n; #ifdef FEAT_EVAL - if (not_in_vim9(eap) == FAIL) + if (not_in_mnv9(eap) == FAIL) return; #endif n = get_address(eap, &eap->arg, eap->addr_type, FALSE, FALSE, FALSE, 1); @@ -8715,7 +8715,7 @@ ex_at(exarg_T *eap) if (c == NUL || (c == '*' && *eap->cmd == '*')) c = '@'; // Put the register in the typeahead buffer with the "silent" flag. - if (do_execreg(c, TRUE, vim_strchr(p_cpo, CPO_EXECBUF) != NULL, TRUE) + if (do_execreg(c, TRUE, mnv_strchr(p_cpo, CPO_EXECBUF) != NULL, TRUE) == FAIL) { beep_flush(); @@ -8871,14 +8871,14 @@ ex_redir(exarg_T *eap) (char_u *)_(BROWSE_FILTER_ALL_FILES), curbuf); if (browseFile == NULL) return; // operation cancelled - vim_free(fname); + mnv_free(fname); fname = browseFile; eap->forceit = TRUE; // since dialog already asked } #endif redir_fd = open_exfile(fname, eap->forceit, mode); - vim_free(fname); + mnv_free(fname); } #ifdef FEAT_EVAL else if (*arg == '@') @@ -8980,8 +8980,8 @@ redraw_cmd(int clear) update_screen(clear ? UPD_CLEAR : VIsual_active ? UPD_INVERTED : 0); if (need_maketitle) maketitle(); -#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) -# ifdef VIMDLL +#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)) +# ifdef MNVDLL if (!gui.in_use) # endif resize_console_buf(); @@ -9096,9 +9096,9 @@ close_redir(void) #if defined(FEAT_SESSION) || defined(FEAT_EVAL) int -vim_mkdir_emsg(char_u *name, int prot UNUSED) +mnv_mkdir_emsg(char_u *name, int prot UNUSED) { - if (vim_mkdir(name, prot) != 0) + if (mnv_mkdir(name, prot) != 0) { semsg(_(e_cannot_create_directory_str), name); return FAIL; @@ -9127,7 +9127,7 @@ open_exfile( return NULL; } #endif - if (!forceit && *mode != 'a' && vim_fexists(fname)) + if (!forceit && *mode != 'a' && mnv_fexists(fname)) { semsg(_(e_str_exists_add_bang_to_override), fname); return NULL; @@ -9148,7 +9148,7 @@ ex_mark(exarg_T *eap) pos_T pos; #ifdef FEAT_EVAL - if (not_in_vim9(eap) == FAIL) + if (not_in_mnv9(eap) == FAIL) return; #endif if (*eap->arg == NUL) // No argument? @@ -9206,7 +9206,7 @@ save_current_state(save_state_T *sst) p_im = FALSE; // don't use 'insertmode' sst->save_script_version = current_sctx.sc_version; - current_sctx.sc_version = 1; // not in Vim9 script + current_sctx.sc_version = 1; // not in MNV9 script /* * Save the current typeahead. This is required to allow using ":normal" @@ -9359,7 +9359,7 @@ ex_normal(exarg_T *eap) ui_cursor_shape(); // may show different cursor shape #endif - vim_free(arg); + mnv_free(arg); } /* @@ -9521,7 +9521,7 @@ ex_findpat(exarg_T *eap) } n = 1; - if (vim_isdigit(*eap->arg)) // get count + if (mnv_isdigit(*eap->arg)) // get count { n = getdigits(&eap->arg); eap->arg = skipwhite(eap->arg); @@ -9785,7 +9785,7 @@ find_cmdline_var(char_u *src, size_t *usedlen) * * change "%" to curbuf->b_ffname * "#" to curwin->w_alt_fnum - * "%%" to curwin->w_alt_fnum in Vim9 script + * "%%" to curwin->w_alt_fnum in MNV9 script * "" to word under the cursor * "" to WORD under the cursor * "" to C-expression under the cursor @@ -9884,7 +9884,7 @@ eval_vars( { case SPEC_PERC: #ifdef FEAT_EVAL - if (!in_vim9script() || src[1] != '%') + if (!in_mnv9script() || src[1] != '%') #endif { // '%': current file @@ -9935,7 +9935,7 @@ eval_vars( return NULL; } #ifdef FEAT_EVAL - result = list_find_str(get_vim_var_list(VV_OLDFILES), + result = list_find_str(get_mnv_var_list(VV_OLDFILES), (long)i); if (result == NULL) { @@ -9990,7 +9990,7 @@ eval_vars( // postponed to avoid a delay when is not used. autocmd_fname_full = TRUE; result = FullName_save(autocmd_fname, FALSE); - vim_free(autocmd_fname); + mnv_free(autocmd_fname); autocmd_fname = result; } if (result == NULL) @@ -10114,7 +10114,7 @@ eval_vars( if (src[*usedlen] == '<') // remove the file name extension { ++*usedlen; - if ((s = vim_strrchr(result, '.')) != NULL && s >= gettail(result)) + if ((s = mnv_strrchr(result, '.')) != NULL && s >= gettail(result)) resultlen = s - result; } else if (!skip_mod) @@ -10141,8 +10141,8 @@ eval_vars( result = NULL; } else - result = vim_strnsave(result, resultlen); - vim_free(resultbuf); + result = mnv_strnsave(result, resultlen); + mnv_free(resultbuf); return result; } @@ -10165,7 +10165,7 @@ expand_sfile(char_u *arg) char_u *p; resultlen = STRLEN(arg); - result = vim_strnsave(arg, resultlen); + result = mnv_strnsave(arg, resultlen); if (result == NULL) return NULL; @@ -10181,7 +10181,7 @@ expand_sfile(char_u *arg) { if (*errormsg) emsg(errormsg); - vim_free(result); + mnv_free(result); return NULL; } if (repl == NULL) // no match (cannot happen) @@ -10194,8 +10194,8 @@ expand_sfile(char_u *arg) newres = alloc(resultlen + 1); if (newres == NULL) { - vim_free(repl); - vim_free(result); + mnv_free(repl); + mnv_free(result); return NULL; } len = p - result; @@ -10203,8 +10203,8 @@ expand_sfile(char_u *arg) STRCPY(newres + len, repl); len += repllen; STRCPY(newres + len, p + srclen); - vim_free(repl); - vim_free(result); + mnv_free(repl); + mnv_free(result); result = newres; p = newres + len; // continue after the match } @@ -10223,7 +10223,7 @@ dialog_msg(char_u *buff, char *format, char_u *fname) { if (fname == NULL) fname = (char_u *)_("Untitled"); - vim_snprintf((char *)buff, DIALOG_MSG_SIZE, format, fname); + mnv_snprintf((char *)buff, DIALOG_MSG_SIZE, format, fname); } #endif @@ -10263,12 +10263,12 @@ static int filetype_indent = FALSE; /* * ":filetype [plugin] [indent] {on,off,detect}" - * on: Load the filetype.vim file to install autocommands for file types. - * off: Load the ftoff.vim file to remove all autocommands for file types. - * plugin on: load filetype.vim and ftplugin.vim - * plugin off: load ftplugof.vim - * indent on: load filetype.vim and indent.vim - * indent off: load indoff.vim + * on: Load the filetype.mnv file to install autocommands for file types. + * off: Load the ftoff.mnv file to remove all autocommands for file types. + * plugin on: load filetype.mnv and ftplugin.mnv + * plugin off: load ftplugof.mnv + * indent on: load filetype.mnv and indent.mnv + * indent off: load indoff.mnv */ static void ex_filetype(exarg_T *eap) @@ -10389,7 +10389,7 @@ set_no_hlsearch(int flag) { no_hlsearch = flag; # ifdef FEAT_EVAL - set_vim_var_nr(VV_HLSEARCH, !no_hlsearch && p_hls); + set_mnv_var_nr(VV_HLSEARCH, !no_hlsearch && p_hls); # endif } diff --git a/uvim/src/ex_eval.c b/uvim/src/ex_eval.c index 00e4d5fcf3..73a1a95dee 100644 --- a/uvim/src/ex_eval.c +++ b/uvim/src/ex_eval.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * ex_eval.c: functions for Ex command line for the +eval feature. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) @@ -52,11 +52,11 @@ static char *get_end_emsg(cstack_T *cstack); */ #if 0 // Expressions used for testing during the development phase. -# define THROW_ON_ERROR (!eval_to_number("$VIMNOERRTHROW")) -# define THROW_ON_INTERRUPT (!eval_to_number("$VIMNOINTTHROW")) +# define THROW_ON_ERROR (!eval_to_number("$MNVNOERRTHROW")) +# define THROW_ON_INTERRUPT (!eval_to_number("$MNVNOINTTHROW")) # define THROW_TEST #else -// Values used for the Vim release. +// Values used for the MNV release. # define THROW_ON_ERROR TRUE # define THROW_ON_ERROR_TRUE # define THROW_ON_INTERRUPT TRUE @@ -259,10 +259,10 @@ cause_errthrow( } else { - elem->msg = (char *)vim_strsave(mesg); + elem->msg = (char *)mnv_strsave(mesg); if (elem->msg == NULL) { - vim_free(elem); + mnv_free(elem); suppress_errthrow = TRUE; emsg(_(e_out_of_memory)); } @@ -275,12 +275,12 @@ cause_errthrow( { char *tmsg; - // Skip the extra "Vim " prefix for message "E458". + // Skip the extra "MNV " prefix for message "E458". tmsg = elem->msg; - if (STRNCMP(tmsg, "Vim E", 5) == 0 - && VIM_ISDIGIT(tmsg[5]) - && VIM_ISDIGIT(tmsg[6]) - && VIM_ISDIGIT(tmsg[7]) + if (STRNCMP(tmsg, "MNV E", 5) == 0 + && MNV_ISDIGIT(tmsg[5]) + && MNV_ISDIGIT(tmsg[6]) + && MNV_ISDIGIT(tmsg[7]) && tmsg[8] == ':' && tmsg[9] == ' ') (*msg_list)->throw_msg = &tmsg[4]; @@ -312,9 +312,9 @@ free_msglist(msglist_T *l) while (messages != NULL) { next = messages->next; - vim_free(messages->msg); - vim_free(messages->sfile); - vim_free(messages); + mnv_free(messages->msg); + mnv_free(messages->sfile); + mnv_free(messages); messages = next; } } @@ -410,7 +410,7 @@ do_intthrow(cstack_T *cstack) // An interrupt exception replaces any user or error exception. discard_current_exception(); } - if (throw_exception("Vim:Interrupt", ET_INTERRUPT, NULL) != FAIL) + if (throw_exception("MNV:Interrupt", ET_INTERRUPT, NULL) != FAIL) do_throw(cstack); } @@ -439,7 +439,7 @@ get_exception_string( if (cmdname != NULL && *cmdname != NUL) { cmdlen = (int)STRLEN(cmdname); - ret = (char *)vim_strnsave((char_u *)"Vim(", + ret = (char *)mnv_strnsave((char_u *)"MNV(", 4 + cmdlen + 2 + STRLEN(mesg)); if (ret == NULL) return ret; @@ -449,7 +449,7 @@ get_exception_string( } else { - ret = (char *)vim_strnsave((char_u *)"Vim:", 4 + STRLEN(mesg)); + ret = (char *)mnv_strnsave((char_u *)"MNV:", 4 + STRLEN(mesg)); if (ret == NULL) return ret; val = ret + 4; @@ -462,11 +462,11 @@ get_exception_string( { if (*p == NUL || (*p == 'E' - && VIM_ISDIGIT(p[1]) + && MNV_ISDIGIT(p[1]) && (p[2] == ':' - || (VIM_ISDIGIT(p[2]) + || (MNV_ISDIGIT(p[2]) && (p[3] == ':' - || (VIM_ISDIGIT(p[3]) + || (MNV_ISDIGIT(p[3]) && p[4] == ':')))))) { if (*p == NUL || p == mesg) @@ -517,11 +517,11 @@ throw_exception(void *value, except_type_T type, char_u *cmdname) */ if (type == ET_USER) { - if (STRNCMP((char_u *)value, "Vim", 3) == 0 + if (STRNCMP((char_u *)value, "MNV", 3) == 0 && (((char_u *)value)[3] == NUL || ((char_u *)value)[3] == ':' || ((char_u *)value)[3] == '(')) { - emsg(_(e_cannot_throw_exceptions_with_vim_prefix)); + emsg(_(e_cannot_throw_exceptions_with_mnv_prefix)); goto fail; } } @@ -532,7 +532,7 @@ throw_exception(void *value, except_type_T type, char_u *cmdname) if (type == ET_ERROR) // Store the original message and prefix the exception value with - // "Vim:" or, if a command name is given, "Vim(cmdname):". + // "MNV:" or, if a command name is given, "MNV(cmdname):". excp->messages = (msglist_T *)value; excp->value = get_exception_string(value, type, cmdname, &should_free); @@ -552,11 +552,11 @@ throw_exception(void *value, except_type_T type, char_u *cmdname) { excp->throw_name = estack_sfile(ESTACK_NONE); if (excp->throw_name == NULL) - excp->throw_name = vim_strsave((char_u *)""); + excp->throw_name = mnv_strsave((char_u *)""); if (excp->throw_name == NULL) { if (should_free) - vim_free(excp->value); + mnv_free(excp->value); goto nomem; } excp->throw_lnum = SOURCING_LNUM; @@ -594,7 +594,7 @@ throw_exception(void *value, except_type_T type, char_u *cmdname) return OK; nomem: - vim_free(excp); + mnv_free(excp); suppress_errthrow = TRUE; emsg(_(e_out_of_memory)); fail: @@ -623,7 +623,7 @@ discard_exception(except_T *excp, int was_finished) { int save_msg_silent = msg_silent; - saved_IObuff = vim_strsave(IObuff); + saved_IObuff = mnv_strsave(IObuff); if (debug_break_level > 0) msg_silent = FALSE; // display messages else @@ -644,15 +644,15 @@ discard_exception(except_T *excp, int was_finished) else verbose_leave(); STRCPY(IObuff, saved_IObuff); - vim_free(saved_IObuff); + mnv_free(saved_IObuff); } if (excp->type != ET_INTERRUPT) - vim_free(excp->value); + mnv_free(excp->value); if (excp->type == ET_ERROR) free_msglist(excp->messages); - vim_free(excp->throw_name); + mnv_free(excp->throw_name); list_unref(excp->stacktrace); - vim_free(excp); + mnv_free(excp); } /* @@ -675,22 +675,22 @@ catch_exception(except_T *excp) { excp->caught = caught_stack; caught_stack = excp; - set_vim_var_string(VV_EXCEPTION, (char_u *)excp->value, -1); - set_vim_var_list(VV_STACKTRACE, excp->stacktrace); + set_mnv_var_string(VV_EXCEPTION, (char_u *)excp->value, -1); + set_mnv_var_list(VV_STACKTRACE, excp->stacktrace); if (*excp->throw_name != NUL) { size_t IObufflen; if (excp->throw_lnum != 0) - IObufflen = vim_snprintf_safelen((char *)IObuff, IOSIZE, _("%s, line %ld"), + IObufflen = mnv_snprintf_safelen((char *)IObuff, IOSIZE, _("%s, line %ld"), excp->throw_name, (long)excp->throw_lnum); else - IObufflen = vim_snprintf_safelen((char *)IObuff, IOSIZE, "%s", excp->throw_name); - set_vim_var_string(VV_THROWPOINT, IObuff, (int)IObufflen); + IObufflen = mnv_snprintf_safelen((char *)IObuff, IOSIZE, "%s", excp->throw_name); + set_mnv_var_string(VV_THROWPOINT, IObuff, (int)IObufflen); } else // throw_name not set on an exception from a command that was typed. - set_vim_var_string(VV_THROWPOINT, NULL, -1); + set_mnv_var_string(VV_THROWPOINT, NULL, -1); if (p_verbose >= 13 || debug_break_level > 0) { @@ -728,31 +728,31 @@ finish_exception(except_T *excp) caught_stack = caught_stack->caught; if (caught_stack != NULL) { - set_vim_var_string(VV_EXCEPTION, (char_u *)caught_stack->value, -1); - set_vim_var_list(VV_STACKTRACE, caught_stack->stacktrace); + set_mnv_var_string(VV_EXCEPTION, (char_u *)caught_stack->value, -1); + set_mnv_var_list(VV_STACKTRACE, caught_stack->stacktrace); if (*caught_stack->throw_name != NUL) { size_t IObufflen; if (caught_stack->throw_lnum != 0) - IObufflen = vim_snprintf_safelen((char *)IObuff, IOSIZE, + IObufflen = mnv_snprintf_safelen((char *)IObuff, IOSIZE, _("%s, line %ld"), caught_stack->throw_name, (long)caught_stack->throw_lnum); else - IObufflen = vim_snprintf_safelen((char *)IObuff, IOSIZE, "%s", + IObufflen = mnv_snprintf_safelen((char *)IObuff, IOSIZE, "%s", caught_stack->throw_name); - set_vim_var_string(VV_THROWPOINT, IObuff, (int)IObufflen); + set_mnv_var_string(VV_THROWPOINT, IObuff, (int)IObufflen); } else // throw_name not set on an exception from a command that was // typed. - set_vim_var_string(VV_THROWPOINT, NULL, -1); + set_mnv_var_string(VV_THROWPOINT, NULL, -1); } else { - set_vim_var_string(VV_EXCEPTION, NULL, -1); - set_vim_var_string(VV_THROWPOINT, NULL, -1); - set_vim_var_list(VV_STACKTRACE, NULL); + set_mnv_var_string(VV_EXCEPTION, NULL, -1); + set_mnv_var_string(VV_THROWPOINT, NULL, -1); + set_mnv_var_list(VV_STACKTRACE, NULL); } // Discard the exception, but use the finish message for 'verbose'. @@ -859,8 +859,8 @@ report_pending(int action, int pending, void *value) default: if (pending & CSTP_THROW) { - vim_snprintf((char *)IObuff, IOSIZE, mesg, _("Exception")); - mesg = (char *)vim_strnsave(IObuff, STRLEN(IObuff) + 4); + mnv_snprintf((char *)IObuff, IOSIZE, mesg, _("Exception")); + mesg = (char *)mnv_strnsave(IObuff, STRLEN(IObuff) + 4); STRCAT(mesg, ": %s"); s = (char *)((except_T *)value)->value; } @@ -885,9 +885,9 @@ report_pending(int action, int pending, void *value) msg_silent = save_msg_silent; if (pending == CSTP_RETURN) - vim_free(s); + mnv_free(s); else if (pending & CSTP_THROW) - vim_free(mesg); + mnv_free(mesg); } /* @@ -982,7 +982,7 @@ cmd_is_name_only(char_u *arg) (void)get_name_len(&p, &alias, FALSE, FALSE); } name_only = ends_excmd2(arg, skipwhite(p)); - vim_free(alias); + mnv_free(alias); return name_only; } @@ -997,7 +997,7 @@ ex_eval(exarg_T *eap) int name_only = FALSE; long lnum = SOURCING_LNUM; - if (in_vim9script()) + if (in_mnv9script()) name_only = cmd_is_name_only(eap->arg); fill_evalarg_from_eap(&evalarg, eap, eap->skip); @@ -1005,7 +1005,7 @@ ex_eval(exarg_T *eap) if (eval0(eap->arg, &tv, eap, &evalarg) == OK) { clear_tv(&tv); - if (in_vim9script() && name_only + if (in_mnv9script() && name_only && (evalarg.eval_tofree == NULL || ends_excmd2(evalarg.eval_tofree, skipwhite(evalarg.eval_tofree)))) @@ -1026,7 +1026,7 @@ ex_eval(exarg_T *eap) enter_block(cstack_T *cstack) { ++cstack->cs_idx; - if (in_vim9script() && current_sctx.sc_sid > 0) + if (in_mnv9script() && current_sctx.sc_sid > 0) { scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid); @@ -1036,7 +1036,7 @@ enter_block(cstack_T *cstack) } else { - // Just in case in_vim9script() does not return the same value when the + // Just in case in_mnv9script() does not return the same value when the // block ends. cstack->cs_script_var_len[cstack->cs_idx] = 0; cstack->cs_block_id[cstack->cs_idx] = 0; @@ -1046,7 +1046,7 @@ enter_block(cstack_T *cstack) static void leave_block(cstack_T *cstack) { - if (in_vim9script() && SCRIPT_ID_VALID(current_sctx.sc_sid)) + if (in_mnv9script() && SCRIPT_ID_VALID(current_sctx.sc_sid)) { scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid); int i; @@ -1282,7 +1282,7 @@ ex_while(exarg_T *eap) } else { - if (in_vim9script() && SCRIPT_ID_VALID(current_sctx.sc_sid)) + if (in_mnv9script() && SCRIPT_ID_VALID(current_sctx.sc_sid)) { scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid); int i; @@ -1568,7 +1568,7 @@ ex_endwhile(exarg_T *eap) } /* - * "{" start of a block in Vim9 script + * "{" start of a block in MNV9 script */ void ex_block(exarg_T *eap) @@ -1585,7 +1585,7 @@ ex_block(exarg_T *eap) } /* - * "}" end of a block in Vim9 script + * "}" end of a block in MNV9 script */ void ex_endblock(exarg_T *eap) @@ -1655,7 +1655,7 @@ ex_throw(exarg_T *eap) if (!eap->skip && value != NULL) { if (throw_exception(value, ET_USER, NULL) == FAIL) - vim_free(value); + mnv_free(value); else do_throw(eap->cstack); } @@ -1928,7 +1928,7 @@ ex_catch(exarg_T *eap) // Disable error messages, it will make current_exception // invalid. ++emsg_off; - regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); + regmatch.regprog = mnv_regcomp(pat, RE_MAGIC + RE_STRING); --emsg_off; regmatch.rm_ic = FALSE; if (end != NULL) @@ -1945,10 +1945,10 @@ ex_catch(exarg_T *eap) */ prev_got_int = got_int; got_int = FALSE; - caught = vim_regexec_nl(®match, + caught = mnv_regexec_nl(®match, (char_u *)current_exception->value, (colnr_T)0); got_int |= prev_got_int; - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); } } } @@ -2202,7 +2202,7 @@ ex_endtry(exarg_T *eap) idx = cstack->cs_idx; // Check the flags only when not in a skipped block. - if (!skip && in_vim9script() + if (!skip && in_mnv9script() && (cstack->cs_flags[idx] & (CSF_CATCH|CSF_FINALLY)) == 0) { // try/endtry without any catch or finally: give an error and @@ -2617,7 +2617,7 @@ cleanup_conditionals( elem = cstack->cs_emsg_silent_list; cstack->cs_emsg_silent_list = elem->next; emsg_silent = elem->saved_emsg_silent; - vim_free(elem); + mnv_free(elem); cstack->cs_flags[idx] &= ~CSF_SILENT; } if (stop) diff --git a/uvim/src/ex_getln.c b/uvim/src/ex_getln.c index 97cc1601c1..f7b4a35ab8 100644 --- a/uvim/src/ex_getln.c +++ b/uvim/src/ex_getln.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * ex_getln.c: Functions for entering and editing an Ex command line. */ -#include "vim.h" +#include "mnv.h" // Return value when handling keys in command-line mode. #define CMDLINE_NOT_CHANGED 1 @@ -102,7 +102,7 @@ empty_pattern_magic(char_u *p, size_t len, magic_T magic_val) { // remove trailing \v and the like while (len >= 2 && p[len - 2] == '\\' - && vim_strchr((char_u *)"mMvVcCZ", p[len - 1]) != NULL) + && mnv_strchr((char_u *)"mMvVcCZ", p[len - 1]) != NULL) len -= 2; // true, if the pattern is empty, or the pattern ends with \| and magic is @@ -245,7 +245,7 @@ parse_pattern_and_range( // Skip over the range to find the command. cmd = skip_range(ea.cmd, TRUE, NULL); - if (vim_strchr((char_u *)"sgvlu", *cmd) == NULL) + if (mnv_strchr((char_u *)"sgvlu", *cmd) == NULL) return FALSE; // Skip over command name to find pattern separator @@ -275,10 +275,10 @@ parse_pattern_and_range( if (*p == NUL) return FALSE; } - else if (STRNCMP(cmd, "vimgrep", MAX(p - cmd, 3)) == 0 - || STRNCMP(cmd, "vimgrepadd", MAX(p - cmd, 8)) == 0 - || STRNCMP(cmd, "lvimgrep", MAX(p - cmd, 2)) == 0 - || STRNCMP(cmd, "lvimgrepadd", MAX(p - cmd, 9)) == 0 + else if (STRNCMP(cmd, "mnvgrep", MAX(p - cmd, 3)) == 0 + || STRNCMP(cmd, "mnvgrepadd", MAX(p - cmd, 8)) == 0 + || STRNCMP(cmd, "lmnvgrep", MAX(p - cmd, 2)) == 0 + || STRNCMP(cmd, "lmnvgrepadd", MAX(p - cmd, 9)) == 0 || STRNCMP(cmd, "global", p - cmd) == 0) { // skip optional "!" @@ -295,7 +295,7 @@ parse_pattern_and_range( return FALSE; p = skipwhite(p); - delim = (delim_optional && vim_isIDc(*p)) ? ' ' : *p++; + delim = (delim_optional && mnv_isIDc(*p)) ? ' ' : *p++; *search_delim = delim; end = skip_regexp_ex(p, delim, magic_isset(), NULL, NULL, &magic); @@ -732,7 +732,7 @@ may_adjust_incsearch_highlighting( curwin->w_cursor = is_state->match_end; } else - vim_beep(BO_ERROR); + mnv_beep(BO_ERROR); restore_last_search_pattern(); return FAIL; } @@ -771,7 +771,7 @@ may_add_char_to_search(int firstc, int *c, incsearch_state_T *is_state) // the character to lowercase. if (p_ic && p_scs && !pat_has_uppercase(ccline.cmdbuff + skiplen)) *c = MB_TOLOWER(*c); - if (*c == search_delim || vim_strchr((char_u *)( + if (*c == search_delim || mnv_strchr((char_u *)( magic_isset() ? "\\~^$.*[" : "\\^$"), *c) != NULL) { // put a backslash before special characters @@ -892,7 +892,7 @@ cmdline_handle_ctrl_bsl(int c, int *gotesc) { ccline.cmdlen = len; STRCPY(ccline.cmdbuff, p); - vim_free(p); + mnv_free(p); // Restore the cursor or use the position set with // set_cmdline_pos(). @@ -905,7 +905,7 @@ cmdline_handle_ctrl_bsl(int c, int *gotesc) redrawcmd(); return CMDLINE_CHANGED; } - vim_free(p); + mnv_free(p); } } beep_flush(); @@ -1047,7 +1047,7 @@ cmdline_wildchar_complete( if (wim_list || (p_wmnu && (wim_full || wim_noselect))) (void)showmatches(xp, p_wmnu, wim_list, wim_noselect); else - vim_beep(BO_WILD); + mnv_beep(BO_WILD); } redrawcmd(); @@ -1108,7 +1108,7 @@ cmdline_erase_chars( p = mb_prevptr(ccline.cmdbuff, p); if (c == Ctrl_W) { - while (p > ccline.cmdbuff && vim_isspace(*p)) + while (p > ccline.cmdbuff && mnv_isspace(*p)) p = mb_prevptr(ccline.cmdbuff, p); i = mb_get_class(p); while (p > ccline.cmdbuff && mb_get_class(p) == i) @@ -1119,13 +1119,13 @@ cmdline_erase_chars( } else if (c == Ctrl_W) { - while (p > ccline.cmdbuff && vim_isspace(p[-1])) + while (p > ccline.cmdbuff && mnv_isspace(p[-1])) --p; if (p > ccline.cmdbuff) { - i = vim_iswordc(p[-1]); - while (p > ccline.cmdbuff && !vim_isspace(p[-1]) - && vim_iswordc(p[-1]) == i) + i = mnv_iswordc(p[-1]); + while (p > ccline.cmdbuff && !mnv_isspace(p[-1]) + && mnv_iswordc(p[-1]) == i) --p; } } @@ -1419,7 +1419,7 @@ cmdline_browse_history( // save current command string so it can be restored later if (lookfor == NULL) { - if ((lookfor = vim_strnsave(ccline.cmdbuff, ccline.cmdlen)) == NULL) + if ((lookfor = mnv_strnsave(ccline.cmdbuff, ccline.cmdlen)) == NULL) return CMDLINE_NOT_CHANGED; lookfor[ccline.cmdpos] = NUL; lookforlen = ccline.cmdpos; @@ -1602,7 +1602,7 @@ init_ccline(int firstc, int indent) // autoindent for :insert and :append if (firstc <= 0) { - vim_memset(ccline.cmdbuff, ' ', indent); + mnv_memset(ccline.cmdbuff, ' ', indent); ccline.cmdbuff[indent] = NUL; ccline.cmdpos = indent; ccline.cmdspos = indent; @@ -1857,7 +1857,7 @@ getcmdline_int( int prev_cmdpos = ccline.cmdpos; int skip_pum_redraw = FALSE; - VIM_CLEAR(prev_cmdbuff); + MNV_CLEAR(prev_cmdbuff); redir_off = TRUE; // Don't redirect the typed command. // Repeated, because a ":redir" inside @@ -1873,7 +1873,7 @@ getcmdline_int( if (ex_normal_busy == 0 && stuff_empty() && typebuf.tb_len == 0) // There is no pending input from sources other than user input, so - // Vim is going to wait for the user to type a key. Consider the + // MNV is going to wait for the user to type a key. Consider the // command line typed even if next key will trigger a mapping. some_key_typed = TRUE; @@ -1882,7 +1882,7 @@ getcmdline_int( if (ccline.cmdbuff != NULL) { - prev_cmdbuff = vim_strsave(ccline.cmdbuff); + prev_cmdbuff = mnv_strsave(ccline.cmdbuff); if (prev_cmdbuff == NULL) goto returncmd; } @@ -1993,7 +1993,7 @@ getcmdline_int( && c != K_LEFT && c != K_RIGHT && (xpc.xp_numfiles > 0 || (c != Ctrl_P && c != Ctrl_N))) { - VIM_CLEAR(lookfor); + MNV_CLEAR(lookfor); lookforlen = 0; } @@ -2031,7 +2031,7 @@ getcmdline_int( || c == Ctrl_C)) { #ifdef FEAT_EVAL - set_vim_var_char(c); // Set v:char + set_mnv_var_char(c); // Set v:char #endif trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVEPRE); event_cmdlineleavepre_triggered = TRUE; @@ -2058,8 +2058,8 @@ getcmdline_int( if (cmdline_pum_active()) { skip_pum_redraw = skip_pum_redraw && !key_is_wc - && !VIM_ISWHITE(c) - && (vim_isprintc(c) + && !MNV_ISWHITE(c) + && (mnv_isprintc(c) || c == K_BS || c == Ctrl_H || c == K_DEL || c == K_KDEL || c == Ctrl_W || c == Ctrl_U); cmdline_pum_remove(&ccline, skip_pum_redraw); @@ -2109,7 +2109,7 @@ getcmdline_int( #endif if (c == '\n' || c == '\r' || c == K_KENTER || (c == ESC - && (!KeyTyped || vim_strchr(p_cpo, CPO_ESC) != NULL))) + && (!KeyTyped || mnv_strchr(p_cpo, CPO_ESC) != NULL))) { // In Ex mode a backslash escapes a newline. if (exmode_active @@ -2614,7 +2614,7 @@ getcmdline_int( * We come here if we have a normal character. */ - if (do_abbr && (IS_SPECIAL(c) || !vim_iswordc(c)) + if (do_abbr && (IS_SPECIAL(c) || !mnv_iswordc(c)) && (ccheck_abbr( // Add ABBR_OFF for characters above 0x100, this is // what check_abbr() expects. @@ -2704,7 +2704,7 @@ returncmd: if (!event_cmdlineleavepre_triggered) { #ifdef FEAT_EVAL - set_vim_var_char(c); // Set v:char + set_mnv_var_char(c); // Set v:char #endif trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVEPRE); } @@ -2742,8 +2742,8 @@ returncmd: histype == HIST_SEARCH ? firstc : NUL); if (firstc == ':') { - vim_free(new_last_cmdline); - new_last_cmdline = vim_strnsave(ccline.cmdbuff, ccline.cmdlen); + mnv_free(new_last_cmdline); + new_last_cmdline = mnv_strnsave(ccline.cmdbuff, ccline.cmdlen); } } @@ -2766,7 +2766,7 @@ returncmd: // Trigger CmdlineLeave autocommands. #ifdef FEAT_EVAL - set_vim_var_char(c); // Set v:char + set_mnv_var_char(c); // Set v:char #endif trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVE); @@ -2799,7 +2799,7 @@ theend: else ccline.cmdbuff = NULL; - vim_free(prev_cmdbuff); + mnv_free(prev_cmdbuff); return p; } } @@ -3482,7 +3482,7 @@ redrawcmd_preedit(void) static void dealloc_cmdbuff(void) { - VIM_CLEAR(ccline.cmdbuff); + MNV_CLEAR(ccline.cmdbuff); ccline.cmdlen = ccline.cmdbufflen = 0; } @@ -3548,7 +3548,7 @@ realloc_cmdbuff(int len) ccline.xpc->xp_pattern = ccline.cmdbuff + i; } - vim_free(p); + mnv_free(p); return OK; } @@ -3560,7 +3560,7 @@ static char_u *arshape_buf = NULL; void free_arshape_buf(void) { - vim_free(arshape_buf); + mnv_free(arshape_buf); } # endif #endif @@ -3607,7 +3607,7 @@ draw_cmdline(int start, int len) { // Re-allocate the buffer. We keep it around to avoid a lot of // alloc()/free() calls. - vim_free(arshape_buf); + mnv_free(arshape_buf); buflen = len * 2 + 2; arshape_buf = alloc(buflen); if (arshape_buf == NULL) @@ -3969,13 +3969,13 @@ cmdline_paste( if (has_mbyte) { len = (*mb_head_off)(ccline.cmdbuff, w - 1) + 1; - if (!vim_iswordc(mb_ptr2char(w - len))) + if (!mnv_iswordc(mb_ptr2char(w - len))) break; w -= len; } else { - if (!vim_iswordc(w[-1])) + if (!mnv_iswordc(w[-1])) break; --w; } @@ -3987,7 +3987,7 @@ cmdline_paste( cmdline_paste_str(p, literally); if (allocated) - vim_free(arg); + mnv_free(arg); return OK; } @@ -4201,7 +4201,7 @@ ccheck_abbr(int c) // Do not consider '<,'> be part of the mapping, skip leading whitespace. // Actually accepts any mark. - while (VIM_ISWHITE(ccline.cmdbuff[spos]) && spos < ccline.cmdlen) + while (MNV_ISWHITE(ccline.cmdbuff[spos]) && spos < ccline.cmdlen) spos++; if (ccline.cmdlen - spos > 5 && ccline.cmdbuff[spos] == '\'' @@ -4217,13 +4217,13 @@ ccheck_abbr(int c) /* * Escape special characters in "fname", depending on "what": - * VSE_NONE: for when used as a file name argument after a Vim command. + * VSE_NONE: for when used as a file name argument after a MNV command. * VSE_SHELL: for a shell command. * VSE_BUFFER: for the ":buffer" command. * Returns the result in allocated memory. */ char_u * -vim_strsave_fnameescape(char_u *fname, int what) +mnv_strsave_fnameescape(char_u *fname, int what) { char_u *p; #ifdef BACKSLASH_IN_FILENAME @@ -4234,21 +4234,21 @@ vim_strsave_fnameescape(char_u *fname, int what) // ":buffer" command. for (p = what == VSE_BUFFER ? BUFFER_ESC_CHARS : PATH_ESC_CHARS; *p != NUL; ++p) - if ((*p != '[' && *p != '{' && *p != '!') || !vim_isfilec(*p)) + if ((*p != '[' && *p != '{' && *p != '!') || !mnv_isfilec(*p)) buf[j++] = *p; buf[j] = NUL; - p = vim_strsave_escaped(fname, buf); + p = mnv_strsave_escaped(fname, buf); #else - p = vim_strsave_escaped(fname, what == VSE_SHELL ? SHELL_ESC_CHARS + p = mnv_strsave_escaped(fname, what == VSE_SHELL ? SHELL_ESC_CHARS : what == VSE_BUFFER ? BUFFER_ESC_CHARS : PATH_ESC_CHARS); if (what == VSE_SHELL && csh_like_shell() && p != NULL) { char_u *s; // For csh and similar shells need to put two backslashes before '!'. - // One is taken by Vim, one by the shell. - s = vim_strsave_escaped(p, (char_u *)"!"); - vim_free(p); + // One is taken by MNV, one by the shell. + s = mnv_strsave_escaped(p, (char_u *)"!"); + mnv_free(p); p = s; } #endif @@ -4275,7 +4275,7 @@ escape_fname(char_u **pp) p[0] = '\\'; STRCPY(p + 1, *pp); - vim_free(*pp); + mnv_free(*pp); *pp = p; } @@ -4292,14 +4292,14 @@ tilde_replace( int i; char_u *p; - if (orig_pat[0] == '~' && vim_ispathsep(orig_pat[1])) + if (orig_pat[0] == '~' && mnv_ispathsep(orig_pat[1])) { for (i = 0; i < num_files; ++i) { p = home_replace_save(NULL, files[i]); if (p != NULL) { - vim_free(files[i]); + mnv_free(files[i]); files[i] = p; } } @@ -4369,7 +4369,7 @@ get_cmdline_str(void) p = get_ccline_ptr(); if (p == NULL) return NULL; - return vim_strnsave(p->cmdbuff, p->cmdlen); + return mnv_strnsave(p->cmdbuff, p->cmdlen); } /* @@ -4403,7 +4403,7 @@ get_cmdline_completion_pattern(void) if (compl_pat == NULL) return NULL; - return vim_strsave(compl_pat); + return mnv_strsave(compl_pat); } /* @@ -4485,7 +4485,7 @@ f_getcmdprompt(typval_T *argvars UNUSED, typval_T *rettv) cmdline_info_T *p = get_ccline_ptr(); rettv->v_type = VAR_STRING; rettv->vval.v_string = p != NULL && p->cmdprompt != NULL ? - vim_strsave(p->cmdprompt) : NULL; + mnv_strsave(p->cmdprompt) : NULL; } /* @@ -4603,7 +4603,7 @@ f_setcmdpos(typval_T *argvars, typval_T *rettv) { int pos; - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; pos = (int)tv_get_number(&argvars[0]) - 1; @@ -4634,9 +4634,9 @@ get_list_range(char_u **str, int *num1, int *num2) varnumber_T num; *str = skipwhite(*str); - if (**str == '-' || vim_isdigit(**str)) // parse "from" part of range + if (**str == '-' || mnv_isdigit(**str)) // parse "from" part of range { - vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0, FALSE, NULL); + mnv_str2nr(*str, NULL, &len, 0, &num, NULL, 0, FALSE, NULL); *str += len; // overflow if (num > INT_MAX) @@ -4649,7 +4649,7 @@ get_list_range(char_u **str, int *num1, int *num2) if (**str == ',') // parse "to" part of range { *str = skipwhite(*str + 1); - vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0, FALSE, NULL); + mnv_str2nr(*str, NULL, &len, 0, &num, NULL, 0, FALSE, NULL); if (len > 0) { *str = skipwhite(*str + len); @@ -4681,7 +4681,7 @@ did_set_cedit(optset_T *args UNUSED) else { n = string_to_key(p_cedit, FALSE); - if (n == 0 || vim_isprintc(n)) + if (n == 0 || mnv_isprintc(n)) return e_invalid_argument; cedit_key = n; } @@ -4826,11 +4826,11 @@ open_cmdwin(void) add_map((char_u *)" ", MODE_INSERT, TRUE); } set_option_value_give_err((char_u *)"ft", - 0L, (char_u *)"vim", OPT_LOCAL); + 0L, (char_u *)"mnv", OPT_LOCAL); } --curbuf_lock; - // Reset 'textwidth' after setting 'filetype' (the Vim filetype plugin + // Reset 'textwidth' after setting 'filetype' (the MNV filetype plugin // sets 'textwidth' to 78). curbuf->b_p_tw = 0; @@ -4937,7 +4937,7 @@ open_cmdwin(void) if (histtype == HIST_CMD) { // Execute the command directly. - ccline.cmdbuff = vim_strnsave(p, plen); + ccline.cmdbuff = mnv_strnsave(p, plen); ccline.cmdlen = (int)plen; ccline.cmdbufflen = (int)(plen + 1); cmdwin_result = CAR; @@ -4960,12 +4960,12 @@ open_cmdwin(void) { ccline.cmdlen = ml_get_curline_len(); ccline.cmdbufflen = ccline.cmdlen + 1; - ccline.cmdbuff = vim_strnsave(ml_get_curline(), ccline.cmdlen); + ccline.cmdbuff = mnv_strnsave(ml_get_curline(), ccline.cmdlen); } if (ccline.cmdbuff == NULL) { - ccline.cmdbuff = vim_strnsave((char_u *)"", 0); + ccline.cmdbuff = mnv_strnsave((char_u *)"", 0); ccline.cmdlen = 0; ccline.cmdbufflen = 1; ccline.cmdpos = 0; @@ -5107,7 +5107,7 @@ get_user_input( if (input_busy) return; // this doesn't work recursively. - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -5128,7 +5128,7 @@ get_user_input( { // Only the part of the message after the last NL is considered as // prompt for the command line - p = vim_strrchr(prompt, '\n'); + p = mnv_strrchr(prompt, '\n'); if (p == NULL) p = prompt; else @@ -5191,10 +5191,10 @@ get_user_input( if (inputdialog && rettv->vval.v_string == NULL && argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN) - rettv->vval.v_string = vim_strsave(tv_get_string_buf( + rettv->vval.v_string = mnv_strsave(tv_get_string_buf( &argvars[2], buf)); - vim_free(xp_arg); + mnv_free(xp_arg); // since the user typed this, no need to wait for return need_wait_return = FALSE; diff --git a/uvim/src/feature.h b/uvim/src/feature.h index 2918fe18d9..e88ee0e5ee 100644 --- a/uvim/src/feature.h +++ b/uvim/src/feature.h @@ -1,14 +1,14 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* * feature.h: Defines for optional code and preferences * - * Edit this file to include/exclude parts of Vim, before compiling. + * Edit this file to include/exclude parts of MNV, before compiling. * The only other file that may be edited is Makefile, it contains machine * specific options. * @@ -323,15 +323,15 @@ #endif /* - * +viminfo reading/writing the viminfo file. Takes about 8Kbyte + * +mnvinfo reading/writing the mnvinfo file. Takes about 8Kbyte * of code. - * VIMINFO_FILE Location of user .viminfo file (should start with $). - * VIMINFO_FILE2 Location of alternate user .viminfo file. + * MNVINFO_FILE Location of user .mnvinfo file (should start with $). + * MNVINFO_FILE2 Location of alternate user .mnvinfo file. */ #ifdef FEAT_NORMAL -# define FEAT_VIMINFO -// #define VIMINFO_FILE "$HOME/foo/.viminfo" -// #define VIMINFO_FILE2 "~/bar/.viminfo" +# define FEAT_MNVINFO +// #define MNVINFO_FILE "$HOME/foo/.mnvinfo" +// #define MNVINFO_FILE2 "~/bar/.mnvinfo" #endif /* @@ -544,7 +544,7 @@ * there is no terminal version, and on Windows we can't figure out how to * fork one off with :gui. */ -#if defined(FEAT_GUI_MSWIN) && !defined(VIMDLL) +#if defined(FEAT_GUI_MSWIN) && !defined(MNVDLL) # define ALWAYS_USE_GUI #endif @@ -618,7 +618,7 @@ /* * +xterm_save The t_ti and t_te entries for the builtin xterm will - * be set to save the screen when starting Vim and + * be set to save the screen when starting MNV and * restoring it when exiting. */ // #define FEAT_XTERM_SAVE @@ -644,9 +644,9 @@ // #define MEM_PROFILE /* - * VIMRC_FILE Name of the .vimrc file in current dir. + * MNVRC_FILE Name of the .mnvrc file in current dir. */ -// #define VIMRC_FILE ".vimrc" +// #define MNVRC_FILE ".mnvrc" /* * EXRC_FILE Name of the .exrc file in current dir. @@ -654,33 +654,33 @@ // #define EXRC_FILE ".exrc" /* - * GVIMRC_FILE Name of the .gvimrc file in current dir. + * GMNVRC_FILE Name of the .gmnvrc file in current dir. */ -// #define GVIMRC_FILE ".gvimrc" +// #define GMNVRC_FILE ".gmnvrc" /* * SESSION_FILE Name of the default ":mksession" file. */ -#define SESSION_FILE "Session.vim" +#define SESSION_FILE "Session.mnv" /* - * USR_VIMRC_FILE Name of the user .vimrc file. - * USR_VIMRC_FILE2 Name of alternate user .vimrc file. - * USR_VIMRC_FILE3 Name of alternate user .vimrc file. + * USR_MNVRC_FILE Name of the user .mnvrc file. + * USR_MNVRC_FILE2 Name of alternate user .mnvrc file. + * USR_MNVRC_FILE3 Name of alternate user .mnvrc file. */ -// #define USR_VIMRC_FILE "~/foo/.vimrc" -// #define USR_VIMRC_FILE2 "~/bar/.vimrc" -// #define USR_VIMRC_FILE3 "$VIM/.vimrc" +// #define USR_MNVRC_FILE "~/foo/.mnvrc" +// #define USR_MNVRC_FILE2 "~/bar/.mnvrc" +// #define USR_MNVRC_FILE3 "$MNV/.mnvrc" /* - * VIM_DEFAULTS_FILE Name of the defaults.vim script file + * MNV_DEFAULTS_FILE Name of the defaults.mnv script file */ -// #define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim" +// #define MNV_DEFAULTS_FILE "$MNVRUNTIME/defaults.mnv" /* - * EVIM_FILE Name of the evim.vim script file + * EMNV_FILE Name of the emnv.mnv script file */ -// #define EVIM_FILE "$VIMRUNTIME/evim.vim" +// #define EMNV_FILE "$MNVRUNTIME/emnv.mnv" /* * USR_EXRC_FILE Name of the user .exrc file. @@ -690,27 +690,27 @@ // #define USR_EXRC_FILE2 "~/bar/.exrc" /* - * USR_GVIMRC_FILE Name of the user .gvimrc file. - * USR_GVIMRC_FILE2 Name of the alternate user .gvimrc file. + * USR_GMNVRC_FILE Name of the user .gmnvrc file. + * USR_GMNVRC_FILE2 Name of the alternate user .gmnvrc file. */ -// #define USR_GVIMRC_FILE "~/foo/.gvimrc" -// #define USR_GVIMRC_FILE2 "~/bar/.gvimrc" -// #define USR_GVIMRC_FILE3 "$VIM/.gvimrc" +// #define USR_GMNVRC_FILE "~/foo/.gmnvrc" +// #define USR_GMNVRC_FILE2 "~/bar/.gmnvrc" +// #define USR_GMNVRC_FILE3 "$MNV/.gmnvrc" /* - * SYS_VIMRC_FILE Name of the system-wide .vimrc file. + * SYS_MNVRC_FILE Name of the system-wide .mnvrc file. */ -// #define SYS_VIMRC_FILE "/etc/vimrc" +// #define SYS_MNVRC_FILE "/etc/mnvrc" /* - * SYS_GVIMRC_FILE Name of the system-wide .gvimrc file. + * SYS_GMNVRC_FILE Name of the system-wide .gmnvrc file. */ -// #define SYS_GVIMRC_FILE "/etc/gvimrc" +// #define SYS_GMNVRC_FILE "/etc/gmnvrc" /* * DFLT_HELPFILE Name of the help file. */ -// # define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt.gz" +// # define DFLT_HELPFILE "$MNVRUNTIME/doc/help.txt.gz" /* * File names for: @@ -722,40 +722,40 @@ * INDOFF_FILE used for loading indent files */ #ifndef FILETYPE_FILE -# define FILETYPE_FILE "filetype.vim" +# define FILETYPE_FILE "filetype.mnv" #endif #ifndef FTPLUGIN_FILE -# define FTPLUGIN_FILE "ftplugin.vim" +# define FTPLUGIN_FILE "ftplugin.mnv" #endif #ifndef INDENT_FILE -# define INDENT_FILE "indent.vim" +# define INDENT_FILE "indent.mnv" #endif #ifndef FTOFF_FILE -# define FTOFF_FILE "ftoff.vim" +# define FTOFF_FILE "ftoff.mnv" #endif #ifndef FTPLUGOF_FILE -# define FTPLUGOF_FILE "ftplugof.vim" +# define FTPLUGOF_FILE "ftplugof.mnv" #endif #ifndef INDOFF_FILE -# define INDOFF_FILE "indoff.vim" +# define INDOFF_FILE "indoff.mnv" #endif /* - * SYS_MENU_FILE Name of the default menu.vim file. + * SYS_MENU_FILE Name of the default menu.mnv file. */ -// # define SYS_MENU_FILE "$VIMRUNTIME/menu.vim" +// # define SYS_MENU_FILE "$MNVRUNTIME/menu.mnv" /* - * SYS_OPTWIN_FILE Name of the default optwin.vim file. + * SYS_OPTWIN_FILE Name of the default optwin.mnv file. */ #ifndef SYS_OPTWIN_FILE -# define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim" +# define SYS_OPTWIN_FILE "$MNVRUNTIME/optwin.mnv" #endif /* * SYNTAX_FNAME Name of a syntax file, where %s is the syntax name. */ -// #define SYNTAX_FNAME "/foo/%s.vim" +// #define SYNTAX_FNAME "/foo/%s.mnv" /* * RUNTIME_DIRNAME Generic name for the directory of the runtime files. @@ -765,26 +765,26 @@ #endif /* - * RUNTIME_GLOBAL Comma-separated list of directory names for global Vim + * RUNTIME_GLOBAL Comma-separated list of directory names for global MNV * runtime directories. * Don't define this if the preprocessor can't handle * string concatenation. * Also set by "--with-global-runtime" configure argument. */ -// #define RUNTIME_GLOBAL "/etc/vim" +// #define RUNTIME_GLOBAL "/etc/mnv" /* - * RUNTIME_GLOBAL_AFTER Comma-separated list of directory names for global Vim + * RUNTIME_GLOBAL_AFTER Comma-separated list of directory names for global MNV * runtime after directories. * Don't define this if the preprocessor can't handle * string concatenation. * Also set by "--with-global-runtime" configure argument. */ -// #define RUNTIME_GLOBAL_AFTER "/etc/vim/after" +// #define RUNTIME_GLOBAL_AFTER "/etc/mnv/after" /* - * MODIFIED_BY Name of who modified Vim. Required when distributing - * a modified version of Vim. + * MODIFIED_BY Name of who modified MNV. Required when distributing + * a modified version of MNV. * Also from the "--with-modified-by" configure argument. */ // #define MODIFIED_BY "John Doe" @@ -821,7 +821,7 @@ * XSMP - X11 Session Management Protocol * It may be preferred to disable this if the GUI supports it (e.g., * GNOME/KDE) and implement save-yourself etc. through that, but it may also - * be cleaner to have all SM-aware vims do the same thing (libSM does not + * be cleaner to have all SM-aware mnvs do the same thing (libSM does not * depend upon X11). * If your GUI wants to support SM itself, change this ifdef. * I'm assuming that any X11 implementation will cope with this for now. @@ -994,7 +994,7 @@ */ #ifdef FEAT_NORMAL // Win32 console can change cursor shape -# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)) # define MCH_CURSOR_SHAPE # endif # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) \ @@ -1145,7 +1145,7 @@ */ #if defined(FEAT_HUGE) && defined(FEAT_TIMERS) && \ (defined(UNIX) || defined(VMS) || \ - (defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)))) + (defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)))) # define FEAT_BEVAL_TERM #endif @@ -1191,7 +1191,7 @@ /* * +vtp: Win32 virtual console. */ -#if (!defined(FEAT_GUI) || defined(VIMDLL)) && defined(MSWIN) +#if (!defined(FEAT_GUI) || defined(MNVDLL)) && defined(MSWIN) # define FEAT_VTP #endif diff --git a/uvim/src/fileio.c b/uvim/src/fileio.c index 975dc310e0..512a0c5dca 100644 --- a/uvim/src/fileio.c +++ b/uvim/src/fileio.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * fileio.c: read from and write to a file */ -#include "vim.h" +#include "mnv.h" #if defined(__TANDEM) # include // for SSIZE_MAX @@ -249,7 +249,7 @@ readfile( if (curbuf->b_ffname == NULL && !filtering && fname != NULL - && vim_strchr(p_cpo, CPO_FNAMER) != NULL + && mnv_strchr(p_cpo, CPO_FNAMER) != NULL && !(flags & READ_DUMMY)) { if (set_rw_fname(fname, sfname) == FAIL) @@ -544,7 +544,7 @@ readfile( */ curbuf->b_flags |= BF_NEW; - // Create a swap file now, so that other Vims are warned + // Create a swap file now, so that other MNVs are warned // that we are editing this file. Don't do this for a // "nofile" or "nowrite" buffer type. if (!bt_dontwrite(curbuf)) @@ -567,7 +567,7 @@ readfile( else filemess(curbuf, sfname, (char_u *)_("[New DIRECTORY]"), 0); -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO // Even though this is a new file, it might have been // edited before and deleted. Get the old marks. check_marks_read(); @@ -625,7 +625,7 @@ readfile( curbuf->b_start_bomb = FALSE; } - // Create a swap file now, so that other Vims are warned that we are + // Create a swap file now, so that other MNVs are warned that we are // editing this file. // Don't do this for a "nofile" or "nowrite" buffer type. if (!bt_dontwrite(curbuf)) @@ -690,9 +690,9 @@ readfile( curbuf->b_op_start.lnum = ((from == 0) ? 1 : from); curbuf->b_op_start.col = 0; - try_mac = (vim_strchr(p_ffs, 'm') != NULL); - try_dos = (vim_strchr(p_ffs, 'd') != NULL); - try_unix = (vim_strchr(p_ffs, 'x') != NULL); + try_mac = (mnv_strchr(p_ffs, 'm') != NULL); + try_dos = (mnv_strchr(p_ffs, 'd') != NULL); + try_unix = (mnv_strchr(p_ffs, 'x') != NULL); if (!read_buffer) { @@ -725,9 +725,9 @@ readfile( apply_autocmds_exarg(EVENT_FILEREADPRE, sfname, sfname, FALSE, NULL, eap); // autocommands may have changed it - try_mac = (vim_strchr(p_ffs, 'm') != NULL); - try_dos = (vim_strchr(p_ffs, 'd') != NULL); - try_unix = (vim_strchr(p_ffs, 'x') != NULL); + try_mac = (mnv_strchr(p_ffs, 'm') != NULL); + try_dos = (mnv_strchr(p_ffs, 'd') != NULL); + try_unix = (mnv_strchr(p_ffs, 'x') != NULL); curbuf->b_op_start = orig_start; if (msg_scrolled == n) @@ -781,10 +781,10 @@ readfile( if (!is_not_a_term()) { #ifndef ALWAYS_USE_GUI -# ifdef VIMDLL +# ifdef MNVDLL if (!gui.in_use) # endif - mch_msg(_("Vim: Reading from stdin...\n")); + mch_msg(_("MNV: Reading from stdin...\n")); #endif #ifdef FEAT_GUI // Also write a message in the GUI window, if there is one. @@ -793,11 +793,11 @@ readfile( size_t plen = STRLEN(_("Reading from stdin...")); // make a copy, gui_write() may try to change it - p = vim_strnsave((char_u *)_("Reading from stdin..."), plen); + p = mnv_strnsave((char_u *)_("Reading from stdin..."), plen); if (p != NULL) { gui_write(p, (int)plen); - vim_free(p); + mnv_free(p); } } #endif @@ -860,7 +860,7 @@ readfile( // Read the first line (and a bit more). Immediately rewind to // the start of the file. If the read() fails "len" is -1. len = read_eintr(fd, firstline, 80); - vim_lseek(fd, (off_T)0L, SEEK_SET); + mnv_lseek(fd, (off_T)0L, SEEK_SET); for (p = firstline; p < firstline + len; ++p) if (*p >= 0x80) { @@ -922,7 +922,7 @@ retry: read_buf_lnum = 1; read_buf_col = 0; } - else if (read_stdin || vim_lseek(fd, (off_T)0L, SEEK_SET) != 0) + else if (read_stdin || mnv_lseek(fd, (off_T)0L, SEEK_SET) != 0) { // Can't rewind the file, give up. error = TRUE; @@ -984,14 +984,14 @@ retry: notconverted = TRUE; conv_error = 0; if (fenc_alloced) - vim_free(fenc); + mnv_free(fenc); fenc = (char_u *)""; fenc_alloced = FALSE; } else { if (fenc_alloced) - vim_free(fenc); + mnv_free(fenc); if (fenc_next != NULL) { fenc = next_fenc(&fenc_next, &fenc_alloced); @@ -1005,7 +1005,7 @@ retry: if (tmpname != NULL) { mch_remove(tmpname); // delete converted file - VIM_CLEAR(tmpname); + MNV_CLEAR(tmpname); } } @@ -1203,7 +1203,7 @@ retry: } if (linerest) // copy characters from the previous buffer mch_memmove(new_buffer, ptr - linerest, (size_t)linerest); - vim_free(buffer); + mnv_free(buffer); buffer = new_buffer; ptr = buffer + linerest; line_start = buffer; @@ -1408,7 +1408,7 @@ retry: { // error message already given error = TRUE; - vim_free(newptr); + mnv_free(newptr); break; } // If the crypt layer is buffering, not producing @@ -1440,12 +1440,12 @@ retry: if (newptr != NULL) mch_memmove(new_buffer + linerest + conv_restlen, newptr, decrypted_size); - vim_free(newptr); + mnv_free(newptr); } if (new_buffer != NULL) { - vim_free(buffer); + mnv_free(buffer); buffer = new_buffer; new_buffer = NULL; line_start = buffer; @@ -1574,7 +1574,7 @@ retry: { // BOM detected: set "fenc" and jump back if (fenc_alloced) - vim_free(fenc); + mnv_free(fenc); fenc = ccname; fenc_alloced = FALSE; } @@ -2337,7 +2337,7 @@ rewind_retry: if ( try_unix && !read_stdin && (read_buffer - || vim_lseek(fd, (off_T)0L, SEEK_SET) + || mnv_lseek(fd, (off_T)0L, SEEK_SET) == 0)) { fileformat = EOL_UNIX; @@ -2444,7 +2444,7 @@ failed: set_string_option_direct((char_u *)"fenc", -1, fenc, OPT_FREE|OPT_LOCAL, 0); if (fenc_alloced) - vim_free(fenc); + mnv_free(fenc); #ifdef USE_ICONV if (iconv_fd != (iconv_t)-1) iconv_close(iconv_fd); @@ -2461,21 +2461,21 @@ failed: (void)fcntl(fd, F_SETFD, fdflags | FD_CLOEXEC); } #endif - vim_free(buffer); + mnv_free(buffer); #ifdef HAVE_DUP if (read_stdin) { // Use stderr for stdin, makes shell commands work. close(0); - vim_ignored = dup(2); + mnv_ignored = dup(2); } #endif if (tmpname != NULL) { mch_remove(tmpname); // delete converted file - vim_free(tmpname); + mnv_free(tmpname); } --no_wait_return; // may wait for return now @@ -2539,7 +2539,7 @@ failed: curbuf->b_p_ro = TRUE; // must use "w!" now } msg_scroll = msg_save; -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO check_marks_read(); #endif retval = OK; // an interrupt isn't really an error @@ -2557,20 +2557,20 @@ failed: #ifdef UNIX if (S_ISFIFO(perm)) // fifo { - buflen += vim_snprintf((char *)IObuff + buflen, IOSIZE - buflen, + buflen += mnv_snprintf((char *)IObuff + buflen, IOSIZE - buflen, _("[fifo]")); c = TRUE; } if (S_ISSOCK(perm)) // or socket { - buflen += vim_snprintf((char *)IObuff + buflen, IOSIZE - buflen, + buflen += mnv_snprintf((char *)IObuff + buflen, IOSIZE - buflen, _("[socket]")); c = TRUE; } # ifdef OPEN_CHR_FILES if (S_ISCHR(perm)) // or character special { - buflen += vim_snprintf((char *)IObuff + buflen, IOSIZE - buflen, + buflen += mnv_snprintf((char *)IObuff + buflen, IOSIZE - buflen, _("[character special]")); c = TRUE; } @@ -2578,7 +2578,7 @@ failed: #endif if (curbuf->b_p_ro) { - buflen += vim_snprintf((char *)IObuff + buflen, IOSIZE - buflen, + buflen += mnv_snprintf((char *)IObuff + buflen, IOSIZE - buflen, "%s", shortmess(SHM_RO) ? _("[RO]") : _("[readonly]")); c = TRUE; } @@ -2589,25 +2589,25 @@ failed: } if (ff_error == EOL_DOS) { - buflen += vim_snprintf((char *)IObuff + buflen, IOSIZE - buflen, + buflen += mnv_snprintf((char *)IObuff + buflen, IOSIZE - buflen, _("[CR missing]")); c = TRUE; } if (split) { - buflen += vim_snprintf((char *)IObuff + buflen, IOSIZE - buflen, + buflen += mnv_snprintf((char *)IObuff + buflen, IOSIZE - buflen, _("[long lines split]")); c = TRUE; } if (notconverted) { - buflen += vim_snprintf((char *)IObuff + buflen, IOSIZE - buflen, + buflen += mnv_snprintf((char *)IObuff + buflen, IOSIZE - buflen, _("[NOT converted]")); c = TRUE; } else if (converted) { - buflen += vim_snprintf((char *)IObuff + buflen, IOSIZE - buflen, + buflen += mnv_snprintf((char *)IObuff + buflen, IOSIZE - buflen, _("[converted]")); c = TRUE; } @@ -2620,19 +2620,19 @@ failed: #endif if (conv_error != 0) { - vim_snprintf((char *)IObuff + buflen, IOSIZE - buflen, + mnv_snprintf((char *)IObuff + buflen, IOSIZE - buflen, _("[CONVERSION ERROR in line %ld]"), (long)conv_error); c = TRUE; } else if (illegal_byte > 0) { - vim_snprintf((char *)IObuff + buflen, IOSIZE - buflen, + mnv_snprintf((char *)IObuff + buflen, IOSIZE - buflen, _("[ILLEGAL BYTE in line %ld]"), (long)illegal_byte); c = TRUE; } else if (error) { - vim_snprintf((char *)IObuff + buflen, IOSIZE - buflen, + mnv_snprintf((char *)IObuff + buflen, IOSIZE - buflen, _("[READ ERRORS]")); c = TRUE; } @@ -2646,7 +2646,7 @@ failed: #endif msg_add_lines(c, (long)linecnt, filesize); - VIM_CLEAR(keep_msg); + MNV_CLEAR(keep_msg); msg_scrolled_ign = TRUE; #ifdef ALWAYS_USE_GUI // Don't show the message when reading stdin, it would end up in a @@ -2719,7 +2719,7 @@ failed: } msg_scroll = msg_save; -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO /* * Get the marks before executing autocommands, so they can be used there. */ @@ -2811,13 +2811,13 @@ theend: * Returns TRUE if the file name argument is of the form "/dev/fd/\d\+", * which is the name of files used for process substitution output by * some shells on some operating systems, e.g., bash on SunOS. - * Do not accept "/dev/fd/[012]", opening these may hang Vim. + * Do not accept "/dev/fd/[012]", opening these may hang MNV. */ int is_dev_fd_file(char_u *fname) { return (STRNCMP(fname, "/dev/fd/", 8) == 0 - && VIM_ISDIGIT(fname[8]) + && MNV_ISDIGIT(fname[8]) && *skipdigits(fname + 9) == NUL && (fname[9] != NUL || (fname[8] != '0' && fname[8] != '1' && fname[8] != '2'))); @@ -2907,7 +2907,7 @@ set_forced_fenc(exarg_T *eap) if (fenc != NULL) set_string_option_direct((char_u *)"fenc", -1, fenc, OPT_FREE|OPT_LOCAL, 0); - vim_free(fenc); + mnv_free(fenc); } /* @@ -2930,7 +2930,7 @@ next_fenc(char_u **pp, int *alloced) *pp = NULL; return (char_u *)""; } - p = vim_strchr(*pp, ','); + p = mnv_strchr(*pp, ','); if (p == NULL) { r = enc_canonize(*pp); @@ -2938,12 +2938,12 @@ next_fenc(char_u **pp, int *alloced) } else { - r = vim_strnsave(*pp, p - *pp); + r = mnv_strnsave(*pp, p - *pp); *pp = p + 1; if (r != NULL) { p = enc_canonize(r); - vim_free(r); + mnv_free(r); r = p; } } @@ -2976,7 +2976,7 @@ readfile_charconvert( char_u *tmpname; char *errmsg = NULL; - tmpname = vim_tempname('r', FALSE); + tmpname = mnv_tempname('r', FALSE); if (tmpname == NULL) errmsg = _("Can't find temp file for conversion"); else @@ -2999,7 +2999,7 @@ readfile_charconvert( if (tmpname != NULL) { mch_remove(tmpname); // delete converted file - VIM_CLEAR(tmpname); + MNV_CLEAR(tmpname); } } @@ -3062,7 +3062,7 @@ check_for_cryptkey( if (cryptkey != NULL && *cryptkey == NUL) { if (cryptkey != curbuf->b_p_key) - vim_free(cryptkey); + mnv_free(cryptkey); cryptkey = NULL; } } @@ -3077,7 +3077,7 @@ check_for_cryptkey( { // invalid header, buffer can't be encrypted if (cryptkey != curbuf->b_p_key) - vim_free(cryptkey); + mnv_free(cryptkey); return NULL; } @@ -3134,7 +3134,7 @@ check_file_readonly( * Return fsync() result: zero for success. */ int -vim_fsync(int fd) +mnv_fsync(int fd) { int r; @@ -3248,14 +3248,14 @@ msg_add_lines( int len = (int)STRLEN(IObuff); if (shortmess(SHM_LINES)) - vim_snprintf((char *)IObuff + len, IOSIZE - (size_t)len, + mnv_snprintf((char *)IObuff + len, IOSIZE - (size_t)len, // l10n: L as in line, B as in byte _("%s%ldL, %lldB"), insert_space ? " " : "", lnum, (varnumber_T)nchars); else { - len += vim_snprintf((char *)IObuff + len, IOSIZE - (size_t)len, + len += mnv_snprintf((char *)IObuff + len, IOSIZE - (size_t)len, NGETTEXT("%s%ld line, ", "%s%ld lines, ", lnum), insert_space ? " " : "", lnum); - vim_snprintf((char *)IObuff + len, IOSIZE - (size_t)len, + mnv_snprintf((char *)IObuff + len, IOSIZE - (size_t)len, NGETTEXT("%lld byte", "%lld bytes", nchars), (varnumber_T)nchars); } } @@ -3485,7 +3485,7 @@ shorten_fname1(char_u *full_path) if (p == NULL || *p == NUL) p = full_path; } - vim_free(dirname); + mnv_free(dirname); return p; } @@ -3516,10 +3516,10 @@ shorten_fname(char_u *full_path, char_u *dir_name) if (!((len > 2) && (*(p - 2) == ':'))) #endif { - if (vim_ispathsep(*p)) + if (mnv_ispathsep(*p)) do ++p; - while (vim_ispathsep_nocolon(*p)); + while (mnv_ispathsep_nocolon(*p)); #ifndef VMS // the path separator is always part of the path else p = NULL; @@ -3535,7 +3535,7 @@ shorten_fname(char_u *full_path, char_u *dir_name) else if (len > 3 && TOUPPER_LOC(full_path[0]) == TOUPPER_LOC(dir_name[0]) && full_path[1] == ':' - && vim_ispathsep(full_path[2])) + && mnv_ispathsep(full_path[2])) p = full_path + 2; #endif else @@ -3565,11 +3565,11 @@ shorten_buf_fname(buf_T *buf, char_u *dirname, int force) || mch_isFullName(buf->b_sfname))) { if (buf->b_sfname != buf->b_ffname) - VIM_CLEAR(buf->b_sfname); + MNV_CLEAR(buf->b_sfname); p = shorten_fname(buf->b_ffname, dirname); if (p != NULL) { - buf->b_sfname = vim_strsave(p); + buf->b_sfname = mnv_strsave(p); buf->b_fname = buf->b_sfname; } if (p == NULL || buf->b_fname == NULL) @@ -3628,8 +3628,8 @@ shorten_filenames(char_u **fnames, int count) // shorten_fname() returns pointer in given "fnames[i]". If free // "fnames[i]" first, "p" becomes invalid. So we need to copy // "p" first then free fnames[i]. - p = vim_strsave(p); - vim_free(fnames[i]); + p = mnv_strsave(p); + mnv_free(fnames[i]); fnames[i] = p; } } @@ -3685,7 +3685,7 @@ buf_modname( if (mch_dirname(retval, MAXPATHL) == FAIL || (fnamelen = (int)STRLEN(retval)) == 0) { - vim_free(retval); + mnv_free(retval); return NULL; } if (!after_pathsep(retval, retval + fnamelen)) @@ -3718,7 +3718,7 @@ buf_modname( if (*ext == '.' && shortname) if (*ptr == '.') // replace '.' by '_' *ptr = '_'; - if (vim_ispathsep(*ptr)) + if (mnv_ispathsep(*ptr)) { ++ptr; break; @@ -3746,7 +3746,7 @@ buf_modname( * ".ext" is invalid. */ if (fname == NULL || *fname == NUL - || vim_ispathsep(fname[STRLEN(fname) - 1])) + || mnv_ispathsep(fname[STRLEN(fname) - 1])) { if (*ext == '.') *s++ = '_'; @@ -3767,7 +3767,7 @@ buf_modname( * If the extension doesn't start with '.', and the file name * doesn't have an extension yet, append a '.' */ - else if ((e = vim_strchr(ptr, '.')) == NULL) + else if ((e = mnv_strchr(ptr, '.')) == NULL) *s++ = '.'; /* * If the extension doesn't start with '.', and there already is an @@ -3827,7 +3827,7 @@ buf_modname( * If the line is truncated then buf[size - 2] will not be NUL. */ int -vim_fgets(char_u *buf, int size, FILE *fp) +mnv_fgets(char_u *buf, int size, FILE *fp) { char *eof; #define FGETS_SIZE 200 @@ -3851,7 +3851,7 @@ vim_fgets(char_u *buf, int size, FILE *fp) do { tbuf[FGETS_SIZE - 2] = NUL; - vim_ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp); + mnv_ignoredp = fgets((char *)tbuf, FGETS_SIZE, fp); } while (tbuf[FGETS_SIZE - 2] != NUL && tbuf[FGETS_SIZE - 2] != '\n'); } return (eof == NULL); @@ -3863,7 +3863,7 @@ vim_fgets(char_u *buf, int size, FILE *fp) * Return -1 for failure, 0 for success. */ int -vim_rename(char_u *from, char_u *to) +mnv_rename(char_u *from, char_u *to) { int n; int ret; @@ -3974,7 +3974,7 @@ vim_rename(char_u *from, char_u *to) * original file will be somewhere else so the backup isn't really * important. If autoscripting is off the rename may fail. */ - flock = Lock((UBYTE *)from, (long)VIM_ACCESS_READ); + flock = Lock((UBYTE *)from, (long)MNV_ACCESS_READ); #endif mch_remove(to); #ifdef AMIGA @@ -3991,7 +3991,7 @@ vim_rename(char_u *from, char_u *to) /* * Rename() failed, try copying the file. */ - ret = vim_copyfile(from, to); + ret = mnv_copyfile(from, to); if (ret != OK) return -1; @@ -4010,7 +4010,7 @@ vim_rename(char_u *from, char_u *to) * Return FAIL for failure, OK for success. */ int -vim_copyfile(char_u *from, char_u *to) +mnv_copyfile(char_u *from, char_u *to) { int fd_in; int fd_out; @@ -4019,7 +4019,7 @@ vim_copyfile(char_u *from, char_u *to) char *buffer; long perm; #ifdef HAVE_ACL - vim_acl_T acl; // ACL from original file + mnv_acl_T acl; // ACL from original file #endif #ifdef HAVE_READLINK @@ -4090,7 +4090,7 @@ vim_copyfile(char_u *from, char_u *to) break; } - vim_free(buffer); + mnv_free(buffer); close(fd_in); if (close(fd_out) < 0) errmsg = _(e_error_closing_str); @@ -4206,14 +4206,14 @@ move_lines(buf_T *frombuf, buf_T *tobuf) curbuf = tobuf; for (lnum = 1; lnum <= frombuf->b_ml.ml_line_count; ++lnum) { - p = vim_strnsave(ml_get_buf(frombuf, lnum, FALSE), ml_get_buf_len(frombuf, lnum)); + p = mnv_strnsave(ml_get_buf(frombuf, lnum, FALSE), ml_get_buf_len(frombuf, lnum)); if (p == NULL || ml_append(lnum - 1, p, 0, FALSE) == FAIL) { - vim_free(p); + mnv_free(p); retval = FAIL; break; } - vim_free(p); + mnv_free(p); } // Delete all the lines in "frombuf". @@ -4384,8 +4384,8 @@ buf_check_timestamp( */ busy = TRUE; #ifdef FEAT_EVAL - set_vim_var_string(VV_FCS_REASON, (char_u *)reason, (int)reasonlen); - set_vim_var_string(VV_FCS_CHOICE, (char_u *)"", 0); + set_mnv_var_string(VV_FCS_REASON, (char_u *)reason, (int)reasonlen); + set_mnv_var_string(VV_FCS_CHOICE, (char_u *)"", 0); #endif ++allbuf_lock; n = apply_autocmds(EVENT_FILECHANGEDSHELL, @@ -4397,7 +4397,7 @@ buf_check_timestamp( if (!bufref_valid(&bufref)) emsg(_(e_filechangedshell_autocommand_deleted_buffer)); #ifdef FEAT_EVAL - char_u *s = get_vim_var_str(VV_FCS_CHOICE); + char_u *s = get_mnv_var_str(VV_FCS_CHOICE); if (STRCMP(s, "reload") == 0 && *reason != 'd') reload = RELOAD_NORMAL; else if (STRCMP(s, "edit") == 0) @@ -4424,7 +4424,7 @@ buf_check_timestamp( #endif if (reason[2] == 'n') { - mesg = _("W12: Warning: File \"%s\" has changed and the buffer was changed in Vim as well"); + mesg = _("W12: Warning: File \"%s\" has changed and the buffer was changed in MNV as well"); mesg2 = _("See \":help W12\" for more info."); } else if (reason[1] == 'h') @@ -4450,7 +4450,7 @@ buf_check_timestamp( } else if ((buf->b_flags & BF_NEW) && !(buf->b_flags & BF_NEW_W) - && vim_fexists(buf->b_ffname)) + && mnv_fexists(buf->b_ffname)) { retval = 1; mesg = _("W13: Warning: File \"%s\" has been created after editing started"); @@ -4479,18 +4479,18 @@ buf_check_timestamp( { int tbuflen; - tbuflen = vim_snprintf(tbuf, tbufsize, mesg, path); + tbuflen = mnv_snprintf(tbuf, tbufsize, mesg, path); #ifdef FEAT_EVAL // Set warningmsg here, before the unimportant and output-specific // mesg2 has been appended. - set_vim_var_string(VV_WARNINGMSG, (char_u *)tbuf, tbuflen); + set_mnv_var_string(VV_WARNINGMSG, (char_u *)tbuf, tbuflen); #endif #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG) if (can_reload) { if (*mesg2 != NUL) - vim_snprintf(tbuf + tbuflen, tbufsize - tbuflen, "\n%s", mesg2); - switch (do_dialog(VIM_WARNING, (char_u *)_("Warning"), + mnv_snprintf(tbuf + tbuflen, tbufsize - tbuflen, "\n%s", mesg2); + switch (do_dialog(MNV_WARNING, (char_u *)_("Warning"), (char_u *)tbuf, (char_u *)_("&OK\n&Load File\nLoad File &and Options"), 1, NULL, TRUE)) @@ -4509,7 +4509,7 @@ buf_check_timestamp( || already_warned) { if (*mesg2 != NUL) - vim_snprintf(tbuf + tbuflen, tbufsize - tbuflen, "; %s", mesg2); + mnv_snprintf(tbuf + tbuflen, tbufsize - tbuflen, "; %s", mesg2); emsg(tbuf); retval = 2; } @@ -4540,8 +4540,8 @@ buf_check_timestamp( } } - vim_free(tbuf); - vim_free(path); + mnv_free(tbuf); + mnv_free(path); } } @@ -4579,7 +4579,7 @@ buf_check_timestamp( /* * Reload a buffer that is already loaded. - * Used when the file was changed outside of Vim. + * Used when the file was changed outside of MNV. * "orig_mode" is buf->b_orig_mode before the need for reloading was detected. * buf->b_orig_mode may have been reset already. */ @@ -4702,7 +4702,7 @@ buf_reload(buf_T *buf, int orig_mode, int reload_options) msg_silent = old_msg_silent; } - vim_free(ea.cmd); + mnv_free(ea.cmd); if (savebuf != NULL && bufref_valid(&bufref)) wipe_buffer(savebuf, FALSE); @@ -4854,10 +4854,10 @@ create_readdirex_item(WIN32_FIND_DATAW *wfd) goto theend; if (dict_add_string(item, "name", p) == FAIL) { - vim_free(p); + mnv_free(p); goto theend; } - vim_free(p); + mnv_free(p); size = (((varnumber_T)wfd->nFileSizeHigh) << 32) | wfd->nFileSizeLow; if (dict_add_number(item, "size", size) == FAIL) @@ -4912,9 +4912,9 @@ create_readdirex_item(char_u *path, char_u *name) if (p == NULL) goto theend; if (pathlen > 0 && path[pathlen - 1] == '/') - vim_snprintf(p, len, "%s%s", path, name); + mnv_snprintf(p, len, "%s%s", path, name); else - vim_snprintf(p, len, "%s/%s", path, name); + mnv_snprintf(p, len, "%s/%s", path, name); ret = mch_lstat(p, &st); if (ret >= 0 && S_ISLNK(st.st_mode)) { @@ -4923,7 +4923,7 @@ create_readdirex_item(char_u *path, char_u *name) if (ret < 0) q = (char_u*)"link"; } - vim_free(p); + mnv_free(p); if (dict_add_string(item, "name", name) == FAIL) goto theend; @@ -5060,12 +5060,12 @@ readdir_core( if (withattr) \ dict_unref((dict_T*)(item)); \ else \ - vim_free(item); \ + mnv_free(item); \ } while (0) readdirex_sort = READDIR_SORT_BYTE; # else -# define FREE_ITEM(item) vim_free(item) +# define FREE_ITEM(item) mnv_free(item) # endif # ifdef MSWIN @@ -5149,8 +5149,8 @@ readdir_core( FindClose(hFind); } - vim_free(buf); - vim_free(wn); + mnv_free(buf); + mnv_free(wn); # else // MSWIN dirp = opendir((char *)path); if (dirp == NULL) @@ -5180,7 +5180,7 @@ readdir_core( item = (void*)create_readdirex_item(path, p); else # endif - item = (void*)vim_strsave(p); + item = (void*)mnv_strsave(p); if (item == NULL) { failed = TRUE; @@ -5258,19 +5258,19 @@ delete_recursive(char_u *name) # endif ) { - char_u *exp = vim_strsave(name); + char_u *exp = mnv_strsave(name); garray_T ga; if (exp == NULL) return -1; if (readdir_core(&ga, exp, FALSE, NULL, NULL, READDIR_SORT_NONE) == OK) { - int len = vim_snprintf((char *)NameBuff, MAXPATHL, "%s/", exp); + int len = mnv_snprintf((char *)NameBuff, MAXPATHL, "%s/", exp); int i; for (i = 0; i < ga.ga_len; ++i) { - vim_snprintf((char *)NameBuff + len, MAXPATHL - len, "%s", ((char_u **)ga.ga_data)[i]); + mnv_snprintf((char *)NameBuff + len, MAXPATHL - len, "%s", ((char_u **)ga.ga_data)[i]); if (delete_recursive(NameBuff) != 0) // Remember the failure but continue deleting any further // entries. @@ -5282,7 +5282,7 @@ delete_recursive(char_u *name) } else result = -1; - vim_free(exp); + mnv_free(exp); } else result = mch_remove(name) == 0 ? 0 : -1; @@ -5300,32 +5300,32 @@ static long temp_count = 0; // Temp filename counter. * to be auto-cleaned. */ static void -vim_opentempdir(void) +mnv_opentempdir(void) { DIR *dp = NULL; - if (vim_tempdir_dp != NULL) + if (mnv_tempdir_dp != NULL) return; - dp = opendir((const char*)vim_tempdir); + dp = opendir((const char*)mnv_tempdir); if (dp == NULL) return; - vim_tempdir_dp = dp; - flock(dirfd(vim_tempdir_dp), LOCK_SH); + mnv_tempdir_dp = dp; + flock(dirfd(mnv_tempdir_dp), LOCK_SH); } /* * Close temporary directory - it automatically release file lock. */ static void -vim_closetempdir(void) +mnv_closetempdir(void) { - if (vim_tempdir_dp == NULL) + if (mnv_tempdir_dp == NULL) return; - closedir(vim_tempdir_dp); - vim_tempdir_dp = NULL; + closedir(mnv_tempdir_dp); + mnv_tempdir_dp = NULL; } # endif @@ -5333,27 +5333,27 @@ vim_closetempdir(void) * Delete the temp directory and all files it contains. */ void -vim_deltempdir(void) +mnv_deltempdir(void) { - if (vim_tempdir == NULL) + if (mnv_tempdir == NULL) return; # if defined(UNIX) && defined(HAVE_FLOCK) && defined(HAVE_DIRFD) - vim_closetempdir(); + mnv_closetempdir(); # endif // remove the trailing path separator - gettail(vim_tempdir)[-1] = NUL; - delete_recursive(vim_tempdir); - VIM_CLEAR(vim_tempdir); + gettail(mnv_tempdir)[-1] = NUL; + delete_recursive(mnv_tempdir); + MNV_CLEAR(mnv_tempdir); } /* * Directory "tempdir" was created. Expand this name to a full path and put - * it in "vim_tempdir". This avoids that using ":cd" would confuse us. + * it in "mnv_tempdir". This avoids that using ":cd" would confuse us. * "tempdir" must be no longer than MAXPATHL. */ static void -vim_settempdir(char_u *tempdir) +mnv_settempdir(char_u *tempdir) { char_u *buf; size_t buflen; @@ -5362,7 +5362,7 @@ vim_settempdir(char_u *tempdir) if (buf == NULL) return; - if (vim_FullName(tempdir, buf, MAXPATHL, FALSE) == FAIL) + if (mnv_FullName(tempdir, buf, MAXPATHL, FALSE) == FAIL) STRCPY(buf, tempdir); buflen = STRLEN(buf); if (!after_pathsep(buf, buf + buflen)) @@ -5370,16 +5370,16 @@ vim_settempdir(char_u *tempdir) STRCPY(buf + buflen, PATHSEPSTR); buflen += STRLEN_LITERAL(PATHSEPSTR); } - vim_tempdir = vim_strnsave(buf, buflen); + mnv_tempdir = mnv_strnsave(buf, buflen); # if defined(UNIX) && defined(HAVE_FLOCK) && defined(HAVE_DIRFD) - vim_opentempdir(); + mnv_opentempdir(); # endif - vim_free(buf); + mnv_free(buf); } #endif /* - * vim_tempname(): Return a unique name that can be used for a temp file. + * mnv_tempname(): Return a unique name that can be used for a temp file. * * The temp file is NOT guaranteed to be created. If "keep" is FALSE it is * guaranteed to NOT be created. @@ -5388,7 +5388,7 @@ vim_settempdir(char_u *tempdir) * The returned pointer is NULL if no valid name was found. */ char_u * -vim_tempname( +mnv_tempname( int extra_char UNUSED, // char to use in the name instead of '?' int keep UNUSED) { @@ -5408,13 +5408,13 @@ vim_tempname( # endif /* - * This will create a directory for private use by this instance of Vim. + * This will create a directory for private use by this instance of MNV. * This is done once, and the same directory is used for all temp files. * This method avoids security problems because of symlink attacks et al. * It's also a bit faster, because we only need to check for an existing * file when creating the directory and not for each temp file. */ - if (vim_tempdir == NULL) + if (mnv_tempdir == NULL) { /* * Try the entries in TEMPDIRNAMES to create the temp directory. @@ -5450,7 +5450,7 @@ vim_tempname( STRCPY(itmp + itmplen, "vXXXXXX"); itmplen += STRLEN_LITERAL("vXXXXXX"); if (mkdtemp((char *)itmp) != NULL) - vim_settempdir(itmp); + mnv_settempdir(itmp); # if defined(UNIX) || defined(VMS) (void)umask(umask_save); # endif @@ -5471,7 +5471,7 @@ vim_tempname( mode_t umask_save; # endif - vim_snprintf((char *)itmp + itmplen, sizeof(itmp) - itmplen, "v%ld", nr + off); + mnv_snprintf((char *)itmp + itmplen, sizeof(itmp) - itmplen, "v%ld", nr + off); # ifndef EEXIST // If mkdir() does not set errno to EEXIST, check for // existing file here. There is a race condition then, @@ -5484,13 +5484,13 @@ vim_tempname( // "repl" has been reported to use "177". umask_save = umask(077); # endif - r = vim_mkdir(itmp, 0700); + r = mnv_mkdir(itmp, 0700); # if defined(UNIX) || defined(VMS) (void)umask(umask_save); # endif if (r == 0) { - vim_settempdir(itmp); + mnv_settempdir(itmp); break; } # ifdef EEXIST @@ -5502,18 +5502,18 @@ vim_tempname( break; } # endif // HAVE_MKDTEMP - if (vim_tempdir != NULL) + if (mnv_tempdir != NULL) break; } } } - if (vim_tempdir != NULL) + if (mnv_tempdir != NULL) { // There is no need to check if the file exists, because we own the // directory and nobody else creates a file in it. - int itmplen = vim_snprintf((char *)itmp, sizeof(itmp), "%s%ld", vim_tempdir, temp_count++); - return vim_strnsave(itmp, (size_t)itmplen); + int itmplen = mnv_snprintf((char *)itmp, sizeof(itmp), "%s%ld", mnv_tempdir, temp_count++); + return mnv_strnsave(itmp, (size_t)itmplen); } return NULL; @@ -5536,7 +5536,7 @@ vim_tempname( wszTempFile[1] = L'\\'; wszTempFile[2] = NUL; } - wcscpy(buf4, L"VIM"); + wcscpy(buf4, L"MNV"); // randomize the name to avoid collisions i = mch_get_pid() + extra_char; @@ -5576,13 +5576,13 @@ vim_tempname( # ifdef VMS_TEMPNAM // mktemp() is not working on VMS. It seems to be // a do-nothing function. Therefore we use tempnam(). - vim_snprintf((char *)itmp, sizeof(itmp), "VIM%c", extra_char); + mnv_snprintf((char *)itmp, sizeof(itmp), "MNV%c", extra_char); p = (char_u *)tempnam("tmp:", (char *)itmp); if (p != NULL) { // VMS will use '.LIS' if we don't explicitly specify an extension, - // and VIM will then be unable to find the file later - itmplen = vim_snprintf((char *)itmp, sizeof(itmp), "%s.txt", p); + // and MNV will then be unable to find the file later + itmplen = mnv_snprintf((char *)itmp, sizeof(itmp), "%s.txt", p); free(p); } else @@ -5590,14 +5590,14 @@ vim_tempname( # else STRCPY(itmp, TEMPNAME); itmplen = STRLEN_LITERAL(TEMPNAME); - if ((p = vim_strchr(itmp, '?')) != NULL) + if ((p = mnv_strchr(itmp, '?')) != NULL) *p = extra_char; if (mktemp((char *)itmp) == NULL) return NULL; # endif # endif - return vim_strnsave(itmp, (size_t)itmplen); + return mnv_strnsave(itmp, (size_t)itmplen); # endif // MSWIN #endif // TEMPDIRNAMES } @@ -5626,7 +5626,7 @@ forward_slash(char_u *fname) /* * Try matching a filename with a "pattern" ("prog" is NULL), or use the * precompiled regprog "prog" ("pattern" is NULL). That avoids calling - * vim_regcomp() often. + * mnv_regcomp() often. * Used for autocommands and 'wildignore'. * Returns TRUE if there is a match, FALSE otherwise. */ @@ -5646,7 +5646,7 @@ match_file_pat( if (prog != NULL) regmatch.regprog = *prog; else - regmatch.regprog = vim_regcomp(pattern, RE_MAGIC); + regmatch.regprog = mnv_regcomp(pattern, RE_MAGIC); /* * Try for a match with the pattern with: @@ -5656,16 +5656,16 @@ match_file_pat( */ if (regmatch.regprog != NULL && ((allow_dirs - && (vim_regexec(®match, fname, (colnr_T)0) + && (mnv_regexec(®match, fname, (colnr_T)0) || (sfname != NULL - && vim_regexec(®match, sfname, (colnr_T)0)))) - || (!allow_dirs && vim_regexec(®match, tail, (colnr_T)0)))) + && mnv_regexec(®match, sfname, (colnr_T)0)))) + || (!allow_dirs && mnv_regexec(®match, tail, (colnr_T)0)))) result = TRUE; if (prog != NULL) *prog = regmatch.regprog; else - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); return result; } @@ -5696,7 +5696,7 @@ match_file_list(char_u *list, char_u *sfname, char_u *ffname) break; match = match_file_pat(regpat, NULL, ffname, sfname, tail, (int)allow_dirs); - vim_free(regpat); + mnv_free(regpat); if (match) return TRUE; } @@ -5809,7 +5809,7 @@ file_pat_to_reg_pat( // "\*" to "\\.*" e.g., "dir\*.c" // "\?" to "\\." e.g., "dir\??.c" // "\+" to "\+" e.g., "fileX\+.c" - if ((vim_isfilec(p[1]) || p[1] == '*' || p[1] == '?') + if ((mnv_isfilec(p[1]) || p[1] == '*' || p[1] == '?') && p[1] != '+') { reg_pat[i++] = '['; @@ -5839,7 +5839,7 @@ file_pat_to_reg_pat( reg_pat[i++] = '?'; else if (*p == ',' || *p == '%' || *p == '#' - || vim_isspace(*p) || *p == '{' || *p == '}') + || mnv_isspace(*p) || *p == '{' || *p == '}') reg_pat[i++] = *p; else if (*p == '\\' && p[1] == '\\' && p[2] == '{') { @@ -5849,7 +5849,7 @@ file_pat_to_reg_pat( } else { - if (allow_dirs != NULL && vim_ispathsep(*p) + if (allow_dirs != NULL && mnv_ispathsep(*p) #ifdef BACKSLASH_IN_FILENAME && (!no_bslash || *p != '\\') #endif @@ -5893,7 +5893,7 @@ file_pat_to_reg_pat( default: if (enc_dbcs != 0 && (*mb_ptr2len)(p) > 1) reg_pat[i++] = *p++; - else if (allow_dirs != NULL && vim_ispathsep(*p)) + else if (allow_dirs != NULL && mnv_ispathsep(*p)) *allow_dirs = TRUE; reg_pat[i++] = *p; break; @@ -5908,7 +5908,7 @@ file_pat_to_reg_pat( emsg(_(e_missing_open_curly)); else emsg(_(e_missing_close_curly)); - VIM_CLEAR(reg_pat); + MNV_CLEAR(reg_pat); } return reg_pat; } @@ -5925,7 +5925,7 @@ read_eintr(int fd, void *buf, size_t bufsize) for (;;) { - ret = vim_read(fd, buf, bufsize); + ret = mnv_read(fd, buf, bufsize); if (ret >= 0 || errno != EINTR) break; } @@ -5946,7 +5946,7 @@ write_eintr(int fd, void *buf, size_t bufsize) // by a signal. while (ret < (long)bufsize) { - wlen = vim_write(fd, (char *)buf + ret, bufsize - ret); + wlen = mnv_write(fd, (char *)buf + ret, bufsize - ret); if (wlen < 0) { if (errno != EINTR) diff --git a/uvim/src/filepath.c b/uvim/src/filepath.c index 91423d9dcc..0cf91462fe 100644 --- a/uvim/src/filepath.c +++ b/uvim/src/filepath.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * filepath.c: dealing with file names and paths. */ -#include "vim.h" +#include "mnv.h" #ifdef MSWIN /* @@ -41,7 +41,7 @@ get_short_pathname(char_u **fnamep, char_u **bufp, size_t *fnamelen) wfname = enc_to_utf16(*fnamep, NULL); if (wfname == NULL) { - vim_free(newbuf); + mnv_free(newbuf); return FAIL; } @@ -51,11 +51,11 @@ get_short_pathname(char_u **fnamep, char_u **bufp, size_t *fnamelen) // If that doesn't work (not enough space), then save the string // and try again with a new buffer big enough. WCHAR *newbuf_t = newbuf; - newbuf = vim_realloc(newbuf, (l + 1) * sizeof(*newbuf)); + newbuf = mnv_realloc(newbuf, (l + 1) * sizeof(*newbuf)); if (newbuf == NULL) { - vim_free(wfname); - vim_free(newbuf_t); + mnv_free(wfname); + mnv_free(newbuf_t); return FAIL; } // Really should always succeed, as the buffer is big enough. @@ -67,18 +67,18 @@ get_short_pathname(char_u **fnamep, char_u **bufp, size_t *fnamelen) if (p != NULL) { - vim_free(*bufp); + mnv_free(*bufp); *fnamep = *bufp = p; } else { - vim_free(wfname); - vim_free(newbuf); + mnv_free(wfname); + mnv_free(newbuf); return FAIL; } } - vim_free(wfname); - vim_free(newbuf); + mnv_free(wfname); + mnv_free(newbuf); *fnamelen = l == 0 ? l : STRLEN(*bufp); return OK; @@ -117,7 +117,7 @@ shortpath_for_invalid_fname( // Make a copy old_len = *fnamelen; - save_fname = vim_strnsave(*fname, old_len); + save_fname = mnv_strnsave(*fname, old_len); if (save_fname == NULL) { retval = FAIL; @@ -174,12 +174,12 @@ shortpath_for_invalid_fname( new_len = len + sfx_len; *fnamelen = new_len; - vim_free(*bufp); + mnv_free(*bufp); if (new_len > old_len) { // There is not enough space in the currently allocated string, // copy it to a buffer big enough. - *fname = *bufp = vim_strnsave(short_fname, new_len); + *fname = *bufp = mnv_strnsave(short_fname, new_len); if (*fname == NULL) { retval = FAIL; @@ -198,13 +198,13 @@ shortpath_for_invalid_fname( // concat the not-shortened part of the path if ((*fname + len) != endp) - vim_strncpy(*fname + len, endp, sfx_len); + mnv_strncpy(*fname + len, endp, sfx_len); (*fname)[new_len] = NUL; } theend: - vim_free(pbuf_unused); - vim_free(save_fname); + mnv_free(pbuf_unused); + mnv_free(save_fname); return retval; } @@ -229,7 +229,7 @@ shortpath_for_partial( // of the path to return. sepcount = 0; for (p = *fnamep; p < *fnamep + *fnamelen; MB_PTR_ADV(p)) - if (vim_ispathsep(*p)) + if (mnv_ispathsep(*p)) ++sepcount; // Need full path first (use expand_env() to remove a "~/") @@ -261,7 +261,7 @@ shortpath_for_partial( { if (has_mbyte) p -= mb_head_off(tfname, p); - if (vim_ispathsep(*p)) + if (mnv_ispathsep(*p)) { if (sepcount == 0 || (hasTilde && sepcount == 1)) break; @@ -281,7 +281,7 @@ shortpath_for_partial( ++p; // Copy in the string - p indexes into tfname - allocated at pbuf - vim_free(*bufp); + mnv_free(*bufp); *fnamelen = STRLEN(p); *bufp = pbuf; *fnamep = p; @@ -340,7 +340,7 @@ repeat: ) { *fnamep = expand_env_save(*fnamep); - vim_free(*bufp); // free any allocated file name + mnv_free(*bufp); // free any allocated file name *bufp = *fnamep; if (*fnamep == NULL) return -1; @@ -349,24 +349,24 @@ repeat: // When "/." or "/.." is used: force expansion to get rid of it. for (p = *fnamep; *p != NUL; MB_PTR_ADV(p)) { - if (vim_ispathsep(*p) + if (mnv_ispathsep(*p) && p[1] == '.' && (p[2] == NUL - || vim_ispathsep(p[2]) + || mnv_ispathsep(p[2]) || (p[2] == '.' - && (p[3] == NUL || vim_ispathsep(p[3]))))) + && (p[3] == NUL || mnv_ispathsep(p[3]))))) break; } // FullName_save() is slow, don't use it when not needed. - if (*p != NUL || !vim_isAbsName(*fnamep) + if (*p != NUL || !mnv_isAbsName(*fnamep) #ifdef MSWIN // enforce drive letter on Windows paths || **fnamep == '/' || **fnamep == '\\' #endif ) { *fnamep = FullName_save(*fnamep, *p != NUL); - vim_free(*bufp); // free any allocated file name + mnv_free(*bufp); // free any allocated file name *bufp = *fnamep; if (*fnamep == NULL) return -1; @@ -374,7 +374,7 @@ repeat: #ifdef MSWIN # if _WIN32_WINNT >= 0x0500 - if (vim_strchr(*fnamep, '~') != NULL) + if (mnv_strchr(*fnamep, '~') != NULL) { // Expand 8.3 filename to full path. Needed to make sure the same // file does not have two different names. @@ -390,11 +390,11 @@ repeat: if (q != NULL) { - vim_free(*bufp); // free any allocated file name + mnv_free(*bufp); // free any allocated file name *bufp = *fnamep = q; } } - vim_free(wfname); + mnv_free(wfname); } } # endif @@ -403,8 +403,8 @@ repeat: if (mch_isdir(*fnamep)) { // Make room for one or two extra characters. - *fnamep = vim_strnsave(*fnamep, STRLEN(*fnamep) + 2); - vim_free(*bufp); // free any allocated file name + *fnamep = mnv_strnsave(*fnamep, STRLEN(*fnamep) + 2); + mnv_free(*bufp); // free any allocated file name *bufp = *fnamep; if (*fnamep == NULL) return -1; @@ -449,11 +449,11 @@ repeat: mch_dirname(dirname, MAXPATHL); if (has_homerelative) { - s = vim_strsave(dirname); + s = mnv_strsave(dirname); if (s != NULL) { home_replace(NULL, s, dirname, MAXPATHL, TRUE); - vim_free(s); + mnv_free(s); } } namelen = STRLEN(dirname); @@ -463,15 +463,15 @@ repeat: if (fnamencmp(p, dirname, namelen) == 0) { p += namelen; - if (vim_ispathsep(*p)) + if (mnv_ispathsep(*p)) { - while (*p && vim_ispathsep(*p)) + while (*p && mnv_ispathsep(*p)) ++p; *fnamep = p; if (pbuf != NULL) { // free any allocated file name - vim_free(*bufp); + mnv_free(*bufp); *bufp = pbuf; pbuf = NULL; } @@ -484,17 +484,17 @@ repeat: // Only replace it when it starts with '~' if (*dirname == '~') { - s = vim_strsave(dirname); + s = mnv_strsave(dirname); if (s != NULL) { *fnamep = s; - vim_free(*bufp); + mnv_free(*bufp); *bufp = s; has_homerelative = TRUE; } } } - vim_free(pbuf); + mnv_free(pbuf); } } @@ -518,10 +518,10 @@ repeat: if (*fnamelen == 0) { // Result is empty. Turn it into "." to make ":cd %:h" work. - p = vim_strsave((char_u *)"."); + p = mnv_strsave((char_u *)"."); if (p == NULL) return -1; - vim_free(*bufp); + mnv_free(*bufp); *bufp = *fnamep = tail = p; *fnamelen = 1; } @@ -552,16 +552,16 @@ repeat: // the buffer name for "%:8". if (*fnamelen < STRLEN(*fnamep) || *fnamep == fname_start) { - p = vim_strnsave(*fnamep, *fnamelen); + p = mnv_strnsave(*fnamep, *fnamelen); if (p == NULL) return -1; - vim_free(*bufp); + mnv_free(*bufp); *bufp = *fnamep = p; } // Split into two implementations - makes it easier. First is where // there isn't a full name already, second is where there is. - if (!has_fullname && !vim_isAbsName(*fnamep)) + if (!has_fullname && !mnv_isAbsName(*fnamep)) { if (shortpath_for_partial(fnamep, bufp, fnamelen) == FAIL) return -1; @@ -666,19 +666,19 @@ repeat: if (sep) { // find end of pattern - p = vim_strchr(s, sep); + p = mnv_strchr(s, sep); if (p != NULL) { - pat = vim_strnsave(s, p - s); + pat = mnv_strnsave(s, p - s); if (pat != NULL) { s = p + 1; // find end of substitution - p = vim_strchr(s, sep); + p = mnv_strchr(s, sep); if (p != NULL) { - sub = vim_strnsave(s, p - s); - str = vim_strnsave(*fnamep, *fnamelen); + sub = mnv_strnsave(s, p - s); + str = mnv_strnsave(*fnamep, *fnamelen); if (sub != NULL && str != NULL) { size_t slen; @@ -689,15 +689,15 @@ repeat: { *fnamep = s; *fnamelen = slen; - vim_free(*bufp); + mnv_free(*bufp); *bufp = s; didit = TRUE; } } - vim_free(sub); - vim_free(str); + mnv_free(sub); + mnv_free(str); } - vim_free(pat); + mnv_free(pat); } } // after using ":s", repeat all the modifiers @@ -708,16 +708,16 @@ repeat: if (src[*usedlen] == ':' && src[*usedlen + 1] == 'S') { - // vim_strsave_shellescape() needs a NUL terminated string. + // mnv_strsave_shellescape() needs a NUL terminated string. c = (*fnamep)[*fnamelen]; if (c != NUL) (*fnamep)[*fnamelen] = NUL; - p = vim_strsave_shellescape(*fnamep, FALSE, FALSE); + p = mnv_strsave_shellescape(*fnamep, FALSE, FALSE); if (c != NUL) (*fnamep)[*fnamelen] = c; if (p == NULL) return -1; - vim_free(*bufp); + mnv_free(*bufp); *bufp = *fnamep = p; *fnamelen = STRLEN(p); *usedlen += 2; @@ -749,7 +749,7 @@ shorten_dir_len(char_u *str, int trim_len) if (*s == NUL) break; } - else if (vim_ispathsep(*s)) // copy '/' and next char + else if (mnv_ispathsep(*s)) // copy '/' and next char { *d++ = *s; skip = FALSE; @@ -827,7 +827,7 @@ f_chdir(typval_T *argvars, typval_T *rettv) { // Returning an empty string means it failed. // No error message, for historic reasons. - if (in_vim9script()) + if (in_mnv9script()) (void) check_for_string_arg(argvars, 0); return; } @@ -841,9 +841,9 @@ f_chdir(typval_T *argvars, typval_T *rettv) # ifdef BACKSLASH_IN_FILENAME slash_adjust(cwd); # endif - rettv->vval.v_string = vim_strsave(cwd); + rettv->vval.v_string = mnv_strsave(cwd); } - vim_free(cwd); + mnv_free(cwd); } if (argvars[1].v_type != VAR_UNKNOWN) @@ -868,7 +868,7 @@ f_chdir(typval_T *argvars, typval_T *rettv) if (!changedir_func(argvars[0].vval.v_string, TRUE, scope)) // Directory change failed - VIM_CLEAR(rettv->vval.v_string); + MNV_CLEAR(rettv->vval.v_string); } /* @@ -885,7 +885,7 @@ f_delete(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL)) return; @@ -921,7 +921,7 @@ f_delete(typval_T *argvars, typval_T *rettv) void f_executable(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; // Check in $PATH and also check directly if there is a directory name. @@ -936,7 +936,7 @@ f_exepath(typval_T *argvars, typval_T *rettv) { char_u *p = NULL; - if (in_vim9script() && check_for_nonempty_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_nonempty_string_arg(argvars, 0) == FAIL) return; (void)mch_can_exe(tv_get_string(&argvars[0]), &p, TRUE); rettv->v_type = VAR_STRING; @@ -949,7 +949,7 @@ f_exepath(typval_T *argvars, typval_T *rettv) void f_filereadable(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; rettv->vval.v_number = file_is_readable(tv_get_string(&argvars[0])); } @@ -961,7 +961,7 @@ f_filereadable(typval_T *argvars, typval_T *rettv) void f_filewritable(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; rettv->vval.v_number = filewritable(tv_get_string(&argvars[0])); } @@ -983,7 +983,7 @@ findfilendir( rettv->vval.v_string = NULL; rettv->v_type = VAR_STRING; - if (in_vim9script() + if (in_mnv9script() && (check_for_nonempty_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -1018,7 +1018,7 @@ findfilendir( do { if (rettv->v_type == VAR_STRING || rettv->v_type == VAR_LIST) - vim_free(fresult); + mnv_free(fresult); fresult = find_file_in_path_option(first ? fname : NULL, first ? (int)STRLEN(fname) : 0, 0, first, path, @@ -1034,8 +1034,8 @@ findfilendir( } while ((rettv->v_type == VAR_LIST || --count > 0) && fresult != NULL); - vim_free(file_to_find); - vim_findfile_cleanup(search_ctx); + mnv_free(file_to_find); + mnv_findfile_cleanup(search_ctx); } if (rettv->v_type == VAR_STRING) @@ -1073,7 +1073,7 @@ f_fnamemodify(typval_T *argvars, typval_T *rettv) char_u *fbuf = NULL; char_u buf[NUMBUFLEN]; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; @@ -1093,8 +1093,8 @@ f_fnamemodify(typval_T *argvars, typval_T *rettv) if (fname == NULL) rettv->vval.v_string = NULL; else - rettv->vval.v_string = vim_strnsave(fname, len); - vim_free(fbuf); + rettv->vval.v_string = mnv_strnsave(fname, len); + mnv_free(fbuf); } /* @@ -1125,7 +1125,7 @@ f_getcwd(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_opt_number_arg(argvars, 0) == FAIL || (argvars[0].v_type != VAR_UNKNOWN && check_for_opt_number_arg(argvars, 1) == FAIL))) @@ -1140,22 +1140,22 @@ f_getcwd(typval_T *argvars, typval_T *rettv) if (wp != NULL && wp->w_localdir != NULL && argvars[0].v_type != VAR_UNKNOWN) - rettv->vval.v_string = vim_strsave(wp->w_localdir); + rettv->vval.v_string = mnv_strsave(wp->w_localdir); else if (tp != NULL && tp->tp_localdir != NULL && argvars[0].v_type != VAR_UNKNOWN) - rettv->vval.v_string = vim_strsave(tp->tp_localdir); + rettv->vval.v_string = mnv_strsave(tp->tp_localdir); else if (wp != NULL || tp != NULL || global) { if (globaldir != NULL && argvars[0].v_type != VAR_UNKNOWN) - rettv->vval.v_string = vim_strsave(globaldir); + rettv->vval.v_string = mnv_strsave(globaldir); else { cwd = alloc(MAXPATHL); if (cwd != NULL) { if (mch_dirname(cwd, MAXPATHL) != FAIL) - rettv->vval.v_string = vim_strsave(cwd); - vim_free(cwd); + rettv->vval.v_string = mnv_strsave(cwd); + mnv_free(cwd); } } } @@ -1195,14 +1195,14 @@ f_getfperm(typval_T *argvars, typval_T *rettv) char_u *perm = NULL; char_u permbuf[] = "---------"; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; fname = tv_get_string(&argvars[0]); rettv->v_type = VAR_STRING; if (mch_stat((char *)fname, &st) >= 0) - perm = vim_strsave(getfpermst(&st, permbuf)); + perm = mnv_strsave(getfpermst(&st, permbuf)); rettv->vval.v_string = perm; } @@ -1215,7 +1215,7 @@ f_getfsize(typval_T *argvars, typval_T *rettv) char_u *fname; stat_T st; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; fname = tv_get_string(&argvars[0]); @@ -1245,7 +1245,7 @@ f_getftime(typval_T *argvars, typval_T *rettv) char_u *fname; stat_T st; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; fname = tv_get_string(&argvars[0]); @@ -1292,14 +1292,14 @@ f_getftype(typval_T *argvars, typval_T *rettv) stat_T st; char_u *type = NULL; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; fname = tv_get_string(&argvars[0]); rettv->v_type = VAR_STRING; if (mch_lstat((char *)fname, &st) >= 0) - type = vim_strsave(getftypest(&st)); + type = mnv_strsave(getftypest(&st)); rettv->vval.v_string = type; } @@ -1313,7 +1313,7 @@ f_glob(typval_T *argvars, typval_T *rettv) expand_T xpc; int error = FALSE; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_bool_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -1372,10 +1372,10 @@ f_glob2regpat(typval_T *argvars, typval_T *rettv) char_u buf[NUMBUFLEN]; char_u *pat; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; - pat = tv_get_string_buf_chk_strict(&argvars[0], buf, in_vim9script()); + pat = tv_get_string_buf_chk_strict(&argvars[0], buf, in_mnv9script()); rettv->v_type = VAR_STRING; rettv->vval.v_string = (pat == NULL) ? NULL : file_pat_to_reg_pat(pat, NULL, NULL, FALSE); @@ -1394,7 +1394,7 @@ f_globpath(typval_T *argvars, typval_T *rettv) garray_T ga; int i; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL || check_for_opt_bool_arg(argvars, 2) == FAIL @@ -1444,7 +1444,7 @@ f_globpath(typval_T *argvars, typval_T *rettv) void f_isdirectory(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; rettv->vval.v_number = mch_isdir(tv_get_string(&argvars[0])); @@ -1456,7 +1456,7 @@ f_isdirectory(typval_T *argvars, typval_T *rettv) void f_isabsolutepath(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; rettv->vval.v_number = mch_isFullName(tv_get_string_strict(&argvars[0])); @@ -1483,18 +1483,18 @@ mkdir_recurse(char_u *dir, int prot, char_u **created) return OK; // If the directory exists we're done. Otherwise: create it. - updir = vim_strnsave(dir, p - dir); + updir = mnv_strnsave(dir, p - dir); if (updir == NULL) return FAIL; if (mch_isdir(updir)) r = OK; else if (mkdir_recurse(updir, prot, created) == OK) { - r = vim_mkdir_emsg(updir, prot); + r = mnv_mkdir_emsg(updir, prot); if (r == OK && created != NULL && *created == NULL) *created = FullName_save(updir, FALSE); } - vim_free(updir); + mnv_free(updir); return r; } @@ -1515,7 +1515,7 @@ f_mkdir(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_nonempty_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -1541,12 +1541,12 @@ f_mkdir(typval_T *argvars, typval_T *rettv) return; } arg2 = tv_get_string(&argvars[1]); - defer = vim_strchr(arg2, 'D') != NULL; - defer_recurse = vim_strchr(arg2, 'R') != NULL; + defer = mnv_strchr(arg2, 'D') != NULL; + defer_recurse = mnv_strchr(arg2, 'R') != NULL; if ((defer || defer_recurse) && !can_add_defer()) return; - if (vim_strchr(arg2, 'p') != NULL) + if (mnv_strchr(arg2, 'p') != NULL) { if (mch_isdir(dir)) { @@ -1557,7 +1557,7 @@ f_mkdir(typval_T *argvars, typval_T *rettv) mkdir_recurse(dir, prot, defer || defer_recurse ? &created : NULL); } } - rettv->vval.v_number = vim_mkdir_emsg(dir, prot); + rettv->vval.v_number = mnv_mkdir_emsg(dir, prot); // Handle "D" and "R": deferred deletion of the created directory. if (rettv->vval.v_number == OK @@ -1572,13 +1572,13 @@ f_mkdir(typval_T *argvars, typval_T *rettv) tv[0].vval.v_string = created; tv[1].v_type = VAR_STRING; tv[1].v_lock = 0; - tv[1].vval.v_string = vim_strsave( + tv[1].vval.v_string = mnv_strsave( (char_u *)(defer_recurse ? "rf" : "d")); if (tv[0].vval.v_string == NULL || tv[1].vval.v_string == NULL || add_defer((char_u *)"delete", 2, tv) == FAIL) { - vim_free(tv[0].vval.v_string); - vim_free(tv[1].vval.v_string); + mnv_free(tv[0].vval.v_string); + mnv_free(tv[1].vval.v_string); } } } @@ -1592,7 +1592,7 @@ f_pathshorten(typval_T *argvars, typval_T *rettv) char_u *p; int trim_len = 1; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_number_arg(argvars, 1) == FAIL)) return; @@ -1611,7 +1611,7 @@ f_pathshorten(typval_T *argvars, typval_T *rettv) rettv->vval.v_string = NULL; else { - p = vim_strsave(p); + p = mnv_strsave(p); rettv->vval.v_string = p; if (p != NULL) shorten_dir_len(p, trim_len); @@ -1632,16 +1632,16 @@ checkitem_common(void *context, char_u *name, dict_T *dict) int retval = 0; int error = FALSE; - prepare_vimvar(VV_VAL, &save_val); + prepare_mnvvar(VV_VAL, &save_val); if (name != NULL) { - set_vim_var_string(VV_VAL, name, -1); + set_mnv_var_string(VV_VAL, name, -1); argv[0].v_type = VAR_STRING; argv[0].vval.v_string = name; } else { - set_vim_var_dict(VV_VAL, dict); + set_mnv_var_dict(VV_VAL, dict); argv[0].v_type = VAR_DICT; argv[0].vval.v_dict = dict; } @@ -1662,10 +1662,10 @@ checkitem_common(void *context, char_u *name, dict_T *dict) theend: if (name != NULL) - set_vim_var_string(VV_VAL, NULL, 0); + set_mnv_var_string(VV_VAL, NULL, 0); else - set_vim_var_dict(VV_VAL, NULL); - restore_vimvar(VV_VAL, &save_val); + set_mnv_var_dict(VV_VAL, NULL); + restore_mnvvar(VV_VAL, &save_val); return retval; } @@ -1728,7 +1728,7 @@ f_readdir(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || (argvars[1].v_type != VAR_UNKNOWN && check_for_opt_dict_arg(argvars, 2) == FAIL))) @@ -1781,7 +1781,7 @@ f_readdirex(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || (argvars[1].v_type != VAR_UNKNOWN && check_for_opt_dict_arg(argvars, 2) == FAIL))) @@ -1909,13 +1909,13 @@ read_file_or_blob(typval_T *argvars, typval_T *rettv, int always_blob) --prevlen; } if (prevlen == 0) - s = vim_strnsave(start, len); + s = mnv_strnsave(start, len); else { // Change "prev" buffer to be the right size. This way // the bytes are only copied once, and very long lines are // allocated only once. - if ((s = vim_realloc(prev, prevlen + len + 1)) != NULL) + if ((s = mnv_realloc(prev, prevlen + len + 1)) != NULL) { mch_memmove(s + prevlen, start, len); s[prevlen + len] = NUL; @@ -1932,7 +1932,7 @@ read_file_or_blob(typval_T *argvars, typval_T *rettv, int always_blob) if ((li = listitem_alloc()) == NULL) { - vim_free(s); + mnv_free(s); failed = TRUE; break; } @@ -2010,7 +2010,7 @@ read_file_or_blob(typval_T *argvars, typval_T *rettv, int always_blob) long growmin = (long)((p - start) * 2 + prevlen); prevsize = grow50pc > growmin ? grow50pc : growmin; } - newprev = vim_realloc(prev, prevsize); + newprev = mnv_realloc(prev, prevsize); if (newprev == NULL) { do_outofmem_msg((long_u)prevsize); @@ -2041,7 +2041,7 @@ read_file_or_blob(typval_T *argvars, typval_T *rettv, int always_blob) rettv_list_alloc(rettv); } - vim_free(prev); + mnv_free(prev); fclose(fd); } @@ -2051,7 +2051,7 @@ read_file_or_blob(typval_T *argvars, typval_T *rettv, int always_blob) void f_readblob(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_number_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -2067,7 +2067,7 @@ f_readblob(typval_T *argvars, typval_T *rettv) void f_readfile(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_nonempty_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -2088,7 +2088,7 @@ f_resolve(typval_T *argvars, typval_T *rettv) char_u *buf = NULL; # endif - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; p = tv_get_string(&argvars[0]); @@ -2100,7 +2100,7 @@ f_resolve(typval_T *argvars, typval_T *rettv) if (v != NULL) rettv->vval.v_string = v; else - rettv->vval.v_string = vim_strsave(p); + rettv->vval.v_string = mnv_strsave(p); } # else # ifdef HAVE_READLINK @@ -2113,11 +2113,11 @@ f_resolve(typval_T *argvars, typval_T *rettv) int has_trailing_pathsep = FALSE; int limit = 100; - p = vim_strsave(p); + p = mnv_strsave(p); if (p == NULL) goto fail; - if (p[0] == '.' && (vim_ispathsep(p[1]) - || (p[1] == '.' && (vim_ispathsep(p[2]))))) + if (p[0] == '.' && (mnv_ispathsep(p[1]) + || (p[1] == '.' && (mnv_ispathsep(p[2]))))) is_relative_to_current = TRUE; len = STRLEN(p); @@ -2132,15 +2132,15 @@ f_resolve(typval_T *argvars, typval_T *rettv) { // Separate the first path component in "p", and keep the // remainder (beginning with the path separator). - remain = vim_strsave(q - 1); + remain = mnv_strsave(q - 1); q[-1] = NUL; } buf = alloc(MAXPATHL + 1); if (buf == NULL) { - vim_free(p); - vim_free(remain); + mnv_free(p); + mnv_free(remain); goto fail; } @@ -2155,8 +2155,8 @@ f_resolve(typval_T *argvars, typval_T *rettv) if (limit-- == 0) { - vim_free(p); - vim_free(remain); + mnv_free(p); + mnv_free(remain); emsg(_(e_too_many_symbolic_links_cycle)); rettv->vval.v_string = NULL; goto fail; @@ -2169,17 +2169,17 @@ f_resolve(typval_T *argvars, typval_T *rettv) // Separate the first path component in the link value and // concatenate the remainders. - q = getnextcomp(vim_ispathsep(*buf) ? buf + 1 : buf); + q = getnextcomp(mnv_ispathsep(*buf) ? buf + 1 : buf); if (*q != NUL) { if (remain == NULL) - remain = vim_strsave(q - 1); + remain = mnv_strsave(q - 1); else { cpy = concat_str(q - 1, remain); if (cpy != NULL) { - vim_free(remain); + mnv_free(remain); remain = cpy; } } @@ -2201,14 +2201,14 @@ f_resolve(typval_T *argvars, typval_T *rettv) { STRCPY(cpy, p); STRCPY(gettail(cpy), buf); - vim_free(p); + mnv_free(p); p = cpy; } } else { - vim_free(p); - p = vim_strsave(buf); + mnv_free(p); + p = mnv_strsave(buf); } } @@ -2218,38 +2218,38 @@ f_resolve(typval_T *argvars, typval_T *rettv) // Append the first path component of "remain" to "p". q = getnextcomp(remain + 1); len = q - remain - (*q != NUL); - cpy = vim_strnsave(p, STRLEN(p) + len); + cpy = mnv_strnsave(p, STRLEN(p) + len); if (cpy != NULL) { STRNCAT(cpy, remain, len); - vim_free(p); + mnv_free(p); p = cpy; } // Shorten "remain". if (*q != NUL) STRMOVE(remain, q - 1); else - VIM_CLEAR(remain); + MNV_CLEAR(remain); } // If the result is a relative path name, make it explicitly relative to // the current directory if and only if the argument had this form. - if (!vim_ispathsep(*p)) + if (!mnv_ispathsep(*p)) { if (is_relative_to_current && *p != NUL && !(p[0] == '.' && (p[1] == NUL - || vim_ispathsep(p[1]) + || mnv_ispathsep(p[1]) || (p[1] == '.' && (p[2] == NUL - || vim_ispathsep(p[2])))))) + || mnv_ispathsep(p[2])))))) { // Prepend "./". cpy = concat_str((char_u *)"./", p); if (cpy != NULL) { - vim_free(p); + mnv_free(p); p = cpy; } } @@ -2257,7 +2257,7 @@ f_resolve(typval_T *argvars, typval_T *rettv) { // Strip leading "./". q = p; - while (q[0] == '.' && vim_ispathsep(q[1])) + while (q[0] == '.' && mnv_ispathsep(q[1])) q += 2; if (q > p) STRMOVE(p, p + 2); @@ -2276,7 +2276,7 @@ f_resolve(typval_T *argvars, typval_T *rettv) rettv->vval.v_string = p; } # else - rettv->vval.v_string = vim_strsave(p); + rettv->vval.v_string = mnv_strsave(p); # endif # endif @@ -2284,7 +2284,7 @@ f_resolve(typval_T *argvars, typval_T *rettv) # ifdef HAVE_READLINK fail: - vim_free(buf); + mnv_free(buf); # endif rettv->v_type = VAR_STRING; } @@ -2298,7 +2298,7 @@ f_tempname(typval_T *argvars UNUSED, typval_T *rettv) static int x = 'A'; rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_tempname(x, FALSE); + rettv->vval.v_string = mnv_tempname(x, FALSE); // Advance 'x' to use A-Z and 0-9, so that there are at least 34 different // names. Skip 'I' and 'O', they are used for shell redirection. @@ -2336,7 +2336,7 @@ f_writefile(typval_T *argvars, typval_T *rettv) if (check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_list_or_blob_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL || check_for_opt_string_arg(argvars, 2) == FAIL)) @@ -2371,16 +2371,16 @@ f_writefile(typval_T *argvars, typval_T *rettv) if (arg2 == NULL) return; - if (vim_strchr(arg2, 'b') != NULL) + if (mnv_strchr(arg2, 'b') != NULL) binary = TRUE; - if (vim_strchr(arg2, 'a') != NULL) + if (mnv_strchr(arg2, 'a') != NULL) append = TRUE; - if (vim_strchr(arg2, 'D') != NULL) + if (mnv_strchr(arg2, 'D') != NULL) defer = TRUE; # ifdef HAVE_FSYNC - if (vim_strchr(arg2, 's') != NULL) + if (mnv_strchr(arg2, 's') != NULL) do_fsync = TRUE; - else if (vim_strchr(arg2, 'S') != NULL) + else if (mnv_strchr(arg2, 'S') != NULL) do_fsync = FALSE; # endif } @@ -2435,7 +2435,7 @@ f_writefile(typval_T *argvars, typval_T *rettv) if (ret == 0 && do_fsync) // Ignore the error, the user wouldn't know what to do about // it. May happen for a device. - vim_ignored = vim_fsync(fileno(fd)); + mnv_ignored = mnv_fsync(fileno(fd)); # endif fclose(fd); } @@ -2492,7 +2492,7 @@ do_browse( } else if (gettail(dflt) != dflt) // default file name includes a path { - tofree = vim_strsave(dflt); + tofree = mnv_strsave(dflt); if (tofree != NULL) { initdir = tofree; @@ -2516,7 +2516,7 @@ do_browse( { if (dflt == NULL || *dflt == NUL) dflt = gettail(curbuf->b_ffname); - tofree = vim_strsave(curbuf->b_ffname); + tofree = mnv_strsave(curbuf->b_ffname); if (tofree != NULL) { initdir = tofree; @@ -2585,15 +2585,15 @@ do_browse( // keep the directory for next time if (fname != NULL) { - vim_free(last_dir); - last_dir = vim_strsave(fname); + mnv_free(last_dir); + last_dir = mnv_strsave(fname); if (last_dir != NULL && !(flags & BROWSE_DIR)) { *gettail(last_dir) = NUL; if (*last_dir == NUL) { // filename only returned, must be in current dir - vim_free(last_dir); + mnv_free(last_dir); last_dir = alloc(MAXPATHL); if (last_dir != NULL) mch_dirname(last_dir, MAXPATHL); @@ -2601,7 +2601,7 @@ do_browse( } } - vim_free(tofree); + mnv_free(tofree); cmdmod.cmod_flags = save_cmod_flags; return fname; @@ -2625,7 +2625,7 @@ f_browse(typval_T *argvars UNUSED, typval_T *rettv) char_u buf2[NUMBUFLEN]; int error = FALSE; - if (in_vim9script() + if (in_mnv9script() && (check_for_bool_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL || check_for_string_arg(argvars, 2) == FAIL @@ -2660,7 +2660,7 @@ f_browsedir(typval_T *argvars UNUSED, typval_T *rettv) char_u *initdir; char_u buf[NUMBUFLEN]; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; @@ -2699,7 +2699,7 @@ f_filecopy(typval_T *argvars, typval_T *rettv) if (mch_lstat((char *)from, &st) >= 0 && (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode))) - rettv->vval.v_number = vim_copyfile( + rettv->vval.v_number = mnv_copyfile( tv_get_string(&argvars[0]), tv_get_string(&argvars[1])) == OK ? TRUE : FALSE; } @@ -2736,7 +2736,7 @@ home_replace( */ if (buf != NULL && buf->b_help) { - vim_snprintf((char *)dst, dstlen, "%s", gettail(src)); + mnv_snprintf((char *)dst, dstlen, "%s", gettail(src)); return; } @@ -2770,7 +2770,7 @@ home_replace( (void)modify_fname((char_u *)":p", FALSE, &usedlen, &homedir_env, &fbuf, &flen); flen = STRLEN(homedir_env); - if (flen > 0 && vim_ispathsep(homedir_env[flen - 1])) + if (flen > 0 && mnv_ispathsep(homedir_env[flen - 1])) // Remove the trailing / that is added to a directory. homedir_env[flen - 1] = NUL; } @@ -2797,7 +2797,7 @@ home_replace( { if ( len && fnamencmp(src, p, len) == 0 - && (vim_ispathsep(src[len]) + && (mnv_ispathsep(src[len]) || (!one && (src[len] == ',' || src[len] == ' ')) || src[len] == NUL)) { @@ -2828,7 +2828,7 @@ home_replace( *dst = NUL; if (homedir_env != homedir_env_orig) - vim_free(homedir_env); + mnv_free(homedir_env); } /* @@ -2879,7 +2879,7 @@ fullpathcmp( if (expandenv) expand_env(s1, exp1, MAXPATHL); else - vim_strncpy(exp1, s1, MAXPATHL - 1); + mnv_strncpy(exp1, s1, MAXPATHL - 1); r1 = mch_stat((char *)exp1, &st1); r2 = mch_stat((char *)s2, &st2); if (r1 != 0 && r2 != 0) @@ -2889,8 +2889,8 @@ fullpathcmp( { if (fnamecmp(exp1, s2) == 0) return FPC_SAMEX; - r1 = vim_FullName(exp1, full1, MAXPATHL, FALSE); - r2 = vim_FullName(s2, full2, MAXPATHL, FALSE); + r1 = mnv_FullName(exp1, full1, MAXPATHL, FALSE); + r2 = mnv_FullName(s2, full2, MAXPATHL, FALSE); if (r1 == OK && r2 == OK && fnamecmp(full1, full2) == 0) return FPC_SAMEX; } @@ -2917,11 +2917,11 @@ fullpathcmp( if (expandenv) expand_env(s1, exp1, MAXPATHL); else - vim_strncpy(exp1, s1, MAXPATHL - 1); - r1 = vim_FullName(exp1, full1, MAXPATHL, FALSE); - r2 = vim_FullName(s2, full2, MAXPATHL, FALSE); + mnv_strncpy(exp1, s1, MAXPATHL - 1); + r1 = mnv_FullName(exp1, full1, MAXPATHL, FALSE); + r2 = mnv_FullName(s2, full2, MAXPATHL, FALSE); - // If vim_FullName() fails, the file probably doesn't exist. + // If mnv_FullName() fails, the file probably doesn't exist. if (r1 != OK && r2 != OK) { if (checkname && fnamecmp(exp1, s2) == 0) @@ -2935,7 +2935,7 @@ fullpathcmp( retval = FPC_DIFF; else retval = FPC_SAME; - vim_free(exp1); + mnv_free(exp1); } return retval; #endif @@ -2955,7 +2955,7 @@ gettail(char_u *fname) return (char_u *)""; for (p1 = p2 = get_past_head(fname); *p2; ) // find last part of path { - if (vim_ispathsep_nocolon(*p2)) + if (mnv_ispathsep_nocolon(*p2)) p1 = p2 + 1; MB_PTR_ADV(p2); } @@ -2990,7 +2990,7 @@ gettail_sep(char_u *fname) char_u * getnextcomp(char_u *fname) { - while (*fname && !vim_ispathsep(*fname)) + while (*fname && !mnv_ispathsep(*fname)) MB_PTR_ADV(fname); if (*fname) ++fname; @@ -3016,7 +3016,7 @@ get_past_head(char_u *path) #else # if defined(AMIGA) // may skip "label:" - retval = vim_strchr(path, ':'); + retval = mnv_strchr(path, ':'); if (retval == NULL) retval = path; # else // Unix @@ -3024,7 +3024,7 @@ get_past_head(char_u *path) # endif #endif - while (vim_ispathsep(*retval)) + while (mnv_ispathsep(*retval)) ++retval; return retval; @@ -3035,7 +3035,7 @@ get_past_head(char_u *path) * Note that for MS-Windows this includes the colon. */ int -vim_ispathsep(int c) +mnv_ispathsep(int c) { #ifdef UNIX return (c == '/'); // UNIX has ':' inside file names @@ -3055,12 +3055,12 @@ vim_ispathsep(int c) } /* - * Like vim_ispathsep(c), but exclude the colon for MS-Windows. + * Like mnv_ispathsep(c), but exclude the colon for MS-Windows. */ int -vim_ispathsep_nocolon(int c) +mnv_ispathsep_nocolon(int c) { - return vim_ispathsep(c) + return mnv_ispathsep(c) #ifdef BACKSLASH_IN_FILENAME && c != ':' #endif @@ -3094,10 +3094,10 @@ dir_of_file_exists(char_u *fname) * and deal with 'fileignorecase'. */ int -vim_fnamecmp(char_u *x, char_u *y) +mnv_fnamecmp(char_u *x, char_u *y) { #ifdef BACKSLASH_IN_FILENAME - return vim_fnamencmp(x, y, MAXPATHL); + return mnv_fnamencmp(x, y, MAXPATHL); #else if (p_fic) return MB_STRICMP(x, y); @@ -3106,7 +3106,7 @@ vim_fnamecmp(char_u *x, char_u *y) } int -vim_fnamencmp(char_u *x, char_u *y, size_t len) +mnv_fnamencmp(char_u *x, char_u *y, size_t len) { #ifdef BACKSLASH_IN_FILENAME char_u *px = x; @@ -3224,11 +3224,11 @@ FullName_save( if (buf == NULL) return NULL; - if (vim_FullName(fname, buf, MAXPATHL, force) != FAIL) - new_fname = vim_strsave(buf); + if (mnv_FullName(fname, buf, MAXPATHL, force) != FAIL) + new_fname = mnv_strsave(buf); else - new_fname = vim_strsave(fname); - vim_free(buf); + new_fname = mnv_strsave(fname); + mnv_free(buf); return new_fname; } @@ -3236,7 +3236,7 @@ FullName_save( * return TRUE if "fname" exists. */ int -vim_fexists(char_u *fname) +mnv_fexists(char_u *fname) { stat_T st; @@ -3297,8 +3297,8 @@ expand_wildcards_eval( ret = OK; } } - vim_free(exp_pat); - vim_free(eval_pat); + mnv_free(exp_pat); + mnv_free(eval_pat); } return ret; @@ -3347,19 +3347,19 @@ expand_wildcards( if (match_file_list(p_wig, (*files)[i], ffname)) { // remove this matching file from the list - vim_free((*files)[i]); + mnv_free((*files)[i]); for (j = i; j + 1 < *num_files; ++j) (*files)[j] = (*files)[j + 1]; --*num_files; --i; } - vim_free(ffname); + mnv_free(ffname); } // If the number of matches is now zero, we fail. if (*num_files == 0) { - VIM_CLEAR(*files); + MNV_CLEAR(*files); return FAIL; } } @@ -3411,7 +3411,7 @@ match_suffix(char_u *fname) char_u *tail = gettail(fname); // empty entry: match name without a '.' - if (vim_strchr(tail, '.') == NULL) + if (mnv_strchr(tail, '.') == NULL) { setsuflen = 1; break; @@ -3433,7 +3433,7 @@ match_suffix(char_u *fname) * Return TRUE if we can expand this backtick thing here. */ static int -vim_backtick(char_u *p) +mnv_backtick(char_u *p) { return (*p == '`' && *(p + 1) != NUL && *(p + STRLEN(p) - 1) == '`'); } @@ -3456,7 +3456,7 @@ expand_backtick( int i; // Create the command: lop off the backticks. - cmd = vim_strnsave(pat + 1, STRLEN(pat) - 2); + cmd = mnv_strnsave(pat + 1, STRLEN(pat) - 2); if (cmd == NULL) return -1; @@ -3467,7 +3467,7 @@ expand_backtick( #endif buffer = get_cmd_output(cmd, NULL, (flags & EW_SILENT) ? SHELL_SILENT : 0, NULL); - vim_free(cmd); + mnv_free(cmd); if (buffer == NULL) return -1; @@ -3492,7 +3492,7 @@ expand_backtick( ++cmd; } - vim_free(buffer); + mnv_free(buffer); return cnt; } @@ -3582,7 +3582,7 @@ dos_expandpath( s = p + 1; } else if (path_end >= path + wildoff - && vim_strchr((char_u *)"*?[~", *path_end) != NULL) + && mnv_strchr((char_u *)"*?[~", *path_end) != NULL) e = p; if (has_mbyte) { @@ -3618,7 +3618,7 @@ dos_expandpath( pat = file_pat_to_reg_pat(s, e, NULL, FALSE); if (pat == NULL) { - vim_free(buf); + mnv_free(buf); return 0; } @@ -3626,19 +3626,19 @@ dos_expandpath( if (flags & (EW_NOERROR | EW_NOTWILD)) ++emsg_silent; regmatch.rm_ic = TRUE; // Always ignore case - regmatch.regprog = vim_regcomp(pat, RE_MAGIC); + regmatch.regprog = mnv_regcomp(pat, RE_MAGIC); if (flags & (EW_NOERROR | EW_NOTWILD)) --emsg_silent; - vim_free(pat); + mnv_free(pat); if (regmatch.regprog == NULL && (flags & EW_NOTWILD) == 0) { - vim_free(buf); + mnv_free(buf); return 0; } // remember the pattern or file name being looked for - matchname = vim_strsave(s); + matchname = mnv_strsave(s); len = (size_t)(s - buf); // If "**" is by itself, this is the first time we encounter it and more @@ -3646,14 +3646,14 @@ dos_expandpath( if (!didstar && stardepth < 100 && starstar && e - s == 2 && *path_end == '/') { - vim_snprintf((char *)s, buflen - len, "%s", path_end + 1); + mnv_snprintf((char *)s, buflen - len, "%s", path_end + 1); ++stardepth; (void)dos_expandpath(gap, buf, len, flags, TRUE); --stardepth; } // Scan all files in the directory with "dir/ *.*" - vim_snprintf((char *)s, buflen - len, "*.*"); + mnv_snprintf((char *)s, buflen - len, "*.*"); wn = enc_to_utf16(buf, NULL); if (wn != NULL) hFind = FindFirstFileW(wn, &wfb); @@ -3667,8 +3667,8 @@ dos_expandpath( break; // out of memory // Do not use the alternate filename when the file name ends in '~', - // because it picks up backup files: short name for "foo.vim~" is - // "foo~1.vim", which matches "*.vim". + // because it picks up backup files: short name for "foo.mnv~" is + // "foo~1.mnv", which matches "*.mnv". if (*wfb.cAlternateFileName == NUL || p[STRLEN(p) - 1] == '~') p_alt = NULL; else @@ -3682,13 +3682,13 @@ dos_expandpath( && p[1] != NUL && (p[1] != '.' || p[2] != NUL))) && (matchname == NULL || (regmatch.regprog != NULL - && (vim_regexec(®match, p, (colnr_T)0) + && (mnv_regexec(®match, p, (colnr_T)0) || (p_alt != NULL - && vim_regexec(®match, p_alt, (colnr_T)0)))) + && mnv_regexec(®match, p_alt, (colnr_T)0)))) || ((flags & EW_NOTWILD) && fnamencmp(path + len, p, e - s) == 0))) { - len += vim_snprintf((char *)s, buflen - len, "%s", p); + len += mnv_snprintf((char *)s, buflen - len, "%s", p); if (len + 1 < buflen) { if (starstar && stardepth < 100 @@ -3696,14 +3696,14 @@ dos_expandpath( { // For "**" in the pattern first go deeper in the tree to // find matches. - vim_snprintf((char *)buf + len, buflen - len, + mnv_snprintf((char *)buf + len, buflen - len, "/**%s", path_end); ++stardepth; (void)dos_expandpath(gap, buf, len + 1, flags, TRUE); --stardepth; } - vim_snprintf((char *)buf + len, buflen - len, "%s", path_end); + mnv_snprintf((char *)buf + len, buflen - len, "%s", path_end); if (mch_has_exp_wildcard(path_end)) { if (stardepth < 100) @@ -3731,16 +3731,16 @@ dos_expandpath( } } - vim_free(p_alt); - vim_free(p); + mnv_free(p_alt); + mnv_free(p); ok = FindNextFileW(hFind, &wfb); } FindClose(hFind); - vim_free(wn); - vim_free(buf); - vim_regfree(regmatch.regprog); - vim_free(matchname); + mnv_free(wn); + mnv_free(buf); + mnv_regfree(regmatch.regprog); + mnv_free(matchname); matches = gap->ga_len - start_len; if (matches > 0) @@ -3829,9 +3829,9 @@ unix_expandpath( s = p + 1; } else if (path_end >= path + wildoff - && (vim_strchr((char_u *)"*?[{~$", *path_end) != NULL + && (mnv_strchr((char_u *)"*?[{~$", *path_end) != NULL || (!p_fic && (flags & EW_ICASE) - && vim_isalpha(PTR2CHAR(path_end))))) + && mnv_isalpha(PTR2CHAR(path_end))))) e = p; if (has_mbyte) { @@ -3868,7 +3868,7 @@ unix_expandpath( pat = file_pat_to_reg_pat(s, e, NULL, FALSE); if (pat == NULL) { - vim_free(buf); + mnv_free(buf); return 0; } @@ -3879,14 +3879,14 @@ unix_expandpath( regmatch.rm_ic = p_fic; // ignore case when 'fileignorecase' is set if (flags & (EW_NOERROR | EW_NOTWILD)) ++emsg_silent; - regmatch.regprog = vim_regcomp(pat, RE_MAGIC); + regmatch.regprog = mnv_regcomp(pat, RE_MAGIC); if (flags & (EW_NOERROR | EW_NOTWILD)) --emsg_silent; - vim_free(pat); + mnv_free(pat); if (regmatch.regprog == NULL && (flags & EW_NOTWILD) == 0) { - vim_free(buf); + mnv_free(buf); return 0; } @@ -3896,7 +3896,7 @@ unix_expandpath( if (!didstar && stardepth < 100 && starstar && e - s == 2 && *path_end == '/') { - vim_snprintf((char *)s, buflen - len, "%s", path_end + 1); + mnv_snprintf((char *)s, buflen - len, "%s", path_end + 1); ++stardepth; (void)unix_expandpath(gap, buf, len, flags, TRUE); --stardepth; @@ -3919,12 +3919,12 @@ unix_expandpath( || ((flags & EW_DODOT) && dp->d_name[1] != NUL && (dp->d_name[1] != '.' || dp->d_name[2] != NUL))) - && ((regmatch.regprog != NULL && vim_regexec(®match, + && ((regmatch.regprog != NULL && mnv_regexec(®match, (char_u *)dp->d_name, (colnr_T)0)) || ((flags & EW_NOTWILD) && fnamencmp(path + len, dp->d_name, e - s) == 0))) { - len += vim_snprintf((char *)s, buflen - len, "%s", dp->d_name); + len += mnv_snprintf((char *)s, buflen - len, "%s", dp->d_name); if (len + 1 >= buflen) continue; @@ -3932,14 +3932,14 @@ unix_expandpath( { // For "**" in the pattern first go deeper in the tree to // find matches. - vim_snprintf((char *)buf + len, buflen - len, + mnv_snprintf((char *)buf + len, buflen - len, "/**%s", path_end); ++stardepth; (void)unix_expandpath(gap, buf, len + 1, flags, TRUE); --stardepth; } - vim_snprintf((char *)buf + len, buflen - len, "%s", path_end); + mnv_snprintf((char *)buf + len, buflen - len, "%s", path_end); if (mch_has_exp_wildcard(path_end)) // handle more wildcards { if (stardepth < 100) @@ -3971,7 +3971,7 @@ unix_expandpath( if (precomp_buf) { mch_memmove(buf, precomp_buf, precomp_len); - vim_free(precomp_buf); + mnv_free(precomp_buf); } # endif addfile(gap, buf, flags); @@ -3983,8 +3983,8 @@ unix_expandpath( closedir(dirp); } - vim_free(buf); - vim_regfree(regmatch.regprog); + mnv_free(buf); + mnv_regfree(regmatch.regprog); // When interrupted the matches probably won't be used and sorting can be // slow, thus skip it. @@ -4007,7 +4007,7 @@ has_env_var(char_u *p) { if (*p == '\\' && p[1] != NUL) ++p; - else if (vim_strchr((char_u *) + else if (mnv_strchr((char_u *) #if defined(MSWIN) "$%" #else @@ -4021,7 +4021,7 @@ has_env_var(char_u *p) #ifdef SPECIAL_WILDCHAR /* - * Return TRUE if "p" contains a special wildcard character, one that Vim + * Return TRUE if "p" contains a special wildcard character, one that MNV * cannot expand, requires using a shell. */ static int @@ -4035,13 +4035,13 @@ has_special_wildchar(char_u *p) // Allow for escaping. if (*p == '\\' && p[1] != NUL && p[1] != '\r' && p[1] != '\n') ++p; - else if (vim_strchr((char_u *)SPECIAL_WILDCHAR, *p) != NULL) + else if (mnv_strchr((char_u *)SPECIAL_WILDCHAR, *p) != NULL) { // A { must be followed by a matching }. - if (*p == '{' && vim_strchr(p, '}') == NULL) + if (*p == '{' && mnv_strchr(p, '}') == NULL) continue; // A quote and backtick must be followed by another one. - if ((*p == '`' || *p == '\'') && vim_strchr(p, *p) == NULL) + if ((*p == '`' || *p == '\'') && mnv_strchr(p, *p) == NULL) continue; return TRUE; } @@ -4102,7 +4102,7 @@ gen_expand_wildcards( for (i = 0; i < num_pat; i++) { if (has_special_wildchar(pat[i]) - && !(vim_backtick(pat[i]) && pat[i][1] == '=') + && !(mnv_backtick(pat[i]) && pat[i][1] == '=') ) return mch_expand_wildcards(num_pat, pat, num_file, file, flags); } @@ -4120,7 +4120,7 @@ gen_expand_wildcards( add_pat = -1; p = pat[i]; - if (vim_backtick(p)) + if (mnv_backtick(p)) { add_pat = expand_backtick(&ga, p, flags); if (add_pat == -1) @@ -4144,7 +4144,7 @@ gen_expand_wildcards( */ else if (has_env_var(p) || *p == '~') { - vim_free(p); + mnv_free(p); ga_clear_strings(&ga); i = mch_expand_wildcards(num_pat, pat, num_file, file, flags|EW_KEEPDOLLAR); @@ -4166,8 +4166,8 @@ gen_expand_wildcards( if ((flags & (EW_PATH | EW_CDPATH)) && !mch_isFullName(p) && !(p[0] == '.' - && (vim_ispathsep(p[1]) - || (p[1] == '.' && vim_ispathsep(p[2])))) + && (mnv_ispathsep(p[1]) + || (p[1] == '.' && mnv_ispathsep(p[2])))) ) { // :find completion where 'path' is used. @@ -4187,20 +4187,20 @@ gen_expand_wildcards( char_u *t = backslash_halve_save(p); // When EW_NOTFOUND is used, always add files and dirs. Makes - // "vim c:/" work. + // "mnv c:/" work. if (flags & EW_NOTFOUND) addfile(&ga, t, flags | EW_DIR | EW_FILE); else addfile(&ga, t, flags); if (t != p) - vim_free(t); + mnv_free(t); } if (did_expand_in_path && ga.ga_len > 0 && (flags & (EW_PATH | EW_CDPATH))) uniquefy_paths(&ga, p, path_option); if (p != pat[i]) - vim_free(p); + mnv_free(p); } // When returning FAIL the array must be freed here. @@ -4242,7 +4242,7 @@ addfile( #ifdef FNAME_ILLEGAL // if the file/dir contains illegal characters, don't add it - if (vim_strpbrk(f, (char_u *)FNAME_ILLEGAL) != NULL) + if (mnv_strpbrk(f, (char_u *)FNAME_ILLEGAL) != NULL) return; #endif @@ -4286,8 +4286,8 @@ FreeWild(int count, char_u **files) if (count <= 0 || files == NULL) return; while (count--) - vim_free(files[count]); - vim_free(files); + mnv_free(files[count]); + mnv_free(files); } /* @@ -4332,9 +4332,9 @@ pathcmp(const char *p, const char *q, int maxlen) #endif ) { - if (vim_ispathsep(c1)) + if (mnv_ispathsep(c1)) return -1; - if (vim_ispathsep(c2)) + if (mnv_ispathsep(c2)) return 1; return p_fic ? MB_TOUPPER(c1) - MB_TOUPPER(c2) : c1 - c2; // no match @@ -4368,7 +4368,7 @@ pathcmp(const char *p, const char *q, int maxlen) * Return TRUE if "name" is a full (absolute) path name or URL. */ int -vim_isAbsName(char_u *name) +mnv_isAbsName(char_u *name) { return (path_with_url(name) != 0 || mch_isFullName(name)); } @@ -4379,7 +4379,7 @@ vim_isAbsName(char_u *name) * return FAIL for failure, OK otherwise */ int -vim_FullName( +mnv_FullName( char_u *fname, char_u *buf, int len, @@ -4398,7 +4398,7 @@ vim_FullName( if (url || retval == FAIL) { // something failed; use the file name (truncate when too long) - vim_strncpy(buf, fname, len - 1); + mnv_strncpy(buf, fname, len - 1); } #if defined(MSWIN) slash_adjust(buf); diff --git a/uvim/src/findfile.c b/uvim/src/findfile.c index 0c5d1cf252..8318c537ac 100644 --- a/uvim/src/findfile.c +++ b/uvim/src/findfile.c @@ -1,47 +1,47 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * findfile.c: Search for files in directories listed in 'path' */ -#include "vim.h" +#include "mnv.h" /* * File searching functions for 'path', 'tags' and 'cdpath' options. * External visible functions: - * vim_findfile_init() creates/initialises the search context - * vim_findfile_free_visited() free list of visited files/dirs of search + * mnv_findfile_init() creates/initialises the search context + * mnv_findfile_free_visited() free list of visited files/dirs of search * context - * vim_findfile() find a file in the search context - * vim_findfile_cleanup() cleanup/free search context created by - * vim_findfile_init() + * mnv_findfile() find a file in the search context + * mnv_findfile_cleanup() cleanup/free search context created by + * mnv_findfile_init() * * All static functions and variables start with 'ff_' * * In general it works like this: - * First you create yourself a search context by calling vim_findfile_init(). + * First you create yourself a search context by calling mnv_findfile_init(). * It is possible to give a search context from a previous call to - * vim_findfile_init(), so it can be reused. After this you call vim_findfile() + * mnv_findfile_init(), so it can be reused. After this you call mnv_findfile() * until you are satisfied with the result or it returns NULL. On every call it * returns the next file which matches the conditions given to - * vim_findfile_init(). If it doesn't find a next file it returns NULL. + * mnv_findfile_init(). If it doesn't find a next file it returns NULL. * - * It is possible to call vim_findfile_init() again to reinitialise your search + * It is possible to call mnv_findfile_init() again to reinitialise your search * with some new parameters. Don't forget to pass your old search context to * it, so it can reuse it and especially reuse the list of already visited * directories. If you want to delete the list of already visited directories - * simply call vim_findfile_free_visited(). + * simply call mnv_findfile_free_visited(). * - * When you are done call vim_findfile_cleanup() to free the search context. + * When you are done call mnv_findfile_cleanup() to free the search context. * - * The function vim_findfile_init() has a long comment, which describes the + * The function mnv_findfile_init() has a long comment, which describes the * needed parameters. * * @@ -81,7 +81,7 @@ typedef struct ff_stack int ffs_stage; // How deep are we in the directory tree? - // Counts backward from value of level parameter to vim_findfile_init + // Counts backward from value of level parameter to mnv_findfile_init int ffs_level; // Did we already expand '**' to an empty string? @@ -118,7 +118,7 @@ typedef struct ff_visited * So we have to do 3 searches: * 1) search from the current files directory downward for the file "tags" * 2) search from the current files directory downward for the file "TAGS" - * 3) search from Vims current directory downwards for the file "tags" + * 3) search from MNVs current directory downwards for the file "tags" * As you can see, the first and the third search are for the same file, so for * the third search we can use the visited list of the first search. For the * second search we must start from a empty visited list. @@ -179,8 +179,8 @@ typedef struct ff_search_ctx_T // locally needed functions static int ff_check_visited(ff_visited_T **, char_u *, size_t, char_u *, size_t); -static void vim_findfile_free_visited(void *search_ctx_arg); -static void vim_findfile_free_visited_list(ff_visited_list_hdr_T **list_headp); +static void mnv_findfile_free_visited(void *search_ctx_arg); +static void mnv_findfile_free_visited_list(ff_visited_list_hdr_T **list_headp); static void ff_free_visited_list(ff_visited_T *vl); static ff_visited_list_hdr_T* ff_get_visited_list(char_u *, size_t, ff_visited_list_hdr_T **list_headp); @@ -202,25 +202,25 @@ static string_T ff_expand_buffer = {NULL, 0}; // used for expanding filename static void *ff_fn_search_context = NULL; char_u * -vim_findfirst(char_u *path, char_u *filename, int level) +mnv_findfirst(char_u *path, char_u *filename, int level) { ff_fn_search_context = - vim_findfile_init(path, filename, NULL, level, TRUE, FALSE, + mnv_findfile_init(path, filename, NULL, level, TRUE, FALSE, ff_fn_search_context, rel_fname); if (NULL == ff_fn_search_context) return NULL; else - return vim_findnext() + return mnv_findnext() } char_u * -vim_findnext(void) +mnv_findnext(void) { - char_u *ret = vim_findfile(ff_fn_search_context); + char_u *ret = mnv_findfile(ff_fn_search_context); if (NULL == ret) { - vim_findfile_cleanup(ff_fn_search_context); + mnv_findfile_cleanup(ff_fn_search_context); ff_fn_search_context = NULL; } return ret; @@ -228,18 +228,18 @@ vim_findnext(void) #endif /* - * Initialization routine for vim_findfile(). + * Initialization routine for mnv_findfile(). * * Returns the newly allocated search context or NULL if an error occurred. * - * Don't forget to clean up by calling vim_findfile_cleanup() if you are done + * Don't forget to clean up by calling mnv_findfile_cleanup() if you are done * with the search context. * * Find the file 'filename' in the directory 'path'. * The parameter 'path' may contain wildcards. If so only search 'level' * directories deep. The parameter 'level' is the absolute maximum and is * not related to restricts given to the '**' wildcard. If 'level' is 100 - * and you use '**200' vim_findfile() will stop after 100 levels. + * and you use '**200' mnv_findfile() will stop after 100 levels. * * 'filename' cannot contain wildcards! It is used as-is, no backslashes to * escape special characters. @@ -249,7 +249,7 @@ vim_findnext(void) * start-directory of a search is contained in 'stopdirs'. 'stopdirs' has the * format ";**\(;\)*;\=$". * - * If the 'path' is relative, the starting dir for the search is either VIM's + * If the 'path' is relative, the starting dir for the search is either MNV's * current dir or if the path starts with "./" the current files dir. * If the 'path' is absolute, the starting dir is that part of the path before * the first wildcard. @@ -261,12 +261,12 @@ vim_findnext(void) * directory, but want to be sure that no directory from a previous search is * searched again. This is useful if you search for a file at different places. * The list of visited files/dirs can also be cleared with the function - * vim_findfile_free_visited(). + * mnv_findfile_free_visited(). * * Set the parameter 'find_what' to FINDFILE_DIR if you want to search for * directories only, FINDFILE_FILE for files only, FINDFILE_BOTH for both. * - * A search context returned by a previous call to vim_findfile_init() can be + * A search context returned by a previous call to mnv_findfile_init() can be * passed in the parameter "search_ctx_arg". This context is reused and * reinitialized with the new parameters. The list of already visited * directories from this context is only deleted if the parameter @@ -276,11 +276,11 @@ vim_findnext(void) * If you don't have a search context from a previous call "search_ctx_arg" * must be NULL. * - * This function silently ignores a few errors, vim_findfile() will have + * This function silently ignores a few errors, mnv_findfile() will have * limited functionality then. */ void * -vim_findfile_init( +mnv_findfile_init( char_u *path, char_u *filename, size_t filenamelen, @@ -315,7 +315,7 @@ vim_findfile_init( // clear visited list if wanted if (free_visited == TRUE) - vim_findfile_free_visited(search_ctx); + mnv_findfile_free_visited(search_ctx); else { // Reuse old visited lists. Get the visited list for the given @@ -342,16 +342,16 @@ vim_findfile_init( // Store information on starting dir now if path is relative. // If path is absolute, we do that later. if (path[0] == '.' - && (vim_ispathsep(path[1]) || path[1] == NUL) - && (!tagfile || vim_strchr(p_cpo, CPO_DOTTAG) == NULL) + && (mnv_ispathsep(path[1]) || path[1] == NUL) + && (!tagfile || mnv_strchr(p_cpo, CPO_DOTTAG) == NULL) && rel_fname != NULL) { int len = (int)(gettail(rel_fname) - rel_fname); - if (!vim_isAbsName(rel_fname) && len + 1 < MAXPATHL) + if (!mnv_isAbsName(rel_fname) && len + 1 < MAXPATHL) { // Make the start dir an absolute path name. - vim_strncpy(ff_expand_buffer.string, rel_fname, len); + mnv_strncpy(ff_expand_buffer.string, rel_fname, len); ff_expand_buffer.length = len; search_ctx->ffsc_start_dir.string = FullName_save(ff_expand_buffer.string, FALSE); @@ -362,7 +362,7 @@ vim_findfile_init( else { search_ctx->ffsc_start_dir.length = len; - search_ctx->ffsc_start_dir.string = vim_strnsave(rel_fname, + search_ctx->ffsc_start_dir.string = mnv_strnsave(rel_fname, search_ctx->ffsc_start_dir.length); if (search_ctx->ffsc_start_dir.string == NULL) goto error_return; @@ -371,7 +371,7 @@ vim_findfile_init( if (*++path != NUL) ++path; } - else if (*path == NUL || !vim_isAbsName(path)) + else if (*path == NUL || !mnv_isAbsName(path)) { #ifdef BACKSLASH_IN_FILENAME // "c:dir" needs "c:" to be expanded, otherwise use current dir @@ -382,7 +382,7 @@ vim_findfile_init( drive[0] = path[0]; drive[1] = ':'; drive[2] = NUL; - if (vim_FullName(drive, ff_expand_buffer.string, MAXPATHL, TRUE) == FAIL) + if (mnv_FullName(drive, ff_expand_buffer.string, MAXPATHL, TRUE) == FAIL) goto error_return; path += 2; } @@ -394,7 +394,7 @@ vim_findfile_init( ff_expand_buffer.length = STRLEN(ff_expand_buffer.string); search_ctx->ffsc_start_dir.length = ff_expand_buffer.length; - search_ctx->ffsc_start_dir.string = vim_strnsave(ff_expand_buffer.string, + search_ctx->ffsc_start_dir.string = mnv_strnsave(ff_expand_buffer.string, search_ctx->ffsc_start_dir.length); if (search_ctx->ffsc_start_dir.string == NULL) goto error_return; @@ -431,22 +431,22 @@ vim_findfile_init( size_t len; helper = walker; - ptr = vim_realloc(search_ctx->ffsc_stopdirs_v, + ptr = mnv_realloc(search_ctx->ffsc_stopdirs_v, (dircount + 1) * sizeof(string_T)); if (ptr) search_ctx->ffsc_stopdirs_v = ptr; else // ignore, keep what we have and continue break; - walker = vim_strchr(walker, ';'); + walker = mnv_strchr(walker, ';'); len = walker ? (size_t)(walker - helper) : STRLEN(helper); // "" means ascent till top of directory tree. - if (*helper != NUL && !vim_isAbsName(helper) + if (*helper != NUL && !mnv_isAbsName(helper) && len + 1 < MAXPATHL) { // Make the stop dir an absolute path name. - vim_strncpy(ff_expand_buffer.string, helper, len); + mnv_strncpy(ff_expand_buffer.string, helper, len); ff_expand_buffer.length = len; tmp = &search_ctx->ffsc_stopdirs_v[dircount - 1]; @@ -458,7 +458,7 @@ vim_findfile_init( { tmp = &search_ctx->ffsc_stopdirs_v[dircount - 1]; tmp->length = len; - tmp->string = vim_strnsave(helper, tmp->length); + tmp->string = mnv_strnsave(helper, tmp->length); if (tmp->string == NULL) tmp->length = 0; } @@ -481,7 +481,7 @@ vim_findfile_init( * -fix path * -wildcard_stuff (might be NULL) */ - wc_part = vim_strchr(path, '*'); + wc_part = mnv_strchr(path, '*'); if (wc_part != NULL) { int llevel; @@ -489,7 +489,7 @@ vim_findfile_init( // save the fix part of the path search_ctx->ffsc_fix_path.length = (size_t)(wc_part - path); - search_ctx->ffsc_fix_path.string = vim_strnsave(path, + search_ctx->ffsc_fix_path.string = mnv_strnsave(path, search_ctx->ffsc_fix_path.length); if (search_ctx->ffsc_fix_path.string == NULL) goto error_return; @@ -525,7 +525,7 @@ vim_findfile_init( else ff_expand_buffer.string[ff_expand_buffer.length++] = FF_MAX_STAR_STAR_EXPAND; wc_part = (char_u *)errpt; - if (*wc_part != NUL && !vim_ispathsep(*wc_part)) + if (*wc_part != NUL && !mnv_ispathsep(*wc_part)) { semsg(_(e_invalid_path_number_must_be_at_end_of_path_or_be_followed_by_str), PATHSEPSTR); goto error_return; @@ -537,7 +537,7 @@ vim_findfile_init( ff_expand_buffer.string[ff_expand_buffer.length] = NUL; search_ctx->ffsc_wc_path.length = ff_expand_buffer.length; - search_ctx->ffsc_wc_path.string = vim_strnsave(ff_expand_buffer.string, + search_ctx->ffsc_wc_path.string = mnv_strnsave(ff_expand_buffer.string, search_ctx->ffsc_wc_path.length); if (search_ctx->ffsc_wc_path.string == NULL) goto error_return; @@ -545,7 +545,7 @@ vim_findfile_init( else { search_ctx->ffsc_fix_path.length = STRLEN(path); - search_ctx->ffsc_fix_path.string = vim_strnsave(path, + search_ctx->ffsc_fix_path.string = mnv_strnsave(path, search_ctx->ffsc_fix_path.length); if (search_ctx->ffsc_fix_path.string == NULL) goto error_return; @@ -556,7 +556,7 @@ vim_findfile_init( // store the fix part as startdir. // This is needed if the parameter path is fully qualified. search_ctx->ffsc_start_dir.length = search_ctx->ffsc_fix_path.length; - search_ctx->ffsc_start_dir.string = vim_strnsave(search_ctx->ffsc_fix_path.string, + search_ctx->ffsc_start_dir.string = mnv_strnsave(search_ctx->ffsc_fix_path.string, search_ctx->ffsc_start_dir.length); if (search_ctx->ffsc_start_dir.string == NULL) goto error_return; @@ -574,7 +574,7 @@ vim_findfile_init( add_sep = !after_pathsep(search_ctx->ffsc_start_dir.string, search_ctx->ffsc_start_dir.string + search_ctx->ffsc_start_dir.length); - ff_expand_buffer.length = vim_snprintf( + ff_expand_buffer.length = mnv_snprintf( (char *)ff_expand_buffer.string, MAXPATHL, "%s%s", @@ -588,7 +588,7 @@ vim_findfile_init( if (buf == NULL) goto error_return; - vim_snprintf( + mnv_snprintf( (char *)buf, bufsize, "%s%s", @@ -600,7 +600,7 @@ vim_findfile_init( { add_sep = !after_pathsep(search_ctx->ffsc_fix_path.string, search_ctx->ffsc_fix_path.string + search_ctx->ffsc_fix_path.length); - ff_expand_buffer.length += vim_snprintf( + ff_expand_buffer.length += mnv_snprintf( (char *)ff_expand_buffer.string + ff_expand_buffer.length, MAXPATHL - ff_expand_buffer.length, "%s%s", @@ -621,13 +621,13 @@ vim_findfile_init( && STRNCMP(search_ctx->ffsc_fix_path.string, "..", 2) == 0) && (len == 2 || search_ctx->ffsc_fix_path.string[2] == PATHSEP)) { - vim_free(buf); + mnv_free(buf); goto error_return; } add_sep = !after_pathsep(search_ctx->ffsc_fix_path.string, search_ctx->ffsc_fix_path.string + search_ctx->ffsc_fix_path.length); - ff_expand_buffer.length += vim_snprintf( + ff_expand_buffer.length += mnv_snprintf( (char *)ff_expand_buffer.string + ff_expand_buffer.length, MAXPATHL - ff_expand_buffer.length, "%.*s%s", @@ -645,22 +645,22 @@ vim_findfile_init( if (temp == NULL) { - vim_free(buf); - vim_free(temp); + mnv_free(buf); + mnv_free(temp); goto error_return; } - search_ctx->ffsc_wc_path.length = vim_snprintf( + search_ctx->ffsc_wc_path.length = mnv_snprintf( (char *)temp, tempsize, "%s%s", search_ctx->ffsc_fix_path.string + len, search_ctx->ffsc_wc_path.string); - vim_free(search_ctx->ffsc_wc_path.string); + mnv_free(search_ctx->ffsc_wc_path.string); search_ctx->ffsc_wc_path.string = temp; } } - vim_free(buf); + mnv_free(buf); } sptr = ff_create_stack_element(ff_expand_buffer.string, @@ -676,7 +676,7 @@ vim_findfile_init( ff_push(search_ctx, sptr); search_ctx->ffsc_file_to_search.length = filenamelen; - search_ctx->ffsc_file_to_search.string = vim_strnsave(filename, + search_ctx->ffsc_file_to_search.string = mnv_strnsave(filename, search_ctx->ffsc_file_to_search.length); if (search_ctx->ffsc_file_to_search.string == NULL) goto error_return; @@ -689,7 +689,7 @@ error_return: * Even when the caller gave us a (perhaps valid) context we free it here, * as we might have already destroyed it. */ - vim_findfile_cleanup(search_ctx); + mnv_findfile_cleanup(search_ctx); return NULL; } @@ -697,7 +697,7 @@ error_return: * Get the stopdir string. Check that ';' is not escaped. */ char_u * -vim_findfile_stopdir(char_u *buf) +mnv_findfile_stopdir(char_u *buf) { char_u *r_ptr = buf; char_u *r_ptr_end = NULL; // points to NUL at end of string "r_ptr" @@ -731,19 +731,19 @@ vim_findfile_stopdir(char_u *buf) * Clean up the given search context. Can handle a NULL pointer. */ void -vim_findfile_cleanup(void *ctx) +mnv_findfile_cleanup(void *ctx) { if (ctx == NULL) return; - vim_findfile_free_visited(ctx); + mnv_findfile_free_visited(ctx); ff_clear(ctx); - vim_free(ctx); + mnv_free(ctx); } /* * Find a file in a search context. - * The search context was created with vim_findfile_init() above. + * The search context was created with mnv_findfile_init() above. * Return a pointer to an allocated file name or NULL if nothing found. * To get all matching files call this function until you get NULL. * @@ -754,7 +754,7 @@ vim_findfile_cleanup(void *ctx) * top of the list). */ char_u * -vim_findfile(void *search_ctx_arg) +mnv_findfile(void *search_ctx_arg) { string_T file_path; string_T rest_of_wildcards; @@ -874,14 +874,14 @@ vim_findfile(void *search_ctx_arg) dirptrs[1] = NULL; // if we have a start dir copy it in - if (!vim_isAbsName(stackp->ffs_fix_path.string) + if (!mnv_isAbsName(stackp->ffs_fix_path.string) && search_ctx->ffsc_start_dir.string) { if (search_ctx->ffsc_start_dir.length + 1 < MAXPATHL) { int add_sep = !after_pathsep(search_ctx->ffsc_start_dir.string, search_ctx->ffsc_start_dir.string + search_ctx->ffsc_start_dir.length); - file_path.length = vim_snprintf( + file_path.length = mnv_snprintf( (char *)file_path.string, MAXPATHL, "%s%s", @@ -900,7 +900,7 @@ vim_findfile(void *search_ctx_arg) { int add_sep = !after_pathsep(stackp->ffs_fix_path.string, stackp->ffs_fix_path.string + stackp->ffs_fix_path.length); - file_path.length += vim_snprintf( + file_path.length += mnv_snprintf( (char *)file_path.string + file_path.length, MAXPATHL - file_path.length, "%s%s", @@ -968,7 +968,7 @@ vim_findfile(void *search_ctx_arg) * on the stack again for further search. */ while (*rest_of_wildcards.string - && !vim_ispathsep(*rest_of_wildcards.string)) + && !mnv_ispathsep(*rest_of_wildcards.string)) { if (file_path.length + 1 < MAXPATHL) { @@ -983,7 +983,7 @@ vim_findfile(void *search_ctx_arg) } file_path.string[file_path.length] = NUL; - if (vim_ispathsep(*rest_of_wildcards.string)) + if (mnv_ispathsep(*rest_of_wildcards.string)) { rest_of_wildcards.string++; rest_of_wildcards.length--; @@ -999,7 +999,7 @@ vim_findfile(void *search_ctx_arg) stackp->ffs_filearray = ALLOC_ONE(char_u *); if (stackp->ffs_filearray != NULL && (stackp->ffs_filearray[0] - = vim_strnsave(dirptrs[0], file_path.length)) != NULL) + = mnv_strnsave(dirptrs[0], file_path.length)) != NULL) stackp->ffs_filearray_size = 1; else stackp->ffs_filearray_size = 0; @@ -1052,7 +1052,7 @@ vim_findfile(void *search_ctx_arg) { int add_sep = !after_pathsep(stackp->ffs_filearray[i], stackp->ffs_filearray[i] + len); - file_path.length = vim_snprintf( + file_path.length = mnv_snprintf( (char *)file_path.string, MAXPATHL, "%s%s%s", @@ -1231,10 +1231,10 @@ vim_findfile(void *search_ctx_arg) // cut of last dir while (path_end > search_ctx->ffsc_start_dir.string - && vim_ispathsep(*path_end)) + && mnv_ispathsep(*path_end)) path_end--; while (path_end > search_ctx->ffsc_start_dir.string - && !vim_ispathsep(path_end[-1])) + && !mnv_ispathsep(path_end[-1])) path_end--; *path_end = NUL; @@ -1250,7 +1250,7 @@ vim_findfile(void *search_ctx_arg) { int add_sep = !after_pathsep(search_ctx->ffsc_start_dir.string, search_ctx->ffsc_start_dir.string + search_ctx->ffsc_start_dir.length); - file_path.length = vim_snprintf( + file_path.length = mnv_snprintf( (char *)file_path.string, MAXPATHL, "%s%s%s", @@ -1274,7 +1274,7 @@ vim_findfile(void *search_ctx_arg) } fail: - vim_free(file_path.string); + mnv_free(file_path.string); return NULL; } @@ -1283,7 +1283,7 @@ fail: * Can handle it if the passed search_context is NULL; */ static void -vim_findfile_free_visited(void *search_ctx_arg) +mnv_findfile_free_visited(void *search_ctx_arg) { ff_search_ctx_T *search_ctx; @@ -1291,12 +1291,12 @@ vim_findfile_free_visited(void *search_ctx_arg) return; search_ctx = (ff_search_ctx_T *)search_ctx_arg; - vim_findfile_free_visited_list(&search_ctx->ffsc_visited_lists_list); - vim_findfile_free_visited_list(&search_ctx->ffsc_dir_visited_lists_list); + mnv_findfile_free_visited_list(&search_ctx->ffsc_visited_lists_list); + mnv_findfile_free_visited_list(&search_ctx->ffsc_dir_visited_lists_list); } static void -vim_findfile_free_visited_list(ff_visited_list_hdr_T **list_headp) +mnv_findfile_free_visited_list(ff_visited_list_hdr_T **list_headp) { ff_visited_list_hdr_T *vp; @@ -1305,8 +1305,8 @@ vim_findfile_free_visited_list(ff_visited_list_hdr_T **list_headp) vp = (*list_headp)->ffvl_next; ff_free_visited_list((*list_headp)->ffvl_visited_list); - vim_free((*list_headp)->ffvl_filename); - vim_free(*list_headp); + mnv_free((*list_headp)->ffvl_filename); + mnv_free(*list_headp); *list_headp = vp; } *list_headp = NULL; @@ -1320,8 +1320,8 @@ ff_free_visited_list(ff_visited_T *vl) while (vl != NULL) { vp = vl->ffv_next; - vim_free(vl->ffv_wc_path); - vim_free(vl); + mnv_free(vl->ffv_wc_path); + mnv_free(vl); vl = vp; } vl = NULL; @@ -1383,10 +1383,10 @@ ff_get_visited_list( return NULL; retptr->ffvl_visited_list = NULL; - retptr->ffvl_filename = vim_strnsave(filename, filenamelen); + retptr->ffvl_filename = mnv_strnsave(filename, filenamelen); if (retptr->ffvl_filename == NULL) { - vim_free(retptr); + mnv_free(retptr); return NULL; } retptr->ffvl_next = *list_headp; @@ -1463,7 +1463,7 @@ ff_check_visited( // device/inode (unix) or the full path name (not Unix). if (path_with_url(fname)) { - vim_strncpy(ff_expand_buffer.string, fname, fnamelen); + mnv_strncpy(ff_expand_buffer.string, fname, fnamelen); ff_expand_buffer.length = fnamelen; #ifdef UNIX url = TRUE; @@ -1477,7 +1477,7 @@ ff_check_visited( if (mch_stat((char *)fname, &st) < 0) return FAIL; #else - if (vim_FullName(fname, ff_expand_buffer.string, MAXPATHL, TRUE) == FAIL) + if (mnv_FullName(fname, ff_expand_buffer.string, MAXPATHL, TRUE) == FAIL) return FAIL; ff_expand_buffer.length = STRLEN(ff_expand_buffer.string); #endif @@ -1527,7 +1527,7 @@ ff_check_visited( } #endif if (wc_path != NULL) - vp->ffv_wc_path = vim_strnsave(wc_path, wc_pathlen); + vp->ffv_wc_path = mnv_strnsave(wc_path, wc_pathlen); else vp->ffv_wc_path = NULL; @@ -1563,13 +1563,13 @@ ff_create_stack_element( new->ffs_level = level; new->ffs_star_star_empty = star_star_empty; - // the following saves NULL pointer checks in vim_findfile + // the following saves NULL pointer checks in mnv_findfile if (fix_part == NULL) { fix_part = (char_u *)""; fix_partlen = 0; } - new->ffs_fix_path.string = vim_strnsave(fix_part, fix_partlen); + new->ffs_fix_path.string = mnv_strnsave(fix_part, fix_partlen); new->ffs_fix_path.length = fix_partlen; if (wc_part == NULL) @@ -1577,7 +1577,7 @@ ff_create_stack_element( wc_part = (char_u *)""; wc_partlen = 0; } - new->ffs_wc_path.string = vim_strnsave(wc_part, wc_partlen); + new->ffs_wc_path.string = mnv_strnsave(wc_part, wc_partlen); new->ffs_wc_path.length = wc_partlen; if (new->ffs_fix_path.string == NULL || new->ffs_wc_path.string == NULL) @@ -1626,14 +1626,14 @@ ff_pop(ff_search_ctx_T *search_ctx) static void ff_free_stack_element(ff_stack_T *stack_ptr) { - // VIM_CLEAR_STRING handles possible NULL pointers - VIM_CLEAR_STRING(stack_ptr->ffs_fix_path); - VIM_CLEAR_STRING(stack_ptr->ffs_wc_path); + // MNV_CLEAR_STRING handles possible NULL pointers + MNV_CLEAR_STRING(stack_ptr->ffs_fix_path); + MNV_CLEAR_STRING(stack_ptr->ffs_wc_path); if (stack_ptr->ffs_filearray != NULL) FreeWild(stack_ptr->ffs_filearray_size, stack_ptr->ffs_filearray); - vim_free(stack_ptr); + mnv_free(stack_ptr); } /* @@ -1654,17 +1654,17 @@ ff_clear(ff_search_ctx_T *search_ctx) while (search_ctx->ffsc_stopdirs_v[i].string != NULL) { - vim_free(search_ctx->ffsc_stopdirs_v[i].string); + mnv_free(search_ctx->ffsc_stopdirs_v[i].string); i++; } - VIM_CLEAR(search_ctx->ffsc_stopdirs_v); + MNV_CLEAR(search_ctx->ffsc_stopdirs_v); } // reset everything - VIM_CLEAR_STRING(search_ctx->ffsc_file_to_search); - VIM_CLEAR_STRING(search_ctx->ffsc_start_dir); - VIM_CLEAR_STRING(search_ctx->ffsc_fix_path); - VIM_CLEAR_STRING(search_ctx->ffsc_wc_path); + MNV_CLEAR_STRING(search_ctx->ffsc_file_to_search); + MNV_CLEAR_STRING(search_ctx->ffsc_start_dir); + MNV_CLEAR_STRING(search_ctx->ffsc_fix_path); + MNV_CLEAR_STRING(search_ctx->ffsc_wc_path); search_ctx->ffsc_level = 0; } @@ -1678,7 +1678,7 @@ ff_path_in_stoplist(char_u *path, int path_len, string_T *stopdirs_v) int i = 0; // eat up trailing path separators, except the first - while (path_len > 1 && vim_ispathsep(path[path_len - 1])) + while (path_len > 1 && mnv_ispathsep(path[path_len - 1])) path_len--; // if no path consider it as match @@ -1691,7 +1691,7 @@ ff_path_in_stoplist(char_u *path, int path_len, string_T *stopdirs_v) // '/home/r' would also match '/home/rks' if (fnamencmp(stopdirs_v[i].string, path, path_len) == 0 && ((int)stopdirs_v[i].length <= path_len - || vim_ispathsep(stopdirs_v[i].string[path_len]))) + || mnv_ispathsep(stopdirs_v[i].string[path_len]))) return TRUE; return FALSE; @@ -1742,7 +1742,7 @@ find_file_in_path( void free_findfile(void) { - VIM_CLEAR_STRING(ff_expand_buffer); + MNV_CLEAR_STRING(ff_expand_buffer); } #endif @@ -1811,8 +1811,8 @@ find_file_in_path_option( file_to_findlen = expand_env_esc(ptr, NameBuff, MAXPATHL, FALSE, TRUE, NULL); ptr[len] = save_char; - vim_free(*file_to_find); - *file_to_find = vim_strnsave(NameBuff, file_to_findlen); + mnv_free(*file_to_find); + *file_to_find = mnv_strnsave(NameBuff, file_to_findlen); if (*file_to_find == NULL) // out of memory { file_name = NULL; @@ -1834,16 +1834,16 @@ find_file_in_path_option( rel_to_curdir = ((*file_to_find)[0] == '.' && ((*file_to_find)[1] == NUL - || vim_ispathsep((*file_to_find)[1]) + || mnv_ispathsep((*file_to_find)[1]) || ((*file_to_find)[1] == '.' && ((*file_to_find)[2] == NUL - || vim_ispathsep((*file_to_find)[2]))))); - if (vim_isAbsName(*file_to_find) + || mnv_ispathsep((*file_to_find)[2]))))); + if (mnv_isAbsName(*file_to_find) // "..", "../path", "." and "./path": don't use the path_option || rel_to_curdir #if defined(MSWIN) // handle "\tmp" as absolute path - || vim_ispathsep((*file_to_find)[0]) + || mnv_ispathsep((*file_to_find)[0]) // handle "c:name" as absolute path || ((*file_to_find)[0] != NUL && (*file_to_find)[1] == ':') #endif @@ -1868,7 +1868,7 @@ find_file_in_path_option( if (path_with_url(*file_to_find)) { - file_name = vim_strnsave(*file_to_find, file_to_findlen); + file_name = mnv_strnsave(*file_to_find, file_to_findlen); goto theend; } @@ -1886,7 +1886,7 @@ find_file_in_path_option( && rel_fname != NULL && rel_fnamelen + l < MAXPATHL) { - l = vim_snprintf( + l = mnv_snprintf( (char *)NameBuff, MAXPATHL, "%.*s%s", @@ -1911,7 +1911,7 @@ find_file_in_path_option( || ((find_what == FINDFILE_DIR) == mch_isdir(NameBuff)))) { - file_name = vim_strnsave(NameBuff, NameBufflen); + file_name = mnv_strnsave(NameBuff, NameBufflen); goto theend; } if (*suffix == NUL) @@ -1931,8 +1931,8 @@ find_file_in_path_option( */ if (first == TRUE) { - // vim_findfile_free_visited can handle a possible NULL pointer - vim_findfile_free_visited(*search_ctx); + // mnv_findfile_free_visited can handle a possible NULL pointer + mnv_findfile_free_visited(*search_ctx); dir = path_option; did_findfile_init = FALSE; } @@ -1941,7 +1941,7 @@ find_file_in_path_option( { if (did_findfile_init) { - file_name = vim_findfile(*search_ctx); + file_name = mnv_findfile(*search_ctx); if (file_name != NULL) break; @@ -1956,7 +1956,7 @@ find_file_in_path_option( { // We searched all paths of the option, now we can // free the search context. - vim_findfile_cleanup(*search_ctx); + mnv_findfile_cleanup(*search_ctx); *search_ctx = NULL; break; } @@ -1969,13 +1969,13 @@ find_file_in_path_option( copy_option_part(&dir, buf, MAXPATHL, " ,"); // get the stopdir string - r_ptr = vim_findfile_stopdir(buf); - *search_ctx = vim_findfile_init(buf, *file_to_find, file_to_findlen, + r_ptr = mnv_findfile_stopdir(buf); + *search_ctx = mnv_findfile_init(buf, *file_to_find, file_to_findlen, r_ptr, 100, FALSE, find_what, *search_ctx, FALSE, rel_fname); if (*search_ctx != NULL) did_findfile_init = TRUE; - vim_free(buf); + mnv_free(buf); } } } @@ -2078,7 +2078,7 @@ file_name_in_line( * search forward for what could be the start of a file name */ ptr = line + col; - while (*ptr != NUL && !vim_isfilec(*ptr)) + while (*ptr != NUL && !mnv_isfilec(*ptr)) MB_PTR_ADV(ptr); if (*ptr == NUL) // nothing found { @@ -2095,7 +2095,7 @@ file_name_in_line( { if (has_mbyte && (len = (*mb_head_off)(line, ptr - 1)) > 0) ptr -= len + 1; - else if (vim_isfilec(ptr[-1]) + else if (mnv_isfilec(ptr[-1]) || ((options & FNAME_HYP) && path_is_url(ptr - 1))) --ptr; else @@ -2107,9 +2107,9 @@ file_name_in_line( * Also allow "://" when ':' is not in 'isfname'. */ len = 0; - while (vim_isfilec(ptr[len]) || (ptr[len] == '\\' && ptr[len + 1] == ' ') + while (mnv_isfilec(ptr[len]) || (ptr[len] == '\\' && ptr[len + 1] == ' ') || ((options & FNAME_HYP) && path_is_url(ptr + len)) - || (is_url && vim_strchr((char_u *)":?&=", ptr[len]) != NULL)) + || (is_url && mnv_strchr((char_u *)":?&=", ptr[len]) != NULL)) { // After type:// we also include :, ?, & and = as valid characters, so // that http://google.com:8080?q=this&that=ok works. @@ -2135,7 +2135,7 @@ file_name_in_line( * If there is trailing punctuation, remove it. * But don't remove "..", could be a directory name. */ - if (len > 2 && vim_strchr((char_u *)".,:;!", ptr[len - 1]) != NULL + if (len > 2 && mnv_strchr((char_u *)".,:;!", ptr[len - 1]) != NULL && ptr[len - 2] != '.') --len; @@ -2182,14 +2182,14 @@ eval_includeexpr(char_u *ptr, int len) char_u *res; sctx_T save_sctx = current_sctx; - set_vim_var_string(VV_FNAME, ptr, len); + set_mnv_var_string(VV_FNAME, ptr, len); current_sctx = curbuf->b_p_script_ctx[BV_INEX]; res = eval_to_string_safe(curbuf->b_p_inex, was_set_insecurely(curwin, (char_u *)"includeexpr", OPT_LOCAL), TRUE, TRUE); - set_vim_var_string(VV_FNAME, NULL, 0); + set_mnv_var_string(VV_FNAME, NULL, 0); current_sctx = save_sctx; return res; } @@ -2266,19 +2266,19 @@ find_file_name_in_path( // appears several times in the path. while (file_name != NULL && --count > 0) { - vim_free(file_name); + mnv_free(file_name); file_name = find_file_in_path(ptr, len, options, FALSE, rel_fname, &file_to_find, &search_ctx); } - vim_free(file_to_find); - vim_findfile_cleanup(search_ctx); + mnv_free(file_to_find); + mnv_findfile_cleanup(search_ctx); } else - file_name = vim_strnsave(ptr, len); + file_name = mnv_strnsave(ptr, len); #if defined(FEAT_FIND_ID) && defined(FEAT_EVAL) - vim_free(tofree); + mnv_free(tofree); #endif return file_name; @@ -2300,7 +2300,7 @@ gettail_dir(char_u *fname) for (p = fname; *p != NUL; ) { - if (vim_ispathsep(*p)) + if (mnv_ispathsep(*p)) { if (look_for_sep) { @@ -2323,7 +2323,7 @@ gettail_dir(char_u *fname) * return TRUE if 'c' is a path list separator. */ int -vim_ispathlistsep(int c) +mnv_ispathlistsep(int c) { #ifdef UNIX return (c == ':'); @@ -2340,13 +2340,13 @@ vim_ispathlistsep(int c) find_previous_pathsep(char_u *path, char_u **psep) { // skip the current separator - if (*psep > path && vim_ispathsep(**psep)) + if (*psep > path && mnv_ispathsep(**psep)) --*psep; // find the previous separator while (*psep > path) { - if (vim_ispathsep(**psep)) + if (mnv_ispathsep(**psep)) return OK; MB_PTR_BACK(path, *psep); } @@ -2378,7 +2378,7 @@ is_unique(char_u *maybe_unique, garray_T *gap, int i) rival = other_paths[j] + other_path_len - candidate_len; if (fnamecmp(maybe_unique, rival) == 0 - && (rival == other_paths[j] || vim_ispathsep(*(rival - 1)))) + && (rival == other_paths[j] || mnv_ispathsep(*(rival - 1)))) return FALSE; // match } @@ -2412,7 +2412,7 @@ expand_path_option( { buflen = copy_option_part(&path_option, buf, MAXPATHL, " ,"); - if (buf[0] == '.' && (buf[1] == NUL || vim_ispathsep(buf[1]))) + if (buf[0] == '.' && (buf[1] == NUL || mnv_ispathsep(buf[1]))) { size_t plen; @@ -2467,13 +2467,13 @@ expand_path_option( buf[buflen - 1] = '/'; #endif - p = vim_strnsave(buf, buflen); + p = mnv_strnsave(buf, buflen); if (p == NULL) break; ((char_u **)gap->ga_data)[gap->ga_len++] = p; } - vim_free(buf); + mnv_free(buf); } /* @@ -2498,7 +2498,7 @@ get_path_cutoff(char_u *fname, garray_T *gap) while ((fname[j] == path_part[i][j] #if defined(MSWIN) - || (vim_ispathsep(fname[j]) && vim_ispathsep(path_part[i][j])) + || (mnv_ispathsep(fname[j]) && mnv_ispathsep(path_part[i][j])) #endif ) && fname[j] != NUL && path_part[i][j] != NUL) j++; @@ -2511,7 +2511,7 @@ get_path_cutoff(char_u *fname, garray_T *gap) // skip to the file or directory name if (cutoff != NULL) - while (vim_ispathsep(*cutoff)) + while (mnv_ispathsep(*cutoff)) MB_PTR_ADV(cutoff); return cutoff; @@ -2555,13 +2555,13 @@ uniquefy_paths( file_pattern[0] = '*'; STRCPY(file_pattern + 1, pattern); pat = file_pat_to_reg_pat(file_pattern, NULL, NULL, FALSE); - vim_free(file_pattern); + mnv_free(file_pattern); if (pat == NULL) return; regmatch.rm_ic = TRUE; // always ignore case - regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); - vim_free(pat); + regmatch.regprog = mnv_regcomp(pat, RE_MAGIC + RE_STRING); + mnv_free(pat); if (regmatch.regprog == NULL) return; @@ -2585,7 +2585,7 @@ uniquefy_paths( is_in_curdir = fnamencmp(curdir, path, dir_end - path) == 0 && curdir[dir_end - path] == NUL; if (is_in_curdir) - in_curdir[i] = vim_strnsave(path, len); + in_curdir[i] = mnv_strnsave(path, len); // Shorten the filename while maintaining its uniqueness path_cutoff = get_path_cutoff(path, &path_ga); @@ -2594,9 +2594,9 @@ uniquefy_paths( // pattern starts with star star slash, so only remove path_cutoff // when possible. if (pattern[0] == '*' && pattern[1] == '*' - && vim_ispathsep_nocolon(pattern[2]) + && mnv_ispathsep_nocolon(pattern[2]) && path_cutoff != NULL - && vim_regexec(®match, path_cutoff, (colnr_T)0) + && mnv_regexec(®match, path_cutoff, (colnr_T)0) && is_unique(path_cutoff, gap, i)) { sort_again = TRUE; @@ -2610,7 +2610,7 @@ uniquefy_paths( while (find_previous_pathsep(path, &pathsep_p)) { - if (vim_regexec(®match, pathsep_p + 1, (colnr_T)0) + if (mnv_regexec(®match, pathsep_p + 1, (colnr_T)0) && is_unique(pathsep_p + 1, gap, i) && path_cutoff != NULL && pathsep_p + 1 >= path_cutoff) { @@ -2643,11 +2643,11 @@ uniquefy_paths( // shorten_fname("c:\a\a.txt", "c:\a\b") // returns "\a\a.txt", which is not really the short // name, hence: - && !vim_ispathsep(*short_name) + && !mnv_ispathsep(*short_name) #endif ) { - vim_snprintf((char *)path, MAXPATHL, ".%s%s", PATHSEPSTR, short_name); + mnv_snprintf((char *)path, MAXPATHL, ".%s%s", PATHSEPSTR, short_name); } } ui_breakcheck(); @@ -2679,24 +2679,24 @@ uniquefy_paths( if (rel_path == NULL) goto theend; - vim_snprintf((char *)rel_path, rel_pathsize, ".%s%s", PATHSEPSTR, short_name); + mnv_snprintf((char *)rel_path, rel_pathsize, ".%s%s", PATHSEPSTR, short_name); - vim_free(fnames[i]); + mnv_free(fnames[i]); fnames[i] = rel_path; sort_again = TRUE; ui_breakcheck(); } theend: - vim_free(curdir); + mnv_free(curdir); if (in_curdir != NULL) { for (i = 0; i < gap->ga_len; i++) - vim_free(in_curdir[i]); - vim_free(in_curdir); + mnv_free(in_curdir[i]); + mnv_free(in_curdir); } ga_clear_strings(&path_ga); - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); if (sort_again) remove_duplicates(gap); @@ -2728,7 +2728,7 @@ expand_in_path( expand_path_option(curdir, p_cdpath, &path_ga); else expand_path_option(curdir, path_option, &path_ga); - vim_free(curdir); + mnv_free(curdir); if (path_ga.ga_len == 0) return 0; @@ -2742,7 +2742,7 @@ expand_in_path( if (flags & EW_ADDSLASH) glob_flags |= WILD_ADD_SLASH; globpath(paths, pattern, gap, glob_flags, !!(flags & EW_CDPATH)); - vim_free(paths); + mnv_free(paths); return gap->ga_len; } @@ -2770,12 +2770,12 @@ simplify_filename(char_u *filename) p += 2; # endif - if (vim_ispathsep(*p)) + if (mnv_ispathsep(*p)) { relative = FALSE; do ++p; - while (vim_ispathsep(*p)); + while (mnv_ispathsep(*p)); } start = p; // remember start after "c:/" or "/" or "///" p_end = p + STRLEN(p); @@ -2810,12 +2810,12 @@ simplify_filename(char_u *filename) } else # endif - if (vim_ispathsep(*p)) + if (mnv_ispathsep(*p)) { mch_memmove(p, p + 1, (size_t)(p_end - (p + 1)) + 1); // remove duplicate "/" --p_end; } - else if (p[0] == '.' && (vim_ispathsep(p[1]) || p[1] == NUL)) + else if (p[0] == '.' && (mnv_ispathsep(p[1]) || p[1] == NUL)) { if (p == start && relative) p += 1 + (p[1] != NUL); // keep single "." or leading "./" @@ -2827,7 +2827,7 @@ simplify_filename(char_u *filename) // of an absolute path name . tail = p + 1; if (p[1] != NUL) - while (vim_ispathsep(*tail)) + while (mnv_ispathsep(*tail)) MB_PTR_ADV(tail); else if (p > start) --p; // strip preceding path separator @@ -2837,11 +2837,11 @@ simplify_filename(char_u *filename) } } else if (p[0] == '.' && p[1] == '.' && - (vim_ispathsep(p[2]) || p[2] == NUL)) + (mnv_ispathsep(p[2]) || p[2] == NUL)) { // Skip to after ".." or "../" or "..///". tail = p + 2; - while (vim_ispathsep(*tail)) + while (mnv_ispathsep(*tail)) MB_PTR_ADV(tail); if (components > 0) // strip one preceding component @@ -2996,11 +2996,11 @@ f_simplify(typval_T *argvars, typval_T *rettv) { char_u *p; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; p = tv_get_string_strict(&argvars[0]); - rettv->vval.v_string = vim_strsave(p); + rettv->vval.v_string = mnv_strsave(p); simplify_filename(rettv->vval.v_string); // simplify in place rettv->v_type = VAR_STRING; } diff --git a/uvim/src/float.c b/uvim/src/float.c index f4253cf845..4f78a190a0 100644 --- a/uvim/src/float.c +++ b/uvim/src/float.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -12,7 +12,7 @@ */ #define USING_FLOAT_STUFF -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) @@ -51,13 +51,13 @@ string2float( *value = NAN; return 3; } - if (skip_quotes && vim_strchr((char_u *)s, '\'') != NULL) + if (skip_quotes && mnv_strchr((char_u *)s, '\'') != NULL) { char_u buf[100]; char_u *p; int quotes = 0; - vim_strncpy(buf, (char_u *)s, 99); + mnv_strncpy(buf, (char_u *)s, 99); for (p = buf; ; p = skipdigits(p)) { // remove single quotes between digits, not in the exponent @@ -66,7 +66,7 @@ string2float( ++quotes; mch_memmove(p, p + 1, STRLEN(p)); } - if (!vim_isdigit(*p)) + if (!mnv_isdigit(*p)) break; } s = (char *)buf; @@ -107,7 +107,7 @@ get_float_arg(typval_T *argvars, float_T *f) void f_abs(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type == VAR_FLOAT) @@ -138,7 +138,7 @@ f_acos(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -156,7 +156,7 @@ f_asin(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -174,7 +174,7 @@ f_atan(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -192,7 +192,7 @@ f_atan2(typval_T *argvars, typval_T *rettv) { float_T fx = 0.0, fy = 0.0; - if (in_vim9script() + if (in_mnv9script() && (check_for_float_or_nr_arg(argvars, 0) == FAIL || check_for_float_or_nr_arg(argvars, 1) == FAIL)) return; @@ -213,7 +213,7 @@ f_ceil(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -231,7 +231,7 @@ f_cos(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -249,7 +249,7 @@ f_cosh(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -267,7 +267,7 @@ f_exp(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -285,7 +285,7 @@ f_float2nr(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; if (get_float_arg(argvars, &f) != OK) @@ -307,7 +307,7 @@ f_floor(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -325,7 +325,7 @@ f_fmod(typval_T *argvars, typval_T *rettv) { float_T fx = 0.0, fy = 0.0; - if (in_vim9script() + if (in_mnv9script() && (check_for_float_or_nr_arg(argvars, 0) == FAIL || check_for_float_or_nr_arg(argvars, 1) == FAIL)) return; @@ -345,7 +345,7 @@ f_fmod(typval_T *argvars, typval_T *rettv) void f_isinf(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type == VAR_FLOAT && isinf(argvars[0].vval.v_float)) @@ -358,7 +358,7 @@ f_isinf(typval_T *argvars, typval_T *rettv) void f_isnan(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->vval.v_number = argvars[0].v_type == VAR_FLOAT @@ -374,7 +374,7 @@ f_log(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -392,7 +392,7 @@ f_log10(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -410,7 +410,7 @@ f_pow(typval_T *argvars, typval_T *rettv) { float_T fx = 0.0, fy = 0.0; - if (in_vim9script() + if (in_mnv9script() && (check_for_float_or_nr_arg(argvars, 0) == FAIL || check_for_float_or_nr_arg(argvars, 1) == FAIL)) return; @@ -428,7 +428,7 @@ f_pow(typval_T *argvars, typval_T *rettv) * round() is not in C90, use ceil() or floor() instead. */ float_T -vim_round(float_T f) +mnv_round(float_T f) { return f > 0 ? floor(f + 0.5) : ceil(f - 0.5); } @@ -441,12 +441,12 @@ f_round(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; if (get_float_arg(argvars, &f) == OK) - rettv->vval.v_float = vim_round(f); + rettv->vval.v_float = mnv_round(f); else rettv->vval.v_float = 0.0; } @@ -459,7 +459,7 @@ f_sin(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -477,7 +477,7 @@ f_sinh(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -495,7 +495,7 @@ f_sqrt(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -515,7 +515,7 @@ f_str2float(typval_T *argvars, typval_T *rettv) int isneg; int skip_quotes; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; skip_quotes = argvars[1].v_type != VAR_UNKNOWN && tv_get_bool(&argvars[1]); @@ -539,7 +539,7 @@ f_tan(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -557,7 +557,7 @@ f_tanh(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; @@ -575,7 +575,7 @@ f_trunc(typval_T *argvars, typval_T *rettv) { float_T f = 0.0; - if (in_vim9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_float_or_nr_arg(argvars, 0) == FAIL) return; rettv->v_type = VAR_FLOAT; diff --git a/uvim/src/fold.c b/uvim/src/fold.c index 9618c21c62..f876719fb4 100644 --- a/uvim/src/fold.c +++ b/uvim/src/fold.c @@ -1,18 +1,18 @@ /* vi:set ts=8 sts=4 sw=4 noet: - * vim600:fdm=marker fdl=1 fdc=3: + * mnv600:fdm=marker fdl=1 fdc=3: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * fold.c: code for folding */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_FOLDING) @@ -1469,7 +1469,7 @@ deleteFoldEntry(garray_T *gap, int idx, int recursive) sizeof(fold_T) * (gap->ga_len - (idx + 1))); // move the contained folds one level up mch_memmove(fp, nfp, (size_t)(sizeof(fold_T) * moved)); - vim_free(nfp); + mnv_free(nfp); gap->ga_len += moved - 1; } } @@ -1815,7 +1815,7 @@ foldAddMarker(linenr_T lnum, char_u *marker, int markerlen) STRCPY(newline, line); // Append the marker to the end of the line if (p == NULL || line_is_comment) - vim_strncpy(newline + line_len, marker, markerlen); + mnv_strncpy(newline + line_len, marker, markerlen); else { STRCPY(newline + line_len, cms); @@ -1873,7 +1873,7 @@ foldDelMarker(linenr_T lnum, char_u *marker, int markerlen) { // Found the marker, include a digit if it's there. len = markerlen; - if (VIM_ISDIGIT(p[len])) + if (MNV_ISDIGIT(p[len])) ++len; if (*cms != NUL) { @@ -1940,18 +1940,18 @@ get_foldtext( char_u *p; // Set "v:foldstart" and "v:foldend". - set_vim_var_nr(VV_FOLDSTART, lnum); - set_vim_var_nr(VV_FOLDEND, lnume); + set_mnv_var_nr(VV_FOLDSTART, lnum); + set_mnv_var_nr(VV_FOLDEND, lnume); // Set "v:folddashes" to a string of "level" dashes. // Set "v:foldlevel" to "level". level = foldinfo->fi_level; if (level > (int)sizeof(dashes) - 1) level = (int)sizeof(dashes) - 1; - vim_memset(dashes, '-', (size_t)level); + mnv_memset(dashes, '-', (size_t)level); dashes[level] = NUL; - set_vim_var_string(VV_FOLDDASHES, dashes, level); - set_vim_var_nr(VV_FOLDLEVEL, (long)level); + set_mnv_var_string(VV_FOLDDASHES, dashes, level); + set_mnv_var_nr(VV_FOLDLEVEL, (long)level); // skip evaluating 'foldtext' on errors if (!got_fdt_error) @@ -1978,7 +1978,7 @@ get_foldtext( } last_lnum = lnum; last_wp = wp; - set_vim_var_string(VV_FOLDDASHES, NULL, -1); + set_mnv_var_string(VV_FOLDDASHES, NULL, -1); if (!did_emsg && save_did_emsg) did_emsg = save_did_emsg; @@ -1993,7 +1993,7 @@ get_foldtext( if (has_mbyte && (len = (*mb_ptr2len)(p)) > 1) { - if (!vim_isprintc((*mb_ptr2char)(p))) + if (!mnv_isprintc((*mb_ptr2char)(p))) break; p += len - 1; } @@ -2006,7 +2006,7 @@ get_foldtext( if (*p != NUL) { p = transstr(text); - vim_free(text); + mnv_free(text); text = p; } } @@ -2016,7 +2016,7 @@ get_foldtext( { long count = (long)(lnume - lnum + 1); - vim_snprintf((char *)buf, FOLD_TEXT_LEN, + mnv_snprintf((char *)buf, FOLD_TEXT_LEN, NGETTEXT("+--%3ld line folded ", "+--%3ld lines folded ", count), count); @@ -2046,7 +2046,7 @@ foldtext_cleanup(char_u *str) // Ignore leading and trailing white space in 'commentstring'. cms_start = skipwhite(curbuf->b_p_cms); cms_slen = (int)STRLEN(cms_start); - while (cms_slen > 0 && VIM_ISWHITE(cms_start[cms_slen - 1])) + while (cms_slen > 0 && MNV_ISWHITE(cms_start[cms_slen - 1])) --cms_slen; // locate "%s" in 'commentstring', use the part before and after it. @@ -2057,7 +2057,7 @@ foldtext_cleanup(char_u *str) cms_slen = (int)(cms_end - cms_start); // exclude white space before "%s" - while (cms_slen > 0 && VIM_ISWHITE(cms_start[cms_slen - 1])) + while (cms_slen > 0 && MNV_ISWHITE(cms_start[cms_slen - 1])) --cms_slen; // skip "%s" and white space after it @@ -2076,12 +2076,12 @@ foldtext_cleanup(char_u *str) len = foldendmarkerlen; if (len > 0) { - if (VIM_ISDIGIT(s[len])) + if (MNV_ISDIGIT(s[len])) ++len; // May remove 'commentstring' start. Useful when it's a double // quote and we already removed a double quote. - for (p = s; p > str && VIM_ISWHITE(p[-1]); --p) + for (p = s; p > str && MNV_ISWHITE(p[-1]); --p) ; if (p >= str + cms_slen && STRNCMP(p - cms_slen, cms_start, cms_slen) == 0) @@ -2106,7 +2106,7 @@ foldtext_cleanup(char_u *str) } if (len != 0) { - while (VIM_ISWHITE(s[len])) + while (MNV_ISWHITE(s[len])) ++len; STRMOVE(s, s + len); } @@ -3261,7 +3261,7 @@ foldlevelIndent(fline_T *flp) // empty line or lines starting with a character in 'foldignore': level // depends on surrounding lines - if (*s == NUL || vim_strchr(flp->wp->w_p_fdi, *s) != NULL) + if (*s == NUL || mnv_strchr(flp->wp->w_p_fdi, *s) != NULL) { // first and last line can't be undefined, use level 0 if (lnum == 1 || lnum == buf->b_ml.ml_line_count) @@ -3317,7 +3317,7 @@ foldlevelExpr(fline_T *flp) win = curwin; curwin = flp->wp; curbuf = flp->wp->w_buffer; - set_vim_var_nr(VV_LNUM, lnum); + set_mnv_var_nr(VV_LNUM, lnum); flp->start = 0; flp->had_end = flp->end; @@ -3408,7 +3408,7 @@ foldlevelExpr(fline_T *flp) static void parseMarker(win_T *wp) { - foldendmarker = vim_strchr(wp->w_p_fmr, ','); + foldendmarker = mnv_strchr(wp->w_p_fmr, ','); foldstartmarkerlen = (int)(foldendmarker++ - wp->w_p_fmr); foldendmarkerlen = (int)STRLEN(foldendmarker); } @@ -3451,7 +3451,7 @@ foldlevelMarker(fline_T *flp) { // found startmarker: set flp->lvl s += foldstartmarkerlen; - if (VIM_ISDIGIT(*s)) + if (MNV_ISDIGIT(*s)) { n = atoi((char *)s); if (n > 0) @@ -3476,7 +3476,7 @@ foldlevelMarker(fline_T *flp) { // found endmarker: set flp->lvl_next s += foldendmarkerlen; - if (VIM_ISDIGIT(*s)) + if (MNV_ISDIGIT(*s)) { n = atoi((char *)s); if (n > 0) @@ -3680,7 +3680,7 @@ foldclosed_both( linenr_T lnum; linenr_T first, last; - if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_lnum_arg(argvars, 0) == FAIL) return; lnum = tv_get_lnum(argvars); @@ -3726,7 +3726,7 @@ f_foldlevel(typval_T *argvars UNUSED, typval_T *rettv UNUSED) # ifdef FEAT_FOLDING linenr_T lnum; - if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_lnum_arg(argvars, 0) == FAIL) return; lnum = tv_get_lnum(argvars); @@ -3756,9 +3756,9 @@ f_foldtext(typval_T *argvars UNUSED, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; # ifdef FEAT_FOLDING - foldstart = (linenr_T)get_vim_var_nr(VV_FOLDSTART); - foldend = (linenr_T)get_vim_var_nr(VV_FOLDEND); - dashes = get_vim_var_str(VV_FOLDDASHES); + foldstart = (linenr_T)get_mnv_var_nr(VV_FOLDSTART); + foldend = (linenr_T)get_mnv_var_nr(VV_FOLDEND); + dashes = get_mnv_var_str(VV_FOLDDASHES); if (foldstart > 0 && foldend <= curbuf->b_ml.ml_line_count && dashes != NULL) { @@ -3774,7 +3774,7 @@ f_foldtext(typval_T *argvars UNUSED, typval_T *rettv) { s = skipwhite(s + 2); if (*skipwhite(s) == NUL - && lnum + 1 < (linenr_T)get_vim_var_nr(VV_FOLDEND)) + && lnum + 1 < (linenr_T)get_mnv_var_nr(VV_FOLDEND)) { s = skipwhite(ml_get(lnum + 1)); if (*s == '*') @@ -3818,7 +3818,7 @@ f_foldtextresult(typval_T *argvars UNUSED, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_lnum_arg(argvars, 0) == FAIL) return; # ifdef FEAT_FOLDING @@ -3836,7 +3836,7 @@ f_foldtextresult(typval_T *argvars UNUSED, typval_T *rettv) text = get_foldtext(curwin, lnum, lnum + fold_count - 1, &foldinfo, buf); if (text == buf) - text = vim_strsave(text); + text = mnv_strsave(text); rettv->vval.v_string = text; } diff --git a/uvim/src/fuzzy.c b/uvim/src/fuzzy.c index 9a94acea20..b2e8e97578 100644 --- a/uvim/src/fuzzy.c +++ b/uvim/src/fuzzy.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. * * fuzzy.c: fuzzy matching algorithm and related functions * @@ -32,7 +32,7 @@ * THE SOFTWARE. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) || defined(FEAT_PROTO) static int fuzzy_match_item_compare(const void *s1, const void *s2); @@ -89,7 +89,7 @@ fuzzy_match( *outScore = 0; - save_pat = vim_strsave(pat_arg); + save_pat = mnv_strsave(pat_arg); if (save_pat == NULL) return FALSE; pat = save_pat; @@ -107,7 +107,7 @@ fuzzy_match( if (*p == NUL) break; pat = p; - while (*p != NUL && !VIM_ISWHITE(PTR2CHAR(p))) + while (*p != NUL && !MNV_ISWHITE(PTR2CHAR(p))) { if (has_mbyte) MB_PTR_ADV(p); @@ -152,7 +152,7 @@ fuzzy_match( ++p; } - vim_free(save_pat); + mnv_free(save_pat); return numMatches != 0; } @@ -282,7 +282,7 @@ fuzzy_match_in_list( { if (itemstr_allocate) { - itemstr_copy = vim_strsave(itemstr); + itemstr_copy = mnv_strsave(itemstr); if (itemstr_copy == NULL) { clear_tv(&rettv); @@ -300,7 +300,7 @@ fuzzy_match_in_list( if (match_positions == NULL) { if (itemstr_allocate && itemstr_copy) - vim_free(itemstr_copy); + mnv_free(itemstr_copy); clear_tv(&rettv); continue; } @@ -312,7 +312,7 @@ fuzzy_match_in_list( while (*p != NUL && j < FUZZY_MATCH_MAX_LEN && success) { - if (!VIM_ISWHITE(PTR2CHAR(p)) || matchseq) + if (!MNV_ISWHITE(PTR2CHAR(p)) || matchseq) { if (list_append_number(match_positions, matches[j]) == FAIL) { @@ -331,7 +331,7 @@ fuzzy_match_in_list( { list_free(match_positions); if (itemstr_allocate && itemstr_copy) - vim_free(itemstr_copy); + mnv_free(itemstr_copy); clear_tv(&rettv); continue; } @@ -419,12 +419,12 @@ done: for (int i = 0; i < match_count; i++) { if (items[i].itemstr_allocated) - vim_free(items[i].itemstr); + mnv_free(items[i].itemstr); if (items[i].lmatchpos) list_free(items[i].lmatchpos); } - vim_free(items); + mnv_free(items); } /* @@ -440,7 +440,7 @@ do_fuzzymatch(typval_T *argvars, typval_T *rettv, int retmatchpos) int matchseq = FALSE; long max_matches = 0; - if (in_vim9script() + if (in_mnv9script() && (check_for_list_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL || check_for_opt_dict_arg(argvars, 2) == FAIL)) @@ -682,13 +682,13 @@ fuzzy_match_str_with_pos(char_u *str UNUSED, char_u *pat UNUSED) || score == FUZZY_SCORE_NONE) { ga_clear(match_positions); - vim_free(match_positions); + mnv_free(match_positions); return NULL; } for (char_u *p = pat; *p != NUL; MB_PTR_ADV(p)) { - if (!VIM_ISWHITE(PTR2CHAR(p))) + if (!MNV_ISWHITE(PTR2CHAR(p))) { ga_grow(match_positions, 1); ((int_u *)match_positions->ga_data)[match_positions->ga_len] = @@ -765,7 +765,7 @@ fuzzy_match_str_in_line( // Move to the end of the current word for the next iteration str = end; // Ensure we continue searching after the current word - while (*str != NUL && !vim_iswordp(str)) + while (*str != NUL && !mnv_iswordp(str)) MB_PTR_ADV(str); } @@ -903,8 +903,8 @@ fuzmatch_str_free(fuzmatch_str_T *fuzmatch, int count) return; for (int i = 0; i < count; ++i) - vim_free(fuzmatch[i].str); - vim_free(fuzmatch); + mnv_free(fuzmatch[i].str); + mnv_free(fuzmatch); } /* @@ -939,7 +939,7 @@ fuzzymatches_to_strmatches( (*matches)[i] = fuzmatch[i].str; theend: - vim_free(fuzmatch); + mnv_free(fuzmatch); return OK; } @@ -1010,7 +1010,7 @@ typedef struct match_struct static score_t compute_bonus_codepoint(int last_c, int c) { - if (ASCII_ISALNUM(c) || vim_iswordc(c)) + if (ASCII_ISALNUM(c) || mnv_iswordc(c)) { if (IS_PATH_SEP(last_c)) return SCORE_MATCH_SLASH; @@ -1182,6 +1182,6 @@ match_positions(char_u *needle, char_u *haystack, int_u *positions) } score_t result = M[n - 1][m - 1]; - vim_free(block); + mnv_free(block); return result; } diff --git a/uvim/src/gc.c b/uvim/src/gc.c index f15d1dffe0..fe683a2215 100644 --- a/uvim/src/gc.c +++ b/uvim/src/gc.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * gc.c: Garbage Collection */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) @@ -94,7 +94,7 @@ garbage_collect(int testing) if (exestack.ga_len + n < exestack.ga_maxlen) { new_len = (size_t)exestack.ga_itemsize * (exestack.ga_len + n); - pp = vim_realloc(exestack.ga_data, new_len); + pp = mnv_realloc(exestack.ga_data, new_len); if (pp == NULL) return FAIL; exestack.ga_maxlen = exestack.ga_len + n; @@ -169,7 +169,7 @@ garbage_collect(int testing) abort = abort || set_ref_in_loopvars(copyID); // v: vars - abort = abort || garbage_collect_vimvars(copyID); + abort = abort || garbage_collect_mnvvars(copyID); // callbacks in buffers abort = abort || set_ref_in_buffers(copyID); diff --git a/uvim/src/getchar.c b/uvim/src/getchar.c index b4ef9ce82e..bd0076670b 100644 --- a/uvim/src/getchar.c +++ b/uvim/src/getchar.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -12,7 +12,7 @@ * file, manipulations with redo buffer and stuff buffer. */ -#include "vim.h" +#include "mnv.h" /* * These buffers are used for storing: @@ -122,7 +122,7 @@ free_buff(buffheader_T *buf) for (p = buf->bh_first.b_next; p != NULL; p = np) { np = p->b_next; - vim_free(p); + mnv_free(p); } buf->bh_first.b_next = NULL; buf->bh_curr = NULL; @@ -252,7 +252,7 @@ add_buff( if (!buf->bh_create_newblock && buf->bh_space >= (int)slen) { - vim_strncpy(buf->bh_curr->b_str + buf->bh_curr->b_strlen, s, (size_t)slen); + mnv_strncpy(buf->bh_curr->b_str + buf->bh_curr->b_strlen, s, (size_t)slen); buf->bh_curr->b_strlen += slen; buf->bh_space -= slen; } @@ -268,7 +268,7 @@ add_buff( p = alloc(offsetof(buffblock_T, b_str) + len + 1); if (p == NULL) return; // no space, just forget it - vim_strncpy(p->b_str, s, (size_t)slen); + mnv_strncpy(p->b_str, s, (size_t)slen); p->b_strlen = slen; buf->bh_space = (int)(len - slen); buf->bh_create_newblock = FALSE; @@ -305,7 +305,7 @@ add_num_buff(buffheader_T *buf, long n) char_u number[32]; int numberlen; - numberlen = vim_snprintf((char *)number, sizeof(number), "%ld", n); + numberlen = mnv_snprintf((char *)number, sizeof(number), "%ld", n); add_buff(buf, number, (long)numberlen); } @@ -401,7 +401,7 @@ read_readbuf(buffheader_T *buf, int advance) if (curr->b_str[++buf->bh_index] == NUL) { buf->bh_first.b_next = curr->b_next; - vim_free(curr); + mnv_free(curr); buf->bh_index = 0; } } @@ -569,7 +569,7 @@ saveRedobuff(save_redo_T *save_redo) return; add_buff(&redobuff, s, (long)slen); - vim_free(s); + mnv_free(s); } /* @@ -956,7 +956,7 @@ start_redo(long count, int old_redo) // try to enter the count (in place of a previous count) if (count) { - while (VIM_ISDIGIT(c)) // skip "old" count + while (MNV_ISDIGIT(c)) // skip "old" count c = read_redo(FALSE, old_redo); add_num_buff(&readbuf2, count); } @@ -984,7 +984,7 @@ start_redo_ins(void) // skip the count and the command character while ((c = read_redo(FALSE, FALSE)) != NUL) { - if (vim_strchr((char_u *)"AaIiRrOo", c) != NULL) + if (mnv_strchr((char_u *)"AaIiRrOo", c) != NULL) { if (c == 'O' || c == 'o') add_buff(&readbuf2, NL_STR, -1L); @@ -1118,7 +1118,7 @@ ins_typebuf( s2 = alloc(newlen); if (s2 == NULL) // out of memory { - vim_free(s1); + mnv_free(s1); return FAIL; } typebuf.tb_buflen = newlen; @@ -1134,7 +1134,7 @@ ins_typebuf( typebuf.tb_buf + typebuf.tb_off + offset, (size_t)(typebuf.tb_len - offset + 1)); if (typebuf.tb_buf != typebuf_init) - vim_free(typebuf.tb_buf); + mnv_free(typebuf.tb_buf); typebuf.tb_buf = s1; mch_memmove(s2 + newoff, typebuf.tb_noremap + typebuf.tb_off, @@ -1143,7 +1143,7 @@ ins_typebuf( typebuf.tb_noremap + typebuf.tb_off + offset, (size_t)(typebuf.tb_len - offset)); if (typebuf.tb_noremap != noremapbuf_init) - vim_free(typebuf.tb_noremap); + mnv_free(typebuf.tb_noremap); typebuf.tb_noremap = s2; typebuf.tb_off = newoff; @@ -1516,11 +1516,11 @@ free_typebuf(void) if (typebuf.tb_buf == typebuf_init) internal_error("Free typebuf 1"); else - VIM_CLEAR(typebuf.tb_buf); + MNV_CLEAR(typebuf.tb_buf); if (typebuf.tb_noremap == noremapbuf_init) internal_error("Free typebuf 2"); else - VIM_CLEAR(typebuf.tb_noremap); + MNV_CLEAR(typebuf.tb_noremap); } /* @@ -1993,7 +1993,7 @@ vgetc(void) // Handle K_TEAROFF here, the caller of vgetc() doesn't need to // know that a menu was torn off if ( -# ifdef VIMDLL +# ifdef MNVDLL gui.in_use && # endif c == K_TEAROFF) @@ -2236,13 +2236,13 @@ do_key_input_pre(int c) buf[buflen] = NUL; typedchars[typedchars_pos] = NUL; - vim_unescape_csi(typedchars); + mnv_unescape_csi(typedchars); get_mode(curr_mode); // Lock the text to avoid weird things from happening. ++textlock; - set_vim_var_string(VV_CHAR, buf, (int)buflen); // set v:char + set_mnv_var_string(VV_CHAR, buf, (int)buflen); // set v:char v_event = get_v_event(&save_v_event); (void)dict_add_bool(v_event, "typed", KeyTyped); @@ -2255,7 +2255,7 @@ do_key_input_pre(int c) // Get the value of v:char. It may be empty or more than one // character. Only use it when changed, otherwise continue with the // original character. - v_char.string = get_vim_var_str(VV_CHAR); + v_char.string = get_mnv_var_str(VV_CHAR); if (STRCMP(buf, v_char.string) != 0) { v_char.length = STRLEN(v_char.string); @@ -2269,7 +2269,7 @@ do_key_input_pre(int c) restore_v_event(v_event, &save_v_event); - set_vim_var_string(VV_CHAR, NULL, -1); // clear v:char + set_mnv_var_string(VV_CHAR, NULL, -1); // clear v:char --textlock; // Restore the State, it may have been changed. @@ -2412,7 +2412,7 @@ getchar_common(typval_T *argvars, typval_T *rettv, int allow_number) int simplify = TRUE; char_u cursor_flag = 'm'; - if ((in_vim9script() + if ((in_mnv9script() && check_for_opt_bool_or_number_arg(argvars, 0) == FAIL) || (argvars[0].v_type != VAR_UNKNOWN && check_for_opt_dict_arg(argvars, 1) == FAIL)) @@ -2495,10 +2495,10 @@ getchar_common(typval_T *argvars, typval_T *rettv, int allow_number) if (cursor_flag == 'h') cursor_unsleep(); - set_vim_var_nr(VV_MOUSE_WIN, 0); - set_vim_var_nr(VV_MOUSE_WINID, 0); - set_vim_var_nr(VV_MOUSE_LNUM, 0); - set_vim_var_nr(VV_MOUSE_COL, 0); + set_mnv_var_nr(VV_MOUSE_WIN, 0); + set_mnv_var_nr(VV_MOUSE_WINID, 0); + set_mnv_var_nr(VV_MOUSE_LNUM, 0); + set_mnv_var_nr(VV_MOUSE_COL, 0); if (n != 0 && (!allow_number || IS_SPECIAL(n) || mod_mask != 0)) { @@ -2524,7 +2524,7 @@ getchar_common(typval_T *argvars, typval_T *rettv, int allow_number) temp[i++] = n; temp[i] = NUL; rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strnsave(temp, i); + rettv->vval.v_string = mnv_strnsave(temp, i); if (is_mouse_key(n)) { @@ -2551,10 +2551,10 @@ getchar_common(typval_T *argvars, typval_T *rettv, int allow_number) for (wp = firstwin; wp != win && wp != NULL; wp = wp->w_next) ++winnr; - set_vim_var_nr(VV_MOUSE_WIN, winnr); - set_vim_var_nr(VV_MOUSE_WINID, win->w_id); - set_vim_var_nr(VV_MOUSE_LNUM, lnum); - set_vim_var_nr(VV_MOUSE_COL, col + 1); + set_mnv_var_nr(VV_MOUSE_WIN, winnr); + set_mnv_var_nr(VV_MOUSE_WINID, win->w_id); + set_mnv_var_nr(VV_MOUSE_LNUM, lnum); + set_mnv_var_nr(VV_MOUSE_COL, col + 1); } } } @@ -2598,7 +2598,7 @@ f_getcharmod(typval_T *argvars UNUSED, typval_T *rettv) /* * Process messages that have been queued for netbeans or clientserver. * Also check if any jobs have ended. - * These functions can call arbitrary Vim script and should only be called when + * These functions can call arbitrary MNV script and should only be called when * it is safe to do so. */ void @@ -2722,7 +2722,7 @@ at_ins_compl_key(void) && p[1] == KS_MODIFIER && (p[2] & MOD_MASK_CTRL)) c = p[3] & 0x1f; - return (ctrl_x_mode_not_default() && vim_is_ctrl_x_key(c)) + return (ctrl_x_mode_not_default() && mnv_is_ctrl_x_key(c)) || (compl_status_local() && (c == Ctrl_N || c == Ctrl_P)); } @@ -3156,7 +3156,7 @@ handle_mapping( for (s = typebuf.tb_buf + typebuf.tb_off + 1; s < typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len - && (VIM_ISDIGIT(*s) || *s == ';' || *s == ' '); + && (MNV_ISDIGIT(*s) || *s == ';' || *s == ' '); ++s) ; if (*s == 'r' || *s == '|') // found one @@ -3309,9 +3309,9 @@ handle_mapping( vgetc_busy = 0; may_garbage_collect = FALSE; - save_m_keys = vim_strnsave(mp->m_keys, (size_t)mp->m_keylen); + save_m_keys = mnv_strnsave(mp->m_keys, (size_t)mp->m_keylen); save_alt_m_keys = mp->m_alt != NULL - ? vim_strnsave(mp->m_alt->m_keys, + ? mnv_strnsave(mp->m_alt->m_keys, (size_t)save_alt_m_keylen) : NULL; map_str = eval_map_expr(mp, NUL); @@ -3327,12 +3327,12 @@ handle_mapping( { char_u buf[4]; - vim_free(map_str); + mnv_free(map_str); buf[0] = K_SPECIAL; buf[1] = KS_EXTRA; buf[2] = KE_IGNORE; buf[3] = NUL; - map_str = vim_strnsave(buf, 3); + map_str = mnv_strnsave(buf, 3); if (State & MODE_CMDLINE) { // redraw the command below the error @@ -3388,12 +3388,12 @@ handle_mapping( 0, TRUE, cmd_silent || save_m_silent); #ifdef FEAT_EVAL if (save_m_expr) - vim_free(map_str); + mnv_free(map_str); #endif } #ifdef FEAT_EVAL - vim_free(save_m_keys); - vim_free(save_alt_m_keys); + mnv_free(save_m_keys); + mnv_free(save_alt_m_keys); #endif *keylenp = keylen; if (i == FAIL) @@ -3703,7 +3703,7 @@ vgetorpeek(int advance) curwin->w_cursor.lnum, 0, ptr, ptr); while (cts.cts_ptr < ptr + curwin->w_cursor.col) { - if (!VIM_ISWHITE(*cts.cts_ptr)) + if (!MNV_ISWHITE(*cts.cts_ptr)) curwin->w_wcol = cts.cts_vcol; cts.cts_vcol += lbr_chartabsize(&cts); if (has_mbyte) @@ -4183,10 +4183,10 @@ fix_input_buffer(char_u *buf, int len) if (p[0] == NUL || (p[0] == K_SPECIAL // timeout may generate K_CURSORHOLD && (i < 2 || p[1] != KS_EXTRA || p[2] != (int)KE_CURSORHOLD) -#if defined(MSWIN) && (!defined(FEAT_GUI) || defined(VIMDLL)) +#if defined(MSWIN) && (!defined(FEAT_GUI) || defined(MNVDLL)) // Win32 console passes modifiers && ( -# ifdef VIMDLL +# ifdef MNVDLL gui.in_use || # endif (i < 2 || p[1] != KS_MODIFIER)) @@ -4215,7 +4215,7 @@ fix_input_buffer(char_u *buf, int len) int input_available(void) { - return (!vim_is_input_buf_empty() + return (!mnv_is_input_buf_empty() # if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL) || typebuf_was_filled # endif @@ -4358,7 +4358,7 @@ may_add_last_used_map_to_redobuff(void) buf[2] = KE_SID; buflen = 3; - buflen += vim_snprintf((char *)buf + 3, 20, "%d;", sid); + buflen += mnv_snprintf((char *)buf + 3, 20, "%d;", sid); add_buff(&redobuff, buf, (long)buflen); } #endif diff --git a/uvim/src/globals.h b/uvim/src/globals.h index 4b40873a96..8161676a0f 100644 --- a/uvim/src/globals.h +++ b/uvim/src/globals.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* @@ -234,7 +234,7 @@ EXTERN int did_emsg_def; // set by emsg() when emsg_silent // is set before calling a function EXTERN int did_emsg_cumul; // cumulative did_emsg, increased // when did_emsg is reset. -EXTERN int called_vim_beep; // set if vim_beep() is called +EXTERN int called_mnv_beep; // set if mnv_beep() is called EXTERN int uncaught_emsg; // number of times emsg() was // called and did show a message #endif @@ -244,7 +244,7 @@ EXTERN int called_emsg; // always incremented by emsg() EXTERN int in_echowindow; // executing ":echowindow" EXTERN int ex_exitval INIT(= 0); // exit value for ex mode EXTERN int emsg_on_display INIT(= FALSE); // there is an error message -EXTERN int rc_did_emsg INIT(= FALSE); // vim_regcomp() called emsg() +EXTERN int rc_did_emsg INIT(= FALSE); // mnv_regcomp() called emsg() EXTERN int no_wait_return INIT(= 0); // don't wait for return for now EXTERN int need_wait_return INIT(= 0); // need to wait for return later @@ -268,8 +268,8 @@ EXTERN int x_force_connect INIT(= FALSE); // Do connect to X server. EXTERN int ex_keep_indent INIT(= FALSE); // getexmodeline(): keep indent EXTERN int vgetc_busy INIT(= 0); // when inside vgetc() then > 0 -EXTERN int didset_vim INIT(= FALSE); // did set $VIM ourselves -EXTERN int didset_vimruntime INIT(= FALSE); // idem for $VIMRUNTIME +EXTERN int didset_mnv INIT(= FALSE); // did set $MNV ourselves +EXTERN int didset_mnvruntime INIT(= FALSE); // idem for $MNVRUNTIME /* * Lines left before a "more" message. Ex mode needs to be able to reset this @@ -817,7 +817,7 @@ EXTERN int highlight_stltermnc[9]; // On top of user EXTERN int skip_term_loop INIT(= FALSE); #endif #ifdef FEAT_GUI -EXTERN char_u *use_gvimrc INIT(= NULL); // "-U" cmdline argument +EXTERN char_u *use_gmnvrc INIT(= NULL); // "-U" cmdline argument #endif EXTERN int cterm_normal_fg_color INIT(= 0); EXTERN int cterm_normal_fg_bold INIT(= 0); @@ -910,7 +910,7 @@ EXTERN int dont_parse_messages INIT(= FALSE); #ifdef FEAT_MENU // The root of the menu hierarchy. -EXTERN vimmenu_T *root_menu INIT(= NULL); +EXTERN mnvmenu_T *root_menu INIT(= NULL); /* * While defining the system menu, sys_menu is TRUE. This avoids * overruling of menus that the user already defined. @@ -921,7 +921,7 @@ EXTERN int sys_menu INIT(= FALSE); #ifdef FEAT_GUI # ifdef FEAT_MENU // Menu item just selected, set by check_termcode() -EXTERN vimmenu_T *current_menu; +EXTERN mnvmenu_T *current_menu; // Set to TRUE after adding/removing menus to ensure they are updated EXTERN int force_menu_update INIT(= FALSE); @@ -1104,9 +1104,9 @@ EXTERN int sc_col; // column for shown command #ifdef TEMPDIRNAMES # if defined(UNIX) && defined(HAVE_FLOCK) \ && (defined(HAVE_DIRFD) || defined(__hpux)) -EXTERN DIR *vim_tempdir_dp INIT(= NULL); // File descriptor of temp dir +EXTERN DIR *mnv_tempdir_dp INIT(= NULL); // File descriptor of temp dir # endif -EXTERN char_u *vim_tempdir INIT(= NULL); // Name of Vim's own temp dir. +EXTERN char_u *mnv_tempdir INIT(= NULL); // Name of MNV's own temp dir. // Ends in a slash. #endif @@ -1118,7 +1118,7 @@ EXTERN int starting INIT(= NO_SCREEN); // first NO_SCREEN, then NO_BUFFERS and then // set to 0 when starting up finished EXTERN int exiting INIT(= FALSE); - // TRUE when planning to exit Vim. Might + // TRUE when planning to exit MNV. Might // still keep on running if there is a changed // buffer. EXTERN int really_exiting INIT(= FALSE); @@ -1141,10 +1141,10 @@ EXTERN volatile sig_atomic_t full_screen INIT(= FALSE); // otherwise only writing some messages EXTERN int restricted INIT(= FALSE); - // TRUE when started as "rvim" + // TRUE when started as "rmnv" EXTERN int secure INIT(= FALSE); // non-zero when only "safe" commands are - // allowed, e.g. when sourcing .exrc or .vimrc + // allowed, e.g. when sourcing .exrc or .mnvrc // in current directory EXTERN int textlock INIT(= 0); @@ -1320,8 +1320,8 @@ EXTERN char mb_bytelen_tab[256]; // Variables that tell what conversion is used for keyboard input and display // output. -EXTERN vimconv_T input_conv; // type of input conversion -EXTERN vimconv_T output_conv; // type of output conversion +EXTERN mnvconv_T input_conv; // type of input conversion +EXTERN mnvconv_T output_conv; // type of output conversion /* * Function pointers, used to quickly get to the right function. Each has @@ -1390,7 +1390,7 @@ EXTERN guicolor_T xim_bg_color INIT(= INVALCOLOR); #endif /* - * "State" is the main state of Vim. + * "State" is the main state of MNV. * There are other variables that modify the state: * "Visual_mode" When State is MODE_NORMAL or MODE_INSERT. * "finish_op" When State is MODE_NORMAL, after typing the operator and @@ -1411,7 +1411,7 @@ EXTERN int motion_force INIT(= 0); // motion force for pending operator /* * Ex mode (Q) state */ -EXTERN int exmode_active INIT(= 0); // zero, EXMODE_NORMAL or EXMODE_VIM +EXTERN int exmode_active INIT(= 0); // zero, EXMODE_NORMAL or EXMODE_MNV // Flag set when main_loop() should exit when entering Ex mode. EXTERN int pending_exmode_active INIT(= FALSE); @@ -1599,9 +1599,9 @@ EXTERN int searchcmdlen; // length of previous search cmd EXTERN int reg_do_extmatch INIT(= 0); // Used when compiling regexp: // REX_SET to allow \z\(...\), // REX_USE to allow \z\1 et al. -EXTERN reg_extmatch_T *re_extmatch_in INIT(= NULL); // Used by vim_regexec(): +EXTERN reg_extmatch_T *re_extmatch_in INIT(= NULL); // Used by mnv_regexec(): // strings for \z\1...\z\9 -EXTERN reg_extmatch_T *re_extmatch_out INIT(= NULL); // Set by vim_regexec() +EXTERN reg_extmatch_T *re_extmatch_out INIT(= NULL); // Set by mnv_regexec() // to store \z\(...\) matches #endif @@ -1701,8 +1701,8 @@ extern char *longVersion; * Makefile to make their value depend on the Makefile. */ #ifdef HAVE_PATHDEF -extern char_u *default_vim_dir; -extern char_u *default_vimruntime_dir; +extern char_u *default_mnv_dir; +extern char_u *default_mnvruntime_dir; extern char_u *all_cflags; extern char_u *all_lflags; # ifdef VMS @@ -1865,7 +1865,7 @@ EXTERN int echo_wid_arg INIT(= FALSE); // --echo-wid argument #ifdef FEAT_GUI_MSWIN /* * The value of the --windowid argument. - * For embedding gvim inside another application. + * For embedding gmnv inside another application. */ EXTERN long_u win_socket_id INIT(= 0); #endif @@ -1963,8 +1963,8 @@ EXTERN FILE *time_fd INIT(= NULL); // where to write startup timing * can't do anything useful with the value. Assign to this variable to avoid * the warning. */ -EXTERN int vim_ignored; -EXTERN char *vim_ignoredp; +EXTERN int mnv_ignored; +EXTERN char *mnv_ignoredp; #ifdef FEAT_EVAL // set by alloc_fail(): ID diff --git a/uvim/src/gmnvtutor b/uvim/src/gmnvtutor new file mode 100644 index 0000000000..8d159a236b --- /dev/null +++ b/uvim/src/gmnvtutor @@ -0,0 +1,8 @@ +#!/bin/sh + +# Start GUI MNV on a copy of the tutor file. + +# Usage: gmnvtutor [xx] +# See mnvtutor for usage. + +exec $(dirname $0)/mnvtutor -g "$@" diff --git a/uvim/src/gui.c b/uvim/src/gui.c index 4238b8b731..ff03032cf7 100644 --- a/uvim/src/gui.c +++ b/uvim/src/gui.c @@ -1,14 +1,14 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * GUI/Motif support by Robert Webb * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ -#include "vim.h" +#include "mnv.h" // Structure containing all the GUI information gui_T gui; @@ -57,7 +57,7 @@ static int disable_flush = 0; // If > 0, gui_mch_flush() is disabled. * gui_start -- Called when user wants to start the GUI. * * Careful: This function can be called recursively when there is a ":gui" - * command in the .gvimrc file. Only the first call should fork, not the + * command in the .gmnvrc file. Only the first call should fork, not the * recursive call. */ void @@ -71,11 +71,11 @@ gui_start(char_u *arg UNUSED) char *msg = NULL; #endif - old_term = vim_strsave(T_NAME); + old_term = mnv_strsave(T_NAME); settmode(TMODE_COOK); // stop RAW mode if (full_screen) - cursor_on(); // needed for ":gui" in .vimrc + cursor_on(); // needed for ":gui" in .mnvrc full_screen = FALSE; // If GUI fails to start, then we will recover afterwards @@ -85,13 +85,13 @@ gui_start(char_u *arg UNUSED) ++recursive; /* * Quit the current process and continue in the child. - * Makes "gvim file" disconnect from the shell it was started in. - * Don't do this when Vim was started with "-f" or the 'f' flag is present + * Makes "gmnv file" disconnect from the shell it was started in. + * Don't do this when MNV was started with "-f" or the 'f' flag is present * in 'guioptions'. * Don't do this when there is a running job, we can only get the status * of a child from the parent. */ - if (gui.dofork && !vim_strchr(p_go, GO_FORG) && recursive <= 1 + if (gui.dofork && !mnv_strchr(p_go, GO_FORG) && recursive <= 1 # ifdef FEAT_JOB_CHANNEL && !job_any_running() # endif @@ -106,7 +106,7 @@ gui_start(char_u *arg UNUSED) # ifdef EXPERIMENTAL_GUI_CMD && gui.dofork # endif - && !vim_strchr(p_go, GO_FORG) + && !mnv_strchr(p_go, GO_FORG) && !anyBufIsChanged() # ifdef FEAT_JOB_CHANNEL && !job_any_running() @@ -166,11 +166,11 @@ gui_start(char_u *arg UNUSED) #ifdef FEAT_GUI_MSWIN // Enable fullscreen mode - if (vim_strchr(p_go, GO_FULLSCREEN) != NULL) + if (mnv_strchr(p_go, GO_FULLSCREEN) != NULL) gui_mch_set_fullscreen(TRUE); #endif - vim_free(old_term); + mnv_free(old_term); // If the GUI started successfully, trigger the GUIEnter event, otherwise // the GUIFailed event. @@ -186,9 +186,9 @@ gui_start(char_u *arg UNUSED) * Set_termname() will call gui_init() to start the GUI. * Set the "starting" flag, to indicate that the GUI will start. * - * We don't want to open the GUI shell until after we've read .gvimrc, + * We don't want to open the GUI shell until after we've read .gmnvrc, * otherwise we don't know what font we will use, and hence we don't know - * what size the shell should be. So if there are errors in the .gvimrc + * what size the shell should be. So if there are errors in the .gmnvrc * file, they will have to go to the terminal: Set full_screen to FALSE. * full_screen will be set to TRUE again by a successful termcapinit(). */ @@ -215,7 +215,7 @@ gui_attempt_start(void) Display *x11_display; if (gui_get_x11_windis(&x11_window, &x11_display) == OK) - set_vim_var_nr(VV_WINDOWID, (long)x11_window); + set_mnv_var_nr(VV_WINDOWID, (long)x11_window); # endif // Display error messages in a dialog now. display_errors(); @@ -270,8 +270,8 @@ gui_do_fork(void) else if (pid > 0) // Parent { // Give the child some time to do the setsid(), otherwise the - // exit() may kill the child too (when starting gvim from inside a - // gvim). + // exit() may kill the child too (when starting gmnv from inside a + // gmnv). if (!pipe_error) { // The read returns when the child closes the pipe (or when @@ -319,7 +319,7 @@ gui_do_fork(void) # if defined(HAVE_SETSID) || defined(HAVE_SETPGID) /* * Change our process group. On some systems/shells a CTRL-C in the - * shell where Vim was started would otherwise kill gvim! + * shell where MNV was started would otherwise kill gmnv! */ # if defined(HAVE_SETSID) (void)setsid(); @@ -383,7 +383,7 @@ gui_read_child_pipe(int fd) #endif // GUI_MAY_FORK /* - * Call this when vim starts up, whether or not the GUI is started + * Call this when mnv starts up, whether or not the GUI is started */ void gui_prepare(int *argc, char **argv) @@ -395,7 +395,7 @@ gui_prepare(int *argc, char **argv) /* * Try initializing the GUI and check if it can be started. - * Used from main() to check early if "vim -g" can start the GUI. + * Used from main() to check early if "mnv -g" can start the GUI. * Used from gui_init() to prepare for starting the GUI. * Returns FAIL or OK. */ @@ -474,14 +474,14 @@ gui_init_check(void) gui.prev_wrap = -1; #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN) - // Note: gui_set_ligatures() might already have been called e.g. from .vimrc, + // Note: gui_set_ligatures() might already have been called e.g. from .mnvrc, // and in that case we don't want to overwrite ligatures map that has already // been correctly populated (as that would lead to a cleared ligatures maps). if (*p_guiligatures == NUL) CLEAR_FIELD(gui.ligatures_map); #endif -#if defined(ALWAYS_USE_GUI) || defined(VIMDLL) +#if defined(ALWAYS_USE_GUI) || defined(MNVDLL) result = OK; #else # ifdef FEAT_GUI_GTK @@ -490,7 +490,7 @@ gui_init_check(void) # endif /* * Note: Don't call gtk_init_check() before fork, it will be called after - * the fork. When calling it before fork, it make vim hang for a while. + * the fork. When calling it before fork, it make mnv hang for a while. * See gui_do_fork(). * Use a simpler check if the GUI window can probably be opened. */ @@ -513,10 +513,10 @@ gui_init(void) static int recursive = 0; /* - * It's possible to use ":gui" in a .gvimrc file. The first half of this + * It's possible to use ":gui" in a .gmnvrc file. The first half of this * function will then be executed at the first call, the rest by the * recursive call. This allow the shell to be opened halfway reading a - * gvimrc file. + * gmnvrc file. */ if (!recursive) { @@ -545,7 +545,7 @@ gui_init(void) * Set up system-wide default menus. */ #if defined(SYS_MENU_FILE) && defined(FEAT_MENU) - if (vim_strchr(p_go, GO_NOSYSMENU) == NULL) + if (mnv_strchr(p_go, GO_NOSYSMENU) == NULL) { sys_menu = TRUE; do_source((char_u *)SYS_MENU_FILE, FALSE, DOSO_NONE, NULL); @@ -555,7 +555,7 @@ gui_init(void) /* * Switch on the mouse by default, unless the user changed it already. - * This can then be changed in the .gvimrc. + * This can then be changed in the .gmnvrc. */ if (!option_was_set((char_u *)"mouse")) set_string_option_direct((char_u *)"mouse", -1, @@ -565,59 +565,59 @@ gui_init(void) * If -U option given, use only the initializations from that file and * nothing else. Skip all initializations for "-U NONE" or "-u NORC". */ - if (use_gvimrc != NULL) + if (use_gmnvrc != NULL) { - if (STRCMP(use_gvimrc, "NONE") != 0 - && STRCMP(use_gvimrc, "NORC") != 0 - && do_source(use_gvimrc, FALSE, DOSO_NONE, NULL) != OK) - semsg(_(e_cannot_read_from_str), use_gvimrc); + if (STRCMP(use_gmnvrc, "NONE") != 0 + && STRCMP(use_gmnvrc, "NORC") != 0 + && do_source(use_gmnvrc, FALSE, DOSO_NONE, NULL) != OK) + semsg(_(e_cannot_read_from_str), use_gmnvrc); } else { /* - * Get system wide defaults for gvim, only when file name defined. + * Get system wide defaults for gmnv, only when file name defined. */ -#ifdef SYS_GVIMRC_FILE - do_source((char_u *)SYS_GVIMRC_FILE, FALSE, DOSO_NONE, NULL); +#ifdef SYS_GMNVRC_FILE + do_source((char_u *)SYS_GMNVRC_FILE, FALSE, DOSO_NONE, NULL); #endif /* * Try to read GUI initialization commands from the following * places: - * - environment variable GVIMINIT - * - the user gvimrc file (~/.gvimrc) - * - the second user gvimrc file ($VIM/.gvimrc for Dos) - * - the third user gvimrc file ($VIM/.gvimrc for Amiga) + * - environment variable GMNVINIT + * - the user gmnvrc file (~/.gmnvrc) + * - the second user gmnvrc file ($MNV/.gmnvrc for Dos) + * - the third user gmnvrc file ($MNV/.gmnvrc for Amiga) * The first that exists is used, the rest is ignored. */ - if (process_env((char_u *)"GVIMINIT", FALSE) == FAIL - && do_source((char_u *)USR_GVIMRC_FILE, TRUE, - DOSO_GVIMRC, NULL) == FAIL -#ifdef USR_GVIMRC_FILE2 - && do_source((char_u *)USR_GVIMRC_FILE2, TRUE, - DOSO_GVIMRC, NULL) == FAIL + if (process_env((char_u *)"GMNVINIT", FALSE) == FAIL + && do_source((char_u *)USR_GMNVRC_FILE, TRUE, + DOSO_GMNVRC, NULL) == FAIL +#ifdef USR_GMNVRC_FILE2 + && do_source((char_u *)USR_GMNVRC_FILE2, TRUE, + DOSO_GMNVRC, NULL) == FAIL #endif -#ifdef USR_GVIMRC_FILE3 - && do_source((char_u *)USR_GVIMRC_FILE3, TRUE, - DOSO_GVIMRC, NULL) == FAIL +#ifdef USR_GMNVRC_FILE3 + && do_source((char_u *)USR_GMNVRC_FILE3, TRUE, + DOSO_GMNVRC, NULL) == FAIL #endif ) { -#ifdef USR_GVIMRC_FILE4 - (void)do_source((char_u *)USR_GVIMRC_FILE4, TRUE, - DOSO_GVIMRC, NULL); +#ifdef USR_GMNVRC_FILE4 + (void)do_source((char_u *)USR_GMNVRC_FILE4, TRUE, + DOSO_GMNVRC, NULL); #endif } /* - * Read initialization commands from ".gvimrc" in current + * Read initialization commands from ".gmnvrc" in current * directory. This is only done if the 'exrc' option is set. * Because of security reasons we disallow shell and write * commands now, except for unix if the file is owned by the user * or 'secure' option has been reset in environment of global - * ".gvimrc". - * Only do this if GVIMRC_FILE is not the same as USR_GVIMRC_FILE, - * USR_GVIMRC_FILE2, USR_GVIMRC_FILE3 or SYS_GVIMRC_FILE. + * ".gmnvrc". + * Only do this if GMNVRC_FILE is not the same as USR_GMNVRC_FILE, + * USR_GMNVRC_FILE2, USR_GMNVRC_FILE3 or SYS_GMNVRC_FILE. */ if (p_exrc) { @@ -625,35 +625,35 @@ gui_init(void) { stat_T s; - // if ".gvimrc" file is not owned by user, set 'secure' + // if ".gmnvrc" file is not owned by user, set 'secure' // mode - if (mch_stat(GVIMRC_FILE, &s) || s.st_uid != getuid()) + if (mch_stat(GMNVRC_FILE, &s) || s.st_uid != getuid()) secure = p_secure; } #else secure = p_secure; #endif - if ( fullpathcmp((char_u *)USR_GVIMRC_FILE, - (char_u *)GVIMRC_FILE, FALSE, TRUE) != FPC_SAME -#ifdef SYS_GVIMRC_FILE - && fullpathcmp((char_u *)SYS_GVIMRC_FILE, - (char_u *)GVIMRC_FILE, FALSE, TRUE) != FPC_SAME + if ( fullpathcmp((char_u *)USR_GMNVRC_FILE, + (char_u *)GMNVRC_FILE, FALSE, TRUE) != FPC_SAME +#ifdef SYS_GMNVRC_FILE + && fullpathcmp((char_u *)SYS_GMNVRC_FILE, + (char_u *)GMNVRC_FILE, FALSE, TRUE) != FPC_SAME #endif -#ifdef USR_GVIMRC_FILE2 - && fullpathcmp((char_u *)USR_GVIMRC_FILE2, - (char_u *)GVIMRC_FILE, FALSE, TRUE) != FPC_SAME +#ifdef USR_GMNVRC_FILE2 + && fullpathcmp((char_u *)USR_GMNVRC_FILE2, + (char_u *)GMNVRC_FILE, FALSE, TRUE) != FPC_SAME #endif -#ifdef USR_GVIMRC_FILE3 - && fullpathcmp((char_u *)USR_GVIMRC_FILE3, - (char_u *)GVIMRC_FILE, FALSE, TRUE) != FPC_SAME +#ifdef USR_GMNVRC_FILE3 + && fullpathcmp((char_u *)USR_GMNVRC_FILE3, + (char_u *)GMNVRC_FILE, FALSE, TRUE) != FPC_SAME #endif -#ifdef USR_GVIMRC_FILE4 - && fullpathcmp((char_u *)USR_GVIMRC_FILE4, - (char_u *)GVIMRC_FILE, FALSE, TRUE) != FPC_SAME +#ifdef USR_GMNVRC_FILE4 + && fullpathcmp((char_u *)USR_GMNVRC_FILE4, + (char_u *)GMNVRC_FILE, FALSE, TRUE) != FPC_SAME #endif ) - do_source((char_u *)GVIMRC_FILE, TRUE, DOSO_GVIMRC, NULL); + do_source((char_u *)GMNVRC_FILE, TRUE, DOSO_GMNVRC, NULL); if (secure == 2) need_wait_return = TRUE; @@ -679,7 +679,7 @@ gui_init(void) goto error; // Avoid a delay for an error message that was printed in the terminal - // where Vim was started. + // where MNV was started. emsg_on_display = FALSE; msg_scrolled = 0; clear_sb_text(TRUE); @@ -778,7 +778,7 @@ gui_init(void) # ifdef FEAT_MENU // If there is no 'm' in 'guioptions' we need to remove the menu now. // It was still there to make F10 work. - if (vim_strchr(p_go, GO_MENUS) == NULL) + if (mnv_strchr(p_go, GO_MENUS) == NULL) { --gui.starting; gui_mch_enable_menu(FALSE); @@ -803,9 +803,9 @@ gui_init(void) if (balloonEval != NULL) { # ifdef FEAT_VARTABS - vim_free(balloonEval->vts); + mnv_free(balloonEval->vts); # endif - vim_free(balloonEval); + mnv_free(balloonEval); } balloonEvalForTerm = FALSE; # ifdef FEAT_GUI_GTK @@ -875,9 +875,9 @@ gui_exit(int rc) # define NEED_GUI_UPDATE_SCREEN 1 /* * Called when the GUI shell is closed by the user. If there are no changed - * files Vim exits, otherwise there will be a dialog to ask the user what to + * files MNV exits, otherwise there will be a dialog to ask the user what to * do. - * When this function returns, Vim should NOT exit! + * When this function returns, MNV should NOT exit! */ void gui_shell_closed(void) @@ -1467,7 +1467,7 @@ gui_position_components(int total_width UNUSED) #if defined(FEAT_TOOLBAR) && (defined(FEAT_GUI_MOTIF) \ || defined(FEAT_GUI_HAIKU) || defined(FEAT_GUI_MSWIN)) - if (vim_strchr(p_go, GO_TOOLBAR) != NULL) + if (mnv_strchr(p_go, GO_TOOLBAR) != NULL) { # if defined(FEAT_GUI_HAIKU) gui_mch_set_toolbar_pos(0, text_area_y, @@ -1549,7 +1549,7 @@ gui_get_base_height(void) base_height += gui.menu_height; # endif # ifdef FEAT_TOOLBAR - if (vim_strchr(p_go, GO_TOOLBAR) != NULL) + if (mnv_strchr(p_go, GO_TOOLBAR) != NULL) base_height += gui.toolbar_height; # endif # if defined(FEAT_GUI_TABLINE) && (defined(FEAT_GUI_MSWIN) \ @@ -1593,7 +1593,7 @@ again: busy = TRUE; #ifdef FEAT_GUI_HAIKU - vim_lock_screen(); + mnv_lock_screen(); #endif // Flush pending output before redrawing @@ -1622,7 +1622,7 @@ again: } #ifdef FEAT_GUI_HAIKU - vim_unlock_screen(); + mnv_unlock_screen(); #endif gui_update_scrollbars(TRUE); @@ -1673,7 +1673,7 @@ gui_get_shellsize(void) } /* - * Set the size of the Vim shell according to Rows and Columns. + * Set the size of the MNV shell according to Rows and Columns. * If "fit_to_display" is TRUE then the size may be reduced to fit the window * on the screen. * When "mustset" is TRUE the size was set by the user. When FALSE a UI @@ -1705,7 +1705,7 @@ gui_set_shellsize( #if defined(MSWIN) || defined(FEAT_GUI_GTK) // If not setting to a user specified size and maximized, calculate the // number of characters that fit in the maximized window. - if (!mustset && (vim_strchr(p_go, GO_KEEPWINSIZE) != NULL + if (!mustset && (mnv_strchr(p_go, GO_KEEPWINSIZE) != NULL || gui_mch_maximized())) { gui_mch_newfont(); @@ -1777,7 +1777,7 @@ gui_set_shellsize( if (fit_to_display && x >= 0 && y >= 0) { - // Some window managers put the Vim window left of/above the screen. + // Some window managers put the MNV window left of/above the screen. // Only change the position if it wasn't already negative before // (happens on MS-Windows with a secondary monitor). gui_mch_update(); @@ -1902,7 +1902,7 @@ gui_write( if (s[0] == ESC && s[1] == '|') { p = s + 2; - if (VIM_ISDIGIT(*p) || (*p == '-' && VIM_ISDIGIT(*(p + 1)))) + if (MNV_ISDIGIT(*p) || (*p == '-' && MNV_ISDIGIT(*(p + 1)))) { arg1 = getdigits(&p); if (p > s + len) @@ -2073,7 +2073,7 @@ gui_write( gui.dragged_sb = SBAR_NONE; #endif - gui_may_flush(); // In case vim decides to take a nap + gui_may_flush(); // In case mnv decides to take a nap } /* @@ -2258,7 +2258,7 @@ gui_screenstr( buf[outlen] = NUL; // only to aid debugging retval = gui_outstr_nowrap(buf, outlen, flags, fg, bg, back); - vim_free(buf); + mnv_free(buf); return retval; } @@ -2281,7 +2281,7 @@ gui_screenstr( buf[outlen] = NUL; // only to aid debugging retval = gui_outstr_nowrap(buf, outlen, flags, fg, bg, back); - vim_free(buf); + mnv_free(buf); return retval; } @@ -2365,7 +2365,7 @@ gui_outstr_nowrap( slen = MIN(n, (int)sizeof(extra) - 1); } - vim_memset(extra, ' ', slen); + mnv_memset(extra, ' ', slen); extra[slen] = NUL; s = extra; if (len == 1 && col > 0) @@ -2753,7 +2753,7 @@ gui_redraw( * its location after a scroll. * (maybe be more strict even and test col too?) * These things may be outside the update/clipping region and reality may - * not reflect Vims internal ideas if these operations are clipped away. + * not reflect MNVs internal ideas if these operations are clipped away. */ if (gui.row == gui.cursor_row) gui_update_cursor(TRUE, TRUE); @@ -3372,7 +3372,7 @@ button_set: /* * If we are dragging and the mouse hasn't moved far enough to be on a - * different character, then don't send an event to vim. + * different character, then don't send an event to mnv. */ if (button == MOUSE_DRAG) { @@ -3464,7 +3464,7 @@ gui_xy2colrow(int x, int y, int *colp) * Callback function for when a menu entry has been selected. */ void -gui_menu_cb(vimmenu_T *menu) +gui_menu_cb(mnvmenu_T *menu) { char_u bytes[sizeof(long_u)]; @@ -3533,8 +3533,8 @@ gui_init_which_components(char_u *oldval UNUSED) /* * Check if the menus go from grey to non-grey or vice versa. */ - grey_old = (vim_strchr(oldval, GO_GREY) != NULL); - grey_new = (vim_strchr(p_go, GO_GREY) != NULL); + grey_old = (mnv_strchr(oldval, GO_GREY) != NULL); + grey_new = (mnv_strchr(p_go, GO_GREY) != NULL); if (grey_old != grey_new) { temp = p_go; @@ -3759,7 +3759,7 @@ gui_init_which_components(char_u *oldval UNUSED) int gui_use_tabline(void) { - return gui.in_use && vim_strchr(p_go, GO_TABLINE) != NULL; + return gui.in_use && mnv_strchr(p_go, GO_TABLINE) != NULL; } /* @@ -3825,7 +3825,7 @@ get_tabline_label( printer_page_num = tabpage_index(tp); # ifdef FEAT_EVAL - set_vim_var_nr(VV_LNUM, printer_page_num); + set_mnv_var_nr(VV_LNUM, printer_page_num); # endif // It's almost as going to the tabpage, but without autocommands. curtab->tp_firstwin = firstwin; @@ -3880,7 +3880,7 @@ get_tabline_label( size_t NameBufflen = STRLEN(NameBuff); if (wincount > 1) - buflen = vim_snprintf_safelen( + buflen = mnv_snprintf_safelen( (char *)buf, sizeof(buf), "%d%s ", @@ -4022,9 +4022,9 @@ gui_find_scrollbar(long ident) * For most systems: Put a code in the input buffer for a dragged scrollbar. * * For Win32, Macintosh and GTK+ 2: - * Scrollbars seem to grab focus and vim doesn't read the input queue until + * Scrollbars seem to grab focus and mnv doesn't read the input queue until * you stop dragging the scrollbar. We get here each time the scrollbar is - * dragged another pixel, but as far as the rest of vim goes, it thinks + * dragged another pixel, but as far as the rest of mnv goes, it thinks * we're just hanging in the call to DispatchMessage() in * process_message(). The DispatchMessage() call that hangs was passed a * mouse button click event in the scrollbar window. -- webb. @@ -4101,7 +4101,7 @@ gui_drag_scrollbar(scrollbar_T *sb, long value, int still_dragging) #ifdef USE_ON_FLY_SCROLL // When not allowed to do the scrolling right now, return. // This also checked input_available(), but that causes the first click in - // a scrollbar to be ignored when Vim doesn't have focus. + // a scrollbar to be ignored when MNV doesn't have focus. if (dont_scroll) return; #endif @@ -4370,7 +4370,7 @@ gui_update_scrollbars( #if defined(FEAT_TOOLBAR) && (defined(FEAT_GUI_MSWIN) \ || defined(FEAT_GUI_HAIKU)) - if (vim_strchr(p_go, GO_TOOLBAR) != NULL) + if (mnv_strchr(p_go, GO_TOOLBAR) != NULL) y += gui.toolbar_height; #endif @@ -4687,14 +4687,14 @@ gui_check_colors(void) gui_set_fg_color(char_u *name) { gui.norm_pixel = gui_get_color(name); - hl_set_fg_color_name(vim_strsave(name)); + hl_set_fg_color_name(mnv_strsave(name)); } static void gui_set_bg_color(char_u *name) { gui.back_pixel = gui_get_color(name); - hl_set_bg_color_name(vim_strsave(name)); + hl_set_bg_color_name(mnv_strsave(name)); } /* @@ -4788,7 +4788,7 @@ gui_focus_change(int in_focus) { /* * Skip this code to avoid drawing the cursor when debugging and switching - * between the debugger window and gvim. + * between the debugger window and gmnv. */ #if 1 gui.in_focus = in_focus; @@ -4839,9 +4839,9 @@ gui_mouse_focus(int x, int y) && State != MODE_HITRETURN // but not hit-return prompt && msg_scrolled == 0 // no scrolled message && !need_mouse_correct // not moving the pointer - && gui.in_focus) // gvim in focus + && gui.in_focus) // gmnv in focus { - // Don't move the mouse when it's left or right of the Vim window + // Don't move the mouse when it's left or right of the MNV window if (x < 0 || x > Columns * gui.char_width) return; #ifndef FEAT_MOUSESHAPE @@ -4921,7 +4921,7 @@ gui_mouse_window(mouse_find_T popup) return NULL; gui_mch_getmouse(&x, &y); - // Only use the mouse when it's on the Vim window + // Only use the mouse when it's on the MNV window if (x >= 0 && x <= Columns * gui.char_width && y >= 0 && Y_2_ROW(y) >= tabline_height()) return xy2win(x, y, popup); @@ -4998,7 +4998,7 @@ xy2win(int x, int y, mouse_find_T popup) } /* - * ":gui" and ":gvim": Change from the terminal version to the GUI version. + * ":gui" and ":gmnv": Change from the terminal version to the GUI version. * File names may be given to redefine the args list. */ void @@ -5008,19 +5008,19 @@ ex_gui(exarg_T *eap) /* * Check for "-f" argument: foreground, don't fork. - * Also don't fork when started with "gvim -f". + * Also don't fork when started with "gmnv -f". * Do fork when using "gui -b". */ if (arg[0] == '-' && (arg[1] == 'f' || arg[1] == 'b') - && (arg[2] == NUL || VIM_ISWHITE(arg[2]))) + && (arg[2] == NUL || MNV_ISWHITE(arg[2]))) { gui.dofork = (arg[1] == 'b'); eap->arg = skipwhite(eap->arg + 2); } if (!gui.in_use) { -#if defined(VIMDLL) && !defined(EXPERIMENTAL_GUI_CMD) +#if defined(MNVDLL) && !defined(EXPERIMENTAL_GUI_CMD) if (!gui.starting) { emsg(_(e_gui_cannot_be_used_not_enabled_at_compile_time)); @@ -5075,7 +5075,7 @@ gui_find_bitmap(char_u *name, char_u *buffer, char *ext) { if (STRLEN(name) > MAXPATHL - 14) return FAIL; - vim_snprintf((char *)buffer, MAXPATHL, "bitmaps/%s.%s", name, ext); + mnv_snprintf((char *)buffer, MAXPATHL, "bitmaps/%s.%s", name, ext); if (do_in_runtimepath(buffer, 0, gfp_setname, buffer) == FAIL || *buffer == NUL) return FAIL; @@ -5124,7 +5124,7 @@ display_errors(void) // Truncate a very long message, it will go off-screen. if (STRLEN(p) > 2000) STRCPY(p + 2000 - 14, "...(truncated)"); - (void)do_dialog(VIM_ERROR, (char_u *)_("Error"), + (void)do_dialog(MNV_ERROR, (char_u *)_("Error"), p, (char_u *)_("&Ok"), 1, NULL, FALSE); break; } @@ -5136,7 +5136,7 @@ display_errors(void) /* * Return TRUE if still starting up and there is no place to enter text. * For GTK and X11 we check if stderr is not a tty, which means we were - * (probably) started from the desktop. Also check stdin, "vim >& file" does + * (probably) started from the desktop. Also check stdin, "mnv >& file" does * allow typing on stdin. */ int @@ -5238,7 +5238,7 @@ get_find_dialog_text( { int len = (int)STRLEN(text); - text = vim_strnsave(text, len); + text = mnv_strnsave(text, len); if (text != NULL) { int i; @@ -5324,10 +5324,10 @@ gui_do_findrepl( if (flags & FRD_WHOLE_WORD) GA_CONCAT_LITERAL(&ga, "\\<"); // escape slash and backslash - p = vim_strsave_escaped(find_text, (char_u *)"/\\"); + p = mnv_strsave_escaped(find_text, (char_u *)"/\\"); if (p != NULL) ga_concat(&ga, p); - vim_free(p); + mnv_free(p); if (flags & FRD_WHOLE_WORD) GA_CONCAT_LITERAL(&ga, "\\>"); @@ -5336,11 +5336,11 @@ gui_do_findrepl( GA_CONCAT_LITERAL(&ga, "/"); // Escape slash and backslash. // Also escape tilde and ampersand if 'magic' is set. - p = vim_strsave_escaped(repl_text, + p = mnv_strsave_escaped(repl_text, p_magic ? (char_u *)"/\\~&" : (char_u *)"/\\"); if (p != NULL) ga_concat(&ga, p); - vim_free(p); + mnv_free(p); GA_CONCAT_LITERAL(&ga, "/g"); } ga_append(&ga, NUL); @@ -5349,12 +5349,12 @@ gui_do_findrepl( { // Do the replacement when the text at the cursor matches. Thus no // replacement is done if the cursor was moved! - regmatch.regprog = vim_regcomp(ga.ga_data, RE_MAGIC + RE_STRING); + regmatch.regprog = mnv_regcomp(ga.ga_data, RE_MAGIC + RE_STRING); regmatch.rm_ic = 0; if (regmatch.regprog != NULL) { p = ml_get_cursor(); - if (vim_regexec_nl(®match, p, (colnr_T)0) + if (mnv_regexec_nl(®match, p, (colnr_T)0) && regmatch.startp[0] == p) { // Clear the command line to remove any old "No match" @@ -5373,7 +5373,7 @@ gui_do_findrepl( } else msg(_("No match at cursor, finding next")); - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); } } @@ -5400,10 +5400,10 @@ gui_do_findrepl( { // We need to escape '?' if and only if we are searching in the up // direction - p = vim_strsave_escaped(ga.ga_data, (char_u *)"?"); + p = mnv_strsave_escaped(ga.ga_data, (char_u *)"?"); if (p != NULL) (void)do_search(NULL, '?', '?', p, STRLEN(p), 1L, searchflags, NULL); - vim_free(p); + mnv_free(p); } msg_scroll = i; // don't let an error message set msg_scroll @@ -5420,7 +5420,7 @@ gui_do_findrepl( need_wait_return = FALSE; // don't wait for return } - vim_free(ga.ga_data); + mnv_free(ga.ga_data); busy = FALSE; return (ga.ga_len > 0); } @@ -5466,9 +5466,9 @@ drop_callback(void *cookie) if (mch_chdir((char *)p) == 0) do_shorten = TRUE; } - else if (vim_chdirfile(p, "drop") == OK) + else if (mnv_chdirfile(p, "drop") == OK) do_shorten = TRUE; - vim_free(p); + mnv_free(p); if (do_shorten) { shorten_fnames(TRUE); @@ -5531,17 +5531,17 @@ gui_handle_drop( // about which characters need to be escaped. Only escape the // most common ones. # ifdef BACKSLASH_IN_FILENAME - p = vim_strsave_escaped(fnames[i], (char_u *)" \t\"|"); + p = mnv_strsave_escaped(fnames[i], (char_u *)" \t\"|"); # else - p = vim_strsave_escaped(fnames[i], (char_u *)"\\ \t\"|"); + p = mnv_strsave_escaped(fnames[i], (char_u *)"\\ \t\"|"); # endif if (p != NULL) add_to_input_buf_csi(p, (int)STRLEN(p)); - vim_free(p); - vim_free(fnames[i]); + mnv_free(p); + mnv_free(fnames[i]); } } - vim_free(fnames); + mnv_free(fnames); } else { @@ -5552,7 +5552,7 @@ gui_handle_drop( // If Shift held down, remember the first item. if ((modifiers & MOUSE_SHIFT) != 0) - p = vim_strsave(fnames[0]); + p = mnv_strsave(fnames[0]); else p = NULL; @@ -5562,9 +5562,9 @@ gui_handle_drop( if (count == 1 && (modifiers & MOUSE_SHIFT) != 0 && mch_isdir(fnames[0])) { - vim_free(fnames[0]); - vim_free(fnames); - vim_free(p); + mnv_free(fnames[0]); + mnv_free(fnames); + mnv_free(p); } else handle_drop(count, fnames, (modifiers & MOUSE_CTRL) != 0, diff --git a/uvim/src/gui.h b/uvim/src/gui.h index 76d5882221..f1cd56fff3 100644 --- a/uvim/src/gui.h +++ b/uvim/src/gui.h @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * Motif support by Robert Webb * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ #ifdef FEAT_GUI_MOTIF @@ -47,7 +47,7 @@ #endif /* - * GUIs that support dropping files on a running Vim. + * GUIs that support dropping files on a running MNV. */ #if (defined(FEAT_DND) && defined(FEAT_GUI_GTK)) \ || defined(FEAT_GUI_MSWIN) \ @@ -177,7 +177,7 @@ typedef struct GuiScrollbar #endif #ifdef FEAT_GUI_HAIKU - VimScrollBar *id; // Pointer to real scroll bar + MNVScrollBar *id; // Pointer to real scroll bar #endif #ifdef FEAT_GUI_PHOTON PtWidget_t *id; @@ -219,23 +219,23 @@ typedef long guicolor_T; // handle for a GUI color; for X11 this should # endif #endif -#ifdef VIMDLL +#ifdef MNVDLL // Use spawn when GUI is starting. # define GUI_MAY_SPAWN // Uncomment the next definition if you want to use the `:gui` command on -// Windows. It uses `:mksession` to inherit the session from vim.exe to -// gvim.exe. So, it doesn't work perfectly. (EXPERIMENTAL) +// Windows. It uses `:mksession` to inherit the session from mnv.exe to +// gmnv.exe. So, it doesn't work perfectly. (EXPERIMENTAL) //# define EXPERIMENTAL_GUI_CMD #endif typedef struct Gui { - int in_focus; // Vim has input focus + int in_focus; // MNV has input focus int in_use; // Is the GUI being used? int starting; // GUI will start in a little while bool shell_created; // Has the shell been created yet? - int dying; // Is vim dying? Then output to terminal + int dying; // Is mnv dying? Then output to terminal int dofork; // Use fork() when GUI is starting #ifdef GUI_MAY_SPAWN int dospawn; // Use spawn() when GUI is starting @@ -436,25 +436,25 @@ typedef struct Gui #endif #ifdef FEAT_GUI_HAIKU - VimApp *vimApp; - VimWindow *vimWindow; - VimFormView *vimForm; - VimTextAreaView *vimTextArea; - int vdcmp; // Vim Direct Communication Message Port + MNVApp *mnvApp; + MNVWindow *mnvWindow; + MNVFormView *mnvForm; + MNVTextAreaView *mnvTextArea; + int vdcmp; // MNV Direct Communication Message Port #endif #ifdef FEAT_GUI_PHOTON - PtWidget_t *vimWindow; // PtWindow - PtWidget_t *vimTextArea; // PtRaw - PtWidget_t *vimContainer; // PtPanel + PtWidget_t *mnvWindow; // PtWindow + PtWidget_t *mnvTextArea; // PtRaw + PtWidget_t *mnvContainer; // PtPanel # if defined(FEAT_MENU) || defined(FEAT_TOOLBAR) - PtWidget_t *vimToolBarGroup; + PtWidget_t *mnvToolBarGroup; # endif # ifdef FEAT_MENU - PtWidget_t *vimMenuBar; + PtWidget_t *mnvMenuBar; # endif # ifdef FEAT_TOOLBAR - PtWidget_t *vimToolBar; + PtWidget_t *mnvToolBar; int toolbar_height; # endif PhEvent_t *event_buffer; @@ -506,7 +506,7 @@ typedef enum * rare occasions where the comma operator comes in handy :) * * Note: Do NOT keep the result around when handling control back to - * the main Vim! The user could change 'encoding' at any time. + * the main MNV! The user could change 'encoding' at any time. */ # define CONVERT_TO_UTF8(String) \ ((output_conv.vc_type == CONV_NONE || (String) == NULL) \ @@ -516,7 +516,7 @@ typedef enum # define CONVERT_TO_UTF8_FREE(String) \ ((String) = ((output_conv.vc_type == CONV_NONE) \ ? (char_u *)NULL \ - : (vim_free(String), (char_u *)NULL))) + : (mnv_free(String), (char_u *)NULL))) # define CONVERT_FROM_UTF8(String) \ ((input_conv.vc_type == CONV_NONE || (String) == NULL) \ @@ -526,7 +526,7 @@ typedef enum # define CONVERT_FROM_UTF8_FREE(String) \ ((String) = ((input_conv.vc_type == CONV_NONE) \ ? (char_u *)NULL \ - : (vim_free(String), (char_u *)NULL))) + : (mnv_free(String), (char_u *)NULL))) #else # define CONVERT_TO_UTF8(String) (String) diff --git a/uvim/src/gui_beval.c b/uvim/src/gui_beval.c index 1d41089fec..4a2f476798 100644 --- a/uvim/src/gui_beval.c +++ b/uvim/src/gui_beval.c @@ -1,14 +1,14 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * Visual Workshop integration by Gordon Prieur * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_BEVAL_GUI) @@ -33,7 +33,7 @@ # endif # ifndef FEAT_GUI_GTK -extern Widget vimShell; +extern Widget mnvShell; /* * Currently, we assume that there can be only one BalloonEval showing @@ -107,8 +107,8 @@ gui_mch_create_beval_area( beval->appContext = XtWidgetToApplicationContext((Widget)target); # endif beval->showState = ShS_NEUTRAL; - vim_free(beval->msg); - beval->msg = mesg == NULL ? NULL : vim_strsave(mesg); + mnv_free(beval->msg); + beval->msg = mesg == NULL ? NULL : mnv_strsave(mesg); beval->msgCB = mesgCB; beval->clientData = clientData; @@ -155,9 +155,9 @@ gui_mch_destroy_beval_area(BalloonEval *beval) # endif # ifdef FEAT_VARTABS if (beval->vts) - vim_free(beval->vts); + mnv_free(beval->vts); # endif - vim_free(beval); + mnv_free(beval); } # endif @@ -199,8 +199,8 @@ gui_mch_currently_showing_beval(void) void gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) { - vim_free(beval->msg); - beval->msg = mesg == NULL ? NULL : vim_strsave(mesg); + mnv_free(beval->msg); + beval->msg = mesg == NULL ? NULL : mnv_strsave(mesg); if (beval->msg != NULL) drawBalloon(beval); else @@ -217,7 +217,7 @@ gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) void gui_mch_unpost_balloon(BalloonEval *beval) { - VIM_CLEAR(beval->msg); + MNV_CLEAR(beval->msg); undrawBalloon(beval); } # endif @@ -884,10 +884,10 @@ set_printable_label_text(GtkLabel *label, char_u *text) *pdest = NUL; } - vim_free(convbuf); + mnv_free(convbuf); gtk_label_set_text(label, (const char *)buf); - vim_free(buf); + mnv_free(buf); gtk_label_set_attributes(label, attr_list); pango_attr_list_unref(attr_list); @@ -1042,7 +1042,7 @@ createBalloonEvalWindow(BalloonEval *beval) # else gtk_misc_set_alignment(GTK_MISC(beval->balloonLabel), 0.5f, 0.5f); # endif - gtk_widget_set_name(beval->balloonLabel, "vim-balloon-label"); + gtk_widget_set_name(beval->balloonLabel, "mnv-balloon-label"); gtk_widget_show(beval->balloonLabel); gtk_container_add(GTK_CONTAINER(beval->balloonShell), beval->balloonLabel); diff --git a/uvim/src/gui_dwrite.cpp b/uvim/src/gui_dwrite.cpp index c71358717a..7135365813 100644 --- a/uvim/src/gui_dwrite.cpp +++ b/uvim/src/gui_dwrite.cpp @@ -7,7 +7,7 @@ * - Yasuhiro Matsumoto * * Copyright (C) 2013 MURAOKA Taro - * THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. + * THIS FILE IS DISTRIBUTED UNDER THE MNV LICENSE. */ #define WIN32_LEAN_AND_MEAN @@ -65,7 +65,7 @@ #endif #ifdef DYNAMIC_DIRECTX -extern "C" HINSTANCE vimLoadLib(const char *name); +extern "C" HINSTANCE mnvLoadLib(const char *name); typedef int (WINAPI *PGETUSERDEFAULTLOCALENAME)(LPWSTR, int); typedef HRESULT (WINAPI *PD2D1CREATEFACTORY)(D2D1_FACTORY_TYPE, @@ -1278,8 +1278,8 @@ DWrite_Init(void) { #ifdef DYNAMIC_DIRECTX // Load libraries. - hD2D1DLL = vimLoadLib("d2d1.dll"); - hDWriteDLL = vimLoadLib("dwrite.dll"); + hD2D1DLL = mnvLoadLib("d2d1.dll"); + hDWriteDLL = mnvLoadLib("dwrite.dll"); if (hD2D1DLL == NULL || hDWriteDLL == NULL) { DWrite_Final(); diff --git a/uvim/src/gui_dwrite.h b/uvim/src/gui_dwrite.h index 5de06f92b1..30fa543562 100644 --- a/uvim/src/gui_dwrite.h +++ b/uvim/src/gui_dwrite.h @@ -7,7 +7,7 @@ * - Yasuhiro Matsumoto * * Copyright (C) 2013 MURAOKA Taro - * THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. + * THIS FILE IS DISTRIBUTED UNDER THE MNV LICENSE. */ #ifndef GUI_DWRITE_H diff --git a/uvim/src/gui_gtk.c b/uvim/src/gui_gtk.c index 77f96179e1..b4841dfa31 100644 --- a/uvim/src/gui_gtk.c +++ b/uvim/src/gui_gtk.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -31,7 +31,7 @@ * "Let's give this some time to mature." */ -#include "vim.h" +#include "mnv.h" #ifdef FEAT_GUI_GTK # include "gui_gtk_f.h" @@ -112,7 +112,7 @@ static void recent_func_log_func( #if defined(FEAT_TOOLBAR) /* * Table from BuiltIn## icon indices to GTK+ stock IDs. Order must exactly - * match toolbar_names[] in menu.c! All stock icons including the "vim-*" + * match toolbar_names[] in menu.c! All stock icons including the "mnv-*" * ones can be overridden in your gtkrc file. */ # if GTK_CHECK_VERSION(3,10,0) @@ -132,49 +132,49 @@ static const char * const menu_themed_names[] = # if GTK_CHECK_VERSION(3,14,0) // Use the file names in gui_gtk_res.xml, cutting off the extension. // Similar changes follow. - /* 11 */ "stock_vim_save_all", - /* 12 */ "stock_vim_session_save", - /* 13 */ "stock_vim_session_new", - /* 14 */ "stock_vim_session_load", + /* 11 */ "stock_mnv_save_all", + /* 12 */ "stock_mnv_session_save", + /* 13 */ "stock_mnv_session_new", + /* 14 */ "stock_mnv_session_load", # else - /* 11 */ "vim-save-all", - /* 12 */ "vim-session-save", - /* 13 */ "vim-session-new", - /* 14 */ "vim-session-load", + /* 11 */ "mnv-save-all", + /* 12 */ "mnv-session-save", + /* 13 */ "mnv-session-new", + /* 14 */ "mnv-session-load", # endif /* 15 */ "system-run", // sub. GTK_STOCK_EXECUTE /* 16 */ "edit-find-replace", // sub. GTK_STOCK_FIND_AND_REPLACE /* 17 */ "window-close", // sub. GTK_STOCK_CLOSE, FIXME: fuzzy # if GTK_CHECK_VERSION(3,14,0) - /* 18 */ "stock_vim_window_maximize", - /* 19 */ "stock_vim_window_minimize", - /* 20 */ "stock_vim_window_split", - /* 21 */ "stock_vim_shell", + /* 18 */ "stock_mnv_window_maximize", + /* 19 */ "stock_mnv_window_minimize", + /* 20 */ "stock_mnv_window_split", + /* 21 */ "stock_mnv_shell", # else - /* 18 */ "vim-window-maximize", - /* 19 */ "vim-window-minimize", - /* 20 */ "vim-window-split", - /* 21 */ "vim-shell", + /* 18 */ "mnv-window-maximize", + /* 19 */ "mnv-window-minimize", + /* 20 */ "mnv-window-split", + /* 21 */ "mnv-shell", # endif /* 22 */ "go-previous", // sub. GTK_STOCK_GO_BACK /* 23 */ "go-next", // sub. GTK_STOCK_GO_FORWARD # if GTK_CHECK_VERSION(3,14,0) - /* 24 */ "stock_vim_find_help", + /* 24 */ "stock_mnv_find_help", # else - /* 24 */ "vim-find-help", + /* 24 */ "mnv-find-help", # endif /* 25 */ "gtk-convert", // sub. GTK_STOCK_CONVERT /* 26 */ "go-jump", // sub. GTK_STOCK_JUMP_TO # if GTK_CHECK_VERSION(3,14,0) - /* 27 */ "stock_vim_build_tags", - /* 28 */ "stock_vim_window_split_vertical", - /* 29 */ "stock_vim_window_maximize_width", - /* 30 */ "stock_vim_window_minimize_width", + /* 27 */ "stock_mnv_build_tags", + /* 28 */ "stock_mnv_window_split_vertical", + /* 29 */ "stock_mnv_window_maximize_width", + /* 30 */ "stock_mnv_window_minimize_width", # else - /* 27 */ "vim-build-tags", - /* 28 */ "vim-window-split-vertical", - /* 29 */ "vim-window-maximize-width", - /* 30 */ "vim-window-minimize-width", + /* 27 */ "mnv-build-tags", + /* 28 */ "mnv-window-split-vertical", + /* 29 */ "mnv-window-maximize-width", + /* 30 */ "mnv-window-minimize-width", # endif /* 31 */ "application-exit", // GTK_STOCK_QUIT }; @@ -192,26 +192,26 @@ static const char * const menu_stock_ids[] = /* 08 */ GTK_STOCK_PRINT, /* 09 */ GTK_STOCK_HELP, /* 10 */ GTK_STOCK_FIND, - /* 11 */ "vim-save-all", - /* 12 */ "vim-session-save", - /* 13 */ "vim-session-new", - /* 14 */ "vim-session-load", + /* 11 */ "mnv-save-all", + /* 12 */ "mnv-session-save", + /* 13 */ "mnv-session-new", + /* 14 */ "mnv-session-load", /* 15 */ GTK_STOCK_EXECUTE, /* 16 */ GTK_STOCK_FIND_AND_REPLACE, /* 17 */ GTK_STOCK_CLOSE, // FIXME: fuzzy - /* 18 */ "vim-window-maximize", - /* 19 */ "vim-window-minimize", - /* 20 */ "vim-window-split", - /* 21 */ "vim-shell", + /* 18 */ "mnv-window-maximize", + /* 19 */ "mnv-window-minimize", + /* 20 */ "mnv-window-split", + /* 21 */ "mnv-shell", /* 22 */ GTK_STOCK_GO_BACK, /* 23 */ GTK_STOCK_GO_FORWARD, - /* 24 */ "vim-find-help", + /* 24 */ "mnv-find-help", /* 25 */ GTK_STOCK_CONVERT, /* 26 */ GTK_STOCK_JUMP_TO, - /* 27 */ "vim-build-tags", - /* 28 */ "vim-window-split-vertical", - /* 29 */ "vim-window-maximize-width", - /* 30 */ "vim-window-minimize-width", + /* 27 */ "mnv-build-tags", + /* 28 */ "mnv-window-split-vertical", + /* 29 */ "mnv-window-maximize-width", + /* 30 */ "mnv-window-minimize-width", /* 31 */ GTK_STOCK_QUIT }; # endif // !GTK_CHECK_VERSION(3,10,0) @@ -223,20 +223,20 @@ typedef struct IconNames { const char *file_name; } IconNames; -static IconNames stock_vim_icons[] = { - { "vim-build-tags", "stock_vim_build_tags.png" }, - { "vim-find-help", "stock_vim_find_help.png" }, - { "vim-save-all", "stock_vim_save_all.png" }, - { "vim-session-load", "stock_vim_session_load.png" }, - { "vim-session-new", "stock_vim_session_new.png" }, - { "vim-session-save", "stock_vim_session_save.png" }, - { "vim-shell", "stock_vim_shell.png" }, - { "vim-window-maximize", "stock_vim_window_maximize.png" }, - { "vim-window-maximize-width", "stock_vim_window_maximize_width.png" }, - { "vim-window-minimize", "stock_vim_window_minimize.png" }, - { "vim-window-minimize-width", "stock_vim_window_minimize_width.png" }, - { "vim-window-split", "stock_vim_window_split.png" }, - { "vim-window-split-vertical", "stock_vim_window_split_vertical.png" }, +static IconNames stock_mnv_icons[] = { + { "mnv-build-tags", "stock_mnv_build_tags.png" }, + { "mnv-find-help", "stock_mnv_find_help.png" }, + { "mnv-save-all", "stock_mnv_save_all.png" }, + { "mnv-session-load", "stock_mnv_session_load.png" }, + { "mnv-session-new", "stock_mnv_session_new.png" }, + { "mnv-session-save", "stock_mnv_session_save.png" }, + { "mnv-shell", "stock_mnv_shell.png" }, + { "mnv-window-maximize", "stock_mnv_window_maximize.png" }, + { "mnv-window-maximize-width", "stock_mnv_window_maximize_width.png" }, + { "mnv-window-minimize", "stock_mnv_window_minimize.png" }, + { "mnv-window-minimize-width", "stock_mnv_window_minimize_width.png" }, + { "mnv-window-split", "stock_mnv_window_split.png" }, + { "mnv-window-split-vertical", "stock_mnv_window_split_vertical.png" }, { NULL, NULL } }; # endif @@ -269,7 +269,7 @@ lookup_menu_iconfile(char_u *iconfile, char_u *dest) if (mch_isFullName(dest)) { - return vim_fexists(dest); + return mnv_fexists(dest); } else { @@ -362,7 +362,7 @@ load_menu_iconfile(char_u *name, GtkIconSize icon_size) } static GtkWidget * -create_menu_icon(vimmenu_T *menu, GtkIconSize icon_size) +create_menu_icon(mnvmenu_T *menu, GtkIconSize icon_size) { GtkWidget *image = NULL; char_u buf[MAXPATHL]; @@ -411,7 +411,7 @@ toolbar_button_focus_in_event(GtkWidget *widget UNUSED, gpointer data UNUSED) { // When we're in a GtkPlug, we don't have window focus events, only widget - // focus. To emulate stand-alone gvim, if a button gets focus (e.g., + // focus. To emulate stand-alone gmnv, if a button gets focus (e.g., // into GtkPlug) immediately pass it to mainwin. if (gtk_socket_id != 0) gtk_widget_grab_focus(gui.drawarea); @@ -432,26 +432,26 @@ gui_gtk_register_stock_icons(void) factory = gtk_icon_factory_new(); # define ADD_ICON(Name, Data) add_stock_icon(factory, Name, Data, (int)sizeof(Data)) - ADD_ICON("vim-build-tags", stock_vim_build_tags); - ADD_ICON("vim-find-help", stock_vim_find_help); - ADD_ICON("vim-save-all", stock_vim_save_all); - ADD_ICON("vim-session-load", stock_vim_session_load); - ADD_ICON("vim-session-new", stock_vim_session_new); - ADD_ICON("vim-session-save", stock_vim_session_save); - ADD_ICON("vim-shell", stock_vim_shell); - ADD_ICON("vim-window-maximize", stock_vim_window_maximize); - ADD_ICON("vim-window-maximize-width", stock_vim_window_maximize_width); - ADD_ICON("vim-window-minimize", stock_vim_window_minimize); - ADD_ICON("vim-window-minimize-width", stock_vim_window_minimize_width); - ADD_ICON("vim-window-split", stock_vim_window_split); - ADD_ICON("vim-window-split-vertical", stock_vim_window_split_vertical); + ADD_ICON("mnv-build-tags", stock_mnv_build_tags); + ADD_ICON("mnv-find-help", stock_mnv_find_help); + ADD_ICON("mnv-save-all", stock_mnv_save_all); + ADD_ICON("mnv-session-load", stock_mnv_session_load); + ADD_ICON("mnv-session-new", stock_mnv_session_new); + ADD_ICON("mnv-session-save", stock_mnv_session_save); + ADD_ICON("mnv-shell", stock_mnv_shell); + ADD_ICON("mnv-window-maximize", stock_mnv_window_maximize); + ADD_ICON("mnv-window-maximize-width", stock_mnv_window_maximize_width); + ADD_ICON("mnv-window-minimize", stock_mnv_window_minimize); + ADD_ICON("mnv-window-minimize-width", stock_mnv_window_minimize_width); + ADD_ICON("mnv-window-split", stock_mnv_window_split); + ADD_ICON("mnv-window-split-vertical", stock_mnv_window_split_vertical); # undef ADD_ICON gtk_icon_factory_add_default(factory); g_object_unref(factory); # else // defined(USE_GRESOURCE) - const char * const path_prefix = "/org/vim/gui/icon"; + const char * const path_prefix = "/org/mnv/gui/icon"; # if GTK_CHECK_VERSION(3,14,0) GdkScreen *screen = NULL; GtkIconTheme *icon_theme = NULL; @@ -465,11 +465,11 @@ gui_gtk_register_stock_icons(void) # elif GTK_CHECK_VERSION(3,0,0) IconNames *names; - for (names = stock_vim_icons; names->icon_name != NULL; names++) + for (names = stock_mnv_icons; names->icon_name != NULL; names++) { char path[MAXPATHL]; - vim_snprintf(path, MAXPATHL, "%s/%s", path_prefix, names->file_name); + mnv_snprintf(path, MAXPATHL, "%s/%s", path_prefix, names->file_name); GdkPixbuf *pixbuf = NULL; pixbuf = gdk_pixbuf_new_from_resource(path, NULL); if (pixbuf != NULL) @@ -484,7 +484,7 @@ gui_gtk_register_stock_icons(void) // won't prepare size variants for us out of a single // fixed-size image. // - // Currently, Vim provides 24x24 images only while the + // Currently, MNV provides 24x24 images only while the // icon size on the menu and the toolbar is set to 16x16 // by default. // @@ -507,12 +507,12 @@ gui_gtk_register_stock_icons(void) GtkIconFactory * const factory = gtk_icon_factory_new(); IconNames *names; - for (names = stock_vim_icons; names->icon_name != NULL; names++) + for (names = stock_mnv_icons; names->icon_name != NULL; names++) { char path[MAXPATHL]; GdkPixbuf *pixbuf; - vim_snprintf(path, MAXPATHL, "%s/%s", path_prefix, names->file_name); + mnv_snprintf(path, MAXPATHL, "%s/%s", path_prefix, names->file_name); pixbuf = gdk_pixbuf_new_from_resource(path, NULL); if (pixbuf != NULL) { @@ -534,8 +534,8 @@ gui_gtk_register_stock_icons(void) #if defined(FEAT_MENU) /* - * Translate Vim's mnemonic tagging to GTK+ style and convert to UTF-8 - * if necessary. The caller must vim_free() the returned string. + * Translate MNV's mnemonic tagging to GTK+ style and convert to UTF-8 + * if necessary. The caller must mnv_free() the returned string. * * Input Output * _ __ @@ -591,14 +591,14 @@ translate_mnemonic_tag(char_u *name, int use_mnemonic) } static void -menu_item_new(vimmenu_T *menu, GtkWidget *parent_widget) +menu_item_new(mnvmenu_T *menu, GtkWidget *parent_widget) { GtkWidget *box; char_u *text; int use_mnemonic; // It would be neat to have image menu items, but that would require major - // changes to Vim's menu system. Not to mention that all the translations + // changes to MNV's menu system. Not to mention that all the translations // had to be updated. menu->id = gtk_menu_item_new(); # if GTK_CHECK_VERSION(3,2,0) @@ -612,7 +612,7 @@ menu_item_new(vimmenu_T *menu, GtkWidget *parent_widget) text = translate_mnemonic_tag(menu->name, use_mnemonic); menu->label = gtk_label_new_with_mnemonic((const char *)text); - vim_free(text); + mnv_free(text); gtk_box_pack_start(GTK_BOX(box), menu->label, FALSE, FALSE, 0); @@ -632,9 +632,9 @@ menu_item_new(vimmenu_T *menu, GtkWidget *parent_widget) } void -gui_mch_add_menu(vimmenu_T *menu, int idx) +gui_mch_add_menu(mnvmenu_T *menu, int idx) { - vimmenu_T *parent; + mnvmenu_T *parent; GtkWidget *parent_widget; if (menu->name[0] == ']' || menu_is_popup(menu->name)) @@ -667,7 +667,7 @@ gui_mch_add_menu(vimmenu_T *menu, int idx) # if !GTK_CHECK_VERSION(3,4,0) menu->tearoff_handle = gtk_tearoff_menu_item_new(); - if (vim_strchr(p_go, GO_TEAROFF) != NULL) + if (mnv_strchr(p_go, GO_TEAROFF) != NULL) gtk_widget_show(menu->tearoff_handle); # if GTK_CHECK_VERSION(3,0,0) gtk_menu_shell_prepend(GTK_MENU_SHELL(menu->submenu_id), @@ -681,19 +681,19 @@ gui_mch_add_menu(vimmenu_T *menu, int idx) static void menu_item_activate(GtkWidget *widget UNUSED, gpointer data) { - gui_menu_cb((vimmenu_T *)data); + gui_menu_cb((mnvmenu_T *)data); } static void menu_item_select(GtkWidget *widget UNUSED, gpointer data) { - vimmenu_T *menu; + mnvmenu_T *menu; char_u *tooltip; static int did_msg = FALSE; if (State & MODE_CMDLINE) return; - menu = (vimmenu_T *)data; + menu = (mnvmenu_T *)data; tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]); if (tooltip != NULL && utf_valid_string(tooltip, NULL)) { @@ -713,9 +713,9 @@ menu_item_select(GtkWidget *widget UNUSED, gpointer data) } void -gui_mch_add_menu_item(vimmenu_T *menu, int idx) +gui_mch_add_menu_item(mnvmenu_T *menu, int idx) { - vimmenu_T *parent; + mnvmenu_T *parent; parent = menu->parent; @@ -853,7 +853,7 @@ gui_mch_set_text_area_pos(int x, int y, int w, int h) void gui_gtk_set_mnemonics(int enable) { - vimmenu_T *menu; + mnvmenu_T *menu; char_u *name; FOR_ALL_MENUS(menu) @@ -864,13 +864,13 @@ gui_gtk_set_mnemonics(int enable) name = translate_mnemonic_tag(menu->name, enable); gtk_label_set_text_with_mnemonic(GTK_LABEL(menu->label), (const char *)name); - vim_free(name); + mnv_free(name); } } # if !GTK_CHECK_VERSION(3,4,0) static void -recurse_tearoffs(vimmenu_T *menu, int val) +recurse_tearoffs(mnvmenu_T *menu, int val) { for (; menu != NULL; menu = menu->next) { @@ -904,9 +904,9 @@ gui_mch_toggle_tearoffs(int enable) #if defined(FEAT_TOOLBAR) static int -get_menu_position(vimmenu_T *menu) +get_menu_position(mnvmenu_T *menu) { - vimmenu_T *node; + mnvmenu_T *node; int idx = 0; for (node = menu->parent->children; node != menu; node = node->next) @@ -922,7 +922,7 @@ get_menu_position(vimmenu_T *menu) #if defined(FEAT_TOOLBAR) void -gui_mch_menu_set_tip(vimmenu_T *menu) +gui_mch_menu_set_tip(mnvmenu_T *menu) { if (menu->id == NULL || menu->parent == NULL || gui.toolbar == NULL) return; @@ -949,7 +949,7 @@ gui_mch_menu_set_tip(vimmenu_T *menu) * Destroy the machine specific menu widget. */ void -gui_mch_destroy_menu(vimmenu_T *menu) +gui_mch_destroy_menu(mnvmenu_T *menu) { // Don't let gtk_container_remove automatically destroy menu->id. if (menu->id != NULL) @@ -1222,7 +1222,7 @@ gui_mch_browse(int saving, // GTK has a bug, it only works with an absolute path. if (initdir == NULL || *initdir == NUL) mch_dirname(dirbuf, MAXPATHL); - else if (vim_FullName(initdir, dirbuf, MAXPATHL - 2, FALSE) == FAIL) + else if (mnv_FullName(initdir, dirbuf, MAXPATHL - 2, FALSE) == FAIL) dirbuf[0] = NUL; // Always need a trailing slash for a directory. add_pathsep(dirbuf); @@ -1298,7 +1298,7 @@ gui_mch_browse(int saving, i++; } } - vim_free(patt); + mnv_free(patt); } if (saving && dflt != NULL && *dflt != NUL) gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(fc), (char *)dflt); @@ -1329,7 +1329,7 @@ gui_mch_browse(int saving, return NULL; // shorten the file name if possible - return vim_strsave(shorten_fname1(gui.browse_fname)); + return mnv_strsave(shorten_fname1(gui.browse_fname)); } /* @@ -1372,7 +1372,7 @@ gui_mch_browsedir( // GTK appears to insist on an absolute path. if (initdir == NULL || *initdir == NUL - || vim_FullName(initdir, dirbuf, MAXPATHL - 10, FALSE) == FAIL) + || mnv_FullName(initdir, dirbuf, MAXPATHL - 10, FALSE) == FAIL) mch_dirname(dirbuf, MAXPATHL - 10); // Always need a trailing slash for a directory. @@ -1391,7 +1391,7 @@ gui_mch_browsedir( return NULL; // shorten the file name if possible - p = vim_strsave(shorten_fname1(dirname)); + p = mnv_strsave(shorten_fname1(dirname)); g_free(dirname); return p; @@ -1414,9 +1414,9 @@ create_message_dialog(int type, char_u *title, char_u *message) switch (type) { - case VIM_ERROR: message_type = GTK_MESSAGE_ERROR; break; - case VIM_WARNING: message_type = GTK_MESSAGE_WARNING; break; - case VIM_QUESTION: message_type = GTK_MESSAGE_QUESTION; break; + case MNV_ERROR: message_type = GTK_MESSAGE_ERROR; break; + case MNV_WARNING: message_type = GTK_MESSAGE_WARNING; break; + case MNV_QUESTION: message_type = GTK_MESSAGE_QUESTION; break; default: message_type = GTK_MESSAGE_INFO; break; } @@ -1434,9 +1434,9 @@ create_message_dialog(int type, char_u *title, char_u *message) gtk_window_set_title(GTK_WINDOW(dialog), (const char *)title); CONVERT_TO_UTF8_FREE(title); } - else if (type == VIM_GENERIC) + else if (type == MNV_GENERIC) { - gtk_window_set_title(GTK_WINDOW(dialog), "VIM"); + gtk_window_set_title(GTK_WINDOW(dialog), "MNV"); } return dialog; @@ -1444,7 +1444,7 @@ create_message_dialog(int type, char_u *title, char_u *message) /* * Split up button_string into individual button labels by inserting - * NUL bytes. Also replace the Vim-style mnemonic accelerator prefix + * NUL bytes. Also replace the MNV-style mnemonic accelerator prefix * '&' with '_'. button_string must point to allocated memory! * Return an allocated array of pointers into button_string. */ @@ -1502,7 +1502,7 @@ split_button_translation(const char *message) if (output_conv.vc_type != CONV_NONE) str = string_convert(&output_conv, str, NULL); else - str = vim_strsave(str); + str = mnv_strsave(str); if (str != NULL) buttons = split_button_string(str, &n_buttons); @@ -1514,15 +1514,15 @@ split_button_translation(const char *message) */ if (buttons == NULL || n_buttons != n_expected) { - vim_free(buttons); - vim_free(str); + mnv_free(buttons); + mnv_free(str); buttons = NULL; - str = vim_strsave((char_u *)message); + str = mnv_strsave((char_u *)message); if (str != NULL) buttons = split_button_string(str, &n_buttons); if (buttons == NULL) - vim_free(str); + mnv_free(str); } return buttons; @@ -1558,12 +1558,12 @@ dialog_add_buttons(GtkDialog *dialog, char_u *button_string) int n_buttons = 0; int idx; - button_string = vim_strsave(button_string); // must be writable + button_string = mnv_strsave(button_string); // must be writable if (button_string == NULL) return; // Check 'v' flag in 'guioptions': vertical button placement. - if (vim_strchr(p_go, GO_VERTICAL) != NULL) + if (mnv_strchr(p_go, GO_VERTICAL) != NULL) { # if GTK_CHECK_VERSION(3,0,0) // Add GTK+ 3 code if necessary. @@ -1608,7 +1608,7 @@ dialog_add_buttons(GtkDialog *dialog, char_u *button_string) * button string to get things right. Yes, this is hackish :/ * * But even the common button labels aren't necessarily translated, - * since anyone can create their own dialogs using Vim functions. + * since anyone can create their own dialogs using MNV functions. * Thus we have to check for those too. */ if (ok != NULL && ync != NULL) // almost impossible to fail @@ -1639,20 +1639,20 @@ dialog_add_buttons(GtkDialog *dialog, char_u *button_string) } if (ok != NULL) - vim_free(*ok); + mnv_free(*ok); if (ync != NULL) - vim_free(*ync); - vim_free(ok); - vim_free(ync); - vim_free(buttons); - vim_free(button_string); + mnv_free(*ync); + mnv_free(ok); + mnv_free(ync); + mnv_free(buttons); + mnv_free(button_string); } /* * Allow mnemonic accelerators to be activated without pressing . * I'm not sure if it's a wise idea to do this. However, the old GTK+ 1.2 * GUI used to work this way, and I consider the impact on UI consistency - * low enough to justify implementing this as a special Vim feature. + * low enough to justify implementing this as a special MNV feature. */ typedef struct _DialogInfo { @@ -1786,7 +1786,7 @@ gui_mch_dialog(int type, // type of dialog text = (char_u *)gtk_entry_get_text(GTK_ENTRY(entry)); text = CONVERT_FROM_UTF8(text); - vim_strncpy(textfield, text, IOSIZE - 1); + mnv_strncpy(textfield, text, IOSIZE - 1); CONVERT_FROM_UTF8_FREE(text); } @@ -1802,7 +1802,7 @@ gui_mch_dialog(int type, // type of dialog #if defined(FEAT_MENU) void -gui_mch_show_popupmenu(vimmenu_T *menu) +gui_mch_show_popupmenu(mnvmenu_T *menu) { # if defined(FEAT_XIM) /* @@ -1811,7 +1811,7 @@ gui_mch_show_popupmenu(vimmenu_T *menu) */ # if !GTK_CHECK_VERSION(3,10,0) if (xic != NULL && g_object_get_data(G_OBJECT(menu->submenu_id), - "vim-has-im-menu") == NULL) + "mnv-has-im-menu") == NULL) { GtkWidget *menuitem; GtkWidget *submenu; @@ -1834,7 +1834,7 @@ gui_mch_show_popupmenu(vimmenu_T *menu) gtk_im_multicontext_append_menuitems(GTK_IM_MULTICONTEXT(xic), GTK_MENU_SHELL(submenu)); g_object_set_data(G_OBJECT(menu->submenu_id), - "vim-has-im-menu", GINT_TO_POINTER(TRUE)); + "mnv-has-im-menu", GINT_TO_POINTER(TRUE)); } # endif # endif // FEAT_XIM @@ -1910,7 +1910,7 @@ popup_menu_position_func(GtkMenu *menu UNUSED, void gui_make_popup(char_u *path_name, int mouse_pos) { - vimmenu_T *menu; + mnvmenu_T *menu; popup_mouse_pos = mouse_pos; @@ -2083,7 +2083,7 @@ convert_localized_message(char_u **buffer, const char *message) if (output_conv.vc_type == CONV_NONE) return message; - vim_free(*buffer); + mnv_free(*buffer); *buffer = string_convert(&output_conv, (char_u *)message, NULL); return (const char *)*buffer; @@ -2143,7 +2143,7 @@ find_replace_dialog_create(char_u *arg, int do_replace) { char_u *old_text = entry_text; entry_text = string_convert(&output_conv, entry_text, NULL); - vim_free(old_text); + mnv_free(old_text); } /* @@ -2168,7 +2168,7 @@ find_replace_dialog_create(char_u *arg, int do_replace) if (do_replace && entry_get_text_length(GTK_ENTRY(frdp->what)) > 0) gtk_widget_grab_focus(frdp->with); - vim_free(entry_text); + mnv_free(entry_text); return; } @@ -2184,12 +2184,12 @@ find_replace_dialog_create(char_u *arg, int do_replace) if (do_replace) { gtk_window_set_title(GTK_WINDOW(frdp->dialog), - CONV(_("VIM - Search and Replace..."))); + CONV(_("MNV - Search and Replace..."))); } else { gtk_window_set_title(GTK_WINDOW(frdp->dialog), - CONV(_("VIM - Search..."))); + CONV(_("MNV - Search..."))); } #if GTK_CHECK_VERSION(3,2,0) @@ -2487,8 +2487,8 @@ find_replace_dialog_create(char_u *arg, int do_replace) gtk_widget_show_all(hbox); gtk_widget_show(frdp->dialog); - vim_free(entry_text); - vim_free(conv_buffer); + mnv_free(entry_text); + mnv_free(conv_buffer); #undef CONV } diff --git a/uvim/src/gui_gtk_f.c b/uvim/src/gui_gtk_f.c index dea7dd0b01..9139cddb10 100644 --- a/uvim/src/gui_gtk_f.c +++ b/uvim/src/gui_gtk_f.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -23,7 +23,7 @@ * 2016 Kazunobu Kuriyama */ -#include "vim.h" +#include "mnv.h" #include // without this it compiles, but gives errors at // runtime! #include "gui_gtk_f.h" diff --git a/uvim/src/gui_gtk_f.h b/uvim/src/gui_gtk_f.h index 2103f9df4f..9d107af611 100644 --- a/uvim/src/gui_gtk_f.h +++ b/uvim/src/gui_gtk_f.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ #ifndef __GTK_FORM_H__ diff --git a/uvim/src/gui_gtk_res.xml b/uvim/src/gui_gtk_res.xml index d6c7a592b4..166a1b71c9 100644 --- a/uvim/src/gui_gtk_res.xml +++ b/uvim/src/gui_gtk_res.xml @@ -1,18 +1,18 @@ - - stock_vim_build_tags.png - stock_vim_find_help.png - stock_vim_save_all.png - stock_vim_session_load.png - stock_vim_session_new.png - stock_vim_session_save.png - stock_vim_shell.png - stock_vim_window_maximize.png - stock_vim_window_maximize_width.png - stock_vim_window_minimize.png - stock_vim_window_minimize_width.png - stock_vim_window_split.png - stock_vim_window_split_vertical.png + + stock_mnv_build_tags.png + stock_mnv_find_help.png + stock_mnv_save_all.png + stock_mnv_session_load.png + stock_mnv_session_new.png + stock_mnv_session_save.png + stock_mnv_shell.png + stock_mnv_window_maximize.png + stock_mnv_window_maximize_width.png + stock_mnv_window_minimize.png + stock_mnv_window_minimize_width.png + stock_mnv_window_split.png + stock_mnv_window_split_vertical.png diff --git a/uvim/src/gui_gtk_vms.h b/uvim/src/gui_gtk_vms.h index 2beb0ff6ba..d20cb37b29 100644 --- a/uvim/src/gui_gtk_vms.h +++ b/uvim/src/gui_gtk_vms.h @@ -1,18 +1,18 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. * * File MOTIF_REDEFINES.H originally delivers together with * OpenVMS Porting Library * defunct link: openvms.compaq.com/openvms/products/ips/porting.html * - * This file has been modified for Vim development. + * This file has been modified for MNV development. * Original file contains just defines that GTK for OpenVMS uses, * but not all functions that DECW library has. Therefore it has been expanded - * with necessary defines for Vim on OpenVMS with GTK GUI. + * with necessary defines for MNV on OpenVMS with GTK GUI. * * Zoltan Arpadffy */ diff --git a/uvim/src/gui_gtk_x11.c b/uvim/src/gui_gtk_x11.c index 21e8768abc..33e82e155d 100644 --- a/uvim/src/gui_gtk_x11.c +++ b/uvim/src/gui_gtk_x11.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -25,7 +25,7 @@ * 2016 Kazunobu Kuriyama */ -#include "vim.h" +#include "mnv.h" #ifdef USE_GRESOURCE # include "auto/gui_gtk_gresources.h" #endif @@ -105,18 +105,18 @@ enum TARGET_TEXT_URI_LIST, TARGET_TEXT_PLAIN, TARGET_TEXT_PLAIN_UTF8, - TARGET_VIM, - TARGET_VIMENC + TARGET_MNV, + TARGET_MNVENC }; /* - * Table of selection targets supported by Vim. + * Table of selection targets supported by MNV. * Note: Order matters, preferred types should come first. */ static const GtkTargetEntry selection_targets[] = { - {VIMENC_ATOM_NAME, 0, TARGET_VIMENC}, - {VIM_ATOM_NAME, 0, TARGET_VIM}, + {MNVENC_ATOM_NAME, 0, TARGET_MNVENC}, + {MNV_ATOM_NAME, 0, TARGET_MNV}, {"text/html", 0, TARGET_HTML}, {"UTF8_STRING", 0, TARGET_UTF8_STRING}, {"COMPOUND_TEXT", 0, TARGET_COMPOUND_TEXT}, @@ -129,7 +129,7 @@ static const GtkTargetEntry selection_targets[] = #ifdef FEAT_DND /* - * Table of DnD targets supported by Vim. + * Table of DnD targets supported by MNV. * Note: Order matters, preferred types should come first. */ static const GtkTargetEntry dnd_targets[] = @@ -168,11 +168,11 @@ static GdkAtom save_yourself_atom = GDK_NONE; */ static GdkAtom html_atom = GDK_NONE; static GdkAtom utf8_string_atom = GDK_NONE; -static GdkAtom vim_atom = GDK_NONE; // Vim's own special selection format -static GdkAtom vimenc_atom = GDK_NONE; // Vim's extended selection format +static GdkAtom mnv_atom = GDK_NONE; // MNV's own special selection format +static GdkAtom mnvenc_atom = GDK_NONE; // MNV's extended selection format /* - * Keycodes recognized by vim. + * Keycodes recognized by mnv. * NOTE: when changing this, the table in gui_x11.c probably needs the same * change! */ @@ -297,7 +297,7 @@ const special_keys[] = /* * This table holds all the X GUI command line options allowed. This includes - * the standard ones so that we can skip them when Vim is started without the + * the standard ones so that we can skip them when MNV is started without the * GUI (but the GUI might start up later). * * When changing this, also update doc/gui_x11.txt and the usage message!!! @@ -360,7 +360,7 @@ static const cmdline_option_T cmdline_options[] = {"-?", ARG_FOR_GTK|ARG_NEEDS_GUI}, {"--help", ARG_FOR_GTK|ARG_NEEDS_GUI|ARG_KEEP}, {"--usage", ARG_FOR_GTK|ARG_NEEDS_GUI}, -# if 0 // conflicts with Vim's own --version argument +# if 0 // conflicts with MNV's own --version argument {"--version", ARG_FOR_GTK|ARG_NEEDS_GUI}, # endif {"--disable-crash-dialog", ARG_FOR_GTK}, @@ -395,7 +395,7 @@ static int using_gnome = 0; * discarded. * When a gtk_window_resize() request is sent to gtk, the width/height of * the request is saved. Recent stale requests are kept around in a list. - * See https://github.com/vim/vim/issues/10123 + * See https://github.com/Project-Tick/Project-Tick/issues/10123 */ # if 0 // Change to 1 to enable ch_log() calls for debugging. # ifdef FEAT_EVAL @@ -466,7 +466,7 @@ clear_resize_hists(void) { resize_hist_T *next_hist = old_resize_hists->next; - vim_free(old_resize_hists); + mnv_free(old_resize_hists); old_resize_hists = next_hist; # ifdef ENABLE_RESIZE_HISTORY_LOG i++; @@ -510,7 +510,7 @@ match_stale_width_height(int width, int height) free_all_resize_hist(void) { clear_resize_hists(); - vim_free(latest_resize_hist); + mnv_free(latest_resize_hist); } # endif #endif @@ -524,7 +524,7 @@ static guint dragging_button_state = 0; /* * Parse the GUI related command-line arguments. Any arguments used are * deleted from argv, and *argc is decremented accordingly. This is called - * when vim is started, whether or not the GUI has been started. + * when mnv is started, whether or not the GUI has been started. */ void gui_mch_prepare(int *argc, char **argv) @@ -535,7 +535,7 @@ gui_mch_prepare(int *argc, char **argv) #if defined(USE_GNOME_SESSION) /* - * Determine the command used to invoke Vim, to be passed as restart + * Determine the command used to invoke MNV, to be passed as restart * command to the session manager. If argv[0] contains any directory * components try building an absolute path, otherwise leave it as is. */ @@ -547,7 +547,7 @@ gui_mch_prepare(int *argc, char **argv) if (mch_FullName((char_u *)argv[0], buf, (int)sizeof(buf), TRUE) == OK) { - abs_restart_command = (char *)vim_strsave(buf); + abs_restart_command = (char *)mnv_strsave(buf); restart_command = abs_restart_command; } } @@ -587,7 +587,7 @@ gui_mch_prepare(int *argc, char **argv) break; #ifdef FEAT_NETBEANS_INTG // darn, -nb has non-standard syntax - if (vim_strchr((char_u *)":=", argv[i][len]) != NULL + if (mnv_strchr((char_u *)":=", argv[i][len]) != NULL && (option->flags & ARG_INDEX_MASK) == ARG_NETBEANS) break; #endif @@ -627,7 +627,7 @@ gui_mch_prepare(int *argc, char **argv) value = argv[i + 1]; } - // Check for options handled by Vim itself + // Check for options handled by MNV itself switch (option->flags & ARG_INDEX_MASK) { case ARG_REVERSE: @@ -641,7 +641,7 @@ gui_mch_prepare(int *argc, char **argv) break; case ARG_GEOMETRY: if (value != NULL) - gui.geom = vim_strsave((char_u *)value); + gui.geom = mnv_strsave((char_u *)value); break; case ARG_BACKGROUND: background_argument = value; @@ -708,9 +708,9 @@ gui_mch_prepare(int *argc, char **argv) void gui_mch_free_all(void) { - vim_free(gui_argv); + mnv_free(gui_argv); # if defined(USE_GNOME_SESSION) - vim_free(abs_restart_command); + mnv_free(abs_restart_command); # endif # ifdef TRACK_RESIZE_HISTORY free_all_resize_hist(); @@ -1100,7 +1100,7 @@ keyval_to_string(unsigned int keyval, char_u *string) } else { - // Translate keys which are represented by ASCII control codes in Vim. + // Translate keys which are represented by ASCII control codes in MNV. // There are only a few of those; most control keys are translated to // special terminal-like control sequences. len = 1; @@ -1129,7 +1129,7 @@ keyval_to_string(unsigned int keyval, char_u *string) } static int -modifiers_gdk2vim(guint state) +modifiers_gdk2mnv(guint state) { int modifiers = 0; @@ -1300,7 +1300,7 @@ key_press_event(GtkWidget *widget UNUSED, } // Handle modifiers. - modifiers = modifiers_gdk2vim(state); + modifiers = modifiers_gdk2mnv(state); // Recognize special keys. key = simplify_key(key, &modifiers); @@ -1441,15 +1441,15 @@ selection_received_cb(GtkWidget *widget UNUSED, return; } - if (gtk_selection_data_get_data_type(data) == vim_atom) + if (gtk_selection_data_get_data_type(data) == mnv_atom) { motion_type = *text++; --len; } - else if (gtk_selection_data_get_data_type(data) == vimenc_atom) + else if (gtk_selection_data_get_data_type(data) == mnvenc_atom) { char_u *enc; - vimconv_T conv; + mnvconv_T conv; motion_type = *text++; --len; @@ -1490,7 +1490,7 @@ selection_received_cb(GtkWidget *widget UNUSED, } else if (len >= 2 && text[0] == 0xff && text[1] == 0xfe) { - vimconv_T conv; + mnvconv_T conv; // UTF-16, we get this for HTML conv.vc_type = CONV_NONE; @@ -1514,7 +1514,7 @@ selection_received_cb(GtkWidget *widget UNUSED, clip_yank_selection(motion_type, text, (long)len, cbd); received_selection = RS_OK; - vim_free(tmpbuf); + mnv_free(tmpbuf); g_free(tmpbuf_utf8); } @@ -1549,8 +1549,8 @@ selection_get_cb(GtkWidget *widget UNUSED, if (info != (guint)TARGET_STRING && (!clip_html || info != (guint)TARGET_HTML) && info != (guint)TARGET_UTF8_STRING - && info != (guint)TARGET_VIMENC - && info != (guint)TARGET_VIM + && info != (guint)TARGET_MNVENC + && info != (guint)TARGET_MNV && info != (guint)TARGET_COMPOUND_TEXT && info != (guint)TARGET_TEXT_PLAIN && info != (guint)TARGET_TEXT_PLAIN_UTF8 @@ -1568,7 +1568,7 @@ selection_get_cb(GtkWidget *widget UNUSED, // (Not that pasting 2G of text is ever going to work, but... ;-) length = MIN(tmplen, (long_u)(G_MAXINT - 1)); - if (info == (guint)TARGET_VIM) + if (info == (guint)TARGET_MNV) { tmpbuf = alloc(length + 1); if (tmpbuf != NULL) @@ -1578,14 +1578,14 @@ selection_get_cb(GtkWidget *widget UNUSED, } // For our own format, the first byte contains the motion type ++length; - vim_free(string); + mnv_free(string); string = tmpbuf; - type = vim_atom; + type = mnv_atom; } else if (info == (guint)TARGET_HTML) { - vimconv_T conv; + mnvconv_T conv; // Since we get utf-16, we probably should set it as well. conv.vc_type = CONV_NONE; @@ -1594,7 +1594,7 @@ selection_get_cb(GtkWidget *widget UNUSED, { tmpbuf = string_convert(&conv, string, &length); convert_setup(&conv, NULL, NULL); - vim_free(string); + mnv_free(string); string = tmpbuf; } @@ -1607,7 +1607,7 @@ selection_get_cb(GtkWidget *widget UNUSED, tmpbuf[0] = 0xff; tmpbuf[1] = 0xfe; mch_memmove(tmpbuf + 2, string, (size_t)length); - vim_free(string); + mnv_free(string); string = tmpbuf; length += 2; } @@ -1620,11 +1620,11 @@ selection_get_cb(GtkWidget *widget UNUSED, #endif gtk_selection_data_set(selection_data, html_atom, 16, string, length); - vim_free(string); + mnv_free(string); } return; } - else if (info == (guint)TARGET_VIMENC) + else if (info == (guint)TARGET_MNVENC) { int l = STRLEN(p_enc); @@ -1636,10 +1636,10 @@ selection_get_cb(GtkWidget *widget UNUSED, STRCPY(tmpbuf + 1, p_enc); mch_memmove(tmpbuf + l + 2, string, (size_t)length); length += l + 2; - vim_free(string); + mnv_free(string); string = tmpbuf; } - type = vimenc_atom; + type = mnvenc_atom; } // gtk_selection_data_set_text() handles everything for us. This is @@ -1649,7 +1649,7 @@ selection_get_cb(GtkWidget *widget UNUSED, if (output_conv.vc_type != CONV_NONE) { tmpbuf = string_convert(&output_conv, string, &length); - vim_free(string); + mnv_free(string); if (tmpbuf == NULL) return; string = tmpbuf; @@ -1660,7 +1660,7 @@ selection_get_cb(GtkWidget *widget UNUSED, gtk_selection_data_set_text(selection_data, (const char *)string, length); } - vim_free(string); + mnv_free(string); return; } @@ -1673,12 +1673,12 @@ selection_get_cb(GtkWidget *widget UNUSED, selection_data->format = 8; // 8 bits per char #endif gtk_selection_data_set(selection_data, type, 8, string, length); - vim_free(string); + mnv_free(string); } } /* - * Check if the GUI can be started. Called before gvimrc is sourced and + * Check if the GUI can be started. Called before gmnvrc is sourced and * before fork(). * Return OK or FAIL. */ @@ -1701,7 +1701,7 @@ gui_mch_early_init_check(int give_message) } /* - * Check if the GUI can be started. Called before gvimrc is sourced but after + * Check if the GUI can be started. Called before gmnvrc is sourced but after * fork(). * Return OK or FAIL. */ @@ -1726,9 +1726,9 @@ gui_mch_init_check(void) #endif // This defaults to argv[0], but we want it to match the name of the - // shipped gvim.desktop so that Vim's windows can be associated with this + // shipped gmnv.desktop so that MNV's windows can be associated with this // file. - g_set_prgname("gvim"); + g_set_prgname("gmnv"); // Don't use gtk_init() or gnome_init(), it exits on failure. if (!gtk_init_check(&gui_argc, &gui_argv)) @@ -1769,7 +1769,7 @@ static timeout_cb_type motion_repeat_timer_cb(gpointer); process_motion_notify(int x, int y, GdkModifierType state) { int button; - int_u vim_modifiers; + int_u mnv_modifiers; GtkAllocation allocation; // Need to add GDK_BUTTON1_MASK state when dragging a touch. @@ -1792,10 +1792,10 @@ process_motion_notify(int x, int y, GdkModifierType state) } // translate modifier coding between the main engine and GTK - vim_modifiers = modifiers_gdk2mouse(state); + mnv_modifiers = modifiers_gdk2mouse(state); // inform the editor engine about the occurrence of this event - gui_send_mouse_event(button, x, y, FALSE, vim_modifiers); + gui_send_mouse_event(button, x, y, FALSE, mnv_modifiers); /* * Auto repeat timer handling. @@ -1908,7 +1908,7 @@ motion_repeat_timer_cb(gpointer data UNUSED) // If there already is a mouse click in the input buffer, wait another // time (otherwise we would create a backlog of clicks) - if (vim_used_in_input_buf() > 10) + if (mnv_used_in_input_buf() > 10) return TRUE; motion_repeat_timer = 0; @@ -1957,7 +1957,7 @@ motion_notify_event(GtkWidget *widget, /* * Mouse button handling. Note please that we are capturing multiple click's * by our own timeout mechanism instead of the one provided by GTK+ itself. - * This is due to the way the generic VIM code is recognizing multiple clicks. + * This is due to the way the generic MNV code is recognizing multiple clicks. */ static gint button_press_event(GtkWidget *widget, @@ -1967,7 +1967,7 @@ button_press_event(GtkWidget *widget, int button; int repeated_click = FALSE; int x, y; - int_u vim_modifiers; + int_u mnv_modifiers; gui.event_time = event->time; @@ -2020,9 +2020,9 @@ button_press_event(GtkWidget *widget, xim_reset(); #endif - vim_modifiers = modifiers_gdk2mouse(event->state); + mnv_modifiers = modifiers_gdk2mouse(event->state); - gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers); + gui_send_mouse_event(button, x, y, repeated_click, mnv_modifiers); return TRUE; } @@ -2036,7 +2036,7 @@ scroll_event(GtkWidget *widget, gpointer data UNUSED) { int button = 0; // silence gcc - int_u vim_modifiers; + int_u mnv_modifiers; #if GTK_CHECK_VERSION(3,4,0) static double acc_x, acc_y; # if !GTK_CHECK_VERSION(3,22,0) @@ -2094,7 +2094,7 @@ scroll_event(GtkWidget *widget, xim_reset(); #endif - vim_modifiers = modifiers_gdk2mouse(event->state); + mnv_modifiers = modifiers_gdk2mouse(event->state); #if GTK_CHECK_VERSION(3,4,0) # ifdef GDK_WINDOWING_WAYLAND @@ -2104,25 +2104,25 @@ scroll_event(GtkWidget *widget, { // right acc_x = MAX(0.0, acc_x - 1.0); gui_send_mouse_event(MOUSE_6, (int)event->x, (int)event->y, - FALSE, vim_modifiers); + FALSE, mnv_modifiers); } while (acc_x <= -1.0) { // left acc_x = MIN(0.0, acc_x + 1.0); gui_send_mouse_event(MOUSE_7, (int)event->x, (int)event->y, - FALSE, vim_modifiers); + FALSE, mnv_modifiers); } while (acc_y >= 1.0) { // down acc_y = MAX(0.0, acc_y - 1.0); gui_send_mouse_event(MOUSE_5, (int)event->x, (int)event->y, - FALSE, vim_modifiers); + FALSE, mnv_modifiers); } while (acc_y <= -1.0) { // up acc_y = MIN(0.0, acc_y + 1.0); gui_send_mouse_event(MOUSE_4, (int)event->x, (int)event->y, - FALSE, vim_modifiers); + FALSE, mnv_modifiers); } } else @@ -2135,7 +2135,7 @@ scroll_event(GtkWidget *widget, else #endif gui_send_mouse_event(button, (int)event->x, (int)event->y, - FALSE, vim_modifiers); + FALSE, mnv_modifiers); return TRUE; } @@ -2147,7 +2147,7 @@ button_release_event(GtkWidget *widget UNUSED, gpointer data UNUSED) { int x, y; - int_u vim_modifiers; + int_u mnv_modifiers; gui.event_time = event->time; @@ -2163,9 +2163,9 @@ button_release_event(GtkWidget *widget UNUSED, x = event->x; y = event->y; - vim_modifiers = modifiers_gdk2mouse(event->state); + mnv_modifiers = modifiers_gdk2mouse(event->state); - gui_send_mouse_event(MOUSE_RELEASE, x, y, FALSE, vim_modifiers); + gui_send_mouse_event(MOUSE_RELEASE, x, y, FALSE, mnv_modifiers); switch (event->button) { @@ -2241,7 +2241,7 @@ filter_uri_list(char_u **outlist, int max, char_u *src) src += 11; while (src[0] == '/' && src[1] == '/') ++src; - outlist[j++] = vim_strsave(src); + outlist[j++] = mnv_strsave(src); } src += STRLEN(src) + 1; } @@ -2261,7 +2261,7 @@ parse_uri_list(int *count, char_u *data, int len) if (n > 0 && (array = ALLOC_MULT(char_u *, n)) != NULL) n = filter_uri_list(array, n, tmp); } - vim_free(tmp); + mnv_free(tmp); *count = n; return array; } @@ -2292,7 +2292,7 @@ drag_handle_uri_list(GdkDragContext *context, gui_handle_drop(x, y, modifiers, fnames, nfiles); } else - vim_free(fnames); + mnv_free(fnames); } static void @@ -2319,9 +2319,9 @@ drag_handle_text(GdkDragContext *context, dnd_yank_drag_data(text, (long)len); gtk_drag_finish(context, TRUE, FALSE, time_); // accept - vim_free(tmpbuf); + mnv_free(tmpbuf); - dropkey[2] = modifiers_gdk2vim(state); + dropkey[2] = modifiers_gdk2mnv(state); if (dropkey[2] != 0) add_to_input_buf(dropkey, (int)sizeof(dropkey)); @@ -2415,7 +2415,7 @@ sm_client_check_changed_any(GnomeClient *client UNUSED, /* * "save_yourself" signal handler. Initiate an interaction to ask the user * for confirmation if necessary. Save the current editing session and tell - * the session manager how to restart Vim. + * the session manager how to restart MNV. */ static gboolean sm_client_save_yourself(GnomeClient *client, @@ -2426,7 +2426,7 @@ sm_client_save_yourself(GnomeClient *client, gboolean fast UNUSED, gpointer data UNUSED) { - static const char suffix[] = "-session.vim"; + static const char suffix[] = "-session.mnv"; char *session_file; unsigned int len; gboolean success; @@ -2465,7 +2465,7 @@ sm_client_save_yourself(GnomeClient *client, // Tell the session manager how to wipe out the stored session data. // This isn't as dangerous as it looks, don't worry :) session_file // is a unique absolute filename. Usually it'll be something like - // `/home/user/.gnome2/vim-XXXXXX-session.vim'. + // `/home/user/.gnome2/mnv-XXXXXX-session.mnv'. i = 0; argv[i++] = "rm"; argv[i++] = session_file; @@ -2474,7 +2474,7 @@ sm_client_save_yourself(GnomeClient *client, gnome_client_set_discard_command(client, i, (char **)argv); // Tell the session manager how to restore the just saved session. - // This is easily done thanks to Vim's -S option. Pass the -f flag + // This is easily done thanks to MNV's -S option. Pass the -f flag // since there's no need to fork -- it might even cause confusion. // Also pass the window role to give the WM something to match on. // The role is set in gui_mch_open(), thus should _never_ be NULL. @@ -2508,8 +2508,8 @@ sm_client_die(GnomeClient *client UNUSED, gpointer data UNUSED) // Don't write messages to the GUI anymore full_screen = FALSE; - vim_strncpy(IObuff, (char_u *) - _("Vim: Received \"die\" request from session manager\n"), + mnv_strncpy(IObuff, (char_u *) + _("MNV: Received \"die\" request from session manager\n"), IOSIZE - 1); preserve_exit(); } @@ -2619,7 +2619,7 @@ setup_save_yourself(void) XSetWMProtocols(GDK_WINDOW_XDISPLAY(mainwin_win), GDK_WINDOW_XID(mainwin_win), new_atoms, count + 1); - vim_free(new_atoms); + mnv_free(new_atoms); } } XFree(existing_atoms); @@ -2738,9 +2738,9 @@ pixbuf_new_from_png_data(const unsigned char *data, unsigned int len) static void mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED) { -#include "../runtime/vim16x16_png.h" -#include "../runtime/vim32x32_png.h" -#include "../runtime/vim48x48_png.h" +#include "../runtime/mnv16x16_png.h" +#include "../runtime/mnv32x32_png.h" +#include "../runtime/mnv48x48_png.h" GdkWindow * const mainwin_win = gtk_widget_get_window(gui.mainwin); @@ -2754,14 +2754,14 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED) fflush(stdout); } - if (vim_strchr(p_go, GO_ICON) != NULL) + if (mnv_strchr(p_go, GO_ICON) != NULL) { GtkIconTheme *icon_theme; icon_theme = gtk_icon_theme_get_default(); - if (icon_theme && gtk_icon_theme_has_icon(icon_theme, "gvim")) - gtk_window_set_icon_name(GTK_WINDOW(gui.mainwin), "gvim"); + if (icon_theme && gtk_icon_theme_has_icon(icon_theme, "gmnv")) + gtk_window_set_icon_name(GTK_WINDOW(gui.mainwin), "gmnv"); else { /* @@ -2769,9 +2769,9 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED) */ GList *icons = NULL; - icons = g_list_prepend(icons, pixbuf_new_from_png_data(vim16x16_png, vim16x16_png_len)); - icons = g_list_prepend(icons, pixbuf_new_from_png_data(vim32x32_png, vim32x32_png_len)); - icons = g_list_prepend(icons, pixbuf_new_from_png_data(vim48x48_png, vim48x48_png_len)); + icons = g_list_prepend(icons, pixbuf_new_from_png_data(mnv16x16_png, mnv16x16_png_len)); + icons = g_list_prepend(icons, pixbuf_new_from_png_data(mnv32x32_png, mnv32x32_png_len)); + icons = g_list_prepend(icons, pixbuf_new_from_png_data(mnv48x48_png, mnv48x48_png_len)); gtk_window_set_icon_list(GTK_WINDOW(gui.mainwin), icons); @@ -2798,7 +2798,7 @@ mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED) { if (serverName == NULL && serverDelayedStartName != NULL) { - // This is a :gui command in a plain vim with no previous server + // This is a :gui command in a plain mnv with no previous server commWindow = GDK_WINDOW_XID(mainwin_win); (void)serverRegisterName(GDK_WINDOW_XDISPLAY(mainwin_win), @@ -2891,8 +2891,8 @@ mainwin_screen_changed_cb(GtkWidget *widget, * After the drawing area comes up, we calculate all colors and create the * dummy blank cursor. * - * Don't try to set any VIM scrollbar sizes anywhere here. I'm relying on the - * fact that the main VIM engine doesn't take them into account anywhere. + * Don't try to set any MNV scrollbar sizes anywhere here. I'm relying on the + * fact that the main MNV engine doesn't take them into account anywhere. */ static void drawarea_realize_cb(GtkWidget *widget, gpointer data UNUSED) @@ -3019,7 +3019,7 @@ drawarea_configure_event_cb(GtkWidget *widget, // the field send_event of such GdkEventConfigures is set to FALSE in // configure_native_child(). // - // Obviously, this is a terrible hack making GVim depend on GTK's + // Obviously, this is a terrible hack making GMNV depend on GTK's // implementation details. Therefore, watch out any relevant internal // changes happening in GTK in the feature (sigh). // @@ -3053,7 +3053,7 @@ drawarea_configure_event_cb(GtkWidget *widget, /* * Callback routine for the "delete_event" signal on the toplevel window. - * Tries to vim gracefully, or refuses to exit with changed buffers. + * Tries to mnv gracefully, or refuses to exit with changed buffers. */ static gint delete_event_cb(GtkWidget *widget UNUSED, @@ -3233,7 +3233,7 @@ update_window_manager_hints(int force_width, int force_height) |GDK_HINT_MIN_SIZE; // Using gui.formwin as geometry widget doesn't work as expected // with GTK+ 2 -- dunno why. Presumably all the resizing hacks - // in Vim confuse GTK+. For GTK 3 the second argument should be NULL + // in MNV confuse GTK+. For GTK 3 the second argument should be NULL // to make the width/height inc works, despite the docs saying // something else. gtk_window_set_geometry_hints(GTK_WINDOW(gui.mainwin), NULL, @@ -3710,7 +3710,7 @@ gui_mch_init(void) // gtk_init_check() in gui_mch_init_check(). if (using_gnome) { - gnome_program_init(VIMPACKAGE, VIM_VERSION_SHORT, + gnome_program_init(MNVPACKAGE, MNV_VERSION_SHORT, LIBGNOMEUI_MODULE, gui_argc, gui_argv, NULL); # if defined(LC_NUMERIC) { @@ -3724,11 +3724,11 @@ gui_mch_init(void) # endif } #endif - VIM_CLEAR(gui_argv); + MNV_CLEAR(gui_argv); #if GLIB_CHECK_VERSION(2,1,3) // Set the human-readable application name - g_set_application_name("Vim"); + g_set_application_name("MNV"); #endif /* * Force UTF-8 output no matter what the value of 'encoding' is. @@ -3799,7 +3799,7 @@ gui_mch_init(void) #ifdef FEAT_GUI_GNOME if (using_gnome) { - gui.mainwin = gnome_app_new("Vim", NULL); + gui.mainwin = gnome_app_new("MNV", NULL); # ifdef USE_XSMP // Use the GNOME save-yourself functionality now. xsmp_close(); @@ -3810,7 +3810,7 @@ gui_mch_init(void) gui.mainwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); } - gtk_widget_set_name(gui.mainwin, "vim-main-window"); + gtk_widget_set_name(gui.mainwin, "mnv-main-window"); // Create the PangoContext used for drawing all text. gui.text_context = gtk_widget_create_pango_context(gui.mainwin); @@ -3860,7 +3860,7 @@ gui_mch_init(void) * Create the menubar and handle */ gui.menubar = gtk_menu_bar_new(); - gtk_widget_set_name(gui.menubar, "vim-menubar"); + gtk_widget_set_name(gui.menubar, "mnv-menubar"); // Avoid that GTK takes away from us. { @@ -3906,13 +3906,13 @@ gui_mch_init(void) // GTK_RELIEF_NONE, there's no need to specify that, probably. # else gtk_rc_parse_string( - "style \"vim-toolbar-style\" {\n" + "style \"mnv-toolbar-style\" {\n" " GtkToolbar::button_relief = GTK_RELIEF_NONE\n" "}\n" - "widget \"*.vim-toolbar\" style \"vim-toolbar-style\"\n"); + "widget \"*.mnv-toolbar\" style \"mnv-toolbar-style\"\n"); # endif gui.toolbar = gtk_toolbar_new(); - gtk_widget_set_name(gui.toolbar, "vim-toolbar"); + gtk_widget_set_name(gui.toolbar, "mnv-toolbar"); set_toolbar_style(GTK_TOOLBAR(gui.toolbar)); # ifdef FEAT_GUI_GNOME @@ -3934,7 +3934,7 @@ gui_mch_init(void) else # endif // FEAT_GUI_GNOME { - if (vim_strchr(p_go, GO_TOOLBAR) != NULL + if (mnv_strchr(p_go, GO_TOOLBAR) != NULL && (toolbar_flags & (TOOLBAR_TEXT | TOOLBAR_ICONS))) gtk_widget_show(gui.toolbar); gtk_box_pack_start(GTK_BOX(vbox), gui.toolbar, FALSE, FALSE, 0); @@ -4007,7 +4007,7 @@ gui_mch_init(void) gtk_widget_set_events(gui.formwin, GDK_EXPOSURE_MASK); #endif #if GTK_CHECK_VERSION(3,22,2) - gtk_widget_set_name(gui.formwin, "vim-gtk-form"); + gtk_widget_set_name(gui.formwin, "mnv-gtk-form"); #endif gui.drawarea = gtk_drawing_area_new(); @@ -4105,8 +4105,8 @@ gui_mch_init(void) /* * Set clipboard specific atoms */ - vim_atom = gdk_atom_intern(VIM_ATOM_NAME, FALSE); - vimenc_atom = gdk_atom_intern(VIMENC_ATOM_NAME, FALSE); + mnv_atom = gdk_atom_intern(MNV_ATOM_NAME, FALSE); + mnvenc_atom = gdk_atom_intern(MNVENC_ATOM_NAME, FALSE); clip_star.gtk_sel_atom = GDK_SELECTION_PRIMARY; clip_plus.gtk_sel_atom = gdk_atom_intern("CLIPBOARD", FALSE); @@ -4129,7 +4129,7 @@ gui_mch_init(void) * Only install these enter/leave callbacks when 'p' in 'guioptions'. * Only needed for some window managers. */ - if (vim_strchr(p_go, GO_POINTER) != NULL) + if (mnv_strchr(p_go, GO_POINTER) != NULL) { g_signal_connect(G_OBJECT(gui.drawarea), "leave-notify-event", G_CALLBACK(leave_notify_event), NULL); @@ -4247,7 +4247,7 @@ gui_mch_new_colors(void) gtk_widget_get_style_context(gui.formwin); GtkCssProvider * const provider = gtk_css_provider_new(); gchar * const css = g_strdup_printf( - "widget#vim-gtk-form {\n" + "widget#mnv-gtk-form {\n" " background-color: #%.2lx%.2lx%.2lx;\n" "}\n", (gui.back_pixel >> 16) & 0xff, @@ -4296,7 +4296,7 @@ form_configure_event(GtkWidget *widget UNUSED, #ifdef TRACK_RESIZE_HISTORY // Resize requests are made for gui.mainwin; // get its dimensions for searching if this event - // is a response to a vim request. + // is a response to a mnv request. int w, h; gtk_window_get_size(GTK_WINDOW(gui.mainwin), &w, &h); @@ -4305,7 +4305,7 @@ form_configure_event(GtkWidget *widget UNUSED, w, h, (int)Columns, (int)Rows); # endif - // Look through history of recent vim resize requests. + // Look through history of recent mnv resize requests. // If this event matches: // - "latest resize hist" We're caught up; // clear the history and process this event. @@ -4377,8 +4377,8 @@ mainwin_destroy_cb(GObject *object UNUSED, gpointer data UNUSED) if (!exiting) // only do anything if the destroy was unexpected { - vim_strncpy(IObuff, - (char_u *)_("Vim: Main window unexpectedly destroyed\n"), + mnv_strncpy(IObuff, + (char_u *)_("MNV: Main window unexpectedly destroyed\n"), IOSIZE - 1); preserve_exit(); } @@ -4523,7 +4523,7 @@ gui_mch_open(void) char *role; // Invent a unique-enough ID string for the role - role = g_strdup_printf("vim-%u-%u-%u", + role = g_strdup_printf("mnv-%u-%u-%u", (unsigned)mch_get_pid(), (unsigned)g_random_int(), (unsigned)time(NULL)); @@ -4578,7 +4578,7 @@ gui_mch_open(void) y += hh - pixel_height; gtk_window_move(GTK_WINDOW(gui.mainwin), x, y); } - VIM_CLEAR(gui.geom); + MNV_CLEAR(gui.geom); // From now until everyone's stopped trying to set the window hints // to their correct minimum values, stop them being set as we need @@ -4623,7 +4623,7 @@ gui_mch_open(void) } // Get the colors from the "Normal" and "Menu" group (set in syntax.c or - // in a vimrc file) + // in a mnvrc file) set_normal_colors(); // Check that none of the colors are the same as the background color @@ -4643,7 +4643,7 @@ gui_mch_open(void) * * We connect this signal deferred finally after anything is in place, * since this is intended to handle resizements coming from the window - * manager upon us and should not interfere with what VIM is requesting + * manager upon us and should not interfere with what MNV is requesting * upon startup. */ #ifdef TRACK_RESIZE_HISTORY @@ -4683,12 +4683,12 @@ gui_mch_open(void) * connect signal handlers to hide the widgets just after they've been * marked visible, but before the main window is realized. */ - if (using_gnome && vim_strchr(p_go, GO_MENUS) == NULL) + if (using_gnome && mnv_strchr(p_go, GO_MENUS) == NULL) menu_handler = g_signal_connect_after(gui.menubar_h, "show", G_CALLBACK(>k_widget_hide), NULL); # ifdef FEAT_TOOLBAR - if (using_gnome && vim_strchr(p_go, GO_TOOLBAR) == NULL + if (using_gnome && mnv_strchr(p_go, GO_TOOLBAR) == NULL && (toolbar_flags & (TOOLBAR_TEXT | TOOLBAR_ICONS))) tool_handler = g_signal_connect_after(gui.toolbar_h, "show", G_CALLBACK(>k_widget_hide), @@ -4722,7 +4722,7 @@ gui_mch_open(void) } /* - * Clean up for when exiting Vim. + * Clean up for when exiting MNV. */ void gui_mch_exit(int rc UNUSED) @@ -4875,9 +4875,9 @@ gui_mch_set_shellsize(int width, int height, #endif // !GTK_CHECK_VERSION(3,0,0) /* * Wait until all events are processed to prevent a crash because the - * real size of the drawing area doesn't reflect Vim's internal ideas. + * real size of the drawing area doesn't reflect MNV's internal ideas. * - * This is a bit of a hack, since Vim is a terminal application with a GUI + * This is a bit of a hack, since MNV is a terminal application with a GUI * on top, while the GUI expects to be the boss. */ gui_mch_update(); @@ -4892,7 +4892,7 @@ gui_mch_settitle(char_u *title, char_u *icon UNUSED) gtk_window_set_title(GTK_WINDOW(gui.mainwin), (const char *)title); if (output_conv.vc_type != CONV_NONE) - vim_free(title); + mnv_free(title); } #if defined(FEAT_MENU) @@ -5025,7 +5025,7 @@ gui_mch_adjust_charheight(void) // LINTED: avoid warning: bitwise operation on signed value gui.char_ascent = PANGO_PIXELS(ascent + p_linespace * PANGO_SCALE / 2); - // A not-positive value of char_height may crash Vim. Only happens + // A not-positive value of char_height may crash MNV. Only happens // if 'linespace' is negative (which does make sense sometimes). gui.char_ascent = MAX(gui.char_ascent, 0); gui.char_height = MAX(gui.char_height, gui.char_ascent + 1); @@ -5081,15 +5081,15 @@ gui_mch_font_dialog(char_u *oldval) // Annoying bug in GTK (or Pango): if the font name does not include a // size, zero is used. Use default point size ten. - if (!vim_isdigit(oldname[STRLEN(oldname) - 1])) + if (!mnv_isdigit(oldname[STRLEN(oldname) - 1])) { - char_u *p = vim_strnsave(oldname, STRLEN(oldname) + 3); + char_u *p = mnv_strnsave(oldname, STRLEN(oldname) + 3); if (p != NULL) { STRCPY(p + STRLEN(p), " 10"); if (oldname != oldval) - vim_free(oldname); + mnv_free(oldname); oldname = p; } } @@ -5103,7 +5103,7 @@ gui_mch_font_dialog(char_u *oldval) #endif if (oldname != oldval) - vim_free(oldname); + mnv_free(oldname); } else #if GTK_CHECK_VERSION(3,2,0) @@ -5132,12 +5132,12 @@ gui_mch_font_dialog(char_u *oldval) // Apparently some font names include a comma, need to escape // that, because in 'guifont' it separates names. - p = vim_strsave_escaped((char_u *)name, (char_u *)","); + p = mnv_strsave_escaped((char_u *)name, (char_u *)","); g_free(name); if (p != NULL && input_conv.vc_type != CONV_NONE) { fontname = string_convert(&input_conv, p, NULL); - vim_free(p); + mnv_free(p); } else fontname = p; @@ -5159,7 +5159,7 @@ gui_mch_font_dialog(char_u *oldval) * * Note that we don't need to check for italic style since Xft can * emulate italic on its own, provided you have a proper fontconfig - * setup. We wouldn't be able to emulate it in Vim anyway. + * setup. We wouldn't be able to emulate it in MNV anyway. */ static void get_styled_font_variants(void) @@ -5271,7 +5271,7 @@ ascii_glyph_table_init(void) } /* - * Initialize Vim to use the font or fontset with the given name. + * Initialize MNV to use the font or fontset with the given name. * Return FAIL if the font could not be loaded, OK otherwise. */ int @@ -5312,7 +5312,7 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED) * http://bugzilla.gnome.org/show_bug.cgi?id=106618 * http://bugzilla.gnome.org/show_bug.cgi?id=106624 * - * With this, for all four of the following cases, Vim works fine: + * With this, for all four of the following cases, MNV works fine: * guifont=CJK_fixed_width_font * guifont=Non_CJK_fixed_font * guifont=Non_CJK_fixed_font,CJK_Fixed_font @@ -5389,7 +5389,7 @@ gui_mch_get_font(char_u *name, int report_error) if (buf != NULL) { font = pango_font_description_from_string((const char *)buf); - vim_free(buf); + mnv_free(buf); } else font = NULL; @@ -5439,7 +5439,7 @@ gui_mch_get_fontname(GuiFont font, char_u *name UNUSED) if (pangoname != NULL) { - char_u *s = vim_strsave((char_u *)pangoname); + char_u *s = mnv_strsave((char_u *)pangoname); g_free(pangoname); return s; @@ -5500,10 +5500,10 @@ gui_mch_expand_font( { if (add_match(buf) != OK) { - vim_free(buf); + mnv_free(buf); break; } - vim_free(buf); + mnv_free(buf); } else break; @@ -5963,7 +5963,7 @@ gui_gtk_draw_string(int row, int col, char_u *s, int len, int flags) new_conv_buf[plen] = ' '; mch_memmove(new_conv_buf + plen + 1, conv_buf + plen, convlen - plen + 1); - vim_free(conv_buf); + mnv_free(conv_buf); conv_buf = new_conv_buf; ++convlen; bp = conv_buf + plen; @@ -6084,7 +6084,7 @@ gui_gtk_draw_string(int row, int col, char_u *s, int len, int flags) byte_sum += slen; needs_pango = should_need_pango; } - vim_free(conv_buf); + mnv_free(conv_buf); return len_sum; } @@ -6128,7 +6128,7 @@ gui_gtk_draw_string_ext( /* * Optimization hack: If possible, skip the itemize and shaping process * for pure ASCII strings. This optimization is particularly effective - * because Vim draws space characters to clear parts of the screen. + * because MNV draws space characters to clear parts of the screen. */ if (!(flags & DRAW_ITALIC) && !((flags & DRAW_BOLD) && gui.font_can_bold) @@ -6212,13 +6212,13 @@ not_ascii: /* * Increment the bidirectional embedding level by 1 if it is not * even. An odd number means the output will be RTL, but we don't - * want that since Vim handles right-to-left text on its own. It + * want that since MNV handles right-to-left text on its own. It * would probably be sufficient to just set level = 0, but you can * never know :) * * Unfortunately we can't take advantage of Pango's ability to * render both LTR and RTL at the same time. In order to support - * that, Vim's main screen engine would have to make use of Pango + * that, MNV's main screen engine would have to make use of Pango * functionality. */ item->analysis.level = (item->analysis.level + 1) & (~1U); @@ -6518,7 +6518,7 @@ gui_mch_iconify(void) #if defined(FEAT_EVAL) /* - * Bring the Vim window to the foreground. + * Bring the MNV window to the foreground. */ void gui_mch_set_foreground(void) @@ -6637,7 +6637,7 @@ gui_mch_draw_part_cursor(int w, int h, guicolor_T color) gui_mch_update(void) { int cnt = 0; // prevent endless loop - while (g_main_context_pending(NULL) && !vim_is_input_buf_full() + while (g_main_context_pending(NULL) && !mnv_is_input_buf_full() && ++cnt < 100) g_main_context_iteration(NULL, TRUE); } @@ -7180,7 +7180,7 @@ clip_gtk_owner_exists(Clipboard_T *cbd) * Make a menu item appear either active or not active (grey or not grey). */ void -gui_mch_menu_grey(vimmenu_T *menu, int grey) +gui_mch_menu_grey(mnvmenu_T *menu, int grey) { if (menu->id == NULL) return; @@ -7201,7 +7201,7 @@ gui_mch_menu_grey(vimmenu_T *menu, int grey) * Make menu item hidden or not hidden. */ void -gui_mch_menu_hidden(vimmenu_T *menu, int hidden) +gui_mch_menu_hidden(mnvmenu_T *menu, int hidden) { if (menu->id == 0) return; @@ -7610,7 +7610,7 @@ gui_mch_register_sign(char_u *signfile) semsg("E255: %s", message); if (input_conv.vc_type != CONV_NONE) - vim_free(message); + mnv_free(message); } g_error_free(error); } diff --git a/uvim/src/gui_haiku.cc b/uvim/src/gui_haiku.cc index 8ab66bc913..ba97e743f4 100644 --- a/uvim/src/gui_haiku.cc +++ b/uvim/src/gui_haiku.cc @@ -1,11 +1,11 @@ /* vi:set ts=8 sts=4 sw=4: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * BeBox GUI support Copyright 1998 by Olaf Seibert. * All Rights Reserved. * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. * * Based on "GUI support for the Buzzword Enhanced Operating System." * @@ -38,23 +38,23 @@ * 2. Runs the BApplication. * 3. The window thread, just like in the first case. * - * This second alternative is cleaner from Vim's viewpoint. However, + * This second alternative is cleaner from MNV's viewpoint. However, * the BeBook seems to assume everywhere that the BApplication *must* * run in the initial thread. So perhaps doing otherwise is very wrong. * * However, from a B_SINGLE_LAUNCH viewpoint, the first is better. - * If Vim is marked "Single Launch" in its application resources, - * and a file is dropped on the Vim icon, and another Vim is already - * running, the file is passed on to the earlier Vim. This happens - * in BApplication::Run(). So we want Vim to terminate if + * If MNV is marked "Single Launch" in its application resources, + * and a file is dropped on the MNV icon, and another MNV is already + * running, the file is passed on to the earlier MNV. This happens + * in BApplication::Run(). So we want MNV to terminate if * BApplication::Run() terminates. (See the BeBook, on BApplication. - * However, it seems that the second copy of Vim isn't even started + * However, it seems that the second copy of MNV isn't even started * in this case... which is for the better since I wouldn't know how * to detect this case.) * * Communication between these threads occurs mostly by translating * BMessages that come in and posting an appropriate translation on - * the VDCMP (Vim Direct Communication Message Port). Therefore the + * the VDCMP (MNV Direct Communication Message Port). Therefore the * actions required for keypresses and window resizes, etc, are mostly * performed in the main() thread. * @@ -64,7 +64,7 @@ * any thread is accessing the essential variables that are used by * the window thread. * - * This locking protocol consists of locking Vim's window. This is both + * This locking protocol consists of locking MNV's window. This is both * convenient and necessary. */ @@ -74,7 +74,7 @@ extern "C" { #include #include -#include "vim.h" +#include "mnv.h" #include "version.h" } // extern "C" @@ -122,12 +122,12 @@ extern "C" { #include #include -class VimApp; -class VimFormView; -class VimTextAreaView; -class VimWindow; -class VimToolbar; -class VimTabLine; +class MNVApp; +class MNVFormView; +class MNVTextAreaView; +class MNVWindow; +class MNVToolbar; +class MNVTabLine; extern key_map *keyMap; extern char *keyMapChars; @@ -138,13 +138,13 @@ extern int main(int argc, char **argv); #define B_MAX_PORT_COUNT 255 #endif -// VimApp seems comparable to the X "vimShell" -class VimApp: public BApplication +// MNVApp seems comparable to the X "mnvShell" +class MNVApp: public BApplication { typedef BApplication Inherited; public: - VimApp(const char *appsig); - ~VimApp(); + MNVApp(const char *appsig); + ~MNVApp(); // callbacks: #if 0 @@ -168,18 +168,18 @@ class VimApp: public BApplication private: }; -class VimWindow: public BWindow +class MNVWindow: public BWindow { typedef BWindow Inherited; public: - VimWindow(); - ~VimWindow(); + MNVWindow(); + ~MNVWindow(); virtual void DispatchMessage(BMessage *m, BHandler *h); virtual void WindowActivated(bool active); virtual bool QuitRequested(); - VimFormView *formView; + MNVFormView *formView; private: void init(); @@ -189,12 +189,12 @@ class VimWindow: public BWindow window_look saved_look; }; -class VimFormView: public BView +class MNVFormView: public BView { typedef BView Inherited; public: - VimFormView(BRect frame); - ~VimFormView(); + MNVFormView(BRect frame); + ~MNVFormView(); // callbacks: virtual void AllAttached(); @@ -210,35 +210,35 @@ class VimFormView: public BView void init(BRect); BMenuBar *menuBar; - VimTextAreaView *textArea; + MNVTextAreaView *textArea; #ifdef FEAT_TOOLBAR public: float ToolbarHeight() const; - VimToolbar *ToolBar() const + MNVToolbar *ToolBar() const { return toolBar; } private: - VimToolbar *toolBar; + MNVToolbar *toolBar; #endif #ifdef FEAT_GUI_TABLINE public: - VimTabLine *TabLine() const { return tabLine; } + MNVTabLine *TabLine() const { return tabLine; } bool IsShowingTabLine() const { return showingTabLine; } void SetShowingTabLine(bool showing) { showingTabLine = showing; } float TablineHeight() const; private: - VimTabLine *tabLine; + MNVTabLine *tabLine; int showingTabLine; #endif }; -class VimTextAreaView: public BView +class MNVTextAreaView: public BView { typedef BView Inherited; public: - VimTextAreaView(BRect frame); - ~VimTextAreaView(); + MNVTextAreaView(BRect frame); + ~MNVTextAreaView(); // callbacks: virtual void Draw(BRect updateRect); @@ -259,7 +259,7 @@ class VimTextAreaView: public BView static void guiSendMouseEvent(int button, int x, int y, int repeated_click, int_u modifiers); static void guiMouseMoved(int x, int y); static void guiBlankMouse(bool should_hide); - static int_u mouseModifiersToVim(int32 beModifiers); + static int_u mouseModifiersToMNV(int32 beModifiers); int32 mouseDragEventCount; @@ -270,8 +270,8 @@ class VimTextAreaView: public BView private: void init(BRect); - int_u vimMouseButton; - int_u vimMouseModifiers; + int_u mnvMouseButton; + int_u mnvMouseModifiers; #ifdef FEAT_MBYTE_IME struct { @@ -285,12 +285,12 @@ class VimTextAreaView: public BView #endif }; -class VimScrollBar: public BScrollBar +class MNVScrollBar: public BScrollBar { typedef BScrollBar Inherited; public: - VimScrollBar(scrollbar_T *gsb, orientation posture); - ~VimScrollBar(); + MNVScrollBar(scrollbar_T *gsb, orientation posture); + ~MNVScrollBar(); virtual void ValueChanged(float newValue); virtual void MouseUp(BPoint where); @@ -308,12 +308,12 @@ class VimScrollBar: public BScrollBar #ifdef FEAT_TOOLBAR -class VimToolbar : public BBox +class MNVToolbar : public BBox { static BBitmap *normalButtonsBitmap; static BBitmap *grayedButtonsBitmap; - BBitmap *LoadVimBitmap(const char* fileName); + BBitmap *LoadMNVBitmap(const char* fileName); bool GetPictureFromBitmap(BPicture *pictureTo, int32 index, BBitmap *bitmapFrom, bool pressed); bool ModifyBitmapToGrayed(BBitmap *bitmap); @@ -321,21 +321,21 @@ class VimToolbar : public BBox void InvalidateLayout(); public: - VimToolbar(BRect frame, const char * name); - ~VimToolbar(); + MNVToolbar(BRect frame, const char * name); + ~MNVToolbar(); bool PrepareButtonBitmaps(); - bool AddButton(int32 index, vimmenu_T *menu); - bool RemoveButton(vimmenu_T *menu); - bool GrayButton(vimmenu_T *menu, int grey); + bool AddButton(int32 index, mnvmenu_T *menu); + bool RemoveButton(mnvmenu_T *menu); + bool GrayButton(mnvmenu_T *menu, int grey); float ToolbarHeight() const; virtual void AttachedToWindow(); }; -BBitmap *VimToolbar::normalButtonsBitmap = NULL; -BBitmap *VimToolbar::grayedButtonsBitmap = NULL; +BBitmap *MNVToolbar::normalButtonsBitmap = NULL; +BBitmap *MNVToolbar::grayedButtonsBitmap = NULL; const float ToolbarMargin = 3.; const float ButtonMargin = 3.; @@ -344,17 +344,17 @@ const float ButtonMargin = 3.; #ifdef FEAT_GUI_TABLINE -class VimTabLine : public BTabView +class MNVTabLine : public BTabView { public: - class VimTab : public BTab { + class MNVTab : public BTab { public: - VimTab() : BTab(new BView(BRect(), "-Empty-", 0, 0)) {} + MNVTab() : BTab(new BView(BRect(), "-Empty-", 0, 0)) {} virtual void Select(BView* owner); }; - VimTabLine(BRect r) : BTabView(r, "vimTabLine", B_WIDTH_FROM_LABEL, + MNVTabLine(BRect r) : BTabView(r, "mnvTabLine", B_WIDTH_FROM_LABEL, B_FOLLOW_LEFT | B_FOLLOW_TOP | B_FOLLOW_RIGHT, B_WILL_DRAW | B_FRAME_EVENTS) {} float TablineHeight() const; @@ -365,18 +365,18 @@ class VimTabLine : public BTabView // For caching the fonts that are used; -// Vim seems rather sloppy in this regard. -class VimFont: public BFont +// MNV seems rather sloppy in this regard. +class MNVFont: public BFont { typedef BFont Inherited; public: - VimFont(); - VimFont(const VimFont *rhs); - VimFont(const BFont *rhs); - VimFont(const VimFont &rhs); - ~VimFont(); + MNVFont(); + MNVFont(const MNVFont *rhs); + MNVFont(const BFont *rhs); + MNVFont(const MNVFont &rhs); + ~MNVFont(); - VimFont *next; + MNVFont *next; int refcount; char_u *name; @@ -386,7 +386,7 @@ class VimFont: public BFont #if defined(FEAT_GUI_DIALOG) -class VimDialog : public BWindow +class MNVDialog : public BWindow { typedef BWindow Inherited; @@ -408,10 +408,10 @@ class VimDialog : public BWindow BBitmap* fIconBitmap; }; - VimDialog(int type, const char *title, const char *message, + MNVDialog(int type, const char *title, const char *message, const char *buttons, int dfltbutton, const char *textfield, int ex_cmd); - ~VimDialog(); + ~MNVDialog(); int Go(); @@ -426,7 +426,7 @@ class VimDialog : public BWindow const char* fInputValue; }; -class VimSelectFontDialog : public BWindow +class MNVSelectFontDialog : public BWindow { typedef BWindow Inherited; @@ -437,8 +437,8 @@ class VimSelectFontDialog : public BWindow bool _UpdateFromListItem(BListView* list, char* text, int textSize); public: - VimSelectFontDialog(font_family* family, font_style* style, float* size); - ~VimSelectFontDialog(); + MNVSelectFontDialog(font_family* family, font_style* style, float* size); + ~MNVSelectFontDialog(); bool Go(); @@ -480,28 +480,28 @@ struct MainArgs { #error Increase KEY_MSG_BUFSIZ! #endif -struct VimKeyMsg { +struct MNVKeyMsg { char_u length; - char_u chars[KEY_MSG_BUFSIZ]; // contains Vim encoding + char_u chars[KEY_MSG_BUFSIZ]; // contains MNV encoding bool csi_escape; }; -struct VimResizeMsg { +struct MNVResizeMsg { int width; int height; }; -struct VimScrollBarMsg { - VimScrollBar *sb; +struct MNVScrollBarMsg { + MNVScrollBar *sb; long value; int stillDragging; }; -struct VimMenuMsg { - vimmenu_T *guiMenu; +struct MNVMenuMsg { + mnvmenu_T *guiMenu; }; -struct VimMouseMsg { +struct MNVMouseMsg { int button; int x; int y; @@ -509,45 +509,45 @@ struct VimMouseMsg { int_u modifiers; }; -struct VimMouseMovedMsg { +struct MNVMouseMovedMsg { int x; int y; }; -struct VimFocusMsg { +struct MNVFocusMsg { bool active; }; -struct VimRefsMsg { +struct MNVRefsMsg { BMessage *message; bool changedir; }; -struct VimTablineMsg { +struct MNVTablineMsg { int index; }; -struct VimTablineMenuMsg { +struct MNVTablineMenuMsg { int index; int event; }; -struct VimMsg { - enum VimMsgType { +struct MNVMsg { + enum MNVMsgType { Key, Resize, ScrollBar, Menu, Mouse, MouseMoved, Focus, Refs, Tabline, TablineMenu }; union { - struct VimKeyMsg Key; - struct VimResizeMsg NewSize; - struct VimScrollBarMsg Scroll; - struct VimMenuMsg Menu; - struct VimMouseMsg Mouse; - struct VimMouseMovedMsg MouseMoved; - struct VimFocusMsg Focus; - struct VimRefsMsg Refs; - struct VimTablineMsg Tabline; - struct VimTablineMenuMsg TablineMenu; + struct MNVKeyMsg Key; + struct MNVResizeMsg NewSize; + struct MNVScrollBarMsg Scroll; + struct MNVMenuMsg Menu; + struct MNVMouseMsg Mouse; + struct MNVMouseMovedMsg MouseMoved; + struct MNVFocusMsg Focus; + struct MNVRefsMsg Refs; + struct MNVTablineMsg Tabline; + struct MNVTablineMenuMsg TablineMenu; } u; }; @@ -562,8 +562,8 @@ static struct specialkey #define KEY(a,b) ((a)<<8|(b)) #define K(a) KEY(0,a) // for ASCII codes #define F(b) KEY(1,b) // for scancodes - char_u vim_code0; - char_u vim_code1; + char_u mnv_code0; + char_u mnv_code1; } special_keys[] = { {K(B_UP_ARROW), 'k', 'u'}, @@ -641,7 +641,7 @@ static struct specialkey #define NUM_SPECIAL_KEYS ARRAY_LENGTH(special_keys) -// ---------------- VimApp ---------------- +// ---------------- MNVApp ---------------- static void docd(BPath &path) @@ -732,7 +732,7 @@ bad: char_u *fname = shorten_fname((char_u *)path.Path(), IObuff); if (fname == NULL) fname = (char_u *)path.Path(); - fnames[fname_index++] = vim_strsave(fname); + fnames[fname_index++] = mnv_strsave(fname); // fprintf(stderr, "%s\n", fname); } @@ -748,7 +748,7 @@ bad: char *fname; if (m->FindString("argv", i, (const char **) &fname) == B_OK) { - fnames[fname_index++] = vim_strsave((char_u *)fname); + fnames[fname_index++] = mnv_strsave((char_u *)fname); } } break; @@ -766,23 +766,23 @@ bad: setcursor(); out_flush(); } else { - vim_free(fnames); + mnv_free(fnames); } } -VimApp::VimApp(const char *appsig): +MNVApp::MNVApp(const char *appsig): BApplication(appsig), fFilePanelSem(-1), fFilePanel(NULL) { } -VimApp::~VimApp() +MNVApp::~MNVApp() { } void -VimApp::ReadyToRun() +MNVApp::ReadyToRun() { /* * Apparently signals are inherited by the created thread - @@ -793,15 +793,15 @@ VimApp::ReadyToRun() } void -VimApp::ArgvReceived(int32 arg_argc, char **arg_argv) +MNVApp::ArgvReceived(int32 arg_argc, char **arg_argv) { if (!IsLaunching()) { /* * This can happen if we are set to Single or Exclusive * Launch. Be nice and open the file(s). */ - if (gui.vimWindow) - gui.vimWindow->Minimize(false); + if (gui.mnvWindow) + gui.mnvWindow->Minimize(false); BMessage *m = CurrentMessage(); DetachCurrentMessage(); SendRefs(m, true); @@ -809,7 +809,7 @@ VimApp::ArgvReceived(int32 arg_argc, char **arg_argv) } void -VimApp::RefsReceived(BMessage *m) +MNVApp::RefsReceived(BMessage *m) { // Horrible hack!!! XXX XXX XXX // The real problem is that b_start_ffc is set too late for @@ -818,8 +818,8 @@ VimApp::RefsReceived(BMessage *m) int limit = 15; while (--limit >= 0 && (curbuf == NULL || curbuf->b_start_ffc == 0)) snooze(100000); // 0.1 s - if (gui.vimWindow) - gui.vimWindow->Minimize(false); + if (gui.mnvWindow) + gui.mnvWindow->Minimize(false); DetachCurrentMessage(); SendRefs(m, true); } @@ -829,18 +829,18 @@ VimApp::RefsReceived(BMessage *m) * Caller must have detached the message. */ void -VimApp::SendRefs(BMessage *m, bool changedir) +MNVApp::SendRefs(BMessage *m, bool changedir) { - VimRefsMsg rm; + MNVRefsMsg rm; rm.message = m; rm.changedir = changedir; - write_port(gui.vdcmp, VimMsg::Refs, &rm, sizeof(rm)); + write_port(gui.vdcmp, MNVMsg::Refs, &rm, sizeof(rm)); // calls ::RefsReceived } void -VimApp::MessageReceived(BMessage *m) +MNVApp::MessageReceived(BMessage *m) { switch (m->what) { case 'save': @@ -879,17 +879,17 @@ VimApp::MessageReceived(BMessage *m) } bool -VimApp::QuitRequested() +MNVApp::QuitRequested() { (void)Inherited::QuitRequested(); return false; } -// ---------------- VimWindow ---------------- +// ---------------- MNVWindow ---------------- -VimWindow::VimWindow(): +MNVWindow::MNVWindow(): BWindow(BRect(40, 40, 150, 150), - "Vim", + "MNV", B_TITLED_WINDOW, 0, B_CURRENT_WORKSPACE) @@ -898,20 +898,20 @@ VimWindow::VimWindow(): init(); } -VimWindow::~VimWindow() +MNVWindow::~MNVWindow() { if (formView) { RemoveChild(formView); delete formView; } - gui.vimWindow = NULL; + gui.mnvWindow = NULL; } void -VimWindow::init() +MNVWindow::init() { - // Attach the VimFormView - formView = new VimFormView(Bounds()); + // Attach the MNVFormView + formView = new MNVFormView(Bounds()); if (formView != NULL) { AddChild(formView); } @@ -919,7 +919,7 @@ VimWindow::init() #if 0 // disabled in zeta patch void -VimWindow::DispatchMessage(BMessage *m, BHandler *h) +MNVWindow::DispatchMessage(BMessage *m, BHandler *h) { /* * Route B_MOUSE_UP messages to MouseUp(), in @@ -951,31 +951,31 @@ VimWindow::DispatchMessage(BMessage *m, BHandler *h) #endif void -VimWindow::WindowActivated(bool active) +MNVWindow::WindowActivated(bool active) { Inherited::WindowActivated(active); // the textArea gets the keyboard action - if (active && gui.vimTextArea) - gui.vimTextArea->MakeFocus(true); + if (active && gui.mnvTextArea) + gui.mnvTextArea->MakeFocus(true); - struct VimFocusMsg fm; + struct MNVFocusMsg fm; fm.active = active; - write_port(gui.vdcmp, VimMsg::Focus, &fm, sizeof(fm)); + write_port(gui.vdcmp, MNVMsg::Focus, &fm, sizeof(fm)); } bool -VimWindow::QuitRequested() +MNVWindow::QuitRequested() { - struct VimKeyMsg km; + struct MNVKeyMsg km; km.length = 5; memcpy((char *)km.chars, "\033:qa\r", km.length); km.csi_escape = false; - write_port(gui.vdcmp, VimMsg::Key, &km, sizeof(km)); + write_port(gui.vdcmp, MNVMsg::Key, &km, sizeof(km)); return false; } void -VimWindow::DispatchMessage(BMessage *m, BHandler *h) +MNVWindow::DispatchMessage(BMessage *m, BHandler *h) { bool should_propagate = true; @@ -1017,10 +1017,10 @@ VimWindow::DispatchMessage(BMessage *m, BHandler *h) } -// ---------------- VimFormView ---------------- +// ---------------- MNVFormView ---------------- -VimFormView::VimFormView(BRect frame): - BView(frame, "VimFormView", B_FOLLOW_ALL_SIDES, +MNVFormView::MNVFormView(BRect frame): + BView(frame, "MNVFormView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS), menuBar(NULL), #ifdef FEAT_TOOLBAR @@ -1035,7 +1035,7 @@ VimFormView::VimFormView(BRect frame): init(frame); } -VimFormView::~VimFormView() +MNVFormView::~MNVFormView() { if (menuBar) { RemoveChild(menuBar); @@ -1058,40 +1058,40 @@ VimFormView::~VimFormView() RemoveChild(textArea); delete textArea; } - gui.vimForm = NULL; + gui.mnvForm = NULL; } void -VimFormView::init(BRect frame) +MNVFormView::init(BRect frame) { menuBar = new BMenuBar(BRect(0,0,-MENUBAR_MARGIN,-MENUBAR_MARGIN), - "VimMenuBar"); + "MNVMenuBar"); AddChild(menuBar); #ifdef FEAT_TOOLBAR - toolBar = new VimToolbar(BRect(0,0,0,0), "VimToolBar"); + toolBar = new MNVToolbar(BRect(0,0,0,0), "MNVToolBar"); toolBar->PrepareButtonBitmaps(); AddChild(toolBar); #endif #ifdef FEAT_GUI_TABLINE - tabLine = new VimTabLine(BRect(0,0,0,0)); + tabLine = new MNVTabLine(BRect(0,0,0,0)); // tabLine->PrepareButtonBitmaps(); AddChild(tabLine); #endif BRect remaining = frame; - textArea = new VimTextAreaView(remaining); + textArea = new MNVTextAreaView(remaining); AddChild(textArea); // The textArea will be resized later when menus are added - gui.vimForm = this; + gui.mnvForm = this; } #ifdef FEAT_TOOLBAR float -VimFormView::ToolbarHeight() const +MNVFormView::ToolbarHeight() const { return toolBar ? toolBar->ToolbarHeight() : 0.; } @@ -1099,14 +1099,14 @@ VimFormView::ToolbarHeight() const #ifdef FEAT_GUI_TABLINE float -VimFormView::TablineHeight() const +MNVFormView::TablineHeight() const { return (tabLine && IsShowingTabLine()) ? tabLine->TablineHeight() : 0.; } #endif void -VimFormView::AllAttached() +MNVFormView::AllAttached() { /* * Apparently signals are inherited by the created thread - @@ -1152,9 +1152,9 @@ VimFormView::AllAttached() } void -VimFormView::FrameResized(float new_width, float new_height) +MNVFormView::FrameResized(float new_width, float new_height) { - struct VimResizeMsg sm; + struct MNVResizeMsg sm; int adjust_h, adjust_w; new_width += 1; // adjust from width to number of pixels occupied @@ -1170,7 +1170,7 @@ VimFormView::FrameResized(float new_width, float new_height) sm.height -= adjust_h; } - write_port(gui.vdcmp, VimMsg::Resize, &sm, sizeof(sm)); + write_port(gui.vdcmp, MNVMsg::Resize, &sm, sizeof(sm)); // calls gui_resize_shell(new_width, new_height); return; @@ -1183,10 +1183,10 @@ VimFormView::FrameResized(float new_width, float new_height) */ } -// ---------------- VimTextAreaView ---------------- +// ---------------- MNVTextAreaView ---------------- -VimTextAreaView::VimTextAreaView(BRect frame): - BView(frame, "VimTextAreaView", B_FOLLOW_ALL_SIDES, +MNVTextAreaView::MNVTextAreaView(BRect frame): + BView(frame, "MNVTextAreaView", B_FOLLOW_ALL_SIDES, #ifdef FEAT_MBYTE_IME B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_INPUT_METHOD_AWARE #else @@ -1202,16 +1202,16 @@ VimTextAreaView::VimTextAreaView(BRect frame): init(frame); } -VimTextAreaView::~VimTextAreaView() +MNVTextAreaView::~MNVTextAreaView() { - gui.vimTextArea = NULL; + gui.mnvTextArea = NULL; } void -VimTextAreaView::init(BRect frame) +MNVTextAreaView::init(BRect frame) { // set up global var for fast access - gui.vimTextArea = this; + gui.mnvTextArea = this; /* * Tell the app server not to erase the view: we will @@ -1225,7 +1225,7 @@ VimTextAreaView::init(BRect frame) } void -VimTextAreaView::Draw(BRect updateRect) +MNVTextAreaView::Draw(BRect updateRect) { /* * XXX Other ports call here: @@ -1235,7 +1235,7 @@ VimTextAreaView::Draw(BRect updateRect) */ /* - * No need to use gui.vimWindow->Lock(): we are locked already. + * No need to use gui.mnvWindow->Lock(): we are locked already. * However, it would not hurt. */ rgb_color rgb = GUI_TO_RGB(gui.back_pixel); @@ -1266,19 +1266,19 @@ VimTextAreaView::Draw(BRect updateRect) } void -VimTextAreaView::KeyDown(const char *bytes, int32 numBytes) +MNVTextAreaView::KeyDown(const char *bytes, int32 numBytes) { - struct VimKeyMsg km; + struct MNVKeyMsg km; char_u *dest = km.chars; - bool canHaveVimModifiers = false; + bool canHaveMNVModifiers = false; BMessage *msg = Window()->CurrentMessage(); assert(msg); // msg->PrintToStream(); /* - * Convert special keys to Vim codes. + * Convert special keys to MNV codes. * I think it is better to do it in the window thread * so we use at least a little bit of the potential * of our 2 CPUs. Besides, due to the fantastic mapping @@ -1337,7 +1337,7 @@ VimTextAreaView::KeyDown(const char *bytes, int32 numBytes) } bytes = (char *)newBytes; } - canHaveVimModifiers = true; + canHaveMNVModifiers = true; uint16 beoskey; int first, last; @@ -1364,8 +1364,8 @@ VimTextAreaView::KeyDown(const char *bytes, int32 numBytes) for (int i = first; i < last; i++) { if (special_keys[i].BeKeys == beoskey) { string[0] = CSI; - string[1] = special_keys[i].vim_code0; - string[2] = special_keys[i].vim_code1; + string[1] = special_keys[i].mnv_code0; + string[2] = special_keys[i].mnv_code1; len = 3; } } @@ -1383,7 +1383,7 @@ notspecial: bytes[0] == B_RETURN || bytes[0] == '\r' || bytes[0] == B_ESCAPE) #else - if (canHaveVimModifiers) + if (canHaveMNVModifiers) #endif { int modifiers; @@ -1433,7 +1433,7 @@ notspecial: km.csi_escape = false; } - write_port(gui.vdcmp, VimMsg::Key, &km, sizeof(km)); + write_port(gui.vdcmp, MNVMsg::Key, &km, sizeof(km)); /* * blank out the pointer if necessary @@ -1445,14 +1445,14 @@ notspecial: } } void -VimTextAreaView::guiSendMouseEvent( +MNVTextAreaView::guiSendMouseEvent( int button, int x, int y, int repeated_click, int_u modifiers) { - VimMouseMsg mm; + MNVMouseMsg mm; mm.button = button; mm.x = x; @@ -1460,7 +1460,7 @@ VimTextAreaView::guiSendMouseEvent( mm.repeated_click = repeated_click; mm.modifiers = modifiers; - write_port(gui.vdcmp, VimMsg::Mouse, &mm, sizeof(mm)); + write_port(gui.vdcmp, MNVMsg::Mouse, &mm, sizeof(mm)); // calls gui_send_mouse_event() /* @@ -1474,16 +1474,16 @@ VimTextAreaView::guiSendMouseEvent( } void -VimTextAreaView::guiMouseMoved( +MNVTextAreaView::guiMouseMoved( int x, int y) { - VimMouseMovedMsg mm; + MNVMouseMovedMsg mm; mm.x = x; mm.y = y; - write_port(gui.vdcmp, VimMsg::MouseMoved, &mm, sizeof(mm)); + write_port(gui.vdcmp, MNVMsg::MouseMoved, &mm, sizeof(mm)); if (gui.pointer_hidden) { @@ -1493,38 +1493,38 @@ VimTextAreaView::guiMouseMoved( } void -VimTextAreaView::guiBlankMouse(bool should_hide) +MNVTextAreaView::guiBlankMouse(bool should_hide) { if (should_hide) { - // gui.vimApp->HideCursor(); - gui.vimApp->ObscureCursor(); + // gui.mnvApp->HideCursor(); + gui.mnvApp->ObscureCursor(); /* * ObscureCursor() would even be easier, but then - * Vim's idea of mouse visibility does not necessarily + * MNV's idea of mouse visibility does not necessarily * correspond to reality. */ } else { - // gui.vimApp->ShowCursor(); + // gui.mnvApp->ShowCursor(); } } int_u -VimTextAreaView::mouseModifiersToVim(int32 beModifiers) +MNVTextAreaView::mouseModifiersToMNV(int32 beModifiers) { - int_u vim_modifiers = 0x0; + int_u mnv_modifiers = 0x0; if (beModifiers & B_SHIFT_KEY) - vim_modifiers |= MOUSE_SHIFT; + mnv_modifiers |= MOUSE_SHIFT; if (beModifiers & B_CONTROL_KEY) - vim_modifiers |= MOUSE_CTRL; + mnv_modifiers |= MOUSE_CTRL; if (beModifiers & B_OPTION_KEY) // Alt or Meta key - vim_modifiers |= MOUSE_ALT; + mnv_modifiers |= MOUSE_ALT; - return vim_modifiers; + return mnv_modifiers; } void -VimTextAreaView::MouseDown(BPoint point) +MNVTextAreaView::MouseDown(BPoint point) { BMessage *m = Window()->CurrentMessage(); assert(m); @@ -1532,18 +1532,18 @@ VimTextAreaView::MouseDown(BPoint point) int32 buttons = 0; m->FindInt32("buttons", &buttons); - int vimButton; + int mnvButton; if (buttons & B_PRIMARY_MOUSE_BUTTON) - vimButton = MOUSE_LEFT; + mnvButton = MOUSE_LEFT; else if (buttons & B_SECONDARY_MOUSE_BUTTON) - vimButton = MOUSE_RIGHT; + mnvButton = MOUSE_RIGHT; else if (buttons & B_TERTIARY_MOUSE_BUTTON) - vimButton = MOUSE_MIDDLE; + mnvButton = MOUSE_MIDDLE; else return; // Unknown button - vimMouseButton = 1; // don't care which one + mnvMouseButton = 1; // don't care which one // Handle multiple clicks int32 clicks = 0; @@ -1552,16 +1552,16 @@ VimTextAreaView::MouseDown(BPoint point) int32 modifiers = 0; m->FindInt32("modifiers", &modifiers); - vimMouseModifiers = mouseModifiersToVim(modifiers); + mnvMouseModifiers = mouseModifiersToMNV(modifiers); - guiSendMouseEvent(vimButton, point.x, point.y, - clicks > 1 /* = repeated_click*/, vimMouseModifiers); + guiSendMouseEvent(mnvButton, point.x, point.y, + clicks > 1 /* = repeated_click*/, mnvMouseModifiers); } void -VimTextAreaView::MouseUp(BPoint point) +MNVTextAreaView::MouseUp(BPoint point) { - vimMouseButton = 0; + mnvMouseButton = 0; BMessage *m = Window()->CurrentMessage(); assert(m); @@ -1570,16 +1570,16 @@ VimTextAreaView::MouseUp(BPoint point) int32 modifiers = 0; m->FindInt32("modifiers", &modifiers); - vimMouseModifiers = mouseModifiersToVim(modifiers); + mnvMouseModifiers = mouseModifiersToMNV(modifiers); guiSendMouseEvent(MOUSE_RELEASE, point.x, point.y, - 0 /* = repeated_click*/, vimMouseModifiers); + 0 /* = repeated_click*/, mnvMouseModifiers); Inherited::MouseUp(point); } void -VimTextAreaView::MouseMoved(BPoint point, uint32 transit, const BMessage *message) +MNVTextAreaView::MouseMoved(BPoint point, uint32 transit, const BMessage *message) { /* * if our pointer is currently hidden, then we should show it. @@ -1590,7 +1590,7 @@ VimTextAreaView::MouseMoved(BPoint point, uint32 transit, const BMessage *messag gui.pointer_hidden = FALSE; } - if (!vimMouseButton) { // could also check m->"buttons" + if (!mnvMouseButton) { // could also check m->"buttons" guiMouseMoved(point.x, point.y); return; } @@ -1598,24 +1598,24 @@ VimTextAreaView::MouseMoved(BPoint point, uint32 transit, const BMessage *messag atomic_add(&mouseDragEventCount, 1); // Don't care much about "transit" - guiSendMouseEvent(MOUSE_DRAG, point.x, point.y, 0, vimMouseModifiers); + guiSendMouseEvent(MOUSE_DRAG, point.x, point.y, 0, mnvMouseModifiers); } void -VimTextAreaView::MessageReceived(BMessage *m) +MNVTextAreaView::MessageReceived(BMessage *m) { switch (m->what) { case 'menu': { - VimMenuMsg mm; + MNVMenuMsg mm; mm.guiMenu = NULL; // in case no pointer in msg - m->FindPointer("VimMenu", (void **)&mm.guiMenu); - write_port(gui.vdcmp, VimMsg::Menu, &mm, sizeof(mm)); + m->FindPointer("MNVMenu", (void **)&mm.guiMenu); + write_port(gui.vdcmp, MNVMsg::Menu, &mm, sizeof(mm)); } break; case B_MOUSE_WHEEL_CHANGED: { - VimScrollBar* scb = curwin->w_scrollbars[1].id; + MNVScrollBar* scb = curwin->w_scrollbars[1].id; float small=0, big=0, dy=0; m->FindFloat("be:wheel_delta_y", &dy); scb->GetSteps(&small, &big); @@ -1653,7 +1653,7 @@ VimTextAreaView::MessageReceived(BMessage *m) { m->FindString("be:string", &str); char_u *chars = (char_u*)str.String(); - struct VimKeyMsg km; + struct MNVKeyMsg km; km.csi_escape = true; int clen; int i = 0; @@ -1662,7 +1662,7 @@ VimTextAreaView::MessageReceived(BMessage *m) clen = utf_ptr2len(chars+i); memcpy(km.chars, chars+i, clen); km.length = clen; - write_port(gui.vdcmp, VimMsg::Key, &km, sizeof(km)); + write_port(gui.vdcmp, MNVMsg::Key, &km, sizeof(km)); i += clen; } } @@ -1692,7 +1692,7 @@ VimTextAreaView::MessageReceived(BMessage *m) BWindow *w = Window(); w->DetachCurrentMessage(); w->Minimize(false); - VimApp::SendRefs(m, (modifiers() & B_SHIFT_KEY) != 0); + MNVApp::SendRefs(m, (modifiers() & B_SHIFT_KEY) != 0); } else { Inherited::MessageReceived(m); } @@ -1701,9 +1701,9 @@ VimTextAreaView::MessageReceived(BMessage *m) } int -VimTextAreaView::mchInitFont(char_u *name) +MNVTextAreaView::mchInitFont(char_u *name) { - VimFont *newFont = (VimFont *)gui_mch_get_font(name, 1); + MNVFont *newFont = (MNVFont *)gui_mch_get_font(name, 1); if (newFont != NOFONT) { gui.norm_font = (GuiFont)newFont; gui_mch_set_font((GuiFont)newFont); @@ -1723,7 +1723,7 @@ VimTextAreaView::mchInitFont(char_u *name) } void -VimTextAreaView::mchDrawString(int row, int col, char_u *s, int len, int flags) +MNVTextAreaView::mchDrawString(int row, int col, char_u *s, int len, int flags) { /* * First we must erase the area, because DrawString won't do @@ -1797,7 +1797,7 @@ VimTextAreaView::mchDrawString(int row, int col, char_u *s, int len, int flags) } void -VimTextAreaView::mchClearBlock( +MNVTextAreaView::mchClearBlock( int row1, int col1, int row2, @@ -1810,7 +1810,7 @@ VimTextAreaView::mchClearBlock( } void -VimTextAreaView::mchClearAll() +MNVTextAreaView::mchClearAll() { gui_mch_set_bg_color(gui.back_pixel); FillRect(Bounds(), B_SOLID_LOW); @@ -1820,7 +1820,7 @@ VimTextAreaView::mchClearAll() * mchDeleteLines() Lock()s the window by itself. */ void -VimTextAreaView::mchDeleteLines(int row, int num_lines) +MNVTextAreaView::mchDeleteLines(int row, int num_lines) { BRect source, dest; source.left = FILL_X(gui.scroll_region_left); @@ -1833,7 +1833,7 @@ VimTextAreaView::mchDeleteLines(int row, int num_lines) dest.right = FILL_X(gui.scroll_region_right + 1) - PEN_WIDTH; dest.bottom = FILL_Y(gui.scroll_region_bot - num_lines + 1) - PEN_WIDTH; - if (gui.vimWindow->Lock()) { + if (gui.mnvWindow->Lock()) { // Clear one column more for when bold has spilled over CopyBits(source, dest); gui_clear_block(gui.scroll_region_bot - num_lines + 1, @@ -1841,7 +1841,7 @@ VimTextAreaView::mchDeleteLines(int row, int num_lines) gui.scroll_region_bot, gui.scroll_region_right); - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); /* * The Draw() callback will be called now if some of the source * bits were not in the visible region. @@ -1855,12 +1855,12 @@ VimTextAreaView::mchDeleteLines(int row, int num_lines) * mchInsertLines() Lock()s the window by itself. */ void -VimTextAreaView::mchInsertLines(int row, int num_lines) +MNVTextAreaView::mchInsertLines(int row, int num_lines) { BRect source, dest; // XXX Attempt at a hack: - gui.vimWindow->UpdateIfNeeded(); + gui.mnvWindow->UpdateIfNeeded(); source.left = FILL_X(gui.scroll_region_left); source.top = FILL_Y(row); source.right = FILL_X(gui.scroll_region_right + 1) - PEN_WIDTH; @@ -1871,13 +1871,13 @@ VimTextAreaView::mchInsertLines(int row, int num_lines) dest.right = FILL_X(gui.scroll_region_right + 1) - PEN_WIDTH; dest.bottom = FILL_Y(gui.scroll_region_bot + 1) - PEN_WIDTH; - if (gui.vimWindow->Lock()) { + if (gui.mnvWindow->Lock()) { // Clear one column more for when bold has spilled over CopyBits(source, dest); gui_clear_block(row, gui.scroll_region_left, row + num_lines - 1, gui.scroll_region_right); - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); /* * The Draw() callback will be called now if some of the source * bits were not in the visible region. @@ -1897,7 +1897,7 @@ VimTextAreaView::mchInsertLines(int row, int num_lines) /* * DrawIMString draws string with IMData.message. */ -void VimTextAreaView::DrawIMString(void) +void MNVTextAreaView::DrawIMString(void) { static const rgb_color r_highlight = {255, 152, 152, 255}, b_highlight = {152, 203, 255, 255}; @@ -1962,20 +1962,20 @@ void VimTextAreaView::DrawIMString(void) SetLowColor(lcolor); } #endif -// ---------------- VimScrollBar ---------------- +// ---------------- MNVScrollBar ---------------- /* * BUG: XXX * It seems that BScrollBar determine their direction not from * "posture" but from if they are "tall" or "wide" in shape... * - * Also, place them out of sight, because Vim enables them before + * Also, place them out of sight, because MNV enables them before * they are positioned. */ -VimScrollBar::VimScrollBar(scrollbar_T *g, orientation posture): +MNVScrollBar::MNVScrollBar(scrollbar_T *g, orientation posture): BScrollBar(posture == B_HORIZONTAL ? BRect(-100,-100,-10,-90) : BRect(-100,-100,-90,-10), - "vim scrollbar", (BView *)NULL, + "mnv scrollbar", (BView *)NULL, 0.0, 10.0, posture), ignoreValue(-1), scrollEventCount(0) @@ -1984,12 +1984,12 @@ VimScrollBar::VimScrollBar(scrollbar_T *g, orientation posture): SetResizingMode(B_FOLLOW_NONE); } -VimScrollBar::~VimScrollBar() +MNVScrollBar::~MNVScrollBar() { } void -VimScrollBar::ValueChanged(float newValue) +MNVScrollBar::ValueChanged(float newValue) { if (ignoreValue >= 0.0 && newValue == ignoreValue) { ignoreValue = -1; @@ -2006,13 +2006,13 @@ VimScrollBar::ValueChanged(float newValue) */ atomic_add(&scrollEventCount, 1); - struct VimScrollBarMsg sm; + struct MNVScrollBarMsg sm; sm.sb = this; sm.value = (long) newValue; sm.stillDragging = TRUE; - write_port(gui.vdcmp, VimMsg::ScrollBar, &sm, sizeof(sm)); + write_port(gui.vdcmp, MNVMsg::ScrollBar, &sm, sizeof(sm)); // calls gui_drag_scrollbar(sb, newValue, TRUE); } @@ -2025,20 +2025,20 @@ VimScrollBar::ValueChanged(float newValue) * So we do special processing when the window de/activates. */ void -VimScrollBar::MouseUp(BPoint where) +MNVScrollBar::MouseUp(BPoint where) { // BMessage *m = Window()->CurrentMessage(); // m->PrintToStream(); atomic_add(&scrollEventCount, 1); - struct VimScrollBarMsg sm; + struct MNVScrollBarMsg sm; sm.sb = this; sm.value = (long) Value(); sm.stillDragging = FALSE; - write_port(gui.vdcmp, VimMsg::ScrollBar, &sm, sizeof(sm)); + write_port(gui.vdcmp, MNVMsg::ScrollBar, &sm, sizeof(sm)); // calls gui_drag_scrollbar(sb, newValue, FALSE); @@ -2046,7 +2046,7 @@ VimScrollBar::MouseUp(BPoint where) } void -VimScrollBar::SetValue(float newValue) +MNVScrollBar::SetValue(float newValue) { if (newValue == Value()) return; @@ -2055,56 +2055,56 @@ VimScrollBar::SetValue(float newValue) Inherited::SetValue(newValue); } -// ---------------- VimFont ---------------- +// ---------------- MNVFont ---------------- -VimFont::VimFont(): BFont() +MNVFont::MNVFont(): BFont() { init(); } -VimFont::VimFont(const VimFont *rhs): BFont(rhs) +MNVFont::MNVFont(const MNVFont *rhs): BFont(rhs) { init(); } -VimFont::VimFont(const BFont *rhs): BFont(rhs) +MNVFont::MNVFont(const BFont *rhs): BFont(rhs) { init(); } -VimFont::VimFont(const VimFont &rhs): BFont(rhs) +MNVFont::MNVFont(const MNVFont &rhs): BFont(rhs) { init(); } -VimFont::~VimFont() +MNVFont::~MNVFont() { } void -VimFont::init() +MNVFont::init() { next = NULL; refcount = 1; name = NULL; } -// ---------------- VimDialog ---------------- +// ---------------- MNVDialog ---------------- #if defined(FEAT_GUI_DIALOG) -const unsigned int kVimDialogButtonMsg = 'VMDB'; -const unsigned int kVimDialogIconStripeWidth = 30; -const unsigned int kVimDialogButtonsSpacingX = 9; -const unsigned int kVimDialogButtonsSpacingY = 4; -const unsigned int kVimDialogSpacingX = 6; -const unsigned int kVimDialogSpacingY = 10; -const unsigned int kVimDialogMinimalWidth = 310; -const unsigned int kVimDialogMinimalHeight = 75; +const unsigned int kMNVDialogButtonMsg = 'VMDB'; +const unsigned int kMNVDialogIconStripeWidth = 30; +const unsigned int kMNVDialogButtonsSpacingX = 9; +const unsigned int kMNVDialogButtonsSpacingY = 4; +const unsigned int kMNVDialogSpacingX = 6; +const unsigned int kMNVDialogSpacingY = 10; +const unsigned int kMNVDialogMinimalWidth = 310; +const unsigned int kMNVDialogMinimalHeight = 75; const BRect kDefaultRect = -BRect(0, 0, kVimDialogMinimalWidth, kVimDialogMinimalHeight); +BRect(0, 0, kMNVDialogMinimalWidth, kMNVDialogMinimalHeight); -VimDialog::VimDialog(int type, const char *title, const char *message, +MNVDialog::MNVDialog(int type, const char *title, const char *message, const char *buttons, int dfltbutton, const char *textfield, int ex_cmd) : BWindow(kDefaultRect, title, B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_CLOSABLE | B_NOT_RESIZABLE | @@ -2116,12 +2116,12 @@ VimDialog::VimDialog(int type, const char *title, const char *message, , fInputValue(textfield) { // master view - VimDialog::View* view = new VimDialog::View(Bounds()); + MNVDialog::View* view = new MNVDialog::View(Bounds()); if (view == NULL) return; if (title == NULL) - SetTitle("Vim " VIM_VERSION_MEDIUM); + SetTitle("MNV " MNV_VERSION_MEDIUM); AddChild(view); @@ -2158,15 +2158,15 @@ VimDialog::VimDialog(int type, const char *title, const char *message, } while (true); int32 buttonsCount = fButtonsList.CountItems(); - buttonsWidth += kVimDialogButtonsSpacingX * (buttonsCount - 1); - buttonsHeight += kVimDialogButtonsSpacingY * (buttonsCount - 1); - float dialogWidth = buttonsWidth + kVimDialogIconStripeWidth + - kVimDialogSpacingX * 2; - float dialogHeight = maxButtonHeight + kVimDialogSpacingY * 3; + buttonsWidth += kMNVDialogButtonsSpacingX * (buttonsCount - 1); + buttonsHeight += kMNVDialogButtonsSpacingY * (buttonsCount - 1); + float dialogWidth = buttonsWidth + kMNVDialogIconStripeWidth + + kMNVDialogSpacingX * 2; + float dialogHeight = maxButtonHeight + kMNVDialogSpacingY * 3; // Check 'v' flag in 'guioptions': vertical button placement. - bool vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL) || - dialogWidth >= gui.vimWindow->Bounds().Width(); + bool vertical = (mnv_strchr(p_go, GO_VERTICAL) != NULL) || + dialogWidth >= gui.mnvWindow->Bounds().Width(); if (vertical) { dialogWidth -= buttonsWidth; dialogWidth += maxButtonWidth; @@ -2174,13 +2174,13 @@ VimDialog::VimDialog(int type, const char *title, const char *message, dialogHeight += buttonsHeight; } - dialogWidth = max_c(dialogWidth, kVimDialogMinimalWidth); + dialogWidth = max_c(dialogWidth, kMNVDialogMinimalWidth); // message view BRect rect(0, 0, dialogWidth, 0); - rect.left += kVimDialogIconStripeWidth + 16 + kVimDialogSpacingX; - rect.top += kVimDialogSpacingY; - rect.right -= kVimDialogSpacingX; + rect.left += kMNVDialogIconStripeWidth + 16 + kMNVDialogSpacingX; + rect.top += kMNVDialogSpacingY; + rect.right -= kMNVDialogSpacingX; rect.bottom = rect.top; fMessageView = new BTextView(rect, "_tv_", rect.OffsetByCopy(B_ORIGIN), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW); @@ -2203,7 +2203,7 @@ VimDialog::VimDialog(int type, const char *title, const char *message, // input view if (fInputValue != NULL) { rect.top = - rect.bottom += messageHeight + kVimDialogSpacingY; + rect.bottom += messageHeight + kMNVDialogSpacingY; fInputControl = new BTextControl(rect, "_iv_", NULL, fInputValue, NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE | B_PULSE_NEEDED); fInputControl->TextView()->SetText(fInputValue); @@ -2214,29 +2214,29 @@ VimDialog::VimDialog(int type, const char *title, const char *message, fInputControl->GetPreferredSize(&width, &height); fInputControl->MakeFocus(true); - dialogHeight += height + kVimDialogSpacingY * 1.5; + dialogHeight += height + kMNVDialogSpacingY * 1.5; } - dialogHeight = max_c(dialogHeight, kVimDialogMinimalHeight); + dialogHeight = max_c(dialogHeight, kMNVDialogMinimalHeight); ResizeTo(dialogWidth, dialogHeight); - MoveTo((gui.vimWindow->Bounds().Width() - dialogWidth) / 2, - (gui.vimWindow->Bounds().Height() - dialogHeight) / 2); + MoveTo((gui.mnvWindow->Bounds().Width() - dialogWidth) / 2, + (gui.mnvWindow->Bounds().Height() - dialogHeight) / 2); // adjust layout of buttons float buttonWidth = max_c(maxButtonWidth, rect.Width() * 0.66); BPoint origin(dialogWidth, dialogHeight); - origin.x -= kVimDialogSpacingX + (vertical ? buttonWidth : buttonsWidth); - origin.y -= kVimDialogSpacingY + (vertical ? buttonsHeight : maxButtonHeight); + origin.x -= kMNVDialogSpacingX + (vertical ? buttonWidth : buttonsWidth); + origin.y -= kMNVDialogSpacingY + (vertical ? buttonsHeight : maxButtonHeight); for (int32 i = 0 ; i < buttonsCount; i++) { BButton *button = (BButton*)fButtonsList.ItemAt(i); button->MoveTo(origin); if (vertical) { - origin.y += button->Frame().Height() + kVimDialogButtonsSpacingY; + origin.y += button->Frame().Height() + kMNVDialogButtonsSpacingY; button->ResizeTo(buttonWidth, button->Frame().Height()); } else - origin.x += button->Frame().Width() + kVimDialogButtonsSpacingX; + origin.x += button->Frame().Width() + kMNVDialogButtonsSpacingX; if (dfltbutton == i + 1) { button->MakeDefault(true); @@ -2245,16 +2245,16 @@ VimDialog::VimDialog(int type, const char *title, const char *message, } } -VimDialog::~VimDialog() +MNVDialog::~MNVDialog() { if (fDialogSem > B_OK) delete_sem(fDialogSem); } int -VimDialog::Go() +MNVDialog::Go() { - fDialogSem = create_sem(0, "VimDialogSem"); + fDialogSem = create_sem(0, "MNVDialogSem"); if (fDialogSem < B_OK) { Quit(); return fDialogValue; @@ -2266,7 +2266,7 @@ VimDialog::Go() int retValue = fDialogValue; if (fInputValue != NULL) - vim_strncpy((char_u*)fInputValue, (char_u*)fInputControl->Text(), IOSIZE - 1); + mnv_strncpy((char_u*)fInputValue, (char_u*)fInputControl->Text(), IOSIZE - 1); if (Lock()) Quit(); @@ -2274,10 +2274,10 @@ VimDialog::Go() return retValue; } -void VimDialog::MessageReceived(BMessage *msg) +void MNVDialog::MessageReceived(BMessage *msg) { int32 which = 0; - if (msg->what != kVimDialogButtonMsg || + if (msg->what != kMNVDialogButtonMsg || msg->FindInt32("which", &which) != B_OK) return BWindow::MessageReceived(msg); @@ -2286,9 +2286,9 @@ void VimDialog::MessageReceived(BMessage *msg) fDialogSem = -1; } -BButton* VimDialog::_CreateButton(int32 which, const char* label) +BButton* MNVDialog::_CreateButton(int32 which, const char* label) { - BMessage *message = new BMessage(kVimDialogButtonMsg); + BMessage *message = new BMessage(kMNVDialogButtonMsg); message->AddInt32("which", which); BRect rect(0, 0, 0, 0); @@ -2305,22 +2305,22 @@ BButton* VimDialog::_CreateButton(int32 which, const char* label) return button; } -VimDialog::View::View(BRect frame) - : BView(frame, "VimDialogView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW), +MNVDialog::View::View(BRect frame) + : BView(frame, "MNVDialogView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW), fIconBitmap(NULL) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); } -VimDialog::View::~View() +MNVDialog::View::~View() { delete fIconBitmap; } -void VimDialog::View::Draw(BRect updateRect) +void MNVDialog::View::Draw(BRect updateRect) { BRect stripeRect = Bounds(); - stripeRect.right = kVimDialogIconStripeWidth; + stripeRect.right = kMNVDialogIconStripeWidth; SetHighColor(tint_color(ViewColor(), B_DARKEN_1_TINT)); FillRect(stripeRect); @@ -2332,9 +2332,9 @@ void VimDialog::View::Draw(BRect updateRect) DrawBitmapAsync(fIconBitmap, BPoint(18, 6)); } -void VimDialog::View::InitIcon(int32 type) +void MNVDialog::View::InitIcon(int32 type) { - if (type == VIM_GENERIC) + if (type == MNV_GENERIC) return; BPath path; @@ -2362,10 +2362,10 @@ void VimDialog::View::InitIcon(int32 type) const char *name = ""; switch(type) { - case VIM_ERROR: name = "stop"; break; - case VIM_WARNING: name = "warn"; break; - case VIM_INFO: name = "info"; break; - case VIM_QUESTION: name = "idea"; break; + case MNV_ERROR: name = "stop"; break; + case MNV_WARNING: name = "warn"; break; + case MNV_INFO: name = "info"; break; + case MNV_QUESTION: name = "idea"; break; default: return; } @@ -2397,14 +2397,14 @@ void VimDialog::View::InitIcon(int32 type) BIconUtils::ConvertFromCMAP8(iconData, iconSize, iconSize, iconSize, fIconBitmap); } -const unsigned int kVimDialogOKButtonMsg = 'FDOK'; -const unsigned int kVimDialogCancelButtonMsg = 'FDCN'; -const unsigned int kVimDialogSizeInputMsg = 'SICH'; -const unsigned int kVimDialogFamilySelectMsg = 'MSFM'; -const unsigned int kVimDialogStyleSelectMsg = 'MSST'; -const unsigned int kVimDialogSizeSelectMsg = 'MSSZ'; +const unsigned int kMNVDialogOKButtonMsg = 'FDOK'; +const unsigned int kMNVDialogCancelButtonMsg = 'FDCN'; +const unsigned int kMNVDialogSizeInputMsg = 'SICH'; +const unsigned int kMNVDialogFamilySelectMsg = 'MSFM'; +const unsigned int kMNVDialogStyleSelectMsg = 'MSST'; +const unsigned int kMNVDialogSizeSelectMsg = 'MSSZ'; -VimSelectFontDialog::VimSelectFontDialog(font_family* family, font_style* style, float* size) +MNVSelectFontDialog::MNVSelectFontDialog(font_family* family, font_style* style, float* size) : BWindow(kDefaultRect, "Font Selection", B_TITLED_WINDOW_LOOK, B_MODAL_APP_WINDOW_FEEL, B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_ASYNCHRONOUS_CONTROLS) @@ -2432,7 +2432,7 @@ VimSelectFontDialog::VimSelectFontDialog(font_family* family, font_style* style, // client view BRect RC = clientBox->Bounds(); - RC.InsetBy(kVimDialogSpacingX, kVimDialogSpacingY); + RC.InsetBy(kMNVDialogSpacingX, kMNVDialogSpacingY); BRect rc(RC.LeftTop(), RC.LeftTop()); // at first create all controls @@ -2468,7 +2468,7 @@ VimSelectFontDialog::VimSelectFontDialog(font_family* family, font_style* style, clientBox->AddChild(scrollStyles); fSizesInput = new BTextControl(rc, "inputSize", NULL, "???", - new BMessage(kVimDialogSizeInputMsg)); + new BMessage(kMNVDialogSizeInputMsg)); clientBox->AddChild(fSizesInput); fSizesInput->ResizeToPreferred(); @@ -2479,42 +2479,42 @@ VimSelectFontDialog::VimSelectFontDialog(font_family* family, font_style* style, clientBox->AddChild(scrollSizes); BButton *buttonOK = new BButton(rc, "buttonOK", "OK", - new BMessage(kVimDialogOKButtonMsg)); + new BMessage(kMNVDialogOKButtonMsg)); clientBox->AddChild(buttonOK); buttonOK->ResizeToPreferred(); BButton *buttonCancel = new BButton(rc, "buttonCancel", "Cancel", - new BMessage(kVimDialogCancelButtonMsg)); + new BMessage(kMNVDialogCancelButtonMsg)); clientBox->AddChild(buttonCancel); buttonCancel->ResizeToPreferred(); // layout controls float lineHeight = labelFamily->Bounds().Height(); float previewHeight = lineHeight * 3; - float offsetYLabels = previewHeight + kVimDialogSpacingY; - float offsetYLists = offsetYLabels + lineHeight + kVimDialogSpacingY / 2; - float offsetYSizes = offsetYLists + fSizesInput->Bounds().Height() + kVimDialogSpacingY / 2; + float offsetYLabels = previewHeight + kMNVDialogSpacingY; + float offsetYLists = offsetYLabels + lineHeight + kMNVDialogSpacingY / 2; + float offsetYSizes = offsetYLists + fSizesInput->Bounds().Height() + kMNVDialogSpacingY / 2; float listsHeight = lineHeight * 9; - float offsetYButtons = offsetYLists + listsHeight + kVimDialogSpacingY; + float offsetYButtons = offsetYLists + listsHeight + kMNVDialogSpacingY; float maxControlsHeight = offsetYButtons + buttonOK->Bounds().Height(); float familiesWidth = labelFamily->Bounds().Width() * 5; - float offsetXStyles = familiesWidth + kVimDialogSpacingX; + float offsetXStyles = familiesWidth + kMNVDialogSpacingX; float stylesWidth = labelStyle->Bounds().Width() * 4; - float offsetXSizes = offsetXStyles + stylesWidth + kVimDialogSpacingX; + float offsetXSizes = offsetXStyles + stylesWidth + kMNVDialogSpacingX; float sizesWidth = labelSize->Bounds().Width() * 2; float maxControlsWidth = offsetXSizes + sizesWidth; - ResizeTo(maxControlsWidth + kVimDialogSpacingX * 2, - maxControlsHeight + kVimDialogSpacingY * 2); + ResizeTo(maxControlsWidth + kMNVDialogSpacingX * 2, + maxControlsHeight + kMNVDialogSpacingY * 2); - BRect rcVim = gui.vimWindow->Frame(); - MoveTo(rcVim.left + (rcVim.Width() - Frame().Width()) / 2, - rcVim.top + (rcVim.Height() - Frame().Height()) / 2); + BRect rcMNV = gui.mnvWindow->Frame(); + MoveTo(rcMNV.left + (rcMNV.Width() - Frame().Width()) / 2, + rcMNV.top + (rcMNV.Height() - Frame().Height()) / 2); fPreview->ResizeTo(maxControlsWidth, previewHeight); fPreview->SetAlignment(B_ALIGN_CENTER); - boxDivider->MoveBy(0.f, previewHeight + kVimDialogSpacingY / 2); + boxDivider->MoveBy(0.f, previewHeight + kMNVDialogSpacingY / 2); boxDivider->ResizeTo(maxControlsWidth, 1.f); labelFamily->MoveBy(0.f, offsetYLabels); @@ -2540,7 +2540,7 @@ VimSelectFontDialog::VimSelectFontDialog(font_family* family, font_style* style, buttonOK->MoveBy(maxControlsWidth - buttonOK->Bounds().Width(), offsetYButtons); buttonCancel->MoveBy(maxControlsWidth - buttonOK->Bounds().Width() - - buttonCancel->Bounds().Width() - kVimDialogSpacingX, offsetYButtons); + - buttonCancel->Bounds().Width() - kMNVDialogSpacingX, offsetYButtons); // fill lists int selIndex = -1; @@ -2576,10 +2576,10 @@ VimSelectFontDialog::VimSelectFontDialog(font_family* family, font_style* style, fSizesList->ScrollToSelection(); } - fFamiliesList->SetSelectionMessage(new BMessage(kVimDialogFamilySelectMsg)); - fStylesList->SetSelectionMessage(new BMessage(kVimDialogStyleSelectMsg)); - fSizesList->SetSelectionMessage(new BMessage(kVimDialogSizeSelectMsg)); - fSizesInput->SetModificationMessage(new BMessage(kVimDialogSizeInputMsg)); + fFamiliesList->SetSelectionMessage(new BMessage(kMNVDialogFamilySelectMsg)); + fStylesList->SetSelectionMessage(new BMessage(kMNVDialogStyleSelectMsg)); + fSizesList->SetSelectionMessage(new BMessage(kMNVDialogSizeSelectMsg)); + fSizesInput->SetModificationMessage(new BMessage(kMNVDialogSizeInputMsg)); _UpdateSizeInputPreview(); _UpdateFontPreview(); @@ -2587,7 +2587,7 @@ VimSelectFontDialog::VimSelectFontDialog(font_family* family, font_style* style, fStatus = B_OK; } -VimSelectFontDialog::~VimSelectFontDialog() +MNVSelectFontDialog::~MNVSelectFontDialog() { _CleanList(fFamiliesList); _CleanList(fStylesList); @@ -2598,21 +2598,21 @@ VimSelectFontDialog::~VimSelectFontDialog() } void -VimSelectFontDialog::_CleanList(BListView* list) +MNVSelectFontDialog::_CleanList(BListView* list) { while (0 < list->CountItems()) delete (dynamic_cast(list->RemoveItem((int32)0))); } bool -VimSelectFontDialog::Go() +MNVSelectFontDialog::Go() { if (fStatus != B_OK) { Quit(); return NOFONT; } - fDialogSem = create_sem(0, "VimFontSelectDialogSem"); + fDialogSem = create_sem(0, "MNVFontSelectDialogSem"); if (fDialogSem < B_OK) { Quit(); return fDialogValue; @@ -2631,7 +2631,7 @@ VimSelectFontDialog::Go() } -void VimSelectFontDialog::_UpdateFontStyles() +void MNVSelectFontDialog::_UpdateFontStyles() { _CleanList(fStylesList); @@ -2655,15 +2655,15 @@ void VimSelectFontDialog::_UpdateFontStyles() } -void VimSelectFontDialog::_UpdateSizeInputPreview() +void MNVSelectFontDialog::_UpdateSizeInputPreview() { char buf[10] = {0}; - vim_snprintf(buf, sizeof(buf), (char*)"%.0f", fFontSize); + mnv_snprintf(buf, sizeof(buf), (char*)"%.0f", fFontSize); fSizesInput->SetText(buf); } -void VimSelectFontDialog::_UpdateFontPreview() +void MNVSelectFontDialog::_UpdateFontPreview() { BFont font; fPreview->GetFont(&font); @@ -2678,7 +2678,7 @@ void VimSelectFontDialog::_UpdateFontPreview() bool -VimSelectFontDialog::_UpdateFromListItem(BListView* list, char* text, int textSize) +MNVSelectFontDialog::_UpdateFromListItem(BListView* list, char* text, int textSize) { int32 index = list->CurrentSelection(); if (index < 0) @@ -2691,15 +2691,15 @@ VimSelectFontDialog::_UpdateFromListItem(BListView* list, char* text, int textSi } -void VimSelectFontDialog::MessageReceived(BMessage *msg) +void MNVSelectFontDialog::MessageReceived(BMessage *msg) { switch (msg->what) { - case kVimDialogOKButtonMsg: + case kMNVDialogOKButtonMsg: strncpy(*fFamily, fFontFamily, B_FONT_FAMILY_LENGTH); strncpy(*fStyle, fFontStyle, B_FONT_STYLE_LENGTH); *fSize = fFontSize; fDialogValue = true; - case kVimDialogCancelButtonMsg: + case kMNVDialogCancelButtonMsg: delete_sem(fDialogSem); fDialogSem = -1; return; @@ -2714,19 +2714,19 @@ void VimSelectFontDialog::MessageReceived(BMessage *msg) } break; - case kVimDialogFamilySelectMsg: + case kMNVDialogFamilySelectMsg: if (_UpdateFromListItem(fFamiliesList, fFontFamily, B_FONT_FAMILY_LENGTH)) { _UpdateFontStyles(); _UpdateFontPreview(); } break; - case kVimDialogStyleSelectMsg: + case kMNVDialogStyleSelectMsg: if (_UpdateFromListItem(fStylesList, fFontStyle, B_FONT_STYLE_LENGTH)) _UpdateFontPreview(); break; - case kVimDialogSizeSelectMsg: + case kMNVDialogSizeSelectMsg: { char buf[10] = {0}; if (_UpdateFromListItem(fSizesList, buf, sizeof(buf))) { @@ -2739,7 +2739,7 @@ void VimSelectFontDialog::MessageReceived(BMessage *msg) } } break; - case kVimDialogSizeInputMsg: + case kMNVDialogSizeInputMsg: { float size = atof(fSizesInput->Text()); if (size > 0.f) { @@ -2759,14 +2759,14 @@ void VimSelectFontDialog::MessageReceived(BMessage *msg) #ifdef FEAT_TOOLBAR // some forward declaration required by toolbar functions... -static BMessage * MenuMessage(vimmenu_T *menu); +static BMessage * MenuMessage(mnvmenu_T *menu); -VimToolbar::VimToolbar(BRect frame, const char *name) : +MNVToolbar::MNVToolbar(BRect frame, const char *name) : BBox(frame, name, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER) { } -VimToolbar::~VimToolbar() +MNVToolbar::~MNVToolbar() { int32 count = fButtonsList.CountItems(); for (int32 i = 0; i < count; i++) @@ -2780,7 +2780,7 @@ VimToolbar::~VimToolbar() } void -VimToolbar::AttachedToWindow() +MNVToolbar::AttachedToWindow() { BBox::AttachedToWindow(); @@ -2788,14 +2788,14 @@ VimToolbar::AttachedToWindow() } float -VimToolbar::ToolbarHeight() const +MNVToolbar::ToolbarHeight() const { float size = NULL == normalButtonsBitmap ? 18. : normalButtonsBitmap->Bounds().Height(); return size + ToolbarMargin * 2 + ButtonMargin * 2 + 1; } bool -VimToolbar::ModifyBitmapToGrayed(BBitmap *bitmap) +MNVToolbar::ModifyBitmapToGrayed(BBitmap *bitmap) { float height = bitmap->Bounds().Height(); float width = bitmap->Bounds().Width(); @@ -2812,10 +2812,10 @@ VimToolbar::ModifyBitmapToGrayed(BBitmap *bitmap) } bool -VimToolbar::PrepareButtonBitmaps() +MNVToolbar::PrepareButtonBitmaps() { // first try to load potentially customized $VIRUNTIME/bitmaps/builtin-tools.png - normalButtonsBitmap = LoadVimBitmap("builtin-tools.png"); + normalButtonsBitmap = LoadMNVBitmap("builtin-tools.png"); if (normalButtonsBitmap == NULL) // customized not found? dig application resources for "builtin-tools" one normalButtonsBitmap = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "builtin-tools"); @@ -2836,12 +2836,12 @@ VimToolbar::PrepareButtonBitmaps() return true; } -BBitmap *VimToolbar::LoadVimBitmap(const char* fileName) +BBitmap *MNVToolbar::LoadMNVBitmap(const char* fileName) { BBitmap *bitmap = NULL; int mustfree = 0; - char_u* runtimePath = vim_getenv((char_u*)"VIMRUNTIME", &mustfree); + char_u* runtimePath = mnv_getenv((char_u*)"MNVRUNTIME", &mustfree); if (runtimePath != NULL && fileName != NULL) { BString strPath((char*)runtimePath); strPath << "/bitmaps/" << fileName; @@ -2849,13 +2849,13 @@ BBitmap *VimToolbar::LoadVimBitmap(const char* fileName) } if (mustfree) - vim_free(runtimePath); + mnv_free(runtimePath); return bitmap; } bool -VimToolbar::GetPictureFromBitmap(BPicture *pictureTo, int32 index, BBitmap *bitmapFrom, bool pressed) +MNVToolbar::GetPictureFromBitmap(BPicture *pictureTo, int32 index, BBitmap *bitmapFrom, bool pressed) { float size = bitmapFrom->Bounds().Height() + 1.; @@ -2895,7 +2895,7 @@ VimToolbar::GetPictureFromBitmap(BPicture *pictureTo, int32 index, BBitmap *bitm } bool -VimToolbar::AddButton(int32 index, vimmenu_T *menu) +MNVToolbar::AddButton(int32 index, mnvmenu_T *menu) { BPictureButton *button = NULL; if (!menu_is_separator(menu->name)) { @@ -2940,7 +2940,7 @@ VimToolbar::AddButton(int32 index, vimmenu_T *menu) button->SetDisabledOn(&pictureGray); button->SetDisabledOff(&pictureGray); - button->SetTarget(gui.vimTextArea); + button->SetTarget(gui.mnvTextArea); AddChild(button); @@ -2953,7 +2953,7 @@ VimToolbar::AddButton(int32 index, vimmenu_T *menu) } bool -VimToolbar::RemoveButton(vimmenu_T *menu) +MNVToolbar::RemoveButton(mnvmenu_T *menu) { if (menu->button) { if (fButtonsList.RemoveItem(menu->button)) { @@ -2965,7 +2965,7 @@ VimToolbar::RemoveButton(vimmenu_T *menu) } bool -VimToolbar::GrayButton(vimmenu_T *menu, int grey) +MNVToolbar::GrayButton(mnvmenu_T *menu, int grey) { if (menu->button) { int32 index = fButtonsList.IndexOf(menu->button); @@ -2976,7 +2976,7 @@ VimToolbar::GrayButton(vimmenu_T *menu, int grey) } void -VimToolbar::InvalidateLayout() +MNVToolbar::InvalidateLayout() { int32 offset = ToolbarMargin; int32 count = fButtonsList.CountItems(); @@ -2995,7 +2995,7 @@ VimToolbar::InvalidateLayout() #if defined(FEAT_GUI_TABLINE) float -VimTabLine::TablineHeight() const +MNVTabLine::TablineHeight() const { // float size = NULL == normalButtonsBitmap ? 18. : normalButtonsBitmap->Bounds().Height(); // return size + ToolbarMargin * 2 + ButtonMargin * 2 + 1; @@ -3003,7 +3003,7 @@ VimTabLine::TablineHeight() const } void -VimTabLine::MouseDown(BPoint point) +MNVTabLine::MouseDown(BPoint point) { if (!gui_mch_showing_tabline()) return; @@ -3060,18 +3060,18 @@ VimTabLine::MouseDown(BPoint point) if (event < 0) return; - VimTablineMenuMsg tmm; + MNVTablineMenuMsg tmm; tmm.index = index; tmm.event = event; - write_port(gui.vdcmp, VimMsg::TablineMenu, &tmm, sizeof(tmm)); + write_port(gui.vdcmp, MNVMsg::TablineMenu, &tmm, sizeof(tmm)); } void -VimTabLine::VimTab::Select(BView* owner) +MNVTabLine::MNVTab::Select(BView* owner) { BTab::Select(owner); - VimTabLine *tabLine = gui.vimForm->TabLine(); + MNVTabLine *tabLine = gui.mnvForm->TabLine(); if (tabLine != NULL) { int32 i = 0; @@ -3081,9 +3081,9 @@ VimTabLine::VimTab::Select(BView* owner) // printf("%d:%d:%s\n", i, tabLine->CountTabs(), tabLine->TabAt(i)->Label()); if (i < tabLine->CountTabs()) { - VimTablineMsg tm; + MNVTablineMsg tm; tm.index = i + 1; - write_port(gui.vdcmp, VimMsg::Tabline, &tm, sizeof(tm)); + write_port(gui.vdcmp, MNVMsg::Tabline, &tm, sizeof(tm)); } } } @@ -3093,7 +3093,7 @@ VimTabLine::VimTab::Select(BView* owner) // ---------------- ---------------- // some global variables -static char appsig[] = "application/x-vnd.Haiku-Vim-8"; +static char appsig[] = "application/x-vnd.Haiku-MNV-8"; key_map *keyMap; char *keyMapChars; int main_exitcode = 127; @@ -3101,7 +3101,7 @@ int main_exitcode = 127; status_t gui_haiku_process_event(bigtime_t timeout) { - struct VimMsg vm; + struct MNVMsg vm; int32 what; ssize_t size; @@ -3110,7 +3110,7 @@ gui_haiku_process_event(bigtime_t timeout) if (size >= 0) { switch (what) { - case VimMsg::Key: + case MNVMsg::Key: { char_u *string = vm.u.Key.chars; int len = vm.u.Key.length; @@ -3144,10 +3144,10 @@ gui_haiku_process_event(bigtime_t timeout) add_to_input_buf(string, len); } break; - case VimMsg::Resize: + case MNVMsg::Resize: gui_resize_shell(vm.u.NewSize.width, vm.u.NewSize.height); break; - case VimMsg::ScrollBar: + case MNVMsg::ScrollBar: { /* * If loads of scroll messages queue up, use only the last @@ -3163,16 +3163,16 @@ gui_haiku_process_event(bigtime_t timeout) } break; #if defined(FEAT_MENU) - case VimMsg::Menu: + case MNVMsg::Menu: gui_menu_cb(vm.u.Menu.guiMenu); break; #endif - case VimMsg::Mouse: + case MNVMsg::Mouse: { int32 oldCount; if (vm.u.Mouse.button == MOUSE_DRAG) oldCount = - atomic_add(&gui.vimTextArea->mouseDragEventCount, -1); + atomic_add(&gui.mnvTextArea->mouseDragEventCount, -1); else oldCount = 0; if (oldCount <= 1) @@ -3181,12 +3181,12 @@ gui_haiku_process_event(bigtime_t timeout) vm.u.Mouse.modifiers); } break; - case VimMsg::MouseMoved: + case MNVMsg::MouseMoved: { gui_mouse_moved(vm.u.MouseMoved.x, vm.u.MouseMoved.y); } break; - case VimMsg::Focus: + case MNVMsg::Focus: gui.in_focus = vm.u.Focus.active; // XXX Signal that scrollbar dragging has stopped? // This is needed because we don't get a MouseUp if @@ -3196,13 +3196,13 @@ gui_haiku_process_event(bigtime_t timeout) } // gui_update_cursor(TRUE, FALSE); break; - case VimMsg::Refs: + case MNVMsg::Refs: ::RefsReceived(vm.u.Refs.message, vm.u.Refs.changedir); break; - case VimMsg::Tabline: + case MNVMsg::Tabline: send_tabline_event(vm.u.Tabline.index); break; - case VimMsg::TablineMenu: + case MNVMsg::TablineMenu: send_tabline_menu_event(vm.u.TablineMenu.index, vm.u.TablineMenu.event); break; default: @@ -3231,16 +3231,16 @@ gui_haiku_process_event(bigtime_t timeout) */ int -vim_lock_screen() +mnv_lock_screen() { - return !gui.vimWindow || gui.vimWindow->Lock(); + return !gui.mnvWindow || gui.mnvWindow->Lock(); } void -vim_unlock_screen() +mnv_unlock_screen() { - if (gui.vimWindow) - gui.vimWindow->Unlock(); + if (gui.mnvWindow) + gui.mnvWindow->Unlock(); } #define RUN_BAPPLICATION_IN_NEW_THREAD 0 @@ -3248,11 +3248,11 @@ vim_unlock_screen() #if RUN_BAPPLICATION_IN_NEW_THREAD int32 -run_vimapp(void *args) +run_mnvapp(void *args) { - VimApp app(appsig); + MNVApp app(appsig); - gui.vimApp = &app; + gui.mnvApp = &app; app.Run(); // Run until Quit() called return 0; @@ -3272,7 +3272,7 @@ call_main(void *args) /* * Parse the GUI related command-line arguments. Any arguments used are * deleted from argv, and *argc is decremented accordingly. This is called - * when vim is started, whether or not the GUI has been started. + * when mnv is started, whether or not the GUI has been started. */ void gui_mch_prepare( @@ -3283,15 +3283,15 @@ gui_mch_prepare( * We don't have any command line arguments for the BeOS GUI yet, * but this is an excellent place to create our Application object. */ - if (!gui.vimApp) { + if (!gui.mnvApp) { thread_info tinfo; get_thread_info(find_thread(NULL), &tinfo); // May need the port very early on to process RefsReceived() - gui.vdcmp = create_port(B_MAX_PORT_COUNT, "vim VDCMP"); + gui.vdcmp = create_port(B_MAX_PORT_COUNT, "mnv VDCMP"); #if RUN_BAPPLICATION_IN_NEW_THREAD - thread_id tid = spawn_thread(run_vimapp, "vim VimApp", + thread_id tid = spawn_thread(run_mnvapp, "mnv MNVApp", tinfo.priority, NULL); if (tid >= B_OK) { resume_thread(tid); @@ -3300,18 +3300,18 @@ gui_mch_prepare( } #else MainArgs ma = { *argc, argv }; - thread_id tid = spawn_thread(call_main, "vim main()", + thread_id tid = spawn_thread(call_main, "mnv main()", tinfo.priority, &ma); if (tid >= B_OK) { - VimApp app(appsig); + MNVApp app(appsig); - gui.vimApp = &app; + gui.mnvApp = &app; resume_thread(tid); /* * This is rather horrible. * call_main will call main() again... * There will be no infinite recursion since - * gui.vimApp is set now. + * gui.mnvApp is set now. */ app.Run(); // Run until Quit() called // fprintf(stderr, "app.Run() returned...\n"); @@ -3319,7 +3319,7 @@ gui_mch_prepare( (void)wait_for_thread(tid, &dummy_exitcode); /* - * This path should be the normal one taken to exit Vim. + * This path should be the normal one taken to exit MNV. * The main() thread calls mch_exit() which calls * gui_mch_exit() which terminates its thread. */ @@ -3334,14 +3334,14 @@ gui_mch_prepare( * XXX Try to determine whether we were started from * the Tracker or the terminal. * It would be nice to have this work, because the Tracker - * follows symlinks, so even if you double-click on gvim, - * when it is a link to vim it will still pass a command name - * of vim... + * follows symlinks, so even if you double-click on gmnv, + * when it is a link to mnv it will still pass a command name + * of mnv... * We try here to see if stdin comes from /dev/null. If so, * (or if there is an error, which should never happen) start the GUI. - * This does the wrong thing for vim - Run(); // Run() unlocks but does not show + gui.mnvWindow->Run(); // Run() unlocks but does not show - // Get the colors from the "Normal" group (set in syntax.c or in a vimrc + // Get the colors from the "Normal" group (set in syntax.c or in a mnvrc // file) set_normal_colors(); @@ -3421,11 +3421,11 @@ gui_mch_new_colors() { rgb_color rgb = GUI_TO_RGB(gui.back_pixel); - if (gui.vimWindow->Lock()) { - gui.vimForm->SetViewColor(rgb); + if (gui.mnvWindow->Lock()) { + gui.mnvForm->SetViewColor(rgb); // Does this not have too much effect for those small rectangles? - gui.vimForm->Invalidate(); - gui.vimWindow->Unlock(); + gui.mnvForm->Invalidate(); + gui.mnvWindow->Unlock(); } } @@ -3439,9 +3439,9 @@ gui_mch_open() gui_mch_set_winpos(gui_win_x, gui_win_y); // Actually open the window - if (gui.vimWindow->Lock()) { - gui.vimWindow->Show(); - gui.vimWindow->Unlock(); + if (gui.mnvWindow->Lock()) { + gui.mnvWindow->Show(); + gui.mnvWindow->Unlock(); return OK; } @@ -3449,12 +3449,12 @@ gui_mch_open() } void -gui_mch_exit(int vim_exitcode) +gui_mch_exit(int mnv_exitcode) { - if (gui.vimWindow) { - thread_id tid = gui.vimWindow->Thread(); - gui.vimWindow->Lock(); - gui.vimWindow->Quit(); + if (gui.mnvWindow) { + thread_id tid = gui.mnvWindow->Thread(); + gui.mnvWindow->Lock(); + gui.mnvWindow->Quit(); // Wait until it is truly gone int32 exitcode; wait_for_thread(tid, &exitcode); @@ -3468,23 +3468,23 @@ gui_mch_exit(int vim_exitcode) * called in time (race condition). */ #endif - if (gui.vimApp) { - VimTextAreaView::guiBlankMouse(false); + if (gui.mnvApp) { + MNVTextAreaView::guiBlankMouse(false); - main_exitcode = vim_exitcode; + main_exitcode = mnv_exitcode; #if RUN_BAPPLICATION_IN_NEW_THREAD - thread_id tid = gui.vimApp->Thread(); + thread_id tid = gui.mnvApp->Thread(); int32 exitcode; - gui.vimApp->Lock(); - gui.vimApp->Quit(); - gui.vimApp->Unlock(); + gui.mnvApp->Lock(); + gui.mnvApp->Quit(); + gui.mnvApp->Unlock(); wait_for_thread(tid, &exitcode); #else - gui.vimApp->Lock(); - gui.vimApp->Quit(); - gui.vimApp->Unlock(); + gui.mnvApp->Lock(); + gui.mnvApp->Quit(); + gui.mnvApp->Unlock(); // suicide - exit_thread(vim_exitcode); + exit_thread(mnv_exitcode); #endif } // If we are somehow still here, let mch_exit() handle things. @@ -3496,10 +3496,10 @@ gui_mch_exit(int vim_exitcode) int gui_mch_get_winpos(int *x, int *y) { - if (gui.vimWindow->Lock()) { + if (gui.mnvWindow->Lock()) { BRect r; - r = gui.vimWindow->Frame(); - gui.vimWindow->Unlock(); + r = gui.mnvWindow->Frame(); + gui.mnvWindow->Unlock(); *x = (int)r.left; *y = (int)r.top; return OK; @@ -3515,9 +3515,9 @@ gui_mch_get_winpos(int *x, int *y) void gui_mch_set_winpos(int x, int y) { - if (gui.vimWindow->Lock()) { - gui.vimWindow->MoveTo(x, y); - gui.vimWindow->Unlock(); + if (gui.mnvWindow->Lock()) { + gui.mnvWindow->MoveTo(x, y); + gui.mnvWindow->Unlock(); } } @@ -3535,25 +3535,25 @@ gui_mch_set_shellsize( int direction) // TODO: utilize? { /* - * We are basically given the size of the VimForm, if I understand + * We are basically given the size of the MNVForm, if I understand * correctly. Since it fills the window completely, this will also * be the size of the window. */ - if (gui.vimWindow->Lock()) { - gui.vimWindow->ResizeTo(width - PEN_WIDTH, height - PEN_WIDTH); + if (gui.mnvWindow->Lock()) { + gui.mnvWindow->ResizeTo(width - PEN_WIDTH, height - PEN_WIDTH); // set size limits float minWidth, maxWidth, minHeight, maxHeight; - gui.vimWindow->GetSizeLimits(&minWidth, &maxWidth, + gui.mnvWindow->GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight); - gui.vimWindow->SetSizeLimits(min_width, maxWidth, + gui.mnvWindow->SetSizeLimits(min_width, maxWidth, min_height, maxHeight); /* * Set the resizing alignment depending on font size. */ - gui.vimWindow->SetWindowAlignment( + gui.mnvWindow->SetWindowAlignment( B_PIXEL_ALIGNMENT, // window_alignment mode, 1, // int32 h, 0, // int32 hOffset = 0, @@ -3565,7 +3565,7 @@ gui_mch_set_shellsize( base_height // int32 heightOffset = 0 ); - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } } @@ -3577,7 +3577,7 @@ gui_mch_get_screen_dimensions( BRect frame; { - BScreen screen(gui.vimWindow); + BScreen screen(gui.mnvWindow); if (screen.IsValid()) { frame = screen.Frame(); @@ -3603,20 +3603,20 @@ gui_mch_set_text_area_pos( int w, int h) { - if (!gui.vimTextArea) + if (!gui.mnvTextArea) return; - if (gui.vimWindow->Lock()) { - gui.vimTextArea->MoveTo(x, y); - gui.vimTextArea->ResizeTo(w - PEN_WIDTH, h - PEN_WIDTH); + if (gui.mnvWindow->Lock()) { + gui.mnvTextArea->MoveTo(x, y); + gui.mnvTextArea->ResizeTo(w - PEN_WIDTH, h - PEN_WIDTH); #ifdef FEAT_GUI_TABLINE - if (gui.vimForm->TabLine() != NULL) { - gui.vimForm->TabLine()->ResizeTo(w, gui.vimForm->TablineHeight()); + if (gui.mnvForm->TabLine() != NULL) { + gui.mnvForm->TabLine()->ResizeTo(w, gui.mnvForm->TablineHeight()); } #endif // FEAT_GUI_TABLINE - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } } @@ -3630,8 +3630,8 @@ gui_mch_enable_scrollbar( scrollbar_T *sb, int flag) { - VimScrollBar *vsb = sb->id; - if (gui.vimWindow->Lock()) { + MNVScrollBar *vsb = sb->id; + if (gui.mnvWindow->Lock()) { /* * This function is supposed to be idempotent, but Show()/Hide() * is not. Therefore we test if they are needed. @@ -3645,7 +3645,7 @@ gui_mch_enable_scrollbar( vsb->Hide(); } } - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } } @@ -3656,8 +3656,8 @@ gui_mch_set_scrollbar_thumb( int size, int max) { - if (gui.vimWindow->Lock()) { - VimScrollBar *s = sb->id; + if (gui.mnvWindow->Lock()) { + MNVScrollBar *s = sb->id; if (max == 0) { s->SetValue(0); s->SetRange(0.0, 0.0); @@ -3686,7 +3686,7 @@ gui_mch_set_scrollbar_thumb( s->SetValue(val); } } - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } } @@ -3698,14 +3698,14 @@ gui_mch_set_scrollbar_pos( int w, int h) { - if (gui.vimWindow->Lock()) { - BRect winb = gui.vimWindow->Bounds(); + if (gui.mnvWindow->Lock()) { + BRect winb = gui.mnvWindow->Bounds(); float vsbx = x, vsby = y; - VimScrollBar *vsb = sb->id; + MNVScrollBar *vsb = sb->id; vsb->ResizeTo(w - PEN_WIDTH, h - PEN_WIDTH); if (winb.right-(x+w)MoveTo(vsbx, vsby); - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } } @@ -3733,12 +3733,12 @@ gui_mch_create_scrollbar( orientation posture = (orient == SBAR_HORIZ) ? B_HORIZONTAL : B_VERTICAL; - VimScrollBar *vsb = sb->id = new VimScrollBar(sb, posture); - if (gui.vimWindow->Lock()) { - vsb->SetTarget(gui.vimTextArea); + MNVScrollBar *vsb = sb->id = new MNVScrollBar(sb, posture); + if (gui.mnvWindow->Lock()) { + vsb->SetTarget(gui.mnvTextArea); vsb->Hide(); - gui.vimForm->AddChild(vsb); - gui.vimWindow->Unlock(); + gui.mnvForm->AddChild(vsb); + gui.mnvWindow->Unlock(); } } @@ -3747,10 +3747,10 @@ void gui_mch_destroy_scrollbar( scrollbar_T *sb) { - if (gui.vimWindow->Lock()) { + if (gui.mnvWindow->Lock()) { sb->id->RemoveSelf(); delete sb->id; - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } } #endif @@ -3832,7 +3832,7 @@ gui_mch_start_blink() } /* - * Initialise vim to use the font with the given name. Return FAIL if the font + * Initialise mnv to use the font with the given name. Return FAIL if the font * could not be loaded, OK otherwise. */ int @@ -3840,10 +3840,10 @@ gui_mch_init_font( char_u *font_name, int fontset) { - if (gui.vimWindow->Lock()) + if (gui.mnvWindow->Lock()) { - int rc = gui.vimTextArea->mchInitFont(font_name); - gui.vimWindow->Unlock(); + int rc = gui.mnvTextArea->mchInitFont(font_name); + gui.mnvWindow->Unlock(); return rc; } @@ -3863,8 +3863,8 @@ gui_mch_adjust_charsize() gui_mch_font_dialog(font_family* family, font_style* style, float* size) { #if defined(FEAT_GUI_DIALOG) - // gui.vimWindow->Unlock(); - VimSelectFontDialog *dialog = new VimSelectFontDialog(family, style, size); + // gui.mnvWindow->Unlock(); + MNVSelectFontDialog *dialog = new MNVSelectFontDialog(family, style, size); bool ret = dialog->Go(); delete dialog; return ret; @@ -3879,7 +3879,7 @@ gui_mch_get_font( char_u *name, int giveErrorIfMissing) { - static VimFont *fontList = NULL; + static MNVFont *fontList = NULL; if (!gui.in_use) // can't do this when GUI not running return NOFONT; @@ -3908,7 +3908,7 @@ gui_mch_get_font( if (font_name[0] == 0) { be_fixed_font->GetFamilyAndStyle(&family, &style); size = be_fixed_font->Size(); - vim_snprintf(font_name, buff_size, + mnv_snprintf(font_name, buff_size, (char*)"%s/%s/%.0f", family, style, size); } @@ -3930,7 +3930,7 @@ gui_mch_get_font( if (gui_mch_font_dialog(&family, &style, &size) == NOFONT) return FAIL; // compose for further processing - vim_snprintf(font_name, buff_size, + mnv_snprintf(font_name, buff_size, (char*)"%s/%s/%.0f", family, style, size); hl_set_font_name((char_u*)font_name); @@ -3938,7 +3938,7 @@ gui_mch_get_font( char_u* new_p_guifont = (char_u*)alloc(STRLEN(font_name) + 1); if (new_p_guifont != NULL) { STRCPY(new_p_guifont, font_name); - vim_free(p_guifont); + mnv_free(p_guifont); p_guifont = new_p_guifont; // Replace spaces in the font name with underscores. for ( ; *new_p_guifont; ++new_p_guifont) @@ -3947,7 +3947,7 @@ gui_mch_get_font( } } - VimFont *flp; + MNVFont *flp; for (flp = fontList; flp; flp = flp->next) { if (STRCMP(font_name, flp->name) == 0) { flp->refcount++; @@ -3955,8 +3955,8 @@ gui_mch_get_font( } } - VimFont *font = new VimFont(); - font->name = vim_strsave((char_u*)font_name); + MNVFont *font = new MNVFont(); + font->name = mnv_strsave((char_u*)font_name); if (count_font_styles(family) <= 0) { if (giveErrorIfMissing) @@ -3986,10 +3986,10 @@ void gui_mch_set_font( GuiFont font) { - if (gui.vimWindow->Lock()) { - VimFont *vf = (VimFont *)font; + if (gui.mnvWindow->Lock()) { + MNVFont *vf = (MNVFont *)font; - gui.vimTextArea->SetFont(vf); + gui.mnvTextArea->SetFont(vf); gui.char_width = (int) vf->StringWidth("n"); font_height fh; @@ -3998,7 +3998,7 @@ gui_mch_set_font( + (int)(fh.descent + 0.9999) + (int)(fh.leading + 0.9999); gui.char_ascent = (int)(fh.ascent + 0.9999); - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } } @@ -4009,10 +4009,10 @@ gui_mch_free_font( { if (font == NOFONT) return; - VimFont *f = (VimFont *)font; + MNVFont *f = (MNVFont *)font; if (--f->refcount <= 0) { if (f->refcount < 0) - fprintf(stderr, "VimFont: refcount < 0\n"); + fprintf(stderr, "MNVFont: refcount < 0\n"); delete f; } } @@ -4022,7 +4022,7 @@ gui_mch_get_fontname(GuiFont font, char_u *name) { if (name == NULL) return NULL; - return vim_strsave(name); + return mnv_strsave(name); } /* @@ -4044,7 +4044,7 @@ gui_mch_adjust_charheight() // else // #endif { - VimFont *font = (VimFont *)gui.norm_font; + MNVFont *font = (MNVFont *)gui.norm_font; font_height fh = {0}; font->GetHeight(&fh); gui.char_height = (int)(fh.ascent + fh.descent + 0.5) + p_linespace; @@ -4100,9 +4100,9 @@ gui_mch_set_fg_color( guicolor_T color) { rgb_color rgb = GUI_TO_RGB(color); - if (gui.vimWindow->Lock()) { - gui.vimTextArea->SetHighColor(rgb); - gui.vimWindow->Unlock(); + if (gui.mnvWindow->Lock()) { + gui.mnvTextArea->SetHighColor(rgb); + gui.mnvWindow->Unlock(); } } @@ -4114,9 +4114,9 @@ gui_mch_set_bg_color( guicolor_T color) { rgb_color rgb = GUI_TO_RGB(color); - if (gui.vimWindow->Lock()) { - gui.vimTextArea->SetLowColor(rgb); - gui.vimWindow->Unlock(); + if (gui.mnvWindow->Lock()) { + gui.mnvTextArea->SetLowColor(rgb); + gui.mnvWindow->Unlock(); } } @@ -4137,9 +4137,9 @@ gui_mch_draw_string( int len, int flags) { - if (gui.vimWindow->Lock()) { - gui.vimTextArea->mchDrawString(row, col, s, len, flags); - gui.vimWindow->Unlock(); + if (gui.mnvWindow->Lock()) { + gui.mnvTextArea->mchDrawString(row, col, s, len, flags); + gui.mnvWindow->Unlock(); } } @@ -4158,8 +4158,8 @@ gui_mch_haskey( int i; for (i = 0; special_keys[i].BeKeys != 0; i++) - if (name[0] == special_keys[i].vim_code0 && - name[1] == special_keys[i].vim_code1) + if (name[0] == special_keys[i].mnv_code0 && + name[1] == special_keys[i].mnv_code1) return OK; return FAIL; } @@ -4175,17 +4175,17 @@ gui_mch_flash(int msec) { // Do a visual beep by reversing the foreground and background colors - if (gui.vimWindow->Lock()) { - BRect rect = gui.vimTextArea->Bounds(); + if (gui.mnvWindow->Lock()) { + BRect rect = gui.mnvTextArea->Bounds(); - gui.vimTextArea->SetDrawingMode(B_OP_INVERT); - gui.vimTextArea->FillRect(rect); - gui.vimTextArea->Sync(); + gui.mnvTextArea->SetDrawingMode(B_OP_INVERT); + gui.mnvTextArea->FillRect(rect); + gui.mnvTextArea->Sync(); snooze(msec * 1000); // wait for a few msec - gui.vimTextArea->FillRect(rect); - gui.vimTextArea->SetDrawingMode(B_OP_COPY); - gui.vimTextArea->Flush(); - gui.vimWindow->Unlock(); + gui.mnvTextArea->FillRect(rect); + gui.mnvTextArea->SetDrawingMode(B_OP_COPY); + gui.mnvTextArea->Flush(); + gui.mnvWindow->Unlock(); } } @@ -4205,11 +4205,11 @@ gui_mch_invert_rectangle( rect.right = rect.left + nc * gui.char_width - PEN_WIDTH; rect.bottom = rect.top + nr * gui.char_height - PEN_WIDTH; - if (gui.vimWindow->Lock()) { - gui.vimTextArea->SetDrawingMode(B_OP_INVERT); - gui.vimTextArea->FillRect(rect); - gui.vimTextArea->SetDrawingMode(B_OP_COPY); - gui.vimWindow->Unlock(); + if (gui.mnvWindow->Lock()) { + gui.mnvTextArea->SetDrawingMode(B_OP_INVERT); + gui.mnvTextArea->FillRect(rect); + gui.mnvTextArea->SetDrawingMode(B_OP_COPY); + gui.mnvWindow->Unlock(); } } @@ -4219,15 +4219,15 @@ gui_mch_invert_rectangle( void gui_mch_iconify() { - if (gui.vimWindow->Lock()) { - gui.vimWindow->Minimize(true); - gui.vimWindow->Unlock(); + if (gui.mnvWindow->Lock()) { + gui.mnvWindow->Minimize(true); + gui.mnvWindow->Unlock(); } } #if defined(FEAT_EVAL) /* - * Bring the Vim window to the foreground. + * Bring the MNV window to the foreground. */ void gui_mch_set_foreground(void) @@ -4244,9 +4244,9 @@ gui_mch_settitle( char_u *title, char_u *icon) { - if (gui.vimWindow->Lock()) { - gui.vimWindow->SetTitle((char *)title); - gui.vimWindow->Unlock(); + if (gui.mnvWindow->Lock()) { + gui.mnvWindow->SetTitle((char *)title); + gui.mnvWindow->Unlock(); } } @@ -4266,9 +4266,9 @@ gui_mch_draw_hollow_cursor(guicolor_T color) r.right = r.left + cells*gui.char_width - PEN_WIDTH; r.bottom = r.top + gui.char_height - PEN_WIDTH; - if (gui.vimWindow->Lock()) { - gui.vimTextArea->StrokeRect(r); - gui.vimWindow->Unlock(); + if (gui.mnvWindow->Lock()) { + gui.mnvTextArea->StrokeRect(r); + gui.mnvWindow->Unlock(); // gui_mch_flush(); } } @@ -4295,9 +4295,9 @@ gui_mch_draw_part_cursor( r.bottom = FILL_Y(gui.row + 1) - PEN_WIDTH; r.top = r.bottom - h + PEN_WIDTH; - if (gui.vimWindow->Lock()) { - gui.vimTextArea->FillRect(r); - gui.vimWindow->Unlock(); + if (gui.mnvWindow->Lock()) { + gui.mnvTextArea->FillRect(r); + gui.mnvWindow->Unlock(); // gui_mch_flush(); } } @@ -4313,7 +4313,7 @@ gui_mch_update() { gui_mch_flush(); while (port_count(gui.vdcmp) > 0 && - !vim_is_input_buf_full() && + !mnv_is_input_buf_full() && gui_haiku_process_event(0) >= B_OK) /* nothing */ ; } @@ -4419,9 +4419,9 @@ gui_mch_wait_for_chars( gui_mch_flush() { // does this need to lock the window? Apparently not but be safe. - if (gui.vimWindow->Lock()) { - gui.vimWindow->Flush(); - gui.vimWindow->Unlock(); + if (gui.mnvWindow->Lock()) { + gui.mnvWindow->Flush(); + gui.mnvWindow->Unlock(); } return; } @@ -4437,18 +4437,18 @@ gui_mch_clear_block( int row2, int col2) { - if (gui.vimWindow->Lock()) { - gui.vimTextArea->mchClearBlock(row1, col1, row2, col2); - gui.vimWindow->Unlock(); + if (gui.mnvWindow->Lock()) { + gui.mnvTextArea->mchClearBlock(row1, col1, row2, col2); + gui.mnvWindow->Unlock(); } } void gui_mch_clear_all() { - if (gui.vimWindow->Lock()) { - gui.vimTextArea->mchClearAll(); - gui.vimWindow->Unlock(); + if (gui.mnvWindow->Lock()) { + gui.mnvTextArea->mchClearAll(); + gui.mnvWindow->Unlock(); } } @@ -4461,7 +4461,7 @@ gui_mch_delete_lines( int row, int num_lines) { - gui.vimTextArea->mchDeleteLines(row, num_lines); + gui.mnvTextArea->mchDeleteLines(row, num_lines); } /* @@ -4473,7 +4473,7 @@ gui_mch_insert_lines( int row, int num_lines) { - gui.vimTextArea->mchInsertLines(row, num_lines); + gui.mnvTextArea->mchInsertLines(row, num_lines); } #if defined(FEAT_MENU) @@ -4485,11 +4485,11 @@ void gui_mch_enable_menu( int flag) { - if (gui.vimWindow->Lock()) + if (gui.mnvWindow->Lock()) { - BMenuBar *menubar = gui.vimForm->MenuBar(); + BMenuBar *menubar = gui.mnvForm->MenuBar(); menubar->SetEnabled(flag); - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } } @@ -4508,10 +4508,10 @@ gui_mch_set_menu_pos( */ void gui_mch_add_menu( - vimmenu_T *menu, + mnvmenu_T *menu, int idx) { - vimmenu_T *parent = menu->parent; + mnvmenu_T *parent = menu->parent; // popup menu - just create it unattached if (menu_is_popup(menu->name) && parent == NULL) { @@ -4525,7 +4525,7 @@ gui_mch_add_menu( || (parent != NULL && parent->submenu_id == NULL)) return; - if (gui.vimWindow->Lock()) + if (gui.mnvWindow->Lock()) { // Major re-write of the menu code, it was failing with memory corruption when // we started loading multiple files (the Buffer menu) @@ -4540,7 +4540,7 @@ gui_mch_add_menu( if ( parent ) tmp = parent->submenu_id; else - tmp = gui.vimForm->MenuBar(); + tmp = gui.mnvForm->MenuBar(); // make sure we don't try and add the same menu twice. The Buffers menu tries to // do this and Be starts to crash... @@ -4557,7 +4557,7 @@ gui_mch_add_menu( menu->id = tmp->FindItem((const char *) menu->dname); } - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } } @@ -4568,10 +4568,10 @@ gui_mch_toggle_tearoffs(int enable) } static BMessage * -MenuMessage(vimmenu_T *menu) +MenuMessage(mnvmenu_T *menu) { BMessage *m = new BMessage('menu'); - m->AddPointer("VimMenu", (void *)menu); + m->AddPointer("MNVMenu", (void *)menu); return m; } @@ -4581,23 +4581,23 @@ MenuMessage(vimmenu_T *menu) */ void gui_mch_add_menu_item( - vimmenu_T *menu, + mnvmenu_T *menu, int idx) { int mnemonic = 0; - vimmenu_T *parent = menu->parent; + mnvmenu_T *parent = menu->parent; // TODO: use menu->actext // This is difficult, since on Be, an accelerator must be a single char - // and a lot of Vim ones are the standard VI commands. + // and a lot of MNV ones are the standard VI commands. // // Punt for Now... // richard@whiequeen.com jul 99 - if (gui.vimWindow->Lock()) + if (gui.mnvWindow->Lock()) { #ifdef FEAT_TOOLBAR if (menu_is_toolbar(parent->name)) { - VimToolbar *toolbar = gui.vimForm->ToolBar(); + MNVToolbar *toolbar = gui.mnvForm->ToolBar(); if (toolbar != NULL) { toolbar->AddButton(idx, menu); } @@ -4614,14 +4614,14 @@ gui_mch_add_menu_item( else { BMenuItem *item = new BMenuItem((char *)menu->dname, MenuMessage(menu)); - item->SetTarget(gui.vimTextArea); + item->SetTarget(gui.mnvTextArea); item->SetTrigger((char) menu->mnemonic); parent->submenu_id->AddItem(item); menu->id = item; menu->submenu_id = NULL; } } - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } } @@ -4630,13 +4630,13 @@ gui_mch_add_menu_item( */ void gui_mch_destroy_menu( - vimmenu_T *menu) + mnvmenu_T *menu) { - if (gui.vimWindow->Lock()) + if (gui.mnvWindow->Lock()) { #ifdef FEAT_TOOLBAR if (menu->parent && menu_is_toolbar(menu->parent->name)) { - VimToolbar *toolbar = gui.vimForm->ToolBar(); + MNVToolbar *toolbar = gui.mnvForm->ToolBar(); if (toolbar != NULL) { toolbar->RemoveButton(menu); } @@ -4659,7 +4659,7 @@ gui_mch_destroy_menu( * If we removed the last item from the menu bar, * resize it out of sight. */ - if (bmenu == gui.vimForm->MenuBar() && bmenu->CountItems() == 0) + if (bmenu == gui.mnvForm->MenuBar() && bmenu->CountItems() == 0) { bmenu->ResizeTo(-MENUBAR_MARGIN, -MENUBAR_MARGIN); } @@ -4668,9 +4668,9 @@ gui_mch_destroy_menu( menu->id = NULL; menu->submenu_id = NULL; - gui.menu_height = (int) gui.vimForm->MenuHeight(); + gui.menu_height = (int) gui.mnvForm->MenuHeight(); } - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } } @@ -4679,17 +4679,17 @@ gui_mch_destroy_menu( */ void gui_mch_menu_grey( - vimmenu_T *menu, + mnvmenu_T *menu, int grey) { #ifdef FEAT_TOOLBAR if (menu->parent && menu_is_toolbar(menu->parent->name)) { - if (gui.vimWindow->Lock()) { - VimToolbar *toolbar = gui.vimForm->ToolBar(); + if (gui.mnvWindow->Lock()) { + MNVToolbar *toolbar = gui.mnvForm->ToolBar(); if (toolbar != NULL) { toolbar->GrayButton(menu, grey); } - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } } else #endif @@ -4702,7 +4702,7 @@ gui_mch_menu_grey( */ void gui_mch_menu_hidden( - vimmenu_T *menu, + mnvmenu_T *menu, int hidden) { if (menu->id != NULL) @@ -4719,7 +4719,7 @@ gui_mch_draw_menubar() } void -gui_mch_show_popupmenu(vimmenu_T *menu) +gui_mch_show_popupmenu(mnvmenu_T *menu) { if (!menu_is_popup(menu->name) || menu->submenu_id == NULL) return; @@ -4729,11 +4729,11 @@ gui_mch_show_popupmenu(vimmenu_T *menu) return; BPoint point; - if (gui.vimWindow->Lock()) { + if (gui.mnvWindow->Lock()) { uint32 buttons = 0; - gui.vimTextArea->GetMouse(&point, &buttons); - gui.vimTextArea->ConvertToScreen(&point); - gui.vimWindow->Unlock(); + gui.mnvTextArea->GetMouse(&point, &buttons); + gui.mnvTextArea->ConvertToScreen(&point); + gui.mnvWindow->Unlock(); } popupMenu->Go(point, true); } @@ -4747,7 +4747,7 @@ gui_mch_show_popupmenu(vimmenu_T *menu) * Clipboard stuff, for cutting and pasting text to other windows. */ char textplain[] = "text/plain"; -char vimselectiontype[] = "application/x-vnd.Rhialto-Vim-selectiontype"; +char mnvselectiontype[] = "application/x-vnd.Rhialto-MNV-selectiontype"; /* * Get the current selection and put it in the clipboard register. @@ -4775,9 +4775,9 @@ clip_mch_request_selection(Clipboard_T *cbd) ssize_t seltypelen; /* - * Try to get the special vim selection type first + * Try to get the special mnv selection type first */ - if (m->FindData(vimselectiontype, B_MIME_TYPE, + if (m->FindData(mnvselectiontype, B_MIME_TYPE, (const void **)&seltype, &seltypelen) == B_OK) { switch (*seltype) @@ -4801,7 +4801,7 @@ clip_mch_request_selection(Clipboard_T *cbd) } } /* - * Make vim the owner of the current selection. + * Make mnv the owner of the current selection. */ void clip_mch_lose_selection(Clipboard_T *cbd) @@ -4810,7 +4810,7 @@ clip_mch_lose_selection(Clipboard_T *cbd) } /* - * Make vim the owner of the current selection. Return OK upon success. + * Make mnv the owner of the current selection. Return OK upon success. */ int clip_mch_own_selection(Clipboard_T *cbd) @@ -4861,9 +4861,9 @@ clip_mch_set_selection(Clipboard_T *cbd) case MBLOCK: vtype = 'B'; break; #endif } - m->AddData(vimselectiontype, B_MIME_TYPE, (void *)&vtype, 1); + m->AddData(mnvselectiontype, B_MIME_TYPE, (void *)&vtype, 1); - vim_free(str); + mnv_free(str); be_clipboard->Commit(); be_clipboard->Unlock(); @@ -4900,33 +4900,33 @@ gui_mch_browse( char_u *initdir, char_u *filter) { - gui.vimApp->fFilePanel = new BFilePanel((saving == TRUE) ? B_SAVE_PANEL : B_OPEN_PANEL, + gui.mnvApp->fFilePanel = new BFilePanel((saving == TRUE) ? B_SAVE_PANEL : B_OPEN_PANEL, NULL, NULL, 0, false, new BMessage((saving == TRUE) ? 'save' : 'open'), NULL, true); - gui.vimApp->fBrowsedPath.Unset(); + gui.mnvApp->fBrowsedPath.Unset(); - gui.vimApp->fFilePanel->Window()->SetTitle((char*)title); - gui.vimApp->fFilePanel->SetPanelDirectory((const char*)initdir); + gui.mnvApp->fFilePanel->Window()->SetTitle((char*)title); + gui.mnvApp->fFilePanel->SetPanelDirectory((const char*)initdir); - gui.vimApp->fFilePanel->Show(); + gui.mnvApp->fFilePanel->Show(); - gui.vimApp->fFilePanelSem = create_sem(0, "FilePanelSem"); + gui.mnvApp->fFilePanelSem = create_sem(0, "FilePanelSem"); - while (acquire_sem(gui.vimApp->fFilePanelSem) == B_INTERRUPTED); + while (acquire_sem(gui.mnvApp->fFilePanelSem) == B_INTERRUPTED); char_u *fileName = NULL; - status_t result = gui.vimApp->fBrowsedPath.InitCheck(); + status_t result = gui.mnvApp->fBrowsedPath.InitCheck(); if (result == B_OK) { - fileName = vim_strsave((char_u*)gui.vimApp->fBrowsedPath.Path()); + fileName = mnv_strsave((char_u*)gui.mnvApp->fBrowsedPath.Path()); } else if (result != B_NO_INIT) { fprintf(stderr, "gui_mch_browse: BPath error: %#08x (%s)\n", result, strerror(result)); } - delete gui.vimApp->fFilePanel; - gui.vimApp->fFilePanel = NULL; + delete gui.mnvApp->fFilePanel; + gui.mnvApp->fFilePanel = NULL; return fileName; } @@ -4962,7 +4962,7 @@ gui_mch_dialog( char_u *textfield, int ex_cmd) { - VimDialog *dialog = new VimDialog(type, (char*)title, (char*)message, + MNVDialog *dialog = new MNVDialog(type, (char*)title, (char*)message, (char*)buttons, dfltbutton, (char*)textfield, ex_cmd); bool ret = dialog->Go(); delete dialog; @@ -4995,10 +4995,10 @@ gui_mch_setmouse(int x, int y) void im_set_position(int row, int col) { - if (gui.vimWindow->Lock()) + if (gui.mnvWindow->Lock()) { - gui.vimTextArea->DrawIMString(); - gui.vimWindow->Unlock(); + gui.mnvTextArea->DrawIMString(); + gui.mnvWindow->Unlock(); } return; } @@ -5007,19 +5007,19 @@ im_set_position(int row, int col) void gui_mch_show_toolbar(int showit) { - VimToolbar *toolbar = gui.vimForm->ToolBar(); + MNVToolbar *toolbar = gui.mnvForm->ToolBar(); gui.toolbar_height = (toolbar && showit) ? toolbar->ToolbarHeight() : 0.; } void gui_mch_set_toolbar_pos(int x, int y, int w, int h) { - VimToolbar *toolbar = gui.vimForm->ToolBar(); + MNVToolbar *toolbar = gui.mnvForm->ToolBar(); if (toolbar != NULL) { - if (gui.vimWindow->Lock()) { + if (gui.mnvWindow->Lock()) { toolbar->MoveTo(x, y); toolbar->ResizeTo(w - 1, h - 1); - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } } } @@ -5032,26 +5032,26 @@ gui_mch_set_toolbar_pos(int x, int y, int w, int h) void gui_mch_show_tabline(int showit) { - VimTabLine *tabLine = gui.vimForm->TabLine(); + MNVTabLine *tabLine = gui.mnvForm->TabLine(); if (tabLine == NULL) return; - if (!showit != !gui.vimForm->IsShowingTabLine()) { - gui.vimForm->SetShowingTabLine(showit != 0); - gui.tabline_height = gui.vimForm->TablineHeight(); + if (!showit != !gui.mnvForm->IsShowingTabLine()) { + gui.mnvForm->SetShowingTabLine(showit != 0); + gui.tabline_height = gui.mnvForm->TablineHeight(); } } void gui_mch_set_tabline_pos(int x, int y, int w, int h) { - VimTabLine *tabLine = gui.vimForm->TabLine(); + MNVTabLine *tabLine = gui.mnvForm->TabLine(); if (tabLine != NULL) { - if (gui.vimWindow->Lock()) { + if (gui.mnvWindow->Lock()) { tabLine->MoveTo(x, y); tabLine->ResizeTo(w - 1, h - 1); - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } } } @@ -5062,8 +5062,8 @@ gui_mch_set_tabline_pos(int x, int y, int w, int h) int gui_mch_showing_tabline() { - VimTabLine *tabLine = gui.vimForm->TabLine(); - return tabLine != NULL && gui.vimForm->IsShowingTabLine(); + MNVTabLine *tabLine = gui.mnvForm->TabLine(); + return tabLine != NULL && gui.mnvForm->IsShowingTabLine(); } /* @@ -5076,12 +5076,12 @@ gui_mch_update_tabline() int nr = 0; int curtabidx = 0; - VimTabLine *tabLine = gui.vimForm->TabLine(); + MNVTabLine *tabLine = gui.mnvForm->TabLine(); if (tabLine == NULL) return; - gui.vimWindow->Lock(); + gui.mnvWindow->Lock(); // Add a label for each tab page. They all contain the same text area. for (tp = first_tabpage; tp != NULL; tp = tp->tp_next, ++nr) { @@ -5091,7 +5091,7 @@ gui_mch_update_tabline() BTab* tab = tabLine->TabAt(nr); if (tab == NULL) { - tab = new VimTabLine::VimTab(); + tab = new MNVTabLine::MNVTab(); tabLine->AddTab(NULL, tab); } @@ -5107,7 +5107,7 @@ gui_mch_update_tabline() if (tabLine->Selection() != curtabidx) tabLine->Select(curtabidx); - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } /* @@ -5116,16 +5116,16 @@ gui_mch_update_tabline() void gui_mch_set_curtab(int nr) { - VimTabLine *tabLine = gui.vimForm->TabLine(); + MNVTabLine *tabLine = gui.mnvForm->TabLine(); if (tabLine == NULL) return; - gui.vimWindow->Lock(); + gui.mnvWindow->Lock(); if (tabLine->Selection() != nr -1) tabLine->Select(nr -1); - gui.vimWindow->Unlock(); + gui.mnvWindow->Unlock(); } #endif // FEAT_GUI_TABLINE diff --git a/uvim/src/gui_haiku.h b/uvim/src/gui_haiku.h index ed8ec70f7f..39858e3c9f 100644 --- a/uvim/src/gui_haiku.h +++ b/uvim/src/gui_haiku.h @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * GUI support by Olaf "Rhialto" Seibert * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. * * Haiku GUI. * @@ -24,28 +24,28 @@ struct BMenu; struct BMenuItem; struct BPictureButton; -// Our own Vim-related classes +// Our own MNV-related classes -struct VimApp; -struct VimFormView; -struct VimTextAreaView; -struct VimWindow; -struct VimScrollBar; +struct MNVApp; +struct MNVFormView; +struct MNVTextAreaView; +struct MNVWindow; +struct MNVScrollBar; // Locking functions -extern int vim_lock_screen(); -extern void vim_unlock_screen(); +extern int mnv_lock_screen(); +extern void mnv_unlock_screen(); #ifndef __cplusplus typedef struct BMenu BMenu; typedef struct BMenuItem BMenuItem; typedef struct BPictureButton BPictureButton; -typedef struct VimWindow VimWindow; -typedef struct VimFormView VimFormView; -typedef struct VimTextAreaView VimTextAreaView; -typedef struct VimApp VimApp; -typedef struct VimScrollBar VimScrollBar; +typedef struct MNVWindow MNVWindow; +typedef struct MNVFormView MNVFormView; +typedef struct MNVTextAreaView MNVTextAreaView; +typedef struct MNVApp MNVApp; +typedef struct MNVScrollBar MNVScrollBar; #endif diff --git a/uvim/src/gui_motif.c b/uvim/src/gui_motif.c index 9f4a5856d0..53f15d2a4c 100644 --- a/uvim/src/gui_motif.c +++ b/uvim/src/gui_motif.c @@ -1,14 +1,14 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * GUI/Motif support by Robert Webb * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ -#include "vim.h" +#include "mnv.h" #include #include @@ -61,9 +61,9 @@ #define MOTIF_POPUP -extern Widget vimShell; +extern Widget mnvShell; -static Widget vimForm; +static Widget mnvForm; static Widget textAreaForm; Widget textArea; #ifdef FEAT_TOOLBAR @@ -406,10 +406,10 @@ gui_x11_create_widgets(void) #endif // Make sure the "Quit" menu entry of the window manager is ignored - XtVaSetValues(vimShell, XmNdeleteResponse, XmDO_NOTHING, NULL); + XtVaSetValues(mnvShell, XmNdeleteResponse, XmDO_NOTHING, NULL); - vimForm = XtVaCreateManagedWidget("vimForm", - xmFormWidgetClass, vimShell, + mnvForm = XtVaCreateManagedWidget("mnvForm", + xmFormWidgetClass, mnvShell, XmNborderWidth, 0, XmNhighlightThickness, 0, XmNshadowThickness, 0, @@ -417,7 +417,7 @@ gui_x11_create_widgets(void) XmNmarginHeight, 0, XmNresizePolicy, XmRESIZE_ANY, NULL); - gui_motif_menu_colors(vimForm); + gui_motif_menu_colors(mnvForm); #ifdef FEAT_MENU { @@ -435,7 +435,7 @@ gui_x11_create_widgets(void) XtSetArg(al[ac], XmNrightOffset, 0); ac++; # endif XtSetArg(al[ac], XmNmarginHeight, 0); ac++; - menuBar = XmCreateMenuBar(vimForm, "menuBar", al, ac); + menuBar = XmCreateMenuBar(mnvForm, "menuBar", al, ac); XtManageChild(menuBar); gui_motif_menu_colors(menuBar); @@ -444,10 +444,10 @@ gui_x11_create_widgets(void) #ifdef FEAT_TOOLBAR /* - * Create an empty ToolBar. We should get buttons defined from menu.vim. + * Create an empty ToolBar. We should get buttons defined from menu.mnv. */ toolBarFrame = XtVaCreateWidget("toolBarFrame", - xmFrameWidgetClass, vimForm, + xmFrameWidgetClass, mnvForm, XmNshadowThickness, 0, XmNmarginHeight, 0, XmNmarginWidth, 0, @@ -476,7 +476,7 @@ gui_x11_create_widgets(void) #endif #ifdef FEAT_GUI_TABLINE - // Create the Vim GUI tabline + // Create the MNV GUI tabline n = 0; XtSetArg(args[n], XmNbindingType, XmNONE); n++; XtSetArg(args[n], XmNorientation, XmVERTICAL); n++; @@ -487,7 +487,7 @@ gui_x11_create_widgets(void) XtSetArg(args[n], XmNshadowThickness, 0); n++; XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++; XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++; - tabLine = XmCreateNotebook(vimForm, "Vim tabline", args, n); + tabLine = XmCreateNotebook(mnvForm, "MNV tabline", args, n); XtAddCallback(tabLine, XmNpageChangedCallback, (XtCallbackProc)tabline_cb, NULL); @@ -543,7 +543,7 @@ gui_x11_create_widgets(void) #endif textAreaForm = XtVaCreateManagedWidget("textAreaForm", - xmFormWidgetClass, vimForm, + xmFormWidgetClass, mnvForm, XmNleftAttachment, XmATTACH_FORM, XmNrightAttachment, XmATTACH_FORM, XmNbottomAttachment, XmATTACH_FORM, @@ -575,7 +575,7 @@ gui_x11_create_widgets(void) /* * Install the callbacks. */ - gui_x11_callbacks(textArea, vimForm); + gui_x11_callbacks(textArea, mnvForm); // Pretend we don't have input focus, we will get an event if we do. gui.in_focus = FALSE; @@ -724,12 +724,12 @@ gui_motif_fontset2fontlist(XFontSet *fontset) * Menu stuff. */ -static void gui_motif_add_actext(vimmenu_T *menu); +static void gui_motif_add_actext(mnvmenu_T *menu); # if (XmVersion >= 1002) static void toggle_tearoff(Widget wid); -static void gui_mch_recurse_tearoffs(vimmenu_T *menu); +static void gui_mch_recurse_tearoffs(mnvmenu_T *menu); # endif -static void submenu_change(vimmenu_T *mp, int colors); +static void submenu_change(mnvmenu_T *mp, int colors); static void do_set_mnemonics(int enable); static int menu_enabled = TRUE; @@ -860,7 +860,7 @@ gui_motif_set_mnemonics(int enable) static void do_set_mnemonics(int enable) { - vimmenu_T *menu; + mnvmenu_T *menu; FOR_ALL_MENUS(menu) if (menu->id != (Widget)0) @@ -870,11 +870,11 @@ do_set_mnemonics(int enable) } void -gui_mch_add_menu(vimmenu_T *menu, int idx) +gui_mch_add_menu(mnvmenu_T *menu, int idx) { XmString label; Widget shell; - vimmenu_T *parent = menu->parent; + mnvmenu_T *parent = menu->parent; # ifdef MOTIF_POPUP if (menu_is_popup(menu->name)) @@ -975,7 +975,7 @@ gui_mch_add_menu(vimmenu_T *menu, int idx) * Add mnemonic and accelerator text to a menu button. */ static void -gui_motif_add_actext(vimmenu_T *menu) +gui_motif_add_actext(mnvmenu_T *menu) { XmString label; @@ -1020,7 +1020,7 @@ toggle_tearoff(Widget wid) } static void -gui_mch_recurse_tearoffs(vimmenu_T *menu) +gui_mch_recurse_tearoffs(mnvmenu_T *menu) { while (menu != NULL) { @@ -1055,7 +1055,7 @@ gui_mch_compute_menu_height( { Dimension y, maxy; Dimension margin, shadow; - vimmenu_T *mp; + mnvmenu_T *mp; static Dimension height = 21; // normal height of a menu item /* @@ -1127,7 +1127,7 @@ gui_mch_compute_menu_height( */ # include "gui_x11_pm.h" -static char **get_toolbar_pixmap(vimmenu_T *menu, char **fname); +static char **get_toolbar_pixmap(mnvmenu_T *menu, char **fname); /* * Read an Xpm file. Return OK or FAIL. @@ -1161,7 +1161,7 @@ check_xpm(char_u *path) * Return a blank pixmap if it fails. */ static char ** -get_toolbar_pixmap(vimmenu_T *menu, char **fname) +get_toolbar_pixmap(mnvmenu_T *menu, char **fname) { char_u buf[MAXPATHL]; // buffer storing expanded pathname char **xpm = NULL; // xpm array @@ -1181,7 +1181,7 @@ get_toolbar_pixmap(vimmenu_T *menu, char **fname) res = check_xpm(buf); if (res == OK) { - *fname = (char *)vim_strsave(buf); + *fname = (char *)mnv_strsave(buf); return tb_blank_xpm; } } @@ -1202,9 +1202,9 @@ get_toolbar_pixmap(vimmenu_T *menu, char **fname) * Add arguments for the toolbar pixmap to a menu item. */ static int -add_pixmap_args(vimmenu_T *menu, Arg *args, int n) +add_pixmap_args(mnvmenu_T *menu, Arg *args, int n) { - vim_free(menu->xpm_fname); + mnv_free(menu->xpm_fname); menu->xpm = get_toolbar_pixmap(menu, &menu->xpm_fname); if (menu->xpm == NULL) { @@ -1224,10 +1224,10 @@ add_pixmap_args(vimmenu_T *menu, Arg *args, int n) # endif // FEAT_TOOLBAR void -gui_mch_add_menu_item(vimmenu_T *menu, int idx) +gui_mch_add_menu_item(mnvmenu_T *menu, int idx) { XmString label; - vimmenu_T *parent = menu->parent; + mnvmenu_T *parent = menu->parent; # if (XmVersion <= 1002) // Don't add Popup menu items when the popup menu isn't used. @@ -1253,7 +1253,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) * A separator has the format "-sep%d[:%d]-". The optional :%d is * a width specifier. If no width is specified then we choose one. */ - cp = (char *)vim_strchr(menu->name, ':'); + cp = (char *)mnv_strchr(menu->name, ':'); if (cp != NULL) wid = (Dimension)atoi(++cp); else @@ -1309,7 +1309,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) menu->submenu_id = NULL; // When adding first item to toolbar it might have to be enabled . if (!XtIsManaged(XtParent(toolBar)) - && vim_strchr(p_go, GO_TOOLBAR) != NULL) + && mnv_strchr(p_go, GO_TOOLBAR) != NULL) gui_mch_show_toolbar(TRUE); gui.toolbar_height = gui_mch_compute_toolbar_height(); return; @@ -1371,7 +1371,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int idx) * there exists a popup menu but it isn't managed. */ void -gui_motif_update_mousemodel(vimmenu_T *menu) +gui_motif_update_mousemodel(mnvmenu_T *menu) { int idx = 0; @@ -1439,7 +1439,7 @@ gui_mch_new_menu_font(void) XtVaGetValues(menuBar, XmNheight, &height, NULL); gui.menu_height = height; - XtVaGetValues(vimShell, XtNwidth, &w, XtNheight, &h, NULL); + XtVaGetValues(mnvShell, XtNwidth, &w, XtNheight, &h, NULL); gui_resize_shell(w, h # ifdef FEAT_XIM - xim_get_status_area_height() @@ -1455,7 +1455,7 @@ gui_mch_new_menu_font(void) gui_mch_new_tooltip_font(void) { # ifdef FEAT_TOOLBAR - vimmenu_T *menu; + mnvmenu_T *menu; if (toolBar == (Widget)0) return; @@ -1470,7 +1470,7 @@ gui_mch_new_tooltip_font(void) gui_mch_new_tooltip_colors(void) { # ifdef FEAT_TOOLBAR - vimmenu_T *toolbar; + mnvmenu_T *toolbar; if (toolBar == (Widget)0) return; @@ -1484,10 +1484,10 @@ gui_mch_new_tooltip_colors(void) static void submenu_change( - vimmenu_T *menu, + mnvmenu_T *menu, int colors) // TRUE for colors, FALSE for font { - vimmenu_T *mp; + mnvmenu_T *mp; for (mp = menu; mp != NULL; mp = mp->next) { @@ -1563,7 +1563,7 @@ submenu_change( * Destroy the machine specific menu widget. */ void -gui_mch_destroy_menu(vimmenu_T *menu) +gui_mch_destroy_menu(mnvmenu_T *menu) { // Please be sure to destroy the parent widget first (i.e. menu->id). // On the other hand, problems have been reported that the submenu must be @@ -1615,7 +1615,7 @@ gui_mch_destroy_menu(vimmenu_T *menu) } void -gui_mch_show_popupmenu(vimmenu_T *menu UNUSED) +gui_mch_show_popupmenu(mnvmenu_T *menu UNUSED) { # ifdef MOTIF_POPUP XmMenuPosition(menu->submenu_id, gui_x11_get_last_mouse_event()); @@ -1709,7 +1709,7 @@ gui_mch_get_scrollbar_xpadding(void) Position tx; XtVaGetValues(textArea, XtNwidth, &tw, XtNx, &tx, NULL); - XtVaGetValues(vimShell, XtNwidth, &ww, NULL); + XtVaGetValues(mnvShell, XtNwidth, &ww, NULL); xpad = ww - tw - tx - gui.scrollbar_width; return (xpad < 0) ? 0 : xpad; } @@ -1722,7 +1722,7 @@ gui_mch_get_scrollbar_ypadding(void) Position ty; XtVaGetValues(textArea, XtNheight, &th, XtNy, &ty, NULL); - XtVaGetValues(vimShell, XtNheight, &wh, NULL); + XtVaGetValues(mnvShell, XtNheight, &wh, NULL); ypad = wh - th - ty - gui.scrollbar_height; return (ypad < 0) ? 0 : ypad; } @@ -2142,7 +2142,7 @@ set_predefined_label(Widget parent, String name, char *new_label) if (!w) return; - p = vim_strsave((char_u *)new_label); + p = mnv_strsave((char_u *)new_label); if (p == NULL) return; for (next = p; *next; ++next) @@ -2160,7 +2160,7 @@ set_predefined_label(Widget parent, String name, char *new_label) } str = XmStringCreate((char *)p, STRING_TAG); - vim_free(p); + mnv_free(p); if (str != NULL) { @@ -2207,7 +2207,7 @@ gui_mch_browse( // avoid to (ab-)use the (maybe internationalized!) dialog title as a // dialog name. - dialog_wgt = XmCreateFileSelectionDialog(vimShell, "browseDialog", NULL, 0); + dialog_wgt = XmCreateFileSelectionDialog(mnvShell, "browseDialog", NULL, 0); if (initdir == NULL || *initdir == NUL) { @@ -2243,7 +2243,7 @@ gui_mch_browse( if (*p == ';' || *p == '\n') // end of (first) pattern break; } - pattern = vim_strnsave(s, p - s); + pattern = mnv_strnsave(s, p - s); tofree = pattern; if (pattern == NULL) pattern = (char_u *)""; @@ -2296,11 +2296,11 @@ gui_mch_browse( suppress_dialog_mnemonics(dialog_wgt); XtDestroyWidget(dialog_wgt); - vim_free(tofree); + mnv_free(tofree); if (browse_fname == NULL) return NULL; - return vim_strsave((char_u *)browse_fname); + return mnv_strsave((char_u *)browse_fname); } /* @@ -2488,15 +2488,15 @@ gui_mch_dialog( # endif if (title == NULL) - title = (char_u *)_("Vim dialog"); + title = (char_u *)_("MNV dialog"); // if our pointer is currently hidden, then we should show it. gui_mch_mousehide(FALSE); - dialogform = XmCreateFormDialog(vimShell, (char *)"dialog", NULL, 0); + dialogform = XmCreateFormDialog(mnvShell, (char *)"dialog", NULL, 0); // Check 'v' flag in 'guioptions': vertical button placement. - vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL); + vertical = (mnv_strchr(p_go, GO_VERTICAL) != NULL); // Set the title of the Dialog window label = XmStringCreateSimple((char *)title); @@ -2510,7 +2510,7 @@ gui_mch_dialog( XmStringFree(label); // make a copy, so that we can insert NULs - buts = vim_strsave(button_names); + buts = mnv_strsave(button_names); if (buts == NULL) return -1; @@ -2522,7 +2522,7 @@ gui_mch_dialog( buttons = ALLOC_MULT(Widget, butcount); if (buttons == NULL) { - vim_free(buts); + mnv_free(buts); return -1; } @@ -2639,7 +2639,7 @@ gui_mch_dialog( (XtCallbackProc)butproc, (XtPointer)(long)butcount); p = next; } - vim_free(buts); + mnv_free(buts); separator = (Widget) 0; if (butcount > 0) @@ -2693,19 +2693,19 @@ gui_mch_dialog( // Add a pixmap, left of the message. switch (type) { - case VIM_GENERIC: + case MNV_GENERIC: icon_data = generic_xpm; break; - case VIM_ERROR: + case MNV_ERROR: icon_data = error_xpm; break; - case VIM_WARNING: + case MNV_WARNING: icon_data = alert_xpm; break; - case VIM_INFO: + case MNV_INFO: icon_data = info_xpm; break; - case VIM_QUESTION: + case MNV_QUESTION: icon_data = quest_xpm; break; default: @@ -2733,7 +2733,7 @@ gui_mch_dialog( label = XmStringCreateLtoR((char *)message, STRING_TAG); if (label == NULL) { - vim_free(buttons); + mnv_free(buttons); return -1; } w = XtVaCreateManagedWidget("dialogMessage", @@ -2813,7 +2813,7 @@ gui_mch_dialog( break; } - vim_free(buttons); + mnv_free(buttons); if (textfield != NULL) { @@ -2821,7 +2821,7 @@ gui_mch_dialog( if (p == NULL || dialogStatus < 0) *textfield = NUL; else - vim_strncpy(textfield, p, IOSIZE - 1); + mnv_strncpy(textfield, p, IOSIZE - 1); XtFree((char *)p); } @@ -2862,8 +2862,8 @@ gui_mch_show_toolbar(int showit) text = -1; if (text != 0) { - vimmenu_T *toolbar; - vimmenu_T *cur; + mnvmenu_T *toolbar; + mnvmenu_T *cur; FOR_ALL_MENUS(toolbar) if (menu_is_toolbar(toolbar->dname)) @@ -3472,7 +3472,7 @@ set_label(Widget w, char *label) if (!w) return; - p = vim_strsave((char_u *)label); + p = mnv_strsave((char_u *)label); if (p == NULL) return; for (next = p; *next; ++next) @@ -3490,7 +3490,7 @@ set_label(Widget w, char *label) } str = XmStringCreateSimple((char *)p); - vim_free(p); + mnv_free(p); if (str) { XtVaSetValues(w, @@ -3541,7 +3541,7 @@ find_replace_dialog_create(char_u *arg, int do_replace) if (entry_text != NULL) XmTextFieldSetString(frdp->what, (char *)entry_text); - vim_free(entry_text); + mnv_free(entry_text); XtVaSetValues(frdp->wword, XmNset, wword, NULL); return; @@ -3549,16 +3549,16 @@ find_replace_dialog_create(char_u *arg, int do_replace) // Create a fresh new dialog window if (do_replace) - str = XmStringCreateSimple(_("VIM - Search and Replace...")); + str = XmStringCreateSimple(_("MNV - Search and Replace...")); else - str = XmStringCreateSimple(_("VIM - Search...")); + str = XmStringCreateSimple(_("MNV - Search...")); n = 0; XtSetArg(args[n], XmNautoUnmanage, False); n++; XtSetArg(args[n], XmNnoResize, True); n++; XtSetArg(args[n], XmNdialogTitle, str); n++; - frdp->dialog = XmCreateFormDialog(vimShell, "findReplaceDialog", args, n); + frdp->dialog = XmCreateFormDialog(mnvShell, "findReplaceDialog", args, n); XmStringFree(str); XtAddCallback(frdp->dialog, XmNdestroyCallback, find_replace_destroy_callback, frdp); @@ -3844,7 +3844,7 @@ find_replace_dialog_create(char_u *arg, int do_replace) if (entry_text != NULL) XmTextFieldSetString(frdp->what, (char *)entry_text); - vim_free(entry_text); + mnv_free(entry_text); gui_motif_synch_fonts(); diff --git a/uvim/src/gui_photon.c b/uvim/src/gui_photon.c index 8cc31d59ad..db7b883ecf 100644 --- a/uvim/src/gui_photon.c +++ b/uvim/src/gui_photon.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * Photon GUI support by Julian Kinraid * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. * * * Clipboard support is in os_qnx.c * PhAttach() is called in os_qnx.c:qnx_init() */ -#include "vim.h" +#include "mnv.h" #ifdef FEAT_TOOLBAR # include @@ -92,8 +92,8 @@ static long_u blink_offtime = 250; static struct { int key_sym; - char_u vim_code0; - char_u vim_code1; + char_u mnv_code0; + char_u mnv_code1; } special_keys[] = { {Pk_Up, 'k', 'u'}, @@ -201,7 +201,7 @@ static PtCallbackF_t gui_ph_handle_focus; // focus change of text area static PtCallbackF_t gui_ph_handle_menu_resize; -// When a menu is unrealized, give focus back to vimTextArea +// When a menu is unrealized, give focus back to mnvTextArea static PtCallbackF_t gui_ph_handle_menu_unrealized; #ifdef USE_PANEL_GROUP @@ -231,7 +231,7 @@ static PtWidget_t * gui_ph_show_tooltip(PtWidget_t *window, PgColor_t text_color) { PtArg_t arg; - vimmenu_T *menu; + mnvmenu_T *menu; char_u *tooltip; PtSetArg(&arg, Pt_ARG_POINTER, &menu, 0); @@ -264,10 +264,10 @@ gui_ph_resize_container(void) { PhArea_t area; - PtWidgetArea(gui.vimWindow, &area); - PtWidgetPos (gui.vimContainer, &area.pos); + PtWidgetArea(gui.mnvWindow, &area); + PtWidgetPos (gui.mnvContainer, &area.pos); - PtSetResource(gui.vimContainer, Pt_ARG_AREA, &area, 0); + PtSetResource(gui.mnvContainer, Pt_ARG_AREA, &area, 0); } static int @@ -283,7 +283,7 @@ gui_ph_handle_menu_resize( height = sizes->new_dim.h; - // Because vim treats the toolbar and menubar separately, + // Because mnv treats the toolbar and menubar separately, // and here they're lumped together into a PtToolbarGroup, // we only need either menu_height or toolbar_height set at once if (gui.menu_is_active) @@ -300,9 +300,9 @@ gui_ph_handle_menu_resize( below_menu.y = height; #ifdef USE_PANEL_GROUP - container = gui.vimPanelGroup; + container = gui.mnvPanelGroup; #else - container = gui.vimContainer; + container = gui.mnvContainer; #endif PtSetResource(container, Pt_ARG_POS, &below_menu, 0); @@ -384,8 +384,8 @@ gui_ph_handle_window_cb(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) break; case Ph_WM_RESIZE: - PtGetResource(gui.vimWindow, Pt_ARG_WIDTH, &width, 0); - PtGetResource(gui.vimWindow, Pt_ARG_HEIGHT, &height, 0); + PtGetResource(gui.mnvWindow, Pt_ARG_WIDTH, &width, 0); + PtGetResource(gui.mnvWindow, Pt_ARG_HEIGHT, &height, 0); #ifdef USE_PANEL_GROUP width -= (pg_margin_left + pg_margin_right); height -= (pg_margin_top + pg_margin_bottom); @@ -393,8 +393,8 @@ gui_ph_handle_window_cb(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) gui_resize_shell(*width, *height); gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH); is_ignore_draw = FALSE; - PtEndFlux(gui.vimContainer); - PtContainerRelease(gui.vimContainer); + PtEndFlux(gui.mnvContainer); + PtContainerRelease(gui.mnvContainer); break; default: @@ -479,8 +479,8 @@ gui_ph_handle_keyboard(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) if (special_keys[i].key_sym == key->key_cap) { len = 0; - if (special_keys[i].vim_code1 == NUL) - ch = special_keys[i].vim_code0; + if (special_keys[i].mnv_code1 == NUL) + ch = special_keys[i].mnv_code0; else { // Detect if a keypad number key has been pressed @@ -493,8 +493,8 @@ gui_ph_handle_keyboard(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) ch = key->key_cap - 0xf080; } else - ch = TO_SPECIAL(special_keys[i].vim_code0, - special_keys[i].vim_code1); + ch = TO_SPECIAL(special_keys[i].mnv_code0, + special_keys[i].mnv_code1); } break; } @@ -641,7 +641,7 @@ gui_ph_handle_mouse(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) /* * Coordinates need to be relative to the base window, - * not relative to the vimTextArea widget + * not relative to the mnvTextArea widget */ mouse_x = pos->ul.x + gui.border_width; mouse_y = pos->ul.y + gui.border_width; @@ -685,7 +685,7 @@ gui_ph_handle_mouse(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) button = MOUSE_DRAG; #if 0 - // Vim doesn't use button repeats + // MNV doesn't use button repeats if (info->event->type & Ph_EV_BUT_REPEAT) button = MOUSE_DRAG; #endif @@ -710,14 +710,14 @@ gui_ph_handle_focus(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) { if (info->reason == Pt_CB_LOST_FOCUS) { - PtRemoveEventHandler(gui.vimTextArea, Ph_EV_PTR_MOTION_NOBUTTON, + PtRemoveEventHandler(gui.mnvTextArea, Ph_EV_PTR_MOTION_NOBUTTON, gui_ph_handle_mouse, NULL); gui_mch_mousehide(MOUSE_SHOW); } else { - PtAddEventHandler(gui.vimTextArea, Ph_EV_PTR_MOTION_NOBUTTON, + PtAddEventHandler(gui.mnvTextArea, Ph_EV_PTR_MOTION_NOBUTTON, gui_ph_handle_mouse, NULL); } return Pt_CONTINUE; @@ -750,7 +750,7 @@ gui_ph_handle_raw_draw(PtWidget_t *widget, PhTile_t *damage) #endif PtWidgetOffset(widget, &offset); - PhTranslatePoint(&offset, PtWidgetPos(gui.vimTextArea, NULL)); + PhTranslatePoint(&offset, PtWidgetPos(gui.mnvTextArea, NULL)); #if 1 // Redraw individual damage regions @@ -786,7 +786,7 @@ gui_ph_handle_pulldown_menu( { if (data != NULL) { - vimmenu_T *menu = (vimmenu_T *) data; + mnvmenu_T *menu = (mnvmenu_T *) data; PtPositionMenu(menu->submenu_id, NULL); PtRealizeWidget(menu->submenu_id); @@ -803,7 +803,7 @@ gui_ph_handle_menu(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) { if (data != NULL) { - vimmenu_T *menu = (vimmenu_T *) data; + mnvmenu_T *menu = (mnvmenu_T *) data; gui_menu_cb(menu); } return Pt_CONTINUE; @@ -818,7 +818,7 @@ gui_ph_handle_menu_unrealized( void *data, PtCallbackInfo_t *info) { - PtGiveFocus(gui.vimTextArea, NULL); + PtGiveFocus(gui.mnvTextArea, NULL); return Pt_CONTINUE; } @@ -846,12 +846,12 @@ gui_ph_draw_start(void) PhGC_t *gc; gc = PgGetGC(); - PgSetRegion(PtWidgetRid(PtFindDisjoint(gui.vimTextArea))); + PgSetRegion(PtWidgetRid(PtFindDisjoint(gui.mnvTextArea))); PgClearClippingsCx(gc); PgClearTranslationCx(gc); - PtWidgetOffset(gui.vimTextArea, &gui_ph_raw_offset); - PhTranslatePoint(&gui_ph_raw_offset, PtWidgetPos(gui.vimTextArea, NULL)); + PtWidgetOffset(gui.mnvTextArea, &gui_ph_raw_offset); + PhTranslatePoint(&gui_ph_raw_offset, PtWidgetPos(gui.mnvTextArea, NULL)); PgSetTranslation(&gui_ph_raw_offset, Pg_RELATIVE); } @@ -865,11 +865,11 @@ gui_ph_draw_end(void) } #ifdef USE_PANEL_GROUP - static vimmenu_T * + static mnvmenu_T * gui_ph_find_buffer_item(char_u *name) { - vimmenu_T *top_level = root_menu; - vimmenu_T *items = NULL; + mnvmenu_T *top_level = root_menu; + mnvmenu_T *items = NULL; while (top_level != NULL && (STRCMP(top_level->dname, "Buffers") != 0)) @@ -893,7 +893,7 @@ gui_ph_pg_set_buffer_num(int_u buf_num) char search[16]; char *mark; - if (gui.vimTextArea == NULL || buf_num == 0) + if (gui.mnvTextArea == NULL || buf_num == 0) return; search[0] = '('; @@ -907,7 +907,7 @@ gui_ph_pg_set_buffer_num(int_u buf_num) mark = STRRCHR(panel_titles[ i ], '('); if (mark != NULL && STRCMP(mark, search) == 0) { - PtSetResource(gui.vimPanelGroup, Pt_ARG_PG_CURRENT_INDEX, + PtSetResource(gui.mnvPanelGroup, Pt_ARG_PG_CURRENT_INDEX, i, 0); } } @@ -919,7 +919,7 @@ gui_ph_handle_pg_change( void *data, PtCallbackInfo_t *info) { - vimmenu_T *menu; + mnvmenu_T *menu; PtPanelGroupCallback_t *panel; if (info->event != NULL) @@ -946,11 +946,11 @@ gui_ph_get_panelgroup_margins( const unsigned short *margin_top, *margin_bottom; const unsigned short *margin_left, *margin_right; - PtGetAbsPosition(gui.vimTextArea, &abs_raw_x, &abs_raw_y); - PtGetAbsPosition(gui.vimPanelGroup, &abs_panel_x, &abs_panel_y); + PtGetAbsPosition(gui.mnvTextArea, &abs_raw_x, &abs_raw_y); + PtGetAbsPosition(gui.mnvPanelGroup, &abs_panel_x, &abs_panel_y); - PtGetResource(gui.vimPanelGroup, Pt_ARG_MARGIN_RIGHT, &margin_right, 0); - PtGetResource(gui.vimPanelGroup, Pt_ARG_MARGIN_BOTTOM, &margin_bottom, 0); + PtGetResource(gui.mnvPanelGroup, Pt_ARG_MARGIN_RIGHT, &margin_right, 0); + PtGetResource(gui.mnvPanelGroup, Pt_ARG_MARGIN_BOTTOM, &margin_bottom, 0); abs_raw_x -= abs_panel_x; abs_raw_y -= abs_panel_y; @@ -966,14 +966,14 @@ gui_ph_get_panelgroup_margins( * Used for the tabs for PtPanelGroup */ static int -gui_ph_is_buffer_item(vimmenu_T *menu, vimmenu_T *parent) +gui_ph_is_buffer_item(mnvmenu_T *menu, mnvmenu_T *parent) { char *mark; if (STRCMP(parent->dname, "Buffers") == 0) { // Look for '(' digits ')' - mark = vim_strchr(menu->dname, '('); + mark = mnv_strchr(menu->dname, '('); if (mark != NULL) { mark++; @@ -1001,10 +1001,10 @@ gui_ph_pg_add_buffer(char *name) new_titles[ num_panels++ ] = name; - PtSetResource(gui.vimPanelGroup, Pt_ARG_PG_PANEL_TITLES, new_titles, + PtSetResource(gui.mnvPanelGroup, Pt_ARG_PG_PANEL_TITLES, new_titles, num_panels); - vim_free(panel_titles); + mnv_free(panel_titles); panel_titles = new_titles; } @@ -1029,20 +1029,20 @@ gui_ph_pg_remove_buffer(char *name) } num_panels--; - PtSetResource(gui.vimPanelGroup, Pt_ARG_PG_PANEL_TITLES, new_titles, + PtSetResource(gui.mnvPanelGroup, Pt_ARG_PG_PANEL_TITLES, new_titles, num_panels); - vim_free(panel_titles); + mnv_free(panel_titles); panel_titles = new_titles; } } else { num_panels--; - PtSetResource(gui.vimPanelGroup, Pt_ARG_PG_PANEL_TITLES, &empty_title, + PtSetResource(gui.mnvPanelGroup, Pt_ARG_PG_PANEL_TITLES, &empty_title, 1); - VIM_CLEAR(panel_titles); + MNV_CLEAR(panel_titles); } } @@ -1055,11 +1055,11 @@ gui_ph_handle_buffer_remove( void *data, PtCallbackInfo_t *info) { - vimmenu_T *menu; + mnvmenu_T *menu; if (data != NULL) { - menu = (vimmenu_T *) data; + menu = (mnvmenu_T *) data; gui_ph_pg_remove_buffer(menu->dname); } @@ -1073,8 +1073,8 @@ gui_ph_pane_resize(PtWidget_t *widget, void *data, PtCallbackInfo_t *info) if (PtWidgetIsRealized(widget)) { is_ignore_draw = TRUE; - PtStartFlux(gui.vimContainer); - PtContainerHold(gui.vimContainer); + PtStartFlux(gui.mnvContainer); + PtContainerHold(gui.mnvContainer); } return Pt_CONTINUE; @@ -1140,12 +1140,12 @@ gui_mch_init(void) PtSetArg(&args[ n++ ], Pt_ARG_WINDOW_NOTIFY_FLAGS, Pt_TRUE, Ph_WM_CLOSE | Ph_WM_RESIZE | Ph_WM_FOCUS); PtSetArg(&args[ n++ ], Pt_ARG_DIM, &window_size, 0); - gui.vimWindow = PtCreateWidget(PtWindow, NULL, n, args); - if (gui.vimWindow == NULL) + gui.mnvWindow = PtCreateWidget(PtWindow, NULL, n, args); + if (gui.mnvWindow == NULL) return FAIL; - PtAddCallback(gui.vimWindow, Pt_CB_WINDOW, gui_ph_handle_window_cb, NULL); - PtAddCallback(gui.vimWindow, Pt_CB_WINDOW_OPENING, + PtAddCallback(gui.mnvWindow, Pt_CB_WINDOW, gui_ph_handle_window_cb, NULL); + PtAddCallback(gui.mnvWindow, Pt_CB_WINDOW_OPENING, gui_ph_handle_window_open, NULL); n = 0; @@ -1157,11 +1157,11 @@ gui_mch_init(void) // Put in a temporary place holder title PtSetArg(&args[ n++ ], Pt_ARG_PG_PANEL_TITLES, &empty_title, 1); - gui.vimPanelGroup = PtCreateWidget(PtPanelGroup, gui.vimWindow, n, args); - if (gui.vimPanelGroup == NULL) + gui.mnvPanelGroup = PtCreateWidget(PtPanelGroup, gui.mnvWindow, n, args); + if (gui.mnvPanelGroup == NULL) return FAIL; - PtAddCallback(gui.vimPanelGroup, Pt_CB_PG_PANEL_SWITCHING, + PtAddCallback(gui.mnvPanelGroup, Pt_CB_PG_PANEL_SWITCHING, gui_ph_handle_pg_change, NULL); #else // Turn off all edge decorations @@ -1171,11 +1171,11 @@ gui_mch_init(void) PtSetArg(&args[ n++ ], Pt_ARG_MARGIN_HEIGHT, 0, 0); PtSetArg(&args[ n++ ], Pt_ARG_CONTAINER_FLAGS, Pt_TRUE, Pt_AUTO_EXTENT); - gui.vimContainer = PtCreateWidget(PtPane, gui.vimWindow, n, args); - if (gui.vimContainer == NULL) + gui.mnvContainer = PtCreateWidget(PtPane, gui.mnvWindow, n, args); + if (gui.mnvContainer == NULL) return FAIL; - PtAddCallback(gui.vimContainer, Pt_CB_RESIZE, gui_ph_pane_resize, NULL); + PtAddCallback(gui.mnvContainer, Pt_CB_RESIZE, gui_ph_pane_resize, NULL); #endif // Size for the text area is set in gui_mch_set_text_area_pos @@ -1194,20 +1194,20 @@ gui_mch_init(void) PtSetArg(&args[ n++ ], Pt_ARG_CURSOR_COLOR, gui_ph_mouse_color, 0); #endif - gui.vimTextArea = PtCreateWidget(PtRaw, Pt_DFLT_PARENT, n, args); - if (gui.vimTextArea == NULL) + gui.mnvTextArea = PtCreateWidget(PtRaw, Pt_DFLT_PARENT, n, args); + if (gui.mnvTextArea == NULL) return FAIL; // TODO: use PtAddEventHandlers instead? - // Not using Ph_EV_BUT_REPEAT because vim wouldn't use it anyway - PtAddEventHandler(gui.vimTextArea, + // Not using Ph_EV_BUT_REPEAT because mnv wouldn't use it anyway + PtAddEventHandler(gui.mnvTextArea, Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE | Ph_EV_PTR_MOTION_BUTTON, gui_ph_handle_mouse, NULL); - PtAddEventHandler(gui.vimTextArea, Ph_EV_KEY, + PtAddEventHandler(gui.mnvTextArea, Ph_EV_KEY, gui_ph_handle_keyboard, NULL); - PtAddCallback(gui.vimTextArea, Pt_CB_GOT_FOCUS, + PtAddCallback(gui.mnvTextArea, Pt_CB_GOT_FOCUS, gui_ph_handle_focus, NULL); - PtAddCallback(gui.vimTextArea, Pt_CB_LOST_FOCUS, + PtAddCallback(gui.mnvTextArea, Pt_CB_LOST_FOCUS, gui_ph_handle_focus, NULL); /* @@ -1219,11 +1219,11 @@ gui_mch_init(void) * Create the two timers, not as accurate as using the kernel timer * functions, but good enough */ - gui_ph_timer_cursor = PtCreateWidget(PtTimer, gui.vimWindow, 0, NULL); + gui_ph_timer_cursor = PtCreateWidget(PtTimer, gui.mnvWindow, 0, NULL); if (gui_ph_timer_cursor == NULL) return FAIL; - gui_ph_timer_timeout = PtCreateWidget(PtTimer, gui.vimWindow, 0, NULL); + gui_ph_timer_timeout = PtCreateWidget(PtTimer, gui.mnvWindow, 0, NULL); if (gui_ph_timer_timeout == NULL) return FAIL; @@ -1237,24 +1237,24 @@ gui_mch_init(void) PtSetArg(&args[ n++ ], Pt_ARG_WIDTH, window_size.w, 0); PtSetArg(&args[ n++ ], Pt_ARG_ANCHOR_FLAGS, Pt_ANCHOR_LEFT_RIGHT, Pt_IS_ANCHORED); - gui.vimToolBarGroup = PtCreateWidget(PtToolbarGroup, gui.vimWindow, + gui.mnvToolBarGroup = PtCreateWidget(PtToolbarGroup, gui.mnvWindow, n, args); - if (gui.vimToolBarGroup == NULL) + if (gui.mnvToolBarGroup == NULL) return FAIL; - PtAddCallback(gui.vimToolBarGroup, Pt_CB_RESIZE, + PtAddCallback(gui.mnvToolBarGroup, Pt_CB_RESIZE, gui_ph_handle_menu_resize, NULL); n = 0; flags = 0; PtSetArg(&args[ n++ ], Pt_ARG_WIDTH, window_size.w, 0); - if (! vim_strchr(p_go, GO_MENUS)) + if (! mnv_strchr(p_go, GO_MENUS)) { flags |= Pt_DELAY_REALIZE; PtSetArg(&args[ n++ ], Pt_ARG_FLAGS, Pt_TRUE, flags); } - gui.vimMenuBar = PtCreateWidget(PtMenuBar, gui.vimToolBarGroup, n, args); - if (gui.vimMenuBar == NULL) + gui.mnvMenuBar = PtCreateWidget(PtMenuBar, gui.mnvToolBarGroup, n, args); + if (gui.mnvMenuBar == NULL) return FAIL; # ifdef FEAT_TOOLBAR @@ -1267,13 +1267,13 @@ gui_mch_init(void) PtSetArg(&args[ n++ ], Pt_ARG_WIDTH, window_size.w, 0); flags = Pt_GETS_FOCUS; - if (! vim_strchr(p_go, GO_TOOLBAR)) + if (! mnv_strchr(p_go, GO_TOOLBAR)) flags |= Pt_DELAY_REALIZE; PtSetArg(&args[ n++ ], Pt_ARG_FLAGS, Pt_DELAY_REALIZE, flags); - gui.vimToolBar = PtCreateWidget(PtToolbar, gui.vimToolBarGroup, n, args); - if (gui.vimToolBar == NULL) + gui.mnvToolBar = PtCreateWidget(PtToolbar, gui.mnvToolBarGroup, n, args); + if (gui.mnvToolBar == NULL) return FAIL; /* @@ -1311,20 +1311,20 @@ gui_mch_open(void) if (gui_win_x != -1 && gui_win_y != -1) gui_mch_set_winpos(gui_win_x, gui_win_y); - return (PtRealizeWidget(gui.vimWindow) == 0) ? OK : FAIL; + return (PtRealizeWidget(gui.mnvWindow) == 0) ? OK : FAIL; } void gui_mch_exit(int rc) { - PtDestroyWidget(gui.vimWindow); + PtDestroyWidget(gui.mnvWindow); PxTranslateSet(charset_translate, NULL); - vim_free(gui.event_buffer); + mnv_free(gui.event_buffer); #ifdef USE_PANEL_GROUPS - vim_free(panel_titles); + mnv_free(panel_titles); #endif } @@ -1348,7 +1348,7 @@ gui_mch_update(void) int working = TRUE; PtAppAddWorkProc(NULL, exit_gui_mch_update, &working); - while ((working == TRUE) && !vim_is_input_buf_full()) + while ((working == TRUE) && !mnv_is_input_buf_full()) PtProcessEvent(); } @@ -1407,7 +1407,7 @@ gui_mch_browse( { if (saving == TRUE) { - // Don't need Pt_FSR_CONFIRM_EXISTING, vim will ask anyway + // Don't need Pt_FSR_CONFIRM_EXISTING, mnv will ask anyway flags |= Pt_FSR_NO_FCHECK; open_text = "&Save"; } @@ -1434,7 +1434,7 @@ gui_mch_browse( // TODO: add a filter? PtFileSelection( - gui.vimWindow, + gui.mnvWindow, NULL, title, default_path, @@ -1445,10 +1445,10 @@ gui_mch_browse( &file, flags); - vim_free(default_path); + mnv_free(default_path); if (file.ret == Pt_FSDIALOG_BTN1) - return vim_strsave(file.path); + return mnv_strsave(file.path); } return NULL; } @@ -1461,13 +1461,13 @@ static PtWidget_t *gui_ph_dialog_text = NULL; gui_ph_dialog_close(int button, void *data) { PtModalCtrl_t *modal_ctrl = data; - char_u *dialog_text, *vim_text; + char_u *dialog_text, *mnv_text; if (gui_ph_dialog_text != NULL) { PtGetResource(gui_ph_dialog_text, Pt_ARG_TEXT_STRING, &dialog_text, 0); - PtGetResource(gui_ph_dialog_text, Pt_ARG_POINTER, &vim_text, 0); - STRNCPY(vim_text, dialog_text, IOSIZE - 1); + PtGetResource(gui_ph_dialog_text, Pt_ARG_POINTER, &mnv_text, 0); + STRNCPY(mnv_text, dialog_text, IOSIZE - 1); } PtModalUnblock(modal_ctrl, (void *) button); @@ -1538,7 +1538,7 @@ gui_mch_dialog( } if (title == NULL) - title = "Vim"; + title = "MNV"; buttons_copy = alloc(len + 1); button_array = ALLOC_MULT(char_u *, button_count); @@ -1565,7 +1565,7 @@ gui_mch_dialog( } # ifndef FEAT_GUI_TEXTDIALOG dialog_result = PtAlert( - gui.vimWindow, NULL, + gui.mnvWindow, NULL, title, NULL, message, NULL, @@ -1573,7 +1573,7 @@ gui_mch_dialog( default_button, 0, Pt_MODAL); # else // Writing the dialog ourselves lets us add extra features, like - // trapping the escape key and returning 0 to vim + // trapping the escape key and returning 0 to mnv { int n; PtArg_t args[5]; @@ -1609,7 +1609,7 @@ gui_mch_dialog( gui_ph_dialog_text_enter, &modal_ctrl); } - di.parent = gui.vimWindow; + di.parent = gui.mnvWindow; di.pane = pane; di.title = title; di.buttons = (const char **) button_array; @@ -1628,7 +1628,7 @@ gui_mch_dialog( if (gui_ph_dialog_text != NULL) PtGiveFocus(gui_ph_dialog_text, NULL); - // Open dialog, block the vim window and wait for the dialog to close + // Open dialog, block the mnv window and wait for the dialog to close PtRealizeWidget(dialog); PtMakeModal(dialog, Ph_CURSOR_NOINPUT, Ph_CURSOR_DEFAULT_COLOR); dialog_result = (int) PtModalBlock(&modal_ctrl, 0); @@ -1639,8 +1639,8 @@ gui_mch_dialog( # endif } - vim_free(button_array); - vim_free(buttons_copy); + mnv_free(button_array); + mnv_free(buttons_copy); return dialog_result; } @@ -1653,7 +1653,7 @@ gui_mch_get_winpos(int *x, int *y) { PhPoint_t *pos; - pos = PtWidgetPos(gui.vimWindow, NULL); + pos = PtWidgetPos(gui.mnvWindow, NULL); *x = pos->x; *y = pos->y; @@ -1666,7 +1666,7 @@ gui_mch_set_winpos(int x, int y) { PhPoint_t pos = { x, y }; - PtSetResource(gui.vimWindow, Pt_ARG_POS, &pos, 0); + PtSetResource(gui.mnvWindow, Pt_ARG_POS, &pos, 0); } void @@ -1682,10 +1682,10 @@ gui_mch_set_shellsize(int width, int height, window_size.h += pg_margin_top + pg_margin_bottom; #endif - PtSetResource(gui.vimWindow, Pt_ARG_MINIMUM_DIM, &min_size, 0); - PtSetResource(gui.vimWindow, Pt_ARG_DIM, &window_size, 0); + PtSetResource(gui.mnvWindow, Pt_ARG_MINIMUM_DIM, &min_size, 0); + PtSetResource(gui.mnvWindow, Pt_ARG_DIM, &window_size, 0); - if (! PtWidgetIsRealized(gui.vimWindow)) + if (! PtWidgetIsRealized(gui.mnvWindow)) gui_ph_resize_container(); } @@ -1713,13 +1713,13 @@ gui_mch_iconify(void) CLEAR_FIELD(event); event.event_f = Ph_WM_HIDE; event.event_state = Ph_WM_EVSTATE_HIDE; - event.rid = PtWidgetRid(gui.vimWindow); + event.rid = PtWidgetRid(gui.mnvWindow); PtForwardWindowEvent(&event); } #if defined(FEAT_EVAL) /* - * Bring the Vim window to the foreground. + * Bring the MNV window to the foreground. */ void gui_mch_set_foreground(void) @@ -1729,7 +1729,7 @@ gui_mch_set_foreground(void) CLEAR_FIELD(event); event.event_f = Ph_WM_TOFRONT; event.event_state = Ph_WM_EVSTATE_FFRONT; - event.rid = PtWidgetRid(gui.vimWindow); + event.rid = PtWidgetRid(gui.mnvWindow); PtForwardWindowEvent(&event); } #endif @@ -1740,7 +1740,7 @@ gui_mch_settitle(char_u *title, char_u *icon) #ifdef USE_PANEL_GROUP gui_ph_pg_set_buffer_num(curwin->w_buffer->b_fnum); #endif - PtSetResource(gui.vimWindow, Pt_ARG_WINDOW_TITLE, title, 0); + PtSetResource(gui.mnvWindow, Pt_ARG_WINDOW_TITLE, title, 0); // Not sure what to do with the icon text, set balloon text somehow? } @@ -1792,7 +1792,7 @@ gui_mch_create_scrollbar(scrollbar_T *sb, int orient) /* * Stop the scrollbar from being realized when the parent - * is realized, so it can be explicitly realized by vim. + * is realized, so it can be explicitly realized by mnv. * * Also, don't let the scrollbar get focus */ @@ -1822,9 +1822,9 @@ gui_mch_create_scrollbar(scrollbar_T *sb, int orient) PtSetArg(&args[ n++ ], Pt_ARG_ORIENTATION, (orient == SBAR_HORIZ) ? Pt_HORIZONTAL : Pt_VERTICAL, 0); #ifdef USE_PANEL_GROUP - sb->id = PtCreateWidget(PtScrollbar, gui.vimPanelGroup, n, args); + sb->id = PtCreateWidget(PtScrollbar, gui.mnvPanelGroup, n, args); #else - sb->id = PtCreateWidget(PtScrollbar, gui.vimContainer, n, args); + sb->id = PtCreateWidget(PtScrollbar, gui.mnvContainer, n, args); #endif PtAddCallback(sb->id, Pt_CB_SCROLLBAR_MOVE, gui_ph_handle_scrollbar, sb); @@ -1886,7 +1886,7 @@ mch_set_mouse_shape(int shape) return; if (shape == MSHAPE_HIDE || gui.pointer_hidden) - PtSetResource(gui.vimTextArea, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_NONE, + PtSetResource(gui.mnvTextArea, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_NONE, 0); else { @@ -1895,7 +1895,7 @@ mch_set_mouse_shape(int shape) else id = mshape_ids[shape]; - PtSetResource(gui.vimTextArea, Pt_ARG_CURSOR_TYPE, id, 0); + PtSetResource(gui.mnvTextArea, Pt_ARG_CURSOR_TYPE, id, 0); } if (shape != MSHAPE_HIDE) last_shape = shape; @@ -1911,12 +1911,12 @@ gui_mch_mousehide(int hide) gui.pointer_hidden = hide; #ifdef FEAT_MOUSESHAPE if (hide) - PtSetResource(gui.vimTextArea, Pt_ARG_CURSOR_TYPE, + PtSetResource(gui.mnvTextArea, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_NONE, 0); else mch_set_mouse_shape(last_shape); #else - PtSetResource(gui.vimTextArea, Pt_ARG_CURSOR_TYPE, + PtSetResource(gui.mnvTextArea, Pt_ARG_CURSOR_TYPE, (hide == MOUSE_SHOW) ? GUI_PH_MOUSE_TYPE : Ph_CURSOR_NONE, 0); #endif @@ -1931,7 +1931,7 @@ gui_mch_getmouse(int *x, int *y) // FIXME: does this return the correct position, // with respect to the border? PhQueryCursor(PhInputGroup(NULL), &info); - PtGetAbsPosition(gui.vimTextArea , &ix, &iy); + PtGetAbsPosition(gui.mnvTextArea , &ix, &iy); *x = info.pos.x - ix; *y = info.pos.y - iy; @@ -1942,7 +1942,7 @@ gui_mch_setmouse(int x, int y) { short abs_x, abs_y; - PtGetAbsPosition(gui.vimTextArea, &abs_x, &abs_y); + PtGetAbsPosition(gui.mnvTextArea, &abs_x, &abs_y); // Add the border offset? PhMoveCursorAbs(PhInputGroup(NULL), abs_x + x, abs_y + y); } @@ -1983,13 +1983,13 @@ gui_mch_new_colors(void) # ifndef FEAT_MOUSESHAPE gui_ph_mouse_color = PgRGB(r, g, b); - PtSetResource(gui.vimTextArea, Pt_ARG_CURSOR_COLOR, + PtSetResource(gui.mnvTextArea, Pt_ARG_CURSOR_COLOR, gui_ph_mouse_color, 0); # endif } #endif - PtSetResource(gui.vimTextArea, Pt_ARG_FILL_COLOR, gui.back_pixel, 0); + PtSetResource(gui.mnvTextArea, Pt_ARG_FILL_COLOR, gui.back_pixel, 0); } /* @@ -2096,8 +2096,8 @@ gui_mch_delete_lines(int row, int num_lines) rect.lr.x = FILL_X(gui.scroll_region_right + 1) - 1; rect.lr.y = FILL_Y(gui.scroll_region_bot + 1) - 1; - PtWidgetOffset(gui.vimTextArea, &gui_ph_raw_offset); - PhTranslatePoint(&gui_ph_raw_offset, PtWidgetPos(gui.vimTextArea, NULL)); + PtWidgetOffset(gui.mnvTextArea, &gui_ph_raw_offset); + PhTranslatePoint(&gui_ph_raw_offset, PtWidgetPos(gui.mnvTextArea, NULL)); PhTranslateRect(&rect, &gui_ph_raw_offset); delta.x = 0; @@ -2105,7 +2105,7 @@ gui_mch_delete_lines(int row, int num_lines) PgFlush(); - PhBlit(PtWidgetRid(PtFindDisjoint(gui.vimTextArea)), &rect, &delta); + PhBlit(PtWidgetRid(PtFindDisjoint(gui.mnvTextArea)), &rect, &delta); gui_clear_block( gui.scroll_region_bot - num_lines + 1, @@ -2126,8 +2126,8 @@ gui_mch_insert_lines(int row, int num_lines) rect.lr.x = FILL_X(gui.scroll_region_right + 1) - 1; rect.lr.y = FILL_Y(gui.scroll_region_bot - num_lines + 1) - 1; - PtWidgetOffset(gui.vimTextArea, &gui_ph_raw_offset); - PhTranslatePoint(&gui_ph_raw_offset, PtWidgetPos(gui.vimTextArea, NULL)); + PtWidgetOffset(gui.mnvTextArea, &gui_ph_raw_offset); + PhTranslatePoint(&gui_ph_raw_offset, PtWidgetPos(gui.mnvTextArea, NULL)); PhTranslateRect(&rect, &gui_ph_raw_offset); delta.x = 0; @@ -2135,7 +2135,7 @@ gui_mch_insert_lines(int row, int num_lines) PgFlush(); - PhBlit(PtWidgetRid(PtFindDisjoint(gui.vimTextArea)) , &rect, &delta); + PhBlit(PtWidgetRid(PtFindDisjoint(gui.mnvTextArea)) , &rect, &delta); gui_clear_block(row, gui.scroll_region_left, row + num_lines - 1, gui.scroll_region_right); @@ -2334,7 +2334,7 @@ gui_mch_set_text_area_pos(int x, int y, int w, int h) { PhArea_t area = {{x, y}, {w, h}}; - PtSetResource(gui.vimTextArea, Pt_ARG_AREA, &area, 0); + PtSetResource(gui.mnvTextArea, Pt_ARG_AREA, &area, 0); } int @@ -2343,8 +2343,8 @@ gui_mch_haskey(char_u *name) int i; for (i = 0; special_keys[i].key_sym != 0; i++) - if (name[0] == special_keys[i].vim_code0 && - name[1] == special_keys[i].vim_code1) + if (name[0] == special_keys[i].mnv_code0 && + name[1] == special_keys[i].mnv_code1) return OK; return FAIL; } @@ -2417,7 +2417,7 @@ gui_ph_toolbar_load_icon(char_u *iconfile) * PhImage_t are copied, and the original PhImage_t aren't needed anymore). */ static PhImage_t * -gui_ph_toolbar_find_icon(vimmenu_T *menu) +gui_ph_toolbar_find_icon(mnvmenu_T *menu) { char_u full_pathname[ MAXPATHL + 1 ]; PhImage_t *icon = NULL; @@ -2451,9 +2451,9 @@ gui_ph_toolbar_find_icon(vimmenu_T *menu) gui_mch_enable_menu(int flag) { if (flag != 0) - PtRealizeWidget(gui.vimMenuBar); + PtRealizeWidget(gui.mnvMenuBar); else - PtUnrealizeWidget(gui.vimMenuBar); + PtUnrealizeWidget(gui.mnvMenuBar); } void @@ -2469,7 +2469,7 @@ gui_mch_set_menu_pos(int x, int y, int w, int h) gui_ph_position_menu(PtWidget_t *widget, int priority) { PtWidget_t *traverse; - vimmenu_T *menu; + mnvmenu_T *menu; traverse = PtWidgetChildBack(PtWidgetParent(widget)); @@ -2497,9 +2497,9 @@ gui_ph_position_menu(PtWidget_t *widget, int priority) * the index is ignored because it's not useful for our purposes */ void -gui_mch_add_menu(vimmenu_T *menu, int index) +gui_mch_add_menu(mnvmenu_T *menu, int index) { - vimmenu_T *parent = menu->parent; + mnvmenu_T *parent = menu->parent; char_u *accel_key; char_u mnemonic_str[MB_LEN_MAX]; int n; @@ -2510,7 +2510,7 @@ gui_mch_add_menu(vimmenu_T *menu, int index) if (menu_is_menubar(menu->name)) { - accel_key = vim_strchr(menu->name, '&'); + accel_key = mnv_strchr(menu->name, '&'); if (accel_key != NULL) { mnemonic_str[0] = accel_key[1]; @@ -2529,7 +2529,7 @@ gui_mch_add_menu(vimmenu_T *menu, int index) PtSetArg(&args[ n++ ], Pt_ARG_BUTTON_TYPE, Pt_MENU_RIGHT, 0); menu->id = PtCreateWidget(PtMenuButton, - (parent == NULL) ? gui.vimMenuBar : parent->submenu_id, + (parent == NULL) ? gui.mnvMenuBar : parent->submenu_id, n, args); PtAddCallback(menu->id, Pt_CB_ARM, gui_ph_handle_pulldown_menu, menu); @@ -2548,7 +2548,7 @@ gui_mch_add_menu(vimmenu_T *menu, int index) if (menu->mnemonic != 0) { - PtAddHotkeyHandler(gui.vimWindow, SAFE_tolower(menu->mnemonic), + PtAddHotkeyHandler(gui.mnvWindow, SAFE_tolower(menu->mnemonic), Pk_KM_Alt, 0, menu, gui_ph_handle_pulldown_menu); } } @@ -2561,16 +2561,16 @@ gui_mch_add_menu(vimmenu_T *menu, int index) } else if (menu_is_popup(menu->name)) { - menu->submenu_id = PtCreateWidget(PtMenu, gui.vimWindow, 0, NULL); + menu->submenu_id = PtCreateWidget(PtMenu, gui.mnvWindow, 0, NULL); PtAddCallback(menu->submenu_id, Pt_CB_UNREALIZED, gui_ph_handle_menu_unrealized, menu); } } void -gui_mch_add_menu_item(vimmenu_T *menu, int index) +gui_mch_add_menu_item(mnvmenu_T *menu, int index) { - vimmenu_T *parent = menu->parent; + mnvmenu_T *parent = menu->parent; char_u *accel_key; char_u mnemonic_str[MB_LEN_MAX]; int n; @@ -2590,7 +2590,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int index) PtSetArg(&args[ n++ ], Pt_ARG_ANCHOR_FLAGS, Pt_TRUE, Pt_ANCHOR_TOP_BOTTOM); PtSetArg(&args[ n++ ], Pt_ARG_WIDTH, 2, 0); - menu->id = PtCreateWidget(PtSeparator, gui.vimToolBar, n, args); + menu->id = PtCreateWidget(PtSeparator, gui.mnvToolBar, n, args); } else { @@ -2621,12 +2621,12 @@ gui_mch_add_menu_item(vimmenu_T *menu, int index) PtSetArg(&args[ n++ ], Pt_ARG_FLAGS, Pt_FALSE, Pt_HIGHLIGHTED | Pt_GETS_FOCUS); PtSetArg(&args[ n++ ], Pt_ARG_FILL_COLOR, Pg_TRANSPARENT, 0); - menu->id = PtCreateWidget(PtButton, gui.vimToolBar, n, args); + menu->id = PtCreateWidget(PtButton, gui.mnvToolBar, n, args); PtAddCallback(menu->id, Pt_CB_ACTIVATE, gui_ph_handle_menu, menu); } // Update toolbar if it's open - if (PtWidgetIsRealized(gui.vimToolBar)) + if (PtWidgetIsRealized(gui.mnvToolBar)) PtRealizeWidget(menu->id); } else @@ -2637,7 +2637,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int index) } else { - accel_key = vim_strchr(menu->name, '&'); + accel_key = mnv_strchr(menu->name, '&'); if (accel_key != NULL) { mnemonic_str[0] = accel_key[1]; @@ -2669,7 +2669,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, int index) } void -gui_mch_destroy_menu(vimmenu_T *menu) +gui_mch_destroy_menu(mnvmenu_T *menu) { if (menu->submenu_id != NULL) PtDestroyWidget(menu->submenu_id); @@ -2681,7 +2681,7 @@ gui_mch_destroy_menu(vimmenu_T *menu) } void -gui_mch_menu_grey(vimmenu_T *menu, int grey) +gui_mch_menu_grey(mnvmenu_T *menu, int grey) { long flags, mask, fields; @@ -2709,7 +2709,7 @@ gui_mch_menu_grey(vimmenu_T *menu, int grey) } void -gui_mch_menu_hidden(vimmenu_T *menu, int hidden) +gui_mch_menu_hidden(mnvmenu_T *menu, int hidden) { // TODO: [un]realize the widget? } @@ -2723,7 +2723,7 @@ gui_mch_draw_menubar(void) } void -gui_mch_show_popupmenu(vimmenu_T *menu) +gui_mch_show_popupmenu(mnvmenu_T *menu) { PtSetResource(menu->submenu_id, Pt_ARG_POS, &abs_mouse, 0); PtRealizeWidget(menu->submenu_id); @@ -2742,9 +2742,9 @@ gui_mch_toggle_tearoffs(int enable) gui_mch_show_toolbar(int showit) { if (showit) - PtRealizeWidget(gui.vimToolBar); + PtRealizeWidget(gui.mnvToolBar); else - PtUnrealizeWidget(gui.vimToolBar); + PtUnrealizeWidget(gui.mnvToolBar); } #endif @@ -2792,15 +2792,15 @@ gui_ph_get_font( style == (info.style & style)) return (GuiFont)font_tag; } - vim_free(font_tag); + mnv_free(font_tag); } return NULL; } /* - * Split up the vim font name + * Split up the mnv font name * - * vim_font is in the form of + * mnv_font is in the form of * :s:a:b:i * * a = antialias @@ -2811,7 +2811,7 @@ gui_ph_get_font( static int gui_ph_parse_font_name( - char_u *vim_font, + char_u *mnv_font, char_u **font_name, int_u *font_flags, int_u *font_size) @@ -2819,13 +2819,13 @@ gui_ph_parse_font_name( char_u *mark; int_u name_len, size; - mark = vim_strchr(vim_font, ':'); + mark = mnv_strchr(mnv_font, ':'); if (mark == NULL) - name_len = STRLEN(vim_font); + name_len = STRLEN(mnv_font); else - name_len = (int_u) (mark - vim_font); + name_len = (int_u) (mark - mnv_font); - *font_name = vim_strnsave(vim_font, name_len); + *font_name = mnv_strnsave(mnv_font, name_len); if (*font_name != NULL) { if (mark != NULL) @@ -2858,7 +2858,7 @@ gui_ph_parse_font_name( } int -gui_mch_init_font(char_u *vim_font_name, int fontset) +gui_mch_init_font(char_u *mnv_font_name, int fontset) { char_u *font_tag; char_u *font_name = NULL; @@ -2868,15 +2868,15 @@ gui_mch_init_font(char_u *vim_font_name, int fontset) FontQueryInfo info; PhRect_t extent; - if (vim_font_name == NULL) + if (mnv_font_name == NULL) { // Default font - vim_font_name = "PC Terminal"; + mnv_font_name = "PC Terminal"; } - if (STRCMP(vim_font_name, "*") == 0) + if (STRCMP(mnv_font_name, "*") == 0) { - font_tag = PtFontSelection(gui.vimWindow, NULL, NULL, + font_tag = PtFontSelection(gui.mnvWindow, NULL, NULL, "pcterm12", -1, PHFONT_FIXED, NULL); if (font_tag == NULL) @@ -2886,18 +2886,18 @@ gui_mch_init_font(char_u *vim_font_name, int fontset) gui.norm_font = font_tag; PfQueryFontInfo(font_tag, &info); - font_name = vim_strsave(info.font); + font_name = mnv_strsave(info.font); } else { - if (gui_ph_parse_font_name(vim_font_name, &font_name, &font_flags, + if (gui_ph_parse_font_name(mnv_font_name, &font_name, &font_flags, &font_size) == FALSE) return FAIL; font_tag = gui_ph_get_font(font_name, font_flags, font_size, 0); if (font_tag == NULL) { - vim_free(font_name); + mnv_free(font_name); return FAIL; } @@ -2920,7 +2920,7 @@ gui_mch_init_font(char_u *vim_font_name, int fontset) gui.char_height = (- extent.ul.y) + extent.lr.y + 1; gui.char_ascent = - extent.ul.y; - vim_free(font_name); + mnv_free(font_name); return OK; } @@ -2941,25 +2941,25 @@ gui_mch_adjust_charheight(void) } GuiFont -gui_mch_get_font(char_u *vim_font_name, int report_error) +gui_mch_get_font(char_u *mnv_font_name, int report_error) { char_u *font_name; char_u *font_tag; int_u font_size = 12; int_u font_flags = 0; - if (gui_ph_parse_font_name(vim_font_name, &font_name, &font_flags, + if (gui_ph_parse_font_name(mnv_font_name, &font_name, &font_flags, &font_size) != FALSE) { font_tag = gui_ph_get_font(font_name, font_flags, font_size, -1); - vim_free(font_name); + mnv_free(font_name); if (font_tag != NULL) return (GuiFont)font_tag; } if (report_error) - semsg(_(e_unknown_font_str), vim_font_name); + semsg(_(e_unknown_font_str), mnv_font_name); return FAIL; } @@ -2974,7 +2974,7 @@ gui_mch_get_fontname(GuiFont font, char_u *name) { if (name == NULL) return NULL; - return vim_strsave(name); + return mnv_strsave(name); } #endif @@ -2987,6 +2987,6 @@ gui_mch_set_font(GuiFont font) void gui_mch_free_font(GuiFont font) { - vim_free(font); + mnv_free(font); } diff --git a/uvim/src/gui_w32.c b/uvim/src/gui_w32.c index 605897fb2b..e59b3ff734 100644 --- a/uvim/src/gui_w32.c +++ b/uvim/src/gui_w32.c @@ -1,11 +1,11 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * GUI support by Robert Webb * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * Windows GUI. @@ -23,7 +23,7 @@ * e.g., replace LONG with LONG_PTR, etc. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_DIRECTX) # include "gui_dwrite.h" @@ -110,7 +110,7 @@ static void keycode_trans_strategy_init(void) // set default value as fallback keycode_trans_strategy_used = &keycode_trans_strategy_classic; - strategy = getenv("VIM_KEYCODE_TRANS_STRATEGY"); + strategy = getenv("MNV_KEYCODE_TRANS_STRATEGY"); if (strategy == NULL) { return; @@ -339,7 +339,7 @@ static WORD s_dlgfntwidth; // width of the dialog font static HMENU s_menuBar = NULL; #endif #ifdef FEAT_TEAROFF -static void rebuild_tearoff(vimmenu_T *menu); +static void rebuild_tearoff(mnvmenu_T *menu); static HBITMAP s_htearbitmap; // bitmap used to indicate tearoff #endif @@ -483,8 +483,8 @@ extern int current_font_height; // this is in os_mswin.c static struct { UINT key_sym; - char_u vim_code0; - char_u vim_code1; + char_u mnv_code0; + char_u mnv_code1; } special_keys[] = { {VK_UP, 'k', 'u'}, @@ -848,7 +848,7 @@ char_to_string(int ch, char_u *string, int slen, int had_alt) if (len > slen) // just in case len = slen; mch_memmove(string, ws, len); - vim_free(ws); + mnv_free(ws); } } @@ -1182,18 +1182,18 @@ _OnMouseEvent( int repeated_click, UINT keyFlags) { - int vim_modifiers = 0x0; + int mnv_modifiers = 0x0; s_getting_focus = FALSE; if (keyFlags & MK_SHIFT) - vim_modifiers |= MOUSE_SHIFT; + mnv_modifiers |= MOUSE_SHIFT; if (keyFlags & MK_CONTROL) - vim_modifiers |= MOUSE_CTRL; + mnv_modifiers |= MOUSE_CTRL; if (GetKeyState(VK_LMENU) & 0x8000) - vim_modifiers |= MOUSE_ALT; + mnv_modifiers |= MOUSE_ALT; - gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers); + gui_send_mouse_event(button, x, y, repeated_click, mnv_modifiers); } static void @@ -1355,14 +1355,14 @@ _OnSizeTextArea( #ifdef FEAT_MENU /* - * Find the vimmenu_T with the given id + * Find the mnvmenu_T with the given id */ - static vimmenu_T * + static mnvmenu_T * gui_mswin_find_menu( - vimmenu_T *pMenu, + mnvmenu_T *pMenu, int id) { - vimmenu_T *pChildMenu; + mnvmenu_T *pChildMenu; while (pMenu) { @@ -1389,7 +1389,7 @@ _OnMenu( HWND hwndCtl UNUSED, UINT codeNotify UNUSED) { - vimmenu_T *pMenu; + mnvmenu_T *pMenu; pMenu = gui_mswin_find_menu(root_menu, id); if (pMenu) @@ -1447,8 +1447,8 @@ _OnFindRepl(void) q = utf16_to_enc(s_findrep_struct.lpstrReplaceWith, NULL); if (p != NULL && q != NULL) gui_do_findrepl(flags, p, q, down); - vim_free(p); - vim_free(q); + mnv_free(p); + mnv_free(q); } #endif @@ -1558,7 +1558,7 @@ _TextAreaWndProc( static void dyn_dwm_load(void) { - hLibDwm = vimLoadLib("dwmapi.dll"); + hLibDwm = mnvLoadLib("dwmapi.dll"); if (hLibDwm == NULL) return; @@ -1592,7 +1592,7 @@ gui_mch_set_titlebar_colors(void) guicolor_T captionColor = DWMWA_COLOR_DEFAULT; guicolor_T textColor = DWMWA_COLOR_DEFAULT; - if (vim_strchr(p_go, GO_TITLEBAR) != NULL) + if (mnv_strchr(p_go, GO_TITLEBAR) != NULL) { if (gui.in_focus) { @@ -1697,7 +1697,7 @@ gui_mch_set_text_area_pos(int x, int y, int w, int h) SetWindowPos(s_textArea, NULL, x, y, w, h, SWP_NOZORDER | SWP_NOACTIVATE); #ifdef FEAT_TOOLBAR - if (vim_strchr(p_go, GO_TOOLBAR) != NULL) + if (mnv_strchr(p_go, GO_TOOLBAR) != NULL) SendMessage(s_toolbarhwnd, WM_SIZE, (WPARAM)0, MAKELPARAM(w, gui.toolbar_height)); #endif @@ -1708,7 +1708,7 @@ gui_mch_set_text_area_pos(int x, int y, int w, int h) RECT rect; # ifdef FEAT_TOOLBAR - if (vim_strchr(p_go, GO_TOOLBAR) != NULL) + if (mnv_strchr(p_go, GO_TOOLBAR) != NULL) top = gui.toolbar_height; # endif GetClientRect(s_hwnd, &rect); @@ -1943,7 +1943,7 @@ gui_mch_get_fontname(GuiFont font UNUSED, char_u *name) { if (name == NULL) return NULL; - return vim_strsave(name); + return mnv_strsave(name); } #endif @@ -2030,9 +2030,9 @@ gui_mch_haskey(char_u *name) { int i; - for (i = 0; special_keys[i].vim_code1 != NUL; i++) - if (name[0] == special_keys[i].vim_code0 - && name[1] == special_keys[i].vim_code1) + for (i = 0; special_keys[i].mnv_code1 != NUL; i++) + if (name[0] == special_keys[i].mnv_code0 + && name[1] == special_keys[i].mnv_code1) return OK; return FAIL; } @@ -2194,7 +2194,7 @@ process_message_usual_key_experimental(UINT vk, const MSG *pmsg) // Construct the state table with only a few modifiers, we don't // really care about the presence of Ctrl/Alt as those modifiers are - // handled by Vim separately. + // handled by MNV separately. memset(keyboard_state, 0, 256); if (GetKeyState(VK_SHIFT) & 0x8000) keyboard_state[VK_SHIFT] = 0x80; @@ -2343,7 +2343,7 @@ process_message(void) else { add_to_input_buf(str, (int)STRLEN(str)); - vim_free(str); // was allocated in CVim::SendKeys() + mnv_free(str); // was allocated in CMNV::SendKeys() } return; } @@ -2483,7 +2483,7 @@ process_message(void) * the TAB key, etc...). */ if (dead_key == DEAD_KEY_SET_DEFAULT - && (special_keys[i].vim_code0 == 'K' + && (special_keys[i].mnv_code0 == 'K' || vk == VK_TAB || vk == CAR)) { outputDeadKey_rePost(msg); @@ -2501,11 +2501,11 @@ process_message(void) #endif modifiers = get_active_modifiers_via_ptr(); - if (special_keys[i].vim_code1 == NUL) - key = special_keys[i].vim_code0; + if (special_keys[i].mnv_code1 == NUL) + key = special_keys[i].mnv_code0; else - key = TO_SPECIAL(special_keys[i].vim_code0, - special_keys[i].vim_code1); + key = TO_SPECIAL(special_keys[i].mnv_code0, + special_keys[i].mnv_code1); key = simplify_key(key, &modifiers); if (key == CSI) key = K_CSI; @@ -2574,7 +2574,7 @@ gui_mch_update(void) if (!s_busy_processing) while (PeekMessageW(&msg, NULL, 0, 0, PM_NOREMOVE) - && !vim_is_input_buf_full()) + && !mnv_is_input_buf_full()) process_message(); } @@ -2771,7 +2771,7 @@ gui_mch_set_menu_pos( */ void gui_mch_menu_hidden( - vimmenu_T *menu, + mnvmenu_T *menu, int hidden) { /* @@ -2854,7 +2854,7 @@ GetTextWidthEnc(HDC hdc, char_u *str, int len) return 0; n = GetTextExtentPointW(hdc, wstr, wlen, &size); - vim_free(wstr); + mnv_free(wstr); if (n) return size.cx; return 0; @@ -2883,7 +2883,7 @@ CenterWindow( wChild = rChild.right - rChild.left; hChild = rChild.bottom - rChild.top; - // If Vim is minimized put the window in the middle of the screen. + // If MNV is minimized put the window in the middle of the screen. if (hwndParent == NULL || IsMinimized(hwndParent)) get_work_area(&rParent); else @@ -2965,7 +2965,7 @@ add_tabline_popup_menu_entry(HMENU pmenu, UINT item_id, char_u *item_text) infow.dwTypeData = wn; infow.cch = (UINT)wcslen(wn); InsertMenuItemW(pmenu, item_id, FALSE, &infow); - vim_free(wn); + mnv_free(wn); } static void @@ -3097,7 +3097,7 @@ gui_mch_update_tabline(void) tiw.iImage = -1; tiw.pszText = wstr; SendMessage(s_tabhwnd, TCM_SETITEMW, (WPARAM)nr, (LPARAM)&tiw); - vim_free(wstr); + mnv_free(wstr); } } @@ -3150,7 +3150,7 @@ gui_mch_set_dark_theme(int dark) static void dyn_uxtheme_load(void) { - hUxThemeLib = vimLoadLib("uxtheme.dll"); + hUxThemeLib = mnvLoadLib("uxtheme.dll"); if (hUxThemeLib == NULL) return; @@ -3304,10 +3304,10 @@ initialise_findrep(char_u *initial_string) wcsncpy(s_findrep_struct.lpstrFindWhat, p, len); s_findrep_struct.lpstrFindWhat[len] = NUL; - vim_free(p); + mnv_free(p); } } - vim_free(entry_text); + mnv_free(entry_text); } #endif @@ -3323,7 +3323,7 @@ set_window_title(HWND hwnd, char *title) if (wbuf != NULL) { SetWindowTextW(hwnd, wbuf); - vim_free(wbuf); + mnv_free(wbuf); } } else @@ -3393,7 +3393,7 @@ gui_mch_mousehide(int hide) #ifdef FEAT_MENU static void -gui_mch_show_popupmenu_at(vimmenu_T *menu, int x, int y) +gui_mch_show_popupmenu_at(mnvmenu_T *menu, int x, int y) { // Unhide the mouse, we don't get move events here. gui_mch_mousehide(FALSE); @@ -3513,7 +3513,7 @@ _OnKillFocus( } /* - * Get a message when the user switches back to vim + * Get a message when the user switches back to mnv */ static LRESULT _OnActivateApp( @@ -3662,19 +3662,19 @@ is_window_onscreen(HWND hwnd) get_scroll_flags(void) { HWND hwnd; - RECT rcVim, rcOther, rcDest; + RECT rcMNV, rcOther, rcDest; // Check if the window is (partly) off-screen. if (!is_window_onscreen(s_hwnd)) return SW_INVALIDATE; // Check if there is a window (partly) on top of us. - GetWindowRect(s_hwnd, &rcVim); + GetWindowRect(s_hwnd, &rcMNV); for (hwnd = s_hwnd; (hwnd = GetWindow(hwnd, GW_HWNDPREV)) != (HWND)0; ) if (IsWindowVisible(hwnd)) { GetWindowRect(hwnd, &rcOther); - if (IntersectRect(&rcDest, &rcVim, &rcOther)) + if (IntersectRect(&rcDest, &rcMNV, &rcOther)) return SW_INVALIDATE; } return 0; @@ -3683,7 +3683,7 @@ get_scroll_flags(void) /* * On some Intel GPUs, the regions drawn just prior to ScrollWindowEx() * may not be scrolled out properly. - * For gVim, when _OnScroll() is repeated, the character at the + * For gMNV, when _OnScroll() is repeated, the character at the * previous cursor position may be left drawn after scroll. * The problem can be avoided by calling GetPixel() to get a pixel in * the region before ScrollWindowEx(). @@ -3841,13 +3841,13 @@ logfont2name(LOGFONTW lf) points = pixels_to_points( lf.lfHeight < 0 ? -lf.lfHeight : lf.lfHeight, TRUE); if (lf.lfWeight == FW_NORMAL || lf.lfWeight == FW_BOLD) - res_len = vim_snprintf_safelen( + res_len = mnv_snprintf_safelen( (char *)res, res_size, "%s:h%d", font_name, points); else - res_len = vim_snprintf_safelen( + res_len = mnv_snprintf_safelen( (char *)res, res_size, "%s:h%d:W%ld", font_name, points, lf.lfWeight); - res_len += vim_snprintf_safelen( + res_len += mnv_snprintf_safelen( (char *)res + res_len, res_size - res_len, "%s%s%s%s", @@ -3857,14 +3857,14 @@ logfont2name(LOGFONTW lf) lf.lfStrikeOut ? ":s" : ""); if (charset_name != NULL) - res_len += vim_snprintf_safelen((char *)res + res_len, + res_len += mnv_snprintf_safelen((char *)res + res_len, res_size - res_len, ":c%s", charset_name); if (quality_name != NULL) - vim_snprintf((char *)res + res_len, + mnv_snprintf((char *)res + res_len, res_size - res_len, ":q%s", quality_name); } - vim_free(font_name); + mnv_free(font_name); return (char_u *)res; } @@ -3936,7 +3936,7 @@ gui_mch_wide_font_changed(void) } /* - * Initialise vim to use the font with the given name. + * Initialise mnv to use the font with the given name. * Return FAIL if the font could not be loaded, OK otherwise. */ int @@ -3977,11 +3977,11 @@ gui_mch_init_font(char_u *font_name, int fontset UNUSED) // When setting 'guifont' to "*" replace it with the actual font name. if (STRCMP(font_name, "*") == 0 && STRCMP(p_guifont, "*") == 0) { - vim_free(p_guifont); + mnv_free(p_guifont); p_guifont = p; } else - vim_free(p); + mnv_free(p); } gui_mch_free_font(gui.ital_font); @@ -4080,7 +4080,7 @@ gui_mch_settitle( char_u *title, char_u *icon UNUSED) { - set_window_title(s_hwnd, (title == NULL ? "VIM" : (char *)title)); + set_window_title(s_hwnd, (title == NULL ? "MNV" : (char *)title)); } #if defined(FEAT_MOUSESHAPE) @@ -4150,7 +4150,7 @@ convert_filterW(char_u *s) return NULL; len = (int)STRLEN(s) + 3; res = enc_to_utf16(tmp, &len); - vim_free(tmp); + mnv_free(tmp); return res; } @@ -4198,7 +4198,7 @@ gui_mch_browse( for (i = 0; wp[i] != NUL && i < MAXPATHL - 1; ++i) fileBuf[i] = wp[i]; fileBuf[i] = NUL; - vim_free(wp); + mnv_free(wp); } } @@ -4224,7 +4224,7 @@ gui_mch_browse( fileStruct.lpstrFile = fileBuf; fileStruct.nMaxFile = MAXPATHL; fileStruct.lpstrFilter = filterp; - fileStruct.hwndOwner = s_hwnd; // main Vim window is owner + fileStruct.hwndOwner = s_hwnd; // main MNV window is owner // has an initial dir been specified? if (initdir != NULL && *initdir != NUL) { @@ -4242,10 +4242,10 @@ gui_mch_browse( /* * TODO: Allow selection of multiple files. Needs another arg to this * function to ask for it, and need to use OFN_ALLOWMULTISELECT below. - * Also, should we use OFN_FILEMUSTEXIST when opening? Vim can edit on + * Also, should we use OFN_FILEMUSTEXIST when opening? MNV can edit on * files that don't exist yet, so I haven't put it in. What about * OFN_PATHMUSTEXIST? - * Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog. + * Don't use OFN_OVERWRITEPROMPT, MNV has its own ":confirm" dialog. */ fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY); # ifdef FEAT_SHORTCUT @@ -4257,10 +4257,10 @@ gui_mch_browse( else ret = GetOpenFileNameW(&fileStruct); - vim_free(filterp); - vim_free(initdirp); - vim_free(titlep); - vim_free(extp); + mnv_free(filterp); + mnv_free(initdirp); + mnv_free(titlep); + mnv_free(extp); if (!ret) return NULL; @@ -4274,8 +4274,8 @@ gui_mch_browse( SetFocus(s_hwnd); // Shorten the file name if possible - q = vim_strsave(shorten_fname1(p)); - vim_free(p); + q = mnv_strsave(shorten_fname1(p)); + mnv_free(p); return q; } @@ -4354,7 +4354,7 @@ _OnDropFiles( else { DragQueryFile(hDrop, i, szFile, BUFPATHLEN); - fnames[i] = vim_strsave((char_u *)szFile); + fnames[i] = mnv_strsave((char_u *)szFile); } } @@ -4525,8 +4525,8 @@ static UINT s_menu_id = 100; */ #define USE_SYSMENU_FONT -#define VIM_NAME "vim" -#define VIM_CLASSW L"Vim" +#define MNV_NAME "mnv" +#define MNV_CLASSW L"MNV" // Initial size for the dialog template. For gui_mch_dialog() it's fixed, // thus there should be room for every dialog. For tearoffs it's made bigger @@ -4550,7 +4550,7 @@ add_dialog_element( static LPWORD lpwAlign(LPWORD); static int nCopyAnsiToWideChar(LPWORD, LPSTR, BOOL); #if defined(FEAT_MENU) && defined(FEAT_TEAROFF) -static void gui_mch_tearoff(char_u *title, vimmenu_T *menu, int initX, int initY); +static void gui_mch_tearoff(char_u *title, mnvmenu_T *menu, int initX, int initY); #endif static void get_dialog_font_metrics(void); @@ -4560,7 +4560,7 @@ static int dialog_default_button = -1; static void initialise_toolbar(void); static void update_toolbar_size(void); static LRESULT CALLBACK toolbar_wndproc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); -static int get_toolbar_bitmap(vimmenu_T *menu); +static int get_toolbar_bitmap(mnvmenu_T *menu); #else # define update_toolbar_size() #endif @@ -4636,14 +4636,14 @@ gui_mswin_get_menu_height( { // The height of the menu cannot be determined while the window is // minimized. Take the previous height if the menu is changed in that - // state, to avoid that Vim's vertical window size accidentally + // state, to avoid that MNV's vertical window size accidentally // increases due to the unaccounted-for menu height. menu_height = old_menu_height == -1 ? 0 : old_menu_height; } else { /* - * In case 'lines' is set in _vimrc/_gvimrc window width doesn't + * In case 'lines' is set in _mnvrc/_gmnvrc window width doesn't * seem to have been set yet, so menu wraps in default window * width which is very narrow. Instead just return height of a * single menu item. Will still be wrong when the menu really @@ -4745,7 +4745,7 @@ _OnMouseWheel(HWND hwnd UNUSED, WPARAM wParam, LPARAM lParam, int horizontal) if (wp == NULL || !p_scf) wp = curwin; - // Translate the scroll event into an event that Vim can process so that + // Translate the scroll event into an event that MNV can process so that // the user has a chance to map the scrollwheel buttons. if (horizontal) button = zDelta >= 0 ? MOUSE_6 : MOUSE_7; @@ -5042,7 +5042,7 @@ _OnNotify(HWND hwnd, UINT id, NMHDR *hdr) char_u *str = NULL; static void *tt_text = NULL; - VIM_CLEAR(tt_text); + MNV_CLEAR(tt_text); # ifdef FEAT_GUI_TABLINE if (gui_mch_showing_tabline() @@ -5087,7 +5087,7 @@ _OnNotify(HWND hwnd, UINT id, NMHDR *hdr) # endif { UINT idButton; - vimmenu_T *pMenu; + mnvmenu_T *pMenu; idButton = (UINT) hdr->idFrom; pMenu = gui_mswin_find_menu(root_menu, idButton); @@ -5116,8 +5116,8 @@ _OnNotify(HWND hwnd, UINT id, NMHDR *hdr) size_t len = STRLEN(str); if (len < sizeof(lpdi->szText) - || ((tt_text = vim_strnsave(str, len)) == NULL)) - vim_strncpy((char_u *)lpdi->szText, str, + || ((tt_text = mnv_strnsave(str, len)) == NULL)) + mnv_strncpy((char_u *)lpdi->szText, str, sizeof(lpdi->szText) - 1); else lpdi->lpszText = tt_text; @@ -5159,7 +5159,7 @@ _OnMenuSelect(HWND hwnd, WPARAM wParam, LPARAM lParam) == MF_HILITE && (State & MODE_CMDLINE) == 0) { - vimmenu_T *pMenu; + mnvmenu_T *pMenu; static int did_menu_tip = FALSE; if (did_menu_tip) @@ -5411,7 +5411,7 @@ _WndProc( */ // parent window, if specified with -P -HWND vim_parent_hwnd = NULL; +HWND mnv_parent_hwnd = NULL; static BOOL CALLBACK FindWindowTitle(HWND hwnd, LPARAM lParam) @@ -5425,8 +5425,8 @@ FindWindowTitle(HWND hwnd, LPARAM lParam) { // Found it. Store the window ref. and quit searching if MDI // works. - vim_parent_hwnd = FindWindowEx(hwnd, NULL, "MDIClient", NULL); - if (vim_parent_hwnd != NULL) + mnv_parent_hwnd = FindWindowEx(hwnd, NULL, "MDIClient", NULL); + if (mnv_parent_hwnd != NULL) return FALSE; } } @@ -5441,7 +5441,7 @@ FindWindowTitle(HWND hwnd, LPARAM lParam) gui_mch_set_parent(char *title) { EnumWindows(FindWindowTitle, (LPARAM)title); - if (vim_parent_hwnd == NULL) + if (mnv_parent_hwnd == NULL) { semsg(_(e_cannot_find_window_title_str), title); mch_exit(2); @@ -5454,12 +5454,12 @@ ole_error(char *arg) { char buf[IOSIZE]; -# ifdef VIMDLL +# ifdef MNVDLL gui.in_use = mch_is_gui_executable(); # endif // Can't use emsg() here, we have not finished initialisation yet. - vim_snprintf(buf, IOSIZE, + mnv_snprintf(buf, IOSIZE, _(e_argument_not_supported_str_use_ole_version), arg); mch_errmsg(buf); } @@ -5467,9 +5467,9 @@ ole_error(char *arg) #if defined(GUI_MAY_SPAWN) static char * -gvim_error(void) +gmnv_error(void) { - char *msg = _(e_gui_cannot_be_used_cannot_execute_gvim_exe); + char *msg = _(e_gui_cannot_be_used_cannot_execute_gmnv_exe); if (starting) { @@ -5498,11 +5498,11 @@ gui_mch_do_spawn(char_u *arg) p = wcsrchr(name, L'\\'); if (p == NULL) goto error; - // Replace the executable name from vim(d).exe to gvim(d).exe. + // Replace the executable name from mnv(d).exe to gmnv(d).exe. # ifdef DEBUG - wcscpy(p + 1, L"gvimd.exe"); + wcscpy(p + 1, L"gmnvd.exe"); # else - wcscpy(p + 1, L"gvim.exe"); + wcscpy(p + 1, L"gmnv.exe"); # endif # if defined(FEAT_SESSION) && defined(EXPERIMENTAL_GUI_CMD) @@ -5532,18 +5532,18 @@ gui_mch_do_spawn(char_u *arg) char_u *savebg; int ret; - session = vim_tempname('s', FALSE); + session = mnv_tempname('s', FALSE); if (session == NULL) goto error; savebg = p_bg; - p_bg = vim_strnsave((char_u *)"light", 5); // Set 'bg' to "light". + p_bg = mnv_strnsave((char_u *)"light", 5); // Set 'bg' to "light". if (p_bg == NULL) { p_bg = savebg; goto error; } ret = write_session_file(session); - vim_free(p_bg); + mnv_free(p_bg); p_bg = savebg; if (!ret) goto error; @@ -5554,13 +5554,13 @@ gui_mch_do_spawn(char_u *arg) cmd = ALLOC_MULT(WCHAR, len); if (cmd == NULL) { - vim_free(wsession); + mnv_free(wsession); goto error; } tofree1 = cmd; _snwprintf(cmd, len, L" -S \"%s\" -c \"call delete('%s')\"", wsession, wsession); - vim_free(wsession); + mnv_free(wsession); } # endif @@ -5594,19 +5594,19 @@ error: # if defined(FEAT_SESSION) && defined(EXPERIMENTAL_GUI_CMD) if (session) mch_remove(session); - vim_free(session); - vim_free(tofree1); + mnv_free(session); + mnv_free(tofree1); # endif - vim_free(newcmd); - vim_free(tofree2); - return gvim_error(); + mnv_free(newcmd); + mnv_free(tofree2); + return gmnv_error(); } #endif /* * Parse the GUI related command-line arguments. Any arguments used are * deleted from argv, and *argc is decremented accordingly. This is called - * when Vim is started, whether or not the GUI has been started. + * when MNV is started, whether or not the GUI has been started. */ void gui_mch_prepare(int *argc, char **argv) @@ -5627,7 +5627,7 @@ gui_mch_prepare(int *argc, char **argv) else idx = 1; - // Register Vim as an OLE Automation server + // Register MNV as an OLE Automation server if (STRICMP(argv[idx] + 1, "register") == 0) { #ifdef FEAT_OLE @@ -5640,7 +5640,7 @@ gui_mch_prepare(int *argc, char **argv) #endif } - // Unregister Vim as an OLE Automation server + // Unregister MNV as an OLE Automation server if (STRICMP(argv[idx] + 1, "unregister") == 0) { #ifdef FEAT_OLE @@ -5669,7 +5669,7 @@ gui_mch_prepare(int *argc, char **argv) } #ifdef FEAT_OLE -# ifdef VIMDLL +# ifdef MNVDLL if (mch_is_gui_executable()) # endif { @@ -5736,7 +5736,7 @@ load_dpi_func(void) fail: // Disable PerMonitorV2 APIs. - pGetDpiForSystem = vimGetDpiForSystem; + pGetDpiForSystem = mnvGetDpiForSystem; pGetDpiForWindow = NULL; pGetSystemMetricsForDpi = stubGetSystemMetricsForDpi; pSetThreadDpiAwarenessContext = NULL; @@ -5750,8 +5750,8 @@ fail: int gui_mch_init(void) { - const WCHAR szVimWndClassW[] = VIM_CLASSW; - const WCHAR szTextAreaClassW[] = L"VimTextArea"; + const WCHAR szMNVWndClassW[] = MNV_CLASSW; + const WCHAR szTextAreaClassW[] = L"MNVTextArea"; WNDCLASSW wndclassw; // Return here if the window was already opened (happens when @@ -5789,24 +5789,24 @@ gui_mch_init(void) // First try using the wide version, so that we can use any title. // Otherwise only characters in the active codepage will work. - if (GetClassInfoW(g_hinst, szVimWndClassW, &wndclassw) == 0) + if (GetClassInfoW(g_hinst, szMNVWndClassW, &wndclassw) == 0) { wndclassw.style = CS_DBLCLKS; wndclassw.lpfnWndProc = _WndProc; wndclassw.cbClsExtra = 0; wndclassw.cbWndExtra = 0; wndclassw.hInstance = g_hinst; - wndclassw.hIcon = LoadIcon(wndclassw.hInstance, "IDR_VIM"); + wndclassw.hIcon = LoadIcon(wndclassw.hInstance, "IDR_MNV"); wndclassw.hCursor = LoadCursor(NULL, IDC_ARROW); wndclassw.hbrBackground = s_brush; wndclassw.lpszMenuName = NULL; - wndclassw.lpszClassName = szVimWndClassW; + wndclassw.lpszClassName = szMNVWndClassW; if (RegisterClassW(&wndclassw) == 0) return FAIL; } - if (vim_parent_hwnd != NULL) + if (mnv_parent_hwnd != NULL) { #ifdef HAVE_TRY_EXCEPT __try @@ -5817,14 +5817,14 @@ gui_mch_init(void) // structure. s_hwnd = CreateWindowExW( WS_EX_MDICHILD, - szVimWndClassW, L"Vim MSWindows GUI", + szMNVWndClassW, L"MNV MSWindows GUI", WS_OVERLAPPEDWINDOW | WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 0xC000, gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, gui_win_y == -1 ? CW_USEDEFAULT : gui_win_y, 100, // Any value will do 100, // Any value will do - vim_parent_hwnd, NULL, + mnv_parent_hwnd, NULL, g_hinst, NULL); #ifdef HAVE_TRY_EXCEPT } @@ -5849,7 +5849,7 @@ gui_mch_init(void) // Create a window. If win_socket_id is not zero without border and // titlebar, it will be reparented below. s_hwnd = CreateWindowW( - szVimWndClassW, L"Vim MSWindows GUI", + szMNVWndClassW, L"MNV MSWindows GUI", (win_socket_id == 0 ? WS_OVERLAPPEDWINDOW : WS_POPUP) | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, gui_win_x == -1 ? CW_USEDEFAULT : gui_win_x, @@ -5899,7 +5899,7 @@ gui_mch_init(void) s_textArea = CreateWindowExW( 0, - szTextAreaClassW, L"Vim text area", + szTextAreaClassW, L"MNV text area", WS_CHILD | WS_VISIBLE, 0, 0, 100, // Any value will do for now 100, // Any value will do for now @@ -5910,7 +5910,7 @@ gui_mch_init(void) return FAIL; #ifdef FEAT_LIBCALL - // Try loading an icon from $RUNTIMEPATH/bitmaps/vim.ico. + // Try loading an icon from $RUNTIMEPATH/bitmaps/mnv.ico. { HANDLE hIcon = NULL; @@ -5932,7 +5932,7 @@ gui_mch_init(void) // Get background/foreground colors from the system gui_mch_def_colors(); - // Get the colors from the "Normal" group (set in syntax.c or in a vimrc + // Get the colors from the "Normal" group (set in syntax.c or in a mnvrc // file) set_normal_colors(); @@ -5992,7 +5992,7 @@ gui_mch_init(void) #ifdef FEAT_EVAL // set the v:windowid variable - set_vim_var_nr(VV_WINDOWID, HandleToLong(s_hwnd)); + set_mnv_var_nr(VV_WINDOWID, HandleToLong(s_hwnd)); #endif #ifdef FEAT_RENDER_OPTIONS @@ -6075,7 +6075,7 @@ gui_mch_set_shellsize( + pGetSystemMetricsForDpi(SM_CYCAPTION, s_dpi) + gui_mswin_get_menu_height(FALSE); - // The following should take care of keeping Vim on the same monitor, no + // The following should take care of keeping MNV on the same monitor, no // matter if the secondary monitor is left or right of the primary // monitor. window_rect.right = window_rect.left + win_width; @@ -6268,7 +6268,7 @@ _OnImeComposition(HWND hwnd, WPARAM dbcs UNUSED, LPARAM param) if (ret != NULL) { add_to_input_buf_csi(ret, len); - vim_free(ret); + mnv_free(ret); return 1; } return 0; @@ -6307,7 +6307,7 @@ GetResultStr(HWND hwnd, int GCS, int *lenp) convbuf = utf16_to_enc(buf, lenp); pImmReleaseContext(hwnd, hIMC); - vim_free(buf); + mnv_free(buf); return convbuf; } #endif @@ -6367,7 +6367,7 @@ im_set_active(int active) HIMC hImc; static HIMC hImcOld = (HIMC)0; -# ifdef VIMDLL +# ifdef MNVDLL if (!gui.in_use && !gui.starting) { mbyte_im_set_active(active); @@ -6444,7 +6444,7 @@ im_get_status(void) int status = 0; HIMC hImc; -# ifdef VIMDLL +# ifdef MNVDLL if (!gui.in_use && !gui.starting) return mbyte_im_get_status(); # endif @@ -6690,7 +6690,7 @@ gui_mch_draw_string( { int i; - vim_free(padding); + mnv_free(padding); pad_size = Columns; // Don't give an out-of-memory message here, it would call us @@ -6731,10 +6731,10 @@ gui_mch_draw_string( || enc_latin9) && (unicodebuf == NULL || len > unibuflen)) { - vim_free(unicodebuf); + mnv_free(unicodebuf); unicodebuf = LALLOC_MULT(WCHAR, len); - vim_free(unicodepdy); + mnv_free(unicodepdy); unicodepdy = LALLOC_MULT(int, len); unibuflen = len; @@ -6945,10 +6945,10 @@ gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) */ void gui_mch_add_menu( - vimmenu_T *menu, + mnvmenu_T *menu, int pos) { - vimmenu_T *parent = menu->parent; + mnvmenu_T *parent = menu->parent; menu->submenu_id = CreatePopupMenu(); menu->id = s_menu_id++; @@ -6974,7 +6974,7 @@ gui_mch_add_menu( InsertMenuItemW((parent == NULL) ? s_menuBar : parent->submenu_id, (UINT)pos, TRUE, &infow); - vim_free(wn); + mnv_free(wn); } // Fix window size if menu may have wrapped @@ -6987,7 +6987,7 @@ gui_mch_add_menu( } void -gui_mch_show_popupmenu(vimmenu_T *menu) +gui_mch_show_popupmenu(mnvmenu_T *menu) { POINT mp; @@ -6998,7 +6998,7 @@ gui_mch_show_popupmenu(vimmenu_T *menu) void gui_make_popup(char_u *path_name, int mouse_pos) { - vimmenu_T *menu = gui_find_menu(path_name); + mnvmenu_T *menu = gui_find_menu(path_name); if (menu == NULL) return; @@ -7032,7 +7032,7 @@ gui_make_popup(char_u *path_name, int mouse_pos) void gui_make_tearoff(char_u *path_name) { - vimmenu_T *menu = gui_find_menu(path_name); + mnvmenu_T *menu = gui_find_menu(path_name); // Found the menu, so tear it off. if (menu != NULL) @@ -7045,10 +7045,10 @@ gui_make_tearoff(char_u *path_name) */ void gui_mch_add_menu_item( - vimmenu_T *menu, + mnvmenu_T *menu, int idx) { - vimmenu_T *parent = menu->parent; + mnvmenu_T *parent = menu->parent; menu->id = s_menu_id++; menu->submenu_id = NULL; @@ -7096,7 +7096,7 @@ gui_mch_add_menu_item( (menu_is_separator(menu->name) ? MF_SEPARATOR : MF_STRING) | MF_BYPOSITION, (UINT)menu->id, wn); - vim_free(wn); + mnv_free(wn); } # ifdef FEAT_TEAROFF if (IsWindow(parent->tearoff_handle)) @@ -7109,7 +7109,7 @@ gui_mch_add_menu_item( * Destroy the machine specific menu widget. */ void -gui_mch_destroy_menu(vimmenu_T *menu) +gui_mch_destroy_menu(mnvmenu_T *menu) { # ifdef FEAT_TOOLBAR /* @@ -7151,7 +7151,7 @@ gui_mch_destroy_menu(vimmenu_T *menu) # ifdef FEAT_TEAROFF static void -rebuild_tearoff(vimmenu_T *menu) +rebuild_tearoff(mnvmenu_T *menu) { //hackish char_u tbuf[128]; @@ -7194,7 +7194,7 @@ rebuild_tearoff(vimmenu_T *menu) */ void gui_mch_menu_grey( - vimmenu_T *menu, + mnvmenu_T *menu, int grey) { # ifdef FEAT_TOOLBAR @@ -7290,10 +7290,10 @@ dialog_callback( p = utf16_to_enc(wp, NULL); if (p != NULL) { - vim_strncpy(s_textfield, p, IOSIZE); - vim_free(p); + mnv_strncpy(s_textfield, p, IOSIZE); + mnv_free(p); } - vim_free(wp); + mnv_free(wp); } /* @@ -7337,11 +7337,11 @@ dialog_callback( static const char *dlg_icons[] = // must match names in resource file { - "IDR_VIM", - "IDR_VIM_ERROR", - "IDR_VIM_ALERT", - "IDR_VIM_INFO", - "IDR_VIM_QUESTION" + "IDR_MNV", + "IDR_MNV_ERROR", + "IDR_MNV_ALERT", + "IDR_MNV_INFO", + "IDR_MNV_QUESTION" }; int @@ -7395,7 +7395,7 @@ gui_mch_dialog( # ifndef NO_CONSOLE // Don't output anything in silent mode ("ex -s") -# ifdef VIMDLL +# ifdef MNVDLL if (!(gui.in_use || gui.starting)) # endif if (silent_mode) @@ -7411,7 +7411,7 @@ gui_mch_dialog( else dpi = pGetDpiForSystem(); - if ((type < 0) || (type > VIM_LAST_TYPE)) + if ((type < 0) || (type > MNV_LAST_TYPE)) type = 0; // allocate some memory for dialog template @@ -7424,10 +7424,10 @@ gui_mch_dialog( /* * make a copy of 'buttons' to fiddle with it. compiler grizzles because - * vim_strsave() doesn't take a const arg (why not?), so cast away the + * mnv_strsave() doesn't take a const arg (why not?), so cast away the * const. */ - tbuffer = vim_strsave(buttons); + tbuffer = mnv_strsave(buttons); if (tbuffer == NULL) return -1; @@ -7529,7 +7529,7 @@ gui_mch_dialog( for (pend = pstart; *pend != NUL && *pend != '\n'; ) { l = (*mb_ptr2len)(pend); - if (l == 1 && VIM_ISWHITE(*pend) + if (l == 1 && MNV_ISWHITE(*pend) && textWidth > maxDialogWidth * 3 / 4) last_white = pend; textWidth += GetTextWidthEnc(hdc, pend, l); @@ -7583,7 +7583,7 @@ gui_mch_dialog( * Check button names. A long one will make the dialog wider. * When called early (-register error message) p_go isn't initialized. */ - vertical = (p_go != NULL && vim_strchr(p_go, GO_VERTICAL) != NULL); + vertical = (p_go != NULL && mnv_strchr(p_go, GO_VERTICAL) != NULL); if (!vertical) { // Place buttons horizontally if they fit. @@ -7592,7 +7592,7 @@ gui_mch_dialog( i = 0; do { - pend = vim_strchr(pstart, DLG_BUTTON_SEP); + pend = mnv_strchr(pstart, DLG_BUTTON_SEP); if (pend == NULL) pend = pstart + STRLEN(pstart); // Last button name. textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart)); @@ -7617,7 +7617,7 @@ gui_mch_dialog( pstart = tbuffer; do { - pend = vim_strchr(pstart, DLG_BUTTON_SEP); + pend = mnv_strchr(pstart, DLG_BUTTON_SEP); if (pend == NULL) pend = pstart + STRLEN(pstart); // Last button name. textWidth = GetTextWidthEnc(hdc, pstart, (int)(pend - pstart)); @@ -7672,7 +7672,7 @@ gui_mch_dialog( // copy the title of the dialog nchar = nCopyAnsiToWideChar(p, (title ? (LPSTR)title - : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE); + : (LPSTR)("MNV "MNV_VERSION_MEDIUM)), TRUE); p += nchar; // do the font, since DS_3DLOOK doesn't work properly @@ -7752,7 +7752,7 @@ gui_mch_dialog( } *pnumitems += numButtons; - // Vim icon + // MNV icon p = add_dialog_element(p, SS_ICON, PixelToDialogX(dlgPaddingX), PixelToDialogY(dlgPaddingY), @@ -7810,10 +7810,10 @@ gui_mch_dialog( (DLGPROC)dialog_callback); LocalFree(LocalHandle(pdlgtemplate)); - vim_free(tbuffer); - vim_free(buttonWidths); - vim_free(buttonPositions); - vim_free(ga.ga_data); + mnv_free(tbuffer); + mnv_free(buttonWidths); + mnv_free(buttonPositions); + mnv_free(ga.ga_data); // Focus back to our window (for when MDI is used). (void)SetFocus(s_hwnd); @@ -7921,7 +7921,7 @@ nCopyAnsiToWideChar( { wcscpy(lpWCStr, wn); nChar = (int)wcslen(wn) + 1; - vim_free(wn); + mnv_free(wn); } } if (nChar == 0) @@ -7945,7 +7945,7 @@ nCopyAnsiToWideChar( */ static HMENU tearoff_lookup_menuhandle( - vimmenu_T *menu, + mnvmenu_T *menu, WORD menu_id) { for ( ; menu != NULL; menu = menu->next) @@ -7962,7 +7962,7 @@ tearoff_lookup_menuhandle( /* * The callback function for all the modeless dialogs that make up the - * "tearoff menus" Very simple - forward button presses (to fool Vim into + * "tearoff menus" Very simple - forward button presses (to fool MNV into * thinking its menus have been clicked), and go away when closed. */ static LRESULT CALLBACK @@ -7990,9 +7990,9 @@ tearoff_callback( if (GetCursorPos(&mp) && GetWindowRect(hwnd, &rect)) { - vimmenu_T *menu; + mnvmenu_T *menu; - menu = (vimmenu_T*)GetWindowLongPtr(hwnd, DWLP_USER); + menu = (mnvmenu_T*)GetWindowLongPtr(hwnd, DWLP_USER); (void)TrackPopupMenu( tearoff_lookup_menuhandle(menu, LOWORD(wParam)), TPM_LEFTALIGN | TPM_LEFTBUTTON, @@ -8008,7 +8008,7 @@ tearoff_callback( } } else - // Pass on messages to the main Vim window + // Pass on messages to the main MNV window PostMessage(s_hwnd, WM_COMMAND, LOWORD(wParam), 0); /* * Give main window the focus back: this is so after @@ -8073,7 +8073,7 @@ get_dialog_font_metrics(void) static void gui_mch_tearoff( char_u *title, - vimmenu_T *menu, + mnvmenu_T *menu, int initX, int initY) { @@ -8084,9 +8084,9 @@ gui_mch_tearoff( DWORD lExtendedStyle; WORD dlgwidth; WORD menuID; - vimmenu_T *pmenu; - vimmenu_T *top_menu; - vimmenu_T *the_menu = menu; + mnvmenu_T *pmenu; + mnvmenu_T *top_menu; + mnvmenu_T *the_menu = menu; HWND hwnd; HDC hdc; HFONT font, oldFont; @@ -8228,7 +8228,7 @@ gui_mch_tearoff( // copy the title of the dialog nchar = nCopyAnsiToWideChar(p, ((*title) ? (LPSTR)title - : (LPSTR)("Vim "VIM_VERSION_MEDIUM)), TRUE); + : (LPSTR)("MNV "MNV_VERSION_MEDIUM)), TRUE); p += nchar; // do the font, since DS_3DLOOK doesn't work properly @@ -8324,8 +8324,8 @@ gui_mch_tearoff( if (label == NULL) break; - vim_strncpy(text, menu->name, nameLen); - text = vim_strchr(text, TAB); // stop at TAB before actext + mnv_strncpy(text, menu->name, nameLen); + text = mnv_strchr(text, TAB); // stop at TAB before actext if (text == NULL) text = label + nameLen; // no actext, use whole name while (padding0-- > 0) @@ -8360,7 +8360,7 @@ gui_mch_tearoff( (WORD)PixelToDialogX(dlgwidth - 2 * TEAROFF_PADDING_X), (WORD)12, menuID, (WORD)0x0080, (char *)label); - vim_free(label); + mnv_free(label); (*pnumitems)++; } @@ -8398,7 +8398,7 @@ gui_mch_tearoff( /* * Create the toolbar, initially unpopulated. * (just like the menu, there are no defaults, it's all - * set up through menu.vim) + * set up through menu.mnv) */ static void initialise_toolbar(void) @@ -8427,7 +8427,7 @@ initialise_toolbar(void) s_toolbar_wndproc = SubclassWindow(s_toolbarhwnd, toolbar_wndproc); - gui_mch_show_toolbar(vim_strchr(p_go, GO_TOOLBAR) != NULL); + gui_mch_show_toolbar(mnv_strchr(p_go, GO_TOOLBAR) != NULL); update_toolbar_size(); } @@ -8470,7 +8470,7 @@ toolbar_wndproc( } static int -get_toolbar_bitmap(vimmenu_T *menu) +get_toolbar_bitmap(mnvmenu_T *menu) { int i = -1; @@ -8541,7 +8541,7 @@ initialise_tabline(void) { InitCommonControls(); - s_tabhwnd = CreateWindow(WC_TABCONTROL, "Vim tabline", + s_tabhwnd = CreateWindow(WC_TABCONTROL, "MNV tabline", WS_CHILD|TCS_FOCUSNEVER|TCS_TOOLTIPS, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, s_hwnd, NULL, g_hinst, NULL); @@ -8690,7 +8690,7 @@ gui_mch_set_foreground(void) static void dyn_imm_load(void) { - hLibImm = vimLoadLib("imm32.dll"); + hLibImm = mnvLoadLib("imm32.dll"); if (hLibImm == NULL) return; @@ -8895,7 +8895,7 @@ gui_mch_destroy_sign(void *sign) return; close_signicon_image((signicon_t *)sign); - vim_free(sign); + mnv_free(sign); } #endif @@ -8973,7 +8973,7 @@ make_tooltip(BalloonEval *beval, char *text, POINT pt) */ mouse_event(MOUSEEVENTF_MOVE, 2, 2, 0, 0); mouse_event(MOUSEEVENTF_MOVE, (DWORD)-1, (DWORD)-1, 0, 0); - vim_free(pti); + mnv_free(pti); } static void @@ -9041,8 +9041,8 @@ gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) { POINT pt; - vim_free(beval->msg); - beval->msg = mesg == NULL ? NULL : vim_strsave(mesg); + mnv_free(beval->msg); + beval->msg = mesg == NULL ? NULL : mnv_strsave(mesg); if (beval->msg == NULL) { delete_tooltip(beval); @@ -9149,10 +9149,10 @@ track_user_activity(UINT uMsg) gui_mch_destroy_beval_area(BalloonEval *beval) { # ifdef FEAT_VARTABS - vim_free(beval->vts); + mnv_free(beval->vts); # endif - vim_free(beval->tofree); - vim_free(beval); + mnv_free(beval->tofree); + mnv_free(beval); } #endif // FEAT_BEVAL_GUI @@ -9221,7 +9221,7 @@ test_gui_w32_sendevent_mouse(dict_T *args) if (dict_get_bool(args, "cell", FALSE)) { // calculate the middle of the character cell - // Note: Cell coordinates are 1-based from Vim script + // Note: Cell coordinates are 1-based from MNV script int pY = (row - 1) * gui.char_height + gui.char_height / 2; int pX = (col - 1) * gui.char_width + gui.char_width / 2; gui_mouse_moved(pX, pY); @@ -9316,7 +9316,7 @@ test_gui_w32_sendevent_keyboard(dict_T *args) (void)SetForegroundWindow(s_hwnd); SendInput(ARRAYSIZE(inputs), inputs, sizeof(INPUT)); - vim_free(event); + mnv_free(event); if (unwrapMods) { @@ -9345,7 +9345,7 @@ test_gui_w32_sendevent_keyboard(dict_T *args) else { semsg(_(e_invalid_value_for_argument_str_str), "event", event); - vim_free(event); + mnv_free(event); } return FALSE; } @@ -9381,7 +9381,7 @@ test_gui_w32_sendevent_set_keycode_trans_strategy(dict_T *args) else { semsg(_(e_invalid_value_for_argument_str_str), "strategy", strategy); - vim_free(strategy); + mnv_free(strategy); } return FALSE; } diff --git a/uvim/src/gui_x11.c b/uvim/src/gui_x11.c index a61d47a077..03f5c3538b 100644 --- a/uvim/src/gui_x11.c +++ b/uvim/src/gui_x11.c @@ -1,18 +1,18 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * GUI/Motif support by Robert Webb * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * Code for the Motif GUI. * Not used for GTK. */ -#include "vim.h" +#include "mnv.h" #include #include @@ -54,8 +54,8 @@ # include #endif -#define VIM_NAME "vim" -#define VIM_CLASS "Vim" +#define MNV_NAME "mnv" +#define MNV_CLASS "MNV" // Default resource values #define DFLT_FONT "7x13" @@ -74,7 +74,7 @@ #define DFLT_TOOLTIP_BG_COLOR "#ffff91" #define DFLT_TOOLTIP_FG_COLOR "#000000" -Widget vimShell = (Widget)0; +Widget mnvShell = (Widget)0; static Atom wm_atoms[2]; // Window Manager Atoms #define DELETE_WINDOW_IDX 0 // index in wm_atoms[] for WM_DELETE_WINDOW @@ -138,15 +138,15 @@ static Cursor gui_x11_create_blank_mouse(void); /* - * Keycodes recognized by vim. + * Keycodes recognized by mnv. * NOTE: when changing this, the table in gui_gtk_x11.c probably needs the * same change! */ static struct specialkey { KeySym key_sym; - char_u vim_code0; - char_u vim_code1; + char_u mnv_code0; + char_u mnv_code1; } special_keys[] = { {XK_Up, 'k', 'u'}, @@ -283,7 +283,7 @@ static struct specialkey /* * X Resources: */ -static XtResource vim_resources[] = +static XtResource mnv_resources[] = { { XtNforeground, @@ -490,9 +490,9 @@ static XtResource vim_resources[] = /* * This table holds all the X GUI command line options allowed. This includes - * the standard ones so that we can skip them when vim is started without the + * the standard ones so that we can skip them when mnv is started without the * GUI (but the GUI might start up later). - * When changing this, also update doc/vim_gui.txt and the usage message!!! + * When changing this, also update doc/mnv_gui.txt and the usage message!!! */ static XrmOptionDescRec cmdline_options[] = { @@ -885,8 +885,8 @@ gui_x11_key_hit_cb( if (special_keys[i].key_sym == key_sym) { string[0] = CSI; - string[1] = special_keys[i].vim_code0; - string[2] = special_keys[i].vim_code1; + string[1] = special_keys[i].mnv_code0; + string[2] = special_keys[i].mnv_code1; len = -3; break; } @@ -1004,7 +1004,7 @@ gui_x11_mouse_cb( int repeated_click = FALSE; int x, y; int_u x_modifiers; - int_u vim_modifiers; + int_u mnv_modifiers; if (event->type == MotionNotify) { @@ -1023,7 +1023,7 @@ gui_x11_mouse_cb( if (button != MOUSE_DRAG) // just moving the rodent { #ifdef FEAT_MENU - if (dud) // moved in vimForm + if (dud) // moved in mnvForm y -= gui.menu_height; #endif gui_mouse_moved(x, y); @@ -1072,15 +1072,15 @@ gui_x11_mouse_cb( #endif } - vim_modifiers = 0x0; + mnv_modifiers = 0x0; if (x_modifiers & ShiftMask) - vim_modifiers |= MOUSE_SHIFT; + mnv_modifiers |= MOUSE_SHIFT; if (x_modifiers & ControlMask) - vim_modifiers |= MOUSE_CTRL; + mnv_modifiers |= MOUSE_CTRL; if (x_modifiers & Mod1Mask) // Alt or Meta key - vim_modifiers |= MOUSE_ALT; + mnv_modifiers |= MOUSE_ALT; - gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers); + gui_send_mouse_event(button, x, y, repeated_click, mnv_modifiers); } /* @@ -1090,7 +1090,7 @@ gui_x11_mouse_cb( /* * Parse the GUI related command-line arguments. Any arguments used are * deleted from argv, and *argc is decremented accordingly. This is called - * when vim is started, whether or not the GUI has been started. + * when mnv is started, whether or not the GUI has been started. */ void gui_mch_prepare(int *argc, char **argv) @@ -1169,7 +1169,7 @@ gui_mch_prepare(int *argc, char **argv) #endif /* - * Check if the GUI can be started. Called before gvimrc is sourced. + * Check if the GUI can be started. Called before gmnvrc is sourced. * Return OK or FAIL. */ int @@ -1180,7 +1180,7 @@ gui_mch_init_check(void) #endif open_app_context(); if (app_context != NULL) - gui.dpy = XtOpenDisplay(app_context, 0, VIM_NAME, VIM_CLASS, + gui.dpy = XtOpenDisplay(app_context, 0, MNV_NAME, MNV_CLASS, cmdline_options, XtNumber(cmdline_options), CARDINAL &gui_argc, gui_argv); @@ -1240,14 +1240,14 @@ gui_mch_init(void) XSynchronize(gui.dpy, True); #endif - vimShell = XtVaAppCreateShell(VIM_NAME, VIM_CLASS, + mnvShell = XtVaAppCreateShell(MNV_NAME, MNV_CLASS, applicationShellWidgetClass, gui.dpy, NULL); /* * Get the application resources */ - XtVaGetApplicationResources(vimShell, (XtPointer)&gui, - vim_resources, XtNumber(vim_resources), NULL); + XtVaGetApplicationResources(mnvShell, (XtPointer)&gui, + mnv_resources, XtNumber(mnv_resources), NULL); gui.scrollbar_height = gui.scrollbar_width; @@ -1279,7 +1279,7 @@ gui_mch_init(void) } // Get the colors from the "Normal", "Tooltip", "Scrollbar" and "Menu" - // group (set in syntax.c or in a vimrc file) + // group (set in syntax.c or in a mnvrc file) set_normal_colors(); /* @@ -1293,17 +1293,17 @@ gui_mch_init(void) gc_mask = GCForeground | GCBackground; gc_vals.foreground = gui.norm_pixel; gc_vals.background = gui.back_pixel; - gui.text_gc = XtGetGC(vimShell, gc_mask, &gc_vals); + gui.text_gc = XtGetGC(mnvShell, gc_mask, &gc_vals); gc_vals.foreground = gui.back_pixel; gc_vals.background = gui.norm_pixel; - gui.back_gc = XtGetGC(vimShell, gc_mask, &gc_vals); + gui.back_gc = XtGetGC(mnvShell, gc_mask, &gc_vals); gc_mask |= GCFunction; gc_vals.foreground = gui.norm_pixel ^ gui.back_pixel; gc_vals.background = gui.norm_pixel ^ gui.back_pixel; gc_vals.function = GXxor; - gui.invert_gc = XtGetGC(vimShell, gc_mask, &gc_vals); + gui.invert_gc = XtGetGC(mnvShell, gc_mask, &gc_vals); gui.visibility = VisibilityUnobscured; x11_setup_atoms(gui.dpy); @@ -1331,45 +1331,45 @@ gui_mch_init(void) * to be done before the shell is popped up. */ if (mask & (XValue|YValue)) - XtVaSetValues(vimShell, XtNgeometry, gui.geom, NULL); + XtVaSetValues(mnvShell, XtNgeometry, gui.geom, NULL); } gui_x11_create_widgets(); /* - * Add an icon to Vim (Marcel Douben: 11 May 1998). + * Add an icon to MNV (Marcel Douben: 11 May 1998). */ - if (vim_strchr(p_go, GO_ICON) != NULL) + if (mnv_strchr(p_go, GO_ICON) != NULL) { #ifndef HAVE_XPM -# include "vim_icon.xbm" -# include "vim_mask.xbm" +# include "mnv_icon.xbm" +# include "mnv_mask.xbm" Arg arg[2]; XtSetArg(arg[0], XtNiconPixmap, XCreateBitmapFromData(gui.dpy, DefaultRootWindow(gui.dpy), - (char *)vim_icon_bits, - vim_icon_width, - vim_icon_height)); + (char *)mnv_icon_bits, + mnv_icon_width, + mnv_icon_height)); XtSetArg(arg[1], XtNiconMask, XCreateBitmapFromData(gui.dpy, DefaultRootWindow(gui.dpy), - (char *)vim_mask_icon_bits, - vim_mask_icon_width, - vim_mask_icon_height)); - XtSetValues(vimShell, arg, (Cardinal)2); + (char *)mnv_mask_icon_bits, + mnv_mask_icon_width, + mnv_mask_icon_height)); + XtSetValues(mnvShell, arg, (Cardinal)2); #else // Use Pixmaps, looking much nicer. -# include "../runtime/vim32x32.xpm" -# include "../runtime/vim16x16.xpm" -# include "../runtime/vim48x48.xpm" +# include "../runtime/mnv32x32.xpm" +# include "../runtime/mnv16x16.xpm" +# include "../runtime/mnv48x48.xpm" static Pixmap icon = 0; static Pixmap icon_mask = 0; - static char **magick = vim32x32; + static char **magick = mnv32x32; Window root_window; XIconSize *size; int number_sizes; @@ -1381,26 +1381,26 @@ gui_mch_init(void) /* * Adjust the icon to the preferences of the actual window manager. */ - root_window = XRootWindowOfScreen(XtScreen(vimShell)); - if (XGetIconSizes(XtDisplay(vimShell), root_window, + root_window = XRootWindowOfScreen(XtScreen(mnvShell)); + if (XGetIconSizes(XtDisplay(mnvShell), root_window, &size, &number_sizes) != 0) { if (number_sizes > 0) { if (size->max_height >= 48 && size->max_width >= 48) - magick = vim48x48; + magick = mnv48x48; else if (size->max_height >= 32 && size->max_width >= 32) - magick = vim32x32; + magick = mnv32x32; else if (size->max_height >= 16 && size->max_width >= 16) - magick = vim16x16; + magick = mnv16x16; } } - dsp = XtDisplay(vimShell); - scr = XtScreen(vimShell); + dsp = XtDisplay(mnvShell); + scr = XtScreen(mnvShell); cmap = DefaultColormap(dsp, DefaultScreen(dsp)); - XtVaSetValues(vimShell, XtNcolormap, cmap, NULL); + XtVaSetValues(mnvShell, XtNcolormap, cmap, NULL); attr.valuemask = 0L; attr.valuemask = XpmCloseness | XpmReturnPixels | XpmColormap | XpmDepth; @@ -1415,7 +1415,7 @@ gui_mch_init(void) XpmFreeAttributes(&attr); } - XtVaSetValues(vimShell, XmNiconPixmap, icon, XmNiconMask, icon_mask, NULL); + XtVaSetValues(mnvShell, XmNiconPixmap, icon, XmNiconMask, icon_mask, NULL); #endif } @@ -1448,8 +1448,8 @@ gui_mch_uninit(void) gui_x11_destroy_widgets(); XtCloseDisplay(gui.dpy); gui.dpy = NULL; - vimShell = (Widget)0; - VIM_CLEAR(gui_argv); + mnvShell = (Widget)0; + MNV_CLEAR(gui_argv); } /* @@ -1489,8 +1489,8 @@ gui_mch_new_colors(void) gui_mch_open(void) { // Actually open the window - XtRealizeWidget(vimShell); - XtManageChild(XtNameToWidget(vimShell, "*vimForm")); + XtRealizeWidget(mnvShell); + XtManageChild(XtNameToWidget(mnvShell, "*mnvForm")); gui.wid = gui_x11_get_wid(); gui.blank_pointer = gui_x11_create_blank_mouse(); @@ -1503,23 +1503,23 @@ gui_mch_open(void) XInternAtom(gui.dpy, "WM_SAVE_YOURSELF", False); wm_atoms[DELETE_WINDOW_IDX] = XInternAtom(gui.dpy, "WM_DELETE_WINDOW", False); - XSetWMProtocols(gui.dpy, XtWindow(vimShell), wm_atoms, 2); - XtAddEventHandler(vimShell, NoEventMask, True, gui_x11_wm_protocol_handler, + XSetWMProtocols(gui.dpy, XtWindow(mnvShell), wm_atoms, 2); + XtAddEventHandler(mnvShell, NoEventMask, True, gui_x11_wm_protocol_handler, NULL); #ifdef HAVE_X11_XMU_EDITRES_H /* * Enable editres protocol (see "man editres"). * Usually will need to add -lXmu to the linker line as well. */ - XtAddEventHandler(vimShell, (EventMask)0, True, _XEditResCheckMessages, + XtAddEventHandler(mnvShell, (EventMask)0, True, _XEditResCheckMessages, (XtPointer)NULL); #endif #ifdef FEAT_CLIENTSERVER if (serverName == NULL && serverDelayedStartName != NULL) { - // This is a :gui command in a plain vim with no previous server - commWindow = XtWindow(vimShell); + // This is a :gui command in a plain mnv with no previous server + commWindow = XtWindow(mnvShell); (void)serverRegisterName(gui.dpy, serverDelayedStartName); } else @@ -1529,9 +1529,9 @@ gui_mch_open(void) * have to change the "server" registration to that of the main window * If we have not registered a name yet, remember the window */ - serverChangeRegisteredWindow(gui.dpy, XtWindow(vimShell)); + serverChangeRegisteredWindow(gui.dpy, XtWindow(mnvShell)); } - XtAddEventHandler(vimShell, PropertyChangeMask, False, + XtAddEventHandler(mnvShell, PropertyChangeMask, False, gui_x11_send_event_handler, NULL); #endif @@ -1560,7 +1560,7 @@ gui_init_tooltip_font(void) to.addr = (XtPointer)&gui.tooltip_fontset; to.size = sizeof(XFontSet); - if (XtConvertAndStore(vimShell, XtRString, &from, XtRFontSet, &to) == False) + if (XtConvertAndStore(mnvShell, XtRString, &from, XtRFontSet, &to) == False) { // Failed. What to do? } @@ -1580,7 +1580,7 @@ gui_init_menu_font(void) to.addr = (XtPointer)&gui.menu_fontset; to.size = sizeof(GuiFontset); - if (XtConvertAndStore(vimShell, XtRString, &from, XtRFontSet, &to) == False) + if (XtConvertAndStore(mnvShell, XtRString, &from, XtRFontSet, &to) == False) { // Failed. What to do? } @@ -1590,7 +1590,7 @@ gui_init_menu_font(void) to.addr = (XtPointer)&gui.menu_font; to.size = sizeof(GuiFont); - if (XtConvertAndStore(vimShell, XtRString, &from, XtRFontStruct, &to) == False) + if (XtConvertAndStore(mnvShell, XtRString, &from, XtRFontStruct, &to) == False) { // Failed. What to do? } @@ -1606,7 +1606,7 @@ gui_mch_exit(int rc UNUSED) // says that this isn't needed when exiting, so just skip it. XtCloseDisplay(gui.dpy); #endif - VIM_CLEAR(gui_argv); + MNV_CLEAR(gui_argv); } /* @@ -1617,7 +1617,7 @@ gui_mch_get_winpos(int *x, int *y) { Dimension xpos, ypos; - XtVaGetValues(vimShell, + XtVaGetValues(mnvShell, XtNx, &xpos, XtNy, &ypos, NULL); @@ -1633,7 +1633,7 @@ gui_mch_get_winpos(int *x, int *y) void gui_mch_set_winpos(int x, int y) { - XtVaSetValues(vimShell, + XtVaSetValues(mnvShell, XtNx, x, XtNy, y, NULL); @@ -1652,7 +1652,7 @@ gui_mch_set_shellsize( #ifdef FEAT_XIM height += xim_get_status_area_height(), #endif - XtVaSetValues(vimShell, + XtVaSetValues(mnvShell, XtNwidthInc, gui.char_width, XtNheightInc, gui.char_height, #if defined(XtSpecificationRelease) && XtSpecificationRelease >= 4 @@ -1680,7 +1680,7 @@ gui_mch_get_screen_dimensions( } /* - * Initialise vim to use the font "font_name". If it's NULL, pick a default + * Initialise mnv to use the font "font_name". If it's NULL, pick a default * font. * If "fontset" is TRUE, load the "font_name" as a fontset. * Return FAIL if the font could not be loaded, OK otherwise. @@ -1712,7 +1712,7 @@ gui_mch_init_font( #ifdef FEAT_XFONTSET if (do_fontset) { - // If 'guifontset' is set, VIM treats all font specifications as if + // If 'guifontset' is set, MNV treats all font specifications as if // they were fontsets, and 'guifontset' becomes the default. if (font_name != NULL) { @@ -1877,7 +1877,7 @@ gui_mch_get_fontname(GuiFont font, char_u *name) if (name != NULL && font == NULL) { // In this case, there's no way other than doing this. - ret = vim_strsave(name); + ret = mnv_strsave(name); } else if (font != NULL) { @@ -1892,14 +1892,14 @@ gui_mch_get_fontname(GuiFont font, char_u *name) xa_font_name = XGetAtomName(gui.dpy, value); if (xa_font_name != NULL) { - ret = vim_strsave((char_u *)xa_font_name); + ret = mnv_strsave((char_u *)xa_font_name); XFree(xa_font_name); } else if (name != NULL) - ret = vim_strsave(name); + ret = mnv_strsave(name); } else if (name != NULL) - ret = vim_strsave(name); + ret = mnv_strsave(name); } return ret; } @@ -2088,7 +2088,7 @@ check_fontset_sanity(XFontSet fs) static int fontset_width(XFontSet fs) { - return XmbTextEscapement(fs, "Vim", 3) / 3; + return XmbTextEscapement(fs, "MNV", 3) / 3; } int @@ -2161,7 +2161,7 @@ gui_mch_get_rgb_color(int r, int g, int b) // Using XParseColor() is very slow, put rgb in XColor directly. char spec[8]; // space enough to hold "#RRGGBB" - vim_snprintf(spec, sizeof(spec), "#%.2x%.2x%.2x", r, g, b); + mnv_snprintf(spec, sizeof(spec), "#%.2x%.2x%.2x", r, g, b); if (XParseColor(gui.dpy, colormap, (char *)spec, &available) != 0 && XAllocColor(gui.dpy, colormap, &available) != 0) return (guicolor_T)available.pixel; @@ -2422,8 +2422,8 @@ gui_mch_haskey(char_u *name) int i; for (i = 0; special_keys[i].key_sym != (KeySym)0; i++) - if (name[0] == special_keys[i].vim_code0 && - name[1] == special_keys[i].vim_code1) + if (name[0] == special_keys[i].mnv_code0 && + name[1] == special_keys[i].mnv_code1) return OK; return FAIL; } @@ -2434,7 +2434,7 @@ gui_mch_haskey(char_u *name) int gui_get_x11_windis(Window *win, Display **dis) { - *win = XtWindow(vimShell); + *win = XtWindow(mnvShell); *dis = gui.dpy; return OK; } @@ -2479,17 +2479,17 @@ gui_mch_invert_rectangle( void gui_mch_iconify(void) { - XIconifyWindow(gui.dpy, XtWindow(vimShell), DefaultScreen(gui.dpy)); + XIconifyWindow(gui.dpy, XtWindow(mnvShell), DefaultScreen(gui.dpy)); } #if defined(FEAT_EVAL) /* - * Bring the Vim window to the foreground. + * Bring the MNV window to the foreground. */ void gui_mch_set_foreground(void) { - XMapRaised(gui.dpy, XtWindow(vimShell)); + XMapRaised(gui.dpy, XtWindow(mnvShell)); } #endif @@ -2545,7 +2545,7 @@ gui_mch_update(void) #endif desired = (XtIMAll); while ((mask = XtAppPending(app_context)) && (mask & desired) - && !vim_is_input_buf_full()) + && !mnv_is_input_buf_full()) XtAppProcessEvent(app_context, desired); } @@ -2770,19 +2770,19 @@ gui_x11_check_copy_area(void) void clip_mch_lose_selection(Clipboard_T *cbd) { - clip_x11_lose_selection(vimShell, cbd); + clip_x11_lose_selection(mnvShell, cbd); } int clip_mch_own_selection(Clipboard_T *cbd) { - return clip_x11_own_selection(vimShell, cbd); + return clip_x11_own_selection(mnvShell, cbd); } void clip_mch_request_selection(Clipboard_T *cbd) { - clip_x11_request_selection(vimShell, gui.dpy, cbd); + clip_x11_request_selection(mnvShell, gui.dpy, cbd); } void @@ -2801,7 +2801,7 @@ clip_mch_set_selection( * Make a menu either grey or not grey. */ void -gui_mch_menu_grey(vimmenu_T *menu, int grey) +gui_mch_menu_grey(mnvmenu_T *menu, int grey) { if (menu->id == (Widget)0) return; @@ -2821,7 +2821,7 @@ gui_mch_menu_grey(vimmenu_T *menu, int grey) * Make menu item hidden or not hidden */ void -gui_mch_menu_hidden(vimmenu_T *menu, int hidden) +gui_mch_menu_hidden(mnvmenu_T *menu, int hidden) { if (menu->id == (Widget)0) return; @@ -2847,7 +2847,7 @@ gui_x11_menu_cb( XtPointer client_data, XtPointer call_data UNUSED) { - gui_menu_cb((vimmenu_T *)client_data); + gui_menu_cb((mnvmenu_T *)client_data); } #endif // FEAT_MENU @@ -2873,7 +2873,7 @@ gui_x11_wm_protocol_handler( /* * The WM_SAVE_YOURSELF event arrives when the window manager wants to - * exit. That can be cancelled though, thus Vim shouldn't exit here. + * exit. That can be cancelled though, thus MNV shouldn't exit here. * Just sync our swap files. */ if ((Atom)((XClientMessageEvent *)event)->data.l[0] == @@ -2885,7 +2885,7 @@ gui_x11_wm_protocol_handler( // Set the window's WM_COMMAND property, to let the window manager // know we are done saving ourselves. We don't want to be restarted, // thus set argv to NULL. - XSetCommand(gui.dpy, XtWindow(vimShell), NULL, 0); + XSetCommand(gui.dpy, XtWindow(mnvShell), NULL, 0); return; } @@ -3031,7 +3031,7 @@ gui_mch_get_rgb(guicolor_T pixel) * Add the callback functions. */ void -gui_x11_callbacks(Widget textArea, Widget vimForm) +gui_x11_callbacks(Widget textArea, Widget mnvForm) { XtAddEventHandler(textArea, VisibilityChangeMask, FALSE, gui_x11_visibility_cb, (XtPointer)0); @@ -3039,34 +3039,34 @@ gui_x11_callbacks(Widget textArea, Widget vimForm) XtAddEventHandler(textArea, ExposureMask, FALSE, gui_x11_expose_cb, (XtPointer)0); - XtAddEventHandler(vimShell, StructureNotifyMask, FALSE, + XtAddEventHandler(mnvShell, StructureNotifyMask, FALSE, gui_x11_resize_window_cb, (XtPointer)0); - XtAddEventHandler(vimShell, FocusChangeMask, FALSE, gui_x11_focus_change_cb, + XtAddEventHandler(mnvShell, FocusChangeMask, FALSE, gui_x11_focus_change_cb, (XtPointer)0); /* * Only install these enter/leave callbacks when 'p' in 'guioptions'. * Only needed for some window managers. */ - if (vim_strchr(p_go, GO_POINTER) != NULL) + if (mnv_strchr(p_go, GO_POINTER) != NULL) { - XtAddEventHandler(vimShell, LeaveWindowMask, FALSE, gui_x11_leave_cb, + XtAddEventHandler(mnvShell, LeaveWindowMask, FALSE, gui_x11_leave_cb, (XtPointer)0); XtAddEventHandler(textArea, LeaveWindowMask, FALSE, gui_x11_leave_cb, (XtPointer)0); XtAddEventHandler(textArea, EnterWindowMask, FALSE, gui_x11_enter_cb, (XtPointer)0); - XtAddEventHandler(vimShell, EnterWindowMask, FALSE, gui_x11_enter_cb, + XtAddEventHandler(mnvShell, EnterWindowMask, FALSE, gui_x11_enter_cb, (XtPointer)0); } - XtAddEventHandler(vimForm, KeyPressMask, FALSE, gui_x11_key_hit_cb, + XtAddEventHandler(mnvForm, KeyPressMask, FALSE, gui_x11_key_hit_cb, (XtPointer)0); XtAddEventHandler(textArea, KeyPressMask, FALSE, gui_x11_key_hit_cb, (XtPointer)0); // get pointer moved events from scrollbar, needed for 'mousefocus' - XtAddEventHandler(vimForm, PointerMotionMask, + XtAddEventHandler(mnvForm, PointerMotionMask, FALSE, gui_x11_mouse_cb, (XtPointer)1); XtAddEventHandler(textArea, ButtonPressMask | ButtonReleaseMask | ButtonMotionMask | PointerMotionMask, @@ -3270,7 +3270,7 @@ mch_set_mouse_shape(int shape) * passing a normal menu item here. Can't explain that, but better avoid it. */ void -gui_mch_menu_set_tip(vimmenu_T *menu) +gui_mch_menu_set_tip(mnvmenu_T *menu) { if (menu->id == NULL || menu->parent == NULL || !menu_is_toolbar(menu->parent->name)) diff --git a/uvim/src/gui_x11_pm.h b/uvim/src/gui_x11_pm.h index e327bdbd85..0af4055eb8 100644 --- a/uvim/src/gui_x11_pm.h +++ b/uvim/src/gui_x11_pm.h @@ -1,11 +1,11 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * GUI/Motif support by Robert Webb * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* diff --git a/uvim/src/gui_xim.c b/uvim/src/gui_xim.c index 8e9b750a41..97e3154890 100644 --- a/uvim/src/gui_xim.c +++ b/uvim/src/gui_xim.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * gui_xim.c: functions for the X Input Method */ -#include "vim.h" +#include "mnv.h" #if !defined(GTK_CHECK_VERSION) # define GTK_CHECK_VERSION(a, b, c) 0 @@ -72,7 +72,7 @@ xim_log(char *s, ...) #endif #if defined(FEAT_EVAL) && \ - (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM) || defined(VIMDLL)) + (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM) || defined(MNVDLL)) static callback_T imaf_cb; // 'imactivatefunc' callback function static callback_T imsf_cb; // 'imstatusfunc' callback function @@ -133,7 +133,7 @@ call_imstatusfunc(void) free_xim_stuff(void) { # if defined(FEAT_EVAL) && \ - (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM) || defined(VIMDLL)) + (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM) || defined(MNVDLL)) free_callback(&imaf_cb); free_callback(&imsf_cb); # endif @@ -150,7 +150,7 @@ set_ref_in_im_funcs(int copyID UNUSED) { int abort = FALSE; -# if defined(FEAT_XIM) || defined(IME_WITHOUT_XIM) || defined(VIMDLL) +# if defined(FEAT_XIM) || defined(IME_WITHOUT_XIM) || defined(MNVDLL) abort = set_ref_in_callback(&imaf_cb, copyID); abort = abort || set_ref_in_callback(&imsf_cb, copyID); # endif @@ -257,7 +257,7 @@ im_add_to_input(char_u *str, int len) add_to_input_buf_csi(str, len); if (input_conv.vc_type != CONV_NONE) - vim_free(str); + mnv_free(str); if (p_mh) // blank out the pointer if necessary gui_mch_mousehide(TRUE); @@ -309,7 +309,7 @@ im_preedit_window_open(void) gtk_window_set_transient_for(GTK_WINDOW(preedit_window), GTK_WINDOW(gui.mainwin)); preedit_label = gtk_label_new(""); - gtk_widget_set_name(preedit_label, "vim-gui-preedit-area"); + gtk_widget_set_name(preedit_label, "mnv-gui-preedit-area"); gtk_container_add(GTK_CONTAINER(preedit_window), preedit_label); } @@ -340,7 +340,7 @@ im_preedit_window_open(void) fontsize_propval = g_strdup_printf("inherit"); css = g_strdup_printf( - "#vim-gui-preedit-area {\n" + "#mnv-gui-preedit-area {\n" " font-family: %s,monospace;\n" " font-size: %s;\n" " color: #%.2lx%.2lx%.2lx;\n" @@ -366,22 +366,22 @@ im_preedit_window_open(void) # elif GTK_CHECK_VERSION(3,0,0) gtk_widget_override_font(preedit_label, gui.norm_font); - vim_snprintf(buf, sizeof(buf), "#%06X", gui.norm_pixel); + mnv_snprintf(buf, sizeof(buf), "#%06X", gui.norm_pixel); gdk_rgba_parse(&color, buf); gtk_widget_override_color(preedit_label, GTK_STATE_FLAG_NORMAL, &color); - vim_snprintf(buf, sizeof(buf), "#%06X", gui.back_pixel); + mnv_snprintf(buf, sizeof(buf), "#%06X", gui.back_pixel); gdk_rgba_parse(&color, buf); gtk_widget_override_background_color(preedit_label, GTK_STATE_FLAG_NORMAL, &color); # else gtk_widget_modify_font(preedit_label, gui.norm_font); - vim_snprintf(buf, sizeof(buf), "#%06X", (unsigned)gui.norm_pixel); + mnv_snprintf(buf, sizeof(buf), "#%06X", (unsigned)gui.norm_pixel); gdk_color_parse(buf, &color); gtk_widget_modify_fg(preedit_label, GTK_STATE_NORMAL, &color); - vim_snprintf(buf, sizeof(buf), "#%06X", (unsigned)gui.back_pixel); + mnv_snprintf(buf, sizeof(buf), "#%06X", (unsigned)gui.back_pixel); gdk_color_parse(buf, &color); gtk_widget_modify_bg(preedit_window, GTK_STATE_NORMAL, &color); # endif @@ -527,7 +527,7 @@ im_commit_cb(GtkIMContext *context UNUSED, // The thing which setting "preedit_start_col" to MAXCOL means that // "preedit_start_col" will be set forcedly when calling // preedit_changed_cb() next time. - // "preedit_start_col" should not reset with MAXCOL on this part. Vim + // "preedit_start_col" should not reset with MAXCOL on this part. MNV // is simulating the preediting by using add_to_input_str(). when // preedit begin immediately before committed, the typebuf is not // flushed to screen, then it can't get correct "preedit_start_col". @@ -544,7 +544,7 @@ im_commit_cb(GtkIMContext *context UNUSED, clen = mb_string2cells(im_str, len); if (input_conv.vc_type != CONV_NONE) - vim_free(im_str); + mnv_free(im_str); preedit_start_col += clen; } @@ -654,7 +654,7 @@ im_preedit_end_cb(GtkIMContext *context UNUSED, gpointer data UNUSED) * for proper operation. * * Conclusions: I think support for preediting needs to be moved to the - * core parts of Vim. Ideally, until it has been committed, the preediting + * core parts of MNV. Ideally, until it has been committed, the preediting * string should only be displayed and not affect the buffer content at all. * The question how to deal with the synchronization issue still remains. * Circumventing the input buffer is probably not desirable. Anyway, I think @@ -665,7 +665,7 @@ im_preedit_end_cb(GtkIMContext *context UNUSED, gpointer data UNUSED) * at the receiving end of the queue. This, however, would have a rather large * impact on the code base. If there is an easy way to force processing of all * remaining input from within the "retrieve_surrounding" signal handler, this - * might not be necessary. Gotta ask on vim-dev for opinions. + * might not be necessary. Gotta ask on mnv-dev for opinions. */ static void im_preedit_changed_cb(GtkIMContext *context, gpointer data UNUSED) @@ -775,8 +775,8 @@ im_preedit_changed_cb(GtkIMContext *context, gpointer data UNUSED) } /* - * Translate the Pango attributes at iter to Vim highlighting attributes. - * Ignore attributes not supported by Vim highlighting. This shouldn't have + * Translate the Pango attributes at iter to MNV highlighting attributes. + * Ignore attributes not supported by MNV highlighting. This shouldn't have * too much impact -- right now we handle even more attributes than necessary * for the IM modules I tested with. */ @@ -1099,7 +1099,7 @@ xim_queue_key_press_event(GdkEventKey *event, int down) && (State & (MODE_INSERT | MODE_CMDLINE | MODE_NORMAL | MODE_EXTERNCMD))) { - // Filter 'imactivatekey' and map it to CTRL-^. This way, Vim is + // Filter 'imactivatekey' and map it to CTRL-^. This way, MNV is // always aware of the current status of IM, and can even emulate // the activation key for modules that don't support one. if (event->keyval == im_activatekey_keyval @@ -1158,7 +1158,7 @@ xim_queue_key_press_event(GdkEventKey *event, int down) // 3. line changed key. // 4. preedited string. // 5. remove preedited string. - // if 3, Vim can't move back the above line for 5. + // if 3, MNV can't move back the above line for 5. // thus, this part should not parse the key. if (!imresult && preedit_start_col != MAXCOL && event->keyval == GDK_Return) @@ -1212,7 +1212,7 @@ im_is_preediting(void) static int xim_is_active = FALSE; // XIM should be active in the current // mode -static int xim_has_focus = FALSE; // XIM is really being used for Vim +static int xim_has_focus = FALSE; // XIM is really being used for MNV # ifdef FEAT_GUI_X11 static XIMStyle input_style; static int status_area_enabled = TRUE; @@ -1233,7 +1233,7 @@ im_set_active(int active_arg) else if (input_style & XIMPreeditPosition) // There is a problem in switching XIM off when preediting is used, // and it is not clear how this can be solved. For now, keep XIM on - // all the time, like it was done in Vim 5.8. + // all the time, like it was done in MNV 5.8. active = TRUE; # if defined(FEAT_EVAL) @@ -1251,7 +1251,7 @@ im_set_active(int active_arg) if (xic == NULL) return; - // Remember the active state, it is needed when Vim gets keyboard focus. + // Remember the active state, it is needed when MNV gets keyboard focus. xim_is_active = active; xim_set_preedit(); } @@ -1266,7 +1266,7 @@ xim_set_focus(int focus) if (xic == NULL) return; - // XIM only gets focus when the Vim window has keyboard focus and XIM has + // XIM only gets focus when the MNV window has keyboard focus and XIM has // been set active for the current mode. if (focus && xim_is_active) { @@ -1786,11 +1786,11 @@ xim_get_status_area_height(void) #else // !defined(FEAT_XIM) -# if defined(IME_WITHOUT_XIM) || defined(VIMDLL) +# if defined(IME_WITHOUT_XIM) || defined(MNVDLL) static int im_was_set_active = FALSE; int -# ifdef VIMDLL +# ifdef MNVDLL mbyte_im_get_status(void) # else im_get_status(void) @@ -1804,7 +1804,7 @@ im_get_status(void) } void -# ifdef VIMDLL +# ifdef MNVDLL mbyte_im_set_active(int active_arg) # else im_set_active(int active_arg) @@ -1821,7 +1821,7 @@ im_set_active(int active_arg) # endif } -# if defined(FEAT_GUI) && !defined(FEAT_GUI_HAIKU) && !defined(VIMDLL) +# if defined(FEAT_GUI) && !defined(FEAT_GUI_HAIKU) && !defined(MNVDLL) void im_set_position(int row UNUSED, int col UNUSED) { diff --git a/uvim/src/gui_xmdlg.c b/uvim/src/gui_xmdlg.c index ad3146a122..13aab9ecc2 100644 --- a/uvim/src/gui_xmdlg.c +++ b/uvim/src/gui_xmdlg.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -16,7 +16,7 @@ * when using a dynamic scrollbar policy. */ -#include "vim.h" +#include "mnv.h" #include #include @@ -38,7 +38,7 @@ #include #include -extern Widget vimShell; +extern Widget mnvShell; #ifdef FEAT_MENU # define apply_fontlist(w) gui_motif_menu_fontlist(w) @@ -168,9 +168,9 @@ name_part(char *font, char *buf) get_part(font, 1, buf3); if (*buf3 != NUL) - vim_snprintf(buf, TEMP_BUF_SIZE, "%s (%s)", buf2, buf3); + mnv_snprintf(buf, TEMP_BUF_SIZE, "%s (%s)", buf2, buf3); else - vim_snprintf(buf, TEMP_BUF_SIZE, "%s", buf2); + mnv_snprintf(buf, TEMP_BUF_SIZE, "%s", buf2); } /* @@ -187,23 +187,23 @@ style_part(char *font, char *buf) if (!strcmp(buf2, "normal") && !strcmp(buf2, "Normal") && !strcmp(buf2, "NORMAL")) - vim_snprintf(buf, TEMP_BUF_SIZE, "%s %s", buf3, buf2); + mnv_snprintf(buf, TEMP_BUF_SIZE, "%s %s", buf3, buf2); else strcpy(buf, buf3); get_part(font, 6, buf2); if (buf2[0] != '\0') - vim_snprintf(buf3, TEMP_BUF_SIZE, "%s %s", buf, buf2); + mnv_snprintf(buf3, TEMP_BUF_SIZE, "%s %s", buf, buf2); else strcpy(buf3, buf); get_part(font, 4, buf2); if (!strcmp(buf2, "o") || !strcmp(buf2, "O")) - vim_snprintf(buf, TEMP_BUF_SIZE, "%s oblique", buf3); + mnv_snprintf(buf, TEMP_BUF_SIZE, "%s oblique", buf3); else if (!strcmp(buf2, "i") || !strcmp(buf2, "I")) - vim_snprintf(buf, TEMP_BUF_SIZE, "%s italic", buf3); + mnv_snprintf(buf, TEMP_BUF_SIZE, "%s italic", buf3); if (!strcmp(buf, " ")) strcpy(buf, "-"); @@ -261,7 +261,7 @@ encoding_part(char *font, char *buf) get_part(font, 14, buf2); if (*buf1 != NUL && *buf2 != NUL) - vim_snprintf(buf, TEMP_BUF_SIZE, "%s-%s", buf1, buf2); + mnv_snprintf(buf, TEMP_BUF_SIZE, "%s-%s", buf1, buf2); if (!strcmp(buf, " ")) strcpy(buf, "-"); } @@ -681,7 +681,7 @@ do_choice(Widget w, display_sample(data); } else - do_dialog(VIM_ERROR, + do_dialog(MNV_ERROR, (char_u *)_("Error"), (char_u *)_("Invalid font specification"), (char_u *)_("&Dismiss"), 1, NULL, FALSE); @@ -800,7 +800,7 @@ ok_callback(Widget w UNUSED, if (i != 1) { - do_dialog(VIM_ERROR, + do_dialog(MNV_ERROR, (char_u *)_("Error"), (char_u *)_("Invalid font specification"), (char_u *)_("&Dismiss"), 1, NULL, FALSE); @@ -868,7 +868,7 @@ gui_xm_select_font(char_u *current) data = &_data; - parent = vimShell; + parent = mnvShell; data->names = XListFonts(XtDisplay(parent), "-*-*-*-*-*-*-*-*-*-*-*-*-*-*", MAX_FONTS, &data->num); @@ -902,7 +902,7 @@ gui_xm_select_font(char_u *current) // Set the title of the Dialog window. data->dialog = XmCreateDialogShell(parent, "fontSelector", NULL, 0); - str = XmStringCreateLocalized(_("Vim - Font Selector")); + str = XmStringCreateLocalized(_("MNV - Font Selector")); // Create form popup dialog widget. form = XtVaCreateWidget("form", diff --git a/uvim/src/gui_xmebw.c b/uvim/src/gui_xmebw.c index 440c1b96ad..93446137c0 100644 --- a/uvim/src/gui_xmebw.c +++ b/uvim/src/gui_xmebw.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * @@ -21,7 +21,7 @@ * Enhanced Motif PushButton widget with move over behavior. */ -#include "vim.h" +#include "mnv.h" #ifdef FEAT_TOOLBAR diff --git a/uvim/src/gui_xmebw.h b/uvim/src/gui_xmebw.h index aaf5c72503..8acccdbb39 100644 --- a/uvim/src/gui_xmebw.h +++ b/uvim/src/gui_xmebw.h @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * diff --git a/uvim/src/gui_xmebwp.h b/uvim/src/gui_xmebwp.h index 48331438af..bea68bdda8 100644 --- a/uvim/src/gui_xmebwp.h +++ b/uvim/src/gui_xmebwp.h @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * diff --git a/uvim/src/gvimtutor b/uvim/src/gvimtutor deleted file mode 100644 index 36ca7bc5e1..0000000000 --- a/uvim/src/gvimtutor +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# Start GUI Vim on a copy of the tutor file. - -# Usage: gvimtutor [xx] -# See vimtutor for usage. - -exec $(dirname $0)/vimtutor -g "$@" diff --git a/uvim/src/hardcopy.c b/uvim/src/hardcopy.c index 5333116049..df30797942 100644 --- a/uvim/src/hardcopy.c +++ b/uvim/src/hardcopy.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * hardcopy.c: printing to paper */ -#include "vim.h" +#include "mnv.h" #include "version.h" #if defined(FEAT_PRINTER) @@ -202,13 +202,13 @@ parse_list_options( stringp = option_str; while (*stringp) { - colonp = vim_strchr(stringp, ':'); + colonp = mnv_strchr(stringp, ':'); if (colonp == NULL) { ret = e_missing_colon_3; break; } - commap = vim_strchr(stringp, ','); + commap = mnv_strchr(stringp, ','); if (commap == NULL) commap = option_str + STRLEN(option_str); @@ -228,7 +228,7 @@ parse_list_options( if (table[idx].hasnum) { - if (!VIM_ISDIGIT(*p)) + if (!MNV_ISDIGIT(*p)) { ret = e_digit_expected_2; break; @@ -251,7 +251,7 @@ parse_list_options( for (idx = 0; idx < table_size; ++idx) table[idx] = old_opts[idx]; } - vim_free(old_opts); + mnv_free(old_opts); return ret; } @@ -519,7 +519,7 @@ prt_header( p += l; } - vim_free(tbuf); + mnv_free(tbuf); #ifdef FEAT_SYN_HL if (psettings->do_syntax) @@ -791,7 +791,7 @@ ex_hardcopy(exarg_T *eap) page_prtpos = prtpos; } - vim_snprintf((char *)IObuff, IOSIZE, _("Printed: %s"), + mnv_snprintf((char *)IObuff, IOSIZE, _("Printed: %s"), settings.jobname); prt_message(IObuff); } @@ -1255,11 +1255,11 @@ struct prt_ps_resource_S // The PS prolog file version number has to match - if the prolog file is // updated, increment the number in the file and here. Version checking was -// added as of VIM 6.2. +// added as of MNV 6.2. // The CID prolog file version number behaves as per PS prolog. -// Table of VIM and prolog versions: +// Table of MNV and prolog versions: // -// VIM Prolog CIDProlog +// MNV Prolog CIDProlog // 6.2 1.3 // 7.0 1.4 1.0 # define PRT_PROLOG_VERSION ((char_u *)"1.4") @@ -1282,7 +1282,7 @@ static char *prt_resource_types[] = # define PRT_RESOURCE_CMAP "CMap" -// Data for table based DSC comment recognition, easy to extend if VIM needs to +// Data for table based DSC comment recognition, easy to extend if MNV needs to // read more comments. # define PRT_DSC_MISC_TYPE (-1) # define PRT_DSC_TITLE_TYPE (1) @@ -1385,7 +1385,7 @@ static char_u prt_line_buffer[257]; static garray_T prt_ps_buffer; static int prt_do_conv; -static vimconv_T prt_conv; +static mnvconv_T prt_conv; static int prt_out_mbyte; static int prt_custom_cmap; @@ -1426,7 +1426,7 @@ prt_write_file_len(char_u *buffer, int bytes) static void prt_write_string(char *s) { - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "%s", s); + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "%s", s); prt_write_file(prt_line_buffer); } @@ -1460,14 +1460,14 @@ prt_def_font( int height, char *font) { - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), - "/_%s /VIM-%s /%s ref\n", new_name, encoding, font); + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), + "/_%s /MNV-%s /%s ref\n", new_name, encoding, font); prt_write_file(prt_line_buffer); if (prt_out_mbyte) sprintf((char *)prt_line_buffer, "/%s %d %f /_%s sffs\n", new_name, height, 500./prt_ps_courier_font.wx, new_name); else - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "/%s %d /_%s ffs\n", new_name, height, new_name); prt_write_file(prt_line_buffer); } @@ -1478,10 +1478,10 @@ prt_def_font( static void prt_def_cidfont(char *new_name, int height, char *cidfont) { - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), - "/_%s /%s[/%s] vim_composefont\n", new_name, prt_cmap, cidfont); + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), + "/_%s /%s[/%s] mnv_composefont\n", new_name, prt_cmap, cidfont); prt_write_file(prt_line_buffer); - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "/%s %d /_%s ffs\n", new_name, height, new_name); prt_write_file(prt_line_buffer); } @@ -1492,7 +1492,7 @@ prt_def_cidfont(char *new_name, int height, char *cidfont) static void prt_dup_cidfont(char *original_name, char *new_name) { - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "/%s %s d\n", new_name, original_name); prt_write_file(prt_line_buffer); } @@ -1562,7 +1562,7 @@ prt_write_real(double val, int prec) static void prt_def_var(char *name, double value, int prec) { - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "/%s ", name); prt_write_file(prt_line_buffer); prt_write_real(value, prec); @@ -1669,17 +1669,17 @@ prt_find_resource(char *name, struct prt_ps_resource_S *resource) if (buffer == NULL) return FALSE; - vim_strncpy(resource->name, (char_u *)name, 63); + mnv_strncpy(resource->name, (char_u *)name, 63); // Look for named resource file in runtimepath STRCPY(buffer, "print"); add_pathsep(buffer); - vim_strcat(buffer, (char_u *)name, MAXPATHL); - vim_strcat(buffer, (char_u *)".ps", MAXPATHL); + mnv_strcat(buffer, (char_u *)name, MAXPATHL); + mnv_strcat(buffer, (char_u *)".ps", MAXPATHL); resource->filename[0] = NUL; retval = (do_in_runtimepath(buffer, 0, prt_resource_name, resource->filename) && resource->filename[0] != NUL); - vim_free(buffer); + mnv_free(buffer); return retval; } @@ -1910,14 +1910,14 @@ prt_open_resource(struct prt_ps_resource_S *resource) switch (dsc_line.type) { case PRT_DSC_TITLE_TYPE: - vim_strncpy(resource->title, dsc_line.string, dsc_line.len); + mnv_strncpy(resource->title, dsc_line.string, dsc_line.len); seen_title = TRUE; if (seen_version) seen_all = TRUE; break; case PRT_DSC_VERSION_TYPE: - vim_strncpy(resource->version, dsc_line.string, dsc_line.len); + mnv_strncpy(resource->version, dsc_line.string, dsc_line.len); seen_version = TRUE; if (seen_title) seen_all = TRUE; @@ -1968,7 +1968,7 @@ prt_dsc_start(void) static void prt_dsc_noarg(char *comment) { - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "%%%%%s\n", comment); prt_write_file(prt_line_buffer); } @@ -1976,7 +1976,7 @@ prt_dsc_noarg(char *comment) static void prt_dsc_textline(char *comment, char *text) { - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "%%%%%s: %s\n", comment, text); prt_write_file(prt_line_buffer); } @@ -1985,7 +1985,7 @@ prt_dsc_textline(char *comment, char *text) prt_dsc_text(char *comment, char *text) { // TODO - should scan 'text' for any chars needing escaping! - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "%%%%%s: (%s)\n", comment, text); prt_write_file(prt_line_buffer); } @@ -1997,7 +1997,7 @@ prt_dsc_ints(char *comment, int count, int *ints) { int i; - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "%%%%%s:", comment); prt_write_file(prt_line_buffer); @@ -2017,14 +2017,14 @@ prt_dsc_resources( char *string) { if (comment != NULL) - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "%%%%%s: %s", comment, type); else - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "%%%%+ %s", type); prt_write_file(prt_line_buffer); - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), " %s\n", string); prt_write_file(prt_line_buffer); } @@ -2087,7 +2087,7 @@ prt_dsc_docmedia( char *colour, char *type) { - vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), + mnv_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "%%%%DocumentMedia: %s ", paper_name); prt_write_file(prt_line_buffer); prt_write_real(width, 2); @@ -2118,7 +2118,7 @@ mch_print_cleanup(void) for (i = PRT_PS_FONT_ROMAN; i <= PRT_PS_FONT_BOLDOBLIQUE; i++) { if (prt_ps_mb_font.ps_fontname[i] != NULL) - VIM_CLEAR(prt_ps_mb_font.ps_fontname[i]); + MNV_CLEAR(prt_ps_mb_font.ps_fontname[i]); } } @@ -2134,7 +2134,7 @@ mch_print_cleanup(void) prt_file_error = FALSE; } if (prt_ps_file_name != NULL) - VIM_CLEAR(prt_ps_file_name); + MNV_CLEAR(prt_ps_file_name); } static float @@ -2225,7 +2225,7 @@ prt_build_cid_fontname(int font, char_u *name, int name_len) fontname = alloc(name_len + 1); if (fontname == NULL) return FALSE; - vim_strncpy((char_u *)fontname, name, name_len); + mnv_strncpy((char_u *)fontname, name, name_len); prt_ps_mb_font.ps_fontname[font] = fontname; return TRUE; @@ -2417,7 +2417,7 @@ mch_print_init( // Add charset name if not empty if (p_mbchar->cmap_charset != NULL) { - vim_strncpy((char_u *)prt_cmap, + mnv_strncpy((char_u *)prt_cmap, (char_u *)p_mbchar->cmap_charset, sizeof(prt_cmap) - 3); STRCAT(prt_cmap, "-"); } @@ -2430,7 +2430,7 @@ mch_print_init( emsg(_(e_printmbcharset_cannot_be_empty_with_multi_byte_encoding)); return FALSE; } - vim_strncpy((char_u *)prt_cmap, p_pmcs, sizeof(prt_cmap) - 3); + mnv_strncpy((char_u *)prt_cmap, p_pmcs, sizeof(prt_cmap) - 3); STRCAT(prt_cmap, "-"); } @@ -2549,8 +2549,8 @@ mch_print_init( * Set up the font size. */ fontsize = PRT_PS_DEFAULT_FONTSIZE; - for (p = p_pfn; (p = vim_strchr(p, ':')) != NULL; ++p) - if (p[1] == 'h' && VIM_ISDIGIT(p[2])) + for (p = p_pfn; (p = mnv_strchr(p, ':')) != NULL; ++p) + if (p[1] == 'h' && MNV_ISDIGIT(p[2])) fontsize = atoi((char *)p + 2); prt_font_metrics(fontsize); @@ -2615,7 +2615,7 @@ mch_print_init( // If the user didn't specify a file name, use a temp file. if (psettings->outfile == NULL) { - prt_ps_file_name = vim_tempname('p', TRUE); + prt_ps_file_name = mnv_tempname('p', TRUE); if (prt_ps_file_name == NULL) { emsg(_(e_cant_get_temp_file_name)); @@ -2629,7 +2629,7 @@ mch_print_init( if (p != NULL) { prt_ps_fd = mch_fopen((char *)p, WRITEBIN); - vim_free(p); + mnv_free(p); } } if (prt_ps_fd == NULL) @@ -2737,7 +2737,7 @@ mch_print_begin(prt_settings_T *psettings) if (!get_user_name((char_u *)buffer, 256)) STRCPY(buffer, "Unknown"); prt_dsc_textline("For", buffer); - prt_dsc_textline("Creator", VIM_VERSION_LONG); + prt_dsc_textline("Creator", MNV_VERSION_LONG); // Note: to ensure Clean8bit I don't think we can use LC_TIME prt_dsc_textline("CreationDate", get_ctime(time(NULL), FALSE)); @@ -2791,7 +2791,7 @@ mch_print_begin(prt_settings_T *psettings) prt_dsc_resources(NULL, "cmap", prt_cmap); } - // Search for external resources VIM supplies + // Search for external resources MNV supplies if (!prt_find_resource("prolog", res_prolog)) { semsg(_(e_cant_find_postscript_resource_file_str_ps), "prolog"); @@ -2818,7 +2818,7 @@ mch_print_begin(prt_settings_T *psettings) // Find an encoding to use for printing. // Check 'printencoding'. If not set or not found, then use 'encoding'. If // that cannot be found then default to "latin1". - // Note: VIM specific encoding header is always skipped. + // Note: MNV specific encoding header is always skipped. if (!prt_out_mbyte) { p_encoding = enc_skip(p_penc); @@ -3023,7 +3023,7 @@ mch_print_begin(prt_settings_T *psettings) { // Define the CID fonts to be used in the job. Typically CJKV fonts do // not have an italic form being a western style, so where no font is - // defined for these faces VIM falls back to an existing face. + // defined for these faces MNV falls back to an existing face. // Note: if using Courier for the ASCII range then the printout will // have bold/italic/bolditalic regardless of the setting of printmbfont. prt_dsc_resources("IncludeResource", "font", @@ -3086,10 +3086,10 @@ mch_print_begin(prt_settings_T *psettings) retval = !prt_file_error; theend: - vim_free(res_prolog); - vim_free(res_encoding); - vim_free(res_cidfont); - vim_free(res_cmap); + mnv_free(res_prolog); + mnv_free(res_encoding); + mnv_free(res_cidfont); + mnv_free(res_cmap); return retval; } @@ -3221,8 +3221,8 @@ mch_print_text_out(char_u *textp, int len UNUSED) char_width = prt_char_width; - // Ideally VIM would create a rearranged CID font to combine a Roman and - // CJKV font to do what VIM is doing here - use a Roman font for characters + // Ideally MNV would create a rearranged CID font to combine a Roman and + // CJKV font to do what MNV is doing here - use a Roman font for characters // in the ASCII range, and the original CID font for everything else. // The problem is that GhostScript still (as of 8.13) does not support // rearranged fonts even though they have been documented by Adobe for 7 @@ -3394,7 +3394,7 @@ mch_print_text_out(char_u *textp, int len UNUSED) } // Need to free any translated characters - vim_free(tofree); + mnv_free(tofree); prt_text_run += char_width; prt_pos_x += char_width; diff --git a/uvim/src/hashtab.c b/uvim/src/hashtab.c index 6d37748795..99a2b7bbe9 100644 --- a/uvim/src/hashtab.c +++ b/uvim/src/hashtab.c @@ -1,14 +1,14 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* - * hashtab.c: Handling of a hashtable with Vim-specific properties. + * hashtab.c: Handling of a hashtable with MNV-specific properties. * * Each item in a hashtable has a NUL terminated string key. A key can appear * only once in the table. @@ -27,7 +27,7 @@ * memory). */ -#include "vim.h" +#include "mnv.h" #if 0 # define HT_DEBUG // extra checks for table consistency and statistics @@ -92,7 +92,7 @@ check_hashtab_frozen(hashtab_T *ht, char *command) hash_clear(hashtab_T *ht) { if (ht->ht_array != ht->ht_smallarray) - vim_free(ht->ht_array); + mnv_free(ht->ht_array); } #if defined(FEAT_SPELL) || defined(FEAT_TERMINAL) @@ -112,7 +112,7 @@ hash_clear_all(hashtab_T *ht, int off) { if (!HASHITEM_EMPTY(hi)) { - vim_free(hi->hi_key - off); + mnv_free(hi->hi_key - off); --todo; } } @@ -477,7 +477,7 @@ hash_may_resize( } if (ht->ht_array != ht->ht_smallarray) - vim_free(ht->ht_array); + mnv_free(ht->ht_array); ht->ht_array = newarray; ht->ht_mask = newmask; ht->ht_filled = ht->ht_used; @@ -490,7 +490,7 @@ hash_may_resize( /* * Get the hash number for a key. * If you think you know a better hash function: Compile with HT_DEBUG set and - * run a script that uses hashtables a lot. Vim will then print statistics + * run a script that uses hashtables a lot. MNV will then print statistics * when exiting. Try that with the current hash algorithm and yours. The * lower the percentage the better. */ diff --git a/uvim/src/help.c b/uvim/src/help.c index 7bb6a0d7dc..42918a222d 100644 --- a/uvim/src/help.c +++ b/uvim/src/help.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* - * help.c: functions for Vim help + * help.c: functions for MNV help */ -#include "vim.h" +#include "mnv.h" /* * ":help": open a read-only window on a help file @@ -72,7 +72,7 @@ ex_help(exarg_T *eap) // remove trailing blanks p = arg + STRLEN(arg) - 1; - while (p > arg && VIM_ISWHITE(*p) && p[-1] != '\\') + while (p > arg && MNV_ISWHITE(*p) && p[-1] != '\\') *p-- = NUL; #ifdef FEAT_MULTI_LANG @@ -114,7 +114,7 @@ ex_help(exarg_T *eap) } // The first match (in the requested language) is the best match. - tag = vim_strsave(matches[i]); + tag = mnv_strsave(matches[i]); FreeWild(num_matches, matches); #ifdef FEAT_GUI @@ -198,7 +198,7 @@ ex_help(exarg_T *eap) curwin->w_alt_fnum = alt_fnum; erret: - vim_free(tag); + mnv_free(tag); } /* @@ -419,10 +419,10 @@ find_help_tags( // And also "\_$" and "\_^". if (arg[0] == '\\' && ((arg[1] != NUL && arg[2] == NUL) - || (vim_strchr((char_u *)"%_z@", arg[1]) != NULL + || (mnv_strchr((char_u *)"%_z@", arg[1]) != NULL && arg[2] != NUL))) { - vim_snprintf((char *)d, IOSIZE, "/\\\\%s", arg + 1); + mnv_snprintf((char *)d, IOSIZE, "/\\\\%s", arg + 1); // Check for "/\\_$", should be "/\\_\$" if (d[3] == '_' && d[4] == '$') STRCPY(d + 4, "\\$"); @@ -473,7 +473,7 @@ find_help_tags( // ":help i_^_CTRL-D" work. // Insert '-' before and after "CTRL-X" when applicable. if (*s < ' ' || (*s == '^' && s[1] && (ASCII_ISALPHA(s[1]) - || vim_strchr((char_u *)"?@[\\]^", s[1]) != NULL))) + || mnv_strchr((char_u *)"?@[\\]^", s[1]) != NULL))) { if (d > IObuff && d[-1] != '_' && d[-1] != '\\') *d++ = '_'; // prepend a '_' to make x_CTRL-x @@ -565,7 +565,7 @@ find_help_tags( sizeof(char_u *), help_compare); // Delete more than TAG_MANY to reduce the size of the listing. while (*num_matches > TAG_MANY) - vim_free((*matches)[--*num_matches]); + mnv_free((*matches)[--*num_matches]); } return OK; } @@ -721,7 +721,7 @@ fix_help_buffer(void) { line = ml_get_buf(curbuf, lnum, FALSE); len = ml_get_buf_len(curbuf, lnum); - if (in_example && len > 0 && !VIM_ISWHITE(line[0])) + if (in_example && len > 0 && !MNV_ISWHITE(line[0])) { // End of example: non-white or '<' in first column. if (line[0] == '<') @@ -771,7 +771,7 @@ fix_help_buffer(void) continue; // Go through all directories in 'runtimepath', skipping - // $VIMRUNTIME. + // $MNVRUNTIME. p = p_rtp; while (*p != NUL) { @@ -779,7 +779,7 @@ fix_help_buffer(void) NameBufflen = copy_option_part(&p, NameBuff, MAXPATHL, ","); mustfree = FALSE; - rt = vim_getenv((char_u *)"VIMRUNTIME", &mustfree); + rt = mnv_getenv((char_u *)"MNVRUNTIME", &mustfree); if (rt != NULL && fullpathcmp(rt, NameBuff, FALSE, TRUE) != FPC_SAME) { @@ -788,7 +788,7 @@ fix_help_buffer(void) FILE *fd; char_u *s; int fi; - vimconv_T vc; + mnvconv_T vc; char_u *cp; // Find all "doc/ *.txt" files in this directory. @@ -818,14 +818,14 @@ fix_help_buffer(void) { f1 = fnames[i1]; t1 = gettail(f1); - e1 = vim_strrchr(t1, '.'); + e1 = mnv_strrchr(t1, '.'); if (e1 == NULL) continue; if (fnamecmp(e1, ".txt") != 0 && fnamecmp(e1, fname + 4) != 0) { // Not .txt and not .abx, remove it. - VIM_CLEAR(fnames[i1]); + MNV_CLEAR(fnames[i1]); continue; } @@ -835,7 +835,7 @@ fix_help_buffer(void) if (f2 == NULL) continue; t2 = gettail(f2); - e2 = vim_strrchr(t2, '.'); + e2 = mnv_strrchr(t2, '.'); if (e2 == NULL) continue; if (e1 - f1 != e2 - f2 @@ -844,7 +844,7 @@ fix_help_buffer(void) if (fnamecmp(e1, ".txt") == 0 && fnamecmp(e2, fname + 4) == 0) // use .abx instead of .txt - VIM_CLEAR(fnames[i1]); + MNV_CLEAR(fnames[i1]); } } #endif @@ -855,9 +855,9 @@ fix_help_buffer(void) fd = mch_fopen((char *)fnames[fi], "r"); if (fd != NULL) { - vim_fgets(IObuff, IOSIZE, fd); + mnv_fgets(IObuff, IOSIZE, fd); if (IObuff[0] == '*' - && (s = vim_strchr(IObuff + 1, '*')) + && (s = mnv_strchr(IObuff + 1, '*')) != NULL) { int this_utf = MAYBE; @@ -909,7 +909,7 @@ fix_help_buffer(void) ml_append(lnum, cp, (colnr_T)0, FALSE); if (cp != IObuff) - vim_free(cp); + mnv_free(cp); ++lnum; } fclose(fd); @@ -919,7 +919,7 @@ fix_help_buffer(void) } } if (mustfree) - vim_free(rt); + mnv_free(rt); } break; } @@ -1003,10 +1003,10 @@ helptags_one( return; } - // If using the "++t" argument or generating tags for "$VIMRUNTIME/doc" + // If using the "++t" argument or generating tags for "$MNVRUNTIME/doc" // add the "help-tags" tag. ga_init2(&ga, sizeof(char_u *), 100); - if (add_help_tags || fullpathcmp((char_u *)"$VIMRUNTIME/doc", + if (add_help_tags || fullpathcmp((char_u *)"$MNVRUNTIME/doc", dir, FALSE, TRUE) == FPC_SAME) { if (ga_grow(&ga, 1) == FAIL) @@ -1038,7 +1038,7 @@ helptags_one( in_example = FALSE; firstline = TRUE; - while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int) + while (!mnv_fgets(IObuff, IOSIZE, fd) && !got_int) { if (firstline) { @@ -1074,17 +1074,17 @@ helptags_one( if (in_example) { // skip over example; a non-white in the first column ends it - if (vim_strchr((char_u *)" \t\n\r", IObuff[0])) + if (mnv_strchr((char_u *)" \t\n\r", IObuff[0])) continue; in_example = FALSE; } - p1 = vim_strchr(IObuff, '*'); // find first '*' + p1 = mnv_strchr(IObuff, '*'); // find first '*' while (p1 != NULL) { - // Use vim_strbyte() instead of vim_strchr() so that when + // Use mnv_strbyte() instead of mnv_strchr() so that when // 'encoding' is dbcs it still works, don't find '*' in the // second byte. - p2 = vim_strbyte(p1 + 1, '*'); // find second '*' + p2 = mnv_strbyte(p1 + 1, '*'); // find second '*' if (p2 != NULL && p2 > p1 + 1) // skip "*" and "**" { for (s = p1 + 1; s < p2; ++s) @@ -1096,7 +1096,7 @@ helptags_one( // followed by a white character or end-of-line. if (s == p2 && (p1 == IObuff || p1[-1] == ' ' || p1[-1] == '\t') - && (vim_strchr((char_u *)" \t\n\r", s[1]) != NULL + && (mnv_strchr((char_u *)" \t\n\r", s[1]) != NULL || s[1] == '\0')) { *p2 = '\0'; @@ -1117,7 +1117,7 @@ helptags_one( sprintf((char *)s, "%s\t%s", p1, fname); // find next '*' - p2 = vim_strchr(p2 + 1, '*'); + p2 = mnv_strchr(p2 + 1, '*'); } } p1 = p2; @@ -1127,7 +1127,7 @@ helptags_one( { off -= 2; while (off > 0 && (ASCII_ISLOWER(IObuff[off]) - || VIM_ISDIGIT(IObuff[off]))) + || MNV_ISDIGIT(IObuff[off]))) off--; if (IObuff[off] == '>' && (off == 0 || IObuff[off - 1] == ' ')) in_example = TRUE; @@ -1156,7 +1156,7 @@ helptags_one( if (*p2 == '\t') { *p2 = NUL; - vim_snprintf((char *)NameBuff, MAXPATHL, + mnv_snprintf((char *)NameBuff, MAXPATHL, _(e_duplicate_tag_str_in_file_str_str), ((char_u **)ga.ga_data)[i], dir, p2 + 1); emsg((char *)NameBuff); @@ -1196,7 +1196,7 @@ helptags_one( got_int = FALSE; // continue with other languages for (i = 0; i < ga.ga_len; ++i) - vim_free(((char_u **)ga.ga_data)[i]); + mnv_free(((char_u **)ga.ga_data)[i]); ga_clear(&ga); fclose(fd_tags); // there is no check for an error... } @@ -1319,7 +1319,7 @@ ex_helptags(exarg_T *eap) int add_help_tags = FALSE; // Check for ":helptags ++t {dir}". - if (STRNCMP(eap->arg, "++t", 3) == 0 && VIM_ISWHITE(eap->arg[3])) + if (STRNCMP(eap->arg, "++t", 3) == 0 && MNV_ISWHITE(eap->arg[3])) { add_help_tags = TRUE; eap->arg = skipwhite(eap->arg + 3); @@ -1340,6 +1340,6 @@ ex_helptags(exarg_T *eap) semsg(_(e_not_a_directory_str), eap->arg); else do_helptags(dirname, add_help_tags, FALSE); - vim_free(dirname); + mnv_free(dirname); } } diff --git a/uvim/src/highlight.c b/uvim/src/highlight.c index 28b7c6be12..0afdcd9430 100644 --- a/uvim/src/highlight.c +++ b/uvim/src/highlight.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * Highlighting stuff. */ -#include "vim.h" +#include "mnv.h" #define SG_TERM 1 // term has been set #define SG_CTERM 2 // cterm has been set @@ -247,7 +247,7 @@ static void hl_do_font(int idx, char_u *arg, int do_normal, int do_menu, int do_ /* * The default highlight groups. These are compiled-in for fast startup and * they still work when the runtime files can't be found. - * When making changes here, also change runtime/colors/default.vim! + * When making changes here, also change runtime/colors/default.mnv! * The #ifdefs are needed to reduce the amount of static data. Helps to make * the 16 bit DOS (museum) version compile. */ @@ -546,13 +546,13 @@ init_highlight( { // The value of g:colors_name could be freed when sourcing the script, // making "p" invalid, so copy it. - char_u *copy_p = vim_strsave(p); + char_u *copy_p = mnv_strsave(p); int r; if (copy_p != NULL) { r = load_colors(copy_p); - vim_free(copy_p); + mnv_free(copy_p); if (r == OK) return; } @@ -602,11 +602,11 @@ init_highlight( static int recursive = 0; if (recursive >= 5) - emsg(_(e_recursive_loop_loading_syncolor_vim)); + emsg(_(e_recursive_loop_loading_syncolor_mnv)); else { ++recursive; - (void)source_runtime((char_u *)"syntax/syncolor.vim", DIP_ALL); + (void)source_runtime((char_u *)"syntax/syncolor.mnv", DIP_ALL); --recursive; } } @@ -623,8 +623,8 @@ load_default_colors_lists(void) { // Lacking a default color list isn't the end of the world but it is likely // an inconvenience so users should know when it is missing. - if (source_runtime((char_u *)"colors/lists/default.vim", DIP_ALL) != OK) - msg("failed to load colors/lists/default.vim"); + if (source_runtime((char_u *)"colors/lists/default.mnv", DIP_ALL) != OK) + msg("failed to load colors/lists/default.mnv"); } #endif @@ -654,9 +654,9 @@ load_colors(char_u *name) #endif apply_autocmds(EVENT_COLORSCHEMEPRE, name, curbuf->b_fname, FALSE, curbuf); - sprintf((char *)buf, "colors/%s.vim", name); + sprintf((char *)buf, "colors/%s.mnv", name); retval = source_runtime(buf, DIP_START + DIP_OPT); - vim_free(buf); + mnv_free(buf); if (retval == OK) apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, FALSE, curbuf); @@ -1005,8 +1005,8 @@ highlight_set_font( else if (!gui.shell_created) { // GUI not started yet, always accept the name. - vim_free(HL_TABLE()[idx].sg_font_name); - HL_TABLE()[idx].sg_font_name = vim_strsave(arg); + mnv_free(HL_TABLE()[idx].sg_font_name); + HL_TABLE()[idx].sg_font_name = mnv_strsave(arg); did_change = TRUE; } else @@ -1051,8 +1051,8 @@ highlight_set_font( // are known. if (did_change) { - vim_free(HL_TABLE()[idx].sg_font_name); - HL_TABLE()[idx].sg_font_name = vim_strsave(arg); + mnv_free(HL_TABLE()[idx].sg_font_name); + HL_TABLE()[idx].sg_font_name = mnv_strsave(arg); } } @@ -1192,7 +1192,7 @@ highlight_set_cterm_font( if (!init) HL_TABLE()[idx].sg_set |= SG_CTERM; - if (VIM_ISDIGIT(*arg)) + if (MNV_ISDIGIT(*arg)) font = atoi((char *)arg); else if (STRICMP(arg, "NONE") == 0) font = -1; @@ -1239,7 +1239,7 @@ highlight_set_cterm_color( HL_TABLE()[idx].sg_cterm_bold = FALSE; } - if (VIM_ISDIGIT(*arg)) + if (MNV_ISDIGIT(*arg)) color = atoi((char *)arg); else if (STRICMP(arg, "fg") == 0) { @@ -1353,9 +1353,9 @@ highlight_set_guifg( # endif if (*namep == NULL || STRCMP(*namep, arg) != 0) { - vim_free(*namep); + mnv_free(*namep); if (STRCMP(arg, "NONE") != 0) - *namep = vim_strsave(arg); + *namep = mnv_strsave(arg); else *namep = NULL; did_change = TRUE; @@ -1436,9 +1436,9 @@ highlight_set_guibg( # endif if (*namep == NULL || STRCMP(*namep, arg) != 0) { - vim_free(*namep); + mnv_free(*namep); if (STRCMP(arg, "NONE") != 0) - *namep = vim_strsave(arg); + *namep = mnv_strsave(arg); else *namep = NULL; did_change = TRUE; @@ -1510,9 +1510,9 @@ highlight_set_guisp(int idx, char_u *arg, int init) # endif if (*namep == NULL || STRCMP(*namep, arg) != 0) { - vim_free(*namep); + mnv_free(*namep); if (STRCMP(arg, "NONE") != 0) - *namep = vim_strsave(arg); + *namep = mnv_strsave(arg); else *namep = NULL; did_change = TRUE; @@ -1553,12 +1553,12 @@ highlight_set_startstop_termcode(int idx, char_u *key, char_u *arg, int init) for (len = 0; arg[off + len] && arg[off + len] != ','; ++len) ; - tname = vim_strnsave(arg + off, len); + tname = mnv_strnsave(arg + off, len); if (tname == NULL) // out of memory return FALSE; // lookup the escape sequence for the item p = get_term_code(tname); - vim_free(tname); + mnv_free(tname); if (p == NULL) // ignore non-existing things p = (char_u *)""; @@ -1593,15 +1593,15 @@ highlight_set_startstop_termcode(int idx, char_u *key, char_u *arg, int init) if (STRCMP(buf, "NONE") == 0) // resetting the value p = NULL; else - p = vim_strsave(buf); + p = mnv_strsave(buf); if (key[2] == 'A') { - vim_free(HL_TABLE()[idx].sg_start); + mnv_free(HL_TABLE()[idx].sg_start); HL_TABLE()[idx].sg_start = p; } else { - vim_free(HL_TABLE()[idx].sg_stop); + mnv_free(HL_TABLE()[idx].sg_stop); HL_TABLE()[idx].sg_stop = p; } return TRUE; @@ -1795,10 +1795,10 @@ do_highlight( // Isolate the key ("term", "ctermfg", "ctermbg", "font", "guifg" // or "guibg"). - while (*linep && !VIM_ISWHITE(*linep) && *linep != '=') + while (*linep && !MNV_ISWHITE(*linep) && *linep != '=') ++linep; - vim_free(key); - key = vim_strnsave_up(key_start, linep - key_start); + mnv_free(key); + key = mnv_strnsave_up(key_start, linep - key_start); if (key == NULL) { error = TRUE; @@ -1831,7 +1831,7 @@ do_highlight( if (*linep == '\'') // guifg='color name' { arg_start = ++linep; - linep = vim_strchr(linep, '\''); + linep = mnv_strchr(linep, '\''); if (linep == NULL) { semsg(_(e_invalid_argument_str), key_start); @@ -1850,8 +1850,8 @@ do_highlight( error = TRUE; break; } - vim_free(arg); - arg = vim_strnsave(arg_start, linep - arg_start); + mnv_free(arg); + arg = mnv_strnsave(arg_start, linep - arg_start); if (arg == NULL) { error = TRUE; @@ -2019,8 +2019,8 @@ do_highlight( #endif } - vim_free(key); - vim_free(arg); + mnv_free(key); + mnv_free(arg); // Only call highlight_changed() once, after a sequence of highlight // commands, and only if an attribute actually changed. @@ -2049,8 +2049,8 @@ free_highlight(void) for (i = 0; i < highlight_ga.ga_len; ++i) { highlight_clear(i); - vim_free(HL_TABLE()[i].sg_name); - vim_free(HL_TABLE()[i].sg_name_u - HLNAME_KEY_OFF); + mnv_free(HL_TABLE()[i].sg_name); + mnv_free(HL_TABLE()[i].sg_name_u - HLNAME_KEY_OFF); } ga_clear(&highlight_ga); hash_clear(&highlight_ht); @@ -2059,7 +2059,7 @@ free_highlight(void) #endif /* - * Reset the cterm colors to what they were before Vim was started, if + * Reset the cterm colors to what they were before MNV was started, if * possible. Otherwise reset them to zero. */ void @@ -2071,7 +2071,7 @@ restore_cterm_colors(void) // background/foreground colors. mch_set_normal_colors(); #else -# ifdef VIMDLL +# ifdef MNVDLL if (!gui.in_use) { mch_set_normal_colors(); @@ -2121,8 +2121,8 @@ highlight_clear(int idx) HL_TABLE()[idx].sg_cleared = TRUE; HL_TABLE()[idx].sg_term = 0; - VIM_CLEAR(HL_TABLE()[idx].sg_start); - VIM_CLEAR(HL_TABLE()[idx].sg_stop); + MNV_CLEAR(HL_TABLE()[idx].sg_start); + MNV_CLEAR(HL_TABLE()[idx].sg_stop); HL_TABLE()[idx].sg_term_attr = 0; HL_TABLE()[idx].sg_cterm = 0; HL_TABLE()[idx].sg_cterm_bold = FALSE; @@ -2132,9 +2132,9 @@ highlight_clear(int idx) HL_TABLE()[idx].sg_cterm_font = 0; #if defined(FEAT_GUI) || defined(FEAT_EVAL) HL_TABLE()[idx].sg_gui = 0; - VIM_CLEAR(HL_TABLE()[idx].sg_gui_fg_name); - VIM_CLEAR(HL_TABLE()[idx].sg_gui_bg_name); - VIM_CLEAR(HL_TABLE()[idx].sg_gui_sp_name); + MNV_CLEAR(HL_TABLE()[idx].sg_gui_fg_name); + MNV_CLEAR(HL_TABLE()[idx].sg_gui_bg_name); + MNV_CLEAR(HL_TABLE()[idx].sg_gui_sp_name); #endif #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) HL_TABLE()[idx].sg_gui_fg = INVALCOLOR; @@ -2148,7 +2148,7 @@ highlight_clear(int idx) gui_mch_free_fontset(HL_TABLE()[idx].sg_fontset); HL_TABLE()[idx].sg_fontset = NOFONTSET; # endif - VIM_CLEAR(HL_TABLE()[idx].sg_font_name); + MNV_CLEAR(HL_TABLE()[idx].sg_font_name); HL_TABLE()[idx].sg_gui_attr = 0; #endif // Restore default link and context if they exist. Otherwise clears. @@ -2323,8 +2323,8 @@ hl_set_font_name(char_u *font_name) if (id <= 0) return; - vim_free(HL_TABLE()[id - 1].sg_font_name); - HL_TABLE()[id - 1].sg_font_name = vim_strsave(font_name); + mnv_free(HL_TABLE()[id - 1].sg_font_name); + HL_TABLE()[id - 1].sg_font_name = mnv_strsave(font_name); } /* @@ -2344,7 +2344,7 @@ hl_set_bg_color_name( if (id <= 0) return; - vim_free(HL_TABLE()[id - 1].sg_gui_bg_name); + mnv_free(HL_TABLE()[id - 1].sg_gui_bg_name); HL_TABLE()[id - 1].sg_gui_bg_name = name; } @@ -2365,7 +2365,7 @@ hl_set_fg_color_name( if (id <= 0) return; - vim_free(HL_TABLE()[id - 1].sg_gui_fg_name); + mnv_free(HL_TABLE()[id - 1].sg_gui_fg_name); HL_TABLE()[id - 1].sg_gui_fg_name = name; } @@ -2546,7 +2546,7 @@ color_name2handle(char_u *name) # define RGB(r, g, b) (((r)<<16) | ((g)<<8) | (b)) # endif -# ifdef VIMDLL +# ifdef MNVDLL static guicolor_T gui_adjust_rgb(guicolor_T c) { @@ -2595,7 +2595,7 @@ decode_hex_color(char_u *hex) static guicolor_T colorname2rgb(char_u *name) { - dict_T *colornames_table = get_vim_var_dict(VV_COLORNAMES); + dict_T *colornames_table = get_mnv_var_dict(VV_COLORNAMES); char_u *lc_name; dictitem_T *colentry; char_u *colstr; @@ -2606,7 +2606,7 @@ colorname2rgb(char_u *name) return INVALCOLOR; colentry = dict_find(colornames_table, lc_name, -1); - vim_free(lc_name); + mnv_free(lc_name); if (colentry == NULL) return INVALCOLOR; @@ -2640,7 +2640,7 @@ gui_get_color_cmn(char_u *name) { guicolor_T color; // Only non X11 colors (not present in rgb.txt) and colors in - // color_name_tab[], useful when $VIMRUNTIME is not found,. + // color_name_tab[], useful when $MNVRUNTIME is not found,. // must be sorted by the 'value' field because it is used by bsearch()! static keyvalue_T rgb_tab[] = { KEYVALUE_ENTRY(RGB(0x00, 0x00, 0x00), "black"), @@ -2854,11 +2854,11 @@ get_attr_entry(garray_T *table, attrentry_T *aep) if (aep->ae_u.term.start == NULL) taep->ae_u.term.start = NULL; else - taep->ae_u.term.start = vim_strsave(aep->ae_u.term.start); + taep->ae_u.term.start = mnv_strsave(aep->ae_u.term.start); if (aep->ae_u.term.stop == NULL) taep->ae_u.term.stop = NULL; else - taep->ae_u.term.stop = vim_strsave(aep->ae_u.term.stop); + taep->ae_u.term.stop = mnv_strsave(aep->ae_u.term.stop); } else if (table == &cterm_attr_table) { @@ -2963,8 +2963,8 @@ clear_hl_tables(void) for (i = 0; i < term_attr_table.ga_len; ++i) { taep = &(((attrentry_T *)term_attr_table.ga_data)[i]); - vim_free(taep->ae_u.term.start); - vim_free(taep->ae_u.term.stop); + mnv_free(taep->ae_u.term.start); + mnv_free(taep->ae_u.term.stop); } ga_clear(&term_attr_table); ga_clear(&cterm_attr_table); @@ -3497,7 +3497,7 @@ highlight_list_arg( ts = highlight_arg_to_string(type, iarg, sarg, buf); (void)syn_list_header(didh, - (int)(vim_strsize(ts) + STRLEN(name) + 1), id); + (int)(mnv_strsize(ts) + STRLEN(name) + 1), id); didh = TRUE; if (!got_int) { @@ -3841,7 +3841,7 @@ syn_name2id_len(char_u *name, int len) len = MAX_SYN_NAME; mch_memmove(name_u, name, len); name_u[len] = NUL; - vim_strup(name_u); + mnv_strup(name_u); if (!highlight_ht_inited) return 0; hi = hash_find(&highlight_ht, name_u); @@ -3929,7 +3929,7 @@ syn_check_group(char_u *pp, int len) id = syn_name2id_len(pp, len); if (id == 0) // doesn't exist yet { - name = vim_strnsave(pp, len); + name = mnv_strnsave(pp, len); if (name == NULL) return 0; id = syn_add_group(name); @@ -3951,10 +3951,10 @@ syn_add_group(char_u *name) // Check that the name is valid (ASCII letters, digits, underscores, dots, or hyphens). for (p = name; *p != NUL; ++p) { - if (!vim_isprintc(*p)) + if (!mnv_isprintc(*p)) { emsg(_(e_unprintable_character_in_group_name)); - vim_free(name); + mnv_free(name); return 0; } else if (!ASCII_ISALNUM(*p) && *p != '_' && *p != '.' && *p != '-') @@ -3979,14 +3979,14 @@ syn_add_group(char_u *name) if (highlight_ga.ga_len >= MAX_HL_ID) { emsg(_(e_too_many_highlight_and_syntax_groups)); - vim_free(name); + mnv_free(name); return 0; } // Make room for at least one other syntax_highlight entry. if (ga_grow(&highlight_ga, 1) == FAIL) { - vim_free(name); + mnv_free(name); return 0; } @@ -3997,11 +3997,11 @@ syn_add_group(char_u *name) hn = alloc(offsetof(hlname_T, hn_key) + len + 1); if (hn == NULL) { - vim_free(name); + mnv_free(name); return 0; } - vim_strncpy(hn->hn_key, name, len); - vim_strup(hn->hn_key); + mnv_strncpy(hn->hn_key, name, len); + mnv_strup(hn->hn_key); hn->hn_id = highlight_ga.ga_len + 1; // ID is index plus one name_up = hn->hn_key; } @@ -4033,8 +4033,8 @@ syn_unadd_group(void) hi = hash_find(&highlight_ht, HL_TABLE()[highlight_ga.ga_len].sg_name_u); if (!HASHITEM_EMPTY(hi)) hash_remove(&highlight_ht, hi, "highlight"); - vim_free(HL_TABLE()[highlight_ga.ga_len].sg_name); - vim_free(HL_TABLE()[highlight_ga.ga_len].sg_name_u - HLNAME_KEY_OFF); + mnv_free(HL_TABLE()[highlight_ga.ga_len].sg_name); + mnv_free(HL_TABLE()[highlight_ga.ga_len].sg_name_u - HLNAME_KEY_OFF); } /* @@ -4088,7 +4088,7 @@ syn_id2colors(int hl_id, guicolor_T *fgp, guicolor_T *bgp) #endif #if (defined(MSWIN) \ - && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) \ + && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)) \ && defined(FEAT_TERMGUICOLORS)) \ || defined(FEAT_TERMINAL) void @@ -4350,7 +4350,7 @@ highlight_changed(void) id = 0; for ( ; *p && *p != ','; ++p) // parse up to comma { - if (VIM_ISWHITE(*p)) // ignore white space + if (MNV_ISWHITE(*p)) // ignore white space continue; if (attr > HL_ALL) // Combination with ':' is not allowed. @@ -4385,7 +4385,7 @@ highlight_changed(void) case ':': ++p; // highlight group name if (attr || *p == NUL) // no combinations return FAIL; - end = vim_strchr(p, ','); + end = mnv_strchr(p, ','); if (end == NULL) end = p + STRLEN(p); id = syn_check_group(p, (int)(end - p)); @@ -4579,7 +4579,7 @@ set_context_in_highlight_cmd(expand_T *xp, char_u *arg) p = skiptowhite(arg); } - p = vim_strchr(arg, '='); + p = mnv_strchr(arg, '='); if (p == NULL) { // Didn't find a key= pattern @@ -4603,7 +4603,7 @@ set_context_in_highlight_cmd(expand_T *xp, char_u *arg) STRNCMP(arg, "cterm=", 6) == 0 || STRNCMP(arg, "gui=", 4) == 0) { - char_u *comma = vim_strrchr(p + 1, ','); + char_u *comma = mnv_strrchr(p + 1, ','); if (comma != NULL) p = comma; } @@ -4753,7 +4753,7 @@ get_highlight_gui_color(expand_T *xp UNUSED, int idx) if (colorname != NULL) { // :hi command doesn't allow space, so don't suggest any malformed items - if (vim_strchr(colorname, ' ') != NULL) + if (mnv_strchr(colorname, ' ') != NULL) return (char_u*)""; if (expand_hi_curvalue != NULL && STRICMP(expand_hi_curvalue, colorname) == 0) @@ -4926,7 +4926,7 @@ expand_highlight_group( // Top 4 items are special, after that sort all the color names unsortedItems = 4; - dict_T *colornames_table = get_vim_var_dict(VV_COLORNAMES); + dict_T *colornames_table = get_mnv_var_dict(VV_COLORNAMES); typval_T colornames_val; colornames_val.v_type = VAR_DICT; colornames_val.vval.v_dict = colornames_table; @@ -5152,7 +5152,7 @@ highlight_get_info(int hl_idx, int resolve_link) return dict; error: - vim_free(dict); + mnv_free(dict); return NULL; } @@ -5265,7 +5265,7 @@ hldict_attr_to_str( // If the attribute dict is empty, then return NONE to clear the attributes if (dict_len(attrdict) == 0) { - vim_strcat(attr_str, (char_u *)"NONE", len); + mnv_strcat(attr_str, (char_u *)"NONE", len); return TRUE; } @@ -5312,7 +5312,7 @@ add_attr_and_value(char_u *dptr, char_u *attr, int attrlen, char_u *value) // When the value contains a space and the attribute has an "=" (i.e. it // is a key=value pair), surround the value with single quotes so that // do_highlight() can parse it correctly. - if (vim_strchr(value, ' ') != NULL && vim_strchr(attr, '=') != NULL) + if (mnv_strchr(value, ' ') != NULL && mnv_strchr(attr, '=') != NULL) { if (dptr + attrlen + vallen + 3 < hlsetBuf + HLSETBUFSZ) { @@ -5383,7 +5383,7 @@ hlg_add_or_update(dict_T *dict) cleared = dict_get_bool(dict, "cleared", FALSE); if (cleared == TRUE) { - vim_snprintf((char *)hlsetBuf, HLSETBUFSZ, "clear %s", name); + mnv_snprintf((char *)hlsetBuf, HLSETBUFSZ, "clear %s", name); do_highlight(hlsetBuf, forceit, FALSE); done = TRUE; } @@ -5398,7 +5398,7 @@ hlg_add_or_update(dict_T *dict) if (linksto == NULL || *linksto == NUL || error) return FALSE; - vim_snprintf((char *)hlsetBuf, HLSETBUFSZ, "%slink %s %s", + mnv_snprintf((char *)hlsetBuf, HLSETBUFSZ, "%slink %s %s", dodefault ? "default " : "", name, linksto); do_highlight(hlsetBuf, forceit, FALSE); @@ -5678,7 +5678,7 @@ pop_highlight_overrides(void) // Set highlight_attr[] to state before override was pushed. memcpy(highlight_attr, set->attr, sizeof(highlight_attr)); - vim_free(set); + mnv_free(set); } /* @@ -5698,14 +5698,14 @@ parse_winhighlight(char_u *opt, int *len, char **errmsg) return NULL; // Get number of overrides first so we can allocate array - while ((p = vim_strchr(p, ',')) != NULL) + while ((p = mnv_strchr(p, ',')) != NULL) { p++; num++; } p = opt; // Check if number of ':' matches number of ',' - while ((p = vim_strchr(p, ':')) != NULL) + while ((p = mnv_strchr(p, ':')) != NULL) { p++; n_colons++; @@ -5737,7 +5737,7 @@ parse_winhighlight(char_u *opt, int *len, char **errmsg) int fromid, toid; int *ids[2] = {&fromid, &toid}; - p = vim_strchr(p, ':'); + p = mnv_strchr(p, ':'); if (p == NULL) goto fail; @@ -5750,7 +5750,7 @@ parse_winhighlight(char_u *opt, int *len, char **errmsg) goto fail; toname = p; - tmp = vim_strchr(p, ','); + tmp = mnv_strchr(p, ','); // Get hl for "to", must check for no trailing comma in case last // element. @@ -5817,7 +5817,7 @@ parse_winhighlight(char_u *opt, int *len, char **errmsg) *len = num; return arr; fail: - vim_free(arr); + mnv_free(arr); *errmsg = e_invalid_argument; return NULL; } @@ -5843,7 +5843,7 @@ update_winhighlight(win_T *wp, char_u *opt) update_highlight_overrides(wp->w_hl, arr, num); - vim_free(wp->w_hl); + mnv_free(wp->w_hl); wp->w_hl = arr; wp->w_hl_len = num; diff --git a/uvim/src/if_cscope.c b/uvim/src/if_cscope.c index 10437a532b..f0d52768fb 100644 --- a/uvim/src/if_cscope.c +++ b/uvim/src/if_cscope.c @@ -1,15 +1,15 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * CSCOPE support for Vim added by Andy Kahn + * CSCOPE support for MNV added by Andy Kahn * Ported to Win32 by Sergey Khorev * - * The basic idea/structure of cscope for Vim was borrowed from Nvi. There + * The basic idea/structure of cscope for MNV was borrowed from Nvi. There * might be a few lines of code that look similar to what Nvi has. * - * See README.txt for an overview of the Vim source code. + * See README.txt for an overview of the MNV source code. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_CSCOPE) @@ -94,7 +94,7 @@ static int cs_insert_filelist(char *, char *, char *, static int cs_kill(exarg_T *eap); static void cs_kill_execute(int, char *); static cscmd_T * cs_lookup_cmd(exarg_T *eap); -static char * cs_make_vim_style_matches(char *, char *, +static char * cs_make_mnv_style_matches(char *, char *, char *, char *); static char * cs_manage_matches(char **, char **, int, mcmd_e); static void cs_print_tags_priv(char **, char **, int); @@ -193,7 +193,7 @@ get_cscope_name(expand_T *xp UNUSED, int idx) continue; if (current_idx++ == idx) { - vim_snprintf(connection, sizeof(connection), "%d", i); + mnv_snprintf(connection, sizeof(connection), "%d", i); return (char_u *)connection; } } @@ -377,7 +377,7 @@ ex_cstag(exarg_T *eap) /* - * This simulates a vim_fgets(), but for cscope, returns the next line + * This simulates a mnv_fgets(), but for cscope, returns the next line * from the cscope output. should only be called from find_tags() * * returns TRUE if eof, FALSE otherwise @@ -389,7 +389,7 @@ cs_fgets(char_u *buf, int size) if ((p = cs_manage_matches(NULL, NULL, -1, Get)) == NULL) return TRUE; - vim_strncpy(buf, (char_u *)p, size - 1); + mnv_strncpy(buf, (char_u *)p, size - 1); return FALSE; } @@ -557,8 +557,8 @@ cs_add_common( (char_u **)&fname, &fbuf, &len); if (fname == NULL) goto add_err; - fname = (char *)vim_strnsave((char_u *)fname, len); - vim_free(fbuf); + fname = (char *)mnv_strnsave((char_u *)fname, len); + mnv_free(fbuf); ret = mch_stat(fname, &statbuf); if (ret < 0) @@ -645,15 +645,15 @@ staterr: } } - vim_free(fname); - vim_free(fname2); - vim_free(ppath); + mnv_free(fname); + mnv_free(fname2); + mnv_free(ppath); return CSCOPE_SUCCESS; add_err: - vim_free(fname2); - vim_free(fname); - vim_free(ppath); + mnv_free(fname2); + mnv_free(fname); + mnv_free(ppath); return CSCOPE_FAILURE; } @@ -717,7 +717,7 @@ cs_cnt_matches(int idx) cs_reading_emsg(idx); - vim_free(buf); + mnv_free(buf); return -1; } @@ -752,7 +752,7 @@ cs_cnt_matches(int idx) break; } - vim_free(buf); + mnv_free(buf); return nlines; } @@ -806,7 +806,7 @@ cs_create_cmd(char *csoption, char *pattern) // they may want to use the leading white space. pat = pattern; if (search != 4 && search != 6) - while VIM_ISWHITE(*pat) + while MNV_ISWHITE(*pat) ++pat; if ((cmd = alloc(strlen(pat) + 2)) == NULL) @@ -928,7 +928,7 @@ err_closing: // expand the prepend path for env var's if ((ppath = alloc(MAXPATHL + 1)) == NULL) { - vim_free(prog); + mnv_free(prog); # ifdef UNIX exit(EXIT_FAILURE); # else @@ -944,8 +944,8 @@ err_closing: if ((cmd = alloc(cmdlen)) == NULL) { - vim_free(prog); - vim_free(ppath); + mnv_free(prog); + mnv_free(ppath); # ifdef UNIX exit(EXIT_FAILURE); # else @@ -956,29 +956,29 @@ err_closing: // run the cscope command # ifdef UNIX - vim_snprintf(cmd, cmdlen, "/bin/sh -c \"exec %s -dl -f %s", + mnv_snprintf(cmd, cmdlen, "/bin/sh -c \"exec %s -dl -f %s", prog, csinfo[i].fname); # else - vim_snprintf(cmd, cmdlen, "%s -dl -f %s", prog, csinfo[i].fname); + mnv_snprintf(cmd, cmdlen, "%s -dl -f %s", prog, csinfo[i].fname); # endif if (csinfo[i].ppath != NULL) { len = (int)STRLEN(cmd); - vim_snprintf(cmd + len, cmdlen - len, " -P%s", csinfo[i].ppath); + mnv_snprintf(cmd + len, cmdlen - len, " -P%s", csinfo[i].ppath); } if (csinfo[i].flags != NULL) { len = (int)STRLEN(cmd); - vim_snprintf(cmd + len, cmdlen - len, " %s", csinfo[i].flags); + mnv_snprintf(cmd + len, cmdlen - len, " %s", csinfo[i].flags); } # ifdef UNIX // terminate the -c command argument STRCAT(cmd, "\""); // on Win32 we still need prog - vim_free(prog); + mnv_free(prog); # endif - vim_free(ppath); + mnv_free(ppath); # if defined(UNIX) # if defined(HAVE_SETSID) || defined(HAVE_SETPGID) @@ -1025,8 +1025,8 @@ err_closing: si.hStdInput = stdin_rd; created = CreateProcess(NULL, cmd, NULL, NULL, TRUE, CREATE_NEW_CONSOLE, NULL, NULL, &si, &pi); - vim_free(prog); - vim_free(cmd); + mnv_free(prog); + mnv_free(cmd); if (!created) { @@ -1157,7 +1157,7 @@ cs_find_common( cmdletter = opt[0]; } - qfpos = (char *)vim_strchr(p_csqf, cmdletter); + qfpos = (char *)mnv_strchr(p_csqf, cmdletter); if (qfpos != NULL) { qfpos++; @@ -1189,7 +1189,7 @@ cs_find_common( nummatches = ALLOC_MULT(int, csinfo_size); if (nummatches == NULL) { - vim_free(cmd); + mnv_free(cmd); return FALSE; } @@ -1215,14 +1215,14 @@ cs_find_common( if (nummatches[i] == 0) (void)cs_read_prompt(i); } - vim_free(cmd); + mnv_free(cmd); if (totmatches == 0) { if (verbose) (void)semsg(_(e_no_matches_found_for_cscope_query_str_of_str), opt, pat); - vim_free(nummatches); + mnv_free(nummatches); return FALSE; } @@ -1231,13 +1231,13 @@ cs_find_common( { // fill error list FILE *f; - char_u *tmp = vim_tempname('c', TRUE); + char_u *tmp = mnv_tempname('c', TRUE); qf_info_T *qi = NULL; win_T *wp = NULL; if (tmp == NULL) { - vim_free(nummatches); + mnv_free(nummatches); return FALSE; } @@ -1275,8 +1275,8 @@ cs_find_common( } } mch_remove(tmp); - vim_free(tmp); - vim_free(nummatches); + mnv_free(tmp); + mnv_free(nummatches); return TRUE; } else @@ -1288,7 +1288,7 @@ cs_find_common( // read output cs_fill_results(pat, totmatches, nummatches, &matches, &contexts, &matched); - vim_free(nummatches); + mnv_free(nummatches); if (matches == NULL) return FALSE; @@ -1311,7 +1311,7 @@ cs_help(exarg_T *eap UNUSED) while (cmdp->name != NULL) { char *help = _(cmdp->help); - int space_cnt = 30 - vim_strsize((char_u *)help); + int space_cnt = 30 - mnv_strsize((char_u *)help); // Use %*s rather than %30s to ensure proper alignment in utf-8 if (space_cnt < 0) @@ -1444,10 +1444,10 @@ cs_insert_filelist( // Reallocate space for more connections. csinfo_size *= 2; - csinfo = vim_realloc(csinfo, sizeof(csinfo_T)*csinfo_size); + csinfo = mnv_realloc(csinfo, sizeof(csinfo_T)*csinfo_size); if (csinfo == NULL) { - vim_free(t_csinfo); + mnv_free(t_csinfo); csinfo_size = 0; } } @@ -1460,16 +1460,16 @@ cs_insert_filelist( if ((csinfo[i].fname = alloc(strlen(fname)+1)) == NULL) return -1; - vim_strncpy((char_u *)csinfo[i].fname, (char_u *)fname, strlen((const char *)fname)); + mnv_strncpy((char_u *)csinfo[i].fname, (char_u *)fname, strlen((const char *)fname)); if (ppath != NULL) { if ((csinfo[i].ppath = alloc(strlen(ppath) + 1)) == NULL) { - VIM_CLEAR(csinfo[i].fname); + MNV_CLEAR(csinfo[i].fname); return -1; } - vim_strncpy((char_u *)csinfo[i].ppath, (char_u *)ppath, strlen((const char *)ppath)); + mnv_strncpy((char_u *)csinfo[i].ppath, (char_u *)ppath, strlen((const char *)ppath)); } else csinfo[i].ppath = NULL; @@ -1478,11 +1478,11 @@ cs_insert_filelist( { if ((csinfo[i].flags = alloc(strlen(flags) + 1)) == NULL) { - VIM_CLEAR(csinfo[i].fname); - VIM_CLEAR(csinfo[i].ppath); + MNV_CLEAR(csinfo[i].fname); + MNV_CLEAR(csinfo[i].ppath); return -1; } - vim_strncpy((char_u *)csinfo[i].flags, (char_u *)flags, strlen((const char *)flags)); + mnv_strncpy((char_u *)csinfo[i].flags, (char_u *)flags, strlen((const char *)flags)); } else csinfo[i].flags = NULL; @@ -1545,9 +1545,9 @@ cs_kill(exarg_T *eap UNUSED) } // only single digit positive and negative integers are allowed - if ((strlen(stok) < 2 && VIM_ISDIGIT((int)(stok[0]))) + if ((strlen(stok) < 2 && MNV_ISDIGIT((int)(stok[0]))) || (strlen(stok) < 3 && stok[0] == '-' - && VIM_ISDIGIT((int)(stok[1])))) + && MNV_ISDIGIT((int)(stok[1])))) i = atoi(stok); else { @@ -1605,7 +1605,7 @@ cs_kill_execute( * Convert the cscope output into a ctags style entry (as might be found * in a ctags tags file). there's one catch though: cscope doesn't tell you * the type of the tag you are looking for. for example, in Darren Hiebert's - * ctags (the one that comes with vim), #define's use a line number to find the + * ctags (the one that comes with mnv), #define's use a line number to find the * tag in a file while function definitions use a regexp search pattern. * * I'm going to always use the line number because cscope does something @@ -1620,21 +1620,21 @@ cs_kill_execute( * characters to comply with ctags formatting. */ static char * -cs_make_vim_style_matches( +cs_make_mnv_style_matches( char *fname, char *slno, char *search, char *tagstr) { - // vim style is ctags: + // mnv style is ctags: // // \t\t"\t // // but as mentioned above, we'll always use the line number and // put the search pattern (if one exists) as "extra" // - // buf is used as part of vim's method of handling tags, and - // (i think) vim frees it when you pop your tags and get replaced + // buf is used as part of mnv's method of handling tags, and + // (i think) mnv frees it when you pop your tags and get replaced // by new ones on the tag stack. char *buf; int amt; @@ -1666,9 +1666,9 @@ cs_make_vim_style_matches( * Store: keep a ptr to the (malloc'd) memory of matches originally * generated from cs_find(). the matches are originally lines directly * from cscope output, but transformed to look like something out of a - * ctags. see cs_make_vim_style_matches for more details. + * ctags. see cs_make_mnv_style_matches for more details. * - * Get: used only from cs_fgets(), this simulates a vim_fgets() to return + * Get: used only from cs_fgets(), this simulates a mnv_fgets() to return * the next line from the cscope output. it basically keeps track of which * lines have been "used" and returns the next one. * @@ -1714,12 +1714,12 @@ cs_manage_matches( if (cnt > 0) while (cnt--) { - vim_free(mp[cnt]); + mnv_free(mp[cnt]); if (cp != NULL) - vim_free(cp[cnt]); + mnv_free(cp[cnt]); } - vim_free(mp); - vim_free(cp); + mnv_free(mp); + mnv_free(cp); } mp = NULL; cp = NULL; @@ -1829,7 +1829,7 @@ cs_file_results(FILE *f, int *nummatches_a) context = alloc(strlen(cntx)+5); if (context == NULL) { - vim_free(fullname); + mnv_free(fullname); continue; } @@ -1843,19 +1843,19 @@ cs_file_results(FILE *f, int *nummatches_a) else fprintf(f, "%s\t%s\t%s %s\n", fullname, slno, context, search); - vim_free(context); - vim_free(fullname); + mnv_free(context); + mnv_free(fullname); } // for all matches (void)cs_read_prompt(i); } // for all cscope connections - vim_free(buf); + mnv_free(buf); } # endif /* - * Get parsed cscope output and calls cs_make_vim_style_matches to convert + * Get parsed cscope output and calls cs_make_mnv_style_matches to convert * into ctags format. * When there are no matches sets "*matches_p" to NULL. */ @@ -1899,17 +1899,17 @@ cs_fill_results( &slno, &search)) == NULL) continue; - matches[totsofar] = cs_make_vim_style_matches(fullname, slno, + matches[totsofar] = cs_make_mnv_style_matches(fullname, slno, search, tagstr); - vim_free(fullname); + mnv_free(fullname); if (strcmp(cntx, "") == 0) cntxts[totsofar] = NULL; else - // note: if vim_strsave returns NULL, then the context + // note: if mnv_strsave returns NULL, then the context // will be "", which is misleading. - cntxts[totsofar] = (char *)vim_strsave((char_u *)cntx); + cntxts[totsofar] = (char *)mnv_strsave((char_u *)cntx); if (matches[totsofar] != NULL) totsofar++; @@ -1924,14 +1924,14 @@ parse_out: if (totsofar == 0) { // No matches, free the arrays and return NULL in "*matches_p". - VIM_CLEAR(matches); - VIM_CLEAR(cntxts); + MNV_CLEAR(matches); + MNV_CLEAR(cntxts); } *matched = totsofar; *matches_p = matches; *cntxts_p = cntxts; - vim_free(buf); + mnv_free(buf); } @@ -1998,7 +1998,7 @@ cs_print_tags_priv(char **matches, char **cntxts, int num_matches) ptag = strtok(tbuf, "\t"); if (ptag == NULL) { - vim_free(tbuf); + mnv_free(tbuf); return; } @@ -2011,7 +2011,7 @@ cs_print_tags_priv(char **matches, char **cntxts, int num_matches) msg_puts_attr(buf, HL_ATTR(HLF_T)); } - vim_free(tbuf); + mnv_free(tbuf); msg_puts_attr(_("\n # line"), HL_ATTR(HLF_T)); // strlen is 7 msg_advance(msg_col + 2); @@ -2033,7 +2033,7 @@ cs_print_tags_priv(char **matches, char **cntxts, int num_matches) || (fname = strtok(NULL, (const char *)"\t")) == NULL || (lno = strtok(NULL, (const char *)"\t")) == NULL) { - vim_free(tbuf); + mnv_free(tbuf); continue; } extra = strtok(NULL, (const char *)"\t"); @@ -2045,11 +2045,11 @@ cs_print_tags_priv(char **matches, char **cntxts, int num_matches) if (bufsize < newsize) { t_buf = buf; - buf = vim_realloc(buf, newsize); + buf = mnv_realloc(buf, newsize); if (buf == NULL) { bufsize = 0; - vim_free(t_buf); + mnv_free(t_buf); } else bufsize = newsize; @@ -2073,11 +2073,11 @@ cs_print_tags_priv(char **matches, char **cntxts, int num_matches) if (bufsize < newsize) { t_buf = buf; - buf = vim_realloc(buf, newsize); + buf = mnv_realloc(buf, newsize); if (buf == NULL) { bufsize = 0; - vim_free(t_buf); + mnv_free(t_buf); } else bufsize = newsize; @@ -2099,7 +2099,7 @@ cs_print_tags_priv(char **matches, char **cntxts, int num_matches) msg_outtrans_long_attr((char_u *)extra, 0); } - vim_free(tbuf); // only after printing extra due to strtok use + mnv_free(tbuf); // only after printing extra due to strtok use if (msg_col) msg_putchar('\n'); @@ -2114,7 +2114,7 @@ cs_print_tags_priv(char **matches, char **cntxts, int num_matches) num++; } // for all matches - vim_free(buf); + mnv_free(buf); } @@ -2140,7 +2140,7 @@ cs_read_prompt(int i) { while ((ch = getc(csinfo[i].fr_fp)) != EOF && ch != CSCOPE_PROMPT[0]) // if there is room and char is printable - if (bufpos < maxlen - 1 && vim_isprintc(ch)) + if (bufpos < maxlen - 1 && mnv_isprintc(ch)) { if (buf == NULL) // lazy buffer allocation buf = alloc(maxlen); @@ -2180,7 +2180,7 @@ cs_read_prompt(int i) else if (p_csverbose) cs_reading_emsg(i); // don't have additional information cs_release_csp(i, TRUE); - vim_free(buf); + mnv_free(buf); return CSCOPE_FAILURE; } @@ -2196,7 +2196,7 @@ cs_read_prompt(int i) break; // did find the prompt } - vim_free(buf); + mnv_free(buf); return CSCOPE_SUCCESS; } @@ -2281,7 +2281,7 @@ cs_release_csp(int i, int freefnpp) if (waitpid_errno == ECHILD) { /* - * When using 'vim -g', vim is forked and cscope process is + * When using 'mnv -g', mnv is forked and cscope process is * no longer a child process but a sibling. So waitpid() * fails with errno being ECHILD (No child processes). * Don't send SIGKILL to cscope immediately but wait @@ -2328,9 +2328,9 @@ cs_release_csp(int i, int freefnpp) if (freefnpp) { - vim_free(csinfo[i].fname); - vim_free(csinfo[i].ppath); - vim_free(csinfo[i].flags); + mnv_free(csinfo[i].fname); + mnv_free(csinfo[i].ppath); + mnv_free(csinfo[i].flags); } clear_csinfo(i); @@ -2356,9 +2356,9 @@ cs_reset(exarg_T *eap UNUSED) fllist = ALLOC_MULT(char *, csinfo_size); if (dblist == NULL || pplist == NULL || fllist == NULL) { - vim_free(dblist); - vim_free(pplist); - vim_free(fllist); + mnv_free(dblist); + mnv_free(pplist); + mnv_free(fllist); return CSCOPE_FAILURE; } @@ -2386,13 +2386,13 @@ cs_reset(exarg_T *eap UNUSED) msg_puts_attr(buf, HL_ATTR(HLF_R)); } } - vim_free(dblist[i]); - vim_free(pplist[i]); - vim_free(fllist[i]); + mnv_free(dblist[i]); + mnv_free(pplist[i]); + mnv_free(fllist[i]); } - vim_free(dblist); - vim_free(pplist); - vim_free(fllist); + mnv_free(dblist); + mnv_free(pplist); + mnv_free(fllist); if (p_csverbose) msg_attr(_("All cscope databases reset"), HL_ATTR(HLF_R) | MSG_HIST); @@ -2418,8 +2418,8 @@ cs_resolve_file(int i, char *name) /* * Ppath is freed when we destroy the cscope connection. - * Fullname is freed after cs_make_vim_style_matches, after it's been - * copied into the tag buffer used by Vim. + * Fullname is freed after cs_make_mnv_style_matches, after it's been + * copied into the tag buffer used by MNV. */ len = (int)(strlen(name) + 2); if (csinfo[i].ppath != NULL) @@ -2431,7 +2431,7 @@ cs_resolve_file(int i, char *name) csdir = alloc(MAXPATHL); if (csdir != NULL) { - vim_strncpy(csdir, (char_u *)csinfo[i].fname, + mnv_strncpy(csdir, (char_u *)csinfo[i].fname, gettail((char_u *)csinfo[i].fname) - (char_u *)csinfo[i].fname); len += (int)STRLEN(csdir); @@ -2460,10 +2460,10 @@ cs_resolve_file(int i, char *name) } else { - fullname = (char *)vim_strsave((char_u *)name); + fullname = (char *)mnv_strsave((char_u *)name); } - vim_free(csdir); + mnv_free(csdir); return fullname; } @@ -2503,7 +2503,7 @@ cs_show(exarg_T *eap UNUSED) /* - * Only called when VIM exits to quit any cscope sessions. + * Only called when MNV exits to quit any cscope sessions. */ void cs_end(void) @@ -2512,7 +2512,7 @@ cs_end(void) for (i = 0; i < csinfo_size; i++) cs_release_csp(i, TRUE); - vim_free(csinfo); + mnv_free(csinfo); csinfo_size = 0; } @@ -2534,7 +2534,7 @@ f_cscope_connection(typval_T *argvars UNUSED, typval_T *rettv UNUSED) char_u *prepend = NULL; char_u buf[NUMBUFLEN]; - if (in_vim9script() + if (in_mnv9script() && (check_for_opt_number_arg(argvars, 0) == FAIL || (argvars[0].v_type != VAR_UNKNOWN && (check_for_opt_string_arg(argvars, 1) == FAIL diff --git a/uvim/src/if_lua.c b/uvim/src/if_lua.c index 7321af2680..9443f0c3ae 100644 --- a/uvim/src/if_lua.c +++ b/uvim/src/if_lua.c @@ -1,15 +1,15 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * * Lua interface by Luis Carvalho * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ -#include "vim.h" +#include "mnv.h" #include "version.h" #include @@ -26,15 +26,15 @@ // depend". #if defined(FEAT_LUA) -# define LUAVIM_CHUNKNAME "vim chunk" -# define LUAVIM_NAME "vim" -# define LUAVIM_EVALNAME "luaeval" -# define LUAVIM_EVALHEADER "local _A=select(1,...) return " +# define LUAMNV_CHUNKNAME "mnv chunk" +# define LUAMNV_NAME "mnv" +# define LUAMNV_EVALNAME "luaeval" +# define LUAMNV_EVALHEADER "local _A=select(1,...) return " # ifdef LUA_RELEASE -# define LUAVIM_VERSION LUA_RELEASE +# define LUAMNV_VERSION LUA_RELEASE # else -# define LUAVIM_VERSION LUA_VERSION +# define LUAMNV_VERSION LUA_VERSION # endif typedef buf_T *luaV_Buffer; @@ -55,23 +55,23 @@ typedef struct { lua_State *L; } luaV_CFuncState; -static const char LUAVIM_DICT[] = "dict"; -static const char LUAVIM_LIST[] = "list"; -static const char LUAVIM_BLOB[] = "blob"; -static const char LUAVIM_FUNCREF[] = "funcref"; -static const char LUAVIM_BUFFER[] = "buffer"; -static const char LUAVIM_WINDOW[] = "window"; -static const char LUAVIM_FREE[] = "luaV_free"; -static const char LUAVIM_LUAEVAL[] = "luaV_luaeval"; -static const char LUAVIM_SETREF[] = "luaV_setref"; +static const char LUAMNV_DICT[] = "dict"; +static const char LUAMNV_LIST[] = "list"; +static const char LUAMNV_BLOB[] = "blob"; +static const char LUAMNV_FUNCREF[] = "funcref"; +static const char LUAMNV_BUFFER[] = "buffer"; +static const char LUAMNV_WINDOW[] = "window"; +static const char LUAMNV_FREE[] = "luaV_free"; +static const char LUAMNV_LUAEVAL[] = "luaV_luaeval"; +static const char LUAMNV_SETREF[] = "luaV_setref"; static const char LUA___CALL[] = "__call"; -// get/setudata manage references to vim userdata in a cache table through +// get/setudata manage references to mnv userdata in a cache table through // object pointers (light userdata). The cache table itself is retrieved // from the registry. -static const char LUAVIM_UDATA_CACHE[] = "luaV_udata_cache"; +static const char LUAMNV_UDATA_CACHE[] = "luaV_udata_cache"; # define luaV_getfield(L, s) \ lua_pushlightuserdata((L), (void *)(s)); \ @@ -103,7 +103,7 @@ static void luaV_call_lua_func_free(void *state); # ifdef DYNAMIC_LUA # ifdef MSWIN -# define load_dll vimLoadLib +# define load_dll mnvLoadLib # define symbol_from_dll GetProcAddress # define close_dll FreeLibrary # define load_dll_error GetWin32Error @@ -493,7 +493,7 @@ luaL_typeerror(lua_State *L, int narg, const char *tname) static LUAV_INLINE void luaV_getudata(lua_State *L, void *v) { - lua_pushlightuserdata(L, (void *) LUAVIM_UDATA_CACHE); + lua_pushlightuserdata(L, (void *) LUAMNV_UDATA_CACHE); lua_rawget(L, LUA_REGISTRYINDEX); // now the cache table is at the top of the stack lua_pushlightuserdata(L, v); lua_rawget(L, -2); @@ -503,7 +503,7 @@ luaV_getudata(lua_State *L, void *v) static LUAV_INLINE void luaV_setudata(lua_State *L, void *v) { - lua_pushlightuserdata(L, (void *) LUAVIM_UDATA_CACHE); + lua_pushlightuserdata(L, (void *) LUAMNV_UDATA_CACHE); lua_rawget(L, LUA_REGISTRYINDEX); // cache table is at -1 lua_pushlightuserdata(L, v); // ...now at -2 lua_pushvalue(L, -3); // copy the userdata (cache at -3) @@ -638,7 +638,7 @@ luaV_totypval(lua_State *L, int pos, typval_T *tv) break; case LUA_TSTRING: tv->v_type = VAR_STRING; - tv->vval.v_string = vim_strsave((char_u *) lua_tostring(L, pos)); + tv->vval.v_string = mnv_strsave((char_u *) lua_tostring(L, pos)); break; case LUA_TNUMBER: { @@ -670,7 +670,7 @@ luaV_totypval(lua_State *L, int pos, typval_T *tv) name = register_cfunc(&luaV_call_lua_func, &luaV_call_lua_func_free, state); tv->v_type = VAR_FUNC; - tv->vval.v_string = vim_strsave(name); + tv->vval.v_string = mnv_strsave(name); break; } case LUA_TTABLE: @@ -694,7 +694,7 @@ luaV_totypval(lua_State *L, int pos, typval_T *tv) name = register_cfunc(&luaV_call_lua_func, &luaV_call_lua_func_free, state); tv->v_type = VAR_FUNC; - tv->vval.v_string = vim_strsave(name); + tv->vval.v_string = mnv_strsave(name); break; } } @@ -710,7 +710,7 @@ luaV_totypval(lua_State *L, int pos, typval_T *tv) if (lua_getmetatable(L, pos)) // has metatable? { // check list - luaV_getfield(L, LUAVIM_LIST); + luaV_getfield(L, LUAMNV_LIST); if (lua_rawequal(L, -1, -2)) { tv->v_type = VAR_LIST; @@ -720,7 +720,7 @@ luaV_totypval(lua_State *L, int pos, typval_T *tv) break; } // check dict - luaV_getfield(L, LUAVIM_DICT); + luaV_getfield(L, LUAMNV_DICT); if (lua_rawequal(L, -1, -3)) { tv->v_type = VAR_DICT; @@ -730,7 +730,7 @@ luaV_totypval(lua_State *L, int pos, typval_T *tv) break; } // check blob - luaV_getfield(L, LUAVIM_BLOB); + luaV_getfield(L, LUAMNV_BLOB); if (lua_rawequal(L, -1, -4)) { tv->v_type = VAR_BLOB; @@ -740,14 +740,14 @@ luaV_totypval(lua_State *L, int pos, typval_T *tv) break; } // check funcref - luaV_getfield(L, LUAVIM_FUNCREF); + luaV_getfield(L, LUAMNV_FUNCREF); if (lua_rawequal(L, -1, -5)) { luaV_Funcref *f = (luaV_Funcref *) p; func_ref(f->name); tv->v_type = VAR_FUNC; - tv->vval.v_string = vim_strsave(f->name); + tv->vval.v_string = mnv_strsave(f->name); lua_pop(L, 5); // MTs break; } @@ -882,13 +882,13 @@ luaV_newlist(lua_State *L, list_T *lis) *l = lis; lis->lv_refcount++; // reference in Lua luaV_setudata(L, lis); // cache[lis] = udata - luaV_getfield(L, LUAVIM_LIST); + luaV_getfield(L, LUAMNV_LIST); lua_setmetatable(L, -2); return l; } luaV_pushtype(list_T, list, luaV_List) -luaV_type_tostring(list, LUAVIM_LIST) +luaV_type_tostring(list, LUAMNV_LIST) static int luaV_list_len(lua_State *L) @@ -927,7 +927,7 @@ luaV_list_index(lua_State *L) long n = (long) luaL_checkinteger(L, 2); listitem_T *li; - // Lua array index starts with 1 while Vim uses 0, subtract 1 to + // Lua array index starts with 1 while MNV uses 0, subtract 1 to // normalize. n -= 1; li = list_find(l, n); @@ -960,7 +960,7 @@ luaV_list_newindex(lua_State *L) long n = (long) luaL_checkinteger(L, 2); listitem_T *li; - // Lua array index starts with 1 while Vim uses 0, subtract 1 to normalize. + // Lua array index starts with 1 while MNV uses 0, subtract 1 to normalize. n -= 1; if (l->lv_lock) @@ -981,7 +981,7 @@ luaV_list_newindex(lua_State *L) { if (lua_isnil(L, 3)) // remove? { - vimlist_remove(l, li, li); + mnvlist_remove(l, li, li); listitem_free(l, li); } else @@ -998,7 +998,7 @@ luaV_list_newindex(lua_State *L) static int luaV_list_add(lua_State *L) { - luaV_List *lis = luaV_checkudata(L, 1, LUAVIM_LIST); + luaV_List *lis = luaV_checkudata(L, 1, LUAMNV_LIST); list_T *l = (list_T *) luaV_checkcache(L, (void *) *lis); typval_T v; if (l->lv_lock) @@ -1015,7 +1015,7 @@ luaV_list_add(lua_State *L) static int luaV_list_insert(lua_State *L) { - luaV_List *lis = luaV_checkudata(L, 1, LUAVIM_LIST); + luaV_List *lis = luaV_checkudata(L, 1, LUAMNV_LIST); list_T *l = (list_T *) luaV_checkcache(L, (void *) *lis); long pos = (long) luaL_optinteger(L, 3, 0); listitem_T *li = NULL; @@ -1058,13 +1058,13 @@ luaV_newdict(lua_State *L, dict_T *dic) *d = dic; dic->dv_refcount++; // reference in Lua luaV_setudata(L, dic); // cache[dic] = udata - luaV_getfield(L, LUAVIM_DICT); + luaV_getfield(L, LUAMNV_DICT); lua_setmetatable(L, -2); return d; } luaV_pushtype(dict_T, dict, luaV_Dict) -luaV_type_tostring(dict, LUAVIM_DICT) +luaV_type_tostring(dict, LUAMNV_DICT) static int luaV_dict_len(lua_State *L) @@ -1167,7 +1167,7 @@ luaV_dict_newindex(lua_State *L) } if (dict_add(d, di) == FAIL) { - vim_free(di); + mnv_free(di); clear_tv(&tv); return 0; } @@ -1204,13 +1204,13 @@ luaV_newblob(lua_State *L, blob_T *blo) *b = blo; blo->bv_refcount++; // reference in Lua luaV_setudata(L, blo); // cache[blo] = udata - luaV_getfield(L, LUAVIM_BLOB); + luaV_getfield(L, LUAMNV_BLOB); lua_setmetatable(L, -2); return b; } luaV_pushtype(blob_T, blob, luaV_Blob) -luaV_type_tostring(blob, LUAVIM_BLOB) +luaV_type_tostring(blob, LUAMNV_BLOB) static int luaV_blob_gc(lua_State *L) @@ -1284,7 +1284,7 @@ luaV_blob_newindex(lua_State *L) static int luaV_blob_add(lua_State *L) { - luaV_Blob *blo = luaV_checkudata(L, 1, LUAVIM_BLOB); + luaV_Blob *blo = luaV_checkudata(L, 1, LUAMNV_BLOB); blob_T *b = (blob_T *) luaV_checkcache(L, (void *) *blo); if (b->bv_lock) luaL_error(L, "blob is locked"); @@ -1325,10 +1325,10 @@ luaV_newfuncref(lua_State *L, char_u *name) if (name != NULL) { func_ref(name); - f->name = vim_strsave(name); + f->name = mnv_strsave(name); } f->self = NULL; - luaV_getfield(L, LUAVIM_FUNCREF); + luaV_getfield(L, LUAMNV_FUNCREF); lua_setmetatable(L, -2); return f; } @@ -1340,7 +1340,7 @@ luaV_pushfuncref(lua_State *L, char_u *name) } -luaV_type_tostring(funcref, LUAVIM_FUNCREF) +luaV_type_tostring(funcref, LUAMNV_FUNCREF) static int luaV_funcref_gc(lua_State *L) @@ -1348,9 +1348,9 @@ luaV_funcref_gc(lua_State *L) luaV_Funcref *f = (luaV_Funcref *) lua_touserdata(L, 1); func_unref(f->name); - vim_free(f->name); + mnv_free(f->name); // NOTE: Don't call "dict_unref(f->self)", because the dict of "f->self" - // will be (or has been already) freed by Vim's garbage collection. + // will be (or has been already) freed by MNV's garbage collection. return 0; } @@ -1408,9 +1408,9 @@ static const luaL_Reg luaV_Funcref_mt[] = { // ======= Buffer type ======= -luaV_newtype(buf_T, buffer, luaV_Buffer, LUAVIM_BUFFER) +luaV_newtype(buf_T, buffer, luaV_Buffer, LUAMNV_BUFFER) luaV_pushtype(buf_T, buffer, luaV_Buffer) -luaV_type_tostring(buffer, LUAVIM_BUFFER) +luaV_type_tostring(buffer, LUAMNV_BUFFER) static int luaV_buffer_len(lua_State *L) @@ -1537,7 +1537,7 @@ luaV_buffer_newindex(lua_State *L) static int luaV_buffer_insert(lua_State *L) { - luaV_Buffer *lb = luaV_checkudata(L, 1, LUAVIM_BUFFER); + luaV_Buffer *lb = luaV_checkudata(L, 1, LUAMNV_BUFFER); buf_T *b = (buf_T *) luaV_checkcache(L, (void *) *lb); linenr_T last = b->b_ml.ml_line_count; linenr_T n = (linenr_T) luaL_optinteger(L, 3, last); @@ -1572,7 +1572,7 @@ luaV_buffer_insert(lua_State *L) static int luaV_buffer_next(lua_State *L) { - luaV_Buffer *b = luaV_checkudata(L, 1, LUAVIM_BUFFER); + luaV_Buffer *b = luaV_checkudata(L, 1, LUAMNV_BUFFER); buf_T *buf = (buf_T *) luaV_checkcache(L, (void *) *b); luaV_pushbuffer(L, buf->b_next); return 1; @@ -1581,7 +1581,7 @@ luaV_buffer_next(lua_State *L) static int luaV_buffer_previous(lua_State *L) { - luaV_Buffer *b = luaV_checkudata(L, 1, LUAVIM_BUFFER); + luaV_Buffer *b = luaV_checkudata(L, 1, LUAMNV_BUFFER); buf_T *buf = (buf_T *) luaV_checkcache(L, (void *) *b); luaV_pushbuffer(L, buf->b_prev); return 1; @@ -1590,7 +1590,7 @@ luaV_buffer_previous(lua_State *L) static int luaV_buffer_isvalid(lua_State *L) { - luaV_Buffer *b = luaV_checkudata(L, 1, LUAVIM_BUFFER); + luaV_Buffer *b = luaV_checkudata(L, 1, LUAMNV_BUFFER); luaV_getudata(L, *b); lua_pushboolean(L, !lua_isnil(L, -1)); return 1; @@ -1612,9 +1612,9 @@ static const luaL_Reg luaV_Buffer_mt[] = { // ======= Window type ======= -luaV_newtype(win_T, window, luaV_Window, LUAVIM_WINDOW) +luaV_newtype(win_T, window, luaV_Window, LUAMNV_WINDOW) luaV_pushtype(win_T, window, luaV_Window) -luaV_type_tostring(window, LUAVIM_WINDOW) +luaV_type_tostring(window, LUAMNV_WINDOW) static int luaV_window_call(lua_State *L) @@ -1706,7 +1706,7 @@ luaV_window_newindex(lua_State *L) static int luaV_window_next(lua_State *L) { - luaV_Window *w = luaV_checkudata(L, 1, LUAVIM_WINDOW); + luaV_Window *w = luaV_checkudata(L, 1, LUAMNV_WINDOW); win_T *win = (win_T *) luaV_checkcache(L, (void *) *w); luaV_pushwindow(L, win->w_next); return 1; @@ -1715,7 +1715,7 @@ luaV_window_next(lua_State *L) static int luaV_window_previous(lua_State *L) { - luaV_Window *w = luaV_checkudata(L, 1, LUAVIM_WINDOW); + luaV_Window *w = luaV_checkudata(L, 1, LUAMNV_WINDOW); win_T *win = (win_T *) luaV_checkcache(L, (void *) *w); luaV_pushwindow(L, win->w_prev); return 1; @@ -1724,7 +1724,7 @@ luaV_window_previous(lua_State *L) static int luaV_window_isvalid(lua_State *L) { - luaV_Window *w = luaV_checkudata(L, 1, LUAVIM_WINDOW); + luaV_Window *w = luaV_checkudata(L, 1, LUAMNV_WINDOW); luaV_getudata(L, *w); lua_pushboolean(L, !lua_isnil(L, -1)); return 1; @@ -1742,7 +1742,7 @@ static const luaL_Reg luaV_Window_mt[] = { }; -// ======= Vim module ======= +// ======= MNV module ======= static int luaV_print(lua_State *L) @@ -1783,14 +1783,14 @@ luaV_print(lua_State *L) luaV_debug(lua_State *L) { lua_settop(L, 0); - lua_getglobal(L, "vim"); + lua_getglobal(L, "mnv"); lua_getfield(L, -1, "eval"); - lua_remove(L, -2); // vim.eval at position 1 + lua_remove(L, -2); // mnv.eval at position 1 for (;;) { const char *input; size_t l; - lua_pushvalue(L, 1); // vim.eval + lua_pushvalue(L, 1); // mnv.eval lua_pushliteral(L, "input('lua_debug> ')"); lua_call(L, 1, 1); // return string input = lua_tolstring(L, -1, &l); @@ -1800,7 +1800,7 @@ luaV_debug(lua_State *L) if (luaL_loadbuffer(L, input, l, "=(debug command)") || lua_pcall(L, 0, 0, 0)) luaV_emsg(L); - lua_settop(L, 1); // remove eventual returns, but keep vim.eval + lua_settop(L, 1); // remove eventual returns, but keep mnv.eval } } @@ -1813,7 +1813,7 @@ luaV_get_var_scope(lua_State *L) if (STRICMP((char *)scope, "g") == 0) dict = get_globvar_dict(); else if (STRICMP((char *)scope, "v") == 0) - dict = get_vimvar_dict(); + dict = get_mnvvar_dict(); else if (STRICMP((char *)scope, "b") == 0) dict = curbuf->b_vars; else if (STRICMP((char *)scope, "w") == 0) @@ -1875,7 +1875,7 @@ luaV_setvar(lua_State *L) // Update the key typval_T tv; - // Convert the lua value to a Vim script type in the temporary variable + // Convert the lua value to a MNV script type in the temporary variable lua_pushvalue(L, 4); if (luaV_totypval(L, -1, &tv) == FAIL) return luaL_error(L, "Couldn't convert lua value"); @@ -1901,7 +1901,7 @@ luaV_setvar(lua_State *L) else { int type_error = FALSE; - if (dict == get_vimvar_dict() + if (dict == get_mnvvar_dict() && !before_set_vvar((char_u *)name, di, &tv, TRUE, &type_error)) { clear_tv(&tv); @@ -1941,10 +1941,10 @@ luaV_getvar(lua_State *L) static int luaV_command(lua_State *L) { - char_u *s = vim_strsave((char_u *)luaL_checkstring(L, 1)); + char_u *s = mnv_strsave((char_u *)luaL_checkstring(L, 1)); execute_cmds_from_string(s); - vim_free(s); + mnv_free(s); update_screen(UPD_VALID); return 0; } @@ -1963,7 +1963,7 @@ luaV_eval(lua_State *L) static int luaV_beep(lua_State *L UNUSED) { - vim_beep(BO_LANG); + mnv_beep(BO_LANG); return 0; } @@ -2003,7 +2003,7 @@ luaV_list(lua_State *L) notnil = !lua_isnil(L, -1); if (notnil) { - luaV_checktypval(L, -1, &v, "vim.list"); + luaV_checktypval(L, -1, &v, "mnv.list"); list_append_tv(l, &v); clear_tv(&v); } @@ -2050,11 +2050,11 @@ luaV_dict(lua_State *L) } if (*key == NUL) luaL_error(L, "table has empty key"); - luaV_checktypval(L, -2, &v, "vim.dict"); // value + luaV_checktypval(L, -2, &v, "mnv.dict"); // value di = dictitem_alloc(key); if (di == NULL || dict_add(d, di) == FAIL) { - vim_free(di); + mnv_free(di); lua_pushnil(L); return 1; } @@ -2101,7 +2101,7 @@ luaV_funcref(lua_State *L) { const char *name = luaL_checkstring(L, 1); // note: not checking if function exists (needs function_exists) - if (name == NULL || *name == NUL || VIM_ISDIGIT(*name)) + if (name == NULL || *name == NUL || MNV_ISDIGIT(*name)) luaL_error(L, "invalid function name: %s", name); luaV_newfuncref(L, (char_u *) name); return 1; @@ -2173,42 +2173,42 @@ luaV_open(lua_State *L) luaV_type(lua_State *L) { luaL_checkany(L, 1); - if (lua_type(L, 1) == LUA_TUSERDATA) // check vim udata? + if (lua_type(L, 1) == LUA_TUSERDATA) // check mnv udata? { lua_settop(L, 1); if (lua_getmetatable(L, 1)) { - luaV_getfield(L, LUAVIM_LIST); + luaV_getfield(L, LUAMNV_LIST); if (lua_rawequal(L, -1, 2)) { lua_pushstring(L, "list"); return 1; } - luaV_getfield(L, LUAVIM_DICT); + luaV_getfield(L, LUAMNV_DICT); if (lua_rawequal(L, -1, 2)) { lua_pushstring(L, "dict"); return 1; } - luaV_getfield(L, LUAVIM_BLOB); + luaV_getfield(L, LUAMNV_BLOB); if (lua_rawequal(L, -1, 2)) { lua_pushstring(L, "blob"); return 1; } - luaV_getfield(L, LUAVIM_FUNCREF); + luaV_getfield(L, LUAMNV_FUNCREF); if (lua_rawequal(L, -1, 2)) { lua_pushstring(L, "funcref"); return 1; } - luaV_getfield(L, LUAVIM_BUFFER); + luaV_getfield(L, LUAMNV_BUFFER); if (lua_rawequal(L, -1, 2)) { lua_pushstring(L, "buffer"); return 1; } - luaV_getfield(L, LUAVIM_WINDOW); + luaV_getfield(L, LUAMNV_WINDOW); if (lua_rawequal(L, -1, 2)) { lua_pushstring(L, "window"); @@ -2241,22 +2241,22 @@ luaV_call(lua_State *L) if (luaV_totypval(L, i + 2, &argv[i]) == FAIL) { error = "lua: cannot convert value"; - goto free_vim_args; + goto free_mnv_args; } } argv[argc].v_type = VAR_UNKNOWN; - if (call_vim_function(funcname, argc, argv, &rettv) == FAIL) + if (call_mnv_function(funcname, argc, argv, &rettv) == FAIL) { - error = "lua: call_vim_function failed"; - goto free_vim_args; + error = "lua: call_mnv_function failed"; + goto free_mnv_args; } luaV_pushtypval(L, &rettv); clear_tv(&rettv); -free_vim_args: +free_mnv_args: while (i > 0) clear_tv(&argv[--i]); @@ -2267,17 +2267,17 @@ free_vim_args: } /* - * Return the Vim version as a Lua table + * Return the MNV version as a Lua table */ static int luaV_version(lua_State *L) { lua_newtable(L); lua_pushstring(L, "major"); - lua_pushinteger(L, VIM_VERSION_MAJOR); + lua_pushinteger(L, MNV_VERSION_MAJOR); lua_settable(L, -3); lua_pushstring(L, "minor"); - lua_pushinteger(L, VIM_VERSION_MINOR); + lua_pushinteger(L, MNV_VERSION_MINOR); lua_settable(L, -3); lua_pushstring(L, "patch"); lua_pushinteger(L, highest_patch()); @@ -2326,11 +2326,11 @@ luaV_luaeval(lua_State *L) typval_T *arg = (typval_T *) lua_touserdata(L, 2); typval_T *rettv = (typval_T *) lua_touserdata(L, 3); luaL_buffinit(L, &b); - luaL_addlstring(&b, LUAVIM_EVALHEADER, sizeof(LUAVIM_EVALHEADER) - 1); + luaL_addlstring(&b, LUAMNV_EVALHEADER, sizeof(LUAMNV_EVALHEADER) - 1); luaL_addlstring(&b, str, l); luaL_pushresult(&b); str = lua_tolstring(L, -1, &l); - if (luaL_loadbuffer(L, str, l, LUAVIM_EVALNAME)) // compile error? + if (luaL_loadbuffer(L, str, l, LUAMNV_EVALNAME)) // compile error? { luaV_emsg(L); return 0; @@ -2352,12 +2352,12 @@ luaV_setref(lua_State *L) int copyID = lua_tointeger(L, 1); int abort = FALSE; - lua_pushlightuserdata(L, (void *) LUAVIM_UDATA_CACHE); + lua_pushlightuserdata(L, (void *) LUAMNV_UDATA_CACHE); lua_rawget(L, LUA_REGISTRYINDEX); // the cache table - luaV_getfield(L, LUAVIM_LIST); - luaV_getfield(L, LUAVIM_DICT); - luaV_getfield(L, LUAVIM_FUNCREF); + luaV_getfield(L, LUAMNV_LIST); + luaV_getfield(L, LUAMNV_DICT); + luaV_getfield(L, LUAMNV_FUNCREF); lua_pushnil(L); // traverse cache table while (!abort && lua_next(L, 2) != 0) @@ -2395,27 +2395,27 @@ luaV_pushversion(lua_State *L) int patch = 0; char s[16]; - sscanf(LUAVIM_VERSION, "Lua %d.%d.%d", &major, &minor, &patch); - vim_snprintf(s, sizeof(s), "%d.%d.%d", major, minor, patch); + sscanf(LUAMNV_VERSION, "Lua %d.%d.%d", &major, &minor, &patch); + mnv_snprintf(s, sizeof(s), "%d.%d.%d", major, minor, patch); lua_pushstring(L, s); return 0; } -# define LUA_VIM_FN_CODE \ - "vim.fn = setmetatable({}, {\n"\ +# define LUA_MNV_FN_CODE \ + "mnv.fn = setmetatable({}, {\n"\ " __index = function (t, key)\n"\ " local function _fn(...)\n"\ - " return vim.call(key, ...)\n"\ + " return mnv.call(key, ...)\n"\ " end\n"\ " t[key] = _fn\n"\ " return _fn\n"\ " end\n"\ " })" -# define LUA_VIM_UPDATE_PACKAGE_PATHS \ - "local last_vim_paths = {}\n"\ - "vim._update_package_paths = function ()\n"\ - " local cur_vim_paths = {}\n"\ +# define LUA_MNV_UPDATE_PACKAGE_PATHS \ + "local last_mnv_paths = {}\n"\ + "mnv._update_package_paths = function ()\n"\ + " local cur_mnv_paths = {}\n"\ " local function split(s, delimiter)\n"\ " result = {}\n"\ " for match in (s..delimiter):gmatch(\"(.-)\"..delimiter) do\n"\ @@ -2423,7 +2423,7 @@ luaV_pushversion(lua_State *L) " end\n"\ " return result\n"\ " end\n"\ - " local rtps = split(vim.eval('&runtimepath'), ',')\n"\ + " local rtps = split(mnv.eval('&runtimepath'), ',')\n"\ " local sep = package.config:sub(1, 1)\n"\ " for _, key in ipairs({'path', 'cpath'}) do\n"\ " local orig_str = package[key] .. ';'\n"\ @@ -2458,45 +2458,45 @@ luaV_pushversion(lua_State *L) " -- Always keep paths from &runtimepath at the start:\n"\ " -- append them here disregarding orig possibly containing one of them.\n"\ " new[#new + 1] = new_path\n"\ - " cur_vim_paths[new_path] = true\n"\ + " cur_mnv_paths[new_path] = true\n"\ " end\n"\ " end\n"\ " end\n"\ " for _, orig_path in ipairs(orig) do\n"\ " -- Handle removing obsolete paths originating from &runtimepath: such\n"\ - " -- paths either belong to cur_nvim_paths and were already added above or\n"\ - " -- to last_nvim_paths and should not be added at all if corresponding\n"\ + " -- paths either belong to cur_nmnv_paths and were already added above or\n"\ + " -- to last_nmnv_paths and should not be added at all if corresponding\n"\ " -- entry was removed from &runtimepath list.\n"\ - " if not (cur_vim_paths[orig_path] or last_vim_paths[orig_path]) then\n"\ + " if not (cur_mnv_paths[orig_path] or last_mnv_paths[orig_path]) then\n"\ " new[#new + 1] = orig_path\n"\ " end\n"\ " end\n"\ " package[key] = table.concat(new, ';')\n"\ " end\n"\ - " last_vim_paths = cur_vim_paths\n"\ + " last_mnv_paths = cur_mnv_paths\n"\ "end" -# define LUA_VIM_SETUP_VARIABLE_DICTS \ +# define LUA_MNV_SETUP_VARIABLE_DICTS \ "do\n"\ " local function make_dict_accessor(scope)\n"\ " local mt = {}\n"\ " function mt:__newindex(k, v)\n"\ - " return vim._setvar(scope, 0, k, v)\n"\ + " return mnv._setvar(scope, 0, k, v)\n"\ " end\n"\ " function mt:__index(k)\n"\ - " return vim._getvar(scope, 0, k)\n"\ + " return mnv._getvar(scope, 0, k)\n"\ " end\n"\ " return setmetatable({}, mt)\n"\ " end\n"\ - " vim.g = make_dict_accessor('g')\n"\ - " vim.v = make_dict_accessor('v')\n"\ - " vim.b = make_dict_accessor('b')\n"\ - " vim.w = make_dict_accessor('w')\n"\ - " vim.t = make_dict_accessor('t')\n"\ + " mnv.g = make_dict_accessor('g')\n"\ + " mnv.v = make_dict_accessor('v')\n"\ + " mnv.b = make_dict_accessor('b')\n"\ + " mnv.w = make_dict_accessor('w')\n"\ + " mnv.t = make_dict_accessor('t')\n"\ "end" static int -luaopen_vim(lua_State *L) +luaopen_mnv(lua_State *L) { lua_newtable(L); // cache table lua_newtable(L); // cache table's metatable @@ -2504,7 +2504,7 @@ luaopen_vim(lua_State *L) lua_setfield(L, -2, "__mode"); lua_setmetatable(L, -2); // cache is weak-valued // put the cache table in the registry for luaV_get/setudata() - lua_pushlightuserdata(L, (void *) LUAVIM_UDATA_CACHE); + lua_pushlightuserdata(L, (void *) LUAMNV_UDATA_CACHE); lua_pushvalue(L, -2); lua_rawset(L, LUA_REGISTRYINDEX); lua_pop(L, 1); // we don't need the cache table here anymore @@ -2517,47 +2517,47 @@ luaopen_vim(lua_State *L) lua_setfield(L, -2, "debug"); lua_pop(L, 1); // free - lua_pushlightuserdata(L, (void *) LUAVIM_FREE); + lua_pushlightuserdata(L, (void *) LUAMNV_FREE); lua_pushcfunction(L, luaV_free); lua_rawset(L, LUA_REGISTRYINDEX); // luaeval - lua_pushlightuserdata(L, (void *) LUAVIM_LUAEVAL); + lua_pushlightuserdata(L, (void *) LUAMNV_LUAEVAL); lua_pushcfunction(L, luaV_luaeval); lua_rawset(L, LUA_REGISTRYINDEX); // setref - lua_pushlightuserdata(L, (void *) LUAVIM_SETREF); + lua_pushlightuserdata(L, (void *) LUAMNV_SETREF); lua_pushcfunction(L, luaV_setref); lua_rawset(L, LUA_REGISTRYINDEX); // register - luaV_newmetatable(L, LUAVIM_LIST); + luaV_newmetatable(L, LUAMNV_LIST); luaV_register(L, luaV_List_mt); lua_pop(L, 1); - luaV_newmetatable(L, LUAVIM_DICT); + luaV_newmetatable(L, LUAMNV_DICT); luaV_register(L, luaV_Dict_mt); lua_pop(L, 1); - luaV_newmetatable(L, LUAVIM_BLOB); + luaV_newmetatable(L, LUAMNV_BLOB); luaV_register(L, luaV_Blob_mt); lua_pop(L, 1); - luaV_newmetatable(L, LUAVIM_FUNCREF); + luaV_newmetatable(L, LUAMNV_FUNCREF); luaV_register(L, luaV_Funcref_mt); lua_pop(L, 1); - luaV_newmetatable(L, LUAVIM_BUFFER); + luaV_newmetatable(L, LUAMNV_BUFFER); luaV_register(L, luaV_Buffer_mt); lua_pop(L, 1); - luaV_newmetatable(L, LUAVIM_WINDOW); + luaV_newmetatable(L, LUAMNV_WINDOW); luaV_register(L, luaV_Window_mt); lua_pop(L, 1); - lua_newtable(L); // vim table + lua_newtable(L); // mnv table luaV_register(L, luaV_module); luaV_pushversion(L); lua_setfield(L, -2, "lua_version"); - lua_setglobal(L, LUAVIM_NAME); + lua_setglobal(L, LUAMNV_NAME); // custom code - (void)luaL_dostring(L, LUA_VIM_FN_CODE); - (void)luaL_dostring(L, LUA_VIM_UPDATE_PACKAGE_PATHS); - (void)luaL_dostring(L, LUA_VIM_SETUP_VARIABLE_DICTS); + (void)luaL_dostring(L, LUA_MNV_FN_CODE); + (void)luaL_dostring(L, LUA_MNV_UPDATE_PACKAGE_PATHS); + (void)luaL_dostring(L, LUA_MNV_SETUP_VARIABLE_DICTS); - lua_getglobal(L, LUAVIM_NAME); + lua_getglobal(L, LUAMNV_NAME); lua_getfield(L, -1, "_update_package_paths"); if (lua_pcall(L, 0, 0, 0)) @@ -2571,7 +2571,7 @@ luaV_newstate(void) { lua_State *L = luaL_newstate(); luaL_openlibs(L); // core libs - lua_pushcfunction(L, luaopen_vim); // vim + lua_pushcfunction(L, luaopen_mnv); // mnv lua_call(L, 0, 0); return L; } @@ -2579,12 +2579,12 @@ luaV_newstate(void) static void luaV_setrange(lua_State *L, int line1, int line2) { - lua_getglobal(L, LUAVIM_NAME); + lua_getglobal(L, LUAMNV_NAME); lua_pushinteger(L, line1); lua_setfield(L, -2, "firstline"); lua_pushinteger(L, line2); lua_setfield(L, -2, "lastline"); - lua_pop(L, 1); // vim table + lua_pop(L, 1); // mnv table } @@ -2639,12 +2639,12 @@ ex_lua(exarg_T *eap) char *s = script != NULL ? script : (char *)eap->arg; luaV_setrange(L, eap->line1, eap->line2); - if (luaL_loadbuffer(L, s, strlen(s), LUAVIM_CHUNKNAME) + if (luaL_loadbuffer(L, s, strlen(s), LUAMNV_CHUNKNAME) || lua_pcall(L, 0, 0, 0)) luaV_emsg(L); } if (script != NULL) - vim_free(script); + mnv_free(script); } void @@ -2669,7 +2669,7 @@ ex_luado(exarg_T *eap) luaL_addlstring(&b, " end", 4); // footer luaL_pushresult(&b); s = lua_tolstring(L, -1, &len); - if (luaL_loadbuffer(L, s, len, LUAVIM_CHUNKNAME)) + if (luaL_loadbuffer(L, s, len, LUAMNV_CHUNKNAME)) { luaV_emsg(L); lua_pop(L, 1); // function body @@ -2731,7 +2731,7 @@ ex_luafile(exarg_T *eap) lua_##tname##_free(typ *o) \ { \ if (!lua_isopen()) return; \ - luaV_getfield(L, LUAVIM_FREE); \ + luaV_getfield(L, LUAMNV_FREE); \ lua_pushlightuserdata(L, (void *) o); \ lua_call(L, 1, 0); \ } @@ -2743,7 +2743,7 @@ luaV_freetype(win_T, window) do_luaeval(char_u *str, typval_T *arg, typval_T *rettv) { lua_init(); - luaV_getfield(L, LUAVIM_LUAEVAL); + luaV_getfield(L, LUAMNV_LUAEVAL); lua_pushstring(L, (char *) str); lua_pushlightuserdata(L, (void *) arg); lua_pushlightuserdata(L, (void *) rettv); @@ -2758,7 +2758,7 @@ set_ref_in_lua(int copyID) if (!lua_isopen()) return 0; - luaV_getfield(L, LUAVIM_SETREF); + luaV_getfield(L, LUAMNV_SETREF); // call the function with 1 arg, getting 1 result back lua_pushinteger(L, copyID); lua_call(L, 1, 1); @@ -2776,7 +2776,7 @@ update_package_paths_in_lua(void) if (!lua_isopen()) return; - lua_getglobal(L, "vim"); + lua_getglobal(L, "mnv"); lua_getfield(L, -1, "_update_package_paths"); if (lua_pcall(L, 0, 0, 0)) @@ -2829,7 +2829,7 @@ luaV_call_lua_func_free(void *state) funcstate->L = NULL; if (funcstate->lua_tableref != LUA_NOREF) luaL_unref(L, LUA_REGISTRYINDEX, funcstate->lua_tableref); - VIM_CLEAR(funcstate); + MNV_CLEAR(funcstate); } #endif diff --git a/uvim/src/if_mzsch.c b/uvim/src/if_mzsch.c index a6043e1d82..268f893e99 100644 --- a/uvim/src/if_mzsch.c +++ b/uvim/src/if_mzsch.c @@ -7,11 +7,11 @@ * This consists of six parts: * 1. MzScheme interpreter main program * 2. Routines that handle the external interface between MzScheme and - * Vim. + * MNV. * 3. MzScheme input/output handlers: writes output via [e]msg(). - * 4. Implementation of the Vim Features for MzScheme - * 5. Vim Window-related Manipulation Functions. - * 6. Vim Buffer-related Manipulation Functions + * 4. Implementation of the MNV Features for MzScheme + * 5. MNV Window-related Manipulation Functions. + * 6. MNV Buffer-related Manipulation Functions * * NOTES * 1. Memory, allocated with scheme_malloc*, need not to be freed explicitly, @@ -21,7 +21,7 @@ * 3. I don't use K&R-style functions. Anyways, MzScheme headers are ANSI. */ -#include "vim.h" +#include "mnv.h" #include "if_mzsch.h" @@ -47,18 +47,18 @@ #if defined(MZ_PRECISE_GC) && MZSCHEME_VERSION_MAJOR >= 400 \ || MZSCHEME_VERSION_MAJOR >= 500 \ && (defined(MZ_USE_FUTURES) || defined(MZ_USE_PLACES)) -# define TRAMPOLINED_MZVIM_STARTUP +# define TRAMPOLINED_MZMNV_STARTUP #endif // Base data structures -#define SCHEME_VIMBUFFERP(obj) SAME_TYPE(SCHEME_TYPE(obj), mz_buffer_type) -#define SCHEME_VIMWINDOWP(obj) SAME_TYPE(SCHEME_TYPE(obj), mz_window_type) +#define SCHEME_MNVBUFFERP(obj) SAME_TYPE(SCHEME_TYPE(obj), mz_buffer_type) +#define SCHEME_MNVWINDOWP(obj) SAME_TYPE(SCHEME_TYPE(obj), mz_window_type) typedef struct { Scheme_Object so; buf_T *buf; -} vim_mz_buffer; +} mnv_mz_buffer; #define INVALID_BUFFER_VALUE ((buf_T *)(-1)) @@ -66,12 +66,12 @@ typedef struct { Scheme_Object so; win_T *win; -} vim_mz_window; +} mnv_mz_window; #define INVALID_WINDOW_VALUE ((win_T *)(-1)) /* - * Prims that form MzScheme Vim interface + * Prims that form MzScheme MNV interface */ typedef struct { @@ -79,7 +79,7 @@ typedef struct char *name; int mina; // arity information int maxa; -} Vim_Prim; +} MNV_Prim; typedef struct { @@ -89,12 +89,12 @@ typedef struct /* *======================================================================== - * Vim-Control Commands + * MNV-Control Commands *======================================================================== */ /* *======================================================================== - * Utility functions for the vim/mzscheme interface + * Utility functions for the mnv/mzscheme interface *======================================================================== */ #ifdef HAVE_SANDBOX @@ -105,18 +105,18 @@ static void sandbox_check(void); // Buffer-related commands static Scheme_Object *buffer_new(buf_T *buf); static Scheme_Object *get_buffer_by_num(void *, int, Scheme_Object **); -static vim_mz_buffer *get_vim_curr_buffer(void); +static mnv_mz_buffer *get_mnv_curr_buffer(void); // Window-related commands static Scheme_Object *window_new(win_T *win); -static vim_mz_window *get_vim_curr_window(void); +static mnv_mz_window *get_mnv_curr_window(void); /* *======================================================================== * Internal Function Prototypes *======================================================================== */ -static int vim_error_check(void); +static int mnv_error_check(void); static int do_mzscheme_command(exarg_T *, void *, Scheme_Closed_Prim *what); static int startup_mzscheme(void); static char *string_to_line(Scheme_Object *obj); @@ -133,10 +133,10 @@ static Scheme_Object *_apply_thunk_catch_exceptions( static Scheme_Object *extract_exn_message(Scheme_Object *v); static Scheme_Object *do_eval(void *, int noargc, Scheme_Object **noargv); static Scheme_Object *do_load(void *, int noargc, Scheme_Object **noargv); -static void register_vim_exn(void); -static vim_mz_buffer *get_buffer_arg(const char *fname, int argnum, +static void register_mnv_exn(void); +static mnv_mz_buffer *get_buffer_arg(const char *fname, int argnum, int argc, Scheme_Object **argv); -static vim_mz_window *get_window_arg(const char *fname, int argnum, +static mnv_mz_window *get_window_arg(const char *fname, int argnum, int argc, Scheme_Object **argv); static int line_in_range(linenr_T, buf_T *); static void check_line_range(linenr_T, buf_T *); @@ -149,19 +149,19 @@ static void init_exn_catching_apply(void); static int mzscheme_env_main(Scheme_Env *env, int argc, char **argv); static int mzscheme_init(void); #ifdef FEAT_EVAL -static Scheme_Object *vim_to_mzscheme(typval_T *vim_value); -static Scheme_Object *vim_to_mzscheme_impl(typval_T *vim_value, int depth, +static Scheme_Object *mnv_to_mzscheme(typval_T *mnv_value); +static Scheme_Object *mnv_to_mzscheme_impl(typval_T *mnv_value, int depth, Scheme_Hash_Table *visited); -static int mzscheme_to_vim(Scheme_Object *obj, typval_T *tv); -static int mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth, +static int mzscheme_to_mnv(Scheme_Object *obj, typval_T *tv); +static int mzscheme_to_mnv_impl(Scheme_Object *obj, typval_T *tv, int depth, Scheme_Hash_Table *visited); -static Scheme_Object *vim_funcref(void *data, int argc, Scheme_Object **argv); +static Scheme_Object *mnv_funcref(void *data, int argc, Scheme_Object **argv); #endif #ifdef MZ_PRECISE_GC static int buffer_size_proc(void *obj UNUSED) { - return gcBYTES_TO_WORDS(sizeof(vim_mz_buffer)); + return gcBYTES_TO_WORDS(sizeof(mnv_mz_buffer)); } static int buffer_mark_proc(void *obj) { @@ -171,14 +171,14 @@ static int buffer_fixup_proc(void *obj) { // apparently not needed as the object will be uncollectable while // the buffer is alive - // vim_mz_buffer* buf = (vim_mz_buffer*) obj; + // mnv_mz_buffer* buf = (mnv_mz_buffer*) obj; // buf->buf->b_mzscheme_ref = GC_fixup_self(obj); return buffer_size_proc(obj); } static int window_size_proc(void *obj UNUSED) { - return gcBYTES_TO_WORDS(sizeof(vim_mz_window)); + return gcBYTES_TO_WORDS(sizeof(mnv_mz_window)); } static int window_mark_proc(void *obj) { @@ -188,7 +188,7 @@ static int window_fixup_proc(void *obj) { // apparently not needed as the object will be uncollectable while // the window is alive - // vim_mz_window* win = (vim_mz_window*) obj; + // mnv_mz_window* win = (mnv_mz_window*) obj; // win->win->w_mzscheme_ref = GC_fixup_self(obj); // return window_size_proc(obj); @@ -196,11 +196,11 @@ static int window_fixup_proc(void *obj) // with precise GC, w_mzscheme_ref and b_mzscheme_ref are immobile boxes // containing pointers to a window/buffer // with conservative GC these are simply pointers -# define WINDOW_REF(win) *(vim_mz_window **)((win)->w_mzscheme_ref) -# define BUFFER_REF(buf) *(vim_mz_buffer **)((buf)->b_mzscheme_ref) +# define WINDOW_REF(win) *(mnv_mz_window **)((win)->w_mzscheme_ref) +# define BUFFER_REF(buf) *(mnv_mz_buffer **)((buf)->b_mzscheme_ref) #else -# define WINDOW_REF(win) (vim_mz_window *)((win)->w_mzscheme_ref) -# define BUFFER_REF(buf) (vim_mz_buffer *)((buf)->b_mzscheme_ref) +# define WINDOW_REF(win) (mnv_mz_window *)((win)->w_mzscheme_ref) +# define BUFFER_REF(buf) (mnv_mz_buffer *)((buf)->b_mzscheme_ref) #endif #if defined(DYNAMIC_MZSCHEME) @@ -345,7 +345,7 @@ static void **(*dll_scheme_malloc_immobile_box)(void *p); static void (*dll_scheme_free_immobile_box)(void **b); # endif # if MZSCHEME_VERSION_MAJOR >= 500 -# ifdef TRAMPOLINED_MZVIM_STARTUP +# ifdef TRAMPOLINED_MZMNV_STARTUP static int (*dll_scheme_main_setup)(int no_auto_statics, Scheme_Env_Main _main, int argc, char **argv); # if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || MZSCHEME_VERSION_MAJOR >= 603 static void (*dll_scheme_register_tls_space)(void *tls_space, int _tls_index); @@ -469,7 +469,7 @@ static void (*dll_scheme_set_config_path)(Scheme_Object *p); # define GC_register_traversers dll_GC_register_traversers # endif # if MZSCHEME_VERSION_MAJOR >= 400 -# ifdef TRAMPOLINED_MZVIM_STARTUP +# ifdef TRAMPOLINED_MZMNV_STARTUP # define scheme_main_setup dll_scheme_main_setup # if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || MZSCHEME_VERSION_MAJOR >= 603 # define scheme_register_tls_space dll_scheme_register_tls_space @@ -615,7 +615,7 @@ static Thunk_Info mzsch_imports[] = { {"GC_register_traversers", (void **)&dll_GC_register_traversers}, # endif # if MZSCHEME_VERSION_MAJOR >= 400 -# ifdef TRAMPOLINED_MZVIM_STARTUP +# ifdef TRAMPOLINED_MZMNV_STARTUP {"scheme_main_setup", (void **)&dll_scheme_main_setup}, # if defined(IMPLEMENT_THREAD_LOCAL_VIA_WIN_TLS) || MZSCHEME_VERSION_MAJOR >= 603 {"scheme_register_tls_space", (void **)&dll_scheme_register_tls_space}, @@ -651,8 +651,8 @@ mzscheme_runtime_link_init(char *sch_dll, char *gc_dll, int verbose) if (hMzGC && hMzSch) return OK; - hMzSch = vimLoadLib(sch_dll); - hMzGC = vimLoadLib(gc_dll); + hMzSch = mnvLoadLib(sch_dll); + hMzGC = mnvLoadLib(gc_dll); if (!hMzGC) { @@ -776,11 +776,11 @@ static Scheme_Env *environment = NULL; // output/error handlers static Scheme_Object *curout = NULL; static Scheme_Object *curerr = NULL; -// exn:vim exception +// exn:mnv exception static Scheme_Object *exn_catching_apply = NULL; static Scheme_Object *exn_p = NULL; static Scheme_Object *exn_message = NULL; -static Scheme_Object *vim_exn = NULL; // Vim Error exception +static Scheme_Object *mnv_exn = NULL; // MNV Error exception #if !defined(MZ_PRECISE_GC) || MZSCHEME_VERSION_MAJOR < 400 static void *stack_base = NULL; @@ -803,9 +803,9 @@ static void timer_proc(XtPointer, XtIntervalId *); static XtIntervalId timer_id = (XtIntervalId)0; #endif -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) // Win32 console and Unix +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) // Win32 console and Unix void -mzvim_check_threads(void) +mzmnv_check_threads(void) { // Last time MzScheme threads were scheduled static time_t mz_last_time = 0; @@ -917,7 +917,7 @@ mzscheme_end(void) #endif } -#if HAVE_TLS_SPACE && !defined(VIMDLL) +#if HAVE_TLS_SPACE && !defined(MNVDLL) # if defined(_MSC_VER) static __declspec(thread) void *tls_space; extern intptr_t _tls_index; @@ -933,7 +933,7 @@ static intptr_t _tls_index = 0; /* * mzscheme_main() is called early in main(). * We may call scheme_main_setup() which calls mzscheme_env_main() which then - * trampolines into vim_main2(), which never returns. + * trampolines into mnv_main2(), which never returns. */ int mzscheme_main(void) @@ -949,22 +949,22 @@ mzscheme_main(void) if (!mzscheme_enabled(FALSE)) { disabled = TRUE; - return vim_main2(); + return mnv_main2(); } #endif #ifdef HAVE_TLS_SPACE -# ifdef VIMDLL +# ifdef MNVDLL void **ptls_space; intptr_t tls_index; void (*pget_tls_info)(void ***ptls_space, intptr_t *ptls_index); - // Get the address of get_tls_info() from (g)vim.exe. + // Get the address of get_tls_info() from (g)mnv.exe. pget_tls_info = (void *)GetProcAddress( GetModuleHandle(NULL), "get_tls_info"); if (pget_tls_info == NULL) { disabled = TRUE; - return vim_main2(); + return mnv_main2(); } pget_tls_info(&ptls_space, &tls_index); scheme_register_tls_space(ptls_space, tls_index); @@ -972,7 +972,7 @@ mzscheme_main(void) scheme_register_tls_space(&tls_space, _tls_index); # endif #endif -#ifdef TRAMPOLINED_MZVIM_STARTUP +#ifdef TRAMPOLINED_MZMNV_STARTUP return scheme_main_setup(TRUE, mzscheme_env_main, argc, &argv); #else return mzscheme_env_main(NULL, argc, &argv); @@ -982,7 +982,7 @@ mzscheme_main(void) static int mzscheme_env_main(Scheme_Env *env, int argc UNUSED, char **argv UNUSED) { -#ifdef TRAMPOLINED_MZVIM_STARTUP +#ifdef TRAMPOLINED_MZMNV_STARTUP // Scheme has created the environment for us environment = env; #else @@ -998,8 +998,8 @@ mzscheme_env_main(Scheme_Env *env, int argc UNUSED, char **argv UNUSED) # endif #endif - vim_main2(); - // not reached, vim_main2() will loop until exit() + mnv_main2(); + // not reached, mnv_main2() will loop until exit() return 0; } @@ -1021,11 +1021,11 @@ load_base_module_on_error(void *data UNUSED) static int startup_mzscheme(void) { -#ifndef TRAMPOLINED_MZVIM_STARTUP +#ifndef TRAMPOLINED_MZMNV_STARTUP scheme_set_stack_base(stack_base, 1); #endif -#ifndef TRAMPOLINED_MZVIM_STARTUP +#ifndef TRAMPOLINED_MZMNV_STARTUP // in newer versions of precise GC the initial env has been created environment = scheme_basic_env(); #endif @@ -1036,7 +1036,7 @@ startup_mzscheme(void) MZ_REGISTER_STATIC(exn_catching_apply); MZ_REGISTER_STATIC(exn_p); MZ_REGISTER_STATIC(exn_message); - MZ_REGISTER_STATIC(vim_exn); + MZ_REGISTER_STATIC(mnv_exn); MZ_GC_CHECK(); @@ -1056,13 +1056,13 @@ startup_mzscheme(void) MZ_GC_VAR_IN_REG(0, coll_path); MZ_GC_REG(); // workaround for dynamic loading on windows - s = vim_getenv((char_u *)"PLTCOLLECTS", &mustfree); + s = mnv_getenv((char_u *)"PLTCOLLECTS", &mustfree); if (s != NULL) { coll_path = scheme_make_path((char *)s); MZ_GC_CHECK(); if (mustfree) - vim_free(s); + mnv_free(s); } # ifdef MZSCHEME_COLLECTS if (coll_path == NULL) @@ -1113,13 +1113,13 @@ startup_mzscheme(void) MZ_GC_VAR_IN_REG(0, config_path); MZ_GC_REG(); // workaround for dynamic loading on windows - s = vim_getenv((char_u *)"PLTCONFIGDIR", &mustfree); + s = mnv_getenv((char_u *)"PLTCONFIGDIR", &mustfree); if (s != NULL) { config_path = scheme_make_path((char *)s); MZ_GC_CHECK(); if (mustfree) - vim_free(s); + mnv_free(s); } # ifdef MZSCHEME_CONFIGDIR if (config_path == NULL) @@ -1159,7 +1159,7 @@ startup_mzscheme(void) } } - register_vim_exn(); + register_mnv_exn(); // use new environment to initialise exception handling init_exn_catching_apply(); @@ -1220,9 +1220,9 @@ startup_mzscheme(void) } #endif // Create buffer and window types for use in Scheme code - mz_buffer_type = scheme_make_type(""); + mz_buffer_type = scheme_make_type(""); MZ_GC_CHECK(); - mz_window_type = scheme_make_type(""); + mz_window_type = scheme_make_type(""); MZ_GC_CHECK(); #ifdef MZ_PRECISE_GC GC_register_traversers(mz_buffer_type, @@ -1314,7 +1314,7 @@ eval_with_exn_handling( MZ_GC_VAR_IN_REG(2, prim); MZ_GC_REG(); - prim = scheme_make_closed_prim_w_arity(what, data, "mzvim", 0, 0); + prim = scheme_make_closed_prim_w_arity(what, data, "mzmnv", 0, 0); MZ_GC_CHECK(); value = _apply_thunk_catch_exceptions(prim, &exn); MZ_GC_CHECK(); @@ -1325,7 +1325,7 @@ eval_with_exn_handling( // Got an exn? if (value) { - scheme_display(value, curerr); // Send to stderr-vim + scheme_display(value, curerr); // Send to stderr-mnv MZ_GC_CHECK(); do_flush(); } @@ -1339,7 +1339,7 @@ eval_with_exn_handling( // Print any result, as long as it's not a void else if (!SCHEME_VOIDP(value)) { - scheme_display(value, curout); // Send to stdout-vim + scheme_display(value, curout); // Send to stdout-mnv MZ_GC_CHECK(); } @@ -1364,7 +1364,7 @@ do_mzscheme_command(exarg_T *eap, void *data, Scheme_Closed_Prim *what) } /* - * Routine called by VIM when deleting a buffer + * Routine called by MNV when deleting a buffer */ void mzscheme_buffer_free(buf_T *buf) @@ -1372,7 +1372,7 @@ mzscheme_buffer_free(buf_T *buf) if (buf->b_mzscheme_ref == NULL) return; - vim_mz_buffer *bp = NULL; + mnv_mz_buffer *bp = NULL; MZ_GC_DECL_REG(1); MZ_GC_VAR_IN_REG(0, bp); MZ_GC_REG(); @@ -1390,7 +1390,7 @@ mzscheme_buffer_free(buf_T *buf) } /* - * Routine called by VIM when deleting a Window + * Routine called by MNV when deleting a Window */ void mzscheme_window_free(win_T *win) @@ -1398,7 +1398,7 @@ mzscheme_window_free(win_T *win) if (win->w_mzscheme_ref == NULL) return; - vim_mz_window *wp = NULL; + mnv_mz_window *wp = NULL; MZ_GC_DECL_REG(1); MZ_GC_VAR_IN_REG(0, wp); MZ_GC_REG(); @@ -1431,7 +1431,7 @@ ex_mzscheme(exarg_T *eap) else { do_mzscheme_command(eap, script, do_eval); - vim_free(script); + mnv_free(script); } } @@ -1452,7 +1452,7 @@ do_load(void *data, int noargc UNUSED, Scheme_Object **noargv UNUSED) file = (char *)scheme_malloc_fail_ok(scheme_malloc_atomic, MAXPATHL + 1); MZ_GC_CHECK(); - // make Vim expansion + // make MNV expansion expand_env((char_u *)pinfo->name, (char_u *)file, MAXPATHL); pinfo->port = scheme_open_input_file(file, "mzfile"); MZ_GC_CHECK(); @@ -1629,7 +1629,7 @@ do_flush(void) /* *======================================================================== - * 4. Implementation of the Vim Features for MzScheme + * 4. Implementation of the MNV Features for MzScheme *======================================================================== */ @@ -1637,9 +1637,9 @@ do_flush(void) * (command {command-string}) */ static Scheme_Object * -vim_command(void *data, int argc, Scheme_Object **argv) +mnv_command(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; + MNV_Prim *prim = (MNV_Prim *)data; Scheme_Object *cmd = NULL; MZ_GC_DECL_REG(1); MZ_GC_VAR_IN_REG(0, cmd); @@ -1659,12 +1659,12 @@ vim_command(void *data, int argc, Scheme_Object **argv) * (eval {expr-string}) */ static Scheme_Object * -vim_eval(void *data UNUSED, int argc UNUSED, Scheme_Object **argv UNUSED) +mnv_eval(void *data UNUSED, int argc UNUSED, Scheme_Object **argv UNUSED) { #ifdef FEAT_EVAL - Vim_Prim *prim = (Vim_Prim *)data; + MNV_Prim *prim = (MNV_Prim *)data; Scheme_Object *result = NULL; - typval_T *vim_result; + typval_T *mnv_result; Scheme_Object *expr = NULL; MZ_GC_DECL_REG(2); MZ_GC_VAR_IN_REG(0, result); @@ -1672,19 +1672,19 @@ vim_eval(void *data UNUSED, int argc UNUSED, Scheme_Object **argv UNUSED) MZ_GC_REG(); expr = GUARANTEED_STRING_ARG(prim->name, 0); - vim_result = eval_expr(BYTE_STRING_VALUE(expr), NULL); + mnv_result = eval_expr(BYTE_STRING_VALUE(expr), NULL); - if (vim_result == NULL) - raise_vim_exn(_("invalid expression")); + if (mnv_result == NULL) + raise_mnv_exn(_("invalid expression")); - result = vim_to_mzscheme(vim_result); + result = mnv_to_mzscheme(mnv_result); MZ_GC_CHECK(); - free_tv(vim_result); + free_tv(mnv_result); MZ_GC_UNREG(); return result; #else - raise_vim_exn(_("expressions disabled at compile time")); + raise_mnv_exn(_("expressions disabled at compile time")); // unreachable return scheme_false; #endif @@ -1717,7 +1717,7 @@ get_range_end(void *data UNUSED, int argc UNUSED, Scheme_Object **argv UNUSED) static Scheme_Object * mzscheme_beep(void *data UNUSED, int argc UNUSED, Scheme_Object **argv UNUSED) { - vim_beep(BO_LANG); + mnv_beep(BO_LANG); return scheme_void; } @@ -1729,7 +1729,7 @@ static Scheme_Object *M_global = NULL; static Scheme_Object * get_option(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; + MNV_Prim *prim = (MNV_Prim *)data; long value; char *strval; getoption_T rc; @@ -1757,12 +1757,12 @@ get_option(void *data, int argc, Scheme_Object **argv) if (argv[1] == M_global) scope = OPT_GLOBAL; - else if (SCHEME_VIMBUFFERP(argv[1])) + else if (SCHEME_MNVBUFFERP(argv[1])) { curbuf = get_valid_buffer(argv[1]); scope = OPT_LOCAL; } - else if (SCHEME_VIMWINDOWP(argv[1])) + else if (SCHEME_MNVWINDOWP(argv[1])) { win_T *win = get_valid_window(argv[1]); @@ -1771,7 +1771,7 @@ get_option(void *data, int argc, Scheme_Object **argv) scope = OPT_LOCAL; } else - scheme_wrong_type(prim->name, "vim-buffer/window", 1, argc, argv); + scheme_wrong_type(prim->name, "mnv-buffer/window", 1, argc, argv); } rc = get_option_value(BYTE_STRING_VALUE(name), &value, (char_u **)&strval, @@ -1788,18 +1788,18 @@ get_option(void *data, int argc, Scheme_Object **argv) case gov_string: rval = scheme_make_byte_string(strval); MZ_GC_CHECK(); - vim_free(strval); + mnv_free(strval); MZ_GC_UNREG(); return rval; case gov_hidden_bool: case gov_hidden_number: case gov_hidden_string: MZ_GC_UNREG(); - raise_vim_exn(_("hidden option")); + raise_mnv_exn(_("hidden option")); //NOTREACHED case gov_unknown: MZ_GC_UNREG(); - raise_vim_exn(_("unknown option")); + raise_mnv_exn(_("unknown option")); //NOTREACHED } // unreachable @@ -1816,7 +1816,7 @@ set_option(void *data, int argc, Scheme_Object **argv) int scope = 0; buf_T *save_curb = curbuf; win_T *save_curw = curwin; - Vim_Prim *prim = (Vim_Prim *)data; + MNV_Prim *prim = (MNV_Prim *)data; Scheme_Object *cmd = NULL; MZ_GC_DECL_REG(1); @@ -1835,12 +1835,12 @@ set_option(void *data, int argc, Scheme_Object **argv) if (argv[1] == M_global) scope = OPT_GLOBAL; - else if (SCHEME_VIMBUFFERP(argv[1])) + else if (SCHEME_MNVBUFFERP(argv[1])) { curbuf = get_valid_buffer(argv[1]); scope = OPT_LOCAL; } - else if (SCHEME_VIMWINDOWP(argv[1])) + else if (SCHEME_MNVWINDOWP(argv[1])) { win_T *win = get_valid_window(argv[1]); curwin = win; @@ -1848,14 +1848,14 @@ set_option(void *data, int argc, Scheme_Object **argv) scope = OPT_LOCAL; } else - scheme_wrong_type(prim->name, "vim-buffer/window", 1, argc, argv); + scheme_wrong_type(prim->name, "mnv-buffer/window", 1, argc, argv); } // do_set can modify cmd, make copy - command = vim_strsave(BYTE_STRING_VALUE(cmd)); + command = mnv_strsave(BYTE_STRING_VALUE(cmd)); MZ_GC_UNREG(); do_set(command, scope); - vim_free(command); + mnv_free(command); update_screen(UPD_NOT_VALID); curbuf = save_curb; curwin = save_curw; @@ -1865,7 +1865,7 @@ set_option(void *data, int argc, Scheme_Object **argv) /* *=========================================================================== - * 5. Vim Window-related Manipulation Functions + * 5. MNV Window-related Manipulation Functions *=========================================================================== */ @@ -1875,7 +1875,7 @@ set_option(void *data, int argc, Scheme_Object **argv) static Scheme_Object * get_curr_win(void *data UNUSED, int argc UNUSED, Scheme_Object **argv UNUSED) { - return (Scheme_Object *)get_vim_curr_window(); + return (Scheme_Object *)get_mnv_curr_window(); } /* @@ -1901,8 +1901,8 @@ get_window_count( static Scheme_Object * get_window_list(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_buffer *buf; + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_buffer *buf; Scheme_Object *list; win_T *w = firstwin; @@ -1922,14 +1922,14 @@ get_window_list(void *data, int argc, Scheme_Object **argv) static Scheme_Object * window_new(win_T *win) { - vim_mz_window *self = NULL; + mnv_mz_window *self = NULL; MZ_GC_DECL_REG(1); MZ_GC_VAR_IN_REG(0, self); // We need to handle deletion of windows underneath us. // If we add a "w_mzscheme_ref" field to the win_T structure, - // then we can get at it in win_free() in vim. + // then we can get at it in win_free() in mnv. // // On a win_free() we set the Scheme object's win_T *field // to an invalid value. We trap all uses of a window @@ -1938,7 +1938,7 @@ window_new(win_T *win) return (Scheme_Object *)WINDOW_REF(win); MZ_GC_REG(); - self = scheme_malloc_fail_ok(scheme_malloc_tagged, sizeof(vim_mz_window)); + self = scheme_malloc_fail_ok(scheme_malloc_tagged, sizeof(mnv_mz_window)); CLEAR_POINTER(self); #ifdef MZ_PRECISE_GC win->w_mzscheme_ref = scheme_malloc_immobile_box(NULL); @@ -1962,7 +1962,7 @@ window_new(win_T *win) get_window_num(void *data UNUSED, int argc UNUSED, Scheme_Object **argv UNUSED) { int nr = 1; - Vim_Prim *prim = (Vim_Prim *)data; + MNV_Prim *prim = (MNV_Prim *)data; win_T *win = get_window_arg(prim->name, 0, argc, argv)->win; win_T *wp; @@ -1978,7 +1978,7 @@ get_window_num(void *data UNUSED, int argc UNUSED, Scheme_Object **argv UNUSED) static Scheme_Object * get_window_by_num(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; + MNV_Prim *prim = (MNV_Prim *)data; win_T *win = firstwin; int fnum; @@ -1999,8 +1999,8 @@ get_window_by_num(void *data, int argc, Scheme_Object **argv) static Scheme_Object * get_window_buffer(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_window *win = get_window_arg(prim->name, 0, argc, argv); + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_window *win = get_window_arg(prim->name, 0, argc, argv); return buffer_new(win->win->w_buffer); } @@ -2011,8 +2011,8 @@ get_window_buffer(void *data, int argc, Scheme_Object **argv) static Scheme_Object * get_window_height(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_window *win = get_window_arg(prim->name, 0, argc, argv); + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_window *win = get_window_arg(prim->name, 0, argc, argv); return scheme_make_integer(win->win->w_height); } @@ -2023,8 +2023,8 @@ get_window_height(void *data, int argc, Scheme_Object **argv) static Scheme_Object * set_window_height(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_window *win; + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_window *win; win_T *savewin; int height; @@ -2050,8 +2050,8 @@ set_window_height(void *data, int argc, Scheme_Object **argv) static Scheme_Object * get_window_width(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_window *win = get_window_arg(prim->name, 0, argc, argv); + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_window *win = get_window_arg(prim->name, 0, argc, argv); return scheme_make_integer(win->win->w_width); } @@ -2062,8 +2062,8 @@ get_window_width(void *data, int argc, Scheme_Object **argv) static Scheme_Object * set_window_width(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_window *win; + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_window *win; win_T *savewin; int width = 0; @@ -2089,8 +2089,8 @@ set_window_width(void *data, int argc, Scheme_Object **argv) static Scheme_Object * get_cursor(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_window *win; + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_window *win; pos_T pos; win = get_window_arg(prim->name, 0, argc, argv); @@ -2105,8 +2105,8 @@ get_cursor(void *data, int argc, Scheme_Object **argv) static Scheme_Object * set_cursor(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_window *win; + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_window *win; long lnum = 0; long col = 0; @@ -2136,7 +2136,7 @@ set_cursor(void *data, int argc, Scheme_Object **argv) } /* *=========================================================================== - * 6. Vim Buffer-related Manipulation Functions + * 6. MNV Buffer-related Manipulation Functions *=========================================================================== */ @@ -2146,7 +2146,7 @@ set_cursor(void *data, int argc, Scheme_Object **argv) static Scheme_Object * mzscheme_open_buffer(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; + MNV_Prim *prim = (MNV_Prim *)data; int num = 0; Scheme_Object *onum = NULL; Scheme_Object *buf = NULL; @@ -2166,7 +2166,7 @@ mzscheme_open_buffer(void *data, int argc, Scheme_Object **argv) num = buflist_add(BYTE_STRING_VALUE(fname), BLN_LISTED | BLN_CURBUF); if (num == 0) - raise_vim_exn(_("couldn't open buffer")); + raise_mnv_exn(_("couldn't open buffer")); onum = scheme_make_integer(num); buf = get_buffer_by_num(data, 1, &onum); @@ -2180,7 +2180,7 @@ mzscheme_open_buffer(void *data, int argc, Scheme_Object **argv) static Scheme_Object * get_buffer_by_num(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; + MNV_Prim *prim = (MNV_Prim *)data; buf_T *buf; int fnum; @@ -2199,7 +2199,7 @@ get_buffer_by_num(void *data, int argc, Scheme_Object **argv) static Scheme_Object * get_buffer_by_name(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; + MNV_Prim *prim = (MNV_Prim *)data; buf_T *buf; Scheme_Object *buffer = NULL; Scheme_Object *fname = NULL; @@ -2237,7 +2237,7 @@ get_buffer_by_name(void *data, int argc, Scheme_Object **argv) static Scheme_Object * get_next_buffer(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; + MNV_Prim *prim = (MNV_Prim *)data; buf_T *buf = get_buffer_arg(prim->name, 0, argc, argv)->buf; if (buf->b_next == NULL) @@ -2252,7 +2252,7 @@ get_next_buffer(void *data, int argc, Scheme_Object **argv) static Scheme_Object * get_prev_buffer(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; + MNV_Prim *prim = (MNV_Prim *)data; buf_T *buf = get_buffer_arg(prim->name, 0, argc, argv)->buf; if (buf->b_prev == NULL) @@ -2267,8 +2267,8 @@ get_prev_buffer(void *data, int argc, Scheme_Object **argv) static Scheme_Object * get_buffer_num(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_buffer *buf = get_buffer_arg(prim->name, 0, argc, argv); + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_buffer *buf = get_buffer_arg(prim->name, 0, argc, argv); return scheme_make_integer(buf->buf->b_fnum); } @@ -2295,8 +2295,8 @@ get_buffer_count( static Scheme_Object * get_buffer_name(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_buffer *buf = get_buffer_arg(prim->name, 0, argc, argv); + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_buffer *buf = get_buffer_arg(prim->name, 0, argc, argv); return scheme_make_byte_string((char *)buf->buf->b_ffname); } @@ -2310,25 +2310,25 @@ get_curr_buffer( int argc UNUSED, Scheme_Object **argv UNUSED) { - return (Scheme_Object *)get_vim_curr_buffer(); + return (Scheme_Object *)get_mnv_curr_buffer(); } static Scheme_Object * buffer_new(buf_T *buf) { - vim_mz_buffer *self = NULL; + mnv_mz_buffer *self = NULL; MZ_GC_DECL_REG(1); MZ_GC_VAR_IN_REG(0, self); // We need to handle deletion of buffers underneath us. // If we add a "b_mzscheme_ref" field to the buf_T structure, - // then we can get at it in buf_freeall() in vim. + // then we can get at it in buf_freeall() in mnv. if (buf->b_mzscheme_ref) return (Scheme_Object *)BUFFER_REF(buf); MZ_GC_REG(); - self = scheme_malloc_fail_ok(scheme_malloc_tagged, sizeof(vim_mz_buffer)); + self = scheme_malloc_fail_ok(scheme_malloc_tagged, sizeof(mnv_mz_buffer)); CLEAR_POINTER(self); #ifdef MZ_PRECISE_GC buf->b_mzscheme_ref = scheme_malloc_immobile_box(NULL); @@ -2353,8 +2353,8 @@ buffer_new(buf_T *buf) static Scheme_Object * get_buffer_size(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_buffer *buf = get_buffer_arg(prim->name, 0, argc, argv); + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_buffer *buf = get_buffer_arg(prim->name, 0, argc, argv); return scheme_make_integer(buf->buf->b_ml.ml_line_count); } @@ -2363,14 +2363,14 @@ get_buffer_size(void *data, int argc, Scheme_Object **argv) * (get-buff-line {linenr} [buffer]) * * Get a line from the specified buffer. The line number is - * in Vim format (1-based). The line is returned as a MzScheme + * in MNV format (1-based). The line is returned as a MzScheme * string object. */ static Scheme_Object * get_buffer_line(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_buffer *buf; + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_buffer *buf; int linenr; char_u *line; @@ -2387,14 +2387,14 @@ get_buffer_line(void *data, int argc, Scheme_Object **argv) * (get-buff-line-list {start} {end} [buffer]) * * Get a list of lines from the specified buffer. The line numbers - * are in Vim format (1-based). The range is from lo up to, but not + * are in MNV format (1-based). The range is from lo up to, but not * including, hi. The list is returned as a list of string objects. */ static Scheme_Object * get_buffer_line_list(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_buffer *buf; + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_buffer *buf; int i, hi, lo, n; Scheme_Object *list = NULL; @@ -2438,7 +2438,7 @@ get_buffer_line_list(void *data, int argc, Scheme_Object **argv) * (set-buff-line {linenr} {string/#f} [buffer]) * * Replace a line in the specified buffer. The line number is - * in Vim format (1-based). The replacement line is given as + * in MNV format (1-based). The replacement line is given as * an MzScheme string object. The object is checked for validity * and correct format. An exception is thrown if the values are not * the correct format. @@ -2454,8 +2454,8 @@ set_buffer_line(void *data, int argc, Scheme_Object **argv) // 1. #f - this is a deletion. // 2. A string - this is a replacement. // 3. Anything else - this is an error. - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_buffer *buf; + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_buffer *buf; Scheme_Object *line = NULL; char *save; int n; @@ -2484,12 +2484,12 @@ set_buffer_line(void *data, int argc, Scheme_Object **argv) if (u_savedel((linenr_T)n, 1L) == FAIL) { curbuf = savebuf; - raise_vim_exn(_("cannot save undo information")); + raise_mnv_exn(_("cannot save undo information")); } else if (ml_delete((linenr_T)n) == FAIL) { curbuf = savebuf; - raise_vim_exn(_("cannot delete line")); + raise_mnv_exn(_("cannot delete line")); } if (buf->buf == curwin->w_buffer) mz_fix_cursor(n, n + 1, -1); @@ -2513,18 +2513,18 @@ set_buffer_line(void *data, int argc, Scheme_Object **argv) if (u_savesub((linenr_T)n) == FAIL) { curbuf = savebuf; - vim_free(save); - raise_vim_exn(_("cannot save undo information")); + mnv_free(save); + raise_mnv_exn(_("cannot save undo information")); } else if (ml_replace((linenr_T)n, (char_u *)save, TRUE) == FAIL) { curbuf = savebuf; - vim_free(save); - raise_vim_exn(_("cannot replace line")); + mnv_free(save); + raise_mnv_exn(_("cannot replace line")); } else { - vim_free(save); + mnv_free(save); changed_bytes((linenr_T)n, 0); } @@ -2545,15 +2545,15 @@ free_array(char **array) { char **curr = array; while (*curr != NULL) - vim_free(*curr++); - vim_free(array); + mnv_free(*curr++); + mnv_free(array); } /* * (set-buff-line-list {start} {end} {string-list/#f/null} [buffer]) * * Replace a range of lines in the specified buffer. The line numbers are in - * Vim format (1-based). The range is from lo up to, but not including, hi. + * MNV format (1-based). The range is from lo up to, but not including, hi. * The replacement lines are given as a Scheme list of string objects. The * list is checked for validity and correct format. * @@ -2569,8 +2569,8 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv) // 1. #f - this is a deletion. // 2. A list - this is a replacement. // 3. Anything else - this is an error. - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_buffer *buf = NULL; + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_buffer *buf = NULL; Scheme_Object *line_list = NULL; int i, old_len, new_len, hi, lo; long extra; @@ -2610,7 +2610,7 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv) if (u_savedel((linenr_T)lo, (long)old_len) == FAIL) { curbuf = savebuf; - raise_vim_exn(_("cannot save undo information")); + raise_mnv_exn(_("cannot save undo information")); } else { @@ -2618,7 +2618,7 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv) if (ml_delete((linenr_T)lo) == FAIL) { curbuf = savebuf; - raise_vim_exn(_("cannot delete line")); + raise_mnv_exn(_("cannot delete line")); } if (buf->buf == curwin->w_buffer) mz_fix_cursor(lo, hi, -old_len); @@ -2673,7 +2673,7 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv) { curbuf = savebuf; free_array(array); - raise_vim_exn(_("cannot save undo information")); + raise_mnv_exn(_("cannot save undo information")); } /* @@ -2687,7 +2687,7 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv) { curbuf = savebuf; free_array(array); - raise_vim_exn(_("cannot delete line")); + raise_mnv_exn(_("cannot delete line")); } extra--; } @@ -2702,7 +2702,7 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv) { curbuf = savebuf; free_array(array); - raise_vim_exn(_("cannot replace line")); + raise_mnv_exn(_("cannot replace line")); } /* @@ -2717,7 +2717,7 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv) { curbuf = savebuf; free_array(array); - raise_vim_exn(_("cannot insert line")); + raise_mnv_exn(_("cannot insert line")); } ++i; ++extra; @@ -2748,7 +2748,7 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv) * (insert-buff-line-list {linenr} {string/string-list} [buffer]) * * Insert a number of lines into the specified buffer after the specified line. - * The line number is in Vim format (1-based). The lines to be inserted are + * The line number is in MNV format (1-based). The lines to be inserted are * given as an MzScheme list of string objects or as a single string. The lines * to be added are checked for validity and correct format. Errors are * returned as a value of FAIL. The return value is OK on success. @@ -2758,8 +2758,8 @@ set_buffer_line_list(void *data, int argc, Scheme_Object **argv) static Scheme_Object * insert_buffer_line_list(void *data, int argc, Scheme_Object **argv) { - Vim_Prim *prim = (Vim_Prim *)data; - vim_mz_buffer *buf = NULL; + MNV_Prim *prim = (MNV_Prim *)data; + mnv_mz_buffer *buf = NULL; Scheme_Object *list = NULL; char *str = NULL; int i, n, size; @@ -2794,18 +2794,18 @@ insert_buffer_line_list(void *data, int argc, Scheme_Object **argv) if (u_save((linenr_T)n, (linenr_T)(n+1)) == FAIL) { curbuf = savebuf; - vim_free(str); - raise_vim_exn(_("cannot save undo information")); + mnv_free(str); + raise_mnv_exn(_("cannot save undo information")); } else if (ml_append((linenr_T)n, (char_u *)str, 0, FALSE) == FAIL) { curbuf = savebuf; - vim_free(str); - raise_vim_exn(_("cannot insert line")); + mnv_free(str); + raise_mnv_exn(_("cannot insert line")); } else { - vim_free(str); + mnv_free(str); appended_lines_mark((linenr_T)n, 1L); } @@ -2851,7 +2851,7 @@ insert_buffer_line_list(void *data, int argc, Scheme_Object **argv) { curbuf = savebuf; free_array(array); - raise_vim_exn(_("cannot save undo information")); + raise_mnv_exn(_("cannot save undo information")); } else { @@ -2861,7 +2861,7 @@ insert_buffer_line_list(void *data, int argc, Scheme_Object **argv) { curbuf = savebuf; free_array(array); - raise_vim_exn(_("cannot insert line")); + raise_mnv_exn(_("cannot insert line")); } if (i > 0) @@ -2885,9 +2885,9 @@ insert_buffer_line_list(void *data, int argc, Scheme_Object **argv) * (buff? obj) */ static Scheme_Object * -vim_bufferp(void *data UNUSED, int argc UNUSED, Scheme_Object **argv) +mnv_bufferp(void *data UNUSED, int argc UNUSED, Scheme_Object **argv) { - if (SCHEME_VIMBUFFERP(argv[0])) + if (SCHEME_MNVBUFFERP(argv[0])) return scheme_true; else return scheme_false; @@ -2897,9 +2897,9 @@ vim_bufferp(void *data UNUSED, int argc UNUSED, Scheme_Object **argv) * (win? obj) */ static Scheme_Object * -vim_windowp(void *data UNUSED, int argc UNUSED, Scheme_Object **argv) +mnv_windowp(void *data UNUSED, int argc UNUSED, Scheme_Object **argv) { - if (SCHEME_VIMWINDOWP(argv[0])) + if (SCHEME_MNVWINDOWP(argv[0])) return scheme_true; else return scheme_false; @@ -2909,10 +2909,10 @@ vim_windowp(void *data UNUSED, int argc UNUSED, Scheme_Object **argv) * (buff-valid? obj) */ static Scheme_Object * -vim_buffer_validp(void *data UNUSED, int argc UNUSED, Scheme_Object **argv) +mnv_buffer_validp(void *data UNUSED, int argc UNUSED, Scheme_Object **argv) { - if (SCHEME_VIMBUFFERP(argv[0]) - && ((vim_mz_buffer *)argv[0])->buf != INVALID_BUFFER_VALUE) + if (SCHEME_MNVBUFFERP(argv[0]) + && ((mnv_mz_buffer *)argv[0])->buf != INVALID_BUFFER_VALUE) return scheme_true; else return scheme_false; @@ -2922,10 +2922,10 @@ vim_buffer_validp(void *data UNUSED, int argc UNUSED, Scheme_Object **argv) * (win-valid? obj) */ static Scheme_Object * -vim_window_validp(void *data UNUSED, int argc UNUSED, Scheme_Object **argv) +mnv_window_validp(void *data UNUSED, int argc UNUSED, Scheme_Object **argv) { - if (SCHEME_VIMWINDOWP(argv[0]) - && ((vim_mz_window *)argv[0])->win != INVALID_WINDOW_VALUE) + if (SCHEME_MNVWINDOWP(argv[0]) + && ((mnv_mz_window *)argv[0])->win != INVALID_WINDOW_VALUE) return scheme_true; else return scheme_false; @@ -2938,18 +2938,18 @@ vim_window_validp(void *data UNUSED, int argc UNUSED, Scheme_Object **argv) */ /* - * Convert an MzScheme string into a Vim line. + * Convert an MzScheme string into a MNV line. * * All internal nulls are replaced by newline characters. * It is an error for the string to contain newline characters. * - * Returns pointer to Vim allocated memory + * Returns pointer to MNV allocated memory */ static char * string_to_line(Scheme_Object *obj) { char *scheme_str = NULL; - char *vim_str = NULL; + char *mnv_str = NULL; OUTPUT_LEN_TYPE len; int i; @@ -2961,30 +2961,30 @@ string_to_line(Scheme_Object *obj) if (memchr(scheme_str, '\n', len)) scheme_signal_error(_("string cannot contain newlines")); - vim_str = alloc(len + 1); + mnv_str = alloc(len + 1); // Create a copy of the string, with internal nulls replaced by - // newline characters, as is the vim convention. + // newline characters, as is the mnv convention. for (i = 0; i < len; ++i) { if (scheme_str[i] == '\0') - vim_str[i] = '\n'; + mnv_str[i] = '\n'; else - vim_str[i] = scheme_str[i]; + mnv_str[i] = scheme_str[i]; } - vim_str[i] = '\0'; + mnv_str[i] = '\0'; MZ_GC_CHECK(); - return vim_str; + return mnv_str; } #ifdef FEAT_EVAL /* - * Convert Vim value into MzScheme, adopted from if_python.c + * Convert MNV value into MzScheme, adopted from if_python.c */ static Scheme_Object * -vim_to_mzscheme(typval_T *vim_value) +mnv_to_mzscheme(typval_T *mnv_value) { Scheme_Object *result = NULL; // hash table to store visited values to avoid infinite loops @@ -2998,15 +2998,15 @@ vim_to_mzscheme(typval_T *vim_value) visited = scheme_make_hash_table(SCHEME_hash_ptr); MZ_GC_CHECK(); - result = vim_to_mzscheme_impl(vim_value, 1, visited); + result = mnv_to_mzscheme_impl(mnv_value, 1, visited); MZ_GC_UNREG(); return result; } static Scheme_Object * -vim_to_mzscheme_impl( - typval_T *vim_value, +mnv_to_mzscheme_impl( + typval_T *mnv_value, int depth, Scheme_Hash_Table *visited) { @@ -3027,28 +3027,28 @@ vim_to_mzscheme_impl( // Check if we run into a recursive loop. The item must be in visited // then and we can use it again. - result = scheme_hash_get(visited, (Scheme_Object *)vim_value); + result = scheme_hash_get(visited, (Scheme_Object *)mnv_value); MZ_GC_CHECK(); if (result != NULL) // found, do nothing new_value = FALSE; - else if (vim_value->v_type == VAR_STRING) + else if (mnv_value->v_type == VAR_STRING) { - result = scheme_make_byte_string((char *)vim_value->vval.v_string); + result = scheme_make_byte_string((char *)mnv_value->vval.v_string); MZ_GC_CHECK(); } - else if (vim_value->v_type == VAR_NUMBER) + else if (mnv_value->v_type == VAR_NUMBER) { - result = scheme_make_integer((long)vim_value->vval.v_number); + result = scheme_make_integer((long)mnv_value->vval.v_number); MZ_GC_CHECK(); } - else if (vim_value->v_type == VAR_FLOAT) + else if (mnv_value->v_type == VAR_FLOAT) { - result = scheme_make_double((double)vim_value->vval.v_float); + result = scheme_make_double((double)mnv_value->vval.v_float); MZ_GC_CHECK(); } - else if (vim_value->v_type == VAR_LIST) + else if (mnv_value->v_type == VAR_LIST) { - list_T *list = vim_value->vval.v_list; + list_T *list = mnv_value->vval.v_list; listitem_T *curr; if (list == NULL || list->lv_first == NULL) @@ -3062,21 +3062,21 @@ vim_to_mzscheme_impl( MZ_GC_REG(); curr = list->lv_u.mat.lv_last; - obj = vim_to_mzscheme_impl(&curr->li_tv, depth + 1, visited); + obj = mnv_to_mzscheme_impl(&curr->li_tv, depth + 1, visited); result = scheme_make_pair(obj, scheme_null); MZ_GC_CHECK(); while (curr != list->lv_first) { curr = curr->li_prev; - obj = vim_to_mzscheme_impl(&curr->li_tv, depth + 1, visited); + obj = mnv_to_mzscheme_impl(&curr->li_tv, depth + 1, visited); result = scheme_make_pair(obj, result); MZ_GC_CHECK(); } } MZ_GC_UNREG(); } - else if (vim_value->v_type == VAR_DICT) + else if (mnv_value->v_type == VAR_DICT) { Scheme_Object *key = NULL; Scheme_Object *obj = NULL; @@ -3088,9 +3088,9 @@ vim_to_mzscheme_impl( result = (Scheme_Object *)scheme_make_hash_table(SCHEME_hash_ptr); MZ_GC_CHECK(); - if (vim_value->vval.v_dict != NULL) + if (mnv_value->vval.v_dict != NULL) { - hashtab_T *ht = &vim_value->vval.v_dict->dv_hashtab; + hashtab_T *ht = &mnv_value->vval.v_dict->dv_hashtab; long_u todo = ht->ht_used; hashitem_T *hi; dictitem_T *di; @@ -3102,7 +3102,7 @@ vim_to_mzscheme_impl( --todo; di = dict_lookup(hi); - obj = vim_to_mzscheme_impl(&di->di_tv, depth + 1, visited); + obj = mnv_to_mzscheme_impl(&di->di_tv, depth + 1, visited); key = scheme_make_byte_string((char *)hi->hi_key); MZ_GC_CHECK(); scheme_hash_set((Scheme_Hash_Table *)result, key, obj); @@ -3112,7 +3112,7 @@ vim_to_mzscheme_impl( } MZ_GC_UNREG(); } - else if (vim_value->v_type == VAR_FUNC) + else if (mnv_value->v_type == VAR_FUNC) { Scheme_Object *funcname = NULL; @@ -3121,17 +3121,17 @@ vim_to_mzscheme_impl( MZ_GC_REG(); // FIXME: func_ref() and func_unref() are needed. - funcname = scheme_make_byte_string((char *)vim_value->vval.v_string); + funcname = scheme_make_byte_string((char *)mnv_value->vval.v_string); MZ_GC_CHECK(); - result = scheme_make_closed_prim_w_arity(vim_funcref, funcname, + result = scheme_make_closed_prim_w_arity(mnv_funcref, funcname, (const char *)BYTE_STRING_VALUE(funcname), 0, -1); MZ_GC_CHECK(); MZ_GC_UNREG(); } - else if (vim_value->v_type == VAR_PARTIAL) + else if (mnv_value->v_type == VAR_PARTIAL) { - if (vim_value->vval.v_partial == NULL) + if (mnv_value->vval.v_partial == NULL) result = scheme_null; else { @@ -3144,19 +3144,19 @@ vim_to_mzscheme_impl( // FIXME: func_ref() and func_unref() are needed. // TODO: Support pt_dict and pt_argv. funcname = scheme_make_byte_string( - (char *)partial_name(vim_value->vval.v_partial)); + (char *)partial_name(mnv_value->vval.v_partial)); MZ_GC_CHECK(); - result = scheme_make_closed_prim_w_arity(vim_funcref, funcname, + result = scheme_make_closed_prim_w_arity(mnv_funcref, funcname, (const char *)BYTE_STRING_VALUE(funcname), 0, -1); MZ_GC_CHECK(); MZ_GC_UNREG(); } } - else if (vim_value->v_type == VAR_BOOL || vim_value->v_type == VAR_SPECIAL) + else if (mnv_value->v_type == VAR_BOOL || mnv_value->v_type == VAR_SPECIAL) { - if (vim_value->vval.v_number <= VVAL_TRUE) - result = scheme_make_integer((long)vim_value->vval.v_number); + if (mnv_value->vval.v_number <= VVAL_TRUE) + result = scheme_make_integer((long)mnv_value->vval.v_number); else result = scheme_null; MZ_GC_CHECK(); @@ -3168,7 +3168,7 @@ vim_to_mzscheme_impl( } if (new_value) { - scheme_hash_set(visited, (Scheme_Object *)vim_value, result); + scheme_hash_set(visited, (Scheme_Object *)mnv_value, result); MZ_GC_CHECK(); } MZ_GC_UNREG(); @@ -3176,7 +3176,7 @@ vim_to_mzscheme_impl( } static int -mzscheme_to_vim(Scheme_Object *obj, typval_T *tv) +mzscheme_to_mnv(Scheme_Object *obj, typval_T *tv) { int i, status; Scheme_Hash_Table *visited = NULL; @@ -3189,7 +3189,7 @@ mzscheme_to_vim(Scheme_Object *obj, typval_T *tv) visited = scheme_make_hash_table(SCHEME_hash_ptr); MZ_GC_CHECK(); - status = mzscheme_to_vim_impl(obj, tv, 1, visited); + status = mzscheme_to_mnv_impl(obj, tv, 1, visited); for (i = 0; i < visited->size; ++i) { // free up remembered objects @@ -3201,7 +3201,7 @@ mzscheme_to_vim(Scheme_Object *obj, typval_T *tv) return status; } static int -mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth, +mzscheme_to_mnv_impl(Scheme_Object *obj, typval_T *tv, int depth, Scheme_Hash_Table *visited) { int status = OK; @@ -3246,7 +3246,7 @@ mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth, else if (SCHEME_BYTE_STRINGP(obj)) { tv->v_type = VAR_STRING; - tv->vval.v_string = vim_strsave(BYTE_STRING_VALUE(obj)); + tv->vval.v_string = mnv_strsave(BYTE_STRING_VALUE(obj)); } # if MZSCHEME_VERSION_MAJOR >= 299 else if (SCHEME_CHAR_STRINGP(obj)) @@ -3258,7 +3258,7 @@ mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth, tmp = scheme_char_string_to_byte_string(obj); tv->v_type = VAR_STRING; - tv->vval.v_string = vim_strsave(BYTE_STRING_VALUE(tmp)); + tv->vval.v_string = mnv_strsave(BYTE_STRING_VALUE(tmp)); MZ_GC_UNREG(); } # endif @@ -3301,7 +3301,7 @@ mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth, for (i = 0; i < SCHEME_VEC_SIZE(obj); ++i) { cval = SCHEME_VEC_ELS(obj)[i]; - status = mzscheme_to_vim_impl(cval, v, depth + 1, visited); + status = mzscheme_to_mnv_impl(cval, v, depth + 1, visited); if (status == FAIL) break; status = list_append_tv(list, v); @@ -3317,7 +3317,7 @@ mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth, curr = SCHEME_CDR(curr)) { cval = SCHEME_CAR(curr); - status = mzscheme_to_vim_impl(cval, v, depth + 1, visited); + status = mzscheme_to_mnv_impl(cval, v, depth + 1, visited); if (status == FAIL) break; status = list_append_tv(list, v); @@ -3329,7 +3329,7 @@ mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth, // need to handle the last element if (status == OK && !SCHEME_NULLP(curr)) { - status = mzscheme_to_vim_impl(cval, v, depth + 1, visited); + status = mzscheme_to_mnv_impl(cval, v, depth + 1, visited); if (status == OK) { status = list_append_tv(list, v); @@ -3338,7 +3338,7 @@ mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth, } } // nothing to do for scheme_null - vim_free(v); + mnv_free(v); } MZ_GC_UNREG(); } @@ -3376,8 +3376,8 @@ mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth, // generate item for `display'ed Scheme key dictitem_T *item = dictitem_alloc((char_u *)string_to_line( ((Scheme_Hash_Table *) obj)->keys[i])); - // convert Scheme val to Vim and add it to the dict - if (mzscheme_to_vim_impl(((Scheme_Hash_Table *) obj)->vals[i], + // convert Scheme val to MNV and add it to the dict + if (mzscheme_to_mnv_impl(((Scheme_Hash_Table *) obj)->vals[i], &item->di_tv, depth + 1, visited) == FAIL || dict_add(dict, item) == FAIL) { @@ -3402,10 +3402,10 @@ mzscheme_to_vim_impl(Scheme_Object *obj, typval_T *tv, int depth, } /* - * Scheme prim procedure wrapping Vim funcref + * Scheme prim procedure wrapping MNV funcref */ static Scheme_Object * -vim_funcref(void *name, int argc, Scheme_Object **argv) +mnv_funcref(void *name, int argc, Scheme_Object **argv) { int i; typval_T args; @@ -3432,13 +3432,13 @@ vim_funcref(void *name, int argc, Scheme_Object **argv) status = FAIL; else { - status = mzscheme_to_vim(argv[i], v); + status = mzscheme_to_mnv(argv[i], v); if (status == OK) { status = list_append_tv(list, v); clear_tv(v); } - vim_free(v); + mnv_free(v); } } if (status == OK) @@ -3446,9 +3446,9 @@ vim_funcref(void *name, int argc, Scheme_Object **argv) typval_T ret; ret.v_type = VAR_UNKNOWN; - mzscheme_call_vim(BYTE_STRING_VALUE((Scheme_Object *)name), &args, &ret); + mzscheme_call_mnv(BYTE_STRING_VALUE((Scheme_Object *)name), &args, &ret); MZ_GC_CHECK(); - result = vim_to_mzscheme(&ret); + result = mnv_to_mzscheme(&ret); clear_tv(&ret); MZ_GC_CHECK(); } @@ -3456,7 +3456,7 @@ vim_funcref(void *name, int argc, Scheme_Object **argv) clear_tv(&args); MZ_GC_UNREG(); if (status != OK) - raise_vim_exn(_("error converting Scheme values to Vim")); + raise_mnv_exn(_("error converting Scheme values to MNV")); else raise_if_error(); return result; @@ -3479,27 +3479,27 @@ do_mzeval(char_u *str, typval_T *rettv) MZ_GC_CHECK(); if (eval_with_exn_handling(str, do_eval, &ret) == OK) - mzscheme_to_vim(ret, rettv); + mzscheme_to_mnv(ret, rettv); MZ_GC_UNREG(); } #endif /* - * Check to see whether a Vim error has been reported, or a keyboard - * interrupt (from vim --> got_int) has been detected. + * Check to see whether a MNV error has been reported, or a keyboard + * interrupt (from mnv --> got_int) has been detected. */ static int -vim_error_check(void) +mnv_error_check(void) { return (got_int || did_emsg); } /* - * register Scheme exn:vim + * register Scheme exn:mnv */ static void -register_vim_exn(void) +register_mnv_exn(void) { int nc = 0; int i; @@ -3511,13 +3511,13 @@ register_vim_exn(void) MZ_GC_VAR_IN_REG(1, exn_name); MZ_GC_REG(); - exn_name = scheme_intern_symbol("exn:vim"); + exn_name = scheme_intern_symbol("exn:mnv"); MZ_GC_CHECK(); struct_exn = scheme_builtin_value("struct:exn"); MZ_GC_CHECK(); - if (vim_exn == NULL) - vim_exn = scheme_make_struct_type(exn_name, + if (mnv_exn == NULL) + mnv_exn = scheme_make_struct_type(exn_name, struct_exn, NULL, 0, 0, NULL, NULL #if MZSCHEME_VERSION_MAJOR >= 299 , NULL @@ -3538,7 +3538,7 @@ register_vim_exn(void) mch_memmove(exn_names, tmp, nc * sizeof(Scheme_Object *)); MZ_GC_CHECK(); - tmp = scheme_make_struct_values(vim_exn, exn_names, nc, 0); + tmp = scheme_make_struct_values(mnv_exn, exn_names, nc, 0); mch_memmove(exn_values, tmp, nc * sizeof(Scheme_Object *)); MZ_GC_CHECK(); @@ -3554,12 +3554,12 @@ register_vim_exn(void) } /* - * raise exn:vim, may be with additional info string + * raise exn:mnv, may be with additional info string */ void -raise_vim_exn(const char *add_info) +raise_mnv_exn(const char *add_info) { - char *fmt = _("Vim error: ~a"); + char *fmt = _("MNV error: ~a"); Scheme_Object *argv[2] = {NULL, NULL}; Scheme_Object *exn = NULL; Scheme_Object *byte_string = NULL; @@ -3592,7 +3592,7 @@ raise_vim_exn(const char *add_info) } else { - byte_string = scheme_make_byte_string(_("Vim error")); + byte_string = scheme_make_byte_string(_("MNV error")); MZ_GC_CHECK(); argv[0] = scheme_byte_string_to_char_string(byte_string); MZ_GC_CHECK(); @@ -3607,7 +3607,7 @@ raise_vim_exn(const char *add_info) MZ_GC_CHECK(); #endif - exn = scheme_make_struct_instance(vim_exn, 2, argv); + exn = scheme_make_struct_instance(mnv_exn, 2, argv); MZ_GC_CHECK(); scheme_raise(exn); MZ_GC_UNREG(); @@ -3616,8 +3616,8 @@ raise_vim_exn(const char *add_info) void raise_if_error(void) { - if (vim_error_check()) - raise_vim_exn(NULL); + if (mnv_error_check()) + raise_mnv_exn(NULL); } /* @@ -3625,16 +3625,16 @@ raise_if_error(void) * either current * or passed as argv[argnum] with checks */ - static vim_mz_buffer * + static mnv_mz_buffer * get_buffer_arg(const char *fname, int argnum, int argc, Scheme_Object **argv) { - vim_mz_buffer *b; + mnv_mz_buffer *b; if (argc < argnum + 1) - return get_vim_curr_buffer(); - if (!SCHEME_VIMBUFFERP(argv[argnum])) - scheme_wrong_type(fname, "vim-buffer", argnum, argc, argv); - b = (vim_mz_buffer *)argv[argnum]; + return get_mnv_curr_buffer(); + if (!SCHEME_MNVBUFFERP(argv[argnum])) + scheme_wrong_type(fname, "mnv-buffer", argnum, argc, argv); + b = (mnv_mz_buffer *)argv[argnum]; (void)get_valid_buffer(argv[argnum]); return b; } @@ -3644,26 +3644,26 @@ get_buffer_arg(const char *fname, int argnum, int argc, Scheme_Object **argv) * either current * or passed as argv[argnum] with checks */ - static vim_mz_window * + static mnv_mz_window * get_window_arg(const char *fname, int argnum, int argc, Scheme_Object **argv) { - vim_mz_window *w; + mnv_mz_window *w; if (argc < argnum + 1) - return get_vim_curr_window(); - w = (vim_mz_window *)argv[argnum]; - if (!SCHEME_VIMWINDOWP(argv[argnum])) - scheme_wrong_type(fname, "vim-window", argnum, argc, argv); + return get_mnv_curr_window(); + w = (mnv_mz_window *)argv[argnum]; + if (!SCHEME_MNVWINDOWP(argv[argnum])) + scheme_wrong_type(fname, "mnv-window", argnum, argc, argv); (void)get_valid_window(argv[argnum]); return w; } /* - * get valid Vim buffer from Scheme_Object* + * get valid MNV buffer from Scheme_Object* */ buf_T *get_valid_buffer(void *obj) { - buf_T *buf = ((vim_mz_buffer *)obj)->buf; + buf_T *buf = ((mnv_mz_buffer *)obj)->buf; if (buf == INVALID_BUFFER_VALUE) scheme_signal_error(_("buffer is invalid")); @@ -3671,11 +3671,11 @@ buf_T *get_valid_buffer(void *obj) } /* - * get valid Vim window from Scheme_Object* + * get valid MNV window from Scheme_Object* */ win_T *get_valid_window(void *obj) { - win_T *win = ((vim_mz_window *)obj)->win; + win_T *win = ((mnv_mz_window *)obj)->win; if (win == INVALID_WINDOW_VALUE) scheme_signal_error(_("window is invalid")); return win; @@ -3702,7 +3702,7 @@ check_line_range(linenr_T lnum, buf_T *buf) /* * Check if deleting lines made the cursor position invalid - * (or you'll get msg from Vim about invalid linenr). + * (or you'll get msg from MNV about invalid linenr). * Changed the lines from "lo" to "hi" and added "extra" lines (negative if * deleted). Got from if_python.c */ @@ -3730,7 +3730,7 @@ mz_fix_cursor(int lo, int hi, int extra) invalidate_botline(); } -static Vim_Prim prims[]= +static MNV_Prim prims[]= { /* * Buffer-related commands @@ -3766,10 +3766,10 @@ static Vim_Prim prims[]= {set_cursor, "set-cursor", 1, 2}, {get_window_list, "get-win-list", 0, 1}, /* - * Vim-related commands + * MNV-related commands */ - {vim_command, "command", 1, 1}, - {vim_eval, "eval", 1, 1}, + {mnv_command, "command", 1, 1}, + {mnv_eval, "eval", 1, 1}, {get_range_start, "range-start", 0, 0}, {get_range_end, "range-end", 0, 0}, {mzscheme_beep, "beep", 0, 0}, @@ -3778,20 +3778,20 @@ static Vim_Prim prims[]= /* * small utilities */ - {vim_bufferp, "buff?", 1, 1}, - {vim_windowp, "win?", 1, 1}, - {vim_buffer_validp, "buff-valid?", 1, 1}, - {vim_window_validp, "win-valid?", 1, 1} + {mnv_bufferp, "buff?", 1, 1}, + {mnv_windowp, "win?", 1, 1}, + {mnv_buffer_validp, "buff-valid?", 1, 1}, + {mnv_window_validp, "win-valid?", 1, 1} }; /* * return MzScheme wrapper for curbuf */ - static vim_mz_buffer * -get_vim_curr_buffer(void) + static mnv_mz_buffer * +get_mnv_curr_buffer(void) { if (curbuf->b_mzscheme_ref == NULL) - return (vim_mz_buffer *)buffer_new(curbuf); + return (mnv_mz_buffer *)buffer_new(curbuf); else return BUFFER_REF(curbuf); } @@ -3799,11 +3799,11 @@ get_vim_curr_buffer(void) /* * return MzScheme wrapper for curwin */ - static vim_mz_window * -get_vim_curr_window(void) + static mnv_mz_window * +get_mnv_curr_window(void) { if (curwin->w_mzscheme_ref == NULL) - return (vim_mz_window *)window_new(curwin); + return (mnv_mz_window *)window_new(curwin); else return WINDOW_REF(curwin); } @@ -3813,23 +3813,23 @@ make_modules(void) { int i; Scheme_Env *mod = NULL; - Scheme_Object *vimext_symbol = NULL; + Scheme_Object *mnvext_symbol = NULL; Scheme_Object *closed_prim = NULL; MZ_GC_DECL_REG(3); MZ_GC_VAR_IN_REG(0, mod); - MZ_GC_VAR_IN_REG(1, vimext_symbol); + MZ_GC_VAR_IN_REG(1, mnvext_symbol); MZ_GC_VAR_IN_REG(2, closed_prim); MZ_GC_REG(); - vimext_symbol = scheme_intern_symbol("vimext"); + mnvext_symbol = scheme_intern_symbol("mnvext"); MZ_GC_CHECK(); - mod = scheme_primitive_module(vimext_symbol, environment); + mod = scheme_primitive_module(mnvext_symbol, environment); MZ_GC_CHECK(); // all prims made closed so they can access their own names for (i = 0; i < (int)ARRAY_LENGTH(prims); i++) { - Vim_Prim *prim = prims + i; + MNV_Prim *prim = prims + i; closed_prim = scheme_make_closed_prim_w_arity(prim->prim, prim, prim->name, prim->mina, prim->maxa); scheme_add_global(prim->name, closed_prim, mod); @@ -3850,11 +3850,11 @@ static Scheme_Object *M_delete = NULL; sandbox_check(void) { if (sandbox) - raise_vim_exn(_("not allowed in the Vim sandbox")); + raise_mnv_exn(_("not allowed in the MNV sandbox")); } /* - * security guards to force Vim's sandbox restrictions on MzScheme level + * security guards to force MNV's sandbox restrictions on MzScheme level */ static Scheme_Object * sandbox_file_guard(int argc UNUSED, Scheme_Object **argv) @@ -3894,7 +3894,7 @@ sandbox_file_guard(int argc UNUSED, Scheme_Object **argv) Scheme_Object *item = SCHEME_CAR(requested_access); if (scheme_eq(item, M_write) || scheme_eq(item, M_read) || scheme_eq(item, M_execute) || scheme_eq(item, M_delete)) - raise_vim_exn(_("not allowed in the Vim sandbox")); + raise_mnv_exn(_("not allowed in the MNV sandbox")); requested_access = SCHEME_CDR(requested_access); } diff --git a/uvim/src/if_mzsch.h b/uvim/src/if_mzsch.h index ffbc490f0b..6de92d87c0 100644 --- a/uvim/src/if_mzsch.h +++ b/uvim/src/if_mzsch.h @@ -1,6 +1,6 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * MzScheme interface for Vim, wrapper around scheme.h + * MzScheme interface for MNV, wrapper around scheme.h */ #ifndef _IF_MZSCH_H_ #define _IF_MZSCH_H_ diff --git a/uvim/src/if_ole.cpp b/uvim/src/if_ole.cpp index d191010cd0..8653073936 100644 --- a/uvim/src/if_ole.cpp +++ b/uvim/src/if_ole.cpp @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ #if defined(FEAT_OLE) && defined(FEAT_GUI_MSWIN) @@ -13,7 +13,7 @@ * See os_mswin.c for the client side. */ extern "C" { -# include "vim.h" +# include "mnv.h" } #include @@ -21,7 +21,7 @@ extern "C" { extern "C" { extern HWND s_hwnd; -extern HWND vim_parent_hwnd; +extern HWND mnv_parent_hwnd; } #if (defined(_MSC_VER) && (_MSC_VER >= 1700)) || (__cplusplus >= 201103L) @@ -43,8 +43,8 @@ WINOLEAUTAPI UnRegisterTypeLib(REFGUID libID, WORD wVerMajor, 1. Internal definitions for this file *****************************************************************************/ -class CVim; -class CVimCF; +class CMNV; +class CMNVCF; /* Internal data */ // The identifier of the registered class factory @@ -54,23 +54,23 @@ static unsigned long cf_id = 0; static unsigned long app_id = 0; // The single global instance of the class factory -static CVimCF *cf = 0; +static CMNVCF *cf = 0; // The single global instance of the application object -static CVim *app = 0; +static CMNV *app = 0; /* GUIDs, versions and type library information */ -#define MYCLSID CLSID_Vim -#define MYLIBID LIBID_Vim -#define MYIID IID_IVim +#define MYCLSID CLSID_MNV +#define MYLIBID LIBID_MNV +#define MYIID IID_IMNV #define MAJORVER 1 #define MINORVER 0 #define LOCALE 0x0409 -#define MYNAME "Vim" -#define MYPROGID "Vim.Application.1" -#define MYVIPROGID "Vim.Application" +#define MYNAME "MNV" +#define MYPROGID "MNV.Application.1" +#define MYVIPROGID "MNV.Application" #define MAX_CLSID_LEN 100 @@ -82,11 +82,11 @@ static CVim *app = 0; * ---------- */ -class CVim FINAL : public IVim +class CMNV FINAL : public IMNV { public: - virtual ~CVim(); - static CVim *Create(int *pbDoRestart); + virtual ~CMNV(); + static CMNV *Create(int *pbDoRestart); // IUnknown members STDMETHOD(QueryInterface)(REFIID riid, void ** ppv); @@ -99,15 +99,15 @@ public: STDMETHOD(GetIDsOfNames)(const IID &iid, OLECHAR **names, UINT n, LCID, DISPID *dispids); STDMETHOD(Invoke)(DISPID member, const IID &iid, LCID, WORD flags, DISPPARAMS *dispparams, VARIANT *result, EXCEPINFO *excepinfo, UINT *argerr); - // IVim members + // IMNV members STDMETHOD(SendKeys)(BSTR keys); STDMETHOD(Eval)(BSTR expr, BSTR *result); STDMETHOD(SetForeground)(void); STDMETHOD(GetHwnd)(UINT_PTR *result); private: - // Constructor is private - create using CVim::Create() - CVim() : ref(0), typeinfo(0) {}; + // Constructor is private - create using CMNV::Create() + CMNV() : ref(0), typeinfo(0) {}; // Reference count unsigned long ref; @@ -120,20 +120,20 @@ private: * -------------- */ -CVim *CVim::Create(int *pbDoRestart) +CMNV *CMNV::Create(int *pbDoRestart) { HRESULT hr; - CVim *me = 0; + CMNV *me = 0; ITypeLib *typelib = 0; ITypeInfo *typeinfo = 0; *pbDoRestart = FALSE; // Create the object - me = new CVim(); + me = new CMNV(); if (me == NULL) { - MessageBox(0, "Cannot create application object", "Vim Initialisation", 0); + MessageBox(0, "Cannot create application object", "MNV Initialisation", 0); return NULL; } @@ -154,8 +154,8 @@ CVim *CVim::Create(int *pbDoRestart) } RegCloseKey(hKey); - if (MessageBox(0, "Cannot load registered type library.\nDo you want to register Vim now?", - "Vim Initialisation", MB_YESNO | MB_ICONQUESTION) != IDYES) + if (MessageBox(0, "Cannot load registered type library.\nDo you want to register MNV now?", + "MNV Initialisation", MB_YESNO | MB_ICONQUESTION) != IDYES) { delete me; return NULL; @@ -167,8 +167,8 @@ CVim *CVim::Create(int *pbDoRestart) hr = LoadRegTypeLib(MYLIBID, 1, 0, 0x00, &typelib); if (FAILED(hr)) { - MessageBox(0, "You must restart Vim in order for the registration to take effect.", - "Vim Initialisation", 0); + MessageBox(0, "You must restart MNV in order for the registration to take effect.", + "MNV Initialisation", 0); *pbDoRestart = TRUE; delete me; return NULL; @@ -182,7 +182,7 @@ CVim *CVim::Create(int *pbDoRestart) if (FAILED(hr)) { MessageBox(0, "Cannot get interface type information", - "Vim Initialisation", 0); + "MNV Initialisation", 0); delete me; return NULL; } @@ -192,15 +192,15 @@ CVim *CVim::Create(int *pbDoRestart) return me; } -CVim::~CVim() +CMNV::~CMNV() { - if (typeinfo && vim_parent_hwnd == NULL) + if (typeinfo && mnv_parent_hwnd == NULL) typeinfo->Release(); typeinfo = 0; } STDMETHODIMP -CVim::QueryInterface(REFIID riid, void **ppv) +CMNV::QueryInterface(REFIID riid, void **ppv) { if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IDispatch) || IsEqualIID(riid, MYIID)) { @@ -214,13 +214,13 @@ CVim::QueryInterface(REFIID riid, void **ppv) } STDMETHODIMP_(ULONG) -CVim::AddRef() +CMNV::AddRef() { return ++ref; } STDMETHODIMP_(ULONG) -CVim::Release() +CMNV::Release() { // Don't delete the object when the reference count reaches zero, as there // is only a single application object, and its lifetime is controlled by @@ -231,14 +231,14 @@ CVim::Release() } STDMETHODIMP -CVim::GetTypeInfoCount(UINT *pCount) +CMNV::GetTypeInfoCount(UINT *pCount) { *pCount = 1; return S_OK; } STDMETHODIMP -CVim::GetTypeInfo(UINT iTypeInfo, LCID, ITypeInfo **ppITypeInfo) +CMNV::GetTypeInfo(UINT iTypeInfo, LCID, ITypeInfo **ppITypeInfo) { *ppITypeInfo = 0; @@ -251,7 +251,7 @@ CVim::GetTypeInfo(UINT iTypeInfo, LCID, ITypeInfo **ppITypeInfo) } STDMETHODIMP -CVim::GetIDsOfNames( +CMNV::GetIDsOfNames( const IID &iid, OLECHAR **names, UINT n, @@ -265,7 +265,7 @@ CVim::GetIDsOfNames( } STDMETHODIMP -CVim::Invoke( +CMNV::Invoke( DISPID member, const IID &iid, LCID, @@ -285,22 +285,22 @@ CVim::Invoke( } STDMETHODIMP -CVim::GetHwnd(UINT_PTR *result) +CMNV::GetHwnd(UINT_PTR *result) { *result = (UINT_PTR)s_hwnd; return S_OK; } STDMETHODIMP -CVim::SetForeground(void) +CMNV::SetForeground(void) { - /* Make the Vim window come to the foreground */ + /* Make the MNV window come to the foreground */ gui_mch_set_foreground(); return S_OK; } STDMETHODIMP -CVim::SendKeys(BSTR keys) +CMNV::SendKeys(BSTR keys) { int len; char *buffer; @@ -318,7 +318,7 @@ CVim::SendKeys(BSTR keys) if (len == 0) { - vim_free(buffer); + mnv_free(buffer); return E_INVALIDARG; } @@ -329,7 +329,7 @@ CVim::SendKeys(BSTR keys) * so we can free the old one. */ if (ptr) - vim_free((char_u *)(buffer)); + mnv_free((char_u *)(buffer)); /* Reject strings too long to fit in the input buffer. Allow 10 bytes * space to cover for the (remote) possibility that characters may enter @@ -337,9 +337,9 @@ CVim::SendKeys(BSTR keys) * processed. If more than 10 characters enter the input buffer in that * time, the WM_OLE processing will simply fail to insert the characters. */ - if ((int)(STRLEN(str)) > (vim_free_in_input_buf() - 10)) + if ((int)(STRLEN(str)) > (mnv_free_in_input_buf() - 10)) { - vim_free(str); + mnv_free(str); return E_INVALIDARG; } @@ -348,7 +348,7 @@ CVim::SendKeys(BSTR keys) * to post it then. */ if (*str == NUL) - vim_free(str); + mnv_free(str); else PostMessage(NULL, WM_OLE, 0, (LPARAM)str); @@ -356,7 +356,7 @@ CVim::SendKeys(BSTR keys) } STDMETHODIMP -CVim::Eval(BSTR expr, BSTR *result) +CMNV::Eval(BSTR expr, BSTR *result) { #ifdef FEAT_EVAL int len; @@ -383,25 +383,25 @@ CVim::Eval(BSTR expr, BSTR *result) ++emsg_skip; str = (char *)eval_to_string((char_u *)buffer, TRUE, FALSE); --emsg_skip; - vim_free(buffer); + mnv_free(buffer); if (str == NULL) return E_FAIL; /* Convert the result to wide characters */ MultiByteToWideChar_alloc(CP_ACP, 0, str, -1, &w_buffer, &len); - vim_free(str); + mnv_free(str); if (w_buffer == NULL) return E_OUTOFMEMORY; if (len == 0) { - vim_free(w_buffer); + mnv_free(w_buffer); return E_FAIL; } /* Store the result */ *result = SysAllocString(w_buffer); - vim_free(w_buffer); + mnv_free(w_buffer); return S_OK; #else @@ -417,11 +417,11 @@ CVim::Eval(BSTR expr, BSTR *result) * ---------- */ -class CVimCF FINAL : public IClassFactory +class CMNVCF FINAL : public IClassFactory { public: - static CVimCF *Create(); - virtual ~CVimCF() {}; + static CMNVCF *Create(); + virtual ~CMNVCF() {}; STDMETHOD(QueryInterface)(REFIID riid, void ** ppv); STDMETHOD_(unsigned long, AddRef)(void); @@ -431,7 +431,7 @@ public: private: // Constructor is private - create via Create() - CVimCF() : ref(0) {}; + CMNVCF() : ref(0) {}; // Reference count unsigned long ref; @@ -441,18 +441,18 @@ private: * -------------- */ -CVimCF *CVimCF::Create() +CMNVCF *CMNVCF::Create() { - CVimCF *me = new CVimCF(); + CMNVCF *me = new CMNVCF(); if (me == NULL) - MessageBox(0, "Cannot create class factory", "Vim Initialisation", 0); + MessageBox(0, "Cannot create class factory", "MNV Initialisation", 0); return me; } STDMETHODIMP -CVimCF::QueryInterface(REFIID riid, void **ppv) +CMNVCF::QueryInterface(REFIID riid, void **ppv) { if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IClassFactory)) { @@ -466,13 +466,13 @@ CVimCF::QueryInterface(REFIID riid, void **ppv) } STDMETHODIMP_(ULONG) -CVimCF::AddRef() +CMNVCF::AddRef() { return ++ref; } STDMETHODIMP_(ULONG) -CVimCF::Release() +CMNVCF::Release() { // Don't delete the object when the reference count reaches zero, as there // is only a single application object, and its lifetime is controlled by @@ -484,14 +484,14 @@ CVimCF::Release() /*ARGSUSED*/ STDMETHODIMP -CVimCF::CreateInstance(IUnknown *punkOuter, REFIID riid, void **ppv) +CMNVCF::CreateInstance(IUnknown *punkOuter, REFIID riid, void **ppv) { return app->QueryInterface(riid, ppv); } /*ARGSUSED*/ STDMETHODIMP -CVimCF::LockServer(BOOL lock) +CMNVCF::LockServer(BOOL lock) { return S_OK; } @@ -558,7 +558,7 @@ extern "C" void RegisterMe(int silent) { if (!silent) MessageBox(0, "Cannot load type library to register", - "Vim Registration", 0); + "MNV Registration", 0); ok = FALSE; } else @@ -567,14 +567,14 @@ extern "C" void RegisterMe(int silent) { if (!silent) MessageBox(0, "Cannot register type library", - "Vim Registration", 0); + "MNV Registration", 0); ok = FALSE; } typelib->Release(); } if (ok && !silent) - MessageBox(0, "Registered successfully", "Vim", 0); + MessageBox(0, "Registered successfully", "MNV", 0); } // Remove the component from the registry @@ -616,7 +616,7 @@ extern "C" void UnregisterMe(int bNotifyUser) RecursiveDeleteKey(HKEY_CLASSES_ROOT, MYPROGID); if (bNotifyUser) - MessageBox(0, "Unregistered successfully", "Vim", 0); + MessageBox(0, "Unregistered successfully", "MNV", 0); } /****************************************************************************/ @@ -710,17 +710,17 @@ extern "C" void InitOLE(int *pbDoRestart) hr = OleInitialize(NULL); if (FAILED(hr)) { - MessageBox(0, "Cannot initialise OLE", "Vim Initialisation", 0); + MessageBox(0, "Cannot initialise OLE", "MNV Initialisation", 0); goto error0; } // Create the application object - app = CVim::Create(pbDoRestart); + app = CMNV::Create(pbDoRestart); if (app == NULL) goto error1; // Create the class factory - cf = CVimCF::Create(); + cf = CMNVCF::Create(); if (cf == NULL) goto error1; @@ -734,7 +734,7 @@ extern "C" void InitOLE(int *pbDoRestart) if (FAILED(hr)) { - MessageBox(0, "Cannot register class factory", "Vim Initialisation", 0); + MessageBox(0, "Cannot register class factory", "MNV Initialisation", 0); goto error1; } @@ -747,7 +747,7 @@ extern "C" void InitOLE(int *pbDoRestart) if (FAILED(hr)) { - MessageBox(0, "Cannot register application object", "Vim Initialisation", 0); + MessageBox(0, "Cannot register application object", "MNV Initialisation", 0); goto error1; } diff --git a/uvim/src/if_ole.h b/uvim/src/if_ole.h index 36e75f7d31..cf66291959 100644 --- a/uvim/src/if_ole.h +++ b/uvim/src/if_ole.h @@ -23,22 +23,22 @@ extern "C"{ // Forward Declarations -#ifndef __IVim_FWD_DEFINED__ -#define __IVim_FWD_DEFINED__ -typedef interface IVim IVim; -#endif // __IVim_FWD_DEFINED__ +#ifndef __IMNV_FWD_DEFINED__ +#define __IMNV_FWD_DEFINED__ +typedef interface IMNV IMNV; +#endif // __IMNV_FWD_DEFINED__ -#ifndef __Vim_FWD_DEFINED__ -#define __Vim_FWD_DEFINED__ +#ifndef __MNV_FWD_DEFINED__ +#define __MNV_FWD_DEFINED__ #ifdef __cplusplus -typedef class Vim Vim; +typedef class MNV MNV; #else -typedef struct Vim Vim; +typedef struct MNV MNV; #endif // __cplusplus -#endif // __Vim_FWD_DEFINED__ +#endif // __MNV_FWD_DEFINED__ // header files for imported files @@ -50,11 +50,11 @@ typedef struct Vim Vim; void __RPC_USER MIDL_user_free( void __RPC_FAR * ); #endif -#ifndef __IVim_INTERFACE_DEFINED__ -#define __IVim_INTERFACE_DEFINED__ +#ifndef __IMNV_INTERFACE_DEFINED__ +#define __IMNV_INTERFACE_DEFINED__ //*************************************** -// Generated header for interface: IVim +// Generated header for interface: IMNV // at Wed Jun 06 18:20:37 2001 // using MIDL 3.01.75 //************************************** @@ -62,12 +62,12 @@ typedef struct Vim Vim; -EXTERN_C const IID IID_IVim; +EXTERN_C const IID IID_IMNV; #if defined(__cplusplus) && !defined(CINTERFACE) interface DECLSPEC_UUID("0F0BFAE2-4C90-11d1-82D7-0004AC368519") - IVim : public IDispatch + IMNV : public IDispatch { public: virtual HRESULT STDMETHODCALLTYPE SendKeys( @@ -86,33 +86,33 @@ EXTERN_C const IID IID_IVim; #else // C style interface - typedef struct IVimVtbl + typedef struct IMNVVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( - IVim __RPC_FAR * This, + IMNV __RPC_FAR * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( - IVim __RPC_FAR * This); + IMNV __RPC_FAR * This); ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( - IVim __RPC_FAR * This); + IMNV __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfoCount )( - IVim __RPC_FAR * This, + IMNV __RPC_FAR * This, /* [out] */ UINT __RPC_FAR *pctinfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTypeInfo )( - IVim __RPC_FAR * This, + IMNV __RPC_FAR * This, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIDsOfNames )( - IVim __RPC_FAR * This, + IMNV __RPC_FAR * This, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, @@ -120,7 +120,7 @@ EXTERN_C const IID IID_IVim; /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); /* [local] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Invoke )( - IVim __RPC_FAR * This, + IMNV __RPC_FAR * This, /* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, @@ -131,65 +131,65 @@ EXTERN_C const IID IID_IVim; /* [out] */ UINT __RPC_FAR *puArgErr); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SendKeys )( - IVim __RPC_FAR * This, + IMNV __RPC_FAR * This, /* [in] */ BSTR keys); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Eval )( - IVim __RPC_FAR * This, + IMNV __RPC_FAR * This, /* [in] */ BSTR expr, /* [retval][out] */ BSTR __RPC_FAR *result); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetForeground )( - IVim __RPC_FAR * This); + IMNV __RPC_FAR * This); HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetHwnd )( - IVim __RPC_FAR * This, + IMNV __RPC_FAR * This, /* [retval][out] */ UINT_PTR __RPC_FAR *result); END_INTERFACE - } IVimVtbl; + } IMNVVtbl; - interface IVim + interface IMNV { - CONST_VTBL struct IVimVtbl __RPC_FAR *lpVtbl; + CONST_VTBL struct IMNVVtbl __RPC_FAR *lpVtbl; }; #ifdef COBJMACROS -#define IVim_QueryInterface(This,riid,ppvObject) \ +#define IMNV_QueryInterface(This,riid,ppvObject) \ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) -#define IVim_AddRef(This) \ +#define IMNV_AddRef(This) \ (This)->lpVtbl -> AddRef(This) -#define IVim_Release(This) \ +#define IMNV_Release(This) \ (This)->lpVtbl -> Release(This) -#define IVim_GetTypeInfoCount(This,pctinfo) \ +#define IMNV_GetTypeInfoCount(This,pctinfo) \ (This)->lpVtbl -> GetTypeInfoCount(This,pctinfo) -#define IVim_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ +#define IMNV_GetTypeInfo(This,iTInfo,lcid,ppTInfo) \ (This)->lpVtbl -> GetTypeInfo(This,iTInfo,lcid,ppTInfo) -#define IVim_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ +#define IMNV_GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) \ (This)->lpVtbl -> GetIDsOfNames(This,riid,rgszNames,cNames,lcid,rgDispId) -#define IVim_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ +#define IMNV_Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) \ (This)->lpVtbl -> Invoke(This,dispIdMember,riid,lcid,wFlags,pDispParams,pVarResult,pExcepInfo,puArgErr) -#define IVim_SendKeys(This,keys) \ +#define IMNV_SendKeys(This,keys) \ (This)->lpVtbl -> SendKeys(This,keys) -#define IVim_Eval(This,expr,result) \ +#define IMNV_Eval(This,expr,result) \ (This)->lpVtbl -> Eval(This,expr,result) -#define IVim_SetForeground(This) \ +#define IMNV_SetForeground(This) \ (This)->lpVtbl -> SetForeground(This) -#define IVim_GetHwnd(This,result) \ +#define IMNV_GetHwnd(This,result) \ (This)->lpVtbl -> GetHwnd(This,result) #endif // COBJMACROS @@ -199,48 +199,48 @@ EXTERN_C const IID IID_IVim; -HRESULT STDMETHODCALLTYPE IVim_SendKeys_Proxy( - IVim __RPC_FAR * This, +HRESULT STDMETHODCALLTYPE IMNV_SendKeys_Proxy( + IMNV __RPC_FAR * This, /* [in] */ BSTR keys); -void __RPC_STUB IVim_SendKeys_Stub( +void __RPC_STUB IMNV_SendKeys_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); -HRESULT STDMETHODCALLTYPE IVim_Eval_Proxy( - IVim __RPC_FAR * This, +HRESULT STDMETHODCALLTYPE IMNV_Eval_Proxy( + IMNV __RPC_FAR * This, /* [in] */ BSTR expr, /* [retval][out] */ BSTR __RPC_FAR *result); -void __RPC_STUB IVim_Eval_Stub( +void __RPC_STUB IMNV_Eval_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); -HRESULT STDMETHODCALLTYPE IVim_SetForeground_Proxy( - IVim __RPC_FAR * This); +HRESULT STDMETHODCALLTYPE IMNV_SetForeground_Proxy( + IMNV __RPC_FAR * This); -void __RPC_STUB IVim_SetForeground_Stub( +void __RPC_STUB IMNV_SetForeground_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); -HRESULT STDMETHODCALLTYPE IVim_GetHwnd_Proxy( - IVim __RPC_FAR * This, +HRESULT STDMETHODCALLTYPE IMNV_GetHwnd_Proxy( + IMNV __RPC_FAR * This, /* [retval][out] */ UINT_PTR __RPC_FAR *result); -void __RPC_STUB IVim_GetHwnd_Stub( +void __RPC_STUB IMNV_GetHwnd_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, @@ -248,15 +248,15 @@ void __RPC_STUB IVim_GetHwnd_Stub( -#endif // __IVim_INTERFACE_DEFINED__ +#endif // __IMNV_INTERFACE_DEFINED__ -#ifndef __Vim_LIBRARY_DEFINED__ -#define __Vim_LIBRARY_DEFINED__ +#ifndef __MNV_LIBRARY_DEFINED__ +#define __MNV_LIBRARY_DEFINED__ //*************************************** -// Generated header for library: Vim +// Generated header for library: MNV // at Wed Jun 06 18:20:37 2001 // using MIDL 3.01.75 //************************************** @@ -264,15 +264,15 @@ void __RPC_STUB IVim_GetHwnd_Stub( -EXTERN_C const IID LIBID_Vim; +EXTERN_C const IID LIBID_MNV; #ifdef __cplusplus -EXTERN_C const CLSID CLSID_Vim; +EXTERN_C const CLSID CLSID_MNV; class DECLSPEC_UUID("0F0BFAE1-4C90-11d1-82D7-0004AC368519") -Vim; +MNV; #endif -#endif // __Vim_LIBRARY_DEFINED__ +#endif // __MNV_LIBRARY_DEFINED__ // Additional Prototypes for ALL interfaces diff --git a/uvim/src/if_ole.idl b/uvim/src/if_ole.idl index 3629fafcdb..60ddf7caa1 100644 --- a/uvim/src/if_ole.idl +++ b/uvim/src/if_ole.idl @@ -1,20 +1,20 @@ -// if_ole.idl - IDL source for the Vim OLE Automation interface +// if_ole.idl - IDL source for the MNV OLE Automation interface // // Processed by the IDL compiler (MIDL) to generate the type library -// (Vim.tlb). +// (MNV.tlb). // // Command line: -// MIDL /proxy nul /iid iid_ole.c /h if_ole.h /tlb vim.tlb if_ole.idl +// MIDL /proxy nul /iid iid_ole.c /h if_ole.h /tlb mnv.tlb if_ole.idl [ object, - uuid(0F0BFAE2-4C90-11d1-82D7-0004AC368519), // IID_IVim - helpstring("IVim"), + uuid(0F0BFAE2-4C90-11d1-82D7-0004AC368519), // IID_IMNV + helpstring("IMNV"), pointer_default(unique), dual, oleautomation ] -interface IVim : IDispatch +interface IMNV : IDispatch { import "oaidl.idl"; HRESULT SendKeys([in]BSTR keys); @@ -25,21 +25,21 @@ interface IVim : IDispatch // Component and type library definitions [ - uuid(0F0BFAE0-4C90-11d1-82D7-0004AC368519), // LIBID_Vim - helpstring("Vim OLE Interface 1.1 Type Library"), + uuid(0F0BFAE0-4C90-11d1-82D7-0004AC368519), // LIBID_MNV + helpstring("MNV OLE Interface 1.1 Type Library"), version(1.1) ] -library Vim +library MNV { importlib("stdole32.tlb"); // Component [ - uuid(0F0BFAE1-4C90-11d1-82D7-0004AC368519), // CLSID_Vim - helpstring("Vim OLE Interface") + uuid(0F0BFAE1-4C90-11d1-82D7-0004AC368519), // CLSID_MNV + helpstring("MNV OLE Interface") ] - coclass Vim + coclass MNV { - [default] interface IVim; + [default] interface IMNV; }; }; diff --git a/uvim/src/if_perl.xs b/uvim/src/if_perl.xs index 7d5954e5fb..ca5464a5a0 100644 --- a/uvim/src/if_perl.xs +++ b/uvim/src/if_perl.xs @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* * if_perl.xs: Main code for Perl interface support. @@ -24,7 +24,7 @@ # define _USE_32BIT_TIME_T #endif -#include "vim.h" +#include "mnv.h" #ifdef _MSC_VER // Work around for using MSVC and ActivePerl 5.18. @@ -72,7 +72,7 @@ const char PL_memory_wrap[] = "panic: memory wrap"; #endif /* - * Work around clashes between Perl and Vim namespace. proto.h doesn't + * Work around clashes between Perl and MNV namespace. proto.h doesn't * include if_perl.pro and perlsfio.pro when IN_PERL_FILE is defined, because * we need the CV typedef. proto.h can't be moved to after including * if_perl.h, because we get all sorts of name clashes then. @@ -93,7 +93,7 @@ const char PL_memory_wrap[] = "panic: memory wrap"; #endif -// Work around for ActivePerl 5.20.3+: Avoid generating (g)vim.lib. +// Work around for ActivePerl 5.20.3+: Avoid generating (g)mnv.lib. #if defined(ACTIVEPERL_VERSION) && (ACTIVEPERL_VERSION >= 2003) \ && defined(MSWIN) && defined(USE_DYNAMIC_LOADING) # undef XS_EXTERNAL @@ -145,7 +145,7 @@ const char PL_memory_wrap[] = "panic: memory wrap"; static PerlInterpreter *perl_interp = NULL; static void xs_init(pTHX); -static void VIM_init(void); +static void MNV_init(void); EXTERN_C void boot_DynaLoader(pTHX_ CV*); /* @@ -166,7 +166,7 @@ typedef int perl_key; # ifdef MSWIN # define PERL_PROC FARPROC -# define load_dll vimLoadLib +# define load_dll mnvLoadLib # define symbol_from_dll GetProcAddress # define close_dll FreeLibrary # define load_dll_error GetWin32Error @@ -674,7 +674,7 @@ static struct { /* * Make all runtime-links of perl. * - * 1. Get module handle using dlopen() or vimLoadLib(). + * 1. Get module handle using dlopen() or mnvLoadLib(). * 2. Get pointer to perl function by GetProcAddress. * 3. Repeat 2, until get all functions will be used. * @@ -721,7 +721,7 @@ perl_enabled(int verbose) #endif /* DYNAMIC_PERL */ #if defined(PERLIO_LAYERS) -static void vim_IOLayer_init(void); +static void mnv_IOLayer_init(void); #endif /* @@ -742,10 +742,10 @@ perl_init(void) perl_interp = perl_alloc(); perl_construct(perl_interp); perl_parse(perl_interp, xs_init, argc, argv, 0); - perl_call_argv("VIM::bootstrap", (long)G_DISCARD, bootargs); - VIM_init(); + perl_call_argv("MNV::bootstrap", (long)G_DISCARD, bootargs); + MNV_init(); #if defined(PERLIO_LAYERS) - vim_IOLayer_init(); + mnv_IOLayer_init(); #endif } @@ -924,11 +924,11 @@ struct ufuncs cw_funcs = { cur_val, 0, 0 }; struct ufuncs cb_funcs = { cur_val, 0, 1 }; /* - * VIM_init(): Vim-specific initialisation. + * MNV_init(): MNV-specific initialisation. * Make the magical main::curwin and main::curbuf variables */ static void -VIM_init(void) +MNV_init(void) { static char cw[] = "main::curwin"; static char cb[] = "main::curbuf"; @@ -948,7 +948,7 @@ VIM_init(void) * XXX: Only shares the 'Msg' routine (which has to be called * like 'Msg(...)'). */ - (void)perl_eval_pv( "if ( eval( 'require Safe' ) ) { $VIM::safe = Safe->new(); $VIM::safe->share_from( 'VIM', ['Msg'] ); }", G_DISCARD | G_VOID ); + (void)perl_eval_pv( "if ( eval( 'require Safe' ) ) { $MNV::safe = Safe->new(); $MNV::safe->share_from( 'MNV', ['Msg'] ); }", G_DISCARD | G_VOID ); } @@ -973,7 +973,7 @@ ex_perl(exarg_T *eap) script = (char *)script_get(eap, eap->arg); if (eap->skip) { - vim_free(script); + mnv_free(script); return; } @@ -983,7 +983,7 @@ ex_perl(exarg_T *eap) if (!perl_enabled(TRUE)) { emsg(_(e_noperl)); - vim_free(script); + mnv_free(script); return; } #endif @@ -1000,12 +1000,12 @@ ex_perl(exarg_T *eap) else { sv = newSVpv(script, 0); - vim_free(script); + mnv_free(script); } if (sandbox || secure) { - safe = perl_get_sv("VIM::safe", FALSE); + safe = perl_get_sv("MNV::safe", FALSE); # ifndef MAKE_TEST /* avoid a warning for unreachable code */ if (safe == NULL || !SvTRUE(safe)) emsg(_(e_perl_evaluation_forbidden_in_sandbox_without_safe_module)); @@ -1059,7 +1059,7 @@ replace_line(linenr_T *line, linenr_T *end) } static struct ref_map_S { - void *vim_ref; + void *mnv_ref; SV *perl_ref; struct ref_map_S *next; } *ref_map = NULL; @@ -1073,7 +1073,7 @@ ref_map_free(void) while (refs) { tofree = refs; refs = refs->next; - vim_free(tofree); + mnv_free(tofree); } ref_map = NULL; } @@ -1096,7 +1096,7 @@ ref_map_find_SV(SV *const sv) if (!refs) return NULL; refs->perl_ref = sv; - refs->vim_ref = NULL; + refs->mnv_ref = NULL; refs->next = ref_map; ref_map = refs; } @@ -1105,7 +1105,7 @@ ref_map_find_SV(SV *const sv) } static int -perl_to_vim(SV *sv, typval_T *rettv) +perl_to_mnv(SV *sv, typval_T *rettv) { if (SvROK(sv)) sv = SvRV(sv); @@ -1156,13 +1156,13 @@ perl_to_vim(SV *sv, typval_T *rettv) if ((refs = ref_map_find_SV(sv)) == NULL) return FAIL; - if (refs->vim_ref) - list = (list_T *) refs->vim_ref; + if (refs->mnv_ref) + list = (list_T *) refs->mnv_ref; else { if ((list = list_alloc()) == NULL) return FAIL; - refs->vim_ref = list; + refs->mnv_ref = list; for (size = av_len((AV*)sv); size >= 0; size--) { @@ -1177,7 +1177,7 @@ perl_to_vim(SV *sv, typval_T *rettv) item2 = av_fetch((AV *)sv, size, 0); if (item2 == NULL || *item2 == NULL || - perl_to_vim(*item2, &item->li_tv) == FAIL) + perl_to_mnv(*item2, &item->li_tv) == FAIL) break; } } @@ -1198,14 +1198,14 @@ perl_to_vim(SV *sv, typval_T *rettv) if ((refs = ref_map_find_SV(sv)) == NULL) return FAIL; - if (refs->vim_ref) - dict = (dict_T *) refs->vim_ref; + if (refs->mnv_ref) + dict = (dict_T *) refs->mnv_ref; else { if ((dict = dict_alloc()) == NULL) return FAIL; - refs->vim_ref = dict; + refs->mnv_ref = dict; hv_iterinit((HV *)sv); @@ -1229,7 +1229,7 @@ perl_to_vim(SV *sv, typval_T *rettv) break; } item2 = hv_iterval((HV *)sv, entry); - if (item2 == NULL || perl_to_vim(item2, &item->di_tv) == FAIL) + if (item2 == NULL || perl_to_mnv(item2, &item->di_tv) == FAIL) break; } } @@ -1241,7 +1241,7 @@ perl_to_vim(SV *sv, typval_T *rettv) { char *val = SvPV_nolen(sv); rettv->v_type = VAR_STRING; - rettv->vval.v_string = val ? vim_strsave((char_u *)val) : NULL; + rettv->vval.v_string = val ? mnv_strsave((char_u *)val) : NULL; break; } } @@ -1280,7 +1280,7 @@ do_perleval(char_u *str, typval_T *rettv) if (sandbox || secure) { - safe = get_sv("VIM::safe", FALSE); + safe = get_sv("MNV::safe", FALSE); # ifndef MAKE_TEST /* avoid a warning for unreachable code */ if (safe == NULL || !SvTRUE(safe)) emsg(_(e_perl_evaluation_forbidden_in_sandbox_without_safe_module)); @@ -1303,7 +1303,7 @@ do_perleval(char_u *str, typval_T *rettv) sv = eval_pv((char *)str, 0); if (sv) { - perl_to_vim(sv, rettv); + perl_to_mnv(sv, rettv); ref_map_free(); err = SvPV(GvSV(PL_errgv), err_len); } @@ -1343,8 +1343,8 @@ ex_perldo(exarg_T *eap) { dSP; length = strlen((char *)eap->arg); - sv = newSV(length + sizeof("sub VIM::perldo {") - 1 + 1); - sv_setpvn(sv, "sub VIM::perldo {", sizeof("sub VIM::perldo {") - 1); + sv = newSV(length + sizeof("sub MNV::perldo {") - 1 + 1); + sv_setpvn(sv, "sub MNV::perldo {", sizeof("sub MNV::perldo {") - 1); sv_catpvn(sv, (char *)eap->arg, length); sv_catpvn(sv, "}", 1); perl_eval_sv(sv, G_DISCARD | G_NOARGS); @@ -1365,7 +1365,7 @@ ex_perldo(exarg_T *eap) break; sv_setpv(GvSV(PL_defgv), (char *)ml_get(i)); PUSHMARK(sp); - perl_call_pv("VIM::perldo", G_SCALAR | G_EVAL); + perl_call_pv("MNV::perldo", G_SCALAR | G_EVAL); str = SvPV(GvSV(PL_errgv), length); if (length || curbuf != was_curbuf || i > curbuf->b_ml.ml_line_count) break; @@ -1397,13 +1397,13 @@ err: typedef struct { struct _PerlIO base; int attr; -} PerlIOVim; +} PerlIOMNV; static IV -PerlIOVim_pushed(pTHX_ PerlIO *f, const char *mode, +PerlIOMNV_pushed(pTHX_ PerlIO *f, const char *mode, SV *arg, PerlIO_funcs *tab) { - PerlIOVim *s = PerlIOSelf(f, PerlIOVim); + PerlIOMNV *s = PerlIOSelf(f, PerlIOMNV); s->attr = 0; if (arg && SvPOK(arg)) s->attr = syn_name2attr((char_u *)SvPV_nolen(arg)); @@ -1411,26 +1411,26 @@ PerlIOVim_pushed(pTHX_ PerlIO *f, const char *mode, } static SSize_t -PerlIOVim_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count) +PerlIOMNV_write(pTHX_ PerlIO *f, const void *vbuf, Size_t count) { char_u *str; - PerlIOVim * s = PerlIOSelf(f, PerlIOVim); + PerlIOMNV * s = PerlIOSelf(f, PerlIOMNV); - str = vim_strnsave((char_u *)vbuf, count); + str = mnv_strnsave((char_u *)vbuf, count); if (str == NULL) return 0; msg_split((char_u *)str, s->attr); - vim_free(str); + mnv_free(str); return (SSize_t)count; } -static PERLIO_FUNCS_DECL(PerlIO_Vim) = { +static PERLIO_FUNCS_DECL(PerlIO_MNV) = { sizeof(PerlIO_funcs), - "Vim", - sizeof(PerlIOVim), + "MNV", + sizeof(PerlIOMNV), PERLIO_K_DUMMY, /* flags */ - PerlIOVim_pushed, + PerlIOMNV_pushed, NULL, /* popped */ NULL, /* open */ NULL, /* binmode */ @@ -1439,7 +1439,7 @@ static PERLIO_FUNCS_DECL(PerlIO_Vim) = { NULL, /* dup */ NULL, /* read */ NULL, /* unread */ - PerlIOVim_write, + PerlIOMNV_write, NULL, /* seek */ NULL, /* tell */ NULL, /* close */ @@ -1456,13 +1456,13 @@ static PERLIO_FUNCS_DECL(PerlIO_Vim) = { NULL /* set_ptrcnt */ }; -/* Use Vim routine for print operator */ +/* Use MNV routine for print operator */ static void -vim_IOLayer_init(void) +mnv_IOLayer_init(void) { - PerlIO_define_layer(aTHX_ PERLIO_FUNCS_CAST(&PerlIO_Vim)); - (void)eval_pv( "binmode(STDOUT, ':Vim')" - " && binmode(STDERR, ':Vim(ErrorMsg)');", 0); + PerlIO_define_layer(aTHX_ PERLIO_FUNCS_CAST(&PerlIO_MNV)); + (void)eval_pv( "binmode(STDOUT, ':MNV')" + " && binmode(STDERR, ':MNV(ErrorMsg)');", 0); } #endif /* PERLIO_LAYERS */ @@ -1533,7 +1533,7 @@ IV Perl_sv_2iv_flags(pTHX_ SV *const sv, const I32 flags) #endif // DYNAMIC_PERL -XS(boot_VIM); +XS(boot_MNV); static void xs_init(pTHX) @@ -1542,13 +1542,13 @@ xs_init(pTHX) /* DynaLoader is a special case */ newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); - newXS("VIM::bootstrap", boot_VIM, file); + newXS("MNV::bootstrap", boot_MNV, file); } typedef win_T * VIWIN; typedef buf_T * VIBUF; -MODULE = VIM PACKAGE = VIM +MODULE = MNV PACKAGE = MNV void Msg(text, hl=NULL) @@ -1601,7 +1601,7 @@ Eval(str) { XPUSHs(sv_2mortal(newSViv(1))); XPUSHs(sv_2mortal(newSVpv((char *)value, 0))); - vim_free(value); + mnv_free(value); } SV* @@ -1629,7 +1629,7 @@ void Buffers(...) PREINIT: - buf_T *vimbuf; + buf_T *mnvbuf; int i, b; PPCODE: @@ -1638,15 +1638,15 @@ Buffers(...) if (GIMME_V == G_SCALAR) { i = 0; - FOR_ALL_BUFFERS(vimbuf) + FOR_ALL_BUFFERS(mnvbuf) ++i; XPUSHs(sv_2mortal(newSViv(i))); } else { - FOR_ALL_BUFFERS(vimbuf) - XPUSHs(sv_2mortal(newBUFrv(newSV(0), vimbuf))); + FOR_ALL_BUFFERS(mnvbuf) + XPUSHs(sv_2mortal(newBUFrv(newSV(0), mnvbuf))); } } else @@ -1669,9 +1669,9 @@ Buffers(...) if (b >= 0) { - vimbuf = buflist_findnr(b); - if (vimbuf) - XPUSHs(sv_2mortal(newBUFrv(newSV(0), vimbuf))); + mnvbuf = buflist_findnr(b); + if (mnvbuf) + XPUSHs(sv_2mortal(newBUFrv(newSV(0), mnvbuf))); } } } @@ -1680,7 +1680,7 @@ void Windows(...) PREINIT: - win_T *vimwin; + win_T *mnvwin; int i, w; PPCODE: @@ -1690,8 +1690,8 @@ Windows(...) XPUSHs(sv_2mortal(newSViv(win_count()))); else { - FOR_ALL_WINDOWS(vimwin) - XPUSHs(sv_2mortal(newWINrv(newSV(0), vimwin))); + FOR_ALL_WINDOWS(mnvwin) + XPUSHs(sv_2mortal(newWINrv(newSV(0), mnvwin))); } } else @@ -1699,13 +1699,13 @@ Windows(...) for (i = 0; i < items; i++) { w = (int) SvIV(ST(i)); - vimwin = win_find_nr(w); - if (vimwin) - XPUSHs(sv_2mortal(newWINrv(newSV(0), vimwin))); + mnvwin = win_find_nr(w); + if (mnvwin) + XPUSHs(sv_2mortal(newWINrv(newSV(0), mnvwin))); } } -MODULE = VIM PACKAGE = VIWIN +MODULE = MNV PACKAGE = VIWIN void DESTROY(win) @@ -1770,94 +1770,94 @@ Cursor(win, ...) update_screen(UPD_NOT_VALID); } -MODULE = VIM PACKAGE = VIBUF +MODULE = MNV PACKAGE = VIBUF void -DESTROY(vimbuf) - VIBUF vimbuf; +DESTROY(mnvbuf) + VIBUF mnvbuf; CODE: - if (buf_valid(vimbuf)) - vimbuf->b_perl_private = 0; + if (buf_valid(mnvbuf)) + mnvbuf->b_perl_private = 0; void -Name(vimbuf) - VIBUF vimbuf; +Name(mnvbuf) + VIBUF mnvbuf; PPCODE: - if (!buf_valid(vimbuf)) - vimbuf = curbuf; + if (!buf_valid(mnvbuf)) + mnvbuf = curbuf; /* No file name returns an empty string */ - if (vimbuf->b_fname == NULL) + if (mnvbuf->b_fname == NULL) XPUSHs(sv_2mortal(newSVpv("", 0))); else - XPUSHs(sv_2mortal(newSVpv((char *)vimbuf->b_fname, 0))); + XPUSHs(sv_2mortal(newSVpv((char *)mnvbuf->b_fname, 0))); void -Number(vimbuf) - VIBUF vimbuf; +Number(mnvbuf) + VIBUF mnvbuf; PPCODE: - if (!buf_valid(vimbuf)) - vimbuf = curbuf; - XPUSHs(sv_2mortal(newSViv(vimbuf->b_fnum))); + if (!buf_valid(mnvbuf)) + mnvbuf = curbuf; + XPUSHs(sv_2mortal(newSViv(mnvbuf->b_fnum))); void -Count(vimbuf) - VIBUF vimbuf; +Count(mnvbuf) + VIBUF mnvbuf; PPCODE: - if (!buf_valid(vimbuf)) - vimbuf = curbuf; - XPUSHs(sv_2mortal(newSViv(vimbuf->b_ml.ml_line_count))); + if (!buf_valid(mnvbuf)) + mnvbuf = curbuf; + XPUSHs(sv_2mortal(newSViv(mnvbuf->b_ml.ml_line_count))); void -Get(vimbuf, ...) - VIBUF vimbuf; +Get(mnvbuf, ...) + VIBUF mnvbuf; PREINIT: char_u *line; int i; long lnum; PPCODE: - if (buf_valid(vimbuf)) + if (buf_valid(mnvbuf)) { for (i = 1; i < items; i++) { lnum = (long) SvIV(ST(i)); - if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count) + if (lnum > 0 && lnum <= mnvbuf->b_ml.ml_line_count) { - line = ml_get_buf(vimbuf, lnum, FALSE); + line = ml_get_buf(mnvbuf, lnum, FALSE); XPUSHs(sv_2mortal(newSVpv((char *)line, 0))); } } } void -Set(vimbuf, ...) - VIBUF vimbuf; +Set(mnvbuf, ...) + VIBUF mnvbuf; PREINIT: int i; long lnum; char *line; PPCODE: - if (buf_valid(vimbuf)) + if (buf_valid(mnvbuf)) { if (items < 3) - croak("Usage: VIBUF::Set(vimbuf, lnum, @lines)"); + croak("Usage: VIBUF::Set(mnvbuf, lnum, @lines)"); lnum = (long) SvIV(ST(1)); for(i = 2; i < items; i++, lnum++) { line = SvPV(ST(i),PL_na); - if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL) + if (lnum > 0 && lnum <= mnvbuf->b_ml.ml_line_count && line != NULL) { aco_save_T aco; - /* Set curwin/curbuf for "vimbuf" and save some things. */ - aucmd_prepbuf(&aco, vimbuf); - if (curbuf == vimbuf) + /* Set curwin/curbuf for "mnvbuf" and save some things. */ + aucmd_prepbuf(&aco, mnvbuf); + if (curbuf == mnvbuf) { /* Only when a window was found. */ if (u_savesub(lnum) == OK) @@ -1868,20 +1868,20 @@ Set(vimbuf, ...) /* restore curwin/curbuf and a few other things */ aucmd_restbuf(&aco); - /* Careful: autocommands may have made "vimbuf" invalid! */ + /* Careful: autocommands may have made "mnvbuf" invalid! */ } } } } void -Delete(vimbuf, ...) - VIBUF vimbuf; +Delete(mnvbuf, ...) + VIBUF mnvbuf; PREINIT: long i, lnum = 0, count = 0; PPCODE: - if (buf_valid(vimbuf)) + if (buf_valid(mnvbuf)) { if (items == 2) { @@ -1904,13 +1904,13 @@ Delete(vimbuf, ...) { for (i = 0; i < count; i++) { - if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count) + if (lnum > 0 && lnum <= mnvbuf->b_ml.ml_line_count) { aco_save_T aco; - /* set curwin/curbuf for "vimbuf" and save some things */ - aucmd_prepbuf(&aco, vimbuf); - if (curbuf == vimbuf) + /* set curwin/curbuf for "mnvbuf" and save some things */ + aucmd_prepbuf(&aco, mnvbuf); + if (curbuf == mnvbuf) { /* Only when a window was found. */ if (u_savedel(lnum, 1) == OK) @@ -1922,7 +1922,7 @@ Delete(vimbuf, ...) /* restore curwin/curbuf and a few other things */ aucmd_restbuf(&aco); - /* Careful: autocommands may have made "vimbuf" + /* Careful: autocommands may have made "mnvbuf" * invalid! */ } @@ -1933,32 +1933,32 @@ Delete(vimbuf, ...) } void -Append(vimbuf, ...) - VIBUF vimbuf; +Append(mnvbuf, ...) + VIBUF mnvbuf; PREINIT: int i; long lnum; char *line; PPCODE: - if (buf_valid(vimbuf)) + if (buf_valid(mnvbuf)) { if (items < 3) - croak("Usage: VIBUF::Append(vimbuf, lnum, @lines)"); + croak("Usage: VIBUF::Append(mnvbuf, lnum, @lines)"); lnum = (long) SvIV(ST(1)); for (i = 2; i < items; i++, lnum++) { line = SvPV(ST(i),PL_na); - if (lnum >= 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL) + if (lnum >= 0 && lnum <= mnvbuf->b_ml.ml_line_count && line != NULL) { aco_save_T aco; - /* set curwin/curbuf for "vimbuf" and save some things */ - aucmd_prepbuf(&aco, vimbuf); - if (curbuf == vimbuf) + /* set curwin/curbuf for "mnvbuf" and save some things */ + aucmd_prepbuf(&aco, mnvbuf); + if (curbuf == mnvbuf) { - /* Only when a window for "vimbuf" was found. */ + /* Only when a window for "mnvbuf" was found. */ if (u_inssub(lnum + 1) == OK) { ml_append(lnum, (char_u *)line, (colnr_T)0, FALSE); @@ -1967,7 +1967,7 @@ Append(vimbuf, ...) /* restore curwin/curbuf and a few other things */ aucmd_restbuf(&aco); - /* Careful: autocommands may have made "vimbuf" invalid! */ + /* Careful: autocommands may have made "mnvbuf" invalid! */ } update_curbuf(UPD_VALID); diff --git a/uvim/src/if_py_both.h b/uvim/src/if_py_both.h index ed37fb0251..c6ce0c1f31 100644 --- a/uvim/src/if_py_both.h +++ b/uvim/src/if_py_both.h @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * Python extensions by Paul Moore, David Leonard, Roland Puntaier, Nikolay @@ -17,18 +17,18 @@ typedef int Py_ssize_t; // Python 2.4 and earlier don't have this type. #endif -// Use values that are known to work, others may make Vim crash. +// Use values that are known to work, others may make MNV crash. #define ENC_OPT (enc_utf8 ? "utf-8" : enc_dbcs ? "euc-jp" : (char *)p_enc) -#define DOPY_FUNC "_vim_pydo" +#define DOPY_FUNC "_mnv_pydo" -static const char *vim_special_path = "_vim_path_"; +static const char *mnv_special_path = "_mnv_path_"; #define PyErr_SET_STRING(exc, str) PyErr_SetString(exc, _(str)) -#define PyErr_SetVim(str) PyErr_SetString(VimError, str) -#define PyErr_SET_VIM(str) PyErr_SET_STRING(VimError, str) +#define PyErr_SetMNV(str) PyErr_SetString(MNVError, str) +#define PyErr_SET_MNV(str) PyErr_SET_STRING(MNVError, str) #define PyErr_FORMAT(exc, str, arg) PyErr_Format(exc, _(str), arg) #define PyErr_FORMAT2(exc, str, arg1, arg2) PyErr_Format(exc, _(str), arg1,arg2) -#define PyErr_VIM_FORMAT(str, arg) PyErr_FORMAT(VimError, str, arg) +#define PyErr_MNV_FORMAT(str, arg) PyErr_FORMAT(MNVError, str, arg) #ifdef USE_LIMITED_API // Limited Python API. Need to call only exposed functions and remap macros. @@ -105,7 +105,7 @@ struct typeobject_wrapper { # define Py_TYPE_GET_TP_METHODS(type) ((PyMethodDef *)PyType_GetSlot(type, Py_tp_methods)) // PyObject_NEW is not part of stable ABI, but PyObject_Malloc/Init are. -static PyObject* Vim_PyObject_New(PyTypeObject *type, size_t objsize) +static PyObject* MNV_PyObject_New(PyTypeObject *type, size_t objsize) { PyObject *obj = (PyObject *)PyObject_Malloc(objsize); if (obj == NULL) @@ -113,7 +113,7 @@ static PyObject* Vim_PyObject_New(PyTypeObject *type, size_t objsize) return PyObject_Init(obj, type); } # undef PyObject_NEW -# define PyObject_NEW(type, typeobj) ((type *)Vim_PyObject_New(typeobj, sizeof(type))) +# define PyObject_NEW(type, typeobj) ((type *)MNV_PyObject_New(typeobj, sizeof(type))) // This is a somewhat convoluted because limited API doesn't expose an easy way // to get the tp_name field, and so we have to manually reconstruct it as @@ -244,7 +244,7 @@ static PyTypeObject* AddHeapType(struct typeobject_wrapper* type_object) // are cleared, leading to a crash, whereas in 3.8 the semantics were changed // and instances hold strong references to types. Since these types are // designed to be static, just keep them around to avoid having to write -// version-specific handling. Vim does not re-start the Python runtime so there +// version-specific handling. MNV does not re-start the Python runtime so there // will be no long-term leak. # define PYTYPE_READY(type) \ type##Ptr = AddHeapType(&(type)); \ @@ -255,7 +255,7 @@ static PyTypeObject* AddHeapType(struct typeobject_wrapper* type_object) // Limited API does not provide PyRun_* functions. Need to implement manually // using PyCompile and PyEval. -static PyObject* Vim_PyRun_String(const char *str, int start, PyObject *globals, PyObject *locals) +static PyObject* MNV_PyRun_String(const char *str, int start, PyObject *globals, PyObject *locals) { // Just pass "" for filename for now. PyObject* compiled = Py_CompileString(str, "", start); @@ -266,14 +266,14 @@ static PyObject* Vim_PyRun_String(const char *str, int start, PyObject *globals, Py_DECREF(compiled); return eval_result; } -static int Vim_PyRun_SimpleString(const char *str) +static int MNV_PyRun_SimpleString(const char *str) { // This function emulates CPython's implementation. PyObject* m = PyImport_AddModule("__main__"); if (m == NULL) return -1; PyObject* d = PyModule_GetDict(m); - PyObject* output = Vim_PyRun_String(str, Py_file_input, d, d); + PyObject* output = MNV_PyRun_String(str, Py_file_input, d, d); if (output == NULL) { PyErr_PrintEx(TRUE); @@ -282,8 +282,8 @@ static int Vim_PyRun_SimpleString(const char *str) Py_DECREF(output); return 0; } -# define PyRun_String Vim_PyRun_String -# define PyRun_SimpleString Vim_PyRun_SimpleString +# define PyRun_String MNV_PyRun_String +# define PyRun_SimpleString MNV_PyRun_SimpleString #else // !defined(USE_LIMITED_API) @@ -313,14 +313,14 @@ static int Vim_PyRun_SimpleString(const char *str) #define RAISE_NO_EMPTY_KEYS PyErr_SET_STRING(PyExc_ValueError, \ N_("empty keys are not allowed")) -#define RAISE_LOCKED_DICTIONARY PyErr_SET_VIM(N_("dictionary is locked")) -#define RAISE_LOCKED_LIST PyErr_SET_VIM(N_("list is locked")) -#define RAISE_UNDO_FAIL PyErr_SET_VIM(N_("cannot save undo information")) -#define RAISE_DELETE_LINE_FAIL PyErr_SET_VIM(N_("cannot delete line")) -#define RAISE_INSERT_LINE_FAIL PyErr_SET_VIM(N_("cannot insert line")) -#define RAISE_REPLACE_LINE_FAIL PyErr_SET_VIM(N_("cannot replace line")) +#define RAISE_LOCKED_DICTIONARY PyErr_SET_MNV(N_("dictionary is locked")) +#define RAISE_LOCKED_LIST PyErr_SET_MNV(N_("list is locked")) +#define RAISE_UNDO_FAIL PyErr_SET_MNV(N_("cannot save undo information")) +#define RAISE_DELETE_LINE_FAIL PyErr_SET_MNV(N_("cannot delete line")) +#define RAISE_INSERT_LINE_FAIL PyErr_SET_MNV(N_("cannot insert line")) +#define RAISE_REPLACE_LINE_FAIL PyErr_SET_MNV(N_("cannot replace line")) #define RAISE_KEY_ADD_FAIL(key) \ - PyErr_VIM_FORMAT(N_("failed to add key '%s' to dictionary"), key) + PyErr_MNV_FORMAT(N_("failed to add key '%s' to dictionary"), key) #define RAISE_INVALID_INDEX_TYPE(idx) \ PyErr_FORMAT_TYPE(N_("index must be int or slice, not %s"), idx); @@ -351,8 +351,8 @@ static PyObject *globals; static PyObject *py_chdir; static PyObject *py_fchdir; static PyObject *py_getcwd; -static PyObject *vim_module; -static PyObject *vim_special_path_object; +static PyObject *mnv_module; +static PyObject *mnv_special_path_object; #if PY_VERSION_HEX >= 0x030700f0 static PyObject *py_find_spec; @@ -363,21 +363,21 @@ static PyObject *py_load_module; static PyObject *py_find_module; #endif -static PyObject *VimError; +static PyObject *MNVError; /* - * obtain a lock on the Vim data structures + * obtain a lock on the MNV data structures */ static void -Python_Lock_Vim(void) +Python_Lock_MNV(void) { } /* - * release a lock on the Vim data structures + * release a lock on the MNV data structures */ static void -Python_Release_Vim(void) +Python_Release_MNV(void) { } @@ -694,9 +694,9 @@ write_output(OutputObject *self, PyObject *string) return -1; Py_BEGIN_ALLOW_THREADS - Python_Lock_Vim(); + Python_Lock_MNV(); writer((writefn)(error ? emsg : msg), (char_u *)str, len, error); - Python_Release_Vim(); + Python_Release_MNV(); Py_END_ALLOW_THREADS PyMem_Free(str); @@ -835,7 +835,7 @@ DEFINE_PY_TYPE_OBJECT(LoaderType); LoaderDestructor(PyObject *self_obj) { LoaderObject *self = (LoaderObject*)self_obj; - vim_free(self->fullname); + mnv_free(self->fullname); Py_XDECREF(self->result); DESTRUCTOR_FINISH(self); } @@ -859,7 +859,7 @@ LoaderLoadModule(LoaderObject *self, PyObject *args UNUSED) self->fullname = NULL; self->result = module; - vim_free(fullname); + mnv_free(fullname); Py_DECREF(result); if (!module) @@ -883,20 +883,20 @@ static struct PyMethodDef LoaderMethods[] = { #endif /* - * Check to see whether a Vim error has been reported, or a keyboard + * Check to see whether a MNV error has been reported, or a keyboard * interrupt has been detected. */ static void -VimTryStart(void) +MNVTryStart(void) { ++trylevel; } static int -VimTryEnd(void) +MNVTryEnd(void) { --trylevel; - // Without this it stops processing all subsequent Vim script commands and + // Without this it stops processing all subsequent MNV script commands and // generates strange error messages if I e.g. try calling Test() in a cycle did_emsg = FALSE; // Keyboard interrupt should be preferred over anything else @@ -921,34 +921,34 @@ VimTryEnd(void) return -1; } - PyErr_SetVim(msg); + PyErr_SetMNV(msg); free_global_msglist(); if (should_free) - vim_free(msg); + mnv_free(msg); return -1; } else if (!did_throw) return (PyErr_Occurred() ? -1 : 0); - // Python exception is preferred over Vim one; unlikely to occur though + // Python exception is preferred over MNV one; unlikely to occur though else if (PyErr_Occurred()) { discard_current_exception(); return -1; } - // Finally transform Vim script exception to python one + // Finally transform MNV script exception to python one else { - PyErr_SetVim((char *)current_exception->value); + PyErr_SetMNV((char *)current_exception->value); discard_current_exception(); return -1; } } static int -VimCheckInterrupt(void) +MNVCheckInterrupt(void) { if (got_int) { @@ -958,10 +958,10 @@ VimCheckInterrupt(void) return 0; } -// Vim module - Implementation +// MNV module - Implementation static PyObject * -VimCommand(PyObject *self UNUSED, PyObject *string) +MNVCommand(PyObject *self UNUSED, PyObject *string) { char_u *cmd; PyObject *ret; @@ -971,16 +971,16 @@ VimCommand(PyObject *self UNUSED, PyObject *string) return NULL; Py_BEGIN_ALLOW_THREADS - Python_Lock_Vim(); + Python_Lock_MNV(); - VimTryStart(); + MNVTryStart(); do_cmdline_cmd(cmd); update_screen(UPD_VALID); - Python_Release_Vim(); + Python_Release_MNV(); Py_END_ALLOW_THREADS - if (VimTryEnd()) + if (MNVTryEnd()) ret = NULL; else ret = Py_None; @@ -995,10 +995,10 @@ VimCommand(PyObject *self UNUSED, PyObject *string) * translate lists/dictionaries into their Python equivalents. * * The depth parameter is to avoid infinite recursion, set it to 1 when - * you call VimToPython. + * you call MNVToPython. */ static PyObject * -VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) +MNVToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) { PyObject *ret; PyObject *newObj; @@ -1069,7 +1069,7 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) CHECK_LIST_MATERIALIZE(list); FOR_ALL_LIST_ITEMS(list, curr) { - if (!(newObj = VimToPython(&curr->li_tv, depth + 1, lookup_dict))) + if (!(newObj = MNVToPython(&curr->li_tv, depth + 1, lookup_dict))) { Py_DECREF(ret); return NULL; @@ -1101,7 +1101,7 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) { typval_T *item_tv = TUPLE_ITEM(tuple, idx); - newObj = VimToPython(item_tv, depth + 1, lookup_dict); + newObj = MNVToPython(item_tv, depth + 1, lookup_dict); if (!newObj) { Py_DECREF(ret); @@ -1145,7 +1145,7 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) --todo; di = dict_lookup(hi); - if (!(newObj = VimToPython(&di->di_tv, depth + 1, lookup_dict))) + if (!(newObj = MNVToPython(&di->di_tv, depth + 1, lookup_dict))) { Py_DECREF(ret); return NULL; @@ -1193,7 +1193,7 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookup_dict) } static PyObject * -VimEval(PyObject *self UNUSED, PyObject *args) +MNVEval(PyObject *self UNUSED, PyObject *args) { char_u *expr; typval_T *our_tv; @@ -1209,38 +1209,38 @@ VimEval(PyObject *self UNUSED, PyObject *args) return NULL; Py_BEGIN_ALLOW_THREADS - Python_Lock_Vim(); - VimTryStart(); + Python_Lock_MNV(); + MNVTryStart(); our_tv = eval_expr(expr, NULL); - Python_Release_Vim(); + Python_Release_MNV(); Py_END_ALLOW_THREADS Py_XDECREF(todecref); - if (VimTryEnd()) + if (MNVTryEnd()) return NULL; if (our_tv == NULL) { - PyErr_SET_VIM(N_("invalid expression")); + PyErr_SET_MNV(N_("invalid expression")); return NULL; } - // Convert the Vim type into a Python type. Create a dictionary that's + // Convert the MNV type into a Python type. Create a dictionary that's // used to check for recursive loops. if (!(lookup_dict = PyDict_New())) ret = NULL; else { - ret = VimToPython(our_tv, 1, lookup_dict); + ret = MNVToPython(our_tv, 1, lookup_dict); Py_DECREF(lookup_dict); } Py_BEGIN_ALLOW_THREADS - Python_Lock_Vim(); + Python_Lock_MNV(); free_tv(our_tv); - Python_Release_Vim(); + Python_Release_MNV(); Py_END_ALLOW_THREADS return ret; @@ -1249,7 +1249,7 @@ VimEval(PyObject *self UNUSED, PyObject *args) static PyObject *ConvertToPyObject(typval_T *); static PyObject * -VimEvalPy(PyObject *self UNUSED, PyObject *string) +MNVEvalPy(PyObject *self UNUSED, PyObject *string) { typval_T *our_tv; PyObject *ret; @@ -1260,35 +1260,35 @@ VimEvalPy(PyObject *self UNUSED, PyObject *string) return NULL; Py_BEGIN_ALLOW_THREADS - Python_Lock_Vim(); - VimTryStart(); + Python_Lock_MNV(); + MNVTryStart(); our_tv = eval_expr(expr, NULL); - Python_Release_Vim(); + Python_Release_MNV(); Py_END_ALLOW_THREADS Py_XDECREF(todecref); - if (VimTryEnd()) + if (MNVTryEnd()) return NULL; if (our_tv == NULL) { - PyErr_SET_VIM(N_("invalid expression")); + PyErr_SET_MNV(N_("invalid expression")); return NULL; } ret = ConvertToPyObject(our_tv); Py_BEGIN_ALLOW_THREADS - Python_Lock_Vim(); + Python_Lock_MNV(); free_tv(our_tv); - Python_Release_Vim(); + Python_Release_MNV(); Py_END_ALLOW_THREADS return ret; } static PyObject * -VimStrwidth(PyObject *self UNUSED, PyObject *string) +MNVStrwidth(PyObject *self UNUSED, PyObject *string) { char_u *str; PyObject *todecref; @@ -1305,7 +1305,7 @@ VimStrwidth(PyObject *self UNUSED, PyObject *string) } static PyObject * -_VimChdir(PyObject *_chdir, PyObject *args, PyObject *kwargs) +_MNVChdir(PyObject *_chdir, PyObject *args, PyObject *kwargs) { PyObject *ret; PyObject *newwd; @@ -1330,18 +1330,18 @@ _VimChdir(PyObject *_chdir, PyObject *args, PyObject *kwargs) return NULL; } - VimTryStart(); + MNVTryStart(); - if (vim_chdir(new_dir)) + if (mnv_chdir(new_dir)) { Py_DECREF(ret); Py_DECREF(newwd); Py_XDECREF(todecref); - if (VimTryEnd()) + if (MNVTryEnd()) return NULL; - PyErr_SET_VIM(N_("failed to change directory")); + PyErr_SET_MNV(N_("failed to change directory")); return NULL; } @@ -1350,7 +1350,7 @@ _VimChdir(PyObject *_chdir, PyObject *args, PyObject *kwargs) post_chdir(CDSCOPE_GLOBAL); - if (VimTryEnd()) + if (MNVTryEnd()) { Py_DECREF(ret); return NULL; @@ -1360,15 +1360,15 @@ _VimChdir(PyObject *_chdir, PyObject *args, PyObject *kwargs) } static PyObject * -VimChdir(PyObject *self UNUSED, PyObject *args, PyObject *kwargs) +MNVChdir(PyObject *self UNUSED, PyObject *args, PyObject *kwargs) { - return _VimChdir(py_chdir, args, kwargs); + return _MNVChdir(py_chdir, args, kwargs); } static PyObject * -VimFchdir(PyObject *self UNUSED, PyObject *args, PyObject *kwargs) +MNVFchdir(PyObject *self UNUSED, PyObject *args, PyObject *kwargs) { - return _VimChdir(py_fchdir, args, kwargs); + return _MNVChdir(py_fchdir, args, kwargs); } typedef struct { @@ -1404,7 +1404,7 @@ map_rtp_callback(char_u *path, void *_data) } static PyObject * -VimForeachRTP(PyObject *self UNUSED, PyObject *callable) +MNVForeachRTP(PyObject *self UNUSED, PyObject *callable) { map_rtp_data data; @@ -1427,7 +1427,7 @@ VimForeachRTP(PyObject *self UNUSED, PyObject *callable) } /* - * _vim_runtimepath_ special path implementation. + * _mnv_runtimepath_ special path implementation. */ static void @@ -1493,7 +1493,7 @@ map_finder_callback(char_u *path, void *_data) } static PyObject * -Vim_GetPaths(PyObject *self UNUSED, PyObject *args UNUSED) +MNV_GetPaths(PyObject *self UNUSED, PyObject *args UNUSED) { PyObject *ret; @@ -1523,7 +1523,7 @@ FinderFindSpec(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "s|O", &fullname, &target)) return NULL; - if (!(paths = Vim_GetPaths(self, NULL))) + if (!(paths = MNV_GetPaths(self, NULL))) return NULL; spec = PyObject_CallFunction(py_find_spec, "sOO", fullname, paths, target); @@ -1591,7 +1591,7 @@ find_module(char *fullname, char *tail, PyObject *new_path) PyObject *module; char *dot; - if ((dot = (char *)vim_strchr((char_u *) tail, '.'))) + if ((dot = (char *)mnv_strchr((char_u *) tail, '.'))) { /* * There is a dot in the name: call find_module recursively without the @@ -1658,7 +1658,7 @@ FinderFindModule(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "s", &fullname)) return NULL; - if (!(new_path = Vim_GetPaths(self, NULL))) + if (!(new_path = MNV_GetPaths(self, NULL))) return NULL; result = find_module(fullname, fullname, new_path); @@ -1674,7 +1674,7 @@ FinderFindModule(PyObject *self, PyObject *args) return Py_None; } - if (!(fullname = (char *)vim_strsave((char_u *)fullname))) + if (!(fullname = (char *)mnv_strsave((char_u *)fullname))) { Py_DECREF(result); PyErr_NoMemory(); @@ -1683,7 +1683,7 @@ FinderFindModule(PyObject *self, PyObject *args) if (!(loader = PyObject_NEW(LoaderObject, LoaderTypePtr))) { - vim_free(fullname); + mnv_free(fullname); Py_DECREF(result); return NULL; } @@ -1696,15 +1696,15 @@ FinderFindModule(PyObject *self, PyObject *args) #endif static PyObject * -VimPathHook(PyObject *self UNUSED, PyObject *args) +MNVPathHook(PyObject *self UNUSED, PyObject *args) { char *path; if (PyArg_ParseTuple(args, "s", &path) - && STRCMP(path, vim_special_path) == 0) + && STRCMP(path, mnv_special_path) == 0) { - Py_INCREF(vim_module); - return vim_module; + Py_INCREF(mnv_module); + return mnv_module; } PyErr_Clear(); @@ -1713,24 +1713,24 @@ VimPathHook(PyObject *self UNUSED, PyObject *args) } /* - * Vim module - Definitions + * MNV module - Definitions */ -static struct PyMethodDef VimMethods[] = { +static struct PyMethodDef MNVMethods[] = { // name, function, calling, documentation - {"command", VimCommand, METH_O, "Execute a Vim ex-mode command" }, - {"eval", VimEval, METH_VARARGS, "Evaluate an expression using Vim evaluator" }, - {"bindeval", VimEvalPy, METH_O, "Like eval(), but returns objects attached to Vim ones"}, - {"strwidth", VimStrwidth, METH_O, "Screen string width, counts as having width 1"}, - {"chdir", (PyCFunction)(void *)VimChdir, METH_VARARGS|METH_KEYWORDS, "Change directory"}, - {"fchdir", (PyCFunction)(void *)VimFchdir, METH_VARARGS|METH_KEYWORDS, "Change directory"}, - {"foreach_rtp", VimForeachRTP, METH_O, "Call given callable for each path in &rtp"}, + {"command", MNVCommand, METH_O, "Execute a MNV ex-mode command" }, + {"eval", MNVEval, METH_VARARGS, "Evaluate an expression using MNV evaluator" }, + {"bindeval", MNVEvalPy, METH_O, "Like eval(), but returns objects attached to MNV ones"}, + {"strwidth", MNVStrwidth, METH_O, "Screen string width, counts as having width 1"}, + {"chdir", (PyCFunction)(void *)MNVChdir, METH_VARARGS|METH_KEYWORDS, "Change directory"}, + {"fchdir", (PyCFunction)(void *)MNVFchdir, METH_VARARGS|METH_KEYWORDS, "Change directory"}, + {"foreach_rtp", MNVForeachRTP, METH_O, "Call given callable for each path in &rtp"}, #if PY_VERSION_HEX >= 0x030700f0 {"find_spec", FinderFindSpec, METH_VARARGS, "Internal use only, returns spec object for any input it receives"}, #endif {"find_module", FinderFindModule, METH_VARARGS, "Internal use only, returns loader object for any input it receives"}, - {"path_hook", VimPathHook, METH_VARARGS, "Hook function to install in sys.path_hooks"}, - {"_get_paths", (PyCFunction)Vim_GetPaths, METH_NOARGS, "Get &rtp-based additions to sys.path"}, + {"path_hook", MNVPathHook, METH_VARARGS, "Hook function to install in sys.path_hooks"}, + {"_get_paths", (PyCFunction)MNV_GetPaths, METH_NOARGS, "Get &rtp-based additions to sys.path"}, { NULL, NULL, 0, NULL} }; @@ -1975,7 +1975,7 @@ DictionarySetattr(PyObject *self_obj, char *name, PyObject *valObject) if (valObject == NULL) { PyErr_SET_STRING(PyExc_AttributeError, - N_("cannot delete vim.Dictionary attributes")); + N_("cannot delete mnv.Dictionary attributes")); return -1; } @@ -2361,10 +2361,10 @@ DictionaryUpdate(DictionaryObject *self, PyObject *args, PyObject *kwargs) if (ConvertFromPyMapping(kwargs, &tv) == -1) return NULL; - VimTryStart(); + MNVTryStart(); dict_extend(self->dict, tv.vval.v_dict, (char_u *) "force", NULL); clear_tv(&tv); - if (VimTryEnd()) + if (MNVTryEnd()) return NULL; } else @@ -2723,7 +2723,7 @@ ListIndex(ListObject *self, Py_ssize_t index) if (li == NULL) { // No more suitable format specifications in python-2.3 - PyErr_VIM_FORMAT(N_("internal error: failed to get Vim list item %d"), + PyErr_MNV_FORMAT(N_("internal error: failed to get MNV list item %d"), (int) index); return NULL; } @@ -2885,7 +2885,7 @@ ListAssSlice(ListObject *self, Py_ssize_t first, li = list_find(l, (long) first); if (li == NULL) { - PyErr_VIM_FORMAT(N_("internal error: no Vim list item %d"), + PyErr_MNV_FORMAT(N_("internal error: no MNV list item %d"), (int)first); if (obj != NULL) PyMem_Free(lis); @@ -2910,7 +2910,7 @@ ListAssSlice(ListObject *self, Py_ssize_t first, } if (li == NULL && i != -1) { - PyErr_SET_VIM(N_("internal error: not enough list items")); + PyErr_SET_MNV(N_("internal error: not enough list items")); if (obj != NULL) PyMem_Free(lis); return -1; @@ -2942,7 +2942,7 @@ ListAssSlice(ListObject *self, Py_ssize_t first, : li) == FAIL) { clear_tv(&v); - PyErr_SET_VIM(N_("internal error: failed to add item to list")); + PyErr_SET_MNV(N_("internal error: failed to add item to list")); list_restore(numadded, numreplaced, slicelen, l, lis, lastaddedli); PyMem_Free(lis); return -1; @@ -2950,7 +2950,7 @@ ListAssSlice(ListObject *self, Py_ssize_t first, if (numreplaced < slicelen) { lis[slicelen + numreplaced] = lis[numreplaced]->li_prev; - vimlist_remove(l, lis[numreplaced], lis[numreplaced]); + mnvlist_remove(l, lis[numreplaced], lis[numreplaced]); numreplaced++; } else @@ -3028,13 +3028,13 @@ ListAssIndex(ListObject *self, Py_ssize_t index, PyObject *obj) li = list_find(l, (long) index); if (li == NULL) { - PyErr_VIM_FORMAT(N_("internal error: failed to get Vim " + PyErr_MNV_FORMAT(N_("internal error: failed to get MNV " "list item %d"), (int) index); return -1; } - vimlist_remove(l, li, li); + mnvlist_remove(l, li, li); clear_tv(&li->li_tv); - vim_free(li); + mnv_free(li); return 0; } @@ -3046,7 +3046,7 @@ ListAssIndex(ListObject *self, Py_ssize_t index, PyObject *obj) if (list_append_tv(l, &tv) == FAIL) { clear_tv(&tv); - PyErr_SET_VIM(N_("failed to add item to list")); + PyErr_SET_MNV(N_("failed to add item to list")); return -1; } } @@ -3055,7 +3055,7 @@ ListAssIndex(ListObject *self, Py_ssize_t index, PyObject *obj) li = list_find(l, (long) index); if (li == NULL) { - PyErr_VIM_FORMAT(N_("internal error: failed to get Vim " + PyErr_MNV_FORMAT(N_("internal error: failed to get MNV " "list item %d"), (int) index); return -1; } @@ -3199,7 +3199,7 @@ ListSetattr(PyObject *self_obj, char *name, PyObject *valObject) if (valObject == NULL) { PyErr_SET_STRING(PyExc_AttributeError, - N_("cannot delete vim.List attributes")); + N_("cannot delete mnv.List attributes")); return -1; } @@ -3549,7 +3549,7 @@ TupleSetattr(PyObject *self_obj, char *name, PyObject *valObject) if (valObject == NULL) { PyErr_SET_STRING(PyExc_AttributeError, - N_("cannot delete vim.Tuple attributes")); + N_("cannot delete mnv.Tuple attributes")); return -1; } @@ -3637,14 +3637,14 @@ FunctionNew(PyTypeObject *subtype, char_u *name, int argc, typval_T *argv, N_("unnamed function %s does not exist"), name); return NULL; } - self->name = vim_strsave(name); + self->name = mnv_strsave(name); } else { char_u *p; if ((p = get_expanded_name(name, - vim_strchr(name, AUTOLOAD_CHAR) == NULL)) == NULL) + mnv_strchr(name, AUTOLOAD_CHAR) == NULL)) == NULL) { PyErr_FORMAT(PyExc_ValueError, N_("function %s does not exist"), name); @@ -3658,12 +3658,12 @@ FunctionNew(PyTypeObject *subtype, char_u *name, int argc, typval_T *argv, if ((np = alloc(len + 2)) == NULL) { - vim_free(p); + mnv_free(p); return NULL; } mch_memmove(np, "", 5); mch_memmove(np + 5, p + 3, len - 3); - vim_free(p); + mnv_free(p); self->name = np; } else @@ -3776,7 +3776,7 @@ FunctionDestructor(PyObject *self_obj) FunctionObject *self = (FunctionObject*)self_obj; int i; func_unref(self->name); - vim_free(self->name); + mnv_free(self->name); for (i = 0; i < self->argc; ++i) clear_tv(&self->argv[i]); PyMem_Free(self->argv); @@ -3831,7 +3831,7 @@ FunctionAttr(FunctionObject *self, char *name) * Populate partial_T given function object. * * "exported" should be set to true when it is needed to construct a partial - * that may be stored in a variable (i.e. may be freed by Vim). + * that may be stored in a variable (i.e. may be freed by MNV). */ static void set_partial(FunctionObject *self, partial_T *pt, int exported) @@ -3861,7 +3861,7 @@ set_partial(FunctionObject *self, partial_T *pt, int exported) if (exported && self->self) ++pt->pt_dict->dv_refcount; if (exported) - pt->pt_name = vim_strsave(pt->pt_name); + pt->pt_name = mnv_strsave(pt->pt_name); pt->pt_refcount = 1; } @@ -3905,20 +3905,20 @@ FunctionCall(PyObject *self_obj, PyObject *argsObject, PyObject *kwargs) } Py_BEGIN_ALLOW_THREADS - Python_Lock_Vim(); + Python_Lock_MNV(); - VimTryStart(); + MNVTryStart(); error = func_call(name, &args, pt_ptr, selfdict, &rettv); - Python_Release_Vim(); + Python_Release_MNV(); Py_END_ALLOW_THREADS - if (VimTryEnd()) + if (MNVTryEnd()) ret = NULL; else if (error != OK) { ret = NULL; - PyErr_VIM_FORMAT(N_("failed to run function %s"), (char *)name); + PyErr_MNV_FORMAT(N_("failed to run function %s"), (char *)name); } else ret = ConvertToPyObject(&rettv); @@ -3943,7 +3943,7 @@ FunctionRepr(PyObject *self_obj) char_u numbuf[NUMBUFLEN]; ga_init2(&repr_ga, sizeof(char), 70); - ga_concat(&repr_ga, (char_u *)"name) ga_concat(&repr_ga, self->name); else @@ -3959,7 +3959,7 @@ FunctionRepr(PyObject *self_obj) ga_concat(&repr_ga, (char_u *)", "); ga_concat(&repr_ga, tv2string(&self->argv[i], &tofree, numbuf, get_copyID())); - vim_free(tofree); + mnv_free(tofree); } --emsg_silent; ga_append(&repr_ga, ']'); @@ -3972,7 +3972,7 @@ FunctionRepr(PyObject *self_obj) ++emsg_silent; ga_concat(&repr_ga, tv2string(&tv, &tofree, numbuf, get_copyID())); --emsg_silent; - vim_free(tofree); + mnv_free(tofree); if (self->auto_rebind) ga_concat(&repr_ga, (char_u *)", auto_rebind=True"); } @@ -4106,7 +4106,7 @@ OptionsItem(OptionsObject *self, PyObject *keyObject) if (stringval) { PyObject *ret = PyBytes_FromString((char *)stringval); - vim_free(stringval); + mnv_free(stringval); return ret; } else @@ -4118,7 +4118,7 @@ OptionsItem(OptionsObject *self, PyObject *keyObject) } else { - PyErr_SET_VIM(N_("internal error: unknown option type")); + PyErr_SET_MNV(N_("internal error: unknown option type")); return NULL; } } @@ -4195,9 +4195,9 @@ set_option_value_err(char_u *key, int numval, char_u *stringval, int opt_flags) if ((errmsg = set_option_value(key, numval, stringval, opt_flags))) { - if (VimTryEnd()) + if (MNVTryEnd()) return FAIL; - PyErr_SetVim(errmsg); + PyErr_SetMNV(errmsg); return FAIL; } return OK; @@ -4216,7 +4216,7 @@ set_option_value_for( bufref_T save_curbuf; int set_ret = 0; - VimTryStart(); + MNVTryStart(); switch (opt_type) { case SREQ_WIN: @@ -4224,9 +4224,9 @@ set_option_value_for( win_find_tabpage((win_T *)from), FALSE) == FAIL) { restore_win(&switchwin, TRUE); - if (VimTryEnd()) + if (MNVTryEnd()) return -1; - PyErr_SET_VIM(N_("problem while switching windows")); + PyErr_SET_MNV(N_("problem while switching windows")); return -1; } set_ret = set_option_value_err(key, numval, stringval, opt_flags); @@ -4243,7 +4243,7 @@ set_option_value_for( } if (set_ret == FAIL) return -1; - return VimTryEnd(); + return MNVTryEnd(); } static int @@ -4384,7 +4384,7 @@ CheckTabPage(TabPageObject *self) { if (self->tab == INVALID_TABPAGE_VALUE) { - PyErr_SET_VIM(N_("attempt to refer to deleted tab page")); + PyErr_SET_MNV(N_("attempt to refer to deleted tab page")); return -1; } @@ -4556,7 +4556,7 @@ CheckWindow(WindowObject *self) { if (self->win == INVALID_WINDOW_VALUE) { - PyErr_SET_VIM(N_("attempt to refer to deleted window")); + PyErr_SET_MNV(N_("attempt to refer to deleted window")); return -1; } @@ -4575,7 +4575,7 @@ WindowNew(win_T *win, tabpage_T *tab) /* * We need to handle deletion of windows underneath us. * If we add a "w_python*_ref" field to the win_T structure, - * then we can get at it in win_free() in vim. We then + * then we can get at it in win_free() in mnv. We then * need to create only ONE Python object per window - if * we try to create a second, just INCREF the existing one * and return it. The (single) Python object referring to @@ -4752,12 +4752,12 @@ WindowSetattr(PyObject *self_obj, char *name, PyObject *valObject) if (lnum <= 0 || lnum > self->win->w_buffer->b_ml.ml_line_count) { - PyErr_SET_VIM(N_("cursor position outside buffer")); + PyErr_SET_MNV(N_("cursor position outside buffer")); return -1; } // Check for keyboard interrupts - if (VimCheckInterrupt()) + if (MNVCheckInterrupt()) return -1; self->win->w_cursor.lnum = lnum; @@ -4785,11 +4785,11 @@ WindowSetattr(PyObject *self_obj, char *name, PyObject *valObject) curwin = self->win; curbuf = curwin->w_buffer; - VimTryStart(); + MNVTryStart(); win_setheight((int) height); curwin = savewin; curbuf = curwin->w_buffer; - if (VimTryEnd()) + if (MNVTryEnd()) return -1; return 0; @@ -4809,11 +4809,11 @@ WindowSetattr(PyObject *self_obj, char *name, PyObject *valObject) curwin = self->win; curbuf = curwin->w_buffer; - VimTryStart(); + MNVTryStart(); win_setwidth((int) width); curwin = savewin; curbuf = curwin->w_buffer; - if (VimTryEnd()) + if (MNVTryEnd()) return -1; return 0; @@ -4928,7 +4928,7 @@ WinListItem(WinListObject *self, PyInt n) } /* - * Convert a Python string into a Vim line. + * Convert a Python string into a MNV line. * * The result is in allocated memory. All internal nulls are replaced by * newline characters. It is an error for the string to contain newline @@ -4992,7 +4992,7 @@ StringToLine(PyObject *obj) --len; else { - PyErr_SET_VIM(N_("string cannot contain newlines")); + PyErr_SET_MNV(N_("string cannot contain newlines")); Py_XDECREF(bytes); return NULL; } @@ -5000,7 +5000,7 @@ StringToLine(PyObject *obj) /* * Create a copy of the string, with internal nulls replaced by - * newline characters, as is the Vim convention. + * newline characters, as is the MNV convention. */ save = alloc(len+1); if (save == NULL) @@ -5026,7 +5026,7 @@ StringToLine(PyObject *obj) /* * Get a line from the specified buffer. The line number is - * in Vim format (1-based). The line is returned as a Python + * in MNV format (1-based). The line is returned as a Python * string object. */ static PyObject * @@ -5038,7 +5038,7 @@ GetBufferLine(buf_T *buf, PyInt n) /* * Get a list of lines from the specified buffer. The line numbers - * are in Vim format (1-based). The range is from lo up to, but not + * are in MNV format (1-based). The range is from lo up to, but not * including, hi. The list is returned as a Python list of string objects. */ static PyObject * @@ -5109,7 +5109,7 @@ py_fix_cursor(linenr_T lo, linenr_T hi, linenr_T extra) /* * Replace a line in the specified buffer. The line number is - * in Vim format (1-based). The replacement line is given as + * in MNV format (1-based). The replacement line is given as * a Python string object. The object is checked for validity * and correct format. Errors are returned as a value of FAIL. * The return value is OK on success. @@ -5133,7 +5133,7 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) switchwin.sw_curwin = NULL; switch_to_win_for_buf(buf, &switchwin, &save_curbuf); - VimTryStart(); + MNVTryStart(); if (u_savedel((linenr_T)n, 1L) == FAIL) RAISE_UNDO_FAIL; @@ -5154,7 +5154,7 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) restore_win_for_buf(&switchwin, &save_curbuf); - if (VimTryEnd()) + if (MNVTryEnd()) return FAIL; if (len_change) @@ -5169,7 +5169,7 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) if (save == NULL) return FAIL; - VimTryStart(); + MNVTryStart(); // We do not need to free "save" if ml_replace() consumes it. PyErr_Clear(); @@ -5178,12 +5178,12 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) if (u_savesub((linenr_T)n) == FAIL) { RAISE_UNDO_FAIL; - vim_free(save); + mnv_free(save); } else if (ml_replace((linenr_T)n, (char_u *)save, FALSE) == FAIL) { RAISE_REPLACE_LINE_FAIL; - vim_free(save); + mnv_free(save); } else changed_bytes((linenr_T)n, 0); @@ -5194,7 +5194,7 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) if (buf == curbuf) check_cursor_col(); - if (VimTryEnd()) + if (MNVTryEnd()) return FAIL; if (len_change) @@ -5211,7 +5211,7 @@ SetBufferLine(buf_T *buf, PyInt n, PyObject *line, PyInt *len_change) /* * Replace a range of lines in the specified buffer. The line numbers are in - * Vim format (1-based). The range is from lo up to, but not including, hi. + * MNV format (1-based). The range is from lo up to, but not including, hi. * The replacement lines are given as a Python list of string objects. The * list is checked for validity and correct format. Errors are returned as a * value of FAIL. The return value is OK on success. @@ -5240,7 +5240,7 @@ SetBufferLineList( PyInt n = (int)(hi - lo); PyErr_Clear(); - VimTryStart(); + MNVTryStart(); switchwin.sw_curwin = NULL; switch_to_win_for_buf(buf, &switchwin, &save_curbuf); @@ -5269,7 +5269,7 @@ SetBufferLineList( restore_win_for_buf(&switchwin, &save_curbuf); - if (VimTryEnd()) + if (MNVTryEnd()) return FAIL; if (len_change) @@ -5305,13 +5305,13 @@ SetBufferLineList( !(array[i] = StringToLine(line))) { while (i) - vim_free(array[--i]); + mnv_free(array[--i]); PyMem_Free(array); return FAIL; } } - VimTryStart(); + MNVTryStart(); PyErr_Clear(); // START of region without "return". Must call restore_buffer()! @@ -5353,7 +5353,7 @@ SetBufferLineList( // Now we may need to insert the remaining new old_len. If we do, we // must free the strings as we finish with them (we can't pass the - // responsibility to Vim in this case). + // responsibility to MNV in this case). if (!PyErr_Occurred()) { while (i < new_len) @@ -5364,7 +5364,7 @@ SetBufferLineList( RAISE_INSERT_LINE_FAIL; break; } - vim_free(array[i]); + mnv_free(array[i]); ++i; ++extra; } @@ -5373,13 +5373,13 @@ SetBufferLineList( // Free any left-over old_len, as a result of an error while (i < new_len) { - vim_free(array[i]); + mnv_free(array[i]); ++i; } // Free the array of old_len. All of its contents have now // been dealt with (either freed, or the responsibility passed - // to vim. + // to mnv. PyMem_Free(array); // Adjust marks. Invalidate any which lie in the @@ -5402,7 +5402,7 @@ SetBufferLineList( // END of region without "return". restore_win_for_buf(&switchwin, &save_curbuf); - if (VimTryEnd()) + if (MNVTryEnd()) return FAIL; if (len_change) @@ -5419,7 +5419,7 @@ SetBufferLineList( /* * Insert a number of lines into the specified buffer after the specified line. - * The line number is in Vim format (1-based). The lines to be inserted are + * The line number is in MNV format (1-based). The lines to be inserted are * given as a Python list of string objects or as a single string. The lines * to be added are checked for validity and correct format. Errors are * returned as a value of FAIL. The return value is OK on success. @@ -5442,7 +5442,7 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) return FAIL; PyErr_Clear(); - VimTryStart(); + MNVTryStart(); switch_to_win_for_buf(buf, &switchwin, &save_curbuf); if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL) @@ -5454,11 +5454,11 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) // holds the buffer, otherwise line numbers will be invalid. appended_lines_mark((linenr_T)n, 1L); - vim_free(str); + mnv_free(str); restore_win_for_buf(&switchwin, &save_curbuf); update_screen(UPD_VALID); - if (VimTryEnd()) + if (MNVTryEnd()) return FAIL; if (len_change) @@ -5487,14 +5487,14 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) !(array[i] = StringToLine(line))) { while (i) - vim_free(array[--i]); + mnv_free(array[--i]); PyMem_Free(array); return FAIL; } } PyErr_Clear(); - VimTryStart(); + MNVTryStart(); switch_to_win_for_buf(buf, &switchwin, &save_curbuf); if (u_save((linenr_T)n, (linenr_T)(n + 1)) == FAIL) @@ -5510,11 +5510,11 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) // Free the rest of the lines while (i < size) - vim_free(array[i++]); + mnv_free(array[i++]); break; } - vim_free(array[i]); + mnv_free(array[i]); } if (i > 0 && save_curbuf.br_buf == NULL) // Only adjust marks if we managed to switch to a window that @@ -5529,7 +5529,7 @@ InsertBufferLines(buf_T *buf, PyInt n, PyObject *lines, PyInt *len_change) update_screen(UPD_VALID); - if (VimTryEnd()) + if (MNVTryEnd()) return FAIL; if (len_change) @@ -5560,7 +5560,7 @@ CheckBuffer(BufferObject *self) { if (self->buf == INVALID_BUFFER_VALUE) { - PyErr_SET_VIM(N_("attempt to refer to deleted buffer")); + PyErr_SET_MNV(N_("attempt to refer to deleted buffer")); return -1; } @@ -5864,7 +5864,7 @@ RangeRepr(PyObject *self_obj) static struct PyMethodDef RangeMethods[] = { // name, function, calling, documentation - {"append", (PyCFunction)RangeAppend, METH_VARARGS, "Append data to the Vim range" }, + {"append", (PyCFunction)RangeAppend, METH_VARARGS, "Append data to the MNV range" }, {"__dir__", (PyCFunction)RangeDir, METH_NOARGS, ""}, { NULL, NULL, 0, NULL} }; @@ -5879,7 +5879,7 @@ BufferNew(buf_T *buf) /* * We need to handle deletion of buffers underneath us. * If we add a "b_python*_ref" field to the buf_T structure, - * then we can get at it in buf_freeall() in vim. We then + * then we can get at it in buf_freeall() in mnv. We then * need to create only ONE Python object per buffer - if * we try to create a second, just INCREF the existing one * and return it. The (single) Python object referring to @@ -6005,7 +6005,7 @@ BufferSetattr(PyObject *self_obj, char *name, PyObject *valObject) if (!(val = StringToChars(valObject, &todecref))) return -1; - VimTryStart(); + MNVTryStart(); // Using aucmd_*: autocommands will be executed by rename_buffer aucmd_prepbuf(&aco, self->buf); if (curbuf == self->buf) @@ -6014,12 +6014,12 @@ BufferSetattr(PyObject *self_obj, char *name, PyObject *valObject) aucmd_restbuf(&aco); } Py_XDECREF(todecref); - if (VimTryEnd()) + if (MNVTryEnd()) return -1; if (ren_ret == FAIL) { - PyErr_SET_VIM(N_("failed to rename buffer")); + PyErr_SET_MNV(N_("failed to rename buffer")); return -1; } return 0; @@ -6064,16 +6064,16 @@ BufferMark(BufferObject *self, PyObject *pmarkObject) Py_XDECREF(todecref); - VimTryStart(); + MNVTryStart(); switch_buffer(&savebuf, self->buf); posp = getmark(mark, FALSE); restore_buffer(&savebuf); - if (VimTryEnd()) + if (MNVTryEnd()) return NULL; if (posp == NULL) { - PyErr_SET_VIM(N_("invalid mark name")); + PyErr_SET_MNV(N_("invalid mark name")); return NULL; } @@ -6121,7 +6121,7 @@ BufferRepr(PyObject *self_obj) static struct PyMethodDef BufferMethods[] = { // name, function, calling, documentation - {"append", (PyCFunction)BufferAppend, METH_VARARGS, "Append data to Vim buffer" }, + {"append", (PyCFunction)BufferAppend, METH_VARARGS, "Append data to MNV buffer" }, {"mark", (PyCFunction)BufferMark, METH_O, "Return (row,col) representing position of named mark" }, {"range", (PyCFunction)BufferRange, METH_VARARGS, "Return a range object which represents the part of the given buffer between line numbers s and e" }, {"__dir__", (PyCFunction)BufferDir, METH_NOARGS, ""}, @@ -6308,7 +6308,7 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *valObject) if (valObject->ob_type != BufferTypePtr) { PyErr_FORMAT_TYPE( - N_("expected vim.Buffer object, but got %s"), + N_("expected mnv.Buffer object, but got %s"), valObject); return -1; } @@ -6317,16 +6317,16 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *valObject) return -1; count = ((BufferObject *)(valObject))->buf->b_fnum; - VimTryStart(); + MNVTryStart(); if (do_buffer(DOBUF_GOTO, DOBUF_FIRST, FORWARD, count, 0) == FAIL) { - if (VimTryEnd()) + if (MNVTryEnd()) return -1; - PyErr_VIM_FORMAT(N_("failed to switch to buffer %d"), count); + PyErr_MNV_FORMAT(N_("failed to switch to buffer %d"), count); return -1; } - return VimTryEnd(); + return MNVTryEnd(); } else if (strcmp(name, "window") == 0) { @@ -6335,7 +6335,7 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *valObject) if (valObject->ob_type != WindowTypePtr) { PyErr_FORMAT_TYPE( - N_("expected vim.Window object, but got %s"), + N_("expected mnv.Window object, but got %s"), valObject); return -1; } @@ -6351,25 +6351,25 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *valObject) return -1; } - VimTryStart(); + MNVTryStart(); win_goto(((WindowObject *)(valObject))->win); if (((WindowObject *)(valObject))->win != curwin) { - if (VimTryEnd()) + if (MNVTryEnd()) return -1; PyErr_SET_STRING(PyExc_RuntimeError, N_("did not switch to the specified window")); return -1; } - return VimTryEnd(); + return MNVTryEnd(); } else if (strcmp(name, "tabpage") == 0) { if (valObject->ob_type != TabPageTypePtr) { PyErr_FORMAT_TYPE( - N_("expected vim.TabPage object, but got %s"), + N_("expected mnv.TabPage object, but got %s"), valObject); return -1; } @@ -6377,18 +6377,18 @@ CurrentSetattr(PyObject *self UNUSED, char *name, PyObject *valObject) if (CheckTabPage((TabPageObject *)(valObject))) return -1; - VimTryStart(); + MNVTryStart(); goto_tabpage_tp(((TabPageObject *)(valObject))->tab, TRUE, TRUE); if (((TabPageObject *)(valObject))->tab != curtab) { - if (VimTryEnd()) + if (MNVTryEnd()) return -1; PyErr_SET_STRING(PyExc_RuntimeError, N_("did not switch to the specified tab page")); return -1; } - return VimTryEnd(); + return MNVTryEnd(); } else { @@ -6433,7 +6433,7 @@ run_cmd(const char *cmd, dict_T* locals UNUSED, void *arg UNUSED } else if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SystemExit)) { - emsg(_(e_cant_handle_systemexit_of_python_exception_in_vim)); + emsg(_(e_cant_handle_systemexit_of_python_exception_in_mnv)); PyErr_Clear(); } else @@ -6478,7 +6478,7 @@ run_do(const char *cmd, dict_T* locals UNUSED, void *arg UNUSED else if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SystemExit)) { PyMem_Free(code); - emsg(_(e_cant_handle_systemexit_of_python_exception_in_vim)); + emsg(_(e_cant_handle_systemexit_of_python_exception_in_mnv)); PyErr_Clear(); return; } @@ -6582,7 +6582,7 @@ run_eval(const char *cmd, dict_T *locals, void *arg { if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SystemExit)) { - emsg(_(e_cant_handle_systemexit_of_python_exception_in_vim)); + emsg(_(e_cant_handle_systemexit_of_python_exception_in_mnv)); PyErr_Clear(); } else @@ -6595,7 +6595,7 @@ run_eval(const char *cmd, dict_T *locals, void *arg else { if (ConvertFromPyObject(run_ret, rettv) == -1) - emsg(_(e_failed_to_convert_returned_python_object_to_vim_value)); + emsg(_(e_failed_to_convert_returned_python_object_to_mnv_value)); Py_DECREF(run_ret); } PyErr_Clear(); @@ -6655,7 +6655,7 @@ set_ref_in_py(const int copyID) static int set_string_copy(char_u *str, typval_T *tv) { - tv->vval.v_string = vim_strsave(str); + tv->vval.v_string = mnv_strsave(str); if (tv->vval.v_string == NULL) { PyErr_NoMemory(); @@ -6717,7 +6717,7 @@ pydict_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict) if (_ConvertFromPyObject(valObject, &di->di_tv, lookup_dict) == -1) { - vim_free(di); + mnv_free(di); dict_unref(dict); return -1; } @@ -6726,7 +6726,7 @@ pydict_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict) { RAISE_KEY_ADD_FAIL(di->di_key); clear_tv(&di->di_tv); - vim_free(di); + mnv_free(di); dict_unref(dict); return -1; } @@ -6816,7 +6816,7 @@ pymap_to_tv(PyObject *obj, typval_T *tv, PyObject *lookup_dict) { Py_DECREF(iterator); Py_DECREF(valObject); - vim_free(di); + mnv_free(di); dict_unref(dict); return -1; } @@ -6962,7 +6962,7 @@ ConvertFromPyMapping(PyObject *obj, typval_T *tv) else { PyErr_FORMAT_TYPE( - N_("unable to convert %s to a Vim dictionary"), + N_("unable to convert %s to a MNV dictionary"), obj); ret = -1; } @@ -6991,7 +6991,7 @@ ConvertFromPySequence(PyObject *obj, typval_T *tv) else { PyErr_FORMAT_TYPE( - N_("unable to convert %s to a Vim list"), + N_("unable to convert %s to a MNV list"), obj); ret = -1; } @@ -7142,7 +7142,7 @@ _ConvertFromPyObject(PyObject *obj, typval_T *tv, PyObject *lookup_dict) else { PyErr_FORMAT_TYPE( - N_("unable to convert %s to a Vim structure"), + N_("unable to convert %s to a MNV structure"), obj); return -1; } @@ -7156,7 +7156,7 @@ ConvertToPyObject(typval_T *tv) int i; if (tv == NULL) { - PyErr_SET_VIM(N_("internal error: NULL reference passed")); + PyErr_SET_MNV(N_("internal error: NULL reference passed")); return NULL; } switch (tv->v_type) @@ -7218,7 +7218,7 @@ ConvertToPyObject(typval_T *tv) case VVAL_NONE: case VVAL_NULL: return ALWAYS_NONE; } - PyErr_SET_VIM(N_("internal error: invalid value type")); + PyErr_SET_MNV(N_("internal error: invalid value type")); return NULL; } return NULL; @@ -7240,10 +7240,10 @@ static CurrentObject TheCurrent = init_structs(void) { CLEAR_FIELD(OutputType); - OutputType.tp_name = "vim.message"; + OutputType.tp_name = "mnv.message"; OutputType.tp_basicsize = sizeof(OutputObject); OutputType.tp_flags = Py_TPFLAGS_DEFAULT; - OutputType.tp_doc = "vim message object"; + OutputType.tp_doc = "mnv message object"; OutputType.tp_methods = OutputMethods; #if PY_MAJOR_VERSION >= 3 OutputType.tp_getattro = OutputGetattro; @@ -7264,7 +7264,7 @@ init_structs(void) #endif CLEAR_FIELD(IterType); - IterType.tp_name = "vim.iter"; + IterType.tp_name = "mnv.iter"; IterType.tp_basicsize = sizeof(IterObject); IterType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC; IterType.tp_doc = "generic iterator object"; @@ -7275,14 +7275,14 @@ init_structs(void) IterType.tp_clear = IterClear; CLEAR_FIELD(BufferType); - BufferType.tp_name = "vim.buffer"; + BufferType.tp_name = "mnv.buffer"; BufferType.tp_basicsize = sizeof(BufferObject); BufferType.tp_dealloc = BufferDestructor; BufferType.tp_repr = BufferRepr; BufferType.tp_as_sequence = &BufferAsSeq; BufferType.tp_as_mapping = &BufferAsMapping; BufferType.tp_flags = Py_TPFLAGS_DEFAULT; - BufferType.tp_doc = "vim buffer object"; + BufferType.tp_doc = "mnv buffer object"; BufferType.tp_methods = BufferMethods; #if PY_MAJOR_VERSION >= 3 BufferType.tp_getattro = BufferGetattro; @@ -7296,12 +7296,12 @@ init_structs(void) #endif CLEAR_FIELD(WindowType); - WindowType.tp_name = "vim.window"; + WindowType.tp_name = "mnv.window"; WindowType.tp_basicsize = sizeof(WindowObject); WindowType.tp_dealloc = WindowDestructor; WindowType.tp_repr = WindowRepr; WindowType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC; - WindowType.tp_doc = "vim Window object"; + WindowType.tp_doc = "mnv Window object"; WindowType.tp_methods = WindowMethods; WindowType.tp_traverse = WindowTraverse; WindowType.tp_clear = WindowClear; @@ -7317,12 +7317,12 @@ init_structs(void) #endif CLEAR_FIELD(TabPageType); - TabPageType.tp_name = "vim.tabpage"; + TabPageType.tp_name = "mnv.tabpage"; TabPageType.tp_basicsize = sizeof(TabPageObject); TabPageType.tp_dealloc = TabPageDestructor; TabPageType.tp_repr = TabPageRepr; TabPageType.tp_flags = Py_TPFLAGS_DEFAULT; - TabPageType.tp_doc = "vim tab page object"; + TabPageType.tp_doc = "mnv tab page object"; TabPageType.tp_methods = TabPageMethods; #if PY_MAJOR_VERSION >= 3 TabPageType.tp_getattro = TabPageGetattro; @@ -7334,37 +7334,37 @@ init_structs(void) #endif CLEAR_FIELD(BufMapType); - BufMapType.tp_name = "vim.bufferlist"; + BufMapType.tp_name = "mnv.bufferlist"; BufMapType.tp_basicsize = sizeof(BufMapObject); BufMapType.tp_as_mapping = &BufMapAsMapping; BufMapType.tp_flags = Py_TPFLAGS_DEFAULT; BufMapType.tp_iter = BufMapIter; - BufMapType.tp_doc = "vim buffer list"; + BufMapType.tp_doc = "mnv buffer list"; CLEAR_FIELD(WinListType); - WinListType.tp_name = "vim.windowlist"; + WinListType.tp_name = "mnv.windowlist"; WinListType.tp_basicsize = sizeof(WinListObject); WinListType.tp_as_sequence = &WinListAsSeq; WinListType.tp_flags = Py_TPFLAGS_DEFAULT; - WinListType.tp_doc = "vim window list"; + WinListType.tp_doc = "mnv window list"; WinListType.tp_dealloc = (destructor)WinListDestructor; CLEAR_FIELD(TabListType); - TabListType.tp_name = "vim.tabpagelist"; + TabListType.tp_name = "mnv.tabpagelist"; TabListType.tp_basicsize = sizeof(TabListObject); TabListType.tp_as_sequence = &TabListAsSeq; TabListType.tp_flags = Py_TPFLAGS_DEFAULT; - TabListType.tp_doc = "vim tab page list"; + TabListType.tp_doc = "mnv tab page list"; CLEAR_FIELD(RangeType); - RangeType.tp_name = "vim.range"; + RangeType.tp_name = "mnv.range"; RangeType.tp_basicsize = sizeof(RangeObject); RangeType.tp_dealloc = RangeDestructor; RangeType.tp_repr = RangeRepr; RangeType.tp_as_sequence = &RangeAsSeq; RangeType.tp_as_mapping = &RangeAsMapping; RangeType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC; - RangeType.tp_doc = "vim Range object"; + RangeType.tp_doc = "mnv Range object"; RangeType.tp_methods = RangeMethods; RangeType.tp_traverse = RangeTraverse; RangeType.tp_clear = RangeClear; @@ -7378,10 +7378,10 @@ init_structs(void) #endif CLEAR_FIELD(CurrentType); - CurrentType.tp_name = "vim.currentdata"; + CurrentType.tp_name = "mnv.currentdata"; CurrentType.tp_basicsize = sizeof(CurrentObject); CurrentType.tp_flags = Py_TPFLAGS_DEFAULT; - CurrentType.tp_doc = "vim current object"; + CurrentType.tp_doc = "mnv current object"; CurrentType.tp_methods = CurrentMethods; #if PY_MAJOR_VERSION >= 3 CurrentType.tp_getattro = CurrentGetattro; @@ -7392,13 +7392,13 @@ init_structs(void) #endif CLEAR_FIELD(DictionaryType); - DictionaryType.tp_name = "vim.dictionary"; + DictionaryType.tp_name = "mnv.dictionary"; DictionaryType.tp_basicsize = sizeof(DictionaryObject); DictionaryType.tp_dealloc = DictionaryDestructor; DictionaryType.tp_as_sequence = &DictionaryAsSeq; DictionaryType.tp_as_mapping = &DictionaryAsMapping; DictionaryType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE; - DictionaryType.tp_doc = "dictionary pushing modifications to Vim structure"; + DictionaryType.tp_doc = "dictionary pushing modifications to MNV structure"; DictionaryType.tp_methods = DictionaryMethods; DictionaryType.tp_iter = DictionaryIter; DictionaryType.tp_new = DictionaryConstructor; @@ -7412,13 +7412,13 @@ init_structs(void) #endif CLEAR_FIELD(ListType); - ListType.tp_name = "vim.list"; + ListType.tp_name = "mnv.list"; ListType.tp_dealloc = ListDestructor; ListType.tp_basicsize = sizeof(ListObject); ListType.tp_as_sequence = &ListAsSeq; ListType.tp_as_mapping = &ListAsMapping; ListType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE; - ListType.tp_doc = "list pushing modifications to Vim structure"; + ListType.tp_doc = "list pushing modifications to MNV structure"; ListType.tp_methods = ListMethods; ListType.tp_iter = ListIter; ListType.tp_new = ListConstructor; @@ -7433,13 +7433,13 @@ init_structs(void) // Tuple type CLEAR_FIELD(TupleType); - TupleType.tp_name = "vim.tuple"; + TupleType.tp_name = "mnv.tuple"; TupleType.tp_dealloc = TupleDestructor; TupleType.tp_basicsize = sizeof(TupleObject); TupleType.tp_as_sequence = &TupleAsSeq; TupleType.tp_as_mapping = &TupleAsMapping; TupleType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE; - TupleType.tp_doc = "tuple pushing modifications to Vim structure"; + TupleType.tp_doc = "tuple pushing modifications to MNV structure"; TupleType.tp_methods = TupleMethods; TupleType.tp_iter = TupleIter; TupleType.tp_new = TupleConstructor; @@ -7453,12 +7453,12 @@ init_structs(void) #endif CLEAR_FIELD(FunctionType); - FunctionType.tp_name = "vim.function"; + FunctionType.tp_name = "mnv.function"; FunctionType.tp_basicsize = sizeof(FunctionObject); FunctionType.tp_dealloc = FunctionDestructor; FunctionType.tp_call = FunctionCall; FunctionType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE; - FunctionType.tp_doc = "object that calls Vim function"; + FunctionType.tp_doc = "object that calls MNV function"; FunctionType.tp_methods = FunctionMethods; FunctionType.tp_repr = FunctionRepr; FunctionType.tp_new = FunctionConstructor; @@ -7470,7 +7470,7 @@ init_structs(void) #endif CLEAR_FIELD(OptionsType); - OptionsType.tp_name = "vim.options"; + OptionsType.tp_name = "mnv.options"; OptionsType.tp_basicsize = sizeof(OptionsObject); OptionsType.tp_as_sequence = &OptionsAsSeq; OptionsType.tp_flags = Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_GC; @@ -7483,20 +7483,20 @@ init_structs(void) #if PY_VERSION_HEX < 0x030700f0 CLEAR_FIELD(LoaderType); - LoaderType.tp_name = "vim.Loader"; + LoaderType.tp_name = "mnv.Loader"; LoaderType.tp_basicsize = sizeof(LoaderObject); LoaderType.tp_flags = Py_TPFLAGS_DEFAULT; - LoaderType.tp_doc = "vim message object"; + LoaderType.tp_doc = "mnv message object"; LoaderType.tp_methods = LoaderMethods; LoaderType.tp_dealloc = LoaderDestructor; #endif #if PY_MAJOR_VERSION >= 3 - CLEAR_FIELD(vimmodule); - vimmodule.m_name = "vim"; - vimmodule.m_doc = "Vim Python interface\n"; - vimmodule.m_size = -1; - vimmodule.m_methods = VimMethods; + CLEAR_FIELD(mnvmodule); + mnvmodule.m_name = "mnv"; + mnvmodule.m_doc = "MNV Python interface\n"; + mnvmodule.m_size = -1; + mnvmodule.m_methods = MNVMethods; #endif } @@ -7569,7 +7569,7 @@ init_sys_path(void) PyObject *path_hook; PyObject *path_hooks; - if (!(path_hook = PyObject_GetAttrString(vim_module, "path_hook"))) + if (!(path_hook = PyObject_GetAttrString(mnv_module, "path_hook"))) return -1; if (!(path_hooks = PySys_GetObject("path_hooks"))) @@ -7595,12 +7595,12 @@ init_sys_path(void) } else { - VimTryStart(); + MNVTryStart(); emsg(_("Failed to set path hook: sys.path_hooks is not a list\n" "You should now do the following:\n" - "- append vim.path_hook to sys.path_hooks\n" - "- append vim.VIM_SPECIAL_PATH to sys.path\n")); - VimTryEnd(); // Discard the error + "- append mnv.path_hook to sys.path_hooks\n" + "- append mnv.MNV_SPECIAL_PATH to sys.path\n")); + MNVTryEnd(); // Discard the error Py_DECREF(path_hook); return 0; } @@ -7609,8 +7609,8 @@ init_sys_path(void) { PyErr_Clear(); path = PyList_New(1); - Py_INCREF(vim_special_path_object); - PyList_SET_ITEM(path, 0, vim_special_path_object); + Py_INCREF(mnv_special_path_object); + PyList_SET_ITEM(path, 0, mnv_special_path_object); if (PySys_SetObject("path", path)) { Py_DECREF(path); @@ -7620,15 +7620,15 @@ init_sys_path(void) } else if (PyList_Check(path)) { - if (PyList_Append(path, vim_special_path_object)) + if (PyList_Append(path, mnv_special_path_object)) return -1; } else { - VimTryStart(); + MNVTryStart(); emsg(_("Failed to set path: sys.path is not a list\n" - "You should now append vim.VIM_SPECIAL_PATH to sys.path")); - VimTryEnd(); // Discard the error + "You should now append mnv.MNV_SPECIAL_PATH to sys.path")); + MNVTryEnd(); // Discard the error } return 0; @@ -7710,12 +7710,12 @@ populate_module(PyObject *m) ADD_OBJECT(m, object_constants[i].name, valObject); } - if (!(VimError = PyErr_NewException("vim.error", NULL, NULL))) + if (!(MNVError = PyErr_NewException("mnv.error", NULL, NULL))) return -1; - ADD_OBJECT(m, "error", VimError); + ADD_OBJECT(m, "error", MNVError); ADD_CHECKED_OBJECT(m, "vars", NEW_DICTIONARY(get_globvar_dict())); - ADD_CHECKED_OBJECT(m, "vvars", NEW_DICTIONARY(get_vimvar_dict())); + ADD_CHECKED_OBJECT(m, "vvars", NEW_DICTIONARY(get_mnvvar_dict())); ADD_CHECKED_OBJECT(m, "options", OptionsNew(SREQ_GLOBAL, NULL, dummy_check, NULL)); @@ -7759,10 +7759,10 @@ populate_module(PyObject *m) else PyErr_Clear(); - if (!(vim_special_path_object = PyString_FromString(vim_special_path))) + if (!(mnv_special_path_object = PyString_FromString(mnv_special_path))) return -1; - ADD_OBJECT(m, "VIM_SPECIAL_PATH", vim_special_path_object); + ADD_OBJECT(m, "MNV_SPECIAL_PATH", mnv_special_path_object); #if PY_VERSION_HEX >= 0x030700f0 if (!(imp = PyImport_ImportModule("importlib.machinery"))) diff --git a/uvim/src/if_python.c b/uvim/src/if_python.c index 9607258fd1..53ba3fe457 100644 --- a/uvim/src/if_python.c +++ b/uvim/src/if_python.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * Python extensions by Paul Moore. @@ -13,11 +13,11 @@ * This consists of four parts: * 1. Python interpreter main program * 2. Python output stream: writes output via [e]msg(). - * 3. Implementation of the Vim module for Python - * 4. Utility functions for handling the interface between Vim and Python. + * 3. Implementation of the MNV module for Python + * 4. Utility functions for handling the interface between MNV and Python. */ -#include "vim.h" +#include "mnv.h" #include @@ -119,7 +119,7 @@ # endif # ifdef MSWIN -# define load_dll vimLoadLib +# define load_dll mnvLoadLib # define close_dll FreeLibrary # define symbol_from_dll GetProcAddress # define load_dll_error GetWin32Error @@ -628,7 +628,7 @@ static struct # endif # endif # if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02050000 \ - && SIZEOF_SIZE_T != VIM_SIZEOF_INT + && SIZEOF_SIZE_T != MNV_SIZEOF_INT # ifdef Py_DEBUG {"Py_InitModule4TraceRefs_64", (PYTHON_PROC*)&dll_Py_InitModule4}, # else @@ -673,7 +673,7 @@ python_runtime_link_init(char *libname, int verbose) if (python3_loaded()) { if (verbose) - emsg(_(e_this_vim_cannot_execute_python_after_using_py3)); + emsg(_(e_this_mnv_cannot_execute_python_after_using_py3)); return FAIL; } # endif @@ -918,7 +918,7 @@ Python_Init(void) if (*p_pyhome != NUL) { // The string must not change later, make a copy in static memory. - py_home_buf = (char *)vim_strsave(p_pyhome); + py_home_buf = (char *)mnv_strsave(p_pyhome); if (py_home_buf != NULL) Py_SetPythonHome(py_home_buf); } @@ -930,7 +930,7 @@ Python_Init(void) init_structs(); #if defined(PY_VERSION_HEX) && PY_VERSION_HEX >= 0x02070000 - // Disable implicit 'import site', because it may cause Vim to exit + // Disable implicit 'import site', because it may cause MNV to exit // when it can't be found. Py_NoSiteFlag++; #endif @@ -1033,7 +1033,7 @@ DoPyCommand( init_range(arg); - Python_Release_Vim(); // leave Vim + Python_Release_MNV(); // leave MNV #if defined(HAVE_LOCALE_H) || defined(X_LOCALE) // Python only works properly when the LC_NUMERIC locale is "C". @@ -1074,7 +1074,7 @@ DoPyCommand( } #endif - Python_Lock_Vim(); // enter vim + Python_Lock_MNV(); // enter mnv PythonIO_Flush(); theend: @@ -1104,7 +1104,7 @@ ex_python(exarg_T *eap) (runner) run_cmd, (void *) eap); } - vim_free(script); + mnv_free(script); } #define BUFFER_SIZE 1024 @@ -1123,7 +1123,7 @@ ex_pyfile(exarg_T *eap) p_pyx = 2; // Have to do it like this. PyRun_SimpleFile requires you to pass a - // stdio file pointer, but Vim and the Python DLL are compiled with + // stdio file pointer, but MNV and the Python DLL are compiled with // different options under Windows, meaning that stdio pointers aren't // compatible between the two. Yuk. // @@ -1190,7 +1190,7 @@ OutputGetattr(PyObject *self, char *name) } /////////////////////////////////////////////////////// -// 3. Implementation of the Vim module for Python +// 3. Implementation of the MNV module for Python // Window type - Implementation functions // -------------------------------------- @@ -1431,10 +1431,10 @@ PythonMod_Init(void) // Set sys.argv[] to avoid a crash in warn(). PySys_SetArgv(1, argv); - vim_module = Py_InitModule4("vim", VimMethods, (char *)NULL, + mnv_module = Py_InitModule4("mnv", MNVMethods, (char *)NULL, (PyObject *)NULL, PYTHON_API_VERSION); - if (populate_module(vim_module)) + if (populate_module(mnv_module)) return -1; if (init_sys_path()) @@ -1444,9 +1444,9 @@ PythonMod_Init(void) } ////////////////////////////////////////////////////////////////////////// -// 4. Utility functions for handling the interface between Vim and Python. +// 4. Utility functions for handling the interface between MNV and Python. -// Convert a Vim line into a Python string. +// Convert a MNV line into a Python string. // All internal newlines are replaced by null characters. // // On errors, the Python exception data is set, and NULL is returned. diff --git a/uvim/src/if_python3.c b/uvim/src/if_python3.c index 6ed457395f..3d038897bb 100644 --- a/uvim/src/if_python3.c +++ b/uvim/src/if_python3.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * Python extensions by Paul Moore. @@ -13,8 +13,8 @@ * This consists of four parts: * 1. Python interpreter main program * 2. Python output stream: writes output via [e]msg(). - * 3. Implementation of the Vim module for Python - * 4. Utility functions for handling the interface between Vim and Python. + * 3. Implementation of the MNV module for Python + * 4. Utility functions for handling the interface between MNV and Python. */ /* @@ -29,7 +29,7 @@ // allocator // #define Py_DEBUG_NO_PYMALLOC -#include "vim.h" +#include "mnv.h" #include @@ -135,7 +135,7 @@ static HINSTANCE hinstPy3 = 0; // Instance of python.dll #if defined(DYNAMIC_PYTHON3) # ifdef MSWIN -# define load_dll vimLoadLib +# define load_dll mnvLoadLib # define close_dll FreeLibrary # define symbol_from_dll GetProcAddress # define load_dll_error GetWin32Error @@ -752,7 +752,7 @@ static struct // // For 3.8 or above, we also use this version even if not using limited API. // The Py_DECREF macros in 3.8+ include references to internal functions which -// cause link errors when building Vim. The stable versions are exposed as API +// cause link errors when building MNV. The stable versions are exposed as API // functions and don't have these problems (albeit slightly slower as they // require function calls rather than an inlined macro). # undef Py_INCREF @@ -907,7 +907,7 @@ py3_get_system_libname(const char *libname) NULL, path, &len); if (ret != ERROR_SUCCESS) { - vim_free(path); + mnv_free(path); return NULL; } // Remove trailing path separators. @@ -940,7 +940,7 @@ py3_runtime_link_init(char *libname, int verbose) if (python_loaded()) { if (verbose) - emsg(_(e_this_vim_cannot_execute_py3_after_using_python)); + emsg(_(e_this_mnv_cannot_execute_py3_after_using_python)); return FAIL; } # endif @@ -960,7 +960,7 @@ py3_runtime_link_init(char *libname, int verbose) hinstPy3 = LoadLibraryExW(syslibname, NULL, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32); - vim_free(syslibname); + mnv_free(syslibname); } } # endif @@ -1120,7 +1120,7 @@ static PyObject *TupleGetattro(PyObject *, PyObject *); static int TupleSetattro(PyObject *, PyObject *, PyObject *); static PyObject *FunctionGetattro(PyObject *, PyObject *); -static struct PyModuleDef vimmodule; +static struct PyModuleDef mnvmodule; #define PY_CAN_RECURSE @@ -1180,7 +1180,7 @@ static char* PY_UNICODE_GET_UTF8_CHARS(PyObject* str) /////////////////////////////////////////////////////// // Internal function prototypes. -static PyObject *Py3Init_vim(void); +static PyObject *Py3Init_mnv(void); /////////////////////////////////////////////////////// // 1. Python interpreter main program. @@ -1246,9 +1246,9 @@ is_stdin_readable(void) } // Python 3.5 or later will abort inside Py_Initialize() when stdin has -// been closed (i.e. executed by "vim -"). Reconnect stdin to CONIN$. +// been closed (i.e. executed by "mnv -"). Reconnect stdin to CONIN$. // Note that the python DLL is linked to its own stdio DLL which can be -// differ from Vim's stdio. +// differ from MNV's stdio. static void reset_stdin(void) { @@ -1347,7 +1347,7 @@ Python3_Init(void) // This is great if you're reading them from the terminal, but useless // and broken everywhere else (such as in log files, or text editors). // Opt out, forcefully. - vim_setenv((char_u*)"PYTHON_COLORS", (char_u*)"0"); + mnv_setenv((char_u*)"PYTHON_COLORS", (char_u*)"0"); init_structs(); @@ -1366,7 +1366,7 @@ Python3_Init(void) Py_SetPythonHome(PYTHON3_HOME); #endif - PyImport_AppendInittab("vim", Py3Init_vim); + PyImport_AppendInittab("mnv", Py3Init_mnv); #if !defined(DYNAMIC_PYTHON3) && defined(MSWIN) hinstPy3 = GetModuleHandle(PYTHON3_DLL); @@ -1406,12 +1406,12 @@ Python3_Init(void) globals = PyModule_GetDict(PyImport_AddModule("__main__")); // Remove the element from sys.path that was added because of our - // argv[0] value in Py3Init_vim(). Previously we used an empty + // argv[0] value in Py3Init_mnv(). Previously we used an empty // string, but depending on the OS we then get an empty entry or // the current directory in sys.path. - // Only after vim has been imported, the element does exist in + // Only after mnv has been imported, the element does exist in // sys.path. - PyRun_SimpleString("import vim; import sys; sys.path = list(filter(lambda x: not x.endswith('must>not&exist'), sys.path))"); + PyRun_SimpleString("import mnv; import sys; sys.path = list(filter(lambda x: not x.endswith('must>not&exist'), sys.path))"); // Without the call to PyEval_SaveThread, thread specific state (such // as the system trace hook), will be lost between invocations of @@ -1462,7 +1462,7 @@ DoPyCommand(const char *cmd, init_range(arg); - Python_Release_Vim(); // leave Vim + Python_Release_MNV(); // leave MNV #if defined(HAVE_LOCALE_H) || defined(X_LOCALE) // Python only works properly when the LC_NUMERIC locale is "C". @@ -1472,7 +1472,7 @@ DoPyCommand(const char *cmd, else { // Need to make a copy, value may change when setting new locale. - saved_locale = (char *)vim_strsave((char_u *)saved_locale); + saved_locale = (char *)mnv_strsave((char_u *)saved_locale); (void)setlocale(LC_NUMERIC, "C"); } #endif @@ -1495,11 +1495,11 @@ DoPyCommand(const char *cmd, if (saved_locale != NULL) { (void)setlocale(LC_NUMERIC, saved_locale); - vim_free(saved_locale); + mnv_free(saved_locale); } #endif - Python_Lock_Vim(); // enter Vim + Python_Lock_MNV(); // enter MNV PythonIO_Flush(); theend: @@ -1526,7 +1526,7 @@ ex_py3(exarg_T *eap) (runner) run_cmd, (void *) eap); } - vim_free(script); + mnv_free(script); } #define BUFFER_SIZE 2048 @@ -1546,7 +1546,7 @@ ex_py3file(exarg_T *eap) p_pyx = 3; // Have to do it like this. PyRun_SimpleFile requires you to pass a - // stdio file pointer, but Vim and the Python DLL are compiled with + // stdio file pointer, but MNV and the Python DLL are compiled with // different options under Windows, meaning that stdio pointers aren't // compatible between the two. Yuk. // @@ -1636,7 +1636,7 @@ OutputSetattro(PyObject *self, PyObject *nameobj, PyObject *val) } /////////////////////////////////////////////////////// -// 3. Implementation of the Vim module for Python +// 3. Implementation of the MNV module for Python // Window type - Implementation functions // -------------------------------------- @@ -2103,7 +2103,7 @@ python3_tabpage_free(tabpage_T *tab) } static PyObject * -Py3Init_vim(void) +Py3Init_mnv(void) { // The special value is removed from sys.path in Python3_Init(). static wchar_t *(argv[2]) = {L"/must>not&exist/foo", NULL}; @@ -2114,23 +2114,23 @@ Py3Init_vim(void) // Set sys.argv[] to avoid a crash in warn(). PySys_SetArgv(1, argv); - if ((vim_module = PyModule_Create(&vimmodule)) == NULL) + if ((mnv_module = PyModule_Create(&mnvmodule)) == NULL) return NULL; - if (populate_module(vim_module)) + if (populate_module(mnv_module)) return NULL; if (init_sys_path()) return NULL; - return vim_module; + return mnv_module; } ////////////////////////////////////////////////////////////////////////// -// 4. Utility functions for handling the interface between Vim and Python. +// 4. Utility functions for handling the interface between MNV and Python. /* - * Convert a Vim line into a Python string. + * Convert a MNV line into a Python string. * All internal newlines are replaced by null characters. * * On errors, the Python exception data is set, and NULL is returned. @@ -2164,7 +2164,7 @@ LineToString(const char *str) result = PyUnicode_Decode(tmp, len, (char *)ENC_OPT, ERRORS_DECODE_ARG); - vim_free(tmp); + mnv_free(tmp); return result; } diff --git a/uvim/src/if_ruby.c b/uvim/src/if_ruby.c index b5b0079ece..796c074664 100644 --- a/uvim/src/if_ruby.c +++ b/uvim/src/if_ruby.c @@ -1,14 +1,14 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * * Ruby interface by Shugo Maeda * with improvements by SegPhault (Ryan Paul) * with improvements by Jon Maken * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ #include "protodef.h" @@ -66,9 +66,9 @@ # define rb_num2long rb_num2long_stub # define rb_int2big rb_int2big_stub -# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG +# if RUBY_VERSION >= 30 || MNV_SIZEOF_INT < MNV_SIZEOF_LONG // Ruby 1.9 defines a number of static functions which use rb_fix2int and -// rb_num2int if VIM_SIZEOF_INT < VIM_SIZEOF_LONG (64bit) +// rb_num2int if MNV_SIZEOF_INT < MNV_SIZEOF_LONG (64bit) # define rb_fix2int rb_fix2int_stub # define rb_num2int rb_num2int_stub # endif @@ -191,13 +191,13 @@ # undef FALSE #endif -#include "vim.h" +#include "mnv.h" #include "version.h" #ifdef DYNAMIC_RUBY -# ifdef MSWIN // must come after including vim.h, where it is defined +# ifdef MSWIN // must come after including mnv.h, where it is defined # define RUBY_PROC FARPROC -# define load_dll vimLoadLib +# define load_dll mnvLoadLib # define symbol_from_dll GetProcAddress # define close_dll FreeLibrary # define load_dll_error GetWin32Error @@ -216,17 +216,17 @@ static int ruby_initialized = 0; static void *ruby_stack_start; static VALUE objtbl; -static VALUE mVIM; +static VALUE mMNV; static VALUE cBuffer; -static VALUE cVimWindow; +static VALUE cMNVWindow; static VALUE eDeletedBufferError; static VALUE eDeletedWindowError; static int ensure_ruby_initialized(void); static void error_print(int); static void ruby_io_init(void); -static void ruby_vim_init(void); -static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); +static void ruby_mnv_init(void); +static int ruby_convert_to_mnv_value(VALUE val, typval_T *rettv); #if defined(__ia64) && !defined(ruby_init_stack) # define ruby_init_stack(addr) ruby_init_stack((addr), rb_ia64_bsp()) @@ -293,7 +293,7 @@ static int ruby_convert_to_vim_value(VALUE val, typval_T *rettv); # undef rb_intern # define rb_intern dll_rb_intern -# if VIM_SIZEOF_INT < VIM_SIZEOF_LONG // 64 bits only +# if MNV_SIZEOF_INT < MNV_SIZEOF_LONG // 64 bits only # if RUBY_VERSION < 30 # define rb_num2uint dll_rb_num2uint # endif @@ -420,7 +420,7 @@ static VALUE (*dll_rb_hash_new) (void); static VALUE (*dll_rb_inspect) (VALUE); static VALUE (*dll_rb_int2inum) (long); static ID (*dll_rb_intern) (const char*); -# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG +# if RUBY_VERSION >= 30 || MNV_SIZEOF_INT < MNV_SIZEOF_LONG static long (*dll_rb_fix2int) (VALUE); static long (*dll_rb_num2int) (VALUE); static unsigned long (*dll_rb_num2uint) (VALUE); @@ -526,7 +526,7 @@ rb_int2big_stub(SIGNED_VALUE x) { return dll_rb_int2big(x); } -# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG +# if RUBY_VERSION >= 30 || MNV_SIZEOF_INT < MNV_SIZEOF_LONG long rb_fix2int_stub(VALUE x) { @@ -685,7 +685,7 @@ static struct {"rb_inspect", (RUBY_PROC*)&dll_rb_inspect}, {"rb_int2inum", (RUBY_PROC*)&dll_rb_int2inum}, {"rb_intern", (RUBY_PROC*)&dll_rb_intern}, -# if RUBY_VERSION >= 30 || VIM_SIZEOF_INT < VIM_SIZEOF_LONG +# if RUBY_VERSION >= 30 || MNV_SIZEOF_INT < MNV_SIZEOF_LONG {"rb_fix2int", (RUBY_PROC*)&dll_rb_fix2int}, {"rb_num2int", (RUBY_PROC*)&dll_rb_num2int}, {"rb_num2uint", (RUBY_PROC*)&dll_rb_num2uint}, @@ -828,16 +828,16 @@ ex_ruby(exarg_T *eap) if (state) error_print(state); } - vim_free(script); + mnv_free(script); } /* * In Ruby 1.9 or later, ruby String object has encoding. - * conversion buffer string of vim to ruby String object using - * VIM encoding option. + * conversion buffer string of mnv to ruby String object using + * MNV encoding option. */ static VALUE -vim_str2rb_enc_str(const char *s) +mnv_str2rb_enc_str(const char *s) { long lval; char_u *sval; @@ -846,7 +846,7 @@ vim_str2rb_enc_str(const char *s) if (get_option_value((char_u *)"enc", &lval, &sval, NULL, 0) == gov_string) { enc = rb_enc_find((char *)sval); - vim_free(sval); + mnv_free(sval); if (enc) return rb_enc_str_new(s, (long)strlen(s), enc); } @@ -864,7 +864,7 @@ eval_enc_string_protect(const char *str, int *state) if (get_option_value((char_u *)"enc", &lval, &sval, NULL, 0) == gov_string) { enc = rb_enc_find((char *)sval); - vim_free(sval); + mnv_free(sval); if (enc) { v = rb_sprintf("#-*- coding:%s -*-\n%s", rb_enc_name(enc), str); @@ -892,7 +892,7 @@ ex_rubydo(exarg_T *eap) if (i > curbuf->b_ml.ml_line_count) break; - line = vim_str2rb_enc_str((char *)ml_get(i)); + line = mnv_str2rb_enc_str((char *)ml_get(i)); rb_lastline_set(line); eval_enc_string_protect((char *) eap->arg, &state); if (state) @@ -975,7 +975,7 @@ ensure_ruby_initialized(void) #ifdef MSWIN // suggested by Ariya Mizutani int argc = 1; - char *argv[] = {"gvim.exe"}; + char *argv[] = {"gmnv.exe"}; char **argvp = argv; ruby_sysinit(&argc, &argvp); #endif @@ -985,12 +985,12 @@ ensure_ruby_initialized(void) } { int dummy_argc = 2; - char *dummy_argv[] = {"vim-ruby", "-e_=0"}; + char *dummy_argv[] = {"mnv-ruby", "-e_=0"}; ruby_options(dummy_argc, dummy_argv); } - ruby_script("vim-ruby"); + ruby_script("mnv-ruby"); ruby_io_init(); - ruby_vim_init(); + ruby_mnv_init(); ruby_initialized = 1; } #ifdef DYNAMIC_RUBY @@ -1057,7 +1057,7 @@ error_print(int state) char *p; epath = rb_class_path(eclass); - vim_snprintf(buff, BUFSIZ, "%s: %s", + mnv_snprintf(buff, BUFSIZ, "%s: %s", RSTRING_PTR(epath), RSTRING_PTR(einfo)); p = strchr(buff, '\n'); if (p) *p = '\0'; @@ -1076,14 +1076,14 @@ error_print(int state) #endif break; default: - vim_snprintf(buff, BUFSIZ, _(e_unknown_longjmp_status_nr), state); + mnv_snprintf(buff, BUFSIZ, _(e_unknown_longjmp_status_nr), state); emsg(buff); break; } } static VALUE -vim_message(VALUE self UNUSED, VALUE str) +mnv_message(VALUE self UNUSED, VALUE str) { char *buff, *p; @@ -1105,7 +1105,7 @@ vim_message(VALUE self UNUSED, VALUE str) } static VALUE -vim_set_option(VALUE self UNUSED, VALUE str) +mnv_set_option(VALUE self UNUSED, VALUE str) { do_set((char_u *)StringValuePtr(str), 0); update_screen(UPD_NOT_VALID); @@ -1113,7 +1113,7 @@ vim_set_option(VALUE self UNUSED, VALUE str) } static VALUE -vim_command(VALUE self UNUSED, VALUE str) +mnv_command(VALUE self UNUSED, VALUE str) { do_cmdline_cmd((char_u *)StringValuePtr(str)); return Qnil; @@ -1121,7 +1121,7 @@ vim_command(VALUE self UNUSED, VALUE str) #ifdef FEAT_EVAL static VALUE -vim_to_ruby(typval_T *tv) +mnv_to_ruby(typval_T *tv) { VALUE result = Qnil; @@ -1148,7 +1148,7 @@ vim_to_ruby(typval_T *tv) if (list != NULL) { FOR_ALL_LIST_ITEMS(list, curr) - rb_ary_push(result, vim_to_ruby(&curr->li_tv)); + rb_ary_push(result, mnv_to_ruby(&curr->li_tv)); } } else if (tv->v_type == VAR_DICT) @@ -1170,7 +1170,7 @@ vim_to_ruby(typval_T *tv) di = dict_lookup(hi); rb_hash_aset(result, rb_str_new2((char *)hi->hi_key), - vim_to_ruby(&di->di_tv)); + mnv_to_ruby(&di->di_tv)); } } } @@ -1194,7 +1194,7 @@ vim_to_ruby(typval_T *tv) #endif static VALUE -vim_evaluate(VALUE self UNUSED, VALUE str) +mnv_evaluate(VALUE self UNUSED, VALUE str) { #ifdef FEAT_EVAL typval_T *tv; @@ -1203,7 +1203,7 @@ vim_evaluate(VALUE self UNUSED, VALUE str) tv = eval_expr((char_u *)StringValuePtr(str), NULL); if (tv == NULL) return Qnil; - result = vim_to_ruby(tv); + result = mnv_to_ruby(tv); free_tv(tv); @@ -1217,7 +1217,7 @@ vim_evaluate(VALUE self UNUSED, VALUE str) static size_t buffer_dsize(const void *buf); static const rb_data_type_t buffer_type = { - "vim_buffer", + "mnv_buffer", {0, 0, buffer_dsize, # if RUBY_VERSION >= 27 0, {0} @@ -1274,7 +1274,7 @@ get_buf(VALUE obj) } static VALUE -vim_blob(VALUE self UNUSED, VALUE str) +mnv_blob(VALUE self UNUSED, VALUE str) { VALUE result = rb_str_new("0z", 2); char buf[4]; @@ -1366,7 +1366,7 @@ get_buffer_line(buf_T *buf, linenr_T n) { if (n <= 0 || n > buf->b_ml.ml_line_count) rb_raise(rb_eIndexError, "line number %ld out of range", (long)n); - return vim_str2rb_enc_str((char *)ml_get_buf(buf, n, FALSE)); + return mnv_str2rb_enc_str((char *)ml_get_buf(buf, n, FALSE)); } static VALUE @@ -1512,7 +1512,7 @@ buffer_append(VALUE self, VALUE num, VALUE str) static size_t window_dsize(const void *buf); static const rb_data_type_t window_type = { - "vim_window", + "mnv_window", {0, 0, window_dsize, # if RUBY_VERSION >= 27 0, {0} @@ -1543,9 +1543,9 @@ window_new(win_T *win) else { #ifdef USE_TYPEDDATA - VALUE obj = TypedData_Wrap_Struct(cVimWindow, &window_type, win); + VALUE obj = TypedData_Wrap_Struct(cMNVWindow, &window_type, win); #else - VALUE obj = Data_Wrap_Struct(cVimWindow, 0, 0, win); + VALUE obj = Data_Wrap_Struct(cMNVWindow, 0, 0, win); #endif win->w_ruby_ref = (void *) obj; rb_hash_aset(objtbl, rb_obj_id(obj), obj); @@ -1735,43 +1735,43 @@ ruby_io_init(void) rb_stdout = rb_obj_alloc(rb_cObject); rb_stderr = rb_obj_alloc(rb_cObject); - rb_define_singleton_method(rb_stdout, "write", (void*)vim_message, 1); + rb_define_singleton_method(rb_stdout, "write", (void*)mnv_message, 1); rb_define_singleton_method(rb_stdout, "flush", (void*)f_nop, 0); - rb_define_singleton_method(rb_stderr, "write", (void*)vim_message, 1); + rb_define_singleton_method(rb_stderr, "write", (void*)mnv_message, 1); rb_define_singleton_method(rb_stderr, "flush", (void*)f_nop, 0); rb_define_global_function("p", f_p, -1); } static void -ruby_vim_init(void) +ruby_mnv_init(void) { objtbl = rb_hash_new(); rb_global_variable(&objtbl); - // The Vim module used to be called "VIM", but "Vim" is better. Make an - // alias "VIM" for backwards compatibility. - mVIM = rb_define_module("Vim"); - rb_define_const(rb_cObject, "VIM", mVIM); - rb_define_const(mVIM, "VERSION_MAJOR", INT2NUM(VIM_VERSION_MAJOR)); - rb_define_const(mVIM, "VERSION_MINOR", INT2NUM(VIM_VERSION_MINOR)); - rb_define_const(mVIM, "VERSION_BUILD", INT2NUM(VIM_VERSION_BUILD)); - rb_define_const(mVIM, "VERSION_PATCHLEVEL", INT2NUM(VIM_VERSION_PATCHLEVEL)); - rb_define_const(mVIM, "VERSION_SHORT", rb_str_new2(VIM_VERSION_SHORT)); - rb_define_const(mVIM, "VERSION_MEDIUM", rb_str_new2(VIM_VERSION_MEDIUM)); - rb_define_const(mVIM, "VERSION_LONG", rb_str_new2(VIM_VERSION_LONG)); - rb_define_const(mVIM, "VERSION_LONG_DATE", rb_str_new2(VIM_VERSION_LONG_DATE)); - rb_define_module_function(mVIM, "message", vim_message, 1); - rb_define_module_function(mVIM, "set_option", vim_set_option, 1); - rb_define_module_function(mVIM, "command", vim_command, 1); - rb_define_module_function(mVIM, "evaluate", vim_evaluate, 1); - rb_define_module_function(mVIM, "blob", vim_blob, 1); - - eDeletedBufferError = rb_define_class_under(mVIM, "DeletedBufferError", + // The MNV module used to be called "MNV", but "MNV" is better. Make an + // alias "MNV" for backwards compatibility. + mMNV = rb_define_module("MNV"); + rb_define_const(rb_cObject, "MNV", mMNV); + rb_define_const(mMNV, "VERSION_MAJOR", INT2NUM(MNV_VERSION_MAJOR)); + rb_define_const(mMNV, "VERSION_MINOR", INT2NUM(MNV_VERSION_MINOR)); + rb_define_const(mMNV, "VERSION_BUILD", INT2NUM(MNV_VERSION_BUILD)); + rb_define_const(mMNV, "VERSION_PATCHLEVEL", INT2NUM(MNV_VERSION_PATCHLEVEL)); + rb_define_const(mMNV, "VERSION_SHORT", rb_str_new2(MNV_VERSION_SHORT)); + rb_define_const(mMNV, "VERSION_MEDIUM", rb_str_new2(MNV_VERSION_MEDIUM)); + rb_define_const(mMNV, "VERSION_LONG", rb_str_new2(MNV_VERSION_LONG)); + rb_define_const(mMNV, "VERSION_LONG_DATE", rb_str_new2(MNV_VERSION_LONG_DATE)); + rb_define_module_function(mMNV, "message", mnv_message, 1); + rb_define_module_function(mMNV, "set_option", mnv_set_option, 1); + rb_define_module_function(mMNV, "command", mnv_command, 1); + rb_define_module_function(mMNV, "evaluate", mnv_evaluate, 1); + rb_define_module_function(mMNV, "blob", mnv_blob, 1); + + eDeletedBufferError = rb_define_class_under(mMNV, "DeletedBufferError", rb_eStandardError); - eDeletedWindowError = rb_define_class_under(mVIM, "DeletedWindowError", + eDeletedWindowError = rb_define_class_under(mMNV, "DeletedWindowError", rb_eStandardError); - cBuffer = rb_define_class_under(mVIM, "Buffer", rb_cObject); + cBuffer = rb_define_class_under(mMNV, "Buffer", rb_cObject); rb_define_singleton_method(cBuffer, "current", (void*)buffer_s_current, 0); rb_define_singleton_method(cBuffer, "count", (void*)buffer_s_count, 0); rb_define_singleton_method(cBuffer, "[]", (void*)buffer_s_aref, 1); @@ -1791,24 +1791,24 @@ ruby_vim_init(void) rb_define_method(cBuffer, "line=", (void*)set_current_line, 1); - cVimWindow = rb_define_class_under(mVIM, "Window", rb_cObject); - rb_define_singleton_method(cVimWindow, "current", (void*)window_s_current, 0); - rb_define_singleton_method(cVimWindow, "count", (void*)window_s_count, 0); - rb_define_singleton_method(cVimWindow, "[]", (void*)window_s_aref, 1); - rb_define_method(cVimWindow, "buffer", (void*)window_buffer, 0); - rb_define_method(cVimWindow, "height", (void*)window_height, 0); - rb_define_method(cVimWindow, "height=", (void*)window_set_height, 1); - rb_define_method(cVimWindow, "width", (void*)window_width, 0); - rb_define_method(cVimWindow, "width=", (void*)window_set_width, 1); - rb_define_method(cVimWindow, "cursor", (void*)window_cursor, 0); - rb_define_method(cVimWindow, "cursor=", (void*)window_set_cursor, 1); + cMNVWindow = rb_define_class_under(mMNV, "Window", rb_cObject); + rb_define_singleton_method(cMNVWindow, "current", (void*)window_s_current, 0); + rb_define_singleton_method(cMNVWindow, "count", (void*)window_s_count, 0); + rb_define_singleton_method(cMNVWindow, "[]", (void*)window_s_aref, 1); + rb_define_method(cMNVWindow, "buffer", (void*)window_buffer, 0); + rb_define_method(cMNVWindow, "height", (void*)window_height, 0); + rb_define_method(cMNVWindow, "height=", (void*)window_set_height, 1); + rb_define_method(cMNVWindow, "width", (void*)window_width, 0); + rb_define_method(cMNVWindow, "width=", (void*)window_set_width, 1); + rb_define_method(cMNVWindow, "cursor", (void*)window_cursor, 0); + rb_define_method(cMNVWindow, "cursor=", (void*)window_set_cursor, 1); rb_define_virtual_variable("$curbuf", buffer_s_current_getter, 0); rb_define_virtual_variable("$curwin", window_s_current_getter, 0); } void -vim_ruby_init(void *stack_start) +mnv_ruby_init(void *stack_start) { // should get machine stack start address early in main function ruby_stack_start = stack_start; @@ -1821,7 +1821,7 @@ convert_hash2dict(VALUE key, VALUE val, VALUE arg) dictitem_T *di; di = dictitem_alloc((char_u *)RSTRING_PTR(rb_obj_as_string(key))); - if (di == NULL || ruby_convert_to_vim_value(val, &di->di_tv) != OK + if (di == NULL || ruby_convert_to_mnv_value(val, &di->di_tv) != OK || dict_add(d, di) != OK) { d->dv_hashtab.ht_flags |= HTFLAGS_ERROR; @@ -1831,7 +1831,7 @@ convert_hash2dict(VALUE key, VALUE val, VALUE arg) } static int -ruby_convert_to_vim_value(VALUE val, typval_T *rettv) +ruby_convert_to_mnv_value(VALUE val, typval_T *rettv) { switch (TYPE(val)) { @@ -1864,7 +1864,7 @@ ruby_convert_to_vim_value(VALUE val, typval_T *rettv) VALUE str = (VALUE)RSTRING(val); rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strnsave((char_u *)RSTRING_PTR(str), + rettv->vval.v_string = mnv_strnsave((char_u *)RSTRING_PTR(str), RSTRING_LEN(str)); } break; @@ -1880,7 +1880,7 @@ ruby_convert_to_vim_value(VALUE val, typval_T *rettv) for (i = 0; i < RARRAY_LEN(val); ++i) { - if (ruby_convert_to_vim_value((VALUE)RARRAY_PTR(val)[i], + if (ruby_convert_to_mnv_value((VALUE)RARRAY_PTR(val)[i], &v) != OK) { list_unref(l); @@ -1933,7 +1933,7 @@ do_rubyeval(char_u *str, typval_T *rettv) if (state) error_print(state); else - retval = ruby_convert_to_vim_value(obj, rettv); + retval = ruby_convert_to_mnv_value(obj, rettv); } if (retval == FAIL) { diff --git a/uvim/src/if_tcl.c b/uvim/src/if_tcl.c index 3aebcbd0fd..451ff13ae4 100644 --- a/uvim/src/if_tcl.c +++ b/uvim/src/if_tcl.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -13,23 +13,23 @@ * Requires Tcl 8.0 or higher. * * Variables: - * ::vim::current(buffer) # Name of buffer command for current buffer. - * ::vim::current(window) # Name of window command for current window. - * ::vim::range(start) # Start of current range (line number). - * ::vim::range(end) # End of current range (line number). - * ::vim::lbase # Start of line/column numbers (1 or 0). + * ::mnv::current(buffer) # Name of buffer command for current buffer. + * ::mnv::current(window) # Name of window command for current window. + * ::mnv::range(start) # Start of current range (line number). + * ::mnv::range(end) # End of current range (line number). + * ::mnv::lbase # Start of line/column numbers (1 or 0). * * Commands: - * ::vim::command {cmd} # Execute ex command {cmd}. - * ::vim::option {opt} [val] # Get/Set option {opt}. - * ::vim::expr {expr} # Evaluate {expr} using vim's evaluator. - * ::vim::beep # Guess. + * ::mnv::command {cmd} # Execute ex command {cmd}. + * ::mnv::option {opt} [val] # Get/Set option {opt}. + * ::mnv::expr {expr} # Evaluate {expr} using mnv's evaluator. + * ::mnv::beep # Guess. * - * set buf [::vim::buffer {n}] # Create Tcl command for buffer N. - * set bl [::vim::buffer list] # Get list of Tcl commands of all buffers. - * ::vim::buffer exists {n} # True if buffer {n} exists. + * set buf [::mnv::buffer {n}] # Create Tcl command for buffer N. + * set bl [::mnv::buffer list] # Get list of Tcl commands of all buffers. + * ::mnv::buffer exists {n} # True if buffer {n} exists. * - * set wl [::vim::window list] # Get list of Tcl commands of all windows. + * set wl [::mnv::window list] # Get list of Tcl commands of all windows. * * set n [$win height] # Report window height. * $win height {n} # Set window height to {n}. @@ -37,9 +37,9 @@ * $win cursor {row} {col} # Set cursor position. * $win cursor pos # Set cursor position from array var "pos" * $win delcmd {cmd} # Register callback command for closed window. - * $win option {opt} [val] # Get/Set vim option in context of $win. + * $win option {opt} [val] # Get/Set mnv option in context of $win. * $win command {cmd} # Execute ex command in context of $win. - * $win expr {expr} # Evaluate vim expression in context of $win. + * $win expr {expr} # Evaluate mnv expression in context of $win. * set buf [$win buffer] # Create Tcl command for window's buffer. * * $buf name # Reports file name in buffer. @@ -53,9 +53,9 @@ * $buf set {n} {l} # Set line {n} to string {l}. * $buf set {n} {m} {L} # Set lines {n} through {m} from list {L}. * # Delete/inserts lines as appropriate. - * $buf option {opt} [val] # Get/Set vim option in context of $buf. + * $buf option {opt} [val] # Get/Set mnv option in context of $buf. * $buf command {cmd} # Execute ex command in context of $buf - * $buf expr {cmd} # Evaluate vim expression in context of $buf. + * $buf expr {cmd} # Evaluate mnv expression in context of $buf. * array set pos [$buf mark {m}] # Get position of mark. * $buf append {n} {str} # Append string {str} to buffer,after line {n}. * $buf insert {n} {str} # Insert string {str} in buffer as line {n}. @@ -63,10 +63,10 @@ * set wl [$buf windows] # Get list of Tcl commands for all windows of * # this buffer. TODO: - * ::vim::buffer new # create new buffer + Tcl command + * ::mnv::buffer new # create new buffer + Tcl command */ -#include "vim.h" +#include "mnv.h" #undef EXTERN // tcl.h defines it too #ifdef DYNAMIC_TCL @@ -87,24 +87,24 @@ typedef struct static tcl_info tclinfo = { NULL, 0, 0, 0, 0, NULL, NULL }; -#define VAR_RANGE1 "::vim::range(start)" -#define VAR_RANGE2 "::vim::range(begin)" -#define VAR_RANGE3 "::vim::range(end)" -#define VAR_CURBUF "::vim::current(buffer)" -#define VAR_CURWIN "::vim::current(window)" -#define VAR_LBASE "::vim::lbase" +#define VAR_RANGE1 "::mnv::range(start)" +#define VAR_RANGE2 "::mnv::range(begin)" +#define VAR_RANGE3 "::mnv::range(end)" +#define VAR_CURBUF "::mnv::current(buffer)" +#define VAR_CURWIN "::mnv::current(window)" +#define VAR_LBASE "::mnv::lbase" #define VAR_CURLINE "line" #define VAR_CURLNUM "lnum" #define VARNAME_SIZE 64 #define row2tcl(x) ((x) - (tclinfo.lbase==0)) -#define row2vim(x) ((x) + (tclinfo.lbase==0)) +#define row2mnv(x) ((x) + (tclinfo.lbase==0)) #define col2tcl(x) ((x) + (tclinfo.lbase!=0)) -#define col2vim(x) ((x) - (tclinfo.lbase!=0)) +#define col2mnv(x) ((x) - (tclinfo.lbase!=0)) -#define VIMOUT ((ClientData)1) -#define VIMERR ((ClientData)2) +#define MNVOUT ((ClientData)1) +#define MNVERR ((ClientData)2) // This appears to be new in Tcl 8.4. #ifndef CONST84 @@ -112,7 +112,7 @@ static tcl_info tclinfo = { NULL, 0, 0, 0, 0, NULL, NULL }; #endif /* - * List of Tcl interpreters who reference a vim window or buffer. + * List of Tcl interpreters who reference a mnv window or buffer. * Each buffer and window has its own list in the w_tcl_ref or b_tcl_ref * struct member. We need this because Tcl can create sub-interpreters with * the "interp" command, and each interpreter can reference all windows and @@ -125,19 +125,19 @@ struct ref Tcl_Interp *interp; Tcl_Command cmd; // Tcl command that represents this object Tcl_Obj *delcmd; // Tcl command to call when object is being del. - void *vimobj; // Vim window or buffer (win_T* or buf_T*) + void *mnvobj; // MNV window or buffer (win_T* or buf_T*) }; static char * tclgetbuffer _ANSI_ARGS_((Tcl_Interp *interp, buf_T *buf)); static char * tclgetwindow _ANSI_ARGS_((Tcl_Interp *interp, win_T *win)); -static int tclsetdelcmd _ANSI_ARGS_((Tcl_Interp *interp, struct ref *reflist, void *vimobj, Tcl_Obj *delcmd)); +static int tclsetdelcmd _ANSI_ARGS_((Tcl_Interp *interp, struct ref *reflist, void *mnvobj, Tcl_Obj *delcmd)); static int tclgetlinenum _ANSI_ARGS_ ((Tcl_Interp *interp, Tcl_Obj *obj, int *valueP, buf_T *buf)); static win_T *tclfindwin _ANSI_ARGS_ ((buf_T *buf)); static int tcldoexcommand _ANSI_ARGS_ ((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int objn)); static int tclsetoption _ANSI_ARGS_ ((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int objn)); -static int tclvimexpr _ANSI_ARGS_ ((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int objn)); +static int tclmnvexpr _ANSI_ARGS_ ((Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], int objn)); static void tcldelthisinterp _ANSI_ARGS_ ((void)); -static int vimerror _ANSI_ARGS_((Tcl_Interp *interp)); +static int mnverror _ANSI_ARGS_((Tcl_Interp *interp)); static void tclmsg _ANSI_ARGS_((char *text)); static void tclerrmsg _ANSI_ARGS_((char *text)); static void tclupdatevars _ANSI_ARGS_((void)); @@ -162,7 +162,7 @@ typedef int HANDLE; # ifdef MSWIN # define TCL_PROC FARPROC -# define load_dll vimLoadLib +# define load_dll mnvLoadLib # define symbol_from_dll GetProcAddress # define close_dll FreeLibrary # define load_dll_error GetWin32Error @@ -240,7 +240,7 @@ static char *find_executable_arg = NULL; #endif void -vim_tcl_init(char *arg) +mnv_tcl_init(char *arg) { #ifdef DYNAMIC_TCL find_executable_arg = arg; @@ -287,7 +287,7 @@ tcl_enabled(int verbose) * Called once when exiting. */ void -vim_tcl_finalize(void) +mnv_tcl_finalize(void) { # ifdef DYNAMIC_TCL if (stubs_initialized) @@ -315,7 +315,7 @@ tcl_end(void) * be run. Since the interpreter is now marked as deleted, an error * will be returned -- typically "attempt to call eval in deleted * interpreter". Hopefully, at this point, checks for TCL_ERROR take - * place and control percolates back up to Vim -- but with this new error + * place and control percolates back up to MNV -- but with this new error * string in the interpreter's result value. Therefore it would be * useless for this routine to return the exit code via Tcl_SetResult(). */ @@ -346,7 +346,7 @@ exitcmd( } /* - * "::vim::beep" - what Vi[m] does best :-) + * "::mnv::beep" - what Vi[m] does best :-) */ static int beepcmd( @@ -360,15 +360,15 @@ beepcmd( Tcl_WrongNumArgs(interp, 1, objv, NULL); return TCL_ERROR; } - vim_beep(BO_LANG); + mnv_beep(BO_LANG); return TCL_OK; } /* - * "::vim::buffer list" - create a list of buffer commands. - * "::vim::buffer {N}" - create buffer command for buffer N. - * "::vim::buffer exists {N}" - test if buffer N exists. - * "::vim::buffer new" - create a new buffer (not implemented) + * "::mnv::buffer list" - create a list of buffer commands. + * "::mnv::buffer {N}" - create buffer command for buffer N. + * "::mnv::buffer exists {N}" - test if buffer N exists. + * "::mnv::buffer new" - create a new buffer (not implemented) */ static int buffercmd( @@ -464,7 +464,7 @@ buffercmd( } /* - * "::vim::window list" - create list of window commands. + * "::mnv::window list" - create list of window commands. */ static int windowcmd( @@ -545,7 +545,7 @@ bufselfcmd( if (err != TCL_OK) return err; - buf = (buf_T *)((struct ref *)ref)->vimobj; + buf = (buf_T *)((struct ref *)ref)->mnvobj; savebuf = curbuf; curbuf = buf; savewin = curwin; curwin = tclfindwin(buf); flags = 0; @@ -564,7 +564,7 @@ bufselfcmd( break; case BUF_EXPR: - err = tclvimexpr(interp, objc, objv, 2); + err = tclmnvexpr(interp, objc, objv, 2); break; case BUF_NAME: @@ -804,7 +804,7 @@ bufselfcmd( for (i = 0; i < n; i++) { ml_delete((linenr_T)val1); - err = vimerror(interp); + err = mnverror(interp); if (err != TCL_OK) break; } @@ -831,7 +831,7 @@ bufselfcmd( err = TCL_ERROR; break; } - err = vimerror(interp); + err = mnverror(interp); if (err != TCL_OK) break; if (pos->lnum <= 0) @@ -980,7 +980,7 @@ winselfcmd( if (err != TCL_OK) return TCL_ERROR; - win = (win_T *)((struct ref *)ref)->vimobj; + win = (win_T *)((struct ref *)ref)->mnvobj; savewin = curwin; curwin = win; savebuf = curbuf; curbuf = win->w_buffer; flags = 0; @@ -998,7 +998,7 @@ winselfcmd( break; case WIN_EXPR: - err = tclvimexpr(interp, objc, objv, 2); + err = tclmnvexpr(interp, objc, objv, 2); break; case WIN_HEIGHT: @@ -1011,7 +1011,7 @@ winselfcmd( need_mouse_correct = TRUE; #endif win_setheight(val1); - err = vimerror(interp); + err = mnverror(interp); if (err != TCL_OK) break; } @@ -1102,7 +1102,7 @@ winselfcmd( } // TODO: should check column win->w_cursor.lnum = val1; - win->w_cursor.col = col2vim(val2); + win->w_cursor.col = col2mnv(val2); win->w_set_curswant = TRUE; flags |= FL_UPDATE_SCREEN; break; @@ -1156,7 +1156,7 @@ exprcmd( int objc, Tcl_Obj *CONST objv[]) { - return tclvimexpr(interp, objc, objv, 1); + return tclmnvexpr(interp, objc, objv, 1); } ///////////////////////////////////////////////////////////////////////////// @@ -1164,7 +1164,7 @@ exprcmd( //////////////////////////////////////////////////////////////////////////// /* - * Get a line number from 'obj' and convert it to vim's range. + * Get a line number from 'obj' and convert it to mnv's range. */ static int tclgetlinenum( @@ -1206,7 +1206,7 @@ tclgetlinenum( err = Tcl_GetIntFromObj(interp, obj, &i); if (err != TCL_OK) return err; - i = row2vim(i); + i = row2mnv(i); if (i < 1 || i > buf->b_ml.ml_line_count) { Tcl_SetResult(interp, _("line number out of range"), TCL_STATIC); @@ -1233,7 +1233,7 @@ tclfindwin(buf_T *buf) } /* - * Do-it-all function for "::vim::command", "$buf command" and "$win command". + * Do-it-all function for "::mnv::command", "$buf command" and "$win command". */ static int tcldoexcommand( @@ -1279,7 +1279,7 @@ tcldoexcommand( do_cmdline_cmd((char_u *)arg); if (flag) --emsg_off; - err = vimerror(interp); + err = mnverror(interp); // If the ex command created a new Tcl interpreter, remove it if (tclinfo.interp) @@ -1291,7 +1291,7 @@ tcldoexcommand( } /* - * Do-it-all function for "::vim::option", "$buf option" and "$win option". + * Do-it-all function for "::mnv::option", "$buf option" and "$win option". */ static int tclsetoption( @@ -1313,7 +1313,7 @@ tclsetoption( nobjs = objc - objn; if (nobjs != 1 && nobjs != 2) { - Tcl_WrongNumArgs(interp, objn, objv, "vimOption ?value?"); + Tcl_WrongNumArgs(interp, objn, objv, "mnvOption ?value?"); return TCL_ERROR; } @@ -1325,7 +1325,7 @@ tclsetoption( { case gov_string: Tcl_SetResult(interp, (char *)sval, TCL_VOLATILE); - vim_free(sval); + mnv_free(sval); break; case gov_bool: case gov_number: @@ -1333,7 +1333,7 @@ tclsetoption( Tcl_SetObjResult(interp, resobj); break; default: - Tcl_SetResult(interp, _("unknown vimOption"), TCL_STATIC); + Tcl_SetResult(interp, _("unknown mnvOption"), TCL_STATIC); return TCL_ERROR; } if (nobjs == 2) @@ -1368,17 +1368,17 @@ tclsetoption( if (err == TCL_OK) { set_option_value_give_err(option, lval, sval, OPT_LOCAL); - err = vimerror(interp); + err = mnverror(interp); } } return err; } /* - * Do-it-all function for "::vim::expr", "$buf expr" and "$win expr". + * Do-it-all function for "::mnv::expr", "$buf expr" and "$win expr". */ static int -tclvimexpr( +tclmnvexpr( Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], @@ -1391,7 +1391,7 @@ tclvimexpr( if (objc - objn != 1) { - Tcl_WrongNumArgs(interp, objn, objv, "vimExpr"); + Tcl_WrongNumArgs(interp, objn, objv, "mnvExpr"); return TCL_ERROR; } @@ -1403,9 +1403,9 @@ tclvimexpr( else { Tcl_SetResult(interp, str, TCL_VOLATILE); - vim_free(str); + mnv_free(str); } - err = vimerror(interp); + err = mnverror(interp); #else Tcl_SetResult(interp, _("expressions disabled at compile time"), TCL_STATIC); err = TCL_ERROR; @@ -1415,10 +1415,10 @@ tclvimexpr( } /* - * Check for internal vim errors. + * Check for internal mnv errors. */ static int -vimerror(Tcl_Interp *interp) +mnverror(Tcl_Interp *interp) { if (got_int) { @@ -1427,7 +1427,7 @@ vimerror(Tcl_Interp *interp) } else if (did_emsg) { - Tcl_SetResult(interp, _("Vim error"), TCL_STATIC); + Tcl_SetResult(interp, _("MNV error"), TCL_STATIC); return TCL_ERROR; } return TCL_OK; @@ -1439,7 +1439,7 @@ vimerror(Tcl_Interp *interp) * tclgetref() - find/create Tcl command for a win_T* or buf_T* object * tclgetwindow() - window frontend for tclgetref() * tclgetbuffer() - buffer frontend for tclgetref() - * tclsetdelcmd() - add Tcl callback command to a vim object + * tclsetdelcmd() - add Tcl callback command to a mnv object */ static void delref(ClientData cref) @@ -1460,7 +1460,7 @@ tclgetref( void **refstartP, // ptr to w_tcl_ref/b_tcl-ref member of // win_T/buf_T struct char *prefix, // "win" or "buf" - void *vimobj, // win_T* or buf_T* + void *mnvobj, // win_T* or buf_T* Tcl_ObjCmdProc *proc) // winselfcmd or bufselfcmd { struct ref *ref, *unused = NULL; @@ -1484,7 +1484,7 @@ tclgetref( } if (ref) - vim_snprintf(name, sizeof(name), "::vim::%s", + mnv_snprintf(name, sizeof(name), "::mnv::%s", Tcl_GetCommandName(interp, ref->cmd)); else { @@ -1499,8 +1499,8 @@ tclgetref( } // This might break on some exotic systems... - vim_snprintf(name, sizeof(name), "::vim::%s_%lx", - prefix, (unsigned long)vimobj); + mnv_snprintf(name, sizeof(name), "::mnv::%s_%lx", + prefix, (unsigned long)mnvobj); cmd = Tcl_CreateObjCommand(interp, name, proc, (ClientData)ref, (Tcl_CmdDeleteProc *)delref); if (!cmd) @@ -1509,7 +1509,7 @@ tclgetref( ref->interp = interp; ref->cmd = cmd; ref->delcmd = NULL; - ref->vimobj = vimobj; + ref->mnvobj = mnvobj; } return name; } @@ -1530,7 +1530,7 @@ tclgetbuffer(Tcl_Interp *interp, buf_T *buf) tclsetdelcmd( Tcl_Interp *interp, struct ref *reflist, - void *vimobj, + void *mnvobj, Tcl_Obj *delcmd) { if (reflist == &refsdeleted) @@ -1541,7 +1541,7 @@ tclsetdelcmd( while (reflist != NULL) { - if (reflist->interp == interp && reflist->vimobj == vimobj) + if (reflist->interp == interp && reflist->mnvobj == mnvobj) { if (reflist->delcmd) Tcl_DecrRefCount(reflist->delcmd); @@ -1569,7 +1569,7 @@ tcl_channel_close(ClientData instance, Tcl_Interp *interp UNUSED) // currently does nothing - if (instance != VIMOUT && instance != VIMERR) + if (instance != MNVOUT && instance != MNVERR) { Tcl_SetErrno(EBADF); err = EBADF; @@ -1606,7 +1606,7 @@ tcl_channel_output( // The buffer is not guaranteed to be 0-terminated, and we don't if // there is enough room to add a '\0'. So we have to create a copy // of the buffer... - str = vim_strnsave((char_u *)buf, bufsiz); + str = mnv_strnsave((char_u *)buf, bufsiz); if (!str) { Tcl_SetErrno(ENOMEM); @@ -1616,10 +1616,10 @@ tcl_channel_output( } result = bufsiz; - if (instance == VIMOUT) + if (instance == MNVOUT) tclmsg((char *)str); else - if (instance == VIMERR) + if (instance == MNVERR) tclerrmsg((char *)str); else { @@ -1628,7 +1628,7 @@ tcl_channel_output( *errptr = EBADF; result = -1; } - vim_free(str); + mnv_free(str); return result; } @@ -1651,7 +1651,7 @@ tcl_channel_gethandle( static Tcl_ChannelType tcl_channel_type = { - "vimmessage", // typeName + "mnvmessage", // typeName TCL_CHANNEL_VERSION_2, // version tcl_channel_close, // closeProc tcl_channel_input, // inputProc @@ -1681,7 +1681,7 @@ static Tcl_ChannelType tcl_channel_type = }; /////////////////////////////////// -// Interface to vim +// Interface to mnv ////////////////////////////////// static void @@ -1734,8 +1734,8 @@ tclinit(exarg_T *eap) // Create replacement channels for stdout and stderr; this has to be // done each time an interpreter is created since the channels are closed // when the interpreter is deleted - ch1 = Tcl_CreateChannel(&tcl_channel_type, "vimout", VIMOUT, TCL_WRITABLE); - ch2 = Tcl_CreateChannel(&tcl_channel_type, "vimerr", VIMERR, TCL_WRITABLE); + ch1 = Tcl_CreateChannel(&tcl_channel_type, "mnvout", MNVOUT, TCL_WRITABLE); + ch2 = Tcl_CreateChannel(&tcl_channel_type, "mnverr", MNVERR, TCL_WRITABLE); Tcl_SetStdChannel(ch1, TCL_STDOUT); Tcl_SetStdChannel(ch2, TCL_STDERR); @@ -1748,7 +1748,7 @@ tclinit(exarg_T *eap) return FAIL; } #if 0 - // VIM sure is interactive + // MNV sure is interactive Tcl_SetVar(interp, "tcl_interactive", "1", TCL_GLOBAL_ONLY); #endif @@ -1766,18 +1766,18 @@ tclinit(exarg_T *eap) Tcl_CreateObjCommand(interp, "exit", exitcmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); - // new commands, in ::vim namespace - Tcl_CreateObjCommand(interp, "::vim::buffer", buffercmd, + // new commands, in ::mnv namespace + Tcl_CreateObjCommand(interp, "::mnv::buffer", buffercmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); - Tcl_CreateObjCommand(interp, "::vim::window", windowcmd, + Tcl_CreateObjCommand(interp, "::mnv::window", windowcmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); - Tcl_CreateObjCommand(interp, "::vim::command", commandcmd, + Tcl_CreateObjCommand(interp, "::mnv::command", commandcmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); - Tcl_CreateObjCommand(interp, "::vim::beep", beepcmd, + Tcl_CreateObjCommand(interp, "::mnv::beep", beepcmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); - Tcl_CreateObjCommand(interp, "::vim::option", optioncmd, + Tcl_CreateObjCommand(interp, "::mnv::option", optioncmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); - Tcl_CreateObjCommand(interp, "::vim::expr", exprcmd, + Tcl_CreateObjCommand(interp, "::mnv::expr", exprcmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL); // "lbase" variable @@ -1864,7 +1864,7 @@ tcldelthisinterp(void) // buffers, but unless the user creates hundreds of sub-interpreters // all referring to lots of windows and buffers, this is hardly worth // the effort. Unused refs are recycled by other interpreters, and - // all refs are free'd when the window/buffer gets closed by vim. + // all refs are free'd when the window/buffer gets closed by mnv. tclinfo.interp = NULL; Tcl_Free(tclinfo.curbuf); @@ -1940,7 +1940,7 @@ ex_tcl(exarg_T *eap) err = tclexit(err); } } - vim_free(script); + mnv_free(script); } /* @@ -2051,7 +2051,7 @@ tcldelallrefs(struct ref *ref) char *result; #ifdef DYNAMIC_TCL - // TODO: this code currently crashes Vim on exit + // TODO: this code currently crashes MNV on exit if (exiting) return; #endif diff --git a/uvim/src/if_xcmdsrv.c b/uvim/src/if_xcmdsrv.c index 070e0db099..13bd28e43c 100644 --- a/uvim/src/if_xcmdsrv.c +++ b/uvim/src/if_xcmdsrv.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * X command server by Flemming Madsen * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. * * if_xcmdsrv.c: Functions for passing commands through an X11 display. * */ -#include "vim.h" +#include "mnv.h" #include "version.h" #if (defined(FEAT_CLIENTSERVER) && defined(FEAT_X11)) @@ -23,10 +23,10 @@ /* * This file provides procedures that implement the command server - * functionality of Vim when in contact with an X11 server. + * functionality of MNV when in contact with an X11 server. * * Adapted from TCL/TK's send command in tkSend.c of the tk 3.6 distribution. - * Adapted for use in Vim by Flemming Madsen. Protocol changed to that of tk 4 + * Adapted for use in MNV by Flemming Madsen. Protocol changed to that of tk 4 */ /* @@ -58,7 +58,7 @@ * sent commands. The information in the structure is used to * process the result when it arrives. You're probably wondering * how there could ever be multiple outstanding sent commands. - * This could happen if Vim instances invoke each other recursively. + * This could happen if MNV instances invoke each other recursively. * It's unlikely, but possible. */ @@ -145,7 +145,7 @@ static PendingCommand *pendingCommands = NULL; * * -i errorInfo * -e errorCode - * Not applicable for Vim + * Not applicable for MNV * * Options may appear in any order, and only the -s option must be * present. As with commands, there may be additional options besides @@ -202,13 +202,13 @@ static void server_parse_message(Display *dpy, char_u *propInfo, long_u numItems // Private variables for the "server" functionality static Atom registryProperty = None; -static Atom vimProperty = None; +static Atom mnvProperty = None; static int got_x_error = FALSE; static char_u *empty_prop = (char_u *)""; // empty GetRegProp() result /* - * Associate an ASCII name with Vim. Try real hard to get a unique one. + * Associate an ASCII name with MNV. Try real hard to get a unique one. * Returns FAIL or OK. */ int @@ -245,7 +245,7 @@ serverRegisterName( } while (res < 0) ; - vim_free(p); + mnv_free(p); return OK; } @@ -315,9 +315,9 @@ DoRegisterName(Display *dpy, char_u *name) namelen = STRLEN(name); # ifdef FEAT_EVAL - set_vim_var_string(VV_SEND_SERVER, name, (int)namelen); + set_mnv_var_string(VV_SEND_SERVER, name, (int)namelen); # endif - serverName = vim_strnsave(name, namelen); + serverName = mnv_strnsave(name, namelen); need_maketitle = TRUE; return 0; } @@ -338,7 +338,7 @@ serverChangeRegisteredWindow( commWindow = newwin; - // Always call SendInit() here, to make sure commWindow is marked as a Vim + // Always call SendInit() here, to make sure commWindow is marked as a MNV // window. if (SendInit(dpy) < 0) return; @@ -362,11 +362,11 @@ serverChangeRegisteredWindow( # endif /* - * Send to an instance of Vim via the X display. + * Send to an instance of MNV via the X display. * Returns 0 for OK, negative for an error. */ int -serverSendToVim( +serverSendToMNV( Display *dpy, // Where to send. char_u *name, // Where to send. char_u *cmd, // What to send. @@ -390,18 +390,18 @@ serverSendToVim( if (result != NULL) *result = NULL; if (name == NULL || *name == NUL) - name = (char_u *)"GVIM"; // use a default name + name = (char_u *)"GMNV"; // use a default name if (commProperty == None && dpy != NULL && SendInit(dpy) < 0) return -1; # if defined(FEAT_EVAL) - ch_log(NULL, "serverSendToVim(%s, %s)", name, cmd); + ch_log(NULL, "serverSendToMNV(%s, %s)", name, cmd); # endif // Execute locally if no display or target is ourselves if (dpy == NULL || (serverName != NULL && STRICMP(name, serverName) == 0)) - return sendToLocalVim(cmd, asExpr, result); + return sendToLocalMNV(cmd, asExpr, result); /* * Bind the server name to a communication window. @@ -421,7 +421,7 @@ serverSendToVim( { LookupName(dpy, loosename ? loosename : name, /*DELETE=*/TRUE, NULL); - vim_free(loosename); + mnv_free(loosename); continue; } } @@ -449,7 +449,7 @@ serverSendToVim( sprintf((char *)property, "%c%c%c-n %s%c-E %s%c-s %s", 0, asExpr ? 'c' : 'k', 0, name, 0, p_enc, 0, cmd); if (name == loosename) - vim_free(loosename); + mnv_free(loosename); // Add a back reference to our comm window serial++; sprintf((char *)property + length, "%c-r %x %d", @@ -458,7 +458,7 @@ serverSendToVim( length += STRLEN(property + length + 1) + 1; res = AppendPropCarefully(dpy, w, commProperty, property, length + 1); - vim_free(property); + mnv_free(property); if (res < 0) { emsg(_(e_failed_to_send_command_to_destination_program)); @@ -501,13 +501,13 @@ serverSendToVim( } # if defined(FEAT_EVAL) - ch_log(NULL, "serverSendToVim() result: %s", + ch_log(NULL, "serverSendToMNV() result: %s", pending.result == NULL ? "NULL" : (char *)pending.result); # endif if (result != NULL) *result = pending.result; else - vim_free(pending.result); + mnv_free(pending.result); return pending.code == 0 ? 0 : -1; } @@ -520,7 +520,7 @@ WaitForPend(void *p) } /* - * Return TRUE if window "w" exists and has a "Vim" property on it. + * Return TRUE if window "w" exists and has a "MNV" property on it. */ static int WindowValid(Display *dpy, Window w) @@ -539,7 +539,7 @@ WindowValid(Display *dpy, Window w) return FALSE; for (i = 0; i < numProp; i++) - if (plist[i] == vimProperty) + if (plist[i] == mnvProperty) { XFree(plist); return TRUE; @@ -597,7 +597,7 @@ ServerWait( check_due_timer(); # endif - // Just look out for the answer without calling back into Vim + // Just look out for the answer without calling back into MNV if (localLoop) { # ifdef HAVE_SELECT @@ -626,13 +626,13 @@ ServerWait( /* - * Fetch a list of all the Vim instance names currently registered for the + * Fetch a list of all the MNV instance names currently registered for the * display. * * Returns a newline separated list in allocated memory or NULL. */ char_u * -serverGetVimNames(Display *dpy) +serverGetMNVNames(Display *dpy) { char_u *regProp; char_u *entry; @@ -768,7 +768,7 @@ serverSendReply(char_u *name, char_u *str) // Add length of what "%x" resulted in. length += STRLEN(property + length); res = AppendPropCarefully(dpy, win, commProperty, property, length + 1); - vim_free(property); + mnv_free(property); return res; } @@ -804,7 +804,7 @@ serverReadReply( if ((p = ServerReplyFind(win, SROP_Find)) != NULL && p->strings.ga_len > 0) { - *str = vim_strsave(p->strings.ga_data); + *str = mnv_strsave(p->strings.ga_data); len = STRLEN(*str) + 1; if (len < p->strings.ga_len) { @@ -862,10 +862,10 @@ SendInit(Display *dpy) if (commProperty == None) commProperty = XInternAtom(dpy, "Comm", False); - if (vimProperty == None) - vimProperty = XInternAtom(dpy, "Vim", False); + if (mnvProperty == None) + mnvProperty = XInternAtom(dpy, "MNV", False); if (registryProperty == None) - registryProperty = XInternAtom(dpy, "VimRegistry", False); + registryProperty = XInternAtom(dpy, "MNVRegistry", False); if (commWindow == None) { @@ -881,10 +881,10 @@ SendInit(Display *dpy) XUngrabServer(dpy); } - // Make window recognizable as a vim window - XChangeProperty(dpy, commWindow, vimProperty, XA_STRING, - 8, PropModeReplace, (char_u *)VIM_VERSION_SHORT, - (int)STRLEN_LITERAL(VIM_VERSION_SHORT) + 1); + // Make window recognizable as a mnv window + XChangeProperty(dpy, commWindow, mnvProperty, XA_STRING, + 8, PropModeReplace, (char_u *)MNV_VERSION_SHORT, + (int)STRLEN_LITERAL(MNV_VERSION_SHORT) + 1); XSync(dpy, False); (void)XSetErrorHandler(old_handler); @@ -954,7 +954,7 @@ LookupName( && STRNICMP(name, p + 1, STRLEN(name)) == 0) { sscanf((char *)entry, "%x", &returnValue); - *loose = vim_strsave(p + 1); + *loose = mnv_strsave(p + 1); break; } while (*p != 0) @@ -994,7 +994,7 @@ LookupName( * occurrence is not ours since it is not yet put into the registry (by us) * * This is necessary in the following scenario: - * 1. There is an old windowid for an exit'ed vim in the registry + * 1. There is an old windowid for an exit'ed mnv in the registry * 2. We get that id for our commWindow but only want to send, not register. * 3. The window will mistakenly be regarded valid because of own commWindow */ @@ -1102,7 +1102,7 @@ GetRegProp( XFree(*regPropp); XDeleteProperty(dpy, RootWindow(dpy, 0), registryProperty); if (domsg) - emsg(_(e_vim_instance_registry_property_is_badly_formed_deleted)); + emsg(_(e_mnv_instance_registry_property_is_badly_formed_deleted)); return FAIL; } return OK; @@ -1110,7 +1110,7 @@ GetRegProp( /* - * This procedure is invoked by the various X event loops throughout Vims when + * This procedure is invoked by the various X event loops throughout MNVs when * a property changes on the communication window. This procedure reads the * property and enqueues command requests and responses. If immediate is true, * it runs the event immediately instead of enqueuing it. Immediate can cause @@ -1160,7 +1160,7 @@ serverEventProc( /* * Saves x clientserver commands in a queue so that they can be called when - * vim is idle. + * mnv is idle. */ static void save_in_queue(char_u *propInfo, long_u len) @@ -1202,7 +1202,7 @@ server_parse_messages(void) head.next = node->next; node->next->prev = node->prev; server_parse_message(X_DISPLAY, node->propInfo, node->len); - vim_free(node); + mnv_free(node); } } @@ -1283,7 +1283,7 @@ server_parse_message( case 'r': end = skipwhite(p + 2); resWindow = 0; - while (vim_isxdigit(*end)) + while (mnv_isxdigit(*end)) { resWindow = 16 * resWindow + (long_u)hex2nr(*end); ++end; @@ -1353,9 +1353,9 @@ server_parse_message( reply.ga_data, reply.ga_len); ga_clear(&reply); } - vim_free(res); + mnv_free(res); } - vim_free(tofree); + mnv_free(tofree); } } else if (*p == 'r' && p[1] == 0) @@ -1416,7 +1416,7 @@ server_parse_message( pcPtr->code = code; res = serverConvert(enc, res, &tofree); if (tofree == NULL) - res = vim_strsave(res); + res = mnv_strsave(res); pcPtr->result = res; break; } @@ -1431,7 +1431,7 @@ server_parse_message( char_u *enc; /* - * This is a (n)otification. Sent with serverreply_send in Vim + * This is a (n)otification. Sent with serverreply_send in MNV * script. Execute any autocommand and save it for later retrieval */ p += 2; @@ -1477,7 +1477,7 @@ server_parse_message( sprintf((char *)winstr, "0x%x", (unsigned int)win); apply_autocmds(EVENT_REMOTEREPLY, winstr, str, TRUE, curbuf); } - vim_free(tofree); + mnv_free(tofree); } else { @@ -1540,6 +1540,6 @@ IsSerialName(char_u *str) { int len = STRLEN(str); - return (len > 1 && vim_isdigit(str[len - 1])); + return (len > 1 && mnv_isdigit(str[len - 1])); } #endif // FEAT_CLIENTSERVER diff --git a/uvim/src/iid_ole.c b/uvim/src/iid_ole.c index f3939eaa12..d3e6f1d163 100644 --- a/uvim/src/iid_ole.c +++ b/uvim/src/iid_ole.c @@ -42,13 +42,13 @@ typedef struct _IID typedef IID CLSID; #endif -const IID IID_IVim = {0x0F0BFAE2,0x4C90,0x11d1,{0x82,0xD7,0x00,0x04,0xAC,0x36,0x85,0x19}}; +const IID IID_IMNV = {0x0F0BFAE2,0x4C90,0x11d1,{0x82,0xD7,0x00,0x04,0xAC,0x36,0x85,0x19}}; -const IID LIBID_Vim = {0x0F0BFAE0,0x4C90,0x11d1,{0x82,0xD7,0x00,0x04,0xAC,0x36,0x85,0x19}}; +const IID LIBID_MNV = {0x0F0BFAE0,0x4C90,0x11d1,{0x82,0xD7,0x00,0x04,0xAC,0x36,0x85,0x19}}; -const CLSID CLSID_Vim = {0x0F0BFAE1,0x4C90,0x11d1,{0x82,0xD7,0x00,0x04,0xAC,0x36,0x85,0x19}}; +const CLSID CLSID_MNV = {0x0F0BFAE1,0x4C90,0x11d1,{0x82,0xD7,0x00,0x04,0xAC,0x36,0x85,0x19}}; #ifdef __cplusplus diff --git a/uvim/src/indent.c b/uvim/src/indent.c index 26f60701c2..f42aa4bb56 100644 --- a/uvim/src/indent.c +++ b/uvim/src/indent.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * indent.c: Indentation related functions */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_VARTABS) @@ -49,7 +49,7 @@ tabstop_set(char_u *var, int **array) } } - if (VIM_ISDIGIT(*cp)) + if (MNV_ISDIGIT(*cp)) continue; if (cp[0] == ',' && cp > var && cp[-1] != ',' && cp[1] != NUL) { @@ -74,7 +74,7 @@ tabstop_set(char_u *var, int **array) if (n <= 0 || n > TABSTOP_MAX) { semsg(_(e_invalid_argument_str), cp); - VIM_CLEAR(*array); + MNV_CLEAR(*array); return FAIL; } (*array)[t++] = n; @@ -557,7 +557,7 @@ set_indent( ind_done = 0; // count as many characters as we can use - while (todo > 0 && VIM_ISWHITE(*p)) + while (todo > 0 && MNV_ISWHITE(*p)) { if (*p == TAB) { @@ -654,7 +654,7 @@ set_indent( } // Return if the indent is OK already. - if (!doit && !VIM_ISWHITE(*p) && !(flags & SIN_INSERT)) + if (!doit && !MNV_ISWHITE(*p) && !(flags & SIN_INSERT)) return FALSE; // Allocate memory for the new line. @@ -688,7 +688,7 @@ set_indent( // Skip over any additional white space (useful when newindent is less // than old) - while (VIM_ISWHITE(*p)) + while (MNV_ISWHITE(*p)) ++p; } @@ -712,7 +712,7 @@ set_indent( p = oldline; ind_done = 0; - while (todo > 0 && VIM_ISWHITE(*p)) + while (todo > 0 && MNV_ISWHITE(*p)) { if (*p == TAB) { @@ -820,7 +820,7 @@ set_indent( retval = TRUE; } else - vim_free(newline); + mnv_free(newline); curwin->w_cursor.col = ind_len; return retval; @@ -848,20 +848,20 @@ get_number_indent(linenr_T lnum) if ((State & MODE_INSERT) || has_format_option(FO_Q_COMS)) lead_len = get_leader_len(ml_get(lnum), NULL, FALSE, TRUE); - regmatch.regprog = vim_regcomp(curbuf->b_p_flp, RE_MAGIC); + regmatch.regprog = mnv_regcomp(curbuf->b_p_flp, RE_MAGIC); if (regmatch.regprog != NULL) { regmatch.rm_ic = FALSE; - // vim_regexec() expects a pointer to a line. This lets us + // mnv_regexec() expects a pointer to a line. This lets us // start matching for the flp beyond any comment leader... - if (vim_regexec(®match, ml_get(lnum) + lead_len, (colnr_T)0)) + if (mnv_regexec(®match, ml_get(lnum) + lead_len, (colnr_T)0)) { pos.lnum = lnum; pos.col = (colnr_T)(*regmatch.endp - ml_get(lnum)); pos.coladd = 0; } - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); } if (pos.lnum == 0 || *ml_get_pos(&pos) == NUL) @@ -898,12 +898,12 @@ briopt_check( { // Note: Keep this in sync with p_briopt_values if (STRNCMP(p, "shift:", 6) == 0 - && ((p[6] == '-' && VIM_ISDIGIT(p[7])) || VIM_ISDIGIT(p[6]))) + && ((p[6] == '-' && MNV_ISDIGIT(p[7])) || MNV_ISDIGIT(p[6]))) { p += 6; bri_shift = getdigits(&p); } - else if (STRNCMP(p, "min:", 4) == 0 && VIM_ISDIGIT(p[4])) + else if (STRNCMP(p, "min:", 4) == 0 && MNV_ISDIGIT(p[4])) { p += 4; bri_min = getdigits(&p); @@ -998,8 +998,8 @@ get_breakindent_win( ) { prev_fnum = wp->w_buffer->b_fnum; - vim_free(prev_line); - prev_line = vim_strsave(line); + mnv_free(prev_line); + prev_line = mnv_strsave(line); prev_ts = wp->w_buffer->b_p_ts; # ifdef FEAT_VARTABS prev_vts = wp->w_buffer->b_p_vts_array; @@ -1017,20 +1017,20 @@ get_breakindent_win( prev_list = 0; prev_no_ts = no_ts; prev_dy_uhex = (dy_flags & DY_UHEX); - vim_free(prev_flp); - prev_flp = vim_strsave(get_flp_value(wp->w_buffer)); + mnv_free(prev_flp); + prev_flp = mnv_strsave(get_flp_value(wp->w_buffer)); // add additional indent for numbered lists if (wp->w_briopt_list != 0 && wp->w_briopt_vcol == 0) { regmatch_T regmatch; - regmatch.regprog = vim_regcomp(prev_flp, + regmatch.regprog = mnv_regcomp(prev_flp, RE_MAGIC + RE_STRING + RE_AUTO + RE_STRICT); if (regmatch.regprog != NULL) { regmatch.rm_ic = FALSE; - if (vim_regexec(®match, line, 0)) + if (mnv_regexec(®match, line, 0)) { if (wp->w_briopt_list > 0) prev_list = wp->w_briopt_list; @@ -1051,7 +1051,7 @@ get_breakindent_win( prev_indent = indent; } } - vim_regfree(regmatch.regprog); + mnv_regfree(regmatch.regprog); } } } @@ -1073,7 +1073,7 @@ get_breakindent_win( // indent minus the length of the showbreak string if (wp->w_briopt_sbr) - bri -= vim_strsize(get_showbreak_value(wp)); + bri -= mnv_strsize(get_showbreak_value(wp)); // never indent past left window margin @@ -1102,7 +1102,7 @@ inindent(int extra) char_u *ptr; colnr_T col; - for (col = 0, ptr = ml_get_curline(); VIM_ISWHITE(*ptr); ++col) + for (col = 0, ptr = ml_get_curline(); MNV_ISWHITE(*ptr); ++col) ++ptr; if (col >= curwin->w_cursor.col + extra) return TRUE; @@ -1250,7 +1250,7 @@ ins_try_si(int c) ptr = ml_get(pos->lnum); i = pos->col; if (i > 0) // skip blanks before '{' - while (--i > 0 && VIM_ISWHITE(ptr[i])) + while (--i > 0 && MNV_ISWHITE(ptr[i])) ; curwin->w_cursor.lnum = pos->lnum; curwin->w_cursor.col = i; @@ -1333,7 +1333,7 @@ change_indent( // MODE_VREPLACE state needs to know what the line was like before changing if (State & VREPLACE_FLAG) { - orig_line = vim_strnsave(ml_get_curline(), ml_get_curline_len()); // Deal with NULL below + orig_line = mnv_strnsave(ml_get_curline(), ml_get_curline_len()); // Deal with NULL below orig_col = curwin->w_cursor.col; } @@ -1439,7 +1439,7 @@ change_indent( while (--i >= 0) ptr[i] = ' '; ins_str(ptr, ptrlen); - vim_free(ptr); + mnv_free(ptr); } } @@ -1511,10 +1511,10 @@ change_indent( return; // Save new line - new_line = vim_strnsave(ml_get_curline(), ml_get_curline_len()); + new_line = mnv_strnsave(ml_get_curline(), ml_get_curline_len()); if (new_line == NULL) { - vim_free(orig_line); + mnv_free(orig_line); return; } @@ -1531,7 +1531,7 @@ change_indent( // Insert new stuff into line again ins_bytes(new_line); - vim_free(new_line); + mnv_free(new_line); } } @@ -1569,7 +1569,7 @@ copy_indent(int size, char_u *src) s = src; // Count/copy the usable portion of the source line - while (todo > 0 && VIM_ISWHITE(*s)) + while (todo > 0 && MNV_ISWHITE(*s)) { if (*s == TAB) { @@ -1740,7 +1740,7 @@ ex_retab(exarg_T *eap) new_ts_str = ptr; if (tabstop_set(ptr, &new_vts_array) == FAIL) return; - while (vim_isdigit(*ptr) || *ptr == ',') + while (mnv_isdigit(*ptr) || *ptr == ',') ++ptr; // This ensures that either new_vts_array and new_ts_str are freshly @@ -1752,7 +1752,7 @@ ex_retab(exarg_T *eap) new_ts_str = NULL; } else - new_ts_str = vim_strnsave(new_ts_str, ptr - new_ts_str); + new_ts_str = mnv_strnsave(new_ts_str, ptr - new_ts_str); #else if (ptr[0] != NUL && (ptr[0] != '0' || ptr[1] != NUL)) { @@ -1785,7 +1785,7 @@ ex_retab(exarg_T *eap) did_undo = FALSE; for (;;) { - if (VIM_ISWHITE(ptr[col])) + if (MNV_ISWHITE(ptr[col])) { if (!got_tab && num_spaces == 0) { @@ -1929,16 +1929,16 @@ ex_retab(exarg_T *eap) set_string_option_direct((char_u *)"vts", -1, new_ts_str, OPT_FREE|OPT_LOCAL, 0); curbuf->b_p_vts_array = new_vts_array; - vim_free(old_vts_ary); + mnv_free(old_vts_ary); } else { // 'vartabstop' wasn't in use and a single value was given to // retab then update 'tabstop'. curbuf->b_p_ts = tabstop_first(new_vts_array); - vim_free(new_vts_array); + mnv_free(new_vts_array); } - vim_free(new_ts_str); + mnv_free(new_ts_str); } #else curbuf->b_p_ts = new_ts; @@ -1970,7 +1970,7 @@ get_expr_indent(void) save_pos = curwin->w_cursor; save_curswant = curwin->w_curswant; save_set_curswant = curwin->w_set_curswant; - set_vim_var_nr(VV_LNUM, curwin->w_cursor.lnum); + set_mnv_var_nr(VV_LNUM, curwin->w_cursor.lnum); if (use_sandbox) ++sandbox; ++textlock; @@ -1978,11 +1978,11 @@ get_expr_indent(void) // Need to make a copy, the 'indentexpr' option could be changed while // evaluating it. - inde_copy = vim_strsave(curbuf->b_p_inde); + inde_copy = mnv_strsave(curbuf->b_p_inde); if (inde_copy != NULL) { indent = (int)eval_to_number(inde_copy, TRUE); - vim_free(inde_copy); + mnv_free(inde_copy); } if (use_sandbox) @@ -2002,7 +2002,7 @@ get_expr_indent(void) State = save_State; // Reset did_throw, unless 'debug' has "throw" and inside a try/catch. - if (did_throw && (vim_strchr(p_debug, 't') == NULL || trylevel == 0)) + if (did_throw && (mnv_strchr(p_debug, 't') == NULL || trylevel == 0)) { handle_did_throw(); did_throw = FALSE; @@ -2060,7 +2060,7 @@ get_lisp_indent(void) int vi_lisp; // Set vi_lisp to use the vi-compatible method - vi_lisp = (vim_strchr(p_cpo, CPO_LISP) != NULL); + vi_lisp = (mnv_strchr(p_cpo, CPO_LISP) != NULL); realpos = curwin->w_cursor; curwin->w_cursor.col = 0; @@ -2175,7 +2175,7 @@ get_lisp_indent(void) init_chartabsize_arg(&cts, curwin, (colnr_T)(that - line), amount, line, that); - while (VIM_ISWHITE(*cts.cts_ptr)) + while (MNV_ISWHITE(*cts.cts_ptr)) { cts.cts_vcol += lbr_chartabsize(&cts); ++cts.cts_ptr; @@ -2203,7 +2203,7 @@ get_lisp_indent(void) && (*that < '0' || *that > '9'))) { while (*cts.cts_ptr - && (!VIM_ISWHITE(*cts.cts_ptr) + && (!MNV_ISWHITE(*cts.cts_ptr) || quotecount || parencount) && (!((*cts.cts_ptr == '(' @@ -2226,7 +2226,7 @@ get_lisp_indent(void) cts.cts_vcol += lbr_chartabsize_adv(&cts); } } - while (VIM_ISWHITE(*cts.cts_ptr)) + while (MNV_ISWHITE(*cts.cts_ptr)) { cts.cts_vcol += lbr_chartabsize(&cts); ++cts.cts_ptr; @@ -2314,7 +2314,7 @@ f_indent(typval_T *argvars, typval_T *rettv) { linenr_T lnum; - if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_lnum_arg(argvars, 0) == FAIL) return; lnum = tv_get_lnum(argvars); @@ -2322,7 +2322,7 @@ f_indent(typval_T *argvars, typval_T *rettv) rettv->vval.v_number = get_indent_lnum(lnum); else { - if (in_vim9script()) + if (in_mnv9script()) semsg(_(e_invalid_line_number_nr), lnum); rettv->vval.v_number = -1; } @@ -2337,7 +2337,7 @@ f_lispindent(typval_T *argvars UNUSED, typval_T *rettv) pos_T pos; linenr_T lnum; - if (in_vim9script() && check_for_lnum_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_lnum_arg(argvars, 0) == FAIL) return; pos = curwin->w_cursor; @@ -2348,7 +2348,7 @@ f_lispindent(typval_T *argvars UNUSED, typval_T *rettv) rettv->vval.v_number = get_lisp_indent(); curwin->w_cursor = pos; } - else if (in_vim9script()) + else if (in_mnv9script()) semsg(_(e_invalid_line_number_nr), lnum); else rettv->vval.v_number = -1; diff --git a/uvim/src/insexpand.c b/uvim/src/insexpand.c index bfae80f61b..ffe34278fb 100644 --- a/uvim/src/insexpand.c +++ b/uvim/src/insexpand.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * insexpand.c: functions for Insert mode completion */ -#include "vim.h" +#include "mnv.h" /* * Definitions used for CTRL-X submode. @@ -474,11 +474,11 @@ has_compl_option(int dict_opt) HL_ATTR(HLF_E)); if (emsg_silent == 0 && !in_assert_fails) { - vim_beep(BO_COMPL); + mnv_beep(BO_COMPL); setcursor(); out_flush(); #ifdef FEAT_EVAL - if (!get_vim_var_nr(VV_TESTING)) + if (!get_mnv_var_nr(VV_TESTING)) #endif ui_delay(2004L, FALSE); } @@ -492,7 +492,7 @@ has_compl_option(int dict_opt) * This depends on the current mode. */ int -vim_is_ctrl_x_key(int c) +mnv_is_ctrl_x_key(int c) { // Always allow ^R - let its results then be checked if (c == Ctrl_R && ctrl_x_mode != CTRL_X_REGISTER) @@ -549,7 +549,7 @@ vim_is_ctrl_x_key(int c) case CTRL_X_REGISTER: return (c == Ctrl_R || c == Ctrl_P || c == Ctrl_N); } - internal_error("vim_is_ctrl_x_key()"); + internal_error("mnv_is_ctrl_x_key()"); return FALSE; } @@ -584,7 +584,7 @@ ins_compl_accept_char(int c) if (ctrl_x_mode & CTRL_X_WANT_IDENT) // When expanding an identifier only accept identifier chars. - return vim_isIDc(c); + return mnv_isIDc(c); switch (ctrl_x_mode) { @@ -592,20 +592,20 @@ ins_compl_accept_char(int c) // When expanding file name only accept file name chars. But not // path separators, so that "proto/" expands files in // "proto", not "proto/" as a whole - return vim_isfilec(c) && !vim_ispathsep(c); + return mnv_isfilec(c) && !mnv_ispathsep(c); case CTRL_X_CMDLINE: case CTRL_X_CMDLINE_CTRL_X: case CTRL_X_OMNI: // Command line and Omni completion can work with just about any // printable character, but do stop at white space. - return vim_isprintc(c) && !VIM_ISWHITE(c); + return mnv_isprintc(c) && !MNV_ISWHITE(c); case CTRL_X_WHOLE_LINE: // For while line completion a space can be part of the line. - return vim_isprintc(c); + return mnv_isprintc(c); } - return vim_iswordc(c); + return mnv_iswordc(c); } /* @@ -721,7 +721,7 @@ ins_compl_infercase_gettext( // growarray. Add the character in the next round. if (ga_grow(&gap, IOSIZE) == FAIL) { - vim_free(wca); + mnv_free(wca); return (char_u *)"[failed]"; } *p = NUL; @@ -733,7 +733,7 @@ ins_compl_infercase_gettext( else *(p++) = wca[i++]; } - vim_free(wca); + mnv_free(wca); if (gap.ga_data != NULL) { @@ -819,7 +819,7 @@ ins_compl_add_infercase( flags |= CP_ICASE; res = ins_compl_add(str, len, fname, NULL, NULL, dir, flags, FALSE, NULL, score); - vim_free(tofree); + mnv_free(tofree); return res; } @@ -871,7 +871,7 @@ ins_compl_preinsert_longest(void) * fname - file name to associate with this match. * cptext - list of strings to use with this match (for abbr, menu, info * and kind) - * user_data - user supplied data (any vim type) for this match + * user_data - user supplied data (any mnv type) for this match * cdir - match direction. If 0, use "compl_direction". * flags_arg - match flags (cp_flags) * adup - accept this match even if it is already present. @@ -938,9 +938,9 @@ ins_compl_add( if (match == NULL) return FAIL; match->cp_number = flags & CP_ORIGINAL_TEXT ? 0 : -1; - if ((match->cp_str.string = vim_strnsave(str, len)) == NULL) + if ((match->cp_str.string = mnv_strnsave(str, len)) == NULL) { - vim_free(match); + mnv_free(match); return FAIL; } @@ -957,7 +957,7 @@ ins_compl_add( match->cp_fname = compl_curr_match->cp_fname; else if (fname != NULL) { - match->cp_fname = vim_strsave(fname); + match->cp_fname = mnv_strsave(fname); flags |= CP_FREE_FNAME; } else @@ -973,7 +973,7 @@ ins_compl_add( for (int i = 0; i < CPT_COUNT; ++i) { if (cptext[i] != NULL && *cptext[i] != NUL) - match->cp_text[i] = vim_strsave(cptext[i]); + match->cp_text[i] = mnv_strsave(cptext[i]); } } #ifdef FEAT_EVAL @@ -1124,7 +1124,7 @@ ins_compl_col_range_attr(linenr_T lnum, int col) static int ins_compl_has_multiple(void) { - return vim_strchr(compl_shown_match->cp_str.string, '\n') != NULL; + return mnv_strchr(compl_shown_match->cp_str.string, '\n') != NULL; } /* @@ -1153,7 +1153,7 @@ ins_compl_longest_match(compl_T *match) if (compl_leader.string == NULL) { // First match, use it as a whole. - compl_leader.string = vim_strnsave(match->cp_str.string, match->cp_str.length); + compl_leader.string = mnv_strnsave(match->cp_str.string, match->cp_str.length); if (compl_leader.string == NULL) return; @@ -1325,7 +1325,7 @@ ins_compl_del_pum(void) return; pum_undisplay(); - VIM_CLEAR(compl_match_array); + MNV_CLEAR(compl_match_array); } /* @@ -1516,7 +1516,7 @@ get_leader_for_startcol(compl_T *match, int cached) if (match == NULL) { - VIM_CLEAR_STRING(adjusted_leader); + MNV_CLEAR_STRING(adjusted_leader); return NULL; } @@ -1552,7 +1552,7 @@ get_leader_for_startcol(compl_T *match, int cached) && adjusted_leader.string != NULL) return &adjusted_leader; - VIM_CLEAR_STRING(adjusted_leader); + MNV_CLEAR_STRING(adjusted_leader); if (prepend_startcol_text(&adjusted_leader, &compl_leader, startcol) != OK) goto theend; @@ -1774,7 +1774,7 @@ ins_compl_build_pum(void) compl = compl->cp_next; } while (compl != NULL && !is_first_match(compl)); - vim_free(match_count); + mnv_free(match_count); if (compl_match_arraysize == 0) return -1; @@ -1930,7 +1930,7 @@ ins_compl_dictionaries( // pattern. Also need to double backslashes. if (ctrl_x_mode_line_or_eval()) { - char_u *pat_esc = vim_strsave_escaped(pat, (char_u *)"\\"); + char_u *pat_esc = mnv_strsave_escaped(pat, (char_u *)"\\"); if (pat_esc == NULL) goto theend; @@ -1938,17 +1938,17 @@ ins_compl_dictionaries( ptr = alloc(len); if (ptr == NULL) { - vim_free(pat_esc); + mnv_free(pat_esc); goto theend; } - vim_snprintf((char *)ptr, len, "^\\s*\\zs\\V%s", pat_esc); - regmatch.regprog = vim_regcomp(ptr, RE_MAGIC); - vim_free(pat_esc); - vim_free(ptr); + mnv_snprintf((char *)ptr, len, "^\\s*\\zs\\V%s", pat_esc); + regmatch.regprog = mnv_regcomp(ptr, RE_MAGIC); + mnv_free(pat_esc); + mnv_free(ptr); } else { - regmatch.regprog = vim_regcomp(pat, magic_isset() ? RE_MAGIC : 0); + regmatch.regprog = mnv_regcomp(pat, magic_isset() ? RE_MAGIC : 0); if (regmatch.regprog == NULL) goto theend; } @@ -1974,7 +1974,7 @@ ins_compl_dictionaries( count = -1; else #endif - if (vim_strchr(buf, '`') != NULL + if (mnv_strchr(buf, '`') != NULL || expand_wildcards(1, &buf, &count, &files, EW_FILE|EW_SILENT) != OK) count = 0; @@ -2006,8 +2006,8 @@ ins_compl_dictionaries( theend: p_scs = save_p_scs; - vim_regfree(regmatch.regprog); - vim_free(buf); + mnv_regfree(regmatch.regprog); + mnv_free(buf); } /* @@ -2045,7 +2045,7 @@ thesaurus_add_words_in_line( { int l = (*mb_ptr2len)(ptr); - if (l < 2 && !vim_iswordc(*ptr)) + if (l < 2 && !mnv_iswordc(*ptr)) break; ptr += l; } @@ -2103,7 +2103,7 @@ ins_compl_files( && !compl_autocomplete) { msg_hist_off = TRUE; // reset in msg_trunc_attr() - vim_snprintf((char *)IObuff, IOSIZE, + mnv_snprintf((char *)IObuff, IOSIZE, _("Scanning dictionary: %s"), (char *)files[i]); (void)msg_trunc_attr((char *)IObuff, TRUE, HL_ATTR(HLF_R)); } @@ -2114,7 +2114,7 @@ ins_compl_files( // Read dictionary file line by line. // Check each line for a match. while (!got_int && !ins_compl_interrupted() - && !vim_fgets(buf, LSIZE, fp)) + && !mnv_fgets(buf, LSIZE, fp)) { ptr = buf; if (cot_fuzzy() && leader_len > 0) @@ -2140,7 +2140,7 @@ ins_compl_files( } else if (regmatch != NULL) { - while (vim_regexec(regmatch, buf, (colnr_T)(ptr - buf))) + while (mnv_regexec(regmatch, buf, (colnr_T)(ptr - buf))) { ptr = regmatch->startp[0]; ptr = ctrl_x_mode_line_or_eval() ? find_line_end(ptr) @@ -2160,7 +2160,7 @@ ins_compl_files( *dir = FORWARD; else if (add_r == FAIL) break; - // avoid expensive call to vim_regexec() when at end + // avoid expensive call to mnv_regexec() when at end // of line if (*ptr == '\n' || got_int) break; @@ -2187,7 +2187,7 @@ find_word_start(char_u *ptr) } else { - while (*ptr != NUL && *ptr != '\n' && !vim_iswordc(*ptr)) + while (*ptr != NUL && *ptr != '\n' && !mnv_iswordc(*ptr)) ++ptr; } return ptr; @@ -2212,7 +2212,7 @@ find_word_end(char_u *ptr) } } else - while (vim_iswordc(*ptr)) + while (mnv_iswordc(*ptr)) ++ptr; return ptr; } @@ -2236,16 +2236,16 @@ find_line_end(char_u *ptr) static void ins_compl_item_free(compl_T *match) { - VIM_CLEAR_STRING(match->cp_str); + MNV_CLEAR_STRING(match->cp_str); // several entries may use the same fname, free it just once. if (match->cp_flags & CP_FREE_FNAME) - vim_free(match->cp_fname); + mnv_free(match->cp_fname); for (int i = 0; i < CPT_COUNT; ++i) - vim_free(match->cp_text[i]); + mnv_free(match->cp_text[i]); #ifdef FEAT_EVAL clear_tv(&match->cp_user_data); #endif - vim_free(match); + mnv_free(match); } /* @@ -2256,8 +2256,8 @@ ins_compl_free(void) { compl_T *match; - VIM_CLEAR_STRING(compl_pattern); - VIM_CLEAR_STRING(compl_leader); + MNV_CLEAR_STRING(compl_pattern); + MNV_CLEAR_STRING(compl_leader); if (compl_first_match == NULL) return; @@ -2290,10 +2290,10 @@ ins_compl_clear(void) compl_ins_end_col = 0; compl_curr_win = NULL; compl_curr_buf = NULL; - VIM_CLEAR_STRING(compl_pattern); - VIM_CLEAR_STRING(compl_leader); + MNV_CLEAR_STRING(compl_pattern); + MNV_CLEAR_STRING(compl_leader); edit_submode_extra = NULL; - VIM_CLEAR_STRING(compl_orig_text); + MNV_CLEAR_STRING(compl_orig_text); compl_enter_selects = FALSE; cpt_sources_clear(); compl_autocomplete = FALSE; @@ -2301,7 +2301,7 @@ ins_compl_clear(void) compl_num_bests = 0; #ifdef FEAT_EVAL // clear v:completed_item - set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED)); + set_mnv_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED)); #endif } @@ -2444,9 +2444,9 @@ ins_compl_bs(void) || ins_compl_need_restart()) ins_compl_restart(); - VIM_CLEAR_STRING(compl_leader); + MNV_CLEAR_STRING(compl_leader); compl_leader.length = (size_t)((p - line) - compl_col); - compl_leader.string = vim_strnsave(line + compl_col, compl_leader.length); + compl_leader.string = mnv_strnsave(line + compl_col, compl_leader.length); if (compl_leader.string == NULL) { compl_leader.length = 0; @@ -2640,9 +2640,9 @@ ins_compl_addleader(int c) // would break redo. if (!compl_opt_refresh_always) { - VIM_CLEAR_STRING(compl_leader); + MNV_CLEAR_STRING(compl_leader); compl_leader.length = (size_t)(curwin->w_cursor.col - compl_col); - compl_leader.string = vim_strnsave(ml_get_curline() + compl_col, + compl_leader.string = mnv_strnsave(ml_get_curline() + compl_col, compl_leader.length); if (compl_leader.string == NULL) { @@ -2683,10 +2683,10 @@ ins_compl_set_original_text(char_u *str, size_t len) // be at the last item for backward completion if (match_at_original_text(compl_first_match)) // safety check { - char_u *p = vim_strnsave(str, len); + char_u *p = mnv_strnsave(str, len); if (p != NULL) { - VIM_CLEAR_STRING(compl_first_match->cp_str); + MNV_CLEAR_STRING(compl_first_match->cp_str); compl_first_match->cp_str.string = p; compl_first_match->cp_str.length = len; } @@ -2694,10 +2694,10 @@ ins_compl_set_original_text(char_u *str, size_t len) else if (compl_first_match->cp_prev != NULL && match_at_original_text(compl_first_match->cp_prev)) { - char_u *p = vim_strnsave(str, len); + char_u *p = mnv_strnsave(str, len); if (p != NULL) { - VIM_CLEAR_STRING(compl_first_match->cp_prev->cp_str); + MNV_CLEAR_STRING(compl_first_match->cp_prev->cp_str); compl_first_match->cp_prev->cp_str.string = p; compl_first_match->cp_prev->cp_str.length = len; } @@ -2832,7 +2832,7 @@ set_ctrl_x_mode(int c) #endif case Ctrl_V: case Ctrl_Q: - // complete vim commands + // complete mnv commands ctrl_x_mode = CTRL_X_CMDLINE; break; case Ctrl_Z: @@ -2978,7 +2978,7 @@ ins_compl_stop(int c, int prev_mode, int retval) && (c == CAR || c == K_KENTER || c == NL))) && pum_visible()) { - word = vim_strsave(compl_shown_match->cp_str.string); + word = mnv_strsave(compl_shown_match->cp_str.string); retval = TRUE; } @@ -3045,7 +3045,7 @@ ins_compl_stop(int c, int prev_mode, int retval) // Trigger the CompleteDone event to give scripts a chance to act // upon the end of completion. trigger_complete_done_event(prev_mode, word); - vim_free(word); + mnv_free(word); return retval; } @@ -3072,7 +3072,7 @@ ins_compl_prep(int c) // Forget any previous 'special' messages if this is actually // a ^X mode key - bar ^R, in which case we wait to see what it gives us. - if (c != Ctrl_R && vim_is_ctrl_x_key(c)) + if (c != Ctrl_R && mnv_is_ctrl_x_key(c)) edit_submode_extra = NULL; // Ignore end of Select mode mapping and mouse scroll/movement. @@ -3114,7 +3114,7 @@ ins_compl_prep(int c) if (ctrl_x_mode == CTRL_X_CMDLINE_CTRL_X && c != Ctrl_X) { if (c == Ctrl_V || c == Ctrl_Q || c == Ctrl_Z || ins_compl_pum_key(c) - || !vim_is_ctrl_x_key(c)) + || !mnv_is_ctrl_x_key(c)) { // Not starting another completion mode. ctrl_x_mode = CTRL_X_CMDLINE; @@ -3149,7 +3149,7 @@ ins_compl_prep(int c) else if (ctrl_x_mode_not_default()) { // We're already in CTRL-X mode, do we stay in it? - if (!vim_is_ctrl_x_key(c)) + if (!mnv_is_ctrl_x_key(c)) { ctrl_x_mode = ctrl_x_mode_scroll() ? CTRL_X_NORMAL : CTRL_X_FINISHED; edit_submode = NULL; @@ -3177,7 +3177,7 @@ ins_compl_prep(int c) // reset continue_* if we left expansion-mode, if we stay they'll be // (re)set properly in ins_complete() - if (!vim_is_ctrl_x_key(c)) + if (!mnv_is_ctrl_x_key(c)) { compl_cont_status = 0; compl_cont_mode = 0; @@ -3412,7 +3412,7 @@ clear_cpt_callbacks(callback_T **callbacks, int count) for (int i = 0; i < count; i++) free_callback(&(*callbacks)[i]); - VIM_CLEAR(*callbacks); + MNV_CLEAR(*callbacks); } /* @@ -3497,7 +3497,7 @@ set_cpt_callbacks(optset_T *args) if (slen > 0 && buf[0] == 'F' && buf[1] != NUL) { char_u *caret; - caret = vim_strchr(buf, '^'); + caret = mnv_strchr(buf, '^'); if (caret != NULL) *caret = NUL; @@ -3852,7 +3852,7 @@ set_completion(colnr_T startcol, list_T *list) compl_lnum = curwin->w_cursor.lnum; compl_length = (int)curwin->w_cursor.col - (int)startcol; // compl_pattern doesn't need to be set - compl_orig_text.string = vim_strnsave(ml_get_curline() + compl_col, + compl_orig_text.string = mnv_strnsave(ml_get_curline() + compl_col, (size_t)compl_length); if (p_ic) flags |= CP_ICASE; @@ -3901,7 +3901,7 @@ set_completion(colnr_T startcol, list_T *list) void f_complete(typval_T *argvars, typval_T *rettv UNUSED) { - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_list_arg(argvars, 1) == FAIL)) return; @@ -3931,7 +3931,7 @@ f_complete(typval_T *argvars, typval_T *rettv UNUSED) void f_complete_add(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_string_or_dict_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_or_dict_arg(argvars, 0) == FAIL) return; rettv->vval.v_number = ins_compl_add_tv(&argvars[0], 0, FALSE); @@ -4174,7 +4174,7 @@ f_complete_info(typval_T *argvars, typval_T *rettv) if (rettv_dict_alloc(rettv) == FAIL) return; - if (in_vim9script() && check_for_opt_list_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_list_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type != VAR_UNKNOWN) @@ -4307,7 +4307,7 @@ process_next_cpt_value( st->set_match_pos = TRUE; } else if (!skip_source && !compl_time_slice_expired - && vim_strchr((char_u *)"buwU", *st->e_cpt) != NULL + && mnv_strchr((char_u *)"buwU", *st->e_cpt) != NULL && (st->ins_buf = ins_compl_next_buf( st->ins_buf, *st->e_cpt)) != curbuf) { @@ -4335,7 +4335,7 @@ process_next_cpt_value( if (!shortmess(SHM_COMPLETIONSCAN) && !compl_autocomplete) { msg_hist_off = TRUE; // reset in msg_trunc_attr() - vim_snprintf((char *)IObuff, IOSIZE, _("Scanning: %s"), + mnv_snprintf((char *)IObuff, IOSIZE, _("Scanning: %s"), st->ins_buf->b_fname == NULL ? buf_spname(st->ins_buf) : st->ins_buf->b_sfname == NULL @@ -4385,7 +4385,7 @@ process_next_cpt_value( if (!shortmess(SHM_COMPLETIONSCAN) && !compl_autocomplete) { msg_hist_off = TRUE; // reset in msg_trunc_attr() - vim_snprintf((char *)IObuff, IOSIZE, _("Scanning tags.")); + mnv_snprintf((char *)IObuff, IOSIZE, _("Scanning tags.")); (void)msg_trunc_attr((char *)IObuff, TRUE, HL_ATTR(HLF_R)); } } @@ -4579,15 +4579,15 @@ fuzzy_longest_match(void) if (leader_len > 0 && STRNCMP(prefix, leader, leader_len) != 0) goto end; - prefix = vim_strnsave(prefix, prefix_len); + prefix = mnv_strnsave(prefix, prefix_len); if (prefix != NULL) { ins_compl_longest_insert(prefix); - vim_free(prefix); + mnv_free(prefix); } end: - vim_free(compl_best_matches); + mnv_free(compl_best_matches); compl_best_matches = NULL; compl_num_bests = 0; } @@ -4641,13 +4641,13 @@ get_next_filename_completion(void) } } #endif - last_sep = vim_strrchr(leader, pathsep); + last_sep = mnv_strrchr(leader, pathsep); if (last_sep == NULL) { // No path separator or separator is the last character, // fuzzy match the whole leader - VIM_CLEAR_STRING(compl_pattern); - compl_pattern.string = vim_strnsave((char_u *)"*", 1); + MNV_CLEAR_STRING(compl_pattern); + compl_pattern.string = mnv_strnsave((char_u *)"*", 1); if (compl_pattern.string == NULL) return; compl_pattern.length = 1; @@ -4663,8 +4663,8 @@ get_next_filename_completion(void) path_with_wildcard = alloc(path_len + 2); if (path_with_wildcard != NULL) { - vim_snprintf((char *)path_with_wildcard, path_len + 2, "%*.*s*", path_len, path_len, leader); - VIM_CLEAR_STRING(compl_pattern); + mnv_snprintf((char *)path_with_wildcard, path_len + 2, "%*.*s*", path_len, path_len, leader); + MNV_CLEAR_STRING(compl_pattern); compl_pattern.string = path_with_wildcard; compl_pattern.length = path_len + 1; @@ -4753,7 +4753,7 @@ get_next_filename_completion(void) num_matches = 0; } - vim_free(compl_fuzzy_scores); + mnv_free(compl_fuzzy_scores); ga_clear(&fuzzy_indices); if (compl_num_bests > 0 && compl_get_longest) @@ -4793,7 +4793,7 @@ get_next_spell_completion(linenr_T lnum UNUSED) if (num_matches > 0) ins_compl_add_matches(num_matches, matches, p_ic); else - vim_free(matches); + mnv_free(matches); #endif } @@ -4840,7 +4840,7 @@ ins_compl_get_next_word_or_line( { tmp_ptr += compl_length; // Skip if already inside a word. - if (vim_iswordp(tmp_ptr)) + if (mnv_iswordp(tmp_ptr)) return NULL; // Find start of next word. tmp_ptr = find_word_start(tmp_ptr); @@ -4874,7 +4874,7 @@ ins_compl_get_next_word_or_line( // IObuf =~ "\k.* ", thus len >= 2 if (p_js && (IObuff[len - 2] == '.' - || (vim_strchr(p_cpo, CPO_JOINSP) + || (mnv_strchr(p_cpo, CPO_JOINSP) == NULL && (IObuff[len - 2] == '?' || IObuff[len - 2] == '!')))) @@ -5270,7 +5270,7 @@ strip_caret_numbers_in_place(char_u *str) if (*read == '^') { p = read + 1; - while (vim_isdigit(*p)) + while (mnv_isdigit(*p)) p++; if ((*p == ',' || *p == '\0') && p != read + 1) { @@ -5301,7 +5301,7 @@ prepare_cpt_compl_funcs(void) int startcol; // Make a copy of 'cpt' in case the buffer gets wiped out - cpt = vim_strsave(curbuf->b_p_cpt); + cpt = mnv_strsave(curbuf->b_p_cpt); if (cpt == NULL) return FAIL; strip_caret_numbers_in_place(cpt); @@ -5335,7 +5335,7 @@ prepare_cpt_compl_funcs(void) idx++; } - vim_free(cpt); + mnv_free(cpt); return OK; #endif return FAIL; @@ -5408,9 +5408,9 @@ ins_compl_get_exp(pos_T *ini) } st.found_all = FALSE; st.ins_buf = curbuf; - vim_free(st.e_cpt_copy); + mnv_free(st.e_cpt_copy); // Make a copy of 'complete', in case the buffer is wiped out. - st.e_cpt_copy = vim_strsave((compl_cont_status & CONT_LOCAL) + st.e_cpt_copy = mnv_strsave((compl_cont_status & CONT_LOCAL) ? (char_u *)"." : curbuf->b_p_cpt); strip_caret_numbers_in_place(st.e_cpt_copy); st.e_cpt = st.e_cpt_copy == NULL ? (char_u *)"" : st.e_cpt_copy; @@ -5644,7 +5644,7 @@ ins_compl_delete(void) { char_u *line = ml_get_cursor(); remaining.length = ml_get_cursor_len(); - remaining.string = vim_strnsave(line, remaining.length); + remaining.string = mnv_strnsave(line, remaining.length); if (remaining.string == NULL) return; } @@ -5653,7 +5653,7 @@ ins_compl_delete(void) if (ml_delete(curwin->w_cursor.lnum) == FAIL) { if (remaining.string) - vim_free(remaining.string); + mnv_free(remaining.string); return; } deleted_lines_mark(curwin->w_cursor.lnum, 1L); @@ -5668,7 +5668,7 @@ ins_compl_delete(void) if (stop_arrow() == FAIL) { if (remaining.string) - vim_free(remaining.string); + mnv_free(remaining.string); return; } backspace_until_column(col); @@ -5680,14 +5680,14 @@ ins_compl_delete(void) orig_col = curwin->w_cursor.col; ins_str(remaining.string, remaining.length); curwin->w_cursor.col = orig_col; - vim_free(remaining.string); + mnv_free(remaining.string); } // TODO: is this sufficient for redrawing? Redrawing everything causes // flicker, thus we can't do that. changed_cline_bef_curs(); #ifdef FEAT_EVAL // clear v:completed_item - set_vim_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED)); + set_mnv_var_dict(VV_COMPLETED_ITEM, dict_alloc_lock(VAR_FIXED)); #endif } @@ -5811,7 +5811,7 @@ find_common_prefix(size_t *prefix_len, int curbuf_only) compl = compl->cp_next; } while (compl != NULL && !is_first_match(compl)); - vim_free(match_count); + mnv_free(match_count); if (len > (int)ins_compl_leader_len()) { @@ -5852,7 +5852,7 @@ ins_compl_insert(int move_cursor, int insert_prefix) char_u *cp_str = compl_shown_match->cp_str.string; size_t cp_str_len = compl_shown_match->cp_str.length; size_t leader_len = ins_compl_leader_len(); - char_u *has_multiple = vim_strchr(cp_str, '\n'); + char_u *has_multiple = mnv_strchr(cp_str, '\n'); if (insert_prefix) { @@ -5911,7 +5911,7 @@ ins_compl_insert(int move_cursor, int insert_prefix) { dict_T *dict = ins_compl_dict_alloc(compl_shown_match); - set_vim_var_dict(VV_COMPLETED_ITEM, dict); + set_mnv_var_dict(VV_COMPLETED_ITEM, dict); } #endif compl_hi_on_autocompl_longest = insert_prefix && move_cursor; @@ -5925,7 +5925,7 @@ ins_compl_insert(int move_cursor, int insert_prefix) ins_compl_show_filename(void) { char *lead = _("match in file"); - int space = sc_col - vim_strsize((char_u *)lead) - 2; + int space = sc_col - mnv_strsize((char_u *)lead) - 2; char_u *s; char_u *e; @@ -5947,7 +5947,7 @@ ins_compl_show_filename(void) if (!compl_autocomplete) { msg_hist_off = TRUE; - vim_snprintf((char *)IObuff, IOSIZE, "%s %s%s", lead, + mnv_snprintf((char *)IObuff, IOSIZE, "%s %s%s", lead, s > compl_shown_match->cp_fname ? "<" : "", s); msg((char *)IObuff); msg_hist_off = FALSE; @@ -6291,7 +6291,7 @@ ins_compl_check_keys(int frequency, int in_compl_func) return; count = 0; - // Check for a typed key. Do use mappings, otherwise vim_is_ctrl_x_key() + // Check for a typed key. Do use mappings, otherwise mnv_is_ctrl_x_key() // can't do its work correctly. c = vpeekc_any(); if (c != NUL @@ -6302,7 +6302,7 @@ ins_compl_check_keys(int frequency, int in_compl_func) #endif ) { - if (vim_is_ctrl_x_key(c) && c != Ctrl_X && c != Ctrl_R) + if (mnv_is_ctrl_x_key(c) && c != Ctrl_X && c != Ctrl_R) { c = safe_vgetc(); // Eat the character compl_shows_dir = ins_compl_key2dir(c); @@ -6425,7 +6425,7 @@ get_normal_compl_info(char_u *line, int startcol, colnr_T curs_col) { if (!compl_status_adding()) { - while (--startcol >= 0 && vim_isIDc(line[startcol])) + while (--startcol >= 0 && mnv_isIDc(line[startcol])) ; compl_col += ++startcol; compl_length = curs_col - startcol; @@ -6443,7 +6443,7 @@ get_normal_compl_info(char_u *line, int startcol, colnr_T curs_col) } else { - compl_pattern.string = vim_strnsave(line + compl_col, (size_t)compl_length); + compl_pattern.string = mnv_strnsave(line + compl_col, (size_t)compl_length); if (compl_pattern.string == NULL) { compl_pattern.length = 0; @@ -6458,9 +6458,9 @@ get_normal_compl_info(char_u *line, int startcol, colnr_T curs_col) size_t prefixlen = STRLEN_LITERAL("\\<"); size_t n; - if (!vim_iswordp(line + compl_col) + if (!mnv_iswordp(line + compl_col) || (compl_col > 0 - && (vim_iswordp(mb_prevptr(line, line + compl_col))))) + && (mnv_iswordp(mb_prevptr(line, line + compl_col))))) { prefix = (char_u *)""; prefixlen = 0; @@ -6480,12 +6480,12 @@ get_normal_compl_info(char_u *line, int startcol, colnr_T curs_col) compl_pattern.length = n - 1; } else if (--startcol < 0 - || !vim_iswordp(mb_prevptr(line, line + startcol + 1))) + || !mnv_iswordp(mb_prevptr(line, line + startcol + 1))) { size_t len = STRLEN_LITERAL("\\<\\k\\k"); // Match any word of at least two chars - compl_pattern.string = vim_strnsave((char_u *)"\\<\\k\\k", len); + compl_pattern.string = mnv_strnsave((char_u *)"\\<\\k\\k", len); if (compl_pattern.string == NULL) { compl_pattern.length = 0; @@ -6518,7 +6518,7 @@ get_normal_compl_info(char_u *line, int startcol, colnr_T curs_col) } else { - while (--startcol >= 0 && vim_iswordc(line[startcol])) + while (--startcol >= 0 && mnv_iswordc(line[startcol])) ; } @@ -6593,7 +6593,7 @@ get_wholeline_compl_info(char_u *line, colnr_T curs_col) } else { - compl_pattern.string = vim_strnsave(line + compl_col, (size_t)compl_length); + compl_pattern.string = mnv_strnsave(line + compl_col, (size_t)compl_length); if (compl_pattern.string == NULL) { compl_pattern.length = 0; @@ -6618,9 +6618,9 @@ get_filename_compl_info(char_u *line, int startcol, colnr_T curs_col) char_u *p = line + startcol; MB_PTR_BACK(line, p); - while (p > line && vim_isfilec(PTR2CHAR(p))) + while (p > line && mnv_isfilec(PTR2CHAR(p))) MB_PTR_BACK(line, p); - if (p == line && vim_isfilec(PTR2CHAR(p))) + if (p == line && mnv_isfilec(PTR2CHAR(p))) startcol = 0; else startcol = (int)(p - line) + 1; @@ -6647,7 +6647,7 @@ get_filename_compl_info(char_u *line, int startcol, colnr_T curs_col) static int get_cmdline_compl_info(char_u *line, colnr_T curs_col) { - compl_pattern.string = vim_strnsave(line, curs_col); + compl_pattern.string = mnv_strnsave(line, curs_col); if (compl_pattern.string == NULL) { compl_pattern.length = 0; @@ -6681,13 +6681,13 @@ set_compl_globals( { if (is_cpt_compl) { - VIM_CLEAR_STRING(cpt_compl_pattern); + MNV_CLEAR_STRING(cpt_compl_pattern); if (startcol < compl_col) return prepend_startcol_text(&cpt_compl_pattern, &compl_orig_text, startcol); else { - cpt_compl_pattern.string = vim_strnsave(compl_orig_text.string, + cpt_compl_pattern.string = mnv_strnsave(compl_orig_text.string, compl_orig_text.length); cpt_compl_pattern.length = compl_orig_text.length; } @@ -6701,7 +6701,7 @@ set_compl_globals( char_u *line = ml_get(curwin->w_cursor.lnum); int len = curs_col - startcol; - compl_pattern.string = vim_strnsave(line + startcol, (size_t)len); + compl_pattern.string = mnv_strnsave(line + startcol, (size_t)len); if (compl_pattern.string == NULL) { compl_pattern.length = 0; @@ -6837,7 +6837,7 @@ get_spell_compl_info(int startcol UNUSED, colnr_T curs_col UNUSED) } // Need to obtain "line" again, it may have become invalid. line = ml_get(curwin->w_cursor.lnum); - compl_pattern.string = vim_strnsave(line + compl_col, (size_t)compl_length); + compl_pattern.string = mnv_strnsave(line + compl_col, (size_t)compl_length); if (compl_pattern.string == NULL) { compl_pattern.length = 0; @@ -7067,9 +7067,9 @@ ins_compl_start(void) ins_compl_fixRedoBufForLeader(NULL); // Always add completion for the original text. - VIM_CLEAR_STRING(compl_orig_text); + MNV_CLEAR_STRING(compl_orig_text); compl_orig_text.length = (size_t)compl_length; - compl_orig_text.string = vim_strnsave(line + compl_col, (size_t)compl_length); + compl_orig_text.string = mnv_strnsave(line + compl_col, (size_t)compl_length); if (p_ic) flags |= CP_ICASE; if (compl_orig_text.string == NULL @@ -7077,8 +7077,8 @@ ins_compl_start(void) (int)compl_orig_text.length, NULL, NULL, NULL, 0, flags, FALSE, NULL, FUZZY_SCORE_NONE) != OK) { - VIM_CLEAR_STRING(compl_pattern); - VIM_CLEAR_STRING(compl_orig_text); + MNV_CLEAR_STRING(compl_pattern); + MNV_CLEAR_STRING(compl_orig_text); did_ai = save_did_ai; return FAIL; } @@ -7148,11 +7148,11 @@ ins_compl_show_statusmsg(void) static char_u match_ref[81]; if (compl_matches > 0) - vim_snprintf((char *)match_ref, sizeof(match_ref), + mnv_snprintf((char *)match_ref, sizeof(match_ref), _("match %d of %d"), compl_curr_match->cp_number, compl_matches); else - vim_snprintf((char *)match_ref, sizeof(match_ref), + mnv_snprintf((char *)match_ref, sizeof(match_ref), _("match %d"), compl_curr_match->cp_number); edit_submode_extra = match_ref; @@ -7411,7 +7411,7 @@ quote_meta(char_u *dest, char_u *src, int len) void free_insexpand_stuff(void) { - VIM_CLEAR_STRING(compl_orig_text); + MNV_CLEAR_STRING(compl_orig_text); # ifdef FEAT_EVAL free_callback(&cfu_cb); free_callback(&ofu_cb); @@ -7443,7 +7443,7 @@ spell_back_to_badword(void) static void cpt_sources_clear(void) { - VIM_CLEAR(cpt_sources_array); + MNV_CLEAR(cpt_sources_array); cpt_sources_index = -1; cpt_sources_count = 0; } @@ -7480,7 +7480,7 @@ setup_cpt_sources(void) slen = copy_option_part(&p, buf, LSIZE, ","); // Advance p if (slen > 0) { - char_u *caret = vim_strchr(buf, '^'); + char_u *caret = mnv_strchr(buf, '^'); if (caret != NULL) cpt_sources_array[idx].cs_max_matches = atoi((char *)caret + 1); @@ -7650,7 +7650,7 @@ cpt_compl_refresh(void) // Make the completion list linear (non-cyclic) ins_compl_make_linear(); // Make a copy of 'cpt' in case the buffer gets wiped out - cpt = vim_strsave(curbuf->b_p_cpt); + cpt = mnv_strsave(curbuf->b_p_cpt); strip_caret_numbers_in_place(cpt); cpt_sources_index = 0; @@ -7694,7 +7694,7 @@ cpt_compl_refresh(void) } cpt_sources_index = -1; - vim_free(cpt); + mnv_free(cpt); // Make the list cyclic compl_matches = ins_compl_make_cyclic(); #endif diff --git a/uvim/src/installman.sh b/uvim/src/installman.sh index f2ea796b5a..6f5ca2fe4d 100755 --- a/uvim/src/installman.sh +++ b/uvim/src/installman.sh @@ -1,35 +1,35 @@ #! /bin/sh -# installman.sh --- install or uninstall manpages for Vim +# installman.sh --- install or uninstall manpages for MNV # # arguments: # 1 what: "install", "uninstall" or "xxd" # 2 target directory e.g., "/usr/local/man/it/man1" # 3 language addition e.g., "" or "-it" -# 4 vim location as used in manual pages e.g., "/usr/local/share/vim" -# 5 runtime dir for menu.vim et al. e.g., "/usr/local/share/vim/vim81" -# 6 runtime dir for global vimrc file e.g., "/usr/local/share/vim" +# 4 mnv location as used in manual pages e.g., "/usr/local/share/mnv" +# 5 runtime dir for menu.mnv et al. e.g., "/usr/local/share/mnv/mnv81" +# 6 runtime dir for global mnvrc file e.g., "/usr/local/share/mnv" # 7 source dir for help files e.g., "../runtime/doc" # 8 mode bits for manpages e.g., "644" -# 9 vim exe name e.g., "vim" -# 10 name of vimdiff exe e.g., "vimdiff" -# 11 name of evim exe e.g., "evim" +# 9 mnv exe name e.g., "mnv" +# 10 name of mnvdiff exe e.g., "mnvdiff" +# 11 name of emnv exe e.g., "emnv" errstatus=0 what=$1 destdir=$2 langadd=$3 -vimloc=$4 +mnvloc=$4 scriptloc=$5 -vimrcloc=$6 +mnvrcloc=$6 helpsource=$7 manmod=$8 exename=$9 # older shells don't support ${10} shift -vimdiffname=$9 +mnvdiffname=$9 shift -evimname=$9 +emnvname=$9 helpsubloc=$scriptloc/doc printsubloc=$scriptloc/print @@ -48,57 +48,57 @@ fi # on some systems. if test $what = "install"; then - # vim.1 - if test -r $helpsource/vim$langadd.1; then + # mnv.1 + if test -r $helpsource/mnv$langadd.1; then echo installing $destdir/$exename.1 - LC_ALL=C sed -e s+/usr/local/lib/vim+$vimloc+ \ - -e s+'/usr/local/share/vim/vim??'+$vimloc+ \ - -e s+/usr/local/share/vim+$vimloc+ \ - -e s+$vimloc/doc+$helpsubloc+ \ - -e s+$vimloc/print+$printsubloc+ \ - -e s+$vimloc/syntax+$synsubloc+ \ - -e s+$vimloc/tutor+$tutorsubloc+ \ - -e s+$vimloc/vimrc+$vimrcloc/vimrc+ \ - -e s+$vimloc/gvimrc+$vimrcloc/gvimrc+ \ - -e s+$vimloc/menu.vim+$scriptloc/menu.vim+ \ - -e s+$vimloc/bugreport.vim+$scriptloc/bugreport.vim+ \ - -e s+$vimloc/filetype.vim+$scriptloc/filetype.vim+ \ - -e s+$vimloc/scripts.vim+$scriptloc/scripts.vim+ \ - -e s+$vimloc/optwin.vim+$scriptloc/optwin.vim+ \ - $helpsource/vim$langadd.1 > $destdir/$exename.1 + LC_ALL=C sed -e s+/usr/local/lib/mnv+$mnvloc+ \ + -e s+'/usr/local/share/mnv/mnv??'+$mnvloc+ \ + -e s+/usr/local/share/mnv+$mnvloc+ \ + -e s+$mnvloc/doc+$helpsubloc+ \ + -e s+$mnvloc/print+$printsubloc+ \ + -e s+$mnvloc/syntax+$synsubloc+ \ + -e s+$mnvloc/tutor+$tutorsubloc+ \ + -e s+$mnvloc/mnvrc+$mnvrcloc/mnvrc+ \ + -e s+$mnvloc/gmnvrc+$mnvrcloc/gmnvrc+ \ + -e s+$mnvloc/menu.mnv+$scriptloc/menu.mnv+ \ + -e s+$mnvloc/bugreport.mnv+$scriptloc/bugreport.mnv+ \ + -e s+$mnvloc/filetype.mnv+$scriptloc/filetype.mnv+ \ + -e s+$mnvloc/scripts.mnv+$scriptloc/scripts.mnv+ \ + -e s+$mnvloc/optwin.mnv+$scriptloc/optwin.mnv+ \ + $helpsource/mnv$langadd.1 > $destdir/$exename.1 chmod $manmod $destdir/$exename.1 fi - # vimtutor.1 - if test -r $helpsource/vimtutor$langadd.1; then + # mnvtutor.1 + if test -r $helpsource/mnvtutor$langadd.1; then echo installing $destdir/$exename""tutor.1 - LC_ALL=C sed -e s+/usr/local/lib/vim+$vimloc+ \ - -e s+'/usr/local/share/vim/vim??'+$vimloc+ \ - -e s+$vimloc/tutor+$tutorsubloc+ \ - $helpsource/vimtutor$langadd.1 > $destdir/$exename""tutor.1 + LC_ALL=C sed -e s+/usr/local/lib/mnv+$mnvloc+ \ + -e s+'/usr/local/share/mnv/mnv??'+$mnvloc+ \ + -e s+$mnvloc/tutor+$tutorsubloc+ \ + $helpsource/mnvtutor$langadd.1 > $destdir/$exename""tutor.1 chmod $manmod $destdir/$exename""tutor.1 fi - # vimdiff.1 - if test -r $helpsource/vimdiff$langadd.1; then - echo installing $destdir/$vimdiffname.1 - cp $helpsource/vimdiff$langadd.1 $destdir/$vimdiffname.1 - chmod $manmod $destdir/$vimdiffname.1 + # mnvdiff.1 + if test -r $helpsource/mnvdiff$langadd.1; then + echo installing $destdir/$mnvdiffname.1 + cp $helpsource/mnvdiff$langadd.1 $destdir/$mnvdiffname.1 + chmod $manmod $destdir/$mnvdiffname.1 fi - # evim.1 - if test -r $helpsource/evim$langadd.1; then - echo installing $destdir/$evimname.1 - LC_ALL=C sed -e s+/usr/local/lib/vim+$vimloc+ \ - -e s+'/usr/local/share/vim/vim??'+$vimloc+ \ - -e s+$vimloc/evim.vim+$scriptloc/evim.vim+ \ - $helpsource/evim$langadd.1 > $destdir/$evimname.1 - chmod $manmod $destdir/$evimname.1 + # emnv.1 + if test -r $helpsource/emnv$langadd.1; then + echo installing $destdir/$emnvname.1 + LC_ALL=C sed -e s+/usr/local/lib/mnv+$mnvloc+ \ + -e s+'/usr/local/share/mnv/mnv??'+$mnvloc+ \ + -e s+$mnvloc/emnv.mnv+$scriptloc/emnv.mnv+ \ + $helpsource/emnv$langadd.1 > $destdir/$emnvname.1 + chmod $manmod $destdir/$emnvname.1 fi fi if test $what = "uninstall"; then - echo Checking for Vim manual pages in $destdir... + echo Checking for MNV manual pages in $destdir... if test -r $destdir/$exename.1; then echo deleting $destdir/$exename.1 rm -f $destdir/$exename.1 @@ -107,13 +107,13 @@ if test $what = "uninstall"; then echo deleting $destdir/$exename""tutor.1 rm -f $destdir/$exename""tutor.1 fi - if test -r $destdir/$vimdiffname.1; then - echo deleting $destdir/$vimdiffname.1 - rm -f $destdir/$vimdiffname.1 + if test -r $destdir/$mnvdiffname.1; then + echo deleting $destdir/$mnvdiffname.1 + rm -f $destdir/$mnvdiffname.1 fi - if test -r $destdir/$evimname.1; then - echo deleting $destdir/$evimname.1 - rm -f $destdir/$evimname.1 + if test -r $destdir/$emnvname.1; then + echo deleting $destdir/$emnvname.1 + rm -f $destdir/$emnvname.1 fi fi @@ -125,4 +125,4 @@ fi exit $errstatus -# vim: set sw=3 sts=3 : +# mnv: set sw=3 sts=3 : diff --git a/uvim/src/installml.sh b/uvim/src/installml.sh index 8649c6ff56..ee2d671d69 100644 --- a/uvim/src/installml.sh +++ b/uvim/src/installml.sh @@ -1,22 +1,22 @@ #! /bin/sh -# installml.sh --- install or uninstall manpage links for Vim +# installml.sh --- install or uninstall manpage links for MNV # # arguments: # 1 what: "install" or "uninstall" # 2 also do GUI pages: "yes" or "" # 3 target directory e.g., "/usr/local/man/it/man1" -# 4 vim exe name e.g., "vim" -# 5 vimdiff exe name e.g., "vimdiff" -# 6 evim exe name e.g., "evim" +# 4 mnv exe name e.g., "mnv" +# 5 mnvdiff exe name e.g., "mnvdiff" +# 6 emnv exe name e.g., "emnv" # 7 ex exe name e.g., "ex" # 8 view exe name e.g., "view" -# 9 rvim exe name e.g., "rvim" +# 9 rmnv exe name e.g., "rmnv" # 10 rview exe name e.g., "rview" -# 11 gvim exe name e.g., "gvim" +# 11 gmnv exe name e.g., "gmnv" # 12 gview exe name e.g., "gview" -# 13 rgvim exe name e.g., "rgvim" +# 13 rgmnv exe name e.g., "rgmnv" # 14 rgview exe name e.g., "rgview" -# 15 gvimdiff exe name e.g., "gvimdiff" +# 15 gmnvdiff exe name e.g., "gmnvdiff" # 16 eview exe name e.g., "eview" errstatus=0 @@ -24,100 +24,100 @@ errstatus=0 what=$1 gui=$2 destdir=$3 -vimname=$4 -vimdiffname=$5 -evimname=$6 +mnvname=$4 +mnvdiffname=$5 +emnvname=$6 exname=$7 viewname=$8 -rvimname=$9 +rmnvname=$9 # old shells don't understand ${10} shift rviewname=$9 shift -gvimname=$9 +gmnvname=$9 shift gviewname=$9 shift -rgvimname=$9 +rgmnvname=$9 shift rgviewname=$9 shift -gvimdiffname=$9 +gmnvdiffname=$9 shift eviewname=$9 -if test $what = "install" -a \( -f $destdir/$vimname.1 -o -f $destdir/$vimdiffname.1 -o -f $destdir/$eviewname.1 \); then +if test $what = "install" -a \( -f $destdir/$mnvname.1 -o -f $destdir/$mnvdiffname.1 -o -f $destdir/$eviewname.1 \); then if test ! -d $destdir; then echo creating $destdir /bin/sh install-sh -c -d $destdir fi # ex - if test ! -f $destdir/$exname.1 -a -f $destdir/$vimname.1; then + if test ! -f $destdir/$exname.1 -a -f $destdir/$mnvname.1; then echo creating link $destdir/$exname.1 - cd $destdir; ln -s $vimname.1 $exname.1 + cd $destdir; ln -s $mnvname.1 $exname.1 fi # view - if test ! -f $destdir/$viewname.1 -a -f $destdir/$vimname.1; then + if test ! -f $destdir/$viewname.1 -a -f $destdir/$mnvname.1; then echo creating link $destdir/$viewname.1 - cd $destdir; ln -s $vimname.1 $viewname.1 + cd $destdir; ln -s $mnvname.1 $viewname.1 fi - # rvim - if test ! -f $destdir/$rvimname.1 -a -f $destdir/$vimname.1; then - echo creating link $destdir/$rvimname.1 - cd $destdir; ln -s $vimname.1 $rvimname.1 + # rmnv + if test ! -f $destdir/$rmnvname.1 -a -f $destdir/$mnvname.1; then + echo creating link $destdir/$rmnvname.1 + cd $destdir; ln -s $mnvname.1 $rmnvname.1 fi # rview - if test ! -f $destdir/$rviewname.1 -a -f $destdir/$vimname.1; then + if test ! -f $destdir/$rviewname.1 -a -f $destdir/$mnvname.1; then echo creating link $destdir/$rviewname.1 - cd $destdir; ln -s $vimname.1 $rviewname.1 + cd $destdir; ln -s $mnvname.1 $rviewname.1 fi # GUI targets are optional if test "$gui" = "yes"; then - # gvim - if test ! -f $destdir/$gvimname.1 -a -f $destdir/$vimname.1; then - echo creating link $destdir/$gvimname.1 - cd $destdir; ln -s $vimname.1 $gvimname.1 + # gmnv + if test ! -f $destdir/$gmnvname.1 -a -f $destdir/$mnvname.1; then + echo creating link $destdir/$gmnvname.1 + cd $destdir; ln -s $mnvname.1 $gmnvname.1 fi # gview - if test ! -f $destdir/$gviewname.1 -a -f $destdir/$vimname.1; then + if test ! -f $destdir/$gviewname.1 -a -f $destdir/$mnvname.1; then echo creating link $destdir/$gviewname.1 - cd $destdir; ln -s $vimname.1 $gviewname.1 + cd $destdir; ln -s $mnvname.1 $gviewname.1 fi - # rgvim - if test ! -f $destdir/$rgvimname.1 -a -f $destdir/$vimname.1; then - echo creating link $destdir/$rgvimname.1 - cd $destdir; ln -s $vimname.1 $rgvimname.1 + # rgmnv + if test ! -f $destdir/$rgmnvname.1 -a -f $destdir/$mnvname.1; then + echo creating link $destdir/$rgmnvname.1 + cd $destdir; ln -s $mnvname.1 $rgmnvname.1 fi # rgview - if test ! -f $destdir/$rgviewname.1 -a -f $destdir/$vimname.1; then + if test ! -f $destdir/$rgviewname.1 -a -f $destdir/$mnvname.1; then echo creating link $destdir/$rgviewname.1 - cd $destdir; ln -s $vimname.1 $rgviewname.1 + cd $destdir; ln -s $mnvname.1 $rgviewname.1 fi - # gvimdiff - if test ! -f $destdir/$gvimdiffname.1 -a -f $destdir/$vimdiffname.1; then - echo creating link $destdir/$gvimdiffname.1 - cd $destdir; ln -s $vimdiffname.1 $gvimdiffname.1 + # gmnvdiff + if test ! -f $destdir/$gmnvdiffname.1 -a -f $destdir/$mnvdiffname.1; then + echo creating link $destdir/$gmnvdiffname.1 + cd $destdir; ln -s $mnvdiffname.1 $gmnvdiffname.1 fi # eview - if test ! -f $destdir/$eviewname.1 -a -f $destdir/$evimname.1; then + if test ! -f $destdir/$eviewname.1 -a -f $destdir/$emnvname.1; then echo creating link $destdir/$eviewname.1 - cd $destdir; ln -s $evimname.1 $eviewname.1 + cd $destdir; ln -s $emnvname.1 $eviewname.1 fi fi fi if test $what = "uninstall"; then - echo Checking for Vim manual page links in $destdir... + echo Checking for MNV manual page links in $destdir... if test -L $destdir/$exname.1; then echo deleting $destdir/$exname.1 @@ -127,9 +127,9 @@ if test $what = "uninstall"; then echo deleting $destdir/$viewname.1 rm -f $destdir/$viewname.1 fi - if test -L $destdir/$rvimname.1; then - echo deleting $destdir/$rvimname.1 - rm -f $destdir/$rvimname.1 + if test -L $destdir/$rmnvname.1; then + echo deleting $destdir/$rmnvname.1 + rm -f $destdir/$rmnvname.1 fi if test -L $destdir/$rviewname.1; then echo deleting $destdir/$rviewname.1 @@ -138,25 +138,25 @@ if test $what = "uninstall"; then # GUI targets are optional if test "$gui" = "yes"; then - if test -L $destdir/$gvimname.1; then - echo deleting $destdir/$gvimname.1 - rm -f $destdir/$gvimname.1 + if test -L $destdir/$gmnvname.1; then + echo deleting $destdir/$gmnvname.1 + rm -f $destdir/$gmnvname.1 fi if test -L $destdir/$gviewname.1; then echo deleting $destdir/$gviewname.1 rm -f $destdir/$gviewname.1 fi - if test -L $destdir/$rgvimname.1; then - echo deleting $destdir/$rgvimname.1 - rm -f $destdir/$rgvimname.1 + if test -L $destdir/$rgmnvname.1; then + echo deleting $destdir/$rgmnvname.1 + rm -f $destdir/$rgmnvname.1 fi if test -L $destdir/$rgviewname.1; then echo deleting $destdir/$rgviewname.1 rm -f $destdir/$rgviewname.1 fi - if test -L $destdir/$gvimdiffname.1; then - echo deleting $destdir/$gvimdiffname.1 - rm -f $destdir/$gvimdiffname.1 + if test -L $destdir/$gmnvdiffname.1; then + echo deleting $destdir/$gmnvdiffname.1 + rm -f $destdir/$gmnvdiffname.1 fi if test -L $destdir/$eviewname.1; then echo deleting $destdir/$eviewname.1 @@ -167,4 +167,4 @@ fi exit $errstatus -# vim: set sw=3 : +# mnv: set sw=3 : diff --git a/uvim/src/iscygpty.c b/uvim/src/iscygpty.c index f4a23938aa..fee5db1467 100644 --- a/uvim/src/iscygpty.c +++ b/uvim/src/iscygpty.c @@ -5,7 +5,7 @@ * Copyright (c) 2015-2023 K.Takata * * You can redistribute it and/or modify it under the terms of either - * the MIT license (as described below) or the Vim license. + * the MIT license (as described below) or the MNV license. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -187,4 +187,4 @@ int is_cygpty_used(void) #endif // _WIN32 -// vim: set ts=4 sw=4: +// mnv: set ts=4 sw=4: diff --git a/uvim/src/iscygpty.h b/uvim/src/iscygpty.h index 01db588aa3..9808a775c3 100644 --- a/uvim/src/iscygpty.h +++ b/uvim/src/iscygpty.h @@ -5,7 +5,7 @@ * Copyright (c) 2015-2017 K.Takata * * You can redistribute it and/or modify it under the terms of either - * the MIT license (as described below) or the Vim license. + * the MIT license (as described below) or the MNV license. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the diff --git a/uvim/src/job.c b/uvim/src/job.c index 041a8e9b93..377a252ec1 100644 --- a/uvim/src/job.c +++ b/uvim/src/job.c @@ -1,16 +1,16 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* * Implements starting jobs and controlling them. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_JOB_CHANNEL) @@ -85,7 +85,7 @@ unref_job_callback(callback_T *cb) { func_unref(cb->cb_name); if (cb->cb_free_name) - vim_free(cb->cb_name); + mnv_free(cb->cb_name); } } @@ -405,9 +405,9 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (p != NULL) { // Must have %d and no other %. - p = vim_strchr(p, '%'); + p = mnv_strchr(p, '%'); if (p != NULL && (p[1] != 'd' - || vim_strchr(p + 2, '%') != NULL)) + || mnv_strchr(p + 2, '%') != NULL)) p = NULL; } if (p == NULL) @@ -764,21 +764,21 @@ job_free_contents(job_T *job) } mch_clear_job(job); - vim_free(job->jv_tty_in); - vim_free(job->jv_tty_out); - vim_free(job->jv_stoponexit); + mnv_free(job->jv_tty_in); + mnv_free(job->jv_tty_out); + mnv_free(job->jv_stoponexit); #ifdef UNIX - vim_free(job->jv_termsig); + mnv_free(job->jv_termsig); #endif #ifdef MSWIN - vim_free(job->jv_tty_type); + mnv_free(job->jv_tty_type); #endif free_callback(&job->jv_exit_cb); if (job->jv_argv != NULL) { for (i = 0; job->jv_argv[i] != NULL; i++) - vim_free(job->jv_argv[i]); - vim_free(job->jv_argv); + mnv_free(job->jv_argv[i]); + mnv_free(job->jv_argv); } } @@ -800,7 +800,7 @@ job_unlink(job_T *job) job_free_job(job_T *job) { job_unlink(job); - vim_free(job); + mnv_free(job); } static void @@ -836,7 +836,7 @@ free_jobs_to_free_later(void) job = jobs_to_free; jobs_to_free = job->jv_next; job_free_contents(job); - vim_free(job); + mnv_free(job); } } @@ -947,7 +947,7 @@ win32_escape_arg(char_u *arg) dlen += 2; if (dlen == slen) - return vim_strsave(arg); + return mnv_strsave(arg); // Allocate memory for the result and fill it. escaped_arg = alloc(dlen + 1); @@ -1015,7 +1015,7 @@ win32_build_cmd(list_T *l, garray_T *gap) if (s == NULL) return FAIL; ga_concat(gap, s); - vim_free(s); + mnv_free(s); if (li->li_next != NULL) ga_append(gap, ' '); } @@ -1117,7 +1117,7 @@ job_unref(job_T *job) else if (job->jv_channel != NULL) { // Do remove the link to the channel, otherwise it hangs - // around until Vim exits. See job_free() for refcount. + // around until MNV exits. See job_free() for refcount. ch_log(job->jv_channel, "detaching channel from job"); job->jv_channel->ch_job = NULL; channel_unref(job->jv_channel); @@ -1174,7 +1174,7 @@ job_alloc(void) return NULL; job->jv_refcount = 1; - job->jv_stoponexit = vim_strsave((char_u *)"term"); + job->jv_stoponexit = mnv_strsave((char_u *)"term"); if (first_job != NULL) { @@ -1190,11 +1190,11 @@ job_set_options(job_T *job, jobopt_T *opt) { if (opt->jo_set & JO_STOPONEXIT) { - vim_free(job->jv_stoponexit); + mnv_free(job->jv_stoponexit); if (opt->jo_stoponexit == NULL || *opt->jo_stoponexit == NUL) job->jv_stoponexit = NULL; else - job->jv_stoponexit = vim_strsave(opt->jo_stoponexit); + job->jv_stoponexit = mnv_strsave(opt->jo_stoponexit); } if (opt->jo_set & JO_EXIT_CB) { @@ -1210,7 +1210,7 @@ job_set_options(job_T *job, jobopt_T *opt) } /* - * Called when Vim is exiting: kill all jobs that have the "stoponexit" flag. + * Called when MNV is exiting: kill all jobs that have the "stoponexit" flag. */ void job_stop_on_exit(void) @@ -1389,7 +1389,7 @@ job_start( if (argv == NULL) goto theend; for (i = 0; i < argc; i++) - argv[i] = (char *)vim_strsave((char_u *)argv_arg[i]); + argv[i] = (char *)mnv_strsave((char_u *)argv_arg[i]); argv[argc] = NULL; } else @@ -1473,13 +1473,13 @@ job_start( theend: #ifndef USE_ARGV - vim_free(ga.ga_data); + mnv_free(ga.ga_data); #endif if (argv != NULL && argv != job->jv_argv) { for (i = 0; argv[i] != NULL; i++) - vim_free(argv[i]); - vim_free(argv); + mnv_free(argv[i]); + mnv_free(argv); } free_job_options(&opt); return job; @@ -1577,7 +1577,7 @@ invoke_prompt_callback(void) if (STRLEN(text) >= STRLEN(prompt)) text += STRLEN(prompt); argv[0].v_type = VAR_STRING; - argv[0].vval.v_string = vim_strsave(text); + argv[0].vval.v_string = mnv_strsave(text); argv[1].v_type = VAR_UNKNOWN; call_callback(&curbuf->b_prompt_callback, -1, &rettv, 1, argv); @@ -1686,7 +1686,7 @@ f_prompt_setcallback(typval_T *argvars, typval_T *rettv UNUSED) if (check_secure()) return; - if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_buffer_arg(argvars, 0) == FAIL) return; buf = tv_get_buf(&argvars[0], FALSE); @@ -1713,7 +1713,7 @@ f_prompt_setinterrupt(typval_T *argvars, typval_T *rettv UNUSED) if (check_secure()) return; - if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_buffer_arg(argvars, 0) == FAIL) return; buf = tv_get_buf(&argvars[0], FALSE); @@ -1741,7 +1741,7 @@ f_prompt_getprompt(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() && check_for_buffer_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_buffer_arg(argvars, 0) == FAIL) return; buf = tv_get_buf_from_arg(&argvars[0]); @@ -1751,7 +1751,7 @@ f_prompt_getprompt(typval_T *argvars, typval_T *rettv) if (!bt_prompt(buf)) return; - rettv->vval.v_string = vim_strsave(buf_prompt_text(buf)); + rettv->vval.v_string = mnv_strsave(buf_prompt_text(buf)); } /* @@ -1763,7 +1763,7 @@ f_prompt_setprompt(typval_T *argvars, typval_T *rettv UNUSED) buf_T *buf; char_u *text; - if (in_vim9script() + if (in_mnv9script() && (check_for_buffer_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL)) return; @@ -1775,8 +1775,8 @@ f_prompt_setprompt(typval_T *argvars, typval_T *rettv UNUSED) return; text = tv_get_string(&argvars[1]); - vim_free(buf->b_prompt_text); - buf->b_prompt_text = vim_strsave(text); + mnv_free(buf->b_prompt_text); + buf->b_prompt_text = mnv_strsave(text); } /* @@ -1808,7 +1808,7 @@ f_job_getchannel(typval_T *argvars, typval_T *rettv) { job_T *job; - if (in_vim9script() && check_for_job_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_job_arg(argvars, 0) == FAIL) return; job = get_job_arg(&argvars[0]); @@ -1898,7 +1898,7 @@ job_info_all(list_T *l) void f_job_info(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_opt_job_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_job_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type != VAR_UNKNOWN) @@ -1922,7 +1922,7 @@ f_job_setoptions(typval_T *argvars, typval_T *rettv UNUSED) job_T *job; jobopt_T opt; - if (in_vim9script() + if (in_mnv9script() && (check_for_job_arg(argvars, 0) == FAIL || check_for_dict_arg(argvars, 1) == FAIL)) return; @@ -1946,7 +1946,7 @@ f_job_start(typval_T *argvars, typval_T *rettv) if (check_restricted() || check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_or_list_arg(argvars, 0) == FAIL || check_for_opt_dict_arg(argvars, 1) == FAIL)) return; @@ -1960,14 +1960,14 @@ f_job_start(typval_T *argvars, typval_T *rettv) void f_job_status(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() && check_for_job_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_job_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type == VAR_JOB && argvars[0].vval.v_job == NULL) { // A job that never started returns "fail". rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strsave((char_u *)"fail"); + rettv->vval.v_string = mnv_strsave((char_u *)"fail"); } else { @@ -1976,7 +1976,7 @@ f_job_status(typval_T *argvars, typval_T *rettv) if (job != NULL) { rettv->v_type = VAR_STRING; - rettv->vval.v_string = vim_strsave((char_u *)job_status(job)); + rettv->vval.v_string = mnv_strsave((char_u *)job_status(job)); } } } @@ -1989,7 +1989,7 @@ f_job_stop(typval_T *argvars, typval_T *rettv) { job_T *job; - if (in_vim9script() + if (in_mnv9script() && (check_for_job_arg(argvars, 0) == FAIL || check_for_opt_string_or_number_arg(argvars, 1) == FAIL)) return; @@ -2011,23 +2011,23 @@ job_to_string_buf(typval_T *varp, char_u *buf) if (job == NULL) { - vim_snprintf((char *)buf, NUMBUFLEN, "no process"); + mnv_snprintf((char *)buf, NUMBUFLEN, "no process"); return buf; } status = job->jv_status == JOB_FAILED ? "fail" : job->jv_status >= JOB_ENDED ? "dead" : "run"; #ifdef UNIX - vim_snprintf((char *)buf, NUMBUFLEN, + mnv_snprintf((char *)buf, NUMBUFLEN, "process %ld %s", (long)job->jv_pid, status); #elif defined(MSWIN) - vim_snprintf((char *)buf, NUMBUFLEN, + mnv_snprintf((char *)buf, NUMBUFLEN, "process %ld %s", (long)job->jv_proc_info.dwProcessId, status); #else // fall-back - vim_snprintf((char *)buf, NUMBUFLEN, "process ? %s", status); + mnv_snprintf((char *)buf, NUMBUFLEN, "process ? %s", status); #endif return buf; } diff --git a/uvim/src/json.c b/uvim/src/json.c index a21ed6e771..c8201fc194 100644 --- a/uvim/src/json.c +++ b/uvim/src/json.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -14,7 +14,7 @@ */ #define USING_FLOAT_STUFF -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) @@ -31,7 +31,7 @@ json_encode_gap(garray_T *gap, typval_T *val, int options) if (json_encode_item(gap, val, get_copyID(), options, 0) == FAIL) { ga_clear(gap); - gap->ga_data = vim_strsave((char_u *)""); + gap->ga_data = mnv_strsave((char_u *)""); return FAIL; } return OK; @@ -105,7 +105,7 @@ json_encode_lsp_msg(typval_T *val) ga_init2(&lspga, 1, 4000); // Header according to LSP specification. - IObufflen = vim_snprintf_safelen((char *)IObuff, IOSIZE, + IObufflen = mnv_snprintf_safelen((char *)IObuff, IOSIZE, "Content-Length: %u\r\n\r\n", ga.ga_len - 1); ga_concat_len(&lspga, IObuff, IObufflen); @@ -139,7 +139,7 @@ write_string(garray_T *gap, char_u *str) char_u numbuf[NUMBUFLEN]; char_u *from; #if defined(USE_ICONV) - vimconv_T conv; + mnvconv_T conv; char_u *converted = NULL; #endif int c; @@ -204,7 +204,7 @@ write_string(garray_T *gap, char_u *str) { size_t numbuflen; - numbuflen = vim_snprintf_safelen((char *)numbuf, + numbuflen = mnv_snprintf_safelen((char *)numbuf, sizeof(numbuf), "\\u%04lx", (long)c); ga_concat_len(gap, numbuf, numbuflen); } @@ -242,7 +242,7 @@ write_string(garray_T *gap, char_u *str) ga_append(gap, '"'); #if defined(USE_ICONV) - vim_free(converted); + mnv_free(converted); #endif } @@ -259,7 +259,7 @@ is_simple_key(char_u *key) if (!ASCII_ISALPHA(*key)) return FALSE; for (p = key + 1; *p != NUL; ++p) - if (!ASCII_ISALPHA(*p) && *p != '_' && !vim_isdigit(*p)) + if (!ASCII_ISALPHA(*p) && *p != '_' && !mnv_isdigit(*p)) return FALSE; return TRUE; } @@ -311,7 +311,7 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID, int options, int dept { size_t numbuflen; - numbuflen = vim_snprintf_safelen((char *)numbuf, sizeof(numbuf), + numbuflen = mnv_snprintf_safelen((char *)numbuf, sizeof(numbuf), "%lld", (varnumber_T)val->vval.v_number); ga_concat_len(gap, numbuf, numbuflen); } @@ -498,7 +498,7 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID, int options, int dept { size_t numbuflen; - numbuflen = vim_snprintf_safelen((char *)numbuf, sizeof(numbuf), + numbuflen = mnv_snprintf_safelen((char *)numbuf, sizeof(numbuf), "%g", val->vval.v_float); ga_concat_len(gap, numbuf, numbuflen); } @@ -613,7 +613,7 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote) } nr = 0; len = 0; - vim_str2nr(p + 2, NULL, &len, + mnv_str2nr(p + 2, NULL, &len, STR2NR_HEX + STR2NR_FORCE, &nr, NULL, 4, TRUE, NULL); if (len == 0) { @@ -630,7 +630,7 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote) // decode surrogate pair: \ud812\u3456 len = 0; - vim_str2nr(p + 2, NULL, &len, STR2NR_HEX + STR2NR_FORCE, + mnv_str2nr(p + 2, NULL, &len, STR2NR_HEX + STR2NR_FORCE, &nr2, NULL, 4, TRUE, NULL); if (len == 0) { @@ -702,7 +702,7 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote) #if defined(USE_ICONV) if (!enc_utf8) { - vimconv_T conv; + mnvconv_T conv; // Convert the utf-8 string to 'encoding'. conv.vc_type = CONV_NONE; @@ -711,7 +711,7 @@ json_decode_string(js_read_T *reader, typval_T *res, int quote) { res->vval.v_string = string_convert(&conv, ga.ga_data, NULL); - vim_free(ga.ga_data); + mnv_free(ga.ga_data); } convert_setup(&conv, NULL, NULL); } @@ -820,7 +820,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options) if (cur_item != NULL) { cur_item->v_type = VAR_STRING; - cur_item->vval.v_string = vim_strnsave(key, p - key); + cur_item->vval.v_string = mnv_strnsave(key, p - key); top_item->jd_key = cur_item->vval.v_string; } reader->js_used += (int)(p - key); @@ -935,8 +935,8 @@ json_decode_item(js_read_T *reader, typval_T *res, int options) break; default: - if (VIM_ISDIGIT(*p) || (*p == '-' - && (VIM_ISDIGIT(p[1]) || p[1] == NUL))) + if (MNV_ISDIGIT(*p) || (*p == '-' + && (MNV_ISDIGIT(p[1]) || p[1] == NUL))) { char_u *sp = p; @@ -948,7 +948,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options) retval = MAYBE; break; } - if (!VIM_ISDIGIT(*sp)) + if (!MNV_ISDIGIT(*sp)) { semsg(_(e_json_decode_error_at_str), p); retval = FAIL; @@ -975,7 +975,7 @@ json_decode_item(js_read_T *reader, typval_T *res, int options) { varnumber_T nr; - vim_str2nr(reader->js_buf + reader->js_used, + mnv_str2nr(reader->js_buf + reader->js_used, NULL, &len, 0, // what &nr, NULL, 0, TRUE, NULL); if (len == 0) @@ -1330,7 +1330,7 @@ f_js_decode(typval_T *argvars, typval_T *rettv) { js_read_T reader; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; reader.js_buf = tv_get_string(&argvars[0]); @@ -1358,7 +1358,7 @@ f_json_decode(typval_T *argvars, typval_T *rettv) { js_read_T reader; - if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_string_arg(argvars, 0) == FAIL) return; reader.js_buf = tv_get_string(&argvars[0]); diff --git a/uvim/src/json_test.c b/uvim/src/json_test.c index a35fd75a4a..cb7c61b5fb 100644 --- a/uvim/src/json_test.c +++ b/uvim/src/json_test.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -15,7 +15,7 @@ #include // Must include main.c because it contains much more than just main() -#define NO_VIM_MAIN +#define NO_MNV_MAIN #include "main.c" // This file has to be included because the tested functions are static diff --git a/uvim/src/keymap.h b/uvim/src/keymap.h index b3be60c48d..000a5e4d86 100644 --- a/uvim/src/keymap.h +++ b/uvim/src/keymap.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* diff --git a/uvim/src/kword_test.c b/uvim/src/kword_test.c index 5d509fcf86..5ac5745825 100644 --- a/uvim/src/kword_test.c +++ b/uvim/src/kword_test.c @@ -1,28 +1,28 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* - * kword_test.c: Unittests for vim_iswordc() and vim_iswordp(). + * kword_test.c: Unittests for mnv_iswordc() and mnv_iswordp(). */ #undef NDEBUG #include // Must include main.c because it contains much more than just main() -#define NO_VIM_MAIN +#define NO_MNV_MAIN #include "main.c" // This file has to be included because the tested functions are static #include "charset.c" /* - * Test the results of vim_iswordc() and vim_iswordp() are matched. + * Test the results of mnv_iswordc() and mnv_iswordp() are matched. */ static void test_isword_funcs_utf8(void) @@ -58,15 +58,15 @@ test_isword_funcs_utf8(void) fprintf(stderr, "c != utf_ptr2char(p) (=%#04x)\n", c1); abort(); } - retc = vim_iswordc_buf(c, &buf); - retp = vim_iswordp_buf(p, &buf); + retc = mnv_iswordc_buf(c, &buf); + retp = mnv_iswordp_buf(p, &buf); if (retc != retp) { fprintf(stderr, "Failed: "); fprintf(stderr, "[c = %#04x, p = {%#02x, %#02x, %#02x}] ", c, p[0], p[1], p[2]); - fprintf(stderr, "vim_iswordc(c) (=%d) != vim_iswordp(p) (=%d)\n", + fprintf(stderr, "mnv_iswordc(c) (=%d) != mnv_iswordp(p) (=%d)\n", retc, retp); abort(); } diff --git a/uvim/src/libvterm/README b/uvim/src/libvterm/README index 56c6e222be..a04a777ac8 100644 --- a/uvim/src/libvterm/README +++ b/uvim/src/libvterm/README @@ -4,7 +4,7 @@ The original can be found: - on the original site (tar archive and Bazaar repository): http://www.leonerd.org.uk/code/libvterm/ - cloned on Github: - https://github.com/neovim/libvterm + https://github.com/neomnv/libvterm Modifications: - revisions up to 839 have been included @@ -12,7 +12,7 @@ Modifications: - use TRUE and FALSE instead of true and false - use int or unsigned int instead of bool - Converted some code from C99 to C90. -- Other changes to support embedding in Vim. +- Other changes to support embedding in MNV. To get the latest version of libvterm you need the "bzr" command and do: bzr co http://bazaar.leonerd.org.uk/c/libvterm/ @@ -24,7 +24,7 @@ patch number: To merge in changes from Github, do this: - Commit any pending changes. - Setup the merge tool: - git config merge.tool vimdiff + git config merge.tool mnvdiff git config merge.conflictstyle diff3 git config mergetool.prompt false - Run the merge tool: diff --git a/uvim/src/libvterm/include/vterm.h b/uvim/src/libvterm/include/vterm.h index 48deebe25e..dd2fc2fd41 100644 --- a/uvim/src/libvterm/include/vterm.h +++ b/uvim/src/libvterm/include/vterm.h @@ -12,16 +12,16 @@ extern "C" { #include "vterm_keycodes.h" -// VIM: use TRUE and FALSE instead of true and false +// MNV: use TRUE and FALSE instead of true and false #define TRUE 1 #define FALSE 0 -// VIM: from stdint.h +// MNV: from stdint.h typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; -// VIM: define max screen cols and rows +// MNV: define max screen cols and rows #define VTERM_MAX_COLS 1000 #define VTERM_MAX_ROWS 1000 @@ -137,7 +137,7 @@ typedef enum { VTERM_COLOR_DEFAULT_MASK = 0x06, /** - * VIM: If set, indicates that the color is invalid. + * MNV: If set, indicates that the color is invalid. */ VTERM_COLOR_INVALID = 0x08 } VTermColorType; @@ -178,7 +178,7 @@ typedef enum { */ #define VTERM_COLOR_IS_INVALID(col) (!!((col)->type & VTERM_COLOR_INVALID)) -// VIM: this was a union, but that doesn't always work. +// MNV: this was a union, but that doesn't always work. typedef struct { /** * Tag indicating which member is actually valid. @@ -261,7 +261,7 @@ typedef enum { VTERM_PROP_CURSORSHAPE, // number VTERM_PROP_MOUSE, // number VTERM_PROP_FOCUSREPORT, // bool - VTERM_PROP_CURSORCOLOR, // VIM - string + VTERM_PROP_CURSORCOLOR, // MNV - string VTERM_N_PROPS } VTermProp; @@ -405,7 +405,7 @@ void vterm_mouse_button(VTerm *vt, int button, int pressed, VTermModifier mod); #define CSI_ARG(a) ((a) & CSI_ARG_MASK) /* Can't use -1 to indicate a missing argument; use this instead */ -// VIM: changed 31 to 30 to avoid an overflow warning +// MNV: changed 31 to 30 to avoid an overflow warning #define CSI_ARG_MISSING ((1<<30)-1) #define CSI_ARG_IS_MISSING(a) (CSI_ARG(a) == CSI_ARG_MISSING) @@ -454,7 +454,7 @@ typedef struct { int (*sb_clear)(void *user); } VTermStateCallbacks; -// VIM: added +// MNV: added typedef struct { VTermPos pos; int buttons; @@ -495,7 +495,7 @@ void *vterm_state_get_unrecognised_fbdata(VTermState *state); void vterm_state_reset(VTermState *state, int hard); void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos); -// VIM: added +// MNV: added void vterm_state_get_mousestate(const VTermState *state, VTermMouseState *mousestate); void vterm_state_get_default_colors(const VTermState *state, VTermColor *default_fg, VTermColor *default_bg); void vterm_state_get_palette_color(const VTermState *state, int index, VTermColor *col); diff --git a/uvim/src/libvterm/src/encoding.c b/uvim/src/libvterm/src/encoding.c index 817344f333..9d1216767a 100644 --- a/uvim/src/libvterm/src/encoding.c +++ b/uvim/src/libvterm/src/encoding.c @@ -49,7 +49,7 @@ static void decode_utf8(VTermEncoding *enc UNUSED, void *data_, if(data->bytes_remaining) { data->bytes_remaining = 0; cp[(*cpi)++] = UNICODE_INVALID; - // VIM: avoid going over the end + // MNV: avoid going over the end if (*cpi >= cplen) break; } diff --git a/uvim/src/libvterm/src/keyboard.c b/uvim/src/libvterm/src/keyboard.c index 7a44670e7e..7ea82542e6 100644 --- a/uvim/src/libvterm/src/keyboard.c +++ b/uvim/src/libvterm/src/keyboard.c @@ -4,13 +4,13 @@ #include "utf8.h" -// VIM: added +// MNV: added int vterm_is_modify_other_keys(VTerm *vt) { return vt->state->mode.modify_other_keys; } -// VIM: added +// MNV: added int vterm_is_kitty_keyboard(VTerm *vt) { return vt->state->mode.kitty_keyboard; @@ -19,13 +19,13 @@ int vterm_is_kitty_keyboard(VTerm *vt) void vterm_keyboard_unichar(VTerm *vt, uint32_t c, VTermModifier mod) { - // VIM: added modifyOtherKeys support + // MNV: added modifyOtherKeys support if (vterm_is_modify_other_keys(vt) && mod != 0) { vterm_push_output_sprintf_ctrl(vt, C1_CSI, "27;%d;%d~", mod+1, c); return; } - // VIM: added kitty keyboard protocol support + // MNV: added kitty keyboard protocol support if (vterm_is_kitty_keyboard(vt) && mod != 0) { vterm_push_output_sprintf_ctrl(vt, C1_CSI, "%d;%du", c, mod+1); return; diff --git a/uvim/src/libvterm/src/pen.c b/uvim/src/libvterm/src/pen.c index 33d3dae9f1..8a893006af 100644 --- a/uvim/src/libvterm/src/pen.c +++ b/uvim/src/libvterm/src/pen.c @@ -44,7 +44,7 @@ static int ramp24[] = { static void lookup_default_colour_ansi(long idx, VTermColor *col) { - // VIM: store both RGB color and index + // MNV: store both RGB color and index vterm_color_rgb( col, ansi_colors[idx].red, ansi_colors[idx].green, ansi_colors[idx].blue); diff --git a/uvim/src/libvterm/src/screen.c b/uvim/src/libvterm/src/screen.c index fd76777c41..228c9e333f 100644 --- a/uvim/src/libvterm/src/screen.c +++ b/uvim/src/libvterm/src/screen.c @@ -1,6 +1,6 @@ #include "vterm_internal.h" -// vim: set sw=2 : +// mnv: set sw=2 : #include #include diff --git a/uvim/src/libvterm/src/unicode.c b/uvim/src/libvterm/src/unicode.c index a6a46e131c..304f603c76 100644 --- a/uvim/src/libvterm/src/unicode.c +++ b/uvim/src/libvterm/src/unicode.c @@ -76,7 +76,7 @@ struct interval { /* sorted list of non-overlapping intervals of non-spacing characters */ /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ -// Replaced by the combining table from Vim. +// Replaced by the combining table from MNV. static const struct interval combining[] = { {0X0300, 0X036F}, {0X0483, 0X0489}, diff --git a/uvim/src/libvterm/src/vterm.c b/uvim/src/libvterm/src/vterm.c index dba6377186..52bfdcad1e 100644 --- a/uvim/src/libvterm/src/vterm.c +++ b/uvim/src/libvterm/src/vterm.c @@ -1,6 +1,6 @@ #define DEFINE_INLINES -// vim: set sw=2 : +// mnv: set sw=2 : #include "vterm_internal.h" #include diff --git a/uvim/src/libvterm/t/63screen_resize.test b/uvim/src/libvterm/t/63screen_resize.test index 6835222db7..3cf3bdb970 100644 --- a/uvim/src/libvterm/t/63screen_resize.test +++ b/uvim/src/libvterm/t/63screen_resize.test @@ -55,7 +55,7 @@ RESIZE 20,80 ?cursor = 9,0 !Resize shorter does not lose line with cursor -# See also https://github.com/neovim/libvterm/commit/1b745d29d45623aa8d22a7b9288c7b0e331c7088 +# See also https://github.com/neomnv/libvterm/commit/1b745d29d45623aa8d22a7b9288c7b0e331c7088 RESET WANTSCREEN -b RESIZE 25,80 @@ -70,7 +70,7 @@ RESIZE 24,80 ?cursor = 23,0 !Resize shorter does not send the cursor to a negative row -# See also https://github.com/vim/vim/pull/6141 +# See also https://github.com/Project-Tick/Project-Tick/pull/6141 RESET WANTSCREEN -b RESIZE 25,80 diff --git a/uvim/src/libvterm/t/69screen_reflow.test b/uvim/src/libvterm/t/69screen_reflow.test index eb7e4e4d95..6d6e8486a6 100644 --- a/uvim/src/libvterm/t/69screen_reflow.test +++ b/uvim/src/libvterm/t/69screen_reflow.test @@ -79,7 +79,7 @@ RESIZE 5,16 ?cursor = 3,2 !Cursor goes missing -# For more context: https://github.com/neovim/neovim/pull/21124 +# For more context: https://github.com/neomnv/neomnv/pull/21124 RESET RESIZE 5,5 RESIZE 3,1 diff --git a/uvim/src/linematch.c b/uvim/src/linematch.c index 1fab282760..8f3b520838 100644 --- a/uvim/src/linematch.c +++ b/uvim/src/linematch.c @@ -1,13 +1,13 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ -#include "vim.h" +#include "mnv.h" #define LN_MAX_BUFS 8 #define LN_DECISION_MAX 255 // pow(2, LN_MAX_BUFS(8)) - 1 = 255 @@ -434,7 +434,7 @@ linematch_nbuffers( *decisions = lalloc(sizeof(int) * memsize_decisions, TRUE); if (*decisions == NULL) { - vim_free(diffcmppath); + mnv_free(diffcmppath); return 0; } @@ -454,7 +454,7 @@ linematch_nbuffers( (*decisions)[n_optimal - 1 - i] = tmp; } - vim_free(diffcmppath); + mnv_free(diffcmppath); return n_optimal; } diff --git a/uvim/src/link.sh b/uvim/src/link.sh index 6e5c50f74d..2b96efd2ac 100755 --- a/uvim/src/link.sh +++ b/uvim/src/link.sh @@ -1,8 +1,8 @@ #! /bin/sh # -# link.sh -- try linking Vim with different sets of libraries, finding the +# link.sh -- try linking MNV with different sets of libraries, finding the # minimal set for fastest startup. The problem is that configure adds a few -# libraries when they exist, but this doesn't mean they are needed for Vim. +# libraries when they exist, but this doesn't mean they are needed for MNV. # # Author: Bram Moolenaar # Last change: 2010 Nov 03 @@ -44,9 +44,9 @@ else # There is a loop to remove libraries that appear several times. # # Notes: -# - Can't remove Xext; It links fine but will give an error when running gvim +# - Can't remove Xext; It links fine but will give an error when running gmnv # with Motif. -# - Don't remove the last -lm: On HP-UX Vim links OK but crashes when the GTK +# - Don't remove the last -lm: On HP-UX MNV links OK but crashes when the GTK # GUI is started, because the "floor" symbol could not be resolved. # cat link_$PROG.cmd @@ -72,11 +72,11 @@ else # Redirect this link output, it may contain error messages which # should be ignored. if sh linkit_$PROG.sh >>auto/link.log 2>&1; then - echo "link.sh: Vim doesn't need the $libname library!" + echo "link.sh: MNV doesn't need the $libname library!" cat link1_$PROG.sed >>auto/link.sed rm -f auto/pathdef.c else - echo "link.sh: Vim DOES need the $libname library." + echo "link.sh: MNV DOES need the $libname library." cont= cp link_$PROG.cmd linkit_$PROG.sh fi @@ -149,4 +149,4 @@ rm -f link_$PROG.cmd linkit_$PROG.sh link1_$PROG.sed link2_$PROG.sed \ # exit $exit_value -# vim:set sw=2 et: +# mnv:set sw=2 et: diff --git a/uvim/src/list.c b/uvim/src/list.c index cd12bcb0a0..e8fc64e4cd 100644 --- a/uvim/src/list.c +++ b/uvim/src/list.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * list.c: List support and container (List, Dict, Blob) functions. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) @@ -272,7 +272,7 @@ list_free_list(list_T *l) l->lv_used_next->lv_used_prev = l->lv_used_prev; free_type(l->lv_type); - vim_free(l); + mnv_free(l); } void @@ -323,7 +323,7 @@ list_free_item(list_T *l, listitem_T *item) { if (l->lv_with_items == 0 || item < (listitem_T *)l || item >= (listitem_T *)(l + 1) + l->lv_with_items) - vim_free(item); + mnv_free(item); } /* @@ -343,7 +343,7 @@ listitem_free(list_T *l, listitem_T *item) void listitem_remove(list_T *l, listitem_T *item) { - vimlist_remove(l, item, item); + mnvlist_remove(l, item, item); listitem_free(l, item); } @@ -690,8 +690,8 @@ list_append_string(list_T *l, char_u *str, int len) li->li_tv.v_lock = 0; if (str == NULL) li->li_tv.vval.v_string = NULL; - else if ((li->li_tv.vval.v_string = (len >= 0 ? vim_strnsave(str, len) - : vim_strsave(str))) == NULL) + else if ((li->li_tv.vval.v_string = (len >= 0 ? mnv_strnsave(str, len) + : mnv_strsave(str))) == NULL) return FAIL; return OK; } @@ -766,7 +766,7 @@ list_insert(list_T *l, listitem_T *ni, listitem_T *item) /* * Append a new empty item into "l" based on the list item type. Used when - * adding a new element to a List in Vim9script by using the current list + * adding a new element to a List in MNV9script by using the current list * length as the index. */ static int @@ -825,7 +825,7 @@ list_append_new_item(list_T *l) /* * Get the list item in "l" with index "n1". "n1" is adjusted if needed. - * In Vim9, it is at the end of the list, add an item if "can_append" is TRUE. + * In MNV9, it is at the end of the list, add an item if "can_append" is TRUE. * Return NULL if there is no such item. */ listitem_T * @@ -837,8 +837,8 @@ check_range_index_one(list_T *l, long *n1, int can_append, int quiet) if (li != NULL) return li; - // Vim9: Allow for adding an item at the end. - if (can_append && in_vim9script() + // MNV9: Allow for adding an item at the end. + if (can_append && in_mnv9script() && *n1 == l->lv_len && l->lv_lock == 0) { if (list_append_new_item(l) == FAIL) @@ -933,7 +933,7 @@ list_assign_range( ++idx; } - if (in_vim9script() && dest->lv_type != NULL + if (in_mnv9script() && dest->lv_type != NULL && dest->lv_type->tt_member != NULL) member_type = dest->lv_type->tt_member; @@ -1015,7 +1015,7 @@ list_flatten(list_T *list, listitem_T *first, long maxitems, long maxdepth) { list_T *itemlist = item->li_tv.vval.v_list; - vimlist_remove(list, item, item); + mnvlist_remove(list, item, item); if (list_extend(list, itemlist, next) == FAIL) { list_free_item(list, item); @@ -1045,7 +1045,7 @@ flatten_common(typval_T *argvars, typval_T *rettv, int make_copy) long maxdepth; int error = FALSE; - if (in_vim9script() + if (in_mnv9script() && (check_for_list_arg(argvars, 0) == FAIL || check_for_opt_number_arg(argvars, 1) == FAIL)) return; @@ -1103,8 +1103,8 @@ flatten_common(typval_T *argvars, typval_T *rettv, int make_copy) void f_flatten(typval_T *argvars, typval_T *rettv) { - if (in_vim9script()) - emsg(_(e_cannot_use_flatten_in_vim9_script)); + if (in_mnv9script()) + emsg(_(e_cannot_use_flatten_in_mnv9_script)); else flatten_common(argvars, rettv, FALSE); } @@ -1144,7 +1144,7 @@ list2items(typval_T *argvars, typval_T *rettv) break; if (list_append_list(rettv->vval.v_list, l2) == FAIL) { - vim_free(l2); + mnv_free(l2); break; } if (list_append_number(l2, idx) == FAIL @@ -1180,7 +1180,7 @@ string2items(typval_T *argvars, typval_T *rettv) break; if (list_append_list(rettv->vval.v_list, l2) == FAIL) { - vim_free(l2); + mnv_free(l2); break; } if (list_append_number(l2, idx) == FAIL @@ -1330,7 +1330,7 @@ list_slice_or_index( if (n1 < 0 || n1 >= len) { // For a range we allow invalid values and for legacy script return an - // empty list, for Vim9 script start at the first item. + // empty list, for MNV9 script start at the first item. // A list index out of range is an error. if (!range) { @@ -1338,7 +1338,7 @@ list_slice_or_index( semsg(_(e_list_index_out_of_range_nr), (long)n1_arg); return FAIL; } - if (in_vim9script()) + if (in_mnv9script()) n1 = n1 < 0 ? 0 : len; else n1 = len; @@ -1372,7 +1372,7 @@ list_slice_or_index( // If "var1" is a List and the List item type is not set, then set it // from the declared list item type. - if (in_vim9script() && var1.v_type == VAR_LIST + if (in_mnv9script() && var1.v_type == VAR_LIST && var1.vval.v_list != NULL && var1.vval.v_list->lv_type == NULL) { @@ -1429,7 +1429,7 @@ list_copy(list_T *orig, int deep, int top, int copyID) if (item_copy(&item->li_tv, &ni->li_tv, deep, FALSE, copyID) == FAIL) { - vim_free(ni); + mnv_free(ni); break; } } @@ -1454,7 +1454,7 @@ list_copy(list_T *orig, int deep, int top, int copyID) * file. */ void -vimlist_remove(list_T *l, listitem_T *item, listitem_T *item2) +mnvlist_remove(list_T *l, listitem_T *item, listitem_T *item2) { listitem_T *ip; @@ -1497,7 +1497,7 @@ list2string(typval_T *tv, int copyID, int restore_copyID) if (list_join(&ga, tv->vval.v_list, (char_u *)", ", FALSE, restore_copyID, copyID) == FAIL) { - vim_free(ga.ga_data); + mnv_free(ga.ga_data); return NULL; } ga_append(&ga, ']'); @@ -1552,7 +1552,7 @@ list_join_inner( } else { - p->s.string = vim_strnsave(s.string, s.length); + p->s.string = mnv_strnsave(s.string, s.length); p->s.length = s.length; p->tofree = p->s.string; } @@ -1618,7 +1618,7 @@ list_join( p = (join_T *)join_ga.ga_data; for (i = 0; i < join_ga.ga_len; ++i) { - vim_free(p->tofree); + mnv_free(p->tofree); ++p; } ga_clear(&join_ga); @@ -1678,7 +1678,7 @@ eval_list(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int do_error) list_T *l = NULL; typval_T tv; listitem_T *item; - int vim9script = in_vim9script(); + int mnv9script = in_mnv9script(); int had_comma; if (evaluate) @@ -1711,15 +1711,15 @@ eval_list(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int do_error) else clear_tv(&tv); } - // Legacy Vim script allowed a space before the comma. - if (!vim9script) + // Legacy MNV script allowed a space before the comma. + if (!mnv9script) *arg = skipwhite(*arg); // the comma must come after the value had_comma = **arg == ','; if (had_comma) { - if (vim9script && !IS_WHITE_NL_OR_NUL((*arg)[1]) && (*arg)[1] != ']') + if (mnv9script && !IS_WHITE_NL_OR_NUL((*arg)[1]) && (*arg)[1] != ']') { semsg(_(e_white_space_required_after_str_str), ",", *arg); goto failret; @@ -1850,7 +1850,7 @@ f_list2str(typval_T *argvars, typval_T *rettv) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_list_arg(argvars, 0) == FAIL || check_for_opt_bool_arg(argvars, 1) == FAIL)) return; @@ -1993,7 +1993,7 @@ list_remove(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg) if (argvars[2].v_type == VAR_UNKNOWN) { // Remove one item, return its value. - vimlist_remove(l, item, item); + mnvlist_remove(l, item, item); *rettv = item->li_tv; list_free_item(l, item); return; @@ -2022,7 +2022,7 @@ list_remove(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg) return; } - vimlist_remove(l, item, item2); + mnvlist_remove(l, item, item2); if (rettv_list_alloc(rettv) == FAIL) return; @@ -2161,8 +2161,8 @@ item_compare(const void *s1, const void *s2) if (res == 0 && !sortinfo->item_compare_keep_zero) res = si1->idx > si2->idx ? 1 : -1; - vim_free(tofree1); - vim_free(tofree2); + mnv_free(tofree1); + mnv_free(tofree2); return res; } @@ -2278,7 +2278,7 @@ do_sort(list_T *l, sortinfo_T *info) } } - vim_free(ptrs); + mnv_free(ptrs); } /* @@ -2336,7 +2336,7 @@ do_uniq(list_T *l, sortinfo_T *info) } } - vim_free(ptrs); + mnv_free(ptrs); } /* @@ -2443,7 +2443,7 @@ do_sort_uniq(typval_T *argvars, typval_T *rettv, int sort) sortinfo_T info; long len; - if (in_vim9script() + if (in_mnv9script() && (check_for_list_arg(argvars, 0) == FAIL || (argvars[1].v_type != VAR_UNKNOWN && (check_for_string_or_func_arg(argvars, 1) == FAIL @@ -2521,7 +2521,7 @@ filter_map_one( typval_T argv[3]; int retval = FAIL; - copy_tv(tv, get_vim_var_tv(VV_VAL)); + copy_tv(tv, get_mnv_var_tv(VV_VAL)); newtv->v_type = VAR_UNKNOWN; if (filtermap == FILTERMAP_FOREACH && expr->v_type == VAR_STRING) @@ -2533,8 +2533,8 @@ filter_map_one( goto theend; } - argv[0] = *get_vim_var_tv(VV_KEY); - argv[1] = *get_vim_var_tv(VV_VAL); + argv[0] = *get_mnv_var_tv(VV_KEY); + argv[1] = *get_mnv_var_tv(VV_VAL); if (eval_expr_typval(expr, FALSE, argv, 2, fc, newtv) == FAIL) goto theend; if (filtermap == FILTERMAP_FILTER) @@ -2542,7 +2542,7 @@ filter_map_one( int error = FALSE; // filter(): when expr is zero remove the item - if (in_vim9script()) + if (in_mnv9script()) *remp = !tv_get_bool_chk(newtv, &error); else *remp = (tv_get_number_chk(newtv, &error) == 0); @@ -2556,7 +2556,7 @@ filter_map_one( clear_tv(newtv); retval = OK; theend: - clear_tv(get_vim_var_tv(VV_VAL)); + clear_tv(get_mnv_var_tv(VV_VAL)); return retval; } @@ -2599,8 +2599,8 @@ list_filter_map( return; l_ret = rettv->vval.v_list; } - // set_vim_var_nr() doesn't set the type - set_vim_var_type(VV_KEY, VAR_NUMBER); + // set_mnv_var_nr() doesn't set the type + set_mnv_var_type(VV_KEY, VAR_NUMBER); if (l->lv_lock == 0) l->lv_lock = VAR_LOCKED; @@ -2631,7 +2631,7 @@ list_filter_map( tv.v_type = VAR_NUMBER; tv.v_lock = 0; tv.vval.v_number = val; - set_vim_var_nr(VV_KEY, idx); + set_mnv_var_nr(VV_KEY, idx); if (filter_map_one(&tv, expr, filtermap, fc, &newtv, &rem) == FAIL) break; if (did_emsg) @@ -2677,7 +2677,7 @@ list_filter_map( li->li_tv.v_lock, arg_errmsg, TRUE)) break; nli = li->li_next; - set_vim_var_nr(VV_KEY, idx); + set_mnv_var_nr(VV_KEY, idx); if (filter_map_one(&li->li_tv, expr, filtermap, fc, &newtv, &rem) == FAIL) break; @@ -2741,7 +2741,7 @@ filter_map(typval_T *argvars, typval_T *rettv, filtermap_T filtermap) if (filtermap != FILTERMAP_MAPNEW && argvars[0].v_type != VAR_STRING) copy_tv(&argvars[0], rettv); - if (in_vim9script() + if (in_mnv9script() && (check_for_list_tuple_dict_blob_or_string_arg(argvars, 0) == FAIL)) return; @@ -2752,7 +2752,7 @@ filter_map(typval_T *argvars, typval_T *rettv, filtermap_T filtermap) return; } - if (filtermap == FILTERMAP_MAP && in_vim9script()) + if (filtermap == FILTERMAP_MAP && in_mnv9script()) { // Check that map() does not change the declared type of the list or // dict. @@ -2789,8 +2789,8 @@ filter_map(typval_T *argvars, typval_T *rettv, filtermap_T filtermap) typval_T save_val; typval_T save_key; - prepare_vimvar(VV_VAL, &save_val); - prepare_vimvar(VV_KEY, &save_key); + prepare_mnvvar(VV_VAL, &save_val); + prepare_mnvvar(VV_KEY, &save_key); // We reset "did_emsg" to be able to detect whether an error // occurred during evaluation of the expression. @@ -2811,8 +2811,8 @@ filter_map(typval_T *argvars, typval_T *rettv, filtermap_T filtermap) list_filter_map(argvars[0].vval.v_list, filtermap, type, func_name, arg_errmsg, expr, rettv); - restore_vimvar(VV_KEY, &save_key); - restore_vimvar(VV_VAL, &save_val); + restore_mnvvar(VV_KEY, &save_key); + restore_mnvvar(VV_VAL, &save_val); did_emsg |= save_did_emsg; } @@ -2863,7 +2863,7 @@ list_add(typval_T *argvars, typval_T *rettv) if (l == NULL) { - if (in_vim9script()) + if (in_mnv9script()) emsg(_(e_cannot_add_to_null_list)); } else if (!value_check_lock(l->lv_lock, @@ -2882,7 +2882,7 @@ f_add(typval_T *argvars, typval_T *rettv) { rettv->vval.v_number = 1; // Default: Failed - if (in_vim9script() + if (in_mnv9script() && (check_for_list_or_blob_arg(argvars, 0) == FAIL || (argvars[0].v_type == VAR_BLOB && check_for_number_arg(argvars, 1) == FAIL))) @@ -2938,7 +2938,7 @@ f_count(typval_T *argvars, typval_T *rettv) int ic = FALSE; int error = FALSE; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_list_tuple_or_dict_arg(argvars, 0) == FAIL || check_for_opt_bool_arg(argvars, 2) == FAIL || (argvars[2].v_type != VAR_UNKNOWN @@ -3074,7 +3074,7 @@ extend(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg, int is_new) { // Check that extend() does not change the type of the list if it was // declared. - if (!is_new && in_vim9script() && argvars[0].vval.v_list != NULL) + if (!is_new && in_mnv9script() && argvars[0].vval.v_list != NULL) type = argvars[0].vval.v_list->lv_type; list_extend_func(argvars, type, func_name, arg_errmsg, is_new, rettv); } @@ -3082,7 +3082,7 @@ extend(typval_T *argvars, typval_T *rettv, char_u *arg_errmsg, int is_new) { // Check that extend() does not change the type of the dict if it was // declared. - if (!is_new && in_vim9script() && argvars[0].vval.v_dict != NULL) + if (!is_new && in_mnv9script() && argvars[0].vval.v_dict != NULL) type = argvars[0].vval.v_dict->dv_type; dict_extend_func(argvars, type, func_name, arg_errmsg, is_new, rettv); } @@ -3124,7 +3124,7 @@ list_insert_func(typval_T *argvars, typval_T *rettv) if (l == NULL) { - if (in_vim9script()) + if (in_mnv9script()) emsg(_(e_cannot_add_to_null_list)); return; } @@ -3161,7 +3161,7 @@ list_insert_func(typval_T *argvars, typval_T *rettv) void f_insert(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_list_or_blob_arg(argvars, 0) == FAIL || (argvars[0].v_type == VAR_BLOB && check_for_number_arg(argvars, 1) == FAIL) @@ -3184,7 +3184,7 @@ f_remove(typval_T *argvars, typval_T *rettv) { char_u *arg_errmsg = (char_u *)N_("remove() argument"); - if (in_vim9script() + if (in_mnv9script() && (check_for_list_or_dict_or_blob_arg(argvars, 0) == FAIL || ((argvars[0].v_type == VAR_LIST || argvars[0].v_type == VAR_BLOB) @@ -3405,7 +3405,7 @@ f_reduce(typval_T *argvars, typval_T *rettv) void f_slice(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && ((argvars[0].v_type != VAR_STRING && argvars[0].v_type != VAR_LIST && argvars[0].v_type != VAR_TUPLE diff --git a/uvim/src/locale.c b/uvim/src/locale.c index db2dfa1af5..d6749b0b40 100644 --- a/uvim/src/locale.c +++ b/uvim/src/locale.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * locale.c: functions for language/locale configuration */ -#include "vim.h" +#include "mnv.h" #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ && (defined(FEAT_EVAL) || defined(FEAT_MULTI_LANG)) @@ -31,7 +31,7 @@ get_locale_val(int what) // setocale() returns something like "LC_COLLATE=;LC_..." when // one of the values (e.g., LC_CTYPE) differs. - p = vim_strchr(loc, '='); + p = mnv_strchr(loc, '='); if (p != NULL) { loc = ++p; @@ -159,7 +159,7 @@ get_mess_env(void) return p; p = mch_getenv((char_u *)"LANG"); - if (p != NULL && VIM_ISDIGIT(*p)) + if (p != NULL && MNV_ISDIGIT(*p)) p = NULL; // ignore something like "1043" # ifdef HAVE_GET_LOCALE_VAL if (p == NULL || *p == NUL) @@ -186,7 +186,7 @@ set_lang_var(void) // setlocale() not supported: use the default value loc = (char_u *)"C"; # endif - set_vim_var_string(VV_CTYPE, loc, -1); + set_mnv_var_string(VV_CTYPE, loc, -1); // When LC_MESSAGES isn't defined use the value from $LC_MESSAGES, fall // back to LC_CTYPE if it's empty. @@ -195,12 +195,12 @@ set_lang_var(void) # else loc = get_mess_env(); # endif - set_vim_var_string(VV_LANG, loc, -1); + set_mnv_var_string(VV_LANG, loc, -1); # ifdef HAVE_GET_LOCALE_VAL loc = get_locale_val(LC_TIME); # endif - set_vim_var_string(VV_LC_TIME, loc, -1); + set_mnv_var_string(VV_LC_TIME, loc, -1); # ifdef HAVE_GET_LOCALE_VAL loc = get_locale_val(LC_COLLATE); @@ -208,7 +208,7 @@ set_lang_var(void) // setlocale() not supported: use the default value loc = (char_u *)"C"; # endif - set_vim_var_string(VV_COLLATE, loc, -1); + set_mnv_var_string(VV_COLLATE, loc, -1); } #endif @@ -247,16 +247,16 @@ init_locale(void) dyn_libintl_init(); # endif // expand_env() doesn't work yet, because g_chartab[] is not - // initialized yet, call vim_getenv() directly - p = vim_getenv((char_u *)"VIMRUNTIME", &mustfree); + // initialized yet, call mnv_getenv() directly + p = mnv_getenv((char_u *)"MNVRUNTIME", &mustfree); if (p != NULL && *p != NUL) { - vim_snprintf((char *)NameBuff, MAXPATHL, "%s/lang", p); - bindtextdomain(VIMPACKAGE, (char *)NameBuff); + mnv_snprintf((char *)NameBuff, MAXPATHL, "%s/lang", p); + bindtextdomain(MNVPACKAGE, (char *)NameBuff); } if (mustfree) - vim_free(p); - textdomain(VIMPACKAGE); + mnv_free(p); + textdomain(MNVPACKAGE); } # endif } @@ -273,9 +273,9 @@ ex_language(exarg_T *eap) int what = LC_ALL; char *whatstr = ""; # ifdef LC_MESSAGES -# define VIM_LC_MESSAGES LC_MESSAGES +# define MNV_LC_MESSAGES LC_MESSAGES # else -# define VIM_LC_MESSAGES 6789 +# define MNV_LC_MESSAGES 6789 # endif name = eap->arg; @@ -284,11 +284,11 @@ ex_language(exarg_T *eap) // Allow abbreviation, but require at least 3 characters to avoid // confusion with a two letter language name "me" or "ct". p = skiptowhite(eap->arg); - if ((*p == NUL || VIM_ISWHITE(*p)) && p - eap->arg >= 3) + if ((*p == NUL || MNV_ISWHITE(*p)) && p - eap->arg >= 3) { if (STRNICMP(eap->arg, "messages", p - eap->arg) == 0) { - what = VIM_LC_MESSAGES; + what = MNV_LC_MESSAGES; name = skipwhite(p); whatstr = "messages "; } @@ -315,7 +315,7 @@ ex_language(exarg_T *eap) if (*name == NUL) { # ifndef LC_MESSAGES - if (what == VIM_LC_MESSAGES) + if (what == MNV_LC_MESSAGES) p = get_mess_env(); else # endif @@ -327,7 +327,7 @@ ex_language(exarg_T *eap) else { # ifndef LC_MESSAGES - if (what == VIM_LC_MESSAGES) + if (what == MNV_LC_MESSAGES) loc = ""; else # endif @@ -350,7 +350,7 @@ ex_language(exarg_T *eap) ++_nl_msg_cat_cntr; # endif // Reset $LC_ALL, otherwise it would overrule everything. - vim_setenv((char_u *)"LC_ALL", (char_u *)""); + mnv_setenv((char_u *)"LC_ALL", (char_u *)""); if (what != LC_TIME && what != LC_COLLATE) { @@ -360,10 +360,10 @@ ex_language(exarg_T *eap) // value. if (what == LC_ALL) { - vim_setenv((char_u *)"LANG", name); + mnv_setenv((char_u *)"LANG", name); // Clear $LANGUAGE because GNU gettext uses it. - vim_setenv((char_u *)"LANGUAGE", (char_u *)""); + mnv_setenv((char_u *)"LANGUAGE", (char_u *)""); # ifdef MSWIN // Apparently MS-Windows printf() may cause a crash when // we give it 8-bit text while it's expecting text in the @@ -379,7 +379,7 @@ ex_language(exarg_T *eap) # else mname = name; # endif - vim_setenv((char_u *)"LC_MESSAGES", mname); + mnv_setenv((char_u *)"LC_MESSAGES", mname); # ifdef FEAT_MULTI_LANG set_helplang_default(mname); # endif @@ -420,7 +420,7 @@ find_locales(void) NULL, SHELL_SILENT, NULL); # else // Find all available locales by examining the directories in - // $VIMRUNTIME/lang/ + // $MNVRUNTIME/lang/ { int options = WILD_SILENT|WILD_USE_NL|WILD_KEEP_ALL; expand_T xpc; @@ -428,14 +428,14 @@ find_locales(void) ExpandInit(&xpc); xpc.xp_context = EXPAND_DIRECTORIES; - locale_list = ExpandOne(&xpc, (char_u *)"$VIMRUNTIME/lang/*", + locale_list = ExpandOne(&xpc, (char_u *)"$MNVRUNTIME/lang/*", NULL, options, WILD_ALL); ExpandCleanup(&xpc); if (locale_list == NULL) // Add a dummy input, that will be skipped lated but we need to // have something in locale_list so that the C locale is added at // the end. - locale_list = vim_strsave((char_u *)".\n"); + locale_list = mnv_strsave((char_u *)".\n"); p = locale_list; // find the last directory delimiter while (p != NULL && *p != NUL) @@ -464,7 +464,7 @@ find_locales(void) if (len > 0) loc += len + 1; // skip locales with a dot (which indicates the charset) - if (vim_strchr(loc, '.') != NULL) + if (mnv_strchr(loc, '.') != NULL) ignore = TRUE; # endif if (!ignore) @@ -472,7 +472,7 @@ find_locales(void) if (ga_grow(&locales_ga, 1) == FAIL) break; - loc = vim_strsave(loc); + loc = mnv_strsave(loc); if (loc == NULL) break; @@ -485,10 +485,10 @@ find_locales(void) // Add the C locale if (ga_grow(&locales_ga, 1) == OK) ((char_u **)locales_ga.ga_data)[locales_ga.ga_len++] = - vim_strsave((char_u *)"C"); + mnv_strsave((char_u *)"C"); # endif - vim_free(locale_list); + mnv_free(locale_list); if (ga_grow(&locales_ga, 1) == FAIL) { ga_clear(&locales_ga); @@ -521,8 +521,8 @@ free_locales(void) return; for (i = 0; locales[i] != NULL; i++) - vim_free(locales[i]); - VIM_CLEAR(locales); + mnv_free(locales[i]); + MNV_CLEAR(locales); } # endif diff --git a/uvim/src/logfile.c b/uvim/src/logfile.c index cb282851f2..d00a195ad2 100644 --- a/uvim/src/logfile.c +++ b/uvim/src/logfile.c @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* @@ -12,7 +12,7 @@ * async debugging. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_EVAL) @@ -39,9 +39,9 @@ ch_logfile(char_u *fname, char_u *opt) } // The "a" flag overrules the "w" flag. - if (vim_strchr(opt, 'a') == NULL && vim_strchr(opt, 'w') != NULL) + if (mnv_strchr(opt, 'a') == NULL && mnv_strchr(opt, 'w') != NULL) mode = "w"; - ch_log_output = vim_strchr(opt, 'o') != NULL ? LOG_ALWAYS : FALSE; + ch_log_output = mnv_strchr(opt, 'o') != NULL ? LOG_ALWAYS : FALSE; if (*fname != NUL) { @@ -51,8 +51,8 @@ ch_logfile(char_u *fname, char_u *opt) semsg(_(e_cant_open_file_str), fname); return; } - vim_free(log_name); - log_name = vim_strsave(fname); + mnv_free(log_name); + log_name = mnv_strsave(fname); } log_fd = file; @@ -151,7 +151,7 @@ ch_log_literal( { ch_log_lead(lead, ch, part); fprintf(log_fd, "'"); - vim_ignored = (int)fwrite(buf, len, 1, log_fd); + mnv_ignored = (int)fwrite(buf, len, 1, log_fd); fprintf(log_fd, "'\n"); fflush(log_fd); } @@ -166,7 +166,7 @@ f_ch_log(typval_T *argvars, typval_T *rettv UNUSED) char_u *msg; channel_T *channel = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_chan_or_job_arg(argvars, 1) == FAIL)) return; @@ -196,7 +196,7 @@ f_ch_logfile(typval_T *argvars, typval_T *rettv UNUSED) if (check_restricted() || check_secure()) return; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL)) return; diff --git a/uvim/src/macros.h b/uvim/src/macros.h index 9007b5b37a..3a7c397606 100644 --- a/uvim/src/macros.h +++ b/uvim/src/macros.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* @@ -33,10 +33,10 @@ #define LTOREQ_POS(a, b) (LT_POS(a, b) || EQUAL_POS(a, b)) /* - * VIM_ISWHITE() differs from isspace() because it doesn't include and + * MNV_ISWHITE() differs from isspace() because it doesn't include and * and the like. */ -#define VIM_ISWHITE(x) ((x) == ' ' || (x) == '\t') +#define MNV_ISWHITE(x) ((x) == ' ' || (x) == '\t') #define IS_WHITE_OR_NUL(x) ((x) == ' ' || (x) == '\t' || (x) == NUL) #define IS_WHITE_NL_OR_NUL(x) ((x) == ' ' || (x) == '\t' || (x) == '\n' || (x) == NUL) @@ -102,23 +102,23 @@ * MB_ISLOWER() and MB_ISUPPER() are to be used on multi-byte characters. But * don't use them for negative values! */ -#define MB_ISLOWER(c) vim_islower(c) -#define MB_ISUPPER(c) vim_isupper(c) -#define MB_TOLOWER(c) vim_tolower(c) -#define MB_TOUPPER(c) vim_toupper(c) +#define MB_ISLOWER(c) mnv_islower(c) +#define MB_ISUPPER(c) mnv_isupper(c) +#define MB_TOLOWER(c) mnv_tolower(c) +#define MB_TOUPPER(c) mnv_toupper(c) #define MB_CASEFOLD(c) (enc_utf8 ? utf_fold(c) : MB_TOLOWER(c)) // Use our own isdigit() replacement, because on MS-Windows isdigit() returns // non-zero for superscript 1. Also avoids that isdigit() crashes for numbers // below 0 and above 255. -#define VIM_ISDIGIT(c) ((unsigned)(c) - '0' < 10) +#define MNV_ISDIGIT(c) ((unsigned)(c) - '0' < 10) // Like isalpha() but reject non-ASCII characters. Can't be used with a // special key (negative value). #define ASCII_ISLOWER(c) ((unsigned)(c) - 'a' < 26) #define ASCII_ISUPPER(c) ((unsigned)(c) - 'A' < 26) #define ASCII_ISALPHA(c) (ASCII_ISUPPER(c) || ASCII_ISLOWER(c)) -#define ASCII_ISALNUM(c) (ASCII_ISALPHA(c) || VIM_ISDIGIT(c)) +#define ASCII_ISALNUM(c) (ASCII_ISALPHA(c) || MNV_ISDIGIT(c)) // Returns empty string if it is NULL. #define EMPTY_IF_NULL(x) ((x) ? (x) : (char_u *)"") @@ -151,10 +151,10 @@ #endif /* - * VIM_ISBREAK() is used very often if 'linebreak' is set, use a macro to make + * MNV_ISBREAK() is used very often if 'linebreak' is set, use a macro to make * it work fast. Only works for single byte characters! */ -#define VIM_ISBREAK(c) ((c) < 256 && breakat_flags[(char_u)(c)]) +#define MNV_ISBREAK(c) ((c) < 256 && breakat_flags[(char_u)(c)]) /* * On VMS file names are different and require a translation. @@ -181,10 +181,10 @@ # endif # ifdef MSWIN // has its own mch_stat() function -# define mch_stat(n, p) vim_stat((n), (p)) +# define mch_stat(n, p) mnv_stat((n), (p)) # else # ifdef STAT_IGNORES_SLASH -# define mch_stat(n, p) vim_stat((n), (p)) +# define mch_stat(n, p) mnv_stat((n), (p)) # else # define mch_stat(n, p) stat((n), (p)) # endif @@ -195,7 +195,7 @@ # define mch_lstat(n, p) lstat((n), (p)) #else # ifdef MSWIN -# define mch_lstat(n, p) vim_lstat((n), (p)) +# define mch_lstat(n, p) mnv_lstat((n), (p)) # else # define mch_lstat(n, p) mch_stat((n), (p)) # endif @@ -356,20 +356,20 @@ #endif /* - * Like vim_free(), and also set the pointer to NULL. + * Like mnv_free(), and also set the pointer to NULL. */ -#define VIM_CLEAR(p) \ +#define MNV_CLEAR(p) \ do { \ - vim_free(p); \ + mnv_free(p); \ (p) = NULL; \ } while (0) /* * Free a string and set it's pointer to NULL and length to 0 */ -#define VIM_CLEAR_STRING(s) \ +#define MNV_CLEAR_STRING(s) \ do { \ - VIM_CLEAR(s.string); \ + MNV_CLEAR(s.string); \ s.length = 0; \ } while (0) diff --git a/uvim/src/main.c b/uvim/src/main.c index b5f542a496..e0a8d80c1f 100644 --- a/uvim/src/main.c +++ b/uvim/src/main.c @@ -1,14 +1,14 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ #define EXTERN -#include "vim.h" +#include "mnv.h" #ifdef __CYGWIN__ # include @@ -17,7 +17,7 @@ # include #endif -#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)) # include "iscygpty.h" #endif @@ -28,12 +28,12 @@ #define EDIT_TAG 3 // tag name argument given, use tagname #define EDIT_QF 4 // start in quickfix mode -#if (defined(UNIX) || defined(VMS)) && !defined(NO_VIM_MAIN) +#if (defined(UNIX) || defined(VMS)) && !defined(NO_MNV_MAIN) static int file_owned(char *fname); #endif static void mainerr(int, char_u *); static void early_arg_scan(mparm_T *parmp); -#ifndef NO_VIM_MAIN +#ifndef NO_MNV_MAIN static void usage(void); static void parse_command_name(mparm_T *parmp); static void command_line_scan(mparm_T *parmp); @@ -80,18 +80,18 @@ static mparm_T params; static void *s_vbuf = NULL; // buffer for setvbuf() # endif -# ifndef NO_VIM_MAIN // skip this for unittests +# ifndef NO_MNV_MAIN // skip this for unittests static char_u *start_dir = NULL; // current working dir on startup static int has_dash_c_arg = FALSE; -# ifdef VIMDLL +# ifdef MNVDLL __declspec(dllexport) # endif int # ifdef MSWIN -VimMain +MNVMain # else main # endif @@ -132,16 +132,16 @@ main # ifdef FEAT_RUBY { int ruby_stack_start; - vim_ruby_init((void *)&ruby_stack_start); + mnv_ruby_init((void *)&ruby_stack_start); } # endif # ifdef FEAT_TCL - vim_tcl_init(params.argv[0]); + mnv_tcl_init(params.argv[0]); # endif # ifdef MEM_PROFILE - atexit(vim_mem_profile_dump); + atexit(mnv_mem_profile_dump); # endif /* @@ -158,7 +158,7 @@ main if (STRICMP(argv[i], "--startuptime") == 0 && time_fd == NULL) { time_fd = mch_fopen(argv[i + 1], "a"); - TIME_MSG("--- VIM STARTING ---"); + TIME_MSG("--- MNV STARTING ---"); } # endif # ifdef FEAT_EVAL @@ -194,7 +194,7 @@ main */ common_init_2(¶ms); -# ifdef VIMDLL +# ifdef MNVDLL // Check if the current executable file is for the GUI subsystem. gui.starting = mch_is_gui_executable(); # elif defined(FEAT_GUI_MSWIN) @@ -204,14 +204,14 @@ main # ifdef FEAT_CLIENTSERVER /* * Do the client-server stuff, unless "--servername ''" was used. - * This may exit Vim if the command was sent to the server. + * This may exit MNV if the command was sent to the server. */ exec_on_server(¶ms); # endif /* * Figure out the way to work from the command name argv[0]. - * "vimdiff" starts diff mode, "rvim" sets "restricted", etc. + * "mnvdiff" starts diff mode, "rmnv" sets "restricted", etc. */ parse_command_name(¶ms); @@ -241,9 +241,9 @@ main { gui.starting = FALSE; - // When running "evim" or "gvim -y" we need the menus, exit if we + // When running "emnv" or "gmnv -y" we need the menus, exit if we // don't have them. - if (params.evim_mode) + if (params.emnv_mode) mch_exit(1); } } @@ -263,7 +263,7 @@ main mch_dirname(start_dir, MAXPATHL); // Temporarily add '(' and ')' to 'isfname'. These are valid // filename characters but are excluded from 'isfname' to make - // "gf" work on a file name in parentheses (e.g.: see vim.h). + // "gf" work on a file name in parentheses (e.g.: see mnv.h). do_cmdline_cmd((char_u *)":set isf+=(,)"); alist_expand(NULL, 0); do_cmdline_cmd((char_u *)":set isf&"); @@ -291,7 +291,7 @@ main * Hint: to avoid this when typing a command use a forward slash. * If the cd fails, it doesn't matter. */ - if (vim_chdirfile(params.fname, "drop") == OK) + if (mnv_chdirfile(params.fname, "drop") == OK) last_chdir_reason = "drop"; if (start_dir != NULL) mch_dirname(start_dir, MAXPATHL); @@ -319,7 +319,7 @@ main * make sense to try using a terminal. */ # if defined(ALWAYS_USE_GUI) || defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) \ - || defined(VIMDLL) + || defined(MNVDLL) if (gui.starting # ifdef FEAT_GUI_GTK && !isatty(2) @@ -391,7 +391,7 @@ main ui_get_shellsize(); // inits Rows and Columns win_init_size(); # ifdef FEAT_DIFF - // Set the 'diff' option now, so that it can be checked for in a .vimrc + // Set the 'diff' option now, so that it can be checked for in a .mnvrc // file. There is no buffer yet though. if (params.diff_mode) diff_win_options(firstwin, FALSE); @@ -425,9 +425,9 @@ main // Reset 'loadplugins' for "-u NONE" before "--cmd" arguments. // Allows for setting 'loadplugins' there. - if (params.use_vimrc != NULL - && (STRCMP(params.use_vimrc, "NONE") == 0 - || STRCMP(params.use_vimrc, "DEFAULTS") == 0)) + if (params.use_mnvrc != NULL + && (STRCMP(params.use_mnvrc, "NONE") == 0 + || STRCMP(params.use_mnvrc, "DEFAULTS") == 0)) p_lpl = FALSE; // Execute --cmd arguments. @@ -437,7 +437,7 @@ main source_startup_scripts(¶ms); # ifdef FEAT_EVAL - set_vim_var_nr(VV_VIM_DID_INIT, 1L); + set_mnv_var_nr(VV_MNV_DID_INIT, 1L); # endif # ifdef FEAT_MZSCHEME @@ -445,15 +445,15 @@ main * Newer version of MzScheme (Racket) require earlier (trampolined) * initialisation via scheme_main_setup. * Implement this by initialising it as early as possible - * and splitting off remaining Vim main into vim_main2(). + * and splitting off remaining MNV main into mnv_main2(). * Do source startup scripts, so that 'mzschemedll' can be set. */ return mzscheme_main(); # else - return vim_main2(); + return mnv_main2(); # endif } -# endif // NO_VIM_MAIN +# endif // NO_MNV_MAIN #endif // PROTO #if defined(FEAT_X11) && defined(FEAT_XCLIPBOARD) && defined(FEAT_CLIPBOARD) @@ -487,14 +487,14 @@ x_restore_state(void) #endif /* - * vim_main2() is needed for FEAT_MZSCHEME, but we define it always to keep + * mnv_main2() is needed for FEAT_MZSCHEME, but we define it always to keep * things simple. - * It is also defined when NO_VIM_MAIN is defined, but then it's empty. + * It is also defined when NO_MNV_MAIN is defined, but then it's empty. */ int -vim_main2(void) +mnv_main2(void) { -#ifndef NO_VIM_MAIN +#ifndef NO_MNV_MAIN # ifdef FEAT_EVAL /* * Read all the plugin files. @@ -505,9 +505,9 @@ vim_main2(void) char_u *rtp_copy = NULL; char_u *plugin_pattern = (char_u *) # if defined(VMS) || defined(AMIGA) // VMS and Amiga don't handle the "**". - "plugin/*.vim" + "plugin/*.mnv" # else - "plugin/**/*.vim" + "plugin/**/*.mnv" # endif ; @@ -518,14 +518,14 @@ vim_main2(void) // the pack directories. if (!did_source_packages) { - rtp_copy = vim_strsave(p_rtp); + rtp_copy = mnv_strsave(p_rtp); add_pack_start_dirs(); } source_in_path(rtp_copy == NULL ? p_rtp : rtp_copy, plugin_pattern, DIP_ALL | DIP_NOAFTER, NULL); TIME_MSG("loading plugins"); - vim_free(rtp_copy); + mnv_free(rtp_copy); // Only source "start" packages if not done already with a :packloadall // command. @@ -539,7 +539,7 @@ vim_main2(void) # endif # ifdef FEAT_DIFF - // Decide about window layout for diff mode after reading vimrc. + // Decide about window layout for diff mode after reading mnvrc. if (params.diff_mode && params.window_layout == 0) { if (diffopt_horizontal()) @@ -561,7 +561,7 @@ vim_main2(void) } /* - * Set a few option defaults after reading .vimrc files: + * Set a few option defaults after reading .mnvrc files: * 'title' and 'icon', Unix: 'shellpipe' and 'shellredir'. */ set_init_3(); @@ -569,7 +569,7 @@ vim_main2(void) /* * "-n" argument: Disable swap file by setting 'updatecount' to 0. - * Note that this overrides anything from a vimrc file. + * Note that this overrides anything from a mnvrc file. */ if (params.no_swap_file) p_uc = 0; @@ -578,7 +578,7 @@ vim_main2(void) if (gui.starting) { # if defined(UNIX) || defined(VMS) - // When something caused a message from a vimrc script, need to output + // When something caused a message from a mnvrc script, need to output // an extra newline before the shell prompt. if (did_emsg || msg_didout) putchar('\n'); @@ -587,29 +587,29 @@ vim_main2(void) gui_start(NULL); // will set full_screen to TRUE TIME_MSG("starting GUI"); - // When running "evim" or "gvim -y" we need the menus, exit if we + // When running "emnv" or "gmnv -y" we need the menus, exit if we // don't have them. - if (!gui.in_use && params.evim_mode) + if (!gui.in_use && params.emnv_mode) mch_exit(1); firstwin->w_prev_height = firstwin->w_height; // may have changed } # endif -# ifdef FEAT_VIMINFO +# ifdef FEAT_MNVINFO /* - * Read in registers, history etc, but not marks, from the viminfo file. + * Read in registers, history etc, but not marks, from the mnvinfo file. * This is where v:oldfiles gets filled. */ - if (*p_viminfo != NUL) + if (*p_mnvinfo != NUL) { - read_viminfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES); - TIME_MSG("reading viminfo"); + read_mnvinfo(NULL, VIF_WANT_INFO | VIF_GET_OLDFILES); + TIME_MSG("reading mnvinfo"); } # endif # ifdef FEAT_EVAL // It's better to make v:oldfiles an empty list than NULL. - if (get_vim_var_list(VV_OLDFILES) == NULL) - set_vim_var_list(VV_OLDFILES, list_alloc()); + if (get_mnv_var_list(VV_OLDFILES) == NULL) + set_mnv_var_list(VV_OLDFILES, list_alloc()); # endif # ifdef FEAT_QUICKFIX @@ -625,7 +625,7 @@ vim_main2(void) if (params.use_ef != NULL) set_string_option_direct((char_u *)"ef", -1, params.use_ef, OPT_FREE, SID_CARG); - vim_snprintf((char *)IObuff, IOSIZE, "cfile %s", p_ef); + mnv_snprintf((char *)IObuff, IOSIZE, "cfile %s", p_ef); if (qf_init(NULL, p_ef, p_efm, TRUE, IObuff, enc) < 0) { out_char('\n'); @@ -650,7 +650,7 @@ vim_main2(void) * This seems to be required to make callbacks to be called now, instead * of after things have been put on the screen, which then may be deleted * when getting a resize callback. - * For the Mac this handles putting files dropped on the Vim icon to + * For the Mac this handles putting files dropped on the MNV icon to * global_alist. */ if (gui.in_use) @@ -680,7 +680,7 @@ vim_main2(void) # endif # ifdef FEAT_CLIENTSERVER - // Prepare for being a Vim server. + // Prepare for being a MNV server. prepare_server(¶ms); # endif @@ -709,14 +709,14 @@ vim_main2(void) * If "-" argument given: Read file from stdin. * Do this before starting Raw mode, because it may change things that the * writing end of the pipe doesn't like, e.g., in case stdin and stderr - * are the same terminal: "cat | vim -". + * are the same terminal: "cat | mnv -". * Using autocommands here may cause trouble... */ if (params.edit_type == EDIT_STDIN && !recoverymode) read_stdin(); # if defined(UNIX) || defined(VMS) - // When switching screens and something caused a message from a vimrc + // When switching screens and something caused a message from a mnvrc // script, need to output an extra newline on exit. if ((did_emsg || msg_didout) && *T_TI != NUL && params.edit_type != EDIT_STDIN) newline_on_exit = TRUE; @@ -786,7 +786,7 @@ vim_main2(void) # ifdef FEAT_EVAL // clear v:swapcommand - set_vim_var_string(VV_SWAPCOMMAND, NULL, -1); + set_mnv_var_string(VV_SWAPCOMMAND, NULL, -1); # endif // Ex starts at last line of the file @@ -813,14 +813,14 @@ vim_main2(void) * windows. */ edit_buffers(¶ms, start_dir); - vim_free(start_dir); + mnv_free(start_dir); # ifdef FEAT_DIFF if (params.diff_mode) { win_T *wp; - // set options in each window for "vimdiff". + // set options in each window for "mnvdiff". FOR_ALL_WINDOWS(wp) diff_win_options(wp, TRUE); } @@ -833,13 +833,13 @@ vim_main2(void) /* * Need to jump to the tag before executing the '-c command'. - * Makes "vim -c '/return' -t main" work. + * Makes "mnv -c '/return' -t main" work. */ if (params.tagname != NULL) { swap_exists_did_quit = FALSE; - vim_snprintf((char *)IObuff, IOSIZE, "ta %s", params.tagname); + mnv_snprintf((char *)IObuff, IOSIZE, "ta %s", params.tagname); do_cmdline_cmd(IObuff); TIME_MSG("jumping to tag"); @@ -888,13 +888,13 @@ vim_main2(void) # ifdef FEAT_TERMRESPONSE // Requesting the termresponse is postponed until here, so that a "-c q" - // argument doesn't make it appear in the shell Vim was started from. + // argument doesn't make it appear in the shell MNV was started from. may_req_termresponse(); may_req_bg_color(); # endif // Same reason for termresponse, don't want the terminal sending out the - // DECRPM response after Vim has exited. + // DECRPM response after MNV has exited. send_decrqm_modes(); // start in insert mode @@ -902,10 +902,10 @@ vim_main2(void) need_start_insertmode = TRUE; # ifdef FEAT_EVAL - set_vim_var_nr(VV_VIM_DID_ENTER, 1L); + set_mnv_var_nr(VV_MNV_DID_ENTER, 1L); # endif - apply_autocmds(EVENT_VIMENTER, NULL, NULL, FALSE, curbuf); - TIME_MSG("VimEnter autocommands"); + apply_autocmds(EVENT_MNVENTER, NULL, NULL, FALSE, curbuf); + TIME_MSG("MNVEnter autocommands"); # if defined(FEAT_EVAL) && defined(FEAT_CLIPBOARD) // Adjust default register name for "unnamed" in 'clipboard'. Can only be @@ -926,8 +926,8 @@ vim_main2(void) } # endif -# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) -# ifdef VIMDLL +# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)) +# ifdef MNVDLL if (!gui.in_use) # endif mch_set_winsize_now(); // Allow winsize changes from now on @@ -979,7 +979,7 @@ vim_main2(void) */ main_loop(FALSE, FALSE); -#endif // NO_VIM_MAIN +#endif // NO_MNV_MAIN return 0; } @@ -1022,8 +1022,8 @@ common_init_2(mparm_T *paramp) #ifdef NBDEBUG // Wait a moment for debugging NetBeans. Must be after allocating // NameBuff. - nbdebug_log_init("SPRO_GVIM_DEBUG", "SPRO_GVIM_DLEVEL"); - nbdebug_wait(WT_ENV | WT_WAIT | WT_STOP, "SPRO_GVIM_WAIT", 20); + nbdebug_log_init("SPRO_GMNV_DEBUG", "SPRO_GMNV_DLEVEL"); + nbdebug_wait(WT_ENV | WT_WAIT | WT_STOP, "SPRO_GMNV_WAIT", 20); TIME_MSG("NetBeans debug wait"); #endif @@ -1295,7 +1295,7 @@ work_pending(void) /* - * Main loop: Execute Normal mode commands until exiting Vim. + * Main loop: Execute Normal mode commands until exiting MNV. * Also used to handle commands in the command-line window, until the window * is closed. * Also used to handle ":visual" command after ":global": execute Normal mode @@ -1323,7 +1323,7 @@ main_loop( // Setup to catch a terminating error from the X server. Just ignore // it, restore the state and continue. This might not always work // properly, but at least we hopefully don't exit unexpectedly when the X - // server exits while Vim is running in a console. + // server exits while MNV is running in a console. if (!cmdwin && !noexmode && SETJMP(x_jump_env)) x_restore_state(); #endif @@ -1535,13 +1535,13 @@ main_loop( redraw_statuslines(); if (need_maketitle) maketitle(); -#ifdef FEAT_VIMINFO - curbuf->b_last_used = vim_time(); +#ifdef FEAT_MNVINFO + curbuf->b_last_used = mnv_time(); #endif // display message after redraw if (keep_msg != NULL) { - char_u *p = vim_strsave(keep_msg); + char_u *p = mnv_strsave(keep_msg); if (p != NULL) { @@ -1552,7 +1552,7 @@ main_loop( msg_hist_off = TRUE; msg_attr((char *)p, keep_msg_attr); msg_hist_off = FALSE; - vim_free(p); + mnv_free(p); } } if (need_fileinfo) // show file info after redraw @@ -1578,7 +1578,7 @@ main_loop( if (time_fd != NULL) { TIME_MSG("first screen update"); - TIME_MSG("--- VIM STARTED ---"); + TIME_MSG("--- MNV STARTED ---"); fclose(time_fd); time_fd = NULL; } @@ -1617,7 +1617,7 @@ main_loop( { if (noexmode) // End of ":global/path/visual" commands goto theend; - do_exmode(exmode_active == EXMODE_VIM); + do_exmode(exmode_active == EXMODE_MNV); } else { @@ -1658,7 +1658,7 @@ getout_preserve_modified(int exitval) { # if defined(SIGHUP) && defined(SIG_IGN) // Ignore SIGHUP, because a dropped connection causes a read error, which - // makes Vim exit and then handling SIGHUP causes various reentrance + // makes MNV exit and then handling SIGHUP causes various reentrance // problems. mch_signal(SIGHUP, SIG_IGN); # endif @@ -1666,13 +1666,13 @@ getout_preserve_modified(int exitval) ml_close_notmod(); // close all not-modified buffers ml_sync_all(FALSE, FALSE); // preserve all swap files ml_close_all(FALSE); // close all memfiles, without deleting - getout(exitval); // exit Vim properly + getout(exitval); // exit MNV properly } #endif /* - * Exit properly. This is the only way to exit Vim after startup has + * Exit properly. This is the only way to exit MNV after startup has * succeeded. We are certain to exit here, no way to abort it. */ void @@ -1690,8 +1690,8 @@ getout(int exitval) exitval += ex_exitval; #ifdef FEAT_EVAL - set_vim_var_type(VV_EXITING, VAR_NUMBER); - set_vim_var_nr(VV_EXITING, exitval); + set_mnv_var_type(VV_EXITING, VAR_NUMBER); + set_mnv_var_nr(VV_EXITING, exitval); #endif // Position the cursor on the last screen line, below all the text @@ -1762,38 +1762,38 @@ getout(int exitval) } // deathtrap() blocks autocommands, but we do want to trigger - // VimLeavePre. + // MNVLeavePre. if (is_autocmd_blocked()) { unblock_autocmds(); ++unblock; } - apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf); + apply_autocmds(EVENT_MNVLEAVEPRE, NULL, NULL, FALSE, curbuf); if (unblock) block_autocmds(); } -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO if ( # ifdef EXITFREE entered_free_all_mem == FALSE && # endif - *p_viminfo != NUL) - // Write out the registers, history, marks etc, to the viminfo file - write_viminfo(NULL, FALSE); + *p_mnvinfo != NUL) + // Write out the registers, history, marks etc, to the mnvinfo file + write_mnvinfo(NULL, FALSE); #endif if (v_dying <= 1) { int unblock = 0; - // deathtrap() blocks autocommands, but we do want to trigger VimLeave. + // deathtrap() blocks autocommands, but we do want to trigger MNVLeave. if (is_autocmd_blocked()) { unblock_autocmds(); ++unblock; } - apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, FALSE, curbuf); + apply_autocmds(EVENT_MNVLEAVE, NULL, NULL, FALSE, curbuf); if (unblock) block_autocmds(); } @@ -1974,9 +1974,9 @@ early_arg_scan(mparm_T *parmp UNUSED) #endif } -#ifndef NO_VIM_MAIN +#ifndef NO_MNV_MAIN /* - * Get a (optional) count for a Vim argument. + * Get a (optional) count for a MNV argument. */ static int get_number_arg( @@ -1984,22 +1984,22 @@ get_number_arg( int *idx, // index in argument, is incremented int def) // default value { - if (vim_isdigit(p[*idx])) + if (mnv_isdigit(p[*idx])) { def = atoi((char *)&(p[*idx])); - while (vim_isdigit(p[*idx])) + while (mnv_isdigit(p[*idx])) *idx = *idx + 1; } return def; } /* - * Check for: [r][e][g][vi|vim|view][diff][ex[im]] (sort of) + * Check for: [r][e][g][vi|mnv|view][diff][ex[im]] (sort of) * If the executable name starts with "r" we disable shell commands. * If the next character is "e" we run in Easy mode. * If the next character is "g" we run the GUI version. * If the next characters are "view" we start in readonly mode. - * If the next characters are "diff" or "vimdiff" we start in diff mode. + * If the next characters are "diff" or "mnvdiff" we start in diff mode. * If the next characters are "ex" we start in Ex mode. If it's followed * by "im" use improved Ex mode. */ @@ -2011,7 +2011,7 @@ parse_command_name(mparm_T *parmp) initstr = gettail((char_u *)parmp->argv[0]); # ifdef FEAT_EVAL - set_vim_var_string(VV_PROGNAME, initstr, -1); + set_mnv_var_string(VV_PROGNAME, initstr, -1); set_progpath((char_u *)parmp->argv[0]); # endif @@ -2021,7 +2021,7 @@ parse_command_name(mparm_T *parmp) ++initstr; } - // Use evim mode for "evim" and "egvim", not for "editor". + // Use emnv mode for "emnv" and "egmnv", not for "editor". if (TOLOWER_ASC(initstr[0]) == 'e' && (TOLOWER_ASC(initstr[1]) == 'v' || TOLOWER_ASC(initstr[1]) == 'g')) @@ -2029,11 +2029,11 @@ parse_command_name(mparm_T *parmp) # ifdef FEAT_GUI gui.starting = TRUE; # endif - parmp->evim_mode = TRUE; + parmp->emnv_mode = TRUE; ++initstr; } - // "gvim" starts the GUI. Also accept "Gvim" for MS-Windows. + // "gmnv" starts the GUI. Also accept "Gmnv" for MS-Windows. if (TOLOWER_ASC(initstr[0]) == 'g') { main_start_gui(); @@ -2046,7 +2046,7 @@ parse_command_name(mparm_T *parmp) } # ifdef GUI_MAY_SPAWN else - gui.dospawn = TRUE; // Not "gvim". Need to spawn gvim.exe. + gui.dospawn = TRUE; // Not "gmnv". Need to spawn gmnv.exe. # endif @@ -2057,27 +2057,27 @@ parse_command_name(mparm_T *parmp) p_uc = 10000; // don't update very often initstr += 4; } - else if (STRNICMP(initstr, "vim", 3) == 0) + else if (STRNICMP(initstr, "mnv", 3) == 0) initstr += 3; - // Catch "[r][g]vimdiff" and "[r][g]viewdiff". + // Catch "[r][g]mnvdiff" and "[r][g]viewdiff". if (STRICMP(initstr, "diff") == 0) { # ifdef FEAT_DIFF parmp->diff_mode = TRUE; # else - mch_errmsg(_("This Vim was not compiled with the diff feature.")); + mch_errmsg(_("This MNV was not compiled with the diff feature.")); mch_errmsg("\n"); mch_exit(2); # endif } - // Checking for "ex" here may catch some weird names, such as "vimex" or + // Checking for "ex" here may catch some weird names, such as "mnvex" or // "viewex", we assume the user knows that. if (STRNICMP(initstr, "ex", 2) == 0) { if (STRNICMP(initstr + 2, "im", 2) == 0) - exmode_active = EXMODE_VIM; + exmode_active = EXMODE_MNV; else exmode_active = EXMODE_NORMAL; change_compatible(TRUE); // set 'compatible' @@ -2155,7 +2155,7 @@ command_line_scan(mparm_T *parmp) # endif /* defined( VMS) */ switch (c) { - case NUL: // "vim -" read from stdin + case NUL: // "mnv -" read from stdin // "ex -" silent mode if (exmode_active) silent_mode = TRUE; @@ -2181,14 +2181,14 @@ command_line_scan(mparm_T *parmp) // "--gui-dialog-file fname" write dialog text // "--ttyfail" exit if not a term // "--noplugin[s]" skip plugins - // "--cmd " execute cmd before vimrc + // "--cmd " execute cmd before mnvrc if (STRICMP(argv[0] + argv_idx, "help") == 0) usage(); else if (STRICMP(argv[0] + argv_idx, "version") == 0) { cmdline_width = Columns = 80; // need to init Columns info_message = TRUE; // use mch_msg(), not mch_errmsg() -# if defined(FEAT_GUI) && !defined(ALWAYS_USE_GUI) && !defined(VIMDLL) +# if defined(FEAT_GUI) && !defined(ALWAYS_USE_GUI) && !defined(MNVDLL) gui.starting = FALSE; // not starting GUI, will exit # endif list_version(); @@ -2198,9 +2198,9 @@ command_line_scan(mparm_T *parmp) } else if (STRNICMP(argv[0] + argv_idx, "clean", 5) == 0) { - parmp->use_vimrc = (char_u *)"DEFAULTS"; + parmp->use_mnvrc = (char_u *)"DEFAULTS"; # ifdef FEAT_GUI - use_gvimrc = (char_u *)"NONE"; + use_gmnvrc = (char_u *)"NONE"; # endif parmp->clean = TRUE; set_option_value_give_err((char_u *)"vif", @@ -2321,7 +2321,7 @@ command_line_scan(mparm_T *parmp) break; case 'E': // "-E" Improved Ex mode - exmode_active = EXMODE_VIM; + exmode_active = EXMODE_MNV; break; case 'f': // "-f" GUI: run in foreground. Amiga: open @@ -2343,7 +2343,7 @@ command_line_scan(mparm_T *parmp) case '?': // "-?" give help message (for MS-Windows) case 'h': // "-h" give help message # ifdef FEAT_GUI_GNOME - // Tell usage() to exit for "gvim". + // Tell usage() to exit for "gmnv". gui.starting = FALSE; # endif usage(); @@ -2376,7 +2376,7 @@ command_line_scan(mparm_T *parmp) # ifdef FEAT_GUI gui.starting = TRUE; // start GUI a bit later # endif - parmp->evim_mode = TRUE; + parmp->emnv_mode = TRUE; break; case 'N': // "-N" Nocompatible @@ -2503,14 +2503,14 @@ command_line_scan(mparm_T *parmp) case 'v': // "-v" Vi-mode (as if called "vi") exmode_active = 0; -# if defined(FEAT_GUI) && !defined(VIMDLL) +# if defined(FEAT_GUI) && !defined(MNVDLL) gui.starting = FALSE; // don't start GUI # endif break; case 'w': // "-w{number}" set window height // "-w {scriptout}" write to script - if (vim_isdigit(((char_u *)argv[0])[argv_idx])) + if (mnv_isdigit(((char_u *)argv[0])[argv_idx])) { n = get_number_arg((char_u *)argv[0], &argv_idx, 10); set_option_value_give_err((char_u *)"window", n, NULL, 0); @@ -2552,14 +2552,14 @@ command_line_scan(mparm_T *parmp) break; } // FALLTHROUGH - case 'S': // "-S {file}" execute Vim script - case 'i': // "-i {viminfo}" use for viminfo + case 'S': // "-S {file}" execute MNV script + case 'i': // "-i {mnvinfo}" use for mnvinfo # ifndef FEAT_DIFF case 'd': // "-d {device}" device (for Amiga) # endif case 'T': // "-T {terminal}" terminal name - case 'u': // "-u {vimrc}" vim inits file - case 'U': // "-U {gvimrc}" gvim inits file + case 'u': // "-u {mnvrc}" mnv inits file + case 'U': // "-U {gmnvrc}" gmnv inits file case 'W': // "-W {scriptout}" overwrite # ifdef FEAT_GUI_MSWIN case 'P': // "-P {parent title}" MDI parent @@ -2591,7 +2591,7 @@ command_line_scan(mparm_T *parmp) switch (c) { case 'c': // "-c {command}" execute command - case 'S': // "-S {file}" execute Vim script + case 'S': // "-S {file}" execute MNV script if (parmp->n_commands >= MAX_ARG_CMDS) mainerr(ME_EXTRA_CMD, NULL); if (c == 'S') @@ -2655,7 +2655,7 @@ command_line_scan(mparm_T *parmp) break; # endif - case 'i': // "-i {viminfo}" use for viminfo + case 'i': // "-i {mnvinfo}" use for mnvinfo set_option_value_give_err((char_u *)"vif", 0L, (char_u *)argv[0], 0); break; @@ -2700,19 +2700,19 @@ scripterror: parmp->term = (char_u *)argv[0]; break; - case 'u': // "-u {vimrc}" vim inits file - parmp->use_vimrc = (char_u *)argv[0]; + case 'u': // "-u {mnvrc}" mnv inits file + parmp->use_mnvrc = (char_u *)argv[0]; break; - case 'U': // "-U {gvimrc}" gvim inits file + case 'U': // "-U {gmnvrc}" gmnv inits file # ifdef FEAT_GUI - use_gvimrc = (char_u *)argv[0]; + use_gmnvrc = (char_u *)argv[0]; # endif break; case 'w': // "-w {nr}" 'window' value // "-w {scriptout}" append to script file - if (vim_isdigit(*((char_u *)argv[0]))) + if (mnv_isdigit(*((char_u *)argv[0]))) { argv_idx = 0; n = get_number_arg((char_u *)argv[0], &argv_idx, 10); @@ -2765,7 +2765,7 @@ scripterror: // Add the file to the global argument list. if (ga_grow(&global_alist.al_ga, 1) == FAIL - || (p = vim_strsave((char_u *)argv[0])) == NULL) + || (p = mnv_strsave((char_u *)argv[0])) == NULL) mch_exit(2); # ifdef FEAT_DIFF if (parmp->diff_mode && mch_isdir(p) && GARGCOUNT > 0 @@ -2776,19 +2776,19 @@ scripterror: r = concat_fnames(p, gettail(alist_name(&GARGLIST[0])), TRUE); if (r != NULL) { - vim_free(p); + mnv_free(p); p = r; } } # endif # ifdef __CYGWIN__ /* - * If vim is invoked by non-Cygwin tools, convert away any + * If mnv is invoked by non-Cygwin tools, convert away any * DOS paths, so things like .swp files are created correctly. * Look for evidence of non-Cygwin paths before we bother. * This is only for when using the Unix files. */ - if (vim_strpbrk(p, "\\:") != NULL && !path_with_url(p)) + if (mnv_strpbrk(p, "\\:") != NULL && !path_with_url(p)) { char posix_path[MAXPATHL]; @@ -2797,8 +2797,8 @@ scripterror: # else cygwin_conv_to_posix_path(p, posix_path); # endif - vim_free(p); - p = vim_strsave((char_u *)posix_path); + mnv_free(p); + p = mnv_strsave((char_u *)posix_path); if (p == NULL) mch_exit(2); } @@ -2857,8 +2857,8 @@ scripterror: if (p != NULL) { sprintf((char *)p, ":%s\r", parmp->commands[0]); - set_vim_var_string(VV_SWAPCOMMAND, p, (int)plen); - vim_free(p); + set_mnv_var_string(VV_SWAPCOMMAND, p, (int)plen); + mnv_free(p); } } # endif @@ -2889,20 +2889,20 @@ check_tty(mparm_T *parmp) # ifdef NBDEBUG /* * This shouldn't be necessary. But if I run netbeans with the log - * output coming to the console and XOpenDisplay fails, I get vim + * output coming to the console and XOpenDisplay fails, I get mnv * trying to start with input/output to my console tty. This fills my * input buffer so fast I can't even kill the process in under 2 * minutes (and it beeps continuously the whole time :-) */ if (netbeans_active() && (!stdout_isatty || !input_isatty)) { - mch_errmsg(_("Vim: Error: Failure to start gvim from NetBeans\n")); + mch_errmsg(_("MNV: Error: Failure to start gmnv from NetBeans\n")); exit(1); } # endif -# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)) if ( -# ifdef VIMDLL +# ifdef MNVDLL !gui.starting && # endif is_cygpty_used()) @@ -2919,17 +2919,17 @@ check_tty(mparm_T *parmp) tofree = s = (char *)enc_locale_env(NULL); if (s == NULL) s = "utf-8"; // Use "utf-8" by default. - (void)bind_textdomain_codeset(VIMPACKAGE, s); - vim_free(tofree); + (void)bind_textdomain_codeset(MNVPACKAGE, s); + mnv_free(tofree); # endif - mch_errmsg(_("Vim: Error: This version of Vim does not run in a Cygwin terminal\n")); + mch_errmsg(_("MNV: Error: This version of MNV does not run in a Cygwin terminal\n")); exit(1); } # endif if (!stdout_isatty) - mch_errmsg(_("Vim: Warning: Output is not to a terminal\n")); + mch_errmsg(_("MNV: Warning: Output is not to a terminal\n")); if (!input_isatty) - mch_errmsg(_("Vim: Warning: Input is not from a terminal\n")); + mch_errmsg(_("MNV: Warning: Input is not from a terminal\n")); out_flush(); if (parmp->tty_fail && (!stdout_isatty || !input_isatty)) exit(1); @@ -2968,7 +2968,7 @@ read_stdin(void) // work. // TODO: why is this needed, even though readfile() has done this? close(0); - vim_ignored = dup(2); + mnv_ignored = dup(2); # endif } @@ -2991,7 +2991,7 @@ create_windows(mparm_T *parmp UNUSED) parmp->window_count = GARGCOUNT; if (parmp->window_count > 1) { - // Don't change the windows if there was a command in .vimrc that + // Don't change the windows if there was a command in .mnvrc that // already split some windows if (parmp->window_layout == 0) parmp->window_layout = WIN_HOR; @@ -3024,7 +3024,7 @@ create_windows(mparm_T *parmp UNUSED) { /* * Open a buffer for windows that don't have one yet. - * Commands in the .vimrc might have loaded a file or split the window. + * Commands in the .mnvrc might have loaded a file or split the window. * Watch out for autocommands that delete a window. */ /* @@ -3163,8 +3163,8 @@ edit_buffers( { char buf[100]; - p_shm_save = vim_strsave(p_shm); - vim_snprintf(buf, 100, "F%s", p_shm); + p_shm_save = mnv_strsave(p_shm); + mnv_snprintf(buf, 100, "F%s", p_shm); set_option_value_give_err((char_u *)"shm", 0L, (char_u *)buf, 0); } @@ -3179,7 +3179,7 @@ edit_buffers( advance = TRUE; // Only open the file if there is no file in this window yet (that can - // happen when .vimrc contains ":sall"). + // happen when .mnvrc contains ":sall"). if (curbuf == firstwin->w_buffer || curbuf->b_ffname == NULL) { curwin->w_arg_idx = arg_idx; @@ -3216,7 +3216,7 @@ edit_buffers( if (p_shm_save != NULL) { set_option_value_give_err((char_u *)"shm", 0L, p_shm_save, 0); - vim_free(p_shm_save); + mnv_free(p_shm_save); } if (parmp->window_layout == WIN_TABS) @@ -3260,7 +3260,7 @@ exe_pre_commands(mparm_T *parmp) return; curwin->w_cursor.lnum = 0; // just in case.. - estack_push(ETYPE_ARGS, (char_u *)_("pre-vimrc command line"), 0); + estack_push(ETYPE_ARGS, (char_u *)_("pre-mnvrc command line"), 0); ESTACK_CHECK_SETUP; # ifdef FEAT_EVAL current_sctx.sc_sid = SID_CMDARG; @@ -3285,7 +3285,7 @@ exe_commands(mparm_T *parmp) ESTACK_CHECK_DECLARATION; /* - * We start commands on line 0, make "vim +/pat file" match a + * We start commands on line 0, make "mnv +/pat file" match a * pattern on line 1. But don't move the cursor when an autocommand * with g`" was used. */ @@ -3302,7 +3302,7 @@ exe_commands(mparm_T *parmp) { do_cmdline_cmd(parmp->commands[i]); if (parmp->cmds_tofree[i]) - vim_free(parmp->commands[i]); + mnv_free(parmp->commands[i]); } ESTACK_CHECK_NOW; estack_pop(); @@ -3332,39 +3332,39 @@ source_startup_scripts(mparm_T *parmp) int i; /* - * For "evim" source evim.vim first of all, so that the user can overrule + * For "emnv" source emnv.mnv first of all, so that the user can overrule * any things he doesn't like. */ - if (parmp->evim_mode) + if (parmp->emnv_mode) { - (void)do_source((char_u *)EVIM_FILE, FALSE, DOSO_NONE, NULL); - TIME_MSG("source evim file"); + (void)do_source((char_u *)EMNV_FILE, FALSE, DOSO_NONE, NULL); + TIME_MSG("source emnv file"); } /* * If -u argument given, use only the initializations from that file and * nothing else. */ - if (parmp->use_vimrc != NULL) + if (parmp->use_mnvrc != NULL) { - if (STRCMP(parmp->use_vimrc, "DEFAULTS") == 0) + if (STRCMP(parmp->use_mnvrc, "DEFAULTS") == 0) { - if (do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE, NULL) + if (do_source((char_u *)MNV_DEFAULTS_FILE, FALSE, DOSO_NONE, NULL) != OK) emsg(_(e_failed_to_source_defaults)); } - else if (STRCMP(parmp->use_vimrc, "NONE") == 0 - || STRCMP(parmp->use_vimrc, "NORC") == 0) + else if (STRCMP(parmp->use_mnvrc, "NONE") == 0 + || STRCMP(parmp->use_mnvrc, "NORC") == 0) { # ifdef FEAT_GUI - if (use_gvimrc == NULL) // don't load gvimrc either - use_gvimrc = parmp->use_vimrc; + if (use_gmnvrc == NULL) // don't load gmnvrc either + use_gmnvrc = parmp->use_mnvrc; # endif } else { - if (do_source(parmp->use_vimrc, FALSE, DOSO_NONE, NULL) != OK) - semsg(_(e_cannot_read_from_str_2), parmp->use_vimrc); + if (do_source(parmp->use_mnvrc, FALSE, DOSO_NONE, NULL) != OK) + semsg(_(e_cannot_read_from_str_2), parmp->use_mnvrc); } } else if (!silent_mode) @@ -3380,43 +3380,43 @@ source_startup_scripts(mparm_T *parmp) /* * Get system wide defaults, if the file name is defined. */ -# ifdef SYS_VIMRC_FILE - (void)do_source((char_u *)SYS_VIMRC_FILE, FALSE, DOSO_NONE, NULL); +# ifdef SYS_MNVRC_FILE + (void)do_source((char_u *)SYS_MNVRC_FILE, FALSE, DOSO_NONE, NULL); # endif # ifdef MACOS_X - (void)do_source((char_u *)"$VIMRUNTIME/macmap.vim", FALSE, + (void)do_source((char_u *)"$MNVRUNTIME/macmap.mnv", FALSE, DOSO_NONE, NULL); # endif /* * Try to read initialization commands from the following places: - * - environment variable VIMINIT - * - user vimrc file (s:.vimrc for Amiga, ~/.vimrc otherwise) - * - second user vimrc file ($VIM/.vimrc for Dos) + * - environment variable MNVINIT + * - user mnvrc file (s:.mnvrc for Amiga, ~/.mnvrc otherwise) + * - second user mnvrc file ($MNV/.mnvrc for Dos) * - environment variable EXINIT * - user exrc file (s:.exrc for Amiga, ~/.exrc otherwise) - * - second user exrc file ($VIM/.exrc for Dos) + * - second user exrc file ($MNV/.exrc for Dos) * The first that exists is used, the rest is ignored. */ - if (process_env((char_u *)"VIMINIT", TRUE) != OK) + if (process_env((char_u *)"MNVINIT", TRUE) != OK) { - if (do_source((char_u *)USR_VIMRC_FILE, TRUE, - DOSO_VIMRC, NULL) == FAIL -# ifdef USR_VIMRC_FILE2 - && do_source((char_u *)USR_VIMRC_FILE2, TRUE, - DOSO_VIMRC, NULL) == FAIL + if (do_source((char_u *)USR_MNVRC_FILE, TRUE, + DOSO_MNVRC, NULL) == FAIL +# ifdef USR_MNVRC_FILE2 + && do_source((char_u *)USR_MNVRC_FILE2, TRUE, + DOSO_MNVRC, NULL) == FAIL # endif -# ifdef XDG_VIMRC_FILE - && do_source((char_u *)XDG_VIMRC_FILE, TRUE, - DOSO_VIMRC, NULL) == FAIL +# ifdef XDG_MNVRC_FILE + && do_source((char_u *)XDG_MNVRC_FILE, TRUE, + DOSO_MNVRC, NULL) == FAIL # endif -# ifdef USR_VIMRC_FILE3 - && do_source((char_u *)USR_VIMRC_FILE3, TRUE, - DOSO_VIMRC, NULL) == FAIL +# ifdef USR_MNVRC_FILE3 + && do_source((char_u *)USR_MNVRC_FILE3, TRUE, + DOSO_MNVRC, NULL) == FAIL # endif -# ifdef USR_VIMRC_FILE4 - && do_source((char_u *)USR_VIMRC_FILE4, TRUE, - DOSO_VIMRC, NULL) == FAIL +# ifdef USR_MNVRC_FILE4 + && do_source((char_u *)USR_MNVRC_FILE4, TRUE, + DOSO_MNVRC, NULL) == FAIL # endif && process_env((char_u *)"EXINIT", FALSE) == FAIL && do_source((char_u *)USR_EXRC_FILE, FALSE, @@ -3427,47 +3427,47 @@ source_startup_scripts(mparm_T *parmp) # endif && !has_dash_c_arg) { - // When no .vimrc file was found: source defaults.vim. - if (do_source((char_u *)VIM_DEFAULTS_FILE, FALSE, DOSO_NONE, + // When no .mnvrc file was found: source defaults.mnv. + if (do_source((char_u *)MNV_DEFAULTS_FILE, FALSE, DOSO_NONE, NULL) == FAIL) emsg(_(e_failed_to_source_defaults)); } } /* - * Read initialization commands from ".vimrc" or ".exrc" in current + * Read initialization commands from ".mnvrc" or ".exrc" in current * directory. This is only done if the 'exrc' option is set. * Because of security reasons we disallow shell and write commands * now, except for Unix if the file is owned by the user or 'secure' - * option has been reset in environment of global ".exrc" or ".vimrc". - * Only do this if VIMRC_FILE is not the same as USR_VIMRC_FILE or - * SYS_VIMRC_FILE. + * option has been reset in environment of global ".exrc" or ".mnvrc". + * Only do this if MNVRC_FILE is not the same as USR_MNVRC_FILE or + * SYS_MNVRC_FILE. */ if (p_exrc) { # if defined(UNIX) || defined(VMS) - // If ".vimrc" file is not owned by user, set 'secure' mode. - if (!file_owned(VIMRC_FILE)) + // If ".mnvrc" file is not owned by user, set 'secure' mode. + if (!file_owned(MNVRC_FILE)) # endif secure = p_secure; i = FAIL; - if (fullpathcmp((char_u *)USR_VIMRC_FILE, - (char_u *)VIMRC_FILE, FALSE, TRUE) != FPC_SAME -# ifdef USR_VIMRC_FILE2 - && fullpathcmp((char_u *)USR_VIMRC_FILE2, - (char_u *)VIMRC_FILE, FALSE, TRUE) != FPC_SAME + if (fullpathcmp((char_u *)USR_MNVRC_FILE, + (char_u *)MNVRC_FILE, FALSE, TRUE) != FPC_SAME +# ifdef USR_MNVRC_FILE2 + && fullpathcmp((char_u *)USR_MNVRC_FILE2, + (char_u *)MNVRC_FILE, FALSE, TRUE) != FPC_SAME # endif -# ifdef USR_VIMRC_FILE3 - && fullpathcmp((char_u *)USR_VIMRC_FILE3, - (char_u *)VIMRC_FILE, FALSE, TRUE) != FPC_SAME +# ifdef USR_MNVRC_FILE3 + && fullpathcmp((char_u *)USR_MNVRC_FILE3, + (char_u *)MNVRC_FILE, FALSE, TRUE) != FPC_SAME # endif -# ifdef SYS_VIMRC_FILE - && fullpathcmp((char_u *)SYS_VIMRC_FILE, - (char_u *)VIMRC_FILE, FALSE, TRUE) != FPC_SAME +# ifdef SYS_MNVRC_FILE + && fullpathcmp((char_u *)SYS_MNVRC_FILE, + (char_u *)MNVRC_FILE, FALSE, TRUE) != FPC_SAME # endif ) - i = do_source((char_u *)VIMRC_FILE, TRUE, DOSO_VIMRC, NULL); + i = do_source((char_u *)MNVRC_FILE, TRUE, DOSO_MNVRC, NULL); if (i == FAIL) { @@ -3496,7 +3496,7 @@ source_startup_scripts(mparm_T *parmp) proc->pr_WindowPtr = save_winptr; # endif } - TIME_MSG("sourcing vimrc file(s)"); + TIME_MSG("sourcing mnvrc file(s)"); } /* @@ -3514,7 +3514,7 @@ main_start_gui(void) # endif } -#endif // NO_VIM_MAIN +#endif // NO_MNV_MAIN /* * Get an environment variable and execute it as Ex commands. @@ -3523,7 +3523,7 @@ main_start_gui(void) int process_env( char_u *env, - int is_viminit) // when TRUE, called for VIMINIT + int is_mnvinit) // when TRUE, called for MNVINIT { char_u *initstr; sctx_T save_current_sctx; @@ -3532,8 +3532,8 @@ process_env( if ((initstr = mch_getenv(env)) == NULL || *initstr == NUL) return FAIL; - if (is_viminit) - vimrc_found(NULL, NULL); + if (is_mnvinit) + mnvrc_found(NULL, NULL); estack_push(ETYPE_ENV, env, 0); ESTACK_CHECK_SETUP; save_current_sctx = current_sctx; @@ -3552,10 +3552,10 @@ process_env( return OK; } -#if (defined(UNIX) || defined(VMS)) && !defined(NO_VIM_MAIN) +#if (defined(UNIX) || defined(VMS)) && !defined(NO_MNV_MAIN) /* * Return TRUE if we are certain the user owns the file "fname". - * Used for ".vimrc" and ".exrc". + * Used for ".mnvrc" and ".exrc". * Use both stat() and lstat() for extra security. */ static int @@ -3589,7 +3589,7 @@ mainerr( #endif // If this is a Windows GUI executable, show an error dialog box. -#ifdef VIMDLL +#ifdef MNVDLL gui.in_use = mch_is_gui_executable(); #endif #ifdef FEAT_GUI_MSWIN @@ -3606,7 +3606,7 @@ mainerr( mch_errmsg((char *)str); mch_errmsg("\""); } - mch_errmsg(_("\nMore info with: \"vim -h\"\n")); + mch_errmsg(_("\nMore info with: \"mnv -h\"\n")); mch_exit(1); } @@ -3617,7 +3617,7 @@ mainerr_arg_missing(char_u *str) mainerr(ME_ARG_MISSING, str); } -#ifndef NO_VIM_MAIN +#ifndef NO_MNV_MAIN /* * print a message with three spaces prepended and '\n' appended. */ @@ -3630,7 +3630,7 @@ main_msg(char *s) } /* - * Print messages for "vim -h" or "vim --help" and exit. + * Print messages for "mnv -h" or "mnv --help" and exit. */ static void usage(void) @@ -3655,7 +3655,7 @@ usage(void) mch_msg(_("\n\nUsage:")); for (i = 0; ; ++i) { - mch_msg(_(" vim [arguments] ")); + mch_msg(_(" mnv [arguments] ")); mch_msg(_(use[i])); if (i == ARRAY_LENGTH(use) - 1) break; @@ -3672,11 +3672,11 @@ usage(void) main_msg(_("--literal\t\tDon't expand wildcards")); # endif # ifdef FEAT_OLE - main_msg(_("-register\t\tRegister this gvim for OLE")); - main_msg(_("-unregister\t\tUnregister gvim for OLE")); + main_msg(_("-register\t\tRegister this gmnv for OLE")); + main_msg(_("-unregister\t\tUnregister gmnv for OLE")); # endif # ifdef FEAT_GUI - main_msg(_("-g\t\t\tRun using GUI (like \"gvim\")")); + main_msg(_("-g\t\t\tRun using GUI (like \"gmnv\")")); main_msg(_("-f or --nofork\tForeground: Don't fork when starting GUI")); # endif main_msg(_("-v\t\t\tVi mode (like \"vi\")")); @@ -3684,11 +3684,11 @@ usage(void) main_msg(_("-E\t\t\tImproved Ex mode")); main_msg(_("-s\t\t\tSilent (batch) mode (only for \"ex\")")); # ifdef FEAT_DIFF - main_msg(_("-d\t\t\tDiff mode (like \"vimdiff\")")); + main_msg(_("-d\t\t\tDiff mode (like \"mnvdiff\")")); # endif - main_msg(_("-y\t\t\tEasy mode (like \"evim\", modeless)")); + main_msg(_("-y\t\t\tEasy mode (like \"emnv\", modeless)")); main_msg(_("-R\t\t\tReadonly mode (like \"view\")")); - main_msg(_("-Z\t\t\tRestricted mode (like \"rvim\")")); + main_msg(_("-Z\t\t\tRestricted mode (like \"rmnv\")")); main_msg(_("-m\t\t\tModifications (writing files) not allowed")); main_msg(_("-M\t\t\tModifications in text not allowed")); main_msg(_("-b\t\t\tBinary mode")); @@ -3719,9 +3719,9 @@ usage(void) main_msg(_("--gui-dialog-file {fname} For testing: write dialog text")); # endif main_msg(_("--ttyfail\t\tExit if input or output is not a terminal")); - main_msg(_("-u \t\tUse instead of any .vimrc")); + main_msg(_("-u \t\tUse instead of any .mnvrc")); # ifdef FEAT_GUI - main_msg(_("-U \t\tUse instead of any .gvimrc")); + main_msg(_("-U \t\tUse instead of any .gmnvrc")); # endif main_msg(_("--noplugin\t\tDon't load plugin scripts")); main_msg(_("-p[N]\t\tOpen N tab pages (default: one for each file)")); @@ -3729,7 +3729,7 @@ usage(void) main_msg(_("-O[N]\t\tLike -o but split vertically")); main_msg(_("+\t\t\tStart at end of file")); main_msg(_("+\t\tStart at line ")); - main_msg(_("--cmd \tExecute before loading any vimrc file")); + main_msg(_("--cmd \tExecute before loading any mnvrc file")); main_msg(_("-c \t\tExecute after loading the first file")); main_msg(_("-S \t\tSource file after loading the first file")); main_msg(_("-s \tRead Normal mode commands from file ")); @@ -3740,7 +3740,7 @@ usage(void) # endif # if (defined(UNIX) || defined(VMS)) && defined(FEAT_X11) # if defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) - main_msg(_("-display \tConnect Vim to this particular X-server")); + main_msg(_("-display \tConnect MNV to this particular X-server")); # endif main_msg(_("-X\t\t\tDo not connect to X server")); # endif @@ -3751,15 +3751,15 @@ usage(void) # if defined(FEAT_X11) && defined(FEAT_SOCKETSERVER) main_msg(_("--clientserver Backend for clientserver communication")); # endif - main_msg(_("--remote \tEdit in a Vim server if possible")); + main_msg(_("--remote \tEdit in a MNV server if possible")); main_msg(_("--remote-silent Same, don't complain if there is no server")); main_msg(_("--remote-wait As --remote but wait for files to have been edited")); main_msg(_("--remote-wait-silent Same, don't complain if there is no server")); main_msg(_("--remote-tab[-wait][-silent] As --remote but use tab page per file")); - main_msg(_("--remote-send \tSend to a Vim server and exit")); - main_msg(_("--remote-expr \tEvaluate in a Vim server and print result")); - main_msg(_("--serverlist\t\tList available Vim server names and exit")); - main_msg(_("--servername \tSend to/become the Vim server ")); + main_msg(_("--remote-send \tSend to a MNV server and exit")); + main_msg(_("--remote-expr \tEvaluate in a MNV server and print result")); + main_msg(_("--serverlist\t\tList available MNV server names and exit")); + main_msg(_("--servername \tSend to/become the MNV server ")); # endif # ifdef STARTUPTIME main_msg(_("--startuptime \tWrite startup timing messages to ")); @@ -3767,19 +3767,19 @@ usage(void) # ifdef FEAT_JOB_CHANNEL main_msg(_("--log \t\tStart logging to early")); # endif -# ifdef FEAT_VIMINFO - main_msg(_("-i \t\tUse instead of .viminfo")); +# ifdef FEAT_MNVINFO + main_msg(_("-i \t\tUse instead of .mnvinfo")); # endif - main_msg(_("--clean\t\t'nocompatible', Vim defaults, no plugins, no viminfo")); + main_msg(_("--clean\t\t'nocompatible', MNV defaults, no plugins, no mnvinfo")); main_msg(_("-h or --help\tPrint Help (this message) and exit")); main_msg(_("--version\t\tPrint version information and exit")); # ifdef FEAT_GUI_X11 # ifdef FEAT_GUI_MOTIF - mch_msg(_("\nArguments recognised by gvim (Motif version):\n")); + mch_msg(_("\nArguments recognised by gmnv (Motif version):\n")); # endif - main_msg(_("-display \tRun Vim on ")); - main_msg(_("-iconic\t\tStart Vim iconified")); + main_msg(_("-display \tRun MNV on ")); + main_msg(_("-iconic\t\tStart MNV iconified")); main_msg(_("-background \tUse for the background (also: -bg)")); main_msg(_("-foreground \tUse for normal text (also: -fg)")); main_msg(_("-font \t\tUse for normal text (also: -fn)")); @@ -3793,25 +3793,25 @@ usage(void) main_msg(_("-xrm \tSet the specified resource")); # endif // FEAT_GUI_X11 # ifdef FEAT_GUI_GTK - mch_msg(_("\nArguments recognised by gvim (GTK+ version):\n")); + mch_msg(_("\nArguments recognised by gmnv (GTK+ version):\n")); main_msg(_("-background \tUse for the background (also: -bg)")); main_msg(_("-foreground \tUse for normal text (also: -fg)")); main_msg(_("-font \t\tUse for normal text (also: -fn)")); main_msg(_("-geometry \tUse for initial geometry (also: -geom)")); - main_msg(_("-iconic\t\tStart Vim iconified")); + main_msg(_("-iconic\t\tStart MNV iconified")); main_msg(_("-reverse\t\tUse reverse video (also: -rv)")); - main_msg(_("-display \tRun Vim on (also: --display)")); + main_msg(_("-display \tRun MNV on (also: --display)")); main_msg(_("--role \tSet a unique role to identify the main window")); - main_msg(_("--socketid \tOpen Vim inside another GTK widget")); - main_msg(_("--echo-wid\t\tMake gvim echo the Window ID on stdout")); + main_msg(_("--socketid \tOpen MNV inside another GTK widget")); + main_msg(_("--echo-wid\t\tMake gmnv echo the Window ID on stdout")); # endif # ifdef FEAT_GUI_MSWIN -# ifdef VIMDLL +# ifdef MNVDLL if (gui.starting) # endif { - main_msg(_("-P \tOpen Vim inside parent application")); - main_msg(_("--windowid \tOpen Vim inside another win32 widget")); + main_msg(_("-P \tOpen MNV inside parent application")); + main_msg(_("--windowid \tOpen MNV inside another win32 widget")); } # endif @@ -3829,7 +3829,7 @@ usage(void) /* * Check the result of the ATTENTION dialog: - * When "Quit" selected, exit Vim. + * When "Quit" selected, exit MNV. * When "Recover" selected, recover the file. */ static void @@ -3840,9 +3840,9 @@ check_swap_exists_action(void) handle_swap_exists(NULL); } -#endif // NO_VIM_MAIN +#endif // NO_MNV_MAIN -#if !defined(NO_VIM_MAIN) && defined(FEAT_EVAL) +#if !defined(NO_MNV_MAIN) && defined(FEAT_EVAL) static void set_progpath(char_u *argv0) { @@ -3851,7 +3851,7 @@ set_progpath(char_u *argv0) # ifdef MSWIN // A relative path containing a "/" will become invalid when using ":cd", // turn it into a full path. - // On MS-Windows "vim" should be expanded to "vim.exe", thus always do + // On MS-Windows "mnv" should be expanded to "mnv.exe", thus always do // this. char_u *path = NULL; @@ -3874,16 +3874,16 @@ set_progpath(char_u *argv0) if (!mch_isFullName(val)) { if (gettail(val) != val - && vim_FullName(val, buf, MAXPATHL, TRUE) != FAIL) + && mnv_FullName(val, buf, MAXPATHL, TRUE) != FAIL) val = buf; } # endif - set_vim_var_string(VV_PROGPATH, val, -1); + set_mnv_var_string(VV_PROGPATH, val, -1); # ifdef MSWIN - vim_free(path); + mnv_free(path); # endif } -#endif // NO_VIM_MAIN +#endif // NO_MNV_MAIN diff --git a/uvim/src/map.c b/uvim/src/map.c index 5f07ef4a81..3c76d7cc30 100644 --- a/uvim/src/map.c +++ b/uvim/src/map.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * map.c: Code for mappings and abbreviations. */ -#include "vim.h" +#include "mnv.h" /* * List used for abbreviations. @@ -84,16 +84,16 @@ map_free(mapblock_T **mpp) mapblock_T *mp; mp = *mpp; - vim_free(mp->m_keys); + mnv_free(mp->m_keys); if (mp->m_alt != NULL) mp->m_alt->m_alt = NULL; - vim_free(mp->m_str); - vim_free(mp->m_orig_str); + mnv_free(mp->m_str); + mnv_free(mp->m_orig_str); *mpp = mp->m_next; #ifdef FEAT_EVAL reset_last_used_map(mp); #endif - vim_free(mp); + mnv_free(mp); } /* @@ -172,7 +172,7 @@ showmap( { msg_puts((char *)mapchars); len = (int)STRLEN(mapchars); - vim_free(mapchars); + mnv_free(mapchars); } while (++len <= 3) @@ -249,15 +249,15 @@ map_add( mapped_ctrl_c |= mode; } - mp->m_keys = vim_strsave(keys); - mp->m_str = vim_strsave(rhs); - mp->m_orig_str = vim_strsave(orig_rhs); + mp->m_keys = mnv_strsave(keys); + mp->m_str = mnv_strsave(rhs); + mp->m_orig_str = mnv_strsave(orig_rhs); if (mp->m_keys == NULL || mp->m_str == NULL) { - vim_free(mp->m_keys); - vim_free(mp->m_str); - vim_free(mp->m_orig_str); - vim_free(mp); + mnv_free(mp->m_keys); + mnv_free(mp->m_str); + mnv_free(mp->m_orig_str); + mnv_free(mp); return NULL; } mp->m_keylen = (int)STRLEN(mp->m_keys); @@ -332,7 +332,7 @@ list_mappings( } char buf[200]; - vim_snprintf(buf, sizeof(buf), + mnv_snprintf(buf, sizeof(buf), _("modifyOtherKeys detected: %s\n"), name); msg_puts(buf); } @@ -350,7 +350,7 @@ list_mappings( } char buf[200]; - vim_snprintf(buf, sizeof(buf), + mnv_snprintf(buf, sizeof(buf), _("Kitty keyboard protocol: %s\n"), name); msg_puts(buf); } @@ -562,8 +562,8 @@ do_map( // Accept backslash like CTRL-V when 'cpoptions' does not contain 'B'. // with :unmap white space is included in the keys, no argument possible. p = keys; - do_backslash = (vim_strchr(p_cpo, CPO_BSLASH) == NULL); - while (*p && (maptype == MAPTYPE_UNMAP || !VIM_ISWHITE(*p))) + do_backslash = (mnv_strchr(p_cpo, CPO_BSLASH) == NULL); + while (*p && (maptype == MAPTYPE_UNMAP || !MNV_ISWHITE(*p))) { if ((p[0] == Ctrl_V || (do_backslash && p[0] == '\\')) && p[1] != NUL) @@ -661,14 +661,14 @@ do_map( int first, last; int same = -1; - first = vim_iswordp(keys); + first = mnv_iswordp(keys); last = first; p = keys + (*mb_ptr2len)(keys); n = 1; while (p < keys + len) { ++n; // nr of (multi-byte) chars - last = vim_iswordp(p); // type of last char + last = mnv_iswordp(p); // type of last char if (same == -1 && last != first) same = n - 1; // count of same char type p += (*mb_ptr2len)(p); @@ -679,17 +679,17 @@ do_map( goto theend; } } - else if (vim_iswordc(keys[len - 1])) + else if (mnv_iswordc(keys[len - 1])) // ends in keyword char for (n = 0; n < len - 2; ++n) - if (vim_iswordc(keys[n]) != vim_iswordc(keys[len - 2])) + if (mnv_iswordc(keys[n]) != mnv_iswordc(keys[len - 2])) { retval = 1; goto theend; } // An abbreviation cannot contain white space. for (n = 0; n < len; ++n) - if (VIM_ISWHITE(keys[n])) + if (MNV_ISWHITE(keys[n])) { retval = 1; goto theend; @@ -850,7 +850,7 @@ do_map( mp->m_mode &= ~mode; // remove mode bits if (mp->m_mode == 0 && !did_it) // reuse entry { - char_u *newstr = vim_strsave(rhs); + char_u *newstr = mnv_strsave(rhs); if (newstr == NULL) { @@ -859,10 +859,10 @@ do_map( } if (mp->m_alt != NULL) mp->m_alt = mp->m_alt->m_alt = NULL; - vim_free(mp->m_str); + mnv_free(mp->m_str); mp->m_str = newstr; - vim_free(mp->m_orig_str); - mp->m_orig_str = vim_strsave(orig_rhs); + mnv_free(mp->m_orig_str); + mp->m_orig_str = mnv_strsave(orig_rhs); mp->m_noremap = noremap; mp->m_nowait = nowait; mp->m_silent = silent; @@ -957,9 +957,9 @@ do_map( } theend: - vim_free(keys_buf); - vim_free(alt_keys_buf); - vim_free(arg_buf); + mnv_free(keys_buf); + mnv_free(alt_keys_buf); + mnv_free(arg_buf); return retval; } @@ -1124,21 +1124,21 @@ mode_str2flags(char_u *modechars) { int mode = 0; - if (vim_strchr(modechars, 'n') != NULL) + if (mnv_strchr(modechars, 'n') != NULL) mode |= MODE_NORMAL; - if (vim_strchr(modechars, 'v') != NULL) + if (mnv_strchr(modechars, 'v') != NULL) mode |= MODE_VISUAL | MODE_SELECT; - if (vim_strchr(modechars, 'x') != NULL) + if (mnv_strchr(modechars, 'x') != NULL) mode |= MODE_VISUAL; - if (vim_strchr(modechars, 's') != NULL) + if (mnv_strchr(modechars, 's') != NULL) mode |= MODE_SELECT; - if (vim_strchr(modechars, 'o') != NULL) + if (mnv_strchr(modechars, 'o') != NULL) mode |= MODE_OP_PENDING; - if (vim_strchr(modechars, 'i') != NULL) + if (mnv_strchr(modechars, 'i') != NULL) mode |= MODE_INSERT; - if (vim_strchr(modechars, 'l') != NULL) + if (mnv_strchr(modechars, 'l') != NULL) mode |= MODE_LANGMAP; - if (vim_strchr(modechars, 'c') != NULL) + if (mnv_strchr(modechars, 'c') != NULL) mode |= MODE_CMDLINE; return mode; @@ -1159,7 +1159,7 @@ map_to_exists(char_u *str, char_u *modechars, int abbr) rhs = replace_termcodes(str, &buf, 0, REPTERM_DO_LT, NULL); retval = map_to_exists_mode(rhs, mode_str2flags(modechars), abbr); - vim_free(buf); + mnv_free(buf); return retval; } @@ -1245,8 +1245,8 @@ translate_mapping(char_u *str) ga.ga_itemsize = 1; ga.ga_growsize = 40; - cpo_bslash = (vim_strchr(p_cpo, CPO_BSLASH) != NULL); - cpo_special = (vim_strchr(p_cpo, CPO_SPECI) != NULL); + cpo_bslash = (mnv_strchr(p_cpo, CPO_BSLASH) != NULL); + cpo_special = (mnv_strchr(p_cpo, CPO_SPECI) != NULL); for (; *str; ++str) { @@ -1429,7 +1429,7 @@ ExpandMappings( continue; if (!fuzzy) - match = vim_regexec(regmatch, p, (colnr_T)0); + match = mnv_regexec(regmatch, p, (colnr_T)0); else { score = fuzzy_match_str(p, pat); @@ -1446,11 +1446,11 @@ ExpandMappings( { fuzmatch = &((fuzmatch_str_T *)ga.ga_data)[ga.ga_len]; fuzmatch->idx = ga.ga_len; - fuzmatch->str = vim_strsave(p); + fuzmatch->str = mnv_strsave(p); fuzmatch->score = score; } else - ((char_u **)ga.ga_data)[ga.ga_len] = vim_strsave(p); + ((char_u **)ga.ga_data)[ga.ga_len] = mnv_strsave(p); ++ga.ga_len; } @@ -1476,7 +1476,7 @@ ExpandMappings( continue; if (!fuzzy) - match = vim_regexec(regmatch, p, (colnr_T)0); + match = mnv_regexec(regmatch, p, (colnr_T)0); else { score = fuzzy_match_str(p, pat); @@ -1485,13 +1485,13 @@ ExpandMappings( if (!match) { - vim_free(p); + mnv_free(p); continue; } if (ga_grow(&ga, 1) == FAIL) { - vim_free(p); + mnv_free(p); break; } @@ -1548,7 +1548,7 @@ ExpandMappings( *++ptr1 = *ptr2++; else { - vim_free(*ptr2++); + mnv_free(*ptr2++); count--; } } @@ -1571,7 +1571,7 @@ ExpandMappings( * characters or all non-id characters. This allows for abbr. "#i" to * "#include". * - * Vim addition: Allow for abbreviations that end in a non-keyword character. + * MNV addition: Allow for abbreviations that end in a non-keyword character. * Then there must be white space before the abbr. * * return TRUE if there is an abbreviation, FALSE if not @@ -1592,7 +1592,7 @@ check_abbr( mapblock_T *mp2; int clen = 0; // length in characters int is_id = TRUE; - int vim_abbr; + int mnv_abbr; if (typebuf.tb_no_abbr_cnt) // abbrev. are not recursive return FALSE; @@ -1613,19 +1613,19 @@ check_abbr( char_u *p; p = mb_prevptr(ptr, ptr + col); - if (!vim_iswordp(p)) - vim_abbr = TRUE; // Vim added abbr. + if (!mnv_iswordp(p)) + mnv_abbr = TRUE; // MNV added abbr. else { - vim_abbr = FALSE; // vi compatible abbr. + mnv_abbr = FALSE; // vi compatible abbr. if (p > ptr) - is_id = vim_iswordp(mb_prevptr(ptr, p)); + is_id = mnv_iswordp(mb_prevptr(ptr, p)); } clen = 1; while (p > ptr + mincol) { p = mb_prevptr(ptr, p); - if (vim_isspace(*p) || (!vim_abbr && is_id != vim_iswordp(p))) + if (mnv_isspace(*p) || (!mnv_abbr && is_id != mnv_iswordp(p))) { p += (*mb_ptr2len)(p); break; @@ -1636,16 +1636,16 @@ check_abbr( } else { - if (!vim_iswordc(ptr[col - 1])) - vim_abbr = TRUE; // Vim added abbr. + if (!mnv_iswordc(ptr[col - 1])) + mnv_abbr = TRUE; // MNV added abbr. else { - vim_abbr = FALSE; // vi compatible abbr. + mnv_abbr = FALSE; // vi compatible abbr. if (col > 1) - is_id = vim_iswordc(ptr[col - 2]); + is_id = mnv_iswordc(ptr[col - 2]); } - for (scol = col - 1; scol > 0 && !vim_isspace(ptr[scol - 1]) - && (vim_abbr || is_id == vim_iswordc(ptr[scol - 1])); --scol) + for (scol = col - 1; scol > 0 && !mnv_isspace(ptr[scol - 1]) + && (mnv_abbr || is_id == mnv_iswordc(ptr[scol - 1])); --scol) ; } @@ -1669,15 +1669,15 @@ check_abbr( char_u *q = mp->m_keys; int match; - if (vim_strbyte(mp->m_keys, K_SPECIAL) != NULL) + if (mnv_strbyte(mp->m_keys, K_SPECIAL) != NULL) { - char_u *qe = vim_strsave(mp->m_keys); + char_u *qe = mnv_strsave(mp->m_keys); // might have CSI escaped mp->m_keys if (qe != NULL) { q = qe; - vim_unescape_csi(q); + mnv_unescape_csi(q); qlen = (int)STRLEN(q); } } @@ -1687,7 +1687,7 @@ check_abbr( && qlen == len && !STRNCMP(q, ptr, (size_t)len); if (q != mp->m_keys) - vim_free(q); + mnv_free(q); if (match) break; } @@ -1735,13 +1735,13 @@ check_abbr( newlen = (*mb_char2bytes)(c, tb + j); tb[j + newlen] = NUL; // Need to escape K_SPECIAL. - escaped = vim_strsave_escape_csi(tb + j); + escaped = mnv_strsave_escape_csi(tb + j); if (escaped != NULL) { newlen = (int)STRLEN(escaped); mch_memmove(tb + j, escaped, newlen); j += newlen; - vim_free(escaped); + mnv_free(escaped); } } else @@ -1771,7 +1771,7 @@ check_abbr( typebuf.tb_no_abbr_cnt += (int)STRLEN(s) + j + 1; #ifdef FEAT_EVAL if (expr) - vim_free(s); + mnv_free(s); #endif } @@ -1809,23 +1809,23 @@ eval_map_expr( // Remove escaping of CSI, because "str" is in a format to be used as // typeahead. - expr = vim_strsave(mp->m_str); + expr = mnv_strsave(mp->m_str); if (expr == NULL) return NULL; - vim_unescape_csi(expr); + mnv_unescape_csi(expr); // Forbid changing text or using ":normal" to avoid most of the bad side // effects. Also restore the cursor position. ++textlock; ++ex_normal_lock; - set_vim_var_char(c); // set v:char to the typed character + set_mnv_var_char(c); // set v:char to the typed character save_cursor = curwin->w_cursor; save_msg_col = msg_col; save_msg_row = msg_row; - if (mp->m_script_ctx.sc_version == SCRIPT_VERSION_VIM9) + if (mp->m_script_ctx.sc_version == SCRIPT_VERSION_MNV9) { current_sctx.sc_sid = mp->m_script_ctx.sc_sid; - current_sctx.sc_version = SCRIPT_VERSION_VIM9; + current_sctx.sc_version = SCRIPT_VERSION_MNV9; } // Note: the evaluation may make "mp" invalid. @@ -1839,13 +1839,13 @@ eval_map_expr( current_sctx.sc_sid = save_sctx_sid; current_sctx.sc_version = save_sctx_version; - vim_free(expr); + mnv_free(expr); if (p == NULL) return NULL; // Escape CSI in the result to be able to use the string as typeahead. - res = vim_strsave_escape_csi(p); - vim_free(p); + res = mnv_strsave_escape_csi(p); + mnv_free(p); return res; } @@ -1857,7 +1857,7 @@ eval_map_expr( * Returns NULL when out of memory. */ char_u * -vim_strsave_escape_csi(char_u *p) +mnv_strsave_escape_csi(char_u *p) { char_u *res; char_u *s, *d; @@ -1898,10 +1898,10 @@ vim_strsave_escape_csi(char_u *p) /* * Remove escaping from CSI and K_SPECIAL characters. Reverse of - * vim_strsave_escape_csi(). Works in-place. + * mnv_strsave_escape_csi(). Works in-place. */ void -vim_unescape_csi(char_u *p) +mnv_unescape_csi(char_u *p) { char_u *s = p, *d = p; @@ -2072,7 +2072,7 @@ makemap( do // do this twice if c2 is set, 3 times with c3 { // When outputting <> form, need to make sure that 'cpo' - // is set to the Vim default. + // is set to the MNV default. if (!did_cpo) { if (*mp->m_str == NUL) // will use @@ -2086,7 +2086,7 @@ makemap( { if (fprintf(fd, "let s:cpo_save=&cpo") < 0 || put_eol(fd) < 0 - || fprintf(fd, "set cpo&vim") < 0 + || fprintf(fd, "set cpo&mnv") < 0 || put_eol(fd) < 0) return FAIL; } @@ -2232,7 +2232,7 @@ put_escstr(FILE *fd, char_u *strstart, int what) // A '<' has to be escaped with a CTRL-V to prevent it being // interpreted as the start of a special key name. // A space in the lhs of a :map needs a CTRL-V. - if (what == 2 && (VIM_ISWHITE(c) || c == '"' || c == '\\')) + if (what == 2 && (MNV_ISWHITE(c) || c == '"' || c == '\\')) { if (putc('\\', fd) < 0) return FAIL; @@ -2417,7 +2417,7 @@ f_hasmapto(typval_T *argvars, typval_T *rettv) char_u buf[NUMBUFLEN]; int abbr = FALSE; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -2455,7 +2455,7 @@ mapblock2dict( char_u *mapmode = map_mode_to_chars(mp->m_mode); dict_add_string(dict, "lhs", lhs); - vim_free(lhs); + mnv_free(lhs); dict_add_string(dict, "lhsraw", mp->m_keys); if (lhsrawalt) // Also add the value for the simplified entry. @@ -2476,7 +2476,7 @@ mapblock2dict( dict_add_number(dict, "abbr", abbr ? 1L : 0L); dict_add_number(dict, "mode_bits", mp->m_mode); - vim_free(mapmode); + mnv_free(mapmode); } static void @@ -2542,7 +2542,7 @@ get_maparg(typval_T *argvars, typval_T *rettv, int exact) if (rhs != NULL) { if (*rhs == NUL) - rettv->vval.v_string = vim_strsave((char_u *)""); + rettv->vval.v_string = mnv_strsave((char_u *)""); else rettv->vval.v_string = str2special_save(rhs, FALSE, FALSE); } @@ -2553,8 +2553,8 @@ get_maparg(typval_T *argvars, typval_T *rettv, int exact) did_simplify ? keys_simplified : NULL, buffer_local, abbr); - vim_free(keys_buf); - vim_free(alt_keys_buf); + mnv_free(keys_buf); + mnv_free(alt_keys_buf); } /* @@ -2573,7 +2573,7 @@ f_maplist(typval_T *argvars UNUSED, typval_T *rettv) const int flags = REPTERM_FROM_PART | REPTERM_DO_LT; int abbr = FALSE; - if (in_vim9script() && check_for_opt_bool_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_bool_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type != VAR_UNKNOWN) abbr = tv_get_bool(&argvars[0]); @@ -2619,12 +2619,12 @@ f_maplist(typval_T *argvars UNUSED, typval_T *rettv) lhs = str2special_save(mp->m_keys, TRUE, FALSE); (void)replace_termcodes(lhs, &keys_buf, 0, flags, &did_simplify); - vim_free(lhs); + mnv_free(lhs); mapblock2dict(mp, d, did_simplify ? keys_buf : NULL, buffer_local, abbr); - vim_free(keys_buf); + mnv_free(keys_buf); } } } @@ -2636,7 +2636,7 @@ f_maplist(typval_T *argvars UNUSED, typval_T *rettv) void f_maparg(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -2654,7 +2654,7 @@ f_maparg(typval_T *argvars, typval_T *rettv) void f_mapcheck(typval_T *argvars, typval_T *rettv) { - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL || (argvars[1].v_type != VAR_UNKNOWN @@ -2751,7 +2751,7 @@ f_mapset(typval_T *argvars, typval_T *rettv UNUSED) // If first arg is a dict, then that's the only arg permitted. dict_only = argvars[0].v_type == VAR_DICT; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_or_dict_arg(argvars, 0) == FAIL || (dict_only && check_for_unknown_arg(argvars, 1) == FAIL) || (!dict_only @@ -2837,12 +2837,12 @@ f_mapset(typval_T *argvars, typval_T *rettv UNUSED) } else { - arg = vim_strsave(lhs); + arg = mnv_strsave(lhs); if (arg == NULL) return; } do_map(MAPTYPE_UNMAP_LHS, arg, mode, is_abbr); - vim_free(arg); + mnv_free(arg); mp_result[0] = map_add(map_table, abbr_table, lhsraw, rhs, orig_rhs, noremap, nowait, silent, mode, is_abbr, expr, sid, @@ -2858,7 +2858,7 @@ f_mapset(typval_T *argvars, typval_T *rettv UNUSED) mp_result[1]->m_alt = mp_result[0]; } - vim_free(arg_buf); + mnv_free(arg_buf); } #endif @@ -2892,7 +2892,7 @@ static struct initmap initmappings[] = }; # endif -# if defined(MSWIN) && (!defined(FEAT_GUI) || defined(VIMDLL)) +# if defined(MSWIN) && (!defined(FEAT_GUI) || defined(MNVDLL)) // Use the Windows (CUA) keybindings. (Console) static struct initmap cinitmappings[] = { @@ -2947,8 +2947,8 @@ init_mappings(void) #if defined(MSWIN) || defined(MACOS_X) int i; -# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) -# ifdef VIMDLL +# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)) +# ifdef MNVDLL if (!gui.starting) # endif { @@ -2975,11 +2975,11 @@ add_map(char_u *map, int mode, int nore) char_u *cpo_save = p_cpo; p_cpo = empty_option; // Allow <> notation - s = vim_strsave(map); + s = mnv_strsave(map); if (s != NULL) { (void)do_map(nore ? MAPTYPE_NOREMAP : MAPTYPE_MAP, s, mode, FALSE); - vim_free(s); + mnv_free(s); } p_cpo = cpo_save; } @@ -2989,10 +2989,10 @@ add_map(char_u *map, int mode, int nore) * Any character has an equivalent 'langmap' character. This is used for * keyboards that have a special language mode that sends characters above * 128 (although other characters can be translated too). The "to" field is a - * Vim command character. This avoids having to switch the keyboard back to + * MNV command character. This avoids having to switch the keyboard back to * ASCII mode when leaving Insert mode. * - * langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim + * langmap_mapchar[] maps any of 256 chars to an ASCII char used for MNV * commands. * langmap_mapga.ga_data is a sorted table of langmap_entry_T. This does the * same as langmap_mapchar[] for characters >= 256. @@ -3163,7 +3163,7 @@ did_set_langmap(optset_T *args UNUSED) { if (p[0] != ',') { - vim_snprintf(args->os_errbuf, args->os_errbuflen, + mnv_snprintf(args->os_errbuf, args->os_errbuflen, _(e_langmap_extra_characters_after_semicolon_str), p); return args->os_errbuf; @@ -3216,7 +3216,7 @@ ex_abbreviate(exarg_T *eap) void ex_map(exarg_T *eap) { - // If we are sourcing .exrc or .vimrc in current directory we + // If we are sourcing .exrc or .mnvrc in current directory we // print the mappings for security reasons. if (secure) { diff --git a/uvim/src/mark.c b/uvim/src/mark.c index 7cd4f31bcb..fd6cea61b5 100644 --- a/uvim/src/mark.c +++ b/uvim/src/mark.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * mark.c: functions for setting marks and jumping to them */ -#include "vim.h" +#include "mnv.h" /* * This file contains routines to maintain and manipulate marks. @@ -20,9 +20,9 @@ /* * If a named file mark's lnum is non-zero, it is valid. * If a named file mark's fnum is non-zero, it is for an existing buffer, - * otherwise it is from .viminfo and namedfm[n].fname is the file name. + * otherwise it is from .mnvinfo and namedfm[n].fname is the file name. * There are marks 'A - 'Z (set by user) and '0 to '9 (set when writing - * viminfo). + * mnvinfo). */ static xfmark_T namedfm[NMARKS + EXTRA_MARKS]; // marks with file nr @@ -112,17 +112,17 @@ setmark_pos(int c, pos_T *pos, int fnum) buf->b_namedm[i] = *pos; return OK; } - if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) + if (ASCII_ISUPPER(c) || MNV_ISDIGIT(c)) { - if (VIM_ISDIGIT(c)) + if (MNV_ISDIGIT(c)) i = c - '0' + NMARKS; else i = c - 'A'; namedfm[i].fmark.mark = *pos; namedfm[i].fmark.fnum = fnum; - VIM_CLEAR(namedfm[i].fname); -#ifdef FEAT_VIMINFO - namedfm[i].time_set = vim_time(); + MNV_CLEAR(namedfm[i].fname); +#ifdef FEAT_MNVINFO + namedfm[i].time_set = mnv_time(); #endif return OK; } @@ -141,7 +141,7 @@ mark_forget_file(win_T *wp, int fnum) for (i = wp->w_jumplistlen - 1; i >= 0; --i) if (wp->w_jumplist[i].fmark.fnum == fnum) { - vim_free(wp->w_jumplist[i].fname); + mnv_free(wp->w_jumplist[i].fname); if (wp->w_jumplistidx > i) --wp->w_jumplistidx; --wp->w_jumplistlen; @@ -192,7 +192,7 @@ setpcmark(void) if (++curwin->w_jumplistlen > JUMPLISTSIZE) { curwin->w_jumplistlen = JUMPLISTSIZE; - vim_free(curwin->w_jumplist[0].fname); + mnv_free(curwin->w_jumplist[0].fname); for (i = 1; i < JUMPLISTSIZE; ++i) curwin->w_jumplist[i - 1] = curwin->w_jumplist[i]; } @@ -202,8 +202,8 @@ setpcmark(void) fm->fmark.mark = curwin->w_pcmark; fm->fmark.fnum = curbuf->b_fnum; fm->fname = NULL; -#ifdef FEAT_VIMINFO - fm->time_set = vim_time(); +#ifdef FEAT_MNVINFO + fm->time_set = mnv_time(); #endif } @@ -246,7 +246,7 @@ movemark(int count) /* * if first CTRL-O or CTRL-I command after a jump, add cursor position * to list. Careful: If there are duplicates (CTRL-O immediately after - * starting Vim on a file), another entry may have been removed. + * starting MNV on a file), another entry may have been removed. */ if (curwin->w_jumplistidx == curwin->w_jumplistlen) { @@ -430,9 +430,9 @@ getmark_buf_fnum( { posp = &(buf->b_namedm[c - 'a']); } - else if (ASCII_ISUPPER(c) || VIM_ISDIGIT(c)) // named file mark + else if (ASCII_ISUPPER(c) || MNV_ISDIGIT(c)) // named file mark { - if (VIM_ISDIGIT(c)) + if (MNV_ISDIGIT(c)) c = c - '0' + NMARKS; else c -= 'A'; @@ -519,7 +519,7 @@ getnextmark( /* * For an xtended filemark: set the fnum from the fname. - * This is used for marks obtained from the .viminfo file. It's postponed + * This is used for marks obtained from the .mnvinfo file. It's postponed * until the mark is used to avoid a long startup delay. */ static void @@ -543,10 +543,10 @@ fname2fnum(xfmark_T *fm) size_t len; len = expand_env((char_u *)"~/", NameBuff, MAXPATHL); - vim_strncpy(NameBuff + len, fm->fname + 2, MAXPATHL - len - 1); + mnv_strncpy(NameBuff + len, fm->fname + 2, MAXPATHL - len - 1); } else - vim_strncpy(NameBuff, fm->fname, MAXPATHL - 1); + mnv_strncpy(NameBuff, fm->fname, MAXPATHL - 1); // Try to shorten the file name. mch_dirname(IObuff, IOSIZE); @@ -559,7 +559,7 @@ fname2fnum(xfmark_T *fm) /* * Check all file marks for a name that matches the file name in buf. * May replace the name with an fnum. - * Used for marks that come from the .viminfo file. + * Used for marks that come from the .mnvinfo file. */ void fmarks_check_names(buf_T *buf) @@ -584,7 +584,7 @@ fmarks_check_names(buf_T *buf) fmarks_check_one(&wp->w_jumplist[i], name, buf); } - vim_free(name); + mnv_free(name); } static void @@ -595,7 +595,7 @@ fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf) && fnamecmp(name, fm->fname) == 0) { fm->fmark.fnum = buf->b_fnum; - VIM_CLEAR(fm->fname); + MNV_CLEAR(fm->fname); } } @@ -642,7 +642,7 @@ clrallmarks(buf_T *buf) { namedfm[i].fmark.mark.lnum = 0; namedfm[i].fname = NULL; -#ifdef FEAT_VIMINFO +#ifdef FEAT_MNVINFO namedfm[i].time_set = 0; #endif } @@ -683,9 +683,9 @@ mark_line(pos_T *mp, int lead_len) int len; if (mp->lnum == 0 || mp->lnum > curbuf->b_ml.ml_line_count) - return vim_strsave((char_u *)"-invalid-"); + return mnv_strsave((char_u *)"-invalid-"); // Allow for up to 5 bytes per character. - s = vim_strnsave(skipwhite(ml_get(mp->lnum)), Columns * 5); + s = mnv_strnsave(skipwhite(ml_get(mp->lnum)), Columns * 5); if (s == NULL) return NULL; // Truncate the line to fit it in the window. @@ -729,7 +729,7 @@ ex_marks(exarg_T *eap) arg, &namedfm[i].fmark.mark, name, namedfm[i].fmark.fnum == curbuf->b_fnum); if (namedfm[i].fmark.fnum != 0) - vim_free(name); + mnv_free(name); } } show_one_mark('"', arg, &curbuf->b_last_cursor, NULL, TRUE); @@ -777,7 +777,7 @@ show_one_mark( } // don't output anything if 'q' typed at --more-- prompt else if (!got_int - && (arg == NULL || vim_strchr(arg, c) != NULL) + && (arg == NULL || mnv_strchr(arg, c) != NULL) && p->lnum != 0) { if (name == NULL && current) @@ -811,7 +811,7 @@ show_one_mark( out_flush(); // show one line at a time } if (mustfree) - vim_free(name); + mnv_free(name); } } @@ -841,7 +841,7 @@ ex_delmarks(exarg_T *eap) for (p = eap->arg; *p != NUL; ++p) { lower = ASCII_ISLOWER(*p); - digit = VIM_ISDIGIT(*p); + digit = MNV_ISDIGIT(*p); if (lower || digit || ASCII_ISUPPER(*p)) { if (p[1] == '-') @@ -850,7 +850,7 @@ ex_delmarks(exarg_T *eap) from = *p; to = p[2]; if (!(lower ? ASCII_ISLOWER(p[2]) - : (digit ? VIM_ISDIGIT(p[2]) + : (digit ? MNV_ISDIGIT(p[2]) : ASCII_ISUPPER(p[2]))) || to < from) { @@ -875,9 +875,9 @@ ex_delmarks(exarg_T *eap) n = i - 'A'; namedfm[n].fmark.mark.lnum = 0; namedfm[n].fmark.fnum = 0; - VIM_CLEAR(namedfm[n].fname); -#ifdef FEAT_VIMINFO - namedfm[n].time_set = digit ? 0 : vim_time(); + MNV_CLEAR(namedfm[n].fname); +#ifdef FEAT_MNVINFO + namedfm[n].time_set = digit ? 0 : mnv_time(); #endif } } @@ -922,18 +922,18 @@ ex_jumps(exarg_T *eap UNUSED) // Make sure to output the current indicator, even when on an wiped // out buffer. ":filter" may still skip it. if (name == NULL && i == curwin->w_jumplistidx) - name = vim_strsave((char_u *)"-invalid-"); + name = mnv_strsave((char_u *)"-invalid-"); // apply :filter /pat/ or file name not available if (name == NULL || message_filtered(name)) { - vim_free(name); + mnv_free(name); continue; } msg_putchar('\n'); if (got_int) { - vim_free(name); + mnv_free(name); break; } sprintf((char *)IObuff, "%c %2d %5ld %4d ", @@ -946,7 +946,7 @@ ex_jumps(exarg_T *eap UNUSED) msg_outtrans_attr(name, curwin->w_jumplist[i].fmark.fnum == curbuf->b_fnum ? HL_ATTR(HLF_D) : 0); - vim_free(name); + mnv_free(name); ui_breakcheck(); } out_flush(); @@ -993,7 +993,7 @@ ex_changes(exarg_T *eap UNUSED) if (name == NULL) break; msg_outtrans_attr(name, HL_ATTR(HLF_D)); - vim_free(name); + mnv_free(name); ui_breakcheck(); } out_flush(); @@ -1380,7 +1380,7 @@ cleanup_jumplist(win_T *wp, int loadfiles) mustfree = TRUE; if (mustfree) - vim_free(wp->w_jumplist[from].fname); + mnv_free(wp->w_jumplist[from].fname); else wp->w_jumplist[to++] = wp->w_jumplist[from]; } @@ -1401,7 +1401,7 @@ copy_jumplist(win_T *from, win_T *to) { to->w_jumplist[i] = from->w_jumplist[i]; if (from->w_jumplist[i].fname != NULL) - to->w_jumplist[i].fname = vim_strsave(from->w_jumplist[i].fname); + to->w_jumplist[i].fname = mnv_strsave(from->w_jumplist[i].fname); } to->w_jumplistlen = from->w_jumplistlen; to->w_jumplistidx = from->w_jumplistidx; @@ -1416,7 +1416,7 @@ free_jumplist(win_T *wp) int i; for (i = 0; i < wp->w_jumplistlen; ++i) - vim_free(wp->w_jumplist[i].fname); + mnv_free(wp->w_jumplist[i].fname); } void @@ -1434,11 +1434,11 @@ free_all_marks(void) for (i = 0; i < NMARKS + EXTRA_MARKS; i++) if (namedfm[i].fmark.mark.lnum != 0) - vim_free(namedfm[i].fname); + mnv_free(namedfm[i].fname); } #endif -#if defined(FEAT_VIMINFO) +#if defined(FEAT_MNVINFO) /* * Return a pointer to the named file marks. */ @@ -1544,7 +1544,7 @@ get_global_marks(list_T *l) add_mark(l, mname, &namedfm[i].fmark.mark, namedfm[i].fmark.fnum, name); if (namedfm[i].fmark.fnum != 0) - vim_free(name); + mnv_free(name); } } } @@ -1560,7 +1560,7 @@ f_getmarklist(typval_T *argvars, typval_T *rettv) if (rettv_list_alloc(rettv) == FAIL) return; - if (in_vim9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_buffer_arg(argvars, 0) == FAIL) return; if (argvars[0].v_type == VAR_UNKNOWN) diff --git a/uvim/src/match.c b/uvim/src/match.c index 912abfd74b..886559cbd3 100644 --- a/uvim/src/match.c +++ b/uvim/src/match.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * match.c: functions for highlighting matches */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_SEARCH_EXTRA) @@ -77,7 +77,7 @@ match_add( semsg(_(e_no_such_highlight_group_name_str), grp); return -1; } - if (pat != NULL && (regprog = vim_regcomp(pat, RE_MAGIC)) == NULL) + if (pat != NULL && (regprog = mnv_regcomp(pat, RE_MAGIC)) == NULL) { semsg(_(e_invalid_argument_str), pat); return -1; @@ -96,7 +96,7 @@ match_add( } m->mit_id = id; m->mit_priority = prio; - m->mit_pattern = pat == NULL ? NULL : vim_strsave(pat); + m->mit_pattern = pat == NULL ? NULL : mnv_strsave(pat); m->mit_hlg_id = hlg_id; m->mit_match.regprog = regprog; m->mit_match.rmm_ic = FALSE; @@ -210,12 +210,12 @@ match_add( return id; fail: - vim_regfree(regprog); + mnv_regfree(regprog); if (m != NULL) { - vim_free(m->mit_pattern); - vim_free(m->mit_pos_array); - vim_free(m); + mnv_free(m->mit_pattern); + mnv_free(m->mit_pos_array); + mnv_free(m); } return -1; } @@ -253,15 +253,15 @@ match_delete(win_T *wp, int id, int perr) wp->w_match_head = cur->mit_next; else prev->mit_next = cur->mit_next; - vim_regfree(cur->mit_match.regprog); - vim_free(cur->mit_pattern); + mnv_regfree(cur->mit_match.regprog); + mnv_free(cur->mit_pattern); if (cur->mit_toplnum != 0) { redraw_win_range_later(wp, cur->mit_toplnum, cur->mit_botlnum); rtype = UPD_VALID; } - vim_free(cur->mit_pos_array); - vim_free(cur); + mnv_free(cur->mit_pos_array); + mnv_free(cur); redraw_win_later(wp, rtype); return 0; } @@ -277,10 +277,10 @@ clear_matches(win_T *wp) while (wp->w_match_head != NULL) { m = wp->w_match_head->mit_next; - vim_regfree(wp->w_match_head->mit_match.regprog); - vim_free(wp->w_match_head->mit_pattern); - vim_free(wp->w_match_head->mit_pos_array); - vim_free(wp->w_match_head); + mnv_regfree(wp->w_match_head->mit_match.regprog); + mnv_free(wp->w_match_head->mit_pattern); + mnv_free(wp->w_match_head->mit_pos_array); + mnv_free(wp->w_match_head); wp->w_match_head = m; } redraw_win_later(wp, UPD_SOME_VALID); @@ -446,7 +446,7 @@ next_search_hl( // 3. Vi compatible searching: continue at end of previous match. if (shl->lnum == 0) matchcol = 0; - else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL + else if (mnv_strchr(p_cpo, CPO_SEARCH) == NULL || (shl->rm.endpos[0].lnum == 0 && shl->rm.endpos[0].col <= shl->rm.startpos[0].col)) { @@ -477,7 +477,7 @@ next_search_hl( && shl == &cur->mit_hl && cur->mit_match.regprog == cur->mit_hl.rm.regprog); - nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, + nmatched = mnv_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol, &timed_out); // Copy the regprog, in case it got freed and recompiled. if (regprog_is_copy) @@ -489,12 +489,12 @@ next_search_hl( if (shl == search_hl) { // don't free regprog in the match list, it's a copy - vim_regfree(shl->rm.regprog); + mnv_regfree(shl->rm.regprog); set_no_hlsearch(TRUE); } shl->rm.regprog = NULL; shl->lnum = 0; - got_int = FALSE; // avoid the "Type :quit to exit Vim" message + got_int = FALSE; // avoid the "Type :quit to exit MNV" message break; } } @@ -979,7 +979,7 @@ f_clearmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) # ifdef FEAT_SEARCH_EXTRA win_T *win; - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; win = get_optional_window(argvars, 0); @@ -1000,7 +1000,7 @@ f_getmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) int i; win_T *win; - if (in_vim9script() && check_for_opt_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_number_arg(argvars, 0) == FAIL) return; win = get_optional_window(argvars, 0); @@ -1075,7 +1075,7 @@ f_setmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) rettv->vval.v_number = -1; - if (in_vim9script() + if (in_mnv9script() && (check_for_list_arg(argvars, 0) == FAIL || check_for_opt_number_arg(argvars, 1) == FAIL)) return; @@ -1168,8 +1168,8 @@ f_setmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) list_unref(s); s = NULL; } - vim_free(group); - vim_free(conceal); + mnv_free(group); + mnv_free(conceal); li = li->li_next; } @@ -1196,7 +1196,7 @@ f_matchadd(typval_T *argvars UNUSED, typval_T *rettv UNUSED) rettv->vval.v_number = -1; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL || check_for_opt_number_arg(argvars, 2) == FAIL @@ -1252,7 +1252,7 @@ f_matchaddpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED) rettv->vval.v_number = -1; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_list_arg(argvars, 1) == FAIL || check_for_opt_number_arg(argvars, 2) == FAIL @@ -1315,7 +1315,7 @@ f_matcharg(typval_T *argvars UNUSED, typval_T *rettv) int id; matchitem_T *m; - if (in_vim9script() && check_for_number_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_number_arg(argvars, 0) == FAIL) return; id = (int)tv_get_number(&argvars[0]); @@ -1345,7 +1345,7 @@ f_matchdelete(typval_T *argvars UNUSED, typval_T *rettv UNUSED) # ifdef FEAT_SEARCH_EXTRA win_T *win; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_opt_number_arg(argvars, 1) == FAIL)) return; @@ -1390,19 +1390,19 @@ ex_match(exarg_T *eap) if (ends_excmd2(eap->cmd, eap->arg)) end = eap->arg; else if ((STRNICMP(eap->arg, "none", 4) == 0 - && (VIM_ISWHITE(eap->arg[4]) + && (MNV_ISWHITE(eap->arg[4]) || ends_excmd2(eap->arg, eap->arg + 4)))) end = eap->arg + 4; else { p = skiptowhite(eap->arg); if (!eap->skip) - g = vim_strnsave(eap->arg, p - eap->arg); + g = mnv_strnsave(eap->arg, p - eap->arg); p = skipwhite(p); if (*p == NUL) { // There must be two arguments. - vim_free(g); + mnv_free(g); semsg(_(e_invalid_argument_str), eap->arg); return; } @@ -1411,13 +1411,13 @@ ex_match(exarg_T *eap) { if (*end != NUL && !ends_excmd2(end, skipwhite(end + 1))) { - vim_free(g); + mnv_free(g); eap->errmsg = ex_errmsg(e_trailing_characters_str, end); return; } if (*end != *p) { - vim_free(g); + mnv_free(g); semsg(_(e_invalid_argument_str), p); return; } @@ -1425,7 +1425,7 @@ ex_match(exarg_T *eap) c = *end; *end = NUL; match_add(curwin, g, p + 1, 10, id, NULL, NULL); - vim_free(g); + mnv_free(g); *end = c; } } diff --git a/uvim/src/mbyte.c b/uvim/src/mbyte.c index 8370c3fa21..7ddcf5adfe 100644 --- a/uvim/src/mbyte.c +++ b/uvim/src/mbyte.c @@ -1,11 +1,11 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * Multibyte extensions partly by Sung-Hoon Baek * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * mbyte.c: Code specifically for handling multi-byte characters. @@ -72,12 +72,12 @@ * (4) The encoding of the file is specified with 'fileencoding'. Conversion * is to be done when it's different from 'encoding'. * - * The viminfo file is a special case: Only text is converted, not file names. - * Vim scripts may contain an ":encoding" command. This has an effect for + * The mnvinfo file is a special case: Only text is converted, not file names. + * MNV scripts may contain an ":encoding" command. This has an effect for * some commands, like ":menutrans" */ -#include "vim.h" +#include "mnv.h" #ifdef WIN32UNIX # ifndef WIN32_LEAN_AND_MEAN @@ -85,7 +85,7 @@ # endif # if defined(FEAT_GUI) || defined(FEAT_XCLIPBOARD) # ifdef __CYGWIN__ - // ControlMask from (included in "vim.h") is conflicting with + // ControlMask from (included in "mnv.h") is conflicting with // (included in ). # undef ControlMask # endif @@ -427,7 +427,7 @@ enc_canon_props(char_u *name) if (i >= 0) return enc_canon_table[i].prop; #ifdef MSWIN - if (name[0] == 'c' && name[1] == 'p' && VIM_ISDIGIT(name[2])) + if (name[0] == 'c' && name[1] == 'p' && MNV_ISDIGIT(name[2])) { CPINFO cpinfo; @@ -473,7 +473,7 @@ mb_init(void) #if defined(USE_ICONV) && !defined(MSWIN) && !defined(WIN32UNIX) \ && !defined(MACOS_CONVERT) # define LEN_FROM_CONV - vimconv_T vimconv; + mnvconv_T mnvconv; char_u *p; #endif @@ -489,7 +489,7 @@ mb_init(void) } #ifdef MSWIN - if (p_enc[0] == 'c' && p_enc[1] == 'p' && VIM_ISDIGIT(p_enc[2])) + if (p_enc[0] == 'c' && p_enc[1] == 'p' && MNV_ISDIGIT(p_enc[2])) { CPINFO cpinfo; @@ -637,16 +637,16 @@ codepage_invalid: #ifdef LEN_FROM_CONV // When 'encoding' is different from the current locale mblen() won't // work. Use conversion to "utf-8" instead. - vimconv.vc_type = CONV_NONE; + mnvconv.vc_type = CONV_NONE; if (enc_dbcs) { p = enc_locale(); if (p == NULL || STRCMP(p, p_enc) != 0) { - convert_setup(&vimconv, p_enc, (char_u *)"utf-8"); - vimconv.vc_fail = TRUE; + convert_setup(&mnvconv, p_enc, (char_u *)"utf-8"); + mnvconv.vc_fail = TRUE; } - vim_free(p); + mnv_free(p); } #endif @@ -684,16 +684,16 @@ codepage_invalid: buf[0] = i; buf[1] = 0; # ifdef LEN_FROM_CONV - if (vimconv.vc_type != CONV_NONE) + if (mnvconv.vc_type != CONV_NONE) { /* * string_convert() should fail when converting the first * byte of a double-byte character. */ - p = string_convert(&vimconv, (char_u *)buf, NULL); + p = string_convert(&mnvconv, (char_u *)buf, NULL); if (p != NULL) { - vim_free(p); + mnv_free(p); n = 1; } else @@ -708,7 +708,7 @@ codepage_invalid: * where mblen() returns 0 for invalid character. * Therefore, following condition includes 0. */ - vim_ignored = mblen(NULL, 0); // First reset the state. + mnv_ignored = mblen(NULL, 0); // First reset the state. if (mblen(buf, (size_t)1) <= 0) n = 2; else @@ -723,7 +723,7 @@ codepage_invalid: } #ifdef LEN_FROM_CONV - convert_setup(&vimconv, NULL, NULL); + convert_setup(&mnvconv, NULL, NULL); #endif // The cell width depends on the type of multi-byte characters. @@ -739,7 +739,7 @@ codepage_invalid: #if defined(HAVE_BIND_TEXTDOMAIN_CODESET) && defined(FEAT_GETTEXT) // GNU gettext 0.10.37 supports this feature: set the codeset used for // translated messages independently from the current locale. - (void)bind_textdomain_codeset(VIMPACKAGE, + (void)bind_textdomain_codeset(MNVPACKAGE, enc_utf8 ? "utf-8" : (char *)p_enc); #endif @@ -751,7 +751,7 @@ codepage_invalid: #endif // Fire an autocommand to let people do custom font setup. This must be - // after Vim has been setup for the new encoding. + // after MNV has been setup for the new encoding. apply_autocmds(EVENT_ENCODINGCHANGED, NULL, (char_u *)"", FALSE, curbuf); #ifdef FEAT_SPELL @@ -809,7 +809,7 @@ remove_bom(char_u *s) char_u *p = s; - while ((p = vim_strbyte(p, 0xef)) != NULL) + while ((p = mnv_strbyte(p, 0xef)) != NULL) { if (p[1] == 0xbb && p[2] == 0xbf) STRMOVE(p, p + 3); @@ -837,9 +837,9 @@ mb_get_class_buf(char_u *p, buf_T *buf) { if (MB_BYTE2LEN(p[0]) == 1) { - if (p[0] == NUL || VIM_ISWHITE(p[0])) + if (p[0] == NUL || MNV_ISWHITE(p[0])) return 0; - if (vim_iswordc_buf(p[0], buf)) + if (mnv_iswordc_buf(p[0], buf)) return 2; return 1; } @@ -1165,7 +1165,7 @@ intable(struct interval *table, size_t size, int c) } // Sorted list of non-overlapping intervals of East Asian Ambiguous -// characters, generated with ../runtime/tools/unicode.vim. +// characters, generated with ../runtime/tools/unicode.mnv. static struct interval ambiguous[] = { {0x00a1, 0x00a1}, @@ -1373,7 +1373,7 @@ utf_uint2cells(UINT32_T c) utf_char2cells(int c) { // Sorted list of non-overlapping intervals of East Asian double width - // characters, generated with ../runtime/tools/unicode.vim. + // characters, generated with ../runtime/tools/unicode.mnv. static struct interval doublewidth[] = { {0x1100, 0x115f}, @@ -1576,7 +1576,7 @@ utf_char2cells(int c) // // Note that these symbols are of varying widths, as they are symbols // representing different things ranging from a simple gear icon to an - // airplane. Some of them are in fact wider than double-width, but Vim + // airplane. Some of them are in fact wider than double-width, but MNV // doesn't support non-fixed-width font, and tagging them as // double-width is the best way to handle them. // @@ -1588,7 +1588,7 @@ utf_char2cells(int c) #ifdef FEAT_EVAL // Use the value from setcellwidths() at 0x80 and higher, unless the // character is not printable. - if (c >= 0x80 && vim_isprintc(c)) + if (c >= 0x80 && mnv_isprintc(c)) { int n = cw_value(c); if (n != 0) @@ -1607,7 +1607,7 @@ utf_char2cells(int c) } // Characters below 0x100 are influenced by 'isprint' option - else if (c >= 0x80 && !vim_isprintc(c)) + else if (c >= 0x80 && !mnv_isprintc(c)) return 4; // unprintable, displays if (c >= 0x80 && *p_ambw == 'd' && intable(ambiguous, sizeof(ambiguous), c)) @@ -2473,7 +2473,7 @@ utf_iscomposing_uint(UINT32_T c) utf_iscomposing(int c) { // Sorted list of non-overlapping intervals. - // Generated by ../runtime/tools/unicode.vim. + // Generated by ../runtime/tools/unicode.mnv. static struct interval combining[] = { {0x0300, 0x036f}, @@ -2856,7 +2856,7 @@ utf_printable(int c) // Sorted list of non-overlapping intervals of all Emoji characters, // based on http://unicode.org/emoji/charts/emoji-list.html -// Generated by ../runtime/tools/unicode.vim. +// Generated by ../runtime/tools/unicode.mnv. // Excludes 0x00a9 and 0x00ae because they are considered latin1. static struct interval emoji_all[] = { @@ -3113,7 +3113,7 @@ utf_class_buf(int c, buf_T *buf) { if (c == ' ' || c == '\t' || c == NUL || c == 0xa0) return 0; // blank - if (vim_iswordc_buf(c, buf)) + if (mnv_iswordc_buf(c, buf)) return 2; // word character return 1; // punctuation } @@ -3153,7 +3153,7 @@ utf_ambiguous_width(int c) */ /* - * The following tables are built by ../runtime/tools/unicode.vim. + * The following tables are built by ../runtime/tools/unicode.mnv. * They must be in numeric order, because we use binary search. * An entry such as {0x41,0x5a,1,32} means that Unicode characters in the * range from 0x41 to 0x5a inclusive, stepping by 1, are changed to @@ -4413,26 +4413,26 @@ utf_find_illegal(void) pos_T pos = curwin->w_cursor; char_u *p; int len; - vimconv_T vimconv; + mnvconv_T mnvconv; char_u *tofree = NULL; - vimconv.vc_type = CONV_NONE; + mnvconv.vc_type = CONV_NONE; if (enc_utf8 && (enc_canon_props(curbuf->b_p_fenc) & ENC_8BIT)) { // 'encoding' is "utf-8" but we are editing a 8-bit encoded file, // possibly a utf-8 file with illegal bytes. Setup for conversion // from utf-8 to 'fileencoding'. - convert_setup(&vimconv, p_enc, curbuf->b_p_fenc); + convert_setup(&mnvconv, p_enc, curbuf->b_p_fenc); } curwin->w_cursor.coladd = 0; for (;;) { p = ml_get_cursor(); - if (vimconv.vc_type != CONV_NONE) + if (mnvconv.vc_type != CONV_NONE) { - vim_free(tofree); - tofree = string_convert(&vimconv, p, NULL); + mnv_free(tofree); + tofree = string_convert(&mnvconv, p, NULL); if (tofree == NULL) break; p = tofree; @@ -4446,7 +4446,7 @@ utf_find_illegal(void) if (*p >= 0x80 && (len == 1 || utf_char2len(utf_ptr2char(p)) != len)) { - if (vimconv.vc_type == CONV_NONE) + if (mnvconv.vc_type == CONV_NONE) curwin->w_cursor.col += (colnr_T)(p - ml_get_cursor()); else { @@ -4474,8 +4474,8 @@ utf_find_illegal(void) beep_flush(); theend: - vim_free(tofree); - convert_setup(&vimconv, NULL, NULL); + mnv_free(tofree); + convert_setup(&mnvconv, NULL, NULL); } #if defined(FEAT_GUI_GTK) || defined(FEAT_SPELL) || defined(FEAT_EVAL) @@ -4557,7 +4557,7 @@ mb_adjustpos(buf_T *buf, pos_T *lp) // double-wide character. if (lp->coladd == 1 && p[lp->col] != TAB - && vim_isprintc((*mb_ptr2char)(p + lp->col)) + && mnv_isprintc((*mb_ptr2char)(p + lp->col)) && ptr2cells(p + lp->col) > 1) lp->coladd = 0; } @@ -4711,7 +4711,7 @@ mb_fix_col(int col, int row) static int enc_alias_search(char_u *name); /* - * Skip the Vim specific head of a 'encoding' name. + * Skip the MNV specific head of a 'encoding' name. */ char_u * enc_skip(char_u *p) @@ -4747,7 +4747,7 @@ enc_canonize(char_u *enc) #endif if (r == NULL) r = (char_u *)ENC_DFLT; - return vim_strsave(r); + return mnv_strsave(r); } // copy "enc" to allocated memory, with room for two '-' @@ -4800,8 +4800,8 @@ enc_canonize(char_u *enc) else if ((i = enc_alias_search(p)) >= 0) { // alias recognized, get canonical name - vim_free(r); - r = vim_strsave((char_u *)enc_canon_table[i].name); + mnv_free(r); + r = mnv_strsave((char_u *)enc_canon_table[i].name); } return r; } @@ -4826,7 +4826,7 @@ enc_alias_search(char_u *name) # include #endif -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) /* * Get the canonicalized encoding from the specified locale string "locale" * or from the environment variables LC_ALL, LC_CTYPE and LANG. @@ -4855,7 +4855,7 @@ enc_locale_env(char *locale) // Make the name lowercase and replace '_' with '-'. // Exception: "ja_JP.EUC" == "euc-jp", "zh_CN.EUC" = "euc-cn", // "ko_KR.EUC" == "euc-kr" - if ((p = (char *)vim_strchr((char_u *)s, '.')) != NULL) + if ((p = (char *)mnv_strchr((char_u *)s, '.')) != NULL) { if (p > s + 2 && STRNICMP(p + 1, "EUC", 3) == 0 && !SAFE_isalnum((int)p[4]) && p[4] != '-' && p[-3] == '_') @@ -5013,7 +5013,7 @@ my_iconv_open(char_u *to, char_u *from) */ static char_u * iconv_string( - vimconv_T *vcp, + mnvconv_T *vcp, char_u *str, int slen, int *unconvlenp, @@ -5041,7 +5041,7 @@ iconv_string( p = alloc(len); if (p != NULL && done > 0) mch_memmove(p, result, done); - vim_free(result); + mnv_free(result); result = p; if (result == NULL) // out of memory break; @@ -5096,7 +5096,7 @@ iconv_string( else if (ICONV_ERRNO != ICONV_E2BIG) { // conversion failed - VIM_CLEAR(result); + MNV_CLEAR(result); break; } // Not enough room or skipping illegal sequence. @@ -5142,21 +5142,21 @@ iconv_enabled(int verbose) // Do the "2" version first, it's newer. # ifdef DYNAMIC_ICONV_DLL_ALT2 if (hIconvDLL == 0) - hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT2); + hIconvDLL = mnvLoadLib(DYNAMIC_ICONV_DLL_ALT2); # endif # ifdef DYNAMIC_ICONV_DLL_ALT3 if (hIconvDLL == 0) - hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT3); + hIconvDLL = mnvLoadLib(DYNAMIC_ICONV_DLL_ALT3); # endif if (hIconvDLL == 0) - hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL); + hIconvDLL = mnvLoadLib(DYNAMIC_ICONV_DLL); # ifdef DYNAMIC_ICONV_DLL_ALT1 if (hIconvDLL == 0) - hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT1); + hIconvDLL = mnvLoadLib(DYNAMIC_ICONV_DLL_ALT1); # endif if (hIconvDLL != 0) - hMsvcrtDLL = vimLoadLib(DYNAMIC_MSVCRT_DLL); + hMsvcrtDLL = mnvLoadLib(DYNAMIC_MSVCRT_DLL); if (hIconvDLL == 0 || hMsvcrtDLL == 0) { // Only give the message when 'verbose' is set, otherwise it might be @@ -5240,12 +5240,12 @@ f_iconv(typval_T *argvars UNUSED, typval_T *rettv) char_u buf1[NUMBUFLEN]; char_u buf2[NUMBUFLEN]; char_u *from, *to, *str; - vimconv_T vimconv; + mnvconv_T mnvconv; rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_string_arg(argvars, 1) == FAIL || check_for_string_arg(argvars, 2) == FAIL)) @@ -5254,18 +5254,18 @@ f_iconv(typval_T *argvars UNUSED, typval_T *rettv) str = tv_get_string(&argvars[0]); from = enc_canonize(enc_skip(tv_get_string_buf(&argvars[1], buf1))); to = enc_canonize(enc_skip(tv_get_string_buf(&argvars[2], buf2))); - vimconv.vc_type = CONV_NONE; - convert_setup(&vimconv, from, to); + mnvconv.vc_type = CONV_NONE; + convert_setup(&mnvconv, from, to); // If the encodings are equal, no conversion needed. - if (vimconv.vc_type == CONV_NONE) - rettv->vval.v_string = vim_strsave(str); + if (mnvconv.vc_type == CONV_NONE) + rettv->vval.v_string = mnv_strsave(str); else - rettv->vval.v_string = string_convert(&vimconv, str, NULL); + rettv->vval.v_string = string_convert(&mnvconv, str, NULL); - convert_setup(&vimconv, NULL, NULL); - vim_free(from); - vim_free(to); + convert_setup(&mnvconv, NULL, NULL); + mnv_free(from); + mnv_free(to); } #endif @@ -5279,7 +5279,7 @@ f_iconv(typval_T *argvars UNUSED, typval_T *rettv) * Return FAIL when conversion is not supported, OK otherwise. */ int -convert_setup(vimconv_T *vcp, char_u *from, char_u *to) +convert_setup(mnvconv_T *vcp, char_u *from, char_u *to) { return convert_setup_ext(vcp, from, TRUE, to, TRUE); } @@ -5290,7 +5290,7 @@ convert_setup(vimconv_T *vcp, char_u *from, char_u *to) */ int convert_setup_ext( - vimconv_T *vcp, + mnvconv_T *vcp, char_u *from, int from_unicode_is_utf8, char_u *to, @@ -5449,7 +5449,7 @@ convert_input_safe( // result is too long, keep the unconverted text (the caller must // have done something wrong!) dlen = len; - vim_free(d); + mnv_free(d); return dlen; } @@ -5462,7 +5462,7 @@ convert_input_safe( */ char_u * string_convert( - vimconv_T *vcp, + mnvconv_T *vcp, char_u *ptr, int *lenp) { @@ -5476,7 +5476,7 @@ string_convert( */ char_u * string_convert_ext( - vimconv_T *vcp, + mnvconv_T *vcp, char_u *ptr, int *lenp, int *unconvlenp) @@ -5493,7 +5493,7 @@ string_convert_ext( else len = *lenp; if (len == 0) - return vim_strsave((char_u *)""); + return mnv_strsave((char_u *)""); switch (vcp->vc_type) { @@ -5562,7 +5562,7 @@ string_convert_ext( if (l_w == 0) { // Illegal utf-8 byte cannot be converted - vim_free(retval); + mnv_free(retval); return NULL; } if (unconvlenp != NULL && l_w > len - i) @@ -5602,7 +5602,7 @@ string_convert_ext( *d++ = c; else if (vcp->vc_fail) { - vim_free(retval); + mnv_free(retval); return NULL; } else @@ -5703,7 +5703,7 @@ string_convert_ext( if (lenp != NULL) *lenp = retlen; } - vim_free(tmp); + mnv_free(tmp); break; } #endif @@ -5821,7 +5821,7 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED) if (li->li_tv.v_type != VAR_LIST || li->li_tv.vval.v_list == NULL) { semsg(_(e_list_item_nr_is_not_list), item); - vim_free(ptrs); + mnv_free(ptrs); return; } @@ -5837,28 +5837,28 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED) if (n1 < 0x80) { emsg(_(e_only_values_of_0x80_and_higher_supported)); - vim_free(ptrs); + mnv_free(ptrs); return; } } else if (i == 1 && lili->li_tv.vval.v_number < n1) { semsg(_(e_list_item_nr_range_invalid), item); - vim_free(ptrs); + mnv_free(ptrs); return; } else if (i == 2 && (lili->li_tv.vval.v_number < 1 || lili->li_tv.vval.v_number > 2)) { semsg(_(e_list_item_nr_cell_width_invalid), item); - vim_free(ptrs); + mnv_free(ptrs); return; } } if (i != 3) { semsg(_(e_list_item_nr_does_not_contain_3_numbers), item); - vim_free(ptrs); + mnv_free(ptrs); return; } ++item; @@ -5870,7 +5870,7 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED) table = ALLOC_MULT(cw_interval_T, table_size); if (table == NULL) { - vim_free(ptrs); + mnv_free(ptrs); return; } @@ -5884,8 +5884,8 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED) if (item > 0 && n1 <= table[item - 1].last) { semsg(_(e_overlapping_ranges_for_nr), (long)n1); - vim_free(ptrs); - vim_free(table); + mnv_free(ptrs); + mnv_free(table); return; } table[item].first = n1; @@ -5895,7 +5895,7 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED) table[item].width = lili->li_tv.vval.v_number; } - vim_free(ptrs); + mnv_free(ptrs); update: cw_table_save = cw_table; @@ -5911,11 +5911,11 @@ update: emsg(_(error)); cw_table = cw_table_save; cw_table_size = cw_table_size_save; - vim_free(table); + mnv_free(table); return; } - vim_free(cw_table_save); + mnv_free(cw_table_save); changed_window_setting_all(); redraw_all_later(UPD_CLEAR); } diff --git a/uvim/src/memfile.c b/uvim/src/memfile.c index 4707969f46..8e87368301 100644 --- a/uvim/src/memfile.c +++ b/uvim/src/memfile.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -32,7 +32,7 @@ * file is opened. */ -#include "vim.h" +#include "mnv.h" /* * Some systems have the page size in statfs.f_bsize, some in stat.st_blksize @@ -142,7 +142,7 @@ mf_open(char_u *fname, int flags) // if the file cannot be opened, return here if (mfp->mf_fd < 0) { - vim_free(mfp); + mnv_free(mfp); return NULL; } } @@ -175,7 +175,7 @@ mf_open(char_u *fname, int flags) #endif if (mfp->mf_fd < 0 || (flags & (O_TRUNC|O_EXCL)) - || (size = vim_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0) + || (size = mnv_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0) mfp->mf_blocknr_max = 0; // no file or empty file else mfp->mf_blocknr_max = (blocknr_T)((size + mfp->mf_page_size - 1) @@ -253,12 +253,12 @@ mf_close(memfile_T *mfp, int del_file) mf_free_bhdr(hp); } while (mfp->mf_free_first != NULL) // free entries in free list - vim_free(mf_rem_free(mfp)); + mnv_free(mf_rem_free(mfp)); mf_hash_free(&mfp->mf_hash); mf_hash_free_all(&mfp->mf_trans); // free hashtable and its items - vim_free(mfp->mf_fname); - vim_free(mfp->mf_ffname); - vim_free(mfp); + mnv_free(mfp->mf_fname); + mnv_free(mfp->mf_ffname); + mnv_free(mfp); } /* @@ -293,8 +293,8 @@ mf_close_file( if (mfp->mf_fname != NULL) { mch_remove(mfp->mf_fname); // delete the swap file - VIM_CLEAR(mfp->mf_fname); - VIM_CLEAR(mfp->mf_ffname); + MNV_CLEAR(mfp->mf_fname); + MNV_CLEAR(mfp->mf_ffname); } } @@ -367,7 +367,7 @@ mf_new(memfile_T *mfp, int negative, int page_count) { freep = mf_rem_free(mfp); hp->bh_bnum = freep->bh_bnum; - vim_free(freep); + mnv_free(freep); } } else // get a new number @@ -395,7 +395,7 @@ mf_new(memfile_T *mfp, int negative, int page_count) * Init the data to all zero, to avoid reading uninitialized data. * This also avoids that the passwd file ends up in the swap file! */ - (void)vim_memset((char *)(hp->bh_data), 0, + (void)mnv_memset((char *)(hp->bh_data), 0, (size_t)mfp->mf_page_size * page_count); return hp; @@ -497,12 +497,12 @@ mf_put( void mf_free(memfile_T *mfp, bhdr_T *hp) { - vim_free(hp->bh_data); // free the memory + mnv_free(hp->bh_data); // free the memory mf_rem_hash(mfp, hp); // get *hp out of the hash list mf_rem_used(mfp, hp); // get *hp out of the used list if (hp->bh_bnum < 0) { - vim_free(hp); // don't want negative numbers in free list + mnv_free(hp); // don't want negative numbers in free list mfp->mf_neg_count--; } else @@ -589,7 +589,7 @@ mf_sync(memfile_T *mfp, int flags) */ if (STRCMP(p_sws, "fsync") == 0) { - if (vim_fsync(mfp->mf_fd)) + if (mnv_fsync(mfp->mf_fd)) status = FAIL; } else @@ -603,7 +603,7 @@ mf_sync(memfile_T *mfp, int flags) #ifdef VMS if (STRCMP(p_sws, "fsync") == 0) { - if (vim_fsync(mfp->mf_fd)) + if (mnv_fsync(mfp->mf_fd)) status = FAIL; } #endif @@ -613,7 +613,7 @@ mf_sync(memfile_T *mfp, int flags) #endif #ifdef AMIGA # if defined(__AROS__) || defined(__amigaos4__) - if (vim_fsync(mfp->mf_fd) != 0) + if (mnv_fsync(mfp->mf_fd) != 0) status = FAIL; # else /* @@ -813,12 +813,12 @@ mf_release(memfile_T *mfp, int page_count) */ if (hp->bh_page_count != page_count) { - VIM_CLEAR(hp->bh_data); + MNV_CLEAR(hp->bh_data); if (page_count > 0) hp->bh_data = alloc((size_t)mfp->mf_page_size * page_count); if (hp->bh_data == NULL) { - vim_free(hp); + mnv_free(hp); return NULL; } hp->bh_page_count = page_count; @@ -886,7 +886,7 @@ mf_alloc_bhdr(memfile_T *mfp, int page_count) if ((hp->bh_data = alloc((size_t)mfp->mf_page_size * page_count)) == NULL) { - vim_free(hp); // not enough memory + mnv_free(hp); // not enough memory return NULL; } hp->bh_page_count = page_count; @@ -899,8 +899,8 @@ mf_alloc_bhdr(memfile_T *mfp, int page_count) static void mf_free_bhdr(bhdr_T *hp) { - vim_free(hp->bh_data); - vim_free(hp); + mnv_free(hp->bh_data); + mnv_free(hp); } /* @@ -945,7 +945,7 @@ mf_read(memfile_T *mfp, bhdr_T *hp) page_size = mfp->mf_page_size; offset = (off_T)page_size * hp->bh_bnum; size = page_size * hp->bh_page_count; - if (vim_lseek(mfp->mf_fd, offset, SEEK_SET) != offset) + if (mnv_lseek(mfp->mf_fd, offset, SEEK_SET) != offset) { PERROR(_(e_seek_error_in_swap_file_read)); return FAIL; @@ -1021,7 +1021,7 @@ mf_write(memfile_T *mfp, bhdr_T *hp) { if (mfp->mf_fd >= 0) { - if (vim_lseek(mfp->mf_fd, offset, SEEK_SET) != offset) + if (mnv_lseek(mfp->mf_fd, offset, SEEK_SET) != offset) { PERROR(_(e_seek_error_in_swap_file_write)); return FAIL; @@ -1096,7 +1096,7 @@ mf_write_block( #ifdef FEAT_CRYPT if (data != hp->bh_data) - vim_free(data); + mnv_free(data); #endif return result; @@ -1143,7 +1143,7 @@ mf_trans_add(memfile_T *mfp, bhdr_T *hp) else { freep = mf_rem_free(mfp); - vim_free(freep); + mnv_free(freep); } } else @@ -1187,7 +1187,7 @@ mf_trans_del(memfile_T *mfp, blocknr_T old_nr) // remove entry from the trans list mf_hash_rem_item(&mfp->mf_trans, (mf_hashitem_T *)np); - vim_free(np); + mnv_free(np); return new_bnum; } @@ -1213,7 +1213,7 @@ mf_fullname(memfile_T *mfp) if (mfp == NULL || mfp->mf_fname == NULL || mfp->mf_ffname == NULL) return; - vim_free(mfp->mf_fname); + mnv_free(mfp->mf_fname); mfp->mf_fname = mfp->mf_ffname; mfp->mf_ffname = NULL; } @@ -1290,8 +1290,8 @@ mf_do_open( */ if (mfp->mf_fd < 0) { - VIM_CLEAR(mfp->mf_fname); - VIM_CLEAR(mfp->mf_ffname); + MNV_CLEAR(mfp->mf_fname); + MNV_CLEAR(mfp->mf_ffname); } else { @@ -1338,7 +1338,7 @@ mf_hash_init(mf_hashtab_T *mht) mf_hash_free(mf_hashtab_T *mht) { if (mht->mht_buckets != mht->mht_small_buckets) - vim_free(mht->mht_buckets); + mnv_free(mht->mht_buckets); } /* @@ -1355,7 +1355,7 @@ mf_hash_free_all(mf_hashtab_T *mht) for (mhi = mht->mht_buckets[idx]; mhi != NULL; mhi = next) { next = mhi->mhi_next; - vim_free(mhi); + mnv_free(mhi); } mf_hash_free(mht); @@ -1493,7 +1493,7 @@ mf_hash_grow(mf_hashtab_T *mht) } if (mht->mht_buckets != mht->mht_small_buckets) - vim_free(mht->mht_buckets); + mnv_free(mht->mht_buckets); mht->mht_buckets = buckets; mht->mht_mask = (mht->mht_mask + 1) * MHT_GROWTH_FACTOR - 1; diff --git a/uvim/src/memfile_test.c b/uvim/src/memfile_test.c index a352619469..16cb903e4d 100644 --- a/uvim/src/memfile_test.c +++ b/uvim/src/memfile_test.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -16,7 +16,7 @@ #include // Must include main.c because it contains much more than just main() -#define NO_VIM_MAIN +#define NO_MNV_MAIN #include "main.c" // This file has to be included because the tested functions are static @@ -110,7 +110,7 @@ test_mf_hash(void) mf_hash_rem_item(&ht, item); assert(mf_hash_find(&ht, key) == NULL); - vim_free(item); + mnv_free(item); } } diff --git a/uvim/src/memline.c b/uvim/src/memline.c index 9cca5c2f45..958c98efda 100644 --- a/uvim/src/memline.c +++ b/uvim/src/memline.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ // for debugging @@ -42,7 +42,7 @@ * mf_get(). */ -#include "vim.h" +#include "mnv.h" #include @@ -159,7 +159,7 @@ struct data_block * NOTE: DEFINITION OF BLOCK 0 SHOULD NOT CHANGE! It would make all existing * swap files unusable! * - * If size of block0 changes anyway, adjust MIN_SWAP_PAGE_SIZE in vim.h!! + * If size of block0 changes anyway, adjust MIN_SWAP_PAGE_SIZE in mnv.h!! * * This block is built up of single bytes, to make it portable across * different machines. b0_magic_* is used to check the byte order and size of @@ -169,7 +169,7 @@ struct block0 { char_u b0_id[2]; // id for block 0: BLOCK0_ID0 and BLOCK0_ID1, // BLOCK0_ID1_C0, BLOCK0_ID1_C1, etc. - char_u b0_version[10]; // Vim version string + char_u b0_version[10]; // MNV version string char_u b0_page_size[4];// number of bytes per page char_u b0_mtime[4]; // last modification time of file char_u b0_ino[4]; // inode of b0_fname @@ -185,7 +185,7 @@ struct block0 /* * Note: b0_dirty and b0_flags are put at the end of the file name. For very - * long file names in older versions of Vim they are invalid. + * long file names in older versions of MNV they are invalid. * The 'fileencoding' comes before b0_flags, with a NUL in front. But only * when there is room, for very long file names it's omitted. */ @@ -193,18 +193,18 @@ struct block0 #define b0_dirty b0_fname[B0_FNAME_SIZE_ORG - 1] /* - * The b0_flags field is new in Vim 7.0. + * The b0_flags field is new in MNV 7.0. */ #define b0_flags b0_fname[B0_FNAME_SIZE_ORG - 2] /* - * Crypt seed goes here, 8 bytes. New in Vim 7.3. + * Crypt seed goes here, 8 bytes. New in MNV 7.3. * Without encryption these bytes may be used for 'fenc'. */ #define b0_seed b0_fname[B0_FNAME_SIZE_ORG - 2 - MF_SEED_LEN] // The lowest two bits contain the fileformat. Zero means it's not set -// (compatible with Vim 6.x), otherwise it's EOL_UNIX + 1, EOL_DOS + 1 or +// (compatible with MNV 6.x), otherwise it's EOL_UNIX + 1, EOL_DOS + 1 or // EOL_MAC + 1. #define B0_FF_MASK 3 @@ -341,7 +341,7 @@ ml_open(buf_T *buf) b0p->b0_magic_int = (int)B0_MAGIC_INT; b0p->b0_magic_short = (short)B0_MAGIC_SHORT; b0p->b0_magic_char = B0_MAGIC_CHAR; - mch_memmove(b0p->b0_version, "VIM ", 4); + mch_memmove(b0p->b0_version, "MNV ", 4); STRNCPY(b0p->b0_version + 4, Version, 6); long_to_char((long)mfp->mf_page_size, b0p->b0_page_size); @@ -561,7 +561,7 @@ ml_set_crypt_key( idx = 0; // start with first index in block 1 error = 0; buf->b_ml.ml_stack_top = 0; - VIM_CLEAR(buf->b_ml.ml_stack); + MNV_CLEAR(buf->b_ml.ml_stack); buf->b_ml.ml_stack_size = 0; // no stack yet for ( ; !got_int; line_breakcheck()) @@ -696,7 +696,7 @@ ml_setname(buf_T *buf) * change directory without us knowing it. */ p = FullName_save(fname, FALSE); - vim_free(fname); + mnv_free(fname); fname = p; if (fname == NULL) continue; @@ -704,7 +704,7 @@ ml_setname(buf_T *buf) // if the file name is the same we don't have to do anything if (fnamecmp(fname, mfp->mf_fname) == 0) { - vim_free(fname); + mnv_free(fname); success = TRUE; break; } @@ -716,12 +716,12 @@ ml_setname(buf_T *buf) } // try to rename the swap file - if (vim_rename(mfp->mf_fname, fname) == 0) + if (mnv_rename(mfp->mf_fname, fname) == 0) { success = TRUE; - vim_free(mfp->mf_fname); + mnv_free(mfp->mf_fname); mfp->mf_fname = fname; - vim_free(mfp->mf_ffname); + mnv_free(mfp->mf_ffname); #if defined(MSWIN) mfp->mf_ffname = NULL; // mf_fname is full pathname already #else @@ -730,7 +730,7 @@ ml_setname(buf_T *buf) ml_upd_block0(buf, UB_SAME_DIR); break; } - vim_free(fname); // this fname didn't work, try another + mnv_free(fname); // this fname didn't work, try another } if (mfp->mf_fd == -1) // need to (re)open the swap file @@ -790,7 +790,7 @@ ml_open_file(buf_T *buf) // For a spell buffer use a temp file name. if (buf->b_spell) { - fname = vim_tempname('s', FALSE); + fname = mnv_tempname('s', FALSE); if (fname != NULL) (void)mf_open_file(mfp, fname); // consumes fname! buf->b_may_swap = FALSE; @@ -807,7 +807,7 @@ ml_open_file(buf_T *buf) if (*dirp == NUL) break; // There is a small chance that between choosing the swap file name - // and creating it, another Vim creates the file. In that case the + // and creating it, another MNV creates the file. In that case the // creation will fail and we will use another directory. fname = findswapname(buf, &dirp, NULL); // allocates fname if (dirp == NULL) @@ -881,10 +881,10 @@ ml_close(buf_T *buf, int del_file) mf_close(buf->b_ml.ml_mfp, del_file); // close the .swp file if (buf->b_ml.ml_line_lnum != 0 && (buf->b_ml.ml_flags & (ML_LINE_DIRTY | ML_ALLOCATED))) - vim_free(buf->b_ml.ml_line_ptr); - vim_free(buf->b_ml.ml_stack); + mnv_free(buf->b_ml.ml_line_ptr); + mnv_free(buf->b_ml.ml_stack); #ifdef FEAT_BYTEOFF - VIM_CLEAR(buf->b_ml.ml_chunksize); + MNV_CLEAR(buf->b_ml.ml_chunksize); #endif buf->b_ml.ml_mfp = NULL; @@ -906,12 +906,12 @@ ml_close_all(int del_file) FOR_ALL_BUFFERS(buf) ml_close(buf, del_file && ((buf->b_flags & BF_PRESERVED) == 0 - || vim_strchr(p_cpo, CPO_PRESERVE) == NULL)); + || mnv_strchr(p_cpo, CPO_PRESERVE) == NULL)); #ifdef FEAT_SPELL spell_delete_wordlist(); // delete the internal wordlist #endif #ifdef TEMPDIRNAMES - vim_deltempdir(); // delete created temp directory + mnv_deltempdir(); // delete created temp directory #endif } @@ -1016,7 +1016,7 @@ set_b0_fname(ZERO_BL *b0p, buf_T *buf) // Systems that cannot translate "~user" back into a path: copy the // file name unmodified. Do use slashes instead of backslashes for // portability. - vim_strncpy(b0p->b0_fname, buf->b_ffname, B0_FNAME_SIZE_CRYPT - 1); + mnv_strncpy(b0p->b0_fname, buf->b_ffname, B0_FNAME_SIZE_CRYPT - 1); # ifdef BACKSLASH_IN_FILENAME forward_slash(b0p->b0_fname); # endif @@ -1039,7 +1039,7 @@ set_b0_fname(ZERO_BL *b0p, buf_T *buf) // If there is no user name or it is too long, don't use "~/" if (get_user_name(uname, B0_UNAME_SIZE) == FAIL || (ulen = STRLEN(uname)) + flen > B0_FNAME_SIZE_CRYPT - 1) - vim_strncpy(b0p->b0_fname, buf->b_ffname, + mnv_strncpy(b0p->b0_fname, buf->b_ffname, B0_FNAME_SIZE_CRYPT - 1); else { @@ -1104,7 +1104,7 @@ add_b0_fenc( int size = B0_FNAME_SIZE_NOCRYPT; #ifdef FEAT_CRYPT - // Without encryption use the same offset as in Vim 7.2 to be compatible. + // Without encryption use the same offset as in MNV 7.2 to be compatible. // With encryption it's OK to move elsewhere, the swap file is not // compatible anyway. if (*buf->b_p_key != NUL) @@ -1218,12 +1218,12 @@ ml_recover(int checkext) STRNICMP(fname + len - 4, ".s", 2) #endif == 0 - && vim_strchr((char_u *)"abcdefghijklmnopqrstuvw", + && mnv_strchr((char_u *)"abcdefghijklmnopqrstuvw", TOLOWER_ASC(fname[len - 2])) != NULL && ASCII_ISALPHA(fname[len - 1])) { directly = TRUE; - fname_used = vim_strsave(fname); // make a copy for mf_open() + fname_used = mnv_strsave(fname); // make a copy for mf_open() } else { @@ -1283,7 +1283,7 @@ ml_recover(int checkext) /* * open the memfile from the old swap file */ - p = vim_strsave(fname_used); // save "fname_used" for the message: + p = mnv_strsave(fname_used); // save "fname_used" for the message: // mf_open() will consume "fname_used"! mfp = mf_open(fname_used, O_RDONLY); fname_used = p; @@ -1314,25 +1314,25 @@ ml_recover(int checkext) msg_start(); msg_puts_attr(_("Unable to read block 0 from "), attr | MSG_HIST); msg_outtrans_attr(mfp->mf_fname, attr | MSG_HIST); - msg_puts_attr(_("\nMaybe no changes were made or Vim did not update the swap file."), + msg_puts_attr(_("\nMaybe no changes were made or MNV did not update the swap file."), attr | MSG_HIST); msg_end(); goto theend; } b0p = (ZERO_BL *)(hp->bh_data); - if (STRNCMP(b0p->b0_version, "VIM 3.0", 7) == 0) + if (STRNCMP(b0p->b0_version, "MNV 3.0", 7) == 0) { msg_start(); msg_outtrans_attr(mfp->mf_fname, MSG_HIST); - msg_puts_attr(_(" cannot be used with this version of Vim.\n"), + msg_puts_attr(_(" cannot be used with this version of MNV.\n"), MSG_HIST); - msg_puts_attr(_("Use Vim version 3.0.\n"), MSG_HIST); + msg_puts_attr(_("Use MNV version 3.0.\n"), MSG_HIST); msg_end(); goto theend; } if (ml_check_b0_id(b0p) == FAIL) { - semsg(_(e_str_does_not_look_like_vim_swap_file), mfp->mf_fname); + semsg(_(e_str_does_not_look_like_mnv_swap_file), mfp->mf_fname); goto theend; } if (b0_magic_wrong(b0p)) @@ -1341,7 +1341,7 @@ ml_recover(int checkext) msg_outtrans_attr(mfp->mf_fname, attr | MSG_HIST); #if defined(MSWIN) if (STRNCMP(b0p->b0_hname, "PC ", 3) == 0) - msg_puts_attr(_(" cannot be used with this version of Vim.\n"), + msg_puts_attr(_(" cannot be used with this version of MNV.\n"), attr | MSG_HIST); else #endif @@ -1366,7 +1366,7 @@ ml_recover(int checkext) #else if (b0p->b0_id[1] != BLOCK0_ID1) { - semsg(_(e_str_is_encrypted_and_this_version_of_vim_does_not_support_encryption), mfp->mf_fname); + semsg(_(e_str_is_encrypted_and_this_version_of_mnv_does_not_support_encryption), mfp->mf_fname); goto theend; } #endif @@ -1389,7 +1389,7 @@ ml_recover(int checkext) msg_end(); goto theend; } - if ((size = vim_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0) + if ((size = mnv_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0) mfp->mf_blocknr_max = 0; // no file or empty file else mfp->mf_blocknr_max = (blocknr_T)(size / mfp->mf_page_size); @@ -1400,7 +1400,7 @@ ml_recover(int checkext) if (p == NULL) goto theend; mch_memmove(p, hp->bh_data, previous_page_size); - vim_free(hp->bh_data); + mnv_free(hp->bh_data); hp->bh_data = p; b0p = (ZERO_BL *)(hp->bh_data); } @@ -1419,7 +1419,7 @@ ml_recover(int checkext) smsg(_("Using swap file \"%s\""), NameBuff); if (buf_spname(curbuf) != NULL) - vim_strncpy(NameBuff, buf_spname(curbuf), MAXPATHL - 1); + mnv_strncpy(NameBuff, buf_spname(curbuf), MAXPATHL - 1); else home_replace(NULL, curbuf->b_ffname, NameBuff, MAXPATHL, TRUE); smsg(_("Original file \"%s\""), NameBuff); @@ -1450,7 +1450,7 @@ ml_recover(int checkext) #endif for (p = b0p->b0_fname + fnsize; p > b0p->b0_fname && p[-1] != NUL; --p) ; - b0_fenc = vim_strnsave(p, b0p->b0_fname + fnsize - p); + b0_fenc = mnv_strnsave(p, b0p->b0_fname + fnsize - p); } mf_put(mfp, hp, FALSE, FALSE); // release block 0 @@ -1492,7 +1492,7 @@ ml_recover(int checkext) buf->b_p_key = curbuf->b_p_key; else if (*buf->b_p_key == NUL) { - vim_free(buf->b_p_key); + mnv_free(buf->b_p_key); buf->b_p_key = curbuf->b_p_key; } if (buf->b_p_key == NULL) @@ -1506,7 +1506,7 @@ ml_recover(int checkext) if (b0_fenc != NULL) { set_option_value_give_err((char_u *)"fenc", 0L, b0_fenc, OPT_LOCAL); - vim_free(b0_fenc); + mnv_free(b0_fenc); } unchanged(curbuf, TRUE, TRUE); @@ -1777,9 +1777,9 @@ ml_recover(int checkext) for (idx = 1; idx <= lnum; ++idx) { // Need to copy one line, fetching the other one may flush it. - p = vim_strnsave(ml_get(idx), ml_get_len(idx)); + p = mnv_strnsave(ml_get(idx), ml_get_len(idx)); i = STRCMP(p, ml_get(idx + lnum)); - vim_free(p); + mnv_free(p); if (i != 0) { changed_internal(); @@ -1825,7 +1825,7 @@ ml_recover(int checkext) #if defined(UNIX) || defined(MSWIN) if (swapfile_process_running(b0p, fname_used)) { - // Warn there could be an active Vim on the same file, the user may + // Warn there could be an active MNV on the same file, the user may // want to kill it. msg_puts(_("\nNote: process STILL RUNNING: ")); msg_outnum(char_to_long(b0p->b0_pid)); @@ -1844,13 +1844,13 @@ ml_recover(int checkext) redraw_curbuf_later(UPD_NOT_VALID); theend: - vim_free(fname_used); + mnv_free(fname_used); recoverymode = FALSE; if (mfp != NULL) { if (hp != NULL) mf_put(mfp, hp, FALSE, FALSE); - mf_close(mfp, FALSE); // will also vim_free(mfp->mf_fname) + mf_close(mfp, FALSE); // will also mnv_free(mfp->mf_fname) } if (buf != NULL) { @@ -1859,8 +1859,8 @@ theend: free_string_option(buf->b_p_key); free_string_option(buf->b_p_cm); #endif - vim_free(buf->b_ml.ml_stack); - vim_free(buf); + mnv_free(buf->b_ml.ml_stack); + mnv_free(buf); } if (serious_error && called_from_main) ml_close(curbuf, TRUE); @@ -1876,7 +1876,7 @@ theend: * with the 'directory' option. * * Used to: - * - list the swap files for "vim -r" + * - list the swap files for "mnv -r" * - count the number of swap files when recovering * - list the swap files when recovering * - list the swap files for swapfilelist() @@ -1943,19 +1943,19 @@ recover_names( if (fname == NULL) { #ifdef VMS - names[0] = vim_strnsave((char_u *)"*_sw%", STRLEN_LITERAL("*_sw%")); + names[0] = mnv_strnsave((char_u *)"*_sw%", STRLEN_LITERAL("*_sw%")); #else - names[0] = vim_strnsave((char_u *)"*.sw?", STRLEN_LITERAL("*.sw?")); + names[0] = mnv_strnsave((char_u *)"*.sw?", STRLEN_LITERAL("*.sw?")); #endif #if defined(UNIX) || defined(MSWIN) // For Unix names starting with a dot are special. MS-Windows // supports this too, on some file systems. - names[1] = vim_strnsave((char_u *)".*.sw?", STRLEN_LITERAL(".*.sw?")); - names[2] = vim_strnsave((char_u *)".sw?", STRLEN_LITERAL(".sw?")); + names[1] = mnv_strnsave((char_u *)".*.sw?", STRLEN_LITERAL(".*.sw?")); + names[2] = mnv_strnsave((char_u *)".sw?", STRLEN_LITERAL(".sw?")); num_names = 3; #else # ifdef VMS - names[1] = vim_strnsave((char_u *)".*_sw%", STRLEN_LITERAL(".*_sw%")); + names[1] = mnv_strnsave((char_u *)".*_sw%", STRLEN_LITERAL(".*_sw%")); num_names = 2; # else num_names = 1; @@ -2009,7 +2009,7 @@ recover_names( else { num_names = recov_file_names(names, tail, FALSE); - vim_free(tail); + mnv_free(tail); } } } @@ -2020,7 +2020,7 @@ recover_names( if (names[i] == NULL) { for (i = 0; i < num_names; ++i) - vim_free(names[i]); + mnv_free(names[i]); num_names = 0; } } @@ -2059,7 +2059,7 @@ recover_names( num_files = 1; } } - vim_free(swapname); + mnv_free(swapname); } } @@ -2079,9 +2079,9 @@ recover_names( // Remove the name from files[i]. Move further entries // down. When the array becomes empty free it here, since // FreeWild() won't be called below. - vim_free(files[i]); + mnv_free(files[i]); if (--num_files == 0) - vim_free(files); + mnv_free(files); else for ( ; i < num_files; ++i) files[i] = files[i + 1]; @@ -2092,7 +2092,7 @@ recover_names( file_count += num_files; if (nr <= file_count) { - *fname_out = vim_strsave( + *fname_out = mnv_strsave( files[nr - 1 + num_files - file_count]); dirp = (char_u *)""; // stop searching } @@ -2138,7 +2138,7 @@ recover_names( if (name != NULL) { list_append_string(ret_list, name, -1); - vim_free(name); + mnv_free(name); } } } @@ -2147,11 +2147,11 @@ recover_names( file_count += num_files; for (int i = 0; i < num_names; ++i) - vim_free(names[i]); + mnv_free(names[i]); if (num_files > 0) FreeWild(num_files, files); } - vim_free(dir_name.string); + mnv_free(dir_name.string); return file_count; } @@ -2177,14 +2177,14 @@ make_percent_swname(char_u *dir, char_u *dir_end, char_u *name) { STRCPY(s, f); for (d = s; *d != NUL; MB_PTR_ADV(d)) - if (vim_ispathsep(*d)) + if (mnv_ispathsep(*d)) *d = '%'; dir_end[-1] = NUL; // remove one trailing slash d = concat_fnames(dir, s, TRUE); - vim_free(s); + mnv_free(s); } - vim_free(f); + mnv_free(f); return d; } #endif @@ -2280,13 +2280,13 @@ swapfile_info(char_u *fname) { if (read_eintr(fd, &b0, sizeof(b0)) == sizeof(b0)) { - if (STRNCMP(b0.b0_version, "VIM 3.0", 7) == 0) + if (STRNCMP(b0.b0_version, "MNV 3.0", 7) == 0) { - msg_puts(_(" [from Vim version 3.0]")); + msg_puts(_(" [from MNV version 3.0]")); } else if (ml_check_b0_id(&b0) == FAIL) { - msg_puts(_(" [does not look like a Vim swap file]")); + msg_puts(_(" [does not look like a MNV swap file]")); } else { @@ -2333,7 +2333,7 @@ swapfile_info(char_u *fname) { #if defined(MSWIN) if (STRNCMP(b0.b0_hname, "PC ", 3) == 0) - msg_puts(_("\n [not usable with this version of Vim]")); + msg_puts(_("\n [not usable with this version of MNV]")); else #endif msg_puts(_("\n [not usable on this computer]")); @@ -2467,7 +2467,7 @@ recov_file_names(char_u **names, char_u *path, int prepend_dot) if (STRCMP(p, names[num_names]) != 0) ++num_names; else - vim_free(names[num_names]); + mnv_free(names[num_names]); } else ++num_names; @@ -2493,7 +2493,7 @@ recov_file_names(char_u **names, char_u *path, int prepend_dot) if (i > 0) p += i; // file name has been expanded to full path if (STRCMP(names[num_names - 1], p) == 0) - vim_free(names[num_names]); + mnv_free(names[num_names]); else ++num_names; #endif @@ -3486,7 +3486,7 @@ ml_append_int( theend: #ifdef FEAT_PROP_POPUP - vim_free(tofree); + mnv_free(tofree); #endif return ret; } @@ -3636,10 +3636,10 @@ ml_replace_len( // copy the line to allocated memory #ifdef FEAT_PROP_POPUP if (has_props) - line = vim_memsave(line, len); + line = mnv_memsave(line, len); else #endif - line = vim_strnsave(line, len - 1); + line = mnv_strnsave(line, len - 1); if (line == NULL) return FAIL; } @@ -3680,7 +3680,7 @@ ml_replace_len( mch_memmove(newline, line, len); mch_memmove(newline + len, curbuf->b_ml.ml_line_ptr + oldtextlen, textproplen); - vim_free(line); + mnv_free(line); line = newline; len += (colnr_T)textproplen; } @@ -3689,7 +3689,7 @@ ml_replace_len( #endif if (curbuf->b_ml.ml_flags & (ML_LINE_DIRTY | ML_ALLOCATED)) - vim_free(curbuf->b_ml.ml_line_ptr); // free allocated line + mnv_free(curbuf->b_ml.ml_line_ptr); // free allocated line curbuf->b_ml.ml_line_ptr = line; curbuf->b_ml.ml_line_len = len; @@ -3889,7 +3889,7 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int flags) textprop_len = line_size - (long)textlen; if (!(flags & (ML_DEL_UNDO | ML_DEL_NOPROP)) && textprop_len > 0) - textprop_save = vim_memsave((char_u *)dp + line_start + textlen, + textprop_save = mnv_memsave((char_u *)dp + line_start + textlen, textprop_len); } #endif @@ -3994,7 +3994,7 @@ theend: adjust_text_props_for_delete(buf, lnum, textprop_save, (int)textprop_len, FALSE); } - vim_free(textprop_save); + mnv_free(textprop_save); #endif return ret; } @@ -4260,12 +4260,12 @@ ml_flush_line(buf_T *buf) (void)ml_delete_int(buf, lnum, ML_DEL_NOPROP); } } - vim_free(new_line); + mnv_free(new_line); entered = FALSE; } else if (buf->b_ml.ml_flags & ML_ALLOCATED) - vim_free(buf->b_ml.ml_line_ptr); + mnv_free(buf->b_ml.ml_line_ptr); buf->b_ml.ml_flags &= ~(ML_LINE_DIRTY | ML_ALLOCATED); buf->b_ml.ml_line_lnum = 0; @@ -4548,7 +4548,7 @@ ml_add_stack(buf_T *buf) if (top > 0) mch_memmove(newstack, buf->b_ml.ml_stack, (size_t)top * sizeof(infoptr_T)); - vim_free(buf->b_ml.ml_stack); + mnv_free(buf->b_ml.ml_stack); buf->b_ml.ml_stack = newstack; buf->b_ml.ml_stack_size += STACK_INCR; } @@ -4613,7 +4613,7 @@ resolve_symlink(char_u *fname, char_u *buf) return FAIL; // Put the result so far in tmp[], starting with the original name. - vim_strncpy(tmp, fname, MAXPATHL - 1); + mnv_strncpy(tmp, fname, MAXPATHL - 1); for (;;) { @@ -4631,7 +4631,7 @@ resolve_symlink(char_u *fname, char_u *buf) { // Found non-symlink or not existing file, stop here. // When at the first level use the unmodified name, skip the - // call to vim_FullName(). + // call to mnv_FullName(). if (depth == 1) return FAIL; @@ -4668,7 +4668,7 @@ resolve_symlink(char_u *fname, char_u *buf) * be consistent even when opening a relative symlink from different * working directories. */ - return vim_FullName(tmp, buf, MAXPATHL, TRUE); + return mnv_FullName(tmp, buf, MAXPATHL, TRUE); } #endif @@ -4704,7 +4704,7 @@ makeswapname( if ((s = make_percent_swname(dir_name, s, fname_res)) != NULL) { r = modname(s, (char_u *)".swp", FALSE); - vim_free(s); + mnv_free(s); } return r; } @@ -4725,7 +4725,7 @@ makeswapname( return NULL; s = get_file_in_dir(r, dir_name); - vim_free(r); + mnv_free(r); return s; } @@ -4754,8 +4754,8 @@ get_file_in_dir( tail = gettail(fname); if (dname[0] == '.' && dname[1] == NUL) - retval = vim_strsave(fname); - else if (dname[0] == '.' && vim_ispathsep(dname[1])) + retval = mnv_strsave(fname); + else if (dname[0] == '.' && mnv_ispathsep(dname[1])) { if (tail == fname) // no path before file name retval = concat_fnames(dname + 2, tail, TRUE); @@ -4770,7 +4770,7 @@ get_file_in_dir( else { retval = concat_fnames(t, tail, TRUE); - vim_free(t); + mnv_free(t); } } } @@ -4822,7 +4822,7 @@ attention_message( // other languages. msg_puts(_("\n(1) Another program may be editing the same file. If this is the case,\n be careful not to end up with two different instances of the same\n file when making changes. Quit, or continue with caution.\n")); msg_puts(_("(2) An edit session for this file crashed.\n")); - msg_puts(_(" If this is the case, use \":recover\" or \"vim -r ")); + msg_puts(_(" If this is the case, use \":recover\" or \"mnv -r ")); msg_outtrans(buf->b_fname); msg_puts(_("\"\n to recover the changes (see \":help recovery\").\n")); msg_puts(_(" If you did this already, delete the swap file \"")); @@ -4850,8 +4850,8 @@ typedef enum { static sea_choice_T do_swapexists(buf_T *buf, char_u *fname) { - set_vim_var_string(VV_SWAPNAME, fname, -1); - set_vim_var_string(VV_SWAPCHOICE, NULL, -1); + set_mnv_var_string(VV_SWAPNAME, fname, -1); + set_mnv_var_string(VV_SWAPCHOICE, NULL, -1); // Trigger SwapExists autocommands with set to the file being // edited. Disallow changing directory here. @@ -4859,9 +4859,9 @@ do_swapexists(buf_T *buf, char_u *fname) apply_autocmds(EVENT_SWAPEXISTS, buf->b_fname, NULL, FALSE, NULL); --allbuf_lock; - set_vim_var_string(VV_SWAPNAME, NULL, -1); + set_mnv_var_string(VV_SWAPNAME, NULL, -1); - switch (*get_vim_var_str(VV_SWAPCHOICE)) + switch (*get_mnv_var_str(VV_SWAPCHOICE)) { case 'o': return SEA_CHOICE_READONLY; case 'e': return SEA_CHOICE_EDIT; @@ -4907,11 +4907,11 @@ findswapname( # ifdef MSWIN if (buf_fname != NULL && !mch_isFullName(buf_fname) - && vim_strchr(gettail(buf_fname), ':')) + && mnv_strchr(gettail(buf_fname), ':')) { char_u *t; - buf_fname = vim_strsave(buf_fname); + buf_fname = mnv_strsave(buf_fname); if (buf_fname == NULL) buf_fname = buf->b_fname; else @@ -4957,7 +4957,7 @@ findswapname( break; if ((n = (int)STRLEN(fname)) == 0) // safety check { - VIM_CLEAR(fname); + MNV_CLEAR(fname); break; } #if defined(UNIX) @@ -4982,7 +4982,7 @@ findswapname( * with a dot. */ tail = gettail(buf_fname); - if ( vim_strchr(tail, '.') != NULL + if ( mnv_strchr(tail, '.') != NULL || STRLEN(tail) > (size_t)8 || *gettail(fname) == '.') { @@ -4993,7 +4993,7 @@ findswapname( // if fname == "xx.xx.swp", fname2 = "xx.xx.swx" // if fname == ".xx.swp", fname2 = ".xx.swpx" // if fname == "123456789.swp", fname2 = "12345678x.swp" - if (vim_strchr(tail, '.') != NULL) + if (mnv_strchr(tail, '.') != NULL) fname2[n - 1] = 'x'; else if (*gettail(fname) == '.') { @@ -5040,11 +5040,11 @@ findswapname( if (created1) mch_remove(fname); } - vim_free(fname2); + mnv_free(fname2); if (same) { buf->b_shortname = TRUE; - vim_free(fname); + mnv_free(fname); fname = makeswapname(buf_fname, buf->b_ffname, buf, dir_name); continue; // try again with b_shortname set @@ -5114,7 +5114,7 @@ findswapname( if (r >= 0) // "file.swx" seems to exist { buf->b_shortname = TRUE; - vim_free(fname); + mnv_free(fname); fname = makeswapname(buf_fname, buf->b_ffname, buf, dir_name); continue; // try again with '.' replaced with '_' @@ -5188,7 +5188,7 @@ findswapname( // give the ATTENTION message when there is an old swap file // for the current file, and the buffer was not recovered. if (differ == FALSE && !(curbuf->b_flags & BF_RECOVERED) - && vim_strchr(p_shm, SHM_ATTENTION) == NULL) + && mnv_strchr(p_shm, SHM_ATTENTION) == NULL) { sea_choice_T choice = SEA_CHOICE_NONE; stat_T st; @@ -5196,8 +5196,8 @@ findswapname( int did_use_dummy = FALSE; // Avoid getting a warning for the file being created - // outside of Vim, it was created at the start of this - // function. Delete the file now, because Vim might exit + // outside of MNV, it was created at the start of this + // function. Delete the file now, because MNV might exit // here if the window is closed. if (dummyfd != NULL) { @@ -5246,8 +5246,8 @@ findswapname( #ifdef FEAT_GUI // If we are supposed to start the GUI but it wasn't // completely started yet, start it now. This makes - // the messages displayed in the Vim window when - // loading a session from the .gvimrc file. + // the messages displayed in the MNV window when + // loading a session from the .gmnvrc file. if (gui.starting && !gui.in_use) gui_start(NULL); #endif @@ -5258,7 +5258,7 @@ findswapname( // interrupt loading a file. got_int = FALSE; - // If vimrc has "simalt ~x" we don't want it to + // If mnvrc has "simalt ~x" we don't want it to // interfere with the prompt here. flush_buffers(FLUSH_TYPEAHEAD); } @@ -5280,8 +5280,8 @@ findswapname( home_replace(NULL, fname, name + len, 1000, TRUE); STRCAT(name, _("\" already exists!")); } - dialog_result = do_dialog(VIM_WARNING, - (char_u *)_("VIM - ATTENTION"), + dialog_result = do_dialog(MNV_WARNING, + (char_u *)_("MNV - ATTENTION"), name == NULL ? (char_u *)_("Swap file already exists!") : name, @@ -5297,7 +5297,7 @@ findswapname( dialog_result++; # endif choice = dialog_result; - vim_free(name); + mnv_free(name); // pretend screen didn't scroll, need redraw anyway msg_scrolled = 0; @@ -5357,7 +5357,7 @@ findswapname( if (fname[n - 2] == 'a') // ".saa": tried enough, give up { emsg(_(e_too_many_swap_files_found)); - VIM_CLEAR(fname); + MNV_CLEAR(fname); break; } --fname[n - 2]; // ".svz", ".suz", etc. @@ -5366,7 +5366,7 @@ findswapname( --fname[n - 1]; // ".swo", ".swn", etc. } - vim_free(dir_name); + mnv_free(dir_name); #ifdef CREATE_DUMMY_FILE if (dummyfd != NULL) // file has been created temporarily { @@ -5376,7 +5376,7 @@ findswapname( #endif #ifdef MSWIN if (buf_fname != buf->b_fname) - vim_free(buf_fname); + mnv_free(buf_fname); #endif return fname; } @@ -5471,11 +5471,11 @@ fnamecmp_ino( return (ino_c != ino_s); /* - * One of the inode numbers is unknown, try a forced vim_FullName() and + * One of the inode numbers is unknown, try a forced mnv_FullName() and * compare the file names. */ - retval_c = vim_FullName(fname_c, buf_c, MAXPATHL, TRUE); - retval_s = vim_FullName(fname_s, buf_s, MAXPATHL, TRUE); + retval_c = mnv_FullName(fname_c, buf_c, MAXPATHL, TRUE); + retval_s = mnv_FullName(fname_s, buf_s, MAXPATHL, TRUE); if (retval_c == OK && retval_s == OK) return STRCMP(buf_c, buf_s) != 0; @@ -5599,7 +5599,7 @@ ml_encrypt_data( // Clear the gap. if (head_end < text_start) - vim_memset(new_data + (head_end - data), 0, text_start - head_end); + mnv_memset(new_data + (head_end - data), 0, text_start - head_end); return new_data; } @@ -5679,7 +5679,7 @@ ml_crypt_prepare(memfile_T *mfp, off_T offset, int reading) { // For PKzip: Append the offset to the key, so that we use a different // key for every block. - vim_snprintf((char *)salt, sizeof(salt), "%s%ld", key, (long)offset); + mnv_snprintf((char *)salt, sizeof(salt), "%s%ld", key, (long)offset); arg.cat_seed = NULL; arg.cat_init_from_file = FALSE; @@ -5688,7 +5688,7 @@ ml_crypt_prepare(memfile_T *mfp, off_T offset, int reading) // Using blowfish or better: add salt and seed. We use the byte offset // of the block for the salt. - vim_snprintf((char *)salt, sizeof(salt), "%ld", (long)offset); + mnv_snprintf((char *)salt, sizeof(salt), "%ld", (long)offset); arg.cat_salt = salt; arg.cat_salt_len = (int)STRLEN(salt); @@ -5797,12 +5797,12 @@ ml_updatechunk( chunksize_T *t_chunksize = buf->b_ml.ml_chunksize; buf->b_ml.ml_numchunks = buf->b_ml.ml_numchunks * 3 / 2; - buf->b_ml.ml_chunksize = vim_realloc(buf->b_ml.ml_chunksize, + buf->b_ml.ml_chunksize = mnv_realloc(buf->b_ml.ml_chunksize, sizeof(chunksize_T) * buf->b_ml.ml_numchunks); if (buf->b_ml.ml_chunksize == NULL) { // Hmmmm, Give up on offset for this buffer - vim_free(t_chunksize); + mnv_free(t_chunksize); buf->b_ml.ml_usedchunks = -1; return; } diff --git a/uvim/src/menu.c b/uvim/src/menu.c index 3c0dfca677..5a8a524194 100644 --- a/uvim/src/menu.c +++ b/uvim/src/menu.c @@ -1,45 +1,45 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * GUI/Motif support by Robert Webb * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * Code for menus. Used for the GUI and 'wildmenu'. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_MENU) #define MENUDEPTH 10 // maximum depth of menus #ifdef FEAT_GUI_MSWIN -static int add_menu_path(char_u *, vimmenu_T *, int *, char_u *, int); +static int add_menu_path(char_u *, mnvmenu_T *, int *, char_u *, int); #else -static int add_menu_path(char_u *, vimmenu_T *, int *, char_u *); +static int add_menu_path(char_u *, mnvmenu_T *, int *, char_u *); #endif -static int menu_nable_recurse(vimmenu_T *menu, char_u *name, int modes, int enable); -static int remove_menu(vimmenu_T **, char_u *, int, int silent); -static void free_menu(vimmenu_T **menup); -static void free_menu_string(vimmenu_T *, int); +static int menu_nable_recurse(mnvmenu_T *menu, char_u *name, int modes, int enable); +static int remove_menu(mnvmenu_T **, char_u *, int, int silent); +static void free_menu(mnvmenu_T **menup); +static void free_menu_string(mnvmenu_T *, int); static int show_menus(char_u *, int); -static void show_menus_recursive(vimmenu_T *, int, int); +static void show_menus_recursive(mnvmenu_T *, int, int); static char_u *menu_name_skip(char_u *name); -static int menu_name_equal(char_u *name, vimmenu_T *menu); +static int menu_name_equal(char_u *name, mnvmenu_T *menu); static int menu_namecmp(char_u *name, char_u *mname); static int get_menu_cmd_modes(char_u *, int, int *, int *); static char_u *popup_mode_name(char_u *name, int idx); static char_u *menu_text(char_u *text, int *mnemonic, char_u **actext); #if defined(FEAT_GUI_MSWIN) && defined(FEAT_TEAROFF) -static void gui_create_tearoffs_recurse(vimmenu_T *menu, const char_u *pname, int *pri_tab, int pri_idx); +static void gui_create_tearoffs_recurse(mnvmenu_T *menu, const char_u *pname, int *pri_tab, int pri_idx); static void gui_add_tearoff(char_u *tearpath, int *pri_tab, int pri_idx); -static void gui_destroy_tearoffs_recurse(vimmenu_T *menu); +static void gui_destroy_tearoffs_recurse(mnvmenu_T *menu); static int s_tearoffs = FALSE; #endif @@ -94,7 +94,7 @@ winbar_height(win_T *wp) return 0; } - static vimmenu_T ** + static mnvmenu_T ** get_root_menu(char_u *name) { if (menu_is_winbar(name)) @@ -147,8 +147,8 @@ ex_menu( #ifdef FEAT_TOOLBAR char_u *icon = NULL; #endif - vimmenu_T menuarg; - vimmenu_T **root_menu_ptr; + mnvmenu_T menuarg; + mnvmenu_T **root_menu_ptr; modes = get_menu_cmd_modes(eap->cmd, eap->forceit, &noremap, &unmenu); arg = eap->arg; @@ -201,11 +201,11 @@ ex_menu( * Fill in the priority table. */ for (p = arg; *p; ++p) - if (!VIM_ISDIGIT(*p) && *p != '.') + if (!MNV_ISDIGIT(*p) && *p != '.') break; - if (VIM_ISWHITE(*p)) + if (MNV_ISWHITE(*p)) { - for (i = 0; i < MENUDEPTH && !VIM_ISWHITE(*arg); ++i) + for (i = 0; i < MENUDEPTH && !MNV_ISWHITE(*arg); ++i) { pri_tab[i] = getdigits(&arg); if (pri_tab[i] == 0) @@ -229,12 +229,12 @@ ex_menu( /* * Check for "disable" or "enable" argument. */ - if (STRNCMP(arg, "enable", 6) == 0 && VIM_ISWHITE(arg[6])) + if (STRNCMP(arg, "enable", 6) == 0 && MNV_ISWHITE(arg[6])) { enable = TRUE; arg = skipwhite(arg + 6); } - else if (STRNCMP(arg, "disable", 7) == 0 && VIM_ISWHITE(arg[7])) + else if (STRNCMP(arg, "disable", 7) == 0 && MNV_ISWHITE(arg[7])) { enable = FALSE; arg = skipwhite(arg + 7); @@ -340,7 +340,7 @@ ex_menu( { menu_nable_recurse(*root_menu_ptr, p, MENU_ALL_MODES, enable); - vim_free(p); + mnv_free(p); } } } @@ -369,7 +369,7 @@ ex_menu( if (p != NULL) { remove_menu(root_menu_ptr, p, MENU_ALL_MODES, TRUE); - vim_free(p); + mnv_free(p); } } } @@ -431,12 +431,12 @@ ex_menu( , TRUE #endif ); - vim_free(p); + mnv_free(p); } } } - vim_free(map_buf); + mnv_free(map_buf); } #if defined(FEAT_GUI) && !(defined(FEAT_GUI_GTK)) @@ -474,7 +474,7 @@ theend: static int add_menu_path( char_u *menu_path, - vimmenu_T *menuarg, // passes modes, iconfile, iconidx, + mnvmenu_T *menuarg, // passes modes, iconfile, iconidx, // icon_builtin, silent[0], noremap[0] int *pri_tab, char_u *call_data @@ -485,10 +485,10 @@ add_menu_path( { char_u *path_name; int modes = menuarg->modes; - vimmenu_T **menup; - vimmenu_T *menu = NULL; - vimmenu_T *parent; - vimmenu_T **lower_pri; + mnvmenu_T **menup; + mnvmenu_T *menu = NULL; + mnvmenu_T *parent; + mnvmenu_T **lower_pri; char_u *p; char_u *name; char_u *dname; @@ -507,10 +507,10 @@ add_menu_path( char_u *en_name; char_u *map_to = NULL; #endif - vimmenu_T **root_menu_ptr; + mnvmenu_T **root_menu_ptr; // Make a copy so we can stuff around with it, since it could be const - path_name = vim_strsave(menu_path); + path_name = mnv_strsave(menu_path); if (path_name == NULL) return FAIL; root_menu_ptr = get_root_menu(menu_path); @@ -606,19 +606,19 @@ add_menu_path( } // Not already there, so let's add it - menu = ALLOC_CLEAR_ONE(vimmenu_T); + menu = ALLOC_CLEAR_ONE(mnvmenu_T); if (menu == NULL) goto erret; menu->modes = modes; menu->enabled = MENU_ALL_MODES; - menu->name = vim_strsave(name); + menu->name = mnv_strsave(name); // separate mnemonic and accelerator text from actual menu name menu->dname = menu_text(name, &menu->mnemonic, &menu->actext); #ifdef FEAT_MULTI_LANG if (en_name != NULL) { - menu->en_name = vim_strsave(en_name); + menu->en_name = mnv_strsave(en_name); menu->en_dname = menu_text(en_name, NULL, NULL); } else @@ -647,7 +647,7 @@ add_menu_path( menu->iconidx = menuarg->iconidx; menu->icon_builtin = menuarg->icon_builtin; if (*next_name == NUL && menuarg->iconfile != NULL) - menu->iconfile = vim_strsave(menuarg->iconfile); + menu->iconfile = mnv_strsave(menuarg->iconfile); #endif #if defined(FEAT_GUI_MSWIN) && defined(FEAT_TEAROFF) // the tearoff item must be present in the modes of each item. @@ -703,9 +703,9 @@ add_menu_path( // When adding a new submenu, may add a tearoff item if ( addtearoff && *next_name - && vim_strchr(p_go, GO_TEAROFF) != NULL + && mnv_strchr(p_go, GO_TEAROFF) != NULL && menu_is_menubar(name) -# ifdef VIMDLL +# ifdef MNVDLL && (gui.in_use || gui.starting) # endif ) @@ -735,7 +735,7 @@ add_menu_path( } tearpath[len] = NUL; gui_add_tearoff(tearpath, pri_tab, pri_idx); - vim_free(tearpath); + mnv_free(tearpath); } } # endif @@ -745,11 +745,11 @@ add_menu_path( menup = &menu->children; parent = menu; name = next_name; - VIM_CLEAR(dname); + MNV_CLEAR(dname); if (pri_tab[pri_idx + 1] != -1) ++pri_idx; } - vim_free(path_name); + mnv_free(path_name); /* * Only add system menu items which have not been defined yet. @@ -765,7 +765,7 @@ add_menu_path( #ifdef FEAT_GUI menu->cb = gui_menu_cb; #endif - p = (call_data == NULL) ? NULL : vim_strsave(call_data); + p = (call_data == NULL) ? NULL : mnv_strsave(call_data); // loop over all modes, may add more than one for (i = 0; i < MENU_MODES; ++i) @@ -841,8 +841,8 @@ add_menu_path( return OK; erret: - vim_free(path_name); - vim_free(dname); + mnv_free(path_name); + mnv_free(dname); // Delete any empty submenu we added before discovering the error. Repeat // for higher levels. @@ -868,7 +868,7 @@ erret: */ static int menu_nable_recurse( - vimmenu_T *menu, + mnvmenu_T *menu, char_u *name, int modes, int enable) @@ -933,13 +933,13 @@ menu_nable_recurse( */ static int remove_menu( - vimmenu_T **menup, + mnvmenu_T **menup, char_u *name, int modes, int silent) // don't give error messages { - vimmenu_T *menu; - vimmenu_T *child; + mnvmenu_T *menu; + mnvmenu_T *child; char_u *p; if (*menup == NULL) @@ -1055,17 +1055,17 @@ remove_menu( remove_winbar(win_T *wp) { remove_menu(&wp->w_winbar, (char_u *)"", MENU_ALL_MODES, TRUE); - vim_free(wp->w_winbar_items); + mnv_free(wp->w_winbar_items); } /* * Free the given menu structure and remove it from the linked list. */ static void -free_menu(vimmenu_T **menup) +free_menu(mnvmenu_T **menup) { int i; - vimmenu_T *menu; + mnvmenu_T *menu; menu = *menup; @@ -1079,22 +1079,22 @@ free_menu(vimmenu_T **menup) // Don't change *menup until after calling gui_mch_destroy_menu(). The // MacOS code needs the original structure to properly delete the menu. *menup = menu->next; - vim_free(menu->name); - vim_free(menu->dname); + mnv_free(menu->name); + mnv_free(menu->dname); #ifdef FEAT_MULTI_LANG - vim_free(menu->en_name); - vim_free(menu->en_dname); + mnv_free(menu->en_name); + mnv_free(menu->en_dname); #endif - vim_free(menu->actext); + mnv_free(menu->actext); #ifdef FEAT_TOOLBAR - vim_free(menu->iconfile); + mnv_free(menu->iconfile); # ifdef FEAT_GUI_MOTIF - vim_free(menu->xpm_fname); + mnv_free(menu->xpm_fname); # endif #endif for (i = 0; i < MENU_MODES; i++) free_menu_string(menu, i); - vim_free(menu); + mnv_free(menu); #ifdef FEAT_GUI // Want to update menus now even if mode not changed @@ -1106,7 +1106,7 @@ free_menu(vimmenu_T **menup) * Free the menu->string with the given index. */ static void -free_menu_string(vimmenu_T *menu, int idx) +free_menu_string(mnvmenu_T *menu, int idx) { int count = 0; int i; @@ -1115,7 +1115,7 @@ free_menu_string(vimmenu_T *menu, int idx) if (menu->strings[i] == menu->strings[idx]) count++; if (count == 1) - vim_free(menu->strings[idx]); + mnv_free(menu->strings[idx]); menu->strings[idx] = NULL; } @@ -1127,10 +1127,10 @@ show_menus(char_u *path_name, int modes) { char_u *p; char_u *name; - vimmenu_T *menu; - vimmenu_T *parent = NULL; + mnvmenu_T *menu; + mnvmenu_T *parent = NULL; - name = path_name = vim_strsave(path_name); + name = path_name = mnv_strsave(path_name); if (path_name == NULL) return FAIL; menu = *get_root_menu(path_name); @@ -1147,13 +1147,13 @@ show_menus(char_u *path_name, int modes) if (*p != NUL && menu->children == NULL) { emsg(_(e_part_of_menu_item_path_is_not_sub_menu)); - vim_free(path_name); + mnv_free(path_name); return FAIL; } else if ((menu->modes & modes) == 0x0) { emsg(_(e_menu_only_exists_in_another_mode)); - vim_free(path_name); + mnv_free(path_name); return FAIL; } break; @@ -1163,14 +1163,14 @@ show_menus(char_u *path_name, int modes) if (menu == NULL) { semsg(_(e_no_menu_str), name); - vim_free(path_name); + mnv_free(path_name); return FAIL; } name = p; parent = menu; menu = menu->children; } - vim_free(path_name); + mnv_free(path_name); // make sure the list of menus doesn't change while listing them ++menus_locked; @@ -1187,7 +1187,7 @@ show_menus(char_u *path_name, int modes) * Recursively show the mappings associated with the menus under the given one */ static void -show_menus_recursive(vimmenu_T *menu, int modes, int depth) +show_menus_recursive(mnvmenu_T *menu, int modes, int depth) { int i; int bit; @@ -1263,8 +1263,8 @@ show_menus_recursive(vimmenu_T *menu, int modes, int depth) /* * Used when expanding menu names. */ -static vimmenu_T *expand_menu = NULL; -static vimmenu_T *expand_menu_alt = NULL; +static mnvmenu_T *expand_menu = NULL; +static mnvmenu_T *expand_menu_alt = NULL; static int expand_modes = 0x0; static int expand_emenu; // TRUE for ":emenu" command @@ -1283,7 +1283,7 @@ set_context_in_menu_cmd( char_u *path_name = NULL; char_u *name; int unmenu; - vimmenu_T *menu; + mnvmenu_T *menu; int expand_menus; xp->xp_context = EXPAND_UNSUCCESSFUL; @@ -1291,27 +1291,27 @@ set_context_in_menu_cmd( // Check for priority numbers, enable and disable for (p = arg; *p; ++p) - if (!VIM_ISDIGIT(*p) && *p != '.') + if (!MNV_ISDIGIT(*p) && *p != '.') break; - if (!VIM_ISWHITE(*p)) + if (!MNV_ISWHITE(*p)) { if (STRNCMP(arg, "enable", 6) == 0 - && (arg[6] == NUL || VIM_ISWHITE(arg[6]))) + && (arg[6] == NUL || MNV_ISWHITE(arg[6]))) p = arg + 6; else if (STRNCMP(arg, "disable", 7) == 0 - && (arg[7] == NUL || VIM_ISWHITE(arg[7]))) + && (arg[7] == NUL || MNV_ISWHITE(arg[7]))) p = arg + 7; else p = arg; } - while (*p != NUL && VIM_ISWHITE(*p)) + while (*p != NUL && MNV_ISWHITE(*p)) ++p; arg = after_dot = p; - for (; *p && !VIM_ISWHITE(*p); ++p) + for (; *p && !MNV_ISWHITE(*p); ++p) { if ((*p == '\\' || *p == Ctrl_V) && p[1] != NUL) p++; @@ -1322,7 +1322,7 @@ set_context_in_menu_cmd( // ":tearoff" and ":popup" only use menus, not entries expand_menus = !((*cmd == 't' && cmd[1] == 'e') || *cmd == 'p'); expand_emenu = (*cmd == 'e'); - if (expand_menus && VIM_ISWHITE(*p)) + if (expand_menus && MNV_ISWHITE(*p)) return NULL; // TODO: check for next command? if (*p == NUL) // Complete the menu name { @@ -1343,7 +1343,7 @@ set_context_in_menu_cmd( path_name = alloc(after_dot - arg); if (path_name == NULL) return NULL; - vim_strncpy(path_name, arg, after_dot - arg - 1); + mnv_strncpy(path_name, arg, after_dot - arg - 1); } name = path_name; while (name != NULL && *name) @@ -1361,7 +1361,7 @@ set_context_in_menu_cmd( * Menu path continues, but we have reached a leaf. * Or menu exists only in another mode. */ - vim_free(path_name); + mnv_free(path_name); return NULL; } break; @@ -1376,14 +1376,14 @@ set_context_in_menu_cmd( if (menu == NULL) { // No menu found with the name we were looking for - vim_free(path_name); + mnv_free(path_name); return NULL; } name = p; menu = menu->children; try_alt_menu = FALSE; } - vim_free(path_name); + mnv_free(path_name); xp->xp_context = expand_menus ? EXPAND_MENUNAMES : EXPAND_MENUS; xp->xp_pattern = after_dot; @@ -1405,7 +1405,7 @@ set_context_in_menu_cmd( char_u * get_menu_name(expand_T *xp UNUSED, int idx) { - static vimmenu_T *menu = NULL; + static mnvmenu_T *menu = NULL; static int did_alt_menu = FALSE; char_u *str; #ifdef FEAT_MULTI_LANG @@ -1481,7 +1481,7 @@ get_menu_name(expand_T *xp UNUSED, int idx) char_u * get_menu_names(expand_T *xp UNUSED, int idx) { - static vimmenu_T *menu = NULL; + static mnvmenu_T *menu = NULL; static int did_alt_menu = FALSE; #define TBUFFER_LEN 256 static char_u tbuffer[TBUFFER_LEN]; //hack @@ -1526,11 +1526,11 @@ get_menu_names(expand_T *xp UNUSED, int idx) { #ifdef FEAT_MULTI_LANG if (should_advance) - vim_strncpy(tbuffer, menu->en_dname, TBUFFER_LEN - 2); + mnv_strncpy(tbuffer, menu->en_dname, TBUFFER_LEN - 2); else { #endif - vim_strncpy(tbuffer, menu->dname, TBUFFER_LEN - 2); + mnv_strncpy(tbuffer, menu->dname, TBUFFER_LEN - 2); #ifdef FEAT_MULTI_LANG if (menu->en_dname == NULL) should_advance = TRUE; @@ -1609,7 +1609,7 @@ menu_name_skip(char_u *name) * two ways: raw menu name and menu name without '&'. ignore part after a TAB. */ static int -menu_name_equal(char_u *name, vimmenu_T *menu) +menu_name_equal(char_u *name, mnvmenu_T *menu) { #ifdef FEAT_MULTI_LANG if (menu->en_name != NULL @@ -1762,7 +1762,7 @@ popup_mode_name(char_u *name, int idx) int mode_chars_len = (int)strlen(mode_chars); int i; - p = vim_strnsave(name, len + mode_chars_len); + p = mnv_strnsave(name, len + mode_chars_len); if (p == NULL) return NULL; @@ -1779,7 +1779,7 @@ popup_mode_name(char_u *name, int idx) * given menu in the current mode. */ int -get_menu_index(vimmenu_T *menu, int state) +get_menu_index(mnvmenu_T *menu, int state) { int idx; @@ -1827,20 +1827,20 @@ menu_text(char_u *str, int *mnemonic, char_u **actext) char_u *text; // Locate accelerator text, after the first TAB - p = vim_strchr(str, TAB); + p = mnv_strchr(str, TAB); if (p != NULL) { if (actext != NULL) - *actext = vim_strsave(p + 1); - text = vim_strnsave(str, p - str); + *actext = mnv_strsave(p + 1); + text = mnv_strnsave(str, p - str); } else - text = vim_strsave(str); + text = mnv_strsave(str); // Find mnemonic characters "&a" and reduce "&&" to "&". for (p = text; p != NULL; ) { - p = vim_strchr(p, '&'); + p = mnv_strchr(p, '&'); if (p != NULL) { if (p[1] == NUL) // trailing "&" @@ -1894,7 +1894,7 @@ menu_is_popup(char_u *name) * Return TRUE if "name" is part of a popup menu. */ int -menu_is_child_of_popup(vimmenu_T *menu) +menu_is_child_of_popup(mnvmenu_T *menu) { while (menu->parent != NULL) menu = menu->parent; @@ -1990,7 +1990,7 @@ get_menu_mode_flag(void) void show_popupmenu(void) { - vimmenu_T *menu; + mnvmenu_T *menu; int menu_mode; char* mode; int mode_len; @@ -2038,9 +2038,9 @@ show_popupmenu(void) * Return OK or FAIL. Used recursively. */ int -check_menu_pointer(vimmenu_T *root, vimmenu_T *menu_to_check) +check_menu_pointer(mnvmenu_T *root, mnvmenu_T *menu_to_check) { - vimmenu_T *p; + mnvmenu_T *p; for (p = root; p != NULL; p = p->next) if (p == menu_to_check @@ -2058,7 +2058,7 @@ check_menu_pointer(vimmenu_T *root, vimmenu_T *menu_to_check) * gui_create_initial_menus(root_menu); */ void -gui_create_initial_menus(vimmenu_T *menu) +gui_create_initial_menus(mnvmenu_T *menu) { int idx = 0; @@ -2084,7 +2084,7 @@ gui_create_initial_menus(vimmenu_T *menu) * Used recursively by gui_update_menus (see below) */ static void -gui_update_menus_recurse(vimmenu_T *menu, int mode) +gui_update_menus_recurse(mnvmenu_T *menu, int mode) { int grey; @@ -2101,7 +2101,7 @@ gui_update_menus_recurse(vimmenu_T *menu, int mode) // Never hide a toplevel menu, it may make the menubar resize or // disappear. Same problem for ToolBar items. - if (vim_strchr(p_go, GO_GREY) != NULL || menu->parent == NULL + if (mnv_strchr(p_go, GO_GREY) != NULL || menu->parent == NULL # ifdef FEAT_TOOLBAR || menu_is_toolbar(menu->parent->name) # endif @@ -2148,7 +2148,7 @@ gui_update_menus(int modes) int gui_is_menu_shortcut(int key) { - vimmenu_T *menu; + mnvmenu_T *menu; if (key < 256) key = TOLOWER_LOC(key); @@ -2191,7 +2191,7 @@ gui_mch_toggle_tearoffs(int enable) */ static void gui_create_tearoffs_recurse( - vimmenu_T *menu, + mnvmenu_T *menu, const char_u *pname, int *pri_tab, int pri_idx) @@ -2236,7 +2236,7 @@ gui_create_tearoffs_recurse( STRCAT(newpname, "."); gui_create_tearoffs_recurse(menu->children, newpname, pri_tab, pri_idx); - vim_free(newpname); + mnv_free(newpname); } } menu = menu->next; @@ -2252,7 +2252,7 @@ gui_add_tearoff(char_u *tearpath, int *pri_tab, int pri_idx) { char_u *tbuf; int t; - vimmenu_T menuarg; + mnvmenu_T menuarg; tbuf = alloc(5 + (unsigned int)STRLEN(tearpath)); if (tbuf == NULL) @@ -2287,14 +2287,14 @@ gui_add_tearoff(char_u *tearpath, int *pri_tab, int pri_idx) (char_u *)_("Tear off this menu"), FALSE); pri_tab[pri_idx + 1] = t; - vim_free(tbuf); + mnv_free(tbuf); } /* * Recursively destroy tearoff items */ static void -gui_destroy_tearoffs_recurse(vimmenu_T *menu) +gui_destroy_tearoffs_recurse(mnvmenu_T *menu) { while (menu) { @@ -2322,7 +2322,7 @@ gui_destroy_tearoffs_recurse(vimmenu_T *menu) * on the current state. */ void -execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx) +execute_menu(exarg_T *eap, mnvmenu_T *menu, int mode_idx) { int idx = mode_idx; @@ -2449,16 +2449,16 @@ execute_menu(exarg_T *eap, vimmenu_T *menu, int mode_idx) * Lookup a menu by the descriptor name e.g. "File.New" * Returns NULL if the menu is not found */ - static vimmenu_T * + static mnvmenu_T * menu_getbyname(char_u *name_arg) { char_u *name; char_u *saved_name; - vimmenu_T *menu; + mnvmenu_T *menu; char_u *p; int gave_emsg = FALSE; - saved_name = vim_strsave(name_arg); + saved_name = mnv_strsave(name_arg); if (saved_name == NULL) return NULL; @@ -2493,7 +2493,7 @@ menu_getbyname(char_u *name_arg) menu = menu->children; name = p; } - vim_free(saved_name); + mnv_free(saved_name); if (menu == NULL) { if (!gave_emsg) @@ -2511,11 +2511,11 @@ menu_getbyname(char_u *name_arg) void ex_emenu(exarg_T *eap) { - vimmenu_T *menu; + mnvmenu_T *menu; char_u *arg = eap->arg; int mode_idx = MENU_INDEX_INVALID; - if (arg[0] && VIM_ISWHITE(arg[1])) + if (arg[0] && MNV_ISWHITE(arg[1])) { switch (arg[0]) { @@ -2599,17 +2599,17 @@ winbar_click(win_T *wp, int col) /* * Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy. */ - vimmenu_T * + mnvmenu_T * gui_find_menu(char_u *path_name) { - vimmenu_T *menu = NULL; + mnvmenu_T *menu = NULL; char_u *name; char_u *saved_name; char_u *p; menu = *get_root_menu(path_name); - saved_name = vim_strsave(path_name); + saved_name = mnv_strsave(path_name); if (saved_name == NULL) return NULL; @@ -2650,7 +2650,7 @@ gui_find_menu(char_u *path_name) if (menu == NULL) emsg(_(e_menu_not_found_check_menu_names)); theend: - vim_free(saved_name); + mnv_free(saved_name); return menu; } #endif @@ -2695,9 +2695,9 @@ ex_menutranslate(exarg_T *eap UNUSED) tp = (menutrans_T *)menutrans_ga.ga_data; for (i = 0; i < menutrans_ga.ga_len; ++i) { - vim_free(tp[i].from); - vim_free(tp[i].from_noamp); - vim_free(tp[i].to); + mnv_free(tp[i].from); + mnv_free(tp[i].from_noamp); + mnv_free(tp[i].to); } ga_clear(&menutrans_ga); # ifdef FEAT_EVAL @@ -2722,11 +2722,11 @@ ex_menutranslate(exarg_T *eap UNUSED) if (ga_grow(&menutrans_ga, 1) == OK) { tp = (menutrans_T *)menutrans_ga.ga_data; - from = vim_strsave(from); + from = mnv_strsave(from); if (from != NULL) { from_noamp = menu_text(from, NULL, NULL); - to = vim_strnsave(to, arg - to); + to = mnv_strnsave(to, arg - to); if (from_noamp != NULL && to != NULL) { menu_translate_tab_and_shift(from); @@ -2740,9 +2740,9 @@ ex_menutranslate(exarg_T *eap UNUSED) } else { - vim_free(from); - vim_free(from_noamp); - vim_free(to); + mnv_free(from); + mnv_free(from_noamp); + mnv_free(to); } } } @@ -2758,7 +2758,7 @@ ex_menutranslate(exarg_T *eap UNUSED) static char_u * menu_skip_part(char_u *p) { - while (*p != NUL && *p != '.' && !VIM_ISWHITE(*p)) + while (*p != NUL && *p != '.' && !MNV_ISWHITE(*p)) { if ((*p == '\\' || *p == Ctrl_V) && p[1] != NUL) ++p; @@ -2795,10 +2795,10 @@ menutrans_lookup(char_u *name, int len) for (i = 0; i < menutrans_ga.ga_len; ++i) if (STRICMP(dname, tp[i].from_noamp) == 0) { - vim_free(dname); + mnv_free(dname); return tp[i].to; } - vim_free(dname); + mnv_free(dname); return NULL; } @@ -2826,7 +2826,7 @@ menu_translate_tab_and_shift(char_u *arg_start) { char_u *arg = arg_start; - while (*arg && !VIM_ISWHITE(*arg)) + while (*arg && !MNV_ISWHITE(*arg)) { if ((*arg == '\\' || *arg == Ctrl_V) && arg[1] != NUL) arg++; @@ -2848,7 +2848,7 @@ menu_translate_tab_and_shift(char_u *arg_start) * Get the information about a menu item in mode 'which' */ static int -menuitem_getinfo(char_u *menu_name, vimmenu_T *menu, int modes, dict_T *dict) +menuitem_getinfo(char_u *menu_name, mnvmenu_T *menu, int modes, dict_T *dict) { int status; list_T *l; @@ -2856,7 +2856,7 @@ menuitem_getinfo(char_u *menu_name, vimmenu_T *menu, int modes, dict_T *dict) if (*menu_name == NUL) { // Return all the top-level menus - vimmenu_T *topmenu; + mnvmenu_T *topmenu; l = list_alloc(); if (l == NULL) @@ -2920,7 +2920,7 @@ menuitem_getinfo(char_u *menu_name, vimmenu_T *menu, int modes, dict_T *dict) ? (char_u *)"" : (tofree = str2special_save( menu->strings[bit], FALSE, FALSE))); - vim_free(tofree); + mnv_free(tofree); } if (status == OK) status = dict_add_bool(dict, "noremenu", @@ -2939,7 +2939,7 @@ menuitem_getinfo(char_u *menu_name, vimmenu_T *menu, int modes, dict_T *dict) // If there are submenus, add all the submenu display names if (status == OK && menu->children != NULL) { - vimmenu_T *child; + mnvmenu_T *child; l = list_alloc(); if (l == NULL) @@ -2970,14 +2970,14 @@ f_menu_info(typval_T *argvars, typval_T *rettv) int modes; char_u *saved_name; char_u *name; - vimmenu_T *menu; + mnvmenu_T *menu; dict_T *retdict; if (rettv_dict_alloc(rettv) == FAIL) return; retdict = rettv->vval.v_dict; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_arg(argvars, 0) == FAIL || check_for_opt_string_arg(argvars, 1) == FAIL)) return; @@ -2998,7 +2998,7 @@ f_menu_info(typval_T *argvars, typval_T *rettv) // Locate the specified menu or menu item menu = *get_root_menu(menu_name); - saved_name = vim_strsave(menu_name); + saved_name = mnv_strsave(menu_name); if (saved_name == NULL) return; if (*saved_name != NUL) @@ -3022,7 +3022,7 @@ f_menu_info(typval_T *argvars, typval_T *rettv) name = p; } } - vim_free(saved_name); + mnv_free(saved_name); if (menu == NULL) // specified menu not found return; diff --git a/uvim/src/message.c b/uvim/src/message.c index ac25fe322e..636b0ed389 100644 --- a/uvim/src/message.c +++ b/uvim/src/message.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -13,7 +13,7 @@ #define MESSAGE_FILE // don't include prototype for smsg() -#include "vim.h" +#include "mnv.h" static void add_msg_hist(char_u *s, int len, int attr); static void check_msg_hist(void); @@ -156,7 +156,7 @@ msg_attr_keep( #ifdef FEAT_EVAL if (attr == 0) - set_vim_var_string(VV_STATUSMSG, (char_u *)s, -1); + set_mnv_var_string(VV_STATUSMSG, (char_u *)s, -1); #endif /* @@ -193,13 +193,13 @@ msg_attr_keep( msg_clr_eos(); retval = msg_end(); - if (keep && retval && vim_strsize((char_u *)s) + if (keep && retval && mnv_strsize((char_u *)s) < (int)(Rows - cmdline_row - 1) * cmdline_width + sc_col) set_keep_msg((char_u *)s, 0); need_fileinfo = FALSE; - vim_free(buf); + mnv_free(buf); --entered; return retval; } @@ -221,7 +221,7 @@ msg_strtrunc( if ((!msg_scroll && !need_wait_return && shortmess(SHM_TRUNCALL) && !exmode_active && msg_silent == 0) || force) { - len = vim_strsize(s); + len = mnv_strsize(s); if (msg_scrolled != 0 #ifdef HAS_MESSAGE_WINDOW || in_echowindow @@ -310,7 +310,7 @@ trunc_string( // For DBCS going backwards in a string is slow, but // computing the cell width isn't too slow: go forward // until the rest fits. - n = vim_strsize(s + i); + n = mnv_strsize(s + i); while (len + n > room) { n -= ptr2cells(s + i); @@ -380,7 +380,7 @@ trunc_string( */ #ifndef PROTO -int vim_snprintf(char *str, size_t str_m, const char *fmt, ...); +int mnv_snprintf(char *str, size_t str_m, const char *fmt, ...); int smsg(const char *s, ...) @@ -395,7 +395,7 @@ smsg(const char *s, ...) va_list arglist; va_start(arglist, s); - vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist); + mnv_vsnprintf((char *)IObuff, IOSIZE, s, arglist); va_end(arglist); return msg((char *)IObuff); } @@ -413,7 +413,7 @@ smsg_attr(int attr, const char *s, ...) va_list arglist; va_start(arglist, s); - vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist); + mnv_vsnprintf((char *)IObuff, IOSIZE, s, arglist); va_end(arglist); return msg_attr((char *)IObuff, attr); } @@ -431,7 +431,7 @@ smsg_attr_keep(int attr, const char *s, ...) va_list arglist; va_start(arglist, s); - vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist); + mnv_vsnprintf((char *)IObuff, IOSIZE, s, arglist); va_end(arglist); return msg_attr_keep((char *)IObuff, attr, TRUE); } @@ -452,7 +452,7 @@ static char_u *last_sourcing_name = NULL; void reset_last_sourcing(void) { - VIM_CLEAR(last_sourcing_name); + MNV_CLEAR(last_sourcing_name); last_sourcing_lnum = 0; } @@ -498,7 +498,7 @@ get_emsg_source(void) Buf = alloc(STRLEN(sname) + STRLEN(p)); if (Buf != NULL) sprintf((char *)Buf, (char *)p, sname); - vim_free(tofree); + mnv_free(tofree); return Buf; } return NULL; @@ -551,22 +551,22 @@ msg_source(int attr) { msg_scroll = TRUE; // this will take more than one line msg_attr((char *)p, attr); - vim_free(p); + mnv_free(p); } p = get_emsg_lnum(); if (p != NULL) { msg_attr((char *)p, HL_ATTR(HLF_N)); - vim_free(p); + mnv_free(p); last_sourcing_lnum = SOURCING_LNUM; // only once for each line } // remember the last sourcing name printed, also when it's empty if (SOURCING_NAME == NULL || other_sourcing_name()) { - VIM_CLEAR(last_sourcing_name); + MNV_CLEAR(last_sourcing_name); if (SOURCING_NAME != NULL) - last_sourcing_name = vim_strsave(SOURCING_NAME); + last_sourcing_name = mnv_strsave(SOURCING_NAME); } --no_wait_return; @@ -582,8 +582,8 @@ msg_source(int attr) static int emsg_not_now(void) { - if ((emsg_off > 0 && vim_strchr(p_debug, 'm') == NULL - && vim_strchr(p_debug, 't') == NULL) + if ((emsg_off > 0 && mnv_strchr(p_debug, 'm') == NULL + && mnv_strchr(p_debug, 't') == NULL) #ifdef FEAT_EVAL || emsg_skip > 0 #endif @@ -671,7 +671,7 @@ emsg_core(const char *s) emsg_severe = FALSE; #endif - if (!emsg_off || vim_strchr(p_debug, 't') != NULL) + if (!emsg_off || mnv_strchr(p_debug, 't') != NULL) { #ifdef FEAT_EVAL /* @@ -690,15 +690,15 @@ emsg_core(const char *s) if (in_assert_fails && emsg_assert_fails_msg == NULL) { - emsg_assert_fails_msg = vim_strsave((char_u *)s); + emsg_assert_fails_msg = mnv_strsave((char_u *)s); emsg_assert_fails_lnum = SOURCING_LNUM; - vim_free(emsg_assert_fails_context); - emsg_assert_fails_context = vim_strsave( + mnv_free(emsg_assert_fails_context); + emsg_assert_fails_context = mnv_strsave( SOURCING_NAME == NULL ? (char_u *)"" : SOURCING_NAME); } // set "v:errmsg", also when using ":silent! cmd" - set_vim_var_string(VV_ERRMSG, (char_u *)s, -1); + set_mnv_var_string(VV_ERRMSG, (char_u *)s, -1); #endif /* @@ -718,14 +718,14 @@ emsg_core(const char *s) { STRCAT(p, "\n"); redir_write(p, -1); - vim_free(p); + mnv_free(p); } p = get_emsg_lnum(); if (p != NULL) { STRCAT(p, "\n"); redir_write(p, -1); - vim_free(p); + mnv_free(p); } redir_write((char_u *)s, -1); } @@ -829,7 +829,7 @@ semsg(const char *s, ...) va_list ap; va_start(ap, s); - vim_vsnprintf((char *)IObuff, IOSIZE, s, ap); + mnv_vsnprintf((char *)IObuff, IOSIZE, s, ap); va_end(ap); return emsg_core((char *)IObuff); } @@ -838,7 +838,7 @@ semsg(const char *s, ...) /* * Same as emsg(...), but abort on error when ABORT_ON_INTERNAL_ERROR is * defined. It is used for internal errors only, so that they can be - * detected when fuzzing vim. + * detected when fuzzing mnv. */ void iemsg(char *s) @@ -852,7 +852,7 @@ iemsg(char *s) emsg_core(s); #if defined(ABORT_ON_INTERNAL_ERROR) && defined(FEAT_EVAL) - set_vim_var_string(VV_ERRMSG, (char_u *)s, -1); + set_mnv_var_string(VV_ERRMSG, (char_u *)s, -1); msg_putchar('\n'); // avoid overwriting the error message out_flush(); abort(); @@ -863,7 +863,7 @@ iemsg(char *s) /* * Same as semsg(...) but abort on error when ABORT_ON_INTERNAL_ERROR is * defined. It is used for internal errors only, so that they can be - * detected when fuzzing vim. + * detected when fuzzing mnv. * Note: caller must not pass 'IObuff' as 1st argument. */ void @@ -887,7 +887,7 @@ siemsg(const char *s, ...) va_list ap; va_start(ap, s); - vim_vsnprintf((char *)IObuff, IOSIZE, s, ap); + mnv_vsnprintf((char *)IObuff, IOSIZE, s, ap); va_end(ap); emsg_core((char *)IObuff); } @@ -915,7 +915,7 @@ internal_error(char *where) #if defined(FEAT_EVAL) /* * Like internal_error() but do not call abort(), to avoid tests using - * test_unknown() and test_void() causing Vim to exit. + * test_unknown() and test_void() causing MNV to exit. */ void internal_error_no_abort(char *where) @@ -943,10 +943,10 @@ emsg_invreg(int name) void emsg_namelen(char *msg, char_u *name, int len) { - char_u *copy = vim_strnsave(name, len); + char_u *copy = mnv_strnsave(name, len); semsg(msg, copy == NULL ? "NULL" : (char *)copy); - vim_free(copy); + mnv_free(copy); } #endif @@ -995,7 +995,7 @@ msg_may_trunc(int force, char_u *s) { if (has_mbyte) { - int size = vim_strsize(s); + int size = mnv_strsize(s); // There may be room anyway when there are multibyte chars. if (size <= room) @@ -1040,7 +1040,7 @@ add_msg_hist( } while (len > 0 && s[len - 1] == '\n') --len; - p->msg = vim_strnsave(s, len); + p->msg = mnv_strnsave(s, len); p->next = NULL; p->attr = attr; if (last_msg_hist != NULL) @@ -1068,8 +1068,8 @@ delete_first_msg(void) first_msg_hist = p->next; if (first_msg_hist == NULL) last_msg_hist = NULL; // history is empty - vim_free(p->msg); - vim_free(p); + mnv_free(p->msg); + mnv_free(p); --msg_hist_len; return OK; } @@ -1102,7 +1102,7 @@ messagesopt_changed(void) } else if (STRNCMP(p, MESSAGES_OPT_WAIT, STRLEN_LITERAL(MESSAGES_OPT_WAIT)) == 0 - && VIM_ISDIGIT(p[STRLEN_LITERAL(MESSAGES_OPT_WAIT)])) + && MNV_ISDIGIT(p[STRLEN_LITERAL(MESSAGES_OPT_WAIT)])) { p += STRLEN_LITERAL(MESSAGES_OPT_WAIT); messages_wait_new = getdigits(&p); @@ -1110,7 +1110,7 @@ messagesopt_changed(void) } else if (STRNCMP(p, MESSAGES_OPT_HISTORY, STRLEN_LITERAL(MESSAGES_OPT_HISTORY)) == 0 - && VIM_ISDIGIT(p[STRLEN_LITERAL(MESSAGES_OPT_HISTORY)])) + && MNV_ISDIGIT(p[STRLEN_LITERAL(MESSAGES_OPT_HISTORY)])) { p += STRLEN_LITERAL(MESSAGES_OPT_HISTORY); messages_history_new = getdigits(&p); @@ -1200,7 +1200,7 @@ ex_messages(exarg_T *eap) msg_attr( // Translator: Please replace the name and email address // with the appropriate text for your translation. - _("Messages maintainer: The Vim Project"), + _("Messages maintainer: The MNV Project"), HL_ATTR(HLF_T)); } @@ -1419,7 +1419,7 @@ wait_return(int redraw) if (c == K_LEFTMOUSE || c == K_MIDDLEMOUSE || c == K_RIGHTMOUSE || c == K_X1MOUSE || c == K_X2MOUSE) (void)jump_to_mouse(MOUSE_SETPOS, NULL, 0); - else if (vim_strchr((char_u *)"\r\n ", c) == NULL && c != Ctrl_C + else if (mnv_strchr((char_u *)"\r\n ", c) == NULL && c != Ctrl_C && c != 'q') { // Put the character back in the typeahead buffer. Don't use @@ -1477,9 +1477,9 @@ wait_return(int redraw) emsg_on_display = FALSE; // can delete error message now lines_left = -1; // reset lines_left at next msg_start() reset_last_sourcing(); - if (keep_msg != NULL && vim_strsize(keep_msg) >= + if (keep_msg != NULL && mnv_strsize(keep_msg) >= (Rows - cmdline_row - 1) * cmdline_width + sc_col) - VIM_CLEAR(keep_msg); // don't redisplay message, it's too long + MNV_CLEAR(keep_msg); // don't redisplay message, it's too long if (tmpState == MODE_SETWSIZE) // got resize event while in vgetc() { @@ -1520,9 +1520,9 @@ hit_return_msg(void) void set_keep_msg(char_u *s, int attr) { - vim_free(keep_msg); + mnv_free(keep_msg); if (s != NULL && msg_silent == 0) - keep_msg = vim_strsave(s); + keep_msg = mnv_strsave(s); else keep_msg = NULL; keep_msg_more = FALSE; @@ -1554,7 +1554,7 @@ msg_start(void) if (!msg_silent) { - VIM_CLEAR(keep_msg); + MNV_CLEAR(keep_msg); need_fileinfo = FALSE; } @@ -1681,7 +1681,7 @@ msg_home_replace_attr(char_u *fname, int attr) name = home_replace_save(NULL, fname); if (name != NULL) msg_outtrans_attr(name, attr); - vim_free(name); + mnv_free(name); } /* @@ -1779,7 +1779,7 @@ msg_outtrans_len_attr(char_u *msgstr, int len, int attr) if (has_mbyte && mb_l > 1) { c = (*mb_ptr2char)(str); - if (vim_isprintc(c)) + if (mnv_isprintc(c)) // printable multi-byte char: count the cells. retval += (*mb_ptr2cells)(str); else @@ -1886,7 +1886,7 @@ msg_outtrans_special( if (text[0] != NUL && text[1] == NUL) // single-byte character or illegal byte text = (char *)transchar_byte_buf(NULL, (char_u)text[0]); - len = vim_strsize((char_u *)text); + len = mnv_strsize((char_u *)text); if (maxlen > 0 && retval + len >= maxlen) break; // Highlight special keys @@ -2061,7 +2061,7 @@ msg_prt_line(char_u *s, int list) if (curwin->w_lcs_chars.trail) { trail = s + STRLEN(s); - while (trail > s && VIM_ISWHITE(trail[-1])) + while (trail > s && MNV_ISWHITE(trail[-1])) --trail; } // find end of leading whitespace @@ -2070,7 +2070,7 @@ msg_prt_line(char_u *s, int list) || curwin->w_lcs_chars.leadtab1 != NUL) { lead = s; - while (VIM_ISWHITE(lead[0])) + while (MNV_ISWHITE(lead[0])) lead++; // in a line full of spaces all of them are treated as trailing if (*lead == NUL) @@ -2409,7 +2409,7 @@ put_msg_win(win_T *wp, int where, char_u *t_s, char_u *end, linenr_T lnum) { if (*end != NUL) { - p = vim_strnsave(t_s, end - t_s); + p = mnv_strnsave(t_s, end - t_s); if (p == NULL) return; } @@ -2417,7 +2417,7 @@ put_msg_win(win_T *wp, int where, char_u *t_s, char_u *end, linenr_T lnum) p = t_s; ml_append_buf(wp->w_buffer, lnum, p, (colnr_T)0, FALSE); if (p != t_s) - vim_free(p); + mnv_free(p); } else { @@ -2434,7 +2434,7 @@ put_msg_win(win_T *wp, int where, char_u *t_s, char_u *end, linenr_T lnum) } else { - newp = vim_strnsave(t_s, end - t_s); + newp = mnv_strnsave(t_s, end - t_s); if (newp == NULL) return; } @@ -2723,7 +2723,7 @@ msg_puts_display( while (msg_col & 7); } else if (*s == BELL) // beep (from ":sh") - vim_beep(BO_SH); + mnv_beep(BO_SH); else { if (has_mbyte) @@ -2800,7 +2800,7 @@ message_filtered(char_u *msg) if (cmdmod.cmod_filter_regmatch.regprog == NULL) return FALSE; - match = vim_regexec(&cmdmod.cmod_filter_regmatch, msg, (colnr_T)0); + match = mnv_regexec(&cmdmod.cmod_filter_regmatch, msg, (colnr_T)0); return cmdmod.cmod_filter_force ? match : !match; } @@ -2849,7 +2849,7 @@ msg_scroll_up(void) inc_msg_scrolled(void) { #ifdef FEAT_EVAL - if (*get_vim_var_str(VV_SCROLLSTART) == NUL) + if (*get_mnv_var_str(VV_SCROLLSTART) == NUL) { string_T p = {SOURCING_NAME, 0}; char_u *tofree = NULL; @@ -2869,13 +2869,13 @@ inc_msg_scrolled(void) tofree = alloc(tofreesize); if (tofree != NULL) { - p.length = vim_snprintf_safelen((char *)tofree, tofreesize, + p.length = mnv_snprintf_safelen((char *)tofree, tofreesize, _("%s line %ld"), p.string, (long)SOURCING_LNUM); p.string = tofree; } } - set_vim_var_string(VV_SCROLLSTART, p.string, (int)p.length); - vim_free(tofree); + set_mnv_var_string(VV_SCROLLSTART, p.string, (int)p.length); + mnv_free(tofree); } #endif ++msg_scrolled; @@ -2940,7 +2940,7 @@ store_sb_text( mp->sb_eol = finish; mp->sb_msg_col = *sb_col; mp->sb_attr = attr; - vim_strncpy(mp->sb_text, *sb_str, s - *sb_str); + mnv_strncpy(mp->sb_text, *sb_str, s - *sb_str); if (last_msgchunk == NULL) { @@ -3013,7 +3013,7 @@ sb_text_restart_cmdline(void) { msgchunk_T *tofree_next = tofree->sb_next; - vim_free(tofree); + mnv_free(tofree); tofree = tofree_next; } } @@ -3050,7 +3050,7 @@ clear_sb_text(int all) while (*lastp != NULL) { mp = (*lastp)->sb_prev; - vim_free(*lastp); + mnv_free(*lastp); *lastp = mp; } } @@ -3067,7 +3067,7 @@ show_sb_text(void) // weird, typing a command without output results in one line. mp = msg_sb_start(last_msgchunk); if (mp == NULL || mp->sb_prev == NULL) - vim_beep(BO_MESS); + mnv_beep(BO_MESS); else { do_more_prompt('G'); @@ -3171,8 +3171,8 @@ t_puts( msg_use_printf(void) { return (!msg_check_screen() -#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) -# ifdef VIMDLL +#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)) +# ifdef MNVDLL || (!gui.in_use && !termcap_active) # else || !termcap_active @@ -3217,7 +3217,7 @@ msg_puts_printf(char_u *str, int maxlen) mch_msg((char *)buf); else mch_errmsg((char *)buf); - vim_free(buf); + mnv_free(buf); } p = s + 1; } @@ -3247,10 +3247,10 @@ msg_puts_printf(char_u *str, int maxlen) { char_u *tofree = NULL; - if (maxlen > 0 && vim_strlen_maxlen((char *)p, (size_t)maxlen) + if (maxlen > 0 && mnv_strlen_maxlen((char *)p, (size_t)maxlen) >= (size_t)maxlen) { - tofree = vim_strnsave(p, (size_t)maxlen); + tofree = mnv_strnsave(p, (size_t)maxlen); p = tofree; } if (p != NULL) @@ -3259,7 +3259,7 @@ msg_puts_printf(char_u *str, int maxlen) mch_msg((char *)p); else mch_errmsg((char *)p); - vim_free(tofree); + mnv_free(tofree); } } @@ -3562,7 +3562,7 @@ do_more_prompt(int typed_char) # undef mch_msg # endif -# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)) static void mch_errmsg_c(char *str) { @@ -3579,7 +3579,7 @@ mch_errmsg_c(char *str) if (w != NULL) { WriteConsoleW(h, w, len, &nwrite, NULL); - vim_free(w); + mnv_free(w); } } else @@ -3601,7 +3601,7 @@ mch_errmsg(char *str) int len; # endif -# if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) && !defined(VIMDLL) +# if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) && !defined(MNVDLL) // On Unix use stderr if it's a tty. // When not going to start the GUI also use stderr. // On Mac, when started from Finder, stderr is the console. @@ -3626,8 +3626,8 @@ mch_errmsg(char *str) } # endif -# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) -# ifdef VIMDLL +# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)) +# ifdef MNVDLL if (!(gui.in_use || gui.starting)) # endif { @@ -3658,7 +3658,7 @@ mch_errmsg(char *str) p = (char_u *)error_ga.ga_data + error_ga.ga_len; for (;;) { - p = vim_strchr(p, '\r'); + p = mnv_strchr(p, '\r'); if (p == NULL) break; *p = ' '; @@ -3671,7 +3671,7 @@ mch_errmsg(char *str) # endif } -# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)) static void mch_msg_c(char *str) { @@ -3688,7 +3688,7 @@ mch_msg_c(char *str) if (w != NULL) { WriteConsoleW(h, w, len, &nwrite, NULL); - vim_free(w); + mnv_free(w); } } else @@ -3706,8 +3706,8 @@ mch_msg_c(char *str) void mch_msg(char *str) { -# if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) && !defined(VIMDLL) - // On Unix use stdout if we have a tty. This allows "vim -h | more" and +# if (defined(UNIX) || defined(FEAT_GUI)) && !defined(ALWAYS_USE_GUI) && !defined(MNVDLL) + // On Unix use stdout if we have a tty. This allows "mnv -h | more" and // uses mch_errmsg() when started from the desktop. // When not going to start the GUI also use stdout. // On Mac, when started from Finder, stderr is the console. @@ -3732,8 +3732,8 @@ mch_msg(char *str) } # endif -# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) -# ifdef VIMDLL +# if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)) +# ifdef MNVDLL if (!(gui.in_use || gui.starting)) # endif { @@ -3787,7 +3787,7 @@ msg_moremsg(int full) if (full) screen_puts((char_u *) _(" SPACE/d/j: screen/page/line down, b/u/k: up, q: quit "), - (int)Rows - 1, cmdline_col_off + vim_strsize(s), attr); + (int)Rows - 1, cmdline_col_off + mnv_strsize(s), attr); } /* @@ -4155,9 +4155,9 @@ give_warning_with_source(char_u *message, int hl, int with_source) ++no_wait_return; #ifdef FEAT_EVAL - set_vim_var_string(VV_WARNINGMSG, message, -1); + set_mnv_var_string(VV_WARNINGMSG, message, -1); #endif - VIM_CLEAR(keep_msg); + MNV_CLEAR(keep_msg); if (hl) keep_msg_attr = HL_ATTR(HLF_W); else @@ -4196,7 +4196,7 @@ give_warning2(char_u *message, char_u *a1, int hl) } else { - vim_snprintf((char *)IObuff, IOSIZE, (char *)message, a1); + mnv_snprintf((char *)IObuff, IOSIZE, (char *)message, a1); give_warning(IObuff, hl); } } @@ -4249,7 +4249,7 @@ msg_warn_missing_clipboard(void) * versions, get this generic handler which uses the command line. * * type = one of: - * VIM_QUESTION, VIM_INFO, VIM_WARNING, VIM_ERROR or VIM_GENERIC + * MNV_QUESTION, MNV_INFO, MNV_WARNING, MNV_ERROR or MNV_GENERIC * title = title string (can be NULL for default) * (neither used in console dialogs at the moment) * @@ -4290,7 +4290,7 @@ do_dialog( # ifdef FEAT_GUI_DIALOG // When GUI is running and 'c' not in 'guioptions', use the GUI dialog - if (gui.in_use && vim_strchr(p_go, GO_CONDIALOG) == NULL) + if (gui.in_use && mnv_strchr(p_go, GO_CONDIALOG) == NULL) { // --gui-dialog-file: write text to a file if (gui_dialog_log(title, message)) @@ -4377,7 +4377,7 @@ do_dialog( break; } - vim_free(hotkeys); + mnv_free(hotkeys); } settmode(save_tmode); @@ -4556,7 +4556,7 @@ msg_show_console_dialog( /* * Now allocate and load the strings */ - vim_free(confirm_msg); + mnv_free(confirm_msg); confirm_msg = alloc(len); if (confirm_msg == NULL) return NULL; @@ -4604,7 +4604,7 @@ display_confirm_msg(void) #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG) int -vim_dialog_yesno( +mnv_dialog_yesno( int type, char_u *title, char_u *message, @@ -4614,12 +4614,12 @@ vim_dialog_yesno( title == NULL ? (char_u *)_("Question") : title, message, (char_u *)_("&Yes\n&No"), dflt, NULL, FALSE) == 1) - return VIM_YES; - return VIM_NO; + return MNV_YES; + return MNV_NO; } int -vim_dialog_yesnocancel( +mnv_dialog_yesnocancel( int type, char_u *title, char_u *message, @@ -4630,14 +4630,14 @@ vim_dialog_yesnocancel( message, (char_u *)_("&Yes\n&No\n&Cancel"), dflt, NULL, FALSE)) { - case 1: return VIM_YES; - case 2: return VIM_NO; + case 1: return MNV_YES; + case 2: return MNV_NO; } - return VIM_CANCEL; + return MNV_CANCEL; } int -vim_dialog_yesnoallcancel( +mnv_dialog_yesnoallcancel( int type, char_u *title, char_u *message, @@ -4649,12 +4649,12 @@ vim_dialog_yesnoallcancel( (char_u *)_("&Yes\n&No\nSave &All\n&Discard All\n&Cancel"), dflt, NULL, FALSE)) { - case 1: return VIM_YES; - case 2: return VIM_NO; - case 3: return VIM_ALL; - case 4: return VIM_DISCARDALL; + case 1: return MNV_YES; + case 2: return MNV_NO; + case 3: return MNV_ALL; + case 4: return MNV_DISCARDALL; } - return VIM_CANCEL; + return MNV_CANCEL; } #endif // FEAT_GUI_DIALOG || FEAT_CON_DIALOG diff --git a/uvim/src/message_test.c b/uvim/src/message_test.c index 884a7a9ceb..fd7f279f26 100644 --- a/uvim/src/message_test.c +++ b/uvim/src/message_test.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -15,7 +15,7 @@ #include // Must include main.c because it contains much more than just main() -#define NO_VIM_MAIN +#define NO_MNV_MAIN #include "main.c" // This file has to be included because some of the tested functions are @@ -34,7 +34,7 @@ // - warning: format ‘%S’ expects argument of type ‘wchar_t *’, but argument 4 has type ‘char *’ // - warning: unknown conversion type character ‘b’ in format // -// These formats are in practise only used from Vim script printf() +// These formats are in practise only used from MNV script printf() // function and never as literals in C code. char *fmt_012p = "%012p"; char *fmt_5S = "%5S"; @@ -60,68 +60,68 @@ test_trunc_string(void) buf = alloc(1); trunc_string((char_u *)"", buf, 1, 1); assert(buf[0] == NUL); - vim_free(buf); + mnv_free(buf); // in place buf = alloc(40); STRCPY(buf, "text"); trunc_string(buf, buf, 20, 40); assert(STRCMP(buf, "text") == 0); - vim_free(buf); + mnv_free(buf); buf = alloc(40); STRCPY(buf, "a short text"); trunc_string(buf, buf, 20, 40); assert(STRCMP(buf, "a short text") == 0); - vim_free(buf); + mnv_free(buf); buf = alloc(40); STRCPY(buf, "a text tha just fits"); trunc_string(buf, buf, 20, 40); assert(STRCMP(buf, "a text tha just fits") == 0); - vim_free(buf); + mnv_free(buf); buf = alloc(40); STRCPY(buf, "a text that nott fits"); trunc_string(buf, buf, 20, 40); assert(STRCMP(buf, "a text t...nott fits") == 0); - vim_free(buf); + mnv_free(buf); // copy from string to buf buf = alloc(40); - s = vim_strsave((char_u *)"text"); + s = mnv_strsave((char_u *)"text"); trunc_string(s, buf, 20, 40); assert(STRCMP(buf, "text") == 0); - vim_free(buf); - vim_free(s); + mnv_free(buf); + mnv_free(s); buf = alloc(40); - s = vim_strsave((char_u *)"a text that fits"); + s = mnv_strsave((char_u *)"a text that fits"); trunc_string(s, buf, 34, 40); assert(STRCMP(buf, "a text that fits") == 0); - vim_free(buf); - vim_free(s); + mnv_free(buf); + mnv_free(s); buf = alloc(40); - s = vim_strsave((char_u *)"a short text"); + s = mnv_strsave((char_u *)"a short text"); trunc_string(s, buf, 20, 40); assert(STRCMP(buf, "a short text") == 0); - vim_free(buf); - vim_free(s); + mnv_free(buf); + mnv_free(s); buf = alloc(40); - s = vim_strsave((char_u *)"a text tha just fits"); + s = mnv_strsave((char_u *)"a text tha just fits"); trunc_string(s, buf, 20, 40); assert(STRCMP(buf, "a text tha just fits") == 0); - vim_free(buf); - vim_free(s); + mnv_free(buf); + mnv_free(s); buf = alloc(40); - s = vim_strsave((char_u *)"a text that nott fits"); + s = mnv_strsave((char_u *)"a text that nott fits"); trunc_string(s, buf, 20, 40); assert(STRCMP(buf, "a text t...nott fits") == 0); - vim_free(buf); - vim_free(s); + mnv_free(buf); + mnv_free(s); } /* @@ -134,39 +134,39 @@ test_trunc_string_mbyte(void) char_u *s; buf = alloc(40); - s = vim_strsave((char_u *)"Ä text tha just fits"); + s = mnv_strsave((char_u *)"Ä text tha just fits"); trunc_string(s, buf, 20, 40); assert(STRCMP(buf, "Ä text tha just fits") == 0); - vim_free(buf); - vim_free(s); + mnv_free(buf); + mnv_free(s); buf = alloc(40); - s = vim_strsave((char_u *)"a text ÄÖÜä nott fits"); + s = mnv_strsave((char_u *)"a text ÄÖÜä nott fits"); trunc_string(s, buf, 20, 40); assert(STRCMP(buf, "a text Ä...nott fits") == 0); - vim_free(buf); - vim_free(s); + mnv_free(buf); + mnv_free(s); buf = alloc(40); - s = vim_strsave((char_u *)"a text that not fitsÄ"); + s = mnv_strsave((char_u *)"a text that not fitsÄ"); trunc_string(s, buf, 20, 40); assert(STRCMP(buf, "a text t...not fitsÄ") == 0); - vim_free(buf); - vim_free(s); + mnv_free(buf); + mnv_free(s); } /* - * Test vim_snprintf() with a focus on checking that truncation is + * Test mnv_snprintf() with a focus on checking that truncation is * correct when buffer is small, since it cannot be tested from - * Vim script tests. Check that: + * MNV script tests. Check that: * - no buffer overflows happens (with valgrind or asan) * - output string is always NUL terminated. * - * Not all formats of vim_snprintf() are checked here. They are - * checked more exhaustively in Test_printf*() Vim script tests. + * Not all formats of mnv_snprintf() are checked here. They are + * checked more exhaustively in Test_printf*() MNV script tests. */ static void -test_vim_snprintf(void) +test_mnv_snprintf(void) { int n; size_t bsize; @@ -174,7 +174,7 @@ test_vim_snprintf(void) void *ptr = (void *)0x87654321; // Loop on various buffer sizes to make sure that truncation of - // vim_snprintf() is correct. + // mnv_snprintf() is correct. for (bsize = 0; bsize < 15; ++bsize) { bsize_int = (int)bsize - 1; @@ -185,112 +185,112 @@ test_vim_snprintf(void) // buffer and its content should then never be used. char *buf = malloc(bsize); - n = vim_snprintf(buf, bsize, "%.8g", 10000000.1); + n = mnv_snprintf(buf, bsize, "%.8g", 10000000.1); assert(n == 12); assert(bsize == 0 || STRNCMP(buf, "1.00000001e7", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%d", 1234567); + n = mnv_snprintf(buf, bsize, "%d", 1234567); assert(n == 7); assert(bsize == 0 || STRNCMP(buf, "1234567", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%ld", 1234567L); + n = mnv_snprintf(buf, bsize, "%ld", 1234567L); assert(n == 7); assert(bsize == 0 || STRNCMP(buf, "1234567", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%9ld", 1234567L); + n = mnv_snprintf(buf, bsize, "%9ld", 1234567L); assert(n == 9); assert(bsize == 0 || STRNCMP(buf, " 1234567", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%-9ld", 1234567L); + n = mnv_snprintf(buf, bsize, "%-9ld", 1234567L); assert(n == 9); assert(bsize == 0 || STRNCMP(buf, "1234567 ", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%x", 0xdeadbeef); + n = mnv_snprintf(buf, bsize, "%x", 0xdeadbeef); assert(n == 8); assert(bsize == 0 || STRNCMP(buf, "deadbeef", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, fmt_06b, (uvarnumber_T)12); + n = mnv_snprintf(buf, bsize, fmt_06b, (uvarnumber_T)12); assert(n == 6); assert(bsize == 0 || STRNCMP(buf, "001100", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%s %s", "one", "two"); + n = mnv_snprintf(buf, bsize, "%s %s", "one", "two"); assert(n == 7); assert(bsize == 0 || STRNCMP(buf, "one two", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%f", 1.234); + n = mnv_snprintf(buf, bsize, "%f", 1.234); assert(n == 8); assert(bsize == 0 || STRNCMP(buf, "1.234000", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%e", 1.234); + n = mnv_snprintf(buf, bsize, "%e", 1.234); assert(n == 12); assert(bsize == 0 || STRNCMP(buf, "1.234000e+00", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%f", 0.0/0.0); + n = mnv_snprintf(buf, bsize, "%f", 0.0/0.0); assert(n == 3); assert(bsize == 0 || STRNCMP(buf, "nan", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%f", 1.0/0.0); + n = mnv_snprintf(buf, bsize, "%f", 1.0/0.0); assert(n == 3); assert(bsize == 0 || STRNCMP(buf, "inf", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%f", -1.0/0.0); + n = mnv_snprintf(buf, bsize, "%f", -1.0/0.0); assert(n == 4); assert(bsize == 0 || STRNCMP(buf, "-inf", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%f", -0.0); + n = mnv_snprintf(buf, bsize, "%f", -0.0); assert(n == 9); assert(bsize == 0 || STRNCMP(buf, "-0.000000", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%s", "漢語"); + n = mnv_snprintf(buf, bsize, "%s", "漢語"); assert(n == 6); assert(bsize == 0 || STRNCMP(buf, "漢語", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%8s", "漢語"); + n = mnv_snprintf(buf, bsize, "%8s", "漢語"); assert(n == 8); assert(bsize == 0 || STRNCMP(buf, " 漢語", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%-8s", "漢語"); + n = mnv_snprintf(buf, bsize, "%-8s", "漢語"); assert(n == 8); assert(bsize == 0 || STRNCMP(buf, "漢語 ", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%.3s", "漢語"); + n = mnv_snprintf(buf, bsize, "%.3s", "漢語"); assert(n == 3); assert(bsize == 0 || STRNCMP(buf, "æ¼¢", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, fmt_5S, "foo"); + n = mnv_snprintf(buf, bsize, fmt_5S, "foo"); assert(n == 5); assert(bsize == 0 || STRNCMP(buf, " foo", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%%%%%%"); + n = mnv_snprintf(buf, bsize, "%%%%%%"); assert(n == 3); assert(bsize == 0 || STRNCMP(buf, "%%%", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%c%c", 1, 2); + n = mnv_snprintf(buf, bsize, "%c%c", 1, 2); assert(n == 2); assert(bsize == 0 || STRNCMP(buf, "\x01\x02", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - // %p format is not tested in Vim script tests Test_printf*() + // %p format is not tested in MNV script tests Test_printf*() // as it only makes sense in C code. // NOTE: SunOS libc doesn't use the prefix "0x" on %p. #ifdef SUN_SYSTEM @@ -302,13 +302,13 @@ test_vim_snprintf(void) # define PREFIX_STR1 "0x" # define PREFIX_STR2 "0x" #endif - n = vim_snprintf(buf, bsize, "%p", ptr); + n = mnv_snprintf(buf, bsize, "%p", ptr); assert(n == 8 + PREFIX_LEN); assert(bsize == 0 || STRNCMP(buf, PREFIX_STR1 "87654321", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, fmt_012p, ptr); + n = mnv_snprintf(buf, bsize, fmt_012p, ptr); assert(n == 12); assert(bsize == 0 || STRNCMP(buf, PREFIX_STR2 "0087654321", bsize_int) == 0); @@ -319,18 +319,18 @@ test_vim_snprintf(void) } /* - * Test vim_snprintf() with a focus on checking that positional + * Test mnv_snprintf() with a focus on checking that positional * arguments are correctly applied and skipped */ static void -test_vim_snprintf_positional(void) +test_mnv_snprintf_positional(void) { int n; size_t bsize; int bsize_int; // Loop on various buffer sizes to make sure that truncation of - // vim_snprintf() is correct. + // mnv_snprintf() is correct. for (bsize = 0; bsize < 25; ++bsize) { bsize_int = (int)bsize - 1; @@ -341,158 +341,158 @@ test_vim_snprintf_positional(void) // buffer and its content should then never be used. char *buf = malloc(bsize); - n = vim_snprintf(buf, bsize, "%1$*2$ld", 1234567L, -9); + n = mnv_snprintf(buf, bsize, "%1$*2$ld", 1234567L, -9); assert(n == 9); assert(bsize == 0 || STRNCMP(buf, "1234567 ", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%1$*2$.*3$ld", 1234567L, -9, 5); + n = mnv_snprintf(buf, bsize, "%1$*2$.*3$ld", 1234567L, -9, 5); assert(n == 9); assert(bsize == 0 || STRNCMP(buf, "1234567 ", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%1$*3$.*2$ld", 1234567L, 5, -9); + n = mnv_snprintf(buf, bsize, "%1$*3$.*2$ld", 1234567L, 5, -9); assert(n == 9); assert(bsize == 0 || STRNCMP(buf, "1234567 ", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%3$*1$.*2$ld", -9, 5, 1234567L); + n = mnv_snprintf(buf, bsize, "%3$*1$.*2$ld", -9, 5, 1234567L); assert(n == 9); assert(bsize == 0 || STRNCMP(buf, "1234567 ", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%1$ld", 1234567L); + n = mnv_snprintf(buf, bsize, "%1$ld", 1234567L); assert(n == 7); assert(bsize == 0 || STRNCMP(buf, "1234567", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%1$*2$ld", 1234567L, 9); + n = mnv_snprintf(buf, bsize, "%1$*2$ld", 1234567L, 9); assert(n == 9); assert(bsize == 0 || STRNCMP(buf, " 1234567", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%2$ld %1$d %3$lu", 12345, 9L, 7654321UL); + n = mnv_snprintf(buf, bsize, "%2$ld %1$d %3$lu", 12345, 9L, 7654321UL); assert(n == 15); assert(bsize == 0 || STRNCMP(buf, "9 12345 7654321", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%2$d %1$ld %3$lu", 1234567L, 9, 7654321UL); + n = mnv_snprintf(buf, bsize, "%2$d %1$ld %3$lu", 1234567L, 9, 7654321UL); assert(n == 17); assert(bsize == 0 || STRNCMP(buf, "9 1234567 7654321", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%2$d %1$lld %3$lu", 1234567LL, 9, 7654321UL); + n = mnv_snprintf(buf, bsize, "%2$d %1$lld %3$lu", 1234567LL, 9, 7654321UL); assert(n == 17); assert(bsize == 0 || STRNCMP(buf, "9 1234567 7654321", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%2$ld %1$u %3$lu", 12345U, 9L, 7654321UL); + n = mnv_snprintf(buf, bsize, "%2$ld %1$u %3$lu", 12345U, 9L, 7654321UL); assert(n == 15); assert(bsize == 0 || STRNCMP(buf, "9 12345 7654321", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%2$d %1$lu %3$lu", 1234567UL, 9, 7654321UL); + n = mnv_snprintf(buf, bsize, "%2$d %1$lu %3$lu", 1234567UL, 9, 7654321UL); assert(n == 17); assert(bsize == 0 || STRNCMP(buf, "9 1234567 7654321", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%2$d %1$llu %3$lu", 1234567LLU, 9, 7654321UL); + n = mnv_snprintf(buf, bsize, "%2$d %1$llu %3$lu", 1234567LLU, 9, 7654321UL); assert(n == 17); assert(bsize == 0 || STRNCMP(buf, "9 1234567 7654321", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%2$d %1$x %3$lu", 0xdeadbeef, 9, 7654321UL); + n = mnv_snprintf(buf, bsize, "%2$d %1$x %3$lu", 0xdeadbeef, 9, 7654321UL); assert(n == 18); assert(bsize == 0 || STRNCMP(buf, "9 deadbeef 7654321", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%2$ld %1$c %3$lu", 'c', 9L, 7654321UL); + n = mnv_snprintf(buf, bsize, "%2$ld %1$c %3$lu", 'c', 9L, 7654321UL); assert(n == 11); assert(bsize == 0 || STRNCMP(buf, "9 c 7654321", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%2$ld %1$s %3$lu", "hi", 9L, 7654321UL); + n = mnv_snprintf(buf, bsize, "%2$ld %1$s %3$lu", "hi", 9L, 7654321UL); assert(n == 12); assert(bsize == 0 || STRNCMP(buf, "9 hi 7654321", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%2$ld %1$e %3$lu", 0.0, 9L, 7654321UL); + n = mnv_snprintf(buf, bsize, "%2$ld %1$e %3$lu", 0.0, 9L, 7654321UL); assert(n == 22); assert(bsize == 0 || STRNCMP(buf, "9 0.000000e+00 7654321", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, fmt_212s, "one", "two", "three"); + n = mnv_snprintf(buf, bsize, fmt_212s, "one", "two", "three"); assert(n == 11); assert(bsize == 0 || STRNCMP(buf, "two one two", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%3$s %1$s %2$s", "one", "two", "three"); + n = mnv_snprintf(buf, bsize, "%3$s %1$s %2$s", "one", "two", "three"); assert(n == 13); assert(bsize == 0 || STRNCMP(buf, "three one two", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%1$d", 1234567); + n = mnv_snprintf(buf, bsize, "%1$d", 1234567); assert(n == 7); assert(bsize == 0 || STRNCMP(buf, "1234567", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%1$x", 0xdeadbeef); + n = mnv_snprintf(buf, bsize, "%1$x", 0xdeadbeef); assert(n == 8); assert(bsize == 0 || STRNCMP(buf, "deadbeef", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, fmt_06pb2, 6, (uvarnumber_T)12); + n = mnv_snprintf(buf, bsize, fmt_06pb2, 6, (uvarnumber_T)12); assert(n == 6); assert(bsize == 0 || STRNCMP(buf, "001100", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, fmt_06pb, (uvarnumber_T)12, 6); + n = mnv_snprintf(buf, bsize, fmt_06pb, (uvarnumber_T)12, 6); assert(n == 6); assert(bsize == 0 || STRNCMP(buf, "001100", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%1$s %2$s", "one", "two"); + n = mnv_snprintf(buf, bsize, "%1$s %2$s", "one", "two"); assert(n == 7); assert(bsize == 0 || STRNCMP(buf, "one two", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, fmt_06b, (uvarnumber_T)12); + n = mnv_snprintf(buf, bsize, fmt_06b, (uvarnumber_T)12); assert(n == 6); assert(bsize == 0 || STRNCMP(buf, "001100", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, fmt_21s, "one", "two", "three"); + n = mnv_snprintf(buf, bsize, fmt_21s, "one", "two", "three"); assert(n == 7); assert(bsize == 0 || STRNCMP(buf, "two one", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); #ifdef FEAT_FLOAT - n = vim_snprintf(buf, bsize, "%1$f", 1.234); + n = mnv_snprintf(buf, bsize, "%1$f", 1.234); assert(n == 8); assert(bsize == 0 || STRNCMP(buf, "1.234000", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%1$e", 1.234); + n = mnv_snprintf(buf, bsize, "%1$e", 1.234); assert(n == 12); assert(bsize == 0 || STRNCMP(buf, "1.234000e+00", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%1$f", 0.0/0.0); + n = mnv_snprintf(buf, bsize, "%1$f", 0.0/0.0); assert(n == 3); assert(bsize == 0 || STRNCMP(buf, "nan", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%1$f", 1.0/0.0); + n = mnv_snprintf(buf, bsize, "%1$f", 1.0/0.0); assert(n == 3); assert(bsize == 0 || STRNCMP(buf, "inf", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%1$f", -1.0/0.0); + n = mnv_snprintf(buf, bsize, "%1$f", -1.0/0.0); assert(n == 4); assert(bsize == 0 || STRNCMP(buf, "-inf", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); - n = vim_snprintf(buf, bsize, "%1$f", -0.0); + n = mnv_snprintf(buf, bsize, "%1$f", -0.0); assert(n == 9); assert(bsize == 0 || STRNCMP(buf, "-0.000000", bsize_int) == 0); assert(bsize == 0 || buf[MIN(n, bsize_int)] == '\0'); @@ -515,14 +515,14 @@ main(int argc, char **argv) init_chartab(); test_trunc_string(); test_trunc_string_mbyte(); - test_vim_snprintf(); - test_vim_snprintf_positional(); + test_mnv_snprintf(); + test_mnv_snprintf_positional(); set_option_value_give_err((char_u *)"encoding", 0, (char_u *)"latin1", 0); init_chartab(); test_trunc_string(); - test_vim_snprintf(); - test_vim_snprintf_positional(); + test_mnv_snprintf(); + test_mnv_snprintf_positional(); return 0; } diff --git a/uvim/src/misc1.c b/uvim/src/misc1.c index 8a951298b9..d4cd26baf1 100644 --- a/uvim/src/misc1.c +++ b/uvim/src/misc1.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * misc1.c: functions that didn't seem to fit elsewhere */ -#include "vim.h" +#include "mnv.h" #include "version.h" #if defined(__HAIKU__) @@ -57,7 +57,7 @@ get_leader_len( char_u *saved_flags = NULL; result = i = 0; - while (VIM_ISWHITE(line[i])) // leading white space is ignored + while (MNV_ISWHITE(line[i])) // leading white space is ignored ++i; /* @@ -77,7 +77,7 @@ get_leader_len( *flags = list; // remember where flags started prev_list = list; (void)copy_option_part(&list, part_buf, COM_MAX_LEN, ","); - string = vim_strchr(part_buf, ':'); + string = mnv_strchr(part_buf, ':'); if (string == NULL) // missing ':', ignore this part continue; *string++ = NUL; // isolate flags from string @@ -85,28 +85,28 @@ get_leader_len( // If we found a middle match previously, use that match when this // is not a middle or end. if (middle_match_len != 0 - && vim_strchr(part_buf, COM_MIDDLE) == NULL - && vim_strchr(part_buf, COM_END) == NULL) + && mnv_strchr(part_buf, COM_MIDDLE) == NULL + && mnv_strchr(part_buf, COM_END) == NULL) break; // When we already found a nested comment, only accept further // nested comments. - if (got_com && vim_strchr(part_buf, COM_NEST) == NULL) + if (got_com && mnv_strchr(part_buf, COM_NEST) == NULL) continue; // When 'O' flag present and using "O" command skip this one. - if (backward && vim_strchr(part_buf, COM_NOBACK) != NULL) + if (backward && mnv_strchr(part_buf, COM_NOBACK) != NULL) continue; // Line contents and string must match. // When string starts with white space, must have some white space // (but the amount does not need to match, there might be a mix of // TABs and spaces). - if (VIM_ISWHITE(string[0])) + if (MNV_ISWHITE(string[0])) { - if (i == 0 || !VIM_ISWHITE(line[i - 1])) + if (i == 0 || !MNV_ISWHITE(line[i - 1])) continue; // missing white space - while (VIM_ISWHITE(string[0])) + while (MNV_ISWHITE(string[0])) ++string; } for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j) @@ -116,8 +116,8 @@ get_leader_len( // When 'b' flag used, there must be white space or an // end-of-line after the string in the line. - if (vim_strchr(part_buf, COM_BLANK) != NULL - && !VIM_ISWHITE(line[i + j]) && line[i + j] != NUL) + if (mnv_strchr(part_buf, COM_BLANK) != NULL + && !MNV_ISWHITE(line[i + j]) && line[i + j] != NUL) continue; // We have found a match, stop searching unless this is a middle @@ -125,7 +125,7 @@ get_leader_len( // comment in which case it's better to return the length of the // end comment and its flags. Thus we keep searching with middle // and end matches and use an end match if it matches better. - if (vim_strchr(part_buf, COM_MIDDLE) != NULL) + if (mnv_strchr(part_buf, COM_MIDDLE) != NULL) { if (middle_match_len == 0) { @@ -162,7 +162,7 @@ get_leader_len( result = i; // Include any trailing white space. - while (VIM_ISWHITE(line[i])) + while (MNV_ISWHITE(line[i])) ++i; if (include_space) @@ -170,7 +170,7 @@ get_leader_len( // If this comment doesn't nest, stop here. got_com = TRUE; - if (vim_strchr(part_buf, COM_NEST) == NULL) + if (mnv_strchr(part_buf, COM_NEST) == NULL) break; } return result; @@ -215,7 +215,7 @@ get_last_leader_offset(char_u *line, char_u **flags) * put string at start of string. */ (void)copy_option_part(&list, part_buf, COM_MAX_LEN, ","); - string = vim_strchr(part_buf, ':'); + string = mnv_strchr(part_buf, ':'); if (string == NULL) // If everything is fine, this cannot actually // happen. continue; @@ -228,11 +228,11 @@ get_last_leader_offset(char_u *line, char_u **flags) * (but the amount does not need to match, there might be a mix of * TABs and spaces). */ - if (VIM_ISWHITE(string[0])) + if (MNV_ISWHITE(string[0])) { - if (i == 0 || !VIM_ISWHITE(line[i - 1])) + if (i == 0 || !MNV_ISWHITE(line[i - 1])) continue; - while (VIM_ISWHITE(*string)) + while (MNV_ISWHITE(*string)) ++string; } for (j = 0; string[j] != NUL && string[j] == line[i + j]; ++j) @@ -244,18 +244,18 @@ get_last_leader_offset(char_u *line, char_u **flags) * When 'b' flag used, there must be white space or an * end-of-line after the string in the line. */ - if (vim_strchr(part_buf, COM_BLANK) != NULL - && !VIM_ISWHITE(line[i + j]) && line[i + j] != NUL) + if (mnv_strchr(part_buf, COM_BLANK) != NULL + && !MNV_ISWHITE(line[i + j]) && line[i + j] != NUL) continue; - if (vim_strchr(part_buf, COM_MIDDLE) != NULL) + if (mnv_strchr(part_buf, COM_MIDDLE) != NULL) { // For a middlepart comment, only consider it to match if // everything before the current position in the line is // whitespace. Otherwise we would think we are inside a // comment if the middle part appears somewhere in the middle // of the line. E.g. for C the "*" appears often. - for (j = 0; VIM_ISWHITE(line[j]) && j <= i; j++) + for (j = 0; MNV_ISWHITE(line[j]) && j <= i; j++) ; if (j < i) continue; @@ -282,7 +282,7 @@ get_last_leader_offset(char_u *line, char_u **flags) /* * If this comment nests, continue searching. */ - if (vim_strchr(part_buf, COM_NEST) != NULL) + if (mnv_strchr(part_buf, COM_NEST) != NULL) continue; lower_check_bound = i; @@ -292,7 +292,7 @@ get_last_leader_offset(char_u *line, char_u **flags) // lower_check_bound so that we make sure that we have determined // the comment leader correctly. - while (VIM_ISWHITE(*com_leader)) + while (MNV_ISWHITE(*com_leader)) ++com_leader; len1 = (int)STRLEN(com_leader); @@ -303,9 +303,9 @@ get_last_leader_offset(char_u *line, char_u **flags) (void)copy_option_part(&list, part_buf2, COM_MAX_LEN, ","); if (flags_save == com_flags) continue; - string = vim_strchr(part_buf2, ':'); + string = mnv_strchr(part_buf2, ':'); ++string; - while (VIM_ISWHITE(*string)) + while (MNV_ISWHITE(*string)) ++string; len2 = (int)STRLEN(string); if (len2 == 0) @@ -737,7 +737,7 @@ get_mode(char_u *buf) else if ((State & MODE_CMDLINE) || exmode_active) { buf[i++] = 'c'; - if (exmode_active == EXMODE_VIM) + if (exmode_active == EXMODE_MNV) buf[i++] = 'v'; else if (exmode_active == EXMODE_NORMAL) buf[i++] = 'e'; @@ -788,7 +788,7 @@ f_mode(typval_T *argvars, typval_T *rettv) { char_u buf[MODE_MAX_LENGTH]; - if (in_vim9script() && check_for_opt_bool_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_bool_arg(argvars, 0) == FAIL) return; get_mode(buf); @@ -798,14 +798,14 @@ f_mode(typval_T *argvars, typval_T *rettv) if (!non_zero_arg(&argvars[0])) buf[1] = NUL; - rettv->vval.v_string = vim_strsave(buf); + rettv->vval.v_string = mnv_strsave(buf); rettv->v_type = VAR_STRING; } static void may_add_state_char(garray_T *gap, char_u *include, int c) { - if (include == NULL || vim_strchr(include, c) != NULL) + if (include == NULL || mnv_strchr(include, c) != NULL) ga_append(gap, c); } @@ -819,7 +819,7 @@ f_state(typval_T *argvars, typval_T *rettv) char_u *include = NULL; int i; - if (in_vim9script() && check_for_opt_string_arg(argvars, 0) == FAIL) + if (in_mnv9script() && check_for_opt_string_arg(argvars, 0) == FAIL) return; ga_init2(&ga, 1, 20); @@ -891,9 +891,9 @@ get_keystroke(void) // Need some more space. This might happen when receiving a long // escape sequence. buflen += 100; - buf = vim_realloc(buf, buflen); + buf = mnv_realloc(buf, buflen); if (buf == NULL) - vim_free(t_buf); + mnv_free(t_buf); maxlen = (buflen - 6 - len) / 3; } if (buf == NULL) @@ -972,7 +972,7 @@ get_keystroke(void) #endif break; } - vim_free(buf); + mnv_free(buf); mapped_ctrl_c = save_mapped_ctrl_c; return merge_modifyOtherKeys(n, &mod_mask); @@ -980,7 +980,7 @@ get_keystroke(void) // For overflow detection, add a digit safely to an int value. static int -vim_append_digit_int(int *value, int digit) +mnv_append_digit_int(int *value, int digit) { int x = *value; if (x > ((INT_MAX - digit) / 10)) @@ -1019,9 +1019,9 @@ get_number( { windgoto(msg_row, cmdline_col_off + msg_col); c = safe_vgetc(); - if (VIM_ISDIGIT(c)) + if (MNV_ISDIGIT(c)) { - if (vim_append_digit_int(&n, c - '0') == FAIL) + if (mnv_append_digit_int(&n, c - '0') == FAIL) return 0; msg_putchar(c); ++typed; @@ -1133,13 +1133,13 @@ msgmore(long n) if (pn > p_report) { if (n > 0) - vim_snprintf(msg_buf, MSG_BUF_LEN, + mnv_snprintf(msg_buf, MSG_BUF_LEN, NGETTEXT("%ld more line", "%ld more lines", pn), pn); else - vim_snprintf(msg_buf, MSG_BUF_LEN, + mnv_snprintf(msg_buf, MSG_BUF_LEN, NGETTEXT("%ld line less", "%ld fewer lines", pn), pn); if (got_int) - vim_strcat((char_u *)msg_buf, (char_u *)_(" (Interrupted)"), + mnv_strcat((char_u *)msg_buf, (char_u *)_(" (Interrupted)"), MSG_BUF_LEN); if (msg(msg_buf)) { @@ -1158,7 +1158,7 @@ beep_flush(void) if (emsg_silent == 0) { flush_buffers(FLUSH_MINIMAL); - vim_beep(BO_ERROR); + mnv_beep(BO_ERROR); } } @@ -1166,10 +1166,10 @@ beep_flush(void) * Give a warning for an error. "val" is one of the BO_ values, e.g., BO_OPER. */ void -vim_beep(unsigned val) +mnv_beep(unsigned val) { #ifdef FEAT_EVAL - called_vim_beep = TRUE; + called_mnv_beep = TRUE; #endif if (emsg_silent != 0 || in_assert_fails) @@ -1182,7 +1182,7 @@ vim_beep(unsigned val) static elapsed_T start_tv; // Only beep once per half a second, otherwise a sequence of beeps - // would freeze Vim. + // would freeze MNV. if (!did_init || ELAPSED_FUNC(start_tv) > 500) { did_init = TRUE; @@ -1221,7 +1221,7 @@ vim_beep(unsigned val) // When 'debug' contains "beep" produce a message. If we are sourcing // a script or executing a function give the user a hint where the beep // comes from. - if (vim_strchr(p_debug, 'e') != NULL) + if (mnv_strchr(p_debug, 'e') != NULL) { msg_source(HL_ATTR(HLF_W)); msg_attr(_("Beep!"), HL_ATTR(HLF_W)); @@ -1245,7 +1245,7 @@ init_homedir(void) char_u *var; // In case we are called a second time (when 'encoding' changes). - VIM_CLEAR(homedir); + MNV_CLEAR(homedir); #ifdef VMS var = mch_getenv((char_u *)"SYS$LOGIN"); @@ -1256,7 +1256,7 @@ init_homedir(void) #ifdef MSWIN /* * Typically, $HOME is not defined on Windows, unless the user has - * specifically defined it for Vim's sake. However, on Windows NT + * specifically defined it for MNV's sake. However, on Windows NT * platforms, $HOMEDRIVE and $HOMEPATH are automatically defined for * each user. Try constructing $HOME from these. */ @@ -1290,15 +1290,15 @@ init_homedir(void) char_u *p; char_u *exp; - p = vim_strchr(var + 1, '%'); + p = mnv_strchr(var + 1, '%'); if (p != NULL) { - vim_strncpy(NameBuff, var + 1, p - (var + 1)); + mnv_strncpy(NameBuff, var + 1, p - (var + 1)); exp = mch_getenv(NameBuff); if (exp != NULL && *exp != NUL && STRLEN(exp) + STRLEN(p) < MAXPATHL) { - vim_snprintf((char *)NameBuff, MAXPATHL, "%s%s", exp, p + 1); + mnv_snprintf((char *)NameBuff, MAXPATHL, "%s%s", exp, p + 1); var = NameBuff; } } @@ -1346,7 +1346,7 @@ init_homedir(void) emsg(_(e_cannot_go_back_to_previous_directory)); } #endif - homedir = vim_strsave(var); + homedir = mnv_strsave(var); } } @@ -1354,7 +1354,7 @@ init_homedir(void) void free_homedir(void) { - vim_free(homedir); + mnv_free(homedir); } void @@ -1366,10 +1366,10 @@ free_users(void) #if defined(MSWIN) /* - * Initialize $VIM and $VIMRUNTIME when 'enc' is updated. + * Initialize $MNV and $MNVRUNTIME when 'enc' is updated. */ void -init_vimdir(void) +init_mnvdir(void) { int mustfree; char_u *p; @@ -1377,16 +1377,16 @@ init_vimdir(void) mch_get_exe_name(); mustfree = FALSE; - didset_vim = FALSE; - p = vim_getenv((char_u *)"VIM", &mustfree); + didset_mnv = FALSE; + p = mnv_getenv((char_u *)"MNV", &mustfree); if (mustfree) - vim_free(p); + mnv_free(p); mustfree = FALSE; - didset_vimruntime = FALSE; - p = vim_getenv((char_u *)"VIMRUNTIME", &mustfree); + didset_mnvruntime = FALSE; + p = mnv_getenv((char_u *)"MNVRUNTIME", &mustfree); if (mustfree) - vim_free(p); + mnv_free(p); } #endif @@ -1424,7 +1424,7 @@ expand_env_save_opt(char_u *src, int one) */ size_t expand_env( - char_u *src, // input string e.g. "$HOME/vim.hlp" + char_u *src, // input string e.g. "$HOME/mnv.hlp" char_u *dst, // where to put the result int dstlen) // maximum length of the result { @@ -1433,7 +1433,7 @@ expand_env( size_t expand_env_esc( - char_u *srcp, // input string e.g. "$HOME/vim.hlp" + char_u *srcp, // input string e.g. "$HOME/mnv.hlp" char_u *dst, // where to put the result int dstlen, // maximum length of the result int esc, // escape spaces in expanded variables @@ -1471,7 +1471,7 @@ expand_env_esc( len = src - var; if (len > (size_t)dstlen) len = dstlen; - vim_strncpy(dst, var, len); + mnv_strncpy(dst, var, len); dst += len; dstlen -= (int)len; continue; @@ -1502,7 +1502,7 @@ expand_env_esc( #ifdef UNIX // Unix has ${var-name} type environment vars - if (*tail == '{' && !vim_isIDc('{')) + if (*tail == '{' && !mnv_isIDc('{')) { tail++; // ignore '{' while (c-- > 0 && *tail && *tail != '}') @@ -1511,7 +1511,7 @@ expand_env_esc( else #endif { - while (c-- > 0 && *tail != NUL && ((vim_isIDc(*tail)) + while (c-- > 0 && *tail != NUL && ((mnv_isIDc(*tail)) #if defined(MSWIN) || (*src == '%' && *tail != '%') #endif @@ -1536,15 +1536,15 @@ expand_env_esc( ++tail; #endif *var = NUL; - var = vim_getenv(dst, &mustfree); + var = mnv_getenv(dst, &mustfree); #if defined(MSWIN) || defined(UNIX) } #endif } // home directory else if ( src[1] == NUL - || vim_ispathsep(src[1]) - || vim_strchr((char_u *)" ,\t\n", src[1]) != NULL) + || mnv_ispathsep(src[1]) + || mnv_strchr((char_u *)" ,\t\n", src[1]) != NULL) { var = homedir; tail = src + 1; @@ -1560,8 +1560,8 @@ expand_env_esc( c = dstlen - 1; while ( c-- > 0 && *tail - && vim_isfilec(*tail) - && !vim_ispathsep(*tail)) + && mnv_isfilec(*tail) + && !mnv_ispathsep(*tail)) *var++ = *tail++; *var = NUL; # ifdef UNIX @@ -1611,7 +1611,7 @@ expand_env_esc( next_path++); if (*next_path) *next_path++ = NUL; - testlen = vim_snprintf_safelen( + testlen = mnv_snprintf_safelen( (char *)test, sizeof(test), "%s/%s", @@ -1640,14 +1640,14 @@ expand_env_esc( #ifdef BACKSLASH_IN_FILENAME // If 'shellslash' is set change backslashes to forward slashes. // Can't use slash_adjust(), p_ssl may be set temporarily. - if (p_ssl && var != NULL && vim_strchr(var, '\\') != NULL) + if (p_ssl && var != NULL && mnv_strchr(var, '\\') != NULL) { - char_u *p = vim_strsave(var); + char_u *p = mnv_strsave(var); if (p != NULL) { if (mustfree) - vim_free(var); + mnv_free(var); var = p; mustfree = TRUE; forward_slash(var); @@ -1657,14 +1657,14 @@ expand_env_esc( // If "var" contains white space, escape it with a backslash. // Required for ":e ~/tt" when $HOME includes a space. - if (esc && var != NULL && vim_strpbrk(var, (char_u *)" \t") != NULL) + if (esc && var != NULL && mnv_strpbrk(var, (char_u *)" \t") != NULL) { - char_u *p = vim_strsave_escaped(var, (char_u *)" \t"); + char_u *p = mnv_strsave_escaped(var, (char_u *)" \t"); if (p != NULL) { if (mustfree) - vim_free(var); + mnv_free(var); var = p; mustfree = TRUE; } @@ -1684,7 +1684,7 @@ expand_env_esc( #if defined(BACKSLASH_IN_FILENAME) || defined(AMIGA) && dst[c - 1] != ':' #endif - && vim_ispathsep(*tail)) + && mnv_ispathsep(*tail)) ++tail; dst += c; src = tail; @@ -1692,7 +1692,7 @@ expand_env_esc( } } if (mustfree) - vim_free(var); + mnv_free(var); } if (copy_char) // copy at least one char @@ -1746,54 +1746,54 @@ remove_tail(char_u *p, char_u *pend, char_u *name) } /* - * Check if the directory "vimdir/" or "vimdir/runtime" exists. + * Check if the directory "mnvdir/" or "mnvdir/runtime" exists. * Return NULL if not, return its name in allocated memory otherwise. */ static char_u * -vim_version_dir(char_u *vimdir) +mnv_version_dir(char_u *mnvdir) { char_u *p; - if (vimdir == NULL || *vimdir == NUL) + if (mnvdir == NULL || *mnvdir == NUL) return NULL; - p = concat_fnames(vimdir, (char_u *)VIM_VERSION_NODOT, TRUE); + p = concat_fnames(mnvdir, (char_u *)MNV_VERSION_NODOT, TRUE); if (p != NULL && mch_isdir(p)) return p; - vim_free(p); - p = concat_fnames(vimdir, (char_u *)RUNTIME_DIRNAME, TRUE); + mnv_free(p); + p = concat_fnames(mnvdir, (char_u *)RUNTIME_DIRNAME, TRUE); if (p != NULL && mch_isdir(p)) { - char_u *fname = concat_fnames(p, (char_u *)"defaults.vim", TRUE); + char_u *fname = concat_fnames(p, (char_u *)"defaults.mnv", TRUE); - // Check that "defaults.vim" exists in this directory, to avoid picking + // Check that "defaults.mnv" exists in this directory, to avoid picking // up a stray "runtime" directory, it would make many tests fail in // mysterious ways. if (fname != NULL) { int exists = file_is_readable(fname); - vim_free(fname); + mnv_free(fname); if (exists) return p; } } - vim_free(p); + mnv_free(p); return NULL; } /* - * Vim's version of getenv(). - * Special handling of $HOME, $VIM and $VIMRUNTIME. + * MNV's version of getenv(). + * Special handling of $HOME, $MNV and $MNVRUNTIME. * Also does ACP to 'enc' conversion for Win32. * "mustfree" is set to TRUE when the returned string is allocated. It must be * initialized to FALSE by the caller. */ char_u * -vim_getenv(char_u *name, int *mustfree) +mnv_getenv(char_u *name, int *mustfree) { char_u *p = NULL; char_u *pend; - int vimruntime; + int mnvruntime; #ifdef MSWIN WCHAR *wn, *wp; @@ -1807,7 +1807,7 @@ vim_getenv(char_u *name, int *mustfree) return NULL; wp = _wgetenv(wn); - vim_free(wn); + mnv_free(wn); if (wp != NULL && *wp == NUL) // empty is the same as not set wp = NULL; @@ -1844,24 +1844,24 @@ vim_getenv(char_u *name, int *mustfree) # endif #endif - // handling $VIMRUNTIME and $VIM is below, bail out if it's another name. - vimruntime = (STRCMP(name, "VIMRUNTIME") == 0); - if (!vimruntime && STRCMP(name, "VIM") != 0) + // handling $MNVRUNTIME and $MNV is below, bail out if it's another name. + mnvruntime = (STRCMP(name, "MNVRUNTIME") == 0); + if (!mnvruntime && STRCMP(name, "MNV") != 0) return NULL; /* - * When expanding $VIMRUNTIME fails, try using $VIM/vim or $VIM. - * Don't do this when default_vimruntime_dir is non-empty. + * When expanding $MNVRUNTIME fails, try using $MNV/mnv or $MNV. + * Don't do this when default_mnvruntime_dir is non-empty. */ - if (vimruntime + if (mnvruntime #ifdef HAVE_PATHDEF - && *default_vimruntime_dir == NUL + && *default_mnvruntime_dir == NUL #endif ) { #ifdef MSWIN // Use Wide function - wp = _wgetenv(L"VIM"); + wp = _wgetenv(L"MNV"); if (wp != NULL && *wp == NUL) // empty is the same as not set wp = NULL; if (wp != NULL) @@ -1869,35 +1869,35 @@ vim_getenv(char_u *name, int *mustfree) char_u *q = utf16_to_enc(wp, NULL); if (q != NULL) { - p = vim_version_dir(q); + p = mnv_version_dir(q); *mustfree = TRUE; if (p == NULL) p = q; } } #else - p = mch_getenv((char_u *)"VIM"); + p = mch_getenv((char_u *)"MNV"); if (p != NULL && *p == NUL) // empty is the same as not set p = NULL; if (p != NULL) { - p = vim_version_dir(p); + p = mnv_version_dir(p); if (p != NULL) *mustfree = TRUE; else - p = mch_getenv((char_u *)"VIM"); + p = mch_getenv((char_u *)"MNV"); } #endif } /* - * When expanding $VIM or $VIMRUNTIME fails, try using: + * When expanding $MNV or $MNVRUNTIME fails, try using: * - the directory name from 'helpfile' (unless it contains '$') * - the executable name from argv[0] */ if (p == NULL) { - if (p_hf != NULL && vim_strchr(p_hf, '$') == NULL) + if (p_hf != NULL && mnv_strchr(p_hf, '$') == NULL) p = p_hf; #ifdef USE_EXE_NAME /* @@ -1917,7 +1917,7 @@ vim_getenv(char_u *name, int *mustfree) #ifdef USE_EXE_NAME # ifdef MACOS_X - // remove "MacOS" from exe_name and add "Resources/vim" + // remove "MacOS" from exe_name and add "Resources/mnv" if (p == exe_name) { char_u *pend1; @@ -1930,7 +1930,7 @@ vim_getenv(char_u *name, int *mustfree) if (pnew != NULL) { STRNCPY(pnew, p, (pend1 - p)); - STRCPY(pnew + (pend1 - p), "Resources/vim"); + STRCPY(pnew + (pend1 - p), "Resources/mnv"); p = pnew; pend = p + STRLEN(p); } @@ -1942,11 +1942,11 @@ vim_getenv(char_u *name, int *mustfree) pend = remove_tail(p, pend, (char_u *)"src"); #endif - // for $VIM, remove "runtime/" or "vim54/", if present - if (!vimruntime) + // for $MNV, remove "runtime/" or "mnv54/", if present + if (!mnvruntime) { pend = remove_tail(p, pend, (char_u *)RUNTIME_DIRNAME); - pend = remove_tail(p, pend, (char_u *)VIM_VERSION_NODOT); + pend = remove_tail(p, pend, (char_u *)MNV_VERSION_NODOT); } // remove trailing path separator @@ -1957,17 +1957,17 @@ vim_getenv(char_u *name, int *mustfree) if (p == exe_name || p == p_hf) #endif // check that the result is a directory name - p = vim_strnsave(p, pend - p); + p = mnv_strnsave(p, pend - p); if (p != NULL && !mch_isdir(p)) - VIM_CLEAR(p); + MNV_CLEAR(p); else { #ifdef USE_EXE_NAME - // may add "/vim54" or "/runtime" if it exists - if (vimruntime && (pend = vim_version_dir(p)) != NULL) + // may add "/mnv54" or "/runtime" if it exists + if (mnvruntime && (pend = mnv_version_dir(p)) != NULL) { - vim_free(p); + mnv_free(p); p = pend; } #endif @@ -1977,23 +1977,23 @@ vim_getenv(char_u *name, int *mustfree) } #ifdef HAVE_PATHDEF - // When there is a pathdef.c file we can use default_vim_dir and - // default_vimruntime_dir + // When there is a pathdef.c file we can use default_mnv_dir and + // default_mnvruntime_dir if (p == NULL) { - // Only use default_vimruntime_dir when it is not empty - if (vimruntime && *default_vimruntime_dir != NUL) + // Only use default_mnvruntime_dir when it is not empty + if (mnvruntime && *default_mnvruntime_dir != NUL) { - p = default_vimruntime_dir; + p = default_mnvruntime_dir; *mustfree = FALSE; } - else if (*default_vim_dir != NUL) + else if (*default_mnv_dir != NUL) { - if (vimruntime && (p = vim_version_dir(default_vim_dir)) != NULL) + if (mnvruntime && (p = mnv_version_dir(default_mnv_dir)) != NULL) *mustfree = TRUE; else { - p = default_vim_dir; + p = default_mnv_dir; *mustfree = FALSE; } } @@ -2006,27 +2006,27 @@ vim_getenv(char_u *name, int *mustfree) */ if (p != NULL) { - if (vimruntime) + if (mnvruntime) { - vim_setenv((char_u *)"VIMRUNTIME", p); - didset_vimruntime = TRUE; + mnv_setenv((char_u *)"MNVRUNTIME", p); + didset_mnvruntime = TRUE; } else { - vim_setenv((char_u *)"VIM", p); - didset_vim = TRUE; + mnv_setenv((char_u *)"MNV", p); + didset_mnv = TRUE; } } return p; } void -vim_unsetenv(char_u *var) +mnv_unsetenv(char_u *var) { #ifdef HAVE_UNSETENV unsetenv((char *)var); #else - vim_setenv(var, (char_u *)""); + mnv_setenv(var, (char_u *)""); #endif } @@ -2034,15 +2034,15 @@ vim_unsetenv(char_u *var) * Removes environment variable "name" and take care of side effects. */ void -vim_unsetenv_ext(char_u *var) +mnv_unsetenv_ext(char_u *var) { - vim_unsetenv(var); + mnv_unsetenv(var); // "homedir" is not cleared, keep using the old value until $HOME is set. - if (STRICMP(var, "VIM") == 0) - didset_vim = FALSE; - else if (STRICMP(var, "VIMRUNTIME") == 0) - didset_vimruntime = FALSE; + if (STRICMP(var, "MNV") == 0) + didset_mnv = FALSE; + else if (STRICMP(var, "MNVRUNTIME") == 0) + didset_mnvruntime = FALSE; } #if defined(FEAT_EVAL) @@ -2050,15 +2050,15 @@ vim_unsetenv_ext(char_u *var) * Set environment variable "name" and take care of side effects. */ void -vim_setenv_ext(char_u *name, char_u *val) +mnv_setenv_ext(char_u *name, char_u *val) { - vim_setenv(name, val); + mnv_setenv(name, val); if (STRICMP(name, "HOME") == 0) init_homedir(); - else if (didset_vim && STRICMP(name, "VIM") == 0) - didset_vim = FALSE; - else if (didset_vimruntime && STRICMP(name, "VIMRUNTIME") == 0) - didset_vimruntime = FALSE; + else if (didset_mnv && STRICMP(name, "MNV") == 0) + didset_mnv = FALSE; + else if (didset_mnvruntime && STRICMP(name, "MNVRUNTIME") == 0) + didset_mnvruntime = FALSE; } #endif @@ -2066,7 +2066,7 @@ vim_setenv_ext(char_u *name, char_u *val) * Our portable version of setenv. */ void -vim_setenv(char_u *name, char_u *val) +mnv_setenv(char_u *name, char_u *val) { #ifdef HAVE_SETENV mch_setenv((char *)name, (char *)val, 1); @@ -2086,17 +2086,17 @@ vim_setenv(char_u *name, char_u *val) #endif #ifdef FEAT_GETTEXT /* - * When setting $VIMRUNTIME adjust the directory to find message - * translations to $VIMRUNTIME/lang. + * When setting $MNVRUNTIME adjust the directory to find message + * translations to $MNVRUNTIME/lang. */ - if (*val != NUL && STRICMP(name, "VIMRUNTIME") == 0) + if (*val != NUL && STRICMP(name, "MNVRUNTIME") == 0) { char_u *buf = concat_str(val, (char_u *)"/lang"); if (buf != NULL) { - bindtextdomain(VIMPACKAGE, (char *)buf); - vim_free(buf); + bindtextdomain(MNVPACKAGE, (char *)buf); + mnv_free(buf); } } #endif @@ -2144,12 +2144,12 @@ get_env_name( add_user(char_u *user, int need_copy) { char_u *user_copy = (user != NULL && need_copy) - ? vim_strsave(user) : user; + ? mnv_strsave(user) : user; if (user_copy == NULL || *user_copy == NUL || ga_grow(&ga_users, 1) == FAIL) { if (need_copy) - vim_free(user_copy); + mnv_free(user_copy); return; } ((char_u **)(ga_users.ga_data))[ga_users.ga_len++] = user_copy; @@ -2269,7 +2269,7 @@ prepare_to_exit(void) { #if defined(SIGHUP) && defined(SIG_IGN) // Ignore SIGHUP, because a dropped connection causes a read error, which - // makes Vim exit and then handling SIGHUP causes various reentrance + // makes MNV exit and then handling SIGHUP causes various reentrance // problems. mch_signal(SIGHUP, SIG_IGN); #endif @@ -2322,7 +2322,7 @@ preserve_exit(void) { if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL) { - OUT_STR("Vim: preserving files...\r\n"); + OUT_STR("MNV: preserving files...\r\n"); screen_start(); // don't know where cursor is now out_flush(); ml_sync_all(FALSE, FALSE); // preserve all swap files @@ -2332,7 +2332,7 @@ preserve_exit(void) ml_close_all(FALSE); // close all memfiles, without deleting - OUT_STR("Vim: Finished.\r\n"); + OUT_STR("MNV: Finished.\r\n"); getout(1); } @@ -2421,7 +2421,7 @@ get_cmd_output( return NULL; // get a name for the temp file - if ((tempname = vim_tempname('o', FALSE)) == NULL) + if ((tempname = mnv_tempname('o', FALSE)) == NULL) { emsg(_(e_cant_get_temp_file_name)); return NULL; @@ -2440,7 +2440,7 @@ get_cmd_output( call_shell(command, SHELL_DOOUT | SHELL_EXPAND | flags); --no_check_timestamps; - vim_free(command); + mnv_free(command); /* * read the names from the file into memory @@ -2477,7 +2477,7 @@ get_cmd_output( if (i != len) { semsg(_(e_cant_read_file_str), tempname); - VIM_CLEAR(buffer); + MNV_CLEAR(buffer); } else if (ret_len == NULL) { @@ -2492,7 +2492,7 @@ get_cmd_output( *ret_len = len; done: - vim_free(tempname); + mnv_free(tempname); return buffer; } @@ -2520,7 +2520,7 @@ get_cmd_output_as_rettv( if (check_restricted() || check_secure()) goto errret; - if (in_vim9script() + if (in_mnv9script() && (check_for_string_or_list_arg(argvars, 0) == FAIL || check_for_opt_string_or_number_or_list_arg(argvars, 1) == FAIL)) @@ -2532,7 +2532,7 @@ get_cmd_output_as_rettv( * Write the text to a temp file, to be used for input of the shell * command. */ - if ((infile = vim_tempname('i', TRUE)) == NULL) + if ((infile = mnv_tempname('i', TRUE)) == NULL) { emsg(_(e_cant_get_temp_file_name)); goto errret; @@ -2685,7 +2685,7 @@ get_cmd_output_as_rettv( li = listitem_alloc(); if (li == NULL) { - vim_free(s); + mnv_free(s); goto errret; } li->li_tv.v_type = VAR_STRING; @@ -2728,16 +2728,16 @@ errret: { int i; for (i = 0; argv[i] != NULL; i++) - vim_free(argv[i]); - vim_free(argv); + mnv_free(argv[i]); + mnv_free(argv); } if (infile != NULL) { mch_remove(infile); - vim_free(infile); + mnv_free(infile); } if (res != NULL) - vim_free(res); + mnv_free(res); if (list != NULL) list_free(list); } @@ -2790,13 +2790,13 @@ get_isolated_shell_name(void) #ifdef MSWIN p = gettail(p_sh); - p = vim_strnsave(p, skiptowhite(p) - p); + p = mnv_strnsave(p, skiptowhite(p) - p); #else p = skiptowhite(p_sh); if (*p == NUL) { // No white space, use the tail. - p = vim_strsave(gettail(p_sh)); + p = mnv_strsave(gettail(p_sh)); } else { @@ -2805,9 +2805,9 @@ get_isolated_shell_name(void) // Find the last path separator before the space. p1 = p_sh; for (p2 = p_sh; p2 < p; MB_PTR_ADV(p2)) - if (vim_ispathsep(*p2)) + if (mnv_ispathsep(*p2)) p1 = p2 + 1; - p = vim_strnsave(p1, p - p1); + p = mnv_strnsave(p1, p - p1); } #endif return p; @@ -2866,7 +2866,7 @@ path_with_url(char_u *fname) dict_T * get_v_event(save_v_event_T *sve) { - dict_T *v_event = get_vim_var_dict(VV_EVENT); + dict_T *v_event = get_mnv_var_dict(VV_EVENT); if (v_event->dv_hashtab.ht_used > 0) { @@ -2918,7 +2918,7 @@ may_trigger_modechanged(void) dict_set_items_ro(v_event); // concatenate modes in format "old_mode:new_mode" - vim_snprintf((char *)pattern_buf, sizeof(pattern_buf), "%s:%s", last_mode, + mnv_snprintf((char *)pattern_buf, sizeof(pattern_buf), "%s:%s", last_mode, curr_mode); apply_autocmds(EVENT_MODECHANGED, pattern_buf, NULL, FALSE, curbuf); @@ -2930,7 +2930,7 @@ may_trigger_modechanged(void) // For overflow detection, add a digit safely to a long value. int -vim_append_digit_long(long *value, int digit) +mnv_append_digit_long(long *value, int digit) { long x = *value; if (x > ((LONG_MAX - (long)digit) / 10)) @@ -2941,7 +2941,7 @@ vim_append_digit_long(long *value, int digit) // Return something that fits into an int. int -trim_to_int(vimlong_T x) +trim_to_int(mnvlong_T x) { return x > INT_MAX ? INT_MAX : x < INT_MIN ? INT_MIN : x; } diff --git a/uvim/src/misc2.c b/uvim/src/misc2.c index a7f52e55eb..90da8f9163 100644 --- a/uvim/src/misc2.c +++ b/uvim/src/misc2.c @@ -1,16 +1,16 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * misc2.c: Various functions. */ -#include "vim.h" +#include "mnv.h" static char_u *username = NULL; // cached result of mch_get_user_name() @@ -744,12 +744,12 @@ copy_option_part( // skip '.' at start of option part, for 'suffixes' if (*p == '.') buf[len++] = *p++; - while (*p != NUL && vim_strchr((char_u *)sep_chars, *p) == NULL) + while (*p != NUL && mnv_strchr((char_u *)sep_chars, *p) == NULL) { /* * Skip backslash before a separator character and space. */ - if (p[0] == '\\' && vim_strchr((char_u *)sep_chars, p[1]) != NULL) + if (p[0] == '\\' && mnv_strchr((char_u *)sep_chars, p[1]) != NULL) ++p; if (len < maxlen - 1) buf[len++] = *p; @@ -767,7 +767,7 @@ copy_option_part( #if !defined(HAVE_MEMSET) && !defined(PROTO) void * -vim_memset(void *ptr, int c, size_t size) +mnv_memset(void *ptr, int c, size_t size) { char *p = ptr; @@ -778,11 +778,11 @@ vim_memset(void *ptr, int c, size_t size) #endif /* - * Vim has its own isspace() function, because on some machines isspace() + * MNV has its own isspace() function, because on some machines isspace() * can't handle characters above 128. */ int -vim_isspace(int x) +mnv_isspace(int x) { return ((x >= 9 && x <= 13) || x == ' '); } @@ -1246,7 +1246,7 @@ get_special_key_name(int c, int modifiers) if (c > 0 && (*mb_char2len)(c) == 1) { if (table_idx < 0 - && (!vim_isprintc(c) || (c & 0x7f) == ' ') + && (!mnv_isprintc(c) || (c & 0x7f) == ' ') && (c & 0x80)) { c &= 0x7f; @@ -1254,7 +1254,7 @@ get_special_key_name(int c, int modifiers) // try again, to find the un-alted key in the special key table table_idx = find_special_key_in_table(c); } - if (table_idx < 0 && !vim_isprintc(c) && c < ' ') + if (table_idx < 0 && !mnv_isprintc(c) && c < ' ') { c += '@'; modifiers |= MOD_MASK_CTRL; @@ -1283,7 +1283,7 @@ get_special_key_name(int c, int modifiers) else { len = (*mb_char2len)(c); - if (len == 1 && vim_isprintc(c)) + if (len == 1 && mnv_isprintc(c)) string[idx++] = c; else if (has_mbyte && len > 1) idx += (*mb_char2bytes)(c, string + idx); @@ -1405,7 +1405,7 @@ find_special_key( // Find end of modifier list last_dash = src; - for (bp = src + 1; *bp == '-' || vim_isNormalIDc(*bp); bp++) + for (bp = src + 1; *bp == '-' || mnv_isNormalIDc(*bp); bp++) { if (*bp == '-') { @@ -1430,7 +1430,7 @@ find_special_key( bp += 3; // skip t_xx, xx may be '-' or '>' else if (STRNICMP(bp, "char-", 5) == 0) { - vim_str2nr(bp + 5, NULL, &l, STR2NR_ALL, NULL, NULL, 0, TRUE, NULL); + mnv_str2nr(bp + 5, NULL, &l, STR2NR_ALL, NULL, NULL, 0, TRUE, NULL); if (l == 0) { emsg(_(e_invalid_argument)); @@ -1464,10 +1464,10 @@ find_special_key( if (bp >= last_dash) { if (STRNICMP(last_dash + 1, "char-", 5) == 0 - && VIM_ISDIGIT(last_dash[6])) + && MNV_ISDIGIT(last_dash[6])) { // or or - vim_str2nr(last_dash + 6, NULL, &l, STR2NR_ALL, NULL, + mnv_str2nr(last_dash + 6, NULL, &l, STR2NR_ALL, NULL, &n, 0, TRUE, NULL); if (l == 0) { @@ -1608,7 +1608,7 @@ may_remove_shift_modifier(int modifiers, int key) || modifiers == (MOD_MASK_SHIFT | MOD_MASK_META)) && ((key >= '!' && key <= '/') || (key >= ':' && key <= 'Z') - || vim_isdigit(key) + || mnv_isdigit(key) || (key >= '[' && key <= '`') || (key >= '{' && key <= '~'))) return modifiers & ~MOD_MASK_SHIFT; @@ -1704,7 +1704,7 @@ find_special_key_in_table(int c) * 'LeftMouse>", ""] ...' * should match with * 'LeftMouse'. - * These characters are identified by vim_isNormalIDc(). + * These characters are identified by mnv_isNormalIDc(). */ static int cmp_key_name_entry(const void *a, const void *b) @@ -1716,7 +1716,7 @@ cmp_key_name_entry(const void *a, const void *b) if (p1 == p2) return 0; - while (vim_isNormalIDc(*p1) && *p2 != NUL) + while (mnv_isNormalIDc(*p1) && *p2 != NUL) { if ((result = TOLOWER_ASC(*p1) - TOLOWER_ASC(*p2)) != 0) break; @@ -1728,7 +1728,7 @@ cmp_key_name_entry(const void *a, const void *b) { if (*p2 == NUL) { - if (vim_isNormalIDc(*p1)) + if (mnv_isNormalIDc(*p1)) result = 1; } else @@ -1948,7 +1948,7 @@ call_shell(char_u *cmd, int opt) if (*p_sxe != NUL && *p_sxq == '(') { - ecmd = vim_strsave_escaped_ext(cmd, p_sxe, '^', FALSE); + ecmd = mnv_strsave_escaped_ext(cmd, p_sxe, '^', FALSE); if (ecmd == NULL) ecmd = cmd; } @@ -1958,16 +1958,16 @@ call_shell(char_u *cmd, int opt) { // When 'shellxquote' is ( append ). // When 'shellxquote' is "( append )". - vim_snprintf((char *)ncmd, ncmdsize, "%s%s%s", p_sxq, ecmd, *p_sxq == '(' ? (char_u *)")" + mnv_snprintf((char *)ncmd, ncmdsize, "%s%s%s", p_sxq, ecmd, *p_sxq == '(' ? (char_u *)")" : *p_sxq == '"' && *(p_sxq+1) == '(' ? (char_u *)")\"" : p_sxq); retval = mch_call_shell(ncmd, opt); - vim_free(ncmd); + mnv_free(ncmd); } else retval = -1; if (ecmd != cmd) - vim_free(ecmd); + mnv_free(ecmd); } #ifdef FEAT_GUI --hold_gui_events; @@ -1980,7 +1980,7 @@ call_shell(char_u *cmd, int opt) } #ifdef FEAT_EVAL - set_vim_var_nr(VV_SHELL_ERROR, (long)retval); + set_mnv_var_nr(VV_SHELL_ERROR, (long)retval); # ifdef FEAT_PROFILE if (do_profiling == PROF_YES) prof_child_exit(&wait_time); @@ -2020,7 +2020,7 @@ get_real_state(void) int after_pathsep(char_u *b, char_u *p) { - return p > b && vim_ispathsep(p[-1]) + return p > b && mnv_ispathsep(p[-1]) && (!has_mbyte || (*mb_head_off)(b, p - 1) == 0); } @@ -2039,7 +2039,7 @@ same_directory(char_u *f1, char_u *f2) if (f1 == NULL || f2 == NULL) return FALSE; - (void)vim_FullName(f1, ffname, MAXPATHL, FALSE); + (void)mnv_FullName(f1, ffname, MAXPATHL, FALSE); t1 = gettail_sep(ffname); t2 = gettail_sep(f2); return (t1 - ffname == t2 - f2 @@ -2055,7 +2055,7 @@ same_directory(char_u *f1, char_u *f2) * Return OK or FAIL. */ int -vim_chdirfile(char_u *fname, char *trigger_autocmd) +mnv_chdirfile(char_u *fname, char *trigger_autocmd) { char_u old_dir[MAXPATHL]; char_u new_dir[MAXPATHL]; @@ -2063,7 +2063,7 @@ vim_chdirfile(char_u *fname, char *trigger_autocmd) if (mch_dirname(old_dir, MAXPATHL) != OK) *old_dir = NUL; - vim_strncpy(new_dir, fname, MAXPATHL - 1); + mnv_strncpy(new_dir, fname, MAXPATHL - 1); *gettail_sep(new_dir) = NUL; if (pathcmp((char *)old_dir, (char *)new_dir, -1) == 0) @@ -2087,7 +2087,7 @@ vim_chdirfile(char_u *fname, char *trigger_autocmd) /* * Check if "name" ends in a slash and is not a directory. * Used for systems where stat() ignores a trailing slash on a file name. - * The Vim code assumes a trailing slash is only ignored for a directory. + * The MNV code assumes a trailing slash is only ignored for a directory. */ static int illegal_slash(const char *name) @@ -2105,7 +2105,7 @@ illegal_slash(const char *name) * Special implementation of mch_stat() for Solaris. */ int -vim_stat(const char *name, stat_T *stp) +mnv_stat(const char *name, stat_T *stp) { // On Solaris stat() accepts "file/" as if it was "file". Return -1 if // the name ends in "/" and it's not a directory. @@ -2122,7 +2122,7 @@ vim_stat(const char *name, stat_T *stp) cursorentry_T shape_table[SHAPE_IDX_COUNT] = { // The values will be filled in from the 'guicursor' and 'mouseshape' - // defaults when Vim starts. + // defaults when MNV starts. // Adjust the SHAPE_IDX_ defines when making changes! {0, 0, 0, 700L, 400L, 250L, 0, 0, "n", SHAPE_CURSOR+SHAPE_MOUSE}, {0, 0, 0, 700L, 400L, 250L, 0, 0, "v", SHAPE_CURSOR+SHAPE_MOUSE}, @@ -2212,8 +2212,8 @@ parse_shape_opt(int what) modep = p_guicursor; while (*modep != NUL) { - colonp = vim_strchr(modep, ':'); - commap = vim_strchr(modep, ','); + colonp = mnv_strchr(modep, ':'); + commap = mnv_strchr(modep, ','); if (colonp == NULL || (commap != NULL && commap < colonp)) return e_missing_colon_2; @@ -2282,7 +2282,7 @@ parse_shape_opt(int what) { if (mshape_names[i].string == NULL) { - if (!VIM_ISDIGIT(*p)) + if (!MNV_ISDIGIT(*p)) return e_illegal_mouseshape; if (round == 2) shape_table[idx].mshape = @@ -2321,7 +2321,7 @@ parse_shape_opt(int what) if (len != 0) { p += len; - if (!VIM_ISDIGIT(*p)) + if (!MNV_ISDIGIT(*p)) return e_digit_expected; n = getdigits(&p); if (len == 3) // "ver" or "hor" @@ -2355,7 +2355,7 @@ parse_shape_opt(int what) } else // must be a highlight group name then { - endp = vim_strchr(p, '-'); + endp = mnv_strchr(p, '-'); if (commap == NULL) // last part { if (endp == NULL) @@ -2363,7 +2363,7 @@ parse_shape_opt(int what) } else if (endp > commap || endp == NULL) endp = commap; - slashp = vim_strchr(p, '/'); + slashp = mnv_strchr(p, '/'); if (slashp != NULL && slashp < endp) { // "group/langmap_group" @@ -2540,7 +2540,7 @@ f_getmouseshape(typval_T *argvars UNUSED, typval_T *rettv) # if defined(FEAT_MOUSESHAPE) if (current_mouse_shape >= 0 && current_mouse_shape < (int)MSHAPE_NAMES_COUNT) - rettv->vval.v_string = vim_strnsave( + rettv->vval.v_string = mnv_strnsave( mshape_names[current_mouse_shape].string, mshape_names[current_mouse_shape].length); # endif @@ -2554,7 +2554,7 @@ f_getmouseshape(typval_T *argvars UNUSED, typval_T *rettv) * names. */ int -vim_chdir(char_u *new_dir) +mnv_chdir(char_u *new_dir) { char_u *dir_name; int r; @@ -2563,12 +2563,12 @@ vim_chdir(char_u *new_dir) dir_name = find_directory_in_path(new_dir, (int)STRLEN(new_dir), FNAME_MESS, curbuf->b_ffname, &file_to_find, &search_ctx); - vim_free(file_to_find); - vim_findfile_cleanup(search_ctx); + mnv_free(file_to_find); + mnv_findfile_cleanup(search_ctx); if (dir_name == NULL) return -1; r = mch_chdir((char *)dir_name); - vim_free(dir_name); + mnv_free(dir_name); return r; } @@ -2586,10 +2586,10 @@ get_user_name(char_u *buf, int len) { if (mch_get_user_name(buf, len) == FAIL) return FAIL; - username = vim_strsave(buf); + username = mnv_strsave(buf); } else - vim_strncpy(buf, username, len - 1); + mnv_strncpy(buf, username, len - 1); return OK; } @@ -2600,7 +2600,7 @@ get_user_name(char_u *buf, int len) void free_username(void) { - vim_free(username); + mnv_free(username); } #endif @@ -2641,7 +2641,7 @@ qsort( mch_memmove(p2, buf, elm_size); } - vim_free(buf); + mnv_free(buf); } #endif @@ -2711,7 +2711,7 @@ putenv(const char *string) } else { // name already in env. - p = vim_realloc(environ[i], strlen(string) + 1); + p = mnv_realloc(environ[i], strlen(string) + 1); if (p == NULL) return -1; } @@ -2778,7 +2778,7 @@ moreenv(void) char **env; esize = envsize + EXTRASIZE; - env = vim_realloc((char *)environ, esize * sizeof (*env)); + env = mnv_realloc((char *)environ, esize * sizeof (*env)); if (env == 0) return -1; environ = env; @@ -2786,12 +2786,12 @@ moreenv(void) return 0; } -# ifdef USE_VIMPTY_GETENV +# ifdef USE_MNVPTY_GETENV /* * Used for mch_getenv() for Mac. */ char_u * -vimpty_getenv(const char_u *string) +mnvpty_getenv(const char_u *string) { int i; char_u *p; @@ -2804,7 +2804,7 @@ vimpty_getenv(const char_u *string) if (i < 0) return NULL; - p = vim_strchr((char_u *)environ[i], '='); + p = mnv_strchr((char_u *)environ[i], '='); return (p + 1); } # endif @@ -2931,7 +2931,7 @@ read_string(FILE *fd, int cnt) c = getc(fd); if (c == EOF) { - vim_free(str); + mnv_free(str); return NULL; } str[i] = c; @@ -2956,7 +2956,7 @@ put_bytes(FILE *fd, long_u nr, int len) #endif -#ifndef PROTO // proto is defined in vim.h +#ifndef PROTO // proto is defined in mnv.h # ifdef ELAPSED_TIMEVAL /* * Return time in msec since "start_tv". @@ -3081,17 +3081,17 @@ build_argv_from_string(char_u *cmd, char ***argv, int *argc) int i; // Make a copy, parsing will modify "cmd". - cmd_copy = vim_strsave(cmd); + cmd_copy = mnv_strsave(cmd); if (cmd_copy == NULL || mch_parse_cmd(cmd_copy, FALSE, argv, argc) == FAIL) { - vim_free(cmd_copy); + mnv_free(cmd_copy); return FAIL; } for (i = 0; i < *argc; i++) - (*argv)[i] = (char *)vim_strsave((char_u *)(*argv)[i]); + (*argv)[i] = (char *)mnv_strsave((char_u *)(*argv)[i]); (*argv)[*argc] = NULL; - vim_free(cmd_copy); + mnv_free(cmd_copy); return OK; } @@ -3122,11 +3122,11 @@ build_argv_from_list(list_T *l, char ***argv, int *argc) int i; for (i = 0; i < *argc; ++i) - VIM_CLEAR((*argv)[i]); + MNV_CLEAR((*argv)[i]); (*argv)[0] = NULL; return FAIL; } - (*argv)[*argc] = (char *)vim_strsave(s); + (*argv)[*argc] = (char *)mnv_strsave(s); *argc += 1; } (*argv)[*argc] = NULL; @@ -3192,7 +3192,7 @@ cmp_keyvalue_value_ni(const void *a, const void *b) keyvalue_T *kv1 = (keyvalue_T *)a; keyvalue_T *kv2 = (keyvalue_T *)b; - return vim_strnicmp_asc((char *)kv1->value.string, + return mnv_strnicmp_asc((char *)kv1->value.string, (char *)kv2->value.string, MAX(kv1->value.length, kv2->value.length)); } diff --git a/uvim/src/mnv.h b/uvim/src/mnv.h new file mode 100644 index 0000000000..8770d2b8d5 --- /dev/null +++ b/uvim/src/mnv.h @@ -0,0 +1,3096 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * MNV - MNV is not Vim by Bram Moolenaar + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + */ + +#ifndef MNV__H +#define MNV__H + +#include "protodef.h" + +// _WIN32 is defined as 1 when the compilation target is 32-bit or 64-bit. +// Note: If you want to check for 64-bit use the _WIN64 macro. +#if defined(WIN32) || defined(_WIN32) +# define MSWIN +#endif + +#if defined(MSWIN) +# include +#endif + +// ============ the header file puzzle: order matters ========= + +#ifdef HAVE_CONFIG_H // GNU autoconf (or something else) was here +# ifdef VMS +# include "config.h" /* Rely on /INCLUDE to find it. */ +# else +# include "auto/config.h" +# endif /* def VMS [else] */ +# define HAVE_PATHDEF + +/* + * Check if configure correctly managed to find sizeof(int). If this failed, + * it becomes zero. This is likely a problem of not being able to run the + * test program. Other items from configure may also be wrong then! + */ +# if (MNV_SIZEOF_INT == 0) +# error configure did not run properly. Check auto/config.log. +# endif + +# if (defined(__linux__) && !defined(__ANDROID__)) || defined(__CYGWIN__) || defined(__GNU__) +// Needed for strptime(). Needs to be done early, since header files can +// include other header files and end up including time.h, where these symbols +// matter for MNV. +// 700 is needed for mkdtemp(). +# ifndef _XOPEN_SOURCE +# define _XOPEN_SOURCE 700 + +// On old systems, defining _XOPEN_SOURCE causes _BSD_SOURCE, _SVID_SOURCE +// and/or // _DEFAULT_SOURCE not to be defined, so do that here. Those are +// needed to include nanosecond-resolution timestamps in struct stat. On new +// systems, _DEFAULT_SOURCE is needed to avoid warning messages about using +// deprecated _BSD_SOURCE or _SVID_SOURCE. +# ifndef _BSD_SOURCE +# define _BSD_SOURCE 1 +# endif +# ifndef _SVID_SOURCE +# define _SVID_SOURCE 1 +# endif +# ifndef _DEFAULT_SOURCE +# define _DEFAULT_SOURCE 1 +# endif +# endif +# endif + +/* + * Cygwin may have fchdir() in a newer release, but in most versions it + * doesn't work well and avoiding it keeps the binary backward compatible. + */ +# if defined(__CYGWIN32__) && defined(HAVE_FCHDIR) +# undef HAVE_FCHDIR +# endif + +// We may need to define the uint32_t on non-Unix system, but using the same +// identifier causes conflicts. Therefore use UINT32_T. +# define UINT32_TYPEDEF uint32_t +#endif + +// for INT_MAX, LONG_MAX et al. +#include + +#if !defined(UINT32_TYPEDEF) +# if defined(uint32_t) // this doesn't catch typedefs, unfortunately +# define UINT32_TYPEDEF uint32_t +# else + // Fall back to assuming unsigned int is 32 bit. If this is wrong then the + // test in blowfish.c will fail. +# define UINT32_TYPEDEF unsigned int +# endif +#endif + +// C89 does not define SIZE_MAX +#if defined(__hpux) || defined(VMS) +# ifndef SIZE_MAX +# define SIZE_MAX ((size_t)(-1)) +# endif +#endif + +// user ID of root is usually zero, but not for everybody +#ifdef __TANDEM +# ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE +# endif +# include +# define ROOT_UID 65535 +# define OLDXAW +# if (_TANDEM_ARCH_ == 2 && __H_Series_RVU >= 621) +# define SA_ONSTACK_COMPATIBILITY +# endif +#else +# define ROOT_UID 0 +#endif + +/* Include MAC_OS_X_VERSION_* macros */ +#ifdef HAVE_AVAILABILITYMACROS_H +# include +#endif + +/* + * MACOS_X compiling for Mac OS X + * MACOS_X_DARWIN integrating the darwin feature into MACOS_X + */ +#if defined(MACOS_X_DARWIN) && !defined(MACOS_X) +# define MACOS_X +#endif +// Unless made through the Makefile enforce GUI on Mac +#if defined(MACOS_X) && !defined(HAVE_CONFIG_H) +# define UNIX +#endif + +#if defined(FEAT_GUI_MOTIF) \ + || defined(FEAT_GUI_GTK) \ + || defined(FEAT_GUI_HAIKU) \ + || defined(FEAT_GUI_MSWIN) \ + || defined(FEAT_GUI_PHOTON) +# if !defined(FEAT_GUI) && !defined(NO_X11_INCLUDES) +# define FEAT_GUI +# endif +#endif + +// Check support for rendering options +#ifdef FEAT_GUI +# if defined(FEAT_DIRECTX) +# define FEAT_RENDER_OPTIONS +# endif +#endif + +/* + * MNV_SIZEOF_INT is used in feature.h, and the system-specific included files + * need items from feature.h. Therefore define MNV_SIZEOF_INT here. + */ +#ifdef MSWIN +# define MNV_SIZEOF_INT 4 +#endif + +#ifdef AMIGA + // Be conservative about sizeof(int). It could be 4 too. +# ifndef FEAT_GUI_GTK // avoid problems when generating prototypes +# ifdef __GNUC__ +# define MNV_SIZEOF_INT 4 +# else +# define MNV_SIZEOF_INT 2 +# endif +# endif +#endif +#if defined(MACOS_X) && !defined(HAVE_CONFIG_H) +# define MNV_SIZEOF_INT __SIZEOF_INT__ +#endif + +#if MNV_SIZEOF_INT < 4 && !defined(PROTO) +# error MNV only works with 32 bit int or larger +#endif + +/* + * #defines for optionals and features + * Also defines FEAT_TINY, FEAT_NORMAL, etc. when FEAT_HUGE is defined. + */ +#include "feature.h" + +#if defined(MACOS_X_DARWIN) +# if defined(FEAT_NORMAL) && !defined(FEAT_CLIPBOARD) +# define FEAT_CLIPBOARD +# endif +# if defined(FEAT_HUGE) && !defined(FEAT_SOUND) && \ + defined(__clang_major__) && __clang_major__ >= 7 && \ + defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 +# define FEAT_SOUND +# endif +# if defined(FEAT_SOUND) +# define FEAT_SOUND_MACOSX +# endif +#endif + +// +x11 is only enabled when it's both available and wanted. +#if defined(HAVE_X11) && defined(WANT_X11) +# define FEAT_X11 +#endif + +#if defined(HAVE_WAYLAND) && defined(WANT_WAYLAND) +# define FEAT_WAYLAND +#endif + +#ifdef NO_X11_INCLUDES + // In os_mac_conv.c and os_macosx.m NO_X11_INCLUDES is defined to avoid + // X11 headers. Disable all X11 related things to avoid conflicts. +# ifdef FEAT_X11 +# undef FEAT_X11 +# endif +# ifdef FEAT_GUI_X11 +# undef FEAT_GUI_X11 +# endif +# ifdef FEAT_XCLIPBOARD +# undef FEAT_XCLIPBOARD +# endif +# ifdef FEAT_GUI_MOTIF +# undef FEAT_GUI_MOTIF +# endif +# ifdef FEAT_GUI_GTK +# undef FEAT_GUI_GTK +# endif +# ifdef FEAT_BEVAL_TIP +# undef FEAT_BEVAL_TIP +# endif +# ifdef FEAT_XIM +# undef FEAT_XIM +# endif +# ifdef FEAT_CLIENTSERVER +# undef FEAT_CLIENTSERVER +# endif +#endif + +// The Mac conversion stuff doesn't work under X11. +#if defined(MACOS_X_DARWIN) +# define MACOS_CONVERT +#endif + +// Can't use "PACKAGE" here, conflicts with a Perl include file. +#ifndef MNVPACKAGE +# define MNVPACKAGE "mnv" +#endif + +/* + * Find out if function definitions should include argument types + */ +#ifdef AZTEC_C +# include +#endif + +#ifdef SASC +# include +#endif + +#ifdef _DCC +# include +#endif + +#ifndef PROTO +# ifdef __HAIKU__ +# include "os_haiku.h" +# define __ARGS(x) x +# endif +#endif + +#if (defined(UNIX) || defined(VMS)) \ + && (!defined(MACOS_X) || defined(HAVE_CONFIG_H)) +# include "os_unix.h" // bring lots of system header files +#elif !defined(PROTO) + // For all non-Unix systems: use old-fashioned signal(). +# define mch_signal(signum, sighandler) signal(signum, sighandler) +#endif + +// Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter +// can be used to check for mistakes. +#ifndef UNUSED +# if defined(HAVE_ATTRIBUTE_UNUSED) || defined(__MINGW32__) +# define UNUSED __attribute__((unused)) +# else +# if defined __has_attribute +# if __has_attribute(unused) +# define UNUSED __attribute__((unused)) +# endif +# endif +# endif +# ifndef UNUSED +# define UNUSED +# endif +#endif + +// Used to check for "sun", "__sun" is used by newer compilers. +#if defined(__sun) +# define SUN_SYSTEM +#endif + +// If we're compiling in C++ (currently only KMNV), the system +// headers must have the correct prototypes or nothing will build. +// Conversely, our prototypes might clash due to throw() specifiers and +// cause compilation failures even though the headers are correct. For +// a concrete example, gcc-3.2 enforces exception specifications, and +// glibc-2.2.5 has them in their system headers. +#if !defined(__cplusplus) && defined(UNIX) \ + && !defined(MACOS_X) // MACOS_X doesn't yet support osdef.h +# include "auto/osdef.h" // bring missing declarations in +#endif + +#ifndef PROTO +# ifdef AMIGA +# include "os_amiga.h" +# endif + +# ifdef MSWIN +# include "os_win32.h" +# endif + +# if defined(MACOS_X) +# include "os_mac.h" +# endif + +# ifdef __QNX__ +# include "os_qnx.h" +# endif +#endif + +#ifdef X_LOCALE +# include +#else +# ifdef HAVE_LOCALE_H +# include +# endif +#endif + +/* + * Maximum length of a path (for non-unix systems) Make it a bit long, to stay + * on the safe side. But not too long to put on the stack. + */ +#ifndef MAXPATHL +# ifdef MAXPATHLEN +# define MAXPATHL MAXPATHLEN +# else +# define MAXPATHL 256 +# endif +#endif +#ifdef BACKSLASH_IN_FILENAME +# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`%#'\"|!<") +# define BUFFER_ESC_CHARS ((char_u *)" \t\n*?[`%#'\"|!<") +#else +# ifdef VMS + // VMS allows a lot of characters in the file name +# define PATH_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'\"|!") +# define SHELL_ESC_CHARS ((char_u *)" \t\n*?{`\\%#'|!()&") +# else +# define PATH_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<") +# define SHELL_ESC_CHARS ((char_u *)" \t\n*?[{`$\\%#'\"|!<>();&") +# endif +# define BUFFER_ESC_CHARS ((char_u *)" \t\n*?[`$\\%#'\"|!<") +#endif + +// length of a buffer to store a number in ASCII (64 bits binary + NUL) +#define NUMBUFLEN 65 + +// flags for mnv_str2nr() +#define STR2NR_BIN 0x01 +#define STR2NR_OCT 0x02 +#define STR2NR_HEX 0x04 +#define STR2NR_OOCT 0x08 // Octal with prefix "0o": 0o777 +#define STR2NR_ALL (STR2NR_BIN + STR2NR_OCT + STR2NR_HEX + STR2NR_OOCT) +#define STR2NR_NO_OCT (STR2NR_BIN + STR2NR_HEX + STR2NR_OOCT) + +#define STR2NR_FORCE 0x80 // only when ONE of the above is used + +#define STR2NR_QUOTE 0x10 // ignore embedded single quotes + +/* + * Shorthand for unsigned variables. Many systems, but not all, have u_char + * already defined, so we use char_u to avoid trouble. + */ +typedef unsigned char char_u; +typedef unsigned short short_u; +typedef unsigned int int_u; + +// Make sure long_u is big enough to hold a pointer. +// On Win64, longs are 32 bits and pointers are 64 bits. +// For printf() and scanf(), we need to take care of long_u specifically. +#ifdef _WIN64 +typedef unsigned __int64 long_u; +typedef __int64 long_i; +# define SCANF_HEX_LONG_U "%llx" +# define SCANF_DECIMAL_LONG_U "%llu" +# define PRINTF_HEX_LONG_U "0x%llx" +#else +typedef unsigned long long_u; +typedef long long_i; +# define SCANF_HEX_LONG_U "%lx" +# define SCANF_DECIMAL_LONG_U "%lu" +# define PRINTF_HEX_LONG_U "0x%lx" +#endif +#define PRINTF_DECIMAL_LONG_U SCANF_DECIMAL_LONG_U + +/* + * Only systems which use configure will have SIZEOF_OFF_T and MNV_SIZEOF_LONG + * defined, which is ok since those are the same systems which can have + * varying sizes for off_t. The other systems will continue to use "%ld" to + * print off_t since off_t is simply a typedef to long for them. + */ +#if defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T > MNV_SIZEOF_LONG) +# define LONG_LONG_OFF_T +#endif + +/* + * We use 64-bit file functions here, if available. E.g. ftello() returns + * off_t instead of long, which helps if long is 32 bit and off_t is 64 bit. + * We assume that when fseeko() is available then ftello() is too. + * Note that Windows has different function names. + */ +#if defined(MSWIN) && !defined(PROTO) +typedef __int64 off_T; +# ifdef __MINGW32__ +# define mnv_lseek lseek64 +# define mnv_fseek fseeko64 +# define mnv_ftell ftello64 +# else +# define mnv_lseek _lseeki64 +# define mnv_fseek _fseeki64 +# define mnv_ftell _ftelli64 +# endif +#else +typedef off_t off_T; +# ifdef HAVE_FSEEKO +# define mnv_lseek lseek +# define mnv_ftell ftello +# define mnv_fseek fseeko +# else +# define mnv_lseek lseek +# define mnv_ftell ftell +# define mnv_fseek(a, b, c) fseek(a, (long)b, c) +# endif +#endif + +/* + * The characters and attributes cached for the screen. + */ +typedef char_u schar_T; +typedef unsigned short sattr_T; +#define MAX_TYPENR 65535 + +/* + * The u8char_T can hold one decoded UTF-8 character. + * We use 32 bits, since some Asian characters don't fit in 16 bits. + */ +typedef unsigned int u8char_T; // int is 32 bits or more + +/* + * The mnvlong_T has sizeof(mnvlong_T) >= 2 * sizeof(int). + * One use is simple handling of overflow in int calculations. + */ +#if defined(VMS) && defined(VAX) +// unsupported compiler +typedef long mnvlong_T; +#else +typedef long long mnvlong_T; +#endif + +#ifndef UNIX // For Unix this is included in os_unix.h +# include +# include +#endif + +#include "ascii.h" +#include "keymap.h" +#include "termdefs.h" +#include "macros.h" + +#ifdef LATTICE +# include +# include +#endif +#ifdef _DCC +# include +#endif +#if defined(MSWIN) +# include +#endif + +#if defined(HAVE_ERRNO_H) || defined(MSWIN) +# include +#endif + +/* + * Allow other (non-unix) systems to configure themselves now + * These are also in os_unix.h, because osdef.sh needs them there. + */ +#ifndef UNIX +// Note: Some systems need both string.h and strings.h (Savage). If the +// system can't handle this, define NO_STRINGS_WITH_STRING_H. +# ifdef HAVE_STRING_H +# include +# endif +# if defined(HAVE_STRINGS_H) && !defined(NO_STRINGS_WITH_STRING_H) +# include +# endif +# ifdef HAVE_STAT_H +# include +# endif +# ifdef HAVE_STDLIB_H +# include +# endif +#endif // NON-UNIX + +#include + +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_WCTYPE_H +# include +#endif +#include +// older compilers do not define va_copy +#ifndef va_copy +# define va_copy(dst, src) ((dst) = (src)) +#endif + +// for offsetof() +#include +#include + +#if defined(HAVE_SYS_SELECT_H) && \ + (!defined(HAVE_SYS_TIME_H) || defined(SYS_SELECT_WITH_SYS_TIME)) +# include +#endif + +#ifndef HAVE_SELECT +# ifdef HAVE_SYS_POLL_H +# include +# elif defined(MSWIN) +# define HAVE_SELECT +# else +# ifdef HAVE_POLL_H +# include +# endif +# endif +#endif + +#ifdef HAVE_SODIUM +# include +#endif + +// ================ end of the header file puzzle =============== + +/* + * For dynamically loaded imm library. Currently, only for Win32. + */ +#ifdef DYNAMIC_IME +# ifndef FEAT_MBYTE_IME +# define FEAT_MBYTE_IME +# endif +#endif + +/* + * For dynamically loaded gettext library. Currently, only for Win32. + */ +#ifdef DYNAMIC_GETTEXT +# ifndef FEAT_GETTEXT +# define FEAT_GETTEXT +# endif +// These are in os_win32.c +extern char *(*dyn_libintl_gettext)(const char *msgid); +extern char *(*dyn_libintl_ngettext)(const char *msgid, const char *msgid_plural, unsigned long n); +extern char *(*dyn_libintl_bindtextdomain)(const char *domainname, const char *dirname); +extern char *(*dyn_libintl_bind_textdomain_codeset)(const char *domainname, const char *codeset); +extern char *(*dyn_libintl_textdomain)(const char *domainname); +extern int (*dyn_libintl_wputenv)(const wchar_t *envstring); +#endif + + +/* + * The _() stuff is for using gettext(). It is a no-op when libintl.h is not + * found or the +multilang feature is disabled. + * Use NGETTEXT(single, multi, number) to get plural behavior: + * - single - message for singular form + * - multi - message for plural form + * - number - the count + */ +#ifdef FEAT_GETTEXT +# ifdef DYNAMIC_GETTEXT +# define _(x) (*dyn_libintl_gettext)((char *)(x)) +# define NGETTEXT(x, xs, n) (*dyn_libintl_ngettext)((char *)(x), (char *)(xs), (n)) +# define N_(x) x +# define bindtextdomain(domain, dir) (*dyn_libintl_bindtextdomain)((domain), (dir)) +# define bind_textdomain_codeset(domain, codeset) (*dyn_libintl_bind_textdomain_codeset)((domain), (codeset)) +# if !defined(HAVE_BIND_TEXTDOMAIN_CODESET) +# define HAVE_BIND_TEXTDOMAIN_CODESET 1 +# endif +# define textdomain(domain) (*dyn_libintl_textdomain)(domain) +# define libintl_wputenv(envstring) (*dyn_libintl_wputenv)(envstring) +# else +# include +# define _(x) gettext((char *)(x)) +# define NGETTEXT(x, xs, n) ngettext((x), (xs), (n)) +# ifdef gettext_noop +# define N_(x) gettext_noop(x) +# else +# define N_(x) x +# endif +# endif +#else +# define _(x) ((char *)(x)) +# define NGETTEXT(x, xs, n) (((n) == 1) ? (char *)(x) : (char *)(xs)) +# define N_(x) x +# ifdef bindtextdomain +# undef bindtextdomain +# endif +# define bindtextdomain(x, y) "" +# ifdef bind_textdomain_codeset +# undef bind_textdomain_codeset +# endif +# define bind_textdomain_codeset(x, y) // empty +# ifdef textdomain +# undef textdomain +# endif +# define textdomain(x) // empty +#endif + +/* + * Flags for update_screen(). + * The higher the value, the higher the priority. + */ +#define UPD_VALID_NO_UPDATE 5 // no new changes, keep the command line if + // possible +#define UPD_VALID 10 // buffer not changed, or changes marked + // with b_mod_* +#define UPD_INVERTED 20 // redisplay inverted part that changed +#define UPD_INVERTED_ALL 25 // redisplay whole inverted part +#define UPD_REDRAW_TOP 30 // display first w_upd_rows screen lines +#define UPD_SOME_VALID 35 // like UPD_NOT_VALID but may scroll +#define UPD_NOT_VALID 40 // buffer needs complete redraw +#define UPD_CLEAR 50 // screen messed up, clear it + +// flags for screen_line() +#define SLF_RIGHTLEFT 1 +#define SLF_POPUP 2 +#define SLF_INC_VCOL 4 + +#define MB_FILLER_CHAR '<' // character used when a double-width character + // doesn't fit. + +/* + * Flags for w_valid. + * These are set when something in a window structure becomes invalid, except + * when the cursor is moved. Call check_cursor_moved() before testing one of + * the flags. + * These are reset when that thing has been updated and is valid again. + * + * Every function that invalidates one of these must call one of the + * invalidate_* functions. + * + * w_valid is supposed to be used only in screen.c. From other files, use the + * functions that set or reset the flags. + * + * VALID_BOTLINE VALID_BOTLINE_AP + * on on w_botline valid + * off on w_botline approximated + * off off w_botline not valid + * on off not possible + */ +#define VALID_WROW 0x01 // w_wrow (window row) is valid +#define VALID_WCOL 0x02 // w_wcol (window col) is valid +#define VALID_VIRTCOL 0x04 // w_virtcol (file col) is valid +#define VALID_CHEIGHT 0x08 // w_cline_height and w_cline_folded valid +#define VALID_CROW 0x10 // w_cline_row is valid +#define VALID_BOTLINE 0x20 // w_botline and w_empty_rows are valid +#define VALID_BOTLINE_AP 0x40 // w_botline is approximated +#define VALID_TOPLINE 0x80 // w_topline is valid (for cursor position) + +// Values for w_popup_flags. +#define POPF_IS_POPUP 0x01 // this is a popup window +#define POPF_HIDDEN 0x02 // popup is not displayed +#define POPF_HIDDEN_FORCE 0x04 // popup is explicitly set to not be displayed +#define POPF_CURSORLINE 0x08 // popup is highlighting at the cursorline +#define POPF_ON_CMDLINE 0x10 // popup overlaps command line +#define POPF_DRAG 0x20 // popup can be moved by dragging border +#define POPF_DRAGALL 0x40 // popup can be moved by dragging everywhere +#define POPF_RESIZE 0x80 // popup can be resized by dragging +#define POPF_MAPPING 0x100 // mapping keys +#define POPF_INFO 0x200 // used for info of popup menu +#define POPF_INFO_MENU 0x400 // align info popup with popup menu +#define POPF_POSINVERT 0x800 // vertical position can be inverted +#define POPF_OPACITY 0x1000 // popup has opacity/transparency setting + +// flags used in w_popup_handled +#define POPUP_HANDLED_1 0x01 // used by mouse_find_win() +#define POPUP_HANDLED_2 0x02 // used by popup_do_filter() +#define POPUP_HANDLED_3 0x04 // used by popup_check_cursor_pos() +#define POPUP_HANDLED_4 0x08 // used by may_update_popup_mask() +#define POPUP_HANDLED_5 0x10 // used by update_popups() + +/* + * Terminal highlighting attribute bits. + * Attributes above HL_ALL are used for syntax highlighting. + */ +#define HL_NORMAL 0x00 +#define HL_INVERSE 0x01 +#define HL_BOLD 0x02 +#define HL_ITALIC 0x04 +#define HL_UNDERLINE 0x08 +#define HL_UNDERCURL 0x10 +#define HL_UNDERDOUBLE 0x20 +#define HL_UNDERDOTTED 0x40 +#define HL_UNDERDASHED 0x80 +#define HL_STANDOUT 0x100 +#define HL_NOCOMBINE 0x200 +#define HL_STRIKETHROUGH 0x400 +#define HL_ALL 0x7ff + +// special attribute addition: Put message in history +#define MSG_HIST 0x1000 + +/* + * Values for State. + * + * The lower bits up to 0x80 are used to distinguish normal/visual/op_pending + * /cmdline/insert/replace/terminal mode. This is used for mapping. If none + * of these bits are set, no mapping is done. See the comment above do_map(). + * The upper bits are used to distinguish between other states and variants of + * the base modes. + */ +#define MODE_NORMAL 0x01 // Normal mode, command expected +#define MODE_VISUAL 0x02 // Visual mode - use get_real_state() +#define MODE_OP_PENDING 0x04 // Normal mode, operator is pending - use + // get_real_state() +#define MODE_CMDLINE 0x08 // Editing the command line +#define MODE_INSERT 0x10 // Insert mode, also for Replace mode +#define MODE_LANGMAP 0x20 // Language mapping, can be combined with + // MODE_INSERT and MODE_CMDLINE +#define MODE_SELECT 0x40 // Select mode, use get_real_state() +#define MODE_TERMINAL 0x80 // Terminal mode + +#define MAP_ALL_MODES 0xff // all mode bits used for mapping + +#define REPLACE_FLAG 0x100 // Replace mode flag +#define MODE_REPLACE (REPLACE_FLAG | MODE_INSERT) +#define VREPLACE_FLAG 0x200 // Virtual-replace mode flag +#define MODE_VREPLACE (REPLACE_FLAG | VREPLACE_FLAG | MODE_INSERT) +#define MODE_LREPLACE (REPLACE_FLAG | MODE_LANGMAP) + +#define MODE_NORMAL_BUSY (0x1000 | MODE_NORMAL) + // Normal mode, busy with a command +#define MODE_HITRETURN (0x2000 | MODE_NORMAL) + // waiting for return or command +#define MODE_ASKMORE 0x3000 // Asking if you want --more-- +#define MODE_SETWSIZE 0x4000 // window size has changed +#define MODE_EXTERNCMD 0x5000 // executing an external command +#define MODE_SHOWMATCH (0x6000 | MODE_INSERT) // show matching paren +#define MODE_CONFIRM 0x7000 // ":confirm" prompt +#define MODE_ALL 0xffff + +#define MODE_MAX_LENGTH 4 // max mode length used by get_mode(), + // including the terminating NUL + +// directions +#define FORWARD 1 +#define BACKWARD (-1) +#define FORWARD_FILE 3 +#define BACKWARD_FILE (-3) + +// return values for functions +#if !(defined(OK) && (OK == 1)) +// OK already defined to 1 in MacOS X curses, skip this +# define OK 1 +#endif +#define FAIL 0 +#define NOTDONE 2 // not OK or FAIL but skipped + +// flags for b_flags +#define BF_RECOVERED 0x01 // buffer has been recovered +#define BF_CHECK_RO 0x02 // need to check readonly when loading file + // into buffer (set by ":e", may be reset by + // ":buf" +#define BF_NEVERLOADED 0x04 // file has never been loaded into buffer, + // many variables still need to be set +#define BF_NOTEDITED 0x08 // Set when file name is changed after + // starting to edit, reset when file is + // written out. +#define BF_NEW 0x10 // file didn't exist when editing started +#define BF_NEW_W 0x20 // Warned for BF_NEW and file created +#define BF_READERR 0x40 // got errors while reading the file +#define BF_DUMMY 0x80 // dummy buffer, only used internally +#define BF_PRESERVED 0x100 // ":preserve" was used +#define BF_SYN_SET 0x200 // 'syntax' option was set +#define BF_NO_SEA 0x400 // no swap_exists_action (ATTENTION prompt) + +// Mask to check for flags that prevent normal writing +#define BF_WRITE_MASK (BF_NOTEDITED + BF_NEW + BF_READERR) + +/* + * values for xp_context when doing command line completion + */ +#define EXPAND_UNSUCCESSFUL (-2) +#define EXPAND_OK (-1) +#define EXPAND_NOTHING 0 +#define EXPAND_COMMANDS 1 +#define EXPAND_FILES 2 +#define EXPAND_DIRECTORIES 3 +#define EXPAND_SETTINGS 4 +#define EXPAND_BOOL_SETTINGS 5 +#define EXPAND_TAGS 6 +#define EXPAND_OLD_SETTING 7 +#define EXPAND_HELP 8 +#define EXPAND_BUFFERS 9 +#define EXPAND_EVENTS 10 +#define EXPAND_MENUS 11 +#define EXPAND_SYNTAX 12 +#define EXPAND_HIGHLIGHT 13 +#define EXPAND_AUGROUP 14 +#define EXPAND_USER_VARS 15 +#define EXPAND_MAPPINGS 16 +#define EXPAND_TAGS_LISTFILES 17 +#define EXPAND_FUNCTIONS 18 +#define EXPAND_USER_FUNC 19 +#define EXPAND_EXPRESSION 20 +#define EXPAND_MENUNAMES 21 +#define EXPAND_USER_COMMANDS 22 +#define EXPAND_USER_CMD_FLAGS 23 +#define EXPAND_USER_NARGS 24 +#define EXPAND_USER_COMPLETE 25 +#define EXPAND_ENV_VARS 26 +#define EXPAND_LANGUAGE 27 +#define EXPAND_COLORS 28 +#define EXPAND_COMPILER 29 +#define EXPAND_USER_DEFINED 30 +#define EXPAND_USER_LIST 31 +#define EXPAND_SHELLCMD 32 +#define EXPAND_CSCOPE 33 +#define EXPAND_SIGN 34 +#define EXPAND_PROFILE 35 +#define EXPAND_BEHAVE 36 +#define EXPAND_FILETYPE 37 +#define EXPAND_FILES_IN_PATH 38 +#define EXPAND_OWNSYNTAX 39 +#define EXPAND_LOCALES 40 +#define EXPAND_HISTORY 41 +#define EXPAND_USER 42 +#define EXPAND_SYNTIME 43 +#define EXPAND_USER_ADDR_TYPE 44 +#define EXPAND_PACKADD 45 +#define EXPAND_MESSAGES 46 +#define EXPAND_MAPCLEAR 47 +#define EXPAND_ARGLIST 48 +#define EXPAND_DIFF_BUFFERS 49 +#define EXPAND_DISASSEMBLE 50 +#define EXPAND_BREAKPOINT 51 +#define EXPAND_SCRIPTNAMES 52 +#define EXPAND_RUNTIME 53 +#define EXPAND_STRING_SETTING 54 +#define EXPAND_SETTING_SUBTRACT 55 +#define EXPAND_ARGOPT 56 +#define EXPAND_TERMINALOPT 57 +#define EXPAND_KEYMAP 58 +#define EXPAND_DIRS_IN_CDPATH 59 +#define EXPAND_SHELLCMDLINE 60 +#define EXPAND_FINDFUNC 61 +#define EXPAND_HIGHLIGHT_GROUP 62 +#define EXPAND_FILETYPECMD 63 +#define EXPAND_PATTERN_IN_BUF 64 +#define EXPAND_RETAB 65 + + +// Values for exmode_active (0 is no exmode) +#define EXMODE_NORMAL 1 +#define EXMODE_MNV 2 + +// Values for nextwild() and ExpandOne(). See ExpandOne() for meaning. +#define WILD_FREE 1 +#define WILD_EXPAND_FREE 2 +#define WILD_EXPAND_KEEP 3 +#define WILD_NEXT 4 +#define WILD_PREV 5 +#define WILD_ALL 6 +#define WILD_LONGEST 7 +#define WILD_ALL_KEEP 8 +#define WILD_CANCEL 9 +#define WILD_APPLY 10 +#define WILD_PAGEUP 11 +#define WILD_PAGEDOWN 12 + +#define WILD_LIST_NOTFOUND 0x01 +#define WILD_HOME_REPLACE 0x02 +#define WILD_USE_NL 0x04 +#define WILD_NO_BEEP 0x08 +#define WILD_ADD_SLASH 0x10 +#define WILD_KEEP_ALL 0x20 +#define WILD_SILENT 0x40 +#define WILD_ESCAPE 0x80 +#define WILD_ICASE 0x100 +#define WILD_ALLLINKS 0x200 +#define WILD_IGNORE_COMPLETESLASH 0x400 +#define WILD_NOERROR 0x800 // sets EW_NOERROR +#define WILD_BUFLASTUSED 0x1000 +#define BUF_DIFF_FILTER 0x2000 +#define WILD_NOSELECT 0x4000 +#define WILD_MAY_EXPAND_PATTERN 0x8000 +#define WILD_FUNC_TRIGGER 0x10000 // called from wildtrigger() + +// Flags for expand_wildcards() +#define EW_DIR 0x01 // include directory names +#define EW_FILE 0x02 // include file names +#define EW_NOTFOUND 0x04 // include not found names +#define EW_ADDSLASH 0x08 // append slash to directory name +#define EW_KEEPALL 0x10 // keep all matches +#define EW_SILENT 0x20 // don't print "1 returned" from shell +#define EW_EXEC 0x40 // executable files +#define EW_PATH 0x80 // search in 'path' too +#define EW_ICASE 0x100 // ignore case +#define EW_NOERROR 0x200 // no error for bad regexp +#define EW_NOTWILD 0x400 // add match with literal name if exists +#define EW_KEEPDOLLAR 0x800 // do not escape $, $var is expanded +// Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND +// is used when executing commands and EW_SILENT for interactive expanding. +#define EW_ALLLINKS 0x1000 // also links not pointing to existing file +#define EW_SHELLCMD 0x2000 // called from expand_shellcmd(), don't check + // if executable is in $PATH +#define EW_DODOT 0x4000 // also files starting with a dot +#define EW_EMPTYOK 0x8000 // no matches is not an error +#define EW_NOTENV 0x10000 // do not expand environment variables +#define EW_CDPATH 0x20000 // search in 'cdpath' too + +// Flags for find_file_*() functions. +#define FINDFILE_FILE 0 // only files +#define FINDFILE_DIR 1 // only directories +#define FINDFILE_BOTH 2 // files and directories + +#if defined(FEAT_TABPANEL) +# define COLUMNS_WITHOUT_TPL() (Columns - tabpanel_width()) +# define TPL_LCOL() tabpanel_leftcol() +#else +# define COLUMNS_WITHOUT_TPL() Columns +# define TPL_LCOL() 0 +#endif + +#define W_ENDCOL(wp) ((wp)->w_wincol + (wp)->w_width) +#ifdef FEAT_MENU +# define W_WINROW(wp) ((wp)->w_winrow + (wp)->w_winbar_height) +#else +# define W_WINROW(wp) (wp->w_winrow) +#endif + +// Values for the find_pattern_in_path() function args 'type' and 'action': +#define FIND_ANY 1 +#define FIND_DEFINE 2 +#define CHECK_PATH 3 + +#define ACTION_SHOW 1 +#define ACTION_GOTO 2 +#define ACTION_SPLIT 3 +#define ACTION_SHOW_ALL 4 +#define ACTION_EXPAND 5 + +#ifdef FEAT_SYN_HL +# define SST_MIN_ENTRIES 150 // minimal size for state stack array +# define SST_MAX_ENTRIES 1000 // maximal size for state stack array +# define SST_FIX_STATES 7 // size of sst_stack[]. +# define SST_DIST 16 // normal distance between entries +# define SST_INVALID ((synstate_T *)-1) // invalid syn_state pointer + +# define HL_CONTAINED 0x01 // not used on toplevel +# define HL_TRANSP 0x02 // has no highlighting +# define HL_ONELINE 0x04 // match within one line only +# define HL_HAS_EOL 0x08 // end pattern that matches with $ +# define HL_SYNC_HERE 0x10 // sync point after this item (syncing only) +# define HL_SYNC_THERE 0x20 // sync point at current line (syncing only) +# define HL_MATCH 0x40 // use match ID instead of item ID +# define HL_SKIPNL 0x80 // nextgroup can skip newlines +# define HL_SKIPWHITE 0x100 // nextgroup can skip white space +# define HL_SKIPEMPTY 0x200 // nextgroup can skip empty lines +# define HL_KEEPEND 0x400 // end match always kept +# define HL_EXCLUDENL 0x800 // exclude NL from match +# define HL_DISPLAY 0x1000 // only used for displaying, not syncing +# define HL_FOLD 0x2000 // define fold +# define HL_EXTEND 0x4000 // ignore a keepend +# define HL_MATCHCONT 0x8000 // match continued from previous line +# define HL_TRANS_CONT 0x10000 // transparent item without contains arg +# define HL_CONCEAL 0x20000 // can be concealed +# define HL_CONCEALENDS 0x40000 // can be concealed +# define HL_INCLUDED_TOPLEVEL 0x80000 // toplevel item in included syntax, allowed by contains=TOP +#endif + +// Values for 'options' argument in do_search() and searchit() +#define SEARCH_REV 0x01 // go in reverse of previous dir. +#define SEARCH_ECHO 0x02 // echo the search command and handle options +#define SEARCH_MSG 0x0c // give messages (yes, it's not 0x04) +#define SEARCH_NFMSG 0x08 // give all messages except not found +#define SEARCH_OPT 0x10 // interpret optional flags +#define SEARCH_HIS 0x20 // put search pattern in history +#define SEARCH_END 0x40 // put cursor at end of match +#define SEARCH_NOOF 0x80 // don't add offset to position +#define SEARCH_START 0x100 // start search without col offset +#define SEARCH_MARK 0x200 // set previous context mark +#define SEARCH_KEEP 0x400 // keep previous search pattern +#define SEARCH_PEEK 0x800 // peek for typed char, cancel search +#define SEARCH_COL 0x1000 // start at specified column instead of zero + +// Values for find_ident_under_cursor() +#define FIND_IDENT 1 // find identifier (word) +#define FIND_STRING 2 // find any string (WORD) +#define FIND_EVAL 4 // include "->", "[]" and "." +#define FIND_NOERROR 8 // no error when no word found + +// Values for file_name_in_line() +#define FNAME_MESS 1 // give error message +#define FNAME_EXP 2 // expand to path +#define FNAME_HYP 4 // check for hypertext link +#define FNAME_INCL 8 // apply 'includeexpr' +#define FNAME_REL 16 // ".." and "./" are relative to the (current) + // file instead of the current directory +#define FNAME_UNESC 32 // remove backslashes used for escaping + +// Values for buflist_getfile() +#define GETF_SETMARK 0x01 // set pcmark before jumping +#define GETF_ALT 0x02 // jumping to alternate file (not buf num) +#define GETF_SWITCH 0x04 // respect 'switchbuf' settings when jumping + +// Return values of getfile() +#define GETFILE_ERROR 1 // normal error +#define GETFILE_NOT_WRITTEN 2 // "not written" error +#define GETFILE_SAME_FILE 0 // success, same file +#define GETFILE_OPEN_OTHER (-1) // success, opened another file +#define GETFILE_UNUSED 8 +#define GETFILE_SUCCESS(x) ((x) <= 0) + +// Values for buflist_new() flags +#define BLN_CURBUF 1 // may re-use curbuf for new buffer +#define BLN_LISTED 2 // put new buffer in buffer list +#define BLN_DUMMY 4 // allocating dummy buffer +#define BLN_NEW 8 // create a new buffer +#define BLN_NOOPT 16 // don't copy options to existing buffer +#define BLN_DUMMY_OK 32 // also find an existing dummy buffer +#define BLN_REUSE 64 // may re-use number from buf_reuse +#define BLN_NOCURWIN 128 // buffer is not associated with curwin + +// Values for in_cinkeys() +#define KEY_OPEN_FORW 0x101 +#define KEY_OPEN_BACK 0x102 +#define KEY_COMPLETE 0x103 // end of completion + +// Used for the first argument of do_map() +#define MAPTYPE_MAP 0 +#define MAPTYPE_UNMAP 1 +#define MAPTYPE_NOREMAP 2 +#define MAPTYPE_UNMAP_LHS 3 + +// Values for "noremap" argument of ins_typebuf(). Also used for +// map->m_noremap and menu->noremap[]. +#define REMAP_YES 0 // allow remapping +#define REMAP_NONE (-1) // no remapping +#define REMAP_SCRIPT (-2) // remap script-local mappings only +#define REMAP_SKIP (-3) // no remapping for first char + +// Values for mch_call_shell() second argument +#define SHELL_FILTER 1 // filtering text +#define SHELL_EXPAND 2 // expanding wildcards +#define SHELL_COOKED 4 // set term to cooked mode +#define SHELL_DOOUT 8 // redirecting output +#define SHELL_SILENT 16 // don't print error returned by command +#define SHELL_READ 32 // read lines and insert into buffer +#define SHELL_WRITE 64 // write lines from buffer + +// Values returned by mch_nodetype() +#define NODE_NORMAL 0 // file or directory, check with mch_isdir() +#define NODE_WRITABLE 1 // something we can write to (character + // device, fifo, socket, ..) +#define NODE_OTHER 2 // non-writable thing (e.g., block device) + +// Values for readfile() flags +#define READ_NEW 0x01 // read a file into a new buffer +#define READ_FILTER 0x02 // read filter output +#define READ_STDIN 0x04 // read from stdin +#define READ_BUFFER 0x08 // read from curbuf (converting stdin) +#define READ_DUMMY 0x10 // reading into a dummy buffer +#define READ_KEEP_UNDO 0x20 // keep undo info +#define READ_FIFO 0x40 // read from fifo or socket +#define READ_NOWINENTER 0x80 // do not trigger BufWinEnter +#define READ_NOFILE 0x100 // do not read a file, do trigger BufReadCmd + +// Values for change_indent() +#define INDENT_SET 1 // set indent +#define INDENT_INC 2 // increase indent +#define INDENT_DEC 3 // decrease indent + +// Values for flags argument for findmatchlimit() +#define FM_BACKWARD 0x01 // search backwards +#define FM_FORWARD 0x02 // search forwards +#define FM_BLOCKSTOP 0x04 // stop at start/end of block +#define FM_SKIPCOMM 0x08 // skip comments + +// Values for action argument for do_buffer() and close_buffer() +#define DOBUF_GOTO 0 // go to specified buffer +#define DOBUF_SPLIT 1 // split window and go to specified buffer +#define DOBUF_UNLOAD 2 // unload specified buffer(s) +#define DOBUF_DEL 3 // delete specified buffer(s) from buflist +#define DOBUF_WIPE 4 // delete specified buffer(s) really +#define DOBUF_WIPE_REUSE 5 // like DOBUF_WIPE and keep number for reuse + +// Values for start argument for do_buffer() +#define DOBUF_CURRENT 0 // "count" buffer from current buffer +#define DOBUF_FIRST 1 // "count" buffer from first buffer +#define DOBUF_LAST 2 // "count" buffer from last buffer +#define DOBUF_MOD 3 // "count" mod. buffer from current buffer + +// Values for flags argument of do_buffer() +#define DOBUF_FORCEIT 1 // :cmd! +#define DOBUF_NOPOPUP 2 // skip popup window buffers +#define DOBUF_SKIPHELP 4 // skip or keep help buffers depending on b_help of the + // starting buffer + +// Values for sub_cmd and which_pat argument for search_regcomp() +// Also used for which_pat argument for searchit() +#define RE_SEARCH 0 // save/use pat in/from search_pattern +#define RE_SUBST 1 // save/use pat in/from subst_pattern +#define RE_BOTH 2 // save pat in both patterns +#define RE_LAST 2 // use last used pattern if "pat" is NULL + +// Second argument for mnv_regcomp(). +#define RE_MAGIC 1 // 'magic' option +#define RE_STRING 2 // match in string instead of buffer text +#define RE_STRICT 4 // don't allow [abc] without ] +#define RE_AUTO 8 // automatic engine selection + +#ifdef FEAT_SYN_HL +// values for reg_do_extmatch +# define REX_SET 1 // to allow \z\(...\), +# define REX_USE 2 // to allow \z\1 et al. +# define REX_ALL (REX_SET | REX_USE) +#endif + +// Return values for fullpathcmp() +// Note: can use (fullpathcmp() & FPC_SAME) to check for equal files +#define FPC_SAME 1 // both exist and are the same file. +#define FPC_DIFF 2 // both exist and are different files. +#define FPC_NOTX 4 // both don't exist. +#define FPC_DIFFX 6 // one of them doesn't exist. +#define FPC_SAMEX 7 // both don't exist and file names are same. + +// flags for do_ecmd() +#define ECMD_HIDE 0x01 // don't free the current buffer +#define ECMD_SET_HELP 0x02 // set b_help flag of (new) buffer before + // opening file +#define ECMD_OLDBUF 0x04 // use existing buffer if it exists +#define ECMD_FORCEIT 0x08 // ! used in Ex command +#define ECMD_ADDBUF 0x10 // don't edit, just add to buffer list +#define ECMD_ALTBUF 0x20 // like ECMD_ADDBUF and set the alternate file +#define ECMD_NOWINENTER 0x40 // do not trigger BufWinEnter + +// for lnum argument in do_ecmd() +#define ECMD_LASTL (linenr_T)0 // use last position in loaded file +#define ECMD_LAST ((linenr_T)-1) // use last position in all files +#define ECMD_ONE (linenr_T)1 // use first line + +// flags for do_cmdline() +#define DOCMD_VERBOSE 0x01 // included command in error message +#define DOCMD_NOWAIT 0x02 // don't call wait_return() and friends +#define DOCMD_REPEAT 0x04 // repeat exec. until getline() returns NULL +#define DOCMD_KEYTYPED 0x08 // don't reset KeyTyped +#define DOCMD_EXCRESET 0x10 // reset exception environment (for debugging) +#define DOCMD_KEEPLINE 0x20 // keep typed line for repeating with "." +#define DOCMD_RANGEOK 0x40 // can use a range without ":" in MNV9 script + +// flags for beginline() +#define BL_WHITE 1 // cursor on first non-white in the line +#define BL_SOL 2 // use 'sol' option +#define BL_FIX 4 // don't leave cursor on a NUL + +// flags for mf_sync() +#define MFS_ALL 1 // also sync blocks with negative numbers +#define MFS_STOP 2 // stop syncing when a character is available +#define MFS_FLUSH 4 // flushed file to disk +#define MFS_ZERO 8 // only write block 0 + +// flags for buf_copy_options() +#define BCO_ENTER 1 // going to enter the buffer +#define BCO_ALWAYS 2 // always copy the options +#define BCO_NOHELP 4 // don't touch the help related options + +// flags for do_put() +#define PUT_FIXINDENT 1 // make indent look nice +#define PUT_CURSEND 2 // leave cursor after end of new text +#define PUT_CURSLINE 4 // leave cursor on last line of new text +#define PUT_LINE 8 // put register as lines +#define PUT_LINE_SPLIT 16 // split line for linewise register +#define PUT_LINE_FORWARD 32 // put linewise register below Visual sel. +#define PUT_BLOCK_INNER 64 // in block mode, do not add trailing spaces + +// flags for set_indent() +#define SIN_CHANGED 1 // call changed_bytes() when line changed +#define SIN_INSERT 2 // insert indent before existing text +#define SIN_UNDO 4 // save line for undo before changing it + +// flags for insertchar() +#define INSCHAR_FORMAT 1 // force formatting +#define INSCHAR_DO_COM 2 // format comments +#define INSCHAR_CTRLV 4 // char typed just after CTRL-V +#define INSCHAR_NO_FEX 8 // don't use 'formatexpr' +#define INSCHAR_COM_LIST 16 // format comments with list/2nd line indent + +// flags for open_line() +#define OPENLINE_DELSPACES 0x01 // delete spaces after cursor +#define OPENLINE_DO_COM 0x02 // format comments +#define OPENLINE_KEEPTRAIL 0x04 // keep trailing spaces +#define OPENLINE_MARKFIX 0x08 // fix mark positions +#define OPENLINE_COM_LIST 0x10 // format comments with list/2nd line indent +#define OPENLINE_FORMAT 0x20 // formatting long comment +#define OPENLINE_FORCE_INDENT 0x40 // use second_line_indent without indent logic + +// There are five history tables: +#define HIST_CMD 0 // colon commands +#define HIST_SEARCH 1 // search commands +#define HIST_EXPR 2 // expressions (from entering = register) +#define HIST_INPUT 3 // input() lines +#define HIST_DEBUG 4 // debug commands +#define HIST_COUNT 5 // number of history tables + +// The type numbers are fixed for backwards compatibility. +#define BARTYPE_VERSION 1 +#define BARTYPE_HISTORY 2 +#define BARTYPE_REGISTER 3 +#define BARTYPE_MARK 4 + +#define MNVINFO_VERSION 4 +#define MNVINFO_VERSION_WITH_HISTORY 2 +#define MNVINFO_VERSION_WITH_REGISTERS 3 +#define MNVINFO_VERSION_WITH_MARKS 4 + +/* + * Values for do_tag(). + */ +#define DT_TAG 1 // jump to newer position or same tag again +#define DT_POP 2 // jump to older position +#define DT_NEXT 3 // jump to next match of same tag +#define DT_PREV 4 // jump to previous match of same tag +#define DT_FIRST 5 // jump to first match of same tag +#define DT_LAST 6 // jump to first match of same tag +#define DT_SELECT 7 // jump to selection from list +#define DT_HELP 8 // like DT_TAG, but no wildcards +#define DT_JUMP 9 // jump to new tag or selection from list +#define DT_CSCOPE 10 // cscope find command (like tjump) +#define DT_LTAG 11 // tag using location list +#define DT_FREE 99 // free cached matches + +/* + * flags for find_tags(). + */ +#define TAG_HELP 1 // only search for help tags +#define TAG_NAMES 2 // only return name of tag +#define TAG_REGEXP 4 // use tag pattern as regexp +#define TAG_NOIC 8 // don't always ignore case +#ifdef FEAT_CSCOPE +# define TAG_CSCOPE 16 // cscope tag +#endif +#define TAG_VERBOSE 32 // message verbosity +#define TAG_INS_COMP 64 // Currently doing insert completion +#define TAG_KEEP_LANG 128 // keep current language +#define TAG_NO_TAGFUNC 256 // do not use 'tagfunc' + +#define TAG_MANY 300 // When finding many tags (for completion), + // find up to this many tags + +/* + * Types of dialogs passed to do_mnv_dialog(). + */ +#define MNV_GENERIC 0 +#define MNV_ERROR 1 +#define MNV_WARNING 2 +#define MNV_INFO 3 +#define MNV_QUESTION 4 +#define MNV_LAST_TYPE 4 // sentinel value + +/* + * Return values for functions like gui_yesnocancel() + */ +#define MNV_YES 2 +#define MNV_NO 3 +#define MNV_CANCEL 4 +#define MNV_ALL 5 +#define MNV_DISCARDALL 6 + +/* + * arguments for win_split() + */ +#define WSP_ROOM 0x01 // require enough room +#define WSP_VERT 0x02 // split/equalize vertically +#define WSP_HOR 0x04 // equalize horizontally +#define WSP_TOP 0x08 // window at top-left of shell +#define WSP_BOT 0x10 // window at bottom-right of shell +#define WSP_HELP 0x20 // creating the help window +#define WSP_BELOW 0x40 // put new window below/right +#define WSP_ABOVE 0x80 // put new window above/left +#define WSP_NEWLOC 0x100 // don't copy location list +#define WSP_FORCE_ROOM 0x200 // ignore "not enough room" errors +#define WSP_QUICKFIX 0x400 // creating the quickfix window + +/* + * arguments for gui_set_shellsize() + */ +#define RESIZE_VERT 1 // resize vertically +#define RESIZE_HOR 2 // resize horizontally +#define RESIZE_BOTH 15 // resize in both directions + +/* + * flags for check_changed() + */ +#define CCGD_AW 1 // do autowrite if buffer was changed +#define CCGD_MULTWIN 2 // check also when several wins for the buf +#define CCGD_FORCEIT 4 // ! used +#define CCGD_ALLBUF 8 // may write all buffers +#define CCGD_EXCMD 16 // may suggest using ! + +/* + * "flags" values for option-setting functions. + * When OPT_GLOBAL and OPT_LOCAL are both missing, set both local and global + * values, get local value. + */ +#define OPT_FREE 0x01 // free old value if it was allocated +#define OPT_GLOBAL 0x02 // use global value +#define OPT_LOCAL 0x04 // use local value +#define OPT_MODELINE 0x08 // option in modeline +#define OPT_WINONLY 0x10 // only set window-local options +#define OPT_NOWIN 0x20 // don't set window-local options +#define OPT_ONECOLUMN 0x40 // list options one per line +#define OPT_NO_REDRAW 0x80 // ignore redraw flags on option +#define OPT_SKIPRTP 0x100 // "skiprtp" in 'sessionoptions' + +// Magic chars used in confirm dialog strings +#define DLG_BUTTON_SEP '\n' +#define DLG_HOTKEY_CHAR '&' + +// Values for "starting" +#define NO_SCREEN 2 // no screen updating yet +#define NO_BUFFERS 1 // not all buffers loaded yet +// 0 not starting anymore + +// Values for swap_exists_action: what to do when swap file already exists +#define SEA_NONE 0 // don't use dialog +#define SEA_DIALOG 1 // use dialog when possible +#define SEA_QUIT 2 // quit editing the file +#define SEA_RECOVER 3 // recover the file +#define SEA_READONLY 4 // no dialog, mark buffer as read-only + +/* + * Minimal size for block 0 of a swap file. + * NOTE: This depends on size of struct block0! It's not done with a sizeof(), + * because struct block0 is defined in memline.c (Sorry). + * The maximal block size is arbitrary. + */ +#define MIN_SWAP_PAGE_SIZE 1048 +#define MAX_SWAP_PAGE_SIZE 50000 + +// Special values for current_sctx.sc_sid. +#define SID_MODELINE (-1) // when using a modeline +#define SID_CMDARG (-2) // for "--cmd" argument +#define SID_CARG (-3) // for "-c" argument +#define SID_ENV (-4) // for sourcing environment variable +#define SID_ERROR (-5) // option was reset because of an error +#define SID_NONE (-6) // don't set scriptID +#define SID_WINLAYOUT (-7) // changing window size + +/* + * Events for autocommands. Must be kept in sync with "event_tab". + */ +enum auto_event +{ + EVENT_BUFADD = 0, // after adding a buffer to the buffer list + EVENT_BUFCREATE, // UNUSED: BufCreate == BufAdd + EVENT_BUFDELETE, // deleting a buffer from the buffer list + EVENT_BUFENTER, // after entering a buffer + EVENT_BUFFILEPOST, // after renaming a buffer + EVENT_BUFFILEPRE, // before renaming a buffer + EVENT_BUFHIDDEN, // just after buffer becomes hidden + EVENT_BUFLEAVE, // before leaving a buffer + EVENT_BUFNEW, // after creating any buffer + EVENT_BUFNEWFILE, // when creating a buffer for a new file + EVENT_BUFREAD, // UNUSED: BufRead == BufReadPost + EVENT_BUFREADCMD, // read buffer using command + EVENT_BUFREADPOST, // after reading a buffer + EVENT_BUFREADPRE, // before reading a buffer + EVENT_BUFUNLOAD, // just before unloading a buffer + EVENT_BUFWINENTER, // after showing a buffer in a window + EVENT_BUFWINLEAVE, // just after buffer removed from window + EVENT_BUFWIPEOUT, // just before really deleting a buffer + EVENT_BUFWRITE, // UNUSED: BufWrite == BufWritePost + EVENT_BUFWRITECMD, // write buffer using command + EVENT_BUFWRITEPOST, // after writing a buffer + EVENT_BUFWRITEPRE, // before writing a buffer + EVENT_CMDLINECHANGED, // command line was modified + EVENT_CMDLINEENTER, // after entering the command line + EVENT_CMDLINELEAVEPRE, // just before leaving the command line + EVENT_CMDLINELEAVE, // before leaving the command line + EVENT_CMDUNDEFINED, // command undefined + EVENT_CMDWINENTER, // after entering the cmdline window + EVENT_CMDWINLEAVE, // before leaving the cmdline window + EVENT_COLORSCHEME, // after loading a colorscheme + EVENT_COLORSCHEMEPRE, // before loading a colorscheme + EVENT_COMPLETECHANGED, // after completion popup menu changed + EVENT_COMPLETEDONE, // after finishing insert complete + EVENT_COMPLETEDONEPRE, // idem, before clearing info + EVENT_CURSORHOLD, // cursor in same position for a while + EVENT_CURSORHOLDI, // idem, in Insert mode + EVENT_CURSORMOVED, // cursor was moved + EVENT_CURSORMOVEDC, // cursor was moved in Command line mode + EVENT_CURSORMOVEDI, // cursor was moved in Insert mode + EVENT_DIFFUPDATED, // after diffs were updated + EVENT_DIRCHANGED, // after user changed directory + EVENT_DIRCHANGEDPRE, // before directory changes + EVENT_ENCODINGCHANGED, // after changing the 'encoding' option + EVENT_EXITPRE, // before exiting + EVENT_FILEAPPENDCMD, // append to a file using command + EVENT_FILEAPPENDPOST, // after appending to a file + EVENT_FILEAPPENDPRE, // before appending to a file + EVENT_FILECHANGEDRO, // before first change to read-only file + EVENT_FILECHANGEDSHELL, // after shell command that changed file + EVENT_FILECHANGEDSHELLPOST, // after (not) reloading changed file + EVENT_FILEENCODING, // UNUSED: FileEncoding == EncodingChanged + EVENT_FILEREADCMD, // read from a file using command + EVENT_FILEREADPOST, // after reading a file + EVENT_FILEREADPRE, // before reading a file + EVENT_FILETYPE, // new file type detected (user defined) + EVENT_FILEWRITECMD, // write to a file using command + EVENT_FILEWRITEPOST, // after writing a file + EVENT_FILEWRITEPRE, // before writing a file + EVENT_FILTERREADPOST, // after reading from a filter + EVENT_FILTERREADPRE, // before reading from a filter + EVENT_FILTERWRITEPOST, // after writing to a filter + EVENT_FILTERWRITEPRE, // before writing to a filter + EVENT_FOCUSGAINED, // got the focus + EVENT_FOCUSLOST, // lost the focus to another app + EVENT_FUNCUNDEFINED, // if calling a function which doesn't exist + EVENT_GUIENTER, // after starting the GUI + EVENT_GUIFAILED, // after starting the GUI failed + EVENT_INSERTCHANGE, // when changing Insert/Replace mode + EVENT_INSERTCHARPRE, // before inserting a char + EVENT_INSERTENTER, // when entering Insert mode + EVENT_INSERTLEAVE, // just after leaving Insert mode + EVENT_INSERTLEAVEPRE, // just before leaving Insert mode + EVENT_KEYINPUTPRE, // before key input + EVENT_MENUPOPUP, // just before popup menu is displayed + EVENT_MODECHANGED, // after changing the mode + EVENT_OPTIONSET, // option was set + EVENT_QUICKFIXCMDPOST, // after :make, :grep etc. + EVENT_QUICKFIXCMDPRE, // before :make, :grep etc. + EVENT_QUITPRE, // before :quit + EVENT_REMOTEREPLY, // upon string reception from a remote mnv + EVENT_SAFESTATE, // going to wait for a character + EVENT_SAFESTATEAGAIN, // still waiting for a character + EVENT_SESSIONLOADPOST, // after loading a session file + EVENT_SESSIONLOADPRE, // before loading a session file + EVENT_SESSIONWRITEPOST, // after writing a session file + EVENT_SHELLCMDPOST, // after ":!cmd" + EVENT_SHELLFILTERPOST, // after ":1,2!cmd", ":w !cmd", ":r !cmd". + EVENT_SIGUSR1, // after the SIGUSR1 signal + EVENT_SOURCECMD, // sourcing a MNV script using command + EVENT_SOURCEPOST, // after sourcing a MNV script + EVENT_SOURCEPRE, // before sourcing a MNV script + EVENT_SPELLFILEMISSING, // spell file missing + EVENT_STDINREADPOST, // after reading from stdin + EVENT_STDINREADPRE, // before reading from stdin + EVENT_SWAPEXISTS, // found existing swap file + EVENT_SYNTAX, // syntax selected + EVENT_TABCLOSED, // after closing a tab page + EVENT_TABCLOSEDPRE, // before closing a tab page + EVENT_TABENTER, // after entering a tab page + EVENT_TABLEAVE, // before leaving a tab page + EVENT_TABNEW, // when entering a new tab page + EVENT_TERMCHANGED, // after changing 'term' + EVENT_TERMINALOPEN, // after a terminal buffer was created + EVENT_TERMINALWINOPEN, // after a terminal buffer was created and + // entering its window + EVENT_TERMRESPONSE, // after setting "v:termresponse" + EVENT_TERMRESPONSEALL, // after setting terminal response vars + EVENT_TEXTCHANGED, // text was modified not in Insert mode + EVENT_TEXTCHANGEDI, // text was modified in Insert mode + EVENT_TEXTCHANGEDP, // TextChangedI with popup menu visible + EVENT_TEXTCHANGEDT, // text was modified in Terminal mode + EVENT_TEXTYANKPOST, // after some text was yanked + EVENT_USER, // user defined autocommand + EVENT_MNVENTER, // after starting MNV + EVENT_MNVLEAVE, // before exiting MNV + EVENT_MNVLEAVEPRE, // before exiting MNV and writing .mnvinfo + EVENT_MNVRESIZED, // after MNV window was resized + EVENT_MNVRESUME, // after MNV is resumed + EVENT_MNVSUSPEND, // before MNV is suspended + EVENT_WINCLOSED, // after closing a window + EVENT_WINENTER, // after entering a window + EVENT_WINLEAVE, // before leaving a window + EVENT_WINNEW, // after creating a new window + EVENT_WINNEWPRE, // before creating a new window + EVENT_WINRESIZED, // after a window was resized + EVENT_WINSCROLLED, // after a window was scrolled or resized + + NUM_EVENTS, // MUST be the last one +}; + +typedef enum auto_event event_T; + +/* + * Values for index in highlight_attr[]. + * When making changes, also update HL_FLAGS below! + * And update the default value of 'highlight': HIGHLIGHT_INIT in optiondefs.h + */ +typedef enum +{ + HLF_8 = 0 // Meta & special keys listed with ":map", text that is + // displayed different from what it is + , HLF_EOB // after the last line in the buffer + , HLF_AT // @ characters at end of screen, characters that + // don't really exist in the text + , HLF_D // directories in CTRL-D listing + , HLF_E // error messages + , HLF_H // obsolete, ignored + , HLF_I // incremental search + , HLF_L // last search string + , HLF_LC // last search string under cursor + , HLF_M // "--More--" message + , HLF_CM // Mode (e.g., "-- INSERT --") + , HLF_N // line number for ":number" and ":#" commands + , HLF_LNA // LineNrAbove + , HLF_LNB // LineNrBelow + , HLF_CLN // current line number + , HLF_CLS // current line sign column + , HLF_CLF // current line fold + , HLF_R // return to continue message and yes/no questions + , HLF_S // status lines + , HLF_SNC // status lines of not-current windows + , HLF_C // column to separate vertically split windows + , HLF_T // Titles for output from ":set all", ":autocmd" etc. + , HLF_V // Visual mode + , HLF_VNC // Visual mode, autoselecting and not clipboard owner + , HLF_W // warning messages + , HLF_WM // Wildmenu highlight + , HLF_FL // Folded line + , HLF_FC // Fold column + , HLF_ADD // Added diff line + , HLF_CHD // Changed diff line + , HLF_DED // Deleted diff line + , HLF_TXD // Text Changed in changed diff line + , HLF_TXA // Text Added in changed diff line + , HLF_CONCEAL // Concealed text + , HLF_SC // Sign column + , HLF_SPB // SpellBad + , HLF_SPC // SpellCap + , HLF_SPR // SpellRare + , HLF_SPL // SpellLocal + , HLF_PNI // popup menu normal item + , HLF_PSI // popup menu selected item + , HLF_PMNI // popup menu matched text in normal item + , HLF_PMSI // popup menu matched text in selected item + , HLF_PNK // popup menu normal item "kind" + , HLF_PSK // popup menu selected item "kind" + , HLF_PNX // popup menu normal item "menu" (extra text) + , HLF_PSX // popup menu selected item "menu" (extra text) + , HLF_PSB // popup menu scrollbar + , HLF_PST // popup menu scrollbar thumb + , HLF_PMB // popup menu border + , HLF_PMS // popup menu shadow + , HLF_TP // tabpage line + , HLF_TPS // tabpage line selected + , HLF_TPF // tabpage line filler + , HLF_CUC // 'cursorcolumn' + , HLF_CUL // 'cursorline' + , HLF_MC // 'colorcolumn' + , HLF_QFL // quickfix window line currently selected + , HLF_ST // status lines of terminal windows + , HLF_STNC // status lines of not-current terminal windows + , HLF_MSG // message area + , HLF_TPL // tabpanel + , HLF_TPLS // tabpanel selected + , HLF_TPLF // tabpanel filler + , HLF_PRI // "preinsert" in 'completeopt' + , HLF_WIN // window colour + , HLF_COUNT // MUST be the last one +} hlf_T; + +// The HL_FLAGS must be in the same order as the HLF_ enums! +// When changing this also adjust the default for 'highlight'. +#define HL_FLAGS {'8', '~', '@', 'd', 'e', 'h', 'i', 'l', 'y', 'm', 'M', \ + 'n', 'a', 'b', 'N', 'G', 'O', 'r', 's', 'S', 'c', 't', 'v', 'V', \ + 'w', 'W', 'f', 'F', 'A', 'C', 'D', 'T', 'E', '-', '>', \ + 'B', 'P', 'R', 'L', \ + '+', '=', 'k', '<','[', ']', '{', '}', 'x', 'X', 'j', 'H', \ + '*', '#', '_', '!', '.', 'o', 'q', \ + 'z', 'Z', 'g', \ + '%', '^', '&', 'I', '('} + +/* + * Values for behaviour in spell_move_to + */ +typedef enum +{ + SMT_ALL = 0 // Move to "all" words + , SMT_BAD // Move to "bad" words only + , SMT_RARE // Move to "rare" words only +} smt_T; +/* + * Boolean constants + */ +#ifndef TRUE +# define FALSE 0 // note: this is an int, not a long! +# define TRUE 1 +#endif + +#define MAYBE 2 // sometimes used for a variant on TRUE + +#define LOG_ALWAYS 9 // must be different from TRUE and FALSE + +#ifdef FEAT_JOB_CHANNEL +// If "--log logfile" was used or ch_logfile() was called then log some or all +// terminal output. +# define MAY_WANT_TO_LOG_THIS if (ch_log_output == FALSE) ch_log_output = TRUE; +#else +// no logging support +# define MAY_WANT_TO_LOG_THIS +#endif + +#ifndef UINT32_T +typedef UINT32_TYPEDEF UINT32_T; +#endif + +/* + * Operator IDs; The order must correspond to opchars[] in ops.c! + */ +#define OP_NOP 0 // no pending operation +#define OP_DELETE 1 // "d" delete operator +#define OP_YANK 2 // "y" yank operator +#define OP_CHANGE 3 // "c" change operator +#define OP_LSHIFT 4 // "<" left shift operator +#define OP_RSHIFT 5 // ">" right shift operator +#define OP_FILTER 6 // "!" filter operator +#define OP_TILDE 7 // "g~" switch case operator +#define OP_INDENT 8 // "=" indent operator +#define OP_FORMAT 9 // "gq" format operator +#define OP_COLON 10 // ":" colon operator +#define OP_UPPER 11 // "gU" make upper case operator +#define OP_LOWER 12 // "gu" make lower case operator +#define OP_JOIN 13 // "J" join operator, only for Visual mode +#define OP_JOIN_NS 14 // "gJ" join operator, only for Visual mode +#define OP_ROT13 15 // "g?" rot-13 encoding +#define OP_REPLACE 16 // "r" replace chars, only for Visual mode +#define OP_INSERT 17 // "I" Insert column, only for Visual mode +#define OP_APPEND 18 // "A" Append column, only for Visual mode +#define OP_FOLD 19 // "zf" define a fold +#define OP_FOLDOPEN 20 // "zo" open folds +#define OP_FOLDOPENREC 21 // "zO" open folds recursively +#define OP_FOLDCLOSE 22 // "zc" close folds +#define OP_FOLDCLOSEREC 23 // "zC" close folds recursively +#define OP_FOLDDEL 24 // "zd" delete folds +#define OP_FOLDDELREC 25 // "zD" delete folds recursively +#define OP_FORMAT2 26 // "gw" format operator, keeps cursor pos +#define OP_FUNCTION 27 // "g@" call 'operatorfunc' +#define OP_NR_ADD 28 // "" Add to the number or alphabetic + // character (OP_ADD conflicts with Perl) +#define OP_NR_SUB 29 // "" Subtract from the number or + // alphabetic character + +/* + * Motion types, used for operators and for yank/delete registers. + */ +#define MCHAR 0 // character-wise movement/register +#define MLINE 1 // line-wise movement/register +#define MBLOCK 2 // block-wise register + +#define MAUTO 0xff // Decide between MLINE/MCHAR + +/* + * Minimum screen size + */ +#define MIN_COLUMNS 12 // minimal columns for screen +#define MIN_LINES 2 // minimal lines for screen +#define MIN_CMDHEIGHT 1 // minimal height for command line +#define STATUS_HEIGHT 1 // default height of a status line under a + // window +#ifdef FEAT_MENU // height of a status line under a window +# define WINBAR_HEIGHT(wp) (wp)->w_winbar_height +# define VISIBLE_HEIGHT(wp) ((wp)->w_height + (wp)->w_winbar_height) +#else +# define WINBAR_HEIGHT(wp) 0 +# define VISIBLE_HEIGHT(wp) (wp)->w_height +#endif +#define QF_WINHEIGHT 10 // default height for quickfix window + +/* + * Buffer sizes + */ +#ifndef CMDBUFFSIZE +# define CMDBUFFSIZE 256 // size of the command processing buffer +#endif + +#define LSIZE 512 // max. size of a line in the tags file + +#define IOSIZE (1024+1) // file i/o and sprintf buffer size + +#define DIALOG_MSG_SIZE 1000 // buffer size for dialog_msg() + +#define MSG_BUF_LEN 480 // length of buffer for small messages +#define MSG_BUF_CLEN (MSG_BUF_LEN / 6) // cell length (worst case: utf-8 + // takes 6 bytes for one cell) + +#define FOLD_TEXT_LEN 51 // buffer size for get_foldtext() + +// Size of the buffer used for tgetent(). Unfortunately this is largely +// undocumented, some systems use 1024. Using a buffer that is too small +// causes a buffer overrun and a crash. Use the maximum known value to stay +// on the safe side. +#define TBUFSZ 2048 // buffer size for termcap entry + +/* + * Maximum length of key sequence to be mapped. + * Must be able to hold an Amiga resize report. + */ +#define MAXMAPLEN 50 + +// maximum length of a function name, including SID and NUL +#define MAX_FUNC_NAME_LEN 200 + +// Size in bytes of the hash used in the undo file. +#define UNDO_HASH_SIZE 32 + +#ifdef HAVE_FCNTL_H +# include +#endif + +#ifdef BINARY_FILE_IO +# define WRITEBIN "wb" // no CR-LF translation +# define READBIN "rb" +# define APPENDBIN "ab" +#else +# define WRITEBIN "w" +# define READBIN "r" +# define APPENDBIN "a" +#endif + +/* + * Cygwin doesn't have a global way of making open() use binary I/O. + * Use O_BINARY for all open() calls. + */ +#ifdef __CYGWIN__ +# define O_EXTRA O_BINARY +#else +# define O_EXTRA 0 +#endif + +#ifndef O_NOFOLLOW +# define O_NOFOLLOW 0 +#endif + +#ifndef W_OK +# define W_OK 2 // for systems that don't have W_OK in unistd.h +#endif +#ifndef R_OK +# define R_OK 4 // for systems that don't have R_OK in unistd.h +#endif + +// Allocate memory for one type and cast the returned pointer to have the +// compiler check the types. +#define ALLOC_ONE(type) (type *)alloc(sizeof(type)) +#define ALLOC_ONE_ID(type, id) (type *)alloc_id(sizeof(type), id) +#define ALLOC_MULT(type, count) (type *)alloc(sizeof(type) * (count)) +#define ALLOC_CLEAR_ONE(type) (type *)alloc_clear(sizeof(type)) +#define ALLOC_CLEAR_ONE_ID(type, id) (type *)alloc_clear_id(sizeof(type), id) +#define ALLOC_CLEAR_MULT(type, count) (type *)alloc_clear(sizeof(type) * (count)) +#define LALLOC_CLEAR_ONE(type) (type *)lalloc_clear(sizeof(type), FALSE) +#define LALLOC_CLEAR_MULT(type, count) (type *)lalloc_clear(sizeof(type) * (count), FALSE) +#define LALLOC_MULT(type, count) (type *)lalloc(sizeof(type) * (count), FALSE) + +#ifdef HAVE_MEMSET +# define mnv_memset(ptr, c, size) memset((ptr), (c), (size)) +#else +void *mnv_memset(void *, int, size_t); +#endif +#define CLEAR_FIELD(field) mnv_memset(&(field), 0, sizeof(field)) +#define CLEAR_POINTER(ptr) mnv_memset((ptr), 0, sizeof(*(ptr))) + +/* + * defines to avoid typecasts from (char_u *) to (char *) and back + * (mnv_strchr() and mnv_strrchr() are now in strings.c) + */ +#define STRLEN(s) strlen((char *)(s)) +#define STRCPY(d, s) strcpy((char *)(d), (char *)(s)) +#define STRNCPY(d, s, n) strncpy((char *)(d), (char *)(s), (size_t)(n)) +#define STRCMP(d, s) strcmp((char *)(d), (char *)(s)) +#define STRNCMP(d, s, n) strncmp((char *)(d), (char *)(s), (size_t)(n)) +#ifdef HAVE_STRCASECMP +# define STRICMP(d, s) strcasecmp((char *)(d), (char *)(s)) +#else +# ifdef HAVE_STRICMP +# define STRICMP(d, s) stricmp((char *)(d), (char *)(s)) +# else +# define STRICMP(d, s) mnv_stricmp((char *)(d), (char *)(s)) +# endif +#endif +#ifdef HAVE_STRCOLL +# define STRCOLL(d, s) strcoll((char *)(d), (char *)(s)) +#else +# define STRCOLL(d, s) strcmp((char *)(d), (char *)(s)) +#endif + +// Like strcpy() but allows overlapped source and destination. +#define STRMOVE(d, s) mch_memmove((d), (s), STRLEN(s) + 1) + +#ifdef HAVE_STRNCASECMP +# define STRNICMP(d, s, n) strncasecmp((char *)(d), (char *)(s), (size_t)(n)) +#else +# ifdef HAVE_STRNICMP +# define STRNICMP(d, s, n) strnicmp((char *)(d), (char *)(s), (size_t)(n)) +# else +# define STRNICMP(d, s, n) mnv_strnicmp((char *)(d), (char *)(s), (size_t)(n)) +# endif +#endif + +// We need to call mb_stricmp() even when we aren't dealing with a multi-byte +// encoding because mb_stricmp() takes care of all ascii and non-ascii +// encodings, including characters with umlauts in latin1, etc., while +// STRICMP() only handles the system locale version, which often does not +// handle non-ascii properly. + +#define MB_STRICMP(d, s) mb_strnicmp((char_u *)(d), (char_u *)(s), (int)MAXCOL) +#define MB_STRNICMP(d, s, n) mb_strnicmp((char_u *)(d), (char_u *)(s), (int)(n)) +#define MB_STRNICMP2(d, s, n1, n2) mb_strnicmp2((char_u *)(d), (char_u *)(s), (n1), (n2)) + +#define STRCAT(d, s) strcat((char *)(d), (char *)(s)) +#define STRNCAT(d, s, n) strncat((char *)(d), (char *)(s), (size_t)(n)) + +#ifdef HAVE_STRPBRK +# define mnv_strpbrk(s, cs) (char_u *)strpbrk((char *)(s), (char *)(cs)) +#endif + +#define OUT_STR(s) out_str((char_u *)(s)) +#define OUT_STR_NF(s) out_str_nf((char_u *)(s)) + +#ifdef FEAT_GUI +# ifdef FEAT_TERMGUICOLORS +# define GUI_FUNCTION(f) (gui.in_use ? gui_##f : termgui_##f) +# define GUI_FUNCTION2(f, pixel) (gui.in_use \ + ? ((pixel) != INVALCOLOR \ + ? gui_##f((pixel)) \ + : INVALCOLOR) \ + : termgui_##f((pixel))) +# define USE_24BIT (gui.in_use || p_tgc) +# else +# define GUI_FUNCTION(f) gui_##f +# define GUI_FUNCTION2(f,pixel) ((pixel) != INVALCOLOR \ + ? gui_##f((pixel)) \ + : INVALCOLOR) +# define USE_24BIT gui.in_use +# endif +#else +# ifdef FEAT_TERMGUICOLORS +# define GUI_FUNCTION(f) termgui_##f +# define GUI_FUNCTION2(f, pixel) termgui_##f((pixel)) +# define USE_24BIT p_tgc +# endif +#endif +#ifdef FEAT_TERMGUICOLORS +# define IS_CTERM (t_colors > 1 || p_tgc) +#else +# define IS_CTERM (t_colors > 1) +#endif +#ifdef GUI_FUNCTION +# define GUI_MCH_GET_RGB GUI_FUNCTION(mch_get_rgb) +# define GUI_MCH_GET_RGB2(pixel) GUI_FUNCTION2(mch_get_rgb, (pixel)) +# define GUI_MCH_GET_COLOR GUI_FUNCTION(mch_get_color) +# define GUI_GET_COLOR GUI_FUNCTION(get_color) +#endif + +// Prefer using emsgf(), because perror() may send the output to the wrong +// destination and mess up the screen. +#ifdef HAVE_STRERROR +# define PERROR(msg) (void)semsg("%s: %s", (char *)(msg), strerror(errno)) +#else +# define PERROR(msg) do_perror(msg) +#endif + +typedef long linenr_T; // line number type +typedef int colnr_T; // column number type +typedef unsigned short disptick_T; // display tick type + +/* + * Well, you won't believe it, but some S/390 machines ("host", now also known + * as zServer) use 31 bit pointers. There are also some newer machines, that + * use 64 bit pointers. I don't know how to distinguish between 31 and 64 bit + * machines, so the best way is to assume 31 bits whenever we detect OS/390 + * Unix. + * With this we restrict the maximum line length to 1073741823. I guess this is + * not a real problem. BTW: Longer lines are split. + */ +#ifdef __MVS__ +# define MAXCOL (0x3fffffffL) // maximum column number, 30 bits +# define MAXLNUM (0x3fffffffL) // maximum (invalid) line number +#else + // MAXCOL used to be INT_MAX, but with 64 bit ints that results in running + // out of memory when trying to allocate a very long line. +# define MAXCOL 0x7fffffffL // maximum column number +# define MAXLNUM LONG_MAX // maximum (invalid) line number +#endif + +#define SHOWCMD_COLS 10 // columns needed by shown command + +typedef void *mnv_acl_T; // dummy to pass an ACL to a function + +#ifndef mch_memmove +# define mch_memmove(to, from, len) memmove((char*)(to), (char*)(from), (size_t)(len)) +#endif + +/* + * fnamecmp() is used to compare file names. + * On some systems case in a file name does not matter, on others it does. + * (this does not account for maximum name lengths and things like "../dir", + * thus it is not 100% accurate!) + */ +#define fnamecmp(x, y) mnv_fnamecmp((char_u *)(x), (char_u *)(y)) +#define fnamencmp(x, y, n) mnv_fnamencmp((char_u *)(x), (char_u *)(y), (size_t)(n)) + +#if defined(UNIX) || defined(FEAT_GUI) || defined(VMS) \ + || defined(FEAT_CLIENTSERVER) +# define USE_INPUT_BUF +#endif + +#if !defined(EINTR) && !defined(PROTO) +# define read_eintr(fd, buf, count) mnv_read((fd), (buf), (count)) +# define write_eintr(fd, buf, count) mnv_write((fd), (buf), (count)) +#endif + +#ifdef MSWIN +// On MS-Windows the third argument isn't size_t. This matters for Win64, +// where sizeof(size_t)==8, not 4 +# define mnv_read(fd, buf, count) read((fd), (char *)(buf), (unsigned int)(count)) +# define mnv_write(fd, buf, count) write((fd), (char *)(buf), (unsigned int)(count)) +#else +# define mnv_read(fd, buf, count) read((fd), (char *)(buf), (size_t) (count)) +# define mnv_write(fd, buf, count) write((fd), (char *)(buf), (size_t) (count)) +#endif + +/* + * Enums need a typecast to be used as array index (for Ultrix). + */ +#define HL_ATTR(n) highlight_attr[(int)(n)] +#define TERM_STR(n) term_strings[(int)(n)] + +/* + * EXTERN is only defined in main.c. That's where global variables are + * actually defined and initialized. + */ +#ifndef EXTERN +# define EXTERN extern +# define INIT(x) +# define INIT2(a, b) +# define INIT3(a, b, c) +# define INIT4(a, b, c, d) +# define INIT5(a, b, c, d, e) +# define INIT6(a, b, c, d, e, f) +#else +# ifndef INIT +# define INIT(x) x +# define INIT2(a, b) = {a, b} +# define INIT3(a, b, c) = {a, b, c} +# define INIT4(a, b, c, d) = {a, b, c, d} +# define INIT5(a, b, c, d, e) = {a, b, c, d, e} +# define INIT6(a, b, c, d, e, f) = {a, b, c, d, e, f} +# define DO_INIT +# endif +#endif + +#define MAX_MCO 6 // maximum value for 'maxcombine' + +// Maximum number of bytes in a multi-byte character. It can be one 32-bit +// character of up to 6 bytes, or one 16-bit character of up to three bytes +// plus six following composing characters of three bytes each. +#define MB_MAXBYTES 21 + +#if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO) +# ifdef MSWIN +typedef LARGE_INTEGER proftime_T; +# define PROF_TIME_BLANK " " +# define PROF_TOTALS_HEADER "count total (s) self (s)" +# else + // Use tv_fsec for fraction of second (micro or nano) of proftime_T +# if defined(HAVE_TIMER_CREATE) && defined(HAVE_CLOCK_GETTIME) +# define PROF_NSEC 1 +typedef struct timespec proftime_T; +# define PROF_GET_TIME(tm) clock_gettime(CLOCK_MONOTONIC, tm) +# define tv_fsec tv_nsec +# define TV_FSEC_SEC 1000000000L +# define PROF_TIME_FORMAT "%3ld.%09ld" +# define PROF_TIME_BLANK " " +# define PROF_TOTALS_HEADER "count total (s) self (s)" +# else +typedef struct timeval proftime_T; +# define PROF_GET_TIME(tm) gettimeofday(tm, NULL) +# define tv_fsec tv_usec +# define TV_FSEC_SEC 1000000 +# define PROF_TIME_FORMAT "%3ld.%06ld" +# define PROF_TIME_BLANK " " +# define PROF_TOTALS_HEADER "count total (s) self (s)" +# endif +# endif +#else +typedef int proftime_T; // dummy for function prototypes +#endif + +// Type of compilation passed to compile_def_function() +typedef enum { + CT_NONE, // use df_instr + CT_PROFILE, // use df_instr_prof + CT_DEBUG // use df_instr_debug, overrules CT_PROFILE +} compiletype_T; + +/* + * When compiling with 32 bit Perl time_t is 32 bits in the Perl code but 64 + * bits elsewhere. That causes memory corruption. Define time_T and use it + * for global variables to avoid that. + */ +#ifdef MSWIN +typedef __time64_t time_T; +#else +typedef time_t time_T; +#endif + +#ifdef _WIN64 +typedef __int64 sock_T; +#else +typedef int sock_T; +#endif + +// The clipboard provider feature uses clipmethod as well but should be separate +// from the clipboard code. +#if defined(FEAT_CLIPBOARD) || defined(FEAT_EVAL) +# define HAVE_CLIPMETHOD +#endif + +#if defined(HAVE_CLIPMETHOD) && defined(FEAT_EVAL) +# define FEAT_CLIPBOARD_PROVIDER +#endif + +// Include option.h before structs.h, because the number of window-local and +// buffer-local options is used there. +#include "option.h" // options and default values + +#include "beval.h" // BalloonEval + +// Note that gui.h is included by structs.h + +#include "structs.h" // defines many structures +#include "xdiff/xdiff.h" // TODO: maybe remove this, but this brings in mmfile_t so it can compile + +#include "alloc.h" + +// Values for "do_profiling". +#define PROF_NONE 0 // profiling not started +#define PROF_YES 1 // profiling busy +#define PROF_PAUSED 2 // profiling paused + + +// Codes for mouse button events in lower three bits: +#define MOUSE_LEFT 0x00 +#define MOUSE_MIDDLE 0x01 +#define MOUSE_RIGHT 0x02 +#define MOUSE_RELEASE 0x03 + +// bit masks for modifiers: +#define MOUSE_SHIFT 0x04 +#define MOUSE_ALT 0x08 +#define MOUSE_CTRL 0x10 + +// mouse buttons that are handled like a key press (GUI only) +// Note that the scroll wheel keys are inverted: MOUSE_5 scrolls lines up but +// the result of this is that the window moves down, similarly MOUSE_6 scrolls +// columns left but the window moves right. +#define MOUSE_4 0x100 // scroll wheel down +#define MOUSE_5 0x200 // scroll wheel up + +#define MOUSE_X1 0x300 // Mouse-button X1 (6th) +#define MOUSE_X2 0x400 // Mouse-button X2 + +#define MOUSE_6 0x500 // scroll wheel left +#define MOUSE_7 0x600 // scroll wheel right + +#define MOUSE_MOVE 0x700 // report mouse moved + +// 0x20 is reserved by xterm +#define MOUSE_DRAG_XTERM 0x40 + +#define MOUSE_DRAG (0x40 | MOUSE_RELEASE) + +// Lowest button code for using the mouse wheel (xterm only) +#define MOUSEWHEEL_LOW 0x60 + +// Lowest button code for extra mouse buttons 8-11 +#define MOUSESIDEBUTTONS_LOW 0xa0 + +#define MOUSE_CLICK_MASK 0x03 + +#define NUM_MOUSE_CLICKS(code) \ + (((unsigned)((code) & 0xC0) >> 6) + 1) + +#define SET_NUM_MOUSE_CLICKS(code, num) \ + ((code) = ((code) & 0x3f) | ((((num) - 1) & 3) << 6)) + +// Added to mouse column for GUI when 'mousefocus' wants to give focus to a +// window by simulating a click on its status line. We could use up to 128 * +// 128 = 16384 columns, now it's reduced to 10000. +#define MOUSE_COLOFF 10000 + +/* + * jump_to_mouse() returns one of first five these values, possibly with + * some of the other four added. + */ +#define IN_UNKNOWN 0 +#define IN_BUFFER 1 +#define IN_STATUS_LINE 2 // on status or command line +#define IN_SEP_LINE 4 // on vertical separator line +#define IN_OTHER_WIN 8 // in other window but can't go there +#define CURSOR_MOVED 0x100 +#define MOUSE_FOLD_CLOSE 0x200 // clicked on '-' in fold column +#define MOUSE_FOLD_OPEN 0x400 // clicked on '+' in fold column +#define MOUSE_WINBAR 0x800 // in window toolbar + +// flags for jump_to_mouse() +#define MOUSE_FOCUS 0x01 // need to stay in this window +#define MOUSE_MAY_VIS 0x02 // may start Visual mode +#define MOUSE_DID_MOVE 0x04 // only act when mouse has moved +#define MOUSE_SETPOS 0x08 // only set current mouse position +#define MOUSE_MAY_STOP_VIS 0x10 // may stop Visual mode +#define MOUSE_RELEASED 0x20 // button was released + +#if defined(UNIX) && defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) +# define CHECK_DOUBLE_CLICK 1 // Checking for double clicks ourselves. +#endif + + +// defines for eval_vars() +#define VALID_PATH 1 +#define VALID_HEAD 2 + +// Defines for MNV variables. These must match mnvvars[] in evalvars.c! +#define VV_COUNT 0 +#define VV_COUNT1 1 +#define VV_PREVCOUNT 2 +#define VV_ERRMSG 3 +#define VV_WARNINGMSG 4 +#define VV_STATUSMSG 5 +#define VV_SHELL_ERROR 6 +#define VV_THIS_SESSION 7 +#define VV_VERSION 8 +#define VV_LNUM 9 +#define VV_TERMRESPONSE 10 +#define VV_FNAME 11 +#define VV_LANG 12 +#define VV_LC_TIME 13 +#define VV_CTYPE 14 +#define VV_CC_FROM 15 +#define VV_CC_TO 16 +#define VV_FNAME_IN 17 +#define VV_FNAME_OUT 18 +#define VV_FNAME_NEW 19 +#define VV_FNAME_DIFF 20 +#define VV_CMDARG 21 +#define VV_FOLDSTART 22 +#define VV_FOLDEND 23 +#define VV_FOLDDASHES 24 +#define VV_FOLDLEVEL 25 +#define VV_PROGNAME 26 +#define VV_SEND_SERVER 27 +#define VV_DYING 28 +#define VV_EXCEPTION 29 +#define VV_THROWPOINT 30 +#define VV_REG 31 +#define VV_CMDBANG 32 +#define VV_INSERTMODE 33 +#define VV_VAL 34 +#define VV_KEY 35 +#define VV_PROFILING 36 +#define VV_FCS_REASON 37 +#define VV_FCS_CHOICE 38 +#define VV_BEVAL_BUFNR 39 +#define VV_BEVAL_WINNR 40 +#define VV_BEVAL_WINID 41 +#define VV_BEVAL_LNUM 42 +#define VV_BEVAL_COL 43 +#define VV_BEVAL_TEXT 44 +#define VV_SCROLLSTART 45 +#define VV_SWAPNAME 46 +#define VV_SWAPCHOICE 47 +#define VV_SWAPCOMMAND 48 +#define VV_CHAR 49 +#define VV_MOUSE_WIN 50 +#define VV_MOUSE_WINID 51 +#define VV_MOUSE_LNUM 52 +#define VV_MOUSE_COL 53 +#define VV_OP 54 +#define VV_SEARCHFORWARD 55 +#define VV_HLSEARCH 56 +#define VV_OLDFILES 57 +#define VV_WINDOWID 58 +#define VV_PROGPATH 59 +#define VV_COMPLETED_ITEM 60 +#define VV_OPTION_NEW 61 +#define VV_OPTION_OLD 62 +#define VV_OPTION_OLDLOCAL 63 +#define VV_OPTION_OLDGLOBAL 64 +#define VV_OPTION_COMMAND 65 +#define VV_OPTION_TYPE 66 +#define VV_ERRORS 67 +#define VV_FALSE 68 +#define VV_TRUE 69 +#define VV_NONE 70 +#define VV_NULL 71 +#define VV_NUMBERMAX 72 +#define VV_NUMBERMIN 73 +#define VV_NUMBERSIZE 74 +#define VV_MNV_DID_ENTER 75 +#define VV_TESTING 76 +#define VV_TYPE_NUMBER 77 +#define VV_TYPE_STRING 78 +#define VV_TYPE_FUNC 79 +#define VV_TYPE_LIST 80 +#define VV_TYPE_DICT 81 +#define VV_TYPE_FLOAT 82 +#define VV_TYPE_BOOL 83 +#define VV_TYPE_NONE 84 +#define VV_TYPE_JOB 85 +#define VV_TYPE_CHANNEL 86 +#define VV_TYPE_BLOB 87 +#define VV_TYPE_CLASS 88 +#define VV_TYPE_OBJECT 89 +#define VV_TERMRFGRESP 90 +#define VV_TERMRBGRESP 91 +#define VV_TERMU7RESP 92 +#define VV_TERMSTYLERESP 93 +#define VV_TERMBLINKRESP 94 +#define VV_EVENT 95 +#define VV_VERSIONLONG 96 +#define VV_ECHOSPACE 97 +#define VV_ARGV 98 +#define VV_COLLATE 99 +#define VV_EXITING 100 +#define VV_COLORNAMES 101 +#define VV_SIZEOFINT 102 +#define VV_SIZEOFLONG 103 +#define VV_SIZEOFPOINTER 104 +#define VV_MAXCOL 105 +#define VV_PYTHON3_VERSION 106 +#define VV_TYPE_TYPEALIAS 107 +#define VV_TYPE_ENUM 108 +#define VV_TYPE_ENUMVALUE 109 +#define VV_STACKTRACE 110 +#define VV_TYPE_TUPLE 111 +#define VV_WAYLAND_DISPLAY 112 +#define VV_CLIPMETHOD 113 +#define VV_TERMDA1 114 +#define VV_TERMOSC 115 +#define VV_MNV_DID_INIT 116 +#define VV_CLIPPROVIDERS 117 +#define VV_LEN 118 // number of v: vars + +// used for v_number in VAR_BOOL and VAR_SPECIAL +#define VVAL_FALSE 0L // VAR_BOOL +#define VVAL_TRUE 1L // VAR_BOOL +#define VVAL_NONE 2L // VAR_SPECIAL +#define VVAL_NULL 3L // VAR_SPECIAL + +// Type values for type(). +#define VAR_TYPE_NUMBER 0 +#define VAR_TYPE_STRING 1 +#define VAR_TYPE_FUNC 2 +#define VAR_TYPE_LIST 3 +#define VAR_TYPE_DICT 4 +#define VAR_TYPE_FLOAT 5 +#define VAR_TYPE_BOOL 6 +#define VAR_TYPE_NONE 7 +#define VAR_TYPE_JOB 8 +#define VAR_TYPE_CHANNEL 9 +#define VAR_TYPE_BLOB 10 +#define VAR_TYPE_INSTR 11 +#define VAR_TYPE_CLASS 12 +#define VAR_TYPE_OBJECT 13 +#define VAR_TYPE_TYPEALIAS 14 +#define VAR_TYPE_ENUM 15 +#define VAR_TYPE_ENUMVALUE 16 +#define VAR_TYPE_TUPLE 17 + +#define DICT_MAXNEST 100 // maximum nesting of lists and dicts + +#define TABSTOP_MAX 9999 + +#ifdef HAVE_CLIPMETHOD +typedef enum { + CLIPMETHOD_FAIL, + CLIPMETHOD_NONE, + CLIPMETHOD_WAYLAND, + CLIPMETHOD_X11, + CLIPMETHOD_PROVIDER +} clipmethod_T; +#endif + +#ifdef FEAT_CLIPBOARD + +// MNV_ATOM_NAME is the older MNV-specific selection type for X11. Still +// supported for when a mix of MNV versions is used. MNVENC_ATOM_NAME includes +// the encoding to support MNVs using different 'encoding' values. +# define MNV_ATOM_NAME "_MNV_TEXT" +# define MNVENC_ATOM_NAME "_MNVENC_TEXT" + +// Selection states for modeless selection +# define SELECT_CLEARED 0 +# define SELECT_IN_PROGRESS 1 +# define SELECT_DONE 2 + +# define SELECT_MODE_CHAR 0 +# define SELECT_MODE_WORD 1 +# define SELECT_MODE_LINE 2 + +# ifdef FEAT_GUI_MSWIN +# ifdef FEAT_OLE +# define WM_OLE (WM_APP+0) +# endif +# endif + +// Info about selected text +typedef struct +{ + int available; // Is clipboard available? + int owned; // Flag: do we own the selection? + pos_T start; // Start of selected area + pos_T end; // End of selected area + int vmode; // Visual mode character + + // Fields for selection that doesn't use Visual mode + short_u origin_row; + short_u origin_start_col; + short_u origin_end_col; + short_u word_start_col; + short_u word_end_col; +# ifdef FEAT_PROP_POPUP + // limits for selection inside a popup window + short_u min_col; + short_u max_col; + short_u min_row; + short_u max_row; +# endif + + pos_T prev; // Previous position + short_u state; // Current selection state + short_u mode; // Select by char, word, or line. + +# if defined(FEAT_GUI_X11) || defined(FEAT_XCLIPBOARD) + Atom sel_atom; // PRIMARY/CLIPBOARD selection ID +# endif + +# ifdef FEAT_GUI_GTK + GdkAtom gtk_sel_atom; // PRIMARY/CLIPBOARD selection ID +# endif + +# if defined(MSWIN) || defined(FEAT_CYGWIN_WIN32_CLIPBOARD) + int_u format; // MNV's own special clipboard format + int_u format_raw; // MNV's raw text clipboard format +# endif +# ifdef FEAT_GUI_HAIKU + // No clipboard at the moment. TODO? +# endif +} Clipboard_T; +#else +typedef int Clipboard_T; // This is required for the prototypes. +#endif + +// Use 64-bit stat structure on MS-Windows. +#ifdef MSWIN +typedef struct _stat64 stat_T; +#else +typedef struct stat stat_T; +#endif + +typedef struct soundcb_S soundcb_T; + +#if (defined(__GNUC__) || defined(__clang__)) && !defined(__MINGW32__) +# define ATTRIBUTE_FORMAT_PRINTF(fmt_idx, arg_idx) \ + __attribute__((format(printf, fmt_idx, arg_idx))) +#else +# define ATTRIBUTE_FORMAT_PRINTF(fmt_idx, arg_idx) +#endif + +#if defined(__GNUC__) || defined(__clang__) +# define likely(x) __builtin_expect((x), 1) +# define unlikely(x) __builtin_expect((x), 0) +# define ATTRIBUTE_COLD __attribute__((cold)) +#else +# define unlikely(x) (x) +# define likely(x) (x) +# define ATTRIBUTE_COLD +#endif + +typedef enum { + ASSERT_EQUAL, + ASSERT_NOTEQUAL, + ASSERT_MATCH, + ASSERT_NOTMATCH, + ASSERT_FAILS, + ASSERT_OTHER +} assert_type_T; + +// Mode for bracketed_paste(). +typedef enum { + PASTE_INSERT, // insert mode + PASTE_CMDLINE, // command line + PASTE_EX, // ex mode line + PASTE_ONE_CHAR // return first character +} paste_mode_T; + +// Argument for flush_buffers(). +typedef enum { + FLUSH_MINIMAL, + FLUSH_TYPEAHEAD, // flush current typebuf contents + FLUSH_INPUT // flush typebuf and inchar() input +} flush_buffers_T; + +// Argument for prepare_tagpreview() +typedef enum { + USEPOPUP_NONE, + USEPOPUP_NORMAL, // use info popup + USEPOPUP_HIDDEN // use info popup initially hidden +} use_popup_T; + +// Argument for estack_sfile(). +typedef enum { + ESTACK_NONE, + ESTACK_SFILE, + ESTACK_STACK, + ESTACK_SCRIPT, +} estack_arg_T; + +// For temporarily backward compatibility, to be removed soon. +#define ENABLE_STL_MODE_MULTI_NL + +// Argument for build_stl_str_hl_local(). +typedef enum { + STL_MODE_SINGLE, // Does not accept line breaks "%@" + STL_MODE_MULTI, // Accept line breaks "%@" + STL_MODE_GET_RENDERED_HEIGHT, // Just get stl rendered height +#ifdef ENABLE_STL_MODE_MULTI_NL + STL_MODE_MULTI_NL, // Accept line breaks "%@" and "\n" +#endif +} stl_mode_T; + +// Return value of match_keyprotocol() +typedef enum { + KEYPROTOCOL_NONE, + KEYPROTOCOL_MOK2, + KEYPROTOCOL_KITTY, + KEYPROTOCOL_FAIL +} keyprot_T; + +// errors for when calling a function +typedef enum { + FCERR_NONE, // no error + FCERR_UNKNOWN, // unknown function + FCERR_TOOMANY, // too many arguments + FCERR_TOOFEW, // too few arguments + FCERR_SCRIPT, // missing script context + FCERR_DICT, // missing dict + FCERR_OTHER, // another kind of error + FCERR_DELETED, // function was deleted + FCERR_NOTMETHOD, // function cannot be used as a method + FCERR_FAILED, // error while executing the function +} funcerror_T; + +/* + * Array indexes used for cp_text[]. + */ +typedef enum { + CPT_ABBR, // "abbr" + CPT_KIND, // "kind" + CPT_MENU, // "menu" + CPT_INFO, // "info" + CPT_COUNT, // Number of entries +} cpitem_T; + +/* + * Type for the callback function that is invoked after an option value is + * changed to validate and apply the new value. + * + * Returns NULL if the option value is valid is successfully applied. + * Otherwise returns an error message. + */ +typedef char *(*opt_did_set_cb_T)(optset_T *args); + +/* + * Type for the callback function that is invoked when expanding possible + * string option values during cmdline completion. + * + * Strings in returned matches will be managed and freed by caller. + * + * Returns OK if the expansion succeeded (numMatches and matches have to be + * set). Otherwise returns FAIL. + * + * Note: If returned FAIL or *numMatches is 0, *matches will NOT be freed by + * caller. + */ +typedef int (*opt_expand_cb_T)(optexpand_T *args, int *numMatches, char_u ***matches); + +// Flags for assignment functions. +#define ASSIGN_VAR 0 // ":var" (nothing special) +#define ASSIGN_FINAL 0x01 // ":final" +#define ASSIGN_CONST 0x02 // ":const" +#define ASSIGN_NO_DECL 0x04 // "name = expr" without ":let"/":const"/":final" +#define ASSIGN_DECL 0x08 // may declare variable if it does not exist +#define ASSIGN_UNPACK 0x10 // using [a, b] = list +#define ASSIGN_NO_MEMBER_TYPE 0x20 // use "any" for list and dict member type +#define ASSIGN_FOR_LOOP 0x40 // assigning to loop variable +#define ASSIGN_INIT 0x80 // not assigning a value, just a declaration +#define ASSIGN_UPDATE_BLOCK_ID 0x100 // update sav_block_id +#define ASSIGN_COMPOUND_OP 0x200 // compound operator e.g. "+=" + +#include "ex_cmds.h" // Ex command defines +#include "spell.h" // spell checking stuff + +#include "proto.h" // function prototypes + +// This has to go after the include of proto.h, as proto/gui.pro declares +// functions of these names. The declarations would break if the defines had +// been seen at that stage. But it must be before globals.h, where error_ga +// is declared. +#if !defined(MSWIN) && !defined(FEAT_GUI_X11) && !defined(FEAT_GUI_HAIKU) \ + && !defined(FEAT_GUI_GTK) && !defined(PROTO) +# define mch_errmsg(str) fprintf(stderr, "%s", (str)) +# define display_errors() fflush(stderr) +# define mch_msg(str) printf("%s", (str)) +#else +# define USE_MCH_ERRMSG +#endif + +#if defined(FEAT_EVAL) \ + && (!defined(FEAT_GUI_MSWIN) || !defined(FEAT_MBYTE_IME)) +// Whether IME is supported by im_get_status() defined in mbyte.c. +// For Win32 GUI it's in gui_w32.c when FEAT_MBYTE_IME is defined. +# define IME_WITHOUT_XIM +#endif + +#if defined(FEAT_XIM) \ + || defined(IME_WITHOUT_XIM) \ + || (defined(FEAT_GUI_MSWIN) && defined(FEAT_MBYTE_IME)) +// im_set_active() is available +# define HAVE_INPUT_METHOD +#endif + +#ifndef FEAT_LINEBREAK +// Without the 'numberwidth' option line numbers are always 7 chars. +# define number_width(x) 7 +#endif + +// This must come after including proto.h. +// For VMS this is defined in macros.h. +#if !defined(MSWIN) && !defined(VMS) && !defined(PROTO) +# define mch_open(n, m, p) open((n), (m), (p)) +# define mch_fopen(n, p) fopen((n), (p)) +#endif + +#include "globals.h" // global variables and messages +#include "errors.h" // error messages + +/* + * If console dialog not supported, but GUI dialog is, use the GUI one. + */ +#if defined(FEAT_GUI_DIALOG) && !defined(FEAT_CON_DIALOG) +# define do_dialog gui_mch_dialog +#endif + +/* + * Default filters for gui_mch_browse(). + * The filters are almost system independent. Except for the difference + * between "*" and "*.*" for MSDOS-like systems. + * NOTE: Motif only uses the very first pattern. Therefore + * BROWSE_FILTER_DEFAULT should start with a "*" pattern. + */ +#ifdef FEAT_BROWSE +# ifdef BACKSLASH_IN_FILENAME +# define BROWSE_FILTER_MACROS \ + (char_u *)N_("MNV macro files (*.mnv)\t*.mnv\nAll Files (*.*)\t*.*\n") +# define BROWSE_FILTER_ALL_FILES (char_u *)N_("All Files (*.*)\t*.*\n") +# define BROWSE_FILTER_DEFAULT \ + (char_u *)N_("All Files (*.*)\t*.*\nC source (*.c, *.h)\t*.c;*.h\nC++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\nVB code (*.bas, *.frm)\t*.bas;*.frm\nMNV files (*.mnv, _mnvrc, _gmnvrc)\t*.mnv;_mnvrc;_gmnvrc\n") +# else +# define BROWSE_FILTER_MACROS \ + (char_u *)N_("MNV macro files (*.mnv)\t*.mnv\nAll Files (*)\t*\n") +# define BROWSE_FILTER_ALL_FILES (char_u *)N_("All Files (*)\t*\n") +# define BROWSE_FILTER_DEFAULT \ + (char_u *)N_("All Files (*)\t*\nC source (*.c, *.h)\t*.c;*.h\nC++ source (*.cpp, *.hpp)\t*.cpp;*.hpp\nMNV files (*.mnv, _mnvrc, _gmnvrc)\t*.mnv;_mnvrc;_gmnvrc\n") +# endif +# define BROWSE_SAVE 1 // flag for do_browse() +# define BROWSE_DIR 2 // flag for do_browse() +#endif + +#ifdef _MSC_VER +// Avoid useless warning "conversion from X to Y of greater size". +# pragma warning(disable : 4312) +// Avoid warning for old style function declarators +# pragma warning(disable : 4131) +// Avoid warning for conversion to type with smaller range +# pragma warning(disable : 4244) +// Avoid warning for conversion to larger size +# pragma warning(disable : 4306) +// Avoid warning for unreferenced formal parameter +# pragma warning(disable : 4100) +// Avoid warning for differs in indirection to slightly different base type +# pragma warning(disable : 4057) +// Avoid warning for constant conditional expression +# pragma warning(disable : 4127) +// Avoid warning for assignment within conditional +# pragma warning(disable : 4706) +#endif + +// Note: a NULL argument for mnv_realloc() is not portable, don't use it. +#if defined(MEM_PROFILE) +# define mnv_realloc(ptr, size) mem_realloc((ptr), (size)) +#else +# define mnv_realloc(ptr, size) realloc((ptr), (size)) +#endif + +/* + * Return byte length of character that starts with byte "b". + * Returns 1 for a single-byte character. + * MB_BYTE2LEN_CHECK() can be used to count a special key as one byte. + * Don't call MB_BYTE2LEN(b) with b < 0 or b > 255! + */ +#define MB_BYTE2LEN(b) mb_bytelen_tab[b] +#define MB_BYTE2LEN_CHECK(b) (((b) < 0 || (b) > 255) ? 1 : mb_bytelen_tab[b]) + +// properties used in enc_canon_table[] (first three mutually exclusive) +#define ENC_8BIT 0x01 +#define ENC_DBCS 0x02 +#define ENC_UNICODE 0x04 + +#define ENC_ENDIAN_B 0x10 // Unicode: Big endian +#define ENC_ENDIAN_L 0x20 // Unicode: Little endian + +#define ENC_2BYTE 0x40 // Unicode: UCS-2 +#define ENC_4BYTE 0x80 // Unicode: UCS-4 +#define ENC_2WORD 0x100 // Unicode: UTF-16 + +#define ENC_LATIN1 0x200 // Latin1 +#define ENC_LATIN9 0x400 // Latin9 +#define ENC_MACROMAN 0x800 // Mac Roman (not Macro Man! :-) + +#ifdef USE_ICONV +# ifndef EILSEQ +# define EILSEQ 123 +# endif +# ifdef DYNAMIC_ICONV +// On Win32 iconv.dll is dynamically loaded. +# define ICONV_ERRNO (*iconv_errno()) +# define ICONV_E2BIG 7 +# define ICONV_EINVAL 22 +# define ICONV_EILSEQ 42 +# else +# define ICONV_ERRNO errno +# define ICONV_E2BIG E2BIG +# define ICONV_EINVAL EINVAL +# define ICONV_EILSEQ EILSEQ +# endif +#endif + +#define SIGN_BYTE 1 // byte value used where sign is displayed; + // attribute value is sign type + +#ifdef FEAT_NETBEANS_INTG +# define MULTISIGN_BYTE 2 // byte value used where sign is displayed if + // multiple signs exist on the line +#endif + +#if defined(FEAT_GUI) && defined(FEAT_XCLIPBOARD) +# ifdef FEAT_GUI_GTK + // Avoid using a global variable for the X display. It's ugly + // and is likely to cause trouble in multihead environments. +# define X_DISPLAY ((gui.in_use) ? gui_mch_get_display() : xterm_dpy) +# else +# define X_DISPLAY (gui.in_use ? gui.dpy : xterm_dpy) +# endif +#elif defined(FEAT_GUI) +# ifdef FEAT_GUI_GTK +# define X_DISPLAY ((gui.in_use) ? gui_mch_get_display() : (Display *)NULL) +# else +# define X_DISPLAY gui.dpy +# endif +#elif defined(FEAT_XCLIPBOARD) +# define X_DISPLAY xterm_dpy +#else +# define X_DISPLAY (Display *)NULL +#endif + +#ifdef FEAT_GUI_GTK +# if !GTK_CHECK_VERSION(2,14,0) +# define gtk_widget_get_window(wid) ((wid)->window) +# define gtk_plug_get_socket_window(wid) ((wid)->socket_window) +# define gtk_selection_data_get_data(sel) ((sel)->data) +# define gtk_selection_data_get_data_type(sel) ((sel)->type) +# define gtk_selection_data_get_format(sel) ((sel)->format) +# define gtk_selection_data_get_length(sel) ((sel)->length) +# define gtk_adjustment_set_lower(adj, low) \ + do { (adj)->lower = low; } while (0) +# define gtk_adjustment_set_upper(adj, up) \ + do { (adj)->upper = up; } while (0) +# define gtk_adjustment_set_page_size(adj, size) \ + do { (adj)->page_size = size; } while (0) +# define gtk_adjustment_set_page_increment(adj, inc) \ + do { (adj)->page_increment = inc; } while (0) +# define gtk_adjustment_set_step_increment(adj, inc) \ + do { (adj)->step_increment = inc; } while (0) +# endif +# if !GTK_CHECK_VERSION(2,16,0) +# define gtk_selection_data_get_selection(sel) ((sel)->selection) +# endif +# if !GTK_CHECK_VERSION(2,18,0) +# define gtk_widget_get_allocation(wid, alloc) \ + do { *(alloc) = (wid)->allocation; } while (0) +# define gtk_widget_set_allocation(wid, alloc) \ + do { (wid)->allocation = *(alloc); } while (0) +# define gtk_widget_get_has_window(wid) !GTK_WIDGET_NO_WINDOW(wid) +# define gtk_widget_get_sensitive(wid) GTK_WIDGET_SENSITIVE(wid) +# define gtk_widget_get_visible(wid) GTK_WIDGET_VISIBLE(wid) +# define gtk_widget_has_focus(wid) GTK_WIDGET_HAS_FOCUS(wid) +# define gtk_widget_set_window(wid, win) \ + do { (wid)->window = (win); } while (0) +# define gtk_widget_set_can_default(wid, can) \ + do { if (can) \ + { GTK_WIDGET_SET_FLAGS(wid, GTK_CAN_DEFAULT); } \ + else \ + { GTK_WIDGET_UNSET_FLAGS(wid, GTK_CAN_DEFAULT); } } while (0) +# define gtk_widget_set_can_focus(wid, can) \ + do { if (can) \ + { GTK_WIDGET_SET_FLAGS(wid, GTK_CAN_FOCUS); } \ + else \ + { GTK_WIDGET_UNSET_FLAGS(wid, GTK_CAN_FOCUS); } } while (0) +# define gtk_widget_set_visible(wid, vis) \ + do { if (vis) \ + { gtk_widget_show(wid); } \ + else \ + { gtk_widget_hide(wid); } } while (0) +# endif +# if !GTK_CHECK_VERSION(2,20,0) +# define gtk_widget_get_mapped(wid) GTK_WIDGET_MAPPED(wid) +# define gtk_widget_get_realized(wid) GTK_WIDGET_REALIZED(wid) +# define gtk_widget_set_mapped(wid, map) \ + do { if (map) \ + { GTK_WIDGET_SET_FLAGS(wid, GTK_MAPPED); } \ + else \ + { GTK_WIDGET_UNSET_FLAGS(wid, GTK_MAPPED); } } while (0) +# define gtk_widget_set_realized(wid, rea) \ + do { if (rea) \ + { GTK_WIDGET_SET_FLAGS(wid, GTK_REALIZED); } \ + else \ + { GTK_WIDGET_UNSET_FLAGS(wid, GTK_REALIZED); } } while (0) +# endif +#endif + +#ifndef FEAT_NETBEANS_INTG +# undef NBDEBUG +#endif +#ifdef NBDEBUG // Netbeans debugging. +# include "nbdebug.h" +#else +# define nbdebug(a) +#endif + +#ifdef IN_PERL_FILE + /* + * Avoid clashes between Perl and MNV namespace. + */ +# undef STRLEN +# undef FF +# undef OP_DELETE +# undef OP_JOIN + // remove MAX and MIN, included by glib.h, redefined by sys/param.h +# ifdef MAX +# undef MAX +# endif +# ifdef MIN +# undef MIN +# endif + // We use _() for gettext(), Perl uses it for function prototypes... +# ifdef _ +# undef _ +# endif +# ifdef DEBUG +# undef DEBUG +# endif +# ifdef _DEBUG +# undef _DEBUG +# endif +# ifdef instr +# undef instr +# endif + // bool may cause trouble on some old versions of Mac OS X but is required + // on a few other systems and for Perl +# if (defined(MACOS_X) && !defined(MAC_OS_X_VERSION_10_6)) \ + && defined(bool) && !defined(FEAT_PERL) +# undef bool +# endif + +#endif + +// values for mnv_handle_signal() that are not a signal +#define SIGNAL_BLOCK (-1) +#define SIGNAL_UNBLOCK (-2) +#if !defined(UNIX) && !defined(VMS) && !defined(PROTO) +# define mnv_handle_signal(x) 0 +#endif + +// flags for skip_mnvgrep_pat() +#define VGR_GLOBAL 1 +#define VGR_NOJUMP 2 +#define VGR_FUZZY 4 + +// behavior for bad character, "++bad=" argument +#define BAD_REPLACE '?' // replace it with '?' (default) +#define BAD_KEEP (-1) // leave it +#define BAD_DROP (-2) // erase it + +// last argument for do_source() +#define DOSO_NONE 0 +#define DOSO_MNVRC 1 // loading mnvrc file +#define DOSO_GMNVRC 2 // loading gmnvrc file + +// flags for read_mnvinfo() and children +#define VIF_WANT_INFO 1 // load non-mark info +#define VIF_WANT_MARKS 2 // load file marks +#define VIF_ONLY_CURBUF 4 // bail out after loading marks for curbuf +#define VIF_FORCEIT 8 // overwrite info already read +#define VIF_GET_OLDFILES 16 // load v:oldfiles + +// flags for buf_freeall() +#define BFA_DEL 1 // buffer is going to be deleted +#define BFA_WIPE 2 // buffer is going to be wiped out +#define BFA_KEEP_UNDO 4 // do not free undo information +#define BFA_IGNORE_ABORT 8 // do not abort for aborting() + +// direction for nv_mousescroll() and ins_mousescroll() +#define MSCR_DOWN 0 // DOWN must be FALSE +#define MSCR_UP 1 +#define MSCR_LEFT (-1) +#define MSCR_RIGHT (-2) + +#define KEYLEN_PART_KEY (-1) // keylen value for incomplete key-code +#define KEYLEN_PART_MAP (-2) // keylen value for incomplete mapping +#define KEYLEN_REMOVED 9999 // keylen value for removed sequence + +// Return values from win32_fileinfo(). +#define FILEINFO_OK 0 +#define FILEINFO_ENC_FAIL 1 // enc_to_utf16() failed +#define FILEINFO_READ_FAIL 2 // CreateFile() failed +#define FILEINFO_INFO_FAIL 3 // GetFileInformationByHandle() failed + +// Return value from get_option_value_strict +#define SOPT_BOOL 0x01 // Boolean option +#define SOPT_NUM 0x02 // Number option +#define SOPT_STRING 0x04 // String option +#define SOPT_GLOBAL 0x08 // Option has global value +#define SOPT_WIN 0x10 // Option has window-local value +#define SOPT_BUF 0x20 // Option has buffer-local value +#define SOPT_UNSET 0x40 // Option does not have local value set + +// Option types for various functions in option.c +#define SREQ_GLOBAL 0 // Request global option +#define SREQ_WIN 1 // Request window-local option +#define SREQ_BUF 2 // Request buffer-local option + +// Flags for get_reg_contents +#define GREG_NO_EXPR 1 // Do not allow expression register +#define GREG_EXPR_SRC 2 // Return expression itself for "=" register +#define GREG_LIST 4 // Return list + +// Character used as separated in autoload function/variable names. +#define AUTOLOAD_CHAR '#' + +#ifdef FEAT_JOB_CHANNEL +# define MAX_OPEN_CHANNELS 10 +#else +# define MAX_OPEN_CHANNELS 0 +#endif + +#if defined(MSWIN) +# define MAX_NAMED_PIPE_SIZE 65535 +#endif + +// Options for json_encode() and json_decode. +#define JSON_JS 1 // use JS instead of JSON +#define JSON_NO_NONE 2 // v:none item not allowed +#define JSON_NL 4 // append a NL + +// Used for flags of do_in_path() +#define DIP_ALL 0x01 // all matches, not just the first one +#define DIP_DIR 0x02 // find directories instead of files. +#define DIP_ERR 0x04 // give an error message when none found. +#define DIP_START 0x08 // also use "start" directory in 'packpath' +#define DIP_OPT 0x10 // also use "opt" directory in 'packpath' +#define DIP_NORTP 0x20 // do not use 'runtimepath' +#define DIP_NOAFTER 0x40 // skip "after" directories +#define DIP_AFTER 0x80 // only use "after" directories + +// Lowest number used for window ID. Cannot have this many windows. +#define LOWEST_WIN_ID 1000 + +// Used by the garbage collector. +#define COPYID_INC 2 +#define COPYID_MASK (~0x1) + +// Values for trans_function_name() argument: +#define TFN_INT 0x01 // internal function name OK +#define TFN_QUIET 0x02 // no error messages +#define TFN_NO_AUTOLOAD 0x04 // do not use script autoloading +#define TFN_NO_DEREF 0x08 // do not dereference a Funcref +#define TFN_READ_ONLY 0x10 // will not change the var +#define TFN_NO_DECL 0x20 // only used for GLV_NO_DECL +#define TFN_COMPILING 0x40 // only used for GLV_COMPILING +#define TFN_NEW_FUNC 0x80 // defining a new function +#define TFN_ASSIGN_WITH_OP 0x100 // only for GLV_ASSIGN_WITH_OP +#define TFN_IN_CLASS 0x200 // function in a class + +// Values for get_lval() flags argument: +#define GLV_QUIET TFN_QUIET // no error messages +#define GLV_NO_AUTOLOAD TFN_NO_AUTOLOAD // do not use script autoloading +#define GLV_READ_ONLY TFN_READ_ONLY // will not change the var +#define GLV_NO_DECL TFN_NO_DECL // assignment without :var or :let +#define GLV_COMPILING TFN_COMPILING // variable may be defined later +#define GLV_ASSIGN_WITH_OP TFN_ASSIGN_WITH_OP // assignment with operator +#define GLV_PREFER_FUNC 0x10000 // prefer function above variable +#define GLV_FOR_LOOP 0x20000 // assigning to a loop variable + +#define DO_NOT_FREE_CNT 99999 // refcount for dict or list that should not + // be freed. + +// fixed buffer length for fname_trans_sid() +#define FLEN_FIXED 40 + +// flags for find_name_end() +#define FNE_INCL_BR 1 // include [] in name +#define FNE_CHECK_START 2 // check name starts with valid character + +// BSD is supposed to cover FreeBSD and similar systems. +#if (defined(SUN_SYSTEM) || defined(BSD) || defined(__FreeBSD_kernel__)) \ + && (defined(S_ISCHR) || defined(S_IFCHR)) +# define OPEN_CHR_FILES +#endif + +// stat macros +#ifndef S_ISDIR +# ifdef S_IFDIR +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# else +# define S_ISDIR(m) 0 +# endif +#endif +#ifndef S_ISREG +# ifdef S_IFREG +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +# else +# define S_ISREG(m) 0 +# endif +#endif +#ifndef S_ISBLK +# ifdef S_IFBLK +# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +# else +# define S_ISBLK(m) 0 +# endif +#endif +#ifndef S_ISSOCK +# ifdef S_IFSOCK +# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +# else +# define S_ISSOCK(m) 0 +# endif +#endif +#ifndef S_ISFIFO +# ifdef S_IFIFO +# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +# else +# define S_ISFIFO(m) 0 +# endif +#endif +#ifndef S_ISCHR +# ifdef S_IFCHR +# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +# else +# define S_ISCHR(m) 0 +# endif +#endif +#ifndef S_ISLNK +# ifdef S_IFLNK +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +# else +# define S_ISLNK(m) 0 +# endif +#endif + +#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H) +# define ELAPSED_TIMEVAL +# define ELAPSED_INIT(v) gettimeofday(&(v), NULL) +# define ELAPSED_FUNC(v) elapsed(&(v)) +typedef struct timeval elapsed_T; +long elapsed(struct timeval *start_tv); +#elif defined(MSWIN) +# define ELAPSED_TICKCOUNT +# define ELAPSED_INIT(v) v = GetTickCount() +# define ELAPSED_FUNC(v) elapsed(v) +typedef DWORD elapsed_T; +# ifndef PROTO +long elapsed(DWORD start_tick); +# endif +#endif + +// Replacement for nchar used by nv_replace(). +#define REPLACE_CR_NCHAR (-1) +#define REPLACE_NL_NCHAR (-2) + +// flags for term_start() +#define TERM_START_NOJOB 1 +#define TERM_START_FORCEIT 2 +#define TERM_START_SYSTEM 4 + +// Used for icon/title save and restore. +#define SAVE_RESTORE_TITLE 1 +#define SAVE_RESTORE_ICON 2 +#define SAVE_RESTORE_BOTH (SAVE_RESTORE_TITLE | SAVE_RESTORE_ICON) + +// Flags for adjust_prop_columns() +#define APC_SAVE_FOR_UNDO 1 // call u_savesub() before making changes +#define APC_SUBSTITUTE 2 // text is replaced, not inserted +#define APC_INDENT 4 // changing indent + +#define CLIP_ZINDEX 32000 + +// Flags for replace_termcodes() +#define REPTERM_FROM_PART 1 +#define REPTERM_DO_LT 2 +#define REPTERM_SPECIAL 4 +#define REPTERM_NO_SIMPLIFY 8 + +// Flags for find_special_key() +#define FSK_KEYCODE 0x01 // prefer key code, e.g. K_DEL instead of DEL +#define FSK_KEEP_X_KEY 0x02 // don't translate xHome to Home key +#define FSK_IN_STRING 0x04 // TRUE in string, double quote is escaped +#define FSK_SIMPLIFY 0x08 // simplify and +#define FSK_FROM_PART 0x10 // left-hand-side of mapping + +// Flags for the readdirex function, how to sort the result +#define READDIR_SORT_NONE 0 // do not sort +#define READDIR_SORT_BYTE 1 // sort by byte order (strcmp), default +#define READDIR_SORT_IC 2 // sort ignoring case (strcasecmp) +#define READDIR_SORT_COLLATE 3 // sort according to collation (strcoll) + +// Flags for mch_delay. +#define MCH_DELAY_IGNOREINPUT 1 +#define MCH_DELAY_SETTMODE 2 + +// Flags for eval_variable(). +#define EVAL_VAR_VERBOSE 1 // may give error message +#define EVAL_VAR_NOAUTOLOAD 2 // do not use script autoloading +#define EVAL_VAR_IMPORT 4 // may return special variable for import +#define EVAL_VAR_NO_FUNC 8 // do not look for a function + +// Fuzzy matching +#define FUZZY_MATCH_MAX_LEN 1024 // max characters that can be matched +#define FUZZY_SCORE_NONE INT_MIN // invalid fuzzy score + +// flags for equal_type() +#define ETYPE_ARG_UNKNOWN 1 + +// flags used by user commands and :autocmd +#define UC_BUFFER 1 // -buffer: local to current buffer +#define UC_MNV9 2 // {} argument: MNV9 syntax. + +// flags used by mnv_strsave_fnameescape() +#define VSE_NONE 0 +#define VSE_SHELL 1 // escape for a shell command +#define VSE_BUFFER 2 // escape for a ":buffer" command + +// Flags used by find_func_even_dead() +#define FFED_IS_GLOBAL 1 // "g:" was used +#define FFED_NO_GLOBAL 2 // only check for script-local functions + +#define MAX_LSHIFT_BITS (varnumber_T)((sizeof(uvarnumber_T) * 8) - 1) + +// Flags used by "class_flags" of define_function() +#define CF_CLASS 1 // inside a class +#define CF_INTERFACE 2 // inside an interface +#define CF_ABSTRACT_METHOD 4 // inside an abstract class + +#endif // MNV__H diff --git a/uvim/src/mnv.ico b/uvim/src/mnv.ico new file mode 100644 index 0000000000..7eb2648937 Binary files /dev/null and b/uvim/src/mnv.ico differ diff --git a/uvim/src/mnv.manifest b/uvim/src/mnv.manifest new file mode 100644 index 0000000000..199c30f46a --- /dev/null +++ b/uvim/src/mnv.manifest @@ -0,0 +1,59 @@ + + + + + MNV is not Vim - A Text Editor + + + + + + + + + + + + + + + + + true + PerMonitorV2 + + + + + + + + + + + + + + + + + diff --git a/uvim/src/mnv.rc b/uvim/src/mnv.rc new file mode 100644 index 0000000000..0994baa768 --- /dev/null +++ b/uvim/src/mnv.rc @@ -0,0 +1,136 @@ +// vi:set ts=8 sts=4 sw=4 noet: +// +// MNV - MNV is not Vim by Bram Moolenaar +// +// Do ":help uganda" in MNV to read copying and usage conditions. +// Do ":help credits" in MNV to see a list of people who contributed. + +// mnv.rc +// Icon and version information for the Win32 version of MNV +// Must be in DOS format ! + +#include +#include "version.h" +#include "gui_w32_rc.h" +#include + +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +// +// Icons +// +IDR_MNV ICON "mnv.ico" + +#if (defined(FEAT_GUI_MSWIN) && !defined(MNVDLL)) || defined(RCDLL) +IDR_MNV_ERROR ICON "mnv_error.ico" +IDR_MNV_ALERT ICON "mnv_alert.ico" +IDR_MNV_INFO ICON "mnv_info.ico" +IDR_MNV_QUESTION ICON "mnv_quest.ico" + +// +// Bitmaps +// +IDB_TEAROFF BITMAP DISCARDABLE "tearoff.bmp" +IDR_TOOLBAR1 BITMAP DISCARDABLE "tools.bmp" +#endif // FEAT_GUI_MSWIN + +#ifndef RCDLL +// +// WinXP theme support +// +#ifndef CREATEPROCESS_MANIFEST_RESOURCE_ID +# define CREATEPROCESS_MANIFEST_RESOURCE_ID 1 +#endif +#ifndef RT_MANIFEST +# define RT_MANIFEST 24 +#endif + +CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "mnv.manifest" +#endif // RCDLL + +// +// Type Library +// +#ifdef FEAT_OLE + 1 TYPELIB "mnv.tlb" +#endif + +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION MNV_VERSION_MAJOR,MNV_VERSION_MINOR,MNV_VERSION_PATCHLEVEL + PRODUCTVERSION MNV_VERSION_MAJOR,MNV_VERSION_MINOR,MNV_VERSION_PATCHLEVEL + FILEFLAGSMASK VS_FFI_FILEFLAGSMASK + +#if MNV_VERSION_PATCHLEVEL > 0 + #ifdef _DEBUG + FILEFLAGS VS_FF_PRERELEASE | VS_FF_DEBUG | VS_FF_PATCHED + #else + FILEFLAGS VS_FF_PRERELEASE | VS_FF_PATCHED + #endif +#else + #ifdef _DEBUG + FILEFLAGS VS_FF_PRERELEASE | VS_FF_DEBUG + #else + FILEFLAGS VS_FF_PRERELEASE + #endif +#endif + + FILEOS VOS__WINDOWS32 +#ifdef RCDLL + FILETYPE VFT_DLL +#else + FILETYPE VFT_APP +#endif + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + // 0x0409 == U.S. English; 0x04E4 => Windows Multilingual + BLOCK "040904E4" + BEGIN + VALUE "CompanyName", "MNV Developers\0" + VALUE "FileDescription", "MNV is not Vim - A Text Editor\0" + VALUE "FileVersion", MNV_VERSION_MAJOR_STR "." MNV_VERSION_MINOR_STR "." MNV_VERSION_PATCHLEVEL_STR "\0" + VALUE "InternalName", "MNV\0" + VALUE "LegalCopyright", "Copyright \251 1996\0" + VALUE "LegalTrademarks", "MNV\0" +#ifdef MNVDLLBASE + VALUE "OriginalFilename", MNVDLLBASE ".dll\0" +#elif defined(FEAT_GUI_MSWIN) + VALUE "OriginalFilename", "gmnv.exe\0" +#else + VALUE "OriginalFilename", "mnv.exe\0" +#endif + VALUE "ProductName", "MNV\0" + VALUE "ProductVersion", MNV_VERSION_MAJOR_STR "." MNV_VERSION_MINOR_STR "." MNV_VERSION_PATCHLEVEL_STR "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 0x4E4 + END +END + +#if !defined(MNVDLL) || defined(RCDLL) +/* + * Printing Status Dialog (should only be used when FEAT_PRINTER is defined) + */ +#define IDC_BOX1 400 +#define IDC_PRINTTEXT1 401 +#define IDC_PRINTTEXT2 402 +#define IDC_PROGRESS 403 +PRINTDLGBOX DIALOG 115, 63, 210, 80 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "Helv" +BEGIN + DEFPUSHBUTTON "Cancel", IDCANCEL, 85, 60, 40, 14 + CTEXT "Printing",IDC_PRINTTEXT1,23,15,157,9 + CTEXT " ",IDC_PRINTTEXT2,23,25,157,9 + CTEXT "Initializing...",IDC_PROGRESS,24,38,157,9 + GROUPBOX "",IDC_BOX1,19,9,170,47 +END +#endif diff --git a/uvim/src/mnv.tlb b/uvim/src/mnv.tlb new file mode 100644 index 0000000000..cb2606ce93 Binary files /dev/null and b/uvim/src/mnv.tlb differ diff --git a/uvim/src/mnv9.h b/uvim/src/mnv9.h new file mode 100644 index 0000000000..7f70905ebc --- /dev/null +++ b/uvim/src/mnv9.h @@ -0,0 +1,901 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * MNV - MNV is not Vim by Bram Moolenaar + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. + */ + +/* + * mnv9.h: types and globals used for MNV9 script. + */ + +#ifdef VMS +# include +#endif + +typedef enum { + ISN_EXEC, // execute Ex command line isn_arg.string + ISN_EXECCONCAT, // execute Ex command from isn_arg.number items on stack + ISN_EXEC_SPLIT, // execute Ex command from isn_arg.string split at NL + ISN_EXECRANGE, // execute EX command that is only a range + ISN_LEGACY_EVAL, // evaluate expression isn_arg.string with legacy syntax. + ISN_ECHO, // :echo with isn_arg.echo.echo_count items on top of stack + ISN_EXECUTE, // :execute with isn_arg.number items on top of stack + ISN_ECHOMSG, // :echomsg with isn_arg.number items on top of stack + ISN_ECHOCONSOLE, // :echoconsole with isn_arg.number items on top of stack + ISN_ECHOWINDOW, // :echowindow with isn_arg.number items on top of stack + ISN_ECHOERR, // :echoerr with isn_arg.number items on top of stack + ISN_RANGE, // compute range from isn_arg.string, push to stack + ISN_SUBSTITUTE, // :s command with expression + + ISN_SOURCE, // source autoload script, isn_arg.number is the script ID + ISN_INSTR, // instructions compiled from expression + ISN_CONSTRUCT, // construct an object, using construct_T + ISN_GET_OBJ_MEMBER, // object member, index is isn_arg.number + ISN_GET_ITF_MEMBER, // interface member, index is isn_arg.classmember + ISN_STORE_THIS, // store value in "this" object member, index is + // isn_arg.number + ISN_LOAD_CLASSMEMBER, // load class member, using isn_arg.classmember + ISN_STORE_CLASSMEMBER, // store in class member, using isn_arg.classmember + + // get and set variables + ISN_LOAD, // push local variable isn_arg.number + ISN_LOADV, // push v: variable isn_arg.number + ISN_LOADG, // push g: variable isn_arg.string + ISN_LOADAUTO, // push g: autoload variable isn_arg.string + ISN_LOADB, // push b: variable isn_arg.string + ISN_LOADW, // push w: variable isn_arg.string + ISN_LOADT, // push t: variable isn_arg.string + ISN_LOADGDICT, // push g: dict + ISN_LOADBDICT, // push b: dict + ISN_LOADWDICT, // push w: dict + ISN_LOADTDICT, // push t: dict + ISN_LOADS, // push s: variable isn_arg.loadstore + ISN_LOADEXPORT, // push exported variable isn_arg.loadstore + ISN_LOADOUTER, // push variable from outer scope isn_arg.outer + ISN_LOADSCRIPT, // push script-local variable isn_arg.script. + ISN_LOADOPT, // push option isn_arg.string + ISN_LOADENV, // push environment variable isn_arg.string + ISN_LOADREG, // push register isn_arg.number + + ISN_STORE, // pop into local variable isn_arg.number + ISN_STOREV, // pop into v: variable isn_arg.number + ISN_STOREG, // pop into global variable isn_arg.string + ISN_STOREAUTO, // pop into global autoload variable isn_arg.string + ISN_STOREB, // pop into buffer-local variable isn_arg.string + ISN_STOREW, // pop into window-local variable isn_arg.string + ISN_STORET, // pop into tab-local variable isn_arg.string + ISN_STORES, // pop into script variable isn_arg.loadstore + ISN_STOREEXPORT, // pop into exported script variable isn_arg.loadstore + ISN_STOREOUTER, // pop variable into outer scope isn_arg.outer + ISN_STORESCRIPT, // pop into script variable isn_arg.script + ISN_STOREOPT, // pop into option isn_arg.storeopt + ISN_STOREFUNCOPT, // pop into option isn_arg.storeopt + ISN_STOREENV, // pop into environment variable isn_arg.string + ISN_STOREREG, // pop into register isn_arg.number + // ISN_STOREOTHER, // pop into other script variable isn_arg.other. + + ISN_STORENR, // store number into local variable isn_arg.storenr.stnr_idx + ISN_STOREINDEX, // store into list or dictionary, using + // isn_arg.storeindex; value/index/variable on stack + ISN_STORERANGE, // store into blob, + // value/index 1/index 2/variable on stack + + ISN_UNLET, // unlet variable isn_arg.unlet.ul_name + ISN_UNLETENV, // unlet environment variable isn_arg.unlet.ul_name + ISN_UNLETINDEX, // unlet item of list or dict + ISN_UNLETRANGE, // unlet items of list + + ISN_LOCKUNLOCK, // :lock and :unlock for local variable member + ISN_LOCKCONST, // lock constant value + + // constants + ISN_PUSHNR, // push number isn_arg.number + ISN_PUSHBOOL, // push bool value isn_arg.number + ISN_PUSHSPEC, // push special value isn_arg.number + ISN_PUSHF, // push float isn_arg.fnumber + ISN_PUSHS, // push string isn_arg.string + ISN_PUSHBLOB, // push blob isn_arg.blob + ISN_PUSHFUNC, // push func isn_arg.string + ISN_PUSHCHANNEL, // push NULL channel + ISN_PUSHJOB, // push NULL job + ISN_PUSHOBJ, // push NULL object + ISN_PUSHCLASS, // push class, uses isn_arg.classarg + ISN_NEWLIST, // push list from stack items, size is isn_arg.number + // -1 for null_list + ISN_NEWTUPLE, // push tuple from stack items, size is isn_arg.number + // -1 for null_list + ISN_NEWDICT, // push dict from stack items, size is isn_arg.number + // -1 for null_dict + ISN_NEWPARTIAL, // push NULL partial + + ISN_AUTOLOAD, // get item from autoload import, function or variable + + // function call + ISN_BCALL, // call builtin function isn_arg.bfunc + ISN_DCALL, // call def function isn_arg.dfunc + ISN_METHODCALL, // call method on interface, uses isn_arg.mfunc + ISN_UCALL, // call user function or funcref/partial isn_arg.ufunc + ISN_PCALL, // call partial, use isn_arg.pfunc + ISN_PCALL_END, // cleanup after ISN_PCALL with cpf_top set + ISN_RETURN, // return, result is on top of stack + ISN_RETURN_VOID, // Push void, then return + ISN_RETURN_OBJECT, // Push constructed object, then return + ISN_FUNCREF, // push a function ref to dfunc isn_arg.funcref + ISN_NEWFUNC, // create a global function from a lambda function + ISN_DEF, // list functions + ISN_DEFER, // :defer argument count is isn_arg.number + + // expression operations + ISN_JUMP, // jump if condition is matched isn_arg.jump + ISN_JUMP_IF_ARG_SET, // jump if argument is already set, uses + // isn_arg.jumparg + ISN_JUMP_IF_ARG_NOT_SET, // jump if argument is not set, uses + // isn_arg.jumparg + + // loop + ISN_FOR, // get next item from a list, uses isn_arg.forloop + ISN_WHILE, // jump if condition false, store funcref count, uses + // isn_arg.whileloop + ISN_ENDLOOP, // handle variables for closures, uses isn_arg.endloop + + ISN_TRY, // add entry to ec_trystack, uses isn_arg.tryref + ISN_THROW, // pop value of stack, store in v:exception + ISN_PUSHEXC, // push v:exception + ISN_CATCH, // drop v:exception + ISN_FINALLY, // start of :finally block + ISN_ENDTRY, // take entry off from ec_trystack + ISN_TRYCONT, // handle :continue or :break inside a :try statement + + // more expression operations + ISN_ADDLIST, // add two lists + ISN_ADDTUPLE, // add two tuples + ISN_ADDBLOB, // add two blobs + + // operation with two arguments; isn_arg.op.op_type is exprtype_T + ISN_OPNR, + ISN_OPFLOAT, + ISN_OPANY, + + // comparative operations; isn_arg.op.op_type is exprtype_T, op_ic used + ISN_COMPAREBOOL, + ISN_COMPARESPECIAL, + ISN_COMPARENULL, + ISN_COMPARENR, + ISN_COMPAREFLOAT, + ISN_COMPARESTRING, + ISN_COMPAREBLOB, + ISN_COMPARELIST, + ISN_COMPARETUPLE, + ISN_COMPAREDICT, + ISN_COMPAREFUNC, + ISN_COMPAREANY, + ISN_COMPAREOBJECT, + + // expression operations + ISN_CONCAT, // concatenate isn_arg.number strings + ISN_STRINDEX, // [expr] string index + ISN_STRSLICE, // [expr:expr] string slice + ISN_LISTAPPEND, // append to a list, like add() + ISN_LISTINDEX, // [expr] list index + ISN_LISTSLICE, // [expr:expr] list slice + ISN_TUPLEINDEX, // [expr] tuple index + ISN_TUPLESLICE, // [expr:expr] tuple slice + ISN_BLOBINDEX, // [expr] blob index + ISN_BLOBSLICE, // [expr:expr] blob slice + ISN_ANYINDEX, // [expr] runtime index + ISN_ANYSLICE, // [expr:expr] runtime slice + ISN_SLICE, // drop isn_arg.number items from start of list + ISN_BLOBAPPEND, // append to a blob, like add() + ISN_GETITEM, // push list item, isn_arg.number is the index + ISN_MEMBER, // dict[member] + ISN_STRINGMEMBER, // dict.member using isn_arg.string + ISN_2BOOL, // falsy/truthy to bool, uses isn_arg.tobool + ISN_COND2BOOL, // convert value to bool + ISN_2STRING, // convert value to string at isn_arg.tostring on stack + ISN_2STRING_ANY, // like ISN_2STRING but check type + ISN_NEGATENR, // apply "-" to number + + ISN_CHECKTYPE, // check value type is isn_arg.type.ct_type + ISN_CHECKLEN, // check list length is isn_arg.checklen.cl_min_len + ISN_SETTYPE, // set dict type to isn_arg.type.ct_type + + ISN_CLEARDICT, // clear dict saved by ISN_MEMBER/ISN_STRINGMEMBER + ISN_USEDICT, // use or clear dict saved by ISN_MEMBER/ISN_STRINGMEMBER + + ISN_PUT, // ":put", uses isn_arg.put + ISN_IPUT, // ":iput", uses isn_arg.put + + ISN_CMDMOD, // set cmdmod + ISN_CMDMOD_REV, // undo ISN_CMDMOD + + ISN_PROF_START, // start a line for profiling + ISN_PROF_END, // end a line for profiling + + ISN_DEBUG, // check for debug breakpoint, uses isn_arg.debug + + ISN_UNPACK, // unpack list into items, uses isn_arg.unpack + ISN_SHUFFLE, // move item on stack up or down + ISN_DROP, // pop stack and discard value + + ISN_REDIRSTART, // :redir => + ISN_REDIREND, // :redir END, isn_arg.number == 1 for append + + ISN_CEXPR_AUCMD, // first part of :cexpr isn_arg.number is cmdidx + ISN_CEXPR_CORE, // second part of :cexpr, uses isn_arg.cexpr + + ISN_SCRIPTCTX_SET, // set script context for expression evaluation + + ISN_FINISH // end marker in list of instructions +} isntype_T; + + +// arguments to ISN_BCALL +typedef struct { + int cbf_idx; // index in "global_functions" + int cbf_argcount; // number of arguments on top of stack +} cbfunc_T; + +// arguments to ISN_DCALL +typedef struct { + int cdf_idx; // index in "def_functions" for ISN_DCALL + int cdf_argcount; // number of arguments on top of stack +} cdfunc_T; + +// arguments to ISN_METHODCALL +typedef struct { + class_T *cmf_itf; // interface used + int cmf_idx; // index in "def_functions" for ISN_METHODCALL + int cmf_argcount; // number of arguments on top of stack + int cmf_is_super; // doing "super.Func", use cmf_itf, not cmf_idx +} cmfunc_T; + +// arguments to ISN_PCALL +typedef struct { + int cpf_top; // when TRUE partial is above the arguments + int cpf_argcount; // number of arguments on top of stack +} cpfunc_T; + +// arguments to ISN_UCALL and ISN_XCALL +typedef struct { + char_u *cuf_name; + int cuf_argcount; // number of arguments on top of stack +} cufunc_T; + +// arguments to ISN_GETITEM +typedef struct { + varnumber_T gi_index; + int gi_with_op; +} getitem_T; + +typedef enum { + JUMP_ALWAYS, + JUMP_NEVER, + JUMP_IF_FALSE, // pop and jump if false + JUMP_WHILE_FALSE, // pop and jump if false for :while + JUMP_AND_KEEP_IF_TRUE, // jump if top of stack is truthy, drop if not + JUMP_IF_COND_TRUE, // jump if top of stack is true, drop if not + JUMP_IF_COND_FALSE, // jump if top of stack is false, drop if not +} jumpwhen_T; + +// arguments to ISN_JUMP +typedef struct { + jumpwhen_T jump_when; + int jump_where; // position to jump to +} jump_T; + +// arguments to ISN_JUMP_IF_ARG_SET and ISN_JUMP_IF_ARG_NOT_SET +typedef struct { + int jump_arg_off; // argument index, negative + int jump_where; // position to jump to +} jumparg_T; + +// arguments to ISN_FOR +typedef struct { + short for_loop_idx; // loop variable index + int for_end; // position to jump to after done +} forloop_T; + +// arguments to ISN_WHILE +typedef struct { + short while_funcref_idx; // variable index for funcref count + int while_end; // position to jump to after done +} whileloop_T; + +// arguments to ISN_ENDLOOP +typedef struct { + short end_funcref_idx; // variable index of funcrefs.ga_len + short end_depth; // nested loop depth + short end_var_idx; // first variable declared in the loop + short end_var_count; // number of variables declared in the loop +} endloop_T; + +// indirect arguments to ISN_TRY +typedef struct { + int try_catch; // position to jump to on throw + int try_finally; // :finally or :endtry position to jump to + int try_endtry; // :endtry position to jump to +} tryref_T; + +// arguments to ISN_TRY +typedef struct { + tryref_T *try_ref; +} try_T; + +// arguments to ISN_TRYCONT +typedef struct { + int tct_levels; // number of nested try statements + int tct_where; // position to jump to, WHILE or FOR +} trycont_T; + +// arguments to ISN_ECHO +typedef struct { + int echo_with_white; // :echo instead of :echon + int echo_count; // number of expressions +} echo_T; + +// arguments to ISN_OPNR, ISN_OPFLOAT, etc. +typedef struct { + exprtype_T op_type; + int op_ic; // TRUE with '#', FALSE with '?', else MAYBE +} opexpr_T; + +// arguments to ISN_CHECKTYPE +typedef struct { + type_T *ct_type; + int8_T ct_off; // offset in stack, -1 is bottom + int8_T ct_arg_idx; // argument index or zero + int8_T ct_is_var; // when TRUE checking variable instead of arg +} checktype_T; + +// arguments to ISN_STORENR +typedef struct { + int stnr_idx; + varnumber_T stnr_val; +} storenr_T; + +// arguments to ISN_STOREOPT and ISN_STOREFUNCOPT +typedef struct { + char_u *so_name; + int so_flags; +} storeopt_T; + +// arguments to ISN_LOADS and ISN_STORES +typedef struct { + char_u *ls_name; // variable name (with s: for ISN_STORES) + int ls_sid; // script ID +} loadstore_T; + +// arguments to ISN_LOADSCRIPT and ISN_STORESCRIPT +typedef struct { + int sref_sid; // script ID + int sref_idx; // index in sn_var_vals + int sref_seq; // sn_script_seq when compiled + type_T *sref_type; // type of the variable when compiled +} scriptref_T; + +typedef struct { + scriptref_T *scriptref; +} script_T; + +// arguments to ISN_UNLET +typedef struct { + char_u *ul_name; // variable name with g:, w:, etc. + int ul_forceit; // forceit flag +} unlet_T; + +// extra arguments for funcref_T +typedef struct { + char_u *fre_func_name; // function name for legacy function + loopvarinfo_T fre_loopvar_info; // info about variables inside loops + class_T *fre_class; // class for a method + int fre_object_method; // class or object method + int fre_method_idx; // method index on "fre_class" +} funcref_extra_T; + +// arguments to ISN_FUNCREF +typedef struct { + int fr_dfunc_idx; // function index for :def function + funcref_extra_T *fr_extra; // optional extra information +} funcref_T; + +// arguments to ISN_NEWFUNC +typedef struct { + char_u *nfa_lambda; // name of the lambda already defined + char_u *nfa_global; // name of the global function to be created + loopvarinfo_T nfa_loopvar_info; // ifno about variables inside loops +} newfuncarg_T; + +typedef struct { + newfuncarg_T *nf_arg; +} newfunc_T; + +// arguments to ISN_CHECKLEN +typedef struct { + int cl_min_len; // minimum length + int cl_more_OK; // longer is allowed +} checklen_T; + +// arguments to ISN_SHUFFLE +typedef struct { + int shfl_item; // item to move (relative to top of stack) + int shfl_up; // places to move upwards +} shuffle_T; + +// arguments to ISN_PUT +typedef struct { + int put_regname; // register, can be NUL + linenr_T put_lnum; // line number to put below +} put_T; + +// arguments to ISN_CMDMOD +typedef struct { + cmdmod_T *cf_cmdmod; // allocated +} cmod_T; + +// arguments to ISN_UNPACK +typedef struct { + int unp_count; // number of items to produce + int unp_semicolon; // last item gets list of remainder +} unpack_T; + +// arguments to ISN_LOADOUTER and ISN_STOREOUTER +typedef struct { + int outer_idx; // index + int outer_depth; // nesting level, stack frames to go up +} isn_outer_T; + +#define OUTER_LOOP_DEPTH -9 // used for outer_depth for loop variables + +// arguments to ISN_SUBSTITUTE +typedef struct { + char_u *subs_cmd; // :s command + isn_T *subs_instr; // sequence of instructions +} subs_T; + +// indirect arguments to ISN_TRY +typedef struct { + int cer_cmdidx; + char_u *cer_cmdline; + int cer_forceit; +} cexprref_T; + +// arguments to ISN_CEXPR_CORE +typedef struct { + cexprref_T *cexpr_ref; +} cexpr_T; + +// arguments to ISN_2STRING and ISN_2STRING_ANY +typedef struct { + int offset; + int flags; +} tostring_T; + +// arguments to ISN_2BOOL +typedef struct { + int offset; + int invert; +} tobool_T; + +// arguments to ISN_DEBUG +typedef struct { + varnumber_T dbg_var_names_len; // current number of local variables + int dbg_break_lnum; // first line to break after +} debug_T; + +// arguments to ISN_DEFER +typedef struct { + int defer_var_idx; // local variable index for defer list + int defer_argcount; // number of arguments +} deferins_T; + +// arguments to ISN_ECHOWINDOW +typedef struct { + int ewin_count; // number of arguments + long ewin_time; // time argument (msec) +} echowin_T; + +// arguments to ISN_CONSTRUCT +typedef struct { + int construct_size; // size of object in bytes + class_T *construct_class; // class the object is created from +} construct_T; + +// arguments to ISN_STORE_CLASSMEMBER, ISN_LOAD_CLASSMEMBER, ISN_GET_ITF_MEMBER +typedef struct { + class_T *cm_class; + int cm_idx; +} classmember_T; + +// arguments to ISN_STOREINDEX +typedef struct { + vartype_T si_vartype; + class_T *si_class; +} storeindex_T; + +// arguments to ISN_LOCKUNLOCK +typedef struct { + char_u *lu_string; // for exec_command + class_T *lu_cl_exec; // executing, null if not class/obj method + int lu_is_arg; // is lval_root a function arg +} lockunlock_T; + +/* + * Instruction + */ +struct isn_S { + isntype_T isn_type; + int isn_lnum; + union { + char_u *string; + varnumber_T number; + blob_T *blob; + vartype_T vartype; + float_T fnumber; + channel_T *channel; + job_T *job; + partial_T *partial; + class_T *classarg; + jump_T jump; + jumparg_T jumparg; + forloop_T forloop; + whileloop_T whileloop; + endloop_T endloop; + try_T tryref; + trycont_T trycont; + cbfunc_T bfunc; + cdfunc_T dfunc; + cmfunc_T *mfunc; + cpfunc_T pfunc; + cufunc_T ufunc; + echo_T echo; + opexpr_T op; + checktype_T type; + storenr_T storenr; + storeopt_T storeopt; + loadstore_T loadstore; + script_T script; + unlet_T unlet; + funcref_T funcref; + newfunc_T newfunc; + checklen_T checklen; + shuffle_T shuffle; + put_T put; + cmod_T cmdmod; + unpack_T unpack; + isn_outer_T outer; + subs_T subs; + cexpr_T cexpr; + isn_T *instr; + tostring_T tostring; + tobool_T tobool; + getitem_T getitem; + debug_T debug; + deferins_T defer; + echowin_T echowin; + construct_T construct; + classmember_T classmember; + storeindex_T storeindex; + lockunlock_T lockunlock; + sctx_T setsctx; + } isn_arg; +}; + +/* + * Info about a function defined with :def. Used in "def_functions". + */ +struct dfunc_S { + ufunc_T *df_ufunc; // struct containing most stuff + int df_refcount; // how many ufunc_T point to this dfunc_T + int df_idx; // index in def_functions + char df_deleted; // if TRUE function was deleted + char df_delete_busy; // TRUE when in + // delete_def_function_contents() + int df_script_seq; // Value of sctx_T sc_seq when the function + // was compiled. + char_u *df_name; // name used for error messages + + garray_T df_def_args_isn; // default argument instructions + garray_T df_var_names; // names of local vars + + // After compiling "df_instr" and/or "df_instr_prof" is not NULL. + isn_T *df_instr; // function body to be executed + int df_instr_count; // size of "df_instr" + int df_instr_debug_count; // size of "df_instr_debug" + isn_T *df_instr_debug; // like "df_instr" with debugging +#ifdef FEAT_PROFILE + isn_T *df_instr_prof; // like "df_instr" with profiling + int df_instr_prof_count; // size of "df_instr_prof" +#endif + + int df_varcount; // number of local variables + int df_has_closure; // one if a closure was created + int df_defer_var_idx; // index of local variable that has a list + // of deferred function calls; zero if not + // set +}; + +// Number of entries used by stack frame for a function call. +// - ec_dfunc_idx: function index +// - ec_iidx: instruction index +// - ec_instr: instruction list pointer +// - ec_outer: stack used for closures +// - funclocal: function-local data +// - ec_frame_idx: previous frame index +#define STACK_FRAME_FUNC_OFF 0 +#define STACK_FRAME_IIDX_OFF 1 +#define STACK_FRAME_INSTR_OFF 2 +#define STACK_FRAME_OUTER_OFF 3 +#define STACK_FRAME_FUNCLOCAL_OFF 4 +#define STACK_FRAME_IDX_OFF 5 +#define STACK_FRAME_SIZE 6 + + +extern garray_T def_functions; + +// Used for "lnum" when a range is to be taken from the stack. +#define LNUM_VARIABLE_RANGE (-999) + +// Used for "lnum" when a range is to be taken from the stack and "!" is used. +#define LNUM_VARIABLE_RANGE_ABOVE (-888) + +// Keep in sync with get_compile_type() +#ifdef FEAT_PROFILE +# define INSTRUCTIONS(dfunc) \ + (debug_break_level > 0 || may_break_in_function(dfunc->df_ufunc) \ + ? (dfunc)->df_instr_debug \ + : ((do_profiling == PROF_YES && (dfunc->df_ufunc)->uf_profiling) \ + ? (dfunc)->df_instr_prof \ + : (dfunc)->df_instr)) +#else +# define INSTRUCTIONS(dfunc) \ + (debug_break_level > 0 || may_break_in_function((dfunc)->df_ufunc) \ + ? (dfunc)->df_instr_debug \ + : (dfunc)->df_instr) +#endif + +// Structure passed between the compile_expr* functions to keep track of +// constants that have been parsed but for which no code was produced yet. If +// possible expressions on these constants are applied at compile time. If +// that is not possible, the code to push the constants needs to be generated +// before other instructions. +// Using 50 should be more than enough of 5 levels of (). +#define PPSIZE 50 +typedef struct { + typval_T pp_tv[PPSIZE]; // stack of ppconst constants + int pp_used; // active entries in pp_tv[] + int pp_is_const; // all generated code was constants, used for a + // list or dict with constant members +} ppconst_T; + +// values for ctx_skip +typedef enum { + SKIP_NOT, // condition is a constant, produce code + SKIP_YES, // condition is a constant, do NOT produce code + SKIP_UNKNOWN // condition is not a constant, produce code +} skip_T; + +/* + * Chain of jump instructions where the end label needs to be set. + */ +typedef struct endlabel_S endlabel_T; +struct endlabel_S { + endlabel_T *el_next; // chain end_label locations + int el_end_label; // instruction idx where to set end +}; + +/* + * info specific for the scope of :if / elseif / else + */ +typedef struct { + int is_seen_else; + int is_seen_skip_not; // a block was unconditionally executed + int is_had_return; // every block ends in :return + int is_if_label; // instruction idx at IF or ELSEIF + endlabel_T *is_end_label; // instructions to set end label +} ifscope_T; + +// info used by :for and :while needed for ENDLOOP +typedef struct { + int li_local_count; // ctx_locals.ga_len at loop start + int li_closure_count; // ctx_closure_count at loop start + int li_funcref_idx; // index of var that holds funcref count + int li_depth; // nested loop depth +} loop_info_T; + +/* + * info specific for the scope of :while + */ +typedef struct { + int ws_top_label; // instruction idx at WHILE + endlabel_T *ws_end_label; // instructions to set end + loop_info_T ws_loop_info; // info for LOOPEND +} whilescope_T; + +/* + * info specific for the scope of :for + */ +typedef struct { + int fs_top_label; // instruction idx at FOR + endlabel_T *fs_end_label; // break instructions + loop_info_T fs_loop_info; // info for LOOPEND +} forscope_T; + +/* + * info specific for the scope of :try + */ +typedef struct { + int ts_try_label; // instruction idx at TRY + endlabel_T *ts_end_label; // jump to :finally or :endtry + int ts_catch_label; // instruction idx of last CATCH + int ts_caught_all; // "catch" without argument encountered + int ts_has_finally; // "finally" encountered + int ts_no_return; // one of the blocks did not end in return +} tryscope_T; + +typedef enum { + NO_SCOPE, + IF_SCOPE, + WHILE_SCOPE, + FOR_SCOPE, + TRY_SCOPE, + BLOCK_SCOPE +} scopetype_T; + +/* + * Info for one scope, pointed to by "ctx_scope". + */ +typedef struct scope_S scope_T; +struct scope_S { + scope_T *se_outer; // scope containing this one + scopetype_T se_type; + int se_local_count; // ctx_locals.ga_len before scope + skip_T se_skip_save; // ctx_skip before the block + int se_loop_depth; // number of loop scopes, including this + union { + ifscope_T se_if; + whilescope_T se_while; + forscope_T se_for; + tryscope_T se_try; + } se_u; +}; + +/* + * Entry for "ctx_locals". Used for arguments and local variables. + */ +typedef struct { + char_u *lv_name; + type_T *lv_type; + int lv_idx; // index of the variable on the stack + int lv_loop_depth; // depth for variable inside a loop or -1 + int lv_loop_idx; // index of first variable inside a loop or -1 + int lv_from_outer; // nesting level, using ctx_outer scope + int lv_const; // ASSIGN_VAR (can be assigned to), + // ASSIGN_FINAL (no assignment) or ASSIGN_CONST + // (value cannot be changed) + int lv_arg; // when TRUE this is an argument +} lvar_T; + +// Destination for an assignment or ":unlet" with an index. +typedef enum { + dest_local, + dest_option, + dest_func_option, + dest_env, + dest_global, + dest_buffer, + dest_window, + dest_tab, + dest_mnvvar, + dest_class_member, + dest_script, + dest_script_v9, + dest_reg, + dest_expr, +} assign_dest_T; + +// Used by compile_lhs() to store information about the LHS of an assignment +// and one argument of ":unlet" with an index. +typedef struct { + assign_dest_T lhs_dest; // type of destination + + char_u *lhs_name; // allocated name excluding the last + // "[expr]" or ".name". + size_t lhs_varlen; // length of the variable without + // "[expr]" or ".name" + char_u *lhs_whole; // allocated name including the last + // "[expr]" or ".name" for :redir + size_t lhs_varlen_total; // length of the variable including + // any "[expr]" or ".name" + char_u *lhs_dest_end; // end of the destination, including + // "[expr]" or ".name". + char_u *lhs_end; // end including any type + + int lhs_has_index; // has "[expr]" or ".name" + + int lhs_new_local; // create new local variable + int lhs_opt_flags; // for when destination is an option + int lhs_mnvvaridx; // for when destination is a v:var + + lvar_T lhs_local_lvar; // used for existing local destination + lvar_T lhs_arg_lvar; // used for argument destination + lvar_T *lhs_lvar; // points to destination lvar + + class_T *lhs_class; // for dest_class_member + int lhs_classmember_idx; // for dest_class_member + + int lhs_scriptvar_sid; + int lhs_scriptvar_idx; + + int lhs_has_type; // type was specified + type_T *lhs_type; + int lhs_member_idx; // object member index + type_T *lhs_member_type; // list/dict/object member type + + int lhs_append; // used by ISN_REDIREND +} lhs_T; + +/* + * Context for compiling lines of a :def function. + * Stores info about the local variables and condition stack. + */ +struct cctx_S { + ufunc_T *ctx_ufunc; // current function + int ctx_lnum; // line number in current function + char_u *ctx_line_start; // start of current line or NULL + garray_T ctx_instr; // generated instructions + + int ctx_prev_lnum; // line number below previous command, for + // debugging + + compiletype_T ctx_compile_type; + + garray_T ctx_locals; // currently visible local variables + + int ctx_has_closure; // set to one if a FUNCREF was used in the + // function + int ctx_closure_count; // incremented for each closure created in + // the function. + + skip_T ctx_skip; + scope_T *ctx_scope; // current scope, NULL at toplevel + int ctx_had_return; // last seen statement was "return" + int ctx_had_throw; // last seen statement was "throw" + + cctx_T *ctx_outer; // outer scope for lambda or nested + // function + int ctx_outer_used; // var in ctx_outer was used + + garray_T ctx_type_stack; // type of each item on the stack + garray_T *ctx_type_list; // list of pointers to allocated types + + int ctx_has_cmdmod; // ISN_CMDMOD was generated + + lhs_T ctx_redir_lhs; // LHS for ":redir => var", valid when + // lhs_name is not NULL +}; + +/* + * List of special functions for "compile_arguments()". + */ +typedef enum { + CA_NOT_SPECIAL, + CA_SEARCHPAIR, // {skip} in searchpair() and searchpairpos() + CA_SUBSTITUTE, // {sub} in substitute(), when prefixed with \= +} ca_special_T; + +// flags for typval2type() +#define TVTT_DO_MEMBER 1 +#define TVTT_MORE_SPECIFIC 2 // get most specific type for member + +// flags for call_def_function() +#define DEF_USE_PT_ARGV 1 // use the partial arguments + +// Flag used for conversion to string by may_generate_2STRING() +#define TOSTRING_NONE 0x0 +// Convert a List to series of values separated by newline +#define TOSTRING_INTERPOLATE 0x1 +// Convert a List to a textual representation of the list "[...]" +#define TOSTRING_TOLERANT 0x2 diff --git a/uvim/src/mnv9class.c b/uvim/src/mnv9class.c new file mode 100644 index 0000000000..ba636c101c --- /dev/null +++ b/uvim/src/mnv9class.c @@ -0,0 +1,4424 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * MNV - MNV is not Vim by Bram Moolenaar + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. + */ + +/* + * mnv9class.c: MNV9 script class support + */ + +#define USING_FLOAT_STUFF +#include "mnv.h" + +#if defined(FEAT_EVAL) + +static class_T *first_class = NULL; +static class_T *next_nonref_class = NULL; + +/* + * Call this function when a class has been created. It will be added to the + * list headed by "first_class". + */ + static void +class_created(class_T *cl) +{ + if (first_class != NULL) + { + cl->class_next_used = first_class; + first_class->class_prev_used = cl; + } + first_class = cl; +} + +/* + * Call this function when a class has been cleared and is about to be freed. + * It is removed from the list headed by "first_class". + */ + static void +class_cleared(class_T *cl) +{ + if (cl->class_next_used != NULL) + cl->class_next_used->class_prev_used = cl->class_prev_used; + if (cl->class_prev_used != NULL) + cl->class_prev_used->class_next_used = cl->class_next_used; + else if (first_class == cl) + first_class = cl->class_next_used; + + // update the next class to check if needed + if (cl == next_nonref_class) + next_nonref_class = cl->class_next_used; +} + +/* + * Parse a member declaration, both object and class member. + * Returns OK or FAIL. When OK then "varname_end" is set to just after the + * variable name and "type_ret" is set to the declared or detected type. + * "init_expr" is set to the initialisation expression (allocated), if there is + * one. For an interface "init_expr" is NULL. + */ + static int +parse_member( + exarg_T *eap, + char_u *line, + char_u *varname, + int has_public, // TRUE if "public" seen before "varname" + char_u **varname_end, + int *has_type, + garray_T *type_list, + type_T **type_ret, + char_u **init_expr) +{ + *varname_end = to_name_end(varname, FALSE); + if (*varname == '_' && has_public) + { + semsg(_(e_public_variable_name_cannot_start_with_underscore_str), line); + return FAIL; + } + + char_u *colon = skipwhite(*varname_end); + char_u *type_arg = colon; + type_T *type = NULL; + *has_type = FALSE; + if (*colon == ':') + { + if (MNV_ISWHITE(**varname_end)) + { + semsg(_(e_no_white_space_allowed_before_colon_str), varname); + return FAIL; + } + if (!MNV_ISWHITE(colon[1])) + { + semsg(_(e_white_space_required_after_str_str), ":", varname); + return FAIL; + } + type_arg = skipwhite(colon + 1); + type = parse_type(&type_arg, type_list, NULL, NULL, TRUE); + if (type == NULL || !valid_declaration_type(type)) + return FAIL; + *has_type = TRUE; + } + + char_u *init_arg = skipwhite(type_arg); + if (type == NULL && *init_arg != '=') + { + emsg(_(e_type_or_initialization_required)); + return FAIL; + } + + if (init_expr == NULL && *init_arg == '=') + { + emsg(_(e_cannot_initialize_variable_in_interface)); + return FAIL; + } + + if (*init_arg == '=') + { + evalarg_T evalarg; + char_u *expr_start, *expr_end; + + if (!MNV_ISWHITE(init_arg[-1]) || !MNV_ISWHITE(init_arg[1])) + { + semsg(_(e_white_space_required_before_and_after_str_at_str), + "=", type_arg); + return FAIL; + } + init_arg = skipwhite(init_arg + 1); + + fill_evalarg_from_eap(&evalarg, eap, FALSE); + (void)skip_expr_concatenate(&init_arg, &expr_start, &expr_end, &evalarg); + + init_arg = skipwhite(init_arg); + if (*init_arg != NUL && !mnv9_comment_start(init_arg)) + { + semsg(_(e_trailing_characters_str), init_arg); + clear_evalarg(&evalarg, NULL); + return FAIL; + } + + // No type specified for the member. Set it to "any" and the correct + // type will be set when the object is instantiated. + if (type == NULL) + type = &t_any; + + *init_expr = mnv_strnsave(expr_start, expr_end - expr_start); + // Free the memory pointed by expr_start. + clear_evalarg(&evalarg, NULL); + } + else if (!valid_declaration_type(type)) + return FAIL; + + *type_ret = type; + return OK; +} + +/* + * Add a member to an object or a class. + * Returns OK when successful, "init_expr" will be consumed then. + * Returns OK on success and FAIL on memory allocation failure (caller might + * need to free "init_expr"). + */ + static int +add_member( + garray_T *gap, + char_u *varname, + char_u *varname_end, + int has_public, + int has_final, + int has_const, + int has_type, + type_T *type, + char_u *init_expr) +{ + if (ga_grow(gap, 1) == FAIL) + return FAIL; + ocmember_T *m = ((ocmember_T *)gap->ga_data) + gap->ga_len; + m->ocm_name.length = (size_t)(varname_end - varname); + m->ocm_name.string = mnv_strnsave(varname, m->ocm_name.length); + if (m->ocm_name.string == NULL) + { + m->ocm_name.length = 0; + return FAIL; + } + m->ocm_access = has_public ? MNV_ACCESS_ALL + : *varname == '_' ? MNV_ACCESS_PRIVATE : MNV_ACCESS_READ; + if (has_final) + m->ocm_flags |= OCMFLAG_FINAL; + if (has_const) + m->ocm_flags |= OCMFLAG_CONST; + if (has_type) + m->ocm_flags |= OCMFLAG_HAS_TYPE; + m->ocm_type = type; + if (init_expr != NULL) + { + m->ocm_init = init_expr; + // Save the script context, we need it when evaluating or compiling the + // initializer expression. + m->ocm_init_sctx = current_sctx; + m->ocm_init_sctx.sc_lnum += SOURCING_LNUM; + } + ++gap->ga_len; + return OK; +} + +/* + * Move the class or object members found while parsing a class into the class. + * "gap" contains the found members. + * "parent_members" points to the members in the parent class (if any) + * "parent_count" is the number of members in the parent class + * "members" will be set to the newly allocated array of members and + * "member_count" set to the number of members. + * Returns OK on success and FAIL on memory allocation failure. + */ + static int +add_members_to_class( + garray_T *gap, + ocmember_T *parent_members, + int parent_count, + ocmember_T **members, + int *member_count) +{ + *member_count = parent_count + gap->ga_len; + *members = *member_count == 0 ? NULL + : ALLOC_MULT(ocmember_T, *member_count); + if (*member_count > 0 && *members == NULL) + return FAIL; + for (int i = 0; i < parent_count; ++i) + { + // parent members need to be copied + ocmember_T *m = *members + i; + *m = parent_members[i]; + m->ocm_name.string = mnv_strnsave(m->ocm_name.string, m->ocm_name.length); + if (m->ocm_name.string == NULL) + { + m->ocm_name.length = 0; + return FAIL; + } + if (m->ocm_init != NULL) + m->ocm_init = mnv_strsave(m->ocm_init); + } + if (gap->ga_len > 0) + // new members are moved + mch_memmove(*members + parent_count, + gap->ga_data, sizeof(ocmember_T) * gap->ga_len); + MNV_CLEAR(gap->ga_data); + return OK; +} + +/* + * Convert a member index "idx" of interface "itf" to the member index of class + * "cl" implementing that interface. + */ + int +object_index_from_itf_index(class_T *itf, int is_method, int idx, class_T *cl) +{ + if (idx >= (is_method ? itf->class_obj_method_count + : itf->class_obj_member_count)) + { + siemsg("index %d out of range for interface %s", idx, itf->class_name.string); + return 0; + } + + // If "cl" is the interface or the class that is extended, then the method + // index can be used directly and there is no need to search for the method + // index in one of the child classes. + if (cl == itf) + return idx; + + itf2class_T *i2c = NULL; + int searching = TRUE; + int method_offset = 0; + + for (class_T *super = cl; super != NULL && searching; + super = super->class_extends) + { + for (i2c = itf->class_itf2class; i2c != NULL; i2c = i2c->i2c_next) + { + if (i2c->i2c_class == super && i2c->i2c_is_method == is_method) + { + searching = FALSE; + break; + } + } + if (searching && is_method) + // The parent class methods are stored after the current class + // methods. + method_offset += super->class_obj_method_count_child; + } + if (i2c == NULL) + { + siemsg("class %s not found on interface %s", + cl->class_name.string, itf->class_name.string); + return 0; + } + + // A table follows the i2c for the class + int *table = (int *)(i2c + 1); + // "method_offset" is 0, if method is in the current class. If method + // is in a parent class, then it is non-zero. + return table[idx] + method_offset; +} + +/* + * Check whether a class named "extends_name" is present. If the class is + * valid, then "extends_clp" is set with the class pointer. + * Returns TRUE if the class name "extends_names" is a valid class. + */ + static int +validate_extends_class( + class_T *cl, + char_u *extends_name, + class_T **extends_clp, + int is_class) +{ + typval_T tv; + int success = FALSE; + + if (STRCMP(cl->class_name.string, extends_name) == 0) + { + semsg(_(e_cannot_extend_str), extends_name); + return success; + } + + tv.v_type = VAR_UNKNOWN; + if (eval_variable_import(extends_name, &tv) == FAIL) + { + semsg(_(e_class_name_not_found_str), extends_name); + return success; + } + + if (tv.v_type != VAR_CLASS || tv.vval.v_class == NULL + || (is_class && IS_INTERFACE(tv.vval.v_class)) + || (!is_class && !IS_INTERFACE(tv.vval.v_class)) + || (is_class && IS_ENUM(tv.vval.v_class))) + { + // a class cannot extend an interface + // an interface cannot extend a class + // a class cannot extend an enum. + semsg(_(e_cannot_extend_str), extends_name); + } + else + { + class_T *extends_cl = tv.vval.v_class; + ++extends_cl->class_refcount; + *extends_clp = extends_cl; + success = TRUE; + } + clear_tv(&tv); + + return success; +} + +/* + * Check a generic method is extended by a generic method and the number of + * type variables match. + */ + static int +validate_extends_generic_method( + class_T *super_cl, + ufunc_T *super_fp, + ufunc_T *cl_fp) +{ + char *msg = NULL; + + if (cl_fp->uf_generic_argcount == super_fp->uf_generic_argcount) + return TRUE; + + if (super_fp->uf_generic_argcount == 0) + msg = e_concrete_method_str_override_with_generic_method_in_class_str; + else if (cl_fp->uf_generic_argcount == 0) + msg = e_generic_method_str_override_with_concrete_method_in_class_str; + else + msg = e_generic_method_str_type_arguments_mismatch_in_class_str; + + semsg(_(msg), cl_fp->uf_name, super_cl->class_name.string); + return FALSE; +} + +/* + * Check method names in the parent class lineage to make sure the access is + * the same for overridden methods. + */ + static int +validate_extends_methods( + garray_T *objmethods_gap, + class_T *extends_cl) +{ + class_T *super = extends_cl; + int method_count = objmethods_gap->ga_len; + ufunc_T **cl_fp = (ufunc_T **)(objmethods_gap->ga_data); + + while (super != NULL) + { + int extends_method_count = super->class_obj_method_count_child; + if (extends_method_count == 0) + { + super = super->class_extends; + continue; + } + + ufunc_T **extends_methods = super->class_obj_methods; + + for (int i = 0; i < extends_method_count; i++) + { + char_u *pstr = extends_methods[i]->uf_name; + int extends_private = (*pstr == '_'); + if (extends_private) + pstr++; + + // When comparing the method names, ignore the access type (public + // and private methods are considered the same). + for (int j = 0; j < method_count; j++) + { + char_u *qstr = cl_fp[j]->uf_name; + int priv_method = (*qstr == '_'); + if (priv_method) + qstr++; + if (STRCMP(pstr, qstr) == 0) + { + if (priv_method != extends_private) + { + // Method access is different between the super class + // and the subclass + semsg(_(e_method_str_of_class_str_has_different_access), + cl_fp[j]->uf_name, super->class_name.string); + return FALSE; + } + + if (!validate_extends_generic_method(super, + extends_methods[i], cl_fp[j])) + return FALSE; + } + } + } + super = super->class_extends; + } + + return TRUE; +} + +/* + * Check whether a object member variable in "objmembers_gap" is a duplicate of + * a member in any of the extended parent class lineage. Returns TRUE if there + * are no duplicates. + */ + static int +extends_check_dup_members( + garray_T *objmembers_gap, + class_T *extends_cl) +{ + int member_count = objmembers_gap->ga_len; + if (member_count == 0) + return TRUE; + + ocmember_T *members = (ocmember_T *)(objmembers_gap->ga_data); + + // Validate each member variable + for (int c_i = 0; c_i < member_count; c_i++) + { + class_T *p_cl = extends_cl; + ocmember_T *c_m = members + c_i; + char_u *pstr = (*c_m->ocm_name.string == '_') + ? c_m->ocm_name.string + 1 : c_m->ocm_name.string; + + // Check in all the parent classes in the lineage + while (p_cl != NULL) + { + int p_member_count = p_cl->class_obj_member_count; + if (p_member_count == 0) + { + p_cl = p_cl->class_extends; + continue; + } + ocmember_T *p_members = p_cl->class_obj_members; + + // Compare against all the members in the parent class + for (int p_i = 0; p_i < p_member_count; p_i++) + { + ocmember_T *p_m = p_members + p_i; + char_u *qstr = (*p_m->ocm_name.string == '_') + ? p_m->ocm_name.string + 1 : p_m->ocm_name.string; + if (STRCMP(pstr, qstr) == 0) + { + semsg(_(e_duplicate_variable_str), c_m->ocm_name.string); + return FALSE; + } + } + + p_cl = p_cl->class_extends; + } + } + + return TRUE; +} + +/* + * Compare the variable type of interface variables in "objmembers_gap" against + * the variable in any of the extended super interface lineage. Used to + * compare the variable types when extending interfaces. Returns TRUE if the + * variable types are the same. + */ + static int +extends_check_intf_var_type( + garray_T *objmembers_gap, + class_T *extends_cl) +{ + int member_count = objmembers_gap->ga_len; + if (member_count == 0) + return TRUE; + + ocmember_T *members = (ocmember_T *)(objmembers_gap->ga_data); + + // Validate each member variable + for (int c_i = 0; c_i < member_count; c_i++) + { + class_T *p_cl = extends_cl; + ocmember_T *c_m = members + c_i; + int var_found = FALSE; + + // Check in all the parent classes in the lineage + while (p_cl != NULL && !var_found) + { + int p_member_count = p_cl->class_obj_member_count; + if (p_member_count == 0) + { + p_cl = p_cl->class_extends; + continue; + } + ocmember_T *p_members = p_cl->class_obj_members; + + // Compare against all the members in the parent class + for (int p_i = 0; p_i < p_member_count; p_i++) + { + where_T where = WHERE_INIT; + ocmember_T *p_m = p_members + p_i; + + if (STRCMP(p_m->ocm_name.string, c_m->ocm_name.string) != 0) + continue; + + // Ensure the type is matching. + where.wt_func_name = (char *)c_m->ocm_name.string; + where.wt_kind = WT_MEMBER; + + if (check_type(p_m->ocm_type, c_m->ocm_type, TRUE, + where) == FAIL) + return FALSE; + + var_found = TRUE; + } + + p_cl = p_cl->class_extends; + } + } + + return TRUE; +} + +/* + * When extending an abstract class, check whether all the abstract methods in + * the parent class are implemented. Returns TRUE if all the methods are + * implemented. + */ + static int +validate_abstract_class_methods( + garray_T *classmethods_gap, + garray_T *objmethods_gap, + class_T *extends_cl) +{ + for (int loop = 1; loop <= 2; ++loop) + { + // loop == 1: check class methods + // loop == 2: check object methods + int extends_method_count = loop == 1 + ? extends_cl->class_class_function_count + : extends_cl->class_obj_method_count; + if (extends_method_count == 0) + continue; + + ufunc_T **extends_methods = loop == 1 + ? extends_cl->class_class_functions + : extends_cl->class_obj_methods; + + int method_count = loop == 1 ? classmethods_gap->ga_len + : objmethods_gap->ga_len; + ufunc_T **cl_fp = (ufunc_T **)(loop == 1 + ? classmethods_gap->ga_data + : objmethods_gap->ga_data); + + for (int i = 0; i < extends_method_count; i++) + { + ufunc_T *uf = extends_methods[i]; + if (!IS_ABSTRACT_METHOD(uf)) + continue; + + int concrete_method_found = FALSE; + int j = 0; + + // Check if the abstract method is already implemented in one of + // the parent classes. + for (j = 0; !concrete_method_found && j < i; j++) + { + ufunc_T *uf2 = extends_methods[j]; + if (!IS_ABSTRACT_METHOD(uf2) && + STRCMP(uf->uf_name, uf2->uf_name) == 0) + concrete_method_found = TRUE; + } + + if (concrete_method_found) + continue; + + for (j = 0; j < method_count; j++) + { + if (STRCMP(uf->uf_name, cl_fp[j]->uf_name) == 0) + { + concrete_method_found = TRUE; + break; + } + } + + if (!concrete_method_found) + { + semsg(_(e_abstract_method_str_not_implemented), uf->uf_name); + return FALSE; + } + } + } + + return TRUE; +} + +/* + * Returns TRUE if the interface variable "if_var" is present in the list of + * variables in "cl_mt" or in the parent lineage of one of the extended classes + * in "extends_cl". For a class variable, 'is_class_var' is TRUE. + */ + static int +intf_variable_present( + char_u *intf_class_name, + ocmember_T *if_var, + ocmember_T *cl_mt, + int cl_member_count, + class_T *extends_cl) +{ + int variable_present = FALSE; + + for (int cl_i = 0; cl_i < cl_member_count; ++cl_i) + { + ocmember_T *m = &cl_mt[cl_i]; + where_T where = WHERE_INIT; + + if (STRCMP(if_var->ocm_name.string, m->ocm_name.string) != 0) + continue; + + // Ensure the access type is same + if (if_var->ocm_access != m->ocm_access) + { + semsg(_(e_variable_str_of_interface_str_has_different_access), + if_var->ocm_name.string, intf_class_name); + return FALSE; + } + + // Ensure the type is matching. + if (m->ocm_type == &t_any) + { + // variable type is not specified. Use the variable type in the + // interface. + m->ocm_type = if_var->ocm_type; + } + else + { + where.wt_func_name = (char *)m->ocm_name.string; + where.wt_kind = WT_MEMBER; + if (check_type(if_var->ocm_type, m->ocm_type, TRUE, + where) == FAIL) + return FALSE; + } + + variable_present = TRUE; + break; + } + + if (!variable_present && extends_cl != NULL) + { + int ext_cl_count = extends_cl->class_obj_member_count; + ocmember_T *ext_cl_mt = extends_cl->class_obj_members; + return intf_variable_present(intf_class_name, if_var, + ext_cl_mt, ext_cl_count, + extends_cl->class_extends); + } + + return variable_present; +} + +/* + * Check the variables of the interface class "ifcl" match object variables + * ("objmembers_gap") of a class. + * Returns TRUE if the object variables names are valid. + */ + static int +validate_interface_variables( + char_u *intf_class_name, + class_T *ifcl, + garray_T *objmembers_gap, + class_T *extends_cl) +{ + int if_count = ifcl->class_obj_member_count; + if (if_count == 0) + return TRUE; + + ocmember_T *if_ms = ifcl->class_obj_members; + ocmember_T *cl_ms = (ocmember_T *)(objmembers_gap->ga_data); + int cl_count = objmembers_gap->ga_len; + for (int if_i = 0; if_i < if_count; ++if_i) + { + if (!intf_variable_present(intf_class_name, &if_ms[if_i], cl_ms, + cl_count, extends_cl)) + { + semsg(_(e_variable_str_of_interface_str_not_implemented), + if_ms[if_i].ocm_name.string, intf_class_name); + return FALSE; + } + } + + return TRUE; +} + +/* + * Returns TRUE if the method signature of "if_method" and "cl_method" matches. + */ + static int +intf_method_type_matches(ufunc_T *if_method, ufunc_T *cl_method) +{ + where_T where = WHERE_INIT; + + // Ensure the type is matching. + where.wt_func_name = (char *)if_method->uf_name; + where.wt_kind = WT_METHOD; + if (check_type(if_method->uf_func_type, cl_method->uf_func_type, TRUE, + where) == FAIL) + return FALSE; + + return TRUE; +} + +/* + * Returns TRUE if the interface method "if_ufunc" is present in the list of + * methods in "cl_fp" or in the parent lineage of one of the extended classes + * in "extends_cl". For a class method, 'is_class_method' is TRUE. + */ + static int +intf_method_present( + ufunc_T *if_ufunc, + ufunc_T **cl_fp, + int cl_count, + class_T *extends_cl) +{ + int method_present = FALSE; + + for (int cl_i = 0; cl_i < cl_count; ++cl_i) + { + if (STRCMP(if_ufunc->uf_name, cl_fp[cl_i]->uf_name) == 0) + { + // Ensure the type is matching. + if (!intf_method_type_matches(if_ufunc, cl_fp[cl_i])) + return FALSE; + method_present = TRUE; + break; + } + } + + if (!method_present && extends_cl != NULL) + { + ufunc_T **ext_cl_fp = (ufunc_T **)(extends_cl->class_obj_methods); + int ext_cl_count = extends_cl->class_obj_method_count; + return intf_method_present(if_ufunc, ext_cl_fp, ext_cl_count, + extends_cl->class_extends); + } + + return method_present; +} + +/* + * Validate that a new class implements all the class/instance methods in the + * interface "ifcl". The new class methods are in "classfunctions_gap" and the + * new object methods are in "objmemthods_gap". Also validates the method + * types. + * Returns TRUE if all the interface class/object methods are implemented in + * the new class. + */ + static int +validate_interface_methods( + char_u *intf_class_name, + class_T *ifcl, + garray_T *objmethods_gap, + class_T *extends_cl) +{ + int if_count = ifcl->class_obj_method_count; + if (if_count == 0) + return TRUE; + + ufunc_T **if_fp = ifcl->class_obj_methods; + ufunc_T **cl_fp = (ufunc_T **)(objmethods_gap->ga_data); + int cl_count = objmethods_gap->ga_len; + for (int if_i = 0; if_i < if_count; ++if_i) + { + char_u *if_name = if_fp[if_i]->uf_name; + + if (!intf_method_present(if_fp[if_i], cl_fp, cl_count, extends_cl)) + { + semsg(_(e_method_str_of_interface_str_not_implemented), + if_name, intf_class_name); + return FALSE; + } + } + + return TRUE; +} + +/* + * Validate all the "implements" classes when creating a new class. The + * classes are returned in "intf_classes". The class functions, class members, + * object methods and object members in the new class are in + * "classfunctions_gap", "classmembers_gap", "objmethods_gap", and + * "objmembers_gap" respectively. + */ + static int +validate_implements_classes( + garray_T *impl_gap, + garray_T *intf_classes_gap, + garray_T *objmethods_gap, + garray_T *objmembers_gap, + class_T *extends_cl) +{ + int success = TRUE; + + for (int i = 0; i < impl_gap->ga_len && success; ++i) + { + char_u *impl = ((char_u **)impl_gap->ga_data)[i]; + typval_T tv; + tv.v_type = VAR_UNKNOWN; + if (eval_variable_import(impl, &tv) == FAIL) + { + semsg(_(e_interface_name_not_found_str), impl); + success = FALSE; + break; + } + + if (tv.v_type != VAR_CLASS + || tv.vval.v_class == NULL + || !IS_INTERFACE(tv.vval.v_class)) + { + semsg(_(e_not_valid_interface_str), impl); + success = FALSE; + clear_tv(&tv); + break; + } + + class_T *ifcl = tv.vval.v_class; + if (ga_grow(intf_classes_gap, 1) == FAIL) + { + success = FALSE; + clear_tv(&tv); + break; + } + ((class_T **)intf_classes_gap->ga_data)[intf_classes_gap->ga_len] + = ifcl; + intf_classes_gap->ga_len++; + ++ifcl->class_refcount; + + // check the variables of the interface match the members of the class + success = validate_interface_variables(impl, ifcl, objmembers_gap, + extends_cl); + + // check the functions/methods of the interface match the + // functions/methods of the class + if (success) + success = validate_interface_methods(impl, ifcl, objmethods_gap, + extends_cl); + clear_tv(&tv); + } + + return success; +} + +/* + * Returns TRUE if the interface class "ifcl" is already present in the + * "intf_classes_gap" grow array. + */ + static int +is_interface_class_present(garray_T *intf_classes_gap, class_T *ifcl) +{ + for (int j = 0; j < intf_classes_gap->ga_len; j++) + { + if (((class_T **)intf_classes_gap)[j] == ifcl) + return TRUE; + } + + return FALSE; +} + +/* + * Add interface "ifcl" from a super class to "intf_classes_gap" and the class + * name to "impl_gap". + */ + static int +add_interface_from_super_class( + class_T *ifcl, + garray_T *impl_gap, + garray_T *intf_classes_gap) +{ + char_u *intf_name; + + // Add the interface name to "impl_gap" + intf_name = mnv_strnsave(ifcl->class_name.string, ifcl->class_name.length); + if (intf_name == NULL) + return FALSE; + + if (ga_grow(impl_gap, 1) == FAIL) + goto fail; + + char_u **intf_names = (char_u **)impl_gap->ga_data; + intf_names[impl_gap->ga_len] = intf_name; + impl_gap->ga_len++; + + // Add the interface class to "intf_classes_gap" + if (ga_grow(intf_classes_gap, 1) == FAIL) + { + --impl_gap->ga_len; + goto fail; + } + + class_T **intf_classes = (class_T **)intf_classes_gap->ga_data; + intf_classes[intf_classes_gap->ga_len] = ifcl; + intf_classes_gap->ga_len++; + ++ifcl->class_refcount; + + return TRUE; +fail: + mnv_free(intf_name); + return FALSE; +} + +/* + * Add "super" class interfaces to "intf_classes_gap" (if not present already) + * Add the interface class names to "impl_gap". + */ + static int +add_super_class_interfaces( + class_T *super, + garray_T *impl_gap, + garray_T *intf_classes_gap) +{ + // Iterate through all the interfaces implemented by "super" + for (int i = 0; i < super->class_interface_count; i++) + { + class_T *ifcl = super->class_interfaces_cl[i]; + + if (!is_interface_class_present(intf_classes_gap, ifcl)) + add_interface_from_super_class(ifcl, impl_gap, intf_classes_gap); + } + + return TRUE; +} + +/* + * Check no function argument name is used as a class member. + * (Object members are always accessed with "this." prefix, so no need + * to check them.) + */ + static int +check_func_arg_names( + garray_T *classfunctions_gap, + garray_T *objmethods_gap, + garray_T *classmembers_gap) +{ + // loop 1: class functions, loop 2: object methods + for (int loop = 1; loop <= 2; ++loop) + { + garray_T *gap = loop == 1 ? classfunctions_gap : objmethods_gap; + + for (int fi = 0; fi < gap->ga_len; ++fi) + { + ufunc_T *uf = ((ufunc_T **)gap->ga_data)[fi]; + + for (int i = 0; i < uf->uf_args.ga_len; ++i) + { + char_u *aname = ((char_u **)uf->uf_args.ga_data)[i]; + garray_T *mgap = classmembers_gap; + + // Check all the class member names + for (int mi = 0; mi < mgap->ga_len; ++mi) + { + char_u *mname = + ((ocmember_T *)mgap->ga_data + mi)->ocm_name.string; + if (STRCMP(aname, mname) == 0) + { + if (uf->uf_script_ctx.sc_sid > 0) + SOURCING_LNUM = uf->uf_script_ctx.sc_lnum; + + semsg(_(e_argument_already_declared_in_class_str), + aname); + + return FALSE; + } + } + } + } + } + + return TRUE; +} + +/* + * Returns TRUE if 'varname' is a reserved keyword name + */ + static int +is_reserved_varname(char_u *varname, char_u *varname_end) +{ + int reserved = FALSE; + char_u save_varname_end = *varname_end; + *varname_end = NUL; + + reserved = check_reserved_name(varname, FALSE) == FAIL; + + *varname_end = save_varname_end; + + return reserved; +} + +/* + * Returns TRUE if the variable "varname" is already defined either as a class + * variable or as an object variable. + */ + static int +is_duplicate_variable( + garray_T *class_members, + garray_T *obj_members, + char_u *varname, + char_u *varname_end) +{ + string_T pstr = {varname, (size_t)(varname_end - varname)}; // Note: the .string field may + // point to a string longer + // than the .length field. + // So we need to use STRNCMP() + // to compare it. + int dup = FALSE; + + // Step over a leading '_'. + if (*pstr.string == '_') + { + pstr.string++; + pstr.length--; + } + + // loop == 1: class variables, loop == 2: object variables + for (int loop = 1; loop <= 2; loop++) + { + garray_T *vgap = (loop == 1) ? class_members : obj_members; + for (int i = 0; i < vgap->ga_len; ++i) + { + ocmember_T *m = ((ocmember_T *)vgap->ga_data) + i; + string_T qstr = {m->ocm_name.string, m->ocm_name.length}; + + // Step over a leading '_'. + if (*qstr.string == '_') + { + qstr.string++; + qstr.length--; + } + + if (pstr.length == qstr.length + && STRNCMP(pstr.string, qstr.string, pstr.length) == 0) + { + char_u save_c = *varname_end; + + *varname_end = NUL; + semsg(_(e_duplicate_variable_str), varname); + *varname_end = save_c; + dup = TRUE; + break; + } + } + } + + return dup; +} + +/* + * Returns TRUE if the method "name" is already defined. + */ + static int +is_duplicate_method( + garray_T *classmethods_gap, + garray_T *objmethods_gap, + char_u *name) +{ + char_u *pstr = (*name == '_') ? name + 1 : name; + + // loop 1: class methods, loop 2: object methods + for (int loop = 1; loop <= 2; loop++) + { + garray_T *fgap = (loop == 1) ? classmethods_gap : objmethods_gap; + for (int i = 0; i < fgap->ga_len; ++i) + { + char_u *n = ((ufunc_T **)fgap->ga_data)[i]->uf_name; + char_u *qstr = *n == '_' ? n + 1 : n; + if (STRCMP(pstr, qstr) == 0) + { + semsg(_(e_duplicate_function_str), name); + return TRUE; + } + } + } + + return FALSE; +} + +/* + * Returns TRUE if the constructor is valid. + */ + static int +is_valid_constructor(ufunc_T *uf, int is_abstract, int has_static) +{ + // Constructors are not allowed in abstract classes. + if (is_abstract) + { + emsg(_(e_cannot_define_new_method_in_abstract_class)); + return FALSE; + } + // A constructor is always static, no need to define it so. + if (has_static) + { + emsg(_(e_cannot_define_new_method_as_static)); + return FALSE; + } + // A return type should not be specified for the new() + // constructor method. + if (uf->uf_ret_type->tt_type != VAR_VOID) + { + emsg(_(e_cannot_use_a_return_type_with_new_method)); + return FALSE; + } + return TRUE; +} + +/* + * Returns TRUE if 'uf' is a supported builtin method and has the correct + * method signature. + */ + static int +object_check_builtin_method_sig(ufunc_T *uf) +{ + char_u *name = uf->uf_name; + int valid = FALSE; + type_T method_sig; + type_T method_rt; + where_T where = WHERE_INIT; + + // validate the method signature + CLEAR_FIELD(method_sig); + CLEAR_FIELD(method_rt); + method_sig.tt_type = VAR_FUNC; + + if (STRCMP(name, "len") == 0) + { + // def __len(): number + method_rt.tt_type = VAR_NUMBER; + method_sig.tt_member = &method_rt; + valid = TRUE; + } + else if (STRCMP(name, "empty") == 0) + { + // def __empty(): bool + method_rt.tt_type = VAR_BOOL; + method_sig.tt_member = &method_rt; + valid = TRUE; + } + else if (STRCMP(name, "string") == 0) + { + // def __string(): string + method_rt.tt_type = VAR_STRING; + method_sig.tt_member = &method_rt; + valid = TRUE; + } + else + semsg(_(e_builtin_object_method_str_not_supported), uf->uf_name); + + where.wt_func_name = (char *)uf->uf_name; + where.wt_kind = WT_METHOD; + if (valid && !check_type(&method_sig, uf->uf_func_type, TRUE, where)) + valid = FALSE; + + return valid; +} + +/* + * Returns TRUE if "funcname" is a supported builtin object method name + */ + int +is_valid_builtin_obj_methodname(char_u *funcname) +{ + switch (funcname[0]) + { + case 'e': + return STRNCMP(funcname, "empty", 5) == 0; + + case 'l': + return STRNCMP(funcname, "len", 3) == 0; + + case 'n': + return STRNCMP(funcname, "new", 3) == 0; + + case 's': + return STRNCMP(funcname, "string", 6) == 0; + } + + return FALSE; +} + + +/* + * Returns the builtin method "name" in object "obj". Returns NULL if the + * method is not found. + */ + ufunc_T * +class_get_builtin_method( + class_T *cl, + class_builtin_T builtin_method, + int *method_idx) +{ + *method_idx = -1; + + if (cl == NULL) + return NULL; + + *method_idx = cl->class_builtin_methods[builtin_method]; + return *method_idx != -1 ? cl->class_obj_methods[*method_idx] : NULL; +} + +/* + * Update the interface class lookup table for the member index on the + * interface to the member index in the class implementing the interface. + * And a lookup table for the object method index on the interface + * to the object method index in the class implementing the interface. + * This is also used for updating the lookup table for the extended class + * hierarchy. + */ + static int +update_member_method_lookup_table( + class_T *ifcl, + class_T *cl, + garray_T *objmethods, + int pobj_method_offset) +{ + if (ifcl == NULL) + return OK; + + // Table for members. + itf2class_T *if2cl = alloc_clear(sizeof(itf2class_T) + + ifcl->class_obj_member_count * sizeof(int)); + if (if2cl == NULL) + return FAIL; + if2cl->i2c_next = ifcl->class_itf2class; + ifcl->class_itf2class = if2cl; + if2cl->i2c_class = cl; + if2cl->i2c_is_method = FALSE; + + for (int if_i = 0; if_i < ifcl->class_obj_member_count; ++if_i) + { + char_u *ocm_name = ifcl->class_obj_members[if_i].ocm_name.string; + + for (int cl_i = 0; cl_i < cl->class_obj_member_count; ++cl_i) + { + if (STRCMP(ocm_name, cl->class_obj_members[cl_i].ocm_name.string) == 0) + { + int *table = (int *)(if2cl + 1); + table[if_i] = cl_i; + break; + } + } + } + + // Table for methods. + if2cl = alloc_clear(sizeof(itf2class_T) + + ifcl->class_obj_method_count * sizeof(int)); + if (if2cl == NULL) + return FAIL; + if2cl->i2c_next = ifcl->class_itf2class; + ifcl->class_itf2class = if2cl; + if2cl->i2c_class = cl; + if2cl->i2c_is_method = TRUE; + + for (int if_i = 0; if_i < ifcl->class_obj_method_count; ++if_i) + { + int done = FALSE; + char_u *if_name = ifcl->class_obj_methods[if_i]->uf_name; + + for (int cl_i = 0; cl_i < objmethods->ga_len; ++cl_i) + { + if (STRCMP(if_name, + ((ufunc_T **)objmethods->ga_data)[cl_i]->uf_name) == 0) + { + int *table = (int *)(if2cl + 1); + table[if_i] = cl_i; + done = TRUE; + break; + } + } + + // extended class object method is not overridden by the child class. + // Keep the method declared in one of the parent classes in the + // lineage. + if (!done) + { + // If "ifcl" is not the immediate parent of "cl", then search in + // the intermediate parent classes. + if (cl->class_extends != ifcl) + { + class_T *parent = cl->class_extends; + int method_offset = objmethods->ga_len; + + while (!done && parent != NULL && parent != ifcl) + { + for (int cl_i = 0; + cl_i < parent->class_obj_method_count_child; ++cl_i) + { + if (STRCMP(if_name, + parent->class_obj_methods[cl_i]->uf_name) + == 0) + { + int *table = (int *)(if2cl + 1); + table[if_i] = method_offset + cl_i; + done = TRUE; + break; + } + } + method_offset += parent->class_obj_method_count_child; + parent = parent->class_extends; + } + } + + if (!done) + { + int *table = (int *)(if2cl + 1); + table[if_i] = pobj_method_offset + if_i; + } + } + } + + return OK; +} + +/* + * Update the member and object method lookup tables for a new class in the + * interface class. + * For each interface add a lookup table for the member index on the interface + * to the member index in the new class. And a lookup table for the object + * method index on the interface to the object method index in the new class. + */ + static int +add_lookup_tables(class_T *cl, class_T *extends_cl, garray_T *objmethods_gap) +{ + // update the lookup table for all the implemented interfaces + for (int i = 0; i < cl->class_interface_count; ++i) + { + class_T *ifcl = cl->class_interfaces_cl[i]; + + // update the lookup table for this interface and all its super + // interfaces. + while (ifcl != NULL) + { + if (update_member_method_lookup_table(ifcl, cl, objmethods_gap, + 0) == FAIL) + return FAIL; + ifcl = ifcl->class_extends; + } + } + + // Update the lookup table for the extended class, if any + if (extends_cl != NULL) + { + class_T *pclass = extends_cl; + int pobj_method_offset = objmethods_gap->ga_len; + + // Update the entire lineage of extended classes. + while (pclass != NULL) + { + if (update_member_method_lookup_table(pclass, cl, + objmethods_gap, pobj_method_offset) == FAIL) + return FAIL; + + pobj_method_offset += pclass->class_obj_method_count_child; + pclass = pclass->class_extends; + } + } + + return OK; +} + +/* + * Add class members to a new class. Allocate a typval for each class member + * and initialize it. + */ + static int +add_class_members(class_T *cl, exarg_T *eap, garray_T *type_list_gap) +{ + // Allocate a typval for each class member and initialize it. + cl->class_members_tv = ALLOC_CLEAR_MULT(typval_T, + cl->class_class_member_count); + if (cl->class_members_tv == NULL) + return FAIL; + + for (int i = 0; i < cl->class_class_member_count; ++i) + { + ocmember_T *m = &cl->class_class_members[i]; + typval_T *tv = &cl->class_members_tv[i]; + if (m->ocm_init != NULL) + { + sctx_T save_current_sctx = current_sctx; + + current_sctx = m->ocm_init_sctx; + typval_T *etv = eval_expr(m->ocm_init, eap); + current_sctx = save_current_sctx; + if (etv == NULL) + return FAIL; + + if (m->ocm_type->tt_type == VAR_ANY + && !(m->ocm_flags & OCMFLAG_HAS_TYPE) + && etv->v_type != VAR_SPECIAL) + // If the member variable type is not yet set, then use + // the initialization expression type. + m->ocm_type = typval2type(etv, get_copyID(), + type_list_gap, + TVTT_DO_MEMBER|TVTT_MORE_SPECIFIC); + *tv = *etv; + mnv_free(etv); + } + else + { + // TODO: proper default value + tv->v_type = m->ocm_type->tt_type; + tv->vval.v_string = NULL; + } + set_tv_type(tv, m->ocm_type); + if (m->ocm_flags & OCMFLAG_CONST) + item_lock(tv, DICT_MAXNEST, TRUE, TRUE); + } + + return OK; +} + +/* + * Add a default constructor method (new()) to the class "cl". + */ + static void +add_default_constructor( + class_T *cl, + garray_T *classfunctions_gap, + garray_T *type_list_gap) +{ + garray_T fga; + int is_enum = IS_ENUM(cl); + + ga_init2(&fga, 1, 1000); + GA_CONCAT_LITERAL(&fga, "new("); + for (int i = 0; i < cl->class_obj_member_count; ++i) + { + if (i < 2 && is_enum) + // The first two object variables in an enum are the enum value + // name and ordinal. Don't initialize these object variables in + // the default constructor as they are already initialized right + // after creating the object. + continue; + + if (i > (is_enum ? 2 : 0)) + GA_CONCAT_LITERAL(&fga, ", "); + GA_CONCAT_LITERAL(&fga, "this."); + ocmember_T *m = cl->class_obj_members + i; + ga_concat_len(&fga, (char_u *)m->ocm_name.string, m->ocm_name.length); + GA_CONCAT_LITERAL(&fga, " = v:none"); + } + GA_CONCAT_LITERAL(&fga, ")\nenddef\n"); + ga_append(&fga, NUL); + + exarg_T fea; + CLEAR_FIELD(fea); + fea.cmdidx = CMD_def; + fea.cmd = fea.arg = fga.ga_data; + + garray_T lines_to_free; + ga_init2(&lines_to_free, sizeof(char_u *), 50); + + ufunc_T *nf = define_function(&fea, NULL, &lines_to_free, CF_CLASS, + cl->class_obj_members, cl->class_obj_member_count, + NULL); + + ga_clear_strings(&lines_to_free); + mnv_free(fga.ga_data); + + if (nf != NULL && ga_grow(classfunctions_gap, 1) == OK) + { + ((ufunc_T **)classfunctions_gap->ga_data)[classfunctions_gap->ga_len] + = nf; + ++classfunctions_gap->ga_len; + + nf->uf_flags |= FC_NEW; + nf->uf_ret_type = get_type_ptr(type_list_gap); + if (nf->uf_ret_type != NULL) + { + nf->uf_ret_type->tt_type = VAR_OBJECT; + nf->uf_ret_type->tt_class = cl; + nf->uf_ret_type->tt_argcount = 0; + nf->uf_ret_type->tt_args = NULL; + } + } +} + +/* + * Add the class methods and object methods to the new class "cl". + * When extending a class "extends_cl", add the instance methods from the + * parent class also. + * Returns OK on success and FAIL on memory allocation failure. + */ + static int +add_classfuncs_objmethods( + class_T *cl, + class_T *extends_cl, + garray_T *classfunctions_gap, + garray_T *objmethods_gap) +{ + // loop 1: class functions, loop 2: object methods + for (int loop = 1; loop <= 2; ++loop) + { + garray_T *gap = loop == 1 ? classfunctions_gap : objmethods_gap; + int *fcount = loop == 1 ? &cl->class_class_function_count + : &cl->class_obj_method_count; + ufunc_T ***fup = loop == 1 ? &cl->class_class_functions + : &cl->class_obj_methods; + + int parent_count = 0; + if (extends_cl != NULL) + // Include object methods from the parent. + // Don't include the parent class methods. + parent_count = loop == 1 + ? 0 + : extends_cl->class_obj_method_count; + + *fcount = parent_count + gap->ga_len; + if (*fcount == 0) + { + *fup = NULL; + continue; + } + *fup = ALLOC_MULT(ufunc_T *, *fcount); + if (*fup == NULL) + return FAIL; + + if (gap->ga_len != 0) + mch_memmove(*fup, gap->ga_data, sizeof(ufunc_T *) * gap->ga_len); + MNV_CLEAR(gap->ga_data); + if (loop == 1) + cl->class_class_function_count_child = gap->ga_len; + else + cl->class_obj_method_count_child = gap->ga_len; + + if (loop == 2) + { + // Copy instance methods from the parent. + + for (int i = 0; i < parent_count; ++i) + { + // Can't use the same parent function, because "uf_class" is + // different and compilation will have a different result. + // Put them after the functions in the current class, object + // methods may be overruled, then "super.Method()" is used to + // find a method from the parent. + ufunc_T *pf = (extends_cl->class_obj_methods)[i]; + (*fup)[gap->ga_len + i] = copy_function(pf, 0); + + // If the child class overrides a function from the parent + // the signature must be equal. + char_u *pname = pf->uf_name; + for (int ci = 0; ci < gap->ga_len; ++ci) + { + ufunc_T *cf = (*fup)[ci]; + char_u *cname = cf->uf_name; + if (STRCMP(pname, cname) == 0) + { + where_T where = WHERE_INIT; + where.wt_func_name = (char *)pname; + where.wt_kind = WT_METHOD; + (void)check_type(pf->uf_func_type, cf->uf_func_type, + TRUE, where); + } + } + } + } + + // Set the class pointer on all the functions and object methods. + for (int i = 0; i < *fcount; ++i) + { + ufunc_T *fp = (*fup)[i]; + fp->uf_class = cl; + if (i < gap->ga_len) + fp->uf_defclass = cl; + if (loop == 2) + fp->uf_flags |= FC_OBJECT; + } + + ga_clear(gap); + } + + return OK; +} + +/* + * Update the index of object methods called by builtin functions. + */ + static void +update_builtin_method_index(class_T *cl) +{ + int i; + + for (i = 0; i < CLASS_BUILTIN_MAX; i++) + cl->class_builtin_methods[i] = -1; + + for (i = 0; i < cl->class_obj_method_count; i++) + { + ufunc_T *uf = cl->class_obj_methods[i]; + + if (cl->class_builtin_methods[CLASS_BUILTIN_STRING] == -1 + && STRCMP(uf->uf_name, "string") == 0) + cl->class_builtin_methods[CLASS_BUILTIN_STRING] = i; + else if (cl->class_builtin_methods[CLASS_BUILTIN_EMPTY] == -1 && + STRCMP(uf->uf_name, "empty") == 0) + cl->class_builtin_methods[CLASS_BUILTIN_EMPTY] = i; + else if (cl->class_builtin_methods[CLASS_BUILTIN_LEN] == -1 && + STRCMP(uf->uf_name, "len") == 0) + cl->class_builtin_methods[CLASS_BUILTIN_LEN] = i; + } +} + +/* + * Return the end of the class name starting at "arg". Valid characters in a + * class name are alphanumeric characters and "_". Also handles imported class + * names. + */ + static char_u * +find_class_name_end(char_u *arg) +{ + char_u *end = arg; + + while (ASCII_ISALNUM(*end) || *end == '_' + || (*end == '.' && (ASCII_ISALNUM(end[1]) || end[1] == '_'))) + ++end; + + return end; +} + +/* + * Returns TRUE if the enum value "varname" is already defined. + */ + static int +is_duplicate_enum( + garray_T *enum_gap, + char_u *varname, + char_u *varname_end) +{ + string_T name = {varname, (size_t)(varname_end - varname)}; // Note: the .string field may + // point to a string longer + // than the .length field. + // So we need to use STRNCMP() + // to compare it. + int dup = FALSE; + + for (int i = 0; i < enum_gap->ga_len; ++i) + { + ocmember_T *m = ((ocmember_T *)enum_gap->ga_data) + i; + + if (name.length == m->ocm_name.length + && STRNCMP(name.string, m->ocm_name.string, name.length) == 0) + { + char_u save_c = *varname_end; + + *varname_end = NUL; + semsg(_(e_duplicate_enum_str), varname); + *varname_end = save_c; + dup = TRUE; + break; + } + } + + return dup; +} + +/* + * Parse the enum values in "line" separated by comma and add them to "gap". + * If the last enum value is found, then "enum_end" is set to TRUE. + */ + static int +enum_parse_values( + exarg_T *eap, + class_T *en, + char_u *line, + garray_T *gap, + int *num_enum_values, + int *enum_end) +{ + evalarg_T evalarg; + char_u *p = line; + char initexpr_buf[1024]; + size_t initexpr_buflen; + char_u last_char = NUL; + int rc = OK; + + fill_evalarg_from_eap(&evalarg, eap, FALSE); + + int did_emsg_before = did_emsg; + while (*p != NUL) + { + // ignore comment + if (*p == '#') + break; + + if (!eval_isnamec1(*p)) + { + semsg(_(e_invalid_enum_value_declaration_str), p); + break; + } + + char_u *eni_name_start = p; + char_u *eni_name_end = to_name_end(p, FALSE); + + if (is_duplicate_enum(gap, eni_name_start, eni_name_end)) + break; + + p = skipwhite(eni_name_end); + + char_u *init_expr = NULL; + if (*p == '(' || *p == '<') + { + if (MNV_ISWHITE(p[-1])) + { + semsg(_(e_no_white_space_allowed_before_str_str), "(", line); + break; + } + + char_u *expr_start, *expr_end; + + p = eni_name_start; + (void)skip_expr_concatenate(&p, &expr_start, &expr_end, &evalarg); + + while (*expr_start && *expr_start != '(' && *expr_start != '<') + expr_start++; + + if (expr_end > expr_start) + init_expr = mnv_strnsave(expr_start, expr_end - expr_start); + } + + if (init_expr == NULL) + initexpr_buflen = mnv_snprintf_safelen( + initexpr_buf, sizeof(initexpr_buf), "%s.new()", en->class_name.string); + else + { + initexpr_buflen = mnv_snprintf_safelen( + initexpr_buf, sizeof(initexpr_buf), "%s.new%s", en->class_name.string, + init_expr); + mnv_free(init_expr); + } + if (add_member(gap, eni_name_start, eni_name_end, FALSE, + TRUE, TRUE, TRUE, &en->class_object_type, + mnv_strnsave((char_u *)initexpr_buf, initexpr_buflen)) == FAIL) + break; + + ++*num_enum_values; + + if (*p != '#') + last_char = *p; + + if (*p != NUL && *p != ',') + break; + + if (*p == ',') + { + if (!IS_WHITE_OR_NUL(p[1])) + { + semsg(_(e_white_space_required_after_str_str), ",", line); + break; + } + if (MNV_ISWHITE(p[-1])) + { + semsg(_(e_no_white_space_allowed_before_str_str), ",", line); + break; + } + p = skipwhite(p + 1); + } + } + + p = skipwhite(p); + + if (*p != NUL && *p != '#') + { + if (did_emsg == did_emsg_before) + semsg(_(e_missing_comma_before_argument_str), p); + rc = FAIL; + } + + if (last_char != ',') + // last enum value should not be terminated by "," + *enum_end = TRUE; + + // Free the memory pointed by expr_start. + clear_evalarg(&evalarg, NULL); + + return rc; +} + +/* + * Add the "values" class variable (List of enum value objects) to the enum + * class "en" + */ + static int +enum_add_values_member( + class_T *en, + garray_T *gap, + int num_enum_values, + garray_T *type_list_gap) +{ + garray_T fga; + int rc = FAIL; + + ga_init2(&fga, 1, 1000); + GA_CONCAT_LITERAL(&fga, "["); + for (int i = 0; i < num_enum_values; ++i) + { + ocmember_T *m = ((ocmember_T *)gap->ga_data) + i; + + if (i > 0) + GA_CONCAT_LITERAL(&fga, ", "); + ga_concat_len(&fga, en->class_name.string, en->class_name.length); + GA_CONCAT_LITERAL(&fga, "."); + ga_concat_len(&fga, (char_u *)m->ocm_name.string, m->ocm_name.length); + } + GA_CONCAT_LITERAL(&fga, "]"); + ga_append(&fga, NUL); + + char_u *varname = (char_u *)"values"; + + type_T *type = get_type_ptr(type_list_gap); + if (type == NULL) + goto done; + + type->tt_type = VAR_LIST; + type->tt_member = get_type_ptr(type_list_gap); + if (type->tt_member != NULL) + { + type->tt_member->tt_type = VAR_OBJECT; + type->tt_member->tt_class = en; + } + + rc = add_member(gap, varname, varname + 6, FALSE, FALSE, TRUE, TRUE, type, + mnv_strnsave((char_u *)fga.ga_data, fga.ga_len)); + +done: + mnv_free(fga.ga_data); + + return rc; +} + +/* + * Clear the constructor method names in a enum class, so that an enum class + * cannot be instantiated. + */ + static void +enum_clear_constructors(class_T *en) +{ + for (int i = 0; i < en->class_class_function_count; ++i) + { + ufunc_T *fp = en->class_class_functions[i]; + + if (fp->uf_flags & FC_NEW) + *fp->uf_name = NUL; + } +} + +/* + * Initialize the name and ordinal object variable in the enum value "enval" in + * the enum "en". These values are set during the enum value object creation. + */ + void +enum_set_internal_obj_vars(class_T *en, object_T *enval) +{ + int i; + + for (i = 0; i < en->class_class_member_count; ++i) + { + typval_T *en_tv = en->class_members_tv + i; + if (en_tv != NULL && en_tv->v_type == VAR_UNKNOWN) + break; + } + + if (i >= en->class_class_member_count) + // When adding enum values to an enum, the index value should be less + // than the member count. It will be greater only when appending a + // new item to a list of enums. In this case, skip setting the enum + // name and ordinal (as this is a dummy enum object) + return; + + // First object variable is the name + ocmember_T *value_ocm = en->class_class_members + i; + typval_T *name_tv = (typval_T *)(enval + 1); + name_tv->v_type = VAR_STRING; + name_tv->vval.v_string = + mnv_strnsave(value_ocm->ocm_name.string, value_ocm->ocm_name.length); + + // Second object variable is the ordinal + typval_T *ord_tv = (typval_T *)(name_tv + 1); + ord_tv->v_type = VAR_NUMBER; + ord_tv->vval.v_number = i; +} + +/* + * Handle ":class" and ":abstract class" up to ":endclass". + * Handle ":enum" up to ":endenum". + * Handle ":interface" up to ":endinterface". + */ + void +ex_class(exarg_T *eap) +{ + int is_class = eap->cmdidx == CMD_class; + int is_abstract = eap->cmdidx == CMD_abstract; + int is_enum = eap->cmdidx == CMD_enum; + int added_enum_values = FALSE; + int is_interface; + long start_lnum = SOURCING_LNUM; + char_u *arg = eap->arg; + + if (is_abstract) + { + if (STRNCMP(arg, "class", 5) != 0 || !MNV_ISWHITE(arg[5])) + { + semsg(_(e_invalid_argument_str), arg); + return; + } + arg = skipwhite(arg + 5); + is_class = TRUE; + } + + is_interface = !is_class && !is_enum; + + if (!current_script_is_mnv9() + || (cmdmod.cmod_flags & CMOD_LEGACY) + || !getline_equal(eap->ea_getline, eap->cookie, getsourceline)) + { + if (is_class) + emsg(_(e_class_can_only_be_defined_in_mnv9_script)); + else if (is_enum) + emsg(_(e_enum_can_only_be_defined_in_mnv9_script)); + else + emsg(_(e_interface_can_only_be_defined_in_mnv9_script)); + return; + } + + if (!ASCII_ISUPPER(*arg)) + { + if (is_class) + semsg(_(e_class_name_must_start_with_uppercase_letter_str), arg); + else if (is_enum) + semsg(_(e_enum_name_must_start_with_uppercase_letter_str), arg); + else + semsg(_(e_interface_name_must_start_with_uppercase_letter_str), + arg); + return; + } + char_u *name_end = find_name_end(arg, NULL, NULL, FNE_CHECK_START); + if (!IS_WHITE_OR_NUL(*name_end)) + { + semsg(_(e_white_space_required_after_name_str), arg); + return; + } + char_u *name_start = arg; + + // TODO: + // generics: + + // Name for "extends BaseClass" + char_u *extends = NULL; + + // Names for "implements SomeInterface" + garray_T ga_impl; + ga_init2(&ga_impl, sizeof(char_u *), 5); + + arg = skipwhite(name_end); + while (*arg != NUL && *arg != '#' && *arg != '\n') + { + // TODO: + // specifies SomeInterface + if (STRNCMP(arg, "extends", 7) == 0 && IS_WHITE_OR_NUL(arg[7])) + { + if (is_enum) + { + emsg(_(e_enum_cannot_extend_class)); + goto early_ret; + } + if (extends != NULL) + { + emsg(_(e_duplicate_extends)); + goto early_ret; + } + arg = skipwhite(arg + 7); + + char_u *end = find_class_name_end(arg); + if (!IS_WHITE_OR_NUL(*end)) + { + semsg(_(e_white_space_required_after_name_str), arg); + goto early_ret; + } + extends = mnv_strnsave(arg, end - arg); + if (extends == NULL) + goto early_ret; + + arg = skipwhite(end + 1); + } + else if (STRNCMP(arg, "implements", 10) == 0 + && IS_WHITE_OR_NUL(arg[10])) + { + if (is_interface) + { + emsg(_(e_interface_cannot_use_implements)); + goto early_ret; + } + + if (ga_impl.ga_len > 0) + { + emsg(_(e_duplicate_implements)); + goto early_ret; + } + arg = skipwhite(arg + 10); + + for (;;) + { + char_u *impl_end = find_class_name_end(arg); + if ((!IS_WHITE_OR_NUL(*impl_end) && *impl_end != ',') + || (*impl_end == ',' + && !IS_WHITE_OR_NUL(*(impl_end + 1)))) + { + semsg(_(e_white_space_required_after_name_str), arg); + goto early_ret; + } + if (impl_end - arg == 0) + { + emsg(_(e_missing_name_after_implements)); + goto early_ret; + } + + char_u *iname = mnv_strnsave(arg, impl_end - arg); + if (iname == NULL) + goto early_ret; + for (int i = 0; i < ga_impl.ga_len; ++i) + if (STRCMP(((char_u **)ga_impl.ga_data)[i], iname) == 0) + { + semsg(_(e_duplicate_interface_after_implements_str), + iname); + mnv_free(iname); + goto early_ret; + } + if (ga_add_string(&ga_impl, iname) == FAIL) + { + mnv_free(iname); + goto early_ret; + } + if (*impl_end != ',') + { + arg = skipwhite(impl_end); + break; + } + arg = skipwhite(impl_end + 1); + } + } + else + { + semsg(_(e_trailing_characters_str), arg); +early_ret: + mnv_free(extends); + ga_clear_strings(&ga_impl); + return; + } + } + + garray_T type_list; // list of pointers to allocated types + ga_init2(&type_list, sizeof(type_T *), 10); + + // Growarray with class members declared in the class. + garray_T classmembers; + ga_init2(&classmembers, sizeof(ocmember_T), 10); + + // Growarray with functions declared in the class. + garray_T classfunctions; + ga_init2(&classfunctions, sizeof(ufunc_T *), 10); + + // Growarray with object members declared in the class. + garray_T objmembers; + ga_init2(&objmembers, sizeof(ocmember_T), 10); + + // Growarray with object methods declared in the class. + garray_T objmethods; + ga_init2(&objmethods, sizeof(ufunc_T *), 10); + + class_T *cl = NULL; + class_T *extends_cl = NULL; // class from "extends" argument + class_T **intf_classes = NULL; + int num_enum_values = 0; + + cl = ALLOC_CLEAR_ONE(class_T); + if (cl == NULL) + goto cleanup; + + if (is_enum) + cl->class_flags = CLASS_ENUM; + else if (is_interface) + cl->class_flags = CLASS_INTERFACE; + else if (is_abstract) + cl->class_flags = CLASS_ABSTRACT; + + cl->class_refcount = 1; + cl->class_name.length = (size_t)(name_end - name_start); + cl->class_name.string = mnv_strnsave(name_start, cl->class_name.length); + if (cl->class_name.string == NULL) + goto cleanup; + + cl->class_type.tt_type = VAR_CLASS; + cl->class_type.tt_class = cl; + cl->class_object_type.tt_type = VAR_OBJECT; + cl->class_object_type.tt_class = cl; + + eap->ea_class = cl; + + // Add the class to the script-local variables. + // TODO: handle other context, e.g. in a function + // TODO: does uf_hash need to be cleared? + typval_T tv; + tv.v_type = VAR_CLASS; + tv.vval.v_class = cl; + SOURCING_LNUM = start_lnum; + int rc = set_var_const(cl->class_name.string, 0, NULL, &tv, FALSE, 0, 0); + if (rc == FAIL) + goto cleanup; + + if (is_enum) + { + // All the enum classes have the name and ordinal object variables. + char_u *varname = (char_u *)"name"; + if (add_member(&objmembers, varname, varname + 4, FALSE, FALSE, TRUE, + TRUE, &t_string, NULL) == FAIL) + goto cleanup; + + varname = (char_u *)"ordinal"; + if (add_member(&objmembers, varname, varname + 7, FALSE, FALSE, TRUE, + TRUE, &t_number, NULL) == FAIL) + goto cleanup; + } + + // "export class" gets used when creating the class, don't use "is_export" + // for the items inside the class. + is_export = FALSE; + + // When parsing an enum definition, this denotes whether all the enumerated + // values are parsed or not. + int enum_end = FALSE; + + /* + * Go over the body of the class/interface until "endclass" or + * "endinterface" or "endenum" is found. + */ + char_u *theline = NULL; + int success = FALSE; + for (;;) + { + mnv_free(theline); + theline = eap->ea_getline(':', eap->cookie, 0, GETLINE_CONCAT_ALL); + if (theline == NULL) + break; + char_u *line = skipwhite(theline); + + // Skip empty and comment lines. + if (*line == NUL) + continue; + if (*line == '#') + { + if (mnv9_bad_comment(line)) + break; + continue; + } + + char_u *p = line; + + char *end_name; + int shortlen; + int fullen; + if (is_class) + { + end_name = "endclass"; + shortlen = 4; + fullen = 8; + } + else if (is_enum) + { + end_name = "endenum"; + shortlen = 4; + fullen = 7; + } + else + { + end_name = "endinterface"; + shortlen = 5; + fullen = 12; + } + + if (checkforcmd(&p, end_name, shortlen)) + { + if (STRNCMP(line, end_name, fullen) != 0) + semsg(_(e_command_cannot_be_shortened_str), line); + else if (*p == '|' || !ends_excmd2(line, p)) + semsg(_(e_trailing_characters_str), p); + else + success = TRUE; + break; + } + + int wrong_endname = FALSE; + if (is_class) + wrong_endname = checkforcmd(&p, "endinterface", 5) + || checkforcmd(&p, "endenum", 4); + else if (is_enum) + wrong_endname = checkforcmd(&p, "endclass", 4) + || checkforcmd(&p, "endinterface", 5); + else + wrong_endname = checkforcmd(&p, "endclass", 4) + || checkforcmd(&p, "endenum", 4); + if (wrong_endname) + { + semsg(_(e_invalid_command_str_expected_str), line, end_name); + break; + } + + if (is_enum && !enum_end) + { + // In an enum, all the enumerated values are at the beginning + // separated by comma. The class and object variables/methods + // follow the values. + if (enum_parse_values(eap, cl, line, &classmembers, + &num_enum_values, &enum_end) == FAIL) + break; + + if (enum_end) + { + // Add the enum "values" class variable. + enum_add_values_member(cl, &classmembers, num_enum_values, + &type_list); + added_enum_values = TRUE; + } + continue; + } + + int has_public = FALSE; + if (checkforcmd(&p, "public", 3)) + { + if (STRNCMP(line, "public", 6) != 0) + { + semsg(_(e_command_cannot_be_shortened_str), line); + break; + } + if (is_interface) + { + emsg(_(e_public_variable_not_supported_in_interface)); + break; + } + has_public = TRUE; + p = skipwhite(line + 6); + + if (STRNCMP(p, "def", 3) == 0) + { + emsg(_(e_public_keyword_not_supported_for_method)); + break; + } + + if (STRNCMP(p, "var", 3) != 0 && STRNCMP(p, "static", 6) != 0 + && STRNCMP(p, "final", 5) != 0 && STRNCMP(p, "const", 5) != 0) + { + emsg(_(e_public_must_be_followed_by_var_static_final_or_const)); + break; + } + } + + int abstract_method = FALSE; + char_u *pa = p; + if (checkforcmd(&p, "abstract", 3)) + { + if (STRNCMP(pa, "abstract", 8) != 0) + { + semsg(_(e_command_cannot_be_shortened_str), pa); + break; + } + + if (is_enum) + { + // "abstract" not supported in an enum + emsg(_(e_abstract_cannot_be_used_in_enum)); + break; + } + + if (is_interface) + { + // "abstract" not supported in an interface + emsg(_(e_abstract_cannot_be_used_in_interface)); + break; + } + + if (!is_abstract) + { + semsg(_(e_abstract_method_in_concrete_class), pa); + break; + } + + p = skipwhite(pa + 8); + if (STRNCMP(p, "def", 3) != 0) + { + emsg(_(e_abstract_must_be_followed_by_def)); + break; + } + + abstract_method = TRUE; + } + + int has_static = FALSE; + char_u *ps = p; + if (checkforcmd(&p, "static", 4)) + { + if (STRNCMP(ps, "static", 6) != 0) + { + semsg(_(e_command_cannot_be_shortened_str), ps); + break; + } + + if (is_interface) + { + emsg(_(e_static_member_not_supported_in_interface)); + break; + } + has_static = TRUE; + p = skipwhite(ps + 6); + + if (STRNCMP(p, "var", 3) != 0 && STRNCMP(p, "def", 3) != 0 + && STRNCMP(p, "final", 5) != 0 && STRNCMP(p, "const", 5) != 0) + { + emsg(_(e_static_must_be_followed_by_var_def_final_or_const)); + break; + } + } + + int has_final = FALSE; + int has_var = FALSE; + int has_const = FALSE; + if (checkforcmd(&p, "var", 3)) + has_var = TRUE; + else if (checkforcmd(&p, "final", 5)) + { + if (is_interface) + { + emsg(_(e_final_variable_not_supported_in_interface)); + break; + } + has_final = TRUE; + } + else if (checkforcmd(&p, "const", 5)) + { + if (is_interface) + { + emsg(_(e_const_variable_not_supported_in_interface)); + break; + } + has_const = TRUE; + } + p = skipwhite(p); + + // object members (public, read access, private): + // "var _varname" + // "var varname" + // "public var varname" + // "final _varname" + // "final varname" + // "public final varname" + // "const _varname" + // "const varname" + // "public const varname" + // class members (public, read access, private): + // "static var _varname" + // "static var varname" + // "public static var varname" + // "static final _varname" + // "static final varname" + // "public static final varname" + // "static const _varname" + // "static const varname" + // "public static const varname" + if (has_var || has_final || has_const) + { + char_u *varname = p; + char_u *varname_end = NULL; + type_T *type = NULL; + char_u *init_expr = NULL; + int has_type = FALSE; + + if (!eval_isnamec1(*p)) + { + if (has_static) + semsg(_(e_invalid_class_variable_declaration_str), line); + else + semsg(_(e_invalid_object_variable_declaration_str), line); + break; + } + + if (is_interface && *varname == '_') + { + // private variables are not supported in an interface + semsg(_(e_protected_variable_not_supported_in_interface), + varname); + break; + } + + if (parse_member(eap, line, varname, has_public, + &varname_end, &has_type, &type_list, &type, + !is_interface ? &init_expr: NULL) == FAIL) + break; + + if (is_reserved_varname(varname, varname_end) + || is_duplicate_variable(&classmembers, &objmembers, + varname, varname_end)) + { + mnv_free(init_expr); + break; + } + if (add_member(has_static ? &classmembers : &objmembers, varname, + varname_end, has_public, has_final, has_const, + has_type, type, init_expr) == FAIL) + { + mnv_free(init_expr); + break; + } + } + + // constructors: + // def new() + // enddef + // def newOther() + // enddef + // object methods and class functions: + // def SomeMethod() + // enddef + // static def ClassFunction() + // enddef + // def someMethod() + // enddef + else if (checkforcmd(&p, "def", 3)) + { + exarg_T ea; + garray_T lines_to_free; + int is_new = STRNCMP(p, "new", 3) == 0 + || STRNCMP(p, "_new", 4) == 0; + + if (has_public) + { + // "public" keyword is not supported when defining an object or + // class method + emsg(_(e_public_keyword_not_supported_for_method)); + break; + } + + if (*p == NUL) + { + // No method name following def + semsg(_(e_not_valid_command_in_class_str), line); + break; + } + + if (is_interface && *p == '_') + { + // private methods are not supported in an interface + semsg(_(e_protected_method_not_supported_in_interface), p); + break; + } + + if (has_static && !is_new && SAFE_islower(*p) && + is_valid_builtin_obj_methodname(p)) + { + semsg(_(e_builtin_class_method_not_supported), p); + break; + } + + CLEAR_FIELD(ea); + ea.cmd = line; + ea.arg = p; + ea.cmdidx = CMD_def; + ea.ea_getline = eap->ea_getline; + ea.cookie = eap->cookie; + + ga_init2(&lines_to_free, sizeof(char_u *), 50); + int class_flags; + if (is_interface) + class_flags = CF_INTERFACE; + else + class_flags = abstract_method ? CF_ABSTRACT_METHOD : CF_CLASS; + ufunc_T *uf = define_function(&ea, NULL, &lines_to_free, + class_flags, objmembers.ga_data, objmembers.ga_len, + NULL); + ga_clear_strings(&lines_to_free); + + if (uf != NULL) + { + if (is_new && !is_valid_constructor(uf, is_abstract, + has_static)) + { + // private variables are not supported in an interface + semsg(_(e_protected_method_not_supported_in_interface), + uf->uf_name); + func_clear_free(uf, FALSE); + break; + } + + // check for builtin method + if (!is_new && SAFE_islower(*uf->uf_name) && + !object_check_builtin_method_sig(uf)) + { + func_clear_free(uf, FALSE); + break; + } + + // Check the uf_name isn't used already. + if (is_duplicate_method(&classfunctions, &objmethods, uf->uf_name)) + { + success = FALSE; + func_clear_free(uf, FALSE); + break; + } + + garray_T *fgap = has_static || is_new + ? &classfunctions : &objmethods; + if (ga_grow(fgap, 1) == OK) + { + if (is_new) + uf->uf_flags |= FC_NEW; + + if (abstract_method) + uf->uf_flags |= FC_ABSTRACT; + + ((ufunc_T **)fgap->ga_data)[fgap->ga_len] = uf; + ++fgap->ga_len; + } + } + } + + else + { + if (is_class) + semsg(_(e_not_valid_command_in_class_str), line); + else if (is_enum) + semsg(_(e_not_valid_command_in_enum_str), line); + else + semsg(_(e_not_valid_command_in_interface_str), line); + break; + } + } + + if (theline == NULL && !success && is_enum) + emsg(_(e_missing_endenum)); + + mnv_free(theline); + + if (success && is_enum && (num_enum_values == 0 || !added_enum_values)) + // Empty enum statement. Add an empty "values" class variable + success = enum_add_values_member(cl, &classmembers, num_enum_values, + &type_list); + + /* + * Check a few things + */ + + // Check the "extends" class is valid. + if (success && extends != NULL) + success = validate_extends_class(cl, extends, &extends_cl, is_class); + MNV_CLEAR(extends); + + // Check the new object methods to make sure their access (public or + // private) is the same as that in the extended class lineage. + if (success && extends_cl != NULL) + success = validate_extends_methods(&objmethods, extends_cl); + + // Check the new class and object variables are not duplicates of the + // variables in the extended class lineage. If an interface is extending + // another interface, then it can duplicate the member variables. + if (success && extends_cl != NULL) + { + if (is_class) + success = extends_check_dup_members(&objmembers, extends_cl); + else + success = extends_check_intf_var_type(&objmembers, extends_cl); + } + + // When extending an abstract class, make sure all the abstract methods in + // the parent class are implemented. If the current class is an abstract + // class, then there is no need for this check. + if (success && !is_abstract && extends_cl != NULL + && (extends_cl->class_flags & CLASS_ABSTRACT)) + success = validate_abstract_class_methods(&classfunctions, + &objmethods, extends_cl); + + // Process the "implements" entries + // Check all "implements" entries are valid. + garray_T intf_classes_ga; + + ga_init2(&intf_classes_ga, sizeof(class_T *), 5); + + if (success && ga_impl.ga_len > 0) + success = validate_implements_classes(&ga_impl, &intf_classes_ga, + &objmethods, &objmembers, extends_cl); + + // inherit the super class interfaces + if (success && extends_cl != NULL) + success = add_super_class_interfaces(extends_cl, &ga_impl, + &intf_classes_ga); + + intf_classes = intf_classes_ga.ga_data; + intf_classes_ga.ga_len = 0; + + // Check no function argument name is used as a class member. + if (success) + success = check_func_arg_names(&classfunctions, &objmethods, + &classmembers); + + if (success) + { + // "endclass" or "endinterface" or "endenum" encountered without any + // failures + + if (extends_cl != NULL) + { + cl->class_extends = extends_cl; + extends_cl->class_flags |= CLASS_EXTENDED; + } + + // Add class and object variables to "cl". + if (add_members_to_class(&classmembers, + NULL, + 0, + &cl->class_class_members, + &cl->class_class_member_count) == FAIL + || add_members_to_class(&objmembers, + extends_cl == NULL ? NULL + : extends_cl->class_obj_members, + extends_cl == NULL ? 0 + : extends_cl->class_obj_member_count, + &cl->class_obj_members, + &cl->class_obj_member_count) == FAIL) + goto cleanup; + + if (ga_impl.ga_len > 0) + { + // Move the "implements" names into the class. + cl->class_interface_count = ga_impl.ga_len; + cl->class_interfaces = ALLOC_MULT(char_u *, ga_impl.ga_len); + if (cl->class_interfaces == NULL) + goto cleanup; + for (int i = 0; i < ga_impl.ga_len; ++i) + cl->class_interfaces[i] = ((char_u **)ga_impl.ga_data)[i]; + MNV_CLEAR(ga_impl.ga_data); + ga_impl.ga_len = 0; + + cl->class_interfaces_cl = intf_classes; + intf_classes = NULL; + } + + if (cl->class_interface_count > 0 || extends_cl != NULL) + { + // Add a method and member lookup table to each of the interface + // classes. + if (add_lookup_tables(cl, extends_cl, &objmethods) == FAIL) + goto cleanup; + } + + int have_new = FALSE; + ufunc_T *class_func = NULL; + for (int i = 0; i < classfunctions.ga_len; ++i) + { + class_func = ((ufunc_T **)classfunctions.ga_data)[i]; + if (STRCMP(class_func->uf_name, "new") == 0 + || STRCMP(class_func->uf_name, "_new") == 0) + { + have_new = TRUE; + break; + } + } + + if (have_new) + // The return type of new() is an object of class "cl" + class_func->uf_ret_type->tt_class = cl; + else if ((is_class || is_enum) && !is_abstract && !have_new) + // No new() method was defined, add the default constructor. + add_default_constructor(cl, &classfunctions, &type_list); + + // Move all the functions into the created class. + if (add_classfuncs_objmethods(cl, extends_cl, &classfunctions, + &objmethods) == FAIL) + goto cleanup; + + update_builtin_method_index(cl); + + class_created(cl); + + // Allocate a typval for each class member and initialize it. + if ((is_class || is_enum) && cl->class_class_member_count > 0) + if (add_class_members(cl, eap, &type_list) == FAIL) + { + cl->class_type_list = type_list; + return; + } + + cl->class_type_list = type_list; + + if (is_enum) + { + // clear the constructor method names, so that an enum class cannot + // be instantiated + enum_clear_constructors(cl); + } + + // TODO: + // - Fill hashtab with object members and methods ? + + return; + } + +cleanup: + mnv_free(extends); + class_unref(extends_cl); + + if (intf_classes != NULL) + { + for (int i = 0; i < ga_impl.ga_len; ++i) + class_unref(intf_classes[i]); + mnv_free(intf_classes); + } + ga_clear_strings(&ga_impl); + + for (int round = 1; round <= 2; ++round) + { + garray_T *gap = round == 1 ? &classmembers : &objmembers; + if (gap->ga_len == 0 || gap->ga_data == NULL) + continue; + + for (int i = 0; i < gap->ga_len; ++i) + { + ocmember_T *m = ((ocmember_T *)gap->ga_data) + i; + MNV_CLEAR_STRING(m->ocm_name); + mnv_free(m->ocm_init); + } + ga_clear(gap); + } + + for (int i = 0; i < objmethods.ga_len; ++i) + { + ufunc_T *uf = ((ufunc_T **)objmethods.ga_data)[i]; + func_clear_free(uf, FALSE); + } + ga_clear(&objmethods); + + for (int i = 0; i < classfunctions.ga_len; ++i) + { + ufunc_T *uf = ((ufunc_T **)classfunctions.ga_data)[i]; + func_clear_free(uf, FALSE); + } + ga_clear(&classfunctions); + + clear_type_list(&type_list); +} + +/* + * Find member "name" in class "cl", set "member_idx" to the member index and + * return its type. + * When "is_object" is TRUE, then look for object members. Otherwise look for + * class members. + * When not found "member_idx" is set to -1 and t_any is returned. + * Set *p_m ocmmember_T if not NULL + */ + type_T * +oc_member_type( + class_T *cl, + int is_object, + char_u *name, + char_u *name_end, + int *member_idx) +{ + size_t len = name_end - name; + ocmember_T *m; + + *member_idx = -1; // not found (yet) + + m = member_lookup(cl, is_object ? VAR_OBJECT : VAR_CLASS, name, len, + member_idx); + if (m == NULL) + { + member_not_found_msg(cl, is_object ? VAR_OBJECT : VAR_CLASS, name, + len); + return &t_any; + } + + return m->ocm_type; +} + +/* + * Given a class or object variable index, return the variable type + */ + type_T * +oc_member_type_by_idx( + class_T *cl, + int is_object, + int member_idx) +{ + ocmember_T *m; + int member_count; + + if (is_object) + { + m = cl->class_obj_members; + member_count = cl->class_obj_member_count; + } + else + { + m = cl->class_class_members; + member_count = cl->class_class_member_count; + } + + if (member_idx >= member_count) + return NULL; + + return m[member_idx].ocm_type; +} + +/* + * Type aliases (:type) + */ + + static void +typealias_free(typealias_T *ta) +{ + // ta->ta_type is freed in clear_type_list() + mnv_free(ta->ta_name); + mnv_free(ta); +} + + void +typealias_unref(typealias_T *ta) +{ + if (ta != NULL && --ta->ta_refcount <= 0) + typealias_free(ta); +} + +/* + * Handle ":type". Create an alias for a type specification. + */ + void +ex_type(exarg_T *eap) +{ + char_u *arg = eap->arg; + + if (!current_script_is_mnv9() + || (cmdmod.cmod_flags & CMOD_LEGACY) + || !getline_equal(eap->ea_getline, eap->cookie, getsourceline)) + { + emsg(_(e_type_can_only_be_defined_in_mnv9_script)); + return; + } + + if (*arg == NUL) + { + emsg(_(e_missing_typealias_name)); + return; + } + + if (!ASCII_ISUPPER(*arg)) + { + semsg(_(e_type_name_must_start_with_uppercase_letter_str), arg); + return; + } + + char_u *name_end = find_name_end(arg, NULL, NULL, FNE_CHECK_START); + if (!IS_WHITE_OR_NUL(*name_end)) + { + semsg(_(e_white_space_required_after_name_str), arg); + return; + } + char_u *name_start = arg; + + arg = skipwhite(name_end); + if (*arg != '=') + { + semsg(_(e_missing_equal_str), arg); + return; + } + if (!IS_WHITE_OR_NUL(*(arg + 1))) + { + semsg(_(e_white_space_required_after_str_str), "=", arg); + return; + } + arg++; + arg = skipwhite(arg); + + if (*arg == NUL) + { + emsg(_(e_missing_typealias_type)); + return; + } + + scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid); + type_T *type = parse_type(&arg, &si->sn_type_list, NULL, NULL, TRUE); + if (type == NULL) + return; + + if (*arg != NUL) + { + // some text after the type + semsg(_(e_trailing_characters_str), arg); + return; + } + + int cc = *name_end; + *name_end = NUL; + + typval_T tv; + tv.v_type = VAR_UNKNOWN; + if (eval_variable_import(name_start, &tv) == OK) + { + if (tv.v_type == VAR_TYPEALIAS) + semsg(_(e_typealias_already_exists_for_str), name_start); + else + semsg(_(e_redefining_script_item_str), name_start); + clear_tv(&tv); + goto done; + } + + // Create a script-local variable for the type alias. + if (type->tt_type != VAR_OBJECT) + { + tv.v_type = VAR_TYPEALIAS; + tv.v_lock = 0; + tv.vval.v_typealias = ALLOC_CLEAR_ONE(typealias_T); + ++tv.vval.v_typealias->ta_refcount; + tv.vval.v_typealias->ta_name = mnv_strsave(name_start); + tv.vval.v_typealias->ta_type = type; + } + else + { + // When creating a type alias for a class, use the class type itself to + // create the type alias variable. This is needed to use the type + // alias to invoke class methods (e.g. new()) and use class variables. + tv.v_type = VAR_CLASS; + tv.v_lock = 0; + tv.vval.v_class = type->tt_class; + ++tv.vval.v_class->class_refcount; + } + set_var_const(name_start, current_sctx.sc_sid, NULL, &tv, FALSE, + ASSIGN_CONST | ASSIGN_FINAL, 0); + +done: + *name_end = cc; +} + +/* + * Returns OK if a member variable named "name" is present in the class "cl". + * Otherwise returns FAIL. If found, the member variable typval is set in + * "rettv". If "is_object" is TRUE, then the object member variable table is + * searched. Otherwise the class member variable table is searched. + */ + int +get_member_tv( + class_T *cl, + int is_object, + char_u *name, + size_t namelen, + class_T *current_class, + typval_T *rettv) +{ + ocmember_T *m; + int m_idx; + + m = member_lookup(cl, is_object ? VAR_OBJECT : VAR_CLASS, name, namelen, + &m_idx); + if (m == NULL) + return FAIL; + + if (*name == '_' && (current_class == NULL || + !class_instance_of(current_class, cl))) + { + emsg_var_cl_define(e_cannot_access_protected_variable_str, + m->ocm_name.string, 0, cl); + return FAIL; + } + + if (is_object) + { + // The object only contains a pointer to the class, the member values + // array follows right after that. + object_T *obj = rettv->vval.v_object; + typval_T *tv = (typval_T *)(obj + 1) + m_idx; + copy_tv(tv, rettv); + set_tv_type(rettv, m->ocm_type); + object_unref(obj); + } + else + { + copy_tv(&cl->class_members_tv[m_idx], rettv); + set_tv_type(rettv, m->ocm_type); + class_unref(cl); + } + + return OK; +} + +/* + * Call an object or class method "name" in class "cl". The method return + * value is returned in "rettv". + */ + static int +call_oc_method( + class_T *cl, + char_u *name, + size_t len, + char_u *name_end, + evalarg_T *evalarg, + char_u **arg, + gfargs_tab_T *gfatab, // generic types + typval_T *rettv) +{ + ufunc_T *fp; + typval_T argvars[MAX_FUNC_ARGS + 1]; + int argcount = 0; + ocmember_T *ocm = NULL; + int m_idx; + + fp = method_lookup(cl, rettv->v_type, name, len, NULL); + if (fp == NULL) + { + // could be an object or class funcref variable + ocm = member_lookup(cl, rettv->v_type, name, len, &m_idx); + if (ocm == NULL || ocm->ocm_type->tt_type != VAR_FUNC) + { + method_not_found_msg(cl, rettv->v_type, name, len); + return FAIL; + } + + if (*name == '_') + { + // Protected object or class funcref variable + semsg(_(e_cannot_access_protected_variable_str), ocm->ocm_name.string, + cl->class_name.string); + return FAIL; + } + + if (rettv->v_type == VAR_OBJECT) + { + // funcref object variable + object_T *obj = rettv->vval.v_object; + typval_T *tv = (typval_T *)(obj + 1) + m_idx; + copy_tv(tv, rettv); + } + else + // funcref class variable + copy_tv(&cl->class_members_tv[m_idx], rettv); + *arg = name_end; + return OK; + } + + if (ocm == NULL && *fp->uf_name == '_') + { + // Cannot access a protected method outside of a class + semsg(_(e_cannot_access_protected_method_str), fp->uf_name); + return FAIL; + } + + // process generic function call + if (fp != NULL) + { + fp = generic_func_get(fp, gfatab); + if (fp == NULL) + return FAIL; + } + + char_u *argp = name_end; + int ret = get_func_arguments(&argp, evalarg, 0, argvars, &argcount, FALSE); + if (ret == FAIL) + { + while (--argcount >= 0) + clear_tv(&argvars[argcount]); + return FAIL; + } + + funcexe_T funcexe; + CLEAR_FIELD(funcexe); + funcexe.fe_evaluate = TRUE; + if (rettv->v_type == VAR_OBJECT) + { + funcexe.fe_object = rettv->vval.v_object; + ++funcexe.fe_object->obj_refcount; + } + if (evalarg != NULL) + funcexe.fe_cctx = evalarg->eval_cctx; + + // Clear the class or object after calling the function, in + // case the refcount is one. + typval_T tv_tofree = *rettv; + rettv->v_type = VAR_UNKNOWN; + + // Call the user function. Result goes into rettv; + int error = call_user_func_check(fp, argcount, argvars, rettv, &funcexe, + NULL); + + // Clear the previous rettv and the arguments. + clear_tv(&tv_tofree); + for (int idx = 0; idx < argcount; ++idx) + clear_tv(&argvars[idx]); + + if (error != FCERR_NONE) + { + user_func_error(error, printable_func_name(fp), funcexe.fe_found_var); + return FAIL; + } + *arg = argp; + + return OK; +} + +/* + * Create a partial typval for "obj.obj_method" and store it in "rettv". + * Returns OK on success and FAIL on memory allocation failure. + */ + int +obj_method_to_partial_tv(object_T *obj, ufunc_T *obj_method, typval_T *rettv) +{ + partial_T *pt = ALLOC_CLEAR_ONE(partial_T); + if (pt == NULL) + return FAIL; + + pt->pt_refcount = 1; + if (obj != NULL) + { + pt->pt_obj = obj; + ++pt->pt_obj->obj_refcount; + } + pt->pt_auto = TRUE; + pt->pt_func = obj_method; + func_ptr_ref(pt->pt_func); + + rettv->v_type = VAR_PARTIAL; + rettv->vval.v_partial = pt; + + return OK; +} + +/* + * Evaluate what comes after a class: + * - class member: SomeClass.varname + * - class function: SomeClass.SomeMethod() + * - class constructor: SomeClass.new() + * - object member: someObject.varname + * - object method: someObject.SomeMethod() + * + * "*arg" points to the '.'. + * "*arg" is advanced to after the member name or method call. + * + * Returns FAIL or OK. + */ + int +class_object_index( + char_u **arg, + typval_T *rettv, + evalarg_T *evalarg, + int verbose UNUSED) // give error messages +{ + int ret = FAIL; + + if (MNV_ISWHITE((*arg)[1])) + { + semsg(_(e_no_white_space_allowed_after_str_str), ".", *arg); + return FAIL; + } + + ++*arg; + char_u *name = *arg; + char_u *name_end = find_name_end(name, NULL, NULL, FNE_CHECK_START); + if (name_end == name) + return FAIL; + size_t len = name_end - name; + + int did_emsg_save = did_emsg; + class_T *cl; + if (rettv->v_type == VAR_CLASS) + cl = rettv->vval.v_class; + else // VAR_OBJECT + { + if (rettv->vval.v_object == NULL) + { + emsg(_(e_using_null_object)); + return FAIL; + } + cl = rettv->vval.v_object->obj_class; + } + + if (cl == NULL) + { + emsg(_(e_incomplete_type)); + return FAIL; + } + + gfargs_tab_T gfatab; + + generic_func_args_table_init(&gfatab); + + if (*name_end == '<') + { + cctx_T *cctx = NULL; + + if (evalarg != NULL) + cctx = evalarg->eval_cctx; + + // calling a generic method + name_end = parse_generic_func_type_args(name, len, name + len, + &gfatab, cctx); + if (name_end == NULL) + goto done; + } + + if (*name_end == '(') + // Invoke the class or object method + ret = call_oc_method(cl, name, len, name_end, evalarg, arg, + &gfatab, rettv); + else if (rettv->v_type == VAR_OBJECT || rettv->v_type == VAR_CLASS) + { + // Search in the object member variable table and the class member + // variable table. + int is_object = rettv->v_type == VAR_OBJECT; + if (get_member_tv(cl, is_object, name, len, NULL, rettv) == OK) + { + *arg = name_end; + ret = OK; + goto done; + } + + // could be a class method or an object method + int fidx; + ufunc_T *fp = method_lookup(cl, rettv->v_type, name, len, &fidx); + if (fp != NULL) + { + // Protected methods are not accessible outside the class + if (fp->uf_defclass != evalarg->eval_class + && *name == '_') + { + semsg(_(e_cannot_access_protected_method_str), fp->uf_name); + goto done; + } + + if (obj_method_to_partial_tv(is_object ? rettv->vval.v_object : + NULL, fp, rettv) == FAIL) + goto done; + + *arg = name_end; + ret = OK; + goto done; + } + + if (did_emsg == did_emsg_save) + member_not_found_msg(cl, rettv->v_type, name, len); + } + +done: + generic_func_args_table_clear(&gfatab); + + return ret; +} + +/* + * If "arg" points to a class or object method, return it. + * Otherwise return NULL. + */ + ufunc_T * +find_class_func(char_u **arg) +{ + char_u *name = *arg; + char_u *name_end = find_name_end(name, NULL, NULL, FNE_CHECK_START); + if (name_end == name || *name_end != '.') + return NULL; + + ufunc_T *fp = NULL; + size_t len = name_end - name; + typval_T tv; + tv.v_type = VAR_UNKNOWN; + if (eval_variable(name, (int)len, + 0, &tv, NULL, EVAL_VAR_NOAUTOLOAD) == FAIL) + return NULL; + if (tv.v_type != VAR_CLASS && tv.v_type != VAR_OBJECT) + goto fail_after_eval; + + class_T *cl = tv.v_type == VAR_CLASS ? tv.vval.v_class + : tv.vval.v_object->obj_class; + if (cl == NULL) + goto fail_after_eval; + char_u *fname = name_end + 1; + char_u *fname_end = find_name_end(fname, NULL, NULL, FNE_CHECK_START); + if (fname_end == fname) + goto fail_after_eval; + len = fname_end - fname; + + fp = method_lookup(cl, tv.v_type, fname, len, NULL); + + if (fp != NULL) + { + fp = eval_generic_func(fp, fname, &fname_end); + if (fp != NULL) + *arg = fname_end; + } + +fail_after_eval: + clear_tv(&tv); + return fp; +} + +/* + * Returns the index of class variable "name" in the class "cl". + * Returns -1, if the variable is not found. + * If "namelen" is zero, then it is assumed that "name" is NUL terminated. + */ + int +class_member_idx(class_T *cl, char_u *name, size_t namelen) +{ + int idx; + class_member_lookup(cl, name, namelen, &idx); + return idx; +} + +/* + * Returns a pointer to the class member variable "name" in the class "cl". + * Returns NULL if the variable is not found. + * The member variable index is set in "idx". + */ + ocmember_T * +class_member_lookup(class_T *cl, char_u *name, size_t namelen, int *idx) +{ + ocmember_T *ret_m = NULL; + int ret_idx = -1; + for (int i = 0; i < cl->class_class_member_count; ++i) + { + ocmember_T *m = &cl->class_class_members[i]; + if (namelen) + { + if (namelen == m->ocm_name.length + && STRNCMP(name, m->ocm_name.string, namelen) == 0) + { + ret_m = m; + ret_idx = i; + break; + } + } + else if (STRCMP(name, m->ocm_name.string) == 0) + { + ret_m = m; + ret_idx = i; + break; + } + } + if (idx != NULL) + *idx = ret_idx; + return ret_m; +} + +/* + * Returns a pointer to the class method "name" in class "cl". + * Returns NULL if the method is not found. + * The method index is set in "idx". + */ + static ufunc_T * +class_method_lookup(class_T *cl, char_u *name, size_t namelen, int *idx) +{ + ufunc_T *ret_fp = NULL; + int ret_idx = -1; + for (int i = 0; i < cl->class_class_function_count; ++i) + { + ufunc_T *fp = cl->class_class_functions[i]; + char_u *ufname = (char_u *)fp->uf_name; + if (STRNCMP(name, ufname, namelen) == 0 && ufname[namelen] == NUL) + { + ret_fp = fp; + ret_idx = i; + break; + } + } + if (idx != NULL) + *idx = ret_idx; + return ret_fp; +} + +/* + * Returns the index of class method "name" in the class "cl". + * Returns -1, if the method is not found. + */ + int +class_method_idx(class_T *cl, char_u *name, size_t namelen) +{ + int idx; + class_method_lookup(cl, name, namelen, &idx); + return idx; +} + +/* + * Returns the index of object member variable "name" in the class "cl". + * Returns -1, if the variable is not found. + * If "namelen" is zero, then it is assumed that "name" is NUL terminated. + */ + static int +object_member_idx(class_T *cl, char_u *name, size_t namelen) +{ + int idx; + object_member_lookup(cl, name, namelen, &idx); + return idx; +} + +/* + * Returns a pointer to the object member variable "name" in the class "cl". + * Returns NULL if the variable is not found. + * The object member variable index is set in "idx". + */ + ocmember_T * +object_member_lookup(class_T *cl, char_u *name, size_t namelen, int *idx) +{ + ocmember_T *ret_m = NULL; + int ret_idx = -1; + for (int i = 0; i < cl->class_obj_member_count; ++i) + { + ocmember_T *m = &cl->class_obj_members[i]; + if (namelen) + { + if (namelen == m->ocm_name.length + && STRNCMP(name, m->ocm_name.string, namelen) == 0) + { + ret_m = m; + ret_idx = i; + break; + } + } + else if (STRCMP(name, m->ocm_name.string) == 0) + { + ret_m = m; + ret_idx = i; + break; + } + } + if (idx != NULL) + *idx = ret_idx; + return ret_m; +} + +/* + * Returns a pointer to the object method "name" in class "cl". + * Returns NULL if the method is not found. + * The object method index is set in "idx". + */ + static ufunc_T * +object_method_lookup(class_T *cl, char_u *name, size_t namelen, int *idx) +{ + ufunc_T *ret_fp = NULL; + int ret_idx = -1; + for (int i = 0; i < cl->class_obj_method_count; ++i) + { + ufunc_T *fp = cl->class_obj_methods[i]; + // Use a separate pointer to avoid that ASAN complains about + // uf_name[] only being 4 characters. + char_u *ufname = (char_u *)fp->uf_name; + if (STRNCMP(name, ufname, namelen) == 0 && ufname[namelen] == NUL) + { + ret_fp = fp; + ret_idx = i; + break; + } + } + if (idx != NULL) + *idx = ret_idx; + return ret_fp; +} + +/* + * Returns the index of object method "name" in the class "cl". + * Returns -1, if the method is not found. + */ + int +object_method_idx(class_T *cl, char_u *name, size_t namelen) +{ + int idx; + object_method_lookup(cl, name, namelen, &idx); + return idx; +} + +/* + * Lookup a class or object member variable by name. If v_type is VAR_CLASS, + * then lookup a class member variable and if it is VAR_OBJECT, then lookup a + * object member variable. + * + * Returns a pointer to the member variable structure if variable is found. + * Otherwise returns NULL. The member variable index is set in "*idx". + */ + ocmember_T * +member_lookup( + class_T *cl, + vartype_T v_type, + char_u *name, + size_t namelen, + int *idx) +{ + if (v_type == VAR_CLASS) + return class_member_lookup(cl, name, namelen, idx); + + return object_member_lookup(cl, name, namelen, idx); +} + +/* + * Find the class that defines the named member. Look up the hierarchy + * starting at "cl". + * + * Return the class that defines the member "name", else NULL. + * Fill in "p_m", if specified, for ocmember_T in found class. + */ +// NOTE: if useful for something could also indirectly return vartype and idx. + static class_T * +class_defining_member(class_T *cl, char_u *name, size_t len, ocmember_T **p_m) +{ + class_T *cl_found = NULL; + vartype_T vartype = VAR_UNKNOWN; + ocmember_T *m_found = NULL; + + len = len != 0 ? len : STRLEN(name); + + // Loop assumes if member is not defined in "cl", then it is not + // defined in any super class; the last class where it's found is the + // class where it is defined. Once the vartype is found, the other + // type is no longer checked. + for (class_T *super = cl; super != NULL; super = super->class_extends) + { + class_T *cl_tmp = NULL; + ocmember_T *m = NULL; + if (vartype == VAR_UNKNOWN || vartype == VAR_OBJECT) + { + if ((m = object_member_lookup(super, name, len, NULL)) != NULL) + { + cl_tmp = super; + vartype = VAR_OBJECT; + } + } + if (vartype == VAR_UNKNOWN || vartype == VAR_CLASS) + { + if (( m = class_member_lookup(super, name, len, NULL)) != NULL) + { + cl_tmp = super; + vartype = VAR_CLASS; + } + } + if (cl_tmp == NULL) + break; // member is not in this or any super class. + cl_found = cl_tmp; + m_found = m; + } + if (p_m != NULL) + *p_m = m_found; + return cl_found; +} + +/* + * Lookup a class or object method by name. If v_type is VAR_CLASS, then + * lookup a class method and if it is VAR_OBJECT, then lookup a object method. + * + * Returns a pointer to the method structure if variable is found. + * Otherwise returns NULL. The method variable index is set in "*idx". + */ + ufunc_T * +method_lookup( + class_T *cl, + vartype_T v_type, + char_u *name, + size_t namelen, + int *idx) +{ + if (v_type == VAR_CLASS) + return class_method_lookup(cl, name, namelen, idx); + else + return object_method_lookup(cl, name, namelen, idx); +} + +/* + * Return TRUE if current context "cctx_arg" is inside class "cl". + * Return FALSE if not. + */ + int +inside_class(cctx_T *cctx_arg, class_T *cl) +{ + for (cctx_T *cctx = cctx_arg; cctx != NULL; cctx = cctx->ctx_outer) + if (cctx->ctx_ufunc != NULL + && class_instance_of(cctx->ctx_ufunc->uf_class, cl)) + return TRUE; + return FALSE; +} + +/* + * Return TRUE if object/class variable "m" is read-only. + * Also give an error message. + */ + int +oc_var_check_ro(class_T *cl, ocmember_T *m) +{ + if (m->ocm_flags & (OCMFLAG_FINAL | OCMFLAG_CONST)) + { + semsg(_(e_cannot_change_readonly_variable_str_in_class_str), + m->ocm_name.string, cl->class_name.string); + return TRUE; + } + return FALSE; +} + +/* + * Lock all the constant object variables. Called after creating and + * initializing a new object. + */ + void +obj_lock_const_vars(object_T *obj) +{ + for (int i = 0; i < obj->obj_class->class_obj_member_count; i++) + { + ocmember_T *ocm = &obj->obj_class->class_obj_members[i]; + if (ocm->ocm_flags & OCMFLAG_CONST) + { + typval_T *mtv = ((typval_T *)(obj + 1)) + i; + item_lock(mtv, DICT_MAXNEST, TRUE, TRUE); + } + } +} + +/* + * Create a new instance of class "cl" + */ + object_T * +alloc_object(class_T *cl) +{ + object_T *obj; + int sz; + + if (cl == NULL) + return NULL; + + sz = sizeof(object_T) + cl->class_obj_member_count * sizeof(typval_T); + obj = alloc_clear(sz); + if (obj == NULL) + return NULL; + + obj->obj_class = cl; + ++cl->class_refcount; + obj->obj_refcount = 1; + object_created(obj); + + // When creating an enum value object, initialize the name and ordinal + // object variables. + if (IS_ENUM(cl)) + enum_set_internal_obj_vars(cl, obj); + + return obj; +} + +/* + * Make a copy of an object. + */ + void +copy_object(typval_T *from, typval_T *to) +{ + if (from->vval.v_object == NULL) + to->vval.v_object = NULL; + else + { + to->vval.v_object = from->vval.v_object; + ++to->vval.v_object->obj_refcount; + } +} + +/* + * Make a copy of a class. + */ + void +copy_class(typval_T *from, typval_T *to) +{ + if (from->vval.v_class == NULL) + to->vval.v_class = NULL; + else + { + to->vval.v_class = from->vval.v_class; + ++to->vval.v_class->class_refcount; + } +} + +/* + * Free the class "cl" and its contents. + */ + static void +class_free(class_T *cl) +{ + // Freeing what the class contains may recursively come back here. + // Clear "class_name" first, if it is NULL the class does not need to + // be freed. + MNV_CLEAR_STRING(cl->class_name); + + class_unref(cl->class_extends); + + for (int i = 0; i < cl->class_interface_count; ++i) + { + mnv_free(((char_u **)cl->class_interfaces)[i]); + if (cl->class_interfaces_cl[i] != NULL) + class_unref(cl->class_interfaces_cl[i]); + } + mnv_free(cl->class_interfaces); + mnv_free(cl->class_interfaces_cl); + + itf2class_T *next; + for (itf2class_T *i2c = cl->class_itf2class; i2c != NULL; i2c = next) + { + next = i2c->i2c_next; + mnv_free(i2c); + } + + for (int i = 0; i < cl->class_class_member_count; ++i) + { + ocmember_T *m = &cl->class_class_members[i]; + MNV_CLEAR_STRING(m->ocm_name); + mnv_free(m->ocm_init); + if (cl->class_members_tv != NULL) + clear_tv(&cl->class_members_tv[i]); + } + mnv_free(cl->class_class_members); + mnv_free(cl->class_members_tv); + + for (int i = 0; i < cl->class_obj_member_count; ++i) + { + ocmember_T *m = &cl->class_obj_members[i]; + MNV_CLEAR_STRING(m->ocm_name); + mnv_free(m->ocm_init); + } + mnv_free(cl->class_obj_members); + + for (int i = 0; i < cl->class_class_function_count; ++i) + { + ufunc_T *uf = cl->class_class_functions[i]; + // For an enum class, the constructor function names are cleared. Set + // the name back, so that clearing the function will work properly. + if (IS_ENUM(cl) && IS_CONSTRUCTOR_METHOD(uf) && *uf->uf_name == NUL) + STRCPY(uf->uf_name, "new"); + func_clear_free(uf, FALSE); + } + mnv_free(cl->class_class_functions); + + for (int i = 0; i < cl->class_obj_method_count; ++i) + { + ufunc_T *uf = cl->class_obj_methods[i]; + func_clear_free(uf, FALSE); + } + mnv_free(cl->class_obj_methods); + + clear_type_list(&cl->class_type_list); + + class_cleared(cl); + + mnv_free(cl); +} + +/* + * Returns the number of references from the class members of class "cl" to cl" + * itself. + */ + static int +class_get_selfrefs(class_T *cl) +{ + int self_refs = 0; + typval_T *tv; + + for (int i = 0; i < cl->class_class_member_count; ++i) + { + tv = &cl->class_members_tv[i]; + if (tv->v_type == VAR_OBJECT && tv->vval.v_object != NULL + && tv->vval.v_object->obj_class == cl + && (tv->vval.v_object->obj_refcount == 1 + || (IS_ENUM(cl) && tv->vval.v_object->obj_refcount == 2))) + self_refs++; + } + + return self_refs; +} + +/* + * Returns TRUE if enum "cl" can be freed. An enum can be freed, if the enum + * values are no longer referenced and the "values" class member is also not + * referenced. + */ + static int +can_free_enum(class_T *cl) +{ + for (int i = 0; i < cl->class_class_member_count; ++i) + { + typval_T *tv = &cl->class_members_tv[i]; + ocmember_T *ocm = &cl->class_class_members[i]; + + if (tv->v_type != VAR_OBJECT && tv->v_type != VAR_LIST) + // In an enum, the first set of class members are the enum values. + // Followed by the "values" member which is a List of enum values. + // If all of those members are no longer referenced, then the enum + // may be freed. + return TRUE; + + if (tv->v_type == VAR_LIST + && tv->vval.v_list->lv_type->tt_member->tt_type == VAR_OBJECT + && tv->vval.v_list->lv_type->tt_member->tt_class == cl + && STRCMP(ocm->ocm_name.string, "values") == 0) + { + // "values" class member is referenced outside + if (tv->vval.v_list->lv_refcount > 1) + return FALSE; + break; + } + + if (tv->vval.v_object->obj_refcount > 2) + // enum value is referenced outside + return FALSE; + } + + return TRUE; +} + +/* + * Returns TRUE if class "cl" has no references outside of the references from + * it's own class members and can be freed. If it is an enum, then checks + * whether the enum values and the "values" members are referenced elsewhere. + */ + static int +can_free_class(class_T *cl) +{ + int can_free = FALSE; + int self_refs = 0; + + if (IS_ENUM(cl) && !can_free_enum(cl)) + return FALSE; + + if (cl->class_refcount > 0) + self_refs = class_get_selfrefs(cl); + + // If the class is no longer referenced or only referenced from it's own + // class member, then it can be freed. + if (cl->class_refcount <= 0 || cl->class_refcount == self_refs) + can_free = TRUE; + + return can_free; +} + +/* + * Unreference a class. Free it when the reference count goes down to zero. + */ + void +class_unref(class_T *cl) +{ + if (cl == NULL) + return; + + --cl->class_refcount; + + if (cl->class_name.string == NULL) + return; + + if (can_free_class(cl)) + class_free(cl); +} + +/* + * Go through the list of all classes and free items without "copyID". + */ + int +class_free_nonref(int copyID) +{ + int did_free = FALSE; + + for (class_T *cl = first_class; cl != NULL; cl = next_nonref_class) + { + next_nonref_class = cl->class_next_used; + if ((cl->class_copyID & COPYID_MASK) != (copyID & COPYID_MASK)) + { + // Free the class and items it contains. + class_free(cl); + did_free = TRUE; + } + } + + next_nonref_class = NULL; + return did_free; +} + + int +set_ref_in_classes(int copyID) +{ + for (class_T *cl = first_class; cl != NULL; cl = cl->class_next_used) + set_ref_in_item_class(cl, copyID, NULL, NULL, NULL); + + return FALSE; +} + +static object_T *first_object = NULL; + +/* + * Call this function when an object has been created. It will be added to the + * list headed by "first_object". + */ + void +object_created(object_T *obj) +{ + if (first_object != NULL) + { + obj->obj_next_used = first_object; + first_object->obj_prev_used = obj; + } + first_object = obj; +} + +/* + * Call this function when an object has been cleared and is about to be freed. + * It is removed from the list headed by "first_object". + */ + static void +object_cleared(object_T *obj) +{ + if (obj->obj_next_used != NULL) + obj->obj_next_used->obj_prev_used = obj->obj_prev_used; + if (obj->obj_prev_used != NULL) + obj->obj_prev_used->obj_next_used = obj->obj_next_used; + else if (first_object == obj) + first_object = obj->obj_next_used; +} + +/* + * Free the contents of an object ignoring the reference count. + */ + static void +object_free_contents(object_T *obj) +{ + class_T *cl = obj->obj_class; + + if (!cl) + return; + + // Avoid a recursive call, it can happen if "obj" has a circular reference. + obj->obj_refcount = INT_MAX; + + // the member values are just after the object structure + typval_T *tv = (typval_T *)(obj + 1); + for (int i = 0; i < cl->class_obj_member_count; ++i) + clear_tv(tv + i); +} + + static void +object_free_object(object_T *obj) +{ + class_T *cl = obj->obj_class; + + if (!cl) + return; + + // Remove from the list headed by "first_object". + object_cleared(obj); + + mnv_free(obj); + class_unref(cl); +} + + static void +object_free(object_T *obj) +{ + if (in_free_unref_items) + return; + + object_free_contents(obj); + object_free_object(obj); +} + +/* + * Unreference an object. + */ + void +object_unref(object_T *obj) +{ + if (obj != NULL && --obj->obj_refcount <= 0) + object_free(obj); +} + +/* + * Go through the list of all objects and free items without "copyID". + */ + int +object_free_nonref(int copyID) +{ + int did_free = FALSE; + + for (object_T *obj = first_object; obj != NULL; obj = obj->obj_next_used) + { + if ((obj->obj_copyID & COPYID_MASK) != (copyID & COPYID_MASK)) + { + // Free the object contents. Object itself will be freed later. + object_free_contents(obj); + did_free = TRUE; + } + } + + return did_free; +} + + void +object_free_items(int copyID) +{ + object_T *obj_next; + + for (object_T *obj = first_object; obj != NULL; obj = obj_next) + { + obj_next = obj->obj_next_used; + if ((obj->obj_copyID & COPYID_MASK) != (copyID & COPYID_MASK)) + object_free_object(obj); + } +} + +/* + * Output message which takes a variable name and the class that defines it. + * "cl" is that class where the name was found. Search "cl"'s hierarchy to + * find the defining class. + */ + void +emsg_var_cl_define(char *msg, char_u *name, size_t len, class_T *cl) +{ + ocmember_T *m; + class_T *cl_def = class_defining_member(cl, name, len, &m); + if (cl_def != NULL) + semsg(_(msg), m->ocm_name.string, cl_def->class_name.string); + else + emsg(_(e_internal_error_please_report_a_bug)); +} + +/* + * Echo a class or object method not found message. + */ + void +method_not_found_msg(class_T *cl, vartype_T v_type, char_u *name, size_t len) +{ + char_u *method_name = mnv_strnsave(name, len); + if ((v_type == VAR_OBJECT) + && (class_method_idx(cl, name, len) >= 0)) + { + // If this is a class method, then give a different error + if (*name == '_') + semsg(_(e_cannot_access_protected_method_str), method_name); + else + semsg(_(e_class_method_str_accessible_only_using_class_str), + method_name, cl->class_name.string); + } + else if ((v_type == VAR_CLASS) + && (object_method_idx(cl, name, len) >= 0)) + { + // If this is an object method, then give a different error + if (*name == '_') + semsg(_(e_cannot_access_protected_method_str), method_name); + else + semsg(_(e_object_method_str_accessible_only_using_object_str), + method_name, cl->class_name.string); + } + else + semsg(_(e_method_not_found_on_class_str_str), method_name, + cl->class_name.string); + mnv_free(method_name); +} + +/* + * Echo a class or object member not found message. + */ + void +member_not_found_msg(class_T *cl, vartype_T v_type, char_u *name, size_t len) +{ + char_u *varname = len ? mnv_strnsave(name, len) : mnv_strsave(name); + + if (v_type == VAR_OBJECT) + { + if (class_member_idx(cl, name, len) >= 0) + semsg(_(e_class_variable_str_accessible_only_using_class_str), + varname, cl->class_name.string); + else + semsg(_(e_variable_not_found_on_object_str_str), varname, + cl->class_name.string); + } + else + { + if (object_member_idx(cl, name, len) >= 0) + semsg(_(e_object_variable_str_accessible_only_using_object_str), + varname, cl->class_name.string); + else + { + if (IS_ENUM(cl)) + semsg(_(e_enum_value_str_not_found_in_enum_str), + varname, cl->class_name.string); + else + semsg(_(e_class_variable_str_not_found_in_class_str), + varname, cl->class_name.string); + } + } + mnv_free(varname); +} + +/* + * Compile all the class and object methods in "cl". + */ + void +defcompile_class(class_T *cl) +{ + for (int loop = 1; loop <= 2; ++loop) + { + int func_count = loop == 1 ? cl->class_class_function_count + : cl->class_obj_method_count; + for (int i = 0; i < func_count; i++) + { + ufunc_T *ufunc = loop == 1 ? cl->class_class_functions[i] + : cl->class_obj_methods[i]; + // Don't compile abstract methods + if (!IS_ABSTRACT_METHOD(ufunc)) + defcompile_function(ufunc, cl); + } + } +} + +/* + * Compile all the classes defined in the current script + */ + void +defcompile_classes_in_script(void) +{ + for (class_T *cl = first_class; cl != NULL; cl = cl->class_next_used) + { + if (eval_variable(cl->class_name.string, 0, 0, NULL, NULL, + EVAL_VAR_NOAUTOLOAD | EVAL_VAR_NO_FUNC) != FAIL) + defcompile_class(cl); + } +} + +/* + * Returns TRUE if "name" is the name of a class. The typval for the class is + * returned in "rettv". + */ + int +is_class_name(char_u *name, typval_T *rettv) +{ + rettv->v_type = VAR_UNKNOWN; + + if (eval_variable(name, 0, 0, rettv, NULL, EVAL_VAR_NOAUTOLOAD | + EVAL_VAR_NO_FUNC) != FAIL) + return rettv->v_type == VAR_CLASS; + return FALSE; +} + +/* + * Calls the object builtin method "name" with arguments "argv". The value + * returned by the builtin method is in "rettv". Returns OK or FAIL. + */ + static int +object_call_builtin_method( + object_T *obj, + class_builtin_T builtin_method, + int argc, + typval_T *argv, + typval_T *rettv) +{ + ufunc_T *uf; + int midx; + + if (obj == NULL) + return FAIL; + + uf = class_get_builtin_method(obj->obj_class, builtin_method, &midx); + if (uf == NULL) + return FAIL; + + funccall_T *fc = create_funccal(uf, rettv); + int r; + + if (fc == NULL) + return FAIL; + + ++obj->obj_refcount; + + r = call_def_function(uf, argc, argv, 0, NULL, obj, fc, rettv); + + remove_funccal(); + + return r; +} + +/* + * Calls the object "empty()" method and returns the method return value. In + * case of an error, returns TRUE. + */ + int +object_empty(object_T *obj) +{ + typval_T rettv; + + if (object_call_builtin_method(obj, CLASS_BUILTIN_EMPTY, 0, NULL, &rettv) + == FAIL) + return TRUE; + + return tv_get_bool(&rettv); +} + +/* + * Use the object "len()" method to get an object length. Returns 0 if the + * method is not found or there is an error. + */ + int +object_len(object_T *obj) +{ + typval_T rettv; + + if (object_call_builtin_method(obj, CLASS_BUILTIN_LEN, 0, NULL, &rettv) + == FAIL) + return 0; + + return tv_to_number(&rettv); +} + +/* + * Return TRUE when two objects have exactly the same values. + */ + int +object_equal( + object_T *o1, + object_T *o2, + int ic) // ignore case for strings +{ + class_T *cl1, *cl2; + + if (o1 == o2) + return TRUE; + if (o1 == NULL || o2 == NULL) + return FALSE; + + cl1 = o1->obj_class; + cl2 = o2->obj_class; + + if (cl1 != cl2 || cl1 == NULL || cl2 == NULL) + return FALSE; + + for (int i = 0; i < cl1->class_obj_member_count; ++i) + if (!tv_equal((typval_T *)(o1 + 1) + i, (typval_T *)(o2 + 1) + i, ic)) + return FALSE; + + return TRUE; +} + +/* + * Return a textual representation of object "obj". + * "obj" must not be NULL. + * May return NULL. + */ + char_u * +object2string( + object_T *obj, + char_u *numbuf, + int copyID, + int echo_style, + int restore_copyID, + int composite_val) +{ + typval_T rettv; + + if (object_call_builtin_method(obj, CLASS_BUILTIN_STRING, 0, NULL, &rettv) + == OK + && rettv.vval.v_string != NULL) + return rettv.vval.v_string; + + int ok = OK; + class_T *cl = obj->obj_class; + garray_T ga; + ga_init2(&ga, 1, 50); + + if (cl != NULL && IS_ENUM(cl)) + { + GA_CONCAT_LITERAL(&ga, "enum "); + ga_concat_len(&ga, cl->class_name.string, cl->class_name.length); + char_u *enum_name = ((typval_T *)(obj + 1))->vval.v_string; + GA_CONCAT_LITERAL(&ga, "."); + ga_concat(&ga, enum_name); + } + else + { + GA_CONCAT_LITERAL(&ga, "object of "); + if (cl == NULL) + GA_CONCAT_LITERAL(&ga, "[unknown]"); + else + ga_concat_len(&ga, cl->class_name.string, cl->class_name.length); + } + if (cl != NULL) + { + GA_CONCAT_LITERAL(&ga, " {"); + for (int i = 0; i < cl->class_obj_member_count; ++i) + { + if (i > 0) + GA_CONCAT_LITERAL(&ga, ", "); + ocmember_T *m = &cl->class_obj_members[i]; + ga_concat_len(&ga, m->ocm_name.string, m->ocm_name.length); + GA_CONCAT_LITERAL(&ga, ": "); + char_u *tf = NULL; + char_u *s = echo_string_core((typval_T *)(obj + 1) + i, + &tf, numbuf, copyID, echo_style, + restore_copyID, composite_val); + if (s != NULL) + ga_concat(&ga, s); + mnv_free(tf); + if (s == NULL || did_echo_string_emsg) + { + ok = FAIL; + break; + } + line_breakcheck(); + } + GA_CONCAT_LITERAL(&ga, "}"); + } + if (ok == FAIL) + { + mnv_free(ga.ga_data); + return NULL; + } + ga_append(&ga, NUL); + return (char_u *)ga.ga_data; +} + +/* + * Return TRUE when the class "cl", its base class or one of the implemented + * interfaces matches the class "other_cl". + */ + int +class_instance_of(class_T *cl, class_T *other_cl) +{ + if (cl == other_cl) + return TRUE; + + // Recursively check the base classes. + for (; cl != NULL; cl = cl->class_extends) + { + if (cl == other_cl) + return TRUE; + // Check the implemented interfaces and the super interfaces + for (int i = cl->class_interface_count - 1; i >= 0; --i) + { + class_T *intf = cl->class_interfaces_cl[i]; + while (intf != NULL) + { + if (intf == other_cl) + return TRUE; + // check the super interfaces + intf = intf->class_extends; + } + } + } + + return FALSE; +} + +/* + * "instanceof(object, classinfo, ...)" function + */ + void +f_instanceof(typval_T *argvars, typval_T *rettv) +{ + typval_T *object_tv = &argvars[0]; + typval_T *classinfo_tv = &argvars[1]; + class_T *c; + + rettv->vval.v_number = VVAL_FALSE; + + if (check_for_object_arg(argvars, 0) == FAIL + || check_for_class_or_typealias_args(argvars, 1) == FAIL) + return; + + if (object_tv->vval.v_object == NULL) + { + if (classinfo_tv->vval.v_class == NULL) + // consider null_object as an instance of null_class + rettv->vval.v_number = VVAL_TRUE; + return; + } + + for (; classinfo_tv->v_type != VAR_UNKNOWN; ++classinfo_tv) + { + if (classinfo_tv->v_type == VAR_TYPEALIAS) + c = classinfo_tv->vval.v_typealias->ta_type->tt_class; + else + c = classinfo_tv->vval.v_class; + + if (class_instance_of(object_tv->vval.v_object->obj_class, c)) + { + rettv->vval.v_number = VVAL_TRUE; + return; + } + } +} + +#endif // FEAT_EVAL diff --git a/uvim/src/mnv9cmds.c b/uvim/src/mnv9cmds.c new file mode 100644 index 0000000000..10ed17bc5f --- /dev/null +++ b/uvim/src/mnv9cmds.c @@ -0,0 +1,2813 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * MNV - MNV is not Vim by Bram Moolenaar + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. + */ + +/* + * mnv9cmds.c: Dealing with commands of a compiled function + */ + +#define USING_FLOAT_STUFF +#include "mnv.h" + +#if defined(FEAT_EVAL) + +/* + * Get the index of the current instruction. + * This compensates for a preceding ISN_CMDMOD and ISN_PROF_START. + */ + static int +current_instr_idx(cctx_T *cctx) +{ + garray_T *instr = &cctx->ctx_instr; + int idx = instr->ga_len; + + while (idx > 0) + { + if (cctx->ctx_has_cmdmod && ((isn_T *)instr->ga_data)[idx - 1] + .isn_type == ISN_CMDMOD) + { + --idx; + continue; + } +#ifdef FEAT_PROFILE + if (((isn_T *)instr->ga_data)[idx - 1].isn_type == ISN_PROF_START) + { + --idx; + continue; + } +#endif + if (((isn_T *)instr->ga_data)[idx - 1].isn_type == ISN_DEBUG) + { + --idx; + continue; + } + break; + } + return idx; +} +/* + * Remove local variables above "new_top". + * Do this by clearing the name. If "keep" is TRUE do not reset the length, a + * closure may still need location of the variable. + */ + static void +unwind_locals(cctx_T *cctx, int new_top, int keep) +{ + if (cctx->ctx_locals.ga_len > new_top) + for (int idx = new_top; idx < cctx->ctx_locals.ga_len; ++idx) + { + lvar_T *lvar = ((lvar_T *)cctx->ctx_locals.ga_data) + idx; + MNV_CLEAR(lvar->lv_name); + } + if (!keep) + cctx->ctx_locals.ga_len = new_top; +} + +/* + * Free all local variables. + */ + void +free_locals(cctx_T *cctx) +{ + unwind_locals(cctx, 0, FALSE); + ga_clear(&cctx->ctx_locals); +} + + +/* + * Check if "name" can be "unlet". + */ + int +check_mnv9_unlet(char_u *name) +{ + if (*name == NUL) + { + semsg(_(e_argument_required_for_str), "unlet"); + return FAIL; + } + + if (name[1] != ':' || mnv_strchr((char_u *)"gwtb", *name) == NULL) + { + // "unlet s:var" is allowed in legacy script. + if (*name == 's' && !in_mnv9script()) + return OK; + semsg(_(e_cannot_unlet_str), name); + return FAIL; + } + return OK; +} + +/* + * Callback passed to ex_unletlock(). + */ + static int +compile_unlet( + lval_T *lvp, + char_u *name_end, + exarg_T *eap, + int deep UNUSED, + void *coookie) +{ + cctx_T *cctx = coookie; + char_u *p = lvp->ll_name; + int cc = *name_end; + int ret = OK; + + if (cctx->ctx_skip == SKIP_YES) + return OK; + + *name_end = NUL; + if (*p == '$') + { + // :unlet $ENV_VAR + ret = generate_UNLET(cctx, ISN_UNLETENV, p + 1, eap->forceit); + } + else if (mnv_strchr(p, '.') != NULL || mnv_strchr(p, '[') != NULL) + { + lhs_T lhs; + + // This is similar to assigning: lookup the list/dict, compile the + // idx/key. Then instead of storing the value unlet the item. + // unlet {list}[idx] + // unlet {dict}[key] dict.key + // + // Figure out the LHS type and other properties. + // + ret = compile_lhs(p, &lhs, CMD_unlet, FALSE, FALSE, 0, cctx); + + // Use the info in "lhs" to unlet the item at the index in the + // list or dict. + if (ret == OK) + { + if (!lhs.lhs_has_index) + { + semsg(_(e_cannot_unlet_imported_item_str), p); + ret = FAIL; + } + else + ret = compile_assign_unlet(p, &lhs, FALSE, &t_void, cctx); + } + + mnv_free(lhs.lhs_name); + } + else if (check_mnv9_unlet(p) == FAIL) + { + ret = FAIL; + } + else + { + // Normal name. Only supports g:, w:, t: and b: namespaces. + ret = generate_UNLET(cctx, ISN_UNLET, p, eap->forceit); + } + + *name_end = cc; + return ret; +} + +/* + * Callback passed to ex_unletlock(). + */ + static int +compile_lock_unlock( + lval_T *lvp, + char_u *name_end, + exarg_T *eap, + int deep, + void *coookie) +{ + cctx_T *cctx = coookie; + int cc = *name_end; + char_u *p = lvp->ll_name; + int ret = OK; + char_u *buf; + isntype_T isn = ISN_EXEC; + char *cmd = eap->cmdidx == CMD_lockvar ? "lockvar" : "unlockvar"; + int is_arg = FALSE; + +#ifdef LOG_LOCKVAR + ch_log(NULL, "LKVAR: compile_lock_unlock(): cookie %p, name %s", + coookie, p); +#endif + + if (cctx->ctx_skip == SKIP_YES) + return OK; + + if (*p == NUL) + { + semsg(_(e_argument_required_for_str), cmd); + return FAIL; + } + + // Cannot use :lockvar and :unlockvar on local variables. + if (p[1] != ':') + { + char_u *end = find_name_end(p, NULL, NULL, FNE_CHECK_START); + + // The most important point is that something like + // name[idx].member... needs to be resolved at runtime, get_lval(), + // starting from the root "name". + + // These checks are reminiscent of the variable_exists function. + // But most of the matches require special handling. + + // If bare name is is locally accessible, except for local var, + // then put it on the stack to use with ISN_LOCKUNLOCK. + // This could be v.memb, v[idx_key]; bare class variable, + // function arg. The item on the stack, will be passed + // to ex_lockvar() indirectly and be used as the root for get_lval. + // A bare script variable name needs no special handling. + + char_u *name = NULL; + int len = end - p; + + if (lookup_local(p, len, NULL, cctx) == OK) + { + // Handle "this", "this.val", "anyvar[idx]" + if (*end != '.' && *end != '[' + && (len != 4 || STRNCMP("this", p, len) != 0)) + { + emsg(_(e_cannot_lock_unlock_local_variable)); + return FAIL; + } + // Push the local on the stack, could be "this". + name = p; +#ifdef LOG_LOCKVAR + ch_log(NULL, "LKVAR: ... lookup_local: name %s", name); +#endif + } + if (name == NULL) + { + class_T *cl; + if (cctx_class_member_idx(cctx, p, len, &cl) >= 0) + { + if (*end != '.' && *end != '[') + { + // Push the class of the bare class variable name + name = cl->class_name.string; + len = (int)cl->class_name.length; +#ifdef LOG_LOCKVAR + ch_log(NULL, "LKVAR: ... cctx_class_member: name %s", + name); +#endif + } + } + } + if (name == NULL) + { + // Can lockvar any function arg. + if (arg_exists(p, len, NULL, NULL, NULL, cctx) == OK) + { + name = p; + is_arg = TRUE; +#ifdef LOG_LOCKVAR + ch_log(NULL, "LKVAR: ... arg_exists: name %s", name); +#endif + } + } + if (name == NULL) + { + // No special handling for a bare script variable; but + // if followed by '[' or '.', it's a root for get_lval(). + if (script_var_exists(p, len, cctx, NULL) == OK + && (*end == '.' || *end == '[')) + { + name = p; +#ifdef LOG_LOCKVAR + ch_log(NULL, "LKVAR: ... script_var_exists: name %s", name); +#endif + } + } + if (name != NULL) + { +#ifdef LOG_LOCKVAR + ch_log(NULL, "LKVAR: ... INS_LOCKUNLOCK %s", name); +#endif + if (compile_load(&name, len, name + len, cctx, FALSE, FALSE) == FAIL) + return FAIL; + isn = ISN_LOCKUNLOCK; + } + } + + // Checking is done at runtime. + *name_end = NUL; + size_t len = name_end - p + 20; + buf = alloc(len); + if (buf == NULL) + ret = FAIL; + else + { + if (deep < 0) + mnv_snprintf((char *)buf, len, "%s! %s", cmd, p); + else + mnv_snprintf((char *)buf, len, "%s %d %s", cmd, deep, p); +#ifdef LOG_LOCKVAR + ch_log(NULL, "LKVAR: ... buf %s", buf); +#endif + if (isn == ISN_LOCKUNLOCK) + ret = generate_LOCKUNLOCK(cctx, buf, is_arg); + else + ret = generate_EXEC_copy(cctx, isn, buf); + + mnv_free(buf); + *name_end = cc; + } + return ret; +} + +/* + * compile "unlet var", "lock var" and "unlock var" + * "arg" points to "var". + */ + char_u * +compile_unletlock(char_u *arg, exarg_T *eap, cctx_T *cctx) +{ + int deep = 0; + char_u *p = arg; + + if (eap->cmdidx != CMD_unlet) + { + if (eap->forceit) + deep = -1; + else if (mnv_isdigit(*p)) + { + deep = getdigits(&p); + p = skipwhite(p); + } + else + deep = 2; + } + + ex_unletlock(eap, p, deep, GLV_NO_AUTOLOAD | GLV_COMPILING, + eap->cmdidx == CMD_unlet ? compile_unlet : compile_lock_unlock, + cctx); + return eap->nextcmd == NULL ? (char_u *)"" : eap->nextcmd; +} + +/* + * Generate a jump to the ":endif"/":endfor"/":endwhile"/":finally"/":endtry". + * "funcref_idx" is used for JUMP_WHILE_FALSE + */ + static int +compile_jump_to_end( + endlabel_T **el, + jumpwhen_T when, + int funcref_idx, + cctx_T *cctx) +{ + garray_T *instr = &cctx->ctx_instr; + endlabel_T *endlabel = ALLOC_CLEAR_ONE(endlabel_T); + + if (endlabel == NULL) + return FAIL; + endlabel->el_next = *el; + *el = endlabel; + endlabel->el_end_label = instr->ga_len; + + if (when == JUMP_WHILE_FALSE) + generate_WHILE(cctx, funcref_idx); + else + generate_JUMP(cctx, when, 0); + return OK; +} + + static void +compile_fill_jump_to_end(endlabel_T **el, int jump_where, cctx_T *cctx) +{ + garray_T *instr = &cctx->ctx_instr; + + while (*el != NULL) + { + endlabel_T *cur = (*el); + isn_T *isn; + + isn = ((isn_T *)instr->ga_data) + cur->el_end_label; + isn->isn_arg.jump.jump_where = jump_where; + *el = cur->el_next; + mnv_free(cur); + } +} + + static void +compile_free_jump_to_end(endlabel_T **el) +{ + while (*el != NULL) + { + endlabel_T *cur = (*el); + + *el = cur->el_next; + mnv_free(cur); + } +} + +/* + * Create a new scope and set up the generic items. + */ + static scope_T * +new_scope(cctx_T *cctx, scopetype_T type) +{ + scope_T *scope = ALLOC_CLEAR_ONE(scope_T); + + if (scope == NULL) + return NULL; + scope->se_outer = cctx->ctx_scope; + cctx->ctx_scope = scope; + scope->se_type = type; + scope->se_local_count = cctx->ctx_locals.ga_len; + if (scope->se_outer != NULL) + scope->se_loop_depth = scope->se_outer->se_loop_depth; + return scope; +} + +/* + * Free the current scope and go back to the outer scope. + */ + void +drop_scope(cctx_T *cctx) +{ + scope_T *scope = cctx->ctx_scope; + + if (scope == NULL) + { + iemsg("calling drop_scope() without a scope"); + return; + } + cctx->ctx_scope = scope->se_outer; + switch (scope->se_type) + { + case IF_SCOPE: + compile_free_jump_to_end(&scope->se_u.se_if.is_end_label); break; + case FOR_SCOPE: + compile_free_jump_to_end(&scope->se_u.se_for.fs_end_label); break; + case WHILE_SCOPE: + compile_free_jump_to_end(&scope->se_u.se_while.ws_end_label); break; + case TRY_SCOPE: + compile_free_jump_to_end(&scope->se_u.se_try.ts_end_label); break; + case NO_SCOPE: + case BLOCK_SCOPE: + break; + } + mnv_free(scope); +} + + static int +misplaced_cmdmod(cctx_T *cctx) +{ + garray_T *instr = &cctx->ctx_instr; + + if (cctx->ctx_has_cmdmod + && ((isn_T *)instr->ga_data)[instr->ga_len - 1].isn_type + == ISN_CMDMOD) + { + emsg(_(e_misplaced_command_modifier)); + return TRUE; + } + return FALSE; +} + +/* + * compile "if expr" + * + * "if expr" Produces instructions: + * EVAL expr Push result of "expr" + * JUMP_IF_FALSE end + * ... body ... + * end: + * + * "if expr | else" Produces instructions: + * EVAL expr Push result of "expr" + * JUMP_IF_FALSE else + * ... body ... + * JUMP_ALWAYS end + * else: + * ... body ... + * end: + * + * "if expr1 | elseif expr2 | else" Produces instructions: + * EVAL expr Push result of "expr" + * JUMP_IF_FALSE elseif + * ... body ... + * JUMP_ALWAYS end + * elseif: + * EVAL expr Push result of "expr" + * JUMP_IF_FALSE else + * ... body ... + * JUMP_ALWAYS end + * else: + * ... body ... + * end: + */ + char_u * +compile_if(char_u *arg, cctx_T *cctx) +{ + char_u *p = arg; + garray_T *instr = &cctx->ctx_instr; + int instr_count = instr->ga_len; + scope_T *scope; + skip_T skip_save = cctx->ctx_skip; + ppconst_T ppconst; + + CLEAR_FIELD(ppconst); + if (compile_expr1(&p, cctx, &ppconst) == FAIL) + { + clear_ppconst(&ppconst); + return NULL; + } + if (!ends_excmd2(arg, skipwhite(p))) + { + semsg(_(e_trailing_characters_str), p); + return NULL; + } + if (cctx->ctx_skip == SKIP_YES) + clear_ppconst(&ppconst); + else if (instr->ga_len == instr_count && ppconst.pp_used == 1) + { + int error = FALSE; + int v; + + // The expression results in a constant. + v = tv_get_bool_chk(&ppconst.pp_tv[0], &error); + clear_ppconst(&ppconst); + if (error) + return NULL; + cctx->ctx_skip = v ? SKIP_NOT : SKIP_YES; + } + else + { + // Not a constant, generate instructions for the expression. + cctx->ctx_skip = SKIP_UNKNOWN; + if (generate_ppconst(cctx, &ppconst) == FAIL) + return NULL; + if (bool_on_stack(cctx) == FAIL) + return NULL; + } + + // CMDMOD_REV must come before the jump + generate_undo_cmdmods(cctx); + + scope = new_scope(cctx, IF_SCOPE); + if (scope == NULL) + return NULL; + scope->se_skip_save = skip_save; + // "is_had_return" will be reset if any block does not end in :return + scope->se_u.se_if.is_had_return = TRUE; + + if (cctx->ctx_skip == SKIP_UNKNOWN) + { + // "where" is set when ":elseif", "else" or ":endif" is found + scope->se_u.se_if.is_if_label = instr->ga_len; + generate_JUMP(cctx, JUMP_IF_FALSE, 0); + } + else + scope->se_u.se_if.is_if_label = -1; + +#ifdef FEAT_PROFILE + if (cctx->ctx_compile_type == CT_PROFILE && cctx->ctx_skip == SKIP_YES + && skip_save != SKIP_YES) + { + // generated a profile start, need to generate a profile end, since it + // won't be done after returning + cctx->ctx_skip = SKIP_NOT; + generate_instr(cctx, ISN_PROF_END); + cctx->ctx_skip = SKIP_YES; + } +#endif + + return p; +} + + char_u * +compile_elseif(char_u *arg, cctx_T *cctx) +{ + char_u *p = arg; + garray_T *instr = &cctx->ctx_instr; + int instr_count; + isn_T *isn; + scope_T *scope = cctx->ctx_scope; + ppconst_T ppconst; + skip_T save_skip = cctx->ctx_skip; + + if (scope == NULL || scope->se_type != IF_SCOPE) + { + emsg(_(e_elseif_without_if)); + return NULL; + } + if (scope->se_u.se_if.is_seen_else) + { + emsg(_(e_elseif_after_else)); + return NULL; + } + unwind_locals(cctx, scope->se_local_count, TRUE); + if (!cctx->ctx_had_return && !cctx->ctx_had_throw) + // the previous if block didn't end in a "return" or a "throw" + // statement. + scope->se_u.se_if.is_had_return = FALSE; + + if (cctx->ctx_skip == SKIP_NOT) + { + // previous block was executed, this one and following will not + cctx->ctx_skip = SKIP_YES; + scope->se_u.se_if.is_seen_skip_not = TRUE; + } + if (scope->se_u.se_if.is_seen_skip_not) + { + // A previous block was executed, skip over expression and bail out. + // Do not count the "elseif" for profiling and cmdmod + instr->ga_len = current_instr_idx(cctx); + + skip_expr_cctx(&p, cctx); + return p; + } + + if (cctx->ctx_skip == SKIP_UNKNOWN) + { + int moved_cmdmod = FALSE; + int saved_debug = FALSE; + isn_T debug_isn; + + // Move any CMDMOD instruction to after the jump + if (((isn_T *)instr->ga_data)[instr->ga_len - 1].isn_type == ISN_CMDMOD) + { + if (GA_GROW_FAILS(instr, 1)) + return NULL; + ((isn_T *)instr->ga_data)[instr->ga_len] = + ((isn_T *)instr->ga_data)[instr->ga_len - 1]; + --instr->ga_len; + moved_cmdmod = TRUE; + } + + // Remove the already generated ISN_DEBUG, it is written below the + // ISN_FOR instruction. + if (cctx->ctx_compile_type == CT_DEBUG && instr->ga_len > 0 + && ((isn_T *)instr->ga_data)[instr->ga_len - 1] + .isn_type == ISN_DEBUG) + { + --instr->ga_len; + debug_isn = ((isn_T *)instr->ga_data)[instr->ga_len]; + saved_debug = TRUE; + } + + if (compile_jump_to_end(&scope->se_u.se_if.is_end_label, + JUMP_ALWAYS, 0, cctx) == FAIL) + return NULL; + // previous "if" or "elseif" jumps here + isn = ((isn_T *)instr->ga_data) + scope->se_u.se_if.is_if_label; + isn->isn_arg.jump.jump_where = instr->ga_len; + + if (moved_cmdmod) + ++instr->ga_len; + + if (saved_debug) + { + // move the debug instruction here + if (GA_GROW_FAILS(instr, 1)) + return NULL; + ((isn_T *)instr->ga_data)[instr->ga_len] = debug_isn; + ++instr->ga_len; + } + } + + // compile "expr"; if we know it evaluates to FALSE skip the block + CLEAR_FIELD(ppconst); + if (cctx->ctx_skip == SKIP_YES) + { + cctx->ctx_skip = SKIP_UNKNOWN; +#ifdef FEAT_PROFILE + if (cctx->ctx_compile_type == CT_PROFILE) + // the previous block was skipped, need to profile this line + generate_instr(cctx, ISN_PROF_START); +#endif + if (cctx->ctx_compile_type == CT_DEBUG) + // the previous block was skipped, may want to debug this line + generate_instr_debug(cctx); + } + + instr_count = instr->ga_len; + if (compile_expr1(&p, cctx, &ppconst) == FAIL) + { + clear_ppconst(&ppconst); + return NULL; + } + cctx->ctx_skip = save_skip; + if (!ends_excmd2(arg, skipwhite(p))) + { + clear_ppconst(&ppconst); + semsg(_(e_trailing_characters_str), p); + return NULL; + } + if (scope->se_skip_save == SKIP_YES) + clear_ppconst(&ppconst); + else if (instr->ga_len == instr_count && ppconst.pp_used == 1) + { + int error = FALSE; + int v; + + // The expression result is a constant. + v = tv_get_bool_chk(&ppconst.pp_tv[0], &error); + if (error) + { + clear_ppconst(&ppconst); + return NULL; + } + cctx->ctx_skip = v ? SKIP_NOT : SKIP_YES; + clear_ppconst(&ppconst); + scope->se_u.se_if.is_if_label = -1; + } + else + { + // Not a constant, generate instructions for the expression. + cctx->ctx_skip = SKIP_UNKNOWN; + if (generate_ppconst(cctx, &ppconst) == FAIL) + return NULL; + if (bool_on_stack(cctx) == FAIL) + return NULL; + + // CMDMOD_REV must come before the jump + generate_undo_cmdmods(cctx); + + // "where" is set when ":elseif", "else" or ":endif" is found + scope->se_u.se_if.is_if_label = instr->ga_len; + generate_JUMP(cctx, JUMP_IF_FALSE, 0); + } + + return p; +} + + char_u * +compile_else(char_u *arg, cctx_T *cctx) +{ + char_u *p = arg; + garray_T *instr = &cctx->ctx_instr; + isn_T *isn; + scope_T *scope = cctx->ctx_scope; + + if (scope == NULL || scope->se_type != IF_SCOPE) + { + emsg(_(e_else_without_if)); + return NULL; + } + if (scope->se_u.se_if.is_seen_else) + { + emsg(_(e_multiple_else)); + return NULL; + } + unwind_locals(cctx, scope->se_local_count, TRUE); + if (!cctx->ctx_had_return && !cctx->ctx_had_throw) + // the previous if block didn't end in a "return" or a "throw" + // statement. + scope->se_u.se_if.is_had_return = FALSE; + scope->se_u.se_if.is_seen_else = TRUE; + +#ifdef FEAT_PROFILE + if (cctx->ctx_compile_type == CT_PROFILE) + { + if (cctx->ctx_skip == SKIP_NOT + && ((isn_T *)instr->ga_data)[instr->ga_len - 1] + .isn_type == ISN_PROF_START) + // the previous block was executed, do not count "else" for + // profiling + --instr->ga_len; + if (cctx->ctx_skip == SKIP_YES && !scope->se_u.se_if.is_seen_skip_not) + { + // the previous block was not executed, this one will, do count the + // "else" for profiling + cctx->ctx_skip = SKIP_NOT; + generate_instr(cctx, ISN_PROF_END); + generate_instr(cctx, ISN_PROF_START); + cctx->ctx_skip = SKIP_YES; + } + } +#endif + + if (!scope->se_u.se_if.is_seen_skip_not && scope->se_skip_save != SKIP_YES) + { + // jump from previous block to the end, unless the else block is empty + if (cctx->ctx_skip == SKIP_UNKNOWN) + { + if (!cctx->ctx_had_return + && compile_jump_to_end(&scope->se_u.se_if.is_end_label, + JUMP_ALWAYS, 0, cctx) == FAIL) + return NULL; + } + + if (cctx->ctx_skip == SKIP_UNKNOWN) + { + if (scope->se_u.se_if.is_if_label >= 0) + { + // previous "if" or "elseif" jumps here + isn = ((isn_T *)instr->ga_data) + scope->se_u.se_if.is_if_label; + isn->isn_arg.jump.jump_where = instr->ga_len; + scope->se_u.se_if.is_if_label = -1; + } + } + + if (cctx->ctx_skip != SKIP_UNKNOWN) + cctx->ctx_skip = cctx->ctx_skip == SKIP_YES ? SKIP_NOT : SKIP_YES; + } + + return p; +} + + char_u * +compile_endif(char_u *arg, cctx_T *cctx) +{ + scope_T *scope = cctx->ctx_scope; + ifscope_T *ifscope; + garray_T *instr = &cctx->ctx_instr; + isn_T *isn; + + if (misplaced_cmdmod(cctx)) + return NULL; + + if (scope == NULL || scope->se_type != IF_SCOPE) + { + emsg(_(e_endif_without_if)); + return NULL; + } + ifscope = &scope->se_u.se_if; + unwind_locals(cctx, scope->se_local_count, TRUE); + if (!cctx->ctx_had_return && !cctx->ctx_had_throw) + // the previous if block didn't end in a "return" or a "throw" + // statement. + ifscope->is_had_return = FALSE; + + if (scope->se_u.se_if.is_if_label >= 0) + { + // previous "if" or "elseif" jumps here + isn = ((isn_T *)instr->ga_data) + scope->se_u.se_if.is_if_label; + isn->isn_arg.jump.jump_where = instr->ga_len; + } + // Fill in the "end" label in jumps at the end of the blocks. + compile_fill_jump_to_end(&ifscope->is_end_label, instr->ga_len, cctx); + +#ifdef FEAT_PROFILE + // even when skipping we count the endif as executed, unless the block it's + // in is skipped + if (cctx->ctx_compile_type == CT_PROFILE && cctx->ctx_skip == SKIP_YES + && scope->se_skip_save != SKIP_YES) + { + cctx->ctx_skip = SKIP_NOT; + generate_instr(cctx, ISN_PROF_START); + } +#endif + cctx->ctx_skip = scope->se_skip_save; + + // If all the blocks end in :return and there is an :else then the + // had_return flag is set. + cctx->ctx_had_return = ifscope->is_had_return && ifscope->is_seen_else; + + drop_scope(cctx); + return arg; +} + +/* + * Save the info needed for ENDLOOP. Used by :for and :while. + */ + static void +compile_fill_loop_info(loop_info_T *loop_info, int funcref_idx, cctx_T *cctx) +{ + loop_info->li_funcref_idx = funcref_idx; + loop_info->li_local_count = cctx->ctx_locals.ga_len; + loop_info->li_closure_count = cctx->ctx_closure_count; +} + +/* + * When compiling a for loop to iterate over a tuple, get the type of the loop + * variable to use. + */ + static type_T * +compile_for_tuple_get_vartype(type_T *vartype, int var_list) +{ + // If this is not a variadic tuple, or all the tuple items don't have + // the same type, then use t_any + if (!(vartype->tt_flags & TTFLAG_VARARGS) || vartype->tt_argcount != 1) + return &t_any; + + // variadic tuple + type_T *member_type = vartype->tt_args[0]->tt_member; + if (member_type->tt_type == VAR_ANY) + return &t_any; + + if (!var_list) + // for x in tuple<...list> + return member_type; + + if (member_type->tt_type == VAR_LIST + && member_type->tt_member->tt_type != VAR_ANY) + // for [x, y] in tuple<...list>> + return member_type->tt_member; + else if (member_type->tt_type == VAR_TUPLE + && member_type->tt_flags & TTFLAG_VARARGS + && member_type->tt_argcount == 1) + // for [x, y] in tuple<...list>>> + return member_type->tt_args[0]->tt_member; + + return &t_any; +} + +/* + * Compile "for var in expr": + * + * Produces instructions: + * STORE -1 in loop-idx Set index to -1 + * EVAL expr Result of "expr" on top of stack + * top: FOR loop-idx, end Increment index, use list on bottom of stack + * - if beyond end, jump to "end" + * - otherwise get item from list and push it + * - store ec_funcrefs in var "loop-idx" + 1 + * STORE var Store item in "var" + * ... body ... + * ENDLOOP funcref-idx off count Only if closure uses local var + * JUMP top Jump back to repeat + * end: DROP Drop the result of "expr" + * + * Compile "for [var1, var2] in expr" - as above, but instead of "STORE var": + * UNPACK 2 Split item in 2 + * STORE var1 Store item in "var1" + * STORE var2 Store item in "var2" + */ + char_u * +compile_for(char_u *arg_start, cctx_T *cctx) +{ + char_u *arg; + char_u *arg_end; + char_u *name = NULL; + char_u *p; + char_u *wp; + int var_count = 0; + int var_list = FALSE; + int semicolon = FALSE; + size_t varlen; + garray_T *instr = &cctx->ctx_instr; + scope_T *scope; + forscope_T *forscope; + lvar_T *loop_lvar; // loop iteration variable + int loop_lvar_idx; + lvar_T *funcref_lvar; + int funcref_lvar_idx; + lvar_T *var_lvar; // variable for "var" + type_T *vartype; + type_T *item_type = &t_any; + int idx; + int prev_lnum = cctx->ctx_prev_lnum; + + p = skip_var_list(arg_start, TRUE, &var_count, &semicolon, FALSE); + if (p == NULL) + return NULL; + if (var_count == 0) + var_count = 1; + else + var_list = TRUE; // can also be a list of one variable + + // consume "in" + wp = p; + if (may_get_next_line_error(wp, &p, cctx) == FAIL) + return NULL; + if (STRNCMP(p, "in", 2) != 0 || !IS_WHITE_OR_NUL(p[2])) + { + if (*p == ':' && wp != p) + semsg(_(e_no_white_space_allowed_before_colon_str), p); + else + emsg(_(e_missing_in_after_for)); + return NULL; + } + wp = p + 2; + if (may_get_next_line_error(wp, &p, cctx) == FAIL) + return NULL; + + // Find the already generated ISN_DEBUG to get the line number for the + // instruction written below the ISN_FOR instruction. + if (cctx->ctx_compile_type == CT_DEBUG && instr->ga_len > 0 + && ((isn_T *)instr->ga_data)[instr->ga_len - 1] + .isn_type == ISN_DEBUG) + { + prev_lnum = ((isn_T *)instr->ga_data)[instr->ga_len - 1] + .isn_arg.debug.dbg_break_lnum; + } + + scope = new_scope(cctx, FOR_SCOPE); + if (scope == NULL) + return NULL; + if (scope->se_loop_depth == MAX_LOOP_DEPTH) + { + emsg(_(e_loop_nesting_too_deep)); + return NULL; + } + ++scope->se_loop_depth; + forscope = &scope->se_u.se_for; + + // Reserve a variable to store the loop iteration counter and initialize it + // to -1. + loop_lvar = reserve_local(cctx, (char_u *)"", 0, ASSIGN_VAR, &t_number); + if (loop_lvar == NULL) + { + drop_scope(cctx); + return NULL; // out of memory + } + // get the index before a following reserve_local() makes the lval invalid + loop_lvar_idx = loop_lvar->lv_idx; + generate_STORENR(cctx, loop_lvar_idx, -1); + + // Reserve a variable to store ec_funcrefs.ga_len, used in ISN_ENDLOOP. + // The variable index is always the loop var index plus one. + // It is not used when no closures are encountered, we don't know yet. + funcref_lvar = reserve_local(cctx, (char_u *)"", 0, ASSIGN_VAR, &t_number); + if (funcref_lvar == NULL) + { + drop_scope(cctx); + return NULL; // out of memory + } + // get the index before a following reserve_local() makes the lval invalid + funcref_lvar_idx = funcref_lvar->lv_idx; + + // compile "expr", it remains on the stack until "endfor" + arg = p; + if (compile_expr0(&arg, cctx) == FAIL) + { + drop_scope(cctx); + return NULL; + } + arg_end = arg; + + if (cctx->ctx_skip != SKIP_YES) + { + // If we know the type of "var" and it is not a supported type we can + // give an error now. + vartype = get_type_on_stack(cctx, 0); + if (vartype->tt_type != VAR_LIST + && vartype->tt_type != VAR_TUPLE + && vartype->tt_type != VAR_STRING + && vartype->tt_type != VAR_BLOB + && vartype->tt_type != VAR_ANY + && vartype->tt_type != VAR_UNKNOWN) + { + semsg(_(e_for_loop_on_str_not_supported), + vartype_name(vartype->tt_type)); + drop_scope(cctx); + return NULL; + } + + if (vartype->tt_type == VAR_STRING) + item_type = &t_string; + else if (vartype->tt_type == VAR_BLOB) + item_type = &t_number; + else if (vartype->tt_type == VAR_LIST + && vartype->tt_member->tt_type != VAR_ANY) + { + if (!var_list) + item_type = vartype->tt_member; + else if (vartype->tt_member->tt_type == VAR_LIST + && vartype->tt_member->tt_member->tt_type != VAR_ANY) + item_type = vartype->tt_member->tt_member; + } + else if (vartype->tt_type == VAR_TUPLE) + item_type = compile_for_tuple_get_vartype(vartype, var_list); + + // CMDMOD_REV must come before the FOR instruction. + generate_undo_cmdmods(cctx); + + // "for_end" is set when ":endfor" is found + forscope->fs_top_label = current_instr_idx(cctx); + + if (cctx->ctx_compile_type == CT_DEBUG) + { + int save_prev_lnum = cctx->ctx_prev_lnum; + isn_T *isn; + + // Add ISN_DEBUG here, before deciding to end the loop. There will + // be another ISN_DEBUG before the next instruction. + // Use the prev_lnum from the ISN_DEBUG instruction removed above. + // Increment the variable count so that the loop variable can be + // inspected. + cctx->ctx_prev_lnum = prev_lnum; + isn = generate_instr_debug(cctx); + ++isn->isn_arg.debug.dbg_var_names_len; + cctx->ctx_prev_lnum = save_prev_lnum; + } + + generate_FOR(cctx, loop_lvar_idx); + + arg = arg_start; + if (var_list) + { + generate_UNPACK(cctx, var_count, semicolon); + arg = skipwhite(arg + 1); // skip white after '[' + + // drop the list item + --cctx->ctx_type_stack.ga_len; + + // add type of the items + for (idx = 0; idx < var_count; ++idx) + { + type_T *type = (semicolon && idx == 0) ? vartype : item_type; + + if (push_type_stack(cctx, type) == FAIL) + { + drop_scope(cctx); + return NULL; + } + } + } + + for (idx = 0; idx < var_count; ++idx) + { + assign_dest_T dest = dest_local; + int opt_flags = 0; + int mnvvaridx = -1; + type_T *type = &t_any; + type_T *lhs_type = &t_any; + where_T where = WHERE_INIT; + + p = skip_var_one(arg, FALSE); + varlen = p - arg; + name = mnv_strnsave(arg, varlen); + if (name == NULL) + goto failed; + if (*skipwhite(p) == ':') + { + if (MNV_ISWHITE(*p)) + { + semsg(_(e_no_white_space_allowed_before_colon_str), p); + goto failed; + } + p = skipwhite(p + 1); + lhs_type = parse_type(&p, cctx->ctx_type_list, cctx->ctx_ufunc, + cctx, TRUE); + if (lhs_type == NULL || !valid_declaration_type(lhs_type)) + goto failed; + } + + if (get_var_dest(name, &dest, CMD_for, &opt_flags, + &mnvvaridx, &type, cctx) == FAIL) + goto failed; + if (dest != dest_local) + { + if (generate_store_var(cctx, dest, opt_flags, mnvvaridx, + type, name, NULL) == FAIL) + goto failed; + } + else if (varlen == 1 && *arg == '_') + { + // Assigning to "_": drop the value. + if (generate_instr_drop(cctx, ISN_DROP, 1) == NULL) + goto failed; + } + else + { + // Script var is not supported. + if (STRNCMP(name, "s:", 2) == 0) + { + emsg(_(e_cannot_use_script_variable_in_for_loop)); + goto failed; + } + + if (!valid_varname(arg, (int)varlen, FALSE)) + goto failed; + if (lookup_local(arg, varlen, NULL, cctx) == OK) + { + semsg(_(e_variable_already_declared_str), arg); + goto failed; + } + + // Reserve a variable to store "var". + if (var_list) + { + where.wt_index = idx + 1; + where.wt_kind = WT_VARIABLE; + } + if (lhs_type == &t_any) + lhs_type = item_type; + else if (item_type != &t_unknown + && need_type_where(item_type, lhs_type, 0, -1, + where, cctx, FALSE, FALSE) == FAIL) + goto failed; + var_lvar = reserve_local(cctx, arg, varlen, ASSIGN_FINAL, + lhs_type); + if (var_lvar == NULL) + // out of memory or used as an argument + goto failed; + + if (semicolon && idx == var_count - 1) + var_lvar->lv_type = vartype; + generate_STORE(cctx, ISN_STORE, var_lvar->lv_idx, NULL); + } + + if (*p == ',' || *p == ';') + ++p; + arg = skipwhite(p); + mnv_free(name); + } + + // remember the number of variables and closures, used for ENDLOOP + compile_fill_loop_info(&forscope->fs_loop_info, funcref_lvar_idx, cctx); + forscope->fs_loop_info.li_depth = scope->se_loop_depth - 1; + } + + return arg_end; + +failed: + mnv_free(name); + drop_scope(cctx); + return NULL; +} + +/* + * Used when ending a loop of :for and :while: Generate an ISN_ENDLOOP + * instruction if any variable was declared that could be used by a new + * closure. + */ + static int +compile_loop_end(loop_info_T *loop_info, cctx_T *cctx) +{ + if (cctx->ctx_locals.ga_len > loop_info->li_local_count + && cctx->ctx_closure_count > loop_info->li_closure_count) + return generate_ENDLOOP(cctx, loop_info); + return OK; +} + +/* + * compile "endfor" + */ + char_u * +compile_endfor(char_u *arg, cctx_T *cctx) +{ + garray_T *instr = &cctx->ctx_instr; + scope_T *scope = cctx->ctx_scope; + forscope_T *forscope; + isn_T *isn; + + if (misplaced_cmdmod(cctx)) + return NULL; + + if (scope == NULL || scope->se_type != FOR_SCOPE) + { + emsg(_(e_endfor_without_for)); + return NULL; + } + forscope = &scope->se_u.se_for; + cctx->ctx_scope = scope->se_outer; + if (cctx->ctx_skip != SKIP_YES) + { + // Handle the case that any local variables were declared that might be + // used in a closure. + if (compile_loop_end(&forscope->fs_loop_info, cctx) == FAIL) + return NULL; + + unwind_locals(cctx, scope->se_local_count, TRUE); + + // At end of ":for" scope jump back to the FOR instruction. + generate_JUMP(cctx, JUMP_ALWAYS, forscope->fs_top_label); + + // Fill in the "end" label in the FOR statement so it can jump here. + // In debug mode an ISN_DEBUG was inserted. + isn = ((isn_T *)instr->ga_data) + forscope->fs_top_label + + (cctx->ctx_compile_type == CT_DEBUG ? 1 : 0); + isn->isn_arg.forloop.for_end = instr->ga_len; + + // Fill in the "end" label any BREAK statements + compile_fill_jump_to_end(&forscope->fs_end_label, instr->ga_len, cctx); + + // Below the ":for" scope drop the "expr" list from the stack. + if (generate_instr_drop(cctx, ISN_DROP, 1) == NULL) + return NULL; + } + + mnv_free(scope); + + return arg; +} + +/* + * compile "while expr" + * + * Produces instructions: + * top: EVAL expr Push result of "expr" + * WHILE funcref-idx end Jump if false + * ... body ... + * ENDLOOP funcref-idx off count only if closure uses local var + * JUMP top Jump back to repeat + * end: + * + */ + char_u * +compile_while(char_u *arg, cctx_T *cctx) +{ + char_u *p = arg; + scope_T *scope; + whilescope_T *whilescope; + lvar_T *funcref_lvar; + int funcref_lvar_idx; + + scope = new_scope(cctx, WHILE_SCOPE); + if (scope == NULL) + return NULL; + if (scope->se_loop_depth == MAX_LOOP_DEPTH) + { + emsg(_(e_loop_nesting_too_deep)); + return NULL; + } + ++scope->se_loop_depth; + whilescope = &scope->se_u.se_while; + + // "endwhile" jumps back here, one before when profiling or using cmdmods + whilescope->ws_top_label = current_instr_idx(cctx); + + // Reserve a variable to store ec_funcrefs.ga_len, used in ISN_ENDLOOP. + // It is not used when no closures are encountered, we don't know yet. + funcref_lvar = reserve_local(cctx, (char_u *)"", 0, ASSIGN_VAR, &t_number); + if (funcref_lvar == NULL) + { + drop_scope(cctx); + return NULL; // out of memory + } + // get the index before a following reserve_local() makes the lval invalid + funcref_lvar_idx = funcref_lvar->lv_idx; + + // remember the number of variables and closures, used for ENDLOOP + compile_fill_loop_info(&whilescope->ws_loop_info, funcref_lvar_idx, cctx); + whilescope->ws_loop_info.li_depth = scope->se_loop_depth - 1; + + // compile "expr" + if (compile_expr0(&p, cctx) == FAIL) + return NULL; + + if (!ends_excmd2(arg, skipwhite(p))) + { + semsg(_(e_trailing_characters_str), p); + return NULL; + } + + if (cctx->ctx_skip != SKIP_YES) + { + if (bool_on_stack(cctx) == FAIL) + return FAIL; + + // CMDMOD_REV must come before the jump + generate_undo_cmdmods(cctx); + + // "while_end" is set when ":endwhile" is found + if (compile_jump_to_end(&whilescope->ws_end_label, + JUMP_WHILE_FALSE, funcref_lvar_idx, cctx) == FAIL) + return FAIL; + } + + return p; +} + +/* + * compile "endwhile" + */ + char_u * +compile_endwhile(char_u *arg, cctx_T *cctx) +{ + scope_T *scope = cctx->ctx_scope; + garray_T *instr = &cctx->ctx_instr; + + if (misplaced_cmdmod(cctx)) + return NULL; + if (scope == NULL || scope->se_type != WHILE_SCOPE) + { + emsg(_(e_endwhile_without_while)); + return NULL; + } + cctx->ctx_scope = scope->se_outer; + if (cctx->ctx_skip != SKIP_YES) + { + whilescope_T *whilescope = &scope->se_u.se_while; + + // Handle the case that any local variables were declared that might be + // used in a closure. + if (compile_loop_end(&whilescope->ws_loop_info, cctx) == FAIL) + return NULL; + + unwind_locals(cctx, scope->se_local_count, TRUE); + +#ifdef FEAT_PROFILE + // count the endwhile before jumping + may_generate_prof_end(cctx, cctx->ctx_lnum); +#endif + + // At end of ":for" scope jump back to the FOR instruction. + generate_JUMP(cctx, JUMP_ALWAYS, scope->se_u.se_while.ws_top_label); + + // Fill in the "end" label in the WHILE statement so it can jump here. + // And in any jumps for ":break" + compile_fill_jump_to_end(&scope->se_u.se_while.ws_end_label, + instr->ga_len, cctx); + } + + mnv_free(scope); + + return arg; +} + +/* + * Get the current information about variables declared inside a loop. + * Returns TRUE if there are any and fills "lvi". + */ + int +get_loop_var_info(cctx_T *cctx, loopvarinfo_T *lvi) +{ + scope_T *scope = cctx->ctx_scope; + int prev_local_count = 0; + + CLEAR_POINTER(lvi); + for (;;) + { + loop_info_T *loopinfo; + int cur_local_last; + int start_local_count; + + while (scope != NULL && scope->se_type != WHILE_SCOPE + && scope->se_type != FOR_SCOPE) + scope = scope->se_outer; + if (scope == NULL) + break; + + if (scope->se_type == WHILE_SCOPE) + { + loopinfo = &scope->se_u.se_while.ws_loop_info; + // :while reserves one variable for funcref count + cur_local_last = loopinfo->li_local_count - 1; + } + else + { + loopinfo = &scope->se_u.se_for.fs_loop_info; + // :for reserves three variable: loop count, funcref count and loop + // var + cur_local_last = loopinfo->li_local_count - 3; + } + + start_local_count = loopinfo->li_local_count; + if (cctx->ctx_locals.ga_len > start_local_count) + { + lvi->lvi_loop[loopinfo->li_depth].var_idx = + (short)start_local_count; + lvi->lvi_loop[loopinfo->li_depth].var_count = + (short)(cctx->ctx_locals.ga_len - start_local_count + - prev_local_count); + if (lvi->lvi_depth == 0) + lvi->lvi_depth = loopinfo->li_depth + 1; + } + + scope = scope->se_outer; + prev_local_count = cctx->ctx_locals.ga_len - cur_local_last; + } + return lvi->lvi_depth > 0; +} + +/* + * Get the index of the variable "idx" in a loop, if any. + */ + void +get_loop_var_idx(cctx_T *cctx, int idx, lvar_T *lvar) +{ + loopvarinfo_T lvi; + + lvar->lv_loop_depth = -1; + lvar->lv_loop_idx = -1; + if (get_loop_var_info(cctx, &lvi)) + { + int depth; + + for (depth = lvi.lvi_depth - 1; depth >= 0; --depth) + if (idx >= lvi.lvi_loop[depth].var_idx + && idx < lvi.lvi_loop[depth].var_idx + + lvi.lvi_loop[depth].var_count) + { + lvar->lv_loop_depth = depth; + lvar->lv_loop_idx = lvi.lvi_loop[depth].var_idx; + return; + } + } +} + +/* + * Common for :break, :continue and :return + */ + static int +compile_find_scope( + int *loop_label, // where to jump to or NULL + endlabel_T ***el, // end label or NULL + int *try_scopes, // :try scopes encountered or NULL + char *error, // error to use when no scope found + cctx_T *cctx) +{ + scope_T *scope = cctx->ctx_scope; + + for (;;) + { + if (scope == NULL) + { + if (error != NULL) + emsg(_(error)); + return FAIL; + } + if (scope->se_type == FOR_SCOPE) + { + if (compile_loop_end(&scope->se_u.se_for.fs_loop_info, cctx) + == FAIL) + return FAIL; + if (loop_label != NULL) + *loop_label = scope->se_u.se_for.fs_top_label; + if (el != NULL) + *el = &scope->se_u.se_for.fs_end_label; + break; + } + if (scope->se_type == WHILE_SCOPE) + { + if (compile_loop_end(&scope->se_u.se_while.ws_loop_info, cctx) + == FAIL) + return FAIL; + if (loop_label != NULL) + *loop_label = scope->se_u.se_while.ws_top_label; + if (el != NULL) + *el = &scope->se_u.se_while.ws_end_label; + break; + } + if (try_scopes != NULL && scope->se_type == TRY_SCOPE) + ++*try_scopes; + scope = scope->se_outer; + } + return OK; +} + +/* + * compile "continue" + */ + char_u * +compile_continue(char_u *arg, cctx_T *cctx) +{ + int try_scopes = 0; + int loop_label; + + if (compile_find_scope(&loop_label, NULL, &try_scopes, + e_continue_without_while_or_for, cctx) == FAIL) + return NULL; + if (try_scopes > 0) + // Inside one or more try/catch blocks we first need to jump to the + // "finally" or "endtry" to cleanup. + generate_TRYCONT(cctx, try_scopes, loop_label); + else + // Jump back to the FOR or WHILE instruction. + generate_JUMP(cctx, JUMP_ALWAYS, loop_label); + + return arg; +} + +/* + * compile "break" + */ + char_u * +compile_break(char_u *arg, cctx_T *cctx) +{ + int try_scopes = 0; + endlabel_T **el; + + if (compile_find_scope(NULL, &el, &try_scopes, + e_break_without_while_or_for, cctx) == FAIL) + return NULL; + + if (cctx->ctx_skip == SKIP_YES) + return arg; + + if (try_scopes > 0) + // Inside one or more try/catch blocks we first need to jump to the + // "finally" or "endtry" to cleanup. Then come to the next JUMP + // instruction, which we don't know the index of yet. + generate_TRYCONT(cctx, try_scopes, cctx->ctx_instr.ga_len + 1); + + // Jump to the end of the FOR or WHILE loop. The instruction index will be + // filled in later. + if (compile_jump_to_end(el, JUMP_ALWAYS, 0, cctx) == FAIL) + return NULL; + + return arg; +} + +/* + * compile "{" start of block + */ + char_u * +compile_block(char_u *arg, cctx_T *cctx) +{ + if (new_scope(cctx, BLOCK_SCOPE) == NULL) + return NULL; + return skipwhite(arg + 1); +} + +/* + * compile end of block: drop one scope + */ + void +compile_endblock(cctx_T *cctx) +{ + scope_T *scope = cctx->ctx_scope; + + cctx->ctx_scope = scope->se_outer; + unwind_locals(cctx, scope->se_local_count, TRUE); + mnv_free(scope); +} + +/* + * Compile "try". + * Creates a new scope for the try-endtry, pointing to the first catch and + * finally. + * Creates another scope for the "try" block itself. + * TRY instruction sets up exception handling at runtime. + * + * "try" + * TRY -> catch1, -> finally push trystack entry + * ... try block + * "throw {exception}" + * EVAL {exception} + * THROW create exception + * ... try block + * " catch {expr}" + * JUMP -> finally + * catch1: PUSH exception + * EVAL {expr} + * MATCH + * JUMP nomatch -> catch2 + * CATCH remove exception + * ... catch block + * " catch" + * JUMP -> finally + * catch2: CATCH remove exception + * ... catch block + * " finally" + * finally: + * ... finally block + * " endtry" + * ENDTRY pop trystack entry, may rethrow + */ + char_u * +compile_try(char_u *arg, cctx_T *cctx) +{ + garray_T *instr = &cctx->ctx_instr; + scope_T *try_scope; + scope_T *scope; + + if (misplaced_cmdmod(cctx)) + return NULL; + + // scope that holds the jumps that go to catch/finally/endtry + try_scope = new_scope(cctx, TRY_SCOPE); + if (try_scope == NULL) + return NULL; + + if (cctx->ctx_skip != SKIP_YES) + { + isn_T *isn; + + // "try_catch" is set when the first ":catch" is found or when no catch + // is found and ":finally" is found. + // "try_finally" is set when ":finally" is found + // "try_endtry" is set when ":endtry" is found + try_scope->se_u.se_try.ts_try_label = instr->ga_len; + if ((isn = generate_instr(cctx, ISN_TRY)) == NULL) + return NULL; + isn->isn_arg.tryref.try_ref = ALLOC_CLEAR_ONE(tryref_T); + if (isn->isn_arg.tryref.try_ref == NULL) + return NULL; + } + + // scope for the try block itself + scope = new_scope(cctx, BLOCK_SCOPE); + if (scope == NULL) + return NULL; + + return arg; +} + +/* + * Compile "catch {expr}". + */ + char_u * +compile_catch(char_u *arg, cctx_T *cctx) +{ + scope_T *scope = cctx->ctx_scope; + garray_T *instr = &cctx->ctx_instr; + char_u *p; + isn_T *isn; + + if (misplaced_cmdmod(cctx)) + return NULL; + + // end block scope from :try or :catch + if (scope != NULL && scope->se_type == BLOCK_SCOPE) + compile_endblock(cctx); + scope = cctx->ctx_scope; + + // Error if not in a :try scope + if (scope == NULL || scope->se_type != TRY_SCOPE) + { + emsg(_(e_catch_without_try)); + return NULL; + } + + if (scope->se_u.se_try.ts_caught_all + && !ignore_unreachable_code_for_testing) + { + emsg(_(e_catch_unreachable_after_catch_all)); + return NULL; + } + if (!cctx->ctx_had_return) + scope->se_u.se_try.ts_no_return = TRUE; + + if (cctx->ctx_skip != SKIP_YES) + { +#ifdef FEAT_PROFILE + // the profile-start should be after the jump + if (cctx->ctx_compile_type == CT_PROFILE + && instr->ga_len > 0 + && ((isn_T *)instr->ga_data)[instr->ga_len - 1] + .isn_type == ISN_PROF_START) + --instr->ga_len; +#endif + // Jump from end of previous block to :finally or :endtry + if (compile_jump_to_end(&scope->se_u.se_try.ts_end_label, + JUMP_ALWAYS, 0, cctx) == FAIL) + return NULL; + + // End :try or :catch scope: set value in ISN_TRY instruction + isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_try_label; + if (isn->isn_arg.tryref.try_ref->try_catch == 0) + isn->isn_arg.tryref.try_ref->try_catch = instr->ga_len; + if (scope->se_u.se_try.ts_catch_label != 0) + { + // Previous catch without match jumps here + isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_catch_label; + isn->isn_arg.jump.jump_where = instr->ga_len; + } +#ifdef FEAT_PROFILE + if (cctx->ctx_compile_type == CT_PROFILE) + { + // a "throw" that jumps here needs to be counted + generate_instr(cctx, ISN_PROF_END); + // the "catch" is also counted + generate_instr(cctx, ISN_PROF_START); + } +#endif + if (cctx->ctx_compile_type == CT_DEBUG) + generate_instr_debug(cctx); + } + + p = skipwhite(arg); + if (ends_excmd2(arg, p)) + { + scope->se_u.se_try.ts_caught_all = TRUE; + scope->se_u.se_try.ts_catch_label = 0; + } + else + { + char_u *end; + char_u *pat; + char_u *tofree = NULL; + int dropped = 0; + int len; + + // Push v:exception, push {expr} and MATCH + generate_instr_type(cctx, ISN_PUSHEXC, &t_string); + + end = skip_regexp_ex(p + 1, *p, TRUE, &tofree, &dropped, NULL); + if (*end != *p) + { + semsg(_(e_separator_mismatch_str), p); + mnv_free(tofree); + return NULL; + } + if (tofree == NULL) + len = (int)(end - (p + 1)); + else + len = (int)(end - tofree); + pat = mnv_strnsave(tofree == NULL ? p + 1 : tofree, len); + mnv_free(tofree); + p += len + 2 + dropped; + if (pat == NULL) + return NULL; + if (generate_PUSHS(cctx, &pat) == FAIL) + return NULL; + + if (generate_COMPARE(cctx, EXPR_MATCH, FALSE) == FAIL) + return NULL; + + scope->se_u.se_try.ts_catch_label = instr->ga_len; + if (generate_JUMP(cctx, JUMP_IF_FALSE, 0) == FAIL) + return NULL; + } + + if (cctx->ctx_skip != SKIP_YES && generate_instr(cctx, ISN_CATCH) == NULL) + return NULL; + + if (new_scope(cctx, BLOCK_SCOPE) == NULL) + return NULL; + return p; +} + + char_u * +compile_finally(char_u *arg, cctx_T *cctx) +{ + scope_T *scope = cctx->ctx_scope; + garray_T *instr = &cctx->ctx_instr; + isn_T *isn; + int this_instr; + + if (misplaced_cmdmod(cctx)) + return NULL; + + // end block scope from :try or :catch + if (scope != NULL && scope->se_type == BLOCK_SCOPE) + compile_endblock(cctx); + scope = cctx->ctx_scope; + + // Error if not in a :try scope + if (scope == NULL || scope->se_type != TRY_SCOPE) + { + emsg(_(e_finally_without_try)); + return NULL; + } + + if (cctx->ctx_skip != SKIP_YES) + { + // End :catch or :finally scope: set value in ISN_TRY instruction + isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_try_label; + if (isn->isn_arg.tryref.try_ref->try_finally != 0) + { + emsg(_(e_multiple_finally)); + return NULL; + } + + this_instr = instr->ga_len; +#ifdef FEAT_PROFILE + if (cctx->ctx_compile_type == CT_PROFILE + && ((isn_T *)instr->ga_data)[this_instr - 1] + .isn_type == ISN_PROF_START) + { + // jump to the profile start of the "finally" + --this_instr; + + // jump to the profile end above it + if (this_instr > 0 && ((isn_T *)instr->ga_data)[this_instr - 1] + .isn_type == ISN_PROF_END) + --this_instr; + } +#endif + + // Fill in the "end" label in jumps at the end of the blocks. + compile_fill_jump_to_end(&scope->se_u.se_try.ts_end_label, + this_instr, cctx); + + // If there is no :catch then an exception jumps to :finally. + if (isn->isn_arg.tryref.try_ref->try_catch == 0) + isn->isn_arg.tryref.try_ref->try_catch = this_instr; + isn->isn_arg.tryref.try_ref->try_finally = this_instr; + if (scope->se_u.se_try.ts_catch_label != 0) + { + // Previous catch without match jumps here + isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_catch_label; + isn->isn_arg.jump.jump_where = this_instr; + scope->se_u.se_try.ts_catch_label = 0; + } + scope->se_u.se_try.ts_has_finally = TRUE; + if (generate_instr(cctx, ISN_FINALLY) == NULL) + return NULL; + } + + return arg; +} + + char_u * +compile_endtry(char_u *arg, cctx_T *cctx) +{ + scope_T *scope = cctx->ctx_scope; + garray_T *instr = &cctx->ctx_instr; + isn_T *try_isn; + + if (misplaced_cmdmod(cctx)) + return NULL; + + // end block scope from :catch or :finally + if (scope != NULL && scope->se_type == BLOCK_SCOPE) + compile_endblock(cctx); + scope = cctx->ctx_scope; + + // Error if not in a :try scope + if (scope == NULL || scope->se_type != TRY_SCOPE) + { + if (scope == NULL) + emsg(_(e_endtry_without_try)); + else if (scope->se_type == WHILE_SCOPE) + emsg(_(e_missing_endwhile)); + else if (scope->se_type == FOR_SCOPE) + emsg(_(e_missing_endfor)); + else + emsg(_(e_missing_endif)); + return NULL; + } + + try_isn = ((isn_T *)instr->ga_data) + scope->se_u.se_try.ts_try_label; + if (cctx->ctx_skip != SKIP_YES) + { + if (try_isn->isn_arg.tryref.try_ref->try_catch == 0 + && try_isn->isn_arg.tryref.try_ref->try_finally == 0) + { + emsg(_(e_missing_catch_or_finally)); + return NULL; + } + +#ifdef FEAT_PROFILE + if (cctx->ctx_compile_type == CT_PROFILE + && ((isn_T *)instr->ga_data)[instr->ga_len - 1] + .isn_type == ISN_PROF_START) + // move the profile start after "endtry" so that it's not counted when + // the exception is rethrown. + --instr->ga_len; +#endif + + // Fill in the "end" label in jumps at the end of the blocks, if not + // done by ":finally". + compile_fill_jump_to_end(&scope->se_u.se_try.ts_end_label, + instr->ga_len, cctx); + + if (scope->se_u.se_try.ts_catch_label != 0) + { + // Last catch without match jumps here + isn_T *isn = ((isn_T *)instr->ga_data) + + scope->se_u.se_try.ts_catch_label; + isn->isn_arg.jump.jump_where = instr->ga_len; + } + } + + // If there is a finally clause that ends in return then we will return. + // If one of the blocks didn't end in "return" or we did not catch all + // exceptions reset the had_return flag. + if (!(scope->se_u.se_try.ts_has_finally && cctx->ctx_had_return) + && (scope->se_u.se_try.ts_no_return + || !scope->se_u.se_try.ts_caught_all)) + cctx->ctx_had_return = FALSE; + + compile_endblock(cctx); + + if (cctx->ctx_skip != SKIP_YES) + { + // End :catch or :finally scope: set instruction index in ISN_TRY + // instruction + try_isn->isn_arg.tryref.try_ref->try_endtry = instr->ga_len; + if (generate_instr(cctx, ISN_ENDTRY) == NULL) + return NULL; +#ifdef FEAT_PROFILE + if (cctx->ctx_compile_type == CT_PROFILE) + generate_instr(cctx, ISN_PROF_START); +#endif + } + return arg; +} + +/* + * compile "throw {expr}" + */ + char_u * +compile_throw(char_u *arg, cctx_T *cctx) +{ + char_u *p = skipwhite(arg); + + if (compile_expr0(&p, cctx) == FAIL) + return NULL; + if (cctx->ctx_skip == SKIP_YES) + return p; + if (may_generate_2STRING(-1, TOSTRING_NONE, cctx) == FAIL) + return NULL; + if (generate_instr_drop(cctx, ISN_THROW, 1) == NULL) + return NULL; + + return p; +} + +/* + * Compile an expression or function call. + */ + char_u * +compile_eval(char_u *arg, cctx_T *cctx) +{ + char_u *p = arg; + int name_only; + long lnum = SOURCING_LNUM; + + // find_ex_command() will consider a variable name an expression, assuming + // that something follows on the next line. Check that something actually + // follows, otherwise it's probably a misplaced command. + name_only = cmd_is_name_only(arg); + + if (compile_expr0(&p, cctx) == FAIL) + return NULL; + + if (name_only && lnum == SOURCING_LNUM) + { + semsg(_(e_expression_without_effect_str), arg); + return NULL; + } + + // drop the result + generate_instr_drop(cctx, ISN_DROP, 1); + + return skipwhite(p); +} + +/* + * Get the local variable index for deferred function calls. + * Reserve it when not done already. + * Returns zero for failure. + */ + int +get_defer_var_idx(cctx_T *cctx) +{ + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + cctx->ctx_ufunc->uf_dfunc_idx; + if (dfunc->df_defer_var_idx == 0) + { + lvar_T *lvar = reserve_local(cctx, (char_u *)"@defer@", 7, + TRUE, &t_list_any); + if (lvar == NULL) + return 0; + dfunc->df_defer_var_idx = lvar->lv_idx + 1; + } + return dfunc->df_defer_var_idx; +} + +/* + * Compile "defer func(arg)". + */ + char_u * +compile_defer(char_u *arg_start, cctx_T *cctx) +{ + char_u *paren; + char_u *arg = arg_start; + int argcount = 0; + int defer_var_idx; + type_T *type = NULL; + int func_idx = -1; + + if (*arg == '(') + { + // a lambda function + if (compile_lambda(&arg, cctx) != OK) + return NULL; + paren = mnv_strchr(arg, '('); + if (paren == NULL) + { + semsg(_(e_missing_parenthesis_str), arg); + return NULL; + } + } + else + { + // Get a funcref for the function name. + // TODO: better way to find the "(". + paren = mnv_strchr(arg, '('); + if (paren == NULL) + { + semsg(_(e_missing_parenthesis_str), arg); + return NULL; + } + *paren = NUL; + func_idx = find_internal_func(arg); + if (func_idx >= 0) + // TODO: better type + generate_PUSHFUNC(cctx, (char_u *)internal_func_name(func_idx), + &t_func_any, FALSE); + else if (compile_expr0(&arg, cctx) == FAIL) + return NULL; + *paren = '('; + } + + // check for function type + if (cctx->ctx_skip != SKIP_YES) + { + type = get_type_on_stack(cctx, 0); + if (type->tt_type != VAR_FUNC) + { + emsg(_(e_function_name_required)); + return NULL; + } + } + + // compile the arguments + arg = skipwhite(paren + 1); + if (compile_arguments(&arg, cctx, &argcount, CA_NOT_SPECIAL) == FAIL) + return NULL; + + if (cctx->ctx_skip != SKIP_YES) + { + if (func_idx >= 0) + { + type2_T *argtypes = NULL; + type2_T shuffled_argtypes[MAX_FUNC_ARGS]; + + if (check_internal_func_args(cctx, func_idx, argcount, FALSE, + &argtypes, shuffled_argtypes) == FAIL) + return NULL; + } + else if (check_func_args_from_type(cctx, type, argcount, TRUE, + arg_start) == FAIL) + return NULL; + + defer_var_idx = get_defer_var_idx(cctx); + if (defer_var_idx == 0) + return NULL; + if (generate_DEFER(cctx, defer_var_idx - 1, argcount) == FAIL) + return NULL; + } + + return skipwhite(arg); +} + +/* + * compile "echo expr" + * compile "echomsg expr" + * compile "echoerr expr" + * compile "echoconsole expr" + * compile "echowindow expr" - may have cmd_count set + * compile "execute expr" + */ + char_u * +compile_mult_expr( + char_u *arg, + int cmdidx, + long cmd_count UNUSED, + cctx_T *cctx) +{ + char_u *p = arg; + char_u *prev = arg; + char_u *expr_start; + int count = 0; + int start_ctx_lnum = cctx->ctx_lnum; + type_T *type; + int r = OK; + + for (;;) + { + if (ends_excmd2(prev, p)) + break; + expr_start = p; + if (compile_expr0(&p, cctx) == FAIL) + return NULL; + + if (cctx->ctx_skip != SKIP_YES) + { + // check for non-void type + type = get_type_on_stack(cctx, 0); + if (type->tt_type == VAR_VOID) + { + semsg(_(e_expression_does_not_result_in_value_str), expr_start); + return NULL; + } + } + + ++count; + prev = p; + p = skipwhite(p); + } + + if (count > 0) + { + long save_lnum = cctx->ctx_lnum; + + // Use the line number where the command started. + cctx->ctx_lnum = start_ctx_lnum; + + if (cmdidx == CMD_echo || cmdidx == CMD_echon) + r = generate_ECHO(cctx, cmdidx == CMD_echo, count); + else if (cmdidx == CMD_execute) + r = generate_MULT_EXPR(cctx, ISN_EXECUTE, count); + else if (cmdidx == CMD_echomsg) + r = generate_MULT_EXPR(cctx, ISN_ECHOMSG, count); +#ifdef HAS_MESSAGE_WINDOW + else if (cmdidx == CMD_echowindow) + r = generate_ECHOWINDOW(cctx, count, cmd_count); +#endif + else if (cmdidx == CMD_echoconsole) + r = generate_MULT_EXPR(cctx, ISN_ECHOCONSOLE, count); + else + r = generate_MULT_EXPR(cctx, ISN_ECHOERR, count); + + cctx->ctx_lnum = save_lnum; + } + return r == OK ? p : NULL; +} + +/* + * If "eap" has a range that is not a constant generate an ISN_RANGE + * instruction to compute it and return OK. + * Otherwise return FAIL, the caller must deal with any range. + */ + static int +compile_variable_range(exarg_T *eap, cctx_T *cctx) +{ + char_u *range_end = skip_range(eap->cmd, TRUE, NULL); + char_u *p = skipdigits(eap->cmd); + + if (p == range_end) + return FAIL; + return generate_RANGE(cctx, mnv_strnsave(eap->cmd, range_end - eap->cmd)); +} + +/* + * :put r + * :put ={expr} + * or if fixindent == TRUE + * :iput r + * :iput ={expr} + */ + char_u * +compile_put(char_u *arg, exarg_T *eap, cctx_T *cctx, int fixindent) +{ + char_u *line = arg; + linenr_T lnum; + char *errormsg; + int above = eap->forceit; + + eap->regname = *line; + + if (eap->regname == '=') + { + char_u *p = skipwhite(line + 1); + + if (compile_expr0(&p, cctx) == FAIL) + return NULL; + line = p; + } + else if (eap->regname != NUL) + ++line; + + if (compile_variable_range(eap, cctx) == OK) + { + lnum = above ? LNUM_VARIABLE_RANGE_ABOVE : LNUM_VARIABLE_RANGE; + } + else + { + // Either no range or a number. + // "errormsg" will not be set because the range is ADDR_LINES. + if (parse_cmd_address(eap, &errormsg, FALSE) == FAIL) + // cannot happen + return NULL; + if (eap->addr_count == 0) + lnum = -1; + else + lnum = eap->line2; + if (above) + --lnum; + } + + generate_PUT(cctx, eap->regname, lnum, fixindent); + + return line; +} + +/* + * A command that is not compiled, execute with legacy code. + */ + char_u * +compile_exec(char_u *line_arg, exarg_T *eap, cctx_T *cctx) +{ + char_u *line = line_arg; + char_u *p; + int has_expr = FALSE; + char_u *nextcmd = (char_u *)""; + char_u *tofree = NULL; + char_u *cmd_arg = NULL; + + if (cctx->ctx_skip == SKIP_YES) + goto theend; + + // If there was a prececing command modifier, drop it and include it in the + // EXEC command. + if (cctx->ctx_has_cmdmod) + { + garray_T *instr = &cctx->ctx_instr; + isn_T *isn = ((isn_T *)instr->ga_data) + instr->ga_len - 1; + + if (isn->isn_type == ISN_CMDMOD) + { + mnv_regfree(isn->isn_arg.cmdmod.cf_cmdmod + ->cmod_filter_regmatch.regprog); + mnv_free(isn->isn_arg.cmdmod.cf_cmdmod); + --instr->ga_len; + cctx->ctx_has_cmdmod = FALSE; + } + } + + if (eap->cmdidx >= 0 && eap->cmdidx < CMD_SIZE) + { + long argt = eap->argt; + int usefilter = FALSE; + + has_expr = argt & (EX_XFILE | EX_EXPAND); + + // If the command can be followed by a bar, find the bar and truncate + // it, so that the following command can be compiled. + // The '|' is overwritten with a NUL, it is put back below. + if ((eap->cmdidx == CMD_write || eap->cmdidx == CMD_read) + && *eap->arg == '!') + // :w !filter or :r !filter or :r! filter + usefilter = TRUE; + if ((argt & EX_TRLBAR) && !usefilter) + { + eap->argt = argt; + separate_nextcmd(eap, TRUE); + if (eap->nextcmd != NULL) + nextcmd = eap->nextcmd; + } + else if (eap->cmdidx == CMD_wincmd) + { + p = eap->arg; + if (*p != NUL) + ++p; + if (*p == 'g' || *p == Ctrl_G) + ++p; + p = skipwhite(p); + if (*p == '|') + { + *p = NUL; + nextcmd = p + 1; + } + } + else if (eap->cmdidx == CMD_command || eap->cmdidx == CMD_autocmd) + { + // If there is a trailing '{' read lines until the '}' + p = eap->arg + STRLEN(eap->arg) - 1; + while (p > eap->arg && MNV_ISWHITE(*p)) + --p; + if (*p == '{') + { + exarg_T ea; + int flags = 0; // unused + int start_lnum = SOURCING_LNUM; + + CLEAR_FIELD(ea); + ea.arg = eap->arg; + fill_exarg_from_cctx(&ea, cctx); + (void)may_get_cmd_block(&ea, p, &tofree, &flags); + if (tofree != NULL) + { + *p = NUL; + line = concat_str(line, tofree); + if (line == NULL) + goto theend; + mnv_free(tofree); + tofree = line; + SOURCING_LNUM = start_lnum; + } + } + } + } + + if (eap->cmdidx == CMD_syntax && STRNCMP(eap->arg, "include ", 8) == 0) + { + // expand filename in "syntax include [@group] filename" + has_expr = TRUE; + eap->arg = skipwhite(eap->arg + 7); + if (*eap->arg == '@') + eap->arg = skiptowhite(eap->arg); + } + + if ((eap->cmdidx == CMD_global || eap->cmdidx == CMD_vglobal) + && STRLEN(eap->arg) > 4) + { + int delim = *eap->arg; + + p = skip_regexp_ex(eap->arg + 1, delim, TRUE, NULL, NULL, NULL); + if (*p == delim) + cmd_arg = p + 1; + } + + if (eap->cmdidx == CMD_folddoopen || eap->cmdidx == CMD_folddoclosed) + cmd_arg = eap->arg; + + if (cmd_arg != NULL) + { + exarg_T nea; + + CLEAR_FIELD(nea); + nea.cmd = cmd_arg; + p = find_ex_command(&nea, NULL, lookup_scriptitem, NULL); + if (nea.cmdidx < CMD_SIZE) + { + has_expr = excmd_get_argt(nea.cmdidx) & (EX_XFILE | EX_EXPAND); + if (has_expr) + eap->arg = skiptowhite(eap->arg); + } + } + + if (has_expr && (p = (char_u *)strstr((char *)eap->arg, "`=")) != NULL) + { + int count = 0; + char_u *start = skipwhite(line); + + // :cmd xxx`=expr1`yyy`=expr2`zzz + // PUSHS ":cmd xxx" + // eval expr1 + // PUSHS "yyy" + // eval expr2 + // PUSHS "zzz" + // EXECCONCAT 5 + for (;;) + { + if (p > start) + { + char_u *val = mnv_strnsave(start, p - start); + + generate_PUSHS(cctx, &val); + ++count; + } + p += 2; + if (compile_expr0(&p, cctx) == FAIL) + return NULL; + may_generate_2STRING(-1, TOSTRING_TOLERANT, cctx); + ++count; + p = skipwhite(p); + if (*p != '`') + { + emsg(_(e_missing_backtick)); + return NULL; + } + start = p + 1; + + p = (char_u *)strstr((char *)start, "`="); + if (p == NULL) + { + if (*skipwhite(start) != NUL) + { + char_u *val = mnv_strsave(start); + + generate_PUSHS(cctx, &val); + ++count; + } + break; + } + } + generate_EXECCONCAT(cctx, count); + } + else + generate_EXEC_copy(cctx, ISN_EXEC, line); + +theend: + if (*nextcmd != NUL) + { + // the parser expects a pointer to the bar, put it back + --nextcmd; + *nextcmd = '|'; + } + mnv_free(tofree); + + return nextcmd; +} + +/* + * A script command with heredoc, e.g. + * ruby << EOF + * command + * EOF + * Has been turned into one long line with NL characters by + * get_function_body(): + * ruby << EOF commandEOF + */ + char_u * +compile_script(char_u *line, cctx_T *cctx) +{ + if (cctx->ctx_skip != SKIP_YES) + { + isn_T *isn; + + if ((isn = generate_instr(cctx, ISN_EXEC_SPLIT)) == NULL) + return NULL; + isn->isn_arg.string = mnv_strsave(line); + } + return (char_u *)""; +} + + +/* + * :s/pat/repl/ + */ + char_u * +compile_substitute(char_u *arg, exarg_T *eap, cctx_T *cctx) +{ + char_u *cmd = eap->arg; + char_u *expr = (char_u *)strstr((char *)cmd, "\\="); + + if (expr != NULL) + { + int delimiter = *cmd++; + + // There is a \=expr, find it in the substitute part. + cmd = skip_regexp_ex(cmd, delimiter, magic_isset(), NULL, NULL, NULL); + if (cmd[0] == delimiter && cmd[1] == '\\' && cmd[2] == '=') + { + garray_T save_ga = cctx->ctx_instr; + char_u *end; + int expr_res; + int trailing_error; + int instr_count; + isn_T *instr; + isn_T *isn; + + cmd += 3; + end = skip_substitute(cmd, delimiter); + + // Temporarily reset the list of instructions so that the jump + // labels are correct. + cctx->ctx_instr.ga_len = 0; + cctx->ctx_instr.ga_maxlen = 0; + cctx->ctx_instr.ga_data = NULL; + expr_res = compile_expr0(&cmd, cctx); + if (end[-1] == NUL) + end[-1] = delimiter; + cmd = skipwhite(cmd); + trailing_error = *cmd != delimiter && *cmd != NUL; + + if (expr_res == FAIL || trailing_error + || GA_GROW_FAILS(&cctx->ctx_instr, 1)) + { + if (trailing_error) + semsg(_(e_trailing_characters_str), cmd); + clear_instr_ga(&cctx->ctx_instr); + cctx->ctx_instr = save_ga; + return NULL; + } + + // Move the generated instructions into the ISN_SUBSTITUTE + // instructions, then restore the list of instructions before + // adding the ISN_SUBSTITUTE instruction. + instr_count = cctx->ctx_instr.ga_len; + instr = cctx->ctx_instr.ga_data; + instr[instr_count].isn_type = ISN_FINISH; + + cctx->ctx_instr = save_ga; + if ((isn = generate_instr(cctx, ISN_SUBSTITUTE)) == NULL) + { + int idx; + + for (idx = 0; idx < instr_count; ++idx) + delete_instr(instr + idx); + mnv_free(instr); + return NULL; + } + isn->isn_arg.subs.subs_cmd = mnv_strsave(arg); + isn->isn_arg.subs.subs_instr = instr; + + // skip over flags + if (*end == '&') + ++end; + while (ASCII_ISALPHA(*end) || *end == '#') + ++end; + return end; + } + } + + return compile_exec(arg, eap, cctx); +} + + char_u * +compile_redir(char_u *line, exarg_T *eap, cctx_T *cctx) +{ + char_u *arg = eap->arg; + lhs_T *lhs = &cctx->ctx_redir_lhs; + + if (lhs->lhs_name != NULL) + { + if (STRNCMP(arg, "END", 3) == 0) + { + if (cctx->ctx_skip != SKIP_YES) + { + if (lhs->lhs_append) + { + // First load the current variable value. + if (compile_load_lhs_with_index(lhs, lhs->lhs_whole, + cctx) == FAIL) + return NULL; + } + + // Gets the redirected text and put it on the stack, then store + // it in the variable. + generate_instr_type(cctx, ISN_REDIREND, &t_string); + + if (lhs->lhs_append) + generate_CONCAT(cctx, 2); + + if (lhs->lhs_has_index) + { + // Use the info in "lhs" to store the value at the index in + // the list or dict. + if (compile_assign_unlet(lhs->lhs_whole, lhs, TRUE, + &t_string, cctx) == FAIL) + return NULL; + } + else if (generate_store_lhs(cctx, lhs, -1, FALSE) == FAIL) + return NULL; + + MNV_CLEAR(lhs->lhs_name); + MNV_CLEAR(lhs->lhs_whole); + } + return arg + 3; + } + emsg(_(e_cannot_nest_redir)); + return NULL; + } + + if (arg[0] == '=' && arg[1] == '>') + { + int append = FALSE; + + // redirect to a variable is compiled + arg += 2; + if (*arg == '>') + { + ++arg; + append = TRUE; + } + arg = skipwhite(arg); + + if (compile_assign_lhs(arg, lhs, CMD_redir, + FALSE, FALSE, FALSE, 1, cctx) == FAIL) + return NULL; + if (need_type(&t_string, lhs->lhs_member_type, 0, + -1, 0, cctx, FALSE, FALSE) == FAIL) + return NULL; + if (cctx->ctx_skip == SKIP_YES) + { + MNV_CLEAR(lhs->lhs_name); + } + else + { + generate_instr(cctx, ISN_REDIRSTART); + lhs->lhs_append = append; + if (lhs->lhs_has_index) + { + lhs->lhs_whole = mnv_strnsave(arg, lhs->lhs_varlen_total); + if (lhs->lhs_whole == NULL) + return NULL; + } + } + + return arg + lhs->lhs_varlen_total; + } + + // other redirects are handled like at script level + return compile_exec(line, eap, cctx); +} + +#if defined(FEAT_QUICKFIX) + char_u * +compile_cexpr(char_u *line, exarg_T *eap, cctx_T *cctx) +{ + isn_T *isn; + char_u *p; + + isn = generate_instr(cctx, ISN_CEXPR_AUCMD); + if (isn == NULL) + return NULL; + isn->isn_arg.number = eap->cmdidx; + + p = eap->arg; + if (compile_expr0(&p, cctx) == FAIL) + return NULL; + + isn = generate_instr(cctx, ISN_CEXPR_CORE); + if (isn == NULL) + return NULL; + isn->isn_arg.cexpr.cexpr_ref = ALLOC_ONE(cexprref_T); + if (isn->isn_arg.cexpr.cexpr_ref == NULL) + return NULL; + isn->isn_arg.cexpr.cexpr_ref->cer_cmdidx = eap->cmdidx; + isn->isn_arg.cexpr.cexpr_ref->cer_forceit = eap->forceit; + isn->isn_arg.cexpr.cexpr_ref->cer_cmdline = mnv_strsave(skipwhite(line)); + + return p; +} +#endif + +/* + * Compile "return [expr]". + * When "legacy" is TRUE evaluate [expr] with legacy syntax + */ + char_u * +compile_return(char_u *arg, int check_return_type, int legacy, cctx_T *cctx) +{ + char_u *p = arg; + type_T *stack_type; + + if (*p != NUL && *p != '|' && *p != '\n' + && (legacy || !mnv9_comment_start(p))) + { + // For a lambda, "return expr" is always used, also when "expr" results + // in a void. + if (cctx->ctx_ufunc->uf_ret_type->tt_type == VAR_VOID + && (cctx->ctx_ufunc->uf_flags & FC_LAMBDA) == 0) + { + emsg(_(e_returning_value_in_function_without_return_type)); + return NULL; + } + if (legacy) + { + int save_flags = cmdmod.cmod_flags; + + generate_LEGACY_EVAL(cctx, p); + if (need_type(&t_any, cctx->ctx_ufunc->uf_ret_type, 0, -1, + 0, cctx, FALSE, FALSE) == FAIL) + return NULL; + cmdmod.cmod_flags |= CMOD_LEGACY; + (void)skip_expr(&p, NULL); + cmdmod.cmod_flags = save_flags; + } + else + { + // compile return argument into instructions + if (compile_expr0(&p, cctx) == FAIL) + return NULL; + } + + if (cctx->ctx_skip != SKIP_YES) + { + // "check_return_type" with uf_ret_type set to &t_unknown is used + // for an inline function without a specified return type. Set the + // return type here. + stack_type = get_type_on_stack(cctx, 0); + if (check_type_is_value(stack_type) == FAIL) + return NULL; + if ((check_return_type && (cctx->ctx_ufunc->uf_ret_type == NULL + || cctx->ctx_ufunc->uf_ret_type == &t_unknown)) + || (!check_return_type + && cctx->ctx_ufunc->uf_ret_type == &t_unknown)) + { + cctx->ctx_ufunc->uf_ret_type = stack_type; + } + else + { + if (need_type(stack_type, cctx->ctx_ufunc->uf_ret_type, 0, + -1, 0, cctx, FALSE, FALSE) == FAIL) + return NULL; + } + } + } + else + { + // "check_return_type" cannot be TRUE, only used for a lambda which + // always has an argument. + if (cctx->ctx_ufunc->uf_ret_type->tt_type != VAR_VOID + && cctx->ctx_ufunc->uf_ret_type->tt_type != VAR_UNKNOWN) + { + emsg(_(e_missing_return_value)); + return NULL; + } + + if (IS_CONSTRUCTOR_METHOD(cctx->ctx_ufunc)) + { + // For a class new() constructor, return an object of the class. + generate_instr(cctx, ISN_RETURN_OBJECT); + cctx->ctx_ufunc->uf_ret_type = + &cctx->ctx_ufunc->uf_class->class_object_type; + } + else + // No argument, return zero. + generate_PUSHNR(cctx, 0); + } + + // may need ENDLOOP when inside a :for or :while loop + if (compile_find_scope(NULL, NULL, NULL, NULL, cctx) == FAIL) + + // Undo any command modifiers. + generate_undo_cmdmods(cctx); + + if (cctx->ctx_skip != SKIP_YES && generate_instr(cctx, ISN_RETURN) == NULL) + return NULL; + + // "return val | endif" is possible + return skipwhite(p); +} + +/* + * Check if the separator for a :global or :substitute command is OK. + */ + int +check_global_and_subst(char_u *cmd, char_u *arg) +{ + if (arg == cmd + 1 && mnv_strchr((char_u *)":-.", *arg) != NULL) + { + semsg(_(e_separator_not_supported_str), arg); + return FAIL; + } + if (MNV_ISWHITE(cmd[1])) + { + semsg(_(e_no_white_space_allowed_before_separator_str), cmd); + return FAIL; + } + return OK; +} + + +#endif // defined(FEAT_EVAL) diff --git a/uvim/src/mnv9compile.c b/uvim/src/mnv9compile.c new file mode 100644 index 0000000000..7fa79dceee --- /dev/null +++ b/uvim/src/mnv9compile.c @@ -0,0 +1,5280 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * MNV - MNV is not Vim by Bram Moolenaar + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. + */ + +/* + * mnv9compile.c: compiling a :def function + */ + +#define USING_FLOAT_STUFF +#include "mnv.h" + +#if defined(FEAT_EVAL) + +// Functions defined with :def are stored in this growarray. +// They are never removed, so that they can be found by index. +// Deleted functions have the df_deleted flag set. +garray_T def_functions = {0, 0, sizeof(dfunc_T), 50, NULL}; + +static void delete_def_function_contents(dfunc_T *dfunc, int mark_deleted); + +/* + * Lookup variable "name" in the local scope and return it in "lvar". + * "lvar->lv_from_outer" is incremented accordingly. + * If "lvar" is NULL only check if the variable can be found. + * Return FAIL if not found. + */ + int +lookup_local(char_u *name, size_t len, lvar_T *lvar, cctx_T *cctx) +{ + int idx; + lvar_T *lvp; + + if (len == 0) + return FAIL; + + if (((len == 4 && STRNCMP(name, "this", 4) == 0) + || (len == 5 && STRNCMP(name, "super", 5) == 0)) + && cctx->ctx_ufunc != NULL + && (cctx->ctx_ufunc->uf_flags & (FC_OBJECT|FC_NEW))) + { + int is_super = *name == 's'; + if (is_super) + { + if (name[5] != '.') + { + emsg(_(e_super_must_be_followed_by_dot)); + return FAIL; + } + if (cctx->ctx_ufunc->uf_class != NULL + && cctx->ctx_ufunc->uf_class->class_extends == NULL) + { + emsg(_(e_using_super_not_in_child_class)); + return FAIL; + } + } + if (lvar != NULL) + { + CLEAR_POINTER(lvar); + lvar->lv_loop_depth = -1; + lvar->lv_name = (char_u *)(is_super ? "super" : "this"); + if (cctx->ctx_ufunc->uf_class != NULL) + { + lvar->lv_type = &cctx->ctx_ufunc->uf_class->class_object_type; + if (is_super) + { + type_T *type = get_type_ptr(cctx->ctx_type_list); + + if (type != NULL) + { + *type = *lvar->lv_type; + lvar->lv_type = type; + type->tt_flags |= TTFLAG_SUPER; + } + } + } + } + return OK; + } + + // Find local in current function scope. + for (idx = 0; idx < cctx->ctx_locals.ga_len; ++idx) + { + lvp = ((lvar_T *)cctx->ctx_locals.ga_data) + idx; + if (lvp->lv_name != NULL + && STRNCMP(name, lvp->lv_name, len) == 0 + && STRLEN(lvp->lv_name) == len) + { + if (lvar != NULL) + { + *lvar = *lvp; + lvar->lv_from_outer = 0; + // If the variable was declared inside a loop set + // lvar->lv_loop_idx and lvar->lv_loop_depth. + get_loop_var_idx(cctx, idx, lvar); + } + return OK; + } + } + + // Find local in outer function scope. + if (cctx->ctx_outer != NULL) + { + if (lookup_local(name, len, lvar, cctx->ctx_outer) == OK) + { + if (lvar != NULL) + { + cctx->ctx_outer_used = TRUE; + ++lvar->lv_from_outer; + } + return OK; + } + } + + return FAIL; +} + +/* + * Lookup an argument in the current function and an enclosing function. + * Returns the argument index in "idxp" + * Returns the argument type in "type" + * Sets "gen_load_outer" to TRUE if found in outer scope. + * Returns OK when found, FAIL otherwise. + */ + int +arg_exists( + char_u *name, + size_t len, + int *idxp, + type_T **type, + int *gen_load_outer, + cctx_T *cctx) +{ + int idx; + char_u *va_name; + + if (len == 0) + return FAIL; + for (idx = 0; idx < cctx->ctx_ufunc->uf_args_visible; ++idx) + { + char_u *arg = FUNCARG(cctx->ctx_ufunc, idx); + + if (STRNCMP(name, arg, len) == 0 && arg[len] == NUL) + { + if (idxp != NULL) + { + // Arguments are located above the frame pointer. One further + // if there is a vararg argument + *idxp = idx - (cctx->ctx_ufunc->uf_args.ga_len + + STACK_FRAME_SIZE) + + (cctx->ctx_ufunc->uf_va_name != NULL ? -1 : 0); + + if (cctx->ctx_ufunc->uf_arg_types != NULL) + *type = cctx->ctx_ufunc->uf_arg_types[idx]; + else + *type = &t_any; + } + return OK; + } + } + + va_name = cctx->ctx_ufunc->uf_va_name; + if (va_name != NULL + && STRNCMP(name, va_name, len) == 0 && va_name[len] == NUL) + { + if (idxp != NULL) + { + // varargs is always the last argument + *idxp = -STACK_FRAME_SIZE - 1; + *type = cctx->ctx_ufunc->uf_va_type; + } + return OK; + } + + if (cctx->ctx_outer != NULL) + { + // Lookup the name for an argument of the outer function. + if (arg_exists(name, len, idxp, type, gen_load_outer, cctx->ctx_outer) + == OK) + { + if (gen_load_outer != NULL) + ++*gen_load_outer; + return OK; + } + } + + return FAIL; +} + +/* + * Lookup a script-local variable in the current script, possibly defined in a + * block that contains the function "cctx->ctx_ufunc". + * "cctx" is NULL at the script level, "cstack" is NULL in a function. + * If "len" is <= 0 "name" must be NUL terminated. + * Return NULL when not found. + */ + static sallvar_T * +find_script_var(char_u *name, size_t len, cctx_T *cctx, cstack_T *cstack) +{ + scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid); + hashitem_T *hi; + int cc; + sallvar_T *sav; + ufunc_T *ufunc; + + // Find the list of all script variables with the right name. + if (len > 0) + { + cc = name[len]; + name[len] = NUL; + } + hi = hash_find(&si->sn_all_vars.dv_hashtab, name); + if (len > 0) + name[len] = cc; + if (HASHITEM_EMPTY(hi)) + return NULL; + + sav = HI2SAV(hi); + if (sav->sav_block_id == 0) + // variable defined in the top script scope is always visible + return sav; + + if (cctx == NULL) + { + if (cstack == NULL) + return NULL; + + // Not in a function scope, find variable with block ID equal to or + // smaller than the current block id. Use "cstack" to go up the block + // scopes. + while (sav != NULL) + { + int idx; + + for (idx = cstack->cs_idx; idx >= 0; --idx) + if (cstack->cs_block_id[idx] == sav->sav_block_id) + break; + if (idx >= 0) + break; + sav = sav->sav_next; + } + return sav; + } + + // Go over the variables with this name and find one that was visible + // from the function. + ufunc = cctx->ctx_ufunc; + while (sav != NULL) + { + int idx; + + // Go over the blocks that this function was defined in. If the + // variable block ID matches it was visible to the function. + for (idx = 0; idx < ufunc->uf_block_depth; ++idx) + if (ufunc->uf_block_ids[idx] == sav->sav_block_id) + return sav; + sav = sav->sav_next; + } + + // Not found, variable was not visible. + return NULL; +} + +/* + * If "name" can be found in the current script set it's "block_id". + */ + void +update_script_var_block_id(char_u *name, int block_id) +{ + scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid); + hashitem_T *hi; + sallvar_T *sav; + + hi = hash_find(&si->sn_all_vars.dv_hashtab, name); + if (HASHITEM_EMPTY(hi)) + return; + sav = HI2SAV(hi); + sav->sav_block_id = block_id; +} + +/* + * Lookup a variable (without s: prefix) in the current script. + * "cctx" is NULL at the script level, "cstack" is NULL in a function. + * Returns OK or FAIL. + */ + int +script_var_exists(char_u *name, size_t len, cctx_T *cctx, cstack_T *cstack) +{ + if (current_sctx.sc_sid <= 0) + return FAIL; + if (current_script_is_mnv9()) + { + // Check script variables that were visible where the function was + // defined. + if (find_script_var(name, len, cctx, cstack) != NULL) + return OK; + } + else + { + hashtab_T *ht = &SCRIPT_VARS(current_sctx.sc_sid); + dictitem_T *di; + int cc; + + // Check script variables that are currently visible + cc = name[len]; + name[len] = NUL; + di = find_var_in_ht(ht, 0, name, TRUE); + name[len] = cc; + if (di != NULL) + return OK; + } + + return FAIL; +} + +/* + * Returns the index of a class method or class variable with name "name" + * accessible in the currently compiled function. + * If "cl_ret" is not NULL set it to the class. + * Otherwise return -1. + */ + static int +cctx_class_midx( + cctx_T *cctx, + int is_method, + char_u *name, + size_t len, + class_T **cl_ret) +{ + if (cctx == NULL || cctx->ctx_ufunc == NULL + || cctx->ctx_ufunc->uf_class == NULL + || cctx->ctx_ufunc->uf_defclass == NULL) + return -1; + + // Search for the class method or variable in the class where the calling + // function is defined. + class_T *cl = cctx->ctx_ufunc->uf_defclass; + int m_idx = is_method ? class_method_idx(cl, name, len) + : class_member_idx(cl, name, len); + if (m_idx < 0) + { + cl = cl->class_extends; + while (cl != NULL) + { + m_idx = is_method ? class_method_idx(cl, name, len) + : class_member_idx(cl, name, len); + if (m_idx >= 0) + break; + cl = cl->class_extends; + } + } + + if (m_idx >= 0) + { + if (cl_ret != NULL) + *cl_ret = cl; + } + + return m_idx; +} + +/* + * Returns the index of a class method with name "name" accessible in the + * currently compiled function. Returns -1 if not found. The class where the + * method is defined is returned in "cl_ret". + */ + int +cctx_class_method_idx( + cctx_T *cctx, + char_u *name, + size_t len, + class_T **cl_ret) +{ + return cctx_class_midx(cctx, TRUE, name, len, cl_ret); +} + +/* + * Returns the index of a class variable with name "name" accessible in the + * currently compiled function. Returns -1 if not found. The class where the + * variable is defined is returned in "cl_ret". + */ + int +cctx_class_member_idx( + cctx_T *cctx, + char_u *name, + size_t len, + class_T **cl_ret) +{ + return cctx_class_midx(cctx, FALSE, name, len, cl_ret); +} + +/* + * Return TRUE if "name" is a local variable, argument, script variable or + * imported. Also if "name" is "this" and in a class method. + */ + static int +variable_exists(char_u *name, size_t len, cctx_T *cctx) +{ + return (cctx != NULL + && (lookup_local(name, len, NULL, cctx) == OK + || arg_exists(name, len, NULL, NULL, NULL, cctx) == OK + || (len == 4 + && cctx->ctx_ufunc != NULL + && (cctx->ctx_ufunc->uf_flags & (FC_OBJECT|FC_NEW)) + && STRNCMP(name, "this", 4) == 0))) + || script_var_exists(name, len, cctx, NULL) == OK + || cctx_class_member_idx(cctx, name, len, NULL) >= 0 + || find_imported(name, len, FALSE) != NULL; +} + +/* + * Return TRUE if "name" is a local variable, argument, script variable, + * imported or function. Or commands are being skipped, a declaration may have + * been skipped then. + */ + static int +item_exists(char_u *name, size_t len, int cmd UNUSED, cctx_T *cctx) +{ + return variable_exists(name, len, cctx); +} + +/* + * Check if "p[len]" is already defined, either in script "import_sid" or in + * compilation context "cctx". + * "cctx" is NULL at the script level, "cstack" is NULL in a function. + * Does not check the global namespace. + * If "is_arg" is TRUE the error message is for an argument name. + * Return FAIL and give an error if it defined. + */ + int +check_defined( + char_u *p, + size_t len, + cctx_T *cctx, + cstack_T *cstack, + int is_arg) +{ + int c = p[len]; + ufunc_T *ufunc = NULL; + + // underscore argument is OK + if (len == 1 && *p == '_') + return OK; + + if (script_var_exists(p, len, cctx, cstack) == OK) + { + if (is_arg) + semsg(_(e_argument_already_declared_in_script_str), p); + else + semsg(_(e_variable_already_declared_in_script_str), p); + return FAIL; + } + + if (cctx_class_member_idx(cctx, p, len, NULL) >= 0) + { + if (is_arg) + semsg(_(e_argument_already_declared_in_class_str), p); + else + semsg(_(e_variable_already_declared_in_class_str), p); + return FAIL; + } + + p[len] = NUL; + if ((cctx != NULL + && (lookup_local(p, len, NULL, cctx) == OK + || arg_exists(p, len, NULL, NULL, NULL, cctx) == OK)) + || find_imported(p, len, FALSE) != NULL + || (ufunc = find_func_even_dead(p, 0)) != NULL) + { + // A local or script-local function can shadow a global function. + if (ufunc == NULL || ((ufunc->uf_flags & FC_DEAD) == 0 + && (!func_is_global(ufunc) + || (p[0] == 'g' && p[1] == ':')))) + { + if (is_arg) + semsg(_(e_argument_name_shadows_existing_variable_str), p); + else + semsg(_(e_name_already_defined_str), p); + p[len] = c; + return FAIL; + } + } + p[len] = c; + return OK; +} + + +/* + * Return TRUE if "actual" could be "expected" and a runtime typecheck is to be + * used. Return FALSE if the types will never match. + */ + static int +use_typecheck(type_T *actual, type_T *expected) +{ + if (actual->tt_type == VAR_ANY + || actual->tt_type == VAR_UNKNOWN + || (actual->tt_type == VAR_FUNC + && (expected->tt_type == VAR_FUNC + || expected->tt_type == VAR_PARTIAL) + && (actual->tt_member == &t_any + || actual->tt_member == &t_unknown + || actual->tt_argcount < 0) + && (actual->tt_member == &t_unknown || + (actual->tt_member == &t_void) + == (expected->tt_member == &t_void)))) + return TRUE; + if (actual->tt_type == VAR_OBJECT && expected->tt_type == VAR_OBJECT) + return TRUE; + if ((actual->tt_type == VAR_LIST + || actual->tt_type == VAR_TUPLE + || actual->tt_type == VAR_DICT) + && actual->tt_type == expected->tt_type) + // This takes care of a nested list or dict. + return use_typecheck(actual->tt_member, expected->tt_member); + return FALSE; +} + +/* + * Check that + * - "actual" matches "expected" type or + * - "actual" is a type that can be "expected" type: add a runtime check; or + * - return FAIL. + * If "actual_is_const" is TRUE then the type won't change at runtime, do not + * generate a TYPECHECK. + * If "typechk_flags" has TYPECHK_NUMBER_OK, then a number is accepted for + * a float. + * If "typechk_flags" has TYPECHK_TUPLE_OK, then a tuple is accepted for a + * list. + */ + int +need_type_where( + type_T *actual, + type_T *expected, + int typechk_flags, // acceptable types (type check flags) + int offset, + where_T where, + cctx_T *cctx, + int silent, + int actual_is_const) +{ + int ret; + + if (expected->tt_type != VAR_CLASS && expected->tt_type != VAR_TYPEALIAS) + { + if (check_type_is_value(actual) == FAIL) + return FAIL; + } + + if (expected == &t_bool && actual != &t_bool + && (actual->tt_flags & TTFLAG_BOOL_OK)) + { + // Using "0", "1" or the result of an expression with "&&" or "||" as a + // boolean is OK but requires a conversion. + generate_2BOOL(cctx, FALSE, offset); + return OK; + } + + ret = check_type_maybe(expected, actual, FALSE, where); + if (ret == OK) + return OK; + + // If actual a constant a runtime check makes no sense. If it's + // null_function it is OK. + if (actual_is_const && ret == MAYBE && actual == &t_func_unknown) + return OK; + + // If the actual type can be the expected type add a runtime check. + if (!actual_is_const && ret == MAYBE && use_typecheck(actual, expected)) + { + generate_TYPECHECK(cctx, expected, typechk_flags, offset, + where.wt_kind == WT_VARIABLE, where.wt_index); + return OK; + } + + if (!silent) + type_mismatch_where(expected, actual, where); + return FAIL; +} + + int +need_type( + type_T *actual, + type_T *expected, + int typechk_flags, // acceptable types (type check flags) + int offset, + int arg_idx, + cctx_T *cctx, + int silent, + int actual_is_const) +{ + where_T where = WHERE_INIT; + + if (arg_idx > 0) + { + where.wt_index = arg_idx; + where.wt_kind = WT_ARGUMENT; + } + return need_type_where(actual, expected, typechk_flags, offset, where, + cctx, silent, actual_is_const); +} + +/* + * Set type of variable "lvar" to "type". If the variable is a constant then + * the type gets TTFLAG_CONST. + */ + static void +set_var_type(lvar_T *lvar, type_T *type_arg, cctx_T *cctx) +{ + type_T *type = type_arg; + + if (lvar->lv_const == ASSIGN_CONST && (type->tt_flags & TTFLAG_CONST) == 0) + { + if (type->tt_flags & TTFLAG_STATIC) + // entry in static_types[] is followed by const type + type = type + 1; + else + { + type = copy_type(type, cctx->ctx_type_list); + type->tt_flags |= TTFLAG_CONST; + } + } + lvar->lv_type = type; +} + +/* + * Reserve space for a local variable. + * "assign" can be ASSIGN_VAR for :var, ASSIGN_CONST for :const and + * ASSIGN_FINAL for :final. + * Return the variable or NULL if it failed. + */ + lvar_T * +reserve_local( + cctx_T *cctx, + char_u *name, + size_t len, + int assign, + type_T *type) +{ + lvar_T *lvar; + dfunc_T *dfunc; + + if (arg_exists(name, len, NULL, NULL, NULL, cctx) == OK) + { + emsg_namelen(_(e_str_is_used_as_argument), name, (int)len); + return NULL; + } + + if (GA_GROW_FAILS(&cctx->ctx_locals, 1)) + return NULL; + lvar = ((lvar_T *)cctx->ctx_locals.ga_data) + cctx->ctx_locals.ga_len++; + CLEAR_POINTER(lvar); + + // Every local variable uses the next entry on the stack. We could re-use + // the last ones when leaving a scope, but then variables used in a closure + // might get overwritten. To keep things simple do not re-use stack + // entries. This is less efficient, but memory is cheap these days. + dfunc = ((dfunc_T *)def_functions.ga_data) + cctx->ctx_ufunc->uf_dfunc_idx; + lvar->lv_idx = dfunc->df_var_names.ga_len; + + lvar->lv_name = mnv_strnsave(name, len == 0 ? STRLEN(name) : len); + lvar->lv_const = assign; + if (type == &t_unknown || type == &t_any) + // type not known yet, may be inferred from RHS + lvar->lv_type = type; + else + // may use TTFLAG_CONST + set_var_type(lvar, type, cctx); + + // Remember the name for debugging. + if (GA_GROW_FAILS(&dfunc->df_var_names, 1)) + return NULL; + ((char_u **)dfunc->df_var_names.ga_data)[lvar->lv_idx] = + mnv_strsave(lvar->lv_name); + ++dfunc->df_var_names.ga_len; + + return lvar; +} + +/* + * If "check_writable" is ASSIGN_CONST give an error if the variable was + * defined with :final or :const, if "check_writable" is ASSIGN_FINAL give an + * error if the variable was defined with :const. + */ + static int +check_item_writable(svar_T *sv, int check_writable, char_u *name) +{ + if ((check_writable == ASSIGN_CONST && sv->sv_const != 0) + || (check_writable == ASSIGN_FINAL + && sv->sv_const == ASSIGN_CONST)) + { + semsg(_(e_cannot_change_readonly_variable_str), name); + return FAIL; + } + return OK; +} + +/* + * Find "name" in script-local items of script "sid". + * Pass "check_writable" to check_item_writable(). + * "cctx" is NULL at the script level, "cstack" is NULL in a function. + * Returns the index in "sn_var_vals" if found. + * If found but not in "sn_var_vals" returns -1. + * If not found or the variable is not writable returns -2. + */ + int +get_script_item_idx( + int sid, + char_u *name, + int check_writable, + cctx_T *cctx, + cstack_T *cstack) +{ + hashtab_T *ht; + dictitem_T *di; + scriptitem_T *si = SCRIPT_ITEM(sid); + svar_T *sv; + int idx; + + if (!SCRIPT_ID_VALID(sid)) + return -1; + if (sid == current_sctx.sc_sid) + { + sallvar_T *sav = find_script_var(name, 0, cctx, cstack); + + if (sav == NULL) + return -2; + idx = sav->sav_var_vals_idx; + sv = ((svar_T *)si->sn_var_vals.ga_data) + idx; + if (check_item_writable(sv, check_writable, name) == FAIL) + return -2; + return idx; + } + + // First look the name up in the hashtable. + ht = &SCRIPT_VARS(sid); + di = find_var_in_ht(ht, 0, name, TRUE); + if (di == NULL) + { + if (si->sn_autoload_prefix != NULL) + { + hashitem_T *hi; + + // A variable exported from an autoload script is in the global + // variables, we can find it in the all_vars table. + hi = hash_find(&si->sn_all_vars.dv_hashtab, name); + if (!HASHITEM_EMPTY(hi)) + return HI2SAV(hi)->sav_var_vals_idx; + } + return -2; + } + + // Now find the svar_T index in sn_var_vals. + for (idx = 0; idx < si->sn_var_vals.ga_len; ++idx) + { + sv = ((svar_T *)si->sn_var_vals.ga_data) + idx; + if (sv->sv_tv == &di->di_tv) + { + if (check_item_writable(sv, check_writable, name) == FAIL) + return -2; + return idx; + } + } + return -1; +} + + static imported_T * +find_imported_in_script(char_u *name, size_t len, int sid) +{ + scriptitem_T *si; + int idx; + + if (!SCRIPT_ID_VALID(sid)) + return NULL; + si = SCRIPT_ITEM(sid); + for (idx = 0; idx < si->sn_imports.ga_len; ++idx) + { + imported_T *import = ((imported_T *)si->sn_imports.ga_data) + idx; + + if (len == 0 ? STRCMP(name, import->imp_name) == 0 + : STRLEN(import->imp_name) == len + && STRNCMP(name, import->imp_name, len) == 0) + return import; + } + return NULL; +} + +/* + * Find "name" in imported items of the current script. + * If "len" is 0 use any length that works. + * If "load" is TRUE and the script was not loaded yet, load it now. + */ + imported_T * +find_imported(char_u *name, size_t len, int load) +{ + if (!SCRIPT_ID_VALID(current_sctx.sc_sid)) + return NULL; + + // Skip over "s:" before "s:something" to find the import name. + int off = name[0] == 's' && name[1] == ':' ? 2 : 0; + + imported_T *ret = find_imported_in_script(name + off, len - off, + current_sctx.sc_sid); + if (ret != NULL && load && (ret->imp_flags & IMP_FLAGS_AUTOLOAD)) + { + scid_T actual_sid = 0; + int save_emsg_off = emsg_off; + + // "emsg_off" will be set when evaluating an expression silently, but + // we do want to know about errors in a script. Also because it then + // aborts when an error is encountered. + emsg_off = FALSE; + + // script found before but not loaded yet + ret->imp_flags &= ~IMP_FLAGS_AUTOLOAD; + (void)do_source(SCRIPT_ITEM(ret->imp_sid)->sn_name, FALSE, + DOSO_NONE, &actual_sid); + // If the script is a symlink it may be sourced with another name, may + // need to adjust the script ID for that. + if (actual_sid != 0) + ret->imp_sid = actual_sid; + + emsg_off = save_emsg_off; + } + return ret; +} + +/* + * Called when checking for a following operator at "arg". When the rest of + * the line is empty or only a comment, peek the next line. If there is a next + * line return a pointer to it and set "nextp". + * Otherwise skip over white space. + */ + char_u * +may_peek_next_line(cctx_T *cctx, char_u *arg, char_u **nextp) +{ + char_u *p = skipwhite(arg); + + *nextp = NULL; + if (*p == NUL || (MNV_ISWHITE(*arg) && mnv9_comment_start(p))) + { + *nextp = peek_next_line_from_context(cctx); + if (*nextp != NULL) + return *nextp; + } + return p; +} + +/* + * Return a pointer to the next line that isn't empty or only contains a + * comment. Skips over white space. + * Returns NULL if there is none. + */ + char_u * +peek_next_line_from_context(cctx_T *cctx) +{ + int lnum = cctx->ctx_lnum; + + while (++lnum < cctx->ctx_ufunc->uf_lines.ga_len) + { + char_u *line = ((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)[lnum]; + char_u *p; + + // ignore NULLs inserted for continuation lines + if (line != NULL) + { + p = skipwhite(line); + if (mnv9_bad_comment(p)) + return NULL; + if (*p != NUL && !mnv9_comment_start(p)) + return p; + } + } + return NULL; +} + +/* + * Get the next line of the function from "cctx". + * Skips over empty lines. Skips over comment lines if "skip_comment" is TRUE. + * Returns NULL when at the end. + */ + char_u * +next_line_from_context(cctx_T *cctx, int skip_comment) +{ + char_u *line; + + do + { + ++cctx->ctx_lnum; + if (cctx->ctx_lnum >= cctx->ctx_ufunc->uf_lines.ga_len) + { + line = NULL; + break; + } + line = ((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)[cctx->ctx_lnum]; + cctx->ctx_line_start = line; + SOURCING_LNUM = cctx->ctx_lnum + 1; + } while (line == NULL || *skipwhite(line) == NUL + || (skip_comment && mnv9_comment_start(skipwhite(line)))); + return line; +} + +/* + * Skip over white space at "whitep" and assign to "*arg". + * If "*arg" is at the end of the line, advance to the next line. + * Also when "whitep" points to white space and "*arg" is on a "#". + * Return FAIL if beyond the last line, "*arg" is unmodified then. + */ + int +may_get_next_line(char_u *whitep, char_u **arg, cctx_T *cctx) +{ + *arg = skipwhite(whitep); + if (mnv9_bad_comment(*arg)) + return FAIL; + if (**arg == NUL || (MNV_ISWHITE(*whitep) && mnv9_comment_start(*arg))) + { + char_u *next = next_line_from_context(cctx, TRUE); + + if (next == NULL) + return FAIL; + *arg = skipwhite(next); + } + return OK; +} + +/* + * Idem, and give an error when failed. + */ + int +may_get_next_line_error(char_u *whitep, char_u **arg, cctx_T *cctx) +{ + if (may_get_next_line(whitep, arg, cctx) == FAIL) + { + SOURCING_LNUM = cctx->ctx_lnum + 1; + emsg(_(e_line_incomplete)); + return FAIL; + } + return OK; +} + +/* + * Get a line from the compilation context, compatible with exarg_T getline(). + * Return a pointer to the line in allocated memory. + * Return NULL for end-of-file or some error. + */ + static char_u * +exarg_getline( + int c UNUSED, + void *cookie, + int indent UNUSED, + getline_opt_T options UNUSED) +{ + cctx_T *cctx = (cctx_T *)cookie; + char_u *p; + + for (;;) + { + if (cctx->ctx_lnum >= cctx->ctx_ufunc->uf_lines.ga_len - 1) + return NULL; + ++cctx->ctx_lnum; + p = ((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)[cctx->ctx_lnum]; + // Comment lines result in NULL pointers, skip them. + if (p != NULL) + return mnv_strsave(p); + } +} + + void +fill_exarg_from_cctx(exarg_T *eap, cctx_T *cctx) +{ + eap->ea_getline = exarg_getline; + eap->cookie = cctx; + eap->skip = cctx->ctx_skip == SKIP_YES; +} + +/* + * Return TRUE if "ufunc" should be compiled, taking into account whether + * "profile" indicates profiling is to be done. + */ + int +func_needs_compiling(ufunc_T *ufunc, compiletype_T compile_type) +{ + switch (ufunc->uf_def_status) + { + case UF_TO_BE_COMPILED: + return TRUE; + + case UF_COMPILED: + { + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + ufunc->uf_dfunc_idx; + + switch (compile_type) + { + case CT_PROFILE: +#ifdef FEAT_PROFILE + return dfunc->df_instr_prof == NULL; +#endif + case CT_NONE: + return dfunc->df_instr == NULL; + case CT_DEBUG: + return dfunc->df_instr_debug == NULL; + } + } + + case UF_NOT_COMPILED: + case UF_COMPILE_ERROR: + case UF_COMPILING: + break; + } + return FALSE; +} + +/* + * Compile a nested :def command. + */ + static char_u * +compile_nested_function(exarg_T *eap, cctx_T *cctx, garray_T *lines_to_free) +{ + int is_global = *eap->arg == 'g' && eap->arg[1] == ':'; + char_u *name_start = eap->arg; + char_u *name_end = to_name_end(eap->arg, TRUE); + int off; + char_u *func_name; + string_T lambda_name; + ufunc_T *ufunc; + int r = FAIL; + compiletype_T compile_type; + int funcref_isn_idx = -1; + lvar_T *lvar = NULL; + char_u *bracket_start = NULL; + + if (eap->forceit) + { + semsg(_(e_cannot_use_bang_with_nested_def_str), + eap->cmdidx == CMD_def ? ":def" : ":function"); + return NULL; + } + + if (*name_start == '/') + { + name_end = skip_regexp(name_start + 1, '/', TRUE); + if (*name_end == '/') + ++name_end; + set_nextcmd(eap, name_end); + } + + if (*name_end == '<') + { + bracket_start = name_end; + if (skip_generic_func_type_args(&name_end) == FAIL) + return NULL; + } + + if (name_end == name_start || *skipwhite(name_end) != '(') + { + if (!ends_excmd2(name_start, name_end)) + { + if (*skipwhite(name_end) == '.') + semsg(_(e_cannot_define_dict_func_in_mnv9_script_str), + eap->cmd); + else + semsg(_(e_invalid_command_str), eap->cmd); + return NULL; + } + + // "def" or "def Name": list functions + if (generate_DEF(cctx, name_start, name_end - name_start) == FAIL) + return NULL; + return eap->nextcmd == NULL ? (char_u *)"" : eap->nextcmd; + } + + if (bracket_start != NULL) + // generic function. The function name ends before the list of types + // (opening angle bracket). + name_end = bracket_start; + + // Only g:Func() can use a namespace. + if (name_start[1] == ':' && !is_global) + { + semsg(_(e_namespace_not_supported_str), name_start); + return NULL; + } + if (cctx->ctx_skip != SKIP_YES + && check_defined(name_start, name_end - name_start, cctx, + NULL, FALSE) == FAIL) + return NULL; + if (!ASCII_ISUPPER(is_global ? name_start[2] : name_start[0])) + { + semsg(_(e_function_name_must_start_with_capital_str), name_start); + return NULL; + } + + eap->arg = name_end; + fill_exarg_from_cctx(eap, cctx); + + eap->forceit = FALSE; + // We use the special 99 name, but it's not really a lambda. + lambda_name = get_lambda_name(); + lambda_name.string = mnv_strnsave(lambda_name.string, lambda_name.length); + if (lambda_name.string == NULL) + return NULL; + + // This may free the current line, make a copy of the name. + off = is_global ? 2 : 0; + func_name = mnv_strnsave(name_start + off, name_end - name_start - off); + if (func_name == NULL) + { + r = FAIL; + goto theend; + } + + // Make sure "KeyTyped" is not set, it may cause indent to be written. + int save_KeyTyped = KeyTyped; + KeyTyped = FALSE; + + ufunc = define_function(eap, lambda_name.string, lines_to_free, 0, NULL, 0, + cctx); + + KeyTyped = save_KeyTyped; + + if (ufunc == NULL) + { + r = eap->skip ? OK : FAIL; + goto theend; + } + if (eap->nextcmd != NULL) + { + semsg(_(e_text_found_after_str_str), + eap->cmdidx == CMD_def ? "enddef" : "endfunction", eap->nextcmd); + r = FAIL; + func_ptr_unref(ufunc); + goto theend; + } + + // copy over the block scope IDs before compiling + if (!is_global && cctx->ctx_ufunc->uf_block_depth > 0) + { + int block_depth = cctx->ctx_ufunc->uf_block_depth; + + ufunc->uf_block_ids = ALLOC_MULT(int, block_depth); + if (ufunc->uf_block_ids != NULL) + { + mch_memmove(ufunc->uf_block_ids, cctx->ctx_ufunc->uf_block_ids, + sizeof(int) * block_depth); + ufunc->uf_block_depth = block_depth; + } + } + + // Define the funcref before compiling, so that it is found by any + // recursive call. + if (is_global) + { + r = generate_NEWFUNC(cctx, lambda_name.string, func_name); + func_name = NULL; + lambda_name.string = NULL; + lambda_name.length = 0; + } + else + { + // Define a local variable for the function reference. + lvar = reserve_local(cctx, func_name, name_end - name_start, + ASSIGN_CONST, ufunc->uf_func_type); + if (lvar == NULL) + goto theend; + if (generate_FUNCREF(cctx, ufunc, NULL, FALSE, 0, &funcref_isn_idx) == FAIL) + goto theend; + r = generate_STORE(cctx, ISN_STORE, lvar->lv_idx, NULL); + } + + compile_type = get_compile_type(ufunc); +#ifdef FEAT_PROFILE + // If the outer function is profiled, also compile the nested function for + // profiling. + if (cctx->ctx_compile_type == CT_PROFILE) + compile_type = CT_PROFILE; +#endif + if (func_needs_compiling(ufunc, compile_type) + && compile_def_function(ufunc, TRUE, compile_type, cctx) == FAIL) + { + func_ptr_unref(ufunc); + if (lvar != NULL) + // Now the local variable can't be used. + *lvar->lv_name = '/'; // impossible value + goto theend; + } + +#ifdef FEAT_PROFILE + // When the outer function is compiled for profiling, the nested function + // may be called without profiling. Compile it here in the right context. + if (compile_type == CT_PROFILE && func_needs_compiling(ufunc, CT_NONE)) + compile_def_function(ufunc, FALSE, CT_NONE, cctx); +#endif + + // If a FUNCREF instruction was generated, set the index after compiling. + if (funcref_isn_idx != -1 && ufunc->uf_def_status == UF_COMPILED) + { + isn_T *funcref_isn = ((isn_T *)cctx->ctx_instr.ga_data) + + funcref_isn_idx; + funcref_isn->isn_arg.funcref.fr_dfunc_idx = ufunc->uf_dfunc_idx; + } + +theend: + mnv_free(lambda_name.string); + mnv_free(func_name); + return r == FAIL ? NULL : (char_u *)""; +} + +/* + * Compile one MNV expression {expr} in string "p". + * "p" points to the opening "{". + * Return a pointer to the character after "}", NULL for an error. + */ + char_u * +compile_one_expr_in_str(char_u *p, cctx_T *cctx) +{ + char_u *block_start; + char_u *block_end; + + // Skip the opening {. + block_start = skipwhite(p + 1); + block_end = block_start; + if (*block_start != NUL && skip_expr(&block_end, NULL) == FAIL) + return NULL; + block_end = skipwhite(block_end); + // The block must be closed by a }. + if (*block_end != '}') + { + semsg(_(e_missing_close_curly_str), p); + return NULL; + } + if (compile_expr0(&block_start, cctx) == FAIL) + return NULL; + may_generate_2STRING(-1, TOSTRING_INTERPOLATE, cctx); + + return block_end + 1; +} + +/* + * Compile a string "str" (either containing a literal string or a mix of + * literal strings and MNV expressions of the form `{expr}`). This is used + * when compiling a heredoc assignment to a variable or an interpolated string + * in a MNV9 def function. MNV9 instructions are generated to push strings, + * evaluate expressions, concatenate them and create a list of lines. When + * "evalstr" is TRUE, MNV expressions in "str" are evaluated. + */ + int +compile_all_expr_in_str(char_u *str, int evalstr, cctx_T *cctx) +{ + char_u *p = str; + char_u *val; + int count = 0; + + if (cctx->ctx_skip == SKIP_YES) + return OK; + + if (!evalstr || *str == NUL) + { + // Literal string, possibly empty. + val = *str != NUL ? mnv_strsave(str) : NULL; + return generate_PUSHS(cctx, &val); + } + + // Push all the string pieces to the stack, followed by a ISN_CONCAT. + while (*p != NUL) + { + char_u *lit_start; + int escaped_brace = FALSE; + + // Look for a block start. + lit_start = p; + while (*p != '{' && *p != '}' && *p != NUL) + ++p; + + if (*p != NUL && *p == p[1]) + { + // Escaped brace, unescape and continue. + // Include the brace in the literal string. + ++p; + escaped_brace = TRUE; + } + else if (*p == '}') + { + semsg(_(e_stray_closing_curly_str), str); + return FAIL; + } + + // Append the literal part. + if (p != lit_start) + { + val = mnv_strnsave(lit_start, (size_t)(p - lit_start)); + if (generate_PUSHS(cctx, &val) == FAIL) + return FAIL; + ++count; + } + + if (*p == NUL) + break; + + if (escaped_brace) + { + // Skip the second brace. + ++p; + continue; + } + + p = compile_one_expr_in_str(p, cctx); + if (p == NULL) + return FAIL; + ++count; + } + + // Small optimization, if there's only a single piece skip the ISN_CONCAT. + if (count > 1) + return generate_CONCAT(cctx, count); + + return OK; +} + +/* + * Return the length of an assignment operator, or zero if there isn't one. + */ + int +assignment_len(char_u *p, int *heredoc) +{ + if (*p == '=') + { + if (p[1] == '<' && p[2] == '<') + { + *heredoc = TRUE; + return 3; + } + return 1; + } + if (mnv_strchr((char_u *)"+-*/%", *p) != NULL && p[1] == '=') + return 2; + if (STRNCMP(p, "..=", 3) == 0) + return 3; + return 0; +} + +/* + * Generate the load instruction for "name". + */ + static int +generate_loadvar(cctx_T *cctx, lhs_T *lhs) +{ + char_u *name = lhs->lhs_name; + type_T *type = lhs->lhs_type; + int res = OK; + + switch (lhs->lhs_dest) + { + case dest_option: + case dest_func_option: + generate_LOAD(cctx, ISN_LOADOPT, 0, name, type); + break; + case dest_global: + if (mnv_strchr(name, AUTOLOAD_CHAR) == NULL) + { + if (name[2] == NUL) + generate_instr_type(cctx, ISN_LOADGDICT, &t_dict_any); + else + generate_LOAD(cctx, ISN_LOADG, 0, name + 2, type); + } + else + generate_LOAD(cctx, ISN_LOADAUTO, 0, name, type); + break; + case dest_buffer: + generate_LOAD(cctx, ISN_LOADB, 0, name + 2, type); + break; + case dest_window: + generate_LOAD(cctx, ISN_LOADW, 0, name + 2, type); + break; + case dest_tab: + generate_LOAD(cctx, ISN_LOADT, 0, name + 2, type); + break; + case dest_script: + case dest_script_v9: + res = compile_load_scriptvar(cctx, + name + (name[1] == ':' ? 2 : 0), NULL, NULL, NULL); + break; + case dest_env: + // Include $ in the name here + generate_LOAD(cctx, ISN_LOADENV, 0, name, type); + break; + case dest_reg: + generate_LOAD(cctx, ISN_LOADREG, name[1], NULL, &t_string); + break; + case dest_mnvvar: + generate_LOADV(cctx, name + 2); + break; + case dest_local: + if (cctx->ctx_skip != SKIP_YES) + { + lvar_T *lvar = lhs->lhs_lvar; + if (lvar->lv_from_outer > 0) + generate_LOADOUTER(cctx, lvar->lv_idx, lvar->lv_from_outer, + lvar->lv_loop_depth, lvar->lv_loop_idx, type); + else + generate_LOAD(cctx, ISN_LOAD, lvar->lv_idx, NULL, type); + } + break; + case dest_class_member: + generate_CLASSMEMBER(cctx, TRUE, lhs->lhs_class, + lhs->lhs_classmember_idx); + break; + case dest_expr: + // list or dict value should already be on the stack. + break; + } + + return res; +} + +/* + * Skip over "[expr]" or ".member". + * Does not check for any errors. + */ + static char_u * +skip_index(char_u *start) +{ + char_u *p = start; + + if (*p == '[') + { + p = skipwhite(p + 1); + (void)skip_expr(&p, NULL); + p = skipwhite(p); + if (*p == ']') + return p + 1; + return p; + } + // if (*p == '.') + return to_name_end(p + 1, TRUE); +} + + void +mnv9_declare_error(char_u *name) +{ + char *scope = ""; + + switch (*name) + { + case 'g': scope = _("global"); break; + case 'b': scope = _("buffer"); break; + case 'w': scope = _("window"); break; + case 't': scope = _("tab"); break; + case 'v': scope = "v:"; break; + case '$': semsg(_(e_cannot_declare_an_environment_variable_str), name); + return; + case '&': semsg(_(e_cannot_declare_an_option_str), name); + return; + case '@': semsg(_(e_cannot_declare_a_register_str), name); + return; + default: return; + } + semsg(_(e_cannot_declare_a_scope_variable_str), scope, name); +} + +/* + * Return TRUE if "name" is a valid register to use. + * Return FALSE and give an error message if not. + */ + static int +valid_dest_reg(int name) +{ + if (name == '@') + name = '"'; + if (name == '/' || name == '=' || valid_yank_reg(name, TRUE)) + return TRUE; + emsg_invreg(name); + return FAIL; +} + +/* + * For one assignment figure out the type of destination. Return it in "dest". + * When not recognized "dest" is not set. + * For an option "option_scope" is set. + * For a v:var "mnvvaridx" is set. + * "type" is set to the destination type if known, unchanted otherwise. + * Return FAIL if an error message was given. + */ + int +get_var_dest( + char_u *name, + assign_dest_T *dest, + cmdidx_T cmdidx, + int *option_scope, + int *mnvvaridx, + type_T **type, + cctx_T *cctx) +{ + char_u *p; + + if (*name == '&') + { + int cc; + long numval; + getoption_T opt_type; + int opt_p_flags; + + *dest = dest_option; + if (cmdidx == CMD_final || cmdidx == CMD_const) + { + emsg(_(e_cannot_lock_option)); + return FAIL; + } + p = name; + p = find_option_end(&p, option_scope); + if (p == NULL) + { + // cannot happen? + emsg(_(e_unexpected_characters_in_assignment)); + return FAIL; + } + cc = *p; + *p = NUL; + opt_type = get_option_value(skip_option_env_lead(name), + &numval, NULL, &opt_p_flags, *option_scope); + *p = cc; + switch (opt_type) + { + case gov_unknown: + semsg(_(e_unknown_option_str), name); + return FAIL; + case gov_string: + case gov_hidden_string: + if (opt_p_flags & P_FUNC) + { + // might be a Funcref, check the type later + *type = &t_any; + *dest = dest_func_option; + } + else + { + *type = &t_string; + } + break; + case gov_bool: + case gov_hidden_bool: + *type = &t_bool; + break; + case gov_number: + case gov_hidden_number: + *type = &t_number; + break; + } + } + else if (*name == '$') + { + *dest = dest_env; + *type = &t_string; + } + else if (*name == '@') + { + if (!valid_dest_reg(name[1])) + return FAIL; + *dest = dest_reg; + *type = name[1] == '#' ? &t_number_or_string : &t_string; + } + else if (STRNCMP(name, "g:", 2) == 0) + { + *dest = dest_global; + } + else if (STRNCMP(name, "b:", 2) == 0) + { + *dest = dest_buffer; + } + else if (STRNCMP(name, "w:", 2) == 0) + { + *dest = dest_window; + } + else if (STRNCMP(name, "t:", 2) == 0) + { + *dest = dest_tab; + } + else if (STRNCMP(name, "v:", 2) == 0) + { + typval_T *vtv; + int di_flags; + + *mnvvaridx = find_mnv_var(name + 2, &di_flags); + if (*mnvvaridx < 0) + { + semsg(_(e_variable_not_found_str), name); + return FAIL; + } + // We use the current value of "sandbox" here, is that OK? + if (var_check_ro(di_flags, name, FALSE)) + return FAIL; + *dest = dest_mnvvar; + vtv = get_mnv_var_tv(*mnvvaridx); + *type = typval2type_mnvvar(vtv, cctx->ctx_type_list); + } + return OK; +} + + static int +is_decl_command(cmdidx_T cmdidx) +{ + return cmdidx == CMD_let || cmdidx == CMD_var + || cmdidx == CMD_final || cmdidx == CMD_const; +} + +/* + * Returns TRUE if the class or object variable in "lhs" is modifiable. + * "var_start" points to the start of the variable name and "lhs->lhs_varlen" + * has the total length. Note that the "lhs" can be nested an object reference + * (e.g. a.b.c.d.var). + */ + static int +lhs_class_member_modifiable(lhs_T *lhs, char_u *var_start, cctx_T *cctx) +{ + size_t varlen = lhs->lhs_varlen; + class_T *cl = lhs->lhs_type->tt_class; + int is_object = lhs->lhs_type->tt_type == VAR_OBJECT; + char_u *name = var_start + varlen + 1; + size_t namelen = lhs->lhs_end - var_start - varlen - 1; + ocmember_T *m; + + m = member_lookup(cl, lhs->lhs_type->tt_type, name, namelen, NULL); + if (m == NULL) + { + member_not_found_msg(cl, lhs->lhs_type->tt_type, name, namelen); + return FALSE; + } + + if (IS_ENUM(cl)) + { + semsg(_(e_enumvalue_str_cannot_be_modified), cl->class_name.string, + m->ocm_name.string); + return FALSE; + } + + // If it is private member variable, then accessing it outside the + // class is not allowed. + // If it is a read only class variable, then it can be modified + // only inside the class where it is defined. + if ((m->ocm_access != MNV_ACCESS_ALL) && + ((is_object && !inside_class(cctx, cl)) + || (!is_object && cctx->ctx_ufunc->uf_class != cl))) + { + char *msg = (m->ocm_access == MNV_ACCESS_PRIVATE) + ? e_cannot_access_protected_variable_str + : e_variable_is_not_writable_str; + emsg_var_cl_define(msg, m->ocm_name.string, 0, cl); + return FALSE; + } + + return TRUE; +} + +/* + * Initialize "lhs" with default values + */ + static void +lhs_init_defaults(lhs_T *lhs) +{ + CLEAR_POINTER(lhs); + lhs->lhs_dest = dest_local; + lhs->lhs_mnvvaridx = -1; + lhs->lhs_scriptvar_idx = -1; + lhs->lhs_member_idx = -1; +} + +/* + * When compiling a LHS variable name, find the end of the destination and the + * end of the variable name. + */ + static int +lhs_find_var_end( + lhs_T *lhs, + char_u *var_start, + int is_decl, + char_u **var_endp) +{ + char_u *var_end = *var_endp; + + // "lhs_dest_end" is the end of the destination, including "[expr]" or + // ".name". + // "var_end" is the end of the variable/option/etc. name. + lhs->lhs_dest_end = skip_var_one(var_start, FALSE); + if (*var_start == '@') + { + if (!valid_dest_reg(var_start[1])) + return FAIL; + var_end = var_start + 2; + } + else + { + // skip over the leading "&", "&l:", "&g:" and "$" + var_end = skip_option_env_lead(var_start); + var_end = to_name_end(var_end, TRUE); + } + + // "a: type" is declaring variable "a" with a type, not dict "a:". + if (is_decl && lhs->lhs_dest_end == var_start + 2 + && lhs->lhs_dest_end[-1] == ':') + --lhs->lhs_dest_end; + if (is_decl && var_end == var_start + 2 && var_end[-1] == ':') + --var_end; + + lhs->lhs_end = lhs->lhs_dest_end; + *var_endp = var_end; + + return OK; +} + +/* + * Set various fields in "lhs" + */ + static int +lhs_init( + lhs_T *lhs, + char_u *var_start, + int is_decl, + int heredoc, + char_u **var_endp) +{ + char_u *var_end = *var_endp; + + lhs_init_defaults(lhs); + + // Find the end of the variable and the destination + if (lhs_find_var_end(lhs, var_start, is_decl, &var_end) == FAIL) + return FAIL; + + // compute the length of the destination without "[expr]" or ".name" + lhs->lhs_varlen = var_end - var_start; + lhs->lhs_varlen_total = lhs->lhs_varlen; + lhs->lhs_name = mnv_strnsave(var_start, lhs->lhs_varlen); + if (lhs->lhs_name == NULL) + return FAIL; + + if (lhs->lhs_dest_end > var_start + lhs->lhs_varlen) + // Something follows after the variable: "var[idx]" or "var.key". + lhs->lhs_has_index = TRUE; + + lhs->lhs_type = heredoc ? &t_list_string : &t_any; + + *var_endp = var_end; + + return OK; +} + +/* + * Compile a LHS class variable name. + */ + static int +compile_lhs_class_variable( + cctx_T *cctx, + lhs_T *lhs, + class_T *defcl, + int is_decl) +{ + if (cctx->ctx_ufunc->uf_defclass != defcl) + { + // A class variable can be accessed without the class name + // only inside a class. + semsg(_(e_class_variable_str_accessible_only_inside_class_str), + lhs->lhs_name, defcl->class_name.string); + return FAIL; + } + + if (is_decl) + { + semsg(_(e_variable_already_declared_in_class_str), lhs->lhs_name); + return FAIL; + } + + ocmember_T *m = &defcl->class_class_members[lhs->lhs_classmember_idx]; + if (oc_var_check_ro(defcl, m)) + return FAIL; + + lhs->lhs_dest = dest_class_member; + // The class variable is defined either in the current class or + // in one of the parent class in the hierarchy. + lhs->lhs_class = defcl; + lhs->lhs_type = oc_member_type_by_idx(defcl, FALSE, + lhs->lhs_classmember_idx); + + return OK; +} + +/* + * Compile an imported LHS variable + */ + static int +compile_lhs_import_var( + lhs_T *lhs, + imported_T *import, + char_u *var_start, + char_u **var_endp, + char_u **rawnamep) +{ + char_u *var_end = *var_endp; + char_u *dot = mnv_strchr(var_start, '.'); + char_u *p; + + // for an import the name is what comes after the dot + if (dot == NULL) + { + semsg(_(e_no_dot_after_imported_name_str), var_start); + return FAIL; + } + + p = skipwhite(dot + 1); + var_end = to_name_end(p, TRUE); + if (var_end == p) + { + semsg(_(e_missing_name_after_imported_name_str), var_start); + return FAIL; + } + + mnv_free(lhs->lhs_name); + lhs->lhs_varlen = var_end - p; + lhs->lhs_name = mnv_strnsave(p, lhs->lhs_varlen); + if (lhs->lhs_name == NULL) + return FAIL; + *rawnamep = lhs->lhs_name; + lhs->lhs_scriptvar_sid = import->imp_sid; + + // TODO: where do we check this name is exported? + + // Check if something follows: "exp.var[idx]" or + // "exp.var.key". + lhs->lhs_has_index = lhs->lhs_dest_end > skipwhite(var_end); + + *var_endp = var_end; + + return OK; +} + +/* + * Process a script-local variable when compiling a LHS variable name. + */ + static int +compile_lhs_script_var( + cctx_T *cctx, + lhs_T *lhs, + char_u *var_start, + char_u *var_end, + int is_decl) +{ + int script_namespace = FALSE; + int script_var = FALSE; + imported_T *import; + char_u *var_name; + size_t var_name_len; + + if (lhs->lhs_varlen > 1 && STRNCMP(var_start, "s:", 2) == 0) + script_namespace = TRUE; + + if (script_namespace) + { + var_name = var_start + 2; + var_name_len = lhs->lhs_varlen - 2; + } + else + { + var_name = var_start; + var_name_len = lhs->lhs_varlen; + } + + if (script_var_exists(var_name, var_name_len, cctx, NULL) == OK) + script_var = TRUE; + + import = find_imported(var_start, lhs->lhs_varlen, FALSE); + + if (script_namespace || script_var || import != NULL) + { + char_u *rawname = lhs->lhs_name + (lhs->lhs_name[1] == ':' ? 2 : 0); + + if (script_namespace && current_script_is_mnv9()) + { + semsg(_(e_cannot_use_s_colon_in_mnv9_script_str), var_start); + return FAIL; + } + + if (is_decl) + { + if (script_namespace) + semsg(_(e_cannot_declare_script_variable_in_function_str), + lhs->lhs_name); + else + semsg(_(e_variable_already_declared_in_script_str), + lhs->lhs_name); + return FAIL; + } + else if (cctx->ctx_ufunc->uf_script_ctx_version == SCRIPT_VERSION_MNV9 + && script_namespace + && !script_var && import == NULL) + { + semsg(_(e_unknown_variable_str), lhs->lhs_name); + return FAIL; + } + + lhs->lhs_dest = current_script_is_mnv9() ? dest_script_v9 : + dest_script; + + // existing script-local variables should have a type + lhs->lhs_scriptvar_sid = current_sctx.sc_sid; + if (import != NULL) + { + if (compile_lhs_import_var(lhs, import, var_start, &var_end, + &rawname) == FAIL) + return FAIL; + } + + if (SCRIPT_ID_VALID(lhs->lhs_scriptvar_sid)) + { + // Check writable only when no index follows. + lhs->lhs_scriptvar_idx = get_script_item_idx( + lhs->lhs_scriptvar_sid, rawname, + lhs->lhs_has_index ? ASSIGN_FINAL : + ASSIGN_CONST, cctx, NULL); + if (lhs->lhs_scriptvar_idx >= 0) + { + scriptitem_T *si = SCRIPT_ITEM(lhs->lhs_scriptvar_sid); + svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + + lhs->lhs_scriptvar_idx; + + lhs->lhs_type = sv->sv_type; + } + } + + return OK; + } + + return check_defined(var_start, lhs->lhs_varlen, cctx, NULL, FALSE); +} + +/* + * Compile the LHS destination. + */ + static int +compile_lhs_var_dest( + cctx_T *cctx, + lhs_T *lhs, + int cmdidx, + char_u *var_start, + char_u *var_end, + int is_decl) +{ + int declare_error = FALSE; + + if (get_var_dest(lhs->lhs_name, &lhs->lhs_dest, cmdidx, + &lhs->lhs_opt_flags, &lhs->lhs_mnvvaridx, + &lhs->lhs_type, cctx) == FAIL) + return FAIL; + + if (lhs->lhs_dest != dest_local && cmdidx != CMD_const + && cmdidx != CMD_final) + { + // Specific kind of variable recognized. + declare_error = is_decl; + } + else + { + class_T *defcl; + + // No specific kind of variable recognized, just a name. + if (check_reserved_name(lhs->lhs_name, lhs->lhs_has_index + && *var_end == '.') == FAIL) + return FAIL; + + if (lookup_local(var_start, lhs->lhs_varlen, &lhs->lhs_local_lvar, + cctx) == OK) + { + lhs->lhs_lvar = &lhs->lhs_local_lvar; + } + else + { + CLEAR_FIELD(lhs->lhs_arg_lvar); + if (arg_exists(var_start, lhs->lhs_varlen, + &lhs->lhs_arg_lvar.lv_idx, &lhs->lhs_arg_lvar.lv_type, + &lhs->lhs_arg_lvar.lv_from_outer, cctx) == OK) + { + if (is_decl) + { + semsg(_(e_str_is_used_as_argument), lhs->lhs_name); + return FAIL; + } + lhs->lhs_lvar = &lhs->lhs_arg_lvar; + } + } + + if (lhs->lhs_lvar != NULL) + { + if (is_decl) + { + // if we come here with what looks like an assignment like + // .= but which has been rejected by assignment_len() from + // may_compile_assignment give a better error message + char_u *p = skipwhite(lhs->lhs_end); + if (p[0] == '.' && p[1] == '=') + emsg(_(e_dot_equal_not_supported_with_script_version_two)); + else if (p[0] == ':') + // type specified in a non-var assignment + semsg(_(e_trailing_characters_str), p); + else + semsg(_(e_variable_already_declared_str), lhs->lhs_name); + return FAIL; + } + } + else if ((lhs->lhs_classmember_idx = cctx_class_member_idx( + cctx, var_start, lhs->lhs_varlen, &defcl)) >= 0) + { + if (compile_lhs_class_variable(cctx, lhs, defcl, is_decl) + == FAIL) + return FAIL; + } + else + { + if (compile_lhs_script_var(cctx, lhs, var_start, var_end, + is_decl) == FAIL) + return FAIL; + } + } + + if (declare_error) + { + mnv9_declare_error(lhs->lhs_name); + return FAIL; + } + + return OK; +} + +/* + * When compiling a LHS variable name, for a class or an object, set the LHS + * member type. + */ + static int +compile_lhs_set_oc_member_type( + cctx_T *cctx, + lhs_T *lhs, + char_u *var_start) +{ + class_T *cl = lhs->lhs_type->tt_class; + int is_object = lhs->lhs_type->tt_type == VAR_OBJECT; + char_u *name = var_start + lhs->lhs_varlen + 1; + size_t namelen = lhs->lhs_end - var_start - lhs->lhs_varlen - 1; + + ocmember_T *m = member_lookup(cl, lhs->lhs_type->tt_type, + name, namelen, &lhs->lhs_member_idx); + if (m == NULL) + { + member_not_found_msg(cl, lhs->lhs_type->tt_type, name, namelen); + return FAIL; + } + + if (IS_ENUM(cl)) + { + if (!inside_class(cctx, cl)) + { + semsg(_(e_enumvalue_str_cannot_be_modified), + cl->class_name.string, m->ocm_name.string); + return FAIL; + } + if (lhs->lhs_type->tt_type == VAR_OBJECT && + lhs->lhs_member_idx < 2) + { + char *msg = lhs->lhs_member_idx == 0 ? + e_enum_str_name_cannot_be_modified : + e_enum_str_ordinal_cannot_be_modified; + semsg(_(msg), cl->class_name.string); + return FAIL; + } + } + + // If it is private member variable, then accessing it outside the + // class is not allowed. + // If it is a read only class variable, then it can be modified + // only inside the class where it is defined. + if ((m->ocm_access != MNV_ACCESS_ALL) && + ((is_object && !inside_class(cctx, cl)) + || (!is_object && cctx->ctx_ufunc->uf_defclass != cl))) + { + char *msg = (m->ocm_access == MNV_ACCESS_PRIVATE) + ? e_cannot_access_protected_variable_str + : e_variable_is_not_writable_str; + emsg_var_cl_define(msg, m->ocm_name.string, 0, cl); + return FAIL; + } + + if (!IS_CONSTRUCTOR_METHOD(cctx->ctx_ufunc) + && oc_var_check_ro(cl, m)) + return FAIL; + + lhs->lhs_member_type = m->ocm_type; + + return OK; +} + +/* + * When compiling a LHS variable, set the LHS variable type. + */ + static int +compile_lhs_set_type(cctx_T *cctx, lhs_T *lhs, char_u *var_end, int is_decl) +{ + if (is_decl && *skipwhite(var_end) == ':') + { + char_u *p; + + // parse optional type: "let var: type = expr" + if (MNV_ISWHITE(*var_end)) + { + semsg(_(e_no_white_space_allowed_before_colon_str), var_end); + return FAIL; + } + + if (!MNV_ISWHITE(var_end[1])) + { + semsg(_(e_white_space_required_after_str_str), ":", var_end); + return FAIL; + } + + p = skipwhite(var_end + 1); + lhs->lhs_type = parse_type(&p, cctx->ctx_type_list, cctx->ctx_ufunc, cctx, TRUE); + if (lhs->lhs_type == NULL + || !valid_declaration_type(lhs->lhs_type)) + return FAIL; + + lhs->lhs_has_type = TRUE; + lhs->lhs_end = p; + } + else if (lhs->lhs_lvar != NULL) + lhs->lhs_type = lhs->lhs_lvar->lv_type; + + return OK; +} + +/* + * Returns TRUE if "lhs" is a concatenable string. + */ + static int +lhs_concatenable(lhs_T *lhs) +{ + return lhs->lhs_dest == dest_global + || lhs->lhs_has_index + || lhs->lhs_type->tt_type == VAR_STRING + || lhs->lhs_type->tt_type == VAR_ANY; +} + +/* + * Create a new local variable when compiling a LHS variable. + */ + static int +compile_lhs_new_local_var( + cctx_T *cctx, + lhs_T *lhs, + char_u *var_start, + int cmdidx, + int oplen, + int is_decl, + int has_cmd, + int heredoc) +{ + if (oplen > 1 && !heredoc) + { + // +=, /=, etc. require an existing variable + semsg(_(e_cannot_use_operator_on_new_variable_str), lhs->lhs_name); + return FAIL; + } + + if (!is_decl || (lhs->lhs_has_index && !has_cmd + && cctx->ctx_skip != SKIP_YES)) + { + semsg(_(e_unknown_variable_str), lhs->lhs_name); + return FAIL; + } + + // Check the name is valid for a funcref. + if (lhs->lhs_type->tt_type == VAR_FUNC + || lhs->lhs_type->tt_type == VAR_PARTIAL) + { + if (var_wrong_func_name(lhs->lhs_name, TRUE)) + return FAIL; + } + + // New local variable. + int assign; + switch (cmdidx) + { + case CMD_final: + assign = ASSIGN_FINAL; break; + case CMD_const: + assign = ASSIGN_CONST; break; + default: + assign = ASSIGN_VAR; break; + } + + lhs->lhs_lvar = reserve_local(cctx, var_start, lhs->lhs_varlen, assign, + lhs->lhs_type); + if (lhs->lhs_lvar == NULL) + return FAIL; + + lhs->lhs_new_local = TRUE; + + return OK; +} + +/* + * When compiling a LHS variable name, set the LHS member type. + */ + static int +compile_lhs_set_member_type( + cctx_T *cctx, + lhs_T *lhs, + char_u *var_start, + int is_decl, + int has_cmd) +{ + lhs->lhs_member_type = lhs->lhs_type; + + if (!lhs->lhs_has_index) + return OK; + + char_u *after = var_start + lhs->lhs_varlen; + char_u *p; + + // Something follows after the variable: "var[idx]" or "var.key". + if (is_decl && cctx->ctx_skip != SKIP_YES) + { + if (has_cmd) + emsg(_(e_cannot_use_index_when_declaring_variable)); + else + semsg(_(e_unknown_variable_str), lhs->lhs_name); + return FAIL; + } + + // Now: var_start[lhs->lhs_varlen] is '[' or '.' + // Only the last index is used below, if there are others + // before it generate code for the expression. Thus for + // "ll[1][2]" the expression is "ll[1]" and "[2]" is the index. + for (;;) + { + p = skip_index(after); + if (*p != '[' && *p != '.') + { + lhs->lhs_varlen_total = p - var_start; + break; + } + after = p; + } + if (after > var_start + lhs->lhs_varlen) + { + lhs->lhs_varlen = after - var_start; + lhs->lhs_dest = dest_expr; + // We don't know the type before evaluating the expression, + // use "any" until then. + lhs->lhs_type = &t_any; + } + + int use_class = lhs->lhs_type != NULL + && (lhs->lhs_type->tt_type == VAR_CLASS + || lhs->lhs_type->tt_type == VAR_OBJECT); + + if (lhs->lhs_type == NULL + || (use_class ? lhs->lhs_type->tt_class == NULL + : lhs->lhs_type->tt_member == NULL)) + { + lhs->lhs_member_type = &t_any; + } + else if (use_class) + { + // for an object or class member get the type of the member + if (compile_lhs_set_oc_member_type(cctx, lhs, var_start) == FAIL) + return FAIL; + } + else + lhs->lhs_member_type = lhs->lhs_type->tt_member; + + return OK; +} + +/* + * Figure out the LHS type and other properties for an assignment or one item + * of ":unlet" with an index. + * Returns OK or FAIL. + */ + int +compile_lhs( + char_u *var_start, + lhs_T *lhs, + cmdidx_T cmdidx, + int heredoc, + int has_cmd, // "var" before "var_start" + int oplen, + cctx_T *cctx) +{ + char_u *var_end = NULL; + int is_decl = is_decl_command(cmdidx); + + if (lhs_init(lhs, var_start, is_decl, heredoc, &var_end) == FAIL) + return FAIL; + + if (cctx->ctx_skip != SKIP_YES) + { + // compile the LHS destination + if (compile_lhs_var_dest(cctx, lhs, cmdidx, var_start, var_end, + is_decl) == FAIL) + return FAIL; + } + + // handle "a:name" as a name, not index "name" in "a" + if (lhs->lhs_varlen > 1 || var_start[lhs->lhs_varlen] != ':') + var_end = lhs->lhs_dest_end; + + if (lhs->lhs_dest != dest_option && lhs->lhs_dest != dest_func_option) + { + // set the LHS variable type + if (compile_lhs_set_type(cctx, lhs, var_end, is_decl) == FAIL) + return FAIL; + } + + if (oplen == 3 && !heredoc && !lhs_concatenable(lhs)) + { + emsg(_(e_can_only_concatenate_to_string)); + return FAIL; + } + + if (lhs->lhs_lvar == NULL && lhs->lhs_dest == dest_local + && cctx->ctx_skip != SKIP_YES) + { + if (compile_lhs_new_local_var(cctx, lhs, var_start, cmdidx, oplen, + is_decl, has_cmd, heredoc) == FAIL) + return FAIL; + } + + if (compile_lhs_set_member_type(cctx, lhs, var_start, is_decl, has_cmd) + == FAIL) + return FAIL; + + return OK; +} + +/* + * Figure out the LHS and check a few errors. + */ + int +compile_assign_lhs( + char_u *var_start, + lhs_T *lhs, + cmdidx_T cmdidx, + int is_decl, + int heredoc, + int has_cmd, // "var" before "var_start" + int oplen, + cctx_T *cctx) +{ + if (compile_lhs(var_start, lhs, cmdidx, heredoc, has_cmd, oplen, cctx) + == FAIL) + return FAIL; + + if (!lhs->lhs_has_index && lhs->lhs_lvar == &lhs->lhs_arg_lvar) + { + semsg(_(e_cannot_assign_to_argument_str), lhs->lhs_name); + return FAIL; + } + if (!is_decl && lhs->lhs_lvar != NULL + && lhs->lhs_lvar->lv_const != ASSIGN_VAR + && !lhs->lhs_has_index) + { + semsg(_(e_cannot_assign_to_constant_str), lhs->lhs_name); + return FAIL; + } + return OK; +} + +/* + * Return TRUE if "lhs" has a range index: "[expr : expr]". + */ + static int +has_list_index(char_u *idx_start, cctx_T *cctx) +{ + char_u *p = idx_start; + int save_skip; + + if (*p != '[') + return FALSE; + + p = skipwhite(p + 1); + if (*p == ':') + return TRUE; + + save_skip = cctx->ctx_skip; + cctx->ctx_skip = SKIP_YES; + (void)compile_expr0(&p, cctx); + cctx->ctx_skip = save_skip; + return *skipwhite(p) == ':'; +} + +/* + * For an assignment with an index, compile the "idx" in "var[idx]" or "key" in + * "var.key". + */ + static int +compile_assign_index( + char_u *var_start, + lhs_T *lhs, + int *range, + cctx_T *cctx) +{ + size_t varlen = lhs->lhs_varlen; + char_u *p; + int r = OK; + int need_white_before = TRUE; + int empty_second; + + p = var_start + varlen; + if (*p == '[') + { + p = skipwhite(p + 1); + if (*p == ':') + { + // empty first index, push zero + r = generate_PUSHNR(cctx, 0); + need_white_before = FALSE; + } + else + r = compile_expr0(&p, cctx); + + if (r == OK && *skipwhite(p) == ':') + { + // unlet var[idx : idx] + // blob[idx : idx] = value + *range = TRUE; + p = skipwhite(p); + empty_second = *skipwhite(p + 1) == ']'; + if ((need_white_before && !IS_WHITE_OR_NUL(p[-1])) + || (!empty_second && !IS_WHITE_OR_NUL(p[1]))) + { + semsg(_(e_white_space_required_before_and_after_str_at_str), + ":", p); + return FAIL; + } + p = skipwhite(p + 1); + if (*p == ']') + // empty second index, push "none" + r = generate_PUSHSPEC(cctx, VVAL_NONE); + else + r = compile_expr0(&p, cctx); + } + + if (r == OK && *skipwhite(p) != ']') + { + // this should not happen + emsg(_(e_missing_closing_square_brace)); + r = FAIL; + } + } + else if (lhs->lhs_member_idx >= 0) + { + // object member index + r = generate_PUSHNR(cctx, lhs->lhs_member_idx); + } + else // if (*p == '.') + { + char_u *key_end = to_name_end(p + 1, TRUE); + char_u *key = mnv_strnsave(p + 1, key_end - p - 1); + + r = generate_PUSHS(cctx, &key); + } + return r; +} + +/* + * For a LHS with an index, load the variable to be indexed. + */ + static int +compile_load_lhs( + lhs_T *lhs, + char_u *var_start, + type_T *rhs_type, + cctx_T *cctx) +{ + if (lhs->lhs_dest == dest_expr) + { + size_t varlen = lhs->lhs_varlen; + int c = var_start[varlen]; + int lines_len = cctx->ctx_ufunc->uf_lines.ga_len; + int res; + + // Evaluate "ll[expr]" of "ll[expr][idx]". End the line with a NUL and + // limit the lines array length to avoid skipping to a following line. + var_start[varlen] = NUL; + cctx->ctx_ufunc->uf_lines.ga_len = cctx->ctx_lnum + 1; + char_u *p = var_start; + res = compile_expr0(&p, cctx); + var_start[varlen] = c; + cctx->ctx_ufunc->uf_lines.ga_len = lines_len; + if (res == FAIL || p != var_start + varlen) + { + // this should not happen + if (res != FAIL) + emsg(_(e_missing_closing_square_brace)); + return FAIL; + } + + lhs->lhs_type = cctx->ctx_type_stack.ga_len == 0 ? &t_void + : get_type_on_stack(cctx, 0); + + if (lhs->lhs_type->tt_type == VAR_CLASS + || (lhs->lhs_type->tt_type == VAR_OBJECT + && lhs->lhs_type != &t_object_any)) + { + // Check whether the class or object variable is modifiable + if (!lhs_class_member_modifiable(lhs, var_start, cctx)) + return FAIL; + } + + // Now we can properly check the type. The variable is indexed, thus + // we need the member type. For a class or object we don't know the + // type yet, it depends on what member is used. + // The top item in the stack is the Dict, followed by the key and then + // the type of the value. + vartype_T vartype = lhs->lhs_type->tt_type; + type_T *member_type = lhs->lhs_type->tt_member; + if (rhs_type != NULL && member_type != NULL + && vartype != VAR_OBJECT && vartype != VAR_CLASS + && rhs_type != &t_void + && need_type(rhs_type, member_type, 0, + -3, 0, cctx, FALSE, FALSE) == FAIL) + return FAIL; + + return OK; + } + + return generate_loadvar(cctx, lhs); +} + +/* + * Produce code for loading "lhs" and also take care of an index. + * Return OK/FAIL. + */ + int +compile_load_lhs_with_index(lhs_T *lhs, char_u *var_start, cctx_T *cctx) +{ + if (lhs->lhs_type->tt_type == VAR_OBJECT) + { + // "this.value": load "this" object and get the value at index for an + // object or class member get the type of the member. + // Also for "obj.value". + char_u *dot = mnv_strchr(var_start, '.'); + if (dot == NULL) + { + semsg(_(e_missing_dot_after_object_str), lhs->lhs_name); + return FAIL; + } + + class_T *cl = lhs->lhs_type->tt_class; + type_T *type = oc_member_type(cl, TRUE, dot + 1, + lhs->lhs_end, &lhs->lhs_member_idx); + if (lhs->lhs_member_idx < 0) + return FAIL; + + if (dot - var_start == 4 && STRNCMP(var_start, "this", 4) == 0) + { + // load "this" + lvar_T *lvar = lhs->lhs_lvar; + int rc; + + if (lvar->lv_from_outer > 0) + rc = generate_LOADOUTER(cctx, lvar->lv_idx, + lvar->lv_from_outer, lvar->lv_loop_depth, + lvar->lv_loop_idx, type); + else + rc = generate_LOAD(cctx, ISN_LOAD, lvar->lv_idx, NULL, type); + + if (rc == FAIL) + return FAIL; + } + else + { + // load object variable or argument + if (compile_load_lhs(lhs, var_start, lhs->lhs_type, cctx) == FAIL) + return FAIL; + } + if (IS_INTERFACE(cl)) + return generate_GET_ITF_MEMBER(cctx, cl, lhs->lhs_member_idx, type); + return generate_GET_OBJ_MEMBER(cctx, lhs->lhs_member_idx, type); + } + else if (lhs->lhs_type->tt_type == VAR_CLASS) + { + // ".value": load class variable "classname.value" + char_u *dot = mnv_strchr(var_start, '.'); + if (dot == NULL) + { + check_type_is_value(lhs->lhs_type); + return FAIL; + } + + class_T *cl = lhs->lhs_type->tt_class; + ocmember_T *m = class_member_lookup(cl, dot + 1, + lhs->lhs_end - dot - 1, + &lhs->lhs_member_idx); + if (m == NULL) + return FAIL; + + return generate_CLASSMEMBER(cctx, TRUE, cl, lhs->lhs_member_idx); + } + + if (compile_load_lhs(lhs, var_start, NULL, cctx) == FAIL) + return FAIL; + + if (lhs->lhs_has_index) + { + int range = FALSE; + + // Get member from list or dict. First compile the + // index value. + if (compile_assign_index(var_start, lhs, &range, cctx) == FAIL) + return FAIL; + if (range) + { + semsg(_(e_cannot_use_range_with_assignment_operator_str), + var_start); + return FAIL; + } + + // Get the member. + if (compile_member(FALSE, NULL, cctx) == FAIL) + return FAIL; + } + return OK; +} + +/* + * Assignment to a list or dict member, or ":unlet" for the item, using the + * information in "lhs". + * Returns OK or FAIL. + */ + int +compile_assign_unlet( + char_u *var_start, + lhs_T *lhs, + int is_assign, + type_T *rhs_type, + cctx_T *cctx) +{ + vartype_T dest_type; + int range = FALSE; + + if (compile_assign_index(var_start, lhs, &range, cctx) == FAIL) + return FAIL; + if (is_assign && range + && lhs->lhs_type->tt_type != VAR_LIST + && lhs->lhs_type != &t_blob + && lhs->lhs_type != &t_any) + { + if (lhs->lhs_type->tt_type == VAR_TUPLE) + emsg(_(e_cannot_slice_tuple)); + else + semsg(_(e_cannot_use_range_with_assignment_str), var_start); + return FAIL; + } + + if (lhs->lhs_type == NULL || lhs->lhs_type == &t_any) + { + // Index on variable of unknown type: check at runtime. + dest_type = VAR_ANY; + } + else + { + dest_type = lhs->lhs_type->tt_type; + if (dest_type == VAR_DICT && range) + { + emsg(_(e_cannot_use_range_with_dictionary)); + return FAIL; + } + if (dest_type == VAR_DICT + && may_generate_2STRING(-1, TOSTRING_NONE, cctx) == FAIL) + return FAIL; + if (dest_type == VAR_LIST || dest_type == VAR_BLOB) + { + type_T *type; + + if (range) + { + type = get_type_on_stack(cctx, 1); + if (need_type(type, &t_number, 0, + -2, 0, cctx, FALSE, FALSE) == FAIL) + return FAIL; + } + type = get_type_on_stack(cctx, 0); + if ((dest_type != VAR_BLOB && type->tt_type != VAR_SPECIAL) + && need_type(type, &t_number, 0, + -1, 0, cctx, FALSE, FALSE) == FAIL) + return FAIL; + } + } + + if (cctx->ctx_skip == SKIP_YES) + return OK; + + // Load the dict, list or object. On the stack we then have: + // - value (for assignment, not for :unlet) + // - index + // - for [a : b] second index + // - variable + if (compile_load_lhs(lhs, var_start, rhs_type, cctx) == FAIL) + return FAIL; + + if (dest_type == VAR_LIST + || dest_type == VAR_DICT + || dest_type == VAR_BLOB + || dest_type == VAR_CLASS + || dest_type == VAR_OBJECT + || dest_type == VAR_ANY) + { + if (is_assign) + { + if (range) + { + if (generate_instr_drop(cctx, ISN_STORERANGE, 4) == NULL) + return FAIL; + } + else + { + isn_T *isn = generate_instr_drop(cctx, ISN_STOREINDEX, 3); + + if (isn == NULL) + return FAIL; + isn->isn_arg.storeindex.si_vartype = dest_type; + isn->isn_arg.storeindex.si_class = NULL; + + if (dest_type == VAR_OBJECT) + { + class_T *cl = lhs->lhs_type->tt_class; + + if (IS_INTERFACE(cl)) + { + // "this.value": load "this" object and get the value + // at index for an object or class member get the type + // of the member + isn->isn_arg.storeindex.si_class = cl; + ++cl->class_refcount; + } + } + } + } + else if (range) + { + if (generate_instr_drop(cctx, ISN_UNLETRANGE, 3) == NULL) + return FAIL; + } + else + { + if (generate_instr_drop(cctx, ISN_UNLETINDEX, 2) == NULL) + return FAIL; + } + } + else + { + if (dest_type == VAR_TUPLE) + emsg(_(e_tuple_is_immutable)); + else + emsg(_(e_indexable_type_required)); + return FAIL; + } + + return OK; +} + +/* + * Generate an instruction to push the default value for "vartype". + * if "dest_local" is TRUE then for some types no instruction is generated. + * "skip_store" is set to TRUE if no PUSH instruction is generated. + * Returns OK or FAIL. + */ + static int +push_default_value( + cctx_T *cctx, + vartype_T vartype, + int dest_is_local, + int *skip_store) +{ + int r = OK; + + switch (vartype) + { + case VAR_BOOL: + r = generate_PUSHBOOL(cctx, VVAL_FALSE); + break; + case VAR_FLOAT: + r = generate_PUSHF(cctx, 0.0); + break; + case VAR_STRING: + r = generate_PUSHS(cctx, NULL); + break; + case VAR_BLOB: + r = generate_PUSHBLOB(cctx, blob_alloc()); + break; + case VAR_FUNC: + r = generate_PUSHFUNC(cctx, NULL, &t_func_void, TRUE); + break; + case VAR_LIST: + r = generate_NEWLIST(cctx, 0, FALSE); + break; + case VAR_TUPLE: + r = generate_NEWTUPLE(cctx, 0, FALSE); + break; + case VAR_DICT: + r = generate_NEWDICT(cctx, 0, FALSE); + break; + case VAR_JOB: + r = generate_PUSHJOB(cctx); + break; + case VAR_CHANNEL: + r = generate_PUSHCHANNEL(cctx); + break; + case VAR_OBJECT: + r = generate_PUSHOBJ(cctx); + break; + case VAR_NUMBER: + case VAR_UNKNOWN: + case VAR_ANY: + case VAR_PARTIAL: + case VAR_VOID: + case VAR_INSTR: + case VAR_CLASS: + case VAR_TYPEALIAS: + case VAR_SPECIAL: // cannot happen + // This is skipped for local variables, they are always + // initialized to zero. But in a "for" or "while" loop + // the value may have been changed. + if (dest_is_local && !inside_loop_scope(cctx)) + *skip_store = TRUE; + else + r = generate_PUSHNR(cctx, 0); + break; + } + return r; +} + +/* + * Compile assignment context. Used when compiling an assignment statement. + */ +typedef struct cac_S cac_T; +struct cac_S +{ + cmdidx_T cac_cmdidx; // assignment command + char_u *cac_nextc; // next character to parse + lhs_T cac_lhs; // lhs of the assignment + type_T *cac_rhs_type; // rhs type of an assignment + char_u *cac_op; // assignment operator + int cac_oplen; // assignment operator length + char_u *cac_var_start; // start of the variable names + char_u *cac_var_end; // end of the variable names + int cac_var_count; // number of variables in assignment + int cac_var_idx; // variable index in a list + int cac_semicolon; // semicolon in [var1, var2; var3] + garray_T *cac_instr; + int cac_instr_count; + int cac_incdec; + int cac_did_generate_slice; + int cac_is_decl; + int cac_is_const; + int cac_start_lnum; + type_T *cac_inferred_type; + int cac_skip_store; +}; + +/* + * Initialize the compile assignment context. + */ + static void +compile_assign_context_init(cac_T *cac, cctx_T *cctx, int cmdidx, char_u *arg) +{ + CLEAR_FIELD(*cac); + cac->cac_cmdidx = cmdidx; + cac->cac_instr = &cctx->ctx_instr; + cac->cac_rhs_type = &t_any; + cac->cac_is_decl = is_decl_command(cmdidx); + cac->cac_start_lnum = SOURCING_LNUM; + cac->cac_instr_count = -1; + cac->cac_var_end = arg; +} + +/* + * Compile an object member variable assignment in the arguments passed to a + * class new() method. + * + * Instruction format: + * + * ifargisset this. = + * + * where is the index of the default argument. + * + * Generates the ISN_JUMP_IF_ARG_NOT_SET instruction to skip the assignment if + * the value is passed as an argument to the new() method call. + * + * Returns OK on success. + */ + static int +compile_assign_obj_new_arg(char_u **argp, cctx_T *cctx) +{ + char_u *arg = *argp; + + arg += 11; // skip "ifargisset" + int def_arg_idx = getdigits(&arg); + arg = skipwhite(arg); + + // Use a JUMP_IF_ARG_NOT_SET instruction to skip if the value was not + // given and the default value is "v:none". + int stack_offset = STACK_FRAME_SIZE + + (cctx->ctx_ufunc->uf_va_name != NULL ? 1 : 0); + int def_arg_count = cctx->ctx_ufunc->uf_def_args.ga_len; + int arg_offset = def_arg_idx - def_arg_count - stack_offset; + + if (generate_JUMP_IF_ARG(cctx, ISN_JUMP_IF_ARG_NOT_SET, + arg_offset) == FAIL) + return FAIL; + + *argp = arg; + return OK; +} + +/* + * Translate the increment (++) and decrement (--) operators to the + * corresponding compound operators (+= or -=). + * + * Returns OK on success and FAIL on syntax error. + */ + static int +translate_incdec_op(exarg_T *eap, cac_T *cac) +{ + if (MNV_ISWHITE(eap->cmd[2])) + { + semsg(_(e_no_white_space_allowed_after_str_str), + eap->cmdidx == CMD_increment ? "++" : "--", eap->cmd); + return FAIL; + } + cac->cac_op = (char_u *)(eap->cmdidx == CMD_increment ? "+=" : "-="); + cac->cac_oplen = 2; + cac->cac_incdec = TRUE; + + return OK; +} + +/* + * Process the operator in an assignment statement. + */ + static int +compile_assign_process_operator( + exarg_T *eap, + char_u *arg, + cac_T *cac, + int *heredoc, + char_u **retstr) +{ + *retstr = NULL; + + if (eap->cmdidx == CMD_increment || eap->cmdidx == CMD_decrement) + // Change an unary operator to a compound operator + return translate_incdec_op(eap, cac); + + char_u *sp = cac->cac_nextc; + cac->cac_nextc = skipwhite(cac->cac_nextc); + cac->cac_op = cac->cac_nextc; + cac->cac_oplen = assignment_len(cac->cac_nextc, heredoc); + + if (cac->cac_var_count > 0 && cac->cac_oplen == 0) + { + // can be something like "[1, 2]->func()" + *retstr = arg; + return FAIL; + } + + // need white space before and after the operator + if (cac->cac_oplen > 0 && (!MNV_ISWHITE(*sp) + || !IS_WHITE_OR_NUL(cac->cac_op[cac->cac_oplen]))) + { + error_white_both(cac->cac_op, cac->cac_oplen); + return FAIL; + } + + return OK; +} + +/* + * Find the start of an assignment statement. + */ + static char_u * +compile_assign_compute_start(char_u *arg, int var_count) +{ + if (var_count > 0) + // [var1, var2] = [val1, val2] + // skip over the "[" + return skipwhite(arg + 1); + + return arg; +} + +/* + * Parse a heredoc assignment starting at "p". Returns a pointer to the + * beginning of the heredoc content. + */ + static char_u * +parse_heredoc_assignment(exarg_T *eap, cctx_T *cctx, cac_T *cac) +{ + // [let] varname =<< [trim] {end} + eap->ea_getline = exarg_getline; + eap->cookie = cctx; + + list_T *l = heredoc_get(eap, cac->cac_nextc + 3, FALSE, TRUE); + if (l == NULL) + return NULL; + + list_free(l); + cac->cac_nextc += STRLEN(cac->cac_nextc); + + return cac->cac_nextc; +} + +/* + * Check the type of a RHS expression in a list assignment statement. + * The RHS expression is already compiled. So the type is on the stack. + */ + static int +compile_assign_list_check_rhs_type(cctx_T *cctx, cac_T *cac) +{ + type_T *stacktype; + + stacktype = cctx->ctx_type_stack.ga_len == 0 ? &t_void + : get_type_on_stack(cctx, 0); + if (stacktype->tt_type == VAR_VOID) + { + emsg(_(e_cannot_use_void_value)); + return FAIL; + } + + if (stacktype->tt_type != VAR_LIST && stacktype->tt_type != VAR_TUPLE + && stacktype->tt_type != VAR_ANY) + { + emsg(_(e_list_or_tuple_required)); + return FAIL; + } + + if (need_type(stacktype, + stacktype->tt_type == VAR_TUPLE ? &t_tuple_any : &t_list_any, + TYPECHK_TUPLE_OK, -1, 0, cctx, FALSE, FALSE) == FAIL) + return FAIL; + + if (stacktype->tt_type == VAR_TUPLE) + { + if (stacktype->tt_argcount != 1) + cac->cac_rhs_type = &t_any; + else + { + if (stacktype->tt_flags & TTFLAG_VARARGS) + cac->cac_rhs_type = stacktype->tt_args[0]->tt_member; + else + cac->cac_rhs_type = stacktype->tt_args[0]; + } + } + else if (stacktype->tt_member != NULL) + cac->cac_rhs_type = stacktype->tt_member; + + return OK; +} + +/* + * In a list assignment statement, if a constant list was used, check the + * length. Returns OK if the length check succeeds. Returns FAIL otherwise. + */ + static int +compile_assign_list_check_length(cctx_T *cctx, cac_T *cac) +{ + int needed_list_len; + int did_check = FALSE; + + needed_list_len = cac->cac_semicolon + ? cac->cac_var_count - 1 + : cac->cac_var_count; + if (cac->cac_instr->ga_len > 0) + { + isn_T *isn = ((isn_T *)cac->cac_instr->ga_data) + + cac->cac_instr->ga_len - 1; + + if (isn->isn_type == ISN_NEWLIST || isn->isn_type == ISN_NEWTUPLE) + { + did_check = TRUE; + if (cac->cac_semicolon ? + isn->isn_arg.number < needed_list_len + : isn->isn_arg.number != needed_list_len) + { + semsg(_(e_expected_nr_items_but_got_nr), + needed_list_len, (int)isn->isn_arg.number); + return FAIL; + } + } + } + + if (!did_check) + generate_CHECKLEN(cctx, needed_list_len, cac->cac_semicolon); + + return OK; +} + +/* + * Evaluate the expression for "[var, var] = expr" assignment. + * A line break may follow the assignment operator "=". + */ + static char_u * +compile_assign_list_expr(cctx_T *cctx, cac_T *cac) +{ + char_u *whitep; + + whitep = cac->cac_op + cac->cac_oplen; + + if (may_get_next_line_error(whitep, &cac->cac_nextc, cctx) == FAIL) + return NULL; + + // compile RHS expression + if (compile_expr0(&cac->cac_nextc, cctx) == FAIL) + return NULL; + + if (cctx->ctx_skip == SKIP_YES) + // no need to parse more when skipping + return cac->cac_nextc; + + if (compile_assign_list_check_rhs_type(cctx, cac) == FAIL) + return NULL; + + // If a constant list was used we can check the length right here. + if (compile_assign_list_check_length(cctx, cac) == FAIL) + return FAIL; + + return cac->cac_nextc; +} + +/* + * Find and return the end of a heredoc or a list of variables assignment + * statement. For a single variable assignment statement, returns the current + * end. + * Returns NULL on failure. + */ + static char_u * +compile_assign_compute_end( + exarg_T *eap, + cctx_T *cctx, + cac_T *cac, + int heredoc) +{ + if (heredoc) + { + cac->cac_nextc = parse_heredoc_assignment(eap, cctx, cac); + return cac->cac_nextc; + } + + if (cac->cac_var_count > 0) + { + // for "[var, var] = expr" evaluate the expression. The list of + // variables are processed later. + // A line break may follow the "=". + cac->cac_nextc = compile_assign_list_expr(cctx, cac); + return cac->cac_nextc; + } + + return cac->cac_var_end; +} + +/* + * For "var = expr" evaluate the expression. + */ + static int +compile_assign_single_eval_expr(cctx_T *cctx, cac_T *cac) +{ + int ret = OK; + char_u *whitep; + lhs_T *lhs = &cac->cac_lhs; + lvar_T *lvp; + lvar_T save_lhs_lvar; + + // Compile the expression. + if (cac->cac_incdec) + return generate_PUSHNR(cctx, 1); + + // Temporarily hide the new local variable here, it is + // not available to this expression. + if (lhs->lhs_new_local) + { + --cctx->ctx_locals.ga_len; + + // Save the local variable value (compiling the RHS expression may + // create new local variables). + lvp = ((lvar_T *)cctx->ctx_locals.ga_data) + cctx->ctx_locals.ga_len; + save_lhs_lvar = *lvp; + } + whitep = cac->cac_op + cac->cac_oplen; + + if (may_get_next_line_error(whitep, &cac->cac_nextc, cctx) == FAIL) + { + if (lhs->lhs_new_local) + ++cctx->ctx_locals.ga_len; + return FAIL; + } + + ret = compile_expr0_ext(&cac->cac_nextc, cctx, &cac->cac_is_const); + if (lhs->lhs_new_local) + { + // Restore the local variable value. Update lhs_lvar as the index of + // the local variable might have changed. + lvp = ((lvar_T *)cctx->ctx_locals.ga_data) + cctx->ctx_locals.ga_len; + *lvp = save_lhs_lvar; + lhs->lhs_lvar = lvp; + + ++cctx->ctx_locals.ga_len; + } + + return ret; +} + +/* + * When compiling an assignment, set the LHS type to the RHS type. + */ + static int +compile_assign_set_lhs_type_from_rhs( + cctx_T *cctx, + cac_T *cac, + lhs_T *lhs, + type_T *rhs_type) +{ + if (rhs_type->tt_type == VAR_VOID) + { + emsg(_(e_cannot_use_void_value)); + return FAIL; + } + + type_T *type; + + // An empty list or dict has a &t_unknown member, for a variable that + // implies &t_any. + if (rhs_type == &t_list_empty) + type = &t_list_any; + else if (rhs_type == &t_dict_empty) + type = &t_dict_any; + else if (rhs_type == &t_unknown) + type = &t_any; + else + { + type = rhs_type; + cac->cac_inferred_type = rhs_type; + } + + set_var_type(lhs->lhs_lvar, type, cctx); + + return OK; +} + +/* + * Returns TRUE if the "rhs_type" can be assigned to the "lhs" variable. + * Used when compiling an assignment statement. + */ + static int +compile_assign_valid_rhs_type( + cctx_T *cctx, + cac_T *cac, + lhs_T *lhs, + type_T *rhs_type) +{ + type_T *use_type = lhs->lhs_lvar->lv_type; + where_T where = WHERE_INIT; + + // Without operator check type here, otherwise below. + // Use the line number of the assignment. + SOURCING_LNUM = cac->cac_start_lnum; + if (cac->cac_var_count > 0) + { + where.wt_index = cac->cac_var_idx + 1; + where.wt_kind = WT_VARIABLE; + } + + // If assigning to a list or dict member, use the member type. + // Not for "list[:] =". + if (lhs->lhs_has_index && + !has_list_index(cac->cac_var_start + lhs->lhs_varlen, cctx)) + use_type = lhs->lhs_member_type; + + if (need_type_where(rhs_type, use_type, 0, -1, where, cctx, FALSE, + cac->cac_is_const) == FAIL) + return FALSE; + + return TRUE; +} + +/* + * Compare the LHS type with the RHS type in an assignment. + */ + static int +compile_assign_check_type(cctx_T *cctx, cac_T *cac) +{ + lhs_T *lhs = &cac->cac_lhs; + type_T *rhs_type; + + rhs_type = cctx->ctx_type_stack.ga_len == 0 + ? &t_void + : get_type_on_stack(cctx, 0); + cac->cac_rhs_type = rhs_type; + + if (check_type_is_value(rhs_type) == FAIL) + return FAIL; + + if (lhs->lhs_lvar != NULL && (cac->cac_is_decl || !lhs->lhs_has_type)) + { + if (rhs_type->tt_type == VAR_FUNC + || rhs_type->tt_type == VAR_PARTIAL) + { + // Make sure the variable name can be used as a funcref + if (!lhs->lhs_has_index + && var_wrong_func_name(lhs->lhs_name, TRUE)) + return FAIL; + } + + if (lhs->lhs_new_local && !lhs->lhs_has_type) + { + // The LHS variable doesn't have a type. Set it to the RHS type. + if (compile_assign_set_lhs_type_from_rhs(cctx, cac, lhs, rhs_type) + == FAIL) + return FAIL; + } + else if (*cac->cac_op == '=') + { + if (!compile_assign_valid_rhs_type(cctx, cac, lhs, rhs_type)) + return FAIL; + } + } + else + { + // Assigning to a register using @r = "abc" + + type_T *lhs_type = lhs->lhs_member_type; + + // Special case: assigning to @# can use a number or a string. + // Also: can assign a number to a float. + if ((lhs_type == &t_number_or_string || lhs_type == &t_float) + && rhs_type->tt_type == VAR_NUMBER) + lhs_type = &t_number; + + if (*cac->cac_nextc != '=') + { + if (need_type(rhs_type, lhs_type, 0, -1, 0, cctx, FALSE, + FALSE) == FAIL) + return FAIL; + } + } + + return OK; +} + +/* + * Compile the RHS expression in an assignment statement and generate the + * instructions. + */ + static int +compile_assign_rhs_expr(cctx_T *cctx, cac_T *cac) +{ + cac->cac_is_const = FALSE; + + // for "+=", "*=", "..=" etc. first load the current value + if (*cac->cac_op != '=' + && compile_load_lhs_with_index(&cac->cac_lhs, cac->cac_var_start, + cctx) == FAIL) + return FAIL; + + // For "var = expr" evaluate the expression. + if (cac->cac_var_count == 0) + { + int ret; + + // Compile the expression. + cac->cac_instr_count = cac->cac_instr->ga_len; + ret = compile_assign_single_eval_expr(cctx, cac); + if (ret == FAIL) + return FAIL; + } + else if (cac->cac_semicolon && cac->cac_var_idx == cac->cac_var_count - 1) + { + // For "[var; var] = expr" get the rest of the list + cac->cac_did_generate_slice = TRUE; + if (generate_SLICE(cctx, cac->cac_var_count - 1) == FAIL) + return FAIL; + } + else + { + // For "[var, var] = expr" get the "var_idx" item from the + // list. + int with_op = *cac->cac_op != '='; + if (generate_GETITEM(cctx, cac->cac_var_idx, with_op) == FAIL) + return FAIL; + } + + if (compile_assign_check_type(cctx, cac) == FAIL) + return FAIL; + + return OK; +} + +/* + * Compile the RHS expression in an assignment + */ + static int +compile_assign_rhs(cctx_T *cctx, cac_T *cac) +{ + lhs_T *lhs = &cac->cac_lhs; + + if (cctx->ctx_skip == SKIP_YES) + { + if (cac->cac_oplen > 0 && cac->cac_var_count == 0) + { + // skip over the "=" and the expression + cac->cac_nextc = skipwhite(cac->cac_op + cac->cac_oplen); + (void)compile_expr0(&cac->cac_nextc, cctx); + } + return OK; + } + + // If RHS is specified, then generate instructions for RHS expression + if (cac->cac_oplen > 0) + return compile_assign_rhs_expr(cctx, cac); + + if (cac->cac_cmdidx == CMD_final) + { + emsg(_(e_final_requires_a_value)); + return FAIL; + } + + if (cac->cac_cmdidx == CMD_const) + { + emsg(_(e_const_requires_a_value)); + return FAIL; + } + + if (!lhs->lhs_has_type || lhs->lhs_dest == dest_option + || lhs->lhs_dest == dest_func_option) + { + emsg(_(e_type_or_initialization_required)); + return FAIL; + } + + // variables are always initialized + if (GA_GROW_FAILS(cac->cac_instr, 1)) + return FAIL; + + cac->cac_instr_count = cac->cac_instr->ga_len; + + return push_default_value(cctx, lhs->lhs_member_type->tt_type, + lhs->lhs_dest == dest_local, + &cac->cac_skip_store); +} + +/* + * Returns OK if "type" supports compound operator "op_arg" (e.g. +=, -=, %=, + * etc.). Compound operators are not supported with a tuple and a dict. + * Returns FAIL if compound operator is not supported. + */ + static int +check_type_supports_compound_op(type_T *type, char_u op_arg) +{ + if (type->tt_type == VAR_TUPLE || type->tt_type == VAR_DICT) + { + char_u op[2]; + + op[0] = op_arg; + op[1] = NUL; + semsg(_(e_wrong_variable_type_for_str_equal), op); + return FAIL; + } + + return OK; +} + +/* + * Compile a compound op assignment statement (+=, -=, *=, %=, etc.) + */ + static int +compile_assign_compound_op(cctx_T *cctx, cac_T *cac) +{ + lhs_T *lhs = &cac->cac_lhs; + type_T *expected; + type_T *stacktype = NULL; + + if (cac->cac_lhs.lhs_type->tt_type == VAR_TUPLE + && check_type_supports_compound_op(cac->cac_lhs.lhs_type, + *cac->cac_op) == FAIL) + return FAIL; + + if (*cac->cac_op == '.') + { + expected = lhs->lhs_member_type; + stacktype = get_type_on_stack(cctx, 0); + if (expected != &t_string + && need_type(stacktype, expected, 0, -1, 0, cctx, + FALSE, FALSE) == FAIL) + return FAIL; + else if (may_generate_2STRING(-1, TOSTRING_NONE, cctx) == FAIL) + return FAIL; + } + else + { + expected = lhs->lhs_member_type; + stacktype = get_type_on_stack(cctx, 0); + + if (check_type_supports_compound_op(expected, *cac->cac_op) == FAIL) + return FAIL; + + if ( + // If variable is float operation with number is OK. + !(expected == &t_float && (stacktype == &t_number + || stacktype == &t_number_bool)) + && need_type(stacktype, expected, TYPECHK_NUMBER_OK, -1, 0, + cctx, FALSE, FALSE) == FAIL) + return FAIL; + } + + if (*cac->cac_op == '.') + { + if (generate_CONCAT(cctx, 2) == FAIL) + return FAIL; + } + else if (*cac->cac_op == '+') + { + if (generate_add_instr(cctx, + operator_type(lhs->lhs_member_type, stacktype), + lhs->lhs_member_type, stacktype, + EXPR_APPEND) == FAIL) + return FAIL; + } + else if (generate_two_op(cctx, cac->cac_op) == FAIL) + return FAIL; + + return OK; +} + +/* + * Generate the STORE and SETTYPE instructions for an assignment statement. + */ + static int +compile_assign_generate_store(cctx_T *cctx, cac_T *cac) +{ + lhs_T *lhs = &cac->cac_lhs; + int save_lnum; + + // Use the line number of the assignment for store instruction. + save_lnum = cctx->ctx_lnum; + cctx->ctx_lnum = cac->cac_start_lnum - 1; + + if (lhs->lhs_has_index) + { + // Use the info in "lhs" to store the value at the index in the + // list, dict or object. + if (compile_assign_unlet(cac->cac_var_start, &cac->cac_lhs, + TRUE, cac->cac_rhs_type, cctx) == FAIL) + { + cctx->ctx_lnum = save_lnum; + return FAIL; + } + } + else + { + if (cac->cac_is_decl && cac->cac_cmdidx == CMD_const && + (lhs->lhs_dest == dest_script + || lhs->lhs_dest == dest_script_v9 + || lhs->lhs_dest == dest_global + || lhs->lhs_dest == dest_local)) + // ":const var": lock the value, but not referenced variables + generate_LOCKCONST(cctx); + + type_T *inferred_type = cac->cac_inferred_type; + + if ((lhs->lhs_type->tt_type == VAR_DICT + || lhs->lhs_type->tt_type == VAR_LIST) + && lhs->lhs_type->tt_member != NULL + && lhs->lhs_type->tt_member != &t_any + && lhs->lhs_type->tt_member != &t_unknown) + // Set the type in the list or dict, so that it can be + // checked, also in legacy script. + generate_SETTYPE(cctx, lhs->lhs_type); + else if (lhs->lhs_type->tt_type == VAR_TUPLE + && lhs->lhs_type->tt_argcount != 0) + generate_SETTYPE(cctx, lhs->lhs_type); + else if (inferred_type != NULL + && (inferred_type->tt_type == VAR_DICT + || inferred_type->tt_type == VAR_LIST) + && inferred_type->tt_member != NULL + && inferred_type->tt_member != &t_unknown + && inferred_type->tt_member != &t_any) + // Set the type in the list or dict, so that it can be + // checked, also in legacy script. + generate_SETTYPE(cctx, inferred_type); + else if (inferred_type != NULL + && inferred_type->tt_type == VAR_TUPLE + && inferred_type->tt_argcount > 0) + generate_SETTYPE(cctx, inferred_type); + + if (!cac->cac_skip_store && + generate_store_lhs(cctx, &cac->cac_lhs, + cac->cac_instr_count, + cac->cac_is_decl) == FAIL) + { + cctx->ctx_lnum = save_lnum; + return FAIL; + } + } + + cctx->ctx_lnum = save_lnum; + + return OK; +} + +/* + * Process the variable(s) in an assignment statement + */ + static int +compile_assign_process_variables( + cctx_T *cctx, + cac_T *cac, + int cmdidx, + int heredoc, + int has_cmd, + int has_argisset_prefix, + int jump_instr_idx) +{ + /* + * Loop over variables in "[var, var] = expr". + * For "name = expr" and "var name: type" this is done only once. + */ + for (cac->cac_var_idx = 0; cac->cac_var_idx == 0 || + cac->cac_var_idx < cac->cac_var_count; cac->cac_var_idx++) + { + if (cac->cac_var_start[0] == '_' + && !eval_isnamec(cac->cac_var_start[1])) + { + // Ignore underscore in "[a, _, b] = list". + if (cac->cac_var_count > 0) + { + cac->cac_var_start = skipwhite(cac->cac_var_start + 2); + continue; + } + emsg(_(e_cannot_use_underscore_here)); + return FAIL; + } + mnv_free(cac->cac_lhs.lhs_name); + + /* + * Figure out the LHS type and other properties. + */ + if (compile_assign_lhs(cac->cac_var_start, &cac->cac_lhs, cmdidx, + cac->cac_is_decl, heredoc, has_cmd, + cac->cac_oplen, cctx) == FAIL) + return FAIL; + + // Compile the RHS expression + if (heredoc) + { + SOURCING_LNUM = cac->cac_start_lnum; + if (cac->cac_lhs.lhs_has_type + && need_type(&t_list_string, cac->cac_lhs.lhs_type, + 0, -1, 0, cctx, FALSE, FALSE) == FAIL) + return FAIL; + } + else + { + if (compile_assign_rhs(cctx, cac) == FAIL) + return FAIL; + if (cac->cac_var_count == 0) + cac->cac_var_end = cac->cac_nextc; + } + + // no need to parse more when skipping + if (cctx->ctx_skip == SKIP_YES) + break; + + if (cac->cac_oplen > 0 && *cac->cac_op != '=') + { + if (compile_assign_compound_op(cctx, cac) == FAIL) + return FAIL; + } + + // generate the store instructions + if (compile_assign_generate_store(cctx, cac) == FAIL) + return FAIL; + + if (cac->cac_var_idx + 1 < cac->cac_var_count) + cac->cac_var_start = skipwhite(cac->cac_lhs.lhs_end + 1); + + if (has_argisset_prefix) + { + // set instruction index in JUMP_IF_ARG_SET to here + isn_T *isn = ((isn_T *)cac->cac_instr->ga_data) + jump_instr_idx; + isn->isn_arg.jumparg.jump_where = cac->cac_instr->ga_len; + } + } + + return OK; +} + +/* + * Compile declaration and assignment: + * "let name" + * "var name = expr" + * "final name = expr" + * "const name = expr" + * "name = expr" + * "arg" points to "name". + * "++arg" and "--arg" + * Return NULL for an error. + * Return "arg" if it does not look like a variable list. + */ + static char_u * +compile_assignment( + char_u *arg_start, + exarg_T *eap, + cmdidx_T cmdidx, + cctx_T *cctx) +{ + cac_T cac; + char_u *arg = arg_start; + char_u *retstr = NULL; + int heredoc = FALSE; + int jump_instr_idx; + + compile_assign_context_init(&cac, cctx, cmdidx, arg); + + jump_instr_idx = cac.cac_instr->ga_len; + + // process object variable initialization in a new() constructor method + int has_argisset_prefix = STRNCMP(arg, "ifargisset ", 11) == 0; + if (has_argisset_prefix && + compile_assign_obj_new_arg(&arg, cctx) == FAIL) + goto theend; + + // Skip over the "varname" or "[varname, varname]" to get to any "=". + cac.cac_nextc = skip_var_list(arg, TRUE, &cac.cac_var_count, + &cac.cac_semicolon, TRUE); + if (cac.cac_nextc == NULL) + return *arg == '[' ? arg : NULL; + + if (compile_assign_process_operator(eap, arg, &cac, &heredoc, + &retstr) == FAIL) + return retstr; + + // Compute the start of the assignment + cac.cac_var_start = compile_assign_compute_start(arg, cac.cac_var_count); + + // Compute the end of the assignment + cac.cac_var_end = compile_assign_compute_end(eap, cctx, &cac, heredoc); + if (cac.cac_var_end == NULL) + return NULL; + + int has_cmd = cac.cac_var_start > eap->cmd; + + /* process the variable(s) */ + if (compile_assign_process_variables(cctx, &cac, cmdidx, heredoc, + has_cmd, has_argisset_prefix, + jump_instr_idx) == FAIL) + goto theend; + + // For "[var, var] = expr" drop the "expr" value. + // Also for "[var, var; _] = expr". + if (cctx->ctx_skip != SKIP_YES && cac.cac_var_count > 0 && + (!cac.cac_semicolon || !cac.cac_did_generate_slice)) + { + if (generate_instr_drop(cctx, ISN_DROP, 1) == NULL) + goto theend; + } + + retstr = skipwhite(cac.cac_var_end); + +theend: + mnv_free(cac.cac_lhs.lhs_name); + return retstr; +} + +/* + * Check for an assignment at "eap->cmd", compile it if found. + * Return NOTDONE if there is none, FAIL for failure, OK if done. + */ + static int +may_compile_assignment(exarg_T *eap, char_u **line, cctx_T *cctx) +{ + char_u *pskip; + char_u *p; + + // Assuming the command starts with a variable or function name, + // find what follows. + // Skip over "var.member", "var[idx]" and the like. + // Also "&opt = val", "$ENV = val" and "@r = val". + pskip = (*eap->cmd == '&' || *eap->cmd == '$' || *eap->cmd == '@') + ? eap->cmd + 1 : eap->cmd; + p = to_name_end(pskip, TRUE); + if (p > eap->cmd && *p != NUL) + { + char_u *var_end; + int oplen; + int heredoc; + + if (eap->cmd[0] == '@') + var_end = eap->cmd + 2; + else + var_end = find_name_end(pskip, NULL, NULL, + FNE_CHECK_START | FNE_INCL_BR); + oplen = assignment_len(skipwhite(var_end), &heredoc); + if (oplen > 0) + { + size_t len = p - eap->cmd; + + // Recognize an assignment if we recognize the variable + // name: + // "&opt = expr" + // "$ENV = expr" + // "@r = expr" + // "g:var = expr" + // "g:[key] = expr" + // "local = expr" where "local" is a local var. + // "script = expr" where "script" is a script-local var. + // "import = expr" where "import" is an imported var + if (*eap->cmd == '&' + || *eap->cmd == '$' + || *eap->cmd == '@' + || ((len) > 2 && eap->cmd[1] == ':') + || STRNCMP(eap->cmd, "g:[", 3) == 0 + || variable_exists(eap->cmd, len, cctx)) + { + *line = compile_assignment(eap->cmd, eap, CMD_SIZE, cctx); + if (*line == NULL || *line == eap->cmd) + return FAIL; + return OK; + } + } + } + + // might be "[var, var] = expr" or "ifargisset this.member = expr" + if (*eap->cmd == '[' || STRNCMP(eap->cmd, "ifargisset ", 11) == 0) + { + *line = compile_assignment(eap->cmd, eap, CMD_SIZE, cctx); + if (*line == NULL) + return FAIL; + if (*line != eap->cmd) + return OK; + } + return NOTDONE; +} + +/* + * Check if arguments of "ufunc" shadow variables in "cctx". + * Return OK or FAIL. + */ + static int +check_args_shadowing(ufunc_T *ufunc, cctx_T *cctx) +{ + int i; + char_u *arg; + int r = OK; + + // Make sure arguments are not found when compiling a second time. + ufunc->uf_args_visible = 0; + + // Check for arguments shadowing variables from the context. + for (i = 0; i < ufunc->uf_args.ga_len; ++i) + { + arg = ((char_u **)(ufunc->uf_args.ga_data))[i]; + if (check_defined(arg, STRLEN(arg), cctx, NULL, TRUE) == FAIL) + { + r = FAIL; + break; + } + } + ufunc->uf_args_visible = ufunc->uf_args.ga_len; + return r; +} + +#ifdef HAS_MESSAGE_WINDOW +/* + * Get a count before a command. Can only be a number. + * Returns zero if there is no count. + * Returns -1 if there is something wrong. + */ + static long +get_cmd_count(char_u *line, exarg_T *eap) +{ + char_u *p; + + // skip over colons and white space + for (p = line; *p == ':' || MNV_ISWHITE(*p); ++p) + ; + if (!SAFE_isdigit(*p)) + { + // The command or modifiers must be following. Assume a lower case + // character means there is a modifier. + if (p < eap->cmd && !mnv_islower(*p)) + { + emsg(_(e_invalid_range)); + return -1; + } + return 0; + } + return atol((char *)p); +} +#endif + +/* + * Get the compilation type that should be used for "ufunc". + * Keep in sync with INSTRUCTIONS(). + */ + compiletype_T +get_compile_type(ufunc_T *ufunc) +{ + // Update uf_has_breakpoint if needed. + update_has_breakpoint(ufunc); + + if (debug_break_level > 0 || may_break_in_function(ufunc)) + return CT_DEBUG; +#ifdef FEAT_PROFILE + if (do_profiling == PROF_YES) + { + if (!ufunc->uf_profiling && has_profiling(FALSE, ufunc->uf_name, NULL, + &ufunc->uf_hash)) + func_do_profile(ufunc); + if (ufunc->uf_profiling) + return CT_PROFILE; + } +#endif + return CT_NONE; +} + +/* + * Free the compiled instructions saved for a def function. This is used when + * compiling a def function and the function was compiled before. + * The index is reused. + */ + static void +clear_def_function(ufunc_T *ufunc, compiletype_T compile_type) +{ + isn_T *instr_dest = NULL; + dfunc_T *dfunc; + + dfunc = ((dfunc_T *)def_functions.ga_data) + ufunc->uf_dfunc_idx; + + switch (compile_type) + { + case CT_PROFILE: +#ifdef FEAT_PROFILE + instr_dest = dfunc->df_instr_prof; break; +#endif + case CT_NONE: instr_dest = dfunc->df_instr; break; + case CT_DEBUG: instr_dest = dfunc->df_instr_debug; break; + } + + if (instr_dest != NULL) + // Was compiled in this mode before: Free old instructions. + delete_def_function_contents(dfunc, FALSE); + + ga_clear_strings(&dfunc->df_var_names); + dfunc->df_defer_var_idx = 0; +} + +/* + * Add a function to the list of :def functions. + * This sets "ufunc->uf_dfunc_idx" but the function isn't compiled yet. + */ + static int +add_def_function(ufunc_T *ufunc) +{ + dfunc_T *dfunc; + + if (def_functions.ga_len == 0) + { + // The first position is not used, so that a zero uf_dfunc_idx means it + // wasn't set. + if (GA_GROW_FAILS(&def_functions, 1)) + return FAIL; + ++def_functions.ga_len; + } + + // Add the function to "def_functions". + if (GA_GROW_FAILS(&def_functions, 1)) + return FAIL; + dfunc = ((dfunc_T *)def_functions.ga_data) + def_functions.ga_len; + CLEAR_POINTER(dfunc); + dfunc->df_idx = def_functions.ga_len; + ufunc->uf_dfunc_idx = dfunc->df_idx; + dfunc->df_ufunc = ufunc; + dfunc->df_name = mnv_strnsave(ufunc->uf_name, ufunc->uf_namelen); + ga_init2(&dfunc->df_var_names, sizeof(char_u *), 10); + ++dfunc->df_refcount; + ++def_functions.ga_len; + return OK; +} + + static int +compile_dfunc_ufunc_init( + ufunc_T *ufunc, + cctx_T *outer_cctx, + compiletype_T compile_type, + int *new_def_function) +{ + // When using a function that was compiled before: Free old instructions. + // The index is reused. Otherwise add a new entry in "def_functions". + if (ufunc->uf_dfunc_idx > 0) + clear_def_function(ufunc, compile_type); + else + { + if (add_def_function(ufunc) == FAIL) + return FAIL; + + *new_def_function = TRUE; + } + + if ((ufunc->uf_flags & FC_CLOSURE) && outer_cctx == NULL) + { + semsg(_(e_compiling_closure_without_context_str), + printable_func_name(ufunc)); + return FAIL; + } + + ufunc->uf_def_status = UF_COMPILING; + + return OK; +} + +/* + * Initialize the compilation context for compiling a def function. + */ + static void +compile_dfunc_cctx_init( + cctx_T *cctx, + cctx_T *outer_cctx, + ufunc_T *ufunc, + compiletype_T compile_type) +{ + CLEAR_FIELD(*cctx); + + cctx->ctx_compile_type = compile_type; + cctx->ctx_ufunc = ufunc; + cctx->ctx_lnum = -1; + cctx->ctx_outer = outer_cctx; + ga_init2(&cctx->ctx_locals, sizeof(lvar_T), 10); + // Each entry on the type stack consists of two type pointers. + ga_init2(&cctx->ctx_type_stack, sizeof(type2_T), 50); + cctx->ctx_type_list = &ufunc->uf_type_list; + ga_init2(&cctx->ctx_instr, sizeof(isn_T), 50); +} + +/* + * For an object constructor, generate instruction to setup "this" (the first + * local variable) and to initialize the object variables. + */ + static int +obj_constructor_prologue(ufunc_T *ufunc, cctx_T *cctx) +{ + generate_CONSTRUCT(cctx, ufunc->uf_class); + + for (int i = 0; i < ufunc->uf_class->class_obj_member_count; ++i) + { + ocmember_T *m = &ufunc->uf_class->class_obj_members[i]; + + if (i < 2 && IS_ENUM(ufunc->uf_class)) + // The first two object variables in an enum are the name + // and the ordinal. These are set by the ISN_CONSTRUCT + // instruction. So don't generate instructions to set + // these variables. + continue; + + if (m->ocm_init != NULL) + { + char_u *expr = m->ocm_init; + sctx_T save_current_sctx; + int change_sctx = FALSE; + + // If the member variable initialization script context is + // different from the current script context, then change it. + if (current_sctx.sc_sid != m->ocm_init_sctx.sc_sid) + change_sctx = TRUE; + + if (change_sctx) + { + // generate an instruction to change the script context to the + // member variable initialization script context. + save_current_sctx = current_sctx; + current_sctx = m->ocm_init_sctx; + generate_SCRIPTCTX_SET(cctx, current_sctx); + } + + int r = compile_expr0(&expr, cctx); + + if (change_sctx) + { + // restore the previous script context + current_sctx = save_current_sctx; + generate_SCRIPTCTX_SET(cctx, current_sctx); + } + + if (r == FAIL) + return FAIL; + + if (!ends_excmd2(m->ocm_init, expr)) + { + semsg(_(e_trailing_characters_str), expr); + return FAIL; + } + + type_T *type = get_type_on_stack(cctx, 0); + if (m->ocm_type->tt_type == VAR_ANY + && !(m->ocm_flags & OCMFLAG_HAS_TYPE) + && type->tt_type != VAR_SPECIAL) + { + // If the member variable type is not yet set, then use + // the initialization expression type. + m->ocm_type = type; + } + else + { + // The type of the member initialization expression is + // determined at run time. Add a runtime type check. + where_T where = WHERE_INIT; + where.wt_kind = WT_MEMBER; + where.wt_func_name = (char *)m->ocm_name.string; + if (need_type_where(type, m->ocm_type, 0, -1, + where, cctx, FALSE, FALSE) == FAIL) + return FAIL; + } + } + else + push_default_value(cctx, m->ocm_type->tt_type, FALSE, NULL); + + if (((m->ocm_type->tt_type == VAR_DICT + || m->ocm_type->tt_type == VAR_LIST) + && m->ocm_type->tt_member != NULL + && m->ocm_type->tt_member != &t_any + && m->ocm_type->tt_member != &t_unknown) + || (m->ocm_type->tt_type == VAR_TUPLE + && m->ocm_type->tt_argcount > 0)) + // Set the type in the list, tuple or dict, so that it can be + // checked, also in legacy script. + generate_SETTYPE(cctx, m->ocm_type); + + generate_STORE_THIS(cctx, i); + } + + return OK; +} + +/* + * For an object method and an constructor, generate instruction to setup + * "this" (the first local variable). For a constructor, generate instructions + * to initialize the object variables. + */ + static int +obj_method_prologue(ufunc_T *ufunc, cctx_T *cctx) +{ + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + ufunc->uf_dfunc_idx; + + if (GA_GROW_FAILS(&dfunc->df_var_names, 1)) + return FAIL; + + ((char_u **)dfunc->df_var_names.ga_data)[0] = + mnv_strsave((char_u *)"this"); + ++dfunc->df_var_names.ga_len; + + // In the constructor allocate memory for the object and initialize the + // object members. + if (IS_CONSTRUCTOR_METHOD(ufunc)) + return obj_constructor_prologue(ufunc, cctx); + + return OK; +} + +/* + * Produce instructions for the default values of optional arguments. + */ + static int +compile_def_function_default_args( + ufunc_T *ufunc, + garray_T *instr, + cctx_T *cctx) +{ + int count = ufunc->uf_def_args.ga_len; + int first_def_arg = ufunc->uf_args.ga_len - count; + int i; + int off = STACK_FRAME_SIZE + (ufunc->uf_va_name != NULL ? 1 : 0); + int did_set_arg_type = FALSE; + + // Produce instructions for the default values of optional arguments. + SOURCING_LNUM = 0; // line number unknown + for (i = 0; i < count; ++i) + { + char_u *arg = ((char_u **)(ufunc->uf_def_args.ga_data))[i]; + if (STRCMP(arg, "v:none") == 0) + // "arg = v:none" means the argument is optional without + // setting a value when the argument is missing. + continue; + + type_T *val_type; + int arg_idx = first_def_arg + i; + where_T where = WHERE_INIT; + int jump_instr_idx = instr->ga_len; + isn_T *isn; + + // Use a JUMP_IF_ARG_SET instruction to skip if the value was given. + if (generate_JUMP_IF_ARG(cctx, ISN_JUMP_IF_ARG_SET, + i - count - off) == FAIL) + return FAIL; + + // Make sure later arguments are not found. + ufunc->uf_args_visible = arg_idx; + + int r = compile_expr0(&arg, cctx); + if (r == FAIL) + return FAIL; + + // If no type specified use the type of the default value. + // Otherwise check that the default value type matches the + // specified type. + val_type = get_type_on_stack(cctx, 0); + where.wt_index = arg_idx + 1; + where.wt_kind = WT_ARGUMENT; + if (ufunc->uf_arg_types[arg_idx] == &t_unknown) + { + did_set_arg_type = TRUE; + ufunc->uf_arg_types[arg_idx] = val_type; + } + else if (need_type_where(val_type, ufunc->uf_arg_types[arg_idx], + 0, -1, where, cctx, FALSE, FALSE) == FAIL) + return FAIL; + + if (generate_STORE(cctx, ISN_STORE, i - count - off, NULL) == FAIL) + return FAIL; + + // set instruction index in JUMP_IF_ARG_SET to here + isn = ((isn_T *)instr->ga_data) + jump_instr_idx; + isn->isn_arg.jumparg.jump_where = instr->ga_len; + } + + if (did_set_arg_type) + set_function_type(ufunc); + + return OK; +} + +/* + * Compile def function body. Loop over all the lines in the function and + * generate instructions. + */ + static int +compile_def_function_body( + int last_func_lnum, + int check_return_type, + garray_T *lines_to_free, + char **errormsg, + cctx_T *cctx) +{ + char_u *line = NULL; + char_u *p; + int did_emsg_before = did_emsg; +#ifdef FEAT_PROFILE + int prof_lnum = -1; +#endif + int debug_lnum = -1; + + for (;;) + { + exarg_T ea; + int starts_with_colon = FALSE; + char_u *cmd; + cmdmod_T local_cmdmod; + + // Bail out on the first error to avoid a flood of errors and report + // the right line number when inside try/catch. + if (did_emsg_before != did_emsg) + return FAIL; + + if (line != NULL && *line == '|') + // the line continues after a '|' + ++line; + else if (line != NULL && *skipwhite(line) != NUL + && !(*line == '#' && (line == cctx->ctx_line_start + || MNV_ISWHITE(line[-1])))) + { + semsg(_(e_trailing_characters_str), line); + return FAIL; + } + else if (line != NULL && mnv9_bad_comment(skipwhite(line))) + return FAIL; + else + { + line = next_line_from_context(cctx, FALSE); + if (cctx->ctx_lnum >= last_func_lnum) + { + // beyond the last line +#ifdef FEAT_PROFILE + if (cctx->ctx_skip != SKIP_YES) + may_generate_prof_end(cctx, prof_lnum); +#endif + break; + } + // Make a copy, splitting off nextcmd and removing trailing spaces + // may change it. + if (line != NULL) + { + line = mnv_strsave(line); + if (ga_add_string(lines_to_free, line) == FAIL) + return FAIL; + } + } + + CLEAR_FIELD(ea); + ea.cmdlinep = &line; + ea.cmd = skipwhite(line); + ea.skip = cctx->ctx_skip == SKIP_YES; + + if (*ea.cmd == '#') + { + // "#" starts a comment, but "#{" is an error + if (mnv9_bad_comment(ea.cmd)) + return FAIL; + line = (char_u *)""; + continue; + } + +#ifdef FEAT_PROFILE + if (cctx->ctx_compile_type == CT_PROFILE && cctx->ctx_lnum != prof_lnum + && cctx->ctx_skip != SKIP_YES) + { + may_generate_prof_end(cctx, prof_lnum); + + prof_lnum = cctx->ctx_lnum; + generate_instr(cctx, ISN_PROF_START); + } +#endif + if (cctx->ctx_compile_type == CT_DEBUG && cctx->ctx_lnum != debug_lnum + && cctx->ctx_skip != SKIP_YES) + { + debug_lnum = cctx->ctx_lnum; + generate_instr_debug(cctx); + } + cctx->ctx_prev_lnum = cctx->ctx_lnum + 1; + + // Some things can be recognized by the first character. + switch (*ea.cmd) + { + case '}': + { + // "}" ends a block scope + scopetype_T stype = cctx->ctx_scope == NULL + ? NO_SCOPE : cctx->ctx_scope->se_type; + + if (stype == BLOCK_SCOPE) + { + compile_endblock(cctx); + line = ea.cmd; + } + else + { + emsg(_(e_using_rcurly_outside_if_block_scope)); + return FAIL; + } + if (line != NULL) + line = skipwhite(ea.cmd + 1); + continue; + } + + case '{': + // "{" starts a block scope + // "{'a': 1}->func() is something else + if (ends_excmd(*skipwhite(ea.cmd + 1))) + { + line = compile_block(ea.cmd, cctx); + continue; + } + break; + } + + /* + * COMMAND MODIFIERS + */ + cctx->ctx_has_cmdmod = FALSE; + if (parse_command_modifiers(&ea, errormsg, &local_cmdmod, FALSE) + == FAIL) + return FAIL; + generate_cmdmods(cctx, &local_cmdmod); + undo_cmdmod(&local_cmdmod); + + // Check if there was a colon after the last command modifier or before + // the current position. + for (p = ea.cmd; p >= line; --p) + { + if (*p == ':') + starts_with_colon = TRUE; + if (p < ea.cmd && !MNV_ISWHITE(*p)) + break; + } + + // Skip ":call" to get to the function name, unless using :legacy + p = ea.cmd; + if (!(local_cmdmod.cmod_flags & CMOD_LEGACY)) + { + if (checkforcmd(&ea.cmd, "call", 3)) + { + if (*ea.cmd == '(') + // not for "call()" + ea.cmd = p; + else + ea.cmd = skipwhite(ea.cmd); + } + + if (!starts_with_colon) + { + int assign; + + // Check for assignment after command modifiers. + assign = may_compile_assignment(&ea, &line, cctx); + if (assign == OK) + goto nextline; + if (assign == FAIL) + return FAIL; + } + } + + /* + * COMMAND after range + * 'text'->func() should not be confused with 'a mark + * 0z1234->func() should not be confused with a zero line number + * "++nr" and "--nr" are eval commands + * in "$ENV->func()" the "$" is not a range + * "123->func()" is a method call + */ + cmd = ea.cmd; + if ((*cmd != '$' || starts_with_colon) + && (starts_with_colon + || !(*cmd == '\'' + || (cmd[0] == '0' && cmd[1] == 'z') + || (cmd[0] != NUL && cmd[0] == cmd[1] + && (*cmd == '+' || *cmd == '-')) + || number_method(cmd)))) + { + ea.cmd = skip_range(ea.cmd, TRUE, NULL); + if (ea.cmd > cmd) + { + if (!starts_with_colon + && !(local_cmdmod.cmod_flags & CMOD_LEGACY)) + { + semsg(_(e_colon_required_before_range_str), cmd); + return FAIL; + } + ea.addr_count = 1; + if (ends_excmd2(line, ea.cmd)) + { + // A range without a command: jump to the line. + generate_EXEC(cctx, ISN_EXECRANGE, + mnv_strnsave(cmd, ea.cmd - cmd)); + line = ea.cmd; + goto nextline; + } + } + } + p = find_ex_command(&ea, NULL, + starts_with_colon || (local_cmdmod.cmod_flags & CMOD_LEGACY) + ? NULL : item_exists, cctx); + + if (p == NULL) + { + if (cctx->ctx_skip != SKIP_YES) + semsg(_(e_ambiguous_use_of_user_defined_command_str), ea.cmd); + return FAIL; + } + + // When using ":legacy cmd" always use compile_exec(). + if (local_cmdmod.cmod_flags & CMOD_LEGACY) + { + char_u *start = ea.cmd; + + switch (ea.cmdidx) + { + case CMD_if: + case CMD_elseif: + case CMD_else: + case CMD_endif: + case CMD_for: + case CMD_endfor: + case CMD_continue: + case CMD_break: + case CMD_while: + case CMD_endwhile: + case CMD_try: + case CMD_catch: + case CMD_finally: + case CMD_endtry: + semsg(_(e_cannot_use_legacy_with_command_str), ea.cmd); + return FAIL; + default: break; + } + + // ":legacy return expr" needs to be handled differently. + if (checkforcmd(&start, "return", 4)) + ea.cmdidx = CMD_return; + else + ea.cmdidx = CMD_legacy; + } + + if (p == ea.cmd && ea.cmdidx != CMD_SIZE) + { + // "eval" is used for "val->func()" and "var" for "var = val", then + // "p" is equal to "ea.cmd" for a valid command. + if (ea.cmdidx == CMD_eval || ea.cmdidx == CMD_var) + ; + else if (cctx->ctx_skip == SKIP_YES) + { + line += STRLEN(line); + goto nextline; + } + else + { + semsg(_(e_command_not_recognized_str), ea.cmd); + return FAIL; + } + } + + if ((cctx->ctx_had_return || cctx->ctx_had_throw) + && ea.cmdidx != CMD_elseif + && ea.cmdidx != CMD_else + && ea.cmdidx != CMD_endif + && ea.cmdidx != CMD_endfor + && ea.cmdidx != CMD_endwhile + && ea.cmdidx != CMD_catch + && ea.cmdidx != CMD_finally + && ea.cmdidx != CMD_endtry + && !ignore_unreachable_code_for_testing) + { + semsg(_(e_unreachable_code_after_str), + cctx->ctx_had_return ? "return" : "throw"); + return FAIL; + } + + // When processing the end of an if-else block, don't clear the + // "ctx_had_throw" flag. If an if-else block ends in a "throw" + // statement, then it is considered to end in a "return" statement. + // The "ctx_had_throw" is cleared immediately after processing the + // if-else block ending statement. + // Otherwise, clear the "had_throw" flag. + if (ea.cmdidx != CMD_else && ea.cmdidx != CMD_elseif + && ea.cmdidx != CMD_endif) + cctx->ctx_had_throw = FALSE; + + p = skipwhite(p); + if (ea.cmdidx != CMD_SIZE + && ea.cmdidx != CMD_write && ea.cmdidx != CMD_read) + { + if (ea.cmdidx >= 0) + ea.argt = excmd_get_argt(ea.cmdidx); + if ((ea.argt & EX_BANG) && *p == '!') + { + ea.forceit = TRUE; + p = skipwhite(p + 1); + } + if ((ea.argt & EX_RANGE) == 0 && ea.addr_count > 0) + { + emsg(_(e_no_range_allowed)); + return FAIL; + } + } + + switch (ea.cmdidx) + { + case CMD_def: + case CMD_function: + ea.arg = p; + line = compile_nested_function(&ea, cctx, lines_to_free); + break; + + case CMD_return: + line = compile_return(p, check_return_type, + local_cmdmod.cmod_flags & CMOD_LEGACY, cctx); + cctx->ctx_had_return = TRUE; + break; + + case CMD_let: + emsg(_(e_cannot_use_let_in_mnv9_script)); + break; + case CMD_var: + case CMD_final: + case CMD_const: + case CMD_increment: + case CMD_decrement: + line = compile_assignment(p, &ea, ea.cmdidx, cctx); + if (line == p) + { + emsg(_(e_invalid_assignment)); + line = NULL; + } + break; + + case CMD_unlet: + case CMD_unlockvar: + case CMD_lockvar: + line = compile_unletlock(p, &ea, cctx); + break; + + case CMD_import: + emsg(_(e_import_can_only_be_used_in_script)); + line = NULL; + break; + + case CMD_if: + line = compile_if(p, cctx); + break; + case CMD_elseif: + line = compile_elseif(p, cctx); + cctx->ctx_had_return = FALSE; + cctx->ctx_had_throw = FALSE; + break; + case CMD_else: + line = compile_else(p, cctx); + cctx->ctx_had_return = FALSE; + cctx->ctx_had_throw = FALSE; + break; + case CMD_endif: + line = compile_endif(p, cctx); + cctx->ctx_had_throw = FALSE; + break; + + case CMD_while: + line = compile_while(p, cctx); + break; + case CMD_endwhile: + line = compile_endwhile(p, cctx); + cctx->ctx_had_return = FALSE; + break; + + case CMD_for: + line = compile_for(p, cctx); + break; + case CMD_endfor: + line = compile_endfor(p, cctx); + cctx->ctx_had_return = FALSE; + break; + case CMD_continue: + line = compile_continue(p, cctx); + break; + case CMD_break: + line = compile_break(p, cctx); + break; + + case CMD_try: + line = compile_try(p, cctx); + break; + case CMD_catch: + line = compile_catch(p, cctx); + cctx->ctx_had_return = FALSE; + break; + case CMD_finally: + line = compile_finally(p, cctx); + cctx->ctx_had_return = FALSE; + break; + case CMD_endtry: + line = compile_endtry(p, cctx); + break; + case CMD_throw: + line = compile_throw(p, cctx); + cctx->ctx_had_throw = TRUE; + break; + + case CMD_eval: + line = compile_eval(p, cctx); + break; + + case CMD_defer: + line = compile_defer(p, cctx); + break; + +#ifdef HAS_MESSAGE_WINDOW + case CMD_echowindow: + { + long cmd_count = get_cmd_count(line, &ea); + if (cmd_count < 0) + line = NULL; + else + line = compile_mult_expr(p, ea.cmdidx, + cmd_count, cctx); + } + break; +#endif + case CMD_echo: + case CMD_echon: + case CMD_echoconsole: + case CMD_echoerr: + case CMD_echomsg: + case CMD_execute: + line = compile_mult_expr(p, ea.cmdidx, 0, cctx); + break; + + case CMD_put: + ea.cmd = cmd; + line = compile_put(p, &ea, cctx, FALSE); + break; + + case CMD_iput: + ea.cmd = cmd; + line = compile_put(p, &ea, cctx, TRUE); + break; + + case CMD_substitute: + if (check_global_and_subst(ea.cmd, p) == FAIL) + return FAIL; + if (cctx->ctx_skip == SKIP_YES) + line = (char_u *)""; + else + { + ea.arg = p; + line = compile_substitute(line, &ea, cctx); + } + break; + + case CMD_redir: + ea.arg = p; + line = compile_redir(line, &ea, cctx); + break; + + case CMD_cexpr: + case CMD_lexpr: + case CMD_caddexpr: + case CMD_laddexpr: + case CMD_cgetexpr: + case CMD_lgetexpr: +#ifdef FEAT_QUICKFIX + ea.arg = p; + line = compile_cexpr(line, &ea, cctx); +#else + ex_ni(&ea); + line = NULL; +#endif + break; + + case CMD_append: + case CMD_change: + case CMD_insert: + case CMD_k: + case CMD_t: + case CMD_xit: + not_in_mnv9(&ea); + return FAIL; + + case CMD_SIZE: + if (cctx->ctx_skip != SKIP_YES) + { + semsg(_(e_invalid_command_str), ea.cmd); + return FAIL; + } + // We don't check for a next command here. + line = (char_u *)""; + break; + + case CMD_lua: + case CMD_mzscheme: + case CMD_perl: + case CMD_py3: + case CMD_python3: + case CMD_python: + case CMD_pythonx: + case CMD_ruby: + case CMD_tcl: + ea.arg = p; + if (mnv_strchr(line, '\n') == NULL) + line = compile_exec(line, &ea, cctx); + else + // heredoc lines have been concatenated with NL + // characters in get_function_body() + line = compile_script(line, cctx); + break; + + case CMD_mnv9script: + if (cctx->ctx_skip != SKIP_YES) + { + emsg(_(e_mnv9script_can_only_be_used_in_script)); + return FAIL; + } + line = (char_u *)""; + break; + + case CMD_class: + emsg(_(e_class_can_only_be_used_in_script)); + return FAIL; + + case CMD_enum: + emsg(_(e_enum_can_only_be_used_in_script)); + return FAIL; + + case CMD_interface: + emsg(_(e_interface_can_only_be_used_in_script)); + return FAIL; + + case CMD_type: + emsg(_(e_type_can_only_be_used_in_script)); + return FAIL; + + case CMD_global: + if (check_global_and_subst(ea.cmd, p) == FAIL) + return FAIL; + // FALLTHROUGH + default: + // Not recognized, execute with do_cmdline_cmd(). + ea.arg = p; + line = compile_exec(line, &ea, cctx); + break; + } +nextline: + if (line == NULL) + return FAIL; + line = skipwhite(line); + + // Undo any command modifiers. + generate_undo_cmdmods(cctx); + + if (cctx->ctx_type_stack.ga_len < 0) + { + iemsg("Type stack underflow"); + return FAIL; + } + } // END of the loop over all the function body lines. + + return OK; +} + +/* + * Returns TRUE if the end of a scope (if, while, for, block) is missing. + * Called after compiling a def function body. + */ + static int +compile_dfunc_scope_end_missing(cctx_T *cctx) +{ + if (cctx->ctx_scope == NULL) + return FALSE; + + switch (cctx->ctx_scope->se_type) + { + case IF_SCOPE: + emsg(_(e_missing_endif)); + break; + case WHILE_SCOPE: + emsg(_(e_missing_endwhile)); + break; + case FOR_SCOPE: + emsg(_(e_missing_endfor)); + break; + case TRY_SCOPE: + emsg(_(e_missing_endtry)); + break; + case BLOCK_SCOPE: + // end block scope from :try (maybe) + compile_endblock(cctx); + if (cctx->ctx_scope != NULL + && cctx->ctx_scope->se_type == TRY_SCOPE) + emsg(_(e_missing_endtry)); + else + emsg(_(e_missing_rcurly)); + break; + default: + emsg(_(e_missing_rcurly)); + } + return TRUE; +} + +/* + * When compiling a def function, if it doesn't have an explicit return + * statement, then generate a default return instruction. For an object + * constructor, return the object. + */ + static int +compile_dfunc_generate_default_return(ufunc_T *ufunc, cctx_T *cctx) +{ + // TODO: if a function ends in "throw" but there was a return elsewhere we + // should not assume the return type is "void". + if (cctx->ctx_had_return || cctx->ctx_had_throw) + return OK; + + if (ufunc->uf_ret_type->tt_type == VAR_UNKNOWN) + ufunc->uf_ret_type = &t_void; + else if (ufunc->uf_ret_type->tt_type != VAR_VOID + && !IS_CONSTRUCTOR_METHOD(ufunc)) + { + emsg(_(e_missing_return_statement)); + return FAIL; + } + + // Return void if there is no return at the end. + // For a constructor return the object. + if (IS_CONSTRUCTOR_METHOD(ufunc)) + { + generate_instr(cctx, ISN_RETURN_OBJECT); + ufunc->uf_ret_type = &ufunc->uf_class->class_object_type; + } + else + generate_instr(cctx, ISN_RETURN_VOID); + + return OK; +} + +/* + * Perform the chores after successfully compiling a def function. + */ + static void +compile_dfunc_epilogue( + cctx_T *outer_cctx, + ufunc_T *ufunc, + garray_T *instr, + cctx_T *cctx) +{ + dfunc_T *dfunc; + + dfunc = ((dfunc_T *)def_functions.ga_data) + ufunc->uf_dfunc_idx; + dfunc->df_deleted = FALSE; + dfunc->df_script_seq = current_sctx.sc_seq; + +#ifdef FEAT_PROFILE + if (cctx->ctx_compile_type == CT_PROFILE) + { + dfunc->df_instr_prof = instr->ga_data; + dfunc->df_instr_prof_count = instr->ga_len; + } + else +#endif + if (cctx->ctx_compile_type == CT_DEBUG) + { + dfunc->df_instr_debug = instr->ga_data; + dfunc->df_instr_debug_count = instr->ga_len; + } + else + { + dfunc->df_instr = instr->ga_data; + dfunc->df_instr_count = instr->ga_len; + } + dfunc->df_varcount = dfunc->df_var_names.ga_len; + dfunc->df_has_closure = cctx->ctx_has_closure; + + if (cctx->ctx_outer_used) + { + ufunc->uf_flags |= FC_CLOSURE; + if (outer_cctx != NULL) + ++outer_cctx->ctx_closure_count; + } + + ufunc->uf_def_status = UF_COMPILED; +} + +/* + * Perform the cleanup when a def function compilation fails. + */ + static void +compile_dfunc_ufunc_cleanup( + ufunc_T *ufunc, + garray_T *instr, + int new_def_function, + char *errormsg, + int did_emsg_before, + cctx_T *cctx) +{ + dfunc_T *dfunc; + + dfunc = ((dfunc_T *)def_functions.ga_data) + ufunc->uf_dfunc_idx; + + // Compiling aborted, free the generated instructions. + clear_instr_ga(instr); + MNV_CLEAR(dfunc->df_name); + ga_clear_strings(&dfunc->df_var_names); + + // If using the last entry in the table and it was added above, we + // might as well remove it. + if (!dfunc->df_deleted && new_def_function + && ufunc->uf_dfunc_idx == def_functions.ga_len - 1) + { + --def_functions.ga_len; + ufunc->uf_dfunc_idx = 0; + } + ufunc->uf_def_status = UF_COMPILE_ERROR; + + while (cctx->ctx_scope != NULL) + drop_scope(cctx); + + if (errormsg != NULL) + emsg(errormsg); + else if (did_emsg == did_emsg_before) + emsg(_(e_compiling_def_function_failed)); +} + +/* + * After ex_function() has collected all the function lines: parse and compile + * the lines into instructions. + * Adds the function to "def_functions". + * When "check_return_type" is set then set ufunc->uf_ret_type to the type of + * the return statement (used for lambda). When uf_ret_type is already set + * then check that it matches. + * When "profiling" is true add ISN_PROF_START instructions. + * "outer_cctx" is set for a nested function. + * This can be used recursively through compile_lambda(), which may reallocate + * "def_functions". + * Returns OK or FAIL. + */ + int +compile_def_function( + ufunc_T *ufunc, + int check_return_type, + compiletype_T compile_type, + cctx_T *outer_cctx) +{ + garray_T lines_to_free; + char *errormsg = NULL; // error message + cctx_T cctx; + garray_T *instr; + int did_emsg_before = did_emsg; + int did_emsg_silent_before = did_emsg_silent; + int ret = FAIL; + sctx_T save_current_sctx = current_sctx; + int save_estack_compiling = estack_compiling; + int save_cmod_flags = cmdmod.cmod_flags; + int do_estack_push; + int new_def_function = FALSE; + + // allocated lines are freed at the end + ga_init2(&lines_to_free, sizeof(char_u *), 50); + + // Initialize the ufunc and the compilation context + if (compile_dfunc_ufunc_init(ufunc, outer_cctx, compile_type, + &new_def_function) == FAIL) + return FAIL; + + compile_dfunc_cctx_init(&cctx, outer_cctx, ufunc, compile_type); + + instr = &cctx.ctx_instr; + + // Set the context to the function, it may be compiled when called from + // another script. Set the script version to the most modern one. + // The line number will be set in next_line_from_context(). + current_sctx = ufunc->uf_script_ctx; + current_sctx.sc_version = SCRIPT_VERSION_MNV9; + + // Don't use the flag from ":legacy" here. + cmdmod.cmod_flags &= ~CMOD_LEGACY; + + // Make sure error messages are OK. + do_estack_push = !estack_top_is_ufunc(ufunc, 1); + if (do_estack_push) + estack_push_ufunc(ufunc, 1); + estack_compiling = TRUE; + + // Make sure arguments don't shadow variables in the context + if (check_args_shadowing(ufunc, &cctx) == FAIL) + goto erret; + + // For an object method and a constructor generate instructions to + // initialize "this" and the object variables. + if (ufunc->uf_flags & (FC_OBJECT|FC_NEW)) + if (obj_method_prologue(ufunc, &cctx) == FAIL) + goto erret; + + if (ufunc->uf_def_args.ga_len > 0) + if (compile_def_function_default_args(ufunc, instr, &cctx) == FAIL) + goto erret; + ufunc->uf_args_visible = ufunc->uf_args.ga_len; + + // Compiling an abstract method or a function in an interface is done to + // get the function type. No code is actually compiled. + if (ufunc->uf_class != NULL && (IS_INTERFACE(ufunc->uf_class) + || IS_ABSTRACT_METHOD(ufunc))) + { + ufunc->uf_def_status = UF_NOT_COMPILED; + ret = OK; + goto erret; + } + + // compile the function body + if (compile_def_function_body(ufunc->uf_lines.ga_len, check_return_type, + &lines_to_free, &errormsg, &cctx) == FAIL) + goto erret; + + if (compile_dfunc_scope_end_missing(&cctx)) + goto erret; + + if (compile_dfunc_generate_default_return(ufunc, &cctx) == FAIL) + goto erret; + + // When compiled with ":silent!" and there was an error don't consider the + // function compiled. + if (emsg_silent == 0 || did_emsg_silent == did_emsg_silent_before) + compile_dfunc_epilogue(outer_cctx, ufunc, instr, &cctx); + + ret = OK; + +erret: + if (ufunc->uf_def_status == UF_COMPILING) + { + // compilation failed. do cleanup. + compile_dfunc_ufunc_cleanup(ufunc, instr, new_def_function, + errormsg, did_emsg_before, &cctx); + } + + if (cctx.ctx_redir_lhs.lhs_name != NULL) + { + if (ret == OK) + { + emsg(_(e_missing_redir_end)); + ret = FAIL; + } + mnv_free(cctx.ctx_redir_lhs.lhs_name); + mnv_free(cctx.ctx_redir_lhs.lhs_whole); + } + + current_sctx = save_current_sctx; + estack_compiling = save_estack_compiling; + cmdmod.cmod_flags = save_cmod_flags; + if (do_estack_push) + estack_pop(); + + ga_clear_strings(&lines_to_free); + free_locals(&cctx); + ga_clear(&cctx.ctx_type_stack); + return ret; +} + + void +set_function_type(ufunc_T *ufunc) +{ + int varargs = ufunc->uf_va_name != NULL; + int argcount = ufunc->uf_args.ga_len; + + // Create a type for the function, with the return type and any + // argument types. + // A vararg is included in uf_args.ga_len but not in uf_arg_types. + // The type is included in "tt_args". + if (argcount > 0 || varargs) + { + if (ufunc->uf_type_list.ga_itemsize == 0) + ga_init2(&ufunc->uf_type_list, sizeof(type_T *), 10); + ufunc->uf_func_type = alloc_func_type(ufunc->uf_ret_type, + argcount, &ufunc->uf_type_list); + // Add argument types to the function type. + if (func_type_add_arg_types(ufunc->uf_func_type, + argcount + varargs, + &ufunc->uf_type_list) == FAIL) + return; + ufunc->uf_func_type->tt_argcount = argcount + varargs; + ufunc->uf_func_type->tt_min_argcount = + argcount - ufunc->uf_def_args.ga_len; + if (ufunc->uf_arg_types == NULL) + { + int i; + + // lambda does not have argument types. + for (i = 0; i < argcount; ++i) + ufunc->uf_func_type->tt_args[i] = &t_any; + } + else + mch_memmove(ufunc->uf_func_type->tt_args, + ufunc->uf_arg_types, sizeof(type_T *) * argcount); + if (varargs) + { + ufunc->uf_func_type->tt_args[argcount] = + ufunc->uf_va_type == NULL ? &t_list_any : ufunc->uf_va_type; + ufunc->uf_func_type->tt_flags = TTFLAG_VARARGS; + } + } + else + // No arguments, can use a predefined type. + ufunc->uf_func_type = get_func_type(ufunc->uf_ret_type, + argcount, &ufunc->uf_type_list); +} + +/* + * Free all instructions for "dfunc" except df_name. + */ + static void +delete_def_function_contents(dfunc_T *dfunc, int mark_deleted) +{ + int idx; + + // In same cases the instructions may refer to a class in which the + // function is defined and unreferencing the class may call back here + // recursively. Set the df_delete_busy to avoid problems. + if (dfunc->df_delete_busy) + return; + dfunc->df_delete_busy = TRUE; + + ga_clear(&dfunc->df_def_args_isn); + ga_clear_strings(&dfunc->df_var_names); + + if (dfunc->df_instr != NULL) + { + for (idx = 0; idx < dfunc->df_instr_count; ++idx) + delete_instr(dfunc->df_instr + idx); + MNV_CLEAR(dfunc->df_instr); + } + if (dfunc->df_instr_debug != NULL) + { + for (idx = 0; idx < dfunc->df_instr_debug_count; ++idx) + delete_instr(dfunc->df_instr_debug + idx); + MNV_CLEAR(dfunc->df_instr_debug); + } +#ifdef FEAT_PROFILE + if (dfunc->df_instr_prof != NULL) + { + for (idx = 0; idx < dfunc->df_instr_prof_count; ++idx) + delete_instr(dfunc->df_instr_prof + idx); + MNV_CLEAR(dfunc->df_instr_prof); + } +#endif + + if (mark_deleted) + dfunc->df_deleted = TRUE; + if (dfunc->df_ufunc != NULL) + dfunc->df_ufunc->uf_def_status = UF_NOT_COMPILED; + + dfunc->df_delete_busy = FALSE; +} + +/* + * When a user function is deleted, clear the contents of any associated def + * function, unless another user function still uses it. + * The position in def_functions can be re-used. + */ + void +unlink_def_function(ufunc_T *ufunc) +{ + if (ufunc->uf_dfunc_idx <= 0) + return; + + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + ufunc->uf_dfunc_idx; + + if (--dfunc->df_refcount <= 0) + delete_def_function_contents(dfunc, TRUE); + ufunc->uf_def_status = UF_NOT_COMPILED; + ufunc->uf_dfunc_idx = 0; + if (dfunc->df_ufunc == ufunc) + dfunc->df_ufunc = NULL; +} + +/* + * Used when a user function refers to an existing dfunc. + */ + void +link_def_function(ufunc_T *ufunc) +{ + if (ufunc->uf_dfunc_idx <= 0) + return; + + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + ufunc->uf_dfunc_idx; + + ++dfunc->df_refcount; +} + +#if defined(EXITFREE) +/* + * Free all functions defined with ":def". + */ + void +free_def_functions(void) +{ + int idx; + + for (idx = 0; idx < def_functions.ga_len; ++idx) + { + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + idx; + + delete_def_function_contents(dfunc, TRUE); + mnv_free(dfunc->df_name); + } + + ga_clear(&def_functions); +} +#endif + + +#endif // FEAT_EVAL diff --git a/uvim/src/mnv9execute.c b/uvim/src/mnv9execute.c new file mode 100644 index 0000000000..d7c37c9714 --- /dev/null +++ b/uvim/src/mnv9execute.c @@ -0,0 +1,8207 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * MNV - MNV is not Vim by Bram Moolenaar + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. + */ + +/* + * mnv9execute.c: execute MNV9 script instructions + */ + +#define USING_FLOAT_STUFF +#include "mnv.h" + +#if defined(FEAT_EVAL) + +// Structure put on ec_trystack when ISN_TRY is encountered. +typedef struct { + int tcd_frame_idx; // ec_frame_idx at ISN_TRY + int tcd_stack_len; // size of ectx.ec_stack at ISN_TRY + int tcd_in_catch; // in catch or finally block + int tcd_did_throw; // set did_throw in :endtry + int tcd_catch_idx; // instruction of the first :catch or :finally + int tcd_finally_idx; // instruction of the :finally block or zero + int tcd_endtry_idx; // instruction of the :endtry + int tcd_caught; // catch block entered + int tcd_cont; // :continue encountered, jump here (minus one) + int tcd_return; // when TRUE return from end of :finally +} trycmd_T; + +// Data local to a function. +// On a function call, if not empty, is saved on the stack and restored when +// returning. +typedef struct { + int floc_restore_cmdmod; + cmdmod_T floc_save_cmdmod; + int floc_restore_cmdmod_stacklen; +} funclocal_T; + +// Structure to hold a reference to an outer_T, with information of whether it +// was allocated. +typedef struct { + outer_T *or_outer; + partial_T *or_partial; // decrement "or_partial->pt_refcount" later + int or_outer_allocated; // free "or_outer" later +} outer_ref_T; + +// A stack is used to store: +// - arguments passed to a :def function +// - info about the calling function, to use when returning +// - local variables +// - temporary values +// +// In detail (FP == Frame Pointer): +// arg1 first argument from caller (if present) +// arg2 second argument from caller (if present) +// extra_arg1 any missing optional argument default value +// FP -> cur_func calling function +// current previous instruction pointer +// frame_ptr previous Frame Pointer +// var1 space for local variable +// var2 space for local variable +// .... fixed space for max. number of local variables +// temp temporary values +// .... flexible space for temporary values (can grow big) + +/* + * Execution context. + */ +struct ectx_S { + garray_T ec_stack; // stack of typval_T values + int ec_frame_idx; // index in ec_stack: context of ec_dfunc_idx + int ec_initial_frame_idx; // frame index when called + + outer_ref_T *ec_outer_ref; // outer scope used for closures, allocated + funclocal_T ec_funclocal; + + garray_T ec_trystack; // stack of trycmd_T values + + isn_T *ec_instr; // array with instructions + int ec_dfunc_idx; // current function index + int ec_iidx; // index in ec_instr: instruction to execute + + garray_T ec_funcrefs; // partials that might be a closure + + int ec_did_emsg_before; + int ec_trylevel_at_start; + where_T ec_where; +}; + +#ifdef FEAT_PROFILE +// stack of profinfo_T used when profiling. +static garray_T profile_info_ga = {0, 0, sizeof(profinfo_T), 20, NULL}; +#endif + +// Get pointer to item in the stack. +#define STACK_TV(idx) (((typval_T *)ectx->ec_stack.ga_data) + idx) + +// Get pointer to item relative to the bottom of the stack, -1 is the last one. +#define STACK_TV_BOT(idx) (((typval_T *)ectx->ec_stack.ga_data) + ectx->ec_stack.ga_len + (idx)) + +// Get pointer to a local variable on the stack. Negative for arguments. +#define STACK_TV_VAR(idx) (((typval_T *)ectx->ec_stack.ga_data) + ectx->ec_frame_idx + STACK_FRAME_SIZE + idx) + +// Return value for functions used to execute instructions +#define EXEC_FAIL 0 +#define EXEC_OK 1 +#define EXEC_DONE 2 + + void +to_string_error(vartype_T vartype) +{ + semsg(_(e_cannot_convert_str_to_string), vartype_name(vartype)); +} + +/* + * Return the number of arguments, including optional arguments and any vararg. + */ + static int +ufunc_argcount(ufunc_T *ufunc) +{ + return ufunc->uf_args.ga_len + (ufunc->uf_va_name != NULL ? 1 : 0); +} + +/* + * Create a new string from "count" items at the bottom of the stack. + * A trailing NUL is appended. + * When "count" is zero an empty string is added to the stack. + */ + static int +exe_concat(int count, ectx_T *ectx) +{ + int idx; + size_t len = 0; + garray_T ga; + typedef struct + { + typval_T *tv; + size_t length; + } string_segment_T; + enum + { + STRING_SEGMENT_CACHE_SIZE = 10 + }; + string_segment_T fixed_string_segment_tab[STRING_SEGMENT_CACHE_SIZE]; + string_segment_T *string_segment_tab = &fixed_string_segment_tab[0]; // an array of cached typevals and lengths + string_segment_T *segment; + + if (count > (int)ARRAY_LENGTH(fixed_string_segment_tab)) + { + // make an array big enough to store the length of each string segment + string_segment_tab = ALLOC_MULT(string_segment_T, count); + if (string_segment_tab == NULL) + return FAIL; + } + + ga_init2(&ga, sizeof(char), 1); + // Preallocate enough space for the whole string to avoid having to grow + // and copy. + for (idx = 0; idx < count; ++idx) + { + segment = &string_segment_tab[idx]; + segment->tv = STACK_TV_BOT(idx - count); + if (segment->tv->vval.v_string != NULL) + { + segment->length = STRLEN(segment->tv->vval.v_string); + len += segment->length; + } + else + segment->length = 0; // Ensure clean state for the second pass + } + + if (ga_grow(&ga, (int)len + 1) == FAIL) + { + if (string_segment_tab != fixed_string_segment_tab) + mnv_free(string_segment_tab); + return FAIL; + } + + for (idx = 0; idx < count; ++idx) + { + segment = &string_segment_tab[idx]; + ga_concat_len(&ga, segment->tv->vval.v_string, segment->length); + clear_tv(segment->tv); + } + + // add a terminating NUL + ga_append(&ga, NUL); + + ectx->ec_stack.ga_len -= count - 1; + STACK_TV_BOT(-1)->vval.v_string = ga.ga_data; + + if (string_segment_tab != fixed_string_segment_tab) + mnv_free(string_segment_tab); + + return OK; +} + +/* + * Create a new list from "count" items at the bottom of the stack. + * When "count" is zero an empty list is added to the stack. + * When "count" is -1 a NULL list is added to the stack. + */ + static int +exe_newlist(int count, ectx_T *ectx) +{ + list_T *list = NULL; + int idx; + typval_T *tv; + + if (count >= 0) + { + list = list_alloc_with_items(count); + if (list == NULL) + return FAIL; + for (idx = 0; idx < count; ++idx) + list_set_item(list, idx, STACK_TV_BOT(idx - count)); + } + + if (count > 0) + ectx->ec_stack.ga_len -= count - 1; + else if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + { + list_unref(list); + return FAIL; + } + else + ++ectx->ec_stack.ga_len; + tv = STACK_TV_BOT(-1); + tv->v_type = VAR_LIST; + tv->vval.v_list = list; + tv->v_lock = 0; + if (list != NULL) + ++list->lv_refcount; + return OK; +} + +/* + * Create a new tuple from "count" items at the bottom of the stack. + * When "count" is zero an empty tuple is added to the stack. + * When "count" is -1 a NULL tuple is added to the stack. + */ + static int +exe_newtuple(int count, ectx_T *ectx) +{ + tuple_T *tuple = NULL; + int idx; + typval_T *tv; + + if (count >= 0) + { + tuple = tuple_alloc_with_items(count); + if (tuple == NULL) + return FAIL; + for (idx = 0; idx < count; ++idx) + tuple_set_item(tuple, idx, STACK_TV_BOT(idx - count)); + } + + if (count > 0) + ectx->ec_stack.ga_len -= count - 1; + else if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + { + tuple_unref(tuple); + return FAIL; + } + else + ++ectx->ec_stack.ga_len; + tv = STACK_TV_BOT(-1); + tv->v_type = VAR_TUPLE; + tv->vval.v_tuple = tuple; + tv->v_lock = 0; + if (tuple != NULL) + ++tuple->tv_refcount; + + return OK; +} + +/* + * Implementation of ISN_NEWDICT. + * Returns FAIL on total failure, MAYBE on error. + */ + static int +exe_newdict(int count, ectx_T *ectx) +{ + dict_T *dict = NULL; + dictitem_T *item; + char_u *key; + int idx; + typval_T *tv; + + if (count >= 0) + { + dict = dict_alloc(); + if (unlikely(dict == NULL)) + return FAIL; + for (idx = 0; idx < count; ++idx) + { + // have already checked key type is VAR_STRING + tv = STACK_TV_BOT(2 * (idx - count)); + // check key is unique + key = tv->vval.v_string == NULL ? (char_u *)"" : tv->vval.v_string; + item = dict_find(dict, key, -1); + if (item != NULL) + { + semsg(_(e_duplicate_key_in_dictionary_str), key); + dict_unref(dict); + return MAYBE; + } + item = dictitem_alloc(key); + clear_tv(tv); + if (unlikely(item == NULL)) + { + dict_unref(dict); + return FAIL; + } + tv = STACK_TV_BOT(2 * (idx - count) + 1); + item->di_tv = *tv; + item->di_tv.v_lock = 0; + tv->v_type = VAR_UNKNOWN; + if (dict_add(dict, item) == FAIL) + { + // can this ever happen? + dictitem_free(item); + dict_unref(dict); + return FAIL; + } + } + } + + if (count > 0) + ectx->ec_stack.ga_len -= 2 * count - 1; + else if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + { + dict_unref(dict); + return FAIL; + } + else + ++ectx->ec_stack.ga_len; + tv = STACK_TV_BOT(-1); + tv->v_type = VAR_DICT; + tv->v_lock = 0; + tv->vval.v_dict = dict; + if (dict != NULL) + ++dict->dv_refcount; + return OK; +} + +/* + * If debug_tick changed check if "ufunc" has a breakpoint and update + * "uf_has_breakpoint". + */ + void +update_has_breakpoint(ufunc_T *ufunc) +{ + if (ufunc->uf_debug_tick == debug_tick) + return; + + linenr_T breakpoint; + + ufunc->uf_debug_tick = debug_tick; + breakpoint = dbg_find_breakpoint(FALSE, ufunc->uf_name, 0); + ufunc->uf_has_breakpoint = breakpoint > 0; +} + +static garray_T dict_stack = GA_EMPTY; + +/* + * Put a value on the dict stack. This consumes "tv". + */ + static int +dict_stack_save(typval_T *tv) +{ + if (dict_stack.ga_growsize == 0) + ga_init2(&dict_stack, sizeof(typval_T), 10); + if (ga_grow(&dict_stack, 1) == FAIL) + return FAIL; + ((typval_T *)dict_stack.ga_data)[dict_stack.ga_len] = *tv; + ++dict_stack.ga_len; + return OK; +} + +/* + * Get the typval at top of the dict stack. + */ + static typval_T * +dict_stack_get_tv(void) +{ + if (dict_stack.ga_len == 0) + return NULL; + return ((typval_T *)dict_stack.ga_data) + dict_stack.ga_len - 1; +} + +/* + * Get the dict at top of the dict stack. + */ + static dict_T * +dict_stack_get_dict(void) +{ + typval_T *tv; + + if (dict_stack.ga_len == 0) + return NULL; + tv = ((typval_T *)dict_stack.ga_data) + dict_stack.ga_len - 1; + if (tv->v_type == VAR_DICT) + return tv->vval.v_dict; + return NULL; +} + +/* + * Drop an item from the dict stack. + */ + static void +dict_stack_drop(void) +{ + if (dict_stack.ga_len == 0) + { + iemsg("Dict stack underflow"); + return; + } + --dict_stack.ga_len; + clear_tv(((typval_T *)dict_stack.ga_data) + dict_stack.ga_len); +} + +/* + * Drop items from the dict stack until the length is equal to "len". + */ + static void +dict_stack_clear(int len) +{ + while (dict_stack.ga_len > len) + dict_stack_drop(); +} + +/* + * Get a pointer to useful "pt_outer" of "pt". + */ + static outer_T * +get_pt_outer(partial_T *pt) +{ + partial_T *ptref = pt->pt_outer_partial; + + if (ptref == NULL) + return &pt->pt_outer; + + // partial using partial (recursively) + while (ptref->pt_outer_partial != NULL) + ptref = ptref->pt_outer_partial; + return &ptref->pt_outer; +} + +/* + * Check "argcount" arguments on the stack against what "ufunc" expects. + * "off" is the offset of arguments on the stack. + * Return OK or FAIL. + */ + static int +check_ufunc_arg_types(ufunc_T *ufunc, int argcount, int off, ectx_T *ectx) +{ + if (ufunc->uf_arg_types == NULL && ufunc->uf_va_type == NULL) + return OK; + + typval_T *argv = STACK_TV_BOT(0) - argcount - off; + + // The function can change at runtime, check that the argument + // types are correct. + for (int i = 0; i < argcount; ++i) + { + type_T *type = NULL; + + // assume a v:none argument, using the default value, is always OK + if (argv[i].v_type == VAR_SPECIAL + && argv[i].vval.v_number == VVAL_NONE) + continue; + // only pass values to user functions, never types + if (check_typval_is_value(&argv[i]) == FAIL) + return FAIL; + + if (i < ufunc->uf_args.ga_len && ufunc->uf_arg_types != NULL) + type = ufunc->uf_arg_types[i]; + else if (ufunc->uf_va_type != NULL) + type = ufunc->uf_va_type->tt_member; + if (type != NULL && check_typval_arg_type(type, + &argv[i], NULL, i + 1) == FAIL) + return FAIL; + } + return OK; +} + +/* + * Call compiled function "cdf_idx" from compiled code. + * This adds a stack frame and sets the instruction pointer to the start of the + * called function. + * If "pt_arg" is not NULL use "pt_arg->pt_outer" for ec_outer_ref->or_outer. + * + * Stack has: + * - current arguments (already there) + * - omitted optional argument (default values) added here + * - stack frame: + * - pointer to calling function + * - Index of next instruction in calling function + * - previous frame pointer + * - reserved space for local variables + */ + static int +call_dfunc( + int cdf_idx, + partial_T *pt_arg, + int argcount_arg, + ectx_T *ectx) +{ + int argcount = argcount_arg; + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + cdf_idx; + ufunc_T *ufunc = dfunc->df_ufunc; + int did_emsg_before = did_emsg_cumul + did_emsg; + int arg_to_add; + int vararg_count = 0; + int varcount; + int idx; + estack_T *entry; + funclocal_T *floc = NULL; + int res = OK; + compiletype_T compile_type; + + if (dfunc->df_deleted) + { + // don't use ufunc->uf_name, it may have been freed + emsg_funcname(e_function_was_deleted_str, + dfunc->df_name == NULL ? (char_u *)"unknown" : dfunc->df_name); + return FAIL; + } + +#ifdef FEAT_PROFILE + if (do_profiling == PROF_YES) + { + if (GA_GROW_OK(&profile_info_ga, 1)) + { + profinfo_T *info = ((profinfo_T *)profile_info_ga.ga_data) + + profile_info_ga.ga_len; + ++profile_info_ga.ga_len; + CLEAR_POINTER(info); + profile_may_start_func(info, ufunc, + (((dfunc_T *)def_functions.ga_data) + + ectx->ec_dfunc_idx)->df_ufunc); + } + } +#endif + + // When debugging and using "cont" switches to the not-debugged + // instructions, may need to still compile them. + compile_type = get_compile_type(ufunc); + if (func_needs_compiling(ufunc, compile_type)) + { + res = compile_def_function(ufunc, FALSE, compile_type, NULL); + + // compile_def_function() may cause def_functions.ga_data to change + dfunc = ((dfunc_T *)def_functions.ga_data) + cdf_idx; + } + if (res == FAIL || INSTRUCTIONS(dfunc) == NULL) + { + if (did_emsg_cumul + did_emsg == did_emsg_before) + semsg(_(e_function_is_not_compiled_str), + printable_func_name(ufunc)); + return FAIL; + } + + if (ufunc->uf_va_name != NULL) + { + // Need to make a list out of the vararg arguments. + // Stack at time of call with 2 varargs: + // normal_arg + // optional_arg + // vararg_1 + // vararg_2 + // After creating the list: + // normal_arg + // optional_arg + // vararg-list + // With missing optional arguments we get: + // normal_arg + // After creating the list + // normal_arg + // (space for optional_arg) + // vararg-list + vararg_count = argcount - ufunc->uf_args.ga_len; + if (vararg_count < 0) + vararg_count = 0; + else + argcount -= vararg_count; + if (exe_newlist(vararg_count, ectx) == FAIL) + return FAIL; + + vararg_count = 1; + } + + arg_to_add = ufunc->uf_args.ga_len - argcount; + if (arg_to_add < 0) + { + semsg(NGETTEXT(e_one_argument_too_many, e_nr_arguments_too_many, + -arg_to_add), -arg_to_add); + return FAIL; + } + else if (arg_to_add > ufunc->uf_def_args.ga_len) + { + int missing = arg_to_add - ufunc->uf_def_args.ga_len; + + semsg(NGETTEXT(e_one_argument_too_few, e_nr_arguments_too_few, + missing), missing); + return FAIL; + } + + // If this is an object method, the object is just before the arguments. + typval_T *obj = STACK_TV_BOT(0) - argcount - vararg_count - 1; + + if (IS_OBJECT_METHOD(ufunc) && !IS_CONSTRUCTOR_METHOD(ufunc) + && obj->v_type == VAR_OBJECT && obj->vval.v_object == NULL) + { + // If this is not a constructor method, then a valid object is + // needed. + emsg(_(e_using_null_object)); + return FAIL; + } + + // Check the argument types. + if (check_ufunc_arg_types(ufunc, argcount, vararg_count, ectx) == FAIL) + return FAIL; + + // While check_ufunc_arg_types call, def function compilation process may + // run. If so many def functions are compiled, def_functions array may be + // reallocated and dfunc may no longer have valid pointer. Get the object + // pointer from def_functions again here. + dfunc = ((dfunc_T *)def_functions.ga_data) + cdf_idx; + + // Reserve space for: + // - missing arguments + // - stack frame + // - local variables + // - if needed: a counter for number of closures created in + // ectx->ec_funcrefs. + varcount = dfunc->df_varcount + dfunc->df_has_closure; + if (GA_GROW_FAILS(&ectx->ec_stack, + arg_to_add + STACK_FRAME_SIZE + varcount)) + return FAIL; + + // The object pointer is in the execution typval stack. The GA_GROW call + // above may have reallocated the execution typval stack. So the object + // pointer may not be valid anymore. Get the object pointer again from the + // execution stack. + obj = STACK_TV_BOT(0) - argcount - vararg_count - 1; + + // If depth of calling is getting too high, don't execute the function. + if (funcdepth_increment() == FAIL) + return FAIL; + ++ex_nesting_level; + + // Only make a copy of funclocal if it contains something to restore. + if (ectx->ec_funclocal.floc_restore_cmdmod) + { + floc = ALLOC_ONE(funclocal_T); + if (floc == NULL) + return FAIL; + *floc = ectx->ec_funclocal; + ectx->ec_funclocal.floc_restore_cmdmod = FALSE; + } + + // Move the vararg-list to below the missing optional arguments. + if (vararg_count > 0 && arg_to_add > 0) + *STACK_TV_BOT(arg_to_add - 1) = *STACK_TV_BOT(-1); + + // Reserve space for omitted optional arguments, filled in soon. + for (idx = 0; idx < arg_to_add; ++idx) + STACK_TV_BOT(idx - vararg_count)->v_type = VAR_UNKNOWN; + ectx->ec_stack.ga_len += arg_to_add; + + // Store current execution state in stack frame for ISN_RETURN. + STACK_TV_BOT(STACK_FRAME_FUNC_OFF)->vval.v_number = ectx->ec_dfunc_idx; + STACK_TV_BOT(STACK_FRAME_IIDX_OFF)->vval.v_number = ectx->ec_iidx; + STACK_TV_BOT(STACK_FRAME_INSTR_OFF)->vval.v_string = (void *)ectx->ec_instr; + STACK_TV_BOT(STACK_FRAME_OUTER_OFF)->vval.v_string = + (void *)ectx->ec_outer_ref; + STACK_TV_BOT(STACK_FRAME_FUNCLOCAL_OFF)->vval.v_string = (void *)floc; + STACK_TV_BOT(STACK_FRAME_IDX_OFF)->vval.v_number = ectx->ec_frame_idx; + ectx->ec_frame_idx = ectx->ec_stack.ga_len; + + // Initialize all local variables to number zero. Also initialize the + // variable that counts how many closures were created. This is used in + // handle_closure_in_use(). + int initcount = dfunc->df_varcount + (dfunc->df_has_closure ? 1 : 0); + for (idx = 0; idx < initcount; ++idx) + { + typval_T *tv = STACK_TV_BOT(STACK_FRAME_SIZE + idx); + + tv->v_type = VAR_NUMBER; + tv->vval.v_number = 0; + } + ectx->ec_stack.ga_len += STACK_FRAME_SIZE + varcount; + + // For an object method move the object from just before the arguments to + // the first local variable. + if (IS_OBJECT_METHOD(ufunc)) + { + if (obj->v_type != VAR_OBJECT) + { + semsg(_(e_internal_error_str), "type in stack is not an object"); + return FAIL; + } + + *STACK_TV_VAR(0) = *obj; + obj->v_type = VAR_UNKNOWN; + } + + partial_T *pt = pt_arg != NULL ? pt_arg : ufunc->uf_partial; + if (pt != NULL || (ufunc->uf_flags & FC_CLOSURE)) + { + outer_ref_T *ref = ALLOC_CLEAR_ONE(outer_ref_T); + + if (ref == NULL) + return FAIL; + if (pt != NULL) + { + ref->or_outer = get_pt_outer(pt); + ++pt->pt_refcount; + ref->or_partial = pt; + } + else + { + ref->or_outer = ALLOC_CLEAR_ONE(outer_T); + if (unlikely(ref->or_outer == NULL)) + { + mnv_free(ref); + return FAIL; + } + ref->or_outer_allocated = TRUE; + ref->or_outer->out_stack = &ectx->ec_stack; + ref->or_outer->out_frame_idx = ectx->ec_frame_idx; + if (ectx->ec_outer_ref != NULL) + ref->or_outer->out_up = ectx->ec_outer_ref->or_outer; + } + ectx->ec_outer_ref = ref; + } + else + ectx->ec_outer_ref = NULL; + + ++ufunc->uf_calls; + + // Set execution state to the start of the called function. + ectx->ec_dfunc_idx = cdf_idx; + ectx->ec_instr = INSTRUCTIONS(dfunc); + entry = estack_push_ufunc(ufunc, 1); + if (entry != NULL) + { + // Set the script context to the script where the function was defined. + // Save the current context so it can be restored on return. + entry->es_save_sctx = current_sctx; + current_sctx = ufunc->uf_script_ctx; + } + + // Start execution at the first instruction. + ectx->ec_iidx = 0; + + return OK; +} + +// Double linked list of funcstack_T in use. +static funcstack_T *first_funcstack = NULL; + + static void +add_funcstack_to_list(funcstack_T *funcstack) +{ + // Link in list of funcstacks. + if (first_funcstack != NULL) + first_funcstack->fs_prev = funcstack; + funcstack->fs_next = first_funcstack; + funcstack->fs_prev = NULL; + first_funcstack = funcstack; +} + + static void +remove_funcstack_from_list(funcstack_T *funcstack) +{ + if (funcstack->fs_prev == NULL) + first_funcstack = funcstack->fs_next; + else + funcstack->fs_prev->fs_next = funcstack->fs_next; + if (funcstack->fs_next != NULL) + funcstack->fs_next->fs_prev = funcstack->fs_prev; +} + +/* + * Used when returning from a function: Check if any closure is still + * referenced. If so then move the arguments and variables to a separate piece + * of stack to be used when the closure is called. + * When "free_arguments" is TRUE the arguments are to be freed. + * Returns FAIL when out of memory. + */ + static int +handle_closure_in_use(ectx_T *ectx, int free_arguments) +{ + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + ectx->ec_dfunc_idx; + int argcount; + int top; + int idx; + typval_T *tv; + int closure_in_use = FALSE; + garray_T *gap = &ectx->ec_funcrefs; + varnumber_T closure_count; + + if (dfunc->df_ufunc == NULL) + return OK; // function was freed + if (dfunc->df_has_closure == 0) + return OK; // no closures + tv = STACK_TV(ectx->ec_frame_idx + STACK_FRAME_SIZE + dfunc->df_varcount); + closure_count = tv->vval.v_number; + if (closure_count == 0) + return OK; // no funcrefs created + + // Compute "top": the first entry in the stack used by the function. + // This is the first argument (after that comes the stack frame and then + // the local variables). + argcount = ufunc_argcount(dfunc->df_ufunc); + top = ectx->ec_frame_idx - argcount; + + // Check if any created closure is still in use. + for (idx = 0; idx < closure_count; ++idx) + { + partial_T *pt; + int off = gap->ga_len - closure_count + idx; + + if (off < 0) + continue; // count is off or already done + pt = ((partial_T **)gap->ga_data)[off]; + if (pt->pt_refcount > 1) + { + int refcount = pt->pt_refcount; + int i; + + // A Reference in a local variable doesn't count, it gets + // unreferenced on return. + for (i = 0; i < dfunc->df_varcount; ++i) + { + typval_T *stv = STACK_TV(ectx->ec_frame_idx + + STACK_FRAME_SIZE + i); + if (stv->v_type == VAR_PARTIAL && pt == stv->vval.v_partial) + --refcount; + } + if (refcount > 1) + { + closure_in_use = TRUE; + break; + } + } + } + + if (closure_in_use) + { + funcstack_T *funcstack = ALLOC_CLEAR_ONE(funcstack_T); + typval_T *stack; + + // A closure is using the arguments and/or local variables. + // Move them to the called function. + if (funcstack == NULL) + return FAIL; + + funcstack->fs_var_offset = argcount + STACK_FRAME_SIZE; + funcstack->fs_ga.ga_len = funcstack->fs_var_offset + + dfunc->df_varcount; + stack = ALLOC_CLEAR_MULT(typval_T, funcstack->fs_ga.ga_len); + funcstack->fs_ga.ga_data = stack; + if (stack == NULL) + { + mnv_free(funcstack); + return FAIL; + } + add_funcstack_to_list(funcstack); + + // Move or copy the arguments. + for (idx = 0; idx < argcount; ++idx) + { + tv = STACK_TV(top + idx); + if (free_arguments) + { + *(stack + idx) = *tv; + tv->v_type = VAR_UNKNOWN; + } + else + copy_tv(tv, stack + idx); + } + // Skip the stack frame. + // Move the local variables. + for (idx = 0; idx < dfunc->df_varcount; ++idx) + { + tv = STACK_TV(ectx->ec_frame_idx + STACK_FRAME_SIZE + idx); + + // A partial created for a local function, that is also used as a + // local variable, has a reference count for the variable, thus + // will never go down to zero. When all these refcounts are one + // then the funcstack is unused. We need to count how many we have + // so we know when to check. + if (tv->v_type == VAR_PARTIAL && tv->vval.v_partial != NULL) + { + int i; + + for (i = 0; i < closure_count; ++i) + if (tv->vval.v_partial == ((partial_T **)gap->ga_data)[ + gap->ga_len - closure_count + i]) + ++funcstack->fs_min_refcount; + } + + *(stack + funcstack->fs_var_offset + idx) = *tv; + tv->v_type = VAR_UNKNOWN; + } + + for (idx = 0; idx < closure_count; ++idx) + { + partial_T *pt = ((partial_T **)gap->ga_data)[gap->ga_len + - closure_count + idx]; + if (pt->pt_refcount > 1) + { + ++funcstack->fs_refcount; + pt->pt_funcstack = funcstack; + pt->pt_outer.out_stack = &funcstack->fs_ga; + pt->pt_outer.out_frame_idx = ectx->ec_frame_idx - top; + } + } + } + + for (idx = 0; idx < closure_count; ++idx) + partial_unref(((partial_T **)gap->ga_data)[gap->ga_len + - closure_count + idx]); + gap->ga_len -= closure_count; + if (gap->ga_len == 0) + ga_clear(gap); + + return OK; +} + +/* + * Called when a partial is freed or its reference count goes down to one. The + * funcstack may be the only reference to the partials in the local variables. + * Go over all of them, the funcref and can be freed if all partials + * referencing the funcstack have a reference count of one. + * Returns TRUE if the funcstack is freed, the partial referencing it will then + * also have been freed. + */ + int +funcstack_check_refcount(funcstack_T *funcstack) +{ + int i; + garray_T *gap = &funcstack->fs_ga; + int done = 0; + typval_T *stack; + + if (funcstack->fs_refcount > funcstack->fs_min_refcount) + return FALSE; + for (i = funcstack->fs_var_offset; i < gap->ga_len; ++i) + { + typval_T *tv = ((typval_T *)gap->ga_data) + i; + + if (tv->v_type == VAR_PARTIAL && tv->vval.v_partial != NULL + && tv->vval.v_partial->pt_funcstack == funcstack + && tv->vval.v_partial->pt_refcount == 1) + ++done; + } + if (done != funcstack->fs_min_refcount) + return FALSE; + + stack = gap->ga_data; + + // All partials referencing the funcstack have a reference count of + // one, thus the funcstack is no longer of use. + for (i = 0; i < gap->ga_len; ++i) + clear_tv(stack + i); + mnv_free(stack); + remove_funcstack_from_list(funcstack); + mnv_free(funcstack); + + return TRUE; +} + +/* + * For garbage collecting: set references in all variables referenced by + * all funcstacks. + */ + int +set_ref_in_funcstacks(int copyID) +{ + funcstack_T *funcstack; + + for (funcstack = first_funcstack; funcstack != NULL; + funcstack = funcstack->fs_next) + { + typval_T *stack = funcstack->fs_ga.ga_data; + int i; + + for (i = 0; i < funcstack->fs_ga.ga_len; ++i) + if (set_ref_in_item(stack + i, copyID, NULL, NULL, NULL)) + return TRUE; // abort + } + return FALSE; +} + +// Ugly static to avoid passing the execution context around through many +// layers. +static ectx_T *current_ectx = NULL; + +/* + * Return TRUE if currently executing a :def function. + * Can be used by builtin functions only. + */ + int +in_def_function(void) +{ + return current_ectx != NULL; +} + +/* + * If executing a class/object method, then fill in the lval_T. + * Set lr_tv to the executing item, and lr_exec_class to the executing class; + * use free_tv and class_unref when finished with the lval_root. + * For use by builtin functions. + * + * Return FAIL and do nothing if not executing in a class; otherwise OK. + */ + int +fill_exec_lval_root(lval_root_T *root) +{ + ectx_T *ectx = current_ectx; + if (ectx != NULL) + { + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + current_ectx->ec_dfunc_idx; + ufunc_T *ufunc = dfunc->df_ufunc; + if (ufunc->uf_class != NULL) // executing a method? + { + typval_T *tv = alloc_tv(); + if (tv != NULL) + { + CLEAR_POINTER(root); + root->lr_tv = tv; + copy_tv(STACK_TV_VAR(0), root->lr_tv); + root->lr_cl_exec = ufunc->uf_class; + ++root->lr_cl_exec->class_refcount; + return OK; + } + } + } + + return FAIL; +} + +/* + * Clear "current_ectx" and return the previous value. To be used when calling + * a user function. + */ + ectx_T * +clear_current_ectx(void) +{ + ectx_T *r = current_ectx; + + current_ectx = NULL; + return r; +} + + void +restore_current_ectx(ectx_T *ectx) +{ + if (current_ectx != NULL) + iemsg("Restoring current_ectx while it is not NULL"); + current_ectx = ectx; +} + +/* + * Add an entry for a deferred function call to the currently executing + * function. + * Return the list or NULL when failed. + */ + static list_T * +add_defer_item(int var_idx, int argcount, ectx_T *ectx) +{ + typval_T *defer_tv = STACK_TV_VAR(var_idx); + list_T *defer_l; + list_T *l; + typval_T listval; + + if (defer_tv->v_type != VAR_LIST) + { + // first time, allocate the list + if (rettv_list_alloc(defer_tv) == FAIL) + return NULL; + } + defer_l = defer_tv->vval.v_list; + + l = list_alloc_with_items(argcount + 1); + if (l == NULL) + return NULL; + listval.v_type = VAR_LIST; + listval.vval.v_list = l; + listval.v_lock = 0; + if (list_insert_tv(defer_l, &listval, defer_l->lv_first) == FAIL) + { + mnv_free(l); + return NULL; + } + + return l; +} + +/* + * Handle ISN_DEFER. Stack has a function reference and "argcount" arguments. + * The local variable that lists deferred functions is "var_idx". + * Returns OK or FAIL. + */ + static int +defer_command(int var_idx, int argcount, ectx_T *ectx) +{ + list_T *l = add_defer_item(var_idx, argcount, ectx); + int i; + typval_T *func_tv; + + if (l == NULL) + return FAIL; + + func_tv = STACK_TV_BOT(-argcount - 1); + if (func_tv->v_type != VAR_PARTIAL && func_tv->v_type != VAR_FUNC) + { + semsg(_(e_expected_str_but_got_str), + "function or partial", + vartype_name(func_tv->v_type)); + return FAIL; + } + list_set_item(l, 0, func_tv); + + for (i = 0; i < argcount; ++i) + list_set_item(l, i + 1, STACK_TV_BOT(-argcount + i)); + ectx->ec_stack.ga_len -= argcount + 1; + return OK; +} + +/* + * Add a deferred call for "name" with arguments "argvars[argcount]". + * Consumes "name", also on failure. + * Only to be called when in_def_function() returns TRUE. + */ + int +add_defer_function(char_u *name, int argcount, typval_T *argvars) +{ + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + current_ectx->ec_dfunc_idx; + list_T *l; + typval_T func_tv; + int i; + + if (dfunc->df_defer_var_idx == 0) + { + iemsg("df_defer_var_idx is zero"); + mnv_free(name); + return FAIL; + } + + l = add_defer_item(dfunc->df_defer_var_idx - 1, argcount, current_ectx); + if (l == NULL) + { + mnv_free(name); + return FAIL; + } + + func_tv.v_type = VAR_FUNC; + func_tv.v_lock = 0; + func_tv.vval.v_string = name; + list_set_item(l, 0, &func_tv); + + for (i = 0; i < argcount; ++i) + list_set_item(l, i + 1, argvars + i); + return OK; +} + +/* + * Invoked when returning from a function: Invoke any deferred calls. + */ + static void +invoke_defer_funcs(ectx_T *ectx) +{ + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + ectx->ec_dfunc_idx; + typval_T *defer_tv = STACK_TV_VAR(dfunc->df_defer_var_idx - 1); + listitem_T *li; + + if (defer_tv->v_type != VAR_LIST) + return; // no function added + FOR_ALL_LIST_ITEMS(defer_tv->vval.v_list, li) + { + list_T *l = li->li_tv.vval.v_list; + typval_T rettv; + typval_T argvars[MAX_FUNC_ARGS]; + int i; + listitem_T *arg_li = l->lv_first; + typval_T *functv = &l->lv_first->li_tv; + int argcount = l->lv_len - 1; + + if (functv->vval.v_string == NULL) + // already being called, can happen if function does ":qa" + continue; + + for (i = 0; i < argcount; ++i) + { + arg_li = arg_li->li_next; + argvars[i] = arg_li->li_tv; + } + + funcexe_T funcexe; + char_u *name = NULL; + partial_T *pt = NULL; + + CLEAR_FIELD(funcexe); + funcexe.fe_evaluate = TRUE; + rettv.v_type = VAR_UNKNOWN; + + if (functv->v_type == VAR_PARTIAL) + { + pt = functv->vval.v_partial; + functv->vval.v_partial = NULL; + + name = pt->pt_func->uf_name; + funcexe.fe_partial = pt; + funcexe.fe_object = pt->pt_obj; + if (funcexe.fe_object != NULL) + ++funcexe.fe_object->obj_refcount; + } + else + { + name = functv->vval.v_string; + functv->vval.v_string = NULL; + } + + // If the deferred function is called after an exception, then only the + // first statement in the function will be executed (because of the + // exception). So save and restore the try/catch/throw exception + // state. + exception_state_T estate; + exception_state_save(&estate); + exception_state_clear(); + + (void)call_func(name, -1, &rettv, argcount, argvars, &funcexe); + + exception_state_restore(&estate); + + clear_tv(&rettv); + if (functv->v_type == VAR_PARTIAL) + partial_unref(pt); + else + mnv_free(name); + } +} + +/* + * Return from the current function. + */ + static int +func_return(ectx_T *ectx) +{ + int idx; + int ret_idx; + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + ectx->ec_dfunc_idx; + int argcount = ufunc_argcount(dfunc->df_ufunc); + estack_T *entry; + int prev_dfunc_idx = STACK_TV(ectx->ec_frame_idx + + STACK_FRAME_FUNC_OFF)->vval.v_number; + funclocal_T *floc; +#ifdef FEAT_PROFILE + dfunc_T *prev_dfunc = ((dfunc_T *)def_functions.ga_data) + + prev_dfunc_idx; + + if (do_profiling == PROF_YES) + { + ufunc_T *caller = prev_dfunc->df_ufunc; + + if (dfunc->df_ufunc->uf_profiling + || (caller != NULL && caller->uf_profiling)) + { + profile_may_end_func(((profinfo_T *)profile_info_ga.ga_data) + + profile_info_ga.ga_len - 1, dfunc->df_ufunc, caller); + --profile_info_ga.ga_len; + } + } +#endif + + if (dfunc->df_defer_var_idx > 0) + invoke_defer_funcs(ectx); + + // No check for uf_refcount being zero, cannot think of a way that would + // happen. + --dfunc->df_ufunc->uf_calls; + + // execution context goes one level up + entry = estack_pop(); + if (entry != NULL) + current_sctx = entry->es_save_sctx; + + if (handle_closure_in_use(ectx, TRUE) == FAIL) + return FAIL; + + // Clear the arguments. If this was an object method also clear the + // object, it is just before the arguments. + int top = ectx->ec_frame_idx - argcount; + if (IS_OBJECT_METHOD(dfunc->df_ufunc)) + --top; + for (idx = top; idx < ectx->ec_frame_idx; ++idx) + clear_tv(STACK_TV(idx)); + + // Clear local variables and temp values, but not the return value. + for (idx = ectx->ec_frame_idx + STACK_FRAME_SIZE; + idx < ectx->ec_stack.ga_len - 1; ++idx) + clear_tv(STACK_TV(idx)); + + // The return value should be on top of the stack. However, when aborting + // it may not be there and ec_frame_idx is the top of the stack. + ret_idx = ectx->ec_stack.ga_len - 1; + if (ret_idx == ectx->ec_frame_idx + STACK_FRAME_IDX_OFF) + ret_idx = 0; + + if (ectx->ec_outer_ref != NULL) + { + if (ectx->ec_outer_ref->or_outer_allocated) + mnv_free(ectx->ec_outer_ref->or_outer); + partial_unref(ectx->ec_outer_ref->or_partial); + mnv_free(ectx->ec_outer_ref); + } + + // Restore the previous frame. + ectx->ec_dfunc_idx = prev_dfunc_idx; + ectx->ec_iidx = STACK_TV(ectx->ec_frame_idx + + STACK_FRAME_IIDX_OFF)->vval.v_number; + ectx->ec_instr = (void *)STACK_TV(ectx->ec_frame_idx + + STACK_FRAME_INSTR_OFF)->vval.v_string; + ectx->ec_outer_ref = (void *)STACK_TV(ectx->ec_frame_idx + + STACK_FRAME_OUTER_OFF)->vval.v_string; + floc = (void *)STACK_TV(ectx->ec_frame_idx + + STACK_FRAME_FUNCLOCAL_OFF)->vval.v_string; + // restoring ec_frame_idx must be last + ectx->ec_frame_idx = STACK_TV(ectx->ec_frame_idx + + STACK_FRAME_IDX_OFF)->vval.v_number; + + if (floc == NULL) + ectx->ec_funclocal.floc_restore_cmdmod = FALSE; + else + { + ectx->ec_funclocal = *floc; + mnv_free(floc); + } + + if (ret_idx > 0) + { + // Reset the stack to the position before the call, with a spot for the + // return value, moved there from above the frame. + ectx->ec_stack.ga_len = top + 1; + *STACK_TV_BOT(-1) = *STACK_TV(ret_idx); + } + else + // Reset the stack to the position before the call. + ectx->ec_stack.ga_len = top; + + funcdepth_decrement(); + --ex_nesting_level; + return OK; +} + +/* + * Prepare arguments and rettv for calling a builtin or user function. + */ + static int +call_prepare(int argcount, typval_T *argvars, ectx_T *ectx) +{ + int idx; + typval_T *tv; + + // Move arguments from bottom of the stack to argvars[] and add terminator. + for (idx = 0; idx < argcount; ++idx) + argvars[idx] = *STACK_TV_BOT(idx - argcount); + argvars[argcount].v_type = VAR_UNKNOWN; + + // Result replaces the arguments on the stack. + if (argcount > 0) + ectx->ec_stack.ga_len -= argcount - 1; + else if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + return FAIL; + else + ++ectx->ec_stack.ga_len; + + // Default return value is zero. + tv = STACK_TV_BOT(-1); + tv->v_type = VAR_NUMBER; + tv->vval.v_number = 0; + tv->v_lock = 0; + + return OK; +} + +/* + * Call a builtin function by index. + */ + static int +call_bfunc(int func_idx, int argcount, ectx_T *ectx) +{ + typval_T argvars[MAX_FUNC_ARGS]; + int idx; + int did_emsg_before = did_emsg; + ectx_T *prev_ectx = current_ectx; + char *save_func_name = ectx->ec_where.wt_func_name; + + if (call_prepare(argcount, argvars, ectx) == FAIL) + return FAIL; + ectx->ec_where.wt_func_name = internal_func_name(func_idx); + + // Call the builtin function. Set "current_ectx" so that when it + // recursively invokes call_def_function() a closure context can be set. + current_ectx = ectx; + call_internal_func_by_idx(func_idx, argvars, STACK_TV_BOT(-1)); + current_ectx = prev_ectx; + ectx->ec_where.wt_func_name = save_func_name; + + // Clear the arguments. + for (idx = 0; idx < argcount; ++idx) + clear_tv(&argvars[idx]); + + if (did_emsg > did_emsg_before) + return FAIL; + return OK; +} + +/* + * Execute a user defined function. + * If the function is compiled this will add a stack frame and set the + * instruction pointer at the start of the function. + * Otherwise the function is called here. + * If "pt" is not null use "pt->pt_outer" for ec_outer_ref->or_outer. + * "iptr" can be used to replace the instruction with a more efficient one. + */ + static int +call_ufunc( + ufunc_T *ufunc, + partial_T *pt, + int argcount, + ectx_T *ectx, + isn_T *iptr, + dict_T *selfdict) +{ + typval_T argvars[MAX_FUNC_ARGS]; + funcexe_T funcexe; + funcerror_T error; + int idx; + int did_emsg_before = did_emsg; + compiletype_T compile_type = get_compile_type(ufunc); + + if (func_needs_compiling(ufunc, compile_type) + && compile_def_function(ufunc, FALSE, compile_type, NULL) + == FAIL) + return FAIL; + if (ufunc->uf_def_status == UF_COMPILED) + { + error = check_user_func_argcount(ufunc, argcount); + if (error != FCERR_UNKNOWN) + { + if (error == FCERR_TOOMANY) + semsg(_(e_too_many_arguments_for_function_str), + printable_func_name(ufunc)); + else + semsg(_(e_not_enough_arguments_for_function_str), + printable_func_name(ufunc)); + return FAIL; + } + + // The function has been compiled, can call it quickly. For a function + // that was defined later: we can call it directly next time. + if (iptr != NULL) + { + delete_instr(iptr); + iptr->isn_type = ISN_DCALL; + iptr->isn_arg.dfunc.cdf_idx = ufunc->uf_dfunc_idx; + iptr->isn_arg.dfunc.cdf_argcount = argcount; + } + return call_dfunc(ufunc->uf_dfunc_idx, pt, argcount, ectx); + } + + if (call_prepare(argcount, argvars, ectx) == FAIL) + return FAIL; + CLEAR_FIELD(funcexe); + funcexe.fe_evaluate = TRUE; + funcexe.fe_selfdict = selfdict != NULL ? selfdict : dict_stack_get_dict(); + + // Call the user function. Result goes in last position on the stack. + error = call_user_func_check(ufunc, argcount, argvars, + STACK_TV_BOT(-1), &funcexe, funcexe.fe_selfdict); + + // Clear the arguments. + for (idx = 0; idx < argcount; ++idx) + clear_tv(&argvars[idx]); + + if (error != FCERR_NONE) + { + user_func_error(error, printable_func_name(ufunc), + funcexe.fe_found_var); + return FAIL; + } + if (did_emsg > did_emsg_before) + // Error other than from calling the function itself. + return FAIL; + return OK; +} + +/* + * If command modifiers were applied restore them. + */ + static void +may_restore_cmdmod(funclocal_T *funclocal) +{ + if (funclocal->floc_restore_cmdmod) + { + cmdmod.cmod_filter_regmatch.regprog = NULL; + undo_cmdmod(&cmdmod); + cmdmod = funclocal->floc_save_cmdmod; + funclocal->floc_restore_cmdmod = FALSE; + } +} + +/* + * Return TRUE if an error was given (not caught in try/catch) or CTRL-C was + * pressed. + */ + static int +mnv9_aborting(int prev_uncaught_emsg) +{ + return uncaught_emsg > prev_uncaught_emsg || got_int || did_throw; +} + +/* + * Execute a function by "name". + * This can be a builtin function or a user function. + * "iptr" can be used to replace the instruction with a more efficient one. + * Returns FAIL if not found without an error message. + */ + static int +call_by_name( + char_u *name, + int argcount, + ectx_T *ectx, + isn_T *iptr, + dict_T *selfdict) +{ + ufunc_T *ufunc; + + if (builtin_function(name, -1)) + { + int func_idx = find_internal_func(name); + + if (func_idx < 0) // Impossible? + return FAIL; + if (check_internal_func(func_idx, argcount) < 0) + return FAIL; + return call_bfunc(func_idx, argcount, ectx); + } + + char_u cc = NUL; + char_u *start_bracket = generic_func_find_open_bracket(name); + if (start_bracket != NULL) + { + cc = *start_bracket; + *start_bracket = NUL; + } + + ufunc = find_func(name, FALSE); + + if (ufunc == NULL) + { + int prev_uncaught_emsg = uncaught_emsg; + + if (script_autoload(name, TRUE)) + // loaded a package, search for the function again + ufunc = find_func(name, FALSE); + + if (mnv9_aborting(prev_uncaught_emsg)) + { + if (start_bracket != NULL) + *start_bracket = cc; + return FAIL; // bail out if loading the script caused an error + } + } + + if (start_bracket != NULL) + *start_bracket = cc; + + if (ufunc != NULL) + { + if (IS_GENERIC_FUNC(ufunc)) + { + if (start_bracket != NULL) + ufunc = find_generic_func(ufunc, name, &start_bracket); + else + { + emsg_funcname(e_generic_func_missing_type_args_str, name); + ufunc = NULL; + } + if (ufunc == NULL) + return FAIL; + } + else if (start_bracket != NULL) + { + emsg_funcname(e_not_a_generic_function_str, name); + return FAIL; + } + + if (check_ufunc_arg_types(ufunc, argcount, 0, ectx) == FAIL) + return FAIL; + + return call_ufunc(ufunc, NULL, argcount, ectx, iptr, selfdict); + } + + return FAIL; +} + + static int +call_partial( + typval_T *tv, + int argcount_arg, + ectx_T *ectx) +{ + int argcount = argcount_arg; + char_u *name = NULL; + int called_emsg_before = called_emsg; + int res = FAIL; + dict_T *selfdict = NULL; + + if (tv->v_type == VAR_PARTIAL) + { + partial_T *pt = tv->vval.v_partial; + int i; + + if (pt->pt_obj != NULL) + { + // partial with an object method. Push the object before the + // function arguments. + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + return FAIL; + for (i = 1; i <= argcount; ++i) + *STACK_TV_BOT(-i + 1) = *STACK_TV_BOT(-i); + + typval_T *obj_tv = STACK_TV_BOT(-argcount); + obj_tv->v_type = VAR_OBJECT; + obj_tv->v_lock = 0; + obj_tv->vval.v_object = pt->pt_obj; + ++pt->pt_obj->obj_refcount; + ++ectx->ec_stack.ga_len; + } + + if (pt->pt_argc > 0) + { + // Make space for arguments from the partial, shift the "argcount" + // arguments up. + if (GA_GROW_FAILS(&ectx->ec_stack, pt->pt_argc)) + return FAIL; + for (i = 1; i <= argcount; ++i) + *STACK_TV_BOT(-i + pt->pt_argc) = *STACK_TV_BOT(-i); + ectx->ec_stack.ga_len += pt->pt_argc; + argcount += pt->pt_argc; + + // copy the arguments from the partial onto the stack + for (i = 0; i < pt->pt_argc; ++i) + copy_tv(&pt->pt_argv[i], STACK_TV_BOT(-argcount + i)); + } + selfdict = pt->pt_dict; + + if (pt->pt_func != NULL) + return call_ufunc(pt->pt_func, pt, argcount, ectx, NULL, selfdict); + + name = pt->pt_name; + } + else if (tv->v_type == VAR_FUNC) + name = tv->vval.v_string; + if (name != NULL) + { + char_u fname_buf[FLEN_FIXED + 1]; + char_u *tofree = NULL; + funcerror_T error = FCERR_NONE; + char_u *fname; + + // May need to translate 123_ to K_SNR. + fname = fname_trans_sid(name, fname_buf, &tofree, &error); + if (error != FCERR_NONE) + res = FAIL; + else + res = call_by_name(fname, argcount, ectx, NULL, selfdict); + mnv_free(tofree); + } + + if (res == FAIL) + { + if (called_emsg == called_emsg_before) + emsg_funcname(e_unknown_function_str, + name == NULL ? (char_u *)"[unknown]" : name); + return FAIL; + } + return OK; +} + +/* + * Check if "lock" is VAR_LOCKED or VAR_FIXED. If so give an error and return + * TRUE. + */ + static int +error_if_locked(int lock, char *error) +{ + if (lock & (VAR_LOCKED | VAR_FIXED)) + { + emsg(_(error)); + return TRUE; + } + return FALSE; +} + +/* + * Give an error if "tv" is not a number and return FAIL. + */ + static int +check_for_number(typval_T *tv) +{ + if (tv->v_type != VAR_NUMBER) + { + semsg(_(e_expected_str_but_got_str), + vartype_name(VAR_NUMBER), vartype_name(tv->v_type)); + return FAIL; + } + return OK; +} + +/* + * Store "tv" in variable "name". + * This is for s: and g: variables. + */ + static void +store_var(char_u *name, typval_T *tv) +{ + funccal_entry_T entry; + int flags = ASSIGN_DECL; + + if (tv->v_lock) + flags |= ASSIGN_CONST; + save_funccal(&entry); + set_var_const(name, 0, NULL, tv, FALSE, flags, 0); + restore_funccal(); +} + +/* + * Convert "tv" to a string. + * Return FAIL if not allowed. + */ + static int +do_2string(typval_T *tv, int is_2string_any, int tostring_flags) +{ + if (tv->v_type == VAR_STRING) + return OK; + + char_u *str; + + if (is_2string_any) + { + switch (tv->v_type) + { + case VAR_SPECIAL: + case VAR_BOOL: + case VAR_NUMBER: + case VAR_FLOAT: + case VAR_DICT: + case VAR_BLOB: break; + + case VAR_LIST: + if (tostring_flags & TOSTRING_TOLERANT) + { + char_u *s, *e, *p; + garray_T ga; + + ga_init2(&ga, sizeof(char_u *), 1); + + // Convert to NL separated items, then + // escape the items and replace the NL with + // a space. + str = typval2string(tv, TRUE); + if (str == NULL) + return FAIL; + s = str; + while ((e = mnv_strchr(s, '\n')) != NULL) + { + *e = NUL; + p = mnv_strsave_fnameescape(s, + VSE_NONE); + if (p != NULL) + { + ga_concat(&ga, p); + GA_CONCAT_LITERAL(&ga, " "); + mnv_free(p); + } + s = e + 1; + } + mnv_free(str); + clear_tv(tv); + tv->v_type = VAR_STRING; + tv->vval.v_string = ga.ga_data; + return OK; + } + if (tostring_flags & TOSTRING_INTERPOLATE) + break; + // FALLTHROUGH + default: to_string_error(tv->v_type); + return FAIL; + } + } + str = typval_tostring(tv, TRUE); + clear_tv(tv); + tv->v_type = VAR_STRING; + tv->vval.v_string = str; + return OK; +} + +/* + * When the value of "sv" is a null list of dict, allocate it. + */ + static void +allocate_if_null(svar_T *sv) +{ + typval_T *tv = sv->sv_tv; + + switch (tv->v_type) + { + case VAR_LIST: + if (tv->vval.v_list == NULL && sv->sv_type != &t_list_empty) + (void)rettv_list_alloc(tv); + break; + case VAR_TUPLE: + if (tv->vval.v_tuple == NULL && sv->sv_type != &t_tuple_empty) + (void)rettv_tuple_alloc(tv); + break; + case VAR_DICT: + if (tv->vval.v_dict == NULL && sv->sv_type != &t_dict_empty) + (void)rettv_dict_alloc(tv); + break; + case VAR_BLOB: + if (tv->vval.v_blob == NULL && sv->sv_type != &t_blob_null) + (void)rettv_blob_alloc(tv); + break; + default: + break; + } +} + +/* + * Return the character "str[index]" where "index" is the character index, + * including composing characters. + * If "index" is out of range NULL is returned. + */ + char_u * +char_from_string(char_u *str, varnumber_T index) +{ + size_t nbyte = 0; + varnumber_T nchar = index; + size_t slen; + + if (str == NULL) + return NULL; + slen = STRLEN(str); + + // Do the same as for a list: a negative index counts from the end. + // Optimization to check the first byte to be below 0x80 (and no composing + // character follows) makes this a lot faster. + if (index < 0) + { + int clen = 0; + + for (nbyte = 0; nbyte < slen; ++clen) + { + if (str[nbyte] < 0x80 && str[nbyte + 1] < 0x80) + ++nbyte; + else if (enc_utf8) + nbyte += utfc_ptr2len(str + nbyte); + else + nbyte += mb_ptr2len(str + nbyte); + } + nchar = clen + index; + if (nchar < 0) + // unlike list: index out of range results in empty string + return NULL; + } + + for (nbyte = 0; nchar > 0 && nbyte < slen; --nchar) + { + if (str[nbyte] < 0x80 && str[nbyte + 1] < 0x80) + ++nbyte; + else if (enc_utf8) + nbyte += utfc_ptr2len(str + nbyte); + else + nbyte += mb_ptr2len(str + nbyte); + } + if (nbyte >= slen) + return NULL; + return mnv_strnsave(str + nbyte, mb_ptr2len(str + nbyte)); +} + +/* + * Get the byte index for character index "idx" in string "str" with length + * "str_len". Composing characters are included. + * If going over the end return "str_len". + * If "idx" is negative count from the end, -1 is the last character. + * When going over the start return -1. + */ + static long +char_idx2byte(char_u *str, size_t str_len, varnumber_T idx) +{ + varnumber_T nchar = idx; + size_t nbyte = 0; + + if (nchar >= 0) + { + while (nchar > 0 && nbyte < str_len) + { + nbyte += mb_ptr2len(str + nbyte); + --nchar; + } + } + else + { + nbyte = str_len; + while (nchar < 0 && nbyte > 0) + { + --nbyte; + nbyte -= mb_head_off(str, str + nbyte); + ++nchar; + } + if (nchar < 0) + return -1; + } + return (long)nbyte; +} + +/* + * Return the slice "str[first : last]" using character indexes. Composing + * characters are included. + * "exclusive" is TRUE for slice(). + * Return NULL when the result is empty. + */ + char_u * +string_slice(char_u *str, varnumber_T first, varnumber_T last, int exclusive) +{ + long start_byte, end_byte; + size_t slen; + + if (str == NULL) + return NULL; + slen = STRLEN(str); + start_byte = char_idx2byte(str, slen, first); + if (start_byte < 0) + start_byte = 0; // first index very negative: use zero + if ((last == -1 && !exclusive) || last == VARNUM_MAX) + end_byte = (long)slen; + else + { + end_byte = char_idx2byte(str, slen, last); + if (!exclusive && end_byte >= 0 && end_byte < (long)slen) + // end index is inclusive + end_byte += mb_ptr2len(str + end_byte); + } + + if (start_byte >= (long)slen || end_byte <= start_byte) + return NULL; + return mnv_strnsave(str + start_byte, end_byte - start_byte); +} + +/* + * Get a script variable for ISN_STORESCRIPT and ISN_LOADSCRIPT. + * When "dfunc_idx" is negative don't give an error. + * Returns NULL for an error. + */ + static svar_T * +get_script_svar(scriptref_T *sref, int dfunc_idx) +{ + scriptitem_T *si = SCRIPT_ITEM(sref->sref_sid); + dfunc_T *dfunc = dfunc_idx < 0 ? NULL + : ((dfunc_T *)def_functions.ga_data) + dfunc_idx; + svar_T *sv; + + if (sref->sref_seq != si->sn_script_seq) + { + // The script was reloaded after the function was compiled, the + // script_idx may not be valid. + if (dfunc != NULL) + semsg(_(e_script_variable_invalid_after_reload_in_function_str), + printable_func_name(dfunc->df_ufunc)); + return NULL; + } + sv = ((svar_T *)si->sn_var_vals.ga_data) + sref->sref_idx; + if (sv->sv_name == NULL) + { + if (dfunc != NULL) + emsg(_(e_script_variable_was_deleted)); + return NULL; + } + if (!equal_type(sv->sv_type, sref->sref_type, 0)) + { + if (dfunc != NULL) + emsg(_(e_script_variable_type_changed)); + return NULL; + } + + if ((sv->sv_flags & SVFLAG_EXPORTED) == 0 + && sref->sref_sid != current_sctx.sc_sid) + { + if (dfunc != NULL) + semsg(_(e_item_not_exported_in_script_str), sv->sv_name); + return NULL; + } + return sv; +} + +/* + * Function passed to do_cmdline() for splitting a script joined by NL + * characters. + */ + static char_u * +get_split_sourceline( + int c UNUSED, + void *cookie, + int indent UNUSED, + getline_opt_T options UNUSED) +{ + source_cookie_T *sp = (source_cookie_T *)cookie; + char_u *p; + char_u *line; + + p = mnv_strchr(sp->nextline, '\n'); + if (p == NULL) + { + line = mnv_strsave(sp->nextline); + sp->nextline += STRLEN(sp->nextline); + } + else + { + line = mnv_strnsave(sp->nextline, p - sp->nextline); + sp->nextline = p + 1; + } + return line; +} + +/* + * Execute a function by "name". + * This can be a builtin function, user function or a funcref. + * "iptr" can be used to replace the instruction with a more efficient one. + */ + static int +call_eval_func( + char_u *name, + int argcount, + ectx_T *ectx, + isn_T *iptr) +{ + int called_emsg_before = called_emsg; + int res; + + res = call_by_name(name, argcount, ectx, iptr, NULL); + if (res == FAIL && called_emsg == called_emsg_before) + { + dictitem_T *v; + + v = find_var(name, NULL, FALSE); + if (v == NULL || (v->di_tv.v_type != VAR_PARTIAL + && v->di_tv.v_type != VAR_FUNC)) + { + emsg_funcname(e_unknown_function_str, name); + return FAIL; + } + return call_partial(&v->di_tv, argcount, ectx); + } + return res; +} + +/* + * When a function reference is used, fill a partial with the information + * needed, especially when it is used as a closure. + */ + int +fill_partial_and_closure( + partial_T *pt, + ufunc_T *ufunc, + loopvarinfo_T *lvi, + ectx_T *ectx) +{ + pt->pt_func = ufunc; + pt->pt_refcount = 1; + + if (ufunc->uf_flags & FC_CLOSURE) + { + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + ectx->ec_dfunc_idx; + + // The closure may need to find arguments and local variables of the + // current function in the stack. + pt->pt_outer.out_stack = &ectx->ec_stack; + pt->pt_outer.out_frame_idx = ectx->ec_frame_idx; + if (ectx->ec_outer_ref != NULL) + { + // The current context already has a context, link to that one. + pt->pt_outer.out_up = ectx->ec_outer_ref->or_outer; + if (ectx->ec_outer_ref->or_partial != NULL) + { + pt->pt_outer.out_up_partial = ectx->ec_outer_ref->or_partial; + ++pt->pt_outer.out_up_partial->pt_refcount; + } + } + + if (lvi != NULL) + { + int depth; + + // The closure may need to find variables defined inside a loop, + // for every nested loop. A new reference is made every time, + // ISN_ENDLOOP will check if they are actually used. + for (depth = 0; depth < lvi->lvi_depth; ++depth) + { + pt->pt_outer.out_loop[depth].stack = &ectx->ec_stack; + pt->pt_outer.out_loop[depth].var_idx = ectx->ec_frame_idx + + STACK_FRAME_SIZE + lvi->lvi_loop[depth].var_idx; + pt->pt_outer.out_loop[depth].var_count = + lvi->lvi_loop[depth].var_count; + } + pt->pt_outer.out_loop_size = lvi->lvi_depth; + } + else + pt->pt_outer.out_loop_size = 0; + + // If the function currently executing returns and the closure is still + // being referenced, we need to make a copy of the context (arguments + // and local variables) so that the closure can use it later. + // Store a reference to the partial so we can handle that. + if (GA_GROW_FAILS(&ectx->ec_funcrefs, 1)) + { + mnv_free(pt); + return FAIL; + } + // Extra variable keeps the count of closures created in the current + // function call. + ++(((typval_T *)ectx->ec_stack.ga_data) + ectx->ec_frame_idx + + STACK_FRAME_SIZE + dfunc->df_varcount)->vval.v_number; + + ((partial_T **)ectx->ec_funcrefs.ga_data)[ectx->ec_funcrefs.ga_len] + = pt; + ++pt->pt_refcount; + ++ectx->ec_funcrefs.ga_len; + } + ++ufunc->uf_refcount; + return OK; +} + +/* + * Execute iptr->isn_arg.string as an Ex command. + */ + static int +exec_command(isn_T *iptr, char_u *cmd_string) +{ + source_cookie_T cookie; + + SOURCING_LNUM = iptr->isn_lnum; + // Pass getsourceline to get an error for a missing ":end" command. + CLEAR_FIELD(cookie); + cookie.sourcing_lnum = iptr->isn_lnum - 1; + if (do_cmdline(cmd_string, getsourceline, &cookie, + DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED) == FAIL + || did_emsg) + return FAIL; + return OK; +} + +/* + * If script "sid" is not loaded yet then load it now. + * Caller must make sure "sid" is a valid script ID. + * "loaded" is set to TRUE if the script had to be loaded. + * Returns FAIL if loading fails, OK if already loaded or loaded now. + */ + int +may_load_script(int sid, int *loaded) +{ + scriptitem_T *si = SCRIPT_ITEM(sid); + + if (si->sn_state == SN_STATE_NOT_LOADED) + { + *loaded = TRUE; + if (do_source(si->sn_name, FALSE, DOSO_NONE, NULL) == FAIL) + { + semsg(_(e_cant_open_file_str), si->sn_name); + return FAIL; + } + } + return OK; +} + +// used for v_instr of typval of VAR_INSTR +struct instr_S { + ectx_T *instr_ectx; + isn_T *instr_instr; +}; + +// used for substitute_instr +typedef struct subs_expr_S { + ectx_T *subs_ectx; + isn_T *subs_instr; + int subs_status; +} subs_expr_T; + +// Set when calling do_debug(). +static ectx_T *debug_context = NULL; +static int debug_var_count; + +/* + * When debugging lookup "name" and return the typeval. + * When not found return NULL. + */ + typval_T * +lookup_debug_var(char_u *name) +{ + int idx; + dfunc_T *dfunc; + ufunc_T *ufunc; + ectx_T *ectx = debug_context; + int varargs_off; + + if (ectx == NULL) + return NULL; + dfunc = ((dfunc_T *)def_functions.ga_data) + ectx->ec_dfunc_idx; + + // Go through the local variable names, from last to first. + for (idx = debug_var_count - 1; idx >= 0; --idx) + { + char_u *varname = ((char_u **)dfunc->df_var_names.ga_data)[idx]; + + // the variable name may be NULL when not available in this block + if (varname != NULL && STRCMP(varname, name) == 0) + return STACK_TV_VAR(idx); + } + + // Go through argument names. + ufunc = dfunc->df_ufunc; + varargs_off = ufunc->uf_va_name == NULL ? 0 : 1; + for (idx = 0; idx < ufunc->uf_args.ga_len; ++idx) + if (STRCMP(((char_u **)(ufunc->uf_args.ga_data))[idx], name) == 0) + return STACK_TV(ectx->ec_frame_idx - ufunc->uf_args.ga_len + - varargs_off + idx); + if (ufunc->uf_va_name != NULL && STRCMP(ufunc->uf_va_name, name) == 0) + return STACK_TV(ectx->ec_frame_idx - 1); + + return NULL; +} + +/* + * Return TRUE if there might be a breakpoint in "ufunc", which is when a + * breakpoint was set in that function or when there is any expression. + */ + int +may_break_in_function(ufunc_T *ufunc) +{ + return ufunc->uf_has_breakpoint || debug_has_expr_breakpoint(); +} + + static void +handle_debug(isn_T *iptr, ectx_T *ectx) +{ + char_u *line; + ufunc_T *ufunc = (((dfunc_T *)def_functions.ga_data) + + ectx->ec_dfunc_idx)->df_ufunc; + isn_T *ni; + int end_lnum = iptr->isn_lnum; + garray_T ga; + int lnum; + + if (ex_nesting_level > debug_break_level) + { + linenr_T breakpoint; + + if (!may_break_in_function(ufunc)) + return; + + // check for the next breakpoint if needed + breakpoint = dbg_find_breakpoint(FALSE, ufunc->uf_name, + iptr->isn_arg.debug.dbg_break_lnum); + if (breakpoint <= 0 || breakpoint > iptr->isn_lnum) + return; + } + + SOURCING_LNUM = iptr->isn_lnum; + debug_context = ectx; + debug_var_count = iptr->isn_arg.debug.dbg_var_names_len; + + for (ni = iptr + 1; ni->isn_type != ISN_FINISH; ++ni) + if (ni->isn_type == ISN_DEBUG + || ni->isn_type == ISN_RETURN + || ni->isn_type == ISN_RETURN_OBJECT + || ni->isn_type == ISN_RETURN_VOID) + { + end_lnum = ni->isn_lnum + (ni->isn_type == ISN_DEBUG ? 0 : 1); + break; + } + + if (end_lnum > iptr->isn_lnum) + { + ga_init2(&ga, sizeof(char_u *), 10); + for (lnum = iptr->isn_lnum; lnum < end_lnum + && lnum <= ufunc->uf_lines.ga_len; ++lnum) + { + char_u *p = ((char_u **)ufunc->uf_lines.ga_data)[lnum - 1]; + + if (p == NULL) + continue; // left over from continuation line + p = skipwhite(p); + if (*p == '#') + break; + if (GA_GROW_OK(&ga, 1)) + ((char_u **)(ga.ga_data))[ga.ga_len++] = p; + if (STRNCMP(p, "def ", 4) == 0) + break; + } + line = ga_concat_strings(&ga, " "); + mnv_free(ga.ga_data); + } + else + line = ((char_u **)ufunc->uf_lines.ga_data)[iptr->isn_lnum - 1]; + + do_debug(line == NULL ? (char_u *)"[empty]" : line); + debug_context = NULL; + + if (end_lnum > iptr->isn_lnum) + mnv_free(line); +} + +/* + * Do a runtime check of the RHS value against the LHS List member type. + * This is used by the STOREINDEX instruction to perform a type check + * at runtime if compile time type check cannot be performed (VAR_ANY). + * Returns FAIL if there is a type mismatch. + */ + static int +storeindex_check_list_member_type( + list_T *lhs_list, + typval_T *rhs_tv, + ectx_T *ectx) +{ + if (lhs_list->lv_type == NULL || lhs_list->lv_type->tt_member == NULL) + return OK; + + return check_typval_type(lhs_list->lv_type->tt_member, rhs_tv, + ectx->ec_where); +} + +/* + * Store a value in a list, dict, blob or object variable. + * Returns OK, FAIL or NOTDONE (uncatchable error). + */ + static int +execute_storeindex(isn_T *iptr, ectx_T *ectx) +{ + vartype_T dest_type = iptr->isn_arg.storeindex.si_vartype; + typval_T *tv; + typval_T *tv_idx = STACK_TV_BOT(-2); + long lidx = 0; + typval_T *tv_dest = STACK_TV_BOT(-1); + int status = OK; + int check_rhs_type = FALSE; + + if (tv_idx->v_type == VAR_NUMBER) + lidx = (long)tv_idx->vval.v_number; + + // Stack contains: + // -3 value to be stored + // -2 index + // -1 dict, list, blob, object or class + tv = STACK_TV_BOT(-3); + SOURCING_LNUM = iptr->isn_lnum; + + // Make sure an object has been initialized + if (dest_type == VAR_OBJECT && tv_dest->vval.v_object == NULL) + { + emsg(_(e_using_null_object)); + status = FAIL; + } + else if (dest_type == VAR_ANY) + { + check_rhs_type = TRUE; + dest_type = tv_dest->v_type; + if (dest_type == VAR_DICT) + status = do_2string(tv_idx, TRUE, FALSE); + else if (dest_type == VAR_OBJECT && tv_idx->v_type == VAR_STRING) + { + // Need to get the member index now that the class is known. + object_T *obj = tv_dest->vval.v_object; + if (obj == NULL) + { + emsg(_(e_using_null_object)); + status = FAIL; + } + else + { + class_T *cl = obj->obj_class; + char_u *member = tv_idx->vval.v_string; + + int m_idx; + ocmember_T *m = object_member_lookup(cl, member, 0, &m_idx); + if (m != NULL) + { + // Get the current function + ufunc_T *ufunc = (((dfunc_T *)def_functions.ga_data) + + ectx->ec_dfunc_idx)->df_ufunc; + where_T where = WHERE_INIT; + + // Check whether the member variable is writeable + if ((m->ocm_access != MNV_ACCESS_ALL) && + (ufunc->uf_class == NULL || + !class_instance_of(ufunc->uf_class, cl))) + { + char *msg = (m->ocm_access == MNV_ACCESS_PRIVATE) + ? e_cannot_access_protected_variable_str + : e_variable_is_not_writable_str; + emsg_var_cl_define(msg, m->ocm_name.string, 0, cl); + status = FAIL; + } + // Fail if the variable is a const or final or the type + // is not compatible + else if (oc_var_check_ro(cl, m) || + check_typval_type(m->ocm_type, tv, where) + == FAIL) + status = FAIL; + else + lidx = m_idx; + } + else + { + member_not_found_msg(cl, VAR_OBJECT, member, 0); + status = FAIL; + } + } + } + else if ((dest_type == VAR_LIST || dest_type == VAR_OBJECT) + && tv_idx->v_type != VAR_NUMBER) + { + emsg(_(e_number_expected)); + status = FAIL; + } + } + + if (status == OK) + { + if (dest_type == VAR_LIST) + { + list_T *list = tv_dest->vval.v_list; + + if (list == NULL) + { + emsg(_(e_list_not_set)); + return FAIL; + } + if (lidx < 0 && list->lv_len + lidx >= 0) + // negative index is relative to the end + lidx = list->lv_len + lidx; + if (lidx < 0 || lidx > list->lv_len) + { + semsg(_(e_list_index_out_of_range_nr), lidx); + return FAIL; + } + + // Do a runtime type check for VAR_ANY + if (check_rhs_type && + storeindex_check_list_member_type(list, tv, ectx) == FAIL) + return FAIL; + + if (lidx < list->lv_len) + { + listitem_T *li = list_find(list, lidx); + + if (error_if_locked(li->li_tv.v_lock, + e_cannot_change_locked_list_item)) + return FAIL; + // overwrite existing list item + clear_tv(&li->li_tv); + li->li_tv = *tv; + } + else + { + if (error_if_locked(list->lv_lock, e_cannot_change_locked_list)) + return FAIL; + // append to list, only fails when out of memory + if (list_append_tv(list, tv) == FAIL) + return NOTDONE; + clear_tv(tv); + } + } + else if (dest_type == VAR_DICT) + { + char_u *key = tv_idx->vval.v_string; + dict_T *dict = tv_dest->vval.v_dict; + dictitem_T *di; + + SOURCING_LNUM = iptr->isn_lnum; + if (dict == NULL) + { + emsg(_(e_dictionary_not_set)); + return FAIL; + } + if (key == NULL) + key = (char_u *)""; + di = dict_find(dict, key, -1); + if (di != NULL) + { + if (error_if_locked(di->di_tv.v_lock, + e_cannot_change_dict_item)) + return FAIL; + // overwrite existing value + clear_tv(&di->di_tv); + di->di_tv = *tv; + } + else + { + if (error_if_locked(dict->dv_lock, e_cannot_change_dict)) + return FAIL; + // add to dict, only fails when out of memory + if (dict_add_tv(dict, (char *)key, tv) == FAIL) + return NOTDONE; + clear_tv(tv); + } + } + else if (dest_type == VAR_BLOB) + { + blob_T *blob = tv_dest->vval.v_blob; + varnumber_T nr; + int error = FALSE; + int len; + + if (blob == NULL) + { + emsg(_(e_blob_not_set)); + return FAIL; + } + len = blob_len(blob); + if (lidx < 0 && len + lidx >= 0) + // negative index is relative to the end + lidx = len + lidx; + + // Can add one byte at the end. + if (lidx < 0 || lidx > len) + { + semsg(_(e_blob_index_out_of_range_nr), lidx); + return FAIL; + } + if (value_check_lock(blob->bv_lock, (char_u *)"blob", FALSE)) + return FAIL; + nr = tv_get_number_chk(tv, &error); + if (error) + return FAIL; + if (nr < 0 || nr > 255) + { + semsg(_(e_invalid_value_for_blob_nr), nr); + return FAIL; + } + blob_set_append(blob, lidx, nr); + } + else if (dest_type == VAR_CLASS || dest_type == VAR_OBJECT) + { + typval_T *otv; + + if (dest_type == VAR_OBJECT) + { + object_T *obj = tv_dest->vval.v_object; + + otv = (typval_T *)(obj + 1); + class_T *itf = iptr->isn_arg.storeindex.si_class; + if (itf != NULL) + // convert interface member index to class member index + lidx = object_index_from_itf_index(itf, FALSE, lidx, + obj->obj_class); + } + else + { + // VAR_CLASS + class_T *class = tv_dest->vval.v_class; + otv = class->class_members_tv; + } + + clear_tv(&otv[lidx]); + otv[lidx] = *tv; + } + else if (dest_type == VAR_TUPLE) + { + emsg(_(e_tuple_is_immutable)); + status = FAIL; + } + else + { + status = FAIL; + semsg(_(e_cannot_index_str), vartype_name(dest_type)); + } + } + + clear_tv(tv_idx); + clear_tv(tv_dest); + ectx->ec_stack.ga_len -= 3; + if (status == FAIL) + { + clear_tv(tv); + return FAIL; + } + return OK; +} + +/* + * Store a value in a list or blob range. + */ + static int +execute_storerange(isn_T *iptr, ectx_T *ectx) +{ + typval_T *tv; + typval_T *tv_idx1 = STACK_TV_BOT(-3); + typval_T *tv_idx2 = STACK_TV_BOT(-2); + typval_T *tv_dest = STACK_TV_BOT(-1); + int status = OK; + + // Stack contains: + // -4 value to be stored + // -3 first index or "none" + // -2 second index or "none" + // -1 destination list or blob + tv = STACK_TV_BOT(-4); + SOURCING_LNUM = iptr->isn_lnum; + if (tv_dest->v_type == VAR_LIST) + { + long n1; + long n2; + listitem_T *li1; + + n1 = (long)tv_get_number_chk(tv_idx1, NULL); + if (tv_idx2->v_type == VAR_SPECIAL + && tv_idx2->vval.v_number == VVAL_NONE) + n2 = list_len(tv_dest->vval.v_list) - 1; + else + n2 = (long)tv_get_number_chk(tv_idx2, NULL); + + li1 = check_range_index_one(tv_dest->vval.v_list, &n1, TRUE, FALSE); + if (li1 == NULL) + status = FAIL; + else + { + status = check_range_index_two(tv_dest->vval.v_list, + &n1, li1, &n2, FALSE); + if (status != FAIL) + status = list_assign_range( + tv_dest->vval.v_list, + tv->vval.v_list, + n1, + n2, + tv_idx2->v_type == VAR_SPECIAL, + (char_u *)"=", + (char_u *)"[unknown]"); + } + } + else if (tv_dest->v_type == VAR_BLOB) + { + varnumber_T n1; + varnumber_T n2; + long bloblen; + + n1 = tv_get_number_chk(tv_idx1, NULL); + if (tv_idx2->v_type == VAR_SPECIAL + && tv_idx2->vval.v_number == VVAL_NONE) + n2 = blob_len(tv_dest->vval.v_blob) - 1; + else + n2 = tv_get_number_chk(tv_idx2, NULL); + bloblen = blob_len(tv_dest->vval.v_blob); + + if (check_blob_index(bloblen, n1, FALSE) == FAIL + || check_blob_range(bloblen, n1, n2, FALSE) == FAIL) + status = FAIL; + else + status = blob_set_range(tv_dest->vval.v_blob, n1, n2, tv); + } + else + { + status = FAIL; + emsg(_(e_list_or_blob_required)); + } + + clear_tv(tv_idx1); + clear_tv(tv_idx2); + clear_tv(tv_dest); + ectx->ec_stack.ga_len -= 4; + clear_tv(tv); + + return status; +} + +/* + * Unlet item in list or dict variable. + */ + static int +execute_unletindex(isn_T *iptr, ectx_T *ectx) +{ + typval_T *tv_idx = STACK_TV_BOT(-2); + typval_T *tv_dest = STACK_TV_BOT(-1); + int status = OK; + + // Stack contains: + // -2 index + // -1 dict or list + SOURCING_LNUM = iptr->isn_lnum; + if (tv_dest->v_type == VAR_DICT) + { + // unlet a dict item, index must be a string + if (tv_idx->v_type != VAR_STRING && tv_idx->v_type != VAR_NUMBER) + { + semsg(_(e_expected_str_but_got_str), + vartype_name(VAR_STRING), + vartype_name(tv_idx->v_type)); + status = FAIL; + } + else + { + dict_T *d = tv_dest->vval.v_dict; + char_u *key; + dictitem_T *di = NULL; + + if (d != NULL && value_check_lock( + d->dv_lock, NULL, FALSE)) + status = FAIL; + else + { + if (tv_idx->v_type == VAR_STRING) + { + key = tv_idx->vval.v_string; + if (key == NULL) + key = (char_u *)""; + } + else + { + key = tv_get_string(tv_idx); + } + if (d != NULL) + di = dict_find(d, key, (int)STRLEN(key)); + if (di == NULL) + { + // NULL dict is equivalent to empty dict + semsg(_(e_key_not_present_in_dictionary_str), key); + status = FAIL; + } + else if (var_check_fixed(di->di_flags, + NULL, FALSE) + || var_check_ro(di->di_flags, + NULL, FALSE)) + status = FAIL; + else + dictitem_remove(d, di, "unlet"); + } + } + } + else if (tv_dest->v_type == VAR_LIST) + { + // unlet a List item, index must be a number + if (check_for_number(tv_idx) == FAIL) + { + status = FAIL; + } + else + { + list_T *l = tv_dest->vval.v_list; + long n = (long)tv_idx->vval.v_number; + + if (l != NULL && value_check_lock( + l->lv_lock, NULL, FALSE)) + status = FAIL; + else + { + listitem_T *li = list_find(l, n); + + if (li == NULL) + { + semsg(_(e_list_index_out_of_range_nr), n); + status = FAIL; + } + else + listitem_remove(l, li); + } + } + } + else + { + status = FAIL; + semsg(_(e_cannot_index_str), + vartype_name(tv_dest->v_type)); + } + + clear_tv(tv_idx); + clear_tv(tv_dest); + ectx->ec_stack.ga_len -= 2; + + return status; +} + +/* + * Unlet a range of items in a list variable. + */ + static int +execute_unletrange(isn_T *iptr, ectx_T *ectx) +{ + // Stack contains: + // -3 index1 + // -2 index2 + // -1 dict or list + typval_T *tv_idx1 = STACK_TV_BOT(-3); + typval_T *tv_idx2 = STACK_TV_BOT(-2); + typval_T *tv_dest = STACK_TV_BOT(-1); + int status = OK; + + if (tv_dest->v_type == VAR_LIST) + { + // indexes must be a number + SOURCING_LNUM = iptr->isn_lnum; + if (check_for_number(tv_idx1) == FAIL + || (tv_idx2->v_type != VAR_SPECIAL + && check_for_number(tv_idx2) == FAIL)) + { + status = FAIL; + } + else + { + list_T *l = tv_dest->vval.v_list; + long n1 = (long)tv_idx1->vval.v_number; + long n2 = tv_idx2->v_type == VAR_SPECIAL + ? 0 : (long)tv_idx2->vval.v_number; + listitem_T *li; + + li = list_find_index(l, &n1); + if (li == NULL) + { + semsg(_(e_list_index_out_of_range_nr), + (long)tv_idx1->vval.v_number); + status = FAIL; + } + else + { + if (n1 < 0) + n1 = list_idx_of_item(l, li); + if (n2 < 0) + { + listitem_T *li2 = list_find(l, n2); + + if (li2 == NULL) + { + semsg(_(e_list_index_out_of_range_nr), n2); + status = FAIL; + } + else + n2 = list_idx_of_item(l, li2); + } + if (status != FAIL + && tv_idx2->v_type != VAR_SPECIAL + && n2 < n1) + { + semsg(_(e_list_index_out_of_range_nr), n2); + status = FAIL; + } + if (status != FAIL) + list_unlet_range(l, li, n1, + tv_idx2->v_type != VAR_SPECIAL, n2); + } + } + } + else + { + status = FAIL; + SOURCING_LNUM = iptr->isn_lnum; + semsg(_(e_cannot_index_str), + vartype_name(tv_dest->v_type)); + } + + clear_tv(tv_idx1); + clear_tv(tv_idx2); + clear_tv(tv_dest); + ectx->ec_stack.ga_len -= 3; + + return status; +} + +/* + * Top of a for loop. + */ + static int +execute_for(isn_T *iptr, ectx_T *ectx) +{ + typval_T *tv; + int jump = FALSE; + typval_T *ltv = STACK_TV_BOT(-1); + typval_T *idxtv = + STACK_TV_VAR(iptr->isn_arg.forloop.for_loop_idx); + + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + return FAIL; + if (ltv->v_type == VAR_LIST) + { + list_T *list = ltv->vval.v_list; + + // push the next item from the list + ++idxtv->vval.v_number; + if (list == NULL + || idxtv->vval.v_number >= list->lv_len) + { + jump = TRUE; + } + else if (list->lv_first == &range_list_item) + { + // non-materialized range() list + tv = STACK_TV_BOT(0); + tv->v_type = VAR_NUMBER; + tv->v_lock = 0; + tv->vval.v_number = list_find_nr( + list, idxtv->vval.v_number, NULL); + ++ectx->ec_stack.ga_len; + } + else + { + listitem_T *li = list_find(list, + idxtv->vval.v_number); + + copy_tv(&li->li_tv, STACK_TV_BOT(0)); + ++ectx->ec_stack.ga_len; + } + } + else if (ltv->v_type == VAR_TUPLE) + { + tuple_T *tuple = ltv->vval.v_tuple; + + // push the next item from the tuple + ++idxtv->vval.v_number; + if (tuple == NULL || idxtv->vval.v_number >= TUPLE_LEN(tuple)) + jump = TRUE; + else + { + copy_tv(TUPLE_ITEM(tuple, idxtv->vval.v_number), STACK_TV_BOT(0)); + ++ectx->ec_stack.ga_len; + } + } + else if (ltv->v_type == VAR_STRING) + { + char_u *str = ltv->vval.v_string; + + // The index is for the last byte of the previous + // character. + ++idxtv->vval.v_number; + if (str == NULL || str[idxtv->vval.v_number] == NUL) + { + jump = TRUE; + } + else + { + int clen = mb_ptr2len(str + idxtv->vval.v_number); + + // Push the next character from the string. + tv = STACK_TV_BOT(0); + tv->v_type = VAR_STRING; + tv->vval.v_string = mnv_strnsave( + str + idxtv->vval.v_number, clen); + ++ectx->ec_stack.ga_len; + idxtv->vval.v_number += clen - 1; + } + } + else if (ltv->v_type == VAR_BLOB) + { + blob_T *blob = ltv->vval.v_blob; + + // When we get here the first time make a copy of the + // blob, so that the iteration still works when it is + // changed. + if (idxtv->vval.v_number == -1 && blob != NULL) + { + blob_copy(blob, ltv); + blob_unref(blob); + blob = ltv->vval.v_blob; + } + + // The index is for the previous byte. + ++idxtv->vval.v_number; + if (blob == NULL || idxtv->vval.v_number >= blob_len(blob)) + { + jump = TRUE; + } + else + { + // Push the next byte from the blob. + tv = STACK_TV_BOT(0); + tv->v_type = VAR_NUMBER; + tv->vval.v_number = blob_get(blob, + idxtv->vval.v_number); + ++ectx->ec_stack.ga_len; + } + } + else + { + semsg(_(e_for_loop_on_str_not_supported), + vartype_name(ltv->v_type)); + return FAIL; + } + + if (jump) + { + // past the end of the list/string/blob, jump to "endfor" + ectx->ec_iidx = iptr->isn_arg.forloop.for_end; + may_restore_cmdmod(&ectx->ec_funclocal); + } + else + { + // Store the current number of funcrefs, this may be used in + // ISN_LOOPEND. The variable index is always one more than the loop + // variable index. + tv = STACK_TV_VAR(iptr->isn_arg.forloop.for_loop_idx + 1); + tv->vval.v_number = ectx->ec_funcrefs.ga_len; + } + + return OK; +} + +/* + * Code for handling variables declared inside a loop and used in a closure. + * This is very similar to what is done with funcstack_T. The difference is + * that the funcstack_T has the scope of a function, while a loopvars_T has the + * scope of the block inside a loop and each loop may have its own. + */ + +// Double linked list of loopvars_T in use. +static loopvars_T *first_loopvars = NULL; + + static void +add_loopvars_to_list(loopvars_T *loopvars) +{ + // Link in list of loopvarss. + if (first_loopvars != NULL) + first_loopvars->lvs_prev = loopvars; + loopvars->lvs_next = first_loopvars; + loopvars->lvs_prev = NULL; + first_loopvars = loopvars; +} + + static void +remove_loopvars_from_list(loopvars_T *loopvars) +{ + if (loopvars->lvs_prev == NULL) + first_loopvars = loopvars->lvs_next; + else + loopvars->lvs_prev->lvs_next = loopvars->lvs_next; + if (loopvars->lvs_next != NULL) + loopvars->lvs_next->lvs_prev = loopvars->lvs_prev; +} + +/* + * End of a for or while loop: Handle any variables used by a closure. + */ + static int +execute_endloop(isn_T *iptr, ectx_T *ectx) +{ + endloop_T *endloop = &iptr->isn_arg.endloop; + typval_T *tv_refcount = STACK_TV_VAR(endloop->end_funcref_idx); + int prev_closure_count = tv_refcount->vval.v_number; + int depth = endloop->end_depth; + garray_T *gap = &ectx->ec_funcrefs; + int closure_in_use = FALSE; + loopvars_T *loopvars; + typval_T *stack; + int idx; + + // Check if any created closure is still being referenced and loopvars have + // not been saved yet for the current depth. + for (idx = prev_closure_count; idx < gap->ga_len; ++idx) + { + partial_T *pt = ((partial_T **)gap->ga_data)[idx]; + + if (pt->pt_refcount > 1 && pt->pt_loopvars[depth] == NULL) + { + int refcount = pt->pt_refcount; + int i; + + // A Reference in a variable inside the loop doesn't count, it gets + // unreferenced at the end of the loop. + for (i = 0; i < endloop->end_var_count; ++i) + { + typval_T *stv = STACK_TV_VAR(endloop->end_var_idx + i); + + if (stv->v_type == VAR_PARTIAL && pt == stv->vval.v_partial) + --refcount; + } + if (refcount > 1) + { + closure_in_use = TRUE; + break; + } + } + } + + // If no function reference were created since the start of the loop block + // or it is no longer referenced there is nothing to do. + if (!closure_in_use) + return OK; + + // A closure is using variables declared inside the loop. + // Move them to the called function. + loopvars = ALLOC_CLEAR_ONE(loopvars_T); + if (loopvars == NULL) + return FAIL; + + loopvars->lvs_ga.ga_len = endloop->end_var_count; + stack = ALLOC_CLEAR_MULT(typval_T, loopvars->lvs_ga.ga_len); + loopvars->lvs_ga.ga_data = stack; + if (stack == NULL) + { + mnv_free(loopvars); + return FAIL; + } + add_loopvars_to_list(loopvars); + + // Move the variable values. + for (idx = 0; idx < endloop->end_var_count; ++idx) + { + typval_T *tv = STACK_TV_VAR(endloop->end_var_idx + idx); + + *(stack + idx) = *tv; + tv->v_type = VAR_UNKNOWN; + } + + for (idx = prev_closure_count; idx < gap->ga_len; ++idx) + { + partial_T *pt = ((partial_T **)gap->ga_data)[idx]; + + if (pt->pt_refcount > 1 && pt->pt_loopvars[depth] == NULL) + { + ++loopvars->lvs_refcount; + pt->pt_loopvars[depth] = loopvars; + + pt->pt_outer.out_loop[depth].stack = &loopvars->lvs_ga; + pt->pt_outer.out_loop[depth].var_idx -= + ectx->ec_frame_idx + STACK_FRAME_SIZE + endloop->end_var_idx; + } + } + + return OK; +} + +/* + * Called when a partial is freed or its reference count goes down to one. The + * loopvars may be the only reference to the partials in the local variables. + * Go over all of them, the funcref and can be freed if all partials + * referencing the loopvars have a reference count of one. + * Return TRUE if it was freed. + */ + int +loopvars_check_refcount(loopvars_T *loopvars) +{ + int i; + garray_T *gap = &loopvars->lvs_ga; + int done = 0; + typval_T *stack = gap->ga_data; + + if (loopvars->lvs_refcount > loopvars->lvs_min_refcount) + return FALSE; + for (i = 0; i < gap->ga_len; ++i) + { + typval_T *tv = ((typval_T *)gap->ga_data) + i; + + if (tv->v_type == VAR_PARTIAL && tv->vval.v_partial != NULL + && tv->vval.v_partial->pt_refcount == 1) + { + int depth; + + for (depth = 0; depth < MAX_LOOP_DEPTH; ++depth) + if (tv->vval.v_partial->pt_loopvars[depth] == loopvars) + ++done; + } + } + if (done != loopvars->lvs_min_refcount) + return FALSE; + + // All partials referencing the loopvars have a reference count of + // one, thus the loopvars is no longer of use. + stack = gap->ga_data; + for (i = 0; i < gap->ga_len; ++i) + clear_tv(stack + i); + mnv_free(stack); + remove_loopvars_from_list(loopvars); + mnv_free(loopvars); + return TRUE; +} + +/* + * For garbage collecting: set references in all variables referenced by + * all loopvars. + */ + int +set_ref_in_loopvars(int copyID) +{ + loopvars_T *loopvars; + + for (loopvars = first_loopvars; loopvars != NULL; + loopvars = loopvars->lvs_next) + { + typval_T *stack = loopvars->lvs_ga.ga_data; + int i; + + for (i = 0; i < loopvars->lvs_ga.ga_len; ++i) + if (set_ref_in_item(stack + i, copyID, NULL, NULL, NULL)) + return TRUE; // abort + } + return FALSE; +} + +/* + * Load instruction for w:/b:/g:/t: variable. + * "isn_type" is used instead of "iptr->isn_type". + */ + static int +load_namespace_var(ectx_T *ectx, isntype_T isn_type, isn_T *iptr) +{ + dictitem_T *di = NULL; + hashtab_T *ht = NULL; + char namespace; + + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + return NOTDONE; + switch (isn_type) + { + case ISN_LOADG: + ht = get_globvar_ht(); + namespace = 'g'; + break; + case ISN_LOADB: + ht = &curbuf->b_vars->dv_hashtab; + namespace = 'b'; + break; + case ISN_LOADW: + ht = &curwin->w_vars->dv_hashtab; + namespace = 'w'; + break; + case ISN_LOADT: + ht = &curtab->tp_vars->dv_hashtab; + namespace = 't'; + break; + default: // Cannot reach here + return NOTDONE; + } + di = find_var_in_ht(ht, 0, iptr->isn_arg.string, TRUE); + + if (di == NULL) + { + if (isn_type == ISN_LOADG) + { + ufunc_T *ufunc = find_func(iptr->isn_arg.string, TRUE); + + // g:Something could be a function + if (ufunc != NULL) + { + typval_T *tv = STACK_TV_BOT(0); + + ++ectx->ec_stack.ga_len; + tv->v_type = VAR_FUNC; + tv->vval.v_string = alloc(STRLEN(iptr->isn_arg.string) + 3); + if (tv->vval.v_string == NULL) + return FAIL; + STRCPY(tv->vval.v_string, "g:"); + STRCPY(tv->vval.v_string + 2, iptr->isn_arg.string); + return OK; + } + } + SOURCING_LNUM = iptr->isn_lnum; + if (mnv_strchr(iptr->isn_arg.string, AUTOLOAD_CHAR) != NULL) + // no check if the item exists in the script but + // isn't exported, it is too complicated + semsg(_(e_item_not_found_in_script_str), iptr->isn_arg.string); + else + semsg(_(e_undefined_variable_char_str), + namespace, iptr->isn_arg.string); + return FAIL; + } + else + { + copy_tv(&di->di_tv, STACK_TV_BOT(0)); + ++ectx->ec_stack.ga_len; + } + return OK; +} + + + static void +object_required_error(typval_T *tv) +{ + garray_T type_list; + ga_init2(&type_list, sizeof(type_T *), 10); + type_T *type = typval2type(tv, get_copyID(), &type_list, TVTT_DO_MEMBER); + char *tofree = NULL; + char *typename = type_name(type, &tofree); + semsg(_(e_object_required_found_str), typename); + mnv_free(tofree); + clear_type_list(&type_list); +} + +/* + * Accessing the variable or method of an object or a class stored in a + * variable of type "any". + * Returns OK if the member variable is present. + * Returns FAIL if the variable is not found. + */ + static int +var_any_get_oc_member(class_T *current_class, isn_T *iptr, typval_T *tv) +{ + int is_object = tv->v_type == VAR_OBJECT; + class_T *tv_cl; + object_T *obj = NULL; + typval_T mtv; + + if (is_object) + { + obj = tv->vval.v_object; + if (obj == NULL) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_using_null_object)); + return FAIL; + } + tv_cl = obj->obj_class; + } + else + { + tv_cl = tv->vval.v_class; + if (tv_cl == NULL) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_using_null_class)); + return FAIL; + } + } + + // get_member_tv() needs the class/object information in the typval + // argument. So set the object information. + copy_tv(tv, &mtv); + + // 'name' can either be an instance or class variable or method + int namelen = (int)STRLEN(iptr->isn_arg.string); + int save_did_emsg = did_emsg; + + if (get_member_tv(tv_cl, is_object, iptr->isn_arg.string, namelen, + current_class, &mtv) == OK) + { + // instance or class variable + copy_tv(&mtv, tv); + clear_tv(&mtv); + return OK; + } + + if (did_emsg != save_did_emsg) + return FAIL; + + // could be a class or instance method + ufunc_T *oc_method; + int oc_method_idx; + + oc_method = method_lookup(tv_cl, tv->v_type, iptr->isn_arg.string, + namelen, &oc_method_idx); + if (oc_method == NULL) + { + char *msg; + + SOURCING_LNUM = iptr->isn_lnum; + if (is_object) + msg = e_variable_not_found_on_object_str_str; + else + msg = e_class_variable_str_not_found_in_class_str; + semsg(_(msg), iptr->isn_arg.string, tv_cl->class_name.string); + return FAIL; + } + + // Protected methods are not accessible outside the class + if (*oc_method->uf_name == '_' + && !class_instance_of(current_class, tv_cl)) + { + semsg(_(e_cannot_access_protected_method_str), oc_method->uf_name); + return FAIL; + } + + // Create a partial for the instance or class method + if (obj_method_to_partial_tv(is_object ? obj : NULL, oc_method, tv) + == FAIL) + return FAIL; + + return OK; +} + +/* + * do ISN_PUT or ISN_IPUT instruction depending on fixindent parameter + */ + static void +isn_put_do(ectx_T *ectx, isn_T *iptr, typval_T *tv, int fixindent) +{ + int regname = iptr->isn_arg.put.put_regname; + linenr_T lnum = iptr->isn_arg.put.put_lnum; + char_u *expr = NULL; + int dir = FORWARD; + + if (lnum < -2) + { + // line number was put on the stack by ISN_RANGE + tv = STACK_TV_BOT(-1); + curwin->w_cursor.lnum = tv->vval.v_number; + if (lnum == LNUM_VARIABLE_RANGE_ABOVE) + dir = BACKWARD; + --ectx->ec_stack.ga_len; + } + else if (lnum == -2) + // :put! above cursor + dir = BACKWARD; + else if (lnum >= 0) + { + curwin->w_cursor.lnum = lnum; + if (lnum == 0) + // check_cursor() below will move to line 1 + dir = BACKWARD; + } + + if (regname == '=') + { + tv = STACK_TV_BOT(-1); + if (tv->v_type == VAR_STRING) + expr = tv->vval.v_string; + else + { + expr = typval2string(tv, TRUE); // allocates value + clear_tv(tv); + } + --ectx->ec_stack.ga_len; + } + check_cursor(); + + if (fixindent) + do_put(regname, expr, dir, 1L, PUT_LINE|PUT_CURSLINE|PUT_FIXINDENT); + else + do_put(regname, expr, dir, 1L, PUT_LINE|PUT_CURSLINE); + mnv_free(expr); +} + +/* + * Execute the ISN_UNPACK instruction for a List + */ + static int +exec_unpack_list(ectx_T *ectx, isn_T *iptr, typval_T *tv) +{ + int count = iptr->isn_arg.unpack.unp_count; + int semicolon = iptr->isn_arg.unpack.unp_semicolon; + list_T *l; + listitem_T *li; + int i; + + l = tv->vval.v_list; + if (l == NULL + || l->lv_len < (semicolon ? count - 1 : count)) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_list_value_does_not_have_enough_items)); + return EXEC_FAIL; + } + else if (!semicolon && l->lv_len > count) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_list_value_has_more_items_than_targets)); + return EXEC_FAIL; + } + + CHECK_LIST_MATERIALIZE(l); + if (GA_GROW_FAILS(&ectx->ec_stack, count - 1)) + return EXEC_DONE; + ectx->ec_stack.ga_len += count - 1; + + // Variable after semicolon gets a list with the remaining + // items. + if (semicolon) + { + list_T *rem_list = + list_alloc_with_items(l->lv_len - count + 1); + + if (rem_list == NULL) + return EXEC_DONE; + tv = STACK_TV_BOT(-count); + tv->vval.v_list = rem_list; + ++rem_list->lv_refcount; + tv->v_lock = 0; + li = l->lv_first; + for (i = 0; i < count - 1; ++i) + li = li->li_next; + for (i = 0; li != NULL; ++i) + { + typval_T tvcopy; + + copy_tv(&li->li_tv, &tvcopy); + list_set_item(rem_list, i, &tvcopy); + li = li->li_next; + } + --count; + } + + // Produce the values in reverse order, first item last. + li = l->lv_first; + for (i = 0; i < count; ++i) + { + tv = STACK_TV_BOT(-i - 1); + copy_tv(&li->li_tv, tv); + li = li->li_next; + } + + list_unref(l); + + return EXEC_OK; +} + +/* + * Execute the ISN_UNPACK instruction for a Tuple + */ + static int +exec_unpack_tuple(ectx_T *ectx, isn_T *iptr, typval_T *tv) +{ + int count = iptr->isn_arg.unpack.unp_count; + int semicolon = iptr->isn_arg.unpack.unp_semicolon; + tuple_T *tuple; + int i; + + tuple = tv->vval.v_tuple; + if (tuple == NULL + || TUPLE_LEN(tuple) < (semicolon ? count - 1 : count)) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_more_targets_than_tuple_items)); + return EXEC_FAIL; + } + else if (!semicolon && TUPLE_LEN(tuple) > count) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_less_targets_than_tuple_items)); + return EXEC_FAIL; + } + + if (GA_GROW_FAILS(&ectx->ec_stack, count - 1)) + return EXEC_DONE; + ectx->ec_stack.ga_len += count - 1; + + // Variable after semicolon gets a list with the remaining + // items. + if (semicolon) + { + list_T *rem_list = + list_alloc_with_items(TUPLE_LEN(tuple) - count + 1); + + if (rem_list == NULL) + return EXEC_DONE; + tv = STACK_TV_BOT(-count); + tv->v_type = VAR_LIST; + tv->vval.v_list = rem_list; + ++rem_list->lv_refcount; + tv->v_lock = 0; + for (i = count - 1; i < TUPLE_LEN(tuple); ++i) + { + typval_T tvcopy; + + copy_tv(TUPLE_ITEM(tuple, i), &tvcopy); + list_set_item(rem_list, i - (count - 1), &tvcopy); + } + --count; + } + + // Produce the values in reverse order, first item last. + for (i = 0; i < count; ++i) + { + tv = STACK_TV_BOT(-i - 1); + copy_tv(TUPLE_ITEM(tuple, i), tv); + } + + tuple_unref(tuple); + + return EXEC_OK; +} + +/* + * Execute instructions in execution context "ectx". + * Return OK or FAIL; + */ + static int +exec_instructions(ectx_T *ectx) +{ + int ret = FAIL; + int save_trylevel_at_start = ectx->ec_trylevel_at_start; + int dict_stack_len_at_start = dict_stack.ga_len; + + // Start execution at the first instruction. + ectx->ec_iidx = 0; + + // Only catch exceptions in this instruction list. + ectx->ec_trylevel_at_start = trylevel; + + for (;;) + { + static int breakcheck_count = 0; // using "static" makes it faster + isn_T *iptr; + typval_T *tv; + + if (unlikely(++breakcheck_count >= 100)) + { + line_breakcheck(); + breakcheck_count = 0; + } + if (unlikely(got_int)) + { + // Turn CTRL-C into an exception. + got_int = FALSE; + if (throw_exception("MNV:Interrupt", ET_INTERRUPT, NULL) == FAIL) + goto theend; + did_throw = TRUE; + } + + if (unlikely(did_emsg && msg_list != NULL && *msg_list != NULL)) + { + // Turn an error message into an exception. + did_emsg = FALSE; + if (throw_exception(*msg_list, ET_ERROR, NULL) == FAIL) + goto theend; + did_throw = TRUE; + *msg_list = NULL; + + // This exception was not caught (yet). + garray_T *trystack = &ectx->ec_trystack; + if (trystack->ga_len > 0) + { + trycmd_T *trycmd = ((trycmd_T *)trystack->ga_data) + + trystack->ga_len - 1; + if (trycmd->tcd_frame_idx == ectx->ec_frame_idx) + { + if (trycmd->tcd_caught) + { + // Inside a "catch" we need to first discard the caught + // exception. + finish_exception(caught_stack); + trycmd->tcd_caught = FALSE; + } + } + } + } + + if (unlikely(did_throw)) + { + garray_T *trystack = &ectx->ec_trystack; + trycmd_T *trycmd = NULL; + int index = trystack->ga_len; + + // An exception jumps to the first catch, finally, or returns from + // the current function. + while (index > 0) + { + trycmd = ((trycmd_T *)trystack->ga_data) + index - 1; + // 1. after :try and before :catch - jump to first :catch + // 2. in :catch block - jump to :finally + // 3. in :catch block and no finally - jump to :endtry + if (!trycmd->tcd_in_catch || trycmd->tcd_finally_idx != 0 + || trycmd->tcd_frame_idx == ectx->ec_frame_idx) + break; + // In the catch and finally block of this try we have to go up + // one level. + --index; + trycmd = NULL; + } + if (trycmd != NULL && trycmd->tcd_frame_idx == ectx->ec_frame_idx) + { + if (trycmd->tcd_in_catch) + { + if (trycmd->tcd_finally_idx > 0) + { + // exception inside ":catch", jump to ":finally" once + ectx->ec_iidx = trycmd->tcd_finally_idx; + trycmd->tcd_finally_idx = 0; + } + else + { + // exception inside ":catch" or ":finally", jump to + // ":endtry" + ectx->ec_iidx = trycmd->tcd_endtry_idx; + } + } + else + { + // jump to first ":catch" + ectx->ec_iidx = trycmd->tcd_catch_idx; + trycmd->tcd_in_catch = TRUE; + } + did_throw = FALSE; // don't come back here until :endtry + trycmd->tcd_did_throw = TRUE; + } + else + { + // Not inside try or need to return from current function. + // Push a dummy return value. + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + tv = STACK_TV_BOT(0); + tv->v_type = VAR_NUMBER; + tv->vval.v_number = 0; + ++ectx->ec_stack.ga_len; + if (ectx->ec_frame_idx == ectx->ec_initial_frame_idx) + { + // At the toplevel we are done. + need_rethrow = TRUE; + if (handle_closure_in_use(ectx, FALSE) == FAIL) + goto theend; + goto done; + } + + if (func_return(ectx) == FAIL) + goto theend; + } + continue; + } + + /* + * Big switch on the instruction. Most compilers will be turning this + * into an efficient lookup table, since the "case" values are an enum + * with sequential numbers. It may look ugly, but it should be the + * most efficient way. + */ + iptr = &ectx->ec_instr[ectx->ec_iidx++]; + switch (iptr->isn_type) + { + // Constructor, first instruction in a new() method. + case ISN_CONSTRUCT: + // "this" is always the local variable at index zero + tv = STACK_TV_VAR(0); + tv->v_type = VAR_OBJECT; + tv->vval.v_object = + alloc_object(iptr->isn_arg.construct.construct_class); + break; + + // execute Ex command line + case ISN_EXEC: + if (exec_command(iptr, iptr->isn_arg.string) == FAIL) + goto on_error; + break; + + // execute Ex command line split at NL characters. + case ISN_EXEC_SPLIT: + { + source_cookie_T cookie; + char_u *line; + + SOURCING_LNUM = iptr->isn_lnum; + CLEAR_FIELD(cookie); + cookie.sourcing_lnum = iptr->isn_lnum - 1; + cookie.nextline = iptr->isn_arg.string; + line = get_split_sourceline(0, &cookie, 0, 0); + if (do_cmdline(line, + get_split_sourceline, &cookie, + DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED) + == FAIL + || did_emsg) + { + mnv_free(line); + goto on_error; + } + mnv_free(line); + } + break; + + // execute Ex command line that is only a range + case ISN_EXECRANGE: + { + exarg_T ea; + char *error = NULL; + + CLEAR_FIELD(ea); + ea.cmdidx = CMD_SIZE; + ea.addr_type = ADDR_LINES; + ea.cmd = iptr->isn_arg.string; + SOURCING_LNUM = iptr->isn_lnum; + parse_cmd_address(&ea, &error, FALSE); + if (ea.cmd == NULL) + goto on_error; + // error is always NULL when using ADDR_LINES + error = ex_range_without_command(&ea); + if (error != NULL) + { + emsg(error); + goto on_error; + } + } + break; + + // Evaluate an expression with legacy syntax, push it onto the + // stack. + case ISN_LEGACY_EVAL: + { + char_u *arg = iptr->isn_arg.string; + int res; + int save_flags = cmdmod.cmod_flags; + + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + tv = STACK_TV_BOT(0); + init_tv(tv); + cmdmod.cmod_flags |= CMOD_LEGACY; + res = eval0(arg, tv, NULL, &EVALARG_EVALUATE); + cmdmod.cmod_flags = save_flags; + if (res == FAIL) + goto on_error; + ++ectx->ec_stack.ga_len; + } + break; + + // push typeval VAR_INSTR with instructions to be executed + case ISN_INSTR: + { + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + tv = STACK_TV_BOT(0); + tv->vval.v_instr = ALLOC_ONE(instr_T); + if (tv->vval.v_instr == NULL) + goto on_error; + ++ectx->ec_stack.ga_len; + + tv->v_type = VAR_INSTR; + tv->vval.v_instr->instr_ectx = ectx; + tv->vval.v_instr->instr_instr = iptr->isn_arg.instr; + } + break; + + case ISN_SOURCE: + { + int notused; + + SOURCING_LNUM = iptr->isn_lnum; + if (may_load_script((int)iptr->isn_arg.number, ¬used) + == FAIL) + goto on_error; + } + break; + + // execute :substitute with an expression + case ISN_SUBSTITUTE: + { + subs_T *subs = &iptr->isn_arg.subs; + source_cookie_T cookie; + struct subs_expr_S *save_instr = substitute_instr; + struct subs_expr_S subs_instr; + int res; + + subs_instr.subs_ectx = ectx; + subs_instr.subs_instr = subs->subs_instr; + subs_instr.subs_status = OK; + substitute_instr = &subs_instr; + + SOURCING_LNUM = iptr->isn_lnum; + // This is very much like ISN_EXEC + CLEAR_FIELD(cookie); + cookie.sourcing_lnum = iptr->isn_lnum - 1; + res = do_cmdline(subs->subs_cmd, + getsourceline, &cookie, + DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED); + substitute_instr = save_instr; + + if (res == FAIL || did_emsg + || subs_instr.subs_status == FAIL) + goto on_error; + } + break; + + case ISN_FINISH: + goto done; + + case ISN_REDIRSTART: + // create a dummy entry for var_redir_str() + if (alloc_redir_lval() == FAIL) + goto on_error; + + // The output is stored in growarray "redir_ga" until + // redirection ends. + init_redir_ga(); + redir_vname = 1; + break; + + case ISN_REDIREND: + { + char_u *res = get_clear_redir_ga(); + + // End redirection, put redirected text on the stack. + clear_redir_lval(); + redir_vname = 0; + + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + { + mnv_free(res); + goto theend; + } + tv = STACK_TV_BOT(0); + tv->v_type = VAR_STRING; + tv->vval.v_string = res; + ++ectx->ec_stack.ga_len; + } + break; + + case ISN_CEXPR_AUCMD: +#ifdef FEAT_QUICKFIX + force_abort = TRUE; + if (trigger_cexpr_autocmd(iptr->isn_arg.number) == FAIL) + goto on_error; + force_abort = FALSE; +#endif + break; + + case ISN_CEXPR_CORE: +#ifdef FEAT_QUICKFIX + { + exarg_T ea; + int res; + + CLEAR_FIELD(ea); + ea.cmdidx = iptr->isn_arg.cexpr.cexpr_ref->cer_cmdidx; + ea.forceit = iptr->isn_arg.cexpr.cexpr_ref->cer_forceit; + ea.cmdlinep = &iptr->isn_arg.cexpr.cexpr_ref->cer_cmdline; + --ectx->ec_stack.ga_len; + tv = STACK_TV_BOT(0); + SOURCING_LNUM = iptr->isn_lnum; + res = cexpr_core(&ea, tv); + clear_tv(tv); + if (res == FAIL) + goto on_error; + } +#endif + break; + + // execute Ex command from pieces on the stack + case ISN_EXECCONCAT: + { + int count = iptr->isn_arg.number; + size_t len = 0; + int pass; + int i; + char_u *cmd = NULL; + char_u *str; + + for (pass = 1; pass <= 2; ++pass) + { + for (i = 0; i < count; ++i) + { + tv = STACK_TV_BOT(i - count); + str = tv->vval.v_string; + if (str != NULL && *str != NUL) + { + if (pass == 2) + STRCPY(cmd + len, str); + len += STRLEN(str); + } + if (pass == 2) + clear_tv(tv); + } + if (pass == 1) + { + cmd = alloc(len + 1); + if (unlikely(cmd == NULL)) + goto theend; + len = 0; + } + } + + SOURCING_LNUM = iptr->isn_lnum; + do_cmdline_cmd(cmd); + mnv_free(cmd); + } + break; + + // execute :echo {string} ... + case ISN_ECHO: + { + int count = iptr->isn_arg.echo.echo_count; + int atstart = TRUE; + int needclr = TRUE; + int idx; + + for (idx = 0; idx < count; ++idx) + { + tv = STACK_TV_BOT(idx - count); + echo_one(tv, iptr->isn_arg.echo.echo_with_white, + &atstart, &needclr); + clear_tv(tv); + } + if (needclr) + msg_clr_eos(); + ectx->ec_stack.ga_len -= count; + } + break; + + // :execute {string} ... + // :echomsg {string} ... + // :echowindow {string} ... + // :echoconsole {string} ... + // :echoerr {string} ... + case ISN_EXECUTE: + case ISN_ECHOMSG: + case ISN_ECHOWINDOW: + case ISN_ECHOCONSOLE: + case ISN_ECHOERR: + { + int count; + garray_T ga; + char_u buf[NUMBUFLEN]; + char_u *p; + int len; + int failed = FALSE; + int idx; + + if (iptr->isn_type == ISN_ECHOWINDOW) + count = iptr->isn_arg.echowin.ewin_count; + else + count = iptr->isn_arg.number; + ga_init2(&ga, 1, 80); + for (idx = 0; idx < count; ++idx) + { + tv = STACK_TV_BOT(idx - count); + if (iptr->isn_type == ISN_EXECUTE) + { + if (tv->v_type == VAR_CHANNEL + || tv->v_type == VAR_JOB) + { + SOURCING_LNUM = iptr->isn_lnum; + semsg(_(e_using_invalid_value_as_string_str), + vartype_name(tv->v_type)); + break; + } + else + p = tv_get_string_buf(tv, buf); + } + else + { + SOURCING_LNUM = iptr->isn_lnum; + p = tv_stringify(tv, buf); + } + + len = (int)STRLEN(p); + if (GA_GROW_FAILS(&ga, len + 2)) + failed = TRUE; + else + { + if (ga.ga_len > 0) + ((char_u *)(ga.ga_data))[ga.ga_len++] = ' '; + STRCPY((char_u *)(ga.ga_data) + ga.ga_len, p); + ga.ga_len += len; + } + clear_tv(tv); + } + ectx->ec_stack.ga_len -= count; + if (failed) + { + ga_clear(&ga); + goto on_error; + } + + if (ga.ga_data != NULL) + { + if (iptr->isn_type == ISN_EXECUTE) + { + SOURCING_LNUM = iptr->isn_lnum; + do_cmdline_cmd((char_u *)ga.ga_data); + if (did_emsg) + { + ga_clear(&ga); + goto on_error; + } + } + else + { + msg_sb_eol(); + if (iptr->isn_type == ISN_ECHOMSG) + { + msg_attr(ga.ga_data, echo_attr); + out_flush(); + } +#ifdef HAS_MESSAGE_WINDOW + else if (iptr->isn_type == ISN_ECHOWINDOW) + { + start_echowindow( + iptr->isn_arg.echowin.ewin_time); + msg_attr(ga.ga_data, echo_attr); + end_echowindow(); + } +#endif + else if (iptr->isn_type == ISN_ECHOCONSOLE) + { + ui_write(ga.ga_data, (int)STRLEN(ga.ga_data), + TRUE); + ui_write((char_u *)"\r\n", 2, TRUE); + } + else + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(ga.ga_data); + } + } + } + ga_clear(&ga); + } + break; + + // load local variable or argument + case ISN_LOAD: + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + tv = STACK_TV_VAR(iptr->isn_arg.number); + if (tv->v_type == VAR_UNKNOWN) + { + // missing argument or default value v:none + STACK_TV_BOT(0)->v_type = VAR_SPECIAL; + STACK_TV_BOT(0)->vval.v_number = VVAL_NONE; + } + else + copy_tv(tv, STACK_TV_BOT(0)); + ++ectx->ec_stack.ga_len; + break; + + // load v: variable + case ISN_LOADV: + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + copy_tv(get_mnv_var_tv(iptr->isn_arg.number), STACK_TV_BOT(0)); + ++ectx->ec_stack.ga_len; + break; + + // load s: variable in MNV9 script + case ISN_LOADSCRIPT: + { + scriptref_T *sref = iptr->isn_arg.script.scriptref; + svar_T *sv; + + sv = get_script_svar(sref, ectx->ec_dfunc_idx); + if (sv == NULL) + goto theend; + allocate_if_null(sv); + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + copy_tv(sv->sv_tv, STACK_TV_BOT(0)); + ++ectx->ec_stack.ga_len; + } + break; + + // load s: variable in old script or autoload import + case ISN_LOADS: + case ISN_LOADEXPORT: + { + int sid = iptr->isn_arg.loadstore.ls_sid; + hashtab_T *ht = &SCRIPT_VARS(sid); + char_u *name = iptr->isn_arg.loadstore.ls_name; + dictitem_T *di = find_var_in_ht(ht, 0, name, TRUE); + + if (di == NULL) + { + SOURCING_LNUM = iptr->isn_lnum; + semsg(_(e_undefined_variable_str), name); + goto on_error; + } + else + { + if (iptr->isn_type == ISN_LOADEXPORT) + { + int idx = get_script_item_idx(sid, name, 0, + NULL, NULL); + svar_T *sv; + + if (idx >= 0) + { + sv = ((svar_T *)SCRIPT_ITEM(sid) + ->sn_var_vals.ga_data) + idx; + if ((sv->sv_flags & SVFLAG_EXPORTED) == 0) + { + SOURCING_LNUM = iptr->isn_lnum; + semsg(_(e_item_not_exported_in_script_str), + name); + goto on_error; + } + } + } + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + copy_tv(&di->di_tv, STACK_TV_BOT(0)); + ++ectx->ec_stack.ga_len; + } + } + break; + + // load g:/b:/w:/t: variable + case ISN_LOADG: + case ISN_LOADB: + case ISN_LOADW: + case ISN_LOADT: + { + int res = load_namespace_var(ectx, iptr->isn_type, iptr); + + if (res == NOTDONE) + goto theend; + if (res == FAIL) + goto on_error; + } + + break; + + // load autoload variable + case ISN_LOADAUTO: + { + char_u *name = iptr->isn_arg.string; + + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + SOURCING_LNUM = iptr->isn_lnum; + if (eval_variable(name, (int)STRLEN(name), 0, + STACK_TV_BOT(0), NULL, EVAL_VAR_VERBOSE) == FAIL) + goto on_error; + ++ectx->ec_stack.ga_len; + } + break; + + // load g:/b:/w:/t: namespace + case ISN_LOADGDICT: + case ISN_LOADBDICT: + case ISN_LOADWDICT: + case ISN_LOADTDICT: + { + dict_T *d = NULL; + + switch (iptr->isn_type) + { + case ISN_LOADGDICT: d = get_globvar_dict(); break; + case ISN_LOADBDICT: d = curbuf->b_vars; break; + case ISN_LOADWDICT: d = curwin->w_vars; break; + case ISN_LOADTDICT: d = curtab->tp_vars; break; + default: // Cannot reach here + goto theend; + } + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + tv = STACK_TV_BOT(0); + tv->v_type = VAR_DICT; + tv->v_lock = 0; + tv->vval.v_dict = d; + ++d->dv_refcount; + ++ectx->ec_stack.ga_len; + } + break; + + // load &option + case ISN_LOADOPT: + { + typval_T optval; + char_u *name = iptr->isn_arg.string; + + // This is not expected to fail, name is checked during + // compilation: don't set SOURCING_LNUM. + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + if (eval_option(&name, &optval, TRUE) == FAIL) + goto theend; + *STACK_TV_BOT(0) = optval; + ++ectx->ec_stack.ga_len; + } + break; + + // load $ENV + case ISN_LOADENV: + { + typval_T optval; + char_u *name = iptr->isn_arg.string; + + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + // name is always valid, checked when compiling + (void)eval_env_var(&name, &optval, TRUE); + *STACK_TV_BOT(0) = optval; + ++ectx->ec_stack.ga_len; + } + break; + + // load @register + case ISN_LOADREG: + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + tv = STACK_TV_BOT(0); + tv->v_type = VAR_STRING; + tv->v_lock = 0; + // This may result in NULL, which should be equivalent to an + // empty string. + tv->vval.v_string = get_reg_contents( + iptr->isn_arg.number, GREG_EXPR_SRC); + ++ectx->ec_stack.ga_len; + break; + + // store local variable + case ISN_STORE: + --ectx->ec_stack.ga_len; + tv = STACK_TV_VAR(iptr->isn_arg.number); + if (check_typval_is_value(STACK_TV_BOT(0)) == FAIL) + { + clear_tv(STACK_TV_BOT(0)); + goto on_error; + } + clear_tv(tv); + *tv = *STACK_TV_BOT(0); + break; + + // store s: variable in old script or autoload import + case ISN_STORES: + case ISN_STOREEXPORT: + { + int sid = iptr->isn_arg.loadstore.ls_sid; + char_u *name = iptr->isn_arg.loadstore.ls_name; + dictitem_T *di = NULL; + // First check for a variable from an exported autoload + // with an autoload_prefix; it would be in globals. + if (iptr->isn_type == ISN_STOREEXPORT) + di = find_var_autoload_prefix(name, sid, NULL, NULL); + // Then look for a variable in the script's variables. + if (di == NULL) + { + hashtab_T *ht = &SCRIPT_VARS(sid); + di = find_var_in_ht(ht, 0, STRNCMP("s:", name, 2) == 0 + ? name + 2 : name, TRUE); + } + + --ectx->ec_stack.ga_len; + SOURCING_LNUM = iptr->isn_lnum; + if (di == NULL) + { + if (iptr->isn_type == ISN_STOREEXPORT) + { + semsg(_(e_undefined_variable_str), name); + clear_tv(STACK_TV_BOT(0)); + goto on_error; + } + store_var(name, STACK_TV_BOT(0)); + } + else + { + if (iptr->isn_type == ISN_STOREEXPORT) + { + int idx = get_script_item_idx(sid, name, 0, + NULL, NULL); + + // can this ever fail? + if (idx >= 0) + { + svar_T *sv = ((svar_T *)SCRIPT_ITEM(sid) + ->sn_var_vals.ga_data) + idx; + + if ((sv->sv_flags & SVFLAG_EXPORTED) == 0) + { + semsg(_(e_item_not_exported_in_script_str), + name); + clear_tv(STACK_TV_BOT(0)); + goto on_error; + } + } + } + if (var_check_permission(di, name) == FAIL) + { + clear_tv(STACK_TV_BOT(0)); + goto on_error; + } + clear_tv(&di->di_tv); + di->di_tv = *STACK_TV_BOT(0); + } + } + break; + + // store script-local variable in MNV9 script + case ISN_STORESCRIPT: + { + scriptref_T *sref = iptr->isn_arg.script.scriptref; + svar_T *sv; + + sv = get_script_svar(sref, ectx->ec_dfunc_idx); + if (sv == NULL) + goto theend; + --ectx->ec_stack.ga_len; + + // "const" and "final" are checked at compile time, locking + // the value needs to be checked here. + SOURCING_LNUM = iptr->isn_lnum; + if (value_check_lock(sv->sv_tv->v_lock, sv->sv_name, FALSE)) + { + clear_tv(STACK_TV_BOT(0)); + goto on_error; + } + + clear_tv(sv->sv_tv); + *sv->sv_tv = *STACK_TV_BOT(0); + } + break; + + // store option + case ISN_STOREOPT: + case ISN_STOREFUNCOPT: + { + char_u *opt_name = iptr->isn_arg.storeopt.so_name; + int opt_flags = iptr->isn_arg.storeopt.so_flags; + long n = 0; + char_u *s = NULL; + char *msg; + char_u numbuf[NUMBUFLEN]; + char_u *tofree = NULL; + + --ectx->ec_stack.ga_len; + SOURCING_LNUM = iptr->isn_lnum; + tv = STACK_TV_BOT(0); + if (tv->v_type == VAR_STRING) + { + s = tv->vval.v_string; + if (s == NULL) + s = (char_u *)""; + } + else if (iptr->isn_type == ISN_STOREFUNCOPT) + { + // If the option can be set to a function reference or + // a lambda and the passed value is a function + // reference, then convert it to the name (string) of + // the function reference. + s = tv2string(tv, &tofree, numbuf, 0); + if (s == NULL || *s == NUL) + { + // cannot happen? + clear_tv(tv); + mnv_free(tofree); + goto on_error; + } + } + else + // must be VAR_NUMBER, CHECKTYPE makes sure + n = tv->vval.v_number; + msg = set_option_value(opt_name, n, s, opt_flags); + clear_tv(tv); + mnv_free(tofree); + if (msg != NULL) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(msg)); + goto on_error; + } + } + break; + + // store $ENV + case ISN_STOREENV: + if (check_restricted()) + goto theend; + --ectx->ec_stack.ga_len; + tv = STACK_TV_BOT(0); + mnv_setenv_ext(iptr->isn_arg.string, tv_get_string(tv)); + clear_tv(tv); + break; + + // store @r + case ISN_STOREREG: + { + int reg = iptr->isn_arg.number; + + --ectx->ec_stack.ga_len; + tv = STACK_TV_BOT(0); + write_reg_contents(reg, tv_get_string(tv), -1, FALSE); + clear_tv(tv); + } + break; + + // store v: variable + case ISN_STOREV: + --ectx->ec_stack.ga_len; + if (set_mnv_var_tv(iptr->isn_arg.number, STACK_TV_BOT(0)) + == FAIL) + // should not happen, type is checked when compiling + goto on_error; + break; + + // store g:/b:/w:/t: variable + case ISN_STOREG: + case ISN_STOREB: + case ISN_STOREW: + case ISN_STORET: + { + dictitem_T *di; + hashtab_T *ht; + char_u *name = iptr->isn_arg.string + 2; + + switch (iptr->isn_type) + { + case ISN_STOREG: + ht = get_globvar_ht(); + break; + case ISN_STOREB: + ht = &curbuf->b_vars->dv_hashtab; + break; + case ISN_STOREW: + ht = &curwin->w_vars->dv_hashtab; + break; + case ISN_STORET: + ht = &curtab->tp_vars->dv_hashtab; + break; + default: // Cannot reach here + goto theend; + } + + --ectx->ec_stack.ga_len; + di = find_var_in_ht(ht, 0, name, TRUE); + if (di == NULL) + store_var(iptr->isn_arg.string, STACK_TV_BOT(0)); + else + { + SOURCING_LNUM = iptr->isn_lnum; + if (var_check_permission(di, name) == FAIL) + goto on_error; + clear_tv(&di->di_tv); + di->di_tv = *STACK_TV_BOT(0); + } + } + break; + + // store an autoload variable + case ISN_STOREAUTO: + SOURCING_LNUM = iptr->isn_lnum; + set_var(iptr->isn_arg.string, STACK_TV_BOT(-1), TRUE); + clear_tv(STACK_TV_BOT(-1)); + --ectx->ec_stack.ga_len; + break; + + // store number in local variable + case ISN_STORENR: + tv = STACK_TV_VAR(iptr->isn_arg.storenr.stnr_idx); + clear_tv(tv); + tv->v_type = VAR_NUMBER; + tv->vval.v_number = iptr->isn_arg.storenr.stnr_val; + break; + + // Store a value in a list, tuple, dict, blob or object variable. + case ISN_STOREINDEX: + { + int res = execute_storeindex(iptr, ectx); + + if (res == FAIL) + goto on_error; + if (res == NOTDONE) + goto theend; + } + break; + + // store value in list or blob range + case ISN_STORERANGE: + if (execute_storerange(iptr, ectx) == FAIL) + goto on_error; + break; + + case ISN_LOAD_CLASSMEMBER: + { + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + classmember_T *cm = &iptr->isn_arg.classmember; + copy_tv(cm->cm_class->class_members_tv + cm->cm_idx, + STACK_TV_BOT(0)); + ++ectx->ec_stack.ga_len; + } + break; + + case ISN_STORE_CLASSMEMBER: + { + classmember_T *cm = &iptr->isn_arg.classmember; + tv = &cm->cm_class->class_members_tv[cm->cm_idx]; + clear_tv(tv); + *tv = *STACK_TV_BOT(-1); + --ectx->ec_stack.ga_len; + } + break; + + // Load or store variable or argument from outer scope. + case ISN_LOADOUTER: + case ISN_STOREOUTER: + { + int depth = iptr->isn_arg.outer.outer_depth; + outer_T *outer = ectx->ec_outer_ref == NULL ? NULL + : ectx->ec_outer_ref->or_outer; + + while (depth > 1 && outer != NULL) + { + outer = outer->out_up; + --depth; + } + if (outer == NULL) + { + SOURCING_LNUM = iptr->isn_lnum; + if (ectx->ec_frame_idx == ectx->ec_initial_frame_idx + || ectx->ec_outer_ref == NULL) + // Possibly :def function called from legacy + // context. + emsg(_(e_closure_called_from_invalid_context)); + else + iemsg("LOADOUTER depth more than scope levels"); + goto theend; + } + if (depth < 0) + // Variable declared in loop. May be copied if the + // loop block has already ended. + tv = ((typval_T *)outer->out_loop[-depth - 1] + .stack->ga_data) + + outer->out_loop[-depth - 1].var_idx + + iptr->isn_arg.outer.outer_idx; + else + // Variable declared in a function. May be copied if + // the function has already returned. + tv = ((typval_T *)outer->out_stack->ga_data) + + outer->out_frame_idx + STACK_FRAME_SIZE + + iptr->isn_arg.outer.outer_idx; + if (iptr->isn_type == ISN_LOADOUTER) + { + typval_T *copy; + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + // careful: ga_grow_inner may re-alloc the stack + if (depth < 0) + copy = ((typval_T *)outer->out_loop[-depth - 1] + .stack->ga_data) + + outer->out_loop[-depth - 1].var_idx + + iptr->isn_arg.outer.outer_idx; + else + copy = ((typval_T *)outer->out_stack->ga_data) + + outer->out_frame_idx + STACK_FRAME_SIZE + + iptr->isn_arg.outer.outer_idx; + // memory was freed, get tv again + if (copy != tv) + tv = copy; + copy_tv(tv, STACK_TV_BOT(0)); + ++ectx->ec_stack.ga_len; + } + else + { + --ectx->ec_stack.ga_len; + clear_tv(tv); + *tv = *STACK_TV_BOT(0); + } + } + break; + + // unlet item in list or dict variable + case ISN_UNLETINDEX: + if (execute_unletindex(iptr, ectx) == FAIL) + goto on_error; + break; + + // unlet range of items in list variable + case ISN_UNLETRANGE: + if (execute_unletrange(iptr, ectx) == FAIL) + goto on_error; + break; + + // push constant + case ISN_PUSHNR: + case ISN_PUSHBOOL: + case ISN_PUSHSPEC: + case ISN_PUSHF: + case ISN_PUSHS: + case ISN_PUSHBLOB: + case ISN_PUSHFUNC: + case ISN_PUSHCHANNEL: + case ISN_PUSHJOB: + case ISN_PUSHOBJ: + case ISN_PUSHCLASS: + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + tv = STACK_TV_BOT(0); + tv->v_lock = 0; + ++ectx->ec_stack.ga_len; + switch (iptr->isn_type) + { + case ISN_PUSHNR: + tv->v_type = VAR_NUMBER; + tv->vval.v_number = iptr->isn_arg.number; + break; + case ISN_PUSHBOOL: + tv->v_type = VAR_BOOL; + tv->vval.v_number = iptr->isn_arg.number; + break; + case ISN_PUSHSPEC: + tv->v_type = VAR_SPECIAL; + tv->vval.v_number = iptr->isn_arg.number; + break; + case ISN_PUSHF: + tv->v_type = VAR_FLOAT; + tv->vval.v_float = iptr->isn_arg.fnumber; + break; + case ISN_PUSHBLOB: + blob_copy(iptr->isn_arg.blob, tv); + break; + case ISN_PUSHFUNC: + tv->v_type = VAR_FUNC; + if (iptr->isn_arg.string == NULL) + tv->vval.v_string = NULL; + else + tv->vval.v_string = + mnv_strsave(iptr->isn_arg.string); + break; + case ISN_PUSHCHANNEL: +#ifdef FEAT_JOB_CHANNEL + tv->v_type = VAR_CHANNEL; + tv->vval.v_channel = NULL; +#endif + break; + case ISN_PUSHJOB: +#ifdef FEAT_JOB_CHANNEL + tv->v_type = VAR_JOB; + tv->vval.v_job = NULL; +#endif + break; + case ISN_PUSHOBJ: + tv->v_type = VAR_OBJECT; + tv->vval.v_object = NULL; + break; + case ISN_PUSHCLASS: + tv->v_type = VAR_CLASS; + tv->vval.v_class = iptr->isn_arg.classarg; + break; + default: + tv->v_type = VAR_STRING; + tv->vval.v_string = iptr->isn_arg.string == NULL + ? NULL : mnv_strsave(iptr->isn_arg.string); + } + break; + + case ISN_AUTOLOAD: + { + char_u *name = iptr->isn_arg.string; + + (void)script_autoload(name, FALSE); + if (find_func(name, TRUE)) + { + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + tv = STACK_TV_BOT(0); + tv->v_lock = 0; + ++ectx->ec_stack.ga_len; + tv->v_type = VAR_FUNC; + tv->vval.v_string = mnv_strsave(name); + } + else + { + int res = load_namespace_var(ectx, ISN_LOADG, iptr); + + if (res == NOTDONE) + goto theend; + if (res == FAIL) + goto on_error; + } + } + break; + + case ISN_UNLET: + if (do_unlet(iptr->isn_arg.unlet.ul_name, + iptr->isn_arg.unlet.ul_forceit) == FAIL) + goto on_error; + break; + case ISN_UNLETENV: + mnv_unsetenv_ext(iptr->isn_arg.unlet.ul_name); + break; + + case ISN_LOCKUNLOCK: + { +#ifdef LOG_LOCKVAR + ch_log(NULL, "LKVAR: execute INS_LOCKUNLOCK isn_arg %s", + iptr->isn_arg.string); +#endif + lval_root_T *lval_root_save = lval_root; + + // Stack has the local variable, argument the whole :lock + // or :unlock command, like ISN_EXEC. + --ectx->ec_stack.ga_len; + lval_root_T root; + root.lr_tv = STACK_TV_BOT(0); + root.lr_cl_exec = iptr->isn_arg.lockunlock.lu_cl_exec; + root.lr_is_arg = iptr->isn_arg.lockunlock.lu_is_arg; + lval_root = &root; + int res = exec_command(iptr, + iptr->isn_arg.lockunlock.lu_string); + clear_tv(root.lr_tv); + lval_root = lval_root_save; + if (res == FAIL) + goto on_error; + } + break; + + case ISN_LOCKCONST: + item_lock(STACK_TV_BOT(-1), 100, TRUE, TRUE); + break; + + // create a list from items on the stack; uses a single allocation + // for the list header and the items + case ISN_NEWLIST: + if (exe_newlist(iptr->isn_arg.number, ectx) == FAIL) + goto theend; + break; + + // create a tuple from items on the stack + case ISN_NEWTUPLE: + if (exe_newtuple(iptr->isn_arg.number, ectx) == FAIL) + goto theend; + break; + + // create a dict from items on the stack + case ISN_NEWDICT: + { + int res; + + SOURCING_LNUM = iptr->isn_lnum; + res = exe_newdict(iptr->isn_arg.number, ectx); + if (res == FAIL) + goto theend; + if (res == MAYBE) + goto on_error; + } + break; + + case ISN_CONCAT: + if (exe_concat(iptr->isn_arg.number, ectx) == FAIL) + goto theend; + break; + + // create a partial with NULL value + case ISN_NEWPARTIAL: + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + ++ectx->ec_stack.ga_len; + tv = STACK_TV_BOT(-1); + tv->v_type = VAR_PARTIAL; + tv->v_lock = 0; + tv->vval.v_partial = NULL; + break; + + // call a :def function + case ISN_DCALL: + SOURCING_LNUM = iptr->isn_lnum; + if (call_dfunc(iptr->isn_arg.dfunc.cdf_idx, + NULL, + iptr->isn_arg.dfunc.cdf_argcount, + ectx) == FAIL) + goto on_error; + break; + + // call a method on an interface + case ISN_METHODCALL: + { + cmfunc_T *mfunc = iptr->isn_arg.mfunc; + + SOURCING_LNUM = iptr->isn_lnum; + tv = STACK_TV_BOT(-1 - mfunc->cmf_argcount); + if (tv->v_type != VAR_OBJECT) + { + object_required_error(tv); + goto on_error; + } + + object_T *obj = tv->vval.v_object; + if (obj == NULL) + { + emsg(_(e_using_null_object)); + goto on_error; + } + + ufunc_T *ufunc; + if (mfunc->cmf_is_super) + // Doing "super.Func", use the specific ufunc. + ufunc = mfunc->cmf_itf->class_obj_methods[ + mfunc->cmf_idx]; + else + { + class_T *cl = obj->obj_class; + + // convert the interface index to the object index + int idx = object_index_from_itf_index(mfunc->cmf_itf, + TRUE, mfunc->cmf_idx, cl); + ufunc = cl->class_obj_methods[idx]; + } + + if (call_ufunc(ufunc, NULL, mfunc->cmf_argcount, ectx, + NULL, NULL) == FAIL) + goto on_error; + } + break; + + // call a builtin function + case ISN_BCALL: + SOURCING_LNUM = iptr->isn_lnum; + if (call_bfunc(iptr->isn_arg.bfunc.cbf_idx, + iptr->isn_arg.bfunc.cbf_argcount, + ectx) == FAIL) + goto on_error; + break; + + // call a funcref or partial + case ISN_PCALL: + { + cpfunc_T *pfunc = &iptr->isn_arg.pfunc; + int r; + typval_T partial_tv; + + SOURCING_LNUM = iptr->isn_lnum; + if (pfunc->cpf_top) + { + // funcref is above the arguments + tv = STACK_TV_BOT(-pfunc->cpf_argcount - 1); + } + else + { + // Get the funcref from the stack. + --ectx->ec_stack.ga_len; + partial_tv = *STACK_TV_BOT(0); + tv = &partial_tv; + } + r = call_partial(tv, pfunc->cpf_argcount, ectx); + if (tv == &partial_tv) + clear_tv(&partial_tv); + if (r == FAIL) + goto on_error; + } + break; + + case ISN_PCALL_END: + // PCALL finished, arguments have been consumed and replaced by + // the return value. Now clear the funcref from the stack, + // and move the return value in its place. + --ectx->ec_stack.ga_len; + clear_tv(STACK_TV_BOT(-1)); + *STACK_TV_BOT(-1) = *STACK_TV_BOT(0); + break; + + // call a user defined function or funcref/partial + case ISN_UCALL: + { + cufunc_T *cufunc = &iptr->isn_arg.ufunc; + + SOURCING_LNUM = iptr->isn_lnum; + if (call_eval_func(cufunc->cuf_name, cufunc->cuf_argcount, + ectx, iptr) == FAIL) + goto on_error; + } + break; + + // :defer func(arg) + case ISN_DEFER: + if (defer_command(iptr->isn_arg.defer.defer_var_idx, + iptr->isn_arg.defer.defer_argcount, ectx) == FAIL) + goto on_error; + break; + + // Return from a :def function call without a value. + // Return from a constructor. + case ISN_RETURN_VOID: + case ISN_RETURN_OBJECT: + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + tv = STACK_TV_BOT(0); + ++ectx->ec_stack.ga_len; + if (iptr->isn_type == ISN_RETURN_VOID) + { + tv->v_type = VAR_VOID; + tv->vval.v_number = 0; + tv->v_lock = 0; + } + else + { + *tv = *STACK_TV_VAR(0); + object_T *obj = tv->vval.v_object; + ++obj->obj_refcount; + + // Lock all the constant object variables + obj_lock_const_vars(obj); + } + // FALLTHROUGH + + // return from a :def function call with what is on the stack + case ISN_RETURN: + { + garray_T *trystack = &ectx->ec_trystack; + trycmd_T *trycmd = NULL; + + /////////////////////////////////////////////////// + // TODO: If FAIL, line number in output not correct + /////////////////////////////////////////////////// + if (check_typval_is_value(STACK_TV_BOT(-1)) == FAIL) + goto theend; + + if (trystack->ga_len > 0) + trycmd = ((trycmd_T *)trystack->ga_data) + + trystack->ga_len - 1; + if (trycmd != NULL + && trycmd->tcd_frame_idx == ectx->ec_frame_idx) + { + // jump to ":finally" or ":endtry" + if (trycmd->tcd_finally_idx != 0) + ectx->ec_iidx = trycmd->tcd_finally_idx; + else + ectx->ec_iidx = trycmd->tcd_endtry_idx; + trycmd->tcd_return = TRUE; + } + else + goto func_return; + } + break; + + // push a partial, a reference to a compiled function + case ISN_FUNCREF: + { + partial_T *pt = ALLOC_CLEAR_ONE(partial_T); + ufunc_T *ufunc; + funcref_T *funcref = &iptr->isn_arg.funcref; + funcref_extra_T *extra = funcref->fr_extra; + + if (pt == NULL) + goto theend; + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + { + mnv_free(pt); + goto theend; + } + if (extra != NULL && extra->fre_class != NULL) + { + class_T *cl; + if (extra->fre_object_method) + { + tv = STACK_TV_BOT(-1); + if (tv->v_type != VAR_OBJECT) + { + SOURCING_LNUM = iptr->isn_lnum; + object_required_error(tv); + mnv_free(pt); + goto on_error; + } + + object_T *obj = tv->vval.v_object; + if (obj == NULL) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_using_null_object)); + mnv_free(pt); + goto on_error; + } + + cl = obj->obj_class; + // drop the value from the stack + clear_tv(tv); + --ectx->ec_stack.ga_len; + + pt->pt_obj = obj; + ++obj->obj_refcount; + } + else + cl = extra->fre_class; + + if (extra->fre_object_method) + { + // object method + // convert the interface index to the object index + int idx = + object_index_from_itf_index(extra->fre_class, + TRUE, extra->fre_method_idx, cl); + ufunc = cl->class_obj_methods[idx]; + } + else + { + // class method + ufunc = + cl->class_class_functions[extra->fre_method_idx]; + } + } + else if (extra == NULL || extra->fre_func_name == NULL) + { + dfunc_T *pt_dfunc = ((dfunc_T *)def_functions.ga_data) + + funcref->fr_dfunc_idx; + + ufunc = pt_dfunc->df_ufunc; + } + else + { + ufunc = find_func(extra->fre_func_name, FALSE); + } + if (ufunc == NULL) + { + SOURCING_LNUM = iptr->isn_lnum; + iemsg("ufunc unexpectedly NULL for FUNCREF"); + mnv_free(pt); + goto theend; + } + if (fill_partial_and_closure(pt, ufunc, + extra == NULL ? NULL : &extra->fre_loopvar_info, + ectx) == FAIL) + goto theend; + tv = STACK_TV_BOT(0); + ++ectx->ec_stack.ga_len; + tv->vval.v_partial = pt; + tv->v_type = VAR_PARTIAL; + tv->v_lock = 0; + } + break; + + // Create a global function from a lambda. + case ISN_NEWFUNC: + { + newfuncarg_T *arg = iptr->isn_arg.newfunc.nf_arg; + + if (copy_lambda_to_global_func(arg->nfa_lambda, + arg->nfa_global, &arg->nfa_loopvar_info, + ectx) == FAIL) + goto theend; + } + break; + + // List functions + case ISN_DEF: + if (iptr->isn_arg.string == NULL) + list_functions(NULL); + else + { + exarg_T ea; + garray_T lines_to_free; + + CLEAR_FIELD(ea); + ea.cmd = ea.arg = iptr->isn_arg.string; + ga_init2(&lines_to_free, sizeof(char_u *), 50); + SOURCING_LNUM = iptr->isn_lnum; + define_function(&ea, NULL, &lines_to_free, 0, NULL, 0, NULL); + ga_clear_strings(&lines_to_free); + } + break; + + // jump if a condition is met + case ISN_JUMP: + { + jumpwhen_T when = iptr->isn_arg.jump.jump_when; + int error = FALSE; + int jump = TRUE; + + if (when != JUMP_ALWAYS) + { + tv = STACK_TV_BOT(-1); + if (when == JUMP_IF_COND_FALSE + || when == JUMP_IF_FALSE + || when == JUMP_IF_COND_TRUE) + { + SOURCING_LNUM = iptr->isn_lnum; + jump = tv_get_bool_chk(tv, &error); + if (error) + goto on_error; + } + else + jump = tv2bool(tv); + if (when == JUMP_IF_FALSE || when == JUMP_IF_COND_FALSE) + jump = !jump; + if (when == JUMP_IF_FALSE || !jump) + { + // drop the value from the stack + clear_tv(tv); + --ectx->ec_stack.ga_len; + } + } + if (jump) + ectx->ec_iidx = iptr->isn_arg.jump.jump_where; + } + break; + + // "while": jump to end if a condition is false + case ISN_WHILE: + { + int error = FALSE; + int jump = TRUE; + + tv = STACK_TV_BOT(-1); + SOURCING_LNUM = iptr->isn_lnum; + jump = !tv_get_bool_chk(tv, &error); + if (error) + goto on_error; + // drop the value from the stack + clear_tv(tv); + --ectx->ec_stack.ga_len; + if (jump) + ectx->ec_iidx = iptr->isn_arg.whileloop.while_end; + + // Store the current funcref count, may be used by + // ISN_ENDLOOP later + tv = STACK_TV_VAR( + iptr->isn_arg.whileloop.while_funcref_idx); + tv->vval.v_number = ectx->ec_funcrefs.ga_len; + } + break; + + // Jump if an argument with a default value was already set and not + // v:none. + case ISN_JUMP_IF_ARG_SET: + case ISN_JUMP_IF_ARG_NOT_SET: + tv = STACK_TV_VAR(iptr->isn_arg.jumparg.jump_arg_off); + int arg_set = tv->v_type != VAR_UNKNOWN + && !(tv->v_type == VAR_SPECIAL + && tv->vval.v_number == VVAL_NONE); + + if (iptr->isn_type == ISN_JUMP_IF_ARG_NOT_SET && !arg_set) + { + dfunc_T *df = ((dfunc_T *)def_functions.ga_data) + + ectx->ec_dfunc_idx; + ufunc_T *ufunc = df->df_ufunc; + // jump_arg_off is negative for arguments + size_t argidx = ufunc->uf_def_args.ga_len + + iptr->isn_arg.jumparg.jump_arg_off + + STACK_FRAME_SIZE; + type_T *tuple = ufunc->uf_arg_types[argidx]; + CLEAR_POINTER(tv); + tv->v_type = tuple->tt_type; + } + + if (iptr->isn_type == ISN_JUMP_IF_ARG_SET ? arg_set : !arg_set) + ectx->ec_iidx = iptr->isn_arg.jumparg.jump_where; + break; + + // top of a for loop + case ISN_FOR: + if (execute_for(iptr, ectx) == FAIL) + goto theend; + break; + + // end of a for or while loop + case ISN_ENDLOOP: + if (execute_endloop(iptr, ectx) == FAIL) + goto theend; + break; + + // start of ":try" block + case ISN_TRY: + { + trycmd_T *trycmd = NULL; + + if (GA_GROW_FAILS(&ectx->ec_trystack, 1)) + goto theend; + trycmd = ((trycmd_T *)ectx->ec_trystack.ga_data) + + ectx->ec_trystack.ga_len; + ++ectx->ec_trystack.ga_len; + ++trylevel; + CLEAR_POINTER(trycmd); + trycmd->tcd_frame_idx = ectx->ec_frame_idx; + trycmd->tcd_stack_len = ectx->ec_stack.ga_len; + trycmd->tcd_catch_idx = + iptr->isn_arg.tryref.try_ref->try_catch; + trycmd->tcd_finally_idx = + iptr->isn_arg.tryref.try_ref->try_finally; + trycmd->tcd_endtry_idx = + iptr->isn_arg.tryref.try_ref->try_endtry; + } + break; + + case ISN_PUSHEXC: + if (current_exception == NULL) + { + SOURCING_LNUM = iptr->isn_lnum; + iemsg("Evaluating catch while current_exception is NULL"); + goto theend; + } + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + tv = STACK_TV_BOT(0); + ++ectx->ec_stack.ga_len; + tv->v_type = VAR_STRING; + tv->v_lock = 0; + tv->vval.v_string = mnv_strsave( + (char_u *)current_exception->value); + break; + + case ISN_CATCH: + { + garray_T *trystack = &ectx->ec_trystack; + trycmd_T *trycmd; + + may_restore_cmdmod(&ectx->ec_funclocal); + trycmd = ((trycmd_T *)trystack->ga_data) + + trystack->ga_len - 1; + trycmd->tcd_caught = TRUE; + trycmd->tcd_did_throw = FALSE; + + did_emsg = got_int = did_throw = FALSE; + force_abort = need_rethrow = FALSE; + catch_exception(current_exception); + } + break; + + case ISN_TRYCONT: + { + garray_T *trystack = &ectx->ec_trystack; + trycont_T *trycont = &iptr->isn_arg.trycont; + int i; + trycmd_T *trycmd; + int iidx = trycont->tct_where; + + if (trystack->ga_len < trycont->tct_levels) + { + siemsg("TRYCONT: expected %d levels, found %d", + trycont->tct_levels, trystack->ga_len); + goto theend; + } + // Make :endtry jump to any outer try block and the last + // :endtry inside the loop to the loop start. + for (i = trycont->tct_levels; i > 0; --i) + { + trycmd = ((trycmd_T *)trystack->ga_data) + + trystack->ga_len - i; + // Add one to tcd_cont to be able to jump to + // instruction with index zero. + trycmd->tcd_cont = iidx + 1; + iidx = trycmd->tcd_finally_idx == 0 + ? trycmd->tcd_endtry_idx : trycmd->tcd_finally_idx; + } + // jump to :finally or :endtry of current try statement + ectx->ec_iidx = iidx; + } + break; + + case ISN_FINALLY: + { + garray_T *trystack = &ectx->ec_trystack; + trycmd_T *trycmd = ((trycmd_T *)trystack->ga_data) + + trystack->ga_len - 1; + + // Reset the index to avoid a return statement jumps here + // again. + trycmd->tcd_finally_idx = 0; + if (trycmd->tcd_caught) + { + // discard the exception + finish_exception(caught_stack); + trycmd->tcd_caught = FALSE; + } + break; + } + + // end of ":try" block + case ISN_ENDTRY: + { + garray_T *trystack = &ectx->ec_trystack; + trycmd_T *trycmd; + + --trystack->ga_len; + --trylevel; + trycmd = ((trycmd_T *)trystack->ga_data) + trystack->ga_len; + if (trycmd->tcd_did_throw) + did_throw = TRUE; + if (trycmd->tcd_caught) + { + // discard the exception + finish_exception(caught_stack); + } + + if (trycmd->tcd_return) + goto func_return; + + while (ectx->ec_stack.ga_len > trycmd->tcd_stack_len) + { + --ectx->ec_stack.ga_len; + clear_tv(STACK_TV_BOT(0)); + } + if (trycmd->tcd_cont != 0) + // handling :continue: jump to outer try block or + // start of the loop + ectx->ec_iidx = trycmd->tcd_cont - 1; + } + break; + + case ISN_THROW: + { + garray_T *trystack = &ectx->ec_trystack; + + if (trystack->ga_len == 0 && trylevel == 0 && emsg_silent) + { + // Throwing an exception while using "silent!" causes + // the function to abort but not display an error. + tv = STACK_TV_BOT(-1); + clear_tv(tv); + tv->v_type = VAR_NUMBER; + tv->vval.v_number = 0; + goto done; + } + --ectx->ec_stack.ga_len; + tv = STACK_TV_BOT(0); + if (tv->vval.v_string == NULL + || *skipwhite(tv->vval.v_string) == NUL) + { + mnv_free(tv->vval.v_string); + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_throw_with_empty_string)); + goto theend; + } + + // Inside a "catch" we need to first discard the caught + // exception. + if (trystack->ga_len > 0) + { + trycmd_T *trycmd = ((trycmd_T *)trystack->ga_data) + + trystack->ga_len - 1; + if (trycmd->tcd_caught) + { + // discard the exception + finish_exception(caught_stack); + trycmd->tcd_caught = FALSE; + } + } + + SOURCING_LNUM = iptr->isn_lnum; + if (throw_exception(tv->vval.v_string, ET_USER, NULL) + == FAIL) + { + mnv_free(tv->vval.v_string); + goto theend; + } + did_throw = TRUE; + } + break; + + // compare with special values + case ISN_COMPAREBOOL: + case ISN_COMPARESPECIAL: + { + typval_T *tv1 = STACK_TV_BOT(-2); + typval_T *tv2 = STACK_TV_BOT(-1); + varnumber_T arg1 = tv1->vval.v_number; + varnumber_T arg2 = tv2->vval.v_number; + int res; + + if (iptr->isn_arg.op.op_type == EXPR_EQUAL) + res = arg1 == arg2; + else + res = arg1 != arg2; + + --ectx->ec_stack.ga_len; + tv1->v_type = VAR_BOOL; + tv1->vval.v_number = res ? VVAL_TRUE : VVAL_FALSE; + } + break; + + case ISN_COMPARENULL: + { + typval_T *tv1 = STACK_TV_BOT(-2); + typval_T *tv2 = STACK_TV_BOT(-1); + int res; + + res = typval_compare_null(tv1, tv2); + if (res == MAYBE) + goto on_error; + if (iptr->isn_arg.op.op_type == EXPR_NEQUAL) + res = !res; + clear_tv(tv1); + clear_tv(tv2); + --ectx->ec_stack.ga_len; + tv1->v_type = VAR_BOOL; + tv1->vval.v_number = res ? VVAL_TRUE : VVAL_FALSE; + } + break; + + // Operation with two number arguments + case ISN_OPNR: + case ISN_COMPARENR: + { + typval_T *tv1 = STACK_TV_BOT(-2); + typval_T *tv2 = STACK_TV_BOT(-1); + varnumber_T arg1 = tv1->vval.v_number; + varnumber_T arg2 = tv2->vval.v_number; + varnumber_T res = 0; + int div_zero = FALSE; + + if (iptr->isn_arg.op.op_type == EXPR_LSHIFT + || iptr->isn_arg.op.op_type == EXPR_RSHIFT) + { + if (arg2 < 0) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_bitshift_ops_must_be_positive)); + goto on_error; + } + } + + switch (iptr->isn_arg.op.op_type) + { + case EXPR_MULT: res = arg1 * arg2; break; + case EXPR_DIV: if (arg2 == 0) + div_zero = TRUE; + else + res = arg1 / arg2; + break; + case EXPR_REM: if (arg2 == 0) + div_zero = TRUE; + else + res = arg1 % arg2; + break; + case EXPR_SUB: res = arg1 - arg2; break; + case EXPR_ADD: res = arg1 + arg2; break; + + case EXPR_EQUAL: res = arg1 == arg2; break; + case EXPR_NEQUAL: res = arg1 != arg2; break; + case EXPR_GREATER: res = arg1 > arg2; break; + case EXPR_GEQUAL: res = arg1 >= arg2; break; + case EXPR_SMALLER: res = arg1 < arg2; break; + case EXPR_SEQUAL: res = arg1 <= arg2; break; + case EXPR_LSHIFT: if (arg2 > MAX_LSHIFT_BITS) + res = 0; + else + res = (uvarnumber_T)arg1 << arg2; + break; + case EXPR_RSHIFT: if (arg2 > MAX_LSHIFT_BITS) + res = 0; + else + res = (uvarnumber_T)arg1 >> arg2; + break; + default: break; + } + + --ectx->ec_stack.ga_len; + if (iptr->isn_type == ISN_COMPARENR) + { + tv1->v_type = VAR_BOOL; + tv1->vval.v_number = res ? VVAL_TRUE : VVAL_FALSE; + } + else + tv1->vval.v_number = res; + if (div_zero) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_divide_by_zero)); + goto on_error; + } + } + break; + + // Computation with two float arguments + case ISN_OPFLOAT: + case ISN_COMPAREFLOAT: + { + typval_T *tv1 = STACK_TV_BOT(-2); + typval_T *tv2 = STACK_TV_BOT(-1); + float_T arg1 = tv1->vval.v_float; + float_T arg2 = tv2->vval.v_float; + float_T res = 0; + int cmp = FALSE; + + switch (iptr->isn_arg.op.op_type) + { + case EXPR_MULT: res = arg1 * arg2; break; + case EXPR_DIV: res = arg1 / arg2; break; + case EXPR_SUB: res = arg1 - arg2; break; + case EXPR_ADD: res = arg1 + arg2; break; + + case EXPR_EQUAL: cmp = arg1 == arg2; break; + case EXPR_NEQUAL: cmp = arg1 != arg2; break; + case EXPR_GREATER: cmp = arg1 > arg2; break; + case EXPR_GEQUAL: cmp = arg1 >= arg2; break; + case EXPR_SMALLER: cmp = arg1 < arg2; break; + case EXPR_SEQUAL: cmp = arg1 <= arg2; break; + default: cmp = 0; break; + } + --ectx->ec_stack.ga_len; + if (iptr->isn_type == ISN_COMPAREFLOAT) + { + tv1->v_type = VAR_BOOL; + tv1->vval.v_number = cmp ? VVAL_TRUE : VVAL_FALSE; + } + else + tv1->vval.v_float = res; + } + break; + + case ISN_COMPARELIST: + case ISN_COMPARETUPLE: + case ISN_COMPAREDICT: + case ISN_COMPAREFUNC: + case ISN_COMPARESTRING: + case ISN_COMPAREBLOB: + case ISN_COMPAREOBJECT: + { + typval_T *tv1 = STACK_TV_BOT(-2); + typval_T *tv2 = STACK_TV_BOT(-1); + exprtype_T exprtype = iptr->isn_arg.op.op_type; + int ic = iptr->isn_arg.op.op_ic; + int res = FALSE; + int status = OK; + + SOURCING_LNUM = iptr->isn_lnum; + if (iptr->isn_type == ISN_COMPARELIST) + { + status = typval_compare_list(tv1, tv2, + exprtype, ic, &res); + } + else if (iptr->isn_type == ISN_COMPARETUPLE) + { + status = typval_compare_tuple(tv1, tv2, + exprtype, ic, &res); + } + else if (iptr->isn_type == ISN_COMPAREDICT) + { + status = typval_compare_dict(tv1, tv2, + exprtype, ic, &res); + } + else if (iptr->isn_type == ISN_COMPAREFUNC) + { + status = typval_compare_func(tv1, tv2, + exprtype, ic, &res); + } + else if (iptr->isn_type == ISN_COMPARESTRING) + { + status = typval_compare_string(tv1, tv2, + exprtype, ic, &res); + } + else if (iptr->isn_type == ISN_COMPAREBLOB) + { + status = typval_compare_blob(tv1, tv2, exprtype, &res); + } + else // ISN_COMPAREOBJECT + { + status = typval_compare_object(tv1, tv2, + exprtype, FALSE, &res); + } + --ectx->ec_stack.ga_len; + clear_tv(tv1); + clear_tv(tv2); + tv1->v_type = VAR_BOOL; + tv1->vval.v_number = res ? VVAL_TRUE : VVAL_FALSE; + if (status == FAIL) + goto theend; + } + break; + + case ISN_COMPAREANY: + { + typval_T *tv1 = STACK_TV_BOT(-2); + typval_T *tv2 = STACK_TV_BOT(-1); + exprtype_T exprtype = iptr->isn_arg.op.op_type; + int ic = iptr->isn_arg.op.op_ic; + int status; + + SOURCING_LNUM = iptr->isn_lnum; + status = typval_compare(tv1, tv2, exprtype, ic); + clear_tv(tv2); + --ectx->ec_stack.ga_len; + if (status == FAIL) + goto theend; + } + break; + + case ISN_ADDLIST: + case ISN_ADDTUPLE: + case ISN_ADDBLOB: + { + typval_T *tv1 = STACK_TV_BOT(-2); + typval_T *tv2 = STACK_TV_BOT(-1); + + // add two lists or blobs + if (iptr->isn_type == ISN_ADDLIST) + { + if (iptr->isn_arg.op.op_type == EXPR_APPEND + && tv1->vval.v_list != NULL) + list_extend(tv1->vval.v_list, tv2->vval.v_list, + NULL); + else + eval_addlist(tv1, tv2); + } + else if (iptr->isn_type == ISN_ADDTUPLE) + eval_addtuple(tv1, tv2); + else + eval_addblob(tv1, tv2); + clear_tv(tv2); + --ectx->ec_stack.ga_len; + } + break; + + case ISN_LISTAPPEND: + { + typval_T *tv1 = STACK_TV_BOT(-2); + typval_T *tv2 = STACK_TV_BOT(-1); + list_T *l = tv1->vval.v_list; + + // add an item to a list + SOURCING_LNUM = iptr->isn_lnum; + if (l == NULL) + { + emsg(_(e_cannot_add_to_null_list)); + goto on_error; + } + if (value_check_lock(l->lv_lock, NULL, FALSE)) + goto on_error; + if (list_append_tv(l, tv2) == FAIL) + goto theend; + clear_tv(tv2); + --ectx->ec_stack.ga_len; + } + break; + + case ISN_BLOBAPPEND: + { + typval_T *tv1 = STACK_TV_BOT(-2); + typval_T *tv2 = STACK_TV_BOT(-1); + blob_T *b = tv1->vval.v_blob; + int error = FALSE; + varnumber_T n; + + // add a number to a blob + if (b == NULL) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_cannot_add_to_null_blob)); + goto on_error; + } + n = tv_get_number_chk(tv2, &error); + if (error) + goto on_error; + ga_append(&b->bv_ga, (int)n); + --ectx->ec_stack.ga_len; + } + break; + + // Computation with two arguments of unknown type + case ISN_OPANY: + { + typval_T *tv1 = STACK_TV_BOT(-2); + typval_T *tv2 = STACK_TV_BOT(-1); + varnumber_T n1, n2; + float_T f1 = 0, f2 = 0; + int error = FALSE; + + if (iptr->isn_arg.op.op_type == EXPR_ADD) + { + if (tv1->v_type == VAR_LIST && tv2->v_type == VAR_LIST) + { + eval_addlist(tv1, tv2); + clear_tv(tv2); + --ectx->ec_stack.ga_len; + break; + } + else if (tv1->v_type == VAR_TUPLE + && tv2->v_type == VAR_TUPLE) + { + eval_addtuple(tv1, tv2); + clear_tv(tv2); + --ectx->ec_stack.ga_len; + break; + } + else if (tv1->v_type == VAR_BLOB + && tv2->v_type == VAR_BLOB) + { + eval_addblob(tv1, tv2); + clear_tv(tv2); + --ectx->ec_stack.ga_len; + break; + } + } + if (tv1->v_type == VAR_FLOAT) + { + f1 = tv1->vval.v_float; + n1 = 0; + } + else + { + SOURCING_LNUM = iptr->isn_lnum; + n1 = tv_get_number_chk(tv1, &error); + if (error) + goto on_error; + if (tv2->v_type == VAR_FLOAT) + f1 = n1; + } + if (tv2->v_type == VAR_FLOAT) + { + f2 = tv2->vval.v_float; + n2 = 0; + } + else + { + n2 = tv_get_number_chk(tv2, &error); + if (error) + goto on_error; + if (tv1->v_type == VAR_FLOAT) + f2 = n2; + } + // if there is a float on either side the result is a float + if (tv1->v_type == VAR_FLOAT || tv2->v_type == VAR_FLOAT) + { + switch (iptr->isn_arg.op.op_type) + { + case EXPR_MULT: f1 = f1 * f2; break; + case EXPR_DIV: f1 = f1 / f2; break; + case EXPR_SUB: f1 = f1 - f2; break; + case EXPR_ADD: f1 = f1 + f2; break; + default: SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_cannot_use_percent_with_float)); + goto on_error; + } + clear_tv(tv1); + clear_tv(tv2); + tv1->v_type = VAR_FLOAT; + tv1->vval.v_float = f1; + --ectx->ec_stack.ga_len; + } + else + { + int failed = FALSE; + + switch (iptr->isn_arg.op.op_type) + { + case EXPR_MULT: n1 = n1 * n2; break; + case EXPR_DIV: n1 = num_divide(n1, n2, &failed); + if (failed) + goto on_error; + break; + case EXPR_SUB: n1 = n1 - n2; break; + case EXPR_ADD: n1 = n1 + n2; break; + default: n1 = num_modulus(n1, n2, &failed); + if (failed) + goto on_error; + break; + } + clear_tv(tv1); + clear_tv(tv2); + tv1->v_type = VAR_NUMBER; + tv1->vval.v_number = n1; + --ectx->ec_stack.ga_len; + } + } + break; + + case ISN_STRINDEX: + case ISN_STRSLICE: + { + int is_slice = iptr->isn_type == ISN_STRSLICE; + varnumber_T n1 = 0, n2; + char_u *res; + + // string index: string is at stack-2, index at stack-1 + // string slice: string is at stack-3, first index at + // stack-2, second index at stack-1 + if (is_slice) + { + tv = STACK_TV_BOT(-2); + n1 = tv->vval.v_number; + } + + tv = STACK_TV_BOT(-1); + n2 = tv->vval.v_number; + + ectx->ec_stack.ga_len -= is_slice ? 2 : 1; + tv = STACK_TV_BOT(-1); + if (is_slice) + // Slice: Select the characters from the string + res = string_slice(tv->vval.v_string, n1, n2, FALSE); + else + // Index: The resulting variable is a string of a + // single character (including composing characters). + // If the index is too big or negative the result is + // empty. + res = char_from_string(tv->vval.v_string, n2); + mnv_free(tv->vval.v_string); + tv->vval.v_string = res; + } + break; + + case ISN_LISTINDEX: + case ISN_LISTSLICE: + case ISN_TUPLEINDEX: + case ISN_TUPLESLICE: + case ISN_BLOBINDEX: + case ISN_BLOBSLICE: + { + int is_slice = iptr->isn_type == ISN_LISTSLICE + || iptr->isn_type == ISN_TUPLESLICE + || iptr->isn_type == ISN_BLOBSLICE; + int is_blob = iptr->isn_type == ISN_BLOBINDEX + || iptr->isn_type == ISN_BLOBSLICE; + int is_tuple = iptr->isn_type == ISN_TUPLEINDEX + || iptr->isn_type == ISN_TUPLESLICE; + varnumber_T n1, n2; + typval_T *val_tv; + + // list index: list is at stack-2, index at stack-1 + // list slice: list is at stack-3, indexes at stack-2 and + // stack-1 + // Same for tuple and blob. + val_tv = is_slice ? STACK_TV_BOT(-3) : STACK_TV_BOT(-2); + + tv = STACK_TV_BOT(-1); + n1 = n2 = tv->vval.v_number; + clear_tv(tv); + + if (is_slice) + { + tv = STACK_TV_BOT(-2); + n1 = tv->vval.v_number; + clear_tv(tv); + } + + ectx->ec_stack.ga_len -= is_slice ? 2 : 1; + tv = STACK_TV_BOT(-1); + SOURCING_LNUM = iptr->isn_lnum; + if (is_blob) + { + if (blob_slice_or_index(val_tv->vval.v_blob, is_slice, + n1, n2, FALSE, tv) == FAIL) + goto on_error; + } + else if (is_tuple) + { + if (tuple_slice_or_index(val_tv->vval.v_tuple, + is_slice, n1, n2, FALSE, tv, TRUE) == FAIL) + goto on_error; + } + else + { + if (list_slice_or_index(val_tv->vval.v_list, is_slice, + n1, n2, FALSE, tv, TRUE) == FAIL) + goto on_error; + } + } + break; + + case ISN_ANYINDEX: + case ISN_ANYSLICE: + { + int is_slice = iptr->isn_type == ISN_ANYSLICE; + typval_T *var1, *var2; + int res; + + // index: composite is at stack-2, index at stack-1 + // slice: composite is at stack-3, indexes at stack-2 and + // stack-1 + tv = is_slice ? STACK_TV_BOT(-3) : STACK_TV_BOT(-2); + SOURCING_LNUM = iptr->isn_lnum; + if (check_can_index(tv, TRUE, TRUE) == FAIL) + goto on_error; + var1 = is_slice ? STACK_TV_BOT(-2) : STACK_TV_BOT(-1); + var2 = is_slice ? STACK_TV_BOT(-1) : NULL; + res = eval_index_inner(tv, is_slice, var1, var2, + FALSE, NULL, -1, TRUE); + clear_tv(var1); + if (is_slice) + clear_tv(var2); + ectx->ec_stack.ga_len -= is_slice ? 2 : 1; + if (res == FAIL) + goto on_error; + } + break; + + case ISN_SLICE: + { + int count = iptr->isn_arg.number; + + // type will have been checked to be a list + tv = STACK_TV_BOT(-1); + if (tv->v_type == VAR_LIST) + { + list_T *list = tv->vval.v_list; + + // no error for short list, expect it to be checked + // earlier + if (list != NULL && list->lv_len >= count) + { + list_T *newlist = list_slice(list, + count, list->lv_len - 1); + + if (newlist != NULL) + { + list_unref(list); + tv->vval.v_list = newlist; + ++newlist->lv_refcount; + } + } + } + else + { + tuple_T *tuple = tv->vval.v_tuple; + + // no error for short tuple, expect it to be checked + // earlier + if (tuple != NULL && TUPLE_LEN(tuple) >= count) + { + tuple_T *newtuple; + + newtuple = tuple_slice(tuple, count, + TUPLE_LEN(tuple) - 1); + if (newtuple != NULL) + { + tuple_unref(tuple); + tv->v_type = VAR_TUPLE; + tv->vval.v_tuple = newtuple; + ++newtuple->tv_refcount; + } + } + } + } + break; + + case ISN_GETITEM: + { + listitem_T *li; + typval_T *item_tv; + getitem_T *gi = &iptr->isn_arg.getitem; + + // Get list item: list is at stack-1, push item. + // List type and length is checked for when compiling. + tv = STACK_TV_BOT(-1 - gi->gi_with_op); + if (tv->v_type == VAR_LIST) + { + li = list_find(tv->vval.v_list, gi->gi_index); + item_tv = &li->li_tv; + } + else + item_tv = TUPLE_ITEM(tv->vval.v_tuple, gi->gi_index); + + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + ++ectx->ec_stack.ga_len; + copy_tv(item_tv, STACK_TV_BOT(-1)); + + // Useful when used in unpack assignment. Reset at + // ISN_DROP. + ectx->ec_where.wt_index = gi->gi_index + 1; + ectx->ec_where.wt_kind = WT_VARIABLE; + } + break; + + // dict member with string key (dict['member']) + case ISN_MEMBER: + { + dict_T *dict; + char_u *key; + dictitem_T *di; + + // dict member: dict is at stack-2, key at stack-1 + tv = STACK_TV_BOT(-2); + // no need to check for VAR_DICT, CHECKTYPE will check. + dict = tv->vval.v_dict; + + tv = STACK_TV_BOT(-1); + // no need to check for VAR_STRING, 2STRING will check. + key = tv->vval.v_string; + if (key == NULL) + key = (char_u *)""; + + if ((di = dict_find(dict, key, -1)) == NULL) + { + SOURCING_LNUM = iptr->isn_lnum; + semsg(_(e_key_not_present_in_dictionary_str), key); + + // If :silent! is used we will continue, make sure the + // stack contents makes sense and the dict stack is + // updated. + clear_tv(tv); + --ectx->ec_stack.ga_len; + tv = STACK_TV_BOT(-1); + (void) dict_stack_save(tv); + tv->v_type = VAR_NUMBER; + tv->vval.v_number = 0; + goto on_fatal_error; + } + clear_tv(tv); + --ectx->ec_stack.ga_len; + // Put the dict used on the dict stack, it might be used by + // a dict function later. + tv = STACK_TV_BOT(-1); + if (dict_stack_save(tv) == FAIL) + goto on_fatal_error; + copy_tv(&di->di_tv, tv); + } + break; + + // dict member with string key (dict.member) + // or can be an object + case ISN_STRINGMEMBER: + { + dict_T *dict; + dictitem_T *di; + + tv = STACK_TV_BOT(-1); + + if (tv->v_type == VAR_OBJECT + || tv->v_type == VAR_CLASS) + { + if (dict_stack_save(tv) == FAIL) + goto on_fatal_error; + + ufunc_T *ufunc = (((dfunc_T *)def_functions.ga_data) + + ectx->ec_dfunc_idx)->df_ufunc; + // Class or an object (not a Dict) + if (var_any_get_oc_member(ufunc->uf_class, iptr, tv) == FAIL) + goto on_error; + } + else + { + if (tv->v_type != VAR_DICT || tv->vval.v_dict == NULL) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_dictionary_required)); + goto on_error; + } + dict = tv->vval.v_dict; + + if ((di = dict_find(dict, iptr->isn_arg.string, -1)) + == NULL) + { + SOURCING_LNUM = iptr->isn_lnum; + semsg(_(e_key_not_present_in_dictionary_str), + iptr->isn_arg.string); + goto on_error; + } + // Put the dict used on the dict stack, it might be + // used by a dict function later. + if (dict_stack_save(tv) == FAIL) + goto on_fatal_error; + + copy_tv(&di->di_tv, tv); + } + } + break; + + case ISN_GET_OBJ_MEMBER: + case ISN_GET_ITF_MEMBER: + { + tv = STACK_TV_BOT(-1); + if (tv->v_type != VAR_OBJECT) + { + SOURCING_LNUM = iptr->isn_lnum; + object_required_error(tv); + goto on_error; + } + + object_T *obj = tv->vval.v_object; + if (obj == NULL) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_using_null_object)); + goto on_error; + } + + int idx; + if (iptr->isn_type == ISN_GET_OBJ_MEMBER) + idx = iptr->isn_arg.classmember.cm_idx; + else + { + idx = iptr->isn_arg.classmember.cm_idx; + // convert the interface index to the object index + idx = object_index_from_itf_index( + iptr->isn_arg.classmember.cm_class, + FALSE, idx, obj->obj_class); + } + + // The members are located right after the object struct. + typval_T *mtv = ((typval_T *)(obj + 1)) + idx; + if (mtv->v_type == VAR_UNKNOWN) + { + // Referencing an object variable (without a type) + // which is not yet initialized. So the type is not + // yet known. + ocmember_T *m = &obj->obj_class->class_obj_members[idx]; + SOURCING_LNUM = iptr->isn_lnum; + semsg(_(e_uninitialized_object_var_reference), + m->ocm_name.string); + goto on_error; + } + copy_tv(mtv, tv); + + // Unreference the object after getting the member, it may + // be freed. + object_unref(obj); + } + break; + + case ISN_STORE_THIS: + { + int idx = iptr->isn_arg.number; + object_T *obj = STACK_TV_VAR(0)->vval.v_object; + // the members are located right after the object struct + typval_T *mtv = ((typval_T *)(obj + 1)) + idx; + clear_tv(mtv); + *mtv = *STACK_TV_BOT(-1); + --ectx->ec_stack.ga_len; + } + break; + + case ISN_CLEARDICT: + dict_stack_drop(); + break; + + case ISN_USEDICT: + { + typval_T *dict_tv = dict_stack_get_tv(); + + // Turn "dict.Func" into a partial for "Func" bound to + // "dict". Don't do this when "Func" is already a partial + // that was bound explicitly (pt_auto is FALSE). + tv = STACK_TV_BOT(-1); + if (dict_tv != NULL + && dict_tv->v_type == VAR_DICT + && dict_tv->vval.v_dict != NULL + && (tv->v_type == VAR_FUNC + || (tv->v_type == VAR_PARTIAL + && (tv->vval.v_partial->pt_auto + || tv->vval.v_partial->pt_dict == NULL)))) + dict_tv->vval.v_dict = + make_partial(dict_tv->vval.v_dict, tv); + dict_stack_drop(); + } + break; + + case ISN_NEGATENR: + tv = STACK_TV_BOT(-1); + // CHECKTYPE should have checked the variable type + if (tv->v_type == VAR_FLOAT) + tv->vval.v_float = -tv->vval.v_float; + else + tv->vval.v_number = -tv->vval.v_number; + break; + + case ISN_CHECKTYPE: + { + checktype_T *ct = &iptr->isn_arg.type; + int r; + where_T where = WHERE_INIT; + + tv = STACK_TV_BOT((int)ct->ct_off); + SOURCING_LNUM = iptr->isn_lnum; + if (ct->ct_arg_idx > 0) + { + where.wt_index = ct->ct_arg_idx; + where.wt_kind = ct->ct_is_var ? WT_VARIABLE : WT_ARGUMENT; + } + where.wt_func_name = ectx->ec_where.wt_func_name; + r = check_typval_type(ct->ct_type, tv, where); + if (r == FAIL) + goto on_error; + + // number 0 is FALSE, number 1 is TRUE + if (tv->v_type == VAR_NUMBER + && ct->ct_type->tt_type == VAR_BOOL + && (tv->vval.v_number == 0 + || tv->vval.v_number == 1)) + { + tv->v_type = VAR_BOOL; + tv->vval.v_number = tv->vval.v_number + ? VVAL_TRUE : VVAL_FALSE; + } + } + break; + + case ISN_CHECKLEN: + { + int min_len = iptr->isn_arg.checklen.cl_min_len; + list_T *list = NULL; + tuple_T *tuple = NULL; + int len = 0; + + tv = STACK_TV_BOT(-1); + + int len_check_failed = FALSE; + if (tv->v_type == VAR_LIST) + { + list = tv->vval.v_list; + if (list == NULL || list->lv_len < min_len + || (list->lv_len > min_len + && !iptr->isn_arg.checklen.cl_more_OK)) + len_check_failed = TRUE; + if (list != NULL) + len = list->lv_len; + } + else if (tv->v_type == VAR_TUPLE) + { + tuple = tv->vval.v_tuple; + if (tuple == NULL || TUPLE_LEN(tuple) < min_len + || (TUPLE_LEN(tuple) > min_len + && !iptr->isn_arg.checklen.cl_more_OK)) + len_check_failed = TRUE; + if (tuple != NULL) + len = TUPLE_LEN(tuple); + } + else + len_check_failed = TRUE; + + if (len_check_failed) + { + SOURCING_LNUM = iptr->isn_lnum; + semsg(_(e_expected_nr_items_but_got_nr), + min_len, len); + goto on_error; + } + } + break; + + case ISN_SETTYPE: + set_tv_type(STACK_TV_BOT(-1), iptr->isn_arg.type.ct_type); + break; + + case ISN_2BOOL: + case ISN_COND2BOOL: + { + int n; + int error = FALSE; + + if (iptr->isn_type == ISN_2BOOL) + { + tv = STACK_TV_BOT(iptr->isn_arg.tobool.offset); + n = tv2bool(tv); + if (iptr->isn_arg.tobool.invert) + n = !n; + } + else + { + tv = STACK_TV_BOT(-1); + SOURCING_LNUM = iptr->isn_lnum; + n = tv_get_bool_chk(tv, &error); + if (error) + goto on_error; + } + clear_tv(tv); + tv->v_type = VAR_BOOL; + tv->vval.v_number = n ? VVAL_TRUE : VVAL_FALSE; + } + break; + + case ISN_2STRING: + case ISN_2STRING_ANY: + SOURCING_LNUM = iptr->isn_lnum; + if (do_2string(STACK_TV_BOT(iptr->isn_arg.tostring.offset), + iptr->isn_type == ISN_2STRING_ANY, + iptr->isn_arg.tostring.flags) == FAIL) + goto on_error; + break; + + case ISN_RANGE: + { + exarg_T ea; + char *errormsg; + + ea.line2 = 0; + ea.addr_count = 0; + ea.addr_type = ADDR_LINES; + ea.cmd = iptr->isn_arg.string; + ea.skip = FALSE; + if (parse_cmd_address(&ea, &errormsg, FALSE) == FAIL) + goto on_error; + + if (GA_GROW_FAILS(&ectx->ec_stack, 1)) + goto theend; + ++ectx->ec_stack.ga_len; + tv = STACK_TV_BOT(-1); + tv->v_type = VAR_NUMBER; + tv->v_lock = 0; + tv->vval.v_number = ea.line2; + } + break; + + case ISN_PUT: + tv = NULL; // initialize it so we don't get a warning + isn_put_do(ectx, iptr, tv, FALSE); + break; + case ISN_IPUT: + tv = NULL; + isn_put_do(ectx, iptr, tv, TRUE); + break; + + case ISN_CMDMOD: + ectx->ec_funclocal.floc_save_cmdmod = cmdmod; + ectx->ec_funclocal.floc_restore_cmdmod = TRUE; + ectx->ec_funclocal.floc_restore_cmdmod_stacklen = + ectx->ec_stack.ga_len; + cmdmod = *iptr->isn_arg.cmdmod.cf_cmdmod; + apply_cmdmod(&cmdmod); + break; + + case ISN_CMDMOD_REV: + // filter regprog is owned by the instruction, don't free it + cmdmod.cmod_filter_regmatch.regprog = NULL; + undo_cmdmod(&cmdmod); + cmdmod = ectx->ec_funclocal.floc_save_cmdmod; + ectx->ec_funclocal.floc_restore_cmdmod = FALSE; + break; + + case ISN_UNPACK: + // Check there is a valid list to unpack. + tv = STACK_TV_BOT(-1); + if (tv->v_type != VAR_LIST && tv->v_type != VAR_TUPLE) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_for_argument_must_be_sequence_of_lists_or_tuples)); + goto on_error; + } + + int rc; + if (tv->v_type == VAR_LIST) + rc = exec_unpack_list(ectx, iptr, tv); + else + rc = exec_unpack_tuple(ectx, iptr, tv); + if (rc != EXEC_OK) + { + if (rc == EXEC_FAIL) + goto on_error; + goto theend; + } + break; + + case ISN_PROF_START: + case ISN_PROF_END: + { +#ifdef FEAT_PROFILE + funccall_T cookie; + ufunc_T *cur_ufunc = + (((dfunc_T *)def_functions.ga_data) + + ectx->ec_dfunc_idx)->df_ufunc; + + cookie.fc_func = cur_ufunc; + if (iptr->isn_type == ISN_PROF_START) + { + func_line_start(&cookie, iptr->isn_lnum); + // if we get here the instruction is executed + func_line_exec(&cookie); + } + else + func_line_end(&cookie); +#endif + } + break; + + case ISN_DEBUG: + handle_debug(iptr, ectx); + break; + + case ISN_SHUFFLE: + { + typval_T tmp_tv; + int item = iptr->isn_arg.shuffle.shfl_item; + int up = iptr->isn_arg.shuffle.shfl_up; + + tmp_tv = *STACK_TV_BOT(-item); + for ( ; up > 0 && item > 1; --up) + { + *STACK_TV_BOT(-item) = *STACK_TV_BOT(-item + 1); + --item; + } + *STACK_TV_BOT(-item) = tmp_tv; + } + break; + + case ISN_DROP: + --ectx->ec_stack.ga_len; + clear_tv(STACK_TV_BOT(0)); + ectx->ec_where = (where_T)WHERE_INIT; + break; + + case ISN_SCRIPTCTX_SET: + // change the script context. Used to evaluate an object + // member variable initialization expression in the context of + // the script where the class is defined. + current_sctx = iptr->isn_arg.setsctx; + break; + } + continue; + +func_return: + // Restore previous function. If the frame pointer is where we started + // then there is none and we are done. + if (ectx->ec_frame_idx == ectx->ec_initial_frame_idx) + goto done; + + if (func_return(ectx) == FAIL) + // only fails when out of memory + goto theend; + continue; + +on_error: + // Jump here for an error that does not require aborting execution. + // If "emsg_silent" is set then ignore the error, unless it was set + // when calling the function. + if (did_emsg_cumul + did_emsg == ectx->ec_did_emsg_before + && emsg_silent && did_emsg_def == 0) + { + // If a sequence of instructions causes an error while ":silent!" + // was used, restore the stack length and jump ahead to restoring + // the cmdmod. + if (ectx->ec_funclocal.floc_restore_cmdmod) + { + while (ectx->ec_stack.ga_len + > ectx->ec_funclocal.floc_restore_cmdmod_stacklen) + { + --ectx->ec_stack.ga_len; + clear_tv(STACK_TV_BOT(0)); + } + while (ectx->ec_instr[ectx->ec_iidx].isn_type != ISN_CMDMOD_REV) + ++ectx->ec_iidx; + } + continue; + } +on_fatal_error: + // Jump here for an error that messes up the stack. + // If we are not inside a try-catch started here, abort execution. + if (trylevel <= ectx->ec_trylevel_at_start) + goto theend; + } + +done: + ret = OK; +theend: + may_invoke_defer_funcs(ectx); + + dict_stack_clear(dict_stack_len_at_start); + ectx->ec_trylevel_at_start = save_trylevel_at_start; + return ret; +} + +/* + * Execute the instructions from a VAR_INSTR typval and put the result in + * "rettv". + * Return OK or FAIL. + */ + int +exe_typval_instr(typval_T *tv, typval_T *rettv) +{ + ectx_T *ectx = tv->vval.v_instr->instr_ectx; + isn_T *save_instr = ectx->ec_instr; + int save_iidx = ectx->ec_iidx; + int res; + + // Initialize rettv so that it is safe for caller to invoke clear_tv(rettv) + // even when the compilation fails. + rettv->v_type = VAR_UNKNOWN; + + ectx->ec_instr = tv->vval.v_instr->instr_instr; + res = exec_instructions(ectx); + if (res == OK) + { + *rettv = *STACK_TV_BOT(-1); + --ectx->ec_stack.ga_len; + } + + ectx->ec_instr = save_instr; + ectx->ec_iidx = save_iidx; + + return res; +} + +/* + * Execute the instructions from an ISN_SUBSTITUTE command, which are in + * "substitute_instr". + */ + char_u * +exe_substitute_instr(void) +{ + ectx_T *ectx = substitute_instr->subs_ectx; + isn_T *save_instr = ectx->ec_instr; + int save_iidx = ectx->ec_iidx; + char_u *res; + + ectx->ec_instr = substitute_instr->subs_instr; + if (exec_instructions(ectx) == OK) + { + typval_T *tv = STACK_TV_BOT(-1); + + res = typval2string(tv, TRUE); + --ectx->ec_stack.ga_len; + clear_tv(tv); + } + else + { + substitute_instr->subs_status = FAIL; + res = mnv_strsave((char_u *)""); + } + + ectx->ec_instr = save_instr; + ectx->ec_iidx = save_iidx; + + return res; +} + +/* + * Call a "def" function from old MNV script. + * Return OK or FAIL. + */ + int +call_def_function( + ufunc_T *ufunc, + int argc_arg, // nr of arguments + typval_T *argv, // arguments + int flags, // DEF_ flags + partial_T *partial, // optional partial for context + object_T *object, // object, e.g. for this.Func() + funccall_T *funccal, + typval_T *rettv) // return value +{ + ectx_T ectx; // execution context + int argc = argc_arg; + int partial_argc = partial == NULL + || (flags & DEF_USE_PT_ARGV) == 0 + ? 0 : partial->pt_argc; + int total_argc = argc + partial_argc; + typval_T *tv; + int idx; + int ret = FAIL; + int defcount = ufunc->uf_args.ga_len - total_argc; + sctx_T save_current_sctx = current_sctx; + int did_emsg_before = did_emsg_cumul + did_emsg; + int save_suppress_errthrow = suppress_errthrow; + msglist_T **saved_msg_list = NULL; + msglist_T *private_msg_list = NULL; + int save_emsg_silent_def = emsg_silent_def; + int save_did_emsg_def = did_emsg_def; + int orig_funcdepth; + int orig_nesting_level = ex_nesting_level; + +// Get pointer to item in the stack. +#undef STACK_TV +#define STACK_TV(idx) (((typval_T *)ectx.ec_stack.ga_data) + idx) + +// Get pointer to item at the bottom of the stack, -1 is the bottom. +#undef STACK_TV_BOT +#define STACK_TV_BOT(idx) (((typval_T *)ectx.ec_stack.ga_data) + ectx.ec_stack.ga_len + idx) + +// Get pointer to a local variable on the stack. Negative for arguments. +#undef STACK_TV_VAR +#define STACK_TV_VAR(idx) (((typval_T *)ectx.ec_stack.ga_data) + ectx.ec_frame_idx + STACK_FRAME_SIZE + idx) + + if (ufunc->uf_def_status == UF_NOT_COMPILED + || ufunc->uf_def_status == UF_COMPILE_ERROR + || (func_needs_compiling(ufunc, get_compile_type(ufunc)) + && compile_def_function(ufunc, FALSE, + get_compile_type(ufunc), NULL) == FAIL)) + { + if (did_emsg_cumul + did_emsg == did_emsg_before) + semsg(_(e_function_is_not_compiled_str), + printable_func_name(ufunc)); + return FAIL; + } + + { + // Check the function was really compiled. + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + ufunc->uf_dfunc_idx; + if (dfunc->df_ufunc == NULL) + { + semsg(_(e_function_was_deleted_str), printable_func_name(ufunc)); + return FAIL; + } + if (INSTRUCTIONS(dfunc) == NULL) + { + iemsg("using call_def_function() on not compiled function"); + return FAIL; + } + } + + // If depth of calling is getting too high, don't execute the function. + orig_funcdepth = funcdepth_get(); + if (funcdepth_increment() == FAIL) + return FAIL; + + CLEAR_FIELD(ectx); + ectx.ec_dfunc_idx = ufunc->uf_dfunc_idx; + ga_init2(&ectx.ec_stack, sizeof(typval_T), 500); + if (GA_GROW_FAILS(&ectx.ec_stack, 20)) + { + funcdepth_decrement(); + return FAIL; + } + ga_init2(&ectx.ec_trystack, sizeof(trycmd_T), 10); + ga_init2(&ectx.ec_funcrefs, sizeof(partial_T *), 10); + ectx.ec_did_emsg_before = did_emsg_before; + ++ex_nesting_level; + + idx = total_argc - ufunc->uf_args.ga_len; + if (idx > 0 && ufunc->uf_va_name == NULL) + { + semsg(NGETTEXT(e_one_argument_too_many, e_nr_arguments_too_many, + idx), idx); + goto failed_early; + } + idx = total_argc - ufunc->uf_args.ga_len + ufunc->uf_def_args.ga_len; + if (idx < 0) + { + semsg(NGETTEXT(e_one_argument_too_few, e_nr_arguments_too_few, + -idx), -idx); + goto failed_early; + } + + // Put values from the partial and arguments on the stack, but no more than + // what the function expects. A lambda can be called with more arguments + // than it uses. + for (idx = 0; idx < total_argc + && (ufunc->uf_va_name != NULL || idx < ufunc->uf_args.ga_len); + ++idx) + { + int argv_idx = idx - partial_argc; + + tv = idx < partial_argc ? partial->pt_argv + idx : argv + argv_idx; + if (idx >= ufunc->uf_args.ga_len - ufunc->uf_def_args.ga_len + && tv->v_type == VAR_SPECIAL + && tv->vval.v_number == VVAL_NONE) + { + // Use the default value. + STACK_TV_BOT(0)->v_type = VAR_UNKNOWN; + } + else + { + int done = FALSE; + if (ufunc->uf_arg_types != NULL && idx < ufunc->uf_args.ga_len) + { + type_T *expected = ufunc->uf_arg_types[idx]; + if (expected->tt_type == VAR_FLOAT && tv->v_type == VAR_NUMBER) + { + // When a float is expected and a number was given, convert + // the value. + STACK_TV_BOT(0)->v_type = VAR_FLOAT; + STACK_TV_BOT(0)->v_lock = 0; + STACK_TV_BOT(0)->vval.v_float = tv->vval.v_number; + done = TRUE; + } + else if (check_typval_arg_type(expected, tv, + NULL, argv_idx + 1) == FAIL) + goto failed_early; + } + if (!done) + copy_tv(tv, STACK_TV_BOT(0)); + } + ++ectx.ec_stack.ga_len; + } + + // Turn varargs into a list. Empty list if no args. + if (ufunc->uf_va_name != NULL) + { + int vararg_count = argc - ufunc->uf_args.ga_len; + + if (vararg_count < 0) + vararg_count = 0; + else + argc -= vararg_count; + if (exe_newlist(vararg_count, &ectx) == FAIL) + goto failed_early; + + // Check the type of the list items. + tv = STACK_TV_BOT(-1); + if (ufunc->uf_va_type != NULL + && ufunc->uf_va_type != &t_list_any + && ufunc->uf_va_type->tt_member != &t_any + && tv->vval.v_list != NULL) + { + type_T *expected = ufunc->uf_va_type->tt_member; + listitem_T *li = tv->vval.v_list->lv_first; + + for (idx = 0; idx < vararg_count; ++idx) + { + if (check_typval_arg_type(expected, &li->li_tv, + NULL, argc + idx + 1) == FAIL) + goto failed_early; + li = li->li_next; + } + } + + if (defcount > 0) + // Move varargs list to below missing default arguments. + *STACK_TV_BOT(defcount - 1) = *STACK_TV_BOT(-1); + --ectx.ec_stack.ga_len; + } + + // Make space for omitted arguments, will store default value below. + // Any varargs list goes after them. + if (defcount > 0) + for (idx = 0; idx < defcount; ++idx) + { + STACK_TV_BOT(0)->v_type = VAR_UNKNOWN; + ++ectx.ec_stack.ga_len; + } + if (ufunc->uf_va_name != NULL) + ++ectx.ec_stack.ga_len; + + // Frame pointer points to just after arguments. + ectx.ec_frame_idx = ectx.ec_stack.ga_len; + ectx.ec_initial_frame_idx = ectx.ec_frame_idx; + + { + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + ufunc->uf_dfunc_idx; + ufunc_T *base_ufunc = dfunc->df_ufunc; + + // "uf_partial" is on the ufunc that "df_ufunc" points to, as is done + // by copy_lambda_to_global_func(). + if (partial != NULL || base_ufunc->uf_partial != NULL) + { + ectx.ec_outer_ref = ALLOC_CLEAR_ONE(outer_ref_T); + if (ectx.ec_outer_ref == NULL) + goto failed_early; + if (partial != NULL) + { + outer_T *outer = get_pt_outer(partial); + + if (outer->out_stack == NULL && outer->out_loop_size == 0) + { + // no stack was set + if (current_ectx != NULL) + { + if (current_ectx->ec_outer_ref != NULL + && current_ectx->ec_outer_ref->or_outer != NULL) + ectx.ec_outer_ref->or_outer = + current_ectx->ec_outer_ref->or_outer; + } + // else: should there be an error here? + } + else + { + ectx.ec_outer_ref->or_outer = outer; + ++partial->pt_refcount; + ectx.ec_outer_ref->or_partial = partial; + } + } + else + { + ectx.ec_outer_ref->or_outer = &base_ufunc->uf_partial->pt_outer; + ++base_ufunc->uf_partial->pt_refcount; + ectx.ec_outer_ref->or_partial = base_ufunc->uf_partial; + } + } + } + + // dummy frame entries + for (idx = 0; idx < STACK_FRAME_SIZE; ++idx) + { + STACK_TV(ectx.ec_stack.ga_len)->v_type = VAR_UNKNOWN; + ++ectx.ec_stack.ga_len; + } + + { + // Reserve space for local variables and any closure reference count. + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + ufunc->uf_dfunc_idx; + + // Initialize variables to zero. That avoids having to generate + // initializing instructions for "var nr: number", "var x: any", etc. + for (idx = 0; idx < dfunc->df_varcount; ++idx) + { + STACK_TV_VAR(idx)->v_type = VAR_NUMBER; + STACK_TV_VAR(idx)->vval.v_number = 0; + } + ectx.ec_stack.ga_len += dfunc->df_varcount; + + if (object != NULL) + { + // the object is always the variable at index zero + tv = STACK_TV_VAR(0); + tv->v_type = VAR_OBJECT; + tv->vval.v_object = object; + } + + if (dfunc->df_has_closure) + { + // Initialize the variable that counts how many closures were + // created. This is used in handle_closure_in_use(). + STACK_TV_VAR(idx)->v_type = VAR_NUMBER; + STACK_TV_VAR(idx)->vval.v_number = 0; + ++ectx.ec_stack.ga_len; + } + + ectx.ec_instr = INSTRUCTIONS(dfunc); + } + + // Store the execution context in funccal, used by invoke_all_defer(). + if (funccal != NULL) + funccal->fc_ectx = &ectx; + + // Following errors are in the function, not the caller. + // Commands behave like mnv9script. + estack_push_ufunc(ufunc, 1); + current_sctx = ufunc->uf_script_ctx; + current_sctx.sc_version = SCRIPT_VERSION_MNV9; + + // Use a specific location for storing error messages to be converted to an + // exception. + saved_msg_list = msg_list; + msg_list = &private_msg_list; + + // Do turn errors into exceptions. + suppress_errthrow = FALSE; + + // Do not delete the function while executing it. + ++ufunc->uf_calls; + + // When ":silent!" was used before calling then we still abort the + // function. If ":silent!" is used in the function then we don't. + emsg_silent_def = emsg_silent; + did_emsg_def = 0; + + ectx.ec_where = (where_T)WHERE_INIT; + + /* + * Execute the instructions until done. + */ + ret = exec_instructions(&ectx); + if (ret == OK) + { + // function finished, get result from the stack. + if (ufunc->uf_ret_type == &t_void) + { + rettv->v_type = VAR_VOID; + } + else + { + tv = STACK_TV_BOT(-1); + *rettv = *tv; + tv->v_type = VAR_UNKNOWN; + } + } + + // When failed need to unwind the call stack. + unwind_def_callstack(&ectx); + + // Deal with any remaining closures, they may be in use somewhere. + if (ectx.ec_funcrefs.ga_len > 0) + { + handle_closure_in_use(&ectx, FALSE); + ga_clear(&ectx.ec_funcrefs); + } + + estack_pop(); + current_sctx = save_current_sctx; + + if (--ufunc->uf_calls <= 0 && ufunc->uf_refcount <= 0) + // Function was unreferenced while being used, free it now. + func_clear_free(ufunc, FALSE); + + if (*msg_list != NULL && saved_msg_list != NULL) + { + msglist_T **plist = saved_msg_list; + + // Append entries from the current msg_list (uncaught exceptions) to + // the saved msg_list. + while (*plist != NULL) + plist = &(*plist)->next; + + *plist = *msg_list; + } + msg_list = saved_msg_list; + + if (ectx.ec_funclocal.floc_restore_cmdmod) + { + cmdmod.cmod_filter_regmatch.regprog = NULL; + undo_cmdmod(&cmdmod); + cmdmod = ectx.ec_funclocal.floc_save_cmdmod; + } + emsg_silent_def = save_emsg_silent_def; + did_emsg_def += save_did_emsg_def; + +failed_early: + // Free all arguments and local variables. + for (idx = 0; idx < ectx.ec_stack.ga_len; ++idx) + { + tv = STACK_TV(idx); + if (tv->v_type != VAR_NUMBER && tv->v_type != VAR_UNKNOWN) + clear_tv(tv); + } + ex_nesting_level = orig_nesting_level; + + mnv_free(ectx.ec_stack.ga_data); + mnv_free(ectx.ec_trystack.ga_data); + if (ectx.ec_outer_ref != NULL) + { + if (ectx.ec_outer_ref->or_outer_allocated) + mnv_free(ectx.ec_outer_ref->or_outer); + partial_unref(ectx.ec_outer_ref->or_partial); + mnv_free(ectx.ec_outer_ref); + } + + // Not sure if this is necessary. + suppress_errthrow = save_suppress_errthrow; + + if (ret != OK && did_emsg_cumul + did_emsg == did_emsg_before + && !need_rethrow) + semsg(_(e_unknown_error_while_executing_str), + printable_func_name(ufunc)); + funcdepth_restore(orig_funcdepth); + return ret; +} + +/* + * Called when a def function has finished (possibly failed). + * Invoke all the function returns to clean up and invoke deferred functions, + * except the toplevel one. + */ + void +unwind_def_callstack(ectx_T *ectx) +{ + while (ectx->ec_frame_idx != ectx->ec_initial_frame_idx) + func_return(ectx); +} + +/* + * Invoke any deferred functions for the top function in "ectx". + */ + void +may_invoke_defer_funcs(ectx_T *ectx) +{ + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + ectx->ec_dfunc_idx; + + if (dfunc->df_defer_var_idx > 0) + invoke_defer_funcs(ectx); +} + +/* + * Return loopvarinfo in a printable form in allocated memory. + */ + static char_u * +printable_loopvarinfo(loopvarinfo_T *lvi) +{ + garray_T ga; + int depth; + + ga_init2(&ga, 1, 100); + for (depth = 0; depth < lvi->lvi_depth; ++depth) + { + if (ga_grow(&ga, 50) == FAIL) + break; + if (lvi->lvi_loop[depth].var_idx == 0) + STRCPY((char *)ga.ga_data + ga.ga_len, " -"); + else + mnv_snprintf((char *)ga.ga_data + ga.ga_len, 50, " $%d-$%d", + lvi->lvi_loop[depth].var_idx, + lvi->lvi_loop[depth].var_idx + + lvi->lvi_loop[depth].var_count - 1); + ga.ga_len = (int)STRLEN(ga.ga_data); + } + return ga.ga_data; +} + +/* + * List instructions "instr" up to "instr_count" or until ISN_FINISH. + * "ufunc" has the source lines, NULL for the instructions of ISN_SUBSTITUTE. + * "pfx" is prefixed to every line. + */ + static void +list_instructions(char *pfx, isn_T *instr, int instr_count, ufunc_T *ufunc) +{ + int line_idx = 0; + int prev_current = 0; + int current; + int def_arg_idx = 0; + sctx_T script_ctx = current_sctx; + + for (current = 0; current < instr_count; ++current) + { + isn_T *iptr = &instr[current]; + char *line; + + if (ufunc != NULL) + { + while (line_idx < iptr->isn_lnum + && line_idx < ufunc->uf_lines.ga_len) + { + if (current > prev_current) + { + msg_puts("\n\n"); + prev_current = current; + } + line = ((char **)ufunc->uf_lines.ga_data)[line_idx++]; + if (line != NULL) + msg(line); + } + if (iptr->isn_type == ISN_JUMP_IF_ARG_SET) + { + int first_def_arg = ufunc->uf_args.ga_len + - ufunc->uf_def_args.ga_len; + + if (def_arg_idx > 0) + msg_puts("\n\n"); + msg_start(); + msg_puts(" "); + msg_puts(((char **)(ufunc->uf_args.ga_data))[ + first_def_arg + def_arg_idx]); + msg_puts(" = "); + msg_puts(((char **)(ufunc->uf_def_args.ga_data))[def_arg_idx++]); + msg_clr_eos(); + msg_end(); + } + } + + switch (iptr->isn_type) + { + case ISN_CONSTRUCT: + smsg("%s%4d NEW %s size %d", pfx, current, + iptr->isn_arg.construct.construct_class->class_name.string, + (int)iptr->isn_arg.construct.construct_size); + break; + case ISN_EXEC: + smsg("%s%4d EXEC %s", pfx, current, iptr->isn_arg.string); + break; + case ISN_EXEC_SPLIT: + smsg("%s%4d EXEC_SPLIT %s", pfx, current, iptr->isn_arg.string); + break; + case ISN_EXECRANGE: + smsg("%s%4d EXECRANGE %s", pfx, current, iptr->isn_arg.string); + break; + case ISN_LEGACY_EVAL: + smsg("%s%4d EVAL legacy %s", pfx, current, + iptr->isn_arg.string); + break; + case ISN_REDIRSTART: + smsg("%s%4d REDIR", pfx, current); + break; + case ISN_REDIREND: + smsg("%s%4d REDIR END%s", pfx, current, + iptr->isn_arg.number ? " append" : ""); + break; + case ISN_CEXPR_AUCMD: +#ifdef FEAT_QUICKFIX + smsg("%s%4d CEXPR pre %s", pfx, current, + cexpr_get_auname(iptr->isn_arg.number)); +#endif + break; + case ISN_CEXPR_CORE: +#ifdef FEAT_QUICKFIX + { + cexprref_T *cer = iptr->isn_arg.cexpr.cexpr_ref; + + smsg("%s%4d CEXPR core %s%s \"%s\"", pfx, current, + cexpr_get_auname(cer->cer_cmdidx), + cer->cer_forceit ? "!" : "", + cer->cer_cmdline); + } +#endif + break; + case ISN_INSTR: + smsg("%s%4d INSTR", pfx, current); + list_instructions(" ", iptr->isn_arg.instr, INT_MAX, NULL); + msg(" -------------"); + break; + case ISN_SOURCE: + { + scriptitem_T *si = SCRIPT_ITEM(iptr->isn_arg.number); + + smsg("%s%4d SOURCE %s", pfx, current, si->sn_name); + } + break; + case ISN_SUBSTITUTE: + { + subs_T *subs = &iptr->isn_arg.subs; + + smsg("%s%4d SUBSTITUTE %s", pfx, current, subs->subs_cmd); + list_instructions(" ", subs->subs_instr, INT_MAX, NULL); + msg(" -------------"); + } + break; + case ISN_EXECCONCAT: + smsg("%s%4d EXECCONCAT %lld", pfx, current, + (varnumber_T)iptr->isn_arg.number); + break; + case ISN_ECHO: + { + echo_T *echo = &iptr->isn_arg.echo; + + smsg("%s%4d %s %d", pfx, current, + echo->echo_with_white ? "ECHO" : "ECHON", + echo->echo_count); + } + break; + case ISN_EXECUTE: + smsg("%s%4d EXECUTE %lld", pfx, current, + (varnumber_T)(iptr->isn_arg.number)); + break; + case ISN_ECHOMSG: + smsg("%s%4d ECHOMSG %lld", pfx, current, + (varnumber_T)(iptr->isn_arg.number)); + break; + case ISN_ECHOWINDOW: + if (iptr->isn_arg.echowin.ewin_time > 0) + smsg("%s%4d ECHOWINDOW %d (%ld sec)", pfx, current, + iptr->isn_arg.echowin.ewin_count, + iptr->isn_arg.echowin.ewin_time); + else + smsg("%s%4d ECHOWINDOW %d", pfx, current, + iptr->isn_arg.echowin.ewin_count); + break; + case ISN_ECHOCONSOLE: + smsg("%s%4d ECHOCONSOLE %lld", pfx, current, + (varnumber_T)(iptr->isn_arg.number)); + break; + case ISN_ECHOERR: + smsg("%s%4d ECHOERR %lld", pfx, current, + (varnumber_T)(iptr->isn_arg.number)); + break; + case ISN_LOAD: + { + if (iptr->isn_arg.number < 0) + smsg("%s%4d LOAD arg[%lld]", pfx, current, + (varnumber_T)(iptr->isn_arg.number + + STACK_FRAME_SIZE)); + else + smsg("%s%4d LOAD $%lld", pfx, current, + (varnumber_T)(iptr->isn_arg.number)); + } + break; + case ISN_LOADOUTER: + { + isn_outer_T *outer = &iptr->isn_arg.outer; + + if (outer->outer_idx < 0) + smsg("%s%4d LOADOUTER level %d arg[%d]", pfx, current, + outer->outer_depth, + outer->outer_idx + STACK_FRAME_SIZE); + else if (outer->outer_depth < 0) + smsg("%s%4d LOADOUTER $%d in loop level %d", + pfx, current, + outer->outer_idx, + -outer->outer_depth); + else + smsg("%s%4d LOADOUTER level %d $%d", pfx, current, + outer->outer_depth, + outer->outer_idx); + } + break; + case ISN_LOADV: + smsg("%s%4d LOADV v:%s", pfx, current, + get_mnv_var_name(iptr->isn_arg.number)); + break; + case ISN_LOADSCRIPT: + { + scriptref_T *sref = iptr->isn_arg.script.scriptref; + scriptitem_T *si = SCRIPT_ITEM(sref->sref_sid); + svar_T *sv; + sctx_T save_sctx = current_sctx; + + current_sctx = script_ctx; + sv = get_script_svar(sref, -1); + current_sctx = save_sctx; + if (sv == NULL) + smsg("%s%4d LOADSCRIPT [deleted] from %s", + pfx, current, si->sn_name); + else + smsg("%s%4d LOADSCRIPT %s-%d from %s", pfx, current, + sv->sv_name, + sref->sref_idx, + si->sn_name); + } + break; + case ISN_LOADS: + case ISN_LOADEXPORT: + { + scriptitem_T *si = SCRIPT_ITEM( + iptr->isn_arg.loadstore.ls_sid); + + smsg("%s%4d %s s:%s from %s", pfx, current, + iptr->isn_type == ISN_LOADS ? "LOADS" + : "LOADEXPORT", + iptr->isn_arg.loadstore.ls_name, si->sn_name); + } + break; + case ISN_LOADAUTO: + smsg("%s%4d LOADAUTO %s", pfx, current, iptr->isn_arg.string); + break; + case ISN_LOADG: + smsg("%s%4d LOADG g:%s", pfx, current, iptr->isn_arg.string); + break; + case ISN_LOADB: + smsg("%s%4d LOADB b:%s", pfx, current, iptr->isn_arg.string); + break; + case ISN_LOADW: + smsg("%s%4d LOADW w:%s", pfx, current, iptr->isn_arg.string); + break; + case ISN_LOADT: + smsg("%s%4d LOADT t:%s", pfx, current, iptr->isn_arg.string); + break; + case ISN_LOADGDICT: + smsg("%s%4d LOAD g:", pfx, current); + break; + case ISN_LOADBDICT: + smsg("%s%4d LOAD b:", pfx, current); + break; + case ISN_LOADWDICT: + smsg("%s%4d LOAD w:", pfx, current); + break; + case ISN_LOADTDICT: + smsg("%s%4d LOAD t:", pfx, current); + break; + case ISN_LOADOPT: + smsg("%s%4d LOADOPT %s", pfx, current, iptr->isn_arg.string); + break; + case ISN_LOADENV: + smsg("%s%4d LOADENV %s", pfx, current, iptr->isn_arg.string); + break; + case ISN_LOADREG: + smsg("%s%4d LOADREG @%c", pfx, current, + (int)(iptr->isn_arg.number)); + break; + + case ISN_STORE: + if (iptr->isn_arg.number < 0) + smsg("%s%4d STORE arg[%lld]", pfx, current, + iptr->isn_arg.number + STACK_FRAME_SIZE); + else + smsg("%s%4d STORE $%lld", pfx, current, + iptr->isn_arg.number); + break; + case ISN_STOREOUTER: + { + isn_outer_T *outer = &iptr->isn_arg.outer; + + if (outer->outer_depth == OUTER_LOOP_DEPTH) + smsg("%s%4d STOREOUTER level 1 $%d in loop", + pfx, current, outer->outer_idx); + else + smsg("%s%4d STOREOUTER level %d $%d", pfx, current, + outer->outer_depth, outer->outer_idx); + } + break; + case ISN_STOREV: + smsg("%s%4d STOREV v:%s", pfx, current, + get_mnv_var_name(iptr->isn_arg.number)); + break; + case ISN_STOREAUTO: + smsg("%s%4d STOREAUTO %s", pfx, current, iptr->isn_arg.string); + break; + case ISN_STOREG: + smsg("%s%4d STOREG %s", pfx, current, iptr->isn_arg.string); + break; + case ISN_STOREB: + smsg("%s%4d STOREB %s", pfx, current, iptr->isn_arg.string); + break; + case ISN_STOREW: + smsg("%s%4d STOREW %s", pfx, current, iptr->isn_arg.string); + break; + case ISN_STORET: + smsg("%s%4d STORET %s", pfx, current, iptr->isn_arg.string); + break; + case ISN_STORES: + case ISN_STOREEXPORT: + { + scriptitem_T *si = SCRIPT_ITEM( + iptr->isn_arg.loadstore.ls_sid); + + smsg("%s%4d %s %s in %s", pfx, current, + iptr->isn_type == ISN_STORES + ? "STORES" : "STOREEXPORT", + iptr->isn_arg.loadstore.ls_name, si->sn_name); + } + break; + case ISN_STORESCRIPT: + { + scriptref_T *sref = iptr->isn_arg.script.scriptref; + scriptitem_T *si = SCRIPT_ITEM(sref->sref_sid); + svar_T *sv; + sctx_T save_sctx = current_sctx; + + current_sctx = script_ctx; + sv = get_script_svar(sref, -1); + current_sctx = save_sctx; + if (sv == NULL) + smsg("%s%4d STORESCRIPT [deleted] in %s", + pfx, current, si->sn_name); + else + smsg("%s%4d STORESCRIPT %s-%d in %s", pfx, current, + sv->sv_name, + sref->sref_idx, + si->sn_name); + } + break; + case ISN_STOREOPT: + case ISN_STOREFUNCOPT: + smsg("%s%4d %s &%s", pfx, current, + iptr->isn_type == ISN_STOREOPT ? "STOREOPT" : "STOREFUNCOPT", + iptr->isn_arg.storeopt.so_name); + break; + case ISN_STOREENV: + smsg("%s%4d STOREENV $%s", pfx, current, iptr->isn_arg.string); + break; + case ISN_STOREREG: + smsg("%s%4d STOREREG @%c", pfx, current, + (int)iptr->isn_arg.number); + break; + case ISN_STORENR: + smsg("%s%4d STORE %lld in $%d", pfx, current, + iptr->isn_arg.storenr.stnr_val, + iptr->isn_arg.storenr.stnr_idx); + break; + + case ISN_STOREINDEX: + smsg("%s%4d STOREINDEX %s", pfx, current, + vartype_name(iptr->isn_arg.storeindex.si_vartype)); + break; + + case ISN_STORERANGE: + smsg("%s%4d STORERANGE", pfx, current); + break; + + case ISN_LOAD_CLASSMEMBER: + case ISN_STORE_CLASSMEMBER: + { + class_T *cl = iptr->isn_arg.classmember.cm_class; + int idx = iptr->isn_arg.classmember.cm_idx; + ocmember_T *ocm = &cl->class_class_members[idx]; + smsg("%s%4d %s CLASSMEMBER %s.%s", pfx, current, + iptr->isn_type == ISN_LOAD_CLASSMEMBER + ? "LOAD" : "STORE", + cl->class_name.string, ocm->ocm_name.string); + } + break; + + // constants + case ISN_PUSHNR: + smsg("%s%4d PUSHNR %lld", pfx, current, + (varnumber_T)(iptr->isn_arg.number)); + break; + case ISN_PUSHBOOL: + case ISN_PUSHSPEC: + smsg("%s%4d PUSH %s", pfx, current, + get_var_special_name(iptr->isn_arg.number)); + break; + case ISN_PUSHF: + smsg("%s%4d PUSHF %g", pfx, current, iptr->isn_arg.fnumber); + break; + case ISN_PUSHS: + smsg("%s%4d PUSHS \"%s\"", pfx, current, iptr->isn_arg.string); + break; + case ISN_PUSHBLOB: + { + char_u *r; + char_u numbuf[NUMBUFLEN]; + char_u *tofree; + + r = blob2string(iptr->isn_arg.blob, &tofree, numbuf); + smsg("%s%4d PUSHBLOB %s", pfx, current, r); + mnv_free(tofree); + } + break; + case ISN_PUSHFUNC: + { + char *name = (char *)iptr->isn_arg.string; + + smsg("%s%4d PUSHFUNC \"%s\"", pfx, current, + name == NULL ? "[none]" : name); + } + break; + case ISN_PUSHCHANNEL: +#ifdef FEAT_JOB_CHANNEL + smsg("%s%4d PUSHCHANNEL 0", pfx, current); +#endif + break; + case ISN_PUSHJOB: +#ifdef FEAT_JOB_CHANNEL + smsg("%s%4d PUSHJOB \"no process\"", pfx, current); +#endif + break; + case ISN_PUSHOBJ: + smsg("%s%4d PUSHOBJ null", pfx, current); + break; + case ISN_PUSHCLASS: + smsg("%s%4d PUSHCLASS %s", pfx, current, + iptr->isn_arg.classarg == NULL ? "null" + : (char *)iptr->isn_arg.classarg->class_name.string); + break; + case ISN_PUSHEXC: + smsg("%s%4d PUSH v:exception", pfx, current); + break; + case ISN_AUTOLOAD: + smsg("%s%4d AUTOLOAD %s", pfx, current, iptr->isn_arg.string); + break; + case ISN_UNLET: + smsg("%s%4d UNLET%s %s", pfx, current, + iptr->isn_arg.unlet.ul_forceit ? "!" : "", + iptr->isn_arg.unlet.ul_name); + break; + case ISN_UNLETENV: + smsg("%s%4d UNLETENV%s $%s", pfx, current, + iptr->isn_arg.unlet.ul_forceit ? "!" : "", + iptr->isn_arg.unlet.ul_name); + break; + case ISN_UNLETINDEX: + smsg("%s%4d UNLETINDEX", pfx, current); + break; + case ISN_UNLETRANGE: + smsg("%s%4d UNLETRANGE", pfx, current); + break; + case ISN_LOCKUNLOCK: + smsg("%s%4d LOCKUNLOCK %s", pfx, current, iptr->isn_arg.string); + break; + case ISN_LOCKCONST: + smsg("%s%4d LOCKCONST", pfx, current); + break; + case ISN_NEWLIST: + smsg("%s%4d NEWLIST size %lld", pfx, current, + (varnumber_T)(iptr->isn_arg.number)); + break; + case ISN_NEWTUPLE: + smsg("%s%4d NEWTUPLE size %lld", pfx, current, + (varnumber_T)(iptr->isn_arg.number)); + break; + case ISN_NEWDICT: + smsg("%s%4d NEWDICT size %lld", pfx, current, + (varnumber_T)(iptr->isn_arg.number)); + break; + case ISN_NEWPARTIAL: + smsg("%s%4d NEWPARTIAL", pfx, current); + break; + + // function call + case ISN_BCALL: + { + cbfunc_T *cbfunc = &iptr->isn_arg.bfunc; + + smsg("%s%4d BCALL %s(argc %d)", pfx, current, + internal_func_name(cbfunc->cbf_idx), + cbfunc->cbf_argcount); + } + break; + case ISN_DCALL: + { + cdfunc_T *cdfunc = &iptr->isn_arg.dfunc; + dfunc_T *df = ((dfunc_T *)def_functions.ga_data) + + cdfunc->cdf_idx; + + smsg("%s%4d DCALL %s(argc %d)", pfx, current, + printable_func_name(df->df_ufunc), + cdfunc->cdf_argcount); + } + break; + case ISN_METHODCALL: + { + cmfunc_T *mfunc = iptr->isn_arg.mfunc; + + smsg("%s%4d METHODCALL %s.%s(argc %d)", pfx, current, + mfunc->cmf_itf->class_name.string, + mfunc->cmf_itf->class_obj_methods[ + mfunc->cmf_idx]->uf_name, + mfunc->cmf_argcount); + } + break; + case ISN_UCALL: + { + cufunc_T *cufunc = &iptr->isn_arg.ufunc; + + smsg("%s%4d UCALL %s(argc %d)", pfx, current, + cufunc->cuf_name, cufunc->cuf_argcount); + } + break; + case ISN_PCALL: + { + cpfunc_T *cpfunc = &iptr->isn_arg.pfunc; + + smsg("%s%4d PCALL%s (argc %d)", pfx, current, + cpfunc->cpf_top ? " top" : "", cpfunc->cpf_argcount); + } + break; + case ISN_PCALL_END: + smsg("%s%4d PCALL end", pfx, current); + break; + case ISN_DEFER: + smsg("%s%4d DEFER %d args", pfx, current, + (int)iptr->isn_arg.defer.defer_argcount); + break; + case ISN_RETURN: + smsg("%s%4d RETURN", pfx, current); + break; + case ISN_RETURN_VOID: + smsg("%s%4d RETURN void", pfx, current); + break; + case ISN_RETURN_OBJECT: + smsg("%s%4d RETURN object", pfx, current); + break; + case ISN_FUNCREF: + { + funcref_T *funcref = &iptr->isn_arg.funcref; + funcref_extra_T *extra = funcref->fr_extra; + char_u *name; + + if (extra == NULL || extra->fre_func_name == NULL) + { + dfunc_T *df = ((dfunc_T *)def_functions.ga_data) + + funcref->fr_dfunc_idx; + name = df->df_ufunc->uf_name; + } + else + name = extra->fre_func_name; + if (extra != NULL && extra->fre_class != NULL) + { + smsg("%s%4d FUNCREF %s.%s", pfx, current, + extra->fre_class->class_name.string, name); + } + else if (extra == NULL + || extra->fre_loopvar_info.lvi_depth == 0) + { + smsg("%s%4d FUNCREF %s", pfx, current, name); + } + else + { + char_u *info = printable_loopvarinfo( + &extra->fre_loopvar_info); + + smsg("%s%4d FUNCREF %s vars %s", pfx, current, + name, info); + mnv_free(info); + } + } + break; + + case ISN_NEWFUNC: + { + newfuncarg_T *arg = iptr->isn_arg.newfunc.nf_arg; + + if (arg->nfa_loopvar_info.lvi_depth == 0) + smsg("%s%4d NEWFUNC %s %s", pfx, current, + arg->nfa_lambda, arg->nfa_global); + else + { + char_u *info = printable_loopvarinfo( + &arg->nfa_loopvar_info); + + smsg("%s%4d NEWFUNC %s %s vars %s", pfx, current, + arg->nfa_lambda, arg->nfa_global, info); + mnv_free(info); + } + } + break; + + case ISN_DEF: + { + char_u *name = iptr->isn_arg.string; + + smsg("%s%4d DEF %s", pfx, current, + name == NULL ? (char_u *)"" : name); + } + break; + + case ISN_JUMP: + { + char *when = "?"; + + switch (iptr->isn_arg.jump.jump_when) + { + case JUMP_ALWAYS: + when = "JUMP"; + break; + case JUMP_NEVER: + iemsg("JUMP_NEVER should not be used"); + break; + case JUMP_AND_KEEP_IF_TRUE: + when = "JUMP_AND_KEEP_IF_TRUE"; + break; + case JUMP_IF_FALSE: + when = "JUMP_IF_FALSE"; + break; + case JUMP_WHILE_FALSE: + when = "JUMP_WHILE_FALSE"; // unused + break; + case JUMP_IF_COND_FALSE: + when = "JUMP_IF_COND_FALSE"; + break; + case JUMP_IF_COND_TRUE: + when = "JUMP_IF_COND_TRUE"; + break; + } + smsg("%s%4d %s -> %d", pfx, current, when, + iptr->isn_arg.jump.jump_where); + } + break; + + case ISN_JUMP_IF_ARG_SET: + smsg("%s%4d JUMP_IF_ARG_SET arg[%d] -> %d", pfx, current, + iptr->isn_arg.jumparg.jump_arg_off + STACK_FRAME_SIZE, + iptr->isn_arg.jump.jump_where); + break; + + case ISN_JUMP_IF_ARG_NOT_SET: + smsg("%s%4d JUMP_IF_ARG_NOT_SET arg[%d] -> %d", pfx, current, + iptr->isn_arg.jumparg.jump_arg_off + STACK_FRAME_SIZE, + iptr->isn_arg.jump.jump_where); + break; + + case ISN_FOR: + { + forloop_T *forloop = &iptr->isn_arg.forloop; + + smsg("%s%4d FOR $%d -> %d", pfx, current, + forloop->for_loop_idx, forloop->for_end); + } + break; + + case ISN_ENDLOOP: + { + endloop_T *endloop = &iptr->isn_arg.endloop; + + smsg("%s%4d ENDLOOP ref $%d save $%d-$%d depth %d", + pfx, current, + endloop->end_funcref_idx, + endloop->end_var_idx, + endloop->end_var_idx + endloop->end_var_count - 1, + endloop->end_depth); + } + break; + + case ISN_WHILE: + { + whileloop_T *whileloop = &iptr->isn_arg.whileloop; + + smsg("%s%4d WHILE $%d -> %d", pfx, current, + whileloop->while_funcref_idx, + whileloop->while_end); + } + break; + + case ISN_TRY: + { + try_T *try = &iptr->isn_arg.tryref; + + if (try->try_ref->try_finally == 0) + smsg("%s%4d TRY catch -> %d, endtry -> %d", + pfx, current, + try->try_ref->try_catch, + try->try_ref->try_endtry); + else + smsg("%s%4d TRY catch -> %d, finally -> %d, endtry -> %d", + pfx, current, + try->try_ref->try_catch, + try->try_ref->try_finally, + try->try_ref->try_endtry); + } + break; + case ISN_CATCH: + smsg("%s%4d CATCH", pfx, current); + break; + case ISN_TRYCONT: + { + trycont_T *trycont = &iptr->isn_arg.trycont; + + smsg("%s%4d TRY-CONTINUE %d level%s -> %d", pfx, current, + trycont->tct_levels, + trycont->tct_levels == 1 ? "" : "s", + trycont->tct_where); + } + break; + case ISN_FINALLY: + smsg("%s%4d FINALLY", pfx, current); + break; + case ISN_ENDTRY: + smsg("%s%4d ENDTRY", pfx, current); + break; + case ISN_THROW: + smsg("%s%4d THROW", pfx, current); + break; + + // expression operations on number + case ISN_OPNR: + case ISN_OPFLOAT: + case ISN_OPANY: + { + char *what; + char *ins; + + switch (iptr->isn_arg.op.op_type) + { + case EXPR_MULT: what = "*"; break; + case EXPR_DIV: what = "/"; break; + case EXPR_REM: what = "%"; break; + case EXPR_SUB: what = "-"; break; + case EXPR_ADD: what = "+"; break; + case EXPR_LSHIFT: what = "<<"; break; + case EXPR_RSHIFT: what = ">>"; break; + default: what = "???"; break; + } + switch (iptr->isn_type) + { + case ISN_OPNR: ins = "OPNR"; break; + case ISN_OPFLOAT: ins = "OPFLOAT"; break; + case ISN_OPANY: ins = "OPANY"; break; + default: ins = "???"; break; + } + smsg("%s%4d %s %s", pfx, current, ins, what); + } + break; + + case ISN_COMPAREBOOL: + case ISN_COMPARESPECIAL: + case ISN_COMPARENULL: + case ISN_COMPARENR: + case ISN_COMPAREFLOAT: + case ISN_COMPARESTRING: + case ISN_COMPAREBLOB: + case ISN_COMPARELIST: + case ISN_COMPARETUPLE: + case ISN_COMPAREDICT: + case ISN_COMPAREFUNC: + case ISN_COMPAREOBJECT: + case ISN_COMPAREANY: + { + char *p; + char buf[10]; + char *type; + + switch (iptr->isn_arg.op.op_type) + { + case EXPR_EQUAL: p = "=="; break; + case EXPR_NEQUAL: p = "!="; break; + case EXPR_GREATER: p = ">"; break; + case EXPR_GEQUAL: p = ">="; break; + case EXPR_SMALLER: p = "<"; break; + case EXPR_SEQUAL: p = "<="; break; + case EXPR_MATCH: p = "=~"; break; + case EXPR_IS: p = "is"; break; + case EXPR_ISNOT: p = "isnot"; break; + case EXPR_NOMATCH: p = "!~"; break; + default: p = "???"; break; + } + STRCPY(buf, p); + if (iptr->isn_arg.op.op_ic == TRUE) + strcat(buf, "?"); + switch(iptr->isn_type) + { + case ISN_COMPAREBOOL: type = "COMPAREBOOL"; break; + case ISN_COMPARESPECIAL: + type = "COMPARESPECIAL"; break; + case ISN_COMPARENULL: type = "COMPARENULL"; break; + case ISN_COMPARENR: type = "COMPARENR"; break; + case ISN_COMPAREFLOAT: type = "COMPAREFLOAT"; break; + case ISN_COMPARESTRING: + type = "COMPARESTRING"; break; + case ISN_COMPAREBLOB: type = "COMPAREBLOB"; break; + case ISN_COMPARELIST: type = "COMPARELIST"; break; + case ISN_COMPARETUPLE: type = "COMPARETUPLE"; break; + case ISN_COMPAREDICT: type = "COMPAREDICT"; break; + case ISN_COMPAREFUNC: type = "COMPAREFUNC"; break; + case ISN_COMPAREOBJECT: + type = "COMPAREOBJECT"; break; + case ISN_COMPAREANY: type = "COMPAREANY"; break; + default: type = "???"; break; + } + + smsg("%s%4d %s %s", pfx, current, type, buf); + } + break; + + case ISN_ADDLIST: smsg("%s%4d ADDLIST", pfx, current); break; + case ISN_ADDTUPLE: smsg("%s%4d ADDTUPLE", pfx, current); break; + case ISN_ADDBLOB: smsg("%s%4d ADDBLOB", pfx, current); break; + + // expression operations + case ISN_CONCAT: + smsg("%s%4d CONCAT size %lld", pfx, current, + (varnumber_T)(iptr->isn_arg.number)); + break; + case ISN_STRINDEX: smsg("%s%4d STRINDEX", pfx, current); break; + case ISN_STRSLICE: smsg("%s%4d STRSLICE", pfx, current); break; + case ISN_BLOBINDEX: smsg("%s%4d BLOBINDEX", pfx, current); break; + case ISN_BLOBSLICE: smsg("%s%4d BLOBSLICE", pfx, current); break; + case ISN_LISTAPPEND: smsg("%s%4d LISTAPPEND", pfx, current); break; + case ISN_BLOBAPPEND: smsg("%s%4d BLOBAPPEND", pfx, current); break; + case ISN_LISTINDEX: smsg("%s%4d LISTINDEX", pfx, current); break; + case ISN_LISTSLICE: smsg("%s%4d LISTSLICE", pfx, current); break; + case ISN_TUPLEINDEX: smsg("%s%4d TUPLEINDEX", pfx, current); break; + case ISN_TUPLESLICE: smsg("%s%4d TUPLESLICE", pfx, current); break; + case ISN_ANYINDEX: smsg("%s%4d ANYINDEX", pfx, current); break; + case ISN_ANYSLICE: smsg("%s%4d ANYSLICE", pfx, current); break; + case ISN_SLICE: smsg("%s%4d SLICE %lld", + pfx, current, iptr->isn_arg.number); break; + case ISN_GETITEM: smsg("%s%4d ITEM %lld%s", pfx, current, + iptr->isn_arg.getitem.gi_index, + iptr->isn_arg.getitem.gi_with_op ? + " with op" : ""); break; + case ISN_MEMBER: smsg("%s%4d MEMBER", pfx, current); break; + case ISN_STRINGMEMBER: smsg("%s%4d MEMBER %s", pfx, current, + iptr->isn_arg.string); break; + case ISN_GET_OBJ_MEMBER: smsg("%s%4d OBJ_MEMBER %d", pfx, current, + (int)iptr->isn_arg.classmember.cm_idx); + break; + case ISN_GET_ITF_MEMBER: smsg("%s%4d ITF_MEMBER %d on %s", + pfx, current, + (int)iptr->isn_arg.classmember.cm_idx, + iptr->isn_arg.classmember.cm_class->class_name.string); + break; + case ISN_STORE_THIS: smsg("%s%4d STORE_THIS %d", pfx, current, + (int)iptr->isn_arg.number); break; + case ISN_CLEARDICT: smsg("%s%4d CLEARDICT", pfx, current); break; + case ISN_USEDICT: smsg("%s%4d USEDICT", pfx, current); break; + + case ISN_NEGATENR: smsg("%s%4d NEGATENR", pfx, current); break; + + case ISN_CHECKTYPE: + { + checktype_T *ct = &iptr->isn_arg.type; + char *tofree = NULL; + char *typename; + + if (ct->ct_type->tt_type == VAR_FLOAT + && (ct->ct_type->tt_flags & TTFLAG_NUMBER_OK)) + typename = "float|number"; + else if (ct->ct_type->tt_type == VAR_LIST + && (ct->ct_type->tt_flags & TTFLAG_TUPLE_OK)) + typename = "list|tuple"; + else + typename = type_name(ct->ct_type, &tofree); + + if (ct->ct_arg_idx == 0) + smsg("%s%4d CHECKTYPE %s stack[%d]", pfx, current, + typename, + (int)ct->ct_off); + else + smsg("%s%4d CHECKTYPE %s stack[%d] %s %d", + pfx, current, + typename, + (int)ct->ct_off, + ct->ct_is_var ? "var": "arg", + (int)ct->ct_arg_idx); + mnv_free(tofree); + break; + } + case ISN_CHECKLEN: smsg("%s%4d CHECKLEN %s%d", pfx, current, + iptr->isn_arg.checklen.cl_more_OK ? ">= " : "", + iptr->isn_arg.checklen.cl_min_len); + break; + case ISN_SETTYPE: + { + char *tofree; + + smsg("%s%4d SETTYPE %s", pfx, current, + type_name(iptr->isn_arg.type.ct_type, &tofree)); + mnv_free(tofree); + break; + } + case ISN_COND2BOOL: smsg("%s%4d COND2BOOL", pfx, current); break; + case ISN_2BOOL: if (iptr->isn_arg.tobool.invert) + smsg("%s%4d INVERT %d (!val)", pfx, current, + iptr->isn_arg.tobool.offset); + else + smsg("%s%4d 2BOOL %d (!!val)", pfx, current, + iptr->isn_arg.tobool.offset); + break; + case ISN_2STRING: smsg("%s%4d 2STRING stack[%lld]", pfx, current, + (varnumber_T)(iptr->isn_arg.tostring.offset)); + break; + case ISN_2STRING_ANY: smsg("%s%4d 2STRING_ANY stack[%lld]", + pfx, current, + (varnumber_T)(iptr->isn_arg.tostring.offset)); + break; + case ISN_RANGE: smsg("%s%4d RANGE %s", pfx, current, + iptr->isn_arg.string); + break; + case ISN_PUT: + if (iptr->isn_arg.put.put_lnum == LNUM_VARIABLE_RANGE_ABOVE) + smsg("%s%4d PUT %c above range", + pfx, current, iptr->isn_arg.put.put_regname); + else if (iptr->isn_arg.put.put_lnum == LNUM_VARIABLE_RANGE) + smsg("%s%4d PUT %c range", + pfx, current, iptr->isn_arg.put.put_regname); + else + smsg("%s%4d PUT %c %ld", pfx, current, + iptr->isn_arg.put.put_regname, + (long)iptr->isn_arg.put.put_lnum); + break; + case ISN_IPUT: + if (iptr->isn_arg.put.put_lnum == LNUM_VARIABLE_RANGE_ABOVE) + smsg("%s%4d IPUT %c above range", + pfx, current, iptr->isn_arg.put.put_regname); + else if (iptr->isn_arg.put.put_lnum == LNUM_VARIABLE_RANGE) + smsg("%s%4d IPUT %c range", + pfx, current, iptr->isn_arg.put.put_regname); + else + smsg("%s%4d IPUT %c %ld", pfx, current, + iptr->isn_arg.put.put_regname, + (long)iptr->isn_arg.put.put_lnum); + break; + case ISN_CMDMOD: + { + char_u *buf; + size_t len = produce_cmdmods( + NULL, iptr->isn_arg.cmdmod.cf_cmdmod, FALSE); + + buf = alloc(len + 1); + if (likely(buf != NULL)) + { + (void)produce_cmdmods( + buf, iptr->isn_arg.cmdmod.cf_cmdmod, FALSE); + smsg("%s%4d CMDMOD %s", pfx, current, buf); + mnv_free(buf); + } + break; + } + case ISN_CMDMOD_REV: smsg("%s%4d CMDMOD_REV", pfx, current); break; + + case ISN_PROF_START: + smsg("%s%4d PROFILE START line %d", pfx, current, + iptr->isn_lnum); + break; + + case ISN_PROF_END: + smsg("%s%4d PROFILE END", pfx, current); + break; + + case ISN_DEBUG: + smsg("%s%4d DEBUG line %d-%d varcount %lld", pfx, current, + iptr->isn_arg.debug.dbg_break_lnum + 1, + iptr->isn_lnum, + iptr->isn_arg.debug.dbg_var_names_len); + break; + + case ISN_UNPACK: smsg("%s%4d UNPACK %d%s", pfx, current, + iptr->isn_arg.unpack.unp_count, + iptr->isn_arg.unpack.unp_semicolon ? " semicolon" : ""); + break; + case ISN_SHUFFLE: smsg("%s%4d SHUFFLE %d up %d", pfx, current, + iptr->isn_arg.shuffle.shfl_item, + iptr->isn_arg.shuffle.shfl_up); + break; + case ISN_DROP: smsg("%s%4d DROP", pfx, current); break; + + case ISN_SCRIPTCTX_SET: + { + int sid = iptr->isn_arg.setsctx.sc_sid; + scriptitem_T *si = SCRIPT_ITEM(sid); + smsg("%s%4d SCRIPTCTX_SET %s", pfx, current, si->sn_name); + script_ctx = iptr->isn_arg.setsctx; + } + break; + + case ISN_FINISH: // End of list of instructions for ISN_SUBSTITUTE. + return; + } + + out_flush(); // output one line at a time + ui_breakcheck(); + if (got_int) + break; + } +} + +/* + * Handle command line completion for the :disassemble command. + */ + void +set_context_in_disassemble_cmd(expand_T *xp, char_u *arg) +{ + char_u *p; + + // Default: expand user functions, "debug" and "profile" + xp->xp_context = EXPAND_DISASSEMBLE; + xp->xp_pattern = arg; + + // first argument already typed: only user function names + if (*arg != NUL && *(p = skiptowhite(arg)) != NUL) + { + xp->xp_context = EXPAND_USER_FUNC; + xp->xp_pattern = skipwhite(p); + } +} + +/* + * Function given to ExpandGeneric() to obtain the list of :disassemble + * arguments. + */ + char_u * +get_disassemble_argument(expand_T *xp, int idx) +{ + if (idx == 0) + return (char_u *)"debug"; + if (idx == 1) + return (char_u *)"profile"; + return get_user_func_name(xp, idx - 2); +} + +/* + * ":disassemble". + * We don't really need this at runtime, but we do have tests that require it, + * so always include this. + */ + void +ex_disassemble(exarg_T *eap) +{ + char_u *arg = eap->arg; + ufunc_T *ufunc; + dfunc_T *dfunc; + isn_T *instr = NULL; // init to shut up gcc warning + int instr_count = 0; // init to shut up gcc warning + compiletype_T compile_type = CT_NONE; + + ufunc = find_func_by_name(arg, &compile_type); + if (ufunc == NULL) + return; + if (func_needs_compiling(ufunc, compile_type) + && compile_def_function(ufunc, FALSE, compile_type, NULL) == FAIL) + return; + if (ufunc->uf_def_status != UF_COMPILED) + { + semsg(_(e_function_is_not_compiled_str), eap->arg); + return; + } + msg((char *)printable_func_name(ufunc)); + + dfunc = ((dfunc_T *)def_functions.ga_data) + ufunc->uf_dfunc_idx; + switch (compile_type) + { + case CT_PROFILE: +#ifdef FEAT_PROFILE + instr = dfunc->df_instr_prof; + instr_count = dfunc->df_instr_prof_count; + break; +#endif + // FALLTHROUGH + case CT_NONE: + instr = dfunc->df_instr; + instr_count = dfunc->df_instr_count; + break; + case CT_DEBUG: + instr = dfunc->df_instr_debug; + instr_count = dfunc->df_instr_debug_count; + break; + } + + list_instructions("", instr, instr_count, ufunc); +} + +/* + * Return TRUE when "tv" is not falsy: non-zero, non-empty string, non-empty + * list, etc. Mostly like what JavaScript does, except that empty list and + * empty dictionary are FALSE. + */ + int +tv2bool(typval_T *tv) +{ + switch (tv->v_type) + { + case VAR_NUMBER: + return tv->vval.v_number != 0; + case VAR_FLOAT: + return tv->vval.v_float != 0.0; + case VAR_PARTIAL: + return tv->vval.v_partial != NULL; + case VAR_FUNC: + case VAR_STRING: + return tv->vval.v_string != NULL && *tv->vval.v_string != NUL; + case VAR_LIST: + return tv->vval.v_list != NULL && tv->vval.v_list->lv_len > 0; + case VAR_TUPLE: + return tuple_len(tv->vval.v_tuple) > 0; + case VAR_DICT: + return tv->vval.v_dict != NULL + && tv->vval.v_dict->dv_hashtab.ht_used > 0; + case VAR_BOOL: + case VAR_SPECIAL: + return tv->vval.v_number == VVAL_TRUE ? TRUE : FALSE; + case VAR_JOB: +#ifdef FEAT_JOB_CHANNEL + return tv->vval.v_job != NULL; +#else + break; +#endif + case VAR_CHANNEL: +#ifdef FEAT_JOB_CHANNEL + return tv->vval.v_channel != NULL; +#else + break; +#endif + case VAR_BLOB: + return tv->vval.v_blob != NULL && tv->vval.v_blob->bv_ga.ga_len > 0; + + case VAR_OBJECT: + return tv->vval.v_object != NULL; + + case VAR_CLASS: + case VAR_TYPEALIAS: + check_typval_is_value(tv); + break; + + case VAR_UNKNOWN: + case VAR_ANY: + case VAR_VOID: + case VAR_INSTR: + break; + } + return FALSE; +} + + void +emsg_using_string_as(typval_T *tv, int as_number) +{ + semsg(_(as_number ? e_using_string_as_number_str + : e_using_string_as_bool_str), + tv->vval.v_string == NULL + ? (char_u *)"" : tv->vval.v_string); +} + +/* + * If "tv" is a string give an error and return FAIL. + */ + int +check_not_string(typval_T *tv) +{ + if (tv->v_type == VAR_STRING) + { + emsg_using_string_as(tv, TRUE); + clear_tv(tv); + return FAIL; + } + return OK; +} + +#endif // FEAT_EVAL diff --git a/uvim/src/mnv9expr.c b/uvim/src/mnv9expr.c new file mode 100644 index 0000000000..add763d737 --- /dev/null +++ b/uvim/src/mnv9expr.c @@ -0,0 +1,4071 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * MNV - MNV is not Vim by Bram Moolenaar + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. + */ + +/* + * mnv9expr.c: Dealing with compiled function expressions + */ + +#define USING_FLOAT_STUFF +#include "mnv.h" + +#if defined(FEAT_EVAL) + +// flag passed from compile_subscript() to compile_load_scriptvar() +static int paren_follows_after_expr = 0; + +/* + * Generate code for any ppconst entries. + */ + int +generate_ppconst(cctx_T *cctx, ppconst_T *ppconst) +{ + int i; + int ret = OK; + int save_skip = cctx->ctx_skip; + + cctx->ctx_skip = SKIP_NOT; + for (i = 0; i < ppconst->pp_used; ++i) + if (generate_tv_PUSH(cctx, &ppconst->pp_tv[i]) == FAIL) + ret = FAIL; + ppconst->pp_used = 0; + cctx->ctx_skip = save_skip; + return ret; +} + +/* + * Check that the last item of "ppconst" is a bool, if there is an item. + */ + static int +check_ppconst_bool(ppconst_T *ppconst) +{ + if (ppconst->pp_used > 0) + { + typval_T *tv = &ppconst->pp_tv[ppconst->pp_used - 1]; + where_T where = WHERE_INIT; + + return check_typval_type(&t_bool, tv, where); + } + return OK; +} + +/* + * Clear ppconst constants. Used when failing. + */ + void +clear_ppconst(ppconst_T *ppconst) +{ + int i; + + for (i = 0; i < ppconst->pp_used; ++i) + clear_tv(&ppconst->pp_tv[i]); + ppconst->pp_used = 0; +} + +/* + * Compile getting a member from a tuple. Stack has the indexable value and + * the index or the two indexes of a slice. + */ + static int +compile_tuple_member( + type2_T *typep, + int is_slice, + cctx_T *cctx) +{ + if (is_slice) + { + if (generate_instr_drop(cctx, ISN_TUPLESLICE, 2) == FAIL) + return FAIL; + // a copy is made so the member type is no longer declared + if (typep->type_decl->tt_type == VAR_TUPLE) + typep->type_decl = &t_tuple_any; + + // a copy is made, the composite is no longer "const" + if (typep->type_curr->tt_flags & TTFLAG_CONST) + { + type_T *type = copy_type(typep->type_curr, cctx->ctx_type_list); + + if (type != typep->type_curr) // did get a copy + { + type->tt_flags &= ~(TTFLAG_CONST | TTFLAG_STATIC); + typep->type_curr = type; + } + } + } + else + { + if (typep->type_curr->tt_type == VAR_TUPLE) + { + if (typep->type_curr->tt_argcount == 1) + { + if (typep->type_curr->tt_flags & TTFLAG_VARARGS) + typep->type_curr + = typep->type_curr->tt_args[0]->tt_member; + else + typep->type_curr = typep->type_curr->tt_args[0]; + } + else + typep->type_curr = &t_any; + if (typep->type_decl->tt_type == VAR_TUPLE) + { + if (typep->type_decl->tt_argcount == 1) + { + if (typep->type_decl->tt_flags & TTFLAG_VARARGS) + typep->type_decl + = typep->type_decl->tt_args[0]->tt_member; + else + typep->type_decl = typep->type_decl->tt_args[0]; + } + else + typep->type_curr = &t_any; + } + else + typep->type_decl = typep->type_curr; + } + if (generate_instr_drop(cctx, ISN_TUPLEINDEX, 1) == FAIL) + return FAIL; + } + + return OK; +} + +/* + * Compile getting a member from a list/tuple/dict/string/blob. Stack has the + * indexable value and the index or the two indexes of a slice. + * "keeping_dict" is used for dict[func](arg) to pass dict to func. + */ + int +compile_member(int is_slice, int *keeping_dict, cctx_T *cctx) +{ + type2_T *typep; + garray_T *stack = &cctx->ctx_type_stack; + vartype_T vartype; + type_T *idxtype; + + // We can index a list, tuple, dict and blob. If we don't know the type + // we can use the index value type. If we still don't know use an "ANY" + // instruction. + // TODO: what about the decl type? + typep = (((type2_T *)stack->ga_data) + stack->ga_len - (is_slice ? 3 : 2)); + vartype = typep->type_curr->tt_type; + idxtype = (((type2_T *)stack->ga_data) + stack->ga_len - 1)->type_curr; + // If the index is a string, the variable must be a Dict. + if ((typep->type_curr->tt_type == VAR_ANY + || typep->type_curr->tt_type == VAR_UNKNOWN) + && idxtype == &t_string) + vartype = VAR_DICT; + if (vartype == VAR_STRING || vartype == VAR_LIST || vartype == VAR_BLOB + || vartype == VAR_TUPLE) + { + if (need_type(idxtype, &t_number, 0, + -1, 0, cctx, FALSE, FALSE) == FAIL) + return FAIL; + if (is_slice) + { + idxtype = get_type_on_stack(cctx, 1); + if (need_type(idxtype, &t_number, 0, + -2, 0, cctx, FALSE, FALSE) == FAIL) + return FAIL; + } + } + + if (vartype == VAR_DICT) + { + if (is_slice) + { + emsg(_(e_cannot_slice_dictionary)); + return FAIL; + } + if (typep->type_curr->tt_type == VAR_DICT) + { + typep->type_curr = typep->type_curr->tt_member; + if (typep->type_curr == &t_unknown) + // empty dict was used + typep->type_curr = &t_any; + if (typep->type_decl->tt_type == VAR_DICT) + { + typep->type_decl = typep->type_decl->tt_member; + if (typep->type_decl == &t_unknown) + // empty dict was used + typep->type_decl = &t_any; + } + else + typep->type_decl = typep->type_curr; + } + else + { + if (need_type(typep->type_curr, &t_dict_any, 0, + -2, 0, cctx, FALSE, FALSE) == FAIL) + return FAIL; + typep->type_curr = &t_any; + typep->type_decl = &t_any; + } + if (may_generate_2STRING(-1, TOSTRING_NONE, cctx) == FAIL + || generate_instr_drop(cctx, ISN_MEMBER, 1) == FAIL) + return FAIL; + if (keeping_dict != NULL) + *keeping_dict = TRUE; + } + else if (vartype == VAR_STRING) + { + typep->type_curr = &t_string; + typep->type_decl = &t_string; + if ((is_slice + ? generate_instr_drop(cctx, ISN_STRSLICE, 2) + : generate_instr_drop(cctx, ISN_STRINDEX, 1)) == FAIL) + return FAIL; + } + else if (vartype == VAR_BLOB) + { + if (is_slice) + { + typep->type_curr = &t_blob; + typep->type_decl = &t_blob; + if (generate_instr_drop(cctx, ISN_BLOBSLICE, 2) == FAIL) + return FAIL; + } + else + { + typep->type_curr = &t_number; + typep->type_decl = &t_number; + if (generate_instr_drop(cctx, ISN_BLOBINDEX, 1) == FAIL) + return FAIL; + } + } + else if (vartype == VAR_TUPLE) + { + if (compile_tuple_member(typep, is_slice, cctx) == FAIL) + return FAIL; + } + else if (vartype == VAR_LIST || typep->type_curr->tt_type == VAR_ANY + || typep->type_curr->tt_type == VAR_UNKNOWN) + { + if (is_slice) + { + if (generate_instr_drop(cctx, + vartype == VAR_LIST ? ISN_LISTSLICE : ISN_ANYSLICE, + 2) == FAIL) + return FAIL; + // a copy is made so the member type is no longer declared + if (typep->type_decl->tt_type == VAR_LIST) + typep->type_decl = &t_list_any; + + // a copy is made, the composite is no longer "const" + if (typep->type_curr->tt_flags & TTFLAG_CONST) + { + type_T *type = copy_type(typep->type_curr, cctx->ctx_type_list); + + if (type != typep->type_curr) // did get a copy + { + type->tt_flags &= ~(TTFLAG_CONST | TTFLAG_STATIC); + typep->type_curr = type; + } + } + } + else + { + if (typep->type_curr->tt_type == VAR_LIST) + { + typep->type_curr = typep->type_curr->tt_member; + if (typep->type_curr == &t_unknown) + // empty list was used + typep->type_curr = &t_any; + if (typep->type_decl->tt_type == VAR_LIST) + { + typep->type_decl = typep->type_decl->tt_member; + if (typep->type_decl == &t_unknown) + // empty list was used + typep->type_decl = &t_any; + } + else + typep->type_decl = typep->type_curr; + } + if (generate_instr_drop(cctx, + vartype == VAR_LIST ? ISN_LISTINDEX : ISN_ANYINDEX, 1) + == FAIL) + return FAIL; + } + } + else + { + switch (vartype) + { + case VAR_FUNC: + case VAR_PARTIAL: + emsg(_(e_cannot_index_a_funcref)); + break; + case VAR_BOOL: + case VAR_SPECIAL: + case VAR_JOB: + case VAR_CHANNEL: + case VAR_INSTR: + case VAR_CLASS: + case VAR_OBJECT: + case VAR_TYPEALIAS: + case VAR_UNKNOWN: + case VAR_ANY: + case VAR_VOID: + emsg(_(e_cannot_index_special_variable)); + break; + default: + emsg(_(e_string_list_dict_or_blob_required)); + } + return FAIL; + } + return OK; +} + +/* + * Returns TRUE if the current function is inside the class "cl" or one of the + * parent classes. + */ + static int +inside_class_hierarchy(cctx_T *cctx_arg, class_T *cl) +{ + for (cctx_T *cctx = cctx_arg; cctx != NULL; cctx = cctx->ctx_outer) + { + if (cctx->ctx_ufunc != NULL && cctx->ctx_ufunc->uf_class != NULL) + { + class_T *clp = cctx->ctx_ufunc->uf_class; + while (clp != NULL) + { + if (clp == cl) + return TRUE; + clp = clp->class_extends; + } + } + } + + return FALSE; +} + +/* + * Compile ".member" coming after an object or class. + */ + static int +compile_class_object_index(cctx_T *cctx, char_u **arg, type_T *type) +{ + int m_idx; + int ret = FAIL; + + if (MNV_ISWHITE((*arg)[1])) + { + semsg(_(e_no_white_space_allowed_after_str_str), ".", *arg); + return FAIL; + } + + class_T *cl = type->tt_class; + int is_super = ((type->tt_flags & TTFLAG_SUPER) == TTFLAG_SUPER); + if (type == &t_super) + { + if (cctx->ctx_ufunc == NULL || cctx->ctx_ufunc->uf_class == NULL) + { + emsg(_(e_using_super_not_in_class_method)); + return FAIL; + } + is_super = TRUE; + cl = cctx->ctx_ufunc->uf_class; + // Remove &t_super from the stack. + --cctx->ctx_type_stack.ga_len; + } + else if (type->tt_type == VAR_CLASS) + { + garray_T *instr = &cctx->ctx_instr; + if (instr->ga_len > 0) + { + isn_T *isn = ((isn_T *)instr->ga_data) + instr->ga_len - 1; + if (isn->isn_type == ISN_LOADSCRIPT) + { + // The class was recognized as a script item. We only need + // to know what class it is, drop the instruction. + --instr->ga_len; + mnv_free(isn->isn_arg.script.scriptref); + } + } + } + + if (cl == NULL) + { + // TODO: this should not give an error but be handled at runtime + emsg(_(e_incomplete_type)); + return FAIL; + } + + ++*arg; + char_u *name = *arg; + char_u *name_end = find_name_end(name, NULL, NULL, FNE_CHECK_START); + if (name_end == name) + { + emsg(_(e_missing_name_after_dot)); + return FAIL; + } + size_t len = name_end - name; + + gfargs_tab_T gfatab; + + generic_func_args_table_init(&gfatab); + + if (*name_end == '<') + { + // generic method call + name_end = parse_generic_func_type_args(name, len, name_end, + &gfatab, cctx); + if (name_end == NULL) + return FAIL; + } + + if (*name_end == '(') + { + int function_count; + int child_count; + ufunc_T **functions; + + if (type->tt_type == VAR_CLASS) + { + function_count = cl->class_class_function_count; + child_count = cl->class_class_function_count_child; + functions = cl->class_class_functions; + } + else + { + // type->tt_type == VAR_OBJECT: method call + // When compiling Func and doing "super.SomeFunc()", must be in the + // class context that defines Func. + if (is_super) + cl = cctx->ctx_ufunc->uf_defclass; + + function_count = cl->class_obj_method_count; + child_count = cl->class_obj_method_count_child; + functions = cl->class_obj_methods; + } + + ufunc_T *ufunc = NULL; + int fi; + for (fi = is_super ? child_count : 0; fi < function_count; ++fi) + { + ufunc_T *fp = functions[fi]; + // Use a separate pointer to avoid that ASAN complains about + // uf_name[] only being 4 characters. + char_u *ufname = (char_u *)fp->uf_name; + if (STRNCMP(name, ufname, len) == 0 && ufname[len] == NUL) + { + ufunc = fp; + break; + } + } + + ocmember_T *ocm = NULL; + if (ufunc == NULL) + { + // could be a funcref in a member variable + ocm = member_lookup(cl, type->tt_type, name, len, &m_idx); + if (ocm == NULL || ocm->ocm_type->tt_type != VAR_FUNC) + { + method_not_found_msg(cl, type->tt_type, name, len); + goto done; + } + if (type->tt_type == VAR_CLASS) + { + // Remove the class type from the stack + --cctx->ctx_type_stack.ga_len; + if (generate_CLASSMEMBER(cctx, TRUE, cl, m_idx) == FAIL) + goto done; + } + else + { + int status; + + if (IS_INTERFACE(cl)) + status = generate_GET_ITF_MEMBER(cctx, cl, m_idx, + ocm->ocm_type); + else + status = generate_GET_OBJ_MEMBER(cctx, m_idx, + ocm->ocm_type); + if (status == FAIL) + goto done; + } + } + + if (is_super && ufunc != NULL && IS_ABSTRACT_METHOD(ufunc)) + { + // Trying to invoke an abstract method in a super class is not + // allowed. + semsg(_(e_abstract_method_str_direct), ufunc->uf_name, + ufunc->uf_defclass->class_name.string); + goto done; + } + + // A private object method can be used only inside the class where it + // is defined or in one of the child classes. + // A private class method can be used only in the class where it is + // defined. + if (ocm == NULL && *ufunc->uf_name == '_' && + ((type->tt_type == VAR_OBJECT + && !inside_class_hierarchy(cctx, cl)) + || (type->tt_type == VAR_CLASS + && cctx->ctx_ufunc->uf_defclass != cl))) + { + semsg(_(e_cannot_access_protected_method_str), name); + goto done; + } + + // process generic function call + if (ufunc != NULL) + { + ufunc = generic_func_get(ufunc, &gfatab); + if (ufunc == NULL) + goto done; + } + + // Compile the arguments and call the class function or object method. + // The object method will know that the object is on the stack, just + // before the arguments. + *arg = skipwhite(name_end + 1); + int argcount = 0; + if (compile_arguments(arg, cctx, &argcount, CA_NOT_SPECIAL) == FAIL) + goto done; + + if (ocm != NULL) + { + ret = generate_PCALL(cctx, argcount, name, ocm->ocm_type, TRUE); + goto done; + } + if (type->tt_type == VAR_OBJECT + && (cl->class_flags & (CLASS_INTERFACE | CLASS_EXTENDED))) + ret = generate_CALL(cctx, ufunc, cl, fi, argcount, is_super); + else + ret = generate_CALL(cctx, ufunc, NULL, 0, argcount, FALSE); + goto done; + } + + if (type->tt_type == VAR_OBJECT) + { + ocmember_T *m = object_member_lookup(cl, name, len, &m_idx); + if (m_idx >= 0) + { + if (*name == '_' && !inside_class(cctx, cl)) + { + emsg_var_cl_define(e_cannot_access_protected_variable_str, + m->ocm_name.string, 0, cl); + goto done; + } + + *arg = name_end; + if (cl->class_flags & (CLASS_INTERFACE | CLASS_EXTENDED)) + ret = generate_GET_ITF_MEMBER(cctx, cl, m_idx, m->ocm_type); + else + ret = generate_GET_OBJ_MEMBER(cctx, m_idx, m->ocm_type); + goto done; + } + + // Could be an object method reference: "obj.Func". + m_idx = object_method_idx(cl, name, len); + if (m_idx >= 0) + { + ufunc_T *fp = cl->class_obj_methods[m_idx]; + // Private object methods are not accessible outside the class + if (*name == '_' && !inside_class(cctx, cl)) + { + semsg(_(e_cannot_access_protected_method_str), fp->uf_name); + goto done; + } + *arg = name_end; + // Remove the object type from the stack + --cctx->ctx_type_stack.ga_len; + ret = generate_FUNCREF(cctx, fp, cl, TRUE, m_idx, NULL); + goto done; + } + + member_not_found_msg(cl, VAR_OBJECT, name, len); + } + else + { + // load class member + int idx; + ocmember_T *m = class_member_lookup(cl, name, len, &idx); + if (m != NULL) + { + // Note: type->tt_type = VAR_CLASS + // A private class variable can be accessed only in the class where + // it is defined. + if (*name == '_' && cctx->ctx_ufunc->uf_class != cl) + { + emsg_var_cl_define(e_cannot_access_protected_variable_str, + m->ocm_name.string, 0, cl); + goto done; + } + + *arg = name_end; + // Remove the class type from the stack + --cctx->ctx_type_stack.ga_len; + ret = generate_CLASSMEMBER(cctx, TRUE, cl, idx); + goto done; + } + + // Could be a class method reference: "class.Func". + m_idx = class_method_idx(cl, name, len); + if (m_idx >= 0) + { + ufunc_T *fp = cl->class_class_functions[m_idx]; + // Private class methods are not accessible outside the class + if (*name == '_' && !inside_class(cctx, cl)) + { + semsg(_(e_cannot_access_protected_method_str), fp->uf_name); + goto done; + } + *arg = name_end; + // Remove the class type from the stack + --cctx->ctx_type_stack.ga_len; + ret = generate_FUNCREF(cctx, fp, cl, FALSE, m_idx, NULL); + goto done; + } + + member_not_found_msg(cl, VAR_CLASS, name, len); + } + +done: + generic_func_args_table_clear(&gfatab); + return ret; +} + +/* + * Generate an instruction to load script-local variable "name", without the + * leading "s:". + * Also finds imported variables. + */ + int +compile_load_scriptvar( + cctx_T *cctx, + char_u *name, // variable NUL terminated + char_u *start, // start of variable + char_u **end, // end of variable, may be NULL + imported_T *import) // found imported item, can be NULL +{ + scriptitem_T *si; + int idx; + imported_T *imp; + + if (!SCRIPT_ID_VALID(current_sctx.sc_sid)) + return FAIL; + si = SCRIPT_ITEM(current_sctx.sc_sid); + idx = get_script_item_idx(current_sctx.sc_sid, name, 0, cctx, NULL); + if (idx >= 0) + { + svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx; + + generate_MNV9SCRIPT(cctx, ISN_LOADSCRIPT, + current_sctx.sc_sid, idx, sv->sv_type); + return OK; + } + + if (end == NULL) + imp = NULL; + else if (import == NULL) + imp = find_imported(name, 0, FALSE); + else + imp = import; + + if (imp != NULL) + { + char_u *p = skipwhite(*end); + char_u *exp_name; + int cc; + ufunc_T *ufunc = NULL; + type_T *type; + int done = FALSE; + int res = OK; + + check_script_symlink(imp->imp_sid); + import_check_sourced_sid(&imp->imp_sid); + + // Need to lookup the member. + if (*p != '.') + { + semsg(_(e_expected_dot_after_name_str), start); + return FAIL; + } + ++p; + if (MNV_ISWHITE(*p)) + { + emsg(_(e_no_white_space_allowed_after_dot)); + return FAIL; + } + + // isolate one name + exp_name = p; + while (eval_isnamec(*p)) + ++p; + cc = *p; + *p = NUL; + + si = SCRIPT_ITEM(imp->imp_sid); + if (si->sn_import_autoload && si->sn_state == SN_STATE_NOT_LOADED) + // "import autoload './dir/script.mnv'" or + // "import autoload './autoload/script.mnv'" - load script first + res = generate_SOURCE(cctx, imp->imp_sid); + + if (res == OK) + { + if (si->sn_autoload_prefix != NULL + && si->sn_state == SN_STATE_NOT_LOADED) + { + char_u *auto_name = + concat_str(si->sn_autoload_prefix, exp_name); + + // autoload script must be loaded later, access by the autoload + // name. If a '(' follows it must be a function. Otherwise we + // don't know, it can be "script.Func". + if (cc == '(' || paren_follows_after_expr) + res = generate_PUSHFUNC(cctx, auto_name, &t_func_any, TRUE); + else + res = generate_AUTOLOAD(cctx, auto_name, &t_any); + mnv_free(auto_name); + done = TRUE; + } + else if (si->sn_import_autoload + && si->sn_state == SN_STATE_NOT_LOADED) + { + // If a '(' follows it must be a function. Otherwise we don't + // know, it can be "script.Func". + if (cc == '(' || paren_follows_after_expr) + { + char_u sid_name[MAX_FUNC_NAME_LEN]; + + func_name_with_sid(exp_name, imp->imp_sid, sid_name); + res = generate_PUSHFUNC(cctx, sid_name, &t_func_any, TRUE); + } + else + res = generate_OLDSCRIPT(cctx, ISN_LOADEXPORT, exp_name, + imp->imp_sid, &t_any); + done = TRUE; + } + else + { + idx = find_exported(imp->imp_sid, exp_name, &ufunc, &type, + cctx, NULL, TRUE); + } + } + + *p = cc; + *end = p; + if (done) + return res; + + if (idx < 0) + { + if (ufunc != NULL) + { + gfargs_tab_T gfatab; + + generic_func_args_table_init(&gfatab); + + if (IS_GENERIC_FUNC(ufunc)) + { + if (*p == '<') + { + // generic function call + p = parse_generic_func_type_args(name, STRLEN(name), p, + &gfatab, cctx); + if (p != NULL) + { + *end = p; + + // generic function call + ufunc = generic_func_get(ufunc, &gfatab); + } + + generic_func_args_table_clear(&gfatab); + + if (p == NULL || ufunc == NULL) + return FAIL; + } + else + { + emsg_funcname(e_generic_func_missing_type_args_str, + name); + return FAIL; + } + } + else if (*p == '<') + { + emsg_funcname(e_not_a_generic_function_str, name); + return FAIL; + } + + // function call or function reference + generate_PUSHFUNC(cctx, ufunc->uf_name, NULL, TRUE); + return OK; + } + return FAIL; + } + + generate_MNV9SCRIPT(cctx, ISN_LOADSCRIPT, + imp->imp_sid, + idx, + type); + return OK; + } + + // Can only get here if we know "name" is a script variable and not in a + // MNV9 script (variable is not in sn_var_vals): old style script. + return generate_OLDSCRIPT(cctx, ISN_LOADS, name, current_sctx.sc_sid, + &t_any); +} + + static int +generate_funcref( + cctx_T *cctx, + char_u *name, + gfargs_tab_T *gfatab, + int has_g_prefix) +{ + ufunc_T *ufunc = find_func(name, FALSE); + compiletype_T compile_type; + + // Reject a global non-autoload function found without the "g:" prefix. + if (ufunc == NULL || (!has_g_prefix && func_requires_g_prefix(ufunc))) + return FAIL; + + // process generic function call + ufunc = generic_func_get(ufunc, gfatab); + if (ufunc == NULL) + return FAIL; + + // Need to compile any default values to get the argument types. + compile_type = get_compile_type(ufunc); + if (func_needs_compiling(ufunc, compile_type) + && compile_def_function(ufunc, TRUE, compile_type, NULL) == FAIL) + return FAIL; + return generate_PUSHFUNC(cctx, ufunc->uf_name, ufunc->uf_func_type, TRUE); +} + +/* + * Returns TRUE if compiling a class method. + */ + static int +compiling_a_class_method(cctx_T *cctx) +{ + // For an object method, the FC_OBJECT flag will be set. + // For a constructor method, the FC_NEW flag will be set. + // Excluding these methods, the others are class methods. + // When compiling a closure function inside an object method, + // cctx->ctx_outer->ctx_func will point to the object method. + return cctx->ctx_ufunc != NULL + && (cctx->ctx_ufunc->uf_flags & (FC_OBJECT|FC_NEW)) == 0 + && (cctx->ctx_outer == NULL + || cctx->ctx_outer->ctx_ufunc == NULL + || cctx->ctx_outer->ctx_ufunc->uf_class == NULL + || (cctx->ctx_outer->ctx_ufunc->uf_flags + & (FC_OBJECT|FC_NEW)) == 0); +} + +/* + * Compile a variable name into a load instruction. + * "end" points to just after the name. + * "is_expr" is TRUE when evaluating an expression, might be a funcref. + * When "error" is FALSE do not give an error when not found. + */ + int +compile_load( + char_u **arg, + size_t namelen, + char_u *end_arg, + cctx_T *cctx, + int is_expr, + int error) +{ + type_T *type; + char_u *name = NULL; + char_u *end = end_arg; + int res = FAIL; + int prev_called_emsg = called_emsg; + gfargs_tab_T gfatab; + + generic_func_args_table_init(&gfatab); + + if (*(*arg + namelen) == '<') + { + // generic function call + if (parse_generic_func_type_args(*arg, namelen, + *arg + namelen, &gfatab, cctx) == NULL) + return FAIL; + *(*arg + namelen) = NUL; + } + + if (*(*arg + 1) == ':') + { + if (end <= *arg + 2) + { + isntype_T isn_type; + + // load dictionary of namespace + switch (**arg) + { + case 'g': isn_type = ISN_LOADGDICT; break; + case 'w': isn_type = ISN_LOADWDICT; break; + case 't': isn_type = ISN_LOADTDICT; break; + case 'b': isn_type = ISN_LOADBDICT; break; + default: + semsg(_(e_namespace_not_supported_str), *arg); + goto theend; + } + if (generate_instr_type(cctx, isn_type, &t_dict_any) == NULL) + goto theend; + res = OK; + } + else + { + isntype_T isn_type = ISN_DROP; + + // load namespaced variable + name = mnv_strnsave(*arg + 2, end - (*arg + 2)); + if (name == NULL) + goto theend; + + switch (**arg) + { + case 'v': res = generate_LOADV(cctx, name); + break; + case 's': if (current_script_is_mnv9()) + { + semsg(_(e_cannot_use_s_colon_in_mnv9_script_str), + *arg); + goto theend; + } + if (is_expr && find_func(name, FALSE) != NULL) + res = generate_funcref(cctx, name, &gfatab, FALSE); + else + res = compile_load_scriptvar(cctx, name, + NULL, &end, NULL); + break; + case 'g': if (mnv_strchr(name, AUTOLOAD_CHAR) == NULL) + { + if (is_expr && ASCII_ISUPPER(*name) + && (find_func(name, FALSE) != NULL + || gfatab.gfat_args.ga_len > 0)) + res = generate_funcref(cctx, name, &gfatab, + TRUE); + else + isn_type = ISN_LOADG; + } + else + { + isn_type = ISN_LOADAUTO; + mnv_free(name); + name = mnv_strnsave(*arg, end - *arg); + if (name == NULL) + goto theend; + } + break; + case 'w': isn_type = ISN_LOADW; break; + case 't': isn_type = ISN_LOADT; break; + case 'b': isn_type = ISN_LOADB; break; + default: // cannot happen, just in case + semsg(_(e_namespace_not_supported_str), *arg); + goto theend; + } + if (isn_type != ISN_DROP) + { + // Global, Buffer-local, Window-local and Tabpage-local + // variables can be defined later, thus we don't check if it + // exists, give an error at runtime. + res = generate_LOAD(cctx, isn_type, 0, name, &t_any); + } + } + } + else + { + int idx; + int method_idx; + int gen_load = FALSE; + int gen_load_outer = 0; + int outer_loop_depth = -1; + int outer_loop_idx = -1; + + name = mnv_strnsave(*arg, namelen); + if (name == NULL) + goto theend; + + if (STRCMP(name, "super") == 0 && compiling_a_class_method(cctx)) + { + // super.SomeFunc() in a class function: push &t_super type, this + // is recognized in compile_subscript(). + res = push_type_stack(cctx, &t_super); + if (*end != '.') + emsg(_(e_super_must_be_followed_by_dot)); + } + else if (mnv_strchr(name, AUTOLOAD_CHAR) != NULL) + { + script_autoload(name, FALSE); + res = generate_LOAD(cctx, ISN_LOADAUTO, 0, name, &t_any); + } + else if (arg_exists(*arg, namelen, &idx, &type, &gen_load_outer, cctx) + == OK) + { + if (gen_load_outer == 0) + gen_load = TRUE; + } + else + { + lvar_T lvar; + class_T *cl = NULL; + + if (lookup_local(*arg, namelen, &lvar, cctx) == OK) + { + type = lvar.lv_type; + idx = lvar.lv_idx; + if (lvar.lv_from_outer != 0) + { + gen_load_outer = lvar.lv_from_outer; + outer_loop_depth = lvar.lv_loop_depth; + outer_loop_idx = lvar.lv_loop_idx; + } + else + gen_load = TRUE; + } + else if (cctx->ctx_ufunc->uf_defclass != NULL && + (((idx = + cctx_class_member_idx(cctx, *arg, namelen, &cl)) >= 0) + || ((method_idx = + cctx_class_method_idx(cctx, *arg, namelen, &cl)) >= 0))) + { + // Referencing a class variable or method without the class + // name. A class variable or method can be referenced without + // the class name only in the class where the function is + // defined. + if (cctx->ctx_ufunc->uf_defclass == cl) + { + if (idx >= 0) + res = generate_CLASSMEMBER(cctx, TRUE, cl, idx); + else + { + ufunc_T *fp = cl->class_class_functions[method_idx]; + res = generate_FUNCREF(cctx, fp, cl, FALSE, method_idx, + NULL); + } + } + else + { + semsg(_(e_class_variable_str_accessible_only_inside_class_str), + name, cl->class_name.string); + res = FAIL; + } + } + else + { + imported_T *imp = NULL; + + // "var" can be script-local even without using "s:" if it + // already exists in a MNV9 script or when it's imported. + if (script_var_exists(*arg, namelen, cctx, NULL) == OK + || (imp = find_imported(name, 0, FALSE)) != NULL) + res = compile_load_scriptvar(cctx, name, *arg, &end, imp); + + // When evaluating an expression and the name starts with an + // uppercase letter it can be a user defined function. + // generate_funcref() will fail if the function can't be found. + if (res == FAIL && is_expr && ASCII_ISUPPER(*name)) + res = generate_funcref(cctx, name, &gfatab, FALSE); + } + } + if (gen_load) + res = generate_LOAD(cctx, ISN_LOAD, idx, NULL, type); + if (gen_load_outer > 0) + { + res = generate_LOADOUTER(cctx, idx, gen_load_outer, + outer_loop_depth, outer_loop_idx, type); + cctx->ctx_outer_used = TRUE; + } + } + + *arg = end; + +theend: + if (res == FAIL && error && called_emsg == prev_called_emsg) + semsg(_(e_variable_not_found_str), name); + mnv_free(name); + generic_func_args_table_clear(&gfatab); + return res; +} + +/* + * Compile a string in a ISN_PUSHS instruction into an ISN_INSTR. + * "str_offset" is the number of leading bytes to skip from the string. + * Returns FAIL if compilation fails. + */ + static int +compile_string(isn_T *isn, cctx_T *cctx, int str_offset) +{ + char_u *s = isn->isn_arg.string + str_offset; + garray_T save_ga = cctx->ctx_instr; + int expr_res; + int trailing_error; + int instr_count; + isn_T *instr = NULL; + + // Remove the string type from the stack. + --cctx->ctx_type_stack.ga_len; + + // Temporarily reset the list of instructions so that the jump labels are + // correct. + cctx->ctx_instr.ga_len = 0; + cctx->ctx_instr.ga_maxlen = 0; + cctx->ctx_instr.ga_data = NULL; + + // avoid peeking a next line + int galen_save = cctx->ctx_ufunc->uf_lines.ga_len; + cctx->ctx_ufunc->uf_lines.ga_len = 0; + + expr_res = compile_expr0(&s, cctx); + + cctx->ctx_ufunc->uf_lines.ga_len = galen_save; + + s = skipwhite(s); + trailing_error = *s != NUL; + + if (expr_res == FAIL || trailing_error + || GA_GROW_FAILS(&cctx->ctx_instr, 1)) + { + if (trailing_error) + semsg(_(e_trailing_characters_str), s); + clear_instr_ga(&cctx->ctx_instr); + cctx->ctx_instr = save_ga; + ++cctx->ctx_type_stack.ga_len; + return FAIL; + } + + // Move the generated instructions into the ISN_INSTR instruction, then + // restore the list of instructions. + instr_count = cctx->ctx_instr.ga_len; + instr = cctx->ctx_instr.ga_data; + instr[instr_count].isn_type = ISN_FINISH; + + cctx->ctx_instr = save_ga; + mnv_free(isn->isn_arg.string); + isn->isn_type = ISN_INSTR; + isn->isn_arg.instr = instr; + return OK; +} + +/* + * Compile the argument expressions. + * "arg" points to just after the "(" and is advanced to after the ")" + */ + int +compile_arguments( + char_u **arg, + cctx_T *cctx, + int *argcount, + ca_special_T special_fn) +{ + char_u *p = *arg; + char_u *whitep = *arg; + int must_end = FALSE; + int instr_count; + + for (;;) + { + if (may_get_next_line(whitep, &p, cctx) == FAIL) + goto failret; + if (*p == ')') + { + *arg = p + 1; + return OK; + } + if (must_end) + { + semsg(_(e_missing_comma_before_argument_str), p); + return FAIL; + } + + instr_count = cctx->ctx_instr.ga_len; + if (compile_expr0(&p, cctx) == FAIL) + return FAIL; + ++*argcount; + + if (special_fn == CA_SEARCHPAIR && *argcount == 5 + && cctx->ctx_instr.ga_len == instr_count + 1) + { + isn_T *isn = ((isn_T *)cctx->ctx_instr.ga_data) + instr_count; + + // {skip} argument of searchpair() can be compiled if not empty + if (isn->isn_type == ISN_PUSHS + && isn->isn_arg.string != NULL + && *isn->isn_arg.string != NUL) + compile_string(isn, cctx, 0); + } + else if (special_fn == CA_SUBSTITUTE && *argcount == 3 + && cctx->ctx_instr.ga_len == instr_count + 1) + { + isn_T *isn = ((isn_T *)cctx->ctx_instr.ga_data) + instr_count; + + // {sub} argument of substitute() can be compiled if it starts + // with \= + if (isn->isn_type == ISN_PUSHS + && isn->isn_arg.string != NULL + && isn->isn_arg.string[0] == '\\' + && isn->isn_arg.string[1] == '=') + compile_string(isn, cctx, 2); + } + + if (*p != ',' && *skipwhite(p) == ',') + { + semsg(_(e_no_white_space_allowed_before_str_str), ",", p); + return FAIL; + } + if (*p == ',') + { + ++p; + if (*p != NUL && !MNV_ISWHITE(*p)) + { + semsg(_(e_white_space_required_after_str_str), ",", p - 1); + return FAIL; + } + } + else + must_end = TRUE; + whitep = p; + p = skipwhite(p); + } +failret: + emsg(_(e_missing_closing_paren)); + return FAIL; +} + +/* + * Compile a builtin method call of an object (e.g. string(), len(), empty(), + * etc.) if the class implements it. + */ + static int +compile_builtin_method_call(cctx_T *cctx, class_builtin_T builtin_method) +{ + type_T *type = get_decl_type_on_stack(cctx, 0); + int res = FAIL; + + // If the built in function is invoked on an object and the class + // implements the corresponding built in method, then invoke the object + // method. + if (type->tt_type == VAR_OBJECT) + { + int method_idx; + ufunc_T *uf = class_get_builtin_method(type->tt_class, builtin_method, + &method_idx); + if (uf != NULL) + res = generate_CALL(cctx, uf, type->tt_class, method_idx, 0, FALSE); + } + + return res; +} + + +/* + * Compile a function call: name(arg1, arg2) + * "arg" points to "name", "arg + varlen" to the "(". + * "argcount_init" is 1 for "value->method()" + * Instructions: + * EVAL arg1 + * EVAL arg2 + * BCALL / DCALL / UCALL + */ + static int +compile_call( + char_u **arg, + size_t varlen, + cctx_T *cctx, + ppconst_T *ppconst, + int argcount_init) +{ + char_u *name = *arg; + char_u *p; + int argcount = argcount_init; + char_u namebuf[MAX_FUNC_NAME_LEN]; + char_u fname_buf[FLEN_FIXED + 1]; + char_u *tofree = NULL; + ufunc_T *ufunc = NULL; + int res = FAIL; + int is_autoload; + int has_g_namespace; + ca_special_T special_fn; + imported_T *import; + + if (varlen >= sizeof(namebuf)) + { + semsg(_(e_name_too_long_str), name); + return FAIL; + } + mnv_strncpy(namebuf, *arg, varlen); + + import = find_imported(name, varlen, FALSE); + if (import != NULL) + { + semsg(_(e_cannot_use_str_itself_it_is_imported), namebuf); + return FAIL; + } + + // We can evaluate "has('name')" at compile time. + // We can evaluate "len('string')" at compile time. + // We always evaluate "exists_compiled()" at compile time. + if ((varlen == 3 + && (STRNCMP(*arg, "has", 3) == 0 || STRNCMP(*arg, "len", 3) == 0)) + || (varlen == 15 && STRNCMP(*arg, "exists_compiled", 6) == 0)) + { + char_u *s = skipwhite(*arg + varlen + 1); + typval_T argvars[2]; + int is_has = **arg == 'h'; + int is_len = **arg == 'l'; + + argvars[0].v_type = VAR_UNKNOWN; + if (*s == '"') + (void)eval_string(&s, &argvars[0], TRUE, FALSE); + else if (*s == '\'') + (void)eval_lit_string(&s, &argvars[0], TRUE, FALSE); + s = skipwhite(s); + if (*s == ')' && argvars[0].v_type == VAR_STRING + && ((is_has && !dynamic_feature(argvars[0].vval.v_string)) + || !is_has)) + { + + *arg = s + 1; + + if (cctx->ctx_skip != SKIP_YES) + { + typval_T *tv = &ppconst->pp_tv[ppconst->pp_used]; + + argvars[1].v_type = VAR_UNKNOWN; + tv->v_type = VAR_NUMBER; + tv->vval.v_number = 0; + if (is_has) + f_has(argvars, tv); + else if (is_len) + f_len(argvars, tv); + else + f_exists(argvars, tv); + ++ppconst->pp_used; + } + clear_tv(&argvars[0]); + return OK; + } + clear_tv(&argvars[0]); + if (!is_has && !is_len) + { + emsg(_(e_argument_of_exists_compiled_must_be_literal_string)); + return FAIL; + } + } + + if (generate_ppconst(cctx, ppconst) == FAIL) + return FAIL; + + funcerror_T error; + name = fname_trans_sid(namebuf, fname_buf, &tofree, &error); + + // We handle the "skip" argument of searchpair() and searchpairpos() + // differently. + if ((varlen == 6 && STRNCMP(*arg, "search", 6) == 0) + || (varlen == 9 && STRNCMP(*arg, "searchpos", 9) == 0) + || (varlen == 10 && STRNCMP(*arg, "searchpair", 10) == 0) + || (varlen == 13 && STRNCMP(*arg, "searchpairpos", 13) == 0)) + special_fn = CA_SEARCHPAIR; + else if (varlen == 10 && STRNCMP(*arg, "substitute", 10) == 0) + special_fn = CA_SUBSTITUTE; + else + special_fn = CA_NOT_SPECIAL; + + gfargs_tab_T gfatab; + + generic_func_args_table_init(&gfatab); + + if (*(*arg + varlen) == '<') + { + // generic function + *arg = parse_generic_func_type_args(*arg, varlen, *arg + varlen, + &gfatab, cctx); + if (*arg == NULL) + goto theend; + ++*arg; // skip '(' + } + else + *arg += varlen + 1; + + if (compile_arguments(arg, cctx, &argcount, special_fn) == FAIL) + goto theend; + + is_autoload = mnv_strchr(name, AUTOLOAD_CHAR) != NULL; + if (ASCII_ISLOWER(*name) && name[1] != ':' && !is_autoload) + { + int idx; + + // builtin function + idx = find_internal_func(name); + if (idx >= 0) + { + if (STRCMP(name, "flatten") == 0) + { + emsg(_(e_cannot_use_flatten_in_mnv9_script)); + goto theend; + } + + if (STRCMP(name, "add") == 0 && argcount == 2) + { + type_T *type = get_decl_type_on_stack(cctx, 1); + if (check_type_is_value(get_type_on_stack(cctx, 0)) == FAIL) + goto theend; + + // add() can be compiled to instructions if we know the type + if (type->tt_type == VAR_LIST) + { + // inline "add(list, item)" so that the type can be checked + res = generate_LISTAPPEND(cctx); + idx = -1; + } + else if (type->tt_type == VAR_BLOB) + { + // inline "add(blob, nr)" so that the type can be checked + res = generate_BLOBAPPEND(cctx); + idx = -1; + } + } + + if ((STRCMP(name, "writefile") == 0 && argcount > 2) + || (STRCMP(name, "mkdir") == 0 && argcount > 1)) + { + // May have the "D" or "R" flag, reserve a variable for a + // deferred function call. + if (get_defer_var_idx(cctx) == 0) + idx = -1; + } + + class_builtin_T builtin_method = CLASS_BUILTIN_INVALID; + if (STRCMP(name, "string") == 0) + builtin_method = CLASS_BUILTIN_STRING; + else if (STRCMP(name, "empty") == 0) + builtin_method = CLASS_BUILTIN_EMPTY; + else if (STRCMP(name, "len") == 0) + builtin_method = CLASS_BUILTIN_LEN; + if (builtin_method != CLASS_BUILTIN_INVALID) + { + res = compile_builtin_method_call(cctx, builtin_method); + if (res == OK) + idx = -1; + } + + if (idx >= 0) + res = generate_BCALL(cctx, idx, argcount, argcount_init == 1); + } + else + emsg_funcname(e_unknown_function_str, namebuf); + goto theend; + } + + has_g_namespace = STRNCMP(namebuf, "g:", 2) == 0; + + // An argument or local variable can be a function reference, this + // overrules a function name. + if (lookup_local(namebuf, varlen, NULL, cctx) == FAIL + && arg_exists(namebuf, varlen, NULL, NULL, NULL, cctx) != OK) + { + class_T *cl = NULL; + int mi = 0; + + // If we can find the function by name generate the right call. + // Skip global functions here, a local funcref takes precedence. + ufunc = find_func(name, FALSE); + if (ufunc != NULL) + { + // process generic function call + ufunc = generic_func_get(ufunc, &gfatab); + if (ufunc == NULL) + goto theend; + + if (!func_is_global(ufunc)) + { + res = generate_CALL(cctx, ufunc, NULL, 0, argcount, FALSE); + goto theend; + } + if (!has_g_namespace + && mnv_strchr(ufunc->uf_name, AUTOLOAD_CHAR) == NULL + && !IS_GENERIC_FUNC(ufunc)) + { + // A function name without g: prefix must be found locally + // A generic function has the name emptied out. + emsg_funcname(e_unknown_function_str, namebuf); + goto theend; + } + } + else if ((mi = cctx_class_method_idx(cctx, name, varlen, &cl)) >= 0) + { + // Class method invocation without the class name. + // A class method can be referenced without the class name only in + // the class where the function is defined. + if (cctx->ctx_ufunc->uf_defclass == cl) + { + res = generate_CALL(cctx, cl->class_class_functions[mi], NULL, + 0, argcount, FALSE); + } + else + { + semsg(_(e_class_method_str_accessible_only_inside_class_str), + name, cl->class_name.string); + res = FAIL; + } + goto theend; + } + } + + // If the name is a variable, load it and use PCALL. + // Not for g:Func(), we don't know if it is a variable or not. + // Not for some#Func(), it will be loaded later. + p = namebuf; + if (!has_g_namespace && !is_autoload + && compile_load(&p, varlen, namebuf + varlen, cctx, FALSE, FALSE) == OK) + { + type_T *s_type = get_type_on_stack(cctx, 0); + + res = generate_PCALL(cctx, argcount, namebuf, s_type, FALSE); + goto theend; + } + + // If we can find a global function by name generate the right call. + if (ufunc != NULL) + { + res = generate_CALL(cctx, ufunc, NULL, 0, argcount, FALSE); + goto theend; + } + + // A global function may be defined only later. Need to figure out at + // runtime. Also handles a FuncRef at runtime. + if (has_g_namespace || is_autoload) + res = generate_UCALL(cctx, name, argcount); + else + emsg_funcname(e_unknown_function_str, namebuf); + +theend: + generic_func_args_table_clear(&gfatab); + mnv_free(tofree); + return res; +} + +// like NAMESPACE_CHAR but with 'a' and 'l'. +#define MNV9_NAMESPACE_CHAR (char_u *)"bgstvw" + +/* + * Find the end of a variable or function name. Unlike find_name_end() this + * does not recognize magic braces. + * When "use_namespace" is TRUE recognize "b:", "s:", etc. + * Return a pointer to just after the name. Equal to "arg" if there is no + * valid name. + */ + char_u * +to_name_end(char_u *arg, int use_namespace) +{ + char_u *p; + + // Quick check for valid starting character. + if (!eval_isnamec1(*arg)) + return arg; + + for (p = arg + 1; *p != NUL && eval_isnamec(*p); MB_PTR_ADV(p)) + // Include a namespace such as "s:var" and "v:var". But "n:" is not + // and can be used in slice "[n:]". + if (*p == ':' && (p != arg + 1 + || !use_namespace + || mnv_strchr(MNV9_NAMESPACE_CHAR, *arg) == NULL)) + break; + return p; +} + +/* + * Like to_name_end() but also skip over a list or dict constant. + * Also accept "123_Func". + * This intentionally does not handle line continuation. + */ + char_u * +to_name_const_end(char_u *arg) +{ + char_u *p = arg; + typval_T rettv; + + if (STRNCMP(p, "", 5) == 0) + p = skipdigits(p + 5); + p = to_name_end(p, TRUE); + if (p == arg && *arg == '[') + { + + // Can be "[1, 2, 3]->Func()". + if (eval_list(&p, &rettv, NULL, FALSE) == FAIL) + p = arg; + } + return p; +} + +/* + * parse a list: [expr, expr] + * "*arg" points to the '['. + * ppconst->pp_is_const is set if all items are a constant. + */ + static int +compile_list(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) +{ + char_u *p = skipwhite(*arg + 1); + char_u *whitep = *arg + 1; + int count = 0; + int is_const; + int is_all_const = TRUE; // reset when non-const encountered + int must_end = FALSE; + + for (;;) + { + if (may_get_next_line(whitep, &p, cctx) == FAIL) + { + semsg(_(e_missing_end_of_list_rsb_str), *arg); + return FAIL; + } + if (*p == ',') + { + semsg(_(e_no_white_space_allowed_before_str_str), ",", p); + return FAIL; + } + if (*p == ']') + { + ++p; + break; + } + if (must_end) + { + semsg(_(e_missing_comma_in_list_str), p); + return FAIL; + } + if (compile_expr0_ext(&p, cctx, &is_const) == FAIL) + return FAIL; + if (!is_const) + is_all_const = FALSE; + ++count; + if (*p == ',') + { + ++p; + if (*p != ']' && !IS_WHITE_OR_NUL(*p)) + { + semsg(_(e_white_space_required_after_str_str), ",", p - 1); + return FAIL; + } + } + else + must_end = TRUE; + whitep = p; + p = skipwhite(p); + } + *arg = p; + + ppconst->pp_is_const = is_all_const; + return generate_NEWLIST(cctx, count, FALSE); +} + +/* + * parse a tuple: (expr, expr) + * "*arg" points to the ','. + * ppconst->pp_is_const is set if all the items are constants. + */ + static int +compile_tuple( + char_u **arg, + cctx_T *cctx, + ppconst_T *ppconst, + int first_item_const) +{ + char_u *p = *arg + 1; + char_u *whitep = *arg + 1; + int count = 0; + int is_const; + int is_all_const = TRUE; // reset when non-const encountered + int must_end = FALSE; + + if (**arg != ')') + { + if (*p != ')' && !IS_WHITE_OR_NUL(*p)) + { + semsg(_(e_white_space_required_after_str_str), ",", p - 1); + return FAIL; + } + count = 1; // the first tuple item is already processed + is_all_const = first_item_const; + for (;;) + { + if (may_get_next_line(whitep, &p, cctx) == FAIL) + { + semsg(_(e_missing_end_of_tuple_rsp_str), *arg); + return FAIL; + } + if (*p == ',') + { + semsg(_(e_no_white_space_allowed_before_str_str), ",", p); + return FAIL; + } + if (*p == ')') + { + ++p; + break; + } + if (must_end) + { + semsg(_(e_missing_comma_in_tuple_str), p); + return FAIL; + } + if (compile_expr0_ext(&p, cctx, &is_const) == FAIL) + return FAIL; + if (!is_const) + is_all_const = FALSE; + ++count; + if (*p == ',') + { + ++p; + if (*p != ')' && !IS_WHITE_OR_NUL(*p)) + { + semsg(_(e_white_space_required_after_str_str), ",", p - 1); + return FAIL; + } + } + else + must_end = TRUE; + whitep = p; + p = skipwhite(p); + } + } + *arg = p; + + ppconst->pp_is_const = is_all_const; + return generate_NEWTUPLE(cctx, count, FALSE); +} + +/* + * Parse a lambda: "(arg, arg) => expr" + * "*arg" points to the '('. + * Returns OK/FAIL when a lambda is recognized, NOTDONE if it's not a lambda. + */ + int +compile_lambda(char_u **arg, cctx_T *cctx) +{ + int r; + typval_T rettv; + ufunc_T *ufunc; + evalarg_T evalarg; + + init_evalarg(&evalarg); + evalarg.eval_flags = EVAL_EVALUATE; + evalarg.eval_cctx = cctx; + + // Get the funcref in "rettv". + r = get_lambda_tv(arg, &rettv, TRUE, &evalarg, cctx); + if (r != OK) + { + clear_evalarg(&evalarg, NULL); + return r; + } + + // "rettv" will now be a partial referencing the function. + ufunc = rettv.vval.v_partial->pt_func; + ++ufunc->uf_refcount; + clear_tv(&rettv); + + if (cctx->ctx_ufunc != NULL) + // This lambda might be defined in a class method. Inherit the class + // from the current function. + ufunc->uf_defclass = cctx->ctx_ufunc->uf_defclass; + + // Compile it here to get the return type. The return type is optional, + // when it's missing use t_unknown. This is recognized in + // compile_return(). + if (ufunc->uf_ret_type->tt_type == VAR_VOID) + ufunc->uf_ret_type = &t_unknown; + compile_def_function(ufunc, FALSE, cctx->ctx_compile_type, cctx); + + // When the outer function is compiled for profiling or debugging, the + // lambda may be called without profiling or debugging. Compile it here in + // the right context. + if (cctx->ctx_compile_type == CT_DEBUG +#ifdef FEAT_PROFILE + || cctx->ctx_compile_type == CT_PROFILE +#endif + ) + compile_def_function(ufunc, FALSE, CT_NONE, cctx); + + // if the outer function is not compiled for debugging or profiling, this + // one might be + if (cctx->ctx_compile_type == CT_NONE) + { + compiletype_T compile_type = get_compile_type(ufunc); + + if (compile_type != CT_NONE) + compile_def_function(ufunc, FALSE, compile_type, cctx); + } + + // The last entry in evalarg.eval_tofree_ga is a copy of the last line and + // "*arg" may point into it. Point into the original line to avoid a + // dangling pointer. + if (evalarg.eval_using_cmdline) + { + garray_T *gap = &evalarg.eval_tofree_ga; + size_t off = *arg - ((char_u **)gap->ga_data)[gap->ga_len - 1]; + + *arg = ((char_u **)cctx->ctx_ufunc->uf_lines.ga_data)[cctx->ctx_lnum] + + off; + evalarg.eval_using_cmdline = FALSE; + } + + clear_evalarg(&evalarg, NULL); + + if (ufunc->uf_def_status == UF_COMPILED) + { + // The return type will now be known. + set_function_type(ufunc); + + // The function reference count will be 1. When the ISN_FUNCREF + // instruction is deleted the reference count is decremented and the + // function is freed. + return generate_FUNCREF(cctx, ufunc, NULL, FALSE, 0, NULL); + } + + func_ptr_unref(ufunc); + return FAIL; +} + +/* + * Get a lambda and compile it. Uses MNV9 syntax. + */ + int +get_lambda_tv_and_compile( + char_u **arg, + typval_T *rettv, + int types_optional, + evalarg_T *evalarg) +{ + int r; + ufunc_T *ufunc; + int save_sc_version = current_sctx.sc_version; + + // Get the funcref in "rettv". + current_sctx.sc_version = SCRIPT_VERSION_MNV9; + r = get_lambda_tv(arg, rettv, types_optional, evalarg, NULL); + current_sctx.sc_version = save_sc_version; + if (r != OK) + return r; // currently unreachable + + // "rettv" will now be a partial referencing the function. + ufunc = rettv->vval.v_partial->pt_func; + + // Compile it here to get the return type. The return type is optional, + // when it's missing use t_unknown. This is recognized in + // compile_return(). + if (ufunc->uf_ret_type == NULL || ufunc->uf_ret_type->tt_type == VAR_VOID) + ufunc->uf_ret_type = &t_unknown; + compile_def_function(ufunc, FALSE, CT_NONE, NULL); + + if (ufunc->uf_def_status == UF_COMPILED) + { + // The return type will now be known. + set_function_type(ufunc); + return OK; + } + clear_tv(rettv); + return FAIL; +} + +/* + * parse a dict: {key: val, [key]: val} + * "*arg" points to the '{'. + * ppconst->pp_is_const is set if all item values are a constant. + */ + static int +compile_dict(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) +{ + garray_T *instr = &cctx->ctx_instr; + int count = 0; + dict_T *d = dict_alloc(); + dictitem_T *item; + char_u *whitep = *arg + 1; + char_u *p; + int is_const; + int is_all_const = TRUE; // reset when non-const encountered + + if (d == NULL) + return FAIL; + if (generate_ppconst(cctx, ppconst) == FAIL) + { + dict_unref(d); + return FAIL; + } + for (;;) + { + char_u *key = NULL; + + if (may_get_next_line(whitep, arg, cctx) == FAIL) + { + *arg = NULL; + goto failret; + } + + if (**arg == '}') + break; + + if (**arg == '[') + { + isn_T *isn; + + // {[expr]: value} uses an evaluated key. + *arg = skipwhite(*arg + 1); + if (compile_expr0(arg, cctx) == FAIL) + return FAIL; + isn = ((isn_T *)instr->ga_data) + instr->ga_len - 1; + if (isn->isn_type == ISN_PUSHNR) + { + char buf[NUMBUFLEN]; + + // Convert to string at compile time. + mnv_snprintf(buf, NUMBUFLEN, "%lld", isn->isn_arg.number); + isn->isn_type = ISN_PUSHS; + isn->isn_arg.string = mnv_strsave((char_u *)buf); + } + if (isn->isn_type == ISN_PUSHS) + key = isn->isn_arg.string; + else if (may_generate_2STRING(-1, TOSTRING_NONE, cctx) == FAIL) + return FAIL; + *arg = skipwhite(*arg); + if (**arg != ']') + { + emsg(_(e_missing_matching_bracket_after_dict_key)); + return FAIL; + } + ++*arg; + } + else + { + // {"name": value}, + // {'name': value}, + // {name: value} use "name" as a literal key + key = get_literal_key(arg); + if (key == NULL) + return FAIL; + if (generate_PUSHS(cctx, &key) == FAIL) + return FAIL; + } + + // Check for duplicate keys, if using string keys. + if (key != NULL) + { + item = dict_find(d, key, -1); + if (item != NULL) + { + semsg(_(e_duplicate_key_in_dictionary_str), key); + goto failret; + } + item = dictitem_alloc(key); + if (item != NULL) + { + item->di_tv.v_type = VAR_UNKNOWN; + item->di_tv.v_lock = 0; + if (dict_add(d, item) == FAIL) + dictitem_free(item); + } + } + + if (**arg != ':') + { + if (*skipwhite(*arg) == ':') + semsg(_(e_no_white_space_allowed_before_str_str), ":", *arg); + else + semsg(_(e_missing_colon_in_dictionary_str), *arg); + return FAIL; + } + whitep = *arg + 1; + if (!IS_WHITE_OR_NUL(*whitep)) + { + semsg(_(e_white_space_required_after_str_str), ":", *arg); + return FAIL; + } + + if (may_get_next_line(whitep, arg, cctx) == FAIL) + { + *arg = NULL; + goto failret; + } + + if (compile_expr0_ext(arg, cctx, &is_const) == FAIL) + return FAIL; + if (!is_const) + is_all_const = FALSE; + ++count; + + whitep = *arg; + if (may_get_next_line(whitep, arg, cctx) == FAIL) + { + *arg = NULL; + goto failret; + } + if (**arg == '}') + break; + if (**arg != ',') + { + semsg(_(e_missing_comma_in_dictionary_str), *arg); + goto failret; + } + if (IS_WHITE_OR_NUL(*whitep)) + { + semsg(_(e_no_white_space_allowed_before_str_str), ",", whitep); + return FAIL; + } + whitep = *arg + 1; + if (!IS_WHITE_OR_NUL(*whitep)) + { + semsg(_(e_white_space_required_after_str_str), ",", *arg); + return FAIL; + } + *arg = skipwhite(whitep); + } + + *arg = *arg + 1; + + // Allow for following comment, after at least one space. + p = skipwhite(*arg); + if (MNV_ISWHITE(**arg) && mnv9_comment_start(p)) + *arg += STRLEN(*arg); + + dict_unref(d); + ppconst->pp_is_const = is_all_const; + return generate_NEWDICT(cctx, count, FALSE); + +failret: + if (*arg == NULL) + { + semsg(_(e_missing_dict_end_str), _("[end of lines]")); + *arg = (char_u *)""; + } + dict_unref(d); + return FAIL; +} + +/* + * Compile "&option". + */ + static int +compile_get_option(char_u **arg, cctx_T *cctx) +{ + typval_T rettv; + char_u *start = *arg; + int ret; + + // parse the option and get the current value to get the type. + rettv.v_type = VAR_UNKNOWN; + ret = eval_option(arg, &rettv, TRUE); + if (ret == OK) + { + // include the '&' in the name, eval_option() expects it. + char_u *name = mnv_strnsave(start, *arg - start); + type_T *type = rettv.v_type == VAR_BOOL ? &t_bool + : rettv.v_type == VAR_NUMBER ? &t_number : &t_string; + + ret = generate_LOAD(cctx, ISN_LOADOPT, 0, name, type); + mnv_free(name); + } + clear_tv(&rettv); + + return ret; +} + +/* + * Compile "$VAR". + */ + static int +compile_get_env(char_u **arg, cctx_T *cctx) +{ + char_u *start = *arg; + int len; + int ret; + char_u *name; + + ++*arg; + len = get_env_len(arg); + if (len == 0) + { + semsg(_(e_syntax_error_at_str), start); + return FAIL; + } + + // include the '$' in the name, eval_env_var() expects it. + name = mnv_strnsave(start, len + 1); + ret = generate_LOAD(cctx, ISN_LOADENV, 0, name, &t_string); + mnv_free(name); + return ret; +} + +/* + * Compile $"string" or $'string'. + */ + static int +compile_interp_string(char_u **arg, cctx_T *cctx) +{ + typval_T tv; + int ret; + int quote; + int evaluate = cctx->ctx_skip != SKIP_YES; + int count = 0; + char_u *p; + + // *arg is on the '$' character, move it to the first string character. + ++*arg; + quote = **arg; + ++*arg; + + for (;;) + { + // Get the string up to the matching quote or to a single '{'. + // "arg" is advanced to either the quote or the '{'. + if (quote == '"') + ret = eval_string(arg, &tv, evaluate, TRUE); + else + ret = eval_lit_string(arg, &tv, evaluate, TRUE); + if (ret == FAIL) + break; + if (evaluate) + { + if ((tv.vval.v_string != NULL && *tv.vval.v_string != NUL) + || (**arg != '{' && count == 0)) + { + // generate non-empty string or empty string if it's the only + // one + if (generate_PUSHS(cctx, &tv.vval.v_string) == FAIL) + return FAIL; + tv.vval.v_string = NULL; // don't free it now + ++count; + } + clear_tv(&tv); + } + + if (**arg != '{') + { + // found terminating quote + ++*arg; + break; + } + + p = compile_one_expr_in_str(*arg, cctx); + if (p == NULL) + { + ret = FAIL; + break; + } + ++count; + *arg = p; + } + + if (ret == FAIL || !evaluate) + return ret; + + // Small optimization, if there's only a single piece skip the ISN_CONCAT. + if (count > 1) + return generate_CONCAT(cctx, count); + + return OK; +} + +/* + * Compile "@r". + */ + static int +compile_get_register(char_u **arg, cctx_T *cctx) +{ + int ret; + + ++*arg; + if (**arg == NUL) + { + semsg(_(e_syntax_error_at_str), *arg - 1); + return FAIL; + } + if (!valid_yank_reg(**arg, FALSE)) + { + emsg_invreg(**arg); + return FAIL; + } + ret = generate_LOAD(cctx, ISN_LOADREG, **arg, NULL, &t_string); + ++*arg; + return ret; +} + +/* + * Apply leading '!', '-' and '+' to constant "rettv". + * When "numeric_only" is TRUE do not apply '!'. + */ + static int +apply_leader(typval_T *rettv, int numeric_only, char_u *start, char_u **end) +{ + char_u *p = *end; + + // this works from end to start + while (p > start) + { + --p; + if (*p == '-' || *p == '+') + { + // only '-' has an effect, for '+' we only check the type + if (rettv->v_type == VAR_FLOAT) + { + if (*p == '-') + rettv->vval.v_float = -rettv->vval.v_float; + } + else + { + varnumber_T val; + int error = FALSE; + + // tv_get_number_chk() accepts a string, but we don't want that + // here + if (check_not_string(rettv) == FAIL) + return FAIL; + val = tv_get_number_chk(rettv, &error); + clear_tv(rettv); + if (error) + return FAIL; + if (*p == '-') + val = -val; + rettv->v_type = VAR_NUMBER; + rettv->vval.v_number = val; + } + } + else if (numeric_only) + { + ++p; + break; + } + else if (*p == '!') + { + int v = tv2bool(rettv); + + // '!' is permissive in the type. + clear_tv(rettv); + rettv->v_type = VAR_BOOL; + rettv->vval.v_number = v ? VVAL_FALSE : VVAL_TRUE; + } + } + *end = p; + return OK; +} + +/* + * Recognize v: variables that are constants and set "rettv". + */ + static void +get_mnv_constant(char_u **arg, typval_T *rettv) +{ + if (STRNCMP(*arg, "v:true", 6) == 0) + { + rettv->v_type = VAR_BOOL; + rettv->vval.v_number = VVAL_TRUE; + *arg += 6; + } + else if (STRNCMP(*arg, "v:false", 7) == 0) + { + rettv->v_type = VAR_BOOL; + rettv->vval.v_number = VVAL_FALSE; + *arg += 7; + } + else if (STRNCMP(*arg, "v:null", 6) == 0) + { + rettv->v_type = VAR_SPECIAL; + rettv->vval.v_number = VVAL_NULL; + *arg += 6; + } + else if (STRNCMP(*arg, "v:none", 6) == 0) + { + rettv->v_type = VAR_SPECIAL; + rettv->vval.v_number = VVAL_NONE; + *arg += 6; + } +} + + exprtype_T +get_compare_type(char_u *p, int *len, int *type_is) +{ + exprtype_T type = EXPR_UNKNOWN; + int i; + + switch (p[0]) + { + case '=': if (p[1] == '=') + type = EXPR_EQUAL; + else if (p[1] == '~') + type = EXPR_MATCH; + break; + case '!': if (p[1] == '=') + type = EXPR_NEQUAL; + else if (p[1] == '~') + type = EXPR_NOMATCH; + break; + case '>': if (p[1] != '=') + { + type = EXPR_GREATER; + *len = 1; + } + else + type = EXPR_GEQUAL; + break; + case '<': if (p[1] != '=') + { + type = EXPR_SMALLER; + *len = 1; + } + else + type = EXPR_SEQUAL; + break; + case 'i': if (p[1] == 's') + { + // "is" and "isnot"; but not a prefix of a name + if (p[2] == 'n' && p[3] == 'o' && p[4] == 't') + *len = 5; + i = p[*len]; + if (!SAFE_isalnum(i) && i != '_') + { + type = *len == 2 ? EXPR_IS : EXPR_ISNOT; + *type_is = TRUE; + } + } + break; + } + return type; +} + +/* + * Skip over an expression, ignoring most errors. + */ + void +skip_expr_cctx(char_u **arg, cctx_T *cctx) +{ + evalarg_T evalarg; + + init_evalarg(&evalarg); + evalarg.eval_cctx = cctx; + skip_expr(arg, &evalarg); + clear_evalarg(&evalarg, NULL); +} + +/* + * Check that the top of the type stack has a type that can be used as a + * condition. Give an error and return FAIL if not. + */ + int +bool_on_stack(cctx_T *cctx) +{ + type_T *type; + + type = get_type_on_stack(cctx, 0); + if (type == &t_bool) + return OK; + + if (type->tt_type == VAR_ANY + || type->tt_type == VAR_UNKNOWN + || type->tt_type == VAR_NUMBER + || type == &t_number_bool + || type == &t_const_number_bool) + // Number 0 and 1 are OK to use as a bool. "any" could also be a bool. + // This requires a runtime type check. + return generate_COND2BOOL(cctx); + + return need_type(type, &t_bool, 0, -1, 0, cctx, FALSE, FALSE); +} + +/* + * Give the "white on both sides" error, taking the operator from "p[len]". + */ + void +error_white_both(char_u *op, int len) +{ + char_u buf[10]; + + mnv_strncpy(buf, op, len); + semsg(_(e_white_space_required_before_and_after_str_at_str), buf, op); +} + +/* + * Compile code to apply '-', '+' and '!'. + * When "numeric_only" is TRUE do not apply '!'. + */ + static int +compile_leader(cctx_T *cctx, int numeric_only, char_u *start, char_u **end) +{ + char_u *p = *end; + + // this works from end to start + while (p > start) + { + --p; + while (MNV_ISWHITE(*p)) + --p; + if (*p == '-' || *p == '+') + { + type_T *type = get_type_on_stack(cctx, 0); + if (type->tt_type != VAR_FLOAT && need_type(type, &t_number, + 0, -1, 0, cctx, FALSE, FALSE) == FAIL) + return FAIL; + + // only '-' has an effect, for '+' we only check the type + if (*p == '-' && generate_instr(cctx, ISN_NEGATENR) == NULL) + return FAIL; + } + else if (numeric_only) + { + ++p; + break; + } + else + { + int invert = *p == '!'; + + while (p > start && (p[-1] == '!' || MNV_ISWHITE(p[-1]))) + { + if (p[-1] == '!') + invert = !invert; + --p; + } + if (check_type_is_value(get_type_on_stack(cctx, 0)) == FAIL) + return FAIL; + if (generate_2BOOL(cctx, invert, -1) == FAIL) + return FAIL; + } + } + *end = p; + return OK; +} + +/* + * Compile "(expression)": recursive! + * Return FAIL/OK. + */ + static int +compile_parenthesis(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) +{ + int ret; + char_u *p = *arg + 1; + + if (may_get_next_line_error(p, arg, cctx) == FAIL) + return FAIL; + + if (**arg == ')') + // empty tuple + return compile_tuple(arg, cctx, ppconst, FALSE); + + if (ppconst->pp_used <= PPSIZE - 10) + { + ret = compile_expr1(arg, cctx, ppconst); + } + else + { + // Not enough space in ppconst, flush constants. + if (generate_ppconst(cctx, ppconst) == FAIL) + return FAIL; + ret = compile_expr0(arg, cctx); + } + if (may_get_next_line_error(*arg, arg, cctx) == FAIL) + return FAIL; + if (ret == OK && **arg == ',') + { + // tuple + int is_const = ppconst->pp_used > 0 || ppconst->pp_is_const; + if (generate_ppconst(cctx, ppconst) == FAIL) + return FAIL; + return compile_tuple(arg, cctx, ppconst, is_const); + } + + if (**arg == ')') + ++*arg; + else if (ret == OK) + { + emsg(_(e_missing_closing_paren)); + ret = FAIL; + } + return ret; +} + +static int compile_expr9(char_u **arg, cctx_T *cctx, ppconst_T *ppconst); + +/* + * Compile whatever comes after "name" or "name()". + * Advances "*arg" only when something was recognized. + */ + static int +compile_subscript( + char_u **arg, + cctx_T *cctx, + char_u *start_leader, + char_u **end_leader, + ppconst_T *ppconst) +{ + char_u *name_start = *end_leader; + int keeping_dict = FALSE; + + for (;;) + { + char_u *p = skipwhite(*arg); + type_T *type; + + if (*p == NUL || (MNV_ISWHITE(**arg) && mnv9_comment_start(p))) + { + char_u *next = peek_next_line_from_context(cctx); + + // If a following line starts with "->{", "->(" or "->X" advance to + // that line, so that a line break before "->" is allowed. + // Also if a following line starts with ".x". + if (next != NULL && + ((next[0] == '-' && next[1] == '>' + && (next[2] == '{' + || next[2] == '(' + || ASCII_ISALPHA(*skipwhite(next + 2)))) + || (next[0] == '.' && eval_isdictc(next[1])))) + { + next = next_line_from_context(cctx, TRUE); + if (next == NULL) + return FAIL; + *arg = next; + p = skipwhite(*arg); + } + } + + // Do not skip over white space to find the "(", "execute 'x' (expr)" + // is not a function call. + if (**arg == '(') + { + int argcount = 0; + + if (generate_ppconst(cctx, ppconst) == FAIL) + return FAIL; + ppconst->pp_is_const = FALSE; + + // funcref(arg) + type = get_type_on_stack(cctx, 0); + + *arg = skipwhite(p + 1); + if (compile_arguments(arg, cctx, &argcount, CA_NOT_SPECIAL) == FAIL) + return FAIL; + if (generate_PCALL(cctx, argcount, name_start, type, TRUE) == FAIL) + return FAIL; + if (keeping_dict) + { + keeping_dict = FALSE; + if (generate_instr(cctx, ISN_CLEARDICT) == NULL) + return FAIL; + } + } + else if (*p == '-' && p[1] == '>') + { + char_u *pstart = p; + int alt; + char_u *paren; + + // something->method() + if (generate_ppconst(cctx, ppconst) == FAIL) + return FAIL; + ppconst->pp_is_const = FALSE; + + // Apply the '!', '-' and '+' first: + // -1.0->func() works like (-1.0)->func() + if (compile_leader(cctx, TRUE, start_leader, end_leader) == FAIL) + return FAIL; + + p += 2; + *arg = skipwhite(p); + // No line break supported right after "->". + + // Three alternatives handled here: + // 1. "base->name(" only a name, use compile_call() + // 2. "base->(expr)(" evaluate "expr", then use PCALL + // 3. "base->expr(" Same, find the end of "expr" by "(" + if (**arg == '(') + alt = 2; + else + { + // alternative 1 or 3 + p = *arg; + if (!eval_isnamec1(*p)) + { + semsg(_(e_trailing_characters_str), pstart); + return FAIL; + } + if (ASCII_ISALPHA(*p) && p[1] == ':') + p += 2; + for ( ; eval_isnamec(*p); ++p) + ; + if (*p == '(') + { + // alternative 1 + alt = 1; + if (compile_call(arg, p - *arg, cctx, ppconst, 1) == FAIL) + return FAIL; + } + else + { + // Must be alternative 3, find the "(". Only works within + // one line. + alt = 3; + paren = mnv_strchr(p, '('); + if (paren == NULL) + { + semsg(_(e_missing_parenthesis_str), *arg); + return FAIL; + } + } + } + + if (alt != 1) + { + int argcount = 1; + garray_T *stack = &cctx->ctx_type_stack; + int type_idx_start = stack->ga_len; + int expr_isn_start = cctx->ctx_instr.ga_len; + int expr_isn_end; + int arg_isn_count; + + if (alt == 2) + { + // Funcref call: list->(Refs[2])(arg) + // or lambda: list->((arg) => expr)(arg) + // + // Fist compile the function expression. + if (compile_parenthesis(arg, cctx, ppconst) == FAIL) + return FAIL; + } + else + { + int fail; + int save_len = cctx->ctx_ufunc->uf_lines.ga_len; + int prev_did_emsg = did_emsg; + + *paren = NUL; + + // instead of using LOADG for "import.Func" use PUSHFUNC + ++paren_follows_after_expr; + + // do not look in the next line + cctx->ctx_ufunc->uf_lines.ga_len = 1; + + fail = compile_expr9(arg, cctx, ppconst) == FAIL + || *skipwhite(*arg) != NUL; + *paren = '('; + --paren_follows_after_expr; + cctx->ctx_ufunc->uf_lines.ga_len = save_len; + + if (fail) + { + if (did_emsg == prev_did_emsg) + semsg(_(e_invalid_expression_str), pstart); + return FAIL; + } + } + + // Compile the arguments. + if (**arg != '(') + { + if (*skipwhite(*arg) == '(') + emsg(_(e_no_white_space_allowed_before_parenthesis)); + else + semsg(_(e_missing_parenthesis_str), *arg); + return FAIL; + } + + // Remember the next instruction index, where the instructions + // for arguments are being written. + expr_isn_end = cctx->ctx_instr.ga_len; + + *arg = skipwhite(*arg + 1); + if (compile_arguments(arg, cctx, &argcount, CA_NOT_SPECIAL) + == FAIL) + return FAIL; + + // Move the instructions for the arguments to before the + // instructions of the expression and move the type of the + // expression after the argument types. This is what ISN_PCALL + // expects. + arg_isn_count = cctx->ctx_instr.ga_len - expr_isn_end; + if (arg_isn_count > 0) + { + int expr_isn_count = expr_isn_end - expr_isn_start; + isn_T *isn = ALLOC_MULT(isn_T, expr_isn_count); + type_T *decl_type; + type2_T *typep; + + if (isn == NULL) + return FAIL; + mch_memmove(isn, ((isn_T *)cctx->ctx_instr.ga_data) + + expr_isn_start, + sizeof(isn_T) * expr_isn_count); + mch_memmove(((isn_T *)cctx->ctx_instr.ga_data) + + expr_isn_start, + ((isn_T *)cctx->ctx_instr.ga_data) + expr_isn_end, + sizeof(isn_T) * arg_isn_count); + mch_memmove(((isn_T *)cctx->ctx_instr.ga_data) + + expr_isn_start + arg_isn_count, + isn, sizeof(isn_T) * expr_isn_count); + mnv_free(isn); + + typep = ((type2_T *)stack->ga_data) + type_idx_start; + type = typep->type_curr; + decl_type = typep->type_decl; + mch_memmove(((type2_T *)stack->ga_data) + type_idx_start, + ((type2_T *)stack->ga_data) + type_idx_start + 1, + sizeof(type2_T) + * (stack->ga_len - type_idx_start - 1)); + typep = ((type2_T *)stack->ga_data) + stack->ga_len - 1; + typep->type_curr = type; + typep->type_decl = decl_type; + } + + type = get_type_on_stack(cctx, 0); + if (generate_PCALL(cctx, argcount, p - 2, type, FALSE) == FAIL) + return FAIL; + } + + if (keeping_dict) + { + keeping_dict = FALSE; + if (generate_instr(cctx, ISN_CLEARDICT) == NULL) + return FAIL; + } + } + else if (**arg == '[') + { + int is_slice = FALSE; + + // list index: list[123] + // tuple index: tuple[123] + // dict member: dict[key] + // string index: text[123] + // blob index: blob[123] + if (generate_ppconst(cctx, ppconst) == FAIL) + return FAIL; + ppconst->pp_is_const = FALSE; + + ++p; + if (may_get_next_line_error(p, arg, cctx) == FAIL) + return FAIL; + if (**arg == ':') + { + // missing first index is equal to zero + generate_PUSHNR(cctx, 0); + } + else + { + if (compile_expr0(arg, cctx) == FAIL) + return FAIL; + if (**arg == ':') + { + semsg(_(e_white_space_required_before_and_after_str_at_str), + ":", *arg); + return FAIL; + } + if (may_get_next_line_error(*arg, arg, cctx) == FAIL) + return FAIL; + *arg = skipwhite(*arg); + } + if (**arg == ':') + { + is_slice = TRUE; + ++*arg; + if (!IS_WHITE_OR_NUL(**arg) && **arg != ']') + { + semsg(_(e_white_space_required_before_and_after_str_at_str), + ":", *arg); + return FAIL; + } + if (may_get_next_line_error(*arg, arg, cctx) == FAIL) + return FAIL; + if (**arg == ']') + // missing second index is equal to end of string + generate_PUSHNR(cctx, -1); + else + { + if (compile_expr0(arg, cctx) == FAIL) + return FAIL; + if (may_get_next_line_error(*arg, arg, cctx) == FAIL) + return FAIL; + *arg = skipwhite(*arg); + } + } + + if (**arg != ']') + { + emsg(_(e_missing_closing_square_brace)); + return FAIL; + } + *arg = *arg + 1; + + if (keeping_dict) + { + keeping_dict = FALSE; + if (generate_instr(cctx, ISN_CLEARDICT) == NULL) + return FAIL; + } + if (cctx->ctx_skip != SKIP_YES + && compile_member(is_slice, &keeping_dict, cctx) == FAIL) + return FAIL; + } + else if (*p == '.' && p[1] != '.') + { + // dictionary member: dict.name + if (generate_ppconst(cctx, ppconst) == FAIL) + return FAIL; + ppconst->pp_is_const = FALSE; + + type = get_type_on_stack(cctx, 0); + if (type != &t_unknown + && (type->tt_type == VAR_CLASS + || (type->tt_type == VAR_OBJECT + && type != &t_object_any))) + { + // class member: SomeClass.varname + // class method: SomeClass.SomeMethod() + // class constructor: SomeClass.new() + // object member: someObject.varname, this.varname + // object method: someObject.SomeMethod(), this.SomeMethod() + *arg = p; + if (compile_class_object_index(cctx, arg, type) == FAIL) + return FAIL; + } + else + { + *arg = p + 1; + if (IS_WHITE_OR_NUL(**arg)) + { + emsg(_(e_missing_name_after_dot)); + return FAIL; + } + p = *arg; + if (eval_isdictc(*p)) + while (eval_isnamec(*p)) + MB_PTR_ADV(p); + if (p == *arg) + { + semsg(_(e_syntax_error_at_str), *arg); + return FAIL; + } + if (keeping_dict && generate_instr(cctx, ISN_CLEARDICT) == NULL) + return FAIL; + if (generate_STRINGMEMBER(cctx, *arg, p - *arg) == FAIL) + return FAIL; + keeping_dict = TRUE; + *arg = p; + } + } + else + break; + } + + // Turn "dict.Func" into a partial for "Func" bound to "dict". + // This needs to be done at runtime to be able to check the type. + if (keeping_dict && cctx->ctx_skip != SKIP_YES + && generate_instr(cctx, ISN_USEDICT) == NULL) + return FAIL; + + return OK; +} + +/* + * Compile an expression at "*arg" and add instructions to "cctx->ctx_instr". + * "arg" is advanced until after the expression, skipping white space. + * + * If the value is a constant "ppconst->pp_used" will be non-zero. + * Before instructions are generated, any values in "ppconst" will generated. + * + * This is the compiling equivalent of eval1(), eval2(), etc. + */ + +/* + * number number constant + * 0zFFFFFFFF Blob constant + * "string" string constant + * 'string' literal string constant + * &option-name option value + * @r register contents + * identifier variable value + * function() function call + * $VAR environment variable + * (expression) nested expression + * [expr, expr] List + * {key: val, [key]: val} Dictionary + * + * Also handle: + * ! in front logical NOT + * - in front unary minus + * + in front unary plus (ignored) + * trailing (arg) funcref/partial call + * trailing [] subscript in String or List + * trailing .name entry in Dictionary + * trailing ->name() method call + */ + static int +compile_expr9( + char_u **arg, + cctx_T *cctx, + ppconst_T *ppconst) +{ + char_u *start_leader, *end_leader; + int ret = OK; + typval_T *rettv = &ppconst->pp_tv[ppconst->pp_used]; + int used_before = ppconst->pp_used; + + ppconst->pp_is_const = FALSE; + + /* + * Skip '!', '-' and '+' characters. They are handled later. + */ + start_leader = *arg; + if (eval_leader(arg, TRUE) == FAIL) + return FAIL; + end_leader = *arg; + + rettv->v_type = VAR_UNKNOWN; + switch (**arg) + { + /* + * Number constant. + */ + case '0': // also for blob starting with 0z + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '.': if (eval_number(arg, rettv, TRUE, FALSE) == FAIL) + return FAIL; + // Apply "-" and "+" just before the number now, right to + // left. Matters especially when "->" follows. Stops at + // '!'. + if (apply_leader(rettv, TRUE, + start_leader, &end_leader) == FAIL) + { + clear_tv(rettv); + return FAIL; + } + break; + + /* + * String constant: "string". + */ + case '"': if (eval_string(arg, rettv, TRUE, FALSE) == FAIL) + return FAIL; + break; + + /* + * Literal string constant: 'str''ing'. + */ + case '\'': if (eval_lit_string(arg, rettv, TRUE, FALSE) == FAIL) + return FAIL; + break; + + /* + * Constant MNV variable. + */ + case 'v': get_mnv_constant(arg, rettv); + ret = NOTDONE; + break; + + /* + * "true" constant + */ + case 't': if (STRNCMP(*arg, "true", 4) == 0 + && !eval_isnamec((*arg)[4])) + { + *arg += 4; + rettv->v_type = VAR_BOOL; + rettv->vval.v_number = VVAL_TRUE; + } + else + ret = NOTDONE; + break; + + /* + * "false" constant + */ + case 'f': if (STRNCMP(*arg, "false", 5) == 0 + && !eval_isnamec((*arg)[5])) + { + *arg += 5; + rettv->v_type = VAR_BOOL; + rettv->vval.v_number = VVAL_FALSE; + } + else + ret = NOTDONE; + break; + + /* + * "null" or "null_*" constant + */ + case 'n': if (STRNCMP(*arg, "null", 4) == 0) + { + char_u *p = *arg + 4; + int len; + + for (len = 0; eval_isnamec(p[len]); ++len) + ; + ret = handle_predefined(*arg, len + 4, rettv); + if (ret == FAIL) + ret = NOTDONE; + else + *arg += len + 4; + } + else + ret = NOTDONE; + break; + + /* + * List: [expr, expr] + */ + case '[': if (generate_ppconst(cctx, ppconst) == FAIL) + return FAIL; + ret = compile_list(arg, cctx, ppconst); + break; + + /* + * Dictionary: {'key': val, 'key': val} + */ + case '{': if (generate_ppconst(cctx, ppconst) == FAIL) + return FAIL; + ret = compile_dict(arg, cctx, ppconst); + break; + + /* + * Option value: &name + */ + case '&': if (generate_ppconst(cctx, ppconst) == FAIL) + return FAIL; + ret = compile_get_option(arg, cctx); + break; + + /* + * Environment variable: $VAR. + * Interpolated string: $"string" or $'string'. + */ + case '$': if (generate_ppconst(cctx, ppconst) == FAIL) + return FAIL; + if ((*arg)[1] == '"' || (*arg)[1] == '\'') + ret = compile_interp_string(arg, cctx); + else + ret = compile_get_env(arg, cctx); + break; + + /* + * Register contents: @r. + */ + case '@': if (generate_ppconst(cctx, ppconst) == FAIL) + return FAIL; + ret = compile_get_register(arg, cctx); + break; + /* + * nested expression: (expression). + * lambda: (arg, arg) => expr + * funcref: (arg, arg) => { statement } + */ + case '(': // if compile_lambda returns NOTDONE then it must be (expr) + ret = compile_lambda(arg, cctx); + if (ret == NOTDONE) + ret = compile_parenthesis(arg, cctx, ppconst); + break; + + default: ret = NOTDONE; + break; + } + if (ret == FAIL) + return FAIL; + + if (rettv->v_type != VAR_UNKNOWN && used_before == ppconst->pp_used) + { + if (cctx->ctx_skip == SKIP_YES) + clear_tv(rettv); + else + // A constant expression can possibly be handled compile time, + // return the value instead of generating code. + ++ppconst->pp_used; + } + else if (ret == NOTDONE) + { + char_u *p; + int r; + + if (!eval_isnamec1(**arg)) + { + if (!mnv9_bad_comment(*arg)) + { + if (ends_excmd(*skipwhite(*arg))) + semsg(_(e_empty_expression_str), *arg); + else + semsg(_(e_name_expected_str), *arg); + } + return FAIL; + } + + // "name" or "name()" + p = to_name_end(*arg, TRUE); + if (p - *arg == (size_t)1 && **arg == '_') + { + emsg(_(e_cannot_use_underscore_here)); + return FAIL; + } + + size_t namelen = p - *arg; + if (*p == '<') + { + if (skip_generic_func_type_args(&p) == FAIL) + return FAIL; + } + + if (*p == '(') + { + r = compile_call(arg, namelen, cctx, ppconst, 0); + } + else + { + if (cctx->ctx_skip != SKIP_YES + && generate_ppconst(cctx, ppconst) == FAIL) + return FAIL; + r = compile_load(arg, namelen, p, cctx, TRUE, TRUE); + } + if (r == FAIL) + return FAIL; + } + + // Handle following "[]", ".member", etc. + // Then deal with prefixed '-', '+' and '!', if not done already. + if (compile_subscript(arg, cctx, start_leader, &end_leader, + ppconst) == FAIL) + return FAIL; + if ((ppconst->pp_used > 0) && (cctx->ctx_skip != SKIP_YES)) + { + // apply the '!', '-' and '+' before the constant + rettv = &ppconst->pp_tv[ppconst->pp_used - 1]; + if (apply_leader(rettv, FALSE, start_leader, &end_leader) == FAIL) + return FAIL; + return OK; + } + if (compile_leader(cctx, FALSE, start_leader, &end_leader) == FAIL) + return FAIL; + return OK; +} + +/* + * expr9: runtime type check / conversion + */ + static int +compile_expr8(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) +{ + type_T *want_type = NULL; + + // Recognize + if (**arg == '<' && eval_isnamec1((*arg)[1])) + { + ++*arg; + want_type = parse_type(arg, cctx->ctx_type_list, cctx->ctx_ufunc, cctx, TRUE); + if (want_type == NULL) + return FAIL; + + if (**arg != '>') + { + if (*skipwhite(*arg) == '>') + semsg(_(e_no_white_space_allowed_before_str_str), ">", *arg); + else + emsg(_(e_missing_gt)); + return FAIL; + } + ++*arg; + if (may_get_next_line_error(*arg, arg, cctx) == FAIL) + return FAIL; + } + + if (compile_expr9(arg, cctx, ppconst) == FAIL) + return FAIL; + + if (want_type != NULL) + { + type_T *actual; + where_T where = WHERE_INIT; + + where.wt_kind = WT_CAST; + generate_ppconst(cctx, ppconst); + actual = get_type_on_stack(cctx, 0); + if (check_type_maybe(want_type, actual, FALSE, where) != OK) + { + if (need_type_where(actual, want_type, 0, -1, where, cctx, FALSE, + FALSE) == FAIL) + return FAIL; + } + } + + return OK; +} + +/* + * * number multiplication + * / number division + * % number modulo + */ + static int +compile_expr7(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) +{ + char_u *op; + char_u *next; + int ppconst_used = ppconst->pp_used; + + // get the first expression + if (compile_expr8(arg, cctx, ppconst) == FAIL) + return FAIL; + + /* + * Repeat computing, until no "*", "/" or "%" is following. + */ + for (;;) + { + op = may_peek_next_line(cctx, *arg, &next); + if (*op != '*' && *op != '/' && *op != '%') + break; + if (next != NULL) + { + *arg = next_line_from_context(cctx, TRUE); + op = skipwhite(*arg); + } + + if (!IS_WHITE_OR_NUL(**arg) || !IS_WHITE_OR_NUL(op[1])) + { + error_white_both(op, 1); + return FAIL; + } + if (may_get_next_line_error(op + 1, arg, cctx) == FAIL) + return FAIL; + + // get the second expression + if (compile_expr8(arg, cctx, ppconst) == FAIL) + return FAIL; + + if (ppconst->pp_used == ppconst_used + 2 + && ppconst->pp_tv[ppconst_used].v_type == VAR_NUMBER + && ppconst->pp_tv[ppconst_used + 1].v_type == VAR_NUMBER) + { + typval_T *tv1 = &ppconst->pp_tv[ppconst_used]; + typval_T *tv2 = &ppconst->pp_tv[ppconst_used + 1]; + varnumber_T res = 0; + int failed = FALSE; + + // both are numbers: compute the result + switch (*op) + { + case '*': res = tv1->vval.v_number * tv2->vval.v_number; + break; + case '/': res = num_divide(tv1->vval.v_number, + tv2->vval.v_number, &failed); + break; + case '%': res = num_modulus(tv1->vval.v_number, + tv2->vval.v_number, &failed); + break; + } + if (failed) + return FAIL; + tv1->vval.v_number = res; + --ppconst->pp_used; + } + else + { + generate_ppconst(cctx, ppconst); + generate_two_op(cctx, op); + } + } + + return OK; +} + +/* + * + number addition or list/blobl concatenation + * - number subtraction + * .. string concatenation + */ + static int +compile_expr6(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) +{ + char_u *op; + char_u *next; + int oplen; + int ppconst_used = ppconst->pp_used; + + // get the first variable + if (compile_expr7(arg, cctx, ppconst) == FAIL) + return FAIL; + + /* + * Repeat computing, until no "+", "-" or ".." is following. + */ + for (;;) + { + op = may_peek_next_line(cctx, *arg, &next); + if (*op != '+' && *op != '-' && !(*op == '.' && *(op + 1) == '.')) + break; + if (op[0] == op[1] && *op != '.' && next) + // Finding "++" or "--" on the next line is a separate command. + // But ".." is concatenation. + break; + oplen = (*op == '.' ? 2 : 1); + if (next != NULL) + { + *arg = next_line_from_context(cctx, TRUE); + op = skipwhite(*arg); + } + + if (!IS_WHITE_OR_NUL(**arg) || !IS_WHITE_OR_NUL(op[oplen])) + { + error_white_both(op, oplen); + return FAIL; + } + + if (may_get_next_line_error(op + oplen, arg, cctx) == FAIL) + return FAIL; + + // get the second expression + if (compile_expr7(arg, cctx, ppconst) == FAIL) + return FAIL; + + if (ppconst->pp_used == ppconst_used + 2 + && (*op == '.' + ? (ppconst->pp_tv[ppconst_used].v_type == VAR_STRING + && ppconst->pp_tv[ppconst_used + 1].v_type == VAR_STRING) + : (ppconst->pp_tv[ppconst_used].v_type == VAR_NUMBER + && ppconst->pp_tv[ppconst_used + 1].v_type == VAR_NUMBER))) + { + typval_T *tv1 = &ppconst->pp_tv[ppconst_used]; + typval_T *tv2 = &ppconst->pp_tv[ppconst_used + 1]; + + // concat/subtract/add constant numbers + if (*op == '+') + tv1->vval.v_number = tv1->vval.v_number + tv2->vval.v_number; + else if (*op == '-') + tv1->vval.v_number = tv1->vval.v_number - tv2->vval.v_number; + else + { + // concatenate constant strings + char_u *s1 = tv1->vval.v_string; + char_u *s2 = tv2->vval.v_string; + size_t len1 = STRLEN(s1); + + tv1->vval.v_string = alloc((int)(len1 + STRLEN(s2) + 1)); + if (tv1->vval.v_string == NULL) + { + clear_ppconst(ppconst); + return FAIL; + } + mch_memmove(tv1->vval.v_string, s1, len1); + STRCPY(tv1->vval.v_string + len1, s2); + mnv_free(s1); + mnv_free(s2); + } + --ppconst->pp_used; + } + else + { + generate_ppconst(cctx, ppconst); + ppconst->pp_is_const = FALSE; + if (*op == '.') + { + if (may_generate_2STRING(-2, TOSTRING_NONE, cctx) == FAIL + || may_generate_2STRING(-1, TOSTRING_NONE, cctx) == FAIL) + return FAIL; + if (generate_CONCAT(cctx, 2) == FAIL) + return FAIL; + } + else + generate_two_op(cctx, op); + } + } + + return OK; +} + +/* + * expr6a >> expr6b + * expr6a << expr6b + * + * Produces instructions: + * OPNR bitwise left or right shift + */ + static int +compile_expr5(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) +{ + exprtype_T type = EXPR_UNKNOWN; + char_u *p; + char_u *next; + int len = 2; + int ppconst_used = ppconst->pp_used; + isn_T *isn; + + // get the first variable + if (compile_expr6(arg, cctx, ppconst) == FAIL) + return FAIL; + + /* + * Repeat computing, until no "+", "-" or ".." is following. + */ + for (;;) + { + type = EXPR_UNKNOWN; + + p = may_peek_next_line(cctx, *arg, &next); + if (p[0] == '<' && p[1] == '<') + type = EXPR_LSHIFT; + else if (p[0] == '>' && p[1] == '>') + type = EXPR_RSHIFT; + + if (type == EXPR_UNKNOWN) + return OK; + + // Handle a bitwise left or right shift operator + if (ppconst->pp_used == ppconst_used + 1) + { + if (ppconst->pp_tv[ppconst->pp_used - 1].v_type != VAR_NUMBER) + { + // left operand should be a number + emsg(_(e_bitshift_ops_must_be_number)); + return FAIL; + } + } + else + { + type_T *t = get_type_on_stack(cctx, 0); + + if (need_type(t, &t_number, 0, 0, 0, cctx, FALSE, FALSE) == FAIL) + { + emsg(_(e_bitshift_ops_must_be_number)); + return FAIL; + } + } + + if (next != NULL) + { + *arg = next_line_from_context(cctx, TRUE); + p = skipwhite(*arg); + } + + if (!IS_WHITE_OR_NUL(**arg) || !IS_WHITE_OR_NUL(p[len])) + { + error_white_both(p, len); + return FAIL; + } + + // get the second variable + if (may_get_next_line_error(p + len, arg, cctx) == FAIL) + return FAIL; + + if (compile_expr6(arg, cctx, ppconst) == FAIL) + return FAIL; + + if (ppconst->pp_used == ppconst_used + 2) + { + typval_T *tv1 = &ppconst->pp_tv[ppconst->pp_used - 2]; + typval_T *tv2 = &ppconst->pp_tv[ppconst->pp_used - 1]; + + // Both sides are a constant, compute the result now. + if (tv2->v_type != VAR_NUMBER || tv2->vval.v_number < 0) + { + // right operand should be a positive number + if (tv2->v_type != VAR_NUMBER) + emsg(_(e_bitshift_ops_must_be_number)); + else + emsg(_(e_bitshift_ops_must_be_positive)); + return FAIL; + } + + if (tv2->vval.v_number > MAX_LSHIFT_BITS) + tv1->vval.v_number = 0; + else if (type == EXPR_LSHIFT) + tv1->vval.v_number = + (uvarnumber_T)tv1->vval.v_number << tv2->vval.v_number; + else + tv1->vval.v_number = + (uvarnumber_T)tv1->vval.v_number >> tv2->vval.v_number; + clear_tv(tv2); + --ppconst->pp_used; + } + else + { + if (need_type(get_type_on_stack(cctx, 0), &t_number, 0, + 0, 0, cctx, FALSE, FALSE) == FAIL) + { + emsg(_(e_bitshift_ops_must_be_number)); + return FAIL; + } + + generate_ppconst(cctx, ppconst); + + isn = generate_instr_drop(cctx, ISN_OPNR, 1); + if (isn == NULL) + return FAIL; + + if (isn != NULL) + isn->isn_arg.op.op_type = type; + } + } + + return OK; +} + +/* + * expr5a == expr5b + * expr5a =~ expr5b + * expr5a != expr5b + * expr5a !~ expr5b + * expr5a > expr5b + * expr5a >= expr5b + * expr5a < expr5b + * expr5a <= expr5b + * expr5a is expr5b + * expr5a isnot expr5b + * + * Produces instructions: + * EVAL expr5a Push result of "expr5a" + * EVAL expr5b Push result of "expr5b" + * COMPARE one of the compare instructions + */ + static int +compile_expr4(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) +{ + exprtype_T type = EXPR_UNKNOWN; + char_u *p; + char_u *next; + int len = 2; + int type_is = FALSE; + int ppconst_used = ppconst->pp_used; + + // get the first variable + if (compile_expr5(arg, cctx, ppconst) == FAIL) + return FAIL; + + p = may_peek_next_line(cctx, *arg, &next); + + type = get_compare_type(p, &len, &type_is); + + /* + * If there is a comparative operator, use it. + */ + if (type != EXPR_UNKNOWN) + { + int ic = FALSE; // Default: do not ignore case + + if (next != NULL) + { + *arg = next_line_from_context(cctx, TRUE); + p = skipwhite(*arg); + } + if (type_is && (p[len] == '?' || p[len] == '#')) + { + semsg(_(e_invalid_expression_str), *arg); + return FAIL; + } + // extra question mark appended: ignore case + if (p[len] == '?') + { + ic = TRUE; + ++len; + } + // extra '#' appended: match case (ignored) + else if (p[len] == '#') + ++len; + // nothing appended: match case + + if (!IS_WHITE_OR_NUL(**arg) || !IS_WHITE_OR_NUL(p[len])) + { + error_white_both(p, len); + return FAIL; + } + + // get the second variable + if (may_get_next_line_error(p + len, arg, cctx) == FAIL) + return FAIL; + + if (compile_expr5(arg, cctx, ppconst) == FAIL) + return FAIL; + + if (ppconst->pp_used == ppconst_used + 2) + { + typval_T *tv1 = &ppconst->pp_tv[ppconst->pp_used - 2]; + typval_T *tv2 = &ppconst->pp_tv[ppconst->pp_used - 1]; + int ret; + + // Both sides are a constant, compute the result now. + // First check for a valid combination of types, this is more + // strict than typval_compare(). + if (check_compare_types(type, tv1, tv2) == FAIL) + ret = FAIL; + else + { + ret = typval_compare(tv1, tv2, type, ic); + tv1->v_type = VAR_BOOL; + tv1->vval.v_number = tv1->vval.v_number + ? VVAL_TRUE : VVAL_FALSE; + clear_tv(tv2); + --ppconst->pp_used; + } + return ret; + } + + generate_ppconst(cctx, ppconst); + return generate_COMPARE(cctx, type, ic); + } + + return OK; +} + +static int compile_expr3(char_u **arg, cctx_T *cctx, ppconst_T *ppconst); + +/* + * Compile || or &&. + */ + static int +compile_and_or( + char_u **arg, + cctx_T *cctx, + char *op, + ppconst_T *ppconst, + int ppconst_used UNUSED) +{ + char_u *next; + char_u *p = may_peek_next_line(cctx, *arg, &next); + int opchar = *op; + + if (p[0] == opchar && p[1] == opchar) + { + garray_T *instr = &cctx->ctx_instr; + garray_T end_ga; + int save_skip = cctx->ctx_skip; + + /* + * Repeat until there is no following "||" or "&&" + */ + ga_init2(&end_ga, sizeof(int), 10); + while (p[0] == opchar && p[1] == opchar) + { + long start_lnum = SOURCING_LNUM; + long save_sourcing_lnum; + int start_ctx_lnum = cctx->ctx_lnum; + int save_lnum; + int const_used; + int status; + jumpwhen_T jump_when = opchar == '|' + ? JUMP_IF_COND_TRUE : JUMP_IF_COND_FALSE; + + if (next != NULL) + { + *arg = next_line_from_context(cctx, TRUE); + p = skipwhite(*arg); + } + + if (!IS_WHITE_OR_NUL(**arg) || !IS_WHITE_OR_NUL(p[2])) + { + semsg(_(e_white_space_required_before_and_after_str_at_str), + op, p); + ga_clear(&end_ga); + return FAIL; + } + + save_sourcing_lnum = SOURCING_LNUM; + SOURCING_LNUM = start_lnum; + save_lnum = cctx->ctx_lnum; + cctx->ctx_lnum = start_ctx_lnum; + + status = check_ppconst_bool(ppconst); + if (status != FAIL) + { + // Use the last ppconst if possible. + if (ppconst->pp_used > 0) + { + typval_T *tv = &ppconst->pp_tv[ppconst->pp_used - 1]; + int is_true = tv2bool(tv); + + if ((is_true && opchar == '|') + || (!is_true && opchar == '&')) + { + // For "false && expr" and "true || expr" the "expr" + // does not need to be evaluated. + cctx->ctx_skip = SKIP_YES; + clear_tv(tv); + tv->v_type = VAR_BOOL; + tv->vval.v_number = is_true ? VVAL_TRUE : VVAL_FALSE; + } + else + { + // For "true && expr" and "false || expr" only "expr" + // needs to be evaluated. + --ppconst->pp_used; + jump_when = JUMP_NEVER; + } + } + else + { + // Every part must evaluate to a bool. + status = bool_on_stack(cctx); + } + } + if (status != FAIL) + status = ga_grow(&end_ga, 1); + cctx->ctx_lnum = save_lnum; + if (status == FAIL) + { + ga_clear(&end_ga); + return FAIL; + } + + if (jump_when != JUMP_NEVER) + { + if (cctx->ctx_skip != SKIP_YES) + { + *(((int *)end_ga.ga_data) + end_ga.ga_len) = instr->ga_len; + ++end_ga.ga_len; + } + generate_JUMP(cctx, jump_when, 0); + } + + // eval the next expression + SOURCING_LNUM = save_sourcing_lnum; + if (may_get_next_line_error(p + 2, arg, cctx) == FAIL) + { + ga_clear(&end_ga); + return FAIL; + } + + const_used = ppconst->pp_used; + if ((opchar == '|' ? compile_expr3(arg, cctx, ppconst) + : compile_expr4(arg, cctx, ppconst)) == FAIL) + { + ga_clear(&end_ga); + return FAIL; + } + + // "0 || 1" results in true, "1 && 0" results in false. + if (ppconst->pp_used == const_used + 1) + { + typval_T *tv = &ppconst->pp_tv[ppconst->pp_used - 1]; + + if (tv->v_type == VAR_NUMBER + && (tv->vval.v_number == 1 || tv->vval.v_number == 0)) + { + tv->vval.v_number = tv->vval.v_number == 1 + ? VVAL_TRUE : VVAL_FALSE; + tv->v_type = VAR_BOOL; + } + } + + p = may_peek_next_line(cctx, *arg, &next); + } + + if (check_ppconst_bool(ppconst) == FAIL) + { + ga_clear(&end_ga); + return FAIL; + } + + if (cctx->ctx_skip != SKIP_YES && ppconst->pp_used == 0) + // Every part must evaluate to a bool. + if (bool_on_stack(cctx) == FAIL) + { + ga_clear(&end_ga); + return FAIL; + } + + if (end_ga.ga_len > 0) + { + // Fill in the end label in all jumps. + generate_ppconst(cctx, ppconst); + while (end_ga.ga_len > 0) + { + isn_T *isn; + + --end_ga.ga_len; + isn = ((isn_T *)instr->ga_data) + + *(((int *)end_ga.ga_data) + end_ga.ga_len); + isn->isn_arg.jump.jump_where = instr->ga_len; + } + } + ga_clear(&end_ga); + + cctx->ctx_skip = save_skip; + } + + return OK; +} + +/* + * expr4a && expr4a && expr4a logical AND + * + * Produces instructions: + * EVAL expr4a Push result of "expr4a" + * COND2BOOL convert to bool if needed + * JUMP_IF_COND_FALSE end + * EVAL expr4b Push result of "expr4b" + * JUMP_IF_COND_FALSE end + * EVAL expr4c Push result of "expr4c" + * end: + */ + static int +compile_expr3(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) +{ + int ppconst_used = ppconst->pp_used; + + // get the first variable + if (compile_expr4(arg, cctx, ppconst) == FAIL) + return FAIL; + + // || and && work almost the same + return compile_and_or(arg, cctx, "&&", ppconst, ppconst_used); +} + +/* + * expr3a || expr3b || expr3c logical OR + * + * Produces instructions: + * EVAL expr3a Push result of "expr3a" + * COND2BOOL convert to bool if needed + * JUMP_IF_COND_TRUE end + * EVAL expr3b Push result of "expr3b" + * JUMP_IF_COND_TRUE end + * EVAL expr3c Push result of "expr3c" + * end: + */ + static int +compile_expr2(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) +{ + int ppconst_used = ppconst->pp_used; + + // eval the first expression + if (compile_expr3(arg, cctx, ppconst) == FAIL) + return FAIL; + + // || and && work almost the same + return compile_and_or(arg, cctx, "||", ppconst, ppconst_used); +} + +/* + * Toplevel expression: expr2 ? expr1a : expr1b + * Produces instructions: + * EVAL expr2 Push result of "expr2" + * JUMP_IF_FALSE alt jump if false + * EVAL expr1a + * JUMP_ALWAYS end + * alt: EVAL expr1b + * end: + * + * Toplevel expression: expr2 ?? expr1 + * Produces instructions: + * EVAL expr2 Push result of "expr2" + * JUMP_AND_KEEP_IF_TRUE end jump if true + * EVAL expr1 + * end: + */ + int +compile_expr1(char_u **arg, cctx_T *cctx, ppconst_T *ppconst) +{ + char_u *p; + int ppconst_used = ppconst->pp_used; + char_u *next; + + // Ignore all kinds of errors when not producing code. + if (cctx->ctx_skip == SKIP_YES) + { + int prev_did_emsg = did_emsg; + + skip_expr_cctx(arg, cctx); + return did_emsg == prev_did_emsg ? OK : FAIL; + } + + // Evaluate the first expression. + if (compile_expr2(arg, cctx, ppconst) == FAIL) + return FAIL; + + p = may_peek_next_line(cctx, *arg, &next); + if (*p == '?') + { + int op_falsy = p[1] == '?'; + garray_T *instr = &cctx->ctx_instr; + garray_T *stack = &cctx->ctx_type_stack; + int alt_idx = instr->ga_len; + int end_idx = 0; + isn_T *isn; + type_T *type1 = NULL; + int has_const_expr = FALSE; + int const_value = FALSE; + int save_skip = cctx->ctx_skip; + + if (next != NULL) + { + *arg = next_line_from_context(cctx, TRUE); + p = skipwhite(*arg); + } + + if (!IS_WHITE_OR_NUL(**arg) || !IS_WHITE_OR_NUL(p[1 + op_falsy])) + { + semsg(_(e_white_space_required_before_and_after_str_at_str), + op_falsy ? "??" : "?", p); + return FAIL; + } + + if (ppconst->pp_used == ppconst_used + 1) + { + // the condition is a constant, we know whether the ? or the : + // expression is to be evaluated. + has_const_expr = TRUE; + if (op_falsy) + const_value = tv2bool(&ppconst->pp_tv[ppconst_used]); + else + { + int error = FALSE; + + const_value = tv_get_bool_chk(&ppconst->pp_tv[ppconst_used], + &error); + if (error) + return FAIL; + } + cctx->ctx_skip = save_skip == SKIP_YES || + (op_falsy ? const_value : !const_value) ? SKIP_YES : SKIP_NOT; + + if (op_falsy && cctx->ctx_skip == SKIP_YES) + // "left ?? right" and "left" is truthy: produce "left" + generate_ppconst(cctx, ppconst); + else + { + clear_tv(&ppconst->pp_tv[ppconst_used]); + --ppconst->pp_used; + } + } + else + { + generate_ppconst(cctx, ppconst); + if (op_falsy) + end_idx = instr->ga_len; + generate_JUMP(cctx, op_falsy + ? JUMP_AND_KEEP_IF_TRUE : JUMP_IF_FALSE, 0); + if (op_falsy) + { + type1 = get_type_on_stack(cctx, -1); + if (check_type_is_value(type1) == FAIL) + return FAIL; + } + } + + // evaluate the second expression; any type is accepted + if (may_get_next_line_error(p + 1 + op_falsy, arg, cctx) == FAIL) + return FAIL; + if (compile_expr1(arg, cctx, ppconst) == FAIL) + return FAIL; + + if (!has_const_expr) + { + generate_ppconst(cctx, ppconst); + + if (!op_falsy) + { + // remember the type and drop it + type1 = get_type_on_stack(cctx, 0); + --stack->ga_len; + + end_idx = instr->ga_len; + generate_JUMP(cctx, JUMP_ALWAYS, 0); + + // jump here from JUMP_IF_FALSE + isn = ((isn_T *)instr->ga_data) + alt_idx; + isn->isn_arg.jump.jump_where = instr->ga_len; + } + } + + if (!op_falsy) + { + // Check for the ":". + p = may_peek_next_line(cctx, *arg, &next); + if (*p != ':') + { + emsg(_(e_missing_colon_after_questionmark)); + return FAIL; + } + if (next != NULL) + { + *arg = next_line_from_context(cctx, TRUE); + p = skipwhite(*arg); + } + + if (!IS_WHITE_OR_NUL(**arg) || !IS_WHITE_OR_NUL(p[1])) + { + semsg(_(e_white_space_required_before_and_after_str_at_str), + ":", p); + return FAIL; + } + + // evaluate the third expression + if (has_const_expr) + cctx->ctx_skip = save_skip == SKIP_YES || const_value + ? SKIP_YES : SKIP_NOT; + if (may_get_next_line_error(p + 1, arg, cctx) == FAIL) + return FAIL; + if (compile_expr1(arg, cctx, ppconst) == FAIL) + return FAIL; + } + + if (!has_const_expr) + { + type_T **typep; + + generate_ppconst(cctx, ppconst); + ppconst->pp_is_const = FALSE; + + // If the types differ, the result has a more generic type. + typep = &((((type2_T *)stack->ga_data) + + stack->ga_len - 1)->type_curr); + common_type(type1, *typep, typep, cctx->ctx_type_list); + + // jump here from JUMP_ALWAYS or JUMP_AND_KEEP_IF_TRUE + isn = ((isn_T *)instr->ga_data) + end_idx; + isn->isn_arg.jump.jump_where = instr->ga_len; + } + + cctx->ctx_skip = save_skip; + } + return OK; +} + +/* + * Toplevel expression. + * Sets "is_const" (if not NULL) to indicate the value is a constant. + * Returns OK or FAIL. + */ + int +compile_expr0_ext(char_u **arg, cctx_T *cctx, int *is_const) +{ + ppconst_T ppconst; + + CLEAR_FIELD(ppconst); + if (compile_expr1(arg, cctx, &ppconst) == FAIL) + { + clear_ppconst(&ppconst); + return FAIL; + } + if (is_const != NULL) + *is_const = ppconst.pp_used > 0 || ppconst.pp_is_const; + if (generate_ppconst(cctx, &ppconst) == FAIL) + return FAIL; + return OK; +} + +/* + * Toplevel expression. + */ + int +compile_expr0(char_u **arg, cctx_T *cctx) +{ + return compile_expr0_ext(arg, cctx, NULL); +} + + +#endif // defined(FEAT_EVAL) diff --git a/uvim/src/mnv9generics.c b/uvim/src/mnv9generics.c new file mode 100644 index 0000000000..adc56aca16 --- /dev/null +++ b/uvim/src/mnv9generics.c @@ -0,0 +1,1312 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * MNV - MNV is not Vim by Bram Moolenaar + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. + */ + +/* + * mnv9generics.c: MNV9 script generics support + */ + +#include "mnv.h" + +#if defined(FEAT_EVAL) + + +/* + * A hash table is used to lookup a generic function with specific types. + * The specific type names are used as the key. + */ +typedef struct gfitem_S gfitem_T; +struct gfitem_S +{ + ufunc_T *gfi_ufunc; + char_u gfi_name[1]; // actually longer +}; +#define GFITEM_KEY_OFF offsetof(gfitem_T, gfi_name) +#define HI2GFITEM(hi) ((gfitem_T *)((hi)->hi_key - GFITEM_KEY_OFF)) + +static type_T *find_generic_type_in_cctx(char_u *gt_name, size_t len, cctx_T *cctx); + +/* + * Returns a pointer to the first '<' character in "name" that starts the + * generic type argument list, skipping an initial or prefix if + * present. The prefix is only skipped if "name" starts with '<'. + * + * Returns NULL if no '<' is found before a '(' or the end of the string. + * The returned pointer refers to the original string. + * + * Examples: + * "123_Fn" -> returns pointer to '<' + * "123_Fn" -> returns pointer to '<' + * "Func" -> returns pointer to '<' + * "Func()" -> returns NULL + */ + char_u * +generic_func_find_open_bracket(char_u *name) +{ + char_u *p = name; + + if (name[0] == '<') + { + // Skip the or at the start of the name + if (STRNCMP(name + 1, "SNR>", 4) == 0) + p += 5; + else if (STRNCMP(name + 1, "lambda>", 7) == 0) + p += 8; + } + + while (*p && *p != '(' && *p != '<') + p++; + + if (*p == '<') + return p; + + return NULL; +} + +/* + * Finds the matching '>' character for a generic function type parameter or + * argument list, starting from the opening '<'. + * + * Enforces correct syntax for a flat, comma-separated list of types: + * - No whitespace before or after type names or commas + * - Each type must be non-empty and separated by a comma and whitespace + * - At least one type must be present + * + * Arguments: + * start - pointer to the opening '<' + * + * Returns: + * Pointer to the matching '>' character if found and syntax is valid, + * or NULL if not found, invalid syntax, or on error. + */ + static char_u * +generic_func_find_close_bracket(char_u *start) +{ + char_u *p = start + 1; + int type_count = 0; + + while (*p && *p != '>') + { + char_u *typename = p; + + if (MNV_ISWHITE(*p)) + { + char tmpstr[2]; + tmpstr[0] = *(p - 1); tmpstr[1] = NUL; + semsg(_(e_no_white_space_allowed_after_str_str), tmpstr, start); + return NULL; + } + + p = skip_type(p, FALSE); + if (p == typename) + { + char_u cc = *p; + *p = NUL; + semsg(_(e_missing_type_after_str), start); + *p = cc; + return NULL; + } + type_count++; + + if (*p == '>' || *p == NUL) + break; + + if (MNV_ISWHITE(*p)) + { + char_u cc = *p; + *p = NUL; + semsg(_(e_no_white_space_allowed_after_str_str), typename, start); + *p = cc; + return NULL; + } + + if (*p != ',') + { + semsg(_(e_missing_comma_in_generic_function_str), start); + return NULL; + } + p++; + + if (*p == NUL) + break; + + if (!MNV_ISWHITE(*p)) + { + semsg(_(e_white_space_required_after_str_str), ",", start); + return NULL; + } + p = skipwhite(p); + } + + if (*p != '>') + { + semsg(_(e_missing_closing_angle_bracket_in_generic_function_str), start); + return NULL; + } + + if (MNV_ISWHITE(*(p + 1)) && *skipwhite(p + 1) == '(') + { + // white space not allowed between '>' and '(' + semsg(_(e_no_white_space_allowed_after_str_str), ">", start); + return NULL; + } + + + if (type_count == 0) + { + semsg(_(e_empty_type_list_for_generic_function_str), start); + return NULL; + } + + return p; +} + +/* + * Advances the argument pointer past a generic function's type argument list. + * + * On entry, "*argp" must point to the opening '<' of a generic type argument + * list. This function finds the matching closing '>' (validating the syntax + * via generic_func_find_close_bracket), and if successful, advances "*argp" to + * the character immediately after the closing '>'. + * + * Returns OK on success, or FAIL if the type argument list is invalid or no + * matching '>' is found. On failure, "*argp" is not modified. + */ + int +skip_generic_func_type_args(char_u **argp) +{ + char_u *p = generic_func_find_close_bracket(*argp); + if (p == NULL) + return FAIL; + + *argp = p + 1; // skip '>' + + return OK; +} + +/* + * Appends the generic function type arguments, starting at "*argp", to the + * function name "funcname" (of length "namelen") and returns a newly allocated + * string containing the result. + * + * On entry, "*argp" must point to the opening '<' of the generic type argument + * list. If the type argument list is valid, the substring from "*argp" up to + * and including the matching '>' is appended to "funcname". On success, + * "*argp" is updated to point to the character after the closing '>'. + * + * Returns: + * A newly allocated string with the combined function name and type + * arguments, or NULL if there is a syntax error in the generic type + * arguments. + * + * The caller is responsible for freeing the returned string. + */ + char_u * +append_generic_func_type_args( + char_u *funcname, + size_t namelen, + char_u **argp) +{ + char_u *p = generic_func_find_close_bracket(*argp); + + if (p == NULL) + return NULL; + + mnv_strncpy(IObuff, funcname, namelen); + STRNCAT(IObuff, *argp, p - *argp + 1); + + *argp = p + 1; + + return mnv_strsave(IObuff); +} + +/* + * Returns a newly allocated string containing the function name from "fp" with + * the generic type arguments from "*argp" appended. + * + * On entry, "*argp" must point to the opening '<' of the generic type argument + * list. On success, "*argp" is advanced to the character after the closing + * '>'. + * + * Returns: + * A newly allocated string with the combined function name and type + * arguments, or NULL if "fp" is not a generic function, if there is a + * parsing error, or on memory allocation failure. + * + * The caller is responsible for freeing the returned string. + */ + char_u * +get_generic_func_name(ufunc_T *fp, char_u **argp) +{ + if (!IS_GENERIC_FUNC(fp)) + { + emsg_funcname(e_not_a_generic_function_str, fp->uf_name); + return NULL; + } + + return append_generic_func_type_args(fp->uf_name, fp->uf_namelen, argp); +} + +/* + * Parses the concrete type arguments provided in a generic function call, + * starting at the opening '<' character and ending at the matching '>'. + * + * On entry, "start" must point to the opening '<' character. + * On success, returns a pointer to the character after the closing '>'. + * On failure, returns NULL and reports an error message. + * + * Arguments: + * func_name - the name of the function being called (used for error + * messages) + * namelen - length of the function name + * start - pointer to the opening '<' character in the call + * gfatab - args table to allocate new type objects and to store parsed + * type argument names and their types. + * cctx - compile context for type resolution (may be NULL) + * + * This function enforces correct syntax for generic type argument lists, + * including whitespace rules, comma separation, and non-empty argument lists. + */ + char_u * +parse_generic_func_type_args( + char_u *func_name, + size_t namelen, + char_u *start, + gfargs_tab_T *gfatab, + cctx_T *cctx) +{ + generic_T *generic_arg; + type_T *type_arg; + char_u *p = start; + + // White spaces not allowed after '<' + if (MNV_ISWHITE(*(p + 1))) + { + semsg(_(e_no_white_space_allowed_after_str_str), "<", p); + return NULL; + } + + ++p; // skip the '<' + + // parse each type argument until '>' or end of string + while (*p && *p != '>') + { + p = skipwhite(p); + + if (!ASCII_ISALNUM(*p)) + { + semsg(_(e_missing_type_after_str), start); + return NULL; + } + + // parse the type + type_arg = parse_type(&p, &gfatab->gfat_arg_types, NULL, cctx, TRUE); + if (type_arg == NULL || !valid_declaration_type(type_arg)) + return NULL; + + char *ret_free = NULL; + char *ret_name = type_name(type_arg, &ret_free); + + // create space for the name and the new type + if (ga_grow(&gfatab->gfat_args, 1) == FAIL) + { + mnv_free(ret_free); + return NULL; + } + generic_arg = (generic_T *)gfatab->gfat_args.ga_data + + gfatab->gfat_args.ga_len; + gfatab->gfat_args.ga_len++; + + // copy the type name + generic_arg->gt_name = alloc(STRLEN(ret_name) + 1); + if (generic_arg->gt_name == NULL) + return NULL; + STRCPY(generic_arg->gt_name, ret_name); + mnv_free(ret_free); + + // add the new type + generic_arg->gt_type = type_arg; + + p = skipwhite(p); + + if (*p == NUL || *p == '>') + break; + + // after a type, expect ',' or '>' + if (*p != ',') + { + semsg(_(e_missing_comma_in_generic_function_str), start); + return NULL; + } + + if (*(p + 1) == NUL) + break; + + // Require whitespace after a comma and skip it + if (!MNV_ISWHITE(*(p + 1))) + { + semsg(_(e_white_space_required_after_str_str), ",", p); + return NULL; + } + p++; + } + + // ensure the list of types ends in a closing '>' + if (*p != '>') + { + semsg(_(e_missing_closing_angle_bracket_in_generic_function_str), + func_name); + return NULL; + } + + // no whitespace allowed before '>' + if (MNV_ISWHITE(*(p - 1))) + { + semsg(_(e_no_white_space_allowed_before_str_str), ">", p); + return NULL; + } + + // at least one type argument is required + if (generic_func_args_table_size(gfatab) == 0) + { + char_u cc = func_name[namelen]; + func_name[namelen] = NUL; + semsg(_(e_empty_type_list_for_generic_function_str), func_name); + func_name[namelen] = cc; + return NULL; + } + ++p; // skip the '>' + + return p; +} + +/* + * Checks if a generic type name already exists in the current context. + * + * This function verifies that the given generic type name "name" does not + * conflict with an imported variable, an existing generic type in the provided + * growarray "gt_gap", or a generic type in the current or outer compile + * context "cctx". If a conflict is found, an appropriate error message is + * reported. + * + * Arguments: + * name - the generic type name to check + * gfatab - args table to allocate new type objects and to store parsed + * type argument names and their types. + * cctx - current compile context, used to check for outer generic types + * (may be NULL) + * + * Returns: + * TRUE if the name already exists or conflicts, FALSE otherwise. + */ + static int +generic_name_exists( + char_u *gt_name, + size_t name_len, + gfargs_tab_T *gfatab, + cctx_T *cctx) +{ + typval_T tv; + + tv.v_type = VAR_UNKNOWN; + + if (eval_variable_import(gt_name, &tv) == OK) + { + semsg(_(e_redefining_script_item_str), gt_name); + clear_tv(&tv); + return TRUE; + } + + for (int i = 0; i < gfatab->gfat_args.ga_len; i++) + { + generic_T *generic = &((generic_T *)gfatab->gfat_args.ga_data)[i]; + + if (STRNCMP(gt_name, generic->gt_name, name_len) == 0) + { + semsg(_(e_duplicate_type_var_name_str), gt_name); + return TRUE; + } + } + + if (cctx != NULL && + find_generic_type_in_cctx(gt_name, name_len, cctx) != NULL) + { + semsg(_(e_duplicate_type_var_name_str), gt_name); + return TRUE; + } + + return FALSE; +} + +/* + * Parses the type parameters specified when defining a new generic function, + * starting at the opening '<' character and ending at the matching '>'. + * + * On entry, "p" must point to the opening '<' character. + * On success, returns a pointer to the character after the closing '>'. + * On failure, returns NULL and reports an error message. + * + * Arguments: + * func_name - the name of the function being defined (for error messages) + * p - pointer to the opening '<' character in the definition + * gfatab - args table to allocate new type objects and to store parsed + * type argument names and their types. + * cctx - current compile context, used to check for duplicate names in + * outer scopes (may be NULL) + * + * This function enforces correct syntax for generic type parameter lists: + * - No whitespace before or after the opening '<' + * - Parameters must be separated by a comma and whitespace + * - No whitespace after a parameter name + * - The list must not be empty + */ + char_u * +parse_generic_func_type_params( + char_u *func_name, + char_u *p, + gfargs_tab_T *gfatab, + cctx_T *cctx) +{ + // No white space allowed before the '<' + if (MNV_ISWHITE(*(p - 1))) + { + semsg(_(e_no_white_space_allowed_before_str_str), "<", p); + return NULL; + } + + if (MNV_ISWHITE(*(p + 1))) + { + semsg(_(e_no_white_space_allowed_after_str_str), "<", p); + return NULL; + } + + char_u *start = ++p; + + while (*p && *p != '>') + { + p = skipwhite(p); + + if (*p == NUL || *p == '>') + { + semsg(_(e_missing_type_after_str), p - 1); + return NULL; + } + + if (!ASCII_ISUPPER(*p)) + { + if (ASCII_ISLOWER(*p)) + semsg(_(e_type_var_name_must_start_with_uppercase_letter_str), p); + else + semsg(_(e_missing_type_after_str), p - 1); + return NULL; + } + + char_u *name_start = p; + char_u *name_end = NULL; + char_u cc; + size_t name_len = 0; + + p++; + while (ASCII_ISALNUM(*p) || *p == '_') + p++; + name_end = p; + + name_len = name_end - name_start; + cc = *name_end; + *name_end = NUL; + + int name_exists = generic_name_exists(name_start, name_len, gfatab, + cctx); + *name_end = cc; + if (name_exists) + return NULL; + + if (ga_grow(&gfatab->gfat_args, 1) == FAIL) + return NULL; + generic_T *generic = + &((generic_T *)gfatab->gfat_args.ga_data)[gfatab->gfat_args.ga_len]; + gfatab->gfat_args.ga_len++; + + generic->gt_name = alloc(name_len + 1); + if (generic->gt_name == NULL) + return NULL; + mnv_strncpy(generic->gt_name, name_start, name_len); + generic->gt_type = NULL; + + if (MNV_ISWHITE(*p)) + { + semsg(_(e_no_white_space_allowed_after_str_str), generic->gt_name, + name_start); + return NULL; + } + + if (*p != ',' && *p != '>') + { + semsg(_(e_missing_comma_in_generic_function_str), start); + return NULL; + } + if (*p == ',') + { + if (!MNV_ISWHITE(*(p + 1))) + { + semsg(_(e_white_space_required_after_str_str), ",", p); + return NULL; + } + p++; + } + } + if (*p != '>') + return NULL; + p++; + + int gfat_sz = generic_func_args_table_size(gfatab); + + if (gfat_sz == 0) + { + emsg_funcname(e_empty_type_list_for_generic_function_str, func_name); + return NULL; + } + + // set the generic params to VAR_ANY type + if (ga_grow(&gfatab->gfat_param_types, gfat_sz) == FAIL) + return NULL; + + gfatab->gfat_param_types.ga_len = gfat_sz; + for (int i = 0; i < generic_func_args_table_size(gfatab); i++) + { + type_T *gt = &((type_T *)gfatab->gfat_param_types.ga_data)[i]; + + CLEAR_POINTER(gt); + gt->tt_type = VAR_ANY; + gt->tt_flags = TTFLAG_GENERIC; + + generic_T *generic = &((generic_T *)gfatab->gfat_args.ga_data)[i]; + generic->gt_type = gt; + } + + return p; +} + +/* + * Initialize a new generic function "fp" using the list of generic types and + * generic arguments in "gfatab". + * + * This function: + * - Marks the function as generic. + * - Sets the generic argument count and stores the type and argument lists. + * - Transfers ownership of the arrays from the growarrays to the function. + * - Initializes the generic function's lookup table. + */ + void +generic_func_init(ufunc_T *fp, gfargs_tab_T *gfatab) +{ + fp->uf_flags |= FC_GENERIC; + fp->uf_generic_argcount = gfatab->gfat_args.ga_len; + fp->uf_generic_args = (generic_T *)gfatab->gfat_args.ga_data; + ga_init(&gfatab->gfat_args); // remove the reference to the args + fp->uf_generic_param_types = (type_T *)gfatab->gfat_param_types.ga_data; + ga_init(&gfatab->gfat_param_types); // remove the reference to the types + ga_init(&fp->uf_generic_arg_types); + hash_init(&fp->uf_generic_functab); +} + +/* + * Initialize the generic function args table + */ + void +generic_func_args_table_init(gfargs_tab_T *gfatab) +{ + ga_init2(&gfatab->gfat_args, sizeof(generic_T), 10); + ga_init2(&gfatab->gfat_param_types, sizeof(type_T), 10); + ga_init2(&gfatab->gfat_arg_types, sizeof(type_T), 10); +} + +/* + * Return the number of entries in the generic function args table + */ + int +generic_func_args_table_size(gfargs_tab_T *gfatab) +{ + return gfatab->gfat_args.ga_len; +} + +/* + * Free all the generic function args table items + */ + void +generic_func_args_table_clear(gfargs_tab_T *gfatab) +{ + clear_type_list(&gfatab->gfat_param_types); + clear_type_list(&gfatab->gfat_arg_types); + for (int i = 0; i < gfatab->gfat_args.ga_len; i++) + { + generic_T *generic = &((generic_T *)gfatab->gfat_args.ga_data)[i]; + MNV_CLEAR(generic->gt_name); + } + ga_clear(&gfatab->gfat_args); +} + +/* + * When a cloning a function "fp" to "new_fp", copy the generic function + * related information. + */ + void +copy_generic_function(ufunc_T *fp, ufunc_T *new_fp) +{ + int i; + int sz; + + if (!IS_GENERIC_FUNC(fp)) + return; + + sz = fp->uf_generic_argcount * sizeof(type_T); + new_fp->uf_generic_param_types = alloc_clear(sz); + if (new_fp->uf_generic_param_types == NULL) + return; + + memcpy(new_fp->uf_generic_param_types, fp->uf_generic_param_types, sz); + + sz = fp->uf_generic_argcount * sizeof(generic_T); + new_fp->uf_generic_args = alloc_clear(sz); + if (new_fp->uf_generic_args == NULL) + { + MNV_CLEAR(new_fp->uf_generic_param_types); + return; + } + memcpy(new_fp->uf_generic_args, fp->uf_generic_args, sz); + + for (i = 0; i < fp->uf_generic_argcount; i++) + new_fp->uf_generic_args[i].gt_name = + mnv_strsave(fp->uf_generic_args[i].gt_name); + + for (i = 0; i < fp->uf_generic_argcount; i++) + new_fp->uf_generic_args[i].gt_type = + &new_fp->uf_generic_param_types[i]; + + ga_init(&new_fp->uf_generic_arg_types); + hash_init(&new_fp->uf_generic_functab); +} + +/* + * Returns the index of the generic type pointer "t" in the generic type list + * of the function "fp". + * + * Arguments: + * fp - pointer to the generic function (ufunc_T) + * t - pointer to the type_T to search for in the function's generic type + * list + * + * Returns: + * The zero-based index of "t" in fp->uf_generic_param_types if found, + * or -1 if not found. + */ + static int +get_generic_type_index(ufunc_T *fp, type_T *t) +{ + for (int i = 0; i < fp->uf_generic_argcount; i++) + { + if (&fp->uf_generic_param_types[i] == t) + return i; + } + return -1; +} + +/* + * Evaluates the type arguments for a generic function call and looks up the + * corresponding concrete function. + * + * Arguments: + * ufunc - the original (possibly generic) function to evaluate + * name - the function name (used for error messages and lookup) + * argp - pointer to a pointer to the argument string; on entry, "*argp" + * should point to the character after the function name (possibly + * '<') + * + * Returns: + * The concrete function corresponding to the given type arguments, + * or NULL on error (with an error message reported). + * + * Behavior: + * - If "ufunc" is a generic function and "*argp" points to '<', attempts to + * find or instantiate the concrete function with the specified type + * arguments. On success, advances "*argp" past the type argument list. + * - If "ufunc" is generic but "*argp" does not point to '<', reports a + * missing type argument error. + * - If "ufunc" is not generic but "*argp" points to '<', reports an error + * that the function is not generic. + * - Otherwise, returns the original function. + */ + ufunc_T * +eval_generic_func( + ufunc_T *ufunc, + char_u *name, + char_u **argp) +{ + if (IS_GENERIC_FUNC(ufunc)) + { + if (**argp == '<') + ufunc = find_generic_func(ufunc, name, argp); + else + { + emsg_funcname(e_generic_func_missing_type_args_str, name); + return NULL; + } + } + else if (**argp == '<') + { + emsg_funcname(e_not_a_generic_function_str, name); + return NULL; + } + + return ufunc; +} + +/* + * Checks if the string at "*argp" represents a generic function call with type + * arguments, i.e., if it starts with a '<', contains a valid type argument + * list, a closing '>', and is immediately followed by '('. + * + * On entry, "*argp" should point to the '<' character. + * If the pattern matches, advances "*argp" to point to the '(' and returns + * TRUE. If not, leaves "*argp" unchanged and returns FALSE. + * + * Example: + * "(" + */ + int +generic_func_call(char_u **argp) +{ + char_u *p = *argp; + + if (*p != '<') + return FALSE; + + if (skip_generic_func_type_args(&p) == FAIL) + return FALSE; + + if (*p != '(') + return FALSE; + + *argp = p; + return TRUE; +} + +/* + * Recursively replaces all occurrences of the generic type "generic_type" in a + * type structure with the corresponding concrete type from "new_ufunc", based + * on the mapping from the original generic function "ufunc". + * + * This is used when instantiating a new function "new_ufunc" from a generic + * function "ufunc" with specific type arguments. The function updates all + * relevant type pointers in place, including nested types (such as lists, + * dictionaries, and tuples). + * + * Arguments: + * ufunc - the original generic function + * new_ufunc - the new function being created with concrete types + * generic_type - the generic type to be replaced (may be a nested type) + * specific_type - pointer to the location where the concrete type should be + * set + * func_type - pointer to the function type to update (may be NULL) + */ + static void +update_generic_type( + ufunc_T *ufunc, + ufunc_T *new_ufunc, + type_T *generic_type, + type_T **specific_type, + type_T **func_type) +{ + int idx; + + switch (generic_type->tt_type) + { + case VAR_ANY: + idx = get_generic_type_index(ufunc, generic_type); + if (idx != -1) + { + *specific_type = new_ufunc->uf_generic_args[idx].gt_type; + if (func_type != NULL) + *func_type = new_ufunc->uf_generic_args[idx].gt_type; + } + break; + case VAR_LIST: + case VAR_DICT: + update_generic_type(ufunc, new_ufunc, generic_type->tt_member, + &(*specific_type)->tt_member, + func_type != NULL ? &(*func_type)->tt_member : NULL); + break; + case VAR_TUPLE: + for (int i = 0; i < generic_type->tt_argcount; i++) + update_generic_type(ufunc, new_ufunc, + generic_type->tt_args[i], + &(*specific_type)->tt_args[i], + func_type != NULL ? &(*func_type)->tt_args[i] : NULL); + break; + case VAR_FUNC: + for (int i = 0; i < generic_type->tt_argcount; i++) + update_generic_type(ufunc, new_ufunc, + generic_type->tt_args[i], + &(*specific_type)->tt_args[i], + func_type != NULL ? &(*func_type)->tt_args[i] : NULL); + update_generic_type(ufunc, new_ufunc, + generic_type->tt_member, + &(*specific_type)->tt_member, + func_type != NULL ? &(*func_type)->tt_member : NULL); + break; + default: + break; + } +} + +/* + * Adds a new concrete instance of a generic function for a specific set of + * type arguments. + * + * Arguments: + * fp - the original generic function to instantiate + * key - a string key representing the specific type arguments (used for + * lookup) + * gfatab - generic function args table containing the parsed type + * arguments and their names + * + * Returns: + * Pointer to the new ufunc_T representing the instantiated function, + * or NULL if the function already exists or on allocation failure. + * + * This function: + * - Checks if a function with the given type arguments already exists. + * - Allocates and initializes a new function instance with the specific + * types. + * - Updates the function's name and expanded name to include the type + * arguments. + * - Copies and updates all relevant type information (argument types, return + * type, vararg type, function type), replacing generic types with the + * actual types. + * - Sets the new function's status to UF_TO_BE_COMPILED. + * - Registers the new function in the generic function's lookup table. + */ + static ufunc_T * +generic_func_add(ufunc_T *fp, char_u *key, gfargs_tab_T *gfatab) +{ + hashtab_T *ht = &fp->uf_generic_functab; + long_u hash; + hashitem_T *hi; + int i; + + hash = hash_hash(key); + hi = hash_lookup(ht, key, hash); + if (!HASHITEM_EMPTY(hi)) + return NULL; + + size_t keylen = STRLEN(key); + gfitem_T *gfitem = alloc(sizeof(gfitem_T) + keylen); + if (gfitem == NULL) + return NULL; + + STRCPY(gfitem->gfi_name, key); + + ufunc_T *new_fp = copy_function(fp, (int)(keylen + 2)); + if (new_fp == NULL) + { + mnv_free(gfitem); + return NULL; + } + + new_fp->uf_generic_arg_types = gfatab->gfat_arg_types; + // now that the type arguments is copied, remove the reference to the type + // arguments + ga_init(&gfatab->gfat_arg_types); + + if (fp->uf_class != NULL) + new_fp->uf_class = fp->uf_class; + + // Create a new name for the function: name + new_fp->uf_name[new_fp->uf_namelen] = '<'; + STRCPY(new_fp->uf_name + new_fp->uf_namelen + 1, key); + new_fp->uf_name[new_fp->uf_namelen + keylen + 1] = '>'; + new_fp->uf_namelen += keylen + 2; + + if (new_fp->uf_name_exp != NULL) + { + char_u *new_name_exp = alloc(STRLEN(new_fp->uf_name_exp) + keylen + 3); + if (new_name_exp != NULL) + { + STRCPY(new_name_exp, new_fp->uf_name_exp); + STRCAT(new_name_exp, "<"); + STRCAT(new_name_exp, key); + STRCAT(new_name_exp, ">"); + mnv_free(new_fp->uf_name_exp); + new_fp->uf_name_exp = new_name_exp; + } + } + + gfitem->gfi_ufunc = new_fp; + gfitem->gfi_ufunc->uf_def_status = UF_TO_BE_COMPILED; + + // create a copy of + // - all the argument types + // - return type + // - vararg type + // - function type + // if any generic type is used, it will be replaced below). + for (i = 0; i < fp->uf_args.ga_len; i++) + new_fp->uf_arg_types[i] = copy_type_deep(fp->uf_arg_types[i], + &new_fp->uf_type_list); + + if (fp->uf_ret_type != NULL) + new_fp->uf_ret_type = copy_type_deep(fp->uf_ret_type, + &new_fp->uf_type_list); + + if (fp->uf_va_type != NULL) + new_fp->uf_va_type = copy_type_deep(fp->uf_va_type, + &new_fp->uf_type_list); + + if (fp->uf_func_type != NULL) + new_fp->uf_func_type = copy_type_deep(fp->uf_func_type, + &new_fp->uf_type_list); + + // Replace the t_any generic types with the actual types + for (i = 0; i < fp->uf_generic_argcount; i++) + { + generic_T *generic_arg; + generic_arg = (generic_T *)gfatab->gfat_args.ga_data + i; + generic_T *gt = &new_fp->uf_generic_args[i]; + gt->gt_type = generic_arg->gt_type; + } + + // Update any generic types in the function arguments + for (i = 0; i < fp->uf_args.ga_len; i++) + update_generic_type(fp, new_fp, fp->uf_arg_types[i], + &new_fp->uf_arg_types[i], + &new_fp->uf_func_type->tt_args[i]); + + // Update the vararg type if it uses generic types + if (fp->uf_va_type != NULL) + update_generic_type(fp, new_fp, fp->uf_va_type, &new_fp->uf_va_type, + NULL); + + // Update the return type if it is a generic type + if (fp->uf_ret_type != NULL) + update_generic_type(fp, new_fp, fp->uf_ret_type, &new_fp->uf_ret_type, + &new_fp->uf_func_type->tt_member); + + hash_add_item(ht, hi, gfitem->gfi_name, hash); + + return new_fp; +} + +/* + * Looks up a concrete instance of a generic function "fp" using the type + * arguments specified in "gfatab". + * + * The lookup key is constructed by concatenating the type argument names from + * "gfatab", separated by ", ", and stored in the provided growarray + * "gfkey_gap". The contents of "gfkey_gap" will be overwritten. + * + * Arguments: + * fp - the generic function to search in + * gfatab - generic function args table containing the parsed type + * arguments and their names + * gfkey_gap - growarray used to build and store the lookup key string + * + * Returns: + * Pointer to the ufunc_T representing the concrete function if found, or + * NULL if no matching function exists. + */ + static ufunc_T * +generic_lookup_func(ufunc_T *fp, gfargs_tab_T *gfatab, garray_T *gfkey_gap) +{ + hashtab_T *ht = &fp->uf_generic_functab; + hashitem_T *hi; + + for (int i = 0; i < gfatab->gfat_args.ga_len; i++) + { + generic_T *generic_arg; + + generic_arg = (generic_T *)gfatab->gfat_args.ga_data + i; + ga_concat(gfkey_gap, generic_arg->gt_name); + + if (i != gfatab->gfat_args.ga_len - 1) + { + ga_append(gfkey_gap, ','); + ga_append(gfkey_gap, ' '); + } + } + ga_append(gfkey_gap, NUL); + + char_u *key = ((char_u *)gfkey_gap->ga_data); + + hi = hash_find(ht, key); + + if (HASHITEM_EMPTY(hi)) + return NULL; + + gfitem_T *gfitem = HI2GFITEM(hi); + return gfitem->gfi_ufunc; +} + +/* + * Returns a concrete instance of the generic function "fp" using the type + * arguments specified in "gfatab". If such an instance does not exist, + * it is created and registered. + * + * Arguments: + * fp - the generic function to instantiate + * gfatab - generic function args table containing the parsed type + * arguments and their names + * + * Returns: + * Pointer to the ufunc_T representing the concrete function instance, + * or NULL if the type arguments are invalid or on allocation failure. + * + * Behavior: + * - If "fp" is not a generic function and no type arguments are given, + * returns "fp" as-is. + * - If "fp" is not generic but type arguments are given, reports an error + * and returns NULL. + * - Validates the number of type arguments, reporting errors for missing, + * too few, or too many. + * - Looks up an existing function instance with the given types. + * - If not found, creates and registers a new function instance. + */ + ufunc_T * +generic_func_get(ufunc_T *fp, gfargs_tab_T *gfatab) +{ + char *emsg = NULL; + + if (!IS_GENERIC_FUNC(fp)) + { + if (gfatab && generic_func_args_table_size(gfatab) > 0) + { + emsg_funcname(e_not_a_generic_function_str, fp->uf_name); + return NULL; + } + return fp; + } + + if (gfatab == NULL || gfatab->gfat_args.ga_len == 0) + emsg = e_generic_func_missing_type_args_str; + else if (gfatab->gfat_args.ga_len < fp->uf_generic_argcount) + emsg = e_not_enough_types_for_generic_function_str; + else if (gfatab->gfat_args.ga_len > fp->uf_generic_argcount) + emsg = e_too_many_types_for_generic_function_str; + + if (emsg != NULL) + { + emsg_funcname(emsg, printable_func_name(fp)); + return NULL; + } + + // generic function call + garray_T gfkey_ga; + + ga_init2(&gfkey_ga, 1, 80); + + // Look up the function with specific types + ufunc_T *generic_fp = generic_lookup_func(fp, gfatab, &gfkey_ga); + if (generic_fp == NULL) + // generic function with these type arguments doesn't exist. + // Create a new one. + generic_fp = generic_func_add(fp, (char_u *)gfkey_ga.ga_data, gfatab); + ga_clear(&gfkey_ga); + + return generic_fp; +} + +/* + * Looks up or creates a concrete instance of a generic function "ufunc" using + * the type arguments specified after the function name in "name". + * + * On entry, "name" points to the function name, and "*argp" points to the + * opening '<' of the type argument list (i.e., name + namelen). + * + * Arguments: + * ufunc - the generic function to instantiate or look up + * name - the function name, followed by the type argument list + * argp - pointer to a pointer to the type argument list (should point to + * '<'); on success, advanced to the character after the closing '>' + * + * Returns: + * Pointer to the ufunc_T representing the concrete function instance if + * successful, or NULL if parsing fails or the instance cannot be created. + * + * This function: + * - Parses the type arguments from the string after the function name. + * - Looks up an existing function instance with those type arguments. + * - If not found, creates and registers a new function instance. + * - Advances "*argp" to after the type argument list on success. + */ + ufunc_T * +find_generic_func(ufunc_T *ufunc, char_u *name, char_u **argp) +{ + gfargs_tab_T gfatab; + char_u *p; + ufunc_T *new_ufunc = NULL; + + generic_func_args_table_init(&gfatab); + + // Get the list of types following the name + p = parse_generic_func_type_args(name, *argp - name, *argp, &gfatab, NULL); + if (p != NULL) + { + new_ufunc = generic_func_get(ufunc, &gfatab); + *argp = p; + } + + generic_func_args_table_clear(&gfatab); + + return new_ufunc; +} + +/* + * Searches for a generic type with the given name "gt_name" in the generic + * function "ufunc". + * + * Arguments: + * gt_name - the name of the generic type to search for + * ufunc - the generic function in which to search for the type + * + * Returns: + * Pointer to the type_T representing the found generic type, + * or NULL if the type is not found or if "ufunc" is not a generic function. + */ + static type_T * +find_generic_type_in_ufunc(char_u *gt_name, size_t name_len, ufunc_T *ufunc) +{ + if (!IS_GENERIC_FUNC(ufunc)) + return NULL; + + for (int i = 0; i < ufunc->uf_generic_argcount; i++) + { + generic_T *generic; + + generic = ((generic_T *)ufunc->uf_generic_args) + i; + if (STRNCMP(generic->gt_name, gt_name, name_len) == 0) + { + type_T *type = generic->gt_type; + return type; + } + } + + return NULL; +} + +/* + * Searches for a generic type with the given name "gt_name" in the current + * function context "cctx" and its outer (enclosing) contexts, if necessary. + * + * Arguments: + * gt_name - the name of the generic type to search for + * cctx - the current compile context, which may be nested + * + * Returns: + * Pointer to the type_T representing the found generic type, + * or NULL if the type is not found in the current or any outer context. + */ + static type_T * +find_generic_type_in_cctx(char_u *gt_name, size_t name_len, cctx_T *cctx) +{ + type_T *type; + + type = find_generic_type_in_ufunc(gt_name, name_len, cctx->ctx_ufunc); + if (type != NULL) + return type; + + if (cctx->ctx_outer != NULL) + return find_generic_type_in_cctx(gt_name, name_len, cctx->ctx_outer); + + return NULL; +} + +/* + * Looks up a generic type with the given name "gt_name" in the generic + * function "ufunc". If not found, searches in the enclosing compile context + * "cctx" (for nested functions). + * + * Arguments: + * gt_name - the name of the generic type to search for + * ufunc - the generic function to search in first (may be NULL) + * cctx - the compile context to search in outer functions if not found + * in "ufunc" (may be NULL) + * + * Returns: + * Pointer to the type_T representing the found generic type, or NULL if the + * type is not found in the given function or any outer context. + */ + type_T * +find_generic_type( + char_u *gt_name, + size_t name_len, + ufunc_T *ufunc, + cctx_T *cctx) +{ + if (ufunc != NULL) + { + type_T *type = find_generic_type_in_ufunc(gt_name, name_len, ufunc); + if (type != NULL) + return type; + } + + if (cctx != NULL && ufunc != cctx->ctx_ufunc) + return find_generic_type_in_cctx(gt_name, name_len, cctx); + + return NULL; +} + +/* + * Frees all concrete function instances stored in the generic function table + * of "fp". This includes freeing each instantiated function and its + * associated gfitem_T structure, and clearing the hash table. + * + * Arguments: + * fp - the generic function whose function table should be freed + */ + static void +free_generic_functab(ufunc_T *fp) +{ + hashtab_T *ht = &fp->uf_generic_functab; + long todo; + hashitem_T *hi; + + todo = (long)ht->ht_used; + FOR_ALL_HASHTAB_ITEMS(ht, hi, todo) + { + if (!HASHITEM_EMPTY(hi)) + { + gfitem_T *gfitem = HI2GFITEM(hi); + + func_clear_free(gfitem->gfi_ufunc, FALSE); + mnv_free(gfitem); + --todo; + } + } + hash_clear(ht); +} + +/* + * Frees all memory and state associated with a generic function "fp". + * This includes the generic type list, generic argument list, and all + * concrete function instances in the generic function table. + * + * Arguments: + * fp - the generic function to clear + */ + void +generic_func_clear_items(ufunc_T *fp) +{ + MNV_CLEAR(fp->uf_generic_param_types); + clear_type_list(&fp->uf_generic_arg_types); + for (int i = 0; i < fp->uf_generic_argcount; i++) + MNV_CLEAR(fp->uf_generic_args[i].gt_name); + MNV_CLEAR(fp->uf_generic_args); + free_generic_functab(fp); + fp->uf_flags &= ~FC_GENERIC; +} + +#endif // FEAT_EVAL diff --git a/uvim/src/mnv9instr.c b/uvim/src/mnv9instr.c new file mode 100644 index 0000000000..d677f97c4e --- /dev/null +++ b/uvim/src/mnv9instr.c @@ -0,0 +1,3008 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * MNV - MNV is not Vim by Bram Moolenaar + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. + */ + +/* + * mnv9instr.c: Dealing with instructions of a compiled function + */ + +#define USING_FLOAT_STUFF +#include "mnv.h" + +#if defined(FEAT_EVAL) + +///////////////////////////////////////////////////////////////////// +// Following generate_ functions expect the caller to call ga_grow(). + +#define RETURN_NULL_IF_SKIP(cctx) if (cctx->ctx_skip == SKIP_YES) return NULL +#define RETURN_OK_IF_SKIP(cctx) if (cctx->ctx_skip == SKIP_YES) return OK + +/* + * Generate an instruction without arguments. + * Returns a pointer to the new instruction, NULL if failed. + */ + isn_T * +generate_instr(cctx_T *cctx, isntype_T isn_type) +{ + garray_T *instr = &cctx->ctx_instr; + isn_T *isn; + + RETURN_NULL_IF_SKIP(cctx); + if (GA_GROW_FAILS(instr, 1)) + return NULL; + isn = ((isn_T *)instr->ga_data) + instr->ga_len; + isn->isn_type = isn_type; + isn->isn_lnum = cctx->ctx_lnum + 1; + ++instr->ga_len; + + return isn; +} + +/* + * Generate an instruction without arguments. + * "drop" will be removed from the stack. + * Returns a pointer to the new instruction, NULL if failed. + */ + isn_T * +generate_instr_drop(cctx_T *cctx, isntype_T isn_type, int drop) +{ + RETURN_NULL_IF_SKIP(cctx); + cctx->ctx_type_stack.ga_len -= drop; + return generate_instr(cctx, isn_type); +} + +/* + * Generate instruction "isn_type" and put "type" on the type stack, + * use "decl_type" for the declared type. + */ + static isn_T * +generate_instr_type2( + cctx_T *cctx, + isntype_T isn_type, + type_T *type, + type_T *decl_type) +{ + isn_T *isn; + + if ((isn = generate_instr(cctx, isn_type)) == NULL) + return NULL; + + if (push_type_stack2(cctx, type == NULL ? &t_any : type, + decl_type == NULL ? &t_any : decl_type) == FAIL) + return NULL; + + return isn; +} + +/* + * Generate instruction "isn_type" and put "type" on the type stack. + * Uses "any" for the declared type, which works for constants. For declared + * variables use generate_instr_type2(). + */ + isn_T * +generate_instr_type(cctx_T *cctx, isntype_T isn_type, type_T *type) +{ + return generate_instr_type2(cctx, isn_type, type, &t_any); +} + +/* + * Generate an ISN_DEBUG instruction. + */ + isn_T * +generate_instr_debug(cctx_T *cctx) +{ + isn_T *isn; + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + cctx->ctx_ufunc->uf_dfunc_idx; + + if ((isn = generate_instr(cctx, ISN_DEBUG)) == NULL) + return NULL; + isn->isn_arg.debug.dbg_var_names_len = dfunc->df_var_names.ga_len; + isn->isn_arg.debug.dbg_break_lnum = cctx->ctx_prev_lnum; + return isn; +} + +/* + * Generate an ISN_CONSTRUCT instruction. + * The object will have "size" members. + */ + int +generate_CONSTRUCT(cctx_T *cctx, class_T *cl) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_CONSTRUCT)) == NULL) + return FAIL; + isn->isn_arg.construct.construct_size = sizeof(object_T) + + cl->class_obj_member_count * sizeof(typval_T); + isn->isn_arg.construct.construct_class = cl; + return OK; +} + +/* + * Generate ISN_GET_OBJ_MEMBER - access member of object at bottom of stack by + * index. + */ + int +generate_GET_OBJ_MEMBER(cctx_T *cctx, int idx, type_T *type) +{ + RETURN_OK_IF_SKIP(cctx); + + // drop the object type + isn_T *isn = generate_instr_drop(cctx, ISN_GET_OBJ_MEMBER, 1); + if (isn == NULL) + return FAIL; + + isn->isn_arg.classmember.cm_class = NULL; + isn->isn_arg.classmember.cm_idx = idx; + return push_type_stack2(cctx, type, &t_any); +} + +/* + * Generate ISN_GET_ITF_MEMBER - access member of interface at bottom of stack + * by index. + */ + int +generate_GET_ITF_MEMBER(cctx_T *cctx, class_T *itf, int idx, type_T *type) +{ + RETURN_OK_IF_SKIP(cctx); + + // drop the object type + isn_T *isn = generate_instr_drop(cctx, ISN_GET_ITF_MEMBER, 1); + if (isn == NULL) + return FAIL; + + isn->isn_arg.classmember.cm_class = itf; + ++itf->class_refcount; + isn->isn_arg.classmember.cm_idx = idx; + return push_type_stack2(cctx, type, &t_any); +} + +/* + * Generate ISN_STORE_THIS - store value in member of "this" object with member + * index "idx". + */ + int +generate_STORE_THIS(cctx_T *cctx, int idx) +{ + RETURN_OK_IF_SKIP(cctx); + + // drop the value type + isn_T *isn = generate_instr_drop(cctx, ISN_STORE_THIS, 1); + if (isn == NULL) + return FAIL; + + isn->isn_arg.number = idx; + return OK; +} + +/* + * If type at "offset" isn't already VAR_STRING then generate ISN_2STRING. + * But only for simple types. + * When tostring_flags has TOSTRING_TOLERANT, convert a List to a series of + * strings. When tostring_flags has TOSTRING_INTERPOLATE, convert a List or a + * Dict to the corresponding textual representation. + */ + int +may_generate_2STRING(int offset, int tostring_flags, cctx_T *cctx) +{ + isn_T *isn; + isntype_T isntype = ISN_2STRING; + type_T *type; + + RETURN_OK_IF_SKIP(cctx); + type = get_type_on_stack(cctx, -1 - offset); + + switch (type->tt_type) + { + // nothing to be done + case VAR_STRING: return OK; + + // conversion possible + case VAR_SPECIAL: + case VAR_BOOL: + case VAR_NUMBER: + case VAR_FLOAT: + break; + + // conversion possible (with runtime check) + case VAR_ANY: + case VAR_UNKNOWN: + isntype = ISN_2STRING_ANY; + break; + + // conversion possible when tolerant + case VAR_LIST: + case VAR_TUPLE: + case VAR_DICT: + if (tostring_flags & TOSTRING_TOLERANT) + { + isntype = ISN_2STRING_ANY; + break; + } + if (tostring_flags & TOSTRING_INTERPOLATE) + break; + // FALLTHROUGH + + // conversion not possible + case VAR_VOID: + case VAR_BLOB: + case VAR_FUNC: + case VAR_PARTIAL: + case VAR_JOB: + case VAR_CHANNEL: + case VAR_INSTR: + case VAR_CLASS: + case VAR_OBJECT: + case VAR_TYPEALIAS: + to_string_error(type->tt_type); + return FAIL; + } + + set_type_on_stack(cctx, &t_string, -1 - offset); + if ((isn = generate_instr(cctx, isntype)) == NULL) + return FAIL; + isn->isn_arg.tostring.offset = offset; + isn->isn_arg.tostring.flags = tostring_flags; + + return OK; +} + + static int +check_number_or_float(type_T *typ1, type_T *typ2, char_u *op) +{ + vartype_T type1 = typ1->tt_type; + vartype_T type2 = typ2->tt_type; + if (!((type1 == VAR_NUMBER || type1 == VAR_FLOAT + || type1 == VAR_ANY || type1 == VAR_UNKNOWN) + && (type2 == VAR_NUMBER || type2 == VAR_FLOAT + || type2 == VAR_ANY || type2 == VAR_UNKNOWN))) + { + if (check_type_is_value(typ1) == FAIL + || check_type_is_value(typ2) == FAIL) + return FAIL; + if (*op == '+') + emsg(_(e_wrong_argument_type_for_plus)); + else + semsg(_(e_char_requires_number_or_float_arguments), *op); + return FAIL; + } + return OK; +} + +/* + * Append the tuple item types from "tuple_type" to the grow array "gap". + */ + static int +ga_append_tuple_types(type_T *tuple_type, garray_T *gap) +{ + for (int i = 0; i < tuple_type->tt_argcount; i++) + { + if (ga_grow(gap, 1) == FAIL) + return FAIL; + + ((type_T **)gap->ga_data)[gap->ga_len] = tuple_type->tt_args[i]; + gap->ga_len++; + } + + return OK; +} + +/* + * When concatenating two tuples, the resulting tuple gets a union of item + * types from both the tuples. This function sets the union tuple type in the + * stack. + * + * Returns OK on success and FAIL on memory allocation failure. + */ + static int +set_tuple_union_type_on_stack(type_T *type1, type_T *type2, cctx_T *cctx) +{ + // The concatenated tuple has the union of types from both the tuples + garray_T tuple_types_ga; + + ga_init2(&tuple_types_ga, sizeof(type_T *), 10); + + if (type1->tt_argcount > 0) + ga_append_tuple_types(type1, &tuple_types_ga); + if (!(type1->tt_flags & TTFLAG_VARARGS) && (type2->tt_argcount > 0)) + ga_append_tuple_types(type2, &tuple_types_ga); + + type_T *new_tuple_type = get_tuple_type(&tuple_types_ga, + cctx->ctx_type_list); + // result inherits the variadic flag from the operands + new_tuple_type->tt_flags |= (type1->tt_flags & TTFLAG_VARARGS) + | (type2->tt_flags & TTFLAG_VARARGS); + + // set the type on the stack for the resulting tuple + set_type_on_stack(cctx, new_tuple_type, 0); + + ga_clear(&tuple_types_ga); + + return OK; +} + +/* + * Generate instruction for "+". For a list this creates a new list. + */ + int +generate_add_instr( + cctx_T *cctx, + vartype_T vartype, + type_T *type1, + type_T *type2, + exprtype_T expr_type) +{ + isn_T *isn = generate_instr_drop(cctx, + vartype == VAR_NUMBER ? ISN_OPNR + : vartype == VAR_LIST ? ISN_ADDLIST + : vartype == VAR_TUPLE ? ISN_ADDTUPLE + : vartype == VAR_BLOB ? ISN_ADDBLOB + : vartype == VAR_FLOAT ? ISN_OPFLOAT + : ISN_OPANY, 1); + + if (vartype != VAR_LIST && vartype != VAR_BLOB && vartype != VAR_TUPLE + && type1->tt_type != VAR_ANY + && type1->tt_type != VAR_UNKNOWN + && type2->tt_type != VAR_ANY + && type2->tt_type != VAR_UNKNOWN + && check_number_or_float(type1, type2, (char_u *)"+") == FAIL) + return FAIL; + + if (isn != NULL) + { + if (isn->isn_type == ISN_ADDLIST) + isn->isn_arg.op.op_type = expr_type; + else + isn->isn_arg.op.op_type = EXPR_ADD; + } + + // When concatenating two lists with different member types the member type + // becomes "any". + if (vartype == VAR_LIST + && type1->tt_type == VAR_LIST && type2->tt_type == VAR_LIST + && type1->tt_member != type2->tt_member) + set_type_on_stack(cctx, &t_list_any, 0); + else if (vartype == VAR_TUPLE) + { + if (!check_tuples_addable(type1, type2)) + return FAIL; + + if (set_tuple_union_type_on_stack(type1, type2, cctx) == FAIL) + return FAIL; + } + + return isn == NULL ? FAIL : OK; +} + +/* + * Get the type to use for an instruction for an operation on "type1" and + * "type2". If they are matching use a type-specific instruction. Otherwise + * fall back to runtime type checking. + */ + vartype_T +operator_type(type_T *type1, type_T *type2) +{ + if (type1->tt_type == type2->tt_type + && (type1->tt_type == VAR_NUMBER + || type1->tt_type == VAR_LIST + || type1->tt_type == VAR_TUPLE + || type1->tt_type == VAR_FLOAT + || type1->tt_type == VAR_BLOB)) + return type1->tt_type; + return VAR_ANY; +} + +/* + * Generate an instruction with two arguments. The instruction depends on the + * type of the arguments. + */ + int +generate_two_op(cctx_T *cctx, char_u *op) +{ + type_T *type1; + type_T *type2; + vartype_T vartype; + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + + // Get the known type of the two items on the stack. + type1 = get_type_on_stack(cctx, 1); + type2 = get_type_on_stack(cctx, 0); + vartype = operator_type(type1, type2); + + switch (*op) + { + case '+': + if (generate_add_instr(cctx, vartype, type1, type2, + EXPR_COPY) == FAIL) + return FAIL; + break; + + case '-': + case '*': + case '/': if (check_number_or_float(type1, type2, op) == FAIL) + return FAIL; + if (vartype == VAR_NUMBER) + isn = generate_instr_drop(cctx, ISN_OPNR, 1); + else if (vartype == VAR_FLOAT) + isn = generate_instr_drop(cctx, ISN_OPFLOAT, 1); + else + isn = generate_instr_drop(cctx, ISN_OPANY, 1); + if (isn != NULL) + isn->isn_arg.op.op_type = *op == '*' + ? EXPR_MULT : *op == '/'? EXPR_DIV : EXPR_SUB; + break; + + case '%': if ((type1->tt_type != VAR_ANY + && type1->tt_type != VAR_UNKNOWN + && type1->tt_type != VAR_NUMBER) + || (type2->tt_type != VAR_ANY + && type2->tt_type != VAR_UNKNOWN + && type2->tt_type != VAR_NUMBER)) + { + emsg(_(e_percent_requires_number_arguments)); + return FAIL; + } + isn = generate_instr_drop(cctx, + vartype == VAR_NUMBER ? ISN_OPNR : ISN_OPANY, 1); + if (isn != NULL) + isn->isn_arg.op.op_type = EXPR_REM; + break; + } + + // correct type of result + if (vartype == VAR_ANY) + { + type_T *type = &t_any; + + // float+number and number+float results in float + if ((type1->tt_type == VAR_NUMBER || type1->tt_type == VAR_FLOAT) + && (type2->tt_type == VAR_NUMBER || type2->tt_type == VAR_FLOAT)) + type = &t_float; + set_type_on_stack(cctx, type, 0); + } + + return OK; +} + +/* + * Choose correct error message for the specified type information. + */ + static isntype_T +compare_isn_not_values(typval_T *tv, type_T *type) +{ + if (tv != NULL) + (void)check_typval_is_value(tv); + else + (void)check_type_is_value(type); + return ISN_DROP; +} + +/* + * Get the instruction to use for comparing two values with specified types. + * Either "tv1" and "tv2" are passed or "type1" and "type2". + * Return ISN_DROP when failed. + */ + static isntype_T +get_compare_isn( + exprtype_T exprtype, + typval_T *tv1, + typval_T *tv2, + type_T *type1, + type_T *type2) +{ + isntype_T isntype = ISN_DROP; + vartype_T vartype1 = tv1 != NULL ? tv1->v_type : type1->tt_type; + vartype_T vartype2 = tv2 != NULL ? tv2->v_type : type2->tt_type; + + if (vartype1 == VAR_CLASS || vartype1 == VAR_TYPEALIAS) + return compare_isn_not_values(tv1, type1); + if (vartype2 == VAR_CLASS || vartype2 == VAR_TYPEALIAS) + return compare_isn_not_values(tv2, type2); + + if (vartype1 == vartype2) + { + switch (vartype1) + { + case VAR_BOOL: isntype = ISN_COMPAREBOOL; break; + case VAR_SPECIAL: isntype = ISN_COMPARESPECIAL; break; + case VAR_NUMBER: isntype = ISN_COMPARENR; break; + case VAR_FLOAT: isntype = ISN_COMPAREFLOAT; break; + case VAR_STRING: isntype = ISN_COMPARESTRING; break; + case VAR_BLOB: isntype = ISN_COMPAREBLOB; break; + case VAR_LIST: isntype = ISN_COMPARELIST; break; + case VAR_TUPLE: isntype = ISN_COMPARETUPLE; break; + case VAR_DICT: isntype = ISN_COMPAREDICT; break; + case VAR_FUNC: isntype = ISN_COMPAREFUNC; break; + case VAR_OBJECT: isntype = ISN_COMPAREOBJECT; break; + default: isntype = ISN_COMPAREANY; break; + } + } + else if (vartype1 == VAR_ANY || vartype2 == VAR_ANY + || ((vartype1 == VAR_NUMBER || vartype1 == VAR_FLOAT) + && (vartype2 == VAR_NUMBER || vartype2 == VAR_FLOAT)) + || (vartype1 == VAR_FUNC && vartype2 == VAR_PARTIAL) + || (vartype1 == VAR_PARTIAL && vartype2 == VAR_FUNC)) + isntype = ISN_COMPAREANY; + else if (vartype1 == VAR_SPECIAL || vartype2 == VAR_SPECIAL) + { + if ((vartype1 == VAR_SPECIAL + && (tv1 != NULL ? tv1->vval.v_number == VVAL_NONE + : type1 == &t_none) + && vartype2 != VAR_STRING) + || (vartype2 == VAR_SPECIAL + && (tv2 != NULL ? tv2->vval.v_number == VVAL_NONE + : type2 == &t_none) + && vartype1 != VAR_STRING)) + { + semsg(_(e_cannot_compare_str_with_str), + vartype_name(vartype1), vartype_name(vartype2)); + return ISN_DROP; + } + // although comparing null with number, float or bool is not useful, we + // allow it + isntype = ISN_COMPARENULL; + } + + if ((exprtype == EXPR_IS || exprtype == EXPR_ISNOT) + && (isntype == ISN_COMPAREBOOL + || isntype == ISN_COMPARESPECIAL + || isntype == ISN_COMPARENR + || isntype == ISN_COMPAREFLOAT)) + { + semsg(_(e_cannot_use_str_with_str), + exprtype == EXPR_IS ? "is" : "isnot" , vartype_name(vartype1)); + return ISN_DROP; + } + if (!(exprtype == EXPR_IS || exprtype == EXPR_ISNOT + || exprtype == EXPR_EQUAL || exprtype == EXPR_NEQUAL) + && (isntype == ISN_COMPAREOBJECT)) + { + semsg(_(e_invalid_operation_for_str), vartype_name(vartype1)); + return ISN_DROP; + } + if (isntype == ISN_DROP + || (isntype != ISN_COMPARENULL + && (((exprtype != EXPR_EQUAL + && exprtype != EXPR_NEQUAL + && (vartype1 == VAR_BOOL || vartype1 == VAR_SPECIAL + || vartype2 == VAR_BOOL || vartype2 == VAR_SPECIAL))) + || ((exprtype != EXPR_EQUAL + && exprtype != EXPR_NEQUAL + && exprtype != EXPR_IS + && exprtype != EXPR_ISNOT + && (vartype1 == VAR_BLOB || vartype2 == VAR_BLOB + || vartype1 == VAR_LIST || vartype2 == VAR_LIST)))))) + { + semsg(_(e_cannot_compare_str_with_str), + vartype_name(vartype1), vartype_name(vartype2)); + return ISN_DROP; + } + return isntype; +} + + int +check_compare_types(exprtype_T type, typval_T *tv1, typval_T *tv2) +{ + if (get_compare_isn(type, tv1, tv2, NULL, NULL) == ISN_DROP) + return FAIL; + return OK; +} + +/* + * Generate an ISN_COMPARE* instruction with a boolean result. + */ + int +generate_COMPARE(cctx_T *cctx, exprtype_T exprtype, int ic) +{ + isntype_T isntype; + isn_T *isn; + garray_T *stack = &cctx->ctx_type_stack; + + RETURN_OK_IF_SKIP(cctx); + + // Get the known type of the two items on the stack. If they are matching + // use a type-specific instruction. Otherwise fall back to runtime type + // checking. + isntype = get_compare_isn(exprtype, NULL, NULL, + get_type_on_stack(cctx, 1), get_type_on_stack(cctx, 0)); + if (isntype == ISN_DROP) + return FAIL; + + if ((isn = generate_instr(cctx, isntype)) == NULL) + return FAIL; + isn->isn_arg.op.op_type = exprtype; + isn->isn_arg.op.op_ic = ic; + + // takes two arguments, puts one bool back + --stack->ga_len; + set_type_on_stack(cctx, &t_bool, 0); + + return OK; +} + +/* + * Generate an ISN_CONCAT instruction. + * "count" is the number of stack elements to join together and it must be + * greater or equal to one. + * The caller ensures all the "count" elements on the stack have the right type. + */ + int +generate_CONCAT(cctx_T *cctx, int count) +{ + isn_T *isn; + garray_T *stack = &cctx->ctx_type_stack; + + RETURN_OK_IF_SKIP(cctx); + + if ((isn = generate_instr(cctx, ISN_CONCAT)) == NULL) + return FAIL; + isn->isn_arg.number = count; + + // drop the argument types + stack->ga_len -= count - 1; + + return OK; +} + +/* + * Generate an ISN_2BOOL instruction. + * "offset" is the offset in the type stack. + */ + int +generate_2BOOL(cctx_T *cctx, int invert, int offset) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_2BOOL)) == NULL) + return FAIL; + isn->isn_arg.tobool.invert = invert; + isn->isn_arg.tobool.offset = offset; + + // type becomes bool + set_type_on_stack(cctx, &t_bool, -1 - offset); + + return OK; +} + +/* + * Generate an ISN_COND2BOOL instruction. + */ + int +generate_COND2BOOL(cctx_T *cctx) +{ + RETURN_OK_IF_SKIP(cctx); + if (generate_instr(cctx, ISN_COND2BOOL) == NULL) + return FAIL; + + // type becomes bool + set_type_on_stack(cctx, &t_bool, 0); + + return OK; +} + + int +generate_TYPECHECK( + cctx_T *cctx, + type_T *expected, + int typechk_flags, // type check flags + int offset, + int is_var, + int argidx) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_CHECKTYPE)) == NULL) + return FAIL; + type_T *tt; + if ((expected->tt_type == VAR_FLOAT + && (typechk_flags & TYPECHK_NUMBER_OK)) + || (expected->tt_type == VAR_LIST + && (typechk_flags & TYPECHK_TUPLE_OK))) + { + // always allocate, also for static types + tt = ALLOC_ONE(type_T); + if (tt != NULL) + { + *tt = *expected; + tt->tt_flags &= ~TTFLAG_STATIC; + if (typechk_flags & TYPECHK_NUMBER_OK) + tt->tt_flags |= TTFLAG_NUMBER_OK; + else + tt->tt_flags |= TTFLAG_TUPLE_OK; + } + } + else + tt = alloc_type(expected); + + isn->isn_arg.type.ct_type = tt; + isn->isn_arg.type.ct_off = (int8_T)offset; + isn->isn_arg.type.ct_is_var = is_var; + isn->isn_arg.type.ct_arg_idx = (int8_T)argidx; + + // type becomes expected + set_type_on_stack(cctx, expected, -1 - offset); + + return OK; +} + + int +generate_SETTYPE( + cctx_T *cctx, + type_T *expected) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_SETTYPE)) == NULL) + return FAIL; + isn->isn_arg.type.ct_type = alloc_type(expected); + return OK; +} + +/* + * Generate an ISN_PUSHOBJ instruction. Object is always NULL. + */ + int +generate_PUSHOBJ(cctx_T *cctx) +{ + RETURN_OK_IF_SKIP(cctx); + if (generate_instr_type(cctx, ISN_PUSHOBJ, &t_object_any) == NULL) + return FAIL; + return OK; +} + +/* + * Generate an ISN_PUSHCLASS instruction. "class" can be NULL. + */ + static int +generate_PUSHCLASS(cctx_T *cctx, class_T *class) +{ + RETURN_OK_IF_SKIP(cctx); + isn_T *isn = generate_instr_type(cctx, ISN_PUSHCLASS, + class == NULL ? &t_any : &class->class_type); + if (isn == NULL) + return FAIL; + isn->isn_arg.classarg = class; + if (class != NULL) + ++class->class_refcount; + return OK; +} + +/* + * Generate a PUSH instruction for "tv". + * "tv" will be consumed or cleared. + */ + int +generate_tv_PUSH(cctx_T *cctx, typval_T *tv) +{ + switch (tv->v_type) + { + case VAR_BOOL: + generate_PUSHBOOL(cctx, tv->vval.v_number); + break; + case VAR_SPECIAL: + generate_PUSHSPEC(cctx, tv->vval.v_number); + break; + case VAR_NUMBER: + generate_PUSHNR(cctx, tv->vval.v_number); + break; + case VAR_FLOAT: + generate_PUSHF(cctx, tv->vval.v_float); + break; + case VAR_BLOB: + generate_PUSHBLOB(cctx, tv->vval.v_blob); + tv->vval.v_blob = NULL; + break; + case VAR_LIST: + if (tv->vval.v_list != NULL) + iemsg("non-empty list constant not supported"); + generate_NEWLIST(cctx, 0, TRUE); + break; + case VAR_TUPLE: + if (tv->vval.v_tuple != NULL) + iemsg("non-empty tuple constant not supported"); + generate_NEWTUPLE(cctx, 0, TRUE); + break; + case VAR_DICT: + if (tv->vval.v_dict != NULL) + iemsg("non-empty dict constant not supported"); + generate_NEWDICT(cctx, 0, TRUE); + break; +#ifdef FEAT_JOB_CHANNEL + case VAR_JOB: + if (tv->vval.v_job != NULL) + iemsg("non-null job constant not supported"); + generate_PUSHJOB(cctx); + break; + case VAR_CHANNEL: + if (tv->vval.v_channel != NULL) + iemsg("non-null channel constant not supported"); + generate_PUSHCHANNEL(cctx); + break; +#endif + case VAR_FUNC: + if (tv->vval.v_string != NULL) + iemsg("non-null function constant not supported"); + generate_PUSHFUNC(cctx, NULL, &t_func_unknown, TRUE); + break; + case VAR_PARTIAL: + if (tv->vval.v_partial != NULL) + iemsg("non-null partial constant not supported"); + if (generate_instr_type(cctx, ISN_NEWPARTIAL, &t_func_unknown) + == NULL) + return FAIL; + break; + case VAR_STRING: + generate_PUSHS(cctx, &tv->vval.v_string); + tv->vval.v_string = NULL; + break; + case VAR_OBJECT: + if (tv->vval.v_object != NULL) + { + emsg(_(e_cannot_use_non_null_object)); + return FAIL; + } + generate_PUSHOBJ(cctx); + break; + case VAR_CLASS: + generate_PUSHCLASS(cctx, tv->vval.v_class); + break; + default: + siemsg("constant type %d not supported", tv->v_type); + clear_tv(tv); + return FAIL; + } + tv->v_type = VAR_UNKNOWN; + return OK; +} + +/* + * Generate an ISN_PUSHNR instruction. + */ + int +generate_PUSHNR(cctx_T *cctx, varnumber_T number) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_type(cctx, ISN_PUSHNR, &t_number)) == NULL) + return FAIL; + isn->isn_arg.number = number; + + if (number == 0 || number == 1) + // A 0 or 1 number can also be used as a bool. + set_type_on_stack(cctx, &t_number_bool, 0); + return OK; +} + +/* + * Generate an ISN_PUSHBOOL instruction. + */ + int +generate_PUSHBOOL(cctx_T *cctx, varnumber_T number) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_type(cctx, ISN_PUSHBOOL, &t_bool)) == NULL) + return FAIL; + isn->isn_arg.number = number; + + return OK; +} + +/* + * Generate an ISN_PUSHSPEC instruction. + */ + int +generate_PUSHSPEC(cctx_T *cctx, varnumber_T number) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_type(cctx, ISN_PUSHSPEC, + number == VVAL_NULL ? &t_null : &t_none)) == NULL) + return FAIL; + isn->isn_arg.number = number; + + return OK; +} + +/* + * Generate an ISN_PUSHF instruction. + */ + int +generate_PUSHF(cctx_T *cctx, float_T fnumber) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_type(cctx, ISN_PUSHF, &t_float)) == NULL) + return FAIL; + isn->isn_arg.fnumber = fnumber; + + return OK; +} + +/* + * Generate an ISN_PUSHS instruction. + * Consumes "*str". When freed *str is set to NULL, unless "str" is NULL. + * Note that if "str" is used in the instruction OK is returned and "*str" is + * not set to NULL. + */ + int +generate_PUSHS(cctx_T *cctx, char_u **str) +{ + isn_T *isn; + int ret = OK; + + if (cctx->ctx_skip != SKIP_YES) + { + if ((isn = generate_instr_type(cctx, ISN_PUSHS, &t_string)) == NULL) + ret = FAIL; + else + { + isn->isn_arg.string = str == NULL ? NULL : *str; + return OK; + } + } + if (str != NULL) + MNV_CLEAR(*str); + return ret; +} + +/* + * Generate an ISN_PUSHCHANNEL instruction. Channel is always NULL. + */ + int +generate_PUSHCHANNEL(cctx_T *cctx) +{ + RETURN_OK_IF_SKIP(cctx); +#ifdef FEAT_JOB_CHANNEL + if (generate_instr_type(cctx, ISN_PUSHCHANNEL, &t_channel) == NULL) + return FAIL; + return OK; +#else + emsg(_(e_channel_job_feature_not_available)); + return FAIL; +#endif +} + +/* + * Generate an ISN_PUSHJOB instruction. Job is always NULL. + */ + int +generate_PUSHJOB(cctx_T *cctx) +{ + RETURN_OK_IF_SKIP(cctx); +#ifdef FEAT_JOB_CHANNEL + if (generate_instr_type(cctx, ISN_PUSHJOB, &t_job) == NULL) + return FAIL; + return OK; +#else + emsg(_(e_channel_job_feature_not_available)); + return FAIL; +#endif +} + +/* + * Generate an ISN_PUSHBLOB instruction. + * Consumes "blob". + */ + int +generate_PUSHBLOB(cctx_T *cctx, blob_T *blob) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_type(cctx, ISN_PUSHBLOB, &t_blob)) == NULL) + return FAIL; + isn->isn_arg.blob = blob; + + return OK; +} + +/* + * Generate an ISN_PUSHFUNC instruction with name "name". + * When "may_prefix" is TRUE prefix "g:" unless "name" is script-local or + * autoload. + */ + int +generate_PUSHFUNC(cctx_T *cctx, char_u *name, type_T *type, int may_prefix) +{ + isn_T *isn; + char_u *funcname; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_type(cctx, ISN_PUSHFUNC, type)) == NULL) + return FAIL; + if (name == NULL) + funcname = NULL; + else if (!may_prefix + || *name == K_SPECIAL // script-local + || mnv_strchr(name, AUTOLOAD_CHAR) != NULL) // autoload + funcname = mnv_strsave(name); + else + { + funcname = alloc(STRLEN(name) + 3); + if (funcname != NULL) + { + STRCPY(funcname, "g:"); + STRCPY(funcname + 2, name); + } + } + + isn->isn_arg.string = funcname; + return OK; +} + +/* + * Generate an ISN_AUTOLOAD instruction. + */ + int +generate_AUTOLOAD(cctx_T *cctx, char_u *name, type_T *type) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_type(cctx, ISN_AUTOLOAD, type)) == NULL) + return FAIL; + isn->isn_arg.string = mnv_strsave(name); + if (isn->isn_arg.string == NULL) + return FAIL; + return OK; +} + +/* + * Generate an ISN_GETITEM instruction with "index". + * "with_op" is TRUE for "+=" and other operators, the stack has the current + * value below the list with values. + * Caller must check the type is a list. + */ + int +generate_GETITEM(cctx_T *cctx, int index, int with_op) +{ + isn_T *isn; + type_T *type = get_type_on_stack(cctx, with_op ? 1 : 0); + type_T *item_type = &t_any; + + RETURN_OK_IF_SKIP(cctx); + + item_type = get_item_type(type); + if ((isn = generate_instr(cctx, ISN_GETITEM)) == NULL) + return FAIL; + isn->isn_arg.getitem.gi_index = index; + isn->isn_arg.getitem.gi_with_op = with_op; + + // add the item type to the type stack + return push_type_stack(cctx, item_type); +} + +/* + * Generate an ISN_SLICE instruction with "count". + */ + int +generate_SLICE(cctx_T *cctx, int count) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_SLICE)) == NULL) + return FAIL; + isn->isn_arg.number = count; + return OK; +} + +/* + * Generate an ISN_CHECKLEN instruction with "min_len". + */ + int +generate_CHECKLEN(cctx_T *cctx, int min_len, int more_OK) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + + if ((isn = generate_instr(cctx, ISN_CHECKLEN)) == NULL) + return FAIL; + isn->isn_arg.checklen.cl_min_len = min_len; + isn->isn_arg.checklen.cl_more_OK = more_OK; + + return OK; +} + +/* + * Generate an ISN_STORE instruction. + */ + int +generate_STORE(cctx_T *cctx, isntype_T isn_type, int idx, char_u *name) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_drop(cctx, isn_type, 1)) == NULL) + return FAIL; + if (name != NULL) + isn->isn_arg.string = mnv_strsave(name); + else + isn->isn_arg.number = idx; + + return OK; +} + +/* + * Generate an ISN_LOAD_CLASSMEMBER ("load" == TRUE) or ISN_STORE_CLASSMEMBER + * ("load" == FALSE) instruction. + */ + int +generate_CLASSMEMBER( + cctx_T *cctx, + int load, + class_T *cl, + int idx) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if (load) + { + ocmember_T *m = &cl->class_class_members[idx]; + isn = generate_instr_type(cctx, ISN_LOAD_CLASSMEMBER, m->ocm_type); + } + else + { + isn = generate_instr_drop(cctx, ISN_STORE_CLASSMEMBER, 1); + } + if (isn == NULL) + return FAIL; + isn->isn_arg.classmember.cm_class = cl; + ++cl->class_refcount; + isn->isn_arg.classmember.cm_idx = idx; + + return OK; +} + +/* + * Generate an ISN_STOREOUTER instruction. + */ + static int +generate_STOREOUTER(cctx_T *cctx, int idx, int level, int loop_idx) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_drop(cctx, ISN_STOREOUTER, 1)) == NULL) + return FAIL; + if (level == 1 && loop_idx >= 0 && idx >= loop_idx) + { + // Store a variable defined in a loop. A copy will be made at the end + // of the loop. TODO: how about deeper nesting? + isn->isn_arg.outer.outer_idx = idx - loop_idx; + isn->isn_arg.outer.outer_depth = OUTER_LOOP_DEPTH; + } + else + { + isn->isn_arg.outer.outer_idx = idx; + isn->isn_arg.outer.outer_depth = level; + } + + return OK; +} + +/* + * Generate an ISN_STORENR instruction (short for ISN_PUSHNR + ISN_STORE) + */ + int +generate_STORENR(cctx_T *cctx, int idx, varnumber_T value) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_STORENR)) == NULL) + return FAIL; + isn->isn_arg.storenr.stnr_idx = idx; + isn->isn_arg.storenr.stnr_val = value; + + return OK; +} + +/* + * Generate an ISN_STOREOPT or ISN_STOREFUNCOPT instruction + */ + static int +generate_STOREOPT( + cctx_T *cctx, + isntype_T isn_type, + char_u *name, + int opt_flags) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_drop(cctx, isn_type, 1)) == NULL) + return FAIL; + isn->isn_arg.storeopt.so_name = mnv_strsave(name); + isn->isn_arg.storeopt.so_flags = opt_flags; + + return OK; +} + +/* + * Generate an ISN_LOAD or similar instruction. + */ + int +generate_LOAD( + cctx_T *cctx, + isntype_T isn_type, + int idx, + char_u *name, + type_T *type) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_type2(cctx, isn_type, type, type)) == NULL) + return FAIL; + if (name != NULL) + isn->isn_arg.string = mnv_strsave(name); + else + isn->isn_arg.number = idx; + + return OK; +} + +/* + * Generate an ISN_LOADOUTER instruction + */ + int +generate_LOADOUTER( + cctx_T *cctx, + int idx, + int nesting, + int loop_depth, + int loop_idx, + type_T *type) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_type2(cctx, ISN_LOADOUTER, type, type)) == NULL) + return FAIL; + if (nesting == 1 && loop_idx >= 0 && idx >= loop_idx) + { + // Load a variable defined in a loop. A copy will be made at the end + // of the loop. + isn->isn_arg.outer.outer_idx = idx - loop_idx; + isn->isn_arg.outer.outer_depth = -loop_depth - 1; + } + else + { + isn->isn_arg.outer.outer_idx = idx; + isn->isn_arg.outer.outer_depth = nesting; + } + + return OK; +} + +/* + * Generate an ISN_LOADV instruction for v:var. + */ + int +generate_LOADV( + cctx_T *cctx, + char_u *name) +{ + int di_flags; + int vidx = find_mnv_var(name, &di_flags); + type_T *type; + + RETURN_OK_IF_SKIP(cctx); + if (vidx < 0) + { + semsg(_(e_variable_not_found_str), name); + return FAIL; + } + type = get_mnv_var_type(vidx, cctx->ctx_type_list); + return generate_LOAD(cctx, ISN_LOADV, vidx, NULL, type); +} + +/* + * Generate an ISN_UNLET instruction. + */ + int +generate_UNLET(cctx_T *cctx, isntype_T isn_type, char_u *name, int forceit) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, isn_type)) == NULL) + return FAIL; + isn->isn_arg.unlet.ul_name = mnv_strsave(name); + isn->isn_arg.unlet.ul_forceit = forceit; + + return OK; +} + +/* + * Generate an ISN_LOCKCONST instruction. + */ + int +generate_LOCKCONST(cctx_T *cctx) +{ + RETURN_OK_IF_SKIP(cctx); + if (generate_instr(cctx, ISN_LOCKCONST) == NULL) + return FAIL; + return OK; +} + +/* + * Generate an ISN_LOADS instruction. + */ + int +generate_OLDSCRIPT( + cctx_T *cctx, + isntype_T isn_type, + char_u *name, + int sid, + type_T *type) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if (isn_type == ISN_LOADS || isn_type == ISN_LOADEXPORT) + isn = generate_instr_type(cctx, isn_type, type); + else + isn = generate_instr_drop(cctx, isn_type, 1); + if (isn == NULL) + return FAIL; + isn->isn_arg.loadstore.ls_name = mnv_strsave(name); + isn->isn_arg.loadstore.ls_sid = sid; + + return OK; +} + +/* + * Generate an ISN_LOADSCRIPT or ISN_STORESCRIPT instruction. + */ + int +generate_MNV9SCRIPT( + cctx_T *cctx, + isntype_T isn_type, + int sid, + int idx, + type_T *type) +{ + isn_T *isn; + scriptref_T *sref; + scriptitem_T *si = SCRIPT_ITEM(sid); + + RETURN_OK_IF_SKIP(cctx); + if (isn_type == ISN_LOADSCRIPT) + isn = generate_instr_type2(cctx, isn_type, type, type); + else + isn = generate_instr_drop(cctx, isn_type, 1); + if (isn == NULL) + return FAIL; + + // This requires three arguments, which doesn't fit in an instruction, thus + // we need to allocate a struct for this. + sref = ALLOC_ONE(scriptref_T); + if (sref == NULL) + return FAIL; + isn->isn_arg.script.scriptref = sref; + sref->sref_sid = sid; + sref->sref_idx = idx; + sref->sref_seq = si->sn_script_seq; + sref->sref_type = type; + return OK; +} + +/* + * Generate an ISN_NEWLIST instruction for "count" items. + * "use_null" is TRUE for null_list. + */ + int +generate_NEWLIST(cctx_T *cctx, int count, int use_null) +{ + isn_T *isn; + type_T *member_type; + type_T *type; + type_T *decl_type; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_NEWLIST)) == NULL) + return FAIL; + isn->isn_arg.number = use_null ? -1 : count; + + // Get the member type and the declared member type from all the items on + // the stack. + if ((member_type = get_member_type_from_stack(count, 1, cctx)) == NULL) + return FAIL; + type = get_list_type(member_type, cctx->ctx_type_list); + decl_type = get_list_type(&t_any, cctx->ctx_type_list); + + // drop the value types + cctx->ctx_type_stack.ga_len -= count; + + // add the list type to the type stack + return push_type_stack2(cctx, type, decl_type); +} + +/* + * Generate an ISN_NEWTUPLE instruction for "count" items. + * "use_null" is TRUE for null_tuple. + */ + int +generate_NEWTUPLE(cctx_T *cctx, int count, int use_null) +{ + isn_T *isn; + type_T *type; + type_T *decl_type; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_NEWTUPLE)) == NULL) + return FAIL; + isn->isn_arg.number = use_null ? -1 : count; + + // Get the member type and the declared member type from all the items on + // the stack. + garray_T tuple_types_ga; + ga_init2(&tuple_types_ga, sizeof(type_T *), 10); + + if (get_tuple_type_from_stack(count, &tuple_types_ga, cctx) < 0) + { + ga_clear(&tuple_types_ga); + return FAIL; + } + + type = get_tuple_type(&tuple_types_ga, cctx->ctx_type_list); + decl_type = &t_tuple_any; + + ga_clear(&tuple_types_ga); + + // drop the value types + cctx->ctx_type_stack.ga_len -= count; + + // add the tuple type to the type stack + return push_type_stack2(cctx, type, decl_type); +} + +/* + * Generate an ISN_NEWDICT instruction. + * "use_null" is TRUE for null_dict. + */ + int +generate_NEWDICT(cctx_T *cctx, int count, int use_null) +{ + isn_T *isn; + type_T *member_type; + type_T *type; + type_T *decl_type; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_NEWDICT)) == NULL) + return FAIL; + isn->isn_arg.number = use_null ? -1 : count; + + if ((member_type = get_member_type_from_stack(count, 2, cctx)) == NULL) + return FAIL; + type = get_dict_type(member_type, cctx->ctx_type_list); + decl_type = get_dict_type(&t_any, cctx->ctx_type_list); + + // drop the key and value types + cctx->ctx_type_stack.ga_len -= 2 * count; + + // add the dict type to the type stack + return push_type_stack2(cctx, type, decl_type); +} + +/* + * Generate an ISN_FUNCREF instruction. + * For "obj.Method" "cl" is the class of the object (can be an interface or a + * base class) and "fi" the index of the method on that class. + * "isn_idx" is set to the index of the instruction, so that fr_dfunc_idx can + * be set later. The index is used instead of a pointer to the instruction + * because the instruction memory can be reallocated. + */ + int +generate_FUNCREF( + cctx_T *cctx, + ufunc_T *ufunc, + class_T *cl, + int object_method, + int fi, + int *isn_idx) +{ + isn_T *isn; + type_T *type; + funcref_extra_T *extra; + loopvarinfo_T loopinfo; + int has_vars; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_FUNCREF)) == NULL) + return FAIL; + if (isn_idx != NULL) + // save the index of the new instruction + *isn_idx = cctx->ctx_instr.ga_len - 1; + + has_vars = get_loop_var_info(cctx, &loopinfo); + if (ufunc->uf_def_status == UF_NOT_COMPILED || has_vars || cl != NULL) + { + extra = ALLOC_CLEAR_ONE(funcref_extra_T); + if (extra == NULL) + return FAIL; + isn->isn_arg.funcref.fr_extra = extra; + extra->fre_loopvar_info = loopinfo; + if (cl != NULL) + { + extra->fre_class = cl; + ++cl->class_refcount; + extra->fre_object_method = object_method; + extra->fre_method_idx = fi; + } + } + if (ufunc->uf_def_status == UF_NOT_COMPILED || cl != NULL) + extra->fre_func_name = mnv_strnsave(ufunc->uf_name, ufunc->uf_namelen); + if (ufunc->uf_def_status != UF_NOT_COMPILED && cl == NULL) + { + if (isn_idx == NULL && ufunc->uf_def_status == UF_TO_BE_COMPILED) + // compile the function now, we need the uf_dfunc_idx value + (void)compile_def_function(ufunc, FALSE, CT_NONE, NULL); + isn->isn_arg.funcref.fr_dfunc_idx = ufunc->uf_dfunc_idx; + } + + // Reserve an extra variable to keep track of the number of closures + // created. + cctx->ctx_has_closure = 1; + + // If the referenced function is a closure, it may use items further up in + // the nested context, including this one. But not a function defined at + // the script level. + if ((ufunc->uf_flags & FC_CLOSURE) + && func_name_refcount(cctx->ctx_ufunc->uf_name)) + cctx->ctx_ufunc->uf_flags |= FC_CLOSURE; + + type = ufunc->uf_func_type == NULL ? &t_func_any : ufunc->uf_func_type; + return push_type_stack(cctx, type); +} + +/* + * Generate an ISN_NEWFUNC instruction. + * "lambda_name" and "func_name" must be in allocated memory and will be + * consumed. + */ + int +generate_NEWFUNC( + cctx_T *cctx, + char_u *lambda_name, + char_u *func_name) +{ + isn_T *isn; + int ret = OK; + + if (cctx->ctx_skip != SKIP_YES) + { + if ((isn = generate_instr(cctx, ISN_NEWFUNC)) == NULL) + ret = FAIL; + else + { + newfuncarg_T *arg = ALLOC_CLEAR_ONE(newfuncarg_T); + + if (arg == NULL) + ret = FAIL; + else + { + // Reserve an extra variable to keep track of the number of + // closures created. + cctx->ctx_has_closure = 1; + + isn->isn_arg.newfunc.nf_arg = arg; + arg->nfa_lambda = lambda_name; + arg->nfa_global = func_name; + (void)get_loop_var_info(cctx, &arg->nfa_loopvar_info); + return OK; + } + } + } + mnv_free(lambda_name); + mnv_free(func_name); + return ret; +} + +/* + * Generate an ISN_DEF instruction: list functions + */ + int +generate_DEF(cctx_T *cctx, char_u *name, size_t len) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_DEF)) == NULL) + return FAIL; + if (len > 0) + { + isn->isn_arg.string = mnv_strnsave(name, len); + if (isn->isn_arg.string == NULL) + return FAIL; + } + return OK; +} + +/* + * Generate an ISN_JUMP instruction. + */ + int +generate_JUMP(cctx_T *cctx, jumpwhen_T when, int where) +{ + isn_T *isn; + garray_T *stack = &cctx->ctx_type_stack; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_JUMP)) == NULL) + return FAIL; + isn->isn_arg.jump.jump_when = when; + isn->isn_arg.jump.jump_where = where; + + if (when != JUMP_ALWAYS && stack->ga_len > 0) + --stack->ga_len; + + return OK; +} + +/* + * Generate an ISN_WHILE instruction. Similar to ISN_JUMP for :while + */ + int +generate_WHILE(cctx_T *cctx, int funcref_idx) +{ + isn_T *isn; + garray_T *stack = &cctx->ctx_type_stack; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_WHILE)) == NULL) + return FAIL; + isn->isn_arg.whileloop.while_funcref_idx = funcref_idx; + isn->isn_arg.whileloop.while_end = 0; // filled in later + + if (stack->ga_len > 0) + --stack->ga_len; + + return OK; +} + +/* + * Generate an ISN_JUMP_IF_ARG_SET or ISN_JUMP_IF_ARG_NOT_SET instruction. + */ + int +generate_JUMP_IF_ARG(cctx_T *cctx, isntype_T isn_type, int arg_off) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, isn_type)) == NULL) + return FAIL; + isn->isn_arg.jumparg.jump_arg_off = arg_off; + // jump_where is set later + return OK; +} + + int +generate_FOR(cctx_T *cctx, int loop_idx) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_FOR)) == NULL) + return FAIL; + isn->isn_arg.forloop.for_loop_idx = loop_idx; + + // type doesn't matter, will be stored next + return push_type_stack(cctx, &t_any); +} + + int +generate_ENDLOOP(cctx_T *cctx, loop_info_T *loop_info) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_ENDLOOP)) == NULL) + return FAIL; + isn->isn_arg.endloop.end_depth = loop_info->li_depth; + isn->isn_arg.endloop.end_funcref_idx = loop_info->li_funcref_idx; + isn->isn_arg.endloop.end_var_idx = loop_info->li_local_count; + isn->isn_arg.endloop.end_var_count = + cctx->ctx_locals.ga_len - loop_info->li_local_count; + return OK; +} + +/* + * Generate an ISN_TRYCONT instruction. + */ + int +generate_TRYCONT(cctx_T *cctx, int levels, int where) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_TRYCONT)) == NULL) + return FAIL; + isn->isn_arg.trycont.tct_levels = levels; + isn->isn_arg.trycont.tct_where = where; + + return OK; +} + +/* + * Check "argount" arguments and their types on the type stack. + * Give an error and return FAIL if something is wrong. + * When "method_call" is NULL no code is generated. + */ + int +check_internal_func_args( + cctx_T *cctx, + int func_idx, + int argcount, + int method_call, + type2_T **argtypes, + type2_T *shuffled_argtypes) +{ + garray_T *stack = &cctx->ctx_type_stack; + int argoff = check_internal_func(func_idx, argcount); + + if (argoff < 0) + return FAIL; + + if (method_call && argoff > 1) + { + if (argcount < argoff) + { + semsg(_(e_not_enough_arguments_for_function_str), + internal_func_name(func_idx)); + return FAIL; + } + + isn_T *isn = generate_instr(cctx, ISN_SHUFFLE); + if (isn == NULL) + return FAIL; + isn->isn_arg.shuffle.shfl_item = argcount; + isn->isn_arg.shuffle.shfl_up = argoff - 1; + } + + if (argcount > 0) + { + type2_T *typep = ((type2_T *)stack->ga_data) + stack->ga_len - argcount; + + // Check the types of the arguments. + if (method_call && argoff > 1) + { + int i; + + for (i = 0; i < argcount; ++i) + shuffled_argtypes[i] = (i < argoff - 1) + ? typep[i + 1] + : (i == argoff - 1) ? typep[0] : typep[i]; + *argtypes = shuffled_argtypes; + } + else + { + int i; + + for (i = 0; i < argcount; ++i) + shuffled_argtypes[i] = typep[i]; + *argtypes = shuffled_argtypes; + } + if (internal_func_check_arg_types(*argtypes, func_idx, argcount, + cctx) == FAIL) + return FAIL; + } + return OK; +} + +/* + * Generate an ISN_BCALL instruction. + * "method_call" is TRUE for "value->method()" + * Return FAIL if the number of arguments is wrong. + */ + int +generate_BCALL(cctx_T *cctx, int func_idx, int argcount, int method_call) +{ + isn_T *isn; + garray_T *stack = &cctx->ctx_type_stack; + type2_T *argtypes = NULL; + type2_T shuffled_argtypes[MAX_FUNC_ARGS]; + type2_T *maptype = NULL; + type_T *type; + type_T *decl_type; + + RETURN_OK_IF_SKIP(cctx); + + if (check_internal_func_args(cctx, func_idx, argcount, method_call, + &argtypes, shuffled_argtypes) == FAIL) + return FAIL; + + if (internal_func_is_map(func_idx)) + maptype = argtypes; + + if ((isn = generate_instr(cctx, ISN_BCALL)) == NULL) + return FAIL; + isn->isn_arg.bfunc.cbf_idx = func_idx; + isn->isn_arg.bfunc.cbf_argcount = argcount; + + // Drop the argument types and push the return type. + stack->ga_len -= argcount; + type = internal_func_ret_type(func_idx, argcount, argtypes, &decl_type, + cctx->ctx_type_list); + if (push_type_stack2(cctx, type, decl_type) == FAIL) + return FAIL; + + if (maptype != NULL && maptype[0].type_decl->tt_member != NULL + && maptype[0].type_decl->tt_member != &t_any) + // Check that map() didn't change the item types. + generate_TYPECHECK(cctx, maptype[0].type_decl, 0, -1, FALSE, 1); + + return OK; +} + +/* + * Generate an ISN_LISTAPPEND instruction. Works like add(). + * Argument count is already checked. + */ + int +generate_LISTAPPEND(cctx_T *cctx) +{ + type_T *list_type; + type_T *item_type; + type_T *expected; + + // Caller already checked that list_type is a list. + // For checking the item type we use the declared type of the list and the + // current type of the added item, adding a string to [1, 2] is OK. + list_type = get_decl_type_on_stack(cctx, 1); + if (arg_type_modifiable(list_type, 1) == FAIL) + return FAIL; + item_type = get_type_on_stack(cctx, 0); + expected = list_type->tt_member; + if (need_type(item_type, expected, 0, -1, 0, cctx, FALSE, FALSE) == FAIL) + return FAIL; + + if (generate_instr(cctx, ISN_LISTAPPEND) == NULL) + return FAIL; + + --cctx->ctx_type_stack.ga_len; // drop the argument + return OK; +} + +/* + * Generate an ISN_BLOBAPPEND instruction. Works like add(). + * Argument count is already checked. + */ + int +generate_BLOBAPPEND(cctx_T *cctx) +{ + type_T *item_type; + + // Caller already checked that blob_type is a blob, check it is modifiable. + if (arg_type_modifiable(get_decl_type_on_stack(cctx, 1), 1) == FAIL) + return FAIL; + item_type = get_type_on_stack(cctx, 0); + if (need_type(item_type, &t_number, 0, -1, 0, cctx, FALSE, FALSE) == FAIL) + return FAIL; + + if (generate_instr(cctx, ISN_BLOBAPPEND) == NULL) + return FAIL; + + --cctx->ctx_type_stack.ga_len; // drop the argument + return OK; +} + +/* + * Get the instruction type for a function call: + * ISN_METHODCALL - object method call via interface + * ISN_DCALL - compiled def function call + * ISN_UCALL - uncompiled function, or + * compiled script-local function called from a lambda + */ + static isntype_T +isn_get_calltype( + cctx_T *cctx, + ufunc_T *ufunc, + class_T *cl) +{ + if (cl != NULL) + return ISN_METHODCALL; + + if (ufunc->uf_def_status == UF_NOT_COMPILED) + return ISN_UCALL; + + // function invoked from a lambda + if (cctx->ctx_ufunc->uf_flags & FC_LAMBDA) + { + // Script-local funcs in a lambda may be redefined by re-sourcing; + // resolve by name at runtime. Patched to ISN_DCALL on next call once + // recompiled. + if (ufunc->uf_name[0] == K_SPECIAL) + return ISN_UCALL; + } + + return ISN_DCALL; +} + +/* + * Generate an ISN_DCALL, ISN_UCALL or ISN_METHODCALL instruction. + * When calling a method on an object, of which we know the interface only, + * then "cl" is the interface and "mi" the method index on the interface. + * save is_super in the "isn->isn_arg"; it flags execution to use mfunc + * directly to determine ufunc. + * Return FAIL if the number of arguments is wrong. + */ + int +generate_CALL( + cctx_T *cctx, + ufunc_T *ufunc, + class_T *cl, + int mi, + int pushed_argcount, + int is_super) +{ + isn_T *isn; + int regular_args = ufunc->uf_args.ga_len; + int argcount = pushed_argcount; + + RETURN_OK_IF_SKIP(cctx); + if (argcount > regular_args && !has_varargs(ufunc)) + { + semsg(_(e_too_many_arguments_for_function_str), + printable_func_name(ufunc)); + return FAIL; + } + if (argcount < regular_args - ufunc->uf_def_args.ga_len) + { + semsg(_(e_not_enough_arguments_for_function_str), + printable_func_name(ufunc)); + return FAIL; + } + + if (ufunc->uf_def_status != UF_NOT_COMPILED + && ufunc->uf_def_status != UF_COMPILE_ERROR) + { + int i; + compiletype_T compile_type; + + for (i = 0; i < argcount; ++i) + { + type_T *expected; + type_T *actual; + + actual = get_type_on_stack(cctx, argcount - i - 1); + if (check_type_is_value(actual) == FAIL) + return FAIL; + if (actual->tt_type == VAR_SPECIAL + && i >= regular_args - ufunc->uf_def_args.ga_len) + { + // assume v:none used for default argument value + continue; + } + if (i < regular_args) + { + if (ufunc->uf_arg_types == NULL) + continue; + expected = ufunc->uf_arg_types[i]; + } + else if (ufunc->uf_va_type == NULL + || ufunc->uf_va_type == &t_list_any) + // possibly a lambda or "...: any" + expected = &t_any; + else + expected = ufunc->uf_va_type->tt_member; + if (need_type(actual, expected, 0, + -argcount + i, i + 1, cctx, TRUE, FALSE) == FAIL) + { + arg_type_mismatch(expected, actual, i + 1); + return FAIL; + } + } + compile_type = get_compile_type(ufunc); + if (func_needs_compiling(ufunc, compile_type) + && compile_def_function(ufunc, ufunc->uf_ret_type == NULL, + compile_type, NULL) == FAIL) + return FAIL; + } + if (ufunc->uf_def_status == UF_COMPILE_ERROR) + { + emsg_funcname(e_call_to_function_that_failed_to_compile_str, + ufunc->uf_name); + return FAIL; + } + + if ((isn = generate_instr(cctx, isn_get_calltype(cctx, ufunc, cl))) == NULL) + return FAIL; + if (cl != NULL /* isn->isn_type == ISN_METHODCALL */) + { + isn->isn_arg.mfunc = ALLOC_ONE(cmfunc_T); + if (isn->isn_arg.mfunc == NULL) + return FAIL; + isn->isn_arg.mfunc->cmf_itf = cl; + ++cl->class_refcount; + isn->isn_arg.mfunc->cmf_idx = mi; + isn->isn_arg.mfunc->cmf_argcount = argcount; + isn->isn_arg.mfunc->cmf_is_super = is_super; + } + else if (isn->isn_type == ISN_DCALL) + { + isn->isn_arg.dfunc.cdf_idx = ufunc->uf_dfunc_idx; + isn->isn_arg.dfunc.cdf_argcount = argcount; + } + else + { + // A user function may be deleted and redefined later, can't use the + // ufunc pointer, need to look it up again at runtime. + isn->isn_arg.ufunc.cuf_name = mnv_strnsave(ufunc->uf_name, ufunc->uf_namelen); + isn->isn_arg.ufunc.cuf_argcount = argcount; + } + + // drop the argument types + cctx->ctx_type_stack.ga_len -= argcount; + + // For an object or class method call, drop the object/class type. + if (ufunc->uf_class != NULL) + { + // When a class method is called without the class name prefix, then + // the type will not be in the stack. + type_T *stype = get_type_on_stack(cctx, 0); + if (stype->tt_type == VAR_CLASS || stype->tt_type == VAR_OBJECT) + cctx->ctx_type_stack.ga_len--; + } + + // add return type + return push_type_stack(cctx, ufunc->uf_ret_type); +} + +/* + * Generate an ISN_UCALL instruction when the function isn't defined yet. + */ + int +generate_UCALL(cctx_T *cctx, char_u *name, int argcount) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_UCALL)) == NULL) + return FAIL; + isn->isn_arg.ufunc.cuf_name = mnv_strsave(name); + isn->isn_arg.ufunc.cuf_argcount = argcount; + + // drop the argument types + cctx->ctx_type_stack.ga_len -= argcount; + + // add return value + return push_type_stack(cctx, &t_any); +} + +/* + * Check the arguments of function "type" against the types on the stack. + * Returns OK or FAIL; + */ + int +check_func_args_from_type( + cctx_T *cctx, + type_T *type, + int argcount, + int at_top, + char_u *name) +{ + if (type->tt_argcount != -1) + { + int varargs = (type->tt_flags & TTFLAG_VARARGS) ? 1 : 0; + + if (argcount < type->tt_min_argcount - varargs) + { + emsg_funcname(e_not_enough_arguments_for_function_str, name); + return FAIL; + } + if (!varargs && argcount > type->tt_argcount) + { + emsg_funcname(e_too_many_arguments_for_function_str, name); + return FAIL; + } + if (type->tt_args != NULL) + { + int i; + + for (i = 0; i < argcount; ++i) + { + int offset = -argcount + i - (at_top ? 0 : 1); + type_T *actual = get_type_on_stack(cctx, -1 - offset); + type_T *expected; + + if (check_type_is_value(actual) == FAIL) + return FAIL; + if (varargs && i >= type->tt_argcount - 1) + { + expected = type->tt_args[type->tt_argcount - 1]; + if (expected != NULL && expected->tt_type == VAR_LIST) + expected = expected->tt_member; + if (expected == NULL) + expected = &t_any; + } + else if (i >= type->tt_min_argcount + && actual->tt_type == VAR_SPECIAL) + expected = &t_any; + else + expected = type->tt_args[i]; + if (need_type(actual, expected, 0, + offset, i + 1, cctx, TRUE, FALSE) == FAIL) + { + arg_type_mismatch(expected, actual, i + 1); + return FAIL; + } + } + } + } + + return OK; +} + +/* + * Generate an ISN_PCALL instruction. + * "type" is the type of the FuncRef. + */ + int +generate_PCALL( + cctx_T *cctx, + int argcount, + char_u *name, + type_T *type, + int at_top) +{ + isn_T *isn; + type_T *ret_type; + + RETURN_OK_IF_SKIP(cctx); + + if (type->tt_type == VAR_ANY || type->tt_type == VAR_UNKNOWN + || type == &t_object_any) + ret_type = &t_any; + else if (type->tt_type == VAR_FUNC || type->tt_type == VAR_PARTIAL) + { + if (check_func_args_from_type(cctx, type, argcount, at_top, name) + == FAIL) + return FAIL; + + ret_type = type->tt_member; + if (ret_type == &t_unknown) + // return type not known yet, use a runtime check + ret_type = &t_any; + } + else + { + semsg(_(e_not_callable_type_str), name); + return FAIL; + } + + if ((isn = generate_instr(cctx, ISN_PCALL)) == NULL) + return FAIL; + isn->isn_arg.pfunc.cpf_top = at_top; + isn->isn_arg.pfunc.cpf_argcount = argcount; + + // drop the arguments and the funcref/partial + cctx->ctx_type_stack.ga_len -= argcount + 1; + + // push the return value + push_type_stack(cctx, ret_type); + + // If partial is above the arguments it must be cleared and replaced with + // the return value. + if (at_top && generate_instr(cctx, ISN_PCALL_END) == NULL) + return FAIL; + + return OK; +} + +/* + * Generate an ISN_DEFER instruction. + */ + int +generate_DEFER(cctx_T *cctx, int var_idx, int argcount) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_drop(cctx, ISN_DEFER, argcount + 1)) == NULL) + return FAIL; + isn->isn_arg.defer.defer_var_idx = var_idx; + isn->isn_arg.defer.defer_argcount = argcount; + return OK; +} + +/* + * Generate an ISN_STRINGMEMBER instruction. + */ + int +generate_STRINGMEMBER(cctx_T *cctx, char_u *name, size_t len) +{ + isn_T *isn; + type_T *type; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_STRINGMEMBER)) == NULL) + return FAIL; + isn->isn_arg.string = mnv_strnsave(name, len); + + // check for dict type + type = get_type_on_stack(cctx, 0); + if (type->tt_type != VAR_DICT + && type->tt_type != VAR_OBJECT + && type->tt_type != VAR_ANY + && type->tt_type != VAR_UNKNOWN) + { + char *tofree; + + semsg(_(e_expected_dictionary_for_using_key_str_but_got_str), + name, type_name(type, &tofree)); + mnv_free(tofree); + return FAIL; + } + // change dict type to dict member type + if (type->tt_type == VAR_DICT) + { + type_T *ntype = type->tt_member->tt_type == VAR_UNKNOWN + ? &t_any : type->tt_member; + set_type_on_stack(cctx, ntype, 0); + } + + return OK; +} + +/* + * Generate an ISN_ECHO instruction. + */ + int +generate_ECHO(cctx_T *cctx, int with_white, int count) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_drop(cctx, ISN_ECHO, count)) == NULL) + return FAIL; + isn->isn_arg.echo.echo_with_white = with_white; + isn->isn_arg.echo.echo_count = count; + + return OK; +} + +/* + * Generate an ISN_EXECUTE/ISN_ECHOMSG/ISN_ECHOERR instruction. + */ + int +generate_MULT_EXPR(cctx_T *cctx, isntype_T isn_type, int count) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr_drop(cctx, isn_type, count)) == NULL) + return FAIL; + isn->isn_arg.number = count; + return OK; +} + +/* + * Generate an ISN_ECHOWINDOW instruction + */ + int +generate_ECHOWINDOW(cctx_T *cctx, int count, long time) +{ + isn_T *isn; + + if ((isn = generate_instr_drop(cctx, ISN_ECHOWINDOW, count)) == NULL) + return FAIL; + isn->isn_arg.echowin.ewin_count = count; + isn->isn_arg.echowin.ewin_time = time; + return OK; +} + +/* + * Generate an ISN_SOURCE instruction. + */ + int +generate_SOURCE(cctx_T *cctx, int sid) +{ + isn_T *isn; + + if ((isn = generate_instr(cctx, ISN_SOURCE)) == NULL) + return FAIL; + isn->isn_arg.number = sid; + + return OK; +} + +/* + * Generate an ISN_PUT or ISN_IPUT instruction depending on fixindent. + */ + int +generate_PUT(cctx_T *cctx, int regname, linenr_T lnum, int fixindent) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + isn = (fixindent) ? generate_instr(cctx, ISN_IPUT) : + generate_instr(cctx, ISN_PUT); + if (isn == NULL) + return FAIL; + isn->isn_arg.put.put_regname = regname; + isn->isn_arg.put.put_lnum = lnum; + return OK; +} + +/* + * Generate a LOCKUNLOCK instruction.The root item, where the indexing starts + * to find the variable, is on the stack. The instr takes + * - the string to parse, "root.b[idx1][idx2].d.val", to find the variable + * - the class, if any, in which the string executes. + * - if the root item is a function argument + * A copy is made of "line". + */ + int +generate_LOCKUNLOCK(cctx_T *cctx, char_u *line, int is_arg) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_LOCKUNLOCK)) == NULL) + return FAIL; + class_T *cl = cctx->ctx_ufunc != NULL ? cctx->ctx_ufunc->uf_class : NULL; + isn->isn_arg.lockunlock.lu_string = mnv_strsave(line); + isn->isn_arg.lockunlock.lu_cl_exec = cl; + if (cl != NULL) + ++cl->class_refcount; + isn->isn_arg.lockunlock.lu_is_arg = is_arg; + return OK; +} + +/* + * Generate an EXEC instruction that takes a string argument. + * A copy is made of "line". + */ + int +generate_EXEC_copy(cctx_T *cctx, isntype_T isntype, char_u *line) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, isntype)) == NULL) + return FAIL; + isn->isn_arg.string = mnv_strsave(line); + return OK; +} + +/* + * Generate an EXEC instruction that takes a string argument. + * "str" must be allocated, it is consumed. + */ + int +generate_EXEC(cctx_T *cctx, isntype_T isntype, char_u *str) +{ + isn_T *isn; + int ret = OK; + + if (cctx->ctx_skip != SKIP_YES) + { + if ((isn = generate_instr(cctx, isntype)) == NULL) + ret = FAIL; + else + { + isn->isn_arg.string = str; + return OK; + } + } + mnv_free(str); + return ret; +} + + int +generate_LEGACY_EVAL(cctx_T *cctx, char_u *line) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_LEGACY_EVAL)) == NULL) + return FAIL; + isn->isn_arg.string = mnv_strsave(line); + + return push_type_stack(cctx, &t_any); +} + + int +generate_EXECCONCAT(cctx_T *cctx, int count) +{ + isn_T *isn; + + if ((isn = generate_instr_drop(cctx, ISN_EXECCONCAT, count)) == NULL) + return FAIL; + isn->isn_arg.number = count; + return OK; +} + +/* + * Generate ISN_RANGE. Consumes "range". Return OK/FAIL. + */ + int +generate_RANGE(cctx_T *cctx, char_u *range) +{ + isn_T *isn; + + if ((isn = generate_instr(cctx, ISN_RANGE)) == NULL) + return FAIL; + isn->isn_arg.string = range; + + return push_type_stack(cctx, &t_number); +} + + int +generate_UNPACK(cctx_T *cctx, int var_count, int semicolon) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_UNPACK)) == NULL) + return FAIL; + isn->isn_arg.unpack.unp_count = var_count; + isn->isn_arg.unpack.unp_semicolon = semicolon; + return OK; +} + +/* + * Generate an instruction for any command modifiers. + */ + int +generate_cmdmods(cctx_T *cctx, cmdmod_T *cmod) +{ + isn_T *isn; + + if (has_cmdmod(cmod, FALSE)) + { + cctx->ctx_has_cmdmod = TRUE; + + if ((isn = generate_instr(cctx, ISN_CMDMOD)) == NULL) + return FAIL; + isn->isn_arg.cmdmod.cf_cmdmod = ALLOC_ONE(cmdmod_T); + if (isn->isn_arg.cmdmod.cf_cmdmod == NULL) + return FAIL; + mch_memmove(isn->isn_arg.cmdmod.cf_cmdmod, cmod, sizeof(cmdmod_T)); + // filter program now belongs to the instruction + cmod->cmod_filter_regmatch.regprog = NULL; + } + + return OK; +} + + int +generate_undo_cmdmods(cctx_T *cctx) +{ + if (cctx->ctx_has_cmdmod && generate_instr(cctx, ISN_CMDMOD_REV) == NULL) + return FAIL; + cctx->ctx_has_cmdmod = FALSE; + return OK; +} + +/* + * Generate a STORE instruction for "dest", not being "dest_local". + * "lhs" might be NULL. + * Return FAIL when out of memory. + */ + int +generate_store_var( + cctx_T *cctx, + assign_dest_T dest, + int opt_flags, + int mnvvaridx, + type_T *type, + char_u *name, + lhs_T *lhs) +{ + switch (dest) + { + case dest_option: + return generate_STOREOPT(cctx, ISN_STOREOPT, + skip_option_env_lead(name), opt_flags); + case dest_func_option: + return generate_STOREOPT(cctx, ISN_STOREFUNCOPT, + skip_option_env_lead(name), opt_flags); + case dest_global: + // include g: with the name, easier to execute that way + return generate_STORE(cctx, mnv_strchr(name, AUTOLOAD_CHAR) == NULL + ? ISN_STOREG : ISN_STOREAUTO, 0, name); + case dest_buffer: + // include b: with the name, easier to execute that way + return generate_STORE(cctx, ISN_STOREB, 0, name); + case dest_window: + // include w: with the name, easier to execute that way + return generate_STORE(cctx, ISN_STOREW, 0, name); + case dest_tab: + // include t: with the name, easier to execute that way + return generate_STORE(cctx, ISN_STORET, 0, name); + case dest_env: + return generate_STORE(cctx, ISN_STOREENV, 0, name + 1); + case dest_reg: + return generate_STORE(cctx, ISN_STOREREG, + name[1] == '@' ? '"' : name[1], NULL); + case dest_mnvvar: + return generate_STORE(cctx, ISN_STOREV, mnvvaridx, NULL); + case dest_script: + case dest_script_v9: + { + int scriptvar_idx = lhs->lhs_scriptvar_idx; + int scriptvar_sid = lhs->lhs_scriptvar_sid; + if (scriptvar_idx < 0) + { + isntype_T isn_type = ISN_STORES; + + // If "sn_import_autoload", generate ISN_STOREEXPORT (not + // ISN_STORES) if destination is in a mnv9script or if + // there is no "sn_autoload_prefix". + if (SCRIPT_ID_VALID(scriptvar_sid) + && SCRIPT_ITEM(scriptvar_sid)->sn_import_autoload + && ((SCRIPT_ITEM(scriptvar_sid) + ->sn_autoload_prefix == NULL) + || lhs->lhs_dest == dest_script_v9)) + { + // "import autoload './dir/script.mnv'" - load script + // first + if (generate_SOURCE(cctx, scriptvar_sid) == FAIL) + return FAIL; + isn_type = ISN_STOREEXPORT; + } + + // "s:" may be included in the name. + return generate_OLDSCRIPT(cctx, isn_type, name, + scriptvar_sid, type); + } + return generate_MNV9SCRIPT(cctx, ISN_STORESCRIPT, + scriptvar_sid, scriptvar_idx, type); + } + case dest_class_member: + return generate_CLASSMEMBER(cctx, FALSE, + lhs->lhs_class, lhs->lhs_classmember_idx); + + case dest_local: + case dest_expr: + // cannot happen + break; + } + return FAIL; +} + +/* + * Return TRUE when inside a "for" or "while" loop. + */ + int +inside_loop_scope(cctx_T *cctx) +{ + scope_T *scope = cctx->ctx_scope; + + for (;;) + { + if (scope == NULL) + break; + if (scope->se_type == FOR_SCOPE || scope->se_type == WHILE_SCOPE) + return TRUE; + scope = scope->se_outer; + } + return FALSE; +} + + int +generate_store_lhs(cctx_T *cctx, lhs_T *lhs, int instr_count, int is_decl) +{ + if (lhs->lhs_dest != dest_local) + return generate_store_var(cctx, lhs->lhs_dest, + lhs->lhs_opt_flags, lhs->lhs_mnvvaridx, + lhs->lhs_type, lhs->lhs_name, lhs); + + if (lhs->lhs_lvar == NULL) + return OK; + + garray_T *instr = &cctx->ctx_instr; + isn_T *isn = ((isn_T *)instr->ga_data) + instr->ga_len - 1; + + // Optimization: turn "var = 123" from ISN_PUSHNR + ISN_STORE into + // ISN_STORENR. + // And "var = 0" does not need any instruction. + if (lhs->lhs_lvar->lv_from_outer == 0 + && instr->ga_len == instr_count + 1 + && isn->isn_type == ISN_PUSHNR) + { + varnumber_T val = isn->isn_arg.number; + garray_T *stack = &cctx->ctx_type_stack; + + if (val == 0 && is_decl && !inside_loop_scope(cctx)) + { + // zero is the default value, no need to do anything + --instr->ga_len; + } + else + { + isn->isn_type = ISN_STORENR; + isn->isn_arg.storenr.stnr_idx = lhs->lhs_lvar->lv_idx; + isn->isn_arg.storenr.stnr_val = val; + } + if (stack->ga_len > 0) + --stack->ga_len; + } + else if (lhs->lhs_lvar->lv_from_outer > 0) + generate_STOREOUTER(cctx, lhs->lhs_lvar->lv_idx, + lhs->lhs_lvar->lv_from_outer, lhs->lhs_lvar->lv_loop_idx); + else + generate_STORE(cctx, ISN_STORE, lhs->lhs_lvar->lv_idx, NULL); + return OK; +} + +/* + * Generate instruction to set the script context. Used to evaluate an + * object member variable initialization expression in the context of the + * script where the class is defined. + */ + int +generate_SCRIPTCTX_SET(cctx_T *cctx, sctx_T new_sctx) +{ + isn_T *isn; + + RETURN_OK_IF_SKIP(cctx); + if ((isn = generate_instr(cctx, ISN_SCRIPTCTX_SET)) == NULL) + return FAIL; + isn->isn_arg.setsctx = new_sctx; + return OK; +} + +#if defined(FEAT_PROFILE) + void +may_generate_prof_end(cctx_T *cctx, int prof_lnum) +{ + if (cctx->ctx_compile_type == CT_PROFILE && prof_lnum >= 0) + generate_instr(cctx, ISN_PROF_END); +} +#endif + + +/* + * Delete an instruction, free what it contains. + */ + void +delete_instr(isn_T *isn) +{ + switch (isn->isn_type) + { + case ISN_AUTOLOAD: + case ISN_DEF: + case ISN_EXEC: + case ISN_EXECRANGE: + case ISN_EXEC_SPLIT: + case ISN_LEGACY_EVAL: + case ISN_LOADAUTO: + case ISN_LOADB: + case ISN_LOADENV: + case ISN_LOADG: + case ISN_LOADOPT: + case ISN_LOADT: + case ISN_LOADW: + case ISN_PUSHEXC: + case ISN_PUSHFUNC: + case ISN_PUSHS: + case ISN_RANGE: + case ISN_STOREAUTO: + case ISN_STOREB: + case ISN_STOREENV: + case ISN_STOREG: + case ISN_STORET: + case ISN_STOREW: + case ISN_STRINGMEMBER: + mnv_free(isn->isn_arg.string); + break; + + case ISN_LOCKUNLOCK: + class_unref(isn->isn_arg.lockunlock.lu_cl_exec); + mnv_free(isn->isn_arg.lockunlock.lu_string); + break; + + case ISN_SUBSTITUTE: + { + int idx; + isn_T *list = isn->isn_arg.subs.subs_instr; + + mnv_free(isn->isn_arg.subs.subs_cmd); + for (idx = 0; list[idx].isn_type != ISN_FINISH; ++idx) + delete_instr(list + idx); + mnv_free(list); + } + break; + + case ISN_INSTR: + { + int idx; + isn_T *list = isn->isn_arg.instr; + + for (idx = 0; list[idx].isn_type != ISN_FINISH; ++idx) + delete_instr(list + idx); + mnv_free(list); + } + break; + + case ISN_LOADS: + case ISN_LOADEXPORT: + case ISN_STORES: + case ISN_STOREEXPORT: + mnv_free(isn->isn_arg.loadstore.ls_name); + break; + + case ISN_UNLET: + case ISN_UNLETENV: + mnv_free(isn->isn_arg.unlet.ul_name); + break; + + case ISN_STOREOPT: + case ISN_STOREFUNCOPT: + mnv_free(isn->isn_arg.storeopt.so_name); + break; + + case ISN_PUSHBLOB: // push blob isn_arg.blob + blob_unref(isn->isn_arg.blob); + break; + + case ISN_PUSHCLASS: + class_unref(isn->isn_arg.classarg); + break; + + case ISN_UCALL: + mnv_free(isn->isn_arg.ufunc.cuf_name); + break; + + case ISN_FUNCREF: + { + funcref_T *funcref = &isn->isn_arg.funcref; + funcref_extra_T *extra = funcref->fr_extra; + + if (extra == NULL || extra->fre_func_name == NULL) + { + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + funcref->fr_dfunc_idx; + ufunc_T *ufunc = dfunc->df_ufunc; + + if (ufunc != NULL && func_name_refcount(ufunc->uf_name)) + func_ptr_unref(ufunc); + } + if (extra != NULL) + { + char_u *name = extra->fre_func_name; + + if (name != NULL) + { + func_unref(name); + mnv_free(name); + } + if (extra->fre_class != NULL) + class_unref(extra->fre_class); + mnv_free(extra); + } + } + break; + + case ISN_DCALL: + { + dfunc_T *dfunc = ((dfunc_T *)def_functions.ga_data) + + isn->isn_arg.dfunc.cdf_idx; + + if (dfunc->df_ufunc != NULL + && func_name_refcount(dfunc->df_ufunc->uf_name)) + func_ptr_unref(dfunc->df_ufunc); + } + break; + + case ISN_METHODCALL: + { + cmfunc_T *mfunc = isn->isn_arg.mfunc; + class_unref(mfunc->cmf_itf); + mnv_free(mfunc); + } + break; + + case ISN_NEWFUNC: + { + newfuncarg_T *arg = isn->isn_arg.newfunc.nf_arg; + + if (arg != NULL) + { + ufunc_T *ufunc = find_func_even_dead( + arg->nfa_lambda, FFED_IS_GLOBAL); + + if (ufunc != NULL) + { + unlink_def_function(ufunc); + func_ptr_unref(ufunc); + } + + mnv_free(arg->nfa_lambda); + mnv_free(arg->nfa_global); + mnv_free(arg); + } + } + break; + + case ISN_CHECKTYPE: + case ISN_SETTYPE: + free_type(isn->isn_arg.type.ct_type); + break; + + case ISN_CMDMOD: + mnv_regfree(isn->isn_arg.cmdmod.cf_cmdmod + ->cmod_filter_regmatch.regprog); + mnv_free(isn->isn_arg.cmdmod.cf_cmdmod); + break; + + case ISN_LOADSCRIPT: + case ISN_STORESCRIPT: + mnv_free(isn->isn_arg.script.scriptref); + break; + + case ISN_LOAD_CLASSMEMBER: + case ISN_STORE_CLASSMEMBER: + case ISN_GET_ITF_MEMBER: + class_unref(isn->isn_arg.classmember.cm_class); + break; + + case ISN_STOREINDEX: + class_unref(isn->isn_arg.storeindex.si_class); + break; + + case ISN_TRY: + mnv_free(isn->isn_arg.tryref.try_ref); + break; + + case ISN_CEXPR_CORE: + mnv_free(isn->isn_arg.cexpr.cexpr_ref->cer_cmdline); + mnv_free(isn->isn_arg.cexpr.cexpr_ref); + break; + + case ISN_2BOOL: + case ISN_2STRING: + case ISN_2STRING_ANY: + case ISN_ADDBLOB: + case ISN_ADDLIST: + case ISN_ADDTUPLE: + case ISN_ANYINDEX: + case ISN_ANYSLICE: + case ISN_BCALL: + case ISN_BLOBAPPEND: + case ISN_BLOBINDEX: + case ISN_BLOBSLICE: + case ISN_CATCH: + case ISN_CEXPR_AUCMD: + case ISN_CHECKLEN: + case ISN_CLEARDICT: + case ISN_CMDMOD_REV: + case ISN_COMPAREANY: + case ISN_COMPAREBLOB: + case ISN_COMPAREBOOL: + case ISN_COMPAREDICT: + case ISN_COMPAREFLOAT: + case ISN_COMPAREFUNC: + case ISN_COMPARELIST: + case ISN_COMPARETUPLE: + case ISN_COMPARENR: + case ISN_COMPARENULL: + case ISN_COMPAREOBJECT: + case ISN_COMPARESPECIAL: + case ISN_COMPARESTRING: + case ISN_CONCAT: + case ISN_CONSTRUCT: + case ISN_COND2BOOL: + case ISN_DEBUG: + case ISN_DEFER: + case ISN_DROP: + case ISN_ECHO: + case ISN_ECHOCONSOLE: + case ISN_ECHOERR: + case ISN_ECHOMSG: + case ISN_ECHOWINDOW: + case ISN_ENDLOOP: + case ISN_ENDTRY: + case ISN_EXECCONCAT: + case ISN_EXECUTE: + case ISN_FINALLY: + case ISN_FINISH: + case ISN_FOR: + case ISN_GETITEM: + case ISN_GET_OBJ_MEMBER: + case ISN_JUMP: + case ISN_JUMP_IF_ARG_NOT_SET: + case ISN_JUMP_IF_ARG_SET: + case ISN_LISTAPPEND: + case ISN_LISTINDEX: + case ISN_LISTSLICE: + case ISN_TUPLEINDEX: + case ISN_TUPLESLICE: + case ISN_LOAD: + case ISN_LOADBDICT: + case ISN_LOADGDICT: + case ISN_LOADOUTER: + case ISN_LOADREG: + case ISN_LOADTDICT: + case ISN_LOADV: + case ISN_LOADWDICT: + case ISN_LOCKCONST: + case ISN_MEMBER: + case ISN_NEGATENR: + case ISN_NEWDICT: + case ISN_NEWLIST: + case ISN_NEWTUPLE: + case ISN_NEWPARTIAL: + case ISN_OPANY: + case ISN_OPFLOAT: + case ISN_OPNR: + case ISN_PCALL: + case ISN_PCALL_END: + case ISN_PROF_END: + case ISN_PROF_START: + case ISN_PUSHBOOL: + case ISN_PUSHCHANNEL: + case ISN_PUSHF: + case ISN_PUSHJOB: + case ISN_PUSHNR: + case ISN_PUSHOBJ: + case ISN_PUSHSPEC: + case ISN_PUT: + case ISN_IPUT: + case ISN_REDIREND: + case ISN_REDIRSTART: + case ISN_RETURN: + case ISN_RETURN_OBJECT: + case ISN_RETURN_VOID: + case ISN_SHUFFLE: + case ISN_SLICE: + case ISN_SOURCE: + case ISN_STORE: + case ISN_STORENR: + case ISN_STOREOUTER: + case ISN_STORE_THIS: + case ISN_STORERANGE: + case ISN_STOREREG: + case ISN_STOREV: + case ISN_STRINDEX: + case ISN_STRSLICE: + case ISN_THROW: + case ISN_TRYCONT: + case ISN_UNLETINDEX: + case ISN_UNLETRANGE: + case ISN_UNPACK: + case ISN_USEDICT: + case ISN_WHILE: + case ISN_SCRIPTCTX_SET: + // nothing allocated + break; + } +} + + void +clear_instr_ga(garray_T *gap) +{ + int idx; + + for (idx = 0; idx < gap->ga_len; ++idx) + delete_instr(((isn_T *)gap->ga_data) + idx); + ga_clear(gap); +} + + +#endif // defined(FEAT_EVAL) diff --git a/uvim/src/mnv9script.c b/uvim/src/mnv9script.c new file mode 100644 index 0000000000..25a3c0151c --- /dev/null +++ b/uvim/src/mnv9script.c @@ -0,0 +1,1162 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * MNV - MNV is not Vim by Bram Moolenaar + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. + */ + +/* + * mnv9script.c: :mnv9script, :import, :export and friends + */ + +#include "mnv.h" + +/* + * Return TRUE when currently using MNV9 script syntax. + * Does not go up the stack, a ":function" inside mnv9script uses legacy + * syntax. + */ + int +in_mnv9script(void) +{ + // "sc_version" is also set when compiling a ":def" function in legacy + // script. + return (current_sctx.sc_version == SCRIPT_VERSION_MNV9 + || (cmdmod.cmod_flags & CMOD_MNV9CMD)) + && !(cmdmod.cmod_flags & CMOD_LEGACY); +} + +#if defined(FEAT_EVAL) +/* + * Return TRUE when currently in a script with script version smaller than + * "max_version" or command modifiers forced it. + */ + int +in_old_script(int max_version) +{ + return (current_sctx.sc_version < max_version + && !(cmdmod.cmod_flags & CMOD_MNV9CMD)) + || (cmdmod.cmod_flags & CMOD_LEGACY); +} + +/* + * Return TRUE if the current script is MNV9 script. + * This also returns TRUE in a legacy function in a MNV9 script. + */ + int +current_script_is_mnv9(void) +{ + return SCRIPT_ID_VALID(current_sctx.sc_sid) + && SCRIPT_ITEM(current_sctx.sc_sid)->sn_version + == SCRIPT_VERSION_MNV9; +} +#endif + +#ifdef FEAT_EVAL +/* + * Clear MNV9 script-local variables and functions. + */ + void +clear_mnv9_scriptlocal_vars(int sid) +{ + hashtab_T *ht = &SCRIPT_VARS(sid); + + hashtab_free_contents(ht); + hash_init(ht); + delete_script_functions(sid); + + // old imports and script variables are no longer valid + free_imports_and_script_vars(sid); +} +#endif + +/* + * ":mnv9script". + */ + void +ex_mnv9script(exarg_T *eap UNUSED) +{ +#ifdef FEAT_EVAL + int sid = current_sctx.sc_sid; + scriptitem_T *si; + int found_noclear = FALSE; + char_u *p; + + if (!sourcing_a_script(eap)) + { + emsg(_(e_mnv9script_can_only_be_used_in_script)); + return; + } + + si = SCRIPT_ITEM(sid); + if (si->sn_state == SN_STATE_HAD_COMMAND) + { + emsg(_(e_mnv9script_must_be_first_command_in_script)); + return; + } + + for (p = eap->arg; !IS_WHITE_OR_NUL(*p); p = skipwhite(skiptowhite(p))) + { + if (STRNCMP(p, "noclear", 7) == 0 && IS_WHITE_OR_NUL(p[7])) + { + if (found_noclear) + { + semsg(_(e_duplicate_argument_str), p); + return; + } + found_noclear = TRUE; + } + else + { + semsg(_(e_invalid_argument_str), eap->arg); + return; + } + } + + if (si->sn_state == SN_STATE_RELOAD && !found_noclear) + // Reloading a script without the "noclear" argument: clear + // script-local variables and functions. + clear_mnv9_scriptlocal_vars(sid); + si->sn_state = SN_STATE_HAD_COMMAND; + + // Store the prefix with the script, it is used to find exported functions. + if (si->sn_autoload_prefix == NULL) + si->sn_autoload_prefix = get_autoload_prefix(si); + + current_sctx.sc_version = SCRIPT_VERSION_MNV9; + si->sn_version = SCRIPT_VERSION_MNV9; + + if (STRCMP(p_cpo, CPO_MNV) != 0) + { + si->sn_save_cpo = mnv_strsave(p_cpo); + set_option_value_give_err((char_u *)"cpo", + 0L, (char_u *)CPO_MNV, OPT_NO_REDRAW); + } +#else + // No check for this being the first command, the information is not + // available. + current_sctx.sc_version = SCRIPT_VERSION_MNV9; +#endif +} + +#if defined(FEAT_EVAL) +/* + * When in MNV9 script give an error and return FAIL. + */ + int +not_in_mnv9(exarg_T *eap) +{ + if (in_mnv9script()) + switch (eap->cmdidx) + { + case CMD_k: + if (eap->addr_count > 0) + { + emsg(_(e_no_range_allowed)); + return FAIL; + } + // FALLTHROUGH + case CMD_append: + case CMD_change: + case CMD_insert: + case CMD_open: + case CMD_t: + case CMD_xit: + semsg(_(e_command_not_supported_in_mnv9_script_missing_var_str), eap->cmd); + return FAIL; + default: break; + } + return OK; +} + +/* + * Return TRUE if "p" points at "#{", not "#{{". + * Give an error message if not done already. + * This avoids that using a legacy style #{} dictionary leads to difficult to + * understand errors. + */ + int +mnv9_bad_comment(char_u *p) +{ + if (p[0] == '#' && p[1] == '{' && p[2] != '{') + { + if (!did_emsg) + emsg(_(e_cannot_use_hash_curly_to_start_comment)); + return TRUE; + } + return FALSE; +} +#endif + +/* + * Return TRUE if "p" points at a "#" not followed by one '{'. + * Gives an error for using "#{", not for "#{{". + * Does not check for white space. + */ + int +mnv9_comment_start(char_u *p) +{ +#ifdef FEAT_EVAL + return p[0] == '#' && !mnv9_bad_comment(p); +#else + return p[0] == '#' && (p[1] != '{' || p[2] == '{'); +#endif +} + +#if defined(FEAT_EVAL) + +/* + * "++nr" and "--nr" commands. + */ + void +ex_incdec(exarg_T *eap) +{ + char_u *cmd = eap->cmd; + char_u *nextcmd = eap->nextcmd; + size_t len = STRLEN(eap->cmd) + 8; + + if (MNV_ISWHITE(cmd[2])) + { + semsg(_(e_no_white_space_allowed_after_str_str), + eap->cmdidx == CMD_increment ? "++" : "--", eap->cmd); + return; + } + + // This works like "nr += 1" or "nr -= 1". + // Add a '|' to avoid looking in the next line. + eap->cmd = alloc(len); + if (eap->cmd == NULL) + return; + mnv_snprintf((char *)eap->cmd, len, "%s %c= 1 |", cmd + 2, + eap->cmdidx == CMD_increment ? '+' : '-'); + eap->arg = eap->cmd; + eap->cmdidx = CMD_var; + eap->nextcmd = NULL; + ex_let(eap); + mnv_free(eap->cmd); + eap->cmd = cmd; + eap->nextcmd = nextcmd; +} + +/* + * ":export cmd" + */ + void +ex_export(exarg_T *eap UNUSED) +{ + // can only get here when "export" wasn't caught in do_cmdline() + emsg(_(e_export_can_only_be_used_in_mnv9script)); +} + +/* + * Add a new imported item entry to the current script. + */ + static imported_T * +new_imported(garray_T *gap) +{ + if (ga_grow(gap, 1) == OK) + return ((imported_T *)gap->ga_data + gap->ga_len++); + return NULL; +} + +/* + * Free the script variables from "sn_all_vars". + */ + static void +free_all_script_vars(scriptitem_T *si) +{ + int todo; + hashtab_T *ht = &si->sn_all_vars.dv_hashtab; + hashitem_T *hi; + sallvar_T *sav; + sallvar_T *sav_next; + int idx; + + hash_lock(ht); + todo = (int)ht->ht_used; + FOR_ALL_HASHTAB_ITEMS(ht, hi, todo) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + + // Free the variable. Don't remove it from the hashtab, ht_array + // might change then. hash_clear() takes care of it later. + sav = HI2SAV(hi); + while (sav != NULL) + { + sav_next = sav->sav_next; + if (sav->sav_di == NULL) + clear_tv(&sav->sav_tv); + mnv_free(sav); + sav = sav_next; + } + } + } + hash_clear(ht); + hash_init(ht); + + for (idx = 0; idx < si->sn_var_vals.ga_len; ++idx) + { + svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx; + + if (sv->sv_flags & SVFLAG_TYPE_ALLOCATED) + free_type(sv->sv_type); + } + ga_clear(&si->sn_var_vals); + + // existing commands using script variable indexes are no longer valid + si->sn_script_seq = current_sctx.sc_seq; +} + +/* + * Free all imported items in script "sid". + */ + void +free_imports_and_script_vars(int sid) +{ + scriptitem_T *si = SCRIPT_ITEM(sid); + int idx; + + for (idx = 0; idx < si->sn_imports.ga_len; ++idx) + { + imported_T *imp = ((imported_T *)si->sn_imports.ga_data) + idx; + + mnv_free(imp->imp_name); + } + ga_clear(&si->sn_imports); + + free_all_script_vars(si); + + clear_type_list(&si->sn_type_list); +} + +/* + * Mark all imports as possible to redefine. Used when a script is loaded + * again but not cleared. + */ + void +mark_imports_for_reload(int sid) +{ + scriptitem_T *si = SCRIPT_ITEM(sid); + int idx; + + for (idx = 0; idx < si->sn_imports.ga_len; ++idx) + { + imported_T *imp = ((imported_T *)si->sn_imports.ga_data) + idx; + + imp->imp_flags |= IMP_FLAGS_RELOAD; + } +} + +/* + * Part of "import" that handles a relative or absolute file name/ + * Returns OK or FAIL. + */ + static int +handle_import_fname(char_u *fname, int is_autoload, int *sid) +{ + if (is_autoload) + { + scriptitem_T *si; + + *sid = find_script_by_name(fname); + if (*sid < 0) + { + int error = OK; + + // Script does not exist yet, check name and create a new + // scriptitem. + if (!file_is_readable(fname)) + { + semsg(_(mch_isdir(fname) ? e_str_is_directory + : e_cannot_read_from_str_2), fname); + return FAIL; + } + *sid = get_new_scriptitem_for_fname(&error, fname); + if (error == FAIL) + return FAIL; + } + + si = SCRIPT_ITEM(*sid); + si->sn_import_autoload = TRUE; + + if (si->sn_autoload_prefix == NULL) + si->sn_autoload_prefix = get_autoload_prefix(si); + + // with testing override: load autoload script right away + if (!override_autoload || si->sn_state != SN_STATE_NOT_LOADED) + return OK; + } + return do_source(fname, FALSE, DOSO_NONE, sid); +} + +/* + * Handle an ":import" command and add the resulting imported_T to "gap", when + * not NULL, or script "import_sid" sn_imports. + * "cctx" is NULL at the script level. + * Returns a pointer to after the command or NULL in case of failure + */ + static char_u * +handle_import( + char_u *arg_start, + garray_T *gap, + int import_sid, + evalarg_T *evalarg, + void *cctx) +{ + char_u *arg = arg_start; + char_u *nextarg; + int is_autoload = FALSE; + int getnext; + char_u *expr_end; + int ret = FAIL; + char_u *as_name = NULL; + typval_T tv; + int sid = -2; + int res; + long start_lnum = SOURCING_LNUM; + garray_T *import_gap; + int i; + + if (STRNCMP(arg, "autoload", 8) == 0 && MNV_ISWHITE(arg[8])) + { + is_autoload = TRUE; + arg = skipwhite(arg + 8); + } + + // The name of the file can be an expression, which must evaluate to a + // string. + ret = eval0_retarg(arg, &tv, NULL, evalarg, &expr_end); + if (ret == FAIL) + goto erret; + if (tv.v_type != VAR_STRING + || tv.vval.v_string == NULL || *tv.vval.v_string == NUL) + { + semsg(_(e_invalid_string_for_import_str), arg); + goto erret; + } + + // Give error messages for the start of the line. + SOURCING_LNUM = start_lnum; + + /* + * find script file + */ + if (*tv.vval.v_string == '.') + { + size_t len; + scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid); + char_u *tail = gettail(si->sn_name); + char_u *from_name; + int sourced_from_nofile_buf = FALSE; + + if (STRNCMP(si->sn_name, ":source buffer=", 15) == 0) + sourced_from_nofile_buf = TRUE; + + if (!sourced_from_nofile_buf) + { + // Relative to current script: "./name.mnv", "../../name.mnv". + len = STRLEN(si->sn_name) - STRLEN(tail) + STRLEN(tv.vval.v_string) + 2; + from_name = alloc((int)len); + if (from_name == NULL) + goto erret; + mnv_strncpy(from_name, si->sn_name, tail - si->sn_name); + add_pathsep(from_name); + STRCAT(from_name, tv.vval.v_string); + } + else + from_name = mnv_strsave(tv.vval.v_string); + simplify_filename(from_name); + + res = handle_import_fname(from_name, is_autoload, &sid); + mnv_free(from_name); + } + else if (mch_isFullName(tv.vval.v_string)) + { + // Absolute path: "/tmp/name.mnv" + res = handle_import_fname(tv.vval.v_string, is_autoload, &sid); + } + else if (is_autoload) + { + size_t len = 9 + STRLEN(tv.vval.v_string) + 1; + char_u *from_name; + + // Find file in "autoload" subdirs in 'runtimepath'. + from_name = alloc((int)len); + if (from_name == NULL) + goto erret; + mnv_snprintf((char *)from_name, len, "autoload/%s", tv.vval.v_string); + // we need a scriptitem without loading the script + sid = find_script_in_rtp(from_name); + mnv_free(from_name); + if (SCRIPT_ID_VALID(sid)) + { + scriptitem_T *si = SCRIPT_ITEM(sid); + + if (si->sn_autoload_prefix == NULL) + si->sn_autoload_prefix = get_autoload_prefix(si); + res = OK; + if (override_autoload && si->sn_state == SN_STATE_NOT_LOADED) + // testing override: load autoload script right away + (void)do_source(si->sn_name, FALSE, DOSO_NONE, NULL); + } + else + res = FAIL; + } + else + { + size_t len = 7 + STRLEN(tv.vval.v_string) + 1; + char_u *from_name; + + // Find file in "import" subdirs in 'runtimepath'. + from_name = alloc((int)len); + if (from_name == NULL) + goto erret; + mnv_snprintf((char *)from_name, len, "import/%s", tv.vval.v_string); + res = source_in_path(p_rtp, from_name, DIP_NOAFTER, &sid); + mnv_free(from_name); + } + + if (res == FAIL || sid <= 0) + { + semsg(_(is_autoload && sid == -2 + ? e_autoload_import_cannot_use_absolute_or_relative_path + : e_could_not_import_str), tv.vval.v_string); + goto erret; + } + + if (sid == current_sctx.sc_sid) + { + emsg(_(e_script_cannot_import_itself)); + goto erret; + } + + import_gap = gap != NULL ? gap : &SCRIPT_ITEM(import_sid)->sn_imports; + for (i = 0; i < import_gap->ga_len; ++i) + { + imported_T *import = (imported_T *)import_gap->ga_data + i; + + if (import->imp_sid == sid) + { + if (import->imp_flags & IMP_FLAGS_RELOAD) + { + // encountering same script first time on a reload is OK + import->imp_flags &= ~IMP_FLAGS_RELOAD; + break; + } + semsg(_(e_cannot_import_same_script_twice_str), tv.vval.v_string); + goto erret; + } + } + + // Allow for the "as Name" to be in the next line. + nextarg = eval_next_non_blank(expr_end, evalarg, &getnext); + if (STRNCMP("as", nextarg, 2) == 0 && IS_WHITE_OR_NUL(nextarg[2])) + { + char_u *p; + + if (getnext) + arg = eval_next_line(expr_end, evalarg); + else + arg = nextarg; + + // Skip over "as Name "; no line break allowed after "as". + // Do not allow for ':' and '#'. + arg = skipwhite(arg + 2); + p = arg; + if (eval_isnamec1(*arg)) + while (ASCII_ISALNUM(*arg) || *arg == '_') + ++arg; + if (p == arg || !IS_WHITE_OR_NUL(*arg)) + { + semsg(_(e_syntax_error_in_import_str), p); + goto erret; + } + as_name = mnv_strnsave(p, arg - p); + arg = skipwhite(arg); + } + else + { + char_u *p = gettail(tv.vval.v_string); + char_u *end = (char_u *)strstr((char *)p, ".mnv"); + + if (!ends_excmd2(arg_start, expr_end)) + { + semsg(_(e_trailing_characters_str), expr_end); + goto erret; + } + if (end == NULL || end[4] != NUL) + { + semsg(_(e_imported_script_must_use_as_or_end_in_dot_mnv_str), p); + goto erret; + } + if (end == p) + { + semsg(_(e_cannot_import_dot_mnv_without_using_as), p); + goto erret; + } + as_name = mnv_strnsave(p, end - p); + } + + if (as_name != NULL) + { + imported_T *imported; + + imported = find_imported(as_name, STRLEN(as_name), FALSE); + if (imported != NULL && imported->imp_sid != sid) + { + semsg(_(e_name_already_defined_str), as_name); + goto erret; + } + else if (imported == NULL + && check_defined(as_name, STRLEN(as_name), cctx, NULL, + FALSE) == FAIL) + goto erret; + + if (imported == NULL) + { + imported = new_imported(import_gap); + if (imported == NULL) + goto erret; + imported->imp_name = as_name; + as_name = NULL; + imported->imp_sid = sid; + if (is_autoload) + imported->imp_flags = IMP_FLAGS_AUTOLOAD; + } + } + +erret: + clear_tv(&tv); + mnv_free(as_name); + return arg; +} + +/* + * ":import 'filename'" + * ":import 'filename' as Name" + */ + void +ex_import(exarg_T *eap) +{ + char_u *cmd_end; + evalarg_T evalarg; + + if (!sourcing_a_script(eap)) + { + emsg(_(e_import_can_only_be_used_in_script)); + return; + } + fill_evalarg_from_eap(&evalarg, eap, eap->skip); + + cmd_end = handle_import(eap->arg, NULL, current_sctx.sc_sid, + &evalarg, NULL); + if (cmd_end != NULL) + set_nextcmd(eap, cmd_end); + clear_evalarg(&evalarg, eap); +} + +/* + * When a script is a symlink it may be imported with one name and sourced + * under another name. Adjust the import script ID if needed. + * "*sid" must be a valid script ID. + */ + void +import_check_sourced_sid(int *sid) +{ + scriptitem_T *script = SCRIPT_ITEM(*sid); + + if (script->sn_sourced_sid > 0) + *sid = script->sn_sourced_sid; +} + +/* + * Find an exported item in "sid" matching "name". + * Either "cctx" or "cstack" is NULL. + * When it is a variable return the index. + * When it is a user function return "*ufunc". + * When not found returns -1 and "*ufunc" is NULL. + */ + int +find_exported( + int sid, + char_u *name, + ufunc_T **ufunc, + type_T **type, + cctx_T *cctx, + cstack_T *cstack, + int verbose) +{ + int idx = -1; + svar_T *sv; + scriptitem_T *script = SCRIPT_ITEM(sid); + + *ufunc = NULL; + + if (script->sn_import_autoload && script->sn_state == SN_STATE_NOT_LOADED) + { + if (do_source(script->sn_name, FALSE, DOSO_NONE, NULL) == FAIL) + { + semsg(_(e_cant_open_file_str), script->sn_name); + return -1; + } + } + + // Find name in "script". + idx = get_script_item_idx(sid, name, 0, cctx, cstack); + if (idx >= 0) + { + sv = ((svar_T *)script->sn_var_vals.ga_data) + idx; + if ((sv->sv_flags & SVFLAG_EXPORTED) == 0) + { + if (verbose) + semsg(_(e_item_not_exported_in_script_str), name); + return -1; + } + *type = sv->sv_type; + } + else + { + size_t len = STRLEN(name); + char_u buffer[200]; + char_u *funcname; + + // It could be a user function. Normally this is stored as + // "99_name". For an autoload script a function is stored with + // the autoload prefix: "dir#script#name". + if (script->sn_autoload_prefix != NULL) + len += STRLEN(script->sn_autoload_prefix) + 2; + else + len += 15; + + if (len < sizeof(buffer)) + funcname = buffer; + else + { + funcname = alloc(len); + if (funcname == NULL) + return -1; + } + if (script->sn_autoload_prefix != NULL) + { + sprintf((char *)funcname, "%s%s", script->sn_autoload_prefix, name); + } + else + { + funcname[0] = K_SPECIAL; + funcname[1] = KS_EXTRA; + funcname[2] = (int)KE_SNR; + sprintf((char *)funcname + 3, "%ld_%s", (long)sid, name); + } + *ufunc = find_func(funcname, FALSE); + + if (*ufunc == NULL) + { + if (verbose) + { + ufunc_T *alt_ufunc = NULL; + + if (script->sn_autoload_prefix != NULL) + { + // try find the function by the script-local name + funcname[0] = K_SPECIAL; + funcname[1] = KS_EXTRA; + funcname[2] = (int)KE_SNR; + sprintf((char *)funcname + 3, "%ld_%s", (long)sid, name); + alt_ufunc = find_func(funcname, FALSE); + } + if (alt_ufunc != NULL) + semsg(_(e_item_not_exported_in_script_str), name); + else + semsg(_(e_item_not_found_in_script_str), name); + } + } + else if (((*ufunc)->uf_flags & FC_EXPORT) == 0) + { + if (verbose) + semsg(_(e_item_not_exported_in_script_str), name); + *ufunc = NULL; + } + if (funcname != buffer) + mnv_free(funcname); + } + + return idx; +} + +/* + * Declare a script-local variable without init: "var name: type". + * "const" is an error since the value is missing. + * Returns a pointer to after the type. + */ + char_u * +mnv9_declare_scriptvar(exarg_T *eap, char_u *arg) +{ + char_u *p; + char_u *name; + scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid); + type_T *type; + typval_T init_tv; + + if (eap->cmdidx == CMD_final || eap->cmdidx == CMD_const) + { + if (eap->cmdidx == CMD_final) + emsg(_(e_final_requires_a_value)); + else + emsg(_(e_const_requires_a_value)); + return arg + STRLEN(arg); + } + + // Check for valid starting character. + if (!eval_isnamec1(*arg)) + { + semsg(_(e_invalid_argument_str), arg); + return arg + STRLEN(arg); + } + + for (p = arg + 1; *p != NUL && eval_isnamec(*p); MB_PTR_ADV(p)) + if (*p == ':' && (MNV_ISWHITE(p[1]) || p != arg + 1)) + break; + + if (*p != ':') + { + emsg(_(e_type_or_initialization_required)); + return arg + STRLEN(arg); + } + if (!MNV_ISWHITE(p[1])) + { + semsg(_(e_white_space_required_after_str_str), ":", p); + return arg + STRLEN(arg); + } + name = mnv_strnsave(arg, p - arg); + + // parse type, check for reserved name + p = skipwhite(p + 1); + type = parse_type(&p, &si->sn_type_list, NULL, NULL, TRUE); + if (type == NULL + || check_reserved_name(name, FALSE) == FAIL + || !valid_declaration_type(type)) + { + mnv_free(name); + return p; + } + + // Create the variable with 0/NULL value. + CLEAR_FIELD(init_tv); + if (type->tt_type == VAR_ANY) + // A variable of type "any" is not possible, just use zero instead + init_tv.v_type = VAR_NUMBER; + else + init_tv.v_type = type->tt_type; + set_var_const(name, 0, type, &init_tv, FALSE, ASSIGN_INIT, 0); + + mnv_free(name); + return p; +} + +/* + * MNV9 part of adding a script variable: add it to sn_all_vars (lookup by name + * with a hashtable) and sn_var_vals (lookup by index). + * When "create" is TRUE this is a new variable, otherwise find and update an + * existing variable. + * "flags" can have ASSIGN_FINAL, ASSIGN_CONST or ASSIGN_INIT. + * When "*type" is NULL use "tv" for the type and update "*type". If + * "do_member" is TRUE also use the member type, otherwise use "any". + */ + void +update_mnv9_script_var( + int create, + dictitem_T *di, + char_u *name, + int flags, + typval_T *tv, + type_T **type, + int do_member) +{ + scriptitem_T *si = SCRIPT_ITEM(current_sctx.sc_sid); + hashitem_T *hi; + svar_T *sv = NULL; + + if (create) + { + sallvar_T *newsav; + sallvar_T *sav = NULL; + + // Store a pointer to the typval_T, so that it can be found by index + // instead of using a hastab lookup. + if (ga_grow(&si->sn_var_vals, 1) == FAIL) + return; + + hi = hash_find(&si->sn_all_vars.dv_hashtab, name); + if (!HASHITEM_EMPTY(hi)) + { + // Variable with this name exists, either in this block or in + // another block. + for (sav = HI2SAV(hi); ; sav = sav->sav_next) + { + if (sav->sav_block_id == si->sn_current_block_id) + { + // variable defined in a loop, re-use the entry + sv = ((svar_T *)si->sn_var_vals.ga_data) + + sav->sav_var_vals_idx; + // unhide the variable + if (sv->sv_tv == &sav->sav_tv) + { + clear_tv(&sav->sav_tv); + sv->sv_tv = &di->di_tv; + sav->sav_di = di; + } + break; + } + if (sav->sav_next == NULL) + break; + } + } + + if (sv == NULL) + { + // Variable not defined or not defined in current block: Add a + // svar_T and create a new sallvar_T. + sv = ((svar_T *)si->sn_var_vals.ga_data) + si->sn_var_vals.ga_len; + newsav = (sallvar_T *)alloc_clear( + offsetof(sallvar_T, sav_key) + STRLEN(name) + 1); + if (newsav == NULL) + return; + + sv->sv_tv = &di->di_tv; + sv->sv_const = (flags & ASSIGN_FINAL) ? ASSIGN_FINAL + : (flags & ASSIGN_CONST) ? ASSIGN_CONST : 0; + sv->sv_flags = is_export ? SVFLAG_EXPORTED : 0; + if ((flags & ASSIGN_INIT) == 0) + sv->sv_flags |= SVFLAG_ASSIGNED; + newsav->sav_var_vals_idx = si->sn_var_vals.ga_len; + ++si->sn_var_vals.ga_len; + // a pointer to the first char avoids a FORTIFY_SOURCE problem + STRCPY(&newsav->sav_key[0], name); + sv->sv_name = newsav->sav_key; + newsav->sav_di = di; + newsav->sav_block_id = si->sn_current_block_id; + + if (HASHITEM_EMPTY(hi)) + // new variable name + hash_add(&si->sn_all_vars.dv_hashtab, newsav->sav_key, + "add variable"); + else if (sav != NULL) + // existing name in a new block, append to the list + sav->sav_next = newsav; + } + } + else + { + sv = find_typval_in_script(&di->di_tv, 0, TRUE); + } + if (sv != NULL) + { + if (*type == NULL) + *type = typval2type(tv, get_copyID(), &si->sn_type_list, + do_member ? TVTT_DO_MEMBER : 0); + else if ((flags & ASSIGN_INIT) == 0 + && (*type)->tt_type == VAR_BLOB && tv->v_type == VAR_BLOB + && tv->vval.v_blob == NULL) + { + // "var b: blob = null_blob" has a different type. + *type = &t_blob_null; + } + if (sv->sv_flags & SVFLAG_TYPE_ALLOCATED) + free_type(sv->sv_type); + if (*type != NULL && ((*type)->tt_type == VAR_FUNC + || (*type)->tt_type == VAR_PARTIAL)) + { + // The type probably uses uf_type_list, which is cleared when the + // function is freed, but the script variable may keep the type. + // Make a copy to avoid using freed memory. + sv->sv_type = alloc_type(*type); + sv->sv_flags |= SVFLAG_TYPE_ALLOCATED; + } + else + { + sv->sv_type = *type; + sv->sv_flags &= ~SVFLAG_TYPE_ALLOCATED; + } + } + + // let ex_export() know the export worked. + is_export = FALSE; +} + +/* + * Hide a script variable when leaving a block. + * "idx" is de index in sn_var_vals. + * When "func_defined" is non-zero then a function was defined in this block, + * the variable may be accessed by it. Otherwise the variable can be cleared. + */ + void +hide_script_var(scriptitem_T *si, int idx, int func_defined) +{ + svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx; + hashtab_T *script_ht = get_script_local_ht(); + hashtab_T *all_ht = &si->sn_all_vars.dv_hashtab; + hashitem_T *script_hi; + hashitem_T *all_hi; + + // Remove a variable declared inside the block, if it still exists. + // If it was added in a nested block it will already have been removed. + // The typval is moved into the sallvar_T. + script_hi = hash_find(script_ht, sv->sv_name); + all_hi = hash_find(all_ht, sv->sv_name); + + if (HASHITEM_EMPTY(script_hi) || HASHITEM_EMPTY(all_hi)) + return; + + dictitem_T *di = HI2DI(script_hi); + sallvar_T *sav = HI2SAV(all_hi); + sallvar_T *sav_prev = NULL; + + // There can be multiple entries with the same name in different + // blocks, find the right one. + while (sav != NULL && sav->sav_var_vals_idx != idx) + { + sav_prev = sav; + sav = sav->sav_next; + } + if (sav == NULL) + return; + + if (func_defined) + { + // move the typval from the dictitem to the sallvar + sav->sav_tv = di->di_tv; + di->di_tv.v_type = VAR_UNKNOWN; + sav->sav_flags = di->di_flags; + sav->sav_di = NULL; + sv->sv_tv = &sav->sav_tv; + } + else + { + if (sav_prev == NULL) + hash_remove(all_ht, all_hi, "hide variable"); + else + sav_prev->sav_next = sav->sav_next; + sv->sv_name = NULL; + mnv_free(sav); + } + delete_var(script_ht, script_hi); +} + +/* + * Find the script-local variable that links to "dest". + * If "sid" is zero use the current script. + * if "must_find" is TRUE and "dest" cannot be found report an internal error. + * Returns NULL if not found and give an internal error. + */ + svar_T * +find_typval_in_script(typval_T *dest, scid_T sid, int must_find) +{ + scriptitem_T *si = SCRIPT_ITEM(sid == 0 ? current_sctx.sc_sid : sid); + int idx; + + if (si->sn_version != SCRIPT_VERSION_MNV9) + // legacy script doesn't store variable types + return NULL; + + // Find the svar_T in sn_var_vals. Start at the end, in a for loop the + // variable was added at the end. + for (idx = si->sn_var_vals.ga_len - 1; idx >= 0; --idx) + { + svar_T *sv = ((svar_T *)si->sn_var_vals.ga_data) + idx; + + // If "sv_name" is NULL the variable was hidden when leaving a block, + // don't check "sv_tv" then, it might be used for another variable now. + if (sv->sv_name != NULL && sv->sv_tv == dest) + return sv; + } + if (must_find) + iemsg("find_typval_in_script(): not found"); + return NULL; +} + +/* + * Check if the type of script variable "dest" allows assigning "value". + * If needed convert "value" to a bool. + */ + int +check_script_var_type( + svar_T *sv, + typval_T *value, + char_u *name, + where_T where) +{ + int ret; + + if (sv->sv_const != 0) + { + semsg(_(e_cannot_change_readonly_variable_str), name); + return FAIL; + } + ret = check_typval_type(sv->sv_type, value, where); + if (ret == OK && need_convert_to_bool(sv->sv_type, value)) + { + int val = tv2bool(value); + + clear_tv(value); + value->v_type = VAR_BOOL; + value->v_lock = 0; + value->vval.v_number = val ? VVAL_TRUE : VVAL_FALSE; + } + return ret; +} + +// words that cannot be used as a variable +// Keep this array sorted, as bsearch() is used to search this array. +static char *reserved[] = { + "false", + "null", + "null_blob", + "null_channel", + "null_class", + "null_dict", + "null_function", + "null_job", + "null_list", + "null_object", + "null_partial", + "null_string", + "null_tuple", + "super", + "this", + "true", +}; + +/* + * String compare function used for bsearch() + */ + static int +comp_names(const void *s1, const void *s2) +{ + return STRCMP(*(char **)s1, *(char **)s2); +} + +/* + * Returns OK if "name" is not a reserved keyword. Otherwise returns FAIL. + */ + int +check_reserved_name(char_u *name, int is_objm_access) +{ + // "this" can be used in an object method + if (is_objm_access && STRCMP("this", name) == 0) + return OK; + + if (bsearch(&name, reserved, ARRAY_LENGTH(reserved), + sizeof(reserved[0]), comp_names) != NULL) + { + semsg(_(e_cannot_use_reserved_name_str), name); + return FAIL; + } + + return OK; +} + +#endif // FEAT_EVAL diff --git a/uvim/src/mnv9type.c b/uvim/src/mnv9type.c new file mode 100644 index 0000000000..52d1bee79f --- /dev/null +++ b/uvim/src/mnv9type.c @@ -0,0 +1,2896 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * MNV - MNV is not Vim by Bram Moolenaar + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. + */ + +/* + * mnv9type.c: handling of types + */ + +#define USING_FLOAT_STUFF +#include "mnv.h" + +#if defined(FEAT_EVAL) + +#ifdef VMS +# include +#endif + +/* + * Allocate memory for a type_T and add the pointer to type_gap, so that it can + * be easily freed later. + */ + type_T * +get_type_ptr(garray_T *type_gap) +{ + type_T *type; + + if (ga_grow(type_gap, 1) == FAIL) + return NULL; + type = ALLOC_CLEAR_ONE(type_T); + if (type == NULL) + return NULL; + + ((type_T **)type_gap->ga_data)[type_gap->ga_len] = type; + ++type_gap->ga_len; + return type; +} + +/* + * Make a shallow copy of "type". + * When allocation fails returns "type". + */ + type_T * +copy_type(type_T *type, garray_T *type_gap) +{ + type_T *copy = get_type_ptr(type_gap); + + if (copy == NULL) + return type; + *copy = *type; + copy->tt_flags &= ~TTFLAG_STATIC; + + if (type->tt_args != NULL + && func_type_add_arg_types(copy, type->tt_argcount, type_gap) == OK) + for (int i = 0; i < type->tt_argcount; ++i) + copy->tt_args[i] = type->tt_args[i]; + + return copy; +} + +/* + * Inner part of copy_type_deep(). + * When allocation fails returns "type". + */ + static type_T * +copy_type_deep_rec(type_T *type, garray_T *type_gap, garray_T *seen_types) +{ + for (int i = 0; i < seen_types->ga_len; ++i) + if (((type_T **)seen_types->ga_data)[i * 2] == type) + // seen this type before, return the copy we made + return ((type_T **)seen_types->ga_data)[i * 2 + 1]; + + type_T *copy = copy_type(type, type_gap); + if (ga_grow(seen_types, 1) == FAIL) + return copy; + ((type_T **)seen_types->ga_data)[seen_types->ga_len * 2] = type; + ((type_T **)seen_types->ga_data)[seen_types->ga_len * 2 + 1] = copy; + ++seen_types->ga_len; + + if (copy->tt_member != NULL) + copy->tt_member = copy_type_deep_rec(copy->tt_member, + type_gap, seen_types); + if (type->tt_args != NULL) + for (int i = 0; i < type->tt_argcount; ++i) + copy->tt_args[i] = copy_type_deep_rec(copy->tt_args[i], + type_gap, seen_types); + + return copy; +} + +/* + * Make a deep copy of "type". + * When allocation fails returns "type". + */ + type_T * +copy_type_deep(type_T *type, garray_T *type_gap) +{ + garray_T seen_types; + // stores type pairs : a type we have seen and the copy used + ga_init2(&seen_types, sizeof(type_T *) * 2, 20); + + type_T *res = copy_type_deep_rec(type, type_gap, &seen_types); + + ga_clear(&seen_types); + return res; +} + + void +clear_type_list(garray_T *gap) +{ + while (gap->ga_len > 0) + mnv_free(((type_T **)gap->ga_data)[--gap->ga_len]); + ga_clear(gap); +} + + void +clear_func_type_list(garray_T *gap, type_T **func_type) +{ + while (gap->ga_len > 0) + { + // func_type pointing to the uf_type_list, so reset pointer + if (*func_type == ((type_T **)gap->ga_data)[--gap->ga_len]) + *func_type = &t_func_any; + mnv_free(((type_T **)gap->ga_data)[gap->ga_len]); + } + ga_clear(gap); +} + +/* + * Take a type that is using entries in a growarray and turn it into a type + * with allocated entries. + */ + type_T * +alloc_type(type_T *type) +{ + type_T *ret; + + if (type == NULL) + return NULL; + + // A fixed type never contains allocated types, return as-is. + if (type->tt_flags & TTFLAG_STATIC) + return type; + + ret = ALLOC_ONE(type_T); + *ret = *type; + + if (ret->tt_member != NULL) + ret->tt_member = alloc_type(ret->tt_member); + + if (type->tt_argcount > 0 && type->tt_args != NULL) + { + int i; + + ret->tt_args = ALLOC_MULT(type_T *, type->tt_argcount); + if (ret->tt_args != NULL) + for (i = 0; i < type->tt_argcount; ++i) + ret->tt_args[i] = alloc_type(type->tt_args[i]); + } + else + ret->tt_args = NULL; + + return ret; +} + +/* + * Free a type that was created with alloc_type(). + */ + void +free_type(type_T *type) +{ + int i; + + if (type == NULL || (type->tt_flags & TTFLAG_STATIC)) + return; + if (type->tt_args != NULL) + { + for (i = 0; i < type->tt_argcount; ++i) + free_type(type->tt_args[i]); + mnv_free(type->tt_args); + } + + free_type(type->tt_member); + + mnv_free(type); +} + +/* + * Return TRUE if "type" is to be recursed into for setting the type. + */ + static int +set_tv_type_recurse(type_T *type) +{ + return type->tt_member != NULL + && (type->tt_member->tt_type == VAR_DICT + || type->tt_member->tt_type == VAR_LIST) + && type->tt_member->tt_member != NULL + && type->tt_member->tt_member != &t_any + && type->tt_member->tt_member != &t_unknown; +} + +/* + * Set the type of Dict "d" to "type" + */ + static void +set_tv_type_dict(dict_T *d, type_T *type) +{ + if (d->dv_type == type) + return; + + free_type(d->dv_type); + d->dv_type = alloc_type(type); + + // Need to recursively set the type of dict items? + if (!set_tv_type_recurse(type)) + return; + + int todo = (int)d->dv_hashtab.ht_used; + hashitem_T *hi; + dictitem_T *di; + + FOR_ALL_HASHTAB_ITEMS(&d->dv_hashtab, hi, todo) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + di = HI2DI(hi); + set_tv_type(&di->di_tv, type->tt_member); + } + } +} + +/* + * Set the type of List "l" to "type" + */ + static void +set_tv_type_list(list_T *l, type_T *type) +{ + if (l->lv_type == type) + return; + + free_type(l->lv_type); + l->lv_type = alloc_type(type); + + // Need to recursively set the type of list items? + if (l->lv_first == &range_list_item || !set_tv_type_recurse(type)) + return; + + listitem_T *li; + + FOR_ALL_LIST_ITEMS(l, li) + set_tv_type(&li->li_tv, type->tt_member); +} + +/* + * Set the type of Tuple "tuple" to "type" + */ + static void +set_tv_type_tuple(tuple_T *tuple, type_T *type) +{ + if (tuple->tv_type == type) + return; + + free_type(tuple->tv_type); + tuple->tv_type = alloc_type(type); + + if (type->tt_argcount <= 0) + return; + + // recursively set the type of list items + type_T *item_type; + for (int i = 0; i < tuple_len(tuple); i++) + { + if ((type->tt_flags & TTFLAG_VARARGS) && (i >= type->tt_argcount - 1)) + // For a variadic tuple, the last type is a List. So use the + // List member type. + item_type = type->tt_args[type->tt_argcount - 1]->tt_member; + else + item_type = type->tt_args[i]; + + set_tv_type(TUPLE_ITEM(tuple, i), item_type); + } +} + +/* + * Set the type of "tv" to "type" if it is a list or tuple or dict. + */ + void +set_tv_type(typval_T *tv, type_T *type) +{ + if (type->tt_type == VAR_ANY) + // If the variable type is "any", then keep the value type. + // e.g. var x: any = [1, 2] or var y: any = {v: 1} + return; + + if (tv->v_type == VAR_DICT && tv->vval.v_dict != NULL) + set_tv_type_dict(tv->vval.v_dict, type); + else if (tv->v_type == VAR_LIST && tv->vval.v_list != NULL) + set_tv_type_list(tv->vval.v_list, type); + else if (tv->v_type == VAR_TUPLE && tv->vval.v_tuple != NULL) + set_tv_type_tuple(tv->vval.v_tuple, type); +} + +/* + * For a tuple type, reserve space for "typecount" types (including the + * repeated type). + */ + static int +tuple_type_add_types( + type_T *tupletype, + int typecount, + garray_T *type_gap) +{ + // To make it easy to free the space needed for the types, add the + // pointer to type_gap. + if (ga_grow(type_gap, 1) == FAIL) + return FAIL; + tupletype->tt_args = ALLOC_CLEAR_MULT(type_T *, typecount); + if (tupletype->tt_args == NULL) + return FAIL; + ((type_T **)type_gap->ga_data)[type_gap->ga_len] = + (void *)tupletype->tt_args; + ++type_gap->ga_len; + return OK; +} + +/* + * Get a list type, based on the member item type in "member_type". + */ + type_T * +get_list_type(type_T *member_type, garray_T *type_gap) +{ + type_T *type; + + // recognize commonly used types + // A generic type is t_any initially before being set to a concrete type + // later. So don't use the static t_list_any for a generic type. + if (member_type == NULL || (member_type->tt_type == VAR_ANY + && !IS_GENERIC_TYPE(member_type))) + return &t_list_any; + if (member_type->tt_type == VAR_VOID + || member_type->tt_type == VAR_UNKNOWN) + return &t_list_empty; + if (member_type->tt_type == VAR_BOOL) + return &t_list_bool; + if (member_type->tt_type == VAR_NUMBER) + return &t_list_number; + if (member_type->tt_type == VAR_STRING) + return &t_list_string; + + // Not a common type, create a new entry. + type = get_type_ptr(type_gap); + if (type == NULL) + return &t_any; + type->tt_type = VAR_LIST; + type->tt_member = member_type; + type->tt_argcount = 0; + type->tt_args = NULL; + return type; +} + +/* + * Create and return a tuple type from the tuple item types in + * "tuple_types_ga". + */ + type_T * +get_tuple_type(garray_T *tuple_types_gap, garray_T *type_gap) +{ + type_T *type; + type_T **tuple_types = tuple_types_gap->ga_data; + int typecount = tuple_types_gap->ga_len; + + // recognize commonly used types + if (typecount == 0) + return &t_tuple_any; + + // Not a common type, create a new entry. + type = get_type_ptr(type_gap); + if (type == NULL) + return &t_any; + type->tt_type = VAR_TUPLE; + type->tt_member = NULL; + if (typecount > 0) + { + if (tuple_type_add_types(type, typecount, type_gap) == FAIL) + return NULL; + mch_memmove(type->tt_args, tuple_types, sizeof(type_T *) * typecount); + } + type->tt_argcount = typecount; + type->tt_flags = 0; + + return type; +} + +/* + * Get a dict type, based on the member item type in "member_type". + */ + type_T * +get_dict_type(type_T *member_type, garray_T *type_gap) +{ + type_T *type; + + // recognize commonly used types + if (member_type == NULL || member_type->tt_type == VAR_ANY) + return &t_dict_any; + if (member_type->tt_type == VAR_VOID + || member_type->tt_type == VAR_UNKNOWN) + return &t_dict_empty; + if (member_type->tt_type == VAR_BOOL) + return &t_dict_bool; + if (member_type->tt_type == VAR_NUMBER) + return &t_dict_number; + if (member_type->tt_type == VAR_STRING) + return &t_dict_string; + + // Not a common type, create a new entry. + type = get_type_ptr(type_gap); + if (type == NULL) + return &t_any; + type->tt_type = VAR_DICT; + type->tt_member = member_type; + type->tt_argcount = 0; + type->tt_args = NULL; + return type; +} + +/* + * Allocate a new type for a function. + */ + type_T * +alloc_func_type(type_T *ret_type, int argcount, garray_T *type_gap) +{ + type_T *type = get_type_ptr(type_gap); + + if (type == NULL) + return &t_any; + type->tt_type = VAR_FUNC; + type->tt_member = ret_type == NULL ? &t_unknown : ret_type; + type->tt_argcount = argcount; + type->tt_args = NULL; + return type; +} + +/* + * Allocate a new type for a tuple. + */ + static type_T * +alloc_tuple_type(int typecount, garray_T *type_gap) +{ + type_T *type = get_type_ptr(type_gap); + + if (type == NULL) + return &t_any; + type->tt_type = VAR_TUPLE; + type->tt_member = NULL; + type->tt_argcount = typecount; + type->tt_args = NULL; + return type; +} + +/* + * Get a function type, based on the return type "ret_type". + * "argcount" must be -1 or 0, a predefined type can be used. + */ + type_T * +get_func_type(type_T *ret_type, int argcount, garray_T *type_gap) +{ + // recognize commonly used types + if (ret_type == &t_unknown || ret_type == NULL) + { + // (argcount == 0) is not possible + return &t_func_unknown; + } + if (ret_type == &t_void) + { + if (argcount == 0) + return &t_func_0_void; + else + return &t_func_void; + } + if (ret_type == &t_any) + { + if (argcount == 0) + return &t_func_0_any; + else + return &t_func_any; + } + if (ret_type == &t_number) + { + if (argcount == 0) + return &t_func_0_number; + else + return &t_func_number; + } + if (ret_type == &t_string) + { + if (argcount == 0) + return &t_func_0_string; + else + return &t_func_string; + } + + return alloc_func_type(ret_type, argcount, type_gap); +} + +/* + * For a function type, reserve space for "argcount" argument types (including + * vararg). + */ + int +func_type_add_arg_types( + type_T *functype, + int argcount, + garray_T *type_gap) +{ + // To make it easy to free the space needed for the argument types, add the + // pointer to type_gap. + if (ga_grow(type_gap, 1) == FAIL) + return FAIL; + functype->tt_args = ALLOC_CLEAR_MULT(type_T *, argcount); + if (functype->tt_args == NULL) + return FAIL; + ((type_T **)type_gap->ga_data)[type_gap->ga_len] = + (void *)functype->tt_args; + ++type_gap->ga_len; + return OK; +} + +/* + * Return TRUE if "type" is NULL, any or unknown. + * This also works for const (comparing with &t_any and &t_unknown doesn't). + */ + int +type_any_or_unknown(type_T *type) +{ + return type == NULL || type->tt_type == VAR_ANY + || type->tt_type == VAR_UNKNOWN; +} + +/* + * Get a type_T for a "special" typval in "tv". + */ + static type_T * +special_typval2type(typval_T *tv) +{ + switch (tv->vval.v_number) + { + case VVAL_NULL: + return &t_null; + + case VVAL_NONE: + return &t_none; + + case VVAL_TRUE: + case VVAL_FALSE: + return &t_bool; + + default: + return &t_unknown; + } +} + +/* + * Get a type_T for a List typval in "tv". + * When "flags" has TVTT_DO_MEMBER also get the member type, otherwise use + * "any". + * When "flags" has TVTT_MORE_SPECIFIC get the more specific member type if it + * is "any". + */ + static type_T * +list_typval2type(typval_T *tv, int copyID, garray_T *type_gap, int flags) +{ + list_T *l = tv->vval.v_list; + listitem_T *li; + type_T *member_type = NULL; + + // An empty list has type list, unless the type was specified + // and is not list. This matters when assigning to a variable + // with a specific list type. + if (l == NULL || (l->lv_first == NULL + && (l->lv_type == NULL || l->lv_type->tt_member == &t_any))) + return &t_list_empty; + + if ((flags & TVTT_DO_MEMBER) == 0) + return &t_list_any; + + // If the type is list go through the members, it may end up a + // more specific type. + if (l->lv_type != NULL && (l->lv_first == NULL + || (flags & TVTT_MORE_SPECIFIC) == 0 + || l->lv_type->tt_member != &t_any)) + // make a copy, lv_type may be freed if the list is freed + return copy_type_deep(l->lv_type, type_gap); + + if (l->lv_first == &range_list_item) + return &t_list_number; + + if (l->lv_copyID == copyID) + // avoid recursion + return &t_list_any; + + l->lv_copyID = copyID; + + // Use the common type of all members. + member_type = typval2type(&l->lv_first->li_tv, copyID, type_gap, + TVTT_DO_MEMBER); + for (li = l->lv_first->li_next; li != NULL; li = li->li_next) + common_type(typval2type(&li->li_tv, copyID, type_gap, TVTT_DO_MEMBER), + member_type, &member_type, type_gap); + + // Reset copyID so that a shared reference to this list (not a circular + // reference) can be processed again to get the correct type. + l->lv_copyID = 0; + + return get_list_type(member_type, type_gap); +} + +/* + * Get a type_T for a Tuple typval in "tv". + * When "flags" has TVTT_DO_MEMBER also get the member type, otherwise use + * "any". + * When "flags" has TVTT_MORE_SPECIFIC get the more specific member type if it + * is "any". + */ + static type_T * +tuple_typval2type(typval_T *tv, int copyID, garray_T *type_gap, int flags) +{ + tuple_T *tuple = tv->vval.v_tuple; + int len = tuple_len(tuple); + type_T *type = NULL; + + // An empty tuple has type tuple, unless the type was specified + // and is not tuple. This matters when assigning to a variable + // with a specific tuple type. + if (tuple == NULL || (len == 0 && (tuple->tv_type == NULL + || tuple->tv_type->tt_argcount == 0))) + return &t_tuple_empty; + + if ((flags & TVTT_DO_MEMBER) == 0) + return &t_tuple_any; + + // If the type is tuple go through the members, it may end up a + // more specific type. + if (tuple->tv_type != NULL && (len == 0 + || (flags & TVTT_MORE_SPECIFIC) == 0)) + // make a copy, tv_type may be freed if the tuple is freed + return copy_type_deep(tuple->tv_type, type_gap); + + if (tuple->tv_copyID == copyID) + // avoid recursion + return &t_tuple_any; + + tuple->tv_copyID = copyID; + + garray_T tuple_types_ga; + ga_init2(&tuple_types_ga, sizeof(type_T *), 10); + for (int i = 0; i < len; i++) + { + type = typval2type(TUPLE_ITEM(tuple, i), copyID, type_gap, + TVTT_DO_MEMBER); + if (ga_grow(&tuple_types_ga, 1) == FAIL) + { + ga_clear(&tuple_types_ga); + // Reset copyID so that a shared reference to this tuple can be + // processed again. + tuple->tv_copyID = 0; + return NULL; + } + ((type_T **)tuple_types_ga.ga_data)[tuple_types_ga.ga_len] = type; + tuple_types_ga.ga_len++; + } + + type_T *tuple_type = get_tuple_type(&tuple_types_ga, type_gap); + ga_clear(&tuple_types_ga); + + // Reset copyID so that a shared reference to this tuple (not a circular + // reference) can be processed again to get the correct type. + tuple->tv_copyID = 0; + + return tuple_type; +} + +/* + * Get a type_T for a Dict typval in "tv". + * When "flags" has TVTT_DO_MEMBER also get the member type, otherwise use + * "any". + * When "flags" has TVTT_MORE_SPECIFIC get the more specific member type if it + * is "any". + */ + static type_T * +dict_typval2type(typval_T *tv, int copyID, garray_T *type_gap, int flags) +{ + dict_iterator_T iter; + typval_T *value; + dict_T *d = tv->vval.v_dict; + type_T *member_type = NULL; + + if (d == NULL || (d->dv_hashtab.ht_used == 0 && d->dv_type == NULL)) + return &t_dict_empty; + + if ((flags & TVTT_DO_MEMBER) == 0) + return &t_dict_any; + + // If the type is dict go through the members, it may end up a + // more specific type. + if (d->dv_type != NULL && (d->dv_hashtab.ht_used == 0 + || (flags & TVTT_MORE_SPECIFIC) == 0 + || d->dv_type->tt_member != &t_any)) + return d->dv_type; + + if (d->dv_copyID == copyID) + // avoid recursion + return &t_dict_any; + + d->dv_copyID = copyID; + + // Use the common type of all values. + dict_iterate_start(tv, &iter); + dict_iterate_next(&iter, &value); + member_type = typval2type(value, copyID, type_gap, TVTT_DO_MEMBER); + + while (dict_iterate_next(&iter, &value) != NULL) + common_type(typval2type(value, copyID, type_gap, TVTT_DO_MEMBER), + member_type, &member_type, type_gap); + + // Reset copyID so that a shared reference to this dict (not a circular + // reference) can be processed again to get the correct type. + d->dv_copyID = 0; + + return get_dict_type(member_type, type_gap); +} + +/* + * Get a type_T for a "partial" typval in "tv". + */ + static type_T * +partial_typval2type(typval_T *tv, ufunc_T *ufunc, garray_T *type_gap) +{ + partial_T *pt = tv->vval.v_partial; + type_T *type; + + type = get_type_ptr(type_gap); + if (type == NULL) + return NULL; + + *type = *ufunc->uf_func_type; + if (type->tt_argcount >= 0 && pt->pt_argc > 0) + { + type->tt_argcount -= pt->pt_argc; + type->tt_min_argcount -= pt->pt_argc; + if (type->tt_argcount > 0 && func_type_add_arg_types(type, + type->tt_argcount, type_gap) == OK) + for (int i = 0; i < type->tt_argcount; ++i) + type->tt_args[i] = + ufunc->uf_func_type->tt_args[i + pt->pt_argc]; + } + if (pt->pt_func != NULL) + type->tt_member = pt->pt_func->uf_ret_type; + + return type; +} + +/* + * Get a type_T for a "class" or an "object" typval in "tv". + */ + static type_T * +oc_typval2type(typval_T *tv) +{ + if (tv->v_type == VAR_CLASS) + { + if (tv->vval.v_class == NULL) + return &t_class; + + return &tv->vval.v_class->class_type; + } + + if (tv->vval.v_object != NULL) + return &tv->vval.v_object->obj_class->class_object_type; + + return &t_object_any; +} + +/* + * Get a type_T for a "function" or a "partial" + */ + static type_T * +fp_typval2type(typval_T *tv, garray_T *type_gap) +{ + char_u *name = NULL; + ufunc_T *ufunc = NULL; + type_T *type; + type_T *member_type = NULL; + int argcount = 0; + int min_argcount = 0; + + if (tv->v_type == VAR_PARTIAL && tv->vval.v_partial != NULL) + { + if (tv->vval.v_partial->pt_func != NULL) + ufunc = tv->vval.v_partial->pt_func; + else + name = tv->vval.v_partial->pt_name; + } + else + name = tv->vval.v_string; + + if (name == NULL && ufunc == NULL) + return &t_func_unknown; + + if (name != NULL) + { + int idx = find_internal_func(name); + + if (idx >= 0) + { + type_T *decl_type; // unused + + internal_func_get_argcount(idx, &argcount, &min_argcount); + member_type = internal_func_ret_type(idx, 0, NULL, &decl_type, + type_gap); + } + else + { + // Check if name contains "<". If it does, then replace "<" with + // NUL and lookup the function and then look up the specific + // generic function using the supplied types. + char_u *p = generic_func_find_open_bracket(name); + if (p == NULL) + ufunc = find_func(name, FALSE); + else + { + // generic function + char_u cc = *p; + + *p = NUL; + ufunc = find_func(name, FALSE); + *p = cc; + if (ufunc != NULL && IS_GENERIC_FUNC(ufunc)) + { + ufunc = find_generic_func(ufunc, name, &p); + if (ufunc == NULL) + return NULL; + } + } + } + } + if (ufunc != NULL) + { + // May need to get the argument types from default values by + // compiling the function. + if (ufunc->uf_def_status == UF_TO_BE_COMPILED + && compile_def_function(ufunc, TRUE, CT_NONE, NULL) + == FAIL) + return NULL; + if (ufunc->uf_func_type == NULL) + set_function_type(ufunc); + if (ufunc->uf_func_type != NULL) + { + if (tv->v_type == VAR_PARTIAL && tv->vval.v_partial != NULL) + return partial_typval2type(tv, ufunc, type_gap); + return ufunc->uf_func_type; + } + } + + type = get_type_ptr(type_gap); + if (type == NULL) + return NULL; + type->tt_type = tv->v_type; + type->tt_argcount = argcount; + type->tt_min_argcount = min_argcount; + if (tv->v_type == VAR_PARTIAL && tv->vval.v_partial != NULL + && tv->vval.v_partial->pt_argc > 0) + { + type->tt_argcount -= tv->vval.v_partial->pt_argc; + type->tt_min_argcount -= tv->vval.v_partial->pt_argc; + } + type->tt_member = member_type; + + return type; +} + +/* + * Get a type_T for a typval_T. + * "type_gap" is used to temporarily create types in. + * When "flags" has TVTT_DO_MEMBER also get the member type, otherwise use + * "any". + * When "flags" has TVTT_MORE_SPECIFIC get the more specific member type if it + * is "any". + */ + static type_T * +typval2type_int(typval_T *tv, int copyID, garray_T *type_gap, int flags) +{ + switch (tv->v_type) + { + case VAR_UNKNOWN: + return &t_unknown; + + case VAR_ANY: + return &t_any; + + case VAR_VOID: + return &t_void; + + case VAR_BOOL: + return &t_bool; + + case VAR_SPECIAL: + return special_typval2type(tv); + + case VAR_NUMBER: + return &t_number; + + case VAR_FLOAT: + return &t_float; + + case VAR_STRING: + return &t_string; + + case VAR_BLOB: + if (tv->vval.v_blob == NULL) + return &t_blob_null; + return &t_blob; + + case VAR_LIST: + return list_typval2type(tv, copyID, type_gap, flags); + + case VAR_TUPLE: + return tuple_typval2type(tv, copyID, type_gap, flags); + + case VAR_DICT: + return dict_typval2type(tv, copyID, type_gap, flags); + + case VAR_JOB: + return &t_job; + + case VAR_CHANNEL: + return &t_channel; + + case VAR_CLASS: + case VAR_OBJECT: + return oc_typval2type(tv); + + case VAR_TYPEALIAS: + return &t_typealias; + + case VAR_FUNC: + case VAR_PARTIAL: + return fp_typval2type(tv, type_gap); + + case VAR_INSTR: + default: + break; + } + + return NULL; +} + +/* + * Return TRUE if "tv" is not a bool but should be converted to bool. + */ + int +need_convert_to_bool(type_T *type, typval_T *tv) +{ + return type != NULL && type == &t_bool && tv->v_type != VAR_BOOL + && (tv->v_type == VAR_NUMBER + && (tv->vval.v_number == 0 || tv->vval.v_number == 1)); +} + +/* + * Get a type_T for a typval_T. + * "type_list" is used to temporarily create types in. + * When "flags" has TVTT_DO_MEMBER also get the member type, otherwise use + * "any". + * When "flags" has TVTT_MORE_SPECIFIC get the most specific member type. + */ + type_T * +typval2type(typval_T *tv, int copyID, garray_T *type_gap, int flags) +{ + type_T *type = typval2type_int(tv, copyID, type_gap, flags); + + if (type == NULL) + return NULL; + + if (type != &t_bool && (tv->v_type == VAR_NUMBER + && (tv->vval.v_number == 0 || tv->vval.v_number == 1))) + // Number 0 and 1 and expression with "&&" or "||" can also be used + // for bool. + type = &t_number_bool; + else if (type != &t_float && tv->v_type == VAR_NUMBER) + // A number can also be used for float. + type = &t_number_float; + return type; +} + +/* + * Return TRUE if "type" can be used for a variable declaration. + * Give an error and return FALSE if not. + */ + int +valid_declaration_type(type_T *type) +{ + if (type->tt_type == VAR_SPECIAL // null, none + || type->tt_type == VAR_VOID) + { + char *tofree = NULL; + char *name = type_name(type, &tofree); + semsg(_(e_invalid_type_in_variable_declaration_str), name); + mnv_free(tofree); + return FALSE; + } + return TRUE; +} + +/* + * Get a type_T for a typval_T, used for v: variables. + * "type_list" is used to temporarily create types in. + */ + type_T * +typval2type_mnvvar(typval_T *tv, garray_T *type_gap) +{ + if (tv->v_type == VAR_LIST) // e.g. for v:oldfiles + return &t_list_string; + if (tv->v_type == VAR_DICT) // e.g. for v:event + return &t_dict_any; + return typval2type(tv, get_copyID(), type_gap, TVTT_DO_MEMBER); +} + + int +check_typval_arg_type( + type_T *expected, + typval_T *actual_tv, + char *func_name, + int arg_idx) +{ + where_T where = WHERE_INIT; + + if (arg_idx > 0) + { + where.wt_index = arg_idx; + where.wt_kind = WT_ARGUMENT; + } + where.wt_func_name = func_name; + return check_typval_type(expected, actual_tv, where); +} + +/* + * Return FAIL if "expected" and "actual" don't match. + * When "argidx" > 0 it is included in the error message. + */ + int +check_typval_type(type_T *expected, typval_T *actual_tv, where_T where) +{ + garray_T type_list; + type_T *actual_type; + int res = FAIL; + + if (expected == NULL) + return OK; // didn't expect anything. + + ga_init2(&type_list, sizeof(type_T *), 10); + + // A null_function and null_partial are special cases, they can be used to + // clear a variable. + if ((actual_tv->v_type == VAR_FUNC && actual_tv->vval.v_string == NULL) + || (actual_tv->v_type == VAR_PARTIAL + && actual_tv->vval.v_partial == NULL)) + actual_type = &t_func_unknown; + else + // When the actual type is list or dict go through the values + // to possibly get a more specific type. + actual_type = typval2type(actual_tv, get_copyID(), &type_list, + TVTT_DO_MEMBER | TVTT_MORE_SPECIFIC); + if (actual_type != NULL) + { + res = check_type_maybe(expected, actual_type, TRUE, where); + if (res == MAYBE && !(actual_type->tt_type == VAR_FUNC + && (actual_type->tt_member == &t_unknown + || actual_type->tt_member == NULL))) + { + // If a type check is needed that means assigning "any" or + // "unknown" to a more specific type, which fails here. + // Except when it looks like a lambda, since they have an + // incomplete type. A legacy lambda function has a NULL return + // type. + type_mismatch_where(expected, actual_type, where); + res = FAIL; + } + } + clear_type_list(&type_list); + return res; +} + + void +arg_type_mismatch(type_T *expected, type_T *actual, int arg_idx) +{ + where_T where = WHERE_INIT; + + if (arg_idx > 0) + { + where.wt_index = arg_idx; + where.wt_kind = WT_ARGUMENT; + } + type_mismatch_where(expected, actual, where); +} + + void +type_mismatch_where(type_T *expected, type_T *actual, where_T where) +{ + char *tofree1, *tofree2; + char *typename1 = type_name(expected, &tofree1); + char *typename2 = type_name(actual, &tofree2); + + switch (where.wt_kind) + { + case WT_MEMBER: + semsg(_(e_variable_str_type_mismatch_expected_str_but_got_str), + where.wt_func_name, typename1, typename2); + break; + case WT_METHOD: + case WT_METHOD_ARG: + case WT_METHOD_RETURN: + semsg(_(e_method_str_type_mismatch_expected_str_but_got_str), + where.wt_func_name, typename1, typename2); + break; + case WT_VARIABLE: + if (where.wt_func_name == NULL) + semsg(_(e_variable_nr_type_mismatch_expected_str_but_got_str), + where.wt_index, typename1, typename2); + else + semsg(_(e_variable_nr_type_mismatch_expected_str_but_got_str_in_str), + where.wt_index, typename1, typename2, where.wt_func_name); + break; + case WT_ARGUMENT: + if (where.wt_func_name == NULL) + semsg(_(e_argument_nr_type_mismatch_expected_str_but_got_str), + where.wt_index, typename1, typename2); + else + semsg(_(e_argument_nr_type_mismatch_expected_str_but_got_str_in_str), + where.wt_index, typename1, typename2, where.wt_func_name); + break; + case WT_CAST: + case WT_UNKNOWN: + if (where.wt_func_name == NULL) + semsg(_(e_type_mismatch_expected_str_but_got_str), + typename1, typename2); + else + semsg(_(e_type_mismatch_expected_str_but_got_str_in_str), + typename1, typename2, where.wt_func_name); + break; + } + + mnv_free(tofree1); + mnv_free(tofree2); +} + +/* + * Check if the expected and actual types match for a tuple + */ + static int +check_tuple_type_maybe( + type_T *expected, + type_T *actual, + where_T where) +{ + if (expected->tt_argcount == -1 || actual->tt_argcount == -1 + || expected->tt_args == NULL || actual->tt_args == NULL) + return OK; + + // For a non-variadic tuple, the number of items must match + if (!(expected->tt_flags & TTFLAG_VARARGS) + && expected->tt_argcount != actual->tt_argcount) + return FAIL; + + // compare the type of each tuple item + for (int i = 0; i < actual->tt_argcount; ++i) + { + type_T *exp_type; + type_T *actual_type; + + if (expected->tt_flags & TTFLAG_VARARGS) + { + if (i < expected->tt_argcount - 1) + exp_type = expected->tt_args[i]; + else + // For a variadic tuple, the last type is a List. So use the + // List member type. + exp_type = expected->tt_args[expected->tt_argcount - 1]->tt_member; + } + else + exp_type = expected->tt_args[i]; + + if (actual->tt_flags & TTFLAG_VARARGS) + { + if (i < actual->tt_argcount - 1) + actual_type = actual->tt_args[i]; + else + // For a variadic tuple, the last type is a List. So use the + // List member type. + actual_type = actual->tt_args[actual->tt_argcount - 1]->tt_member; + } + else + actual_type = actual->tt_args[i]; + + // Allow for using "any" type for a tuple item + if (actual->tt_args[i] != &t_any && check_type(exp_type, actual_type, + FALSE, where) == FAIL) + return FAIL; + } + + return OK; +} + +/* + * Check if the expected and actual types match for a function + * Returns OK if "expected" and "actual" are matching function types. + * Returns FAIL if "expected" and "actual" are different types. + * Returns MAYBE when a runtime type check is needed. + */ + static int +check_func_type_maybe( + type_T *expected, + type_T *actual, + where_T where) +{ + int ret = OK; + + // If the return type is unknown it can be anything, including + // nothing, thus there is no point in checking. + if (expected->tt_member != &t_unknown) + { + if (actual->tt_member != NULL + && actual->tt_member != &t_unknown) + { + where_T func_where = where; + + func_where.wt_kind = WT_METHOD_RETURN; + ret = check_type_maybe(expected->tt_member, + actual->tt_member, FALSE, + func_where); + } + else + ret = MAYBE; + } + if (ret != FAIL + && ((expected->tt_flags & TTFLAG_VARARGS) + != (actual->tt_flags & TTFLAG_VARARGS)) + && expected->tt_argcount != -1) + ret = FAIL; + if (ret != FAIL && expected->tt_argcount != -1 + && actual->tt_min_argcount != -1 + && (actual->tt_argcount == -1 + || (actual->tt_argcount < expected->tt_min_argcount + || actual->tt_argcount > expected->tt_argcount))) + ret = FAIL; + if (ret != FAIL && expected->tt_args != NULL + && actual->tt_args != NULL) + { + int i; + + for (i = 0; i < expected->tt_argcount + && i < actual->tt_argcount; ++i) + { + where_T func_where = where; + func_where.wt_kind = WT_METHOD_ARG; + + // Allow for using "any" argument type, lambda's have them. + if (actual->tt_args[i] != &t_any && check_type( + expected->tt_args[i], actual->tt_args[i], FALSE, + func_where) == FAIL) + { + ret = FAIL; + break; + } + } + } + if (ret == OK && expected->tt_argcount >= 0 + && actual->tt_argcount == -1) + // check the argument count at runtime + ret = MAYBE; + + return ret; +} + +/* + * Check if the expected and actual types match for an object + * Returns OK if "expected" and "actual" are matching object types. + * Returns FAIL if "expected" and "actual" are different types. + * Returns MAYBE when a runtime type check is needed. + */ + static int +check_object_type_maybe( + type_T *expected, + type_T *actual, + where_T where) +{ + int ret = OK; + + if (actual->tt_type == VAR_ANY) + return MAYBE; // use runtime type check + if (actual->tt_type != VAR_OBJECT) + return FAIL; // don't use tt_class + if (actual->tt_class == NULL) // null object + return OK; + // t_object_any matches any object except for an enum item + if (expected == &t_object_any && !IS_ENUM(actual->tt_class)) + return OK; + + // For object method arguments, do a invariant type check in + // an extended class. For all others, do a covariance type check. + if (where.wt_kind == WT_METHOD_ARG) + { + if (actual->tt_class != expected->tt_class) + ret = FAIL; + } + else if (!class_instance_of(actual->tt_class, expected->tt_class)) + { + // Check if this is an up-cast, if so we'll have to check the type at + // runtime. + if (where.wt_kind == WT_CAST && + class_instance_of(expected->tt_class, actual->tt_class)) + ret = MAYBE; + else + ret = FAIL; + } + + return ret; +} + +/* + * Check if the expected and actual types match. + * Does not allow for assigning "any" to a specific type. + * When "argidx" > 0 it is included in the error message. + * Return OK if types match. + * Return FAIL if types do not match. + */ + int +check_type( + type_T *expected, + type_T *actual, + int give_msg, + where_T where) +{ + int ret = check_type_maybe(expected, actual, give_msg, where); + + return ret == MAYBE ? OK : ret; +} + +/* + * As check_type() but return MAYBE when a runtime type check should be used + * when compiling. + */ + int +check_type_maybe( + type_T *expected, + type_T *actual, + int give_msg, + where_T where) +{ + int ret = OK; + + // When expected is "unknown" we accept any actual type. + // When expected is "any" we accept any actual type except "void". + if (expected->tt_type != VAR_UNKNOWN + && !(expected->tt_type == VAR_ANY && actual->tt_type != VAR_VOID)) + + { + // tt_type should match, except that a "partial" can be assigned to a + // variable with type "func". + // And "unknown" (using global variable) and "any" need a runtime type + // check. + if (!(expected->tt_type == actual->tt_type + || actual->tt_type == VAR_UNKNOWN + || actual->tt_type == VAR_ANY + || (expected->tt_type == VAR_FUNC + && actual->tt_type == VAR_PARTIAL))) + { + if (expected->tt_type == VAR_BOOL + && (actual->tt_flags & TTFLAG_BOOL_OK)) + // Using number 0 or 1 for bool is OK. + return OK; + if (expected->tt_type == VAR_FLOAT + && actual->tt_type == VAR_NUMBER + && ((expected->tt_flags & TTFLAG_NUMBER_OK) + || (actual->tt_flags & TTFLAG_FLOAT_OK))) + // Using a number where a float is expected is OK here. + return OK; + if (expected->tt_type == VAR_LIST + && actual->tt_type == VAR_TUPLE + && (expected->tt_flags & TTFLAG_TUPLE_OK)) + // Using a tuple where a list is expected is OK here. + return OK; + if (give_msg) + type_mismatch_where(expected, actual, where); + return FAIL; + } + if (expected->tt_type == VAR_DICT || expected->tt_type == VAR_LIST) + { + // "unknown" is used for an empty list or dict + if (actual->tt_member != NULL && actual->tt_member != &t_unknown) + ret = check_type_maybe(expected->tt_member, actual->tt_member, + FALSE, where); + } + else if (expected->tt_type == VAR_TUPLE && actual != &t_any) + ret = check_tuple_type_maybe(expected, actual, where); + else if (expected->tt_type == VAR_FUNC && actual != &t_any) + ret = check_func_type_maybe(expected, actual, where); + else if (expected->tt_type == VAR_OBJECT) + ret = check_object_type_maybe(expected, actual, where); + + if (ret == FAIL && give_msg) + type_mismatch_where(expected, actual, where); + } + + if (ret == OK && expected->tt_type != VAR_UNKNOWN + && expected->tt_type != VAR_ANY + && (actual->tt_type == VAR_UNKNOWN || actual->tt_type == VAR_ANY)) + // check the type at runtime + ret = MAYBE; + + return ret; +} + +/* + * Check that the arguments of "type" match "argvars[argcount]". + * "base_tv" is from "expr->Func()". + * Return OK/FAIL. + */ + int +check_argument_types( + type_T *type, + typval_T *argvars, + int argcount, + typval_T *base_tv, + char_u *name) +{ + int varargs = (type->tt_flags & TTFLAG_VARARGS) ? 1 : 0; + int i; + int totcount = argcount + (base_tv == NULL ? 0 : 1); + + if (type->tt_type != VAR_FUNC && type->tt_type != VAR_PARTIAL) + return OK; // just in case + if (totcount < type->tt_min_argcount - varargs) + { + emsg_funcname(e_not_enough_arguments_for_function_str, name); + return FAIL; + } + if (!varargs && type->tt_argcount >= 0 && totcount > type->tt_argcount) + { + emsg_funcname(e_too_many_arguments_for_function_str, name); + return FAIL; + } + if (type->tt_args == NULL) + return OK; // cannot check + + + for (i = 0; i < totcount; ++i) + { + type_T *expected; + typval_T *tv; + + if (base_tv != NULL) + { + if (i == 0) + tv = base_tv; + else + tv = &argvars[i - 1]; + } + else + tv = &argvars[i]; + if (varargs && i >= type->tt_argcount - 1) + { + expected = type->tt_args[type->tt_argcount - 1]; + if (expected != NULL && expected->tt_type == VAR_LIST) + expected = expected->tt_member; + if (expected == NULL) + expected = &t_any; + } + else + expected = type->tt_args[i]; + + // check the type, unless the value is v:none + if ((tv->v_type != VAR_SPECIAL || tv->vval.v_number != VVAL_NONE) + && check_typval_arg_type(expected, tv, NULL, i + 1) == FAIL) + return FAIL; + } + return OK; +} + +/* + * Skip over type in list, dict or tuple. + * Returns a pointer to the character after the type. "syn_error" is set to + * TRUE on syntax error. + */ + static char_u * +skip_member_type(char_u *start, char_u *p, int *syn_error) +{ + if (STRNCMP("tuple", start, 5) == 0) + { + // handle tuple<{type1}, {type2}, ....> + p = skipwhite(p + 1); + while (*p != '>' && *p != NUL) + { + char_u *sp = p; + + if (STRNCMP(p, "...", 3) == 0) + p += 3; + p = skip_type(p, TRUE); + if (p == sp) + { + *syn_error = TRUE; + return p; // syntax error + } + if (*p == ',') + p = skipwhite(p + 1); + } + if (*p == '>') + p++; + } + else + { + p = skipwhite(p); + p = skip_type(skipwhite(p + 1), FALSE); + p = skipwhite(p); + if (*p == '>') + ++p; + } + + return p; +} + +/* + * Skip over a function type. Returns a pointer to the character after the + * type. "syn_error" is set to TRUE on syntax error. + */ + static char_u * +skip_func_type(char_u *p, int *syn_error) +{ + if (*p == '(') + { + // handle func(args): type + ++p; + while (*p != ')' && *p != NUL) + { + char_u *sp = p; + + if (STRNCMP(p, "...", 3) == 0) + p += 3; + p = skip_type(p, TRUE); + if (p == sp) + { + *syn_error = TRUE; + return p; // syntax error + } + if (*p == ',') + p = skipwhite(p + 1); + } + if (*p == ')') + { + if (p[1] == ':') + p = skip_type(skipwhite(p + 2), FALSE); + else + ++p; + } + } + else + { + // handle func: return_type + p = skip_type(skipwhite(p + 1), FALSE); + } + + return p; +} + +/* + * Skip over a type definition and return a pointer to just after it. + * When "optional" is TRUE then a leading "?" is accepted. + */ + char_u * +skip_type(char_u *start, int optional) +{ + char_u *p = start; + int syn_error = FALSE; + + if (optional && *p == '?') + ++p; + + // Also skip over "." for imported classes: "import.ClassName". + while (ASCII_ISALNUM(*p) || *p == '_' || *p == '.') + ++p; + + // Skip over ""; this is permissive about white space. + if (*skipwhite(p) == '<') + { + p = skip_member_type(start, p, &syn_error); + if (syn_error) + return p; + } + else if ((*p == '(' || (*p == ':' && MNV_ISWHITE(p[1]))) + && STRNCMP("func", start, 4) == 0) + { + // skip over function type + p = skip_func_type(p, &syn_error); + if (syn_error) + return p; + } + + return p; +} + +/* + * Parse the member type: "" and return "type" with the member set. + * Use "type_gap" if a new type needs to be added. + * "info" is extra information for an error message. + * Returns NULL in case of failure. + */ + static type_T * +parse_type_member( + char_u **arg, + type_T *type, + garray_T *type_gap, + int give_error, + char *info, + ufunc_T *ufunc, + cctx_T *cctx) +{ + char_u *arg_start = *arg; + type_T *member_type; + int prev_called_emsg = called_emsg; + + if (**arg != '<') + { + if (give_error) + { + if (*skipwhite(*arg) == '<') + semsg(_(e_no_white_space_allowed_before_str_str), "<", *arg); + else + semsg(_(e_missing_type_after_str), info); + } + return NULL; + } + *arg = skipwhite(*arg + 1); + + member_type = parse_type(arg, type_gap, ufunc, cctx, give_error); + if (member_type == NULL || !valid_declaration_type(member_type)) + return NULL; + + *arg = skipwhite(*arg); + if (**arg != '>' && called_emsg == prev_called_emsg) + { + if (give_error) + semsg(_(e_missing_gt_after_type_str), arg_start); + return NULL; + } + ++*arg; + + if (type->tt_type == VAR_LIST) + return get_list_type(member_type, type_gap); + return get_dict_type(member_type, type_gap); +} + +/* + * Parse a "func" type at "*arg" and advance over it. + * When "give_error" is TRUE give error messages, otherwise be quiet. + * Return NULL for failure. + */ + static type_T * +parse_type_func( + char_u **arg, + size_t len, + garray_T *type_gap, + int give_error, + ufunc_T *ufunc, + cctx_T *cctx) +{ + char_u *p; + type_T *type; + type_T *ret_type = &t_unknown; + int argcount = -1; + int flags = 0; + int first_optional = -1; + type_T *arg_type[MAX_FUNC_ARGS + 1]; + + // func({type}, ...{type}): {type} + *arg += len; + if (**arg == '(') + { + // "func" may or may not return a value, "func()" does + // not return a value. + ret_type = &t_void; + + p = ++*arg; + argcount = 0; + while (*p != NUL && *p != ')') + { + if (*p == '?') + { + if (first_optional == -1) + first_optional = argcount; + ++p; + } + else if (STRNCMP(p, "...", 3) == 0) + { + flags |= TTFLAG_VARARGS; + p += 3; + } + else if (first_optional != -1) + { + if (give_error) + emsg(_(e_mandatory_argument_after_optional_argument)); + return NULL; + } + + type = parse_type(&p, type_gap, ufunc, cctx, give_error); + if (type == NULL || !valid_declaration_type(type)) + return NULL; + if ((flags & TTFLAG_VARARGS) != 0 && type->tt_type != VAR_LIST) + { + char *tofree; + semsg(_(e_variable_arguments_type_must_be_list_str), + type_name(type, &tofree)); + mnv_free(tofree); + return NULL; + } + arg_type[argcount++] = type; + + // Nothing comes after "...{type}". + if (flags & TTFLAG_VARARGS) + break; + + if (*p != ',' && *skipwhite(p) == ',') + { + if (give_error) + semsg(_(e_no_white_space_allowed_before_str_str), + ",", p); + return NULL; + } + if (*p == ',') + { + ++p; + if (!MNV_ISWHITE(*p)) + { + if (give_error) + semsg(_(e_white_space_required_after_str_str), + ",", p - 1); + return NULL; + } + } + p = skipwhite(p); + if (argcount == MAX_FUNC_ARGS) + { + if (give_error) + emsg(_(e_too_many_argument_types)); + return NULL; + } + } + + p = skipwhite(p); + if (*p != ')') + { + if (give_error) + emsg(_(e_missing_closing_paren)); + return NULL; + } + *arg = p + 1; + } + if (**arg == ':') + { + // parse return type + ++*arg; + if (!MNV_ISWHITE(**arg) && give_error) + semsg(_(e_white_space_required_after_str_str), ":", *arg - 1); + *arg = skipwhite(*arg); + ret_type = parse_type(arg, type_gap, ufunc, cctx, give_error); + if (ret_type == NULL) + return NULL; + } + if (flags == 0 && first_optional == -1 && argcount <= 0) + type = get_func_type(ret_type, argcount, type_gap); + else + { + type = alloc_func_type(ret_type, argcount, type_gap); + type->tt_flags = flags; + if (argcount > 0) + { + type->tt_argcount = argcount; + type->tt_min_argcount = first_optional == -1 + ? argcount : first_optional; + if (func_type_add_arg_types(type, argcount, type_gap) == FAIL) + return NULL; + mch_memmove(type->tt_args, arg_type, sizeof(type_T *) * argcount); + } + } + + return type; +} + +/* + * Parse a "tuple" type at "*arg" and advance over it. + * When "give_error" is TRUE give error messages, otherwise be quiet. + * Return NULL for failure. + */ + static type_T * +parse_type_tuple( + char_u **arg, + garray_T *type_gap, + int give_error, + ufunc_T *ufunc, + cctx_T *cctx) +{ + char_u *p; + type_T *type; + type_T *ret_type = NULL; + int typecount = -1; + int flags = 0; + garray_T tuple_types_ga; + + ga_init2(&tuple_types_ga, sizeof(type_T *), 10); + + // tuple<{type}, {type}> + // tuple<{type}, ...{type}> + if (**arg != '<') + { + if (give_error) + { + if (*skipwhite(*arg) == '<') + semsg(_(e_no_white_space_allowed_before_str_str), "<", *arg); + else + semsg(_(e_missing_type_after_str), "tuple"); + } + + // only "tuple" is specified + return NULL; + } + + p = ++*arg; + typecount = 0; + while (*p != NUL && *p != '>') + { + if (STRNCMP(p, "...", 3) == 0) + { + flags |= TTFLAG_VARARGS; + p += 3; + } + + type = parse_type(&p, type_gap, ufunc, cctx, give_error); + if (type == NULL || !valid_declaration_type(type)) + goto on_err; + + if ((flags & TTFLAG_VARARGS) != 0 && type->tt_type != VAR_LIST) + { + char *tofree; + semsg(_(e_variadic_tuple_must_end_with_list_type_str), + type_name(type, &tofree)); + mnv_free(tofree); + goto on_err; + } + + // Add the item type + if (ga_grow(&tuple_types_ga, 1) == FAIL) + goto on_err; + ((type_T **)tuple_types_ga.ga_data)[tuple_types_ga.ga_len] = type; + tuple_types_ga.ga_len++; + typecount++; + + // Nothing comes after "...{type}". + if (flags & TTFLAG_VARARGS) + break; + + if (*p != ',' && *skipwhite(p) == ',') + { + if (give_error) + semsg(_(e_no_white_space_allowed_before_str_str), ",", p); + goto on_err; + } + if (*p == ',') + { + ++p; + if (!MNV_ISWHITE(*p)) + { + if (give_error) + semsg(_(e_white_space_required_after_str_str), + ",", p - 1); + goto on_err; + } + } + p = skipwhite(p); + } + + p = skipwhite(p); + if (*p != '>' || typecount <= 0) + { + if (give_error) + semsg(_(e_missing_type_after_str), p); + goto on_err; + } + *arg = p + 1; + + ret_type = alloc_tuple_type(typecount, type_gap); + ret_type->tt_flags = flags; + ret_type->tt_argcount = typecount; + if (tuple_type_add_types(ret_type, typecount, type_gap) == FAIL) + { + ret_type = NULL; + goto on_err; + } + mch_memmove(ret_type->tt_args, tuple_types_ga.ga_data, + sizeof(type_T *) * typecount); + +on_err: + ga_clear(&tuple_types_ga); + + return ret_type; +} + +/* + * Parse a "object" type at "*arg" and advance over it. + * When "give_error" is TRUE give error messages, otherwise be quiet. + * Return NULL for failure. + */ + static type_T * +parse_type_object( + char_u **arg, + garray_T *type_gap, + int give_error, + cctx_T *cctx) +{ + char_u *arg_start = *arg; + type_T *object_type; + int prev_called_emsg = called_emsg; + + // object or object + if (**arg != '<') + { + if (give_error) + { + if (*skipwhite(*arg) == '<') + semsg(_(e_no_white_space_allowed_before_str_str), "<", *arg); + else + semsg(_(e_missing_type_after_str), "object"); + } + + // only "object" is specified + return NULL; + } + + // skip spaces following "object<" + *arg = skipwhite(*arg + 1); + + object_type = parse_type(arg, type_gap, NULL, cctx, give_error); + if (object_type == NULL) + return NULL; + + *arg = skipwhite(*arg); + if (**arg != '>' && called_emsg == prev_called_emsg) + { + if (give_error) + semsg(_(e_missing_gt_after_type_str), arg_start); + return NULL; + } + ++*arg; + + if (object_type->tt_type == VAR_ANY) + return &t_object_any; + + if (object_type->tt_type != VAR_OBJECT) + { + // specified type is not a class + if (give_error) + semsg(_(e_class_name_not_found_str), arg_start); + return NULL; + } + + return object_type; +} + +/* + * Parse a user defined type at "*arg" and advance over it. + * It can be a class or an interface or a typealias name, possibly imported. + * Return NULL if a type is not found. + */ + static type_T * +parse_type_user_defined( + char_u **arg, + size_t len, + garray_T *type_gap, + int give_error, + ufunc_T *ufunc, + cctx_T *cctx) +{ + int did_emsg_before = did_emsg; + typval_T tv; + + tv.v_type = VAR_UNKNOWN; + if (eval_variable_import(*arg, &tv) == OK) + { + if (tv.v_type == VAR_CLASS && tv.vval.v_class != NULL) + { + type_T *type = get_type_ptr(type_gap); + if (type != NULL) + { + // Although the name is that of a class or interface, the type + // uses will be an object. + type->tt_type = VAR_OBJECT; + type->tt_class = tv.vval.v_class; + clear_tv(&tv); + + *arg += len; + // Skip over ".ClassName". + while (ASCII_ISALNUM(**arg) || **arg == '_' || **arg == '.') + ++*arg; + + return type; + } + } + else if (tv.v_type == VAR_TYPEALIAS) + { + // user defined type + type_T *type = copy_type(tv.vval.v_typealias->ta_type, type_gap); + *arg += len; + clear_tv(&tv); + // Skip over ".TypeName". + while (ASCII_ISALNUM(**arg) || **arg == '_' || **arg == '.') + ++*arg; + return type; + } + + clear_tv(&tv); + } + + // Check whether it is a generic type + type_T *type = find_generic_type(*arg, len, ufunc, cctx); + if (type != NULL) + { + *arg += len; + return type; + } + + if (give_error && (did_emsg == did_emsg_before)) + { + char_u *p = skip_type(*arg, FALSE); + char cc = *p; + + *p = NUL; + semsg(_(e_type_not_recognized_str), *arg); + *p = cc; + } + + return NULL; +} + +/* + * Parse a type at "arg" and advance over it. + * When "give_error" is TRUE give error messages, otherwise be quiet. + * Return NULL for failure. + */ + type_T * +parse_type( + char_u **arg, + garray_T *type_gap, + ufunc_T *ufunc, + cctx_T *cctx, + int give_error) +{ + char_u *p = *arg; + size_t len; + + // Skip over the first word. + while (ASCII_ISALNUM(*p) || *p == '_') + ++p; + len = p - *arg; + + switch (**arg) + { + case 'a': + if (len == 3 && STRNCMP(*arg, "any", len) == 0) + { + *arg += len; + return &t_any; + } + break; + case 'b': + if (len == 4 && STRNCMP(*arg, "bool", len) == 0) + { + *arg += len; + return &t_bool; + } + if (len == 4 && STRNCMP(*arg, "blob", len) == 0) + { + *arg += len; + return &t_blob; + } + break; + case 'c': + if (len == 7 && STRNCMP(*arg, "channel", len) == 0) + { + *arg += len; + return &t_channel; + } + break; + case 'd': + if (len == 4 && STRNCMP(*arg, "dict", len) == 0) + { + *arg += len; + return parse_type_member(arg, &t_dict_any, type_gap, + give_error, "dict", ufunc, + cctx); + } + break; + case 'f': + if (len == 5 && STRNCMP(*arg, "float", len) == 0) + { + *arg += len; + return &t_float; + } + if (len == 4 && STRNCMP(*arg, "func", len) == 0) + return parse_type_func(arg, len, type_gap, give_error, ufunc, + cctx); + break; + case 'j': + if (len == 3 && STRNCMP(*arg, "job", len) == 0) + { + *arg += len; + return &t_job; + } + break; + case 'l': + if (len == 4 && STRNCMP(*arg, "list", len) == 0) + { + *arg += len; + return parse_type_member(arg, &t_list_any, type_gap, + give_error, "list", ufunc, + cctx); + } + break; + case 'n': + if (len == 6 && STRNCMP(*arg, "number", len) == 0) + { + *arg += len; + return &t_number; + } + break; + case 'o': + if (len == 6 && STRNCMP(*arg, "object", len) == 0) + { + *arg += len; + return parse_type_object(arg, type_gap, give_error, cctx); + } + break; + case 's': + if (len == 6 && STRNCMP(*arg, "string", len) == 0) + { + *arg += len; + return &t_string; + } + break; + case 't': + if (len == 5 && STRNCMP(*arg, "tuple", len) == 0) + { + *arg += len; + return parse_type_tuple(arg, type_gap, give_error, ufunc, + cctx); + } + break; + case 'v': + if (len == 4 && STRNCMP(*arg, "void", len) == 0) + { + *arg += len; + return &t_void; + } + break; + } + + // User defined type + return parse_type_user_defined(arg, len, type_gap, give_error, ufunc, + cctx); +} + +/* + * Check if "type1" and "type2" are exactly the same. + * "flags" can have ETYPE_ARG_UNKNOWN, which means that an unknown argument + * type in "type1" is accepted. + */ + int +equal_type(type_T *type1, type_T *type2, int flags) +{ + int i; + + if (type1 == NULL || type2 == NULL) + return FALSE; + if (type1->tt_type != type2->tt_type) + return FALSE; + switch (type1->tt_type) + { + case VAR_UNKNOWN: + case VAR_ANY: + case VAR_VOID: + case VAR_SPECIAL: + case VAR_BOOL: + case VAR_NUMBER: + case VAR_FLOAT: + case VAR_STRING: + case VAR_BLOB: + case VAR_JOB: + case VAR_CHANNEL: + case VAR_INSTR: + case VAR_TYPEALIAS: + break; // not composite is always OK + case VAR_OBJECT: + case VAR_CLASS: + // Objects are considered equal if they are from the same class + return type1->tt_class == type2->tt_class; + case VAR_LIST: + case VAR_DICT: + return equal_type(type1->tt_member, type2->tt_member, flags); + case VAR_TUPLE: + if (type1->tt_argcount != type2->tt_argcount) + return FALSE; + if (type1->tt_argcount < 0 + || type1->tt_args == NULL || type2->tt_args == NULL) + return TRUE; + for (i = 0; i < type1->tt_argcount; ++i) + if ((flags & ETYPE_ARG_UNKNOWN) == 0 + && !equal_type(type1->tt_args[i], type2->tt_args[i], + flags)) + return FALSE; + return TRUE; + case VAR_FUNC: + case VAR_PARTIAL: + if (!equal_type(type1->tt_member, type2->tt_member, flags) + || type1->tt_argcount != type2->tt_argcount) + return FALSE; + if (type1->tt_argcount < 0 + || type1->tt_args == NULL || type2->tt_args == NULL) + return TRUE; + for (i = 0; i < type1->tt_argcount; ++i) + if ((flags & ETYPE_ARG_UNKNOWN) == 0 + && !equal_type(type1->tt_args[i], type2->tt_args[i], + flags)) + return FALSE; + return TRUE; + } + return TRUE; +} + +/* + * Find the common type of "type1" (VAR_FUNC) and "type2" (VAR_FUNC) and put it + * in "dest". "type2" and "dest" may be the same. + */ + static void +common_type_var_func( + type_T *type1, + type_T *type2, + type_T **dest, + garray_T *type_gap) +{ + type_T *common; + + // When one of the types is t_func_unknown return the other one. + // Useful if a list or dict item is null_func. + if (type1 == &t_func_unknown) + { + *dest = type2; + return; + } + if (type2 == &t_func_unknown) + { + *dest = type1; + return; + } + + common_type(type1->tt_member, type2->tt_member, &common, type_gap); + if (type1->tt_argcount == type2->tt_argcount + && type1->tt_argcount >= 0) + { + int argcount = type1->tt_argcount; + int i; + + *dest = alloc_func_type(common, argcount, type_gap); + if (type1->tt_args != NULL && type2->tt_args != NULL) + { + if (func_type_add_arg_types(*dest, argcount, + type_gap) == OK) + for (i = 0; i < argcount; ++i) + common_type(type1->tt_args[i], type2->tt_args[i], + &(*dest)->tt_args[i], type_gap); + } + } + else + // Use -1 for "tt_argcount" to indicate an unknown number of + // arguments. + *dest = alloc_func_type(common, -1, type_gap); + + // Use the minimum of min_argcount. + (*dest)->tt_min_argcount = + type1->tt_min_argcount < type2->tt_min_argcount + ? type1->tt_min_argcount : type2->tt_min_argcount; +} + +/* + * Find the common type of "type1" and "type2" and put it in "dest". + * "type2" and "dest" may be the same. + */ + void +common_type(type_T *type1, type_T *type2, type_T **dest, garray_T *type_gap) +{ + if (equal_type(type1, type2, 0)) + { + *dest = type1; + return; + } + + // If either is VAR_UNKNOWN use the other type. An empty list/dict has no + // specific type. + if (type1 == NULL || type1->tt_type == VAR_UNKNOWN) + { + *dest = type2; + return; + } + if (type2 == NULL || type2->tt_type == VAR_UNKNOWN) + { + *dest = type1; + return; + } + + if (type1->tt_type == type2->tt_type) + { + if (type1->tt_type == VAR_LIST + || type1->tt_type == VAR_DICT) + { + type_T *common; + + common_type(type1->tt_member, type2->tt_member, &common, type_gap); + if (type1->tt_type == VAR_LIST) + *dest = get_list_type(common, type_gap); + else + *dest = get_dict_type(common, type_gap); + return; + } + else if (type1->tt_type == VAR_FUNC) + { + common_type_var_func(type1, type2, dest, type_gap); + return; + } + else if (type1->tt_type == VAR_OBJECT) + { + *dest = &t_object_any; + return; + } + } + + *dest = &t_any; +} + +/* + * Return the item type of a List, Dict or a Tuple + */ + type_T * +get_item_type(type_T *type) +{ + if (type->tt_type == VAR_TUPLE) + { + if (type->tt_argcount != 1) + return &t_any; + + if (type->tt_flags & TTFLAG_VARARGS) + return type->tt_args[0]->tt_member; + else + return type->tt_args[0]; + } + + return type->tt_member; +} + +/* + * Push an entry onto the type stack. "type" used both for the current type + * and the declared type. + * Returns FAIL when out of memory. + */ + int +push_type_stack(cctx_T *cctx, type_T *type) +{ + return push_type_stack2(cctx, type, type); +} + +/* + * Push an entry onto the type stack. "type" is the current type, "decl_type" + * is the declared type. + * Returns FAIL when out of memory. + */ + int +push_type_stack2(cctx_T *cctx, type_T *type, type_T *decl_type) +{ + garray_T *stack = &cctx->ctx_type_stack; + type2_T *typep; + + if (GA_GROW_FAILS(stack, 1)) + return FAIL; + typep = ((type2_T *)stack->ga_data) + stack->ga_len; + typep->type_curr = type; + typep->type_decl = decl_type; + ++stack->ga_len; + return OK; +} + +/* + * Set the type of the top of the stack to "type". + */ + void +set_type_on_stack(cctx_T *cctx, type_T *type, int offset) +{ + garray_T *stack = &cctx->ctx_type_stack; + type2_T *typep = ((type2_T *)stack->ga_data) + + stack->ga_len - 1 - offset; + + typep->type_curr = type; + typep->type_decl = &t_any; +} + +/* + * Get the current type from the type stack. If "offset" is zero the one at + * the top, + * if "offset" is one the type above that, etc. + * Returns &t_unknown if there is no such stack entry. + */ + type_T * +get_type_on_stack(cctx_T *cctx, int offset) +{ + garray_T *stack = &cctx->ctx_type_stack; + + if (offset + 1 > stack->ga_len) + return &t_unknown; + return (((type2_T *)stack->ga_data) + stack->ga_len - offset - 1) + ->type_curr; +} + +/* + * Get the declared type from the type stack. If "offset" is zero the one at + * the top, + * if "offset" is one the type above that, etc. + * Returns &t_unknown if there is no such stack entry. + */ + type_T * +get_decl_type_on_stack(cctx_T *cctx, int offset) +{ + garray_T *stack = &cctx->ctx_type_stack; + + if (offset + 1 > stack->ga_len) + return &t_unknown; + return (((type2_T *)stack->ga_data) + stack->ga_len - offset - 1) + ->type_decl; +} + +/* + * Get the member type of a dict or list from the items on the stack of "cctx". + * The declared type is stored in "decl_type". + * For a list "skip" is 1, for a dict "skip" is 2, keys are skipped. + * Returns &t_void for an empty list or dict. + * Otherwise finds the common type of all items. + */ + type_T * +get_member_type_from_stack( + int count, + int skip, + cctx_T *cctx) +{ + garray_T *stack = &cctx->ctx_type_stack; + type2_T *typep; + garray_T *type_gap = cctx->ctx_type_list; + int i; + type_T *result; + type_T *type; + + // Use "unknown" for an empty list or dict. + if (count == 0) + return &t_unknown; + // Find the common type from following items. + typep = ((type2_T *)stack->ga_data) + stack->ga_len; + result = &t_unknown; + for (i = 0; i < count; ++i) + { + type = (typep -((count - i) * skip) + skip - 1)->type_curr; + if (check_type_is_value(type) == FAIL) + return NULL; + if (result != &t_any) + common_type(type, result, &result, type_gap); + } + + return result; +} + +/* + * Get the types of items in a tuple on the stack of "cctx". + * Returns the number of types. Returns -1 on failure. + */ + int +get_tuple_type_from_stack( + int count, + garray_T *tuple_types_gap, + cctx_T *cctx) +{ + garray_T *stack = &cctx->ctx_type_stack; + type2_T *typep; + type_T *type = NULL; + + // Use "unknown" for an empty tuple + if (count == 0) + return 0; + + // Find the common type from following items. + typep = ((type2_T *)stack->ga_data) + stack->ga_len; + for (int i = 0; i < count; i++) + { + type = (typep - (count - i))->type_curr; + if (check_type_is_value(type) == FAIL) + return -1; + if (ga_grow(tuple_types_gap, 1) == FAIL) + return -1; + ((type_T **)tuple_types_gap->ga_data)[tuple_types_gap->ga_len] = type; + tuple_types_gap->ga_len++; + } + + return tuple_types_gap->ga_len; +} + + char * +vartype_name(vartype_T type) +{ + switch (type) + { + case VAR_UNKNOWN: break; + case VAR_ANY: return "any"; + case VAR_VOID: return "void"; + case VAR_SPECIAL: return "special"; + case VAR_BOOL: return "bool"; + case VAR_NUMBER: return "number"; + case VAR_FLOAT: return "float"; + case VAR_STRING: return "string"; + case VAR_BLOB: return "blob"; + case VAR_JOB: return "job"; + case VAR_CHANNEL: return "channel"; + case VAR_LIST: return "list"; + case VAR_TUPLE: return "tuple"; + case VAR_DICT: return "dict"; + case VAR_INSTR: return "instr"; + case VAR_CLASS: return "class"; + case VAR_OBJECT: return "object"; + case VAR_TYPEALIAS: return "typealias"; + + case VAR_FUNC: + case VAR_PARTIAL: return "func"; + } + return "unknown"; +} + +/* + * Return the type name of a List (list) or Dict (dict). + * The result may be in allocated memory, in which case "tofree" is set. + */ + static char * +type_name_list_or_dict(char *name, type_T *type, char **tofree) +{ + char *member_free; + char *member_name; + + if (type->tt_member->tt_type == VAR_UNKNOWN) + member_name = type_name(&t_any, &member_free); + else + member_name = type_name(type->tt_member, &member_free); + + size_t len = STRLEN(name) + STRLEN(member_name) + 3; + *tofree = alloc(len); + if (*tofree == NULL) + { + mnv_free(member_free); + return name; + } + + mnv_snprintf(*tofree, len, "%s<%s>", name, member_name); + mnv_free(member_free); + return *tofree; +} + +/* + * Return the type name of a tuple. + * The result may be in allocated memory, in which case "tofree" is set. + */ + static char * +type_name_tuple(type_T *type, char **tofree) +{ + garray_T ga; + int i; + int varargs = (type->tt_flags & TTFLAG_VARARGS) ? 1 : 0; + char *arg_free = NULL; + + ga_init2(&ga, 1, 100); + if (ga_grow(&ga, 20) == FAIL) + goto failed; + STRCPY(ga.ga_data, "tuple<"); + ga.ga_len += 6; + + if (type->tt_argcount <= 0) + // empty tuple + GA_CONCAT_LITERAL(&ga, "any"); + else + { + if (type->tt_args == NULL) + GA_CONCAT_LITERAL(&ga, "[unknown]"); + else + { + for (i = 0; i < type->tt_argcount; ++i) + { + string_T arg_type; + + arg_type.string = (char_u *)type_name(type->tt_args[i], &arg_free); + if (i > 0) + { + STRCPY((char *)ga.ga_data + ga.ga_len, ", "); + ga.ga_len += 2; + } + arg_type.length = STRLEN(arg_type.string); + if (ga_grow(&ga, (int)arg_type.length + 8) == FAIL) + goto failed; + if (varargs && i == type->tt_argcount - 1) + GA_CONCAT_LITERAL(&ga, "..."); + ga_concat_len(&ga, arg_type.string, arg_type.length); + MNV_CLEAR(arg_free); + } + } + } + + STRCPY((char *)ga.ga_data + ga.ga_len, ">"); + *tofree = ga.ga_data; + return ga.ga_data; + +failed: + mnv_free(arg_free); + ga_clear(&ga); + return "[unknown]"; +} + +/* + * Return the type name of a Class (class) or Object (object). + * The result may be in allocated memory, in which case "tofree" is set. + */ + static char * +type_name_class_or_obj(char *name, type_T *type, char **tofree) +{ + string_T class_name; + + if (type->tt_class != NULL) + { + class_name.string = type->tt_class->class_name.string; + class_name.length = type->tt_class->class_name.length; + if (IS_ENUM(type->tt_class)) + name = "enum"; + } + else + { + class_name.string = (char_u *)"any"; + class_name.length = 3; + } + + size_t len = STRLEN(name) + class_name.length + 3; + *tofree = alloc(len); + if (*tofree == NULL) + return name; + + mnv_snprintf(*tofree, len, "%s<%s>", name, class_name.string); + return *tofree; +} + +/* + * Return the type name of a function. + * The result may be in allocated memory, in which case "tofree" is set. + */ + static char * +type_name_func(type_T *type, char **tofree) +{ + garray_T ga; + int i; + int varargs = (type->tt_flags & TTFLAG_VARARGS) ? 1 : 0; + char *arg_free = NULL; + + ga_init2(&ga, 1, 100); + if (ga_grow(&ga, 20) == FAIL) + goto failed; + STRCPY(ga.ga_data, "func("); + ga.ga_len += 5; + + for (i = 0; i < type->tt_argcount; ++i) + { + string_T arg_type; + + if (type->tt_args == NULL) + { + arg_type.string = (char_u *)"[unknown]"; + arg_type.length = 9; + } + else + { + arg_type.string = (char_u *)type_name(type->tt_args[i], &arg_free); + arg_type.length = STRLEN(arg_type.string); + } + if (i > 0) + { + STRCPY((char *)ga.ga_data + ga.ga_len, ", "); + ga.ga_len += 2; + } + if (ga_grow(&ga, (int)arg_type.length + 8) == FAIL) + goto failed; + if (varargs && i == type->tt_argcount - 1) + GA_CONCAT_LITERAL(&ga, "..."); + else if (i >= type->tt_min_argcount) + *((char *)ga.ga_data + ga.ga_len++) = '?'; + ga_concat_len(&ga, arg_type.string, arg_type.length); + MNV_CLEAR(arg_free); + } + if (type->tt_argcount < 0) + // any number of arguments + GA_CONCAT_LITERAL(&ga, "..."); + + if (type->tt_member == &t_void) + STRCPY((char *)ga.ga_data + ga.ga_len, ")"); + else + { + char *ret_free; + char *ret_name = type_name(type->tt_member, &ret_free); + int len; + + len = (int)STRLEN(ret_name) + 4; + if (ga_grow(&ga, len) == FAIL) + goto failed; + STRCPY((char *)ga.ga_data + ga.ga_len, "): "); + STRCPY((char *)ga.ga_data + ga.ga_len + 3, ret_name); + mnv_free(ret_free); + } + *tofree = ga.ga_data; + return ga.ga_data; + +failed: + mnv_free(arg_free); + ga_clear(&ga); + return "[unknown]"; +} + +/* + * Return the name of a type. + * The result may be in allocated memory, in which case "tofree" is set. + */ + char * +type_name(type_T *type, char **tofree) +{ + char *name; + + *tofree = NULL; + if (type == NULL) + return "[unknown]"; + name = vartype_name(type->tt_type); + + switch (type->tt_type) + { + case VAR_LIST: + case VAR_DICT: + return type_name_list_or_dict(name, type, tofree); + + case VAR_TUPLE: + return type_name_tuple(type, tofree); + + case VAR_CLASS: + case VAR_OBJECT: + return type_name_class_or_obj(name, type, tofree); + + case VAR_FUNC: + return type_name_func(type, tofree); + + default: + break; + } + + return name; +} + +/* + * "typename(expr)" function + */ + void +f_typename(typval_T *argvars, typval_T *rettv) +{ + garray_T type_list; + type_T *type; + char *tofree; + char *name; + + rettv->v_type = VAR_STRING; + ga_init2(&type_list, sizeof(type_T *), 10); + if (argvars[0].v_type == VAR_TYPEALIAS) + { + type = copy_type(argvars[0].vval.v_typealias->ta_type, &type_list); + // A type alias for a class has the type set to VAR_OBJECT. Change it + // to VAR_CLASS, so that the name is "typealias>" + if (type->tt_type == VAR_OBJECT) + type->tt_type = VAR_CLASS; + } + else + type = typval2type(argvars, get_copyID(), &type_list, TVTT_DO_MEMBER); + name = type_name(type, &tofree); + if (argvars[0].v_type == VAR_TYPEALIAS) + { + mnv_snprintf((char *)IObuff, IOSIZE, "typealias<%s>", name); + rettv->vval.v_string = mnv_strsave((char_u *)IObuff); + if (tofree != NULL) + mnv_free(tofree); + } + else + { + if (tofree != NULL) + rettv->vval.v_string = (char_u *)tofree; + else + rettv->vval.v_string = mnv_strsave((char_u *)name); + } + clear_type_list(&type_list); +} + +/* + * Check if the typval_T is a value type; report an error if it is not. + * Note: a type, user defined or typealias, is not a value type. + * + * Return OK if it's a value type, else FAIL + */ + int +check_typval_is_value(typval_T *tv) +{ + if (tv == NULL) + return OK; + + switch (tv->v_type) + { + case VAR_CLASS: + { + class_T *cl = tv->vval.v_class; + char_u *class_name = (cl == NULL) ? (char_u *)"" + : cl->class_name.string; + if (cl != NULL && IS_ENUM(cl)) + semsg(_(e_using_enum_as_value_str), class_name); + else + semsg(_(e_using_class_as_value_str), class_name); + } + return FAIL; + + case VAR_TYPEALIAS: + semsg(_(e_using_typealias_as_value_str), + tv->vval.v_typealias->ta_name); + return FAIL; + + default: + break; + } + return OK; +} + +/* + * Same as above, except check type_T. + */ + int +check_type_is_value(type_T *type) +{ + if (type == NULL) + return OK; + switch (type->tt_type) + { + case VAR_CLASS: + if (type->tt_class != NULL && IS_ENUM(type->tt_class)) + semsg(_(e_using_enum_as_value_str), + type->tt_class->class_name.string); + else + semsg(_(e_using_class_as_value_str), + type->tt_class == NULL ? (char_u *)"" + : type->tt_class->class_name.string); + return FAIL; + + case VAR_TYPEALIAS: + // TODO: Not sure what could be done here to get a name. + // Maybe an optional argument? + emsg(_(e_using_typealias_as_var_val)); + return FAIL; + + default: + break; + } + return OK; +} + +#endif // FEAT_EVAL diff --git a/uvim/src/mnv_alert.ico b/uvim/src/mnv_alert.ico new file mode 100644 index 0000000000..25b610c0fd Binary files /dev/null and b/uvim/src/mnv_alert.ico differ diff --git a/uvim/src/mnv_error.ico b/uvim/src/mnv_error.ico new file mode 100644 index 0000000000..98fed16c8e Binary files /dev/null and b/uvim/src/mnv_error.ico differ diff --git a/uvim/src/mnv_icon.xbm b/uvim/src/mnv_icon.xbm new file mode 100644 index 0000000000..a773778b59 --- /dev/null +++ b/uvim/src/mnv_icon.xbm @@ -0,0 +1,14 @@ +#define mnv_icon_width 32 +#define mnv_icon_height 32 +static unsigned char mnv_icon_bits[] = { + 0x00, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00, 0xfc, 0xff, 0xff, 0x3f, + 0x04, 0x80, 0x03, 0x20, 0x04, 0x80, 0x0f, 0x40, 0x08, 0xc0, 0x1f, 0x60, + 0x10, 0xe0, 0x3f, 0x60, 0x10, 0xe0, 0x1f, 0x30, 0x10, 0xe0, 0x0f, 0x18, + 0x10, 0xe0, 0x07, 0x0e, 0x10, 0xe0, 0x03, 0x07, 0x10, 0xe0, 0x81, 0x0f, + 0x18, 0xe0, 0x80, 0x1f, 0x1c, 0x60, 0xe0, 0x3f, 0x1e, 0x20, 0xf0, 0x7f, + 0x1f, 0x00, 0xf8, 0xff, 0x1f, 0x00, 0xfc, 0xff, 0x1e, 0x00, 0xfc, 0x7f, + 0x1c, 0x00, 0xff, 0x3f, 0x18, 0x80, 0xfc, 0x1f, 0x10, 0x80, 0xfc, 0x0f, + 0x10, 0xc0, 0xff, 0x5f, 0x10, 0x60, 0x44, 0x24, 0x10, 0x50, 0x0c, 0x40, + 0x10, 0x70, 0xce, 0x24, 0x10, 0x7c, 0x6e, 0x26, 0x10, 0x7a, 0x66, 0x26, + 0x10, 0x3d, 0x22, 0x13, 0xa0, 0x32, 0x32, 0x67, 0xd0, 0xe1, 0xdf, 0x1c, + 0x00, 0xc0, 0x43, 0x00, 0x00, 0x80, 0x01, 0x00}; diff --git a/uvim/src/mnv_info.ico b/uvim/src/mnv_info.ico new file mode 100644 index 0000000000..e72023f62c Binary files /dev/null and b/uvim/src/mnv_info.ico differ diff --git a/uvim/src/mnv_mask.xbm b/uvim/src/mnv_mask.xbm new file mode 100644 index 0000000000..efd80f2be9 --- /dev/null +++ b/uvim/src/mnv_mask.xbm @@ -0,0 +1,14 @@ +#define mnv_mask_icon_width 32 +#define mnv_mask_icon_height 32 +static unsigned char mnv_mask_icon_bits[] = { + 0x00, 0x80, 0x01, 0x00, 0x00, 0xc0, 0x03, 0x00, 0xfc, 0xff, 0xff, 0x3f, + 0xfc, 0xff, 0xff, 0x3f, 0xfc, 0xff, 0xff, 0x7f, 0xf8, 0xff, 0xff, 0x7f, + 0xf0, 0xff, 0xff, 0x7f, 0xf0, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0x1f, + 0xf0, 0xff, 0xff, 0x0f, 0xf0, 0xff, 0xff, 0x07, 0xf0, 0xff, 0xff, 0x0f, + 0xf8, 0xff, 0xff, 0x1f, 0xfc, 0xff, 0xff, 0x3f, 0xfe, 0xff, 0xff, 0x7f, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0x7f, + 0xfc, 0xff, 0xff, 0x3f, 0xf8, 0xff, 0xff, 0x1f, 0xf0, 0xff, 0xff, 0x0f, + 0xf0, 0xff, 0xff, 0x5f, 0xf0, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0x7f, + 0xf0, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0x3f, + 0xf0, 0xff, 0xff, 0x3f, 0xf0, 0xff, 0xff, 0x7f, 0xd0, 0xe1, 0xdf, 0x1c, + 0x00, 0xc0, 0x43, 0x00, 0x00, 0x80, 0x01, 0x00}; diff --git a/uvim/src/mnv_quest.ico b/uvim/src/mnv_quest.ico new file mode 100644 index 0000000000..02b01b334e Binary files /dev/null and b/uvim/src/mnv_quest.ico differ diff --git a/uvim/src/mnvinfo.c b/uvim/src/mnvinfo.c new file mode 100644 index 0000000000..410e3c0c01 --- /dev/null +++ b/uvim/src/mnvinfo.c @@ -0,0 +1,3396 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * MNV - MNV is not Vim by Bram Moolenaar + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. + */ + +/* + * mnvinfo.c: mnvinfo related functions + */ + +#include "mnv.h" +#include "version.h" + +/* + * Structure used for reading from the mnvinfo file. + */ +typedef struct +{ + char_u *vir_line; // text of the current line + FILE *vir_fd; // file descriptor + mnvconv_T vir_conv; // encoding conversion + int vir_version; // mnvinfo version detected or -1 + garray_T vir_barlines; // lines starting with | +} vir_T; + +typedef enum { + BVAL_NR, + BVAL_STRING, + BVAL_EMPTY +} btype_T; + +typedef struct { + btype_T bv_type; + long bv_nr; + char_u *bv_string; + char_u *bv_tofree; // free later when not NULL + int bv_len; // length of bv_string + int bv_allocated; // bv_string was allocated +} bval_T; + +#if defined(FEAT_MNVINFO) + +static int mnvinfo_errcnt; + +/* + * Find the parameter represented by the given character (eg ''', ':', '"', or + * '/') in the 'mnvinfo' option and return a pointer to the string after it. + * Return NULL if the parameter is not specified in the string. + */ + static char_u * +find_mnvinfo_parameter(int type) +{ + char_u *p; + + for (p = p_mnvinfo; *p; ++p) + { + if (*p == type) + return p + 1; + if (*p == 'n') // 'n' is always the last one + break; + p = mnv_strchr(p, ','); // skip until next ',' + if (p == NULL) // hit the end without finding parameter + break; + } + return NULL; +} + +/* + * Find the parameter represented by the given character (eg ', :, ", or /), + * and return its associated value in the 'mnvinfo' string. + * Only works for number parameters, not for 'r' or 'n'. + * If the parameter is not specified in the string or there is no following + * number, return -1. + */ + int +get_mnvinfo_parameter(int type) +{ + char_u *p; + + p = find_mnvinfo_parameter(type); + if (p != NULL && MNV_ISDIGIT(*p)) + return atoi((char *)p); + return -1; +} + +/* + * Get the mnvinfo file name to use. + * If "file" is given and not empty, use it (has already been expanded by + * cmdline functions). + * Otherwise use "-i file_name", value from 'mnvinfo' or the default, and + * expand environment variables. + * Returns an allocated string. NULL when out of memory. + */ + static char_u * +mnvinfo_filename(char_u *file) +{ + if (file == NULL || *file == NUL) + { + size_t len; + + if (*p_mnvinfofile != NUL) + file = p_mnvinfofile; + else if ((file = find_mnvinfo_parameter('n')) == NULL || *file == NUL) + { +#ifdef MNVINFO_FILE2 +# ifdef VMS + if (mch_getenv((char_u *)"SYS$LOGIN") == NULL) +# else +# ifdef MSWIN + // Use $MNV only if $HOME is the default "C:/". + if (STRCMP(mnv_getenv((char_u *)"HOME", NULL), "C:/") == 0 + && mch_getenv((char_u *)"HOME") == NULL) +# else + if (mch_getenv((char_u *)"HOME") == NULL) +# endif +# endif + { + // don't use $MNV when not available. + expand_env((char_u *)"$MNV", NameBuff, MAXPATHL); + if (STRCMP("$MNV", NameBuff) != 0) // $MNV was expanded + file = (char_u *)MNVINFO_FILE2; + else + file = (char_u *)MNVINFO_FILE; + } + else +#endif + file = (char_u *)MNVINFO_FILE; + } + len = expand_env(file, NameBuff, MAXPATHL); + file = NameBuff; + + return mnv_strnsave(file, len); + } + + return mnv_strsave(file); +} + +/* + * write string to mnvinfo file + * - replace CTRL-V with CTRL-V CTRL-V + * - replace '\n' with CTRL-V 'n' + * - add a '\n' at the end + * + * For a long line: + * - write " CTRL-V \n " in first line + * - write " < \n " in second line + */ + static void +mnvinfo_writestring(FILE *fd, char_u *p) +{ + int c; + char_u *s; + int len = 0; + + for (s = p; *s != NUL; ++s) + { + if (*s == Ctrl_V || *s == '\n') + ++len; + ++len; + } + + // If the string will be too long, write its length and put it in the next + // line. Take into account that some room is needed for what comes before + // the string (e.g., variable name). Add something to the length for the + // '<', NL and trailing NUL. + if (len > LSIZE / 2) + fprintf(fd, "\026%d\n<", len + 3); + + while ((c = *p++) != NUL) + { + if (c == Ctrl_V || c == '\n') + { + putc(Ctrl_V, fd); + if (c == '\n') + c = 'n'; + } + putc(c, fd); + } + putc('\n', fd); +} + +/* + * Write a string in quotes that barline_parse() can read back. + * Breaks the line in less than LSIZE pieces when needed. + * Returns remaining characters in the line. + */ + static int +barline_writestring(FILE *fd, char_u *s, int remaining_start) +{ + char_u *p; + int remaining = remaining_start; + int len = 2; + + // Count the number of characters produced, including quotes. + for (p = s; *p != NUL; ++p) + { + if (*p == NL) + len += 2; + else if (*p == '"' || *p == '\\') + len += 2; + else + ++len; + } + if (len > remaining - 2) + { + fprintf(fd, ">%d\n|<", len); + remaining = LSIZE - 20; + } + + putc('"', fd); + for (p = s; *p != NUL; ++p) + { + if (*p == NL) + { + putc('\\', fd); + putc('n', fd); + --remaining; + } + else if (*p == '"' || *p == '\\') + { + putc('\\', fd); + putc(*p, fd); + --remaining; + } + else + putc(*p, fd); + --remaining; + + if (remaining < 3) + { + putc('\n', fd); + putc('|', fd); + putc('<', fd); + // Leave enough space for another continuation. + remaining = LSIZE - 20; + } + } + putc('"', fd); + return remaining - 2; +} + +/* + * Check string read from mnvinfo file. + * Remove '\n' at the end of the line. + * - replace CTRL-V CTRL-V with CTRL-V + * - replace CTRL-V 'n' with '\n' + * + * Check for a long line as written by mnvinfo_writestring(). + * + * Return the string in allocated memory (NULL when out of memory). + */ + static char_u * +mnvinfo_readstring( + vir_T *virp, + int off, // offset for virp->vir_line + int convert) // convert the string +{ + char_u *retval = NULL; + char_u *s, *d; + long len; + + if (virp->vir_line[off] == Ctrl_V && mnv_isdigit(virp->vir_line[off + 1])) + { + len = atol((char *)virp->vir_line + off + 1); + if (len > 1 && len < 1000000) + retval = lalloc(len, TRUE); + if (retval == NULL) + { + // Invalid length, line too long, out of memory? Skip next line. + (void)mnv_fgets(virp->vir_line, 10, virp->vir_fd); + return NULL; + } + (void)mnv_fgets(retval, (int)len, virp->vir_fd); + s = retval + 1; // Skip the leading '<' + } + else + { + retval = mnv_strsave(virp->vir_line + off); + if (retval == NULL) + return NULL; + s = retval; + } + + // Change CTRL-V CTRL-V to CTRL-V and CTRL-V n to \n in-place. + d = retval; + while (*s != NUL && *s != '\n') + { + if (s[0] == Ctrl_V && s[1] != NUL) + { + if (s[1] == 'n') + *d++ = '\n'; + else + *d++ = Ctrl_V; + s += 2; + } + else + *d++ = *s++; + } + *d = NUL; + + if (convert && virp->vir_conv.vc_type != CONV_NONE && *retval != NUL) + { + d = string_convert(&virp->vir_conv, retval, NULL); + if (d != NULL) + { + mnv_free(retval); + retval = d; + } + } + + return retval; +} + +/* + * Read a line from the mnvinfo file. + * Returns TRUE for end-of-file; + */ + static int +mnvinfo_readline(vir_T *virp) +{ + return mnv_fgets(virp->vir_line, LSIZE, virp->vir_fd); +} + + static int +read_mnvinfo_bufferlist( + vir_T *virp, + int writing) +{ + char_u *tab; + linenr_T lnum; + colnr_T col; + buf_T *buf; + char_u *sfname; + char_u *xline; + + // Handle long line and escaped characters. + xline = mnvinfo_readstring(virp, 1, FALSE); + + // don't read in if there are files on the command-line or if writing: + if (xline != NULL && !writing && ARGCOUNT == 0 + && find_mnvinfo_parameter('%') != NULL) + { + // Format is: Tab Tab . + // Watch out for a Tab in the file name, work from the end. + lnum = 0; + col = 0; + tab = mnv_strrchr(xline, '\t'); + if (tab != NULL) + { + *tab++ = '\0'; + col = (colnr_T)atoi((char *)tab); + tab = mnv_strrchr(xline, '\t'); + if (tab != NULL) + { + *tab++ = '\0'; + lnum = atol((char *)tab); + } + } + + // Expand "~/" in the file name at "line + 1" to a full path. + // Then try shortening it by comparing with the current directory + expand_env(xline, NameBuff, MAXPATHL); + sfname = shorten_fname1(NameBuff); + + buf = buflist_new(NameBuff, sfname, (linenr_T)0, BLN_LISTED); + if (buf != NULL) // just in case... + { + buf->b_last_cursor.lnum = lnum; + buf->b_last_cursor.col = col; + buflist_setfpos(buf, curwin, lnum, col, FALSE); + } + } + mnv_free(xline); + + return mnvinfo_readline(virp); +} + +/* + * Return TRUE if "name" is on removable media (depending on 'mnvinfo'). + */ + static int +removable(char_u *name) +{ + char_u *p; + char_u part[51]; + int part_len; + int retval = FALSE; + + name = home_replace_save(NULL, name); + if (name == NULL) + return FALSE; + for (p = p_mnvinfo; *p; ) + { + part_len = copy_option_part(&p, part, sizeof(part), ", "); + if (part[0] == 'r') + { + if (MB_STRNICMP(part + 1, name, part_len - 1) == 0) + { + retval = TRUE; + break; + } + } + } + mnv_free(name); + return retval; +} + + static void +write_mnvinfo_bufferlist(FILE *fp) +{ + buf_T *buf; + win_T *win; + tabpage_T *tp; + char_u *line; + int max_buffers; + + if (find_mnvinfo_parameter('%') == NULL) + return; + + // Without a number -1 is returned: do all buffers. + max_buffers = get_mnvinfo_parameter('%'); + + // Allocate room for the file name, lnum and col. +#define LINE_BUF_LEN (MAXPATHL + 40) + line = alloc(LINE_BUF_LEN); + if (line == NULL) + return; + + FOR_ALL_TAB_WINDOWS(tp, win) + set_last_cursor(win); + + fputs(_("\n# Buffer list:\n"), fp); + FOR_ALL_BUFFERS(buf) + { + if (buf->b_fname == NULL + || !buf->b_p_bl + || bt_quickfix(buf) + || bt_terminal(buf) + || removable(buf->b_ffname)) + continue; + + if (max_buffers-- == 0) + break; + putc('%', fp); + home_replace(NULL, buf->b_ffname, line, MAXPATHL, TRUE); + mnv_snprintf_add((char *)line, LINE_BUF_LEN, "\t%ld\t%d", + (long)buf->b_last_cursor.lnum, + buf->b_last_cursor.col); + mnvinfo_writestring(fp, line); + } + mnv_free(line); +} + +/* + * Buffers for history read from a mnvinfo file. Only valid while reading. + */ +static histentry_T *mnvinfo_history[HIST_COUNT] = + {NULL, NULL, NULL, NULL, NULL}; +static int mnvinfo_hisidx[HIST_COUNT] = {0, 0, 0, 0, 0}; +static int mnvinfo_hislen[HIST_COUNT] = {0, 0, 0, 0, 0}; +static int mnvinfo_add_at_front = FALSE; + +/* + * Translate a history type number to the associated character. + */ + static int +hist_type2char( + int type, + int use_question) // use '?' instead of '/' +{ + if (type == HIST_CMD) + return ':'; + if (type == HIST_SEARCH) + { + if (use_question) + return '?'; + else + return '/'; + } + if (type == HIST_EXPR) + return '='; + return '@'; +} + +/* + * Prepare for reading the history from the mnvinfo file. + * This allocates history arrays to store the read history lines. + */ + static void +prepare_mnvinfo_history(int asklen, int writing) +{ + int i; + int num; + int type; + int len; + int hislen; + + init_history(); + hislen = get_hislen(); + mnvinfo_add_at_front = (asklen != 0 && !writing); + if (asklen > hislen) + asklen = hislen; + + for (type = 0; type < HIST_COUNT; ++type) + { + histentry_T *histentry = get_histentry(type); + + // Count the number of empty spaces in the history list. Entries read + // from mnvinfo previously are also considered empty. If there are + // more spaces available than we request, then fill them up. + for (i = 0, num = 0; i < hislen; i++) + if (histentry[i].hisstr == NULL || histentry[i].mnvinfo) + num++; + len = asklen; + if (num > len) + len = num; + if (len <= 0) + mnvinfo_history[type] = NULL; + else + mnvinfo_history[type] = LALLOC_MULT(histentry_T, len); + if (mnvinfo_history[type] == NULL) + len = 0; + mnvinfo_hislen[type] = len; + mnvinfo_hisidx[type] = 0; + } +} + +/* + * Accept a line from the mnvinfo, store it in the history array when it's + * new. + */ + static int +read_mnvinfo_history(vir_T *virp, int writing) +{ + int type; + long_u len; + char_u *val = NULL; + char_u *p; + + type = hist_char2type(virp->vir_line[0]); + if (mnvinfo_hisidx[type] >= mnvinfo_hislen[type]) + goto done; + + val = mnvinfo_readstring(virp, 1, TRUE); + if (val == NULL || *val == NUL) + goto done; + + int sep = (*val == ' ' ? NUL : *val); + + if (in_history(type, val + (type == HIST_SEARCH), mnvinfo_add_at_front, + sep, writing)) + goto done; + + // Need to re-allocate to append the separator byte. + len = STRLEN(val); + if (type == HIST_SEARCH) + { + p = alloc((size_t)len + 1); // +1 for the NUL. val already + // includes the separator. + if (p == NULL) + goto done; + + // Search entry: Move the separator from the first + // column to after the NUL. + mch_memmove(p, val + 1, (size_t)len); + p[len] = sep; + --len; // take into account the shortened string + } + else + { + p = alloc((size_t)len + 2); // +1 for NUL and +1 for separator + if (p == NULL) + goto done; + + // Not a search entry: No separator in the mnvinfo + // file, add a NUL separator. + mch_memmove(p, val, (size_t)len + 1); // +1 to include the NUL + p[len + 1] = NUL; // put the separator *after* the string's NUL + } + mnvinfo_history[type][mnvinfo_hisidx[type]].hisstr = p; + mnvinfo_history[type][mnvinfo_hisidx[type]].hisstrlen = (size_t)len; + mnvinfo_history[type][mnvinfo_hisidx[type]].time_set = 0; + mnvinfo_history[type][mnvinfo_hisidx[type]].mnvinfo = TRUE; + mnvinfo_history[type][mnvinfo_hisidx[type]].hisnum = 0; + mnvinfo_hisidx[type]++; + +done: + mnv_free(val); + return mnvinfo_readline(virp); +} + +/* + * Accept a new style history line from the mnvinfo, store it in the history + * array when it's new. + */ + static void +handle_mnvinfo_history( + garray_T *values, + int writing) +{ + int type; + long_u len; + char_u *val; + char_u *p; + bval_T *vp = (bval_T *)values->ga_data; + + // Check the format: + // |{bartype},{histtype},{timestamp},{separator},"text" + if (values->ga_len < 4 + || vp[0].bv_type != BVAL_NR + || vp[1].bv_type != BVAL_NR + || (vp[2].bv_type != BVAL_NR && vp[2].bv_type != BVAL_EMPTY) + || vp[3].bv_type != BVAL_STRING) + return; + + type = vp[0].bv_nr; + if (type >= HIST_COUNT) + return; + + if (mnvinfo_hisidx[type] >= mnvinfo_hislen[type]) + return; + + val = vp[3].bv_string; + if (val == NULL || *val == NUL) + return; + + int sep = type == HIST_SEARCH && vp[2].bv_type == BVAL_NR + ? vp[2].bv_nr : NUL; + int idx; + int overwrite = FALSE; + + if (in_history(type, val, mnvinfo_add_at_front, sep, writing)) + return; + + // If lines were written by an older MNV we need to avoid + // getting duplicates. See if the entry already exists. + for (idx = 0; idx < mnvinfo_hisidx[type]; ++idx) + { + p = mnvinfo_history[type][idx].hisstr; + len = mnvinfo_history[type][idx].hisstrlen; + if (STRCMP(val, p) == 0 + && (type != HIST_SEARCH || sep == p[len + 1])) + { + overwrite = TRUE; + break; + } + } + + if (!overwrite) + { + // Need to re-allocate to append the separator byte. + len = vp[3].bv_len; + p = alloc(len + 2); + } + else + len = 0; // for picky compilers + if (p != NULL) + { + mnvinfo_history[type][idx].time_set = vp[1].bv_nr; + if (!overwrite) + { + mch_memmove(p, val, (size_t)len + 1); + // Put the separator after the NUL. + p[len + 1] = sep; + mnvinfo_history[type][idx].hisstr = p; + mnvinfo_history[type][idx].hisstrlen = (size_t)len; + mnvinfo_history[type][idx].hisnum = 0; + mnvinfo_history[type][idx].mnvinfo = TRUE; + mnvinfo_hisidx[type]++; + } + } +} + +/* + * Concatenate history lines from mnvinfo after the lines typed in this MNV. + */ + static void +concat_history(int type) +{ + int idx; + int i; + int hislen = get_hislen(); + histentry_T *histentry = get_histentry(type); + int *hisidx = get_hisidx(type); + int *hisnum = get_hisnum(type); + + idx = *hisidx + mnvinfo_hisidx[type]; + if (idx >= hislen) + idx -= hislen; + else if (idx < 0) + idx = hislen - 1; + if (mnvinfo_add_at_front) + *hisidx = idx; + else + { + if (*hisidx == -1) + *hisidx = hislen - 1; + do + { + if (histentry[idx].hisstr != NULL || histentry[idx].mnvinfo) + break; + if (++idx == hislen) + idx = 0; + } while (idx != *hisidx); + if (idx != *hisidx && --idx < 0) + idx = hislen - 1; + } + for (i = 0; i < mnvinfo_hisidx[type]; i++) + { + mnv_free(histentry[idx].hisstr); + histentry[idx].hisstr = mnvinfo_history[type][i].hisstr; + histentry[idx].hisstrlen = mnvinfo_history[type][i].hisstrlen; + histentry[idx].mnvinfo = TRUE; + histentry[idx].time_set = mnvinfo_history[type][i].time_set; + if (--idx < 0) + idx = hislen - 1; + } + idx += 1; + idx %= hislen; + for (i = 0; i < mnvinfo_hisidx[type]; i++) + { + histentry[idx++].hisnum = ++*hisnum; + idx %= hislen; + } +} + + static int +sort_hist(const void *s1, const void *s2) +{ + histentry_T *p1 = *(histentry_T **)s1; + histentry_T *p2 = *(histentry_T **)s2; + + if (p1->time_set < p2->time_set) return -1; + if (p1->time_set > p2->time_set) return 1; + return 0; +} + +/* + * Merge history lines from mnvinfo and lines typed in this MNV based on the + * timestamp; + */ + static void +merge_history(int type) +{ + int max_len; + histentry_T **tot_hist; + histentry_T *new_hist; + int i; + int len; + int hislen = get_hislen(); + histentry_T *histentry = get_histentry(type); + int *hisidx = get_hisidx(type); + int *hisnum = get_hisnum(type); + + // Make one long list with all entries. + max_len = hislen + mnvinfo_hisidx[type]; + tot_hist = ALLOC_MULT(histentry_T *, max_len); + new_hist = ALLOC_MULT(histentry_T, hislen); + if (tot_hist == NULL || new_hist == NULL) + { + mnv_free(tot_hist); + mnv_free(new_hist); + return; + } + for (i = 0; i < mnvinfo_hisidx[type]; i++) + tot_hist[i] = &mnvinfo_history[type][i]; + len = i; + for (i = 0; i < hislen; i++) + if (histentry[i].hisstr != NULL) + tot_hist[len++] = &histentry[i]; + + // Sort the list on timestamp. + qsort((void *)tot_hist, (size_t)len, sizeof(histentry_T *), sort_hist); + + // Keep the newest ones. + for (i = 0; i < hislen; i++) + { + if (i < len) + { + new_hist[i] = *tot_hist[i]; + tot_hist[i]->hisstr = NULL; + tot_hist[i]->hisstrlen = 0; + if (new_hist[i].hisnum == 0) + new_hist[i].hisnum = ++*hisnum; + } + else + clear_hist_entry(&new_hist[i]); + } + *hisidx = (i < len ? i : len) - 1; + + // Free what is not kept. + for (i = 0; i < mnvinfo_hisidx[type]; i++) + { + mnv_free(mnvinfo_history[type][i].hisstr); + mnvinfo_history[type][i].hisstrlen = 0; + } + for (i = 0; i < hislen; i++) + { + mnv_free(histentry[i].hisstr); + histentry[i].hisstrlen = 0; + } + mnv_free(histentry); + set_histentry(type, new_hist); + mnv_free(tot_hist); +} + +/* + * Finish reading history lines from mnvinfo. Not used when writing mnvinfo. + */ + static void +finish_mnvinfo_history(vir_T *virp) +{ + int type; + int merge = virp->vir_version >= MNVINFO_VERSION_WITH_HISTORY; + + for (type = 0; type < HIST_COUNT; ++type) + { + if (get_histentry(type) == NULL) + continue; + + if (merge) + merge_history(type); + else + concat_history(type); + + MNV_CLEAR(mnvinfo_history[type]); + mnvinfo_hisidx[type] = 0; + } +} + +/* + * Write history to mnvinfo file in "fp". + * When "merge" is TRUE merge history lines with a previously read mnvinfo + * file, data is in mnvinfo_history[]. + * When "merge" is FALSE just write all history lines. Used for ":wmnvinfo!". + */ + static void +write_mnvinfo_history(FILE *fp, int merge) +{ + int i; + int type; + int num_saved; + int round; + int hislen; + + init_history(); + hislen = get_hislen(); + if (hislen == 0) + return; + for (type = 0; type < HIST_COUNT; ++type) + { + histentry_T *histentry = get_histentry(type); + int *hisidx = get_hisidx(type); + + num_saved = get_mnvinfo_parameter(hist_type2char(type, FALSE)); + if (num_saved == 0) + continue; + if (num_saved < 0) // Use default + num_saved = hislen; + fprintf(fp, _("\n# %s History (newest to oldest):\n"), + type == HIST_CMD ? _("Command Line") : + type == HIST_SEARCH ? _("Search String") : + type == HIST_EXPR ? _("Expression") : + type == HIST_INPUT ? _("Input Line") : + _("Debug Line")); + if (num_saved > hislen) + num_saved = hislen; + + // Merge typed and mnvinfo history: + // round 1: history of typed commands. + // round 2: history from recently read mnvinfo. + for (round = 1; round <= 2; ++round) + { + if (round == 1) + // start at newest entry, somewhere in the list + i = *hisidx; + else if (mnvinfo_hisidx[type] > 0) + // start at newest entry, first in the list + i = 0; + else + // empty list + i = -1; + if (i >= 0) + while (num_saved > 0 + && !(round == 2 && i >= mnvinfo_hisidx[type])) + { + char_u *p; + size_t plen; + time_t timestamp; + int c = NUL; + + if (round == 1) + { + p = histentry[i].hisstr; + plen = histentry[i].hisstrlen; + timestamp = histentry[i].time_set; + } + else + { + if (mnvinfo_history[type] == NULL) + { + p = NULL; + plen = 0; + timestamp = 0; + } + else + { + p = mnvinfo_history[type][i].hisstr; + plen = mnvinfo_history[type][i].hisstrlen; + timestamp = mnvinfo_history[type][i].time_set; + } + } + + if (p != NULL && (round == 2 + || !merge + || !histentry[i].mnvinfo)) + { + --num_saved; + fputc(hist_type2char(type, TRUE), fp); + // For the search history: put the separator in the + // second column; use a space if there isn't one. + if (type == HIST_SEARCH) + { + c = p[plen + 1]; + putc(c == NUL ? ' ' : c, fp); + } + mnvinfo_writestring(fp, p); + + { + char cbuf[NUMBUFLEN]; + + // New style history with a bar line. Format: + // |{bartype},{histtype},{timestamp},{separator},"text" + if (c == NUL) + cbuf[0] = NUL; + else + sprintf(cbuf, "%d", c); + fprintf(fp, "|%d,%d,%ld,%s,", BARTYPE_HISTORY, + type, (long)timestamp, cbuf); + barline_writestring(fp, p, LSIZE - 20); + putc('\n', fp); + } + } + if (round == 1) + { + // Decrement index, loop around and stop when back at + // the start. + if (--i < 0) + i = hislen - 1; + if (i == *hisidx) + break; + } + else + { + // Increment index. Stop at the end in the while. + ++i; + } + } + } + for (i = 0; i < mnvinfo_hisidx[type]; ++i) + if (mnvinfo_history[type] != NULL) + { + mnv_free(mnvinfo_history[type][i].hisstr); + mnvinfo_history[type][i].hisstrlen = 0; + } + MNV_CLEAR(mnvinfo_history[type]); + mnvinfo_hisidx[type] = 0; + } +} + + static void +write_mnvinfo_barlines(vir_T *virp, FILE *fp_out) +{ + int i; + garray_T *gap = &virp->vir_barlines; + int seen_useful = FALSE; + char *line; + + if (gap->ga_len <= 0) + return; + + fputs(_("\n# Bar lines, copied verbatim:\n"), fp_out); + + // Skip over continuation lines until seeing a useful line. + for (i = 0; i < gap->ga_len; ++i) + { + line = ((char **)(gap->ga_data))[i]; + if (seen_useful || line[1] != '<') + { + fputs(line, fp_out); + seen_useful = TRUE; + } + } +} + +/* + * Parse a mnvinfo line starting with '|'. + * Add each decoded value to "values". + * Returns TRUE if the next line is to be read after using the parsed values. + */ + static int +barline_parse(vir_T *virp, char_u *text, garray_T *values) +{ + char_u *p = text; + char_u *nextp = NULL; + char_u *buf = NULL; + bval_T *value; + int i; + int allocated = FALSE; + int eof; + char_u *sconv; + int converted; + + while (*p == ',') + { + ++p; + if (ga_grow(values, 1) == FAIL) + break; + value = (bval_T *)(values->ga_data) + values->ga_len; + + if (*p == '>') + { + // Need to read a continuation line. Put strings in allocated + // memory, because virp->vir_line is overwritten. + if (!allocated) + { + for (i = 0; i < values->ga_len; ++i) + { + bval_T *vp = (bval_T *)(values->ga_data) + i; + + if (vp->bv_type == BVAL_STRING && !vp->bv_allocated) + { + vp->bv_string = mnv_strnsave(vp->bv_string, vp->bv_len); + vp->bv_allocated = TRUE; + } + } + allocated = TRUE; + } + + if (mnv_isdigit(p[1])) + { + size_t len; + size_t todo; + size_t n; + + // String value was split into lines that are each shorter + // than LSIZE: + // |{bartype},>{length of "{text}{text2}"} + // |<"{text1} + // |<{text2}",{value} + // Length includes the quotes. + ++p; + len = getdigits(&p); + buf = alloc(len + 1); + if (buf == NULL) + return TRUE; + p = buf; + for (todo = len; todo > 0; todo -= n) + { + eof = mnvinfo_readline(virp); + if (eof || virp->vir_line[0] != '|' + || virp->vir_line[1] != '<') + { + // File was truncated or garbled. Read another line if + // this one starts with '|'. + mnv_free(buf); + return eof || virp->vir_line[0] == '|'; + } + // Get length of text, excluding |< and NL chars. + n = STRLEN(virp->vir_line); + while (n > 0 && (virp->vir_line[n - 1] == NL + || virp->vir_line[n - 1] == CAR)) + --n; + n -= 2; + if (n > todo) + { + // more values follow after the string + nextp = virp->vir_line + 2 + todo; + n = todo; + } + mch_memmove(p, virp->vir_line + 2, n); + p += n; + } + *p = NUL; + p = buf; + } + else + { + // Line ending in ">" continues in the next line: + // |{bartype},{lots of values},> + // |<{value},{value} + eof = mnvinfo_readline(virp); + if (eof || virp->vir_line[0] != '|' + || virp->vir_line[1] != '<') + // File was truncated or garbled. Read another line if + // this one starts with '|'. + return eof || virp->vir_line[0] == '|'; + p = virp->vir_line + 2; + } + } + + if (SAFE_isdigit(*p)) + { + value->bv_type = BVAL_NR; + value->bv_nr = getdigits(&p); + ++values->ga_len; + } + else if (*p == '"') + { + int len = 0; + char_u *s = p; + + // Unescape special characters in-place. + ++p; + while (*p != '"') + { + if (*p == NL || *p == NUL) + return TRUE; // syntax error, drop the value + if (*p == '\\') + { + ++p; + if (*p == 'n') + s[len++] = '\n'; + else + s[len++] = *p; + ++p; + } + else + s[len++] = *p++; + } + ++p; + s[len] = NUL; + + converted = FALSE; + value->bv_tofree = NULL; + if (virp->vir_conv.vc_type != CONV_NONE && *s != NUL) + { + sconv = string_convert(&virp->vir_conv, s, NULL); + if (sconv != NULL) + { + if (s == buf) + // the converted string is stored in bv_string and + // freed later, also need to free "buf" later + value->bv_tofree = buf; + s = sconv; + len = (int)STRLEN(s); + converted = TRUE; + } + } + + // Need to copy in allocated memory if the string wasn't allocated + // above and we did allocate before, thus vir_line may change. + if (s != buf && allocated && !converted) + s = mnv_strnsave(s, len); + value->bv_string = s; + value->bv_type = BVAL_STRING; + value->bv_len = len; + value->bv_allocated = allocated || converted; + ++values->ga_len; + if (nextp != NULL) + { + // values following a long string + p = nextp; + nextp = NULL; + } + } + else if (*p == ',') + { + value->bv_type = BVAL_EMPTY; + ++values->ga_len; + } + else + break; + } + return TRUE; +} + + static void +write_mnvinfo_version(FILE *fp_out) +{ + fprintf(fp_out, "# MNVinfo version\n|%d,%d\n\n", + BARTYPE_VERSION, MNVINFO_VERSION); +} + + static int +no_mnvinfo(void) +{ + // "mnv -i NONE" does not read or write a mnvinfo file + return STRCMP(p_mnvinfofile, "NONE") == 0; +} + +/* + * Report an error for reading a mnvinfo file. + * Count the number of errors. When there are more than 10, return TRUE. + */ + static int +mnvinfo_error(char *errnum, char *message, char_u *line) +{ + mnv_snprintf((char *)IObuff, IOSIZE, _("%smnvinfo: %s in line: "), + errnum, message); + STRNCAT(IObuff, line, IOSIZE - STRLEN(IObuff) - 1); + if (IObuff[STRLEN(IObuff) - 1] == '\n') + IObuff[STRLEN(IObuff) - 1] = NUL; + emsg((char *)IObuff); + if (++mnvinfo_errcnt >= 10) + { + emsg(_(e_mnvinfo_too_many_errors_skipping_rest_of_file)); + return TRUE; + } + return FALSE; +} + +/* + * Compare the 'encoding' value in the mnvinfo file with the current value of + * 'encoding'. If different and the 'c' flag is in 'mnvinfo', setup for + * conversion of text with iconv() in mnvinfo_readstring(). + */ + static int +mnvinfo_encoding(vir_T *virp) +{ + char_u *p; + int i; + + if (get_mnvinfo_parameter('c') != 0) + { + p = mnv_strchr(virp->vir_line, '='); + if (p != NULL) + { + // remove trailing newline + ++p; + for (i = 0; mnv_isprintc(p[i]); ++i) + ; + p[i] = NUL; + + convert_setup(&virp->vir_conv, p, p_enc); + } + } + return mnvinfo_readline(virp); +} + +#if defined(FEAT_EVAL) +/* + * Restore global vars that start with a capital from the mnvinfo file + */ + static int +read_mnvinfo_varlist(vir_T *virp, int writing) +{ + char_u *tab; + int type = VAR_NUMBER; + typval_T tv; + funccal_entry_T funccal_entry; + + if (!writing && (find_mnvinfo_parameter('!') != NULL)) + { + tab = mnv_strchr(virp->vir_line + 1, '\t'); + if (tab != NULL) + { + *tab++ = '\0'; // isolate the variable name + switch (*tab) + { + case 'S': type = VAR_STRING; break; + case 'F': type = VAR_FLOAT; break; + case 'D': type = VAR_DICT; break; + case 'L': type = VAR_LIST; break; + case 'B': type = VAR_BLOB; break; + case 'X': type = VAR_SPECIAL; break; + case 'T': type = VAR_TUPLE; break; + } + + tab = mnv_strchr(tab, '\t'); + if (tab != NULL) + { + tv.v_type = type; + if (type == VAR_STRING || type == VAR_DICT + || type == VAR_LIST || type == VAR_BLOB + || type == VAR_TUPLE) + tv.vval.v_string = mnvinfo_readstring(virp, + (int)(tab - virp->vir_line + 1), TRUE); + else if (type == VAR_FLOAT) + (void)string2float(tab + 1, &tv.vval.v_float, FALSE); + else + { + tv.vval.v_number = atol((char *)tab + 1); + if (type == VAR_SPECIAL && (tv.vval.v_number == VVAL_FALSE + || tv.vval.v_number == VVAL_TRUE)) + tv.v_type = VAR_BOOL; + } + if (type == VAR_DICT || type == VAR_LIST || type == VAR_TUPLE) + { + typval_T *etv = eval_expr(tv.vval.v_string, NULL); + + if (etv == NULL) + // Failed to parse back the dict or list, use it as a + // string. + tv.v_type = VAR_STRING; + else + { + mnv_free(tv.vval.v_string); + tv = *etv; + mnv_free(etv); + } + } + else if (type == VAR_BLOB) + { + blob_T *blob = string2blob(tv.vval.v_string); + + if (blob == NULL) + // Failed to parse back the blob, use it as a string. + tv.v_type = VAR_STRING; + else + { + mnv_free(tv.vval.v_string); + tv.v_type = VAR_BLOB; + tv.vval.v_blob = blob; + } + } + + // when in a function use global variables + save_funccal(&funccal_entry); + set_var(virp->vir_line + 1, &tv, FALSE); + restore_funccal(); + + if (tv.v_type == VAR_STRING) + mnv_free(tv.vval.v_string); + else if (tv.v_type == VAR_DICT || tv.v_type == VAR_LIST || + tv.v_type == VAR_BLOB) + clear_tv(&tv); + } + } + } + + return mnvinfo_readline(virp); +} + +/* + * Write global vars that start with a capital to the mnvinfo file + */ + static void +write_mnvinfo_varlist(FILE *fp) +{ + hashtab_T *gvht = get_globvar_ht(); + hashitem_T *hi; + dictitem_T *this_var; + int todo; + char *s = ""; + char_u *p; + char_u *tofree; + char_u numbuf[NUMBUFLEN]; + + if (find_mnvinfo_parameter('!') == NULL) + return; + + fputs(_("\n# global variables:\n"), fp); + + todo = (int)gvht->ht_used; + FOR_ALL_HASHTAB_ITEMS(gvht, hi, todo) + { + if (!HASHITEM_EMPTY(hi)) + { + --todo; + this_var = HI2DI(hi); + if (var_flavour(this_var->di_key) == VAR_FLAVOUR_MNVINFO) + { + switch (this_var->di_tv.v_type) + { + case VAR_STRING: s = "STR"; break; + case VAR_NUMBER: s = "NUM"; break; + case VAR_FLOAT: s = "FLO"; break; + case VAR_DICT: + { + dict_T *di = this_var->di_tv.vval.v_dict; + int copyID = get_copyID(); + + s = "DIC"; + if (di != NULL && !set_ref_in_ht( + &di->dv_hashtab, copyID, NULL, NULL) + && di->dv_copyID == copyID) + // has a circular reference, can't turn the + // value into a string + continue; + break; + } + case VAR_LIST: + { + list_T *l = this_var->di_tv.vval.v_list; + int copyID = get_copyID(); + + s = "LIS"; + if (l != NULL && !set_ref_in_list_items( + l, copyID, NULL, NULL) + && l->lv_copyID == copyID) + // has a circular reference, can't turn the + // value into a string + continue; + break; + } + case VAR_TUPLE: + { + tuple_T *tuple = this_var->di_tv.vval.v_tuple; + int copyID = get_copyID(); + + s = "TUP"; + if (tuple != NULL && !set_ref_in_tuple_items( + tuple, copyID, NULL, NULL) + && tuple->tv_copyID == copyID) + // has a circular reference, can't turn the + // value into a string + continue; + break; + } + case VAR_BLOB: s = "BLO"; break; + case VAR_BOOL: s = "XPL"; break; // backwards compat. + case VAR_SPECIAL: s = "XPL"; break; + + case VAR_UNKNOWN: + case VAR_ANY: + case VAR_VOID: + case VAR_FUNC: + case VAR_PARTIAL: + case VAR_JOB: + case VAR_CHANNEL: + case VAR_INSTR: + case VAR_CLASS: + case VAR_OBJECT: + case VAR_TYPEALIAS: + continue; + } + fprintf(fp, "!%s\t%s\t", this_var->di_key, s); + if (this_var->di_tv.v_type == VAR_BOOL + || this_var->di_tv.v_type == VAR_SPECIAL) + { + // do not use "v:true" but "1" + sprintf((char *)numbuf, "%ld", + (long)this_var->di_tv.vval.v_number); + p = numbuf; + tofree = NULL; + } + else + p = echo_string(&this_var->di_tv, &tofree, numbuf, 0); + if (p != NULL) + mnvinfo_writestring(fp, p); + mnv_free(tofree); + } + } + } +} +#endif // FEAT_EVAL + + static int +read_mnvinfo_sub_string(vir_T *virp, int force) +{ + if (force || get_old_sub() == NULL) + set_old_sub(mnvinfo_readstring(virp, 1, TRUE)); + return mnvinfo_readline(virp); +} + + static void +write_mnvinfo_sub_string(FILE *fp) +{ + char_u *old_sub = get_old_sub(); + + if (get_mnvinfo_parameter('/') == 0 || old_sub == NULL) + return; + + fputs(_("\n# Last Substitute String:\n$"), fp); + mnvinfo_writestring(fp, old_sub); +} + +/* + * Functions relating to reading/writing the search pattern from mnvinfo + */ + + static int +read_mnvinfo_search_pattern(vir_T *virp, int force) +{ + char_u *lp; + int idx = -1; + int magic = FALSE; + int no_scs = FALSE; + int off_line = FALSE; + int off_end = 0; + long off = 0; + int setlast = FALSE; +#ifdef FEAT_SEARCH_EXTRA + static int hlsearch_on = FALSE; +#endif + char_u *val; + spat_T *spat; + + // Old line types: + // "/pat", "&pat": search/subst. pat + // "~/pat", "~&pat": last used search/subst. pat + // New line types: + // "~h", "~H": hlsearch highlighting off/on + // "~pat" + // : 'm' off, 'M' on + // : 's' off, 'S' on + // : 'L' line offset, 'l' char offset + // : 'E' from end, 'e' from start + // : decimal, offset + // : '~' last used pattern + // : '/' search pat, '&' subst. pat + lp = virp->vir_line; + if (lp[0] == '~' && (lp[1] == 'm' || lp[1] == 'M')) // new line type + { + if (lp[1] == 'M') // magic on + magic = TRUE; + if (lp[2] == 's') + no_scs = TRUE; + if (lp[3] == 'L') + off_line = TRUE; + if (lp[4] == 'E') + off_end = SEARCH_END; + lp += 5; + off = getdigits(&lp); + } + if (lp[0] == '~') // use this pattern for last-used pattern + { + setlast = TRUE; + lp++; + } + if (lp[0] == '/') + idx = RE_SEARCH; + else if (lp[0] == '&') + idx = RE_SUBST; +#ifdef FEAT_SEARCH_EXTRA + else if (lp[0] == 'h') // ~h: 'hlsearch' highlighting off + hlsearch_on = FALSE; + else if (lp[0] == 'H') // ~H: 'hlsearch' highlighting on + hlsearch_on = TRUE; +#endif + if (idx >= 0) + { + spat = get_spat(idx); + if (force || spat->pat == NULL) + { + val = mnvinfo_readstring(virp, (int)(lp - virp->vir_line + 1), + TRUE); + if (val != NULL) + { + set_last_search_pat(val, idx, magic, setlast); + mnv_free(val); + spat->no_scs = no_scs; + spat->off.line = off_line; + spat->off.end = off_end; + spat->off.off = off; +#ifdef FEAT_SEARCH_EXTRA + if (setlast) + set_no_hlsearch(!hlsearch_on); +#endif + } + } + } + return mnvinfo_readline(virp); +} + + static void +wvsp_one( + FILE *fp, // file to write to + int idx, // spats[] index + char *s, // search pat + int sc) // dir char +{ + spat_T *spat = get_spat(idx); + if (spat->pat == NULL) + return; + + fprintf(fp, _("\n# Last %sSearch Pattern:\n~"), s); + // off.dir is not stored, it's reset to forward + fprintf(fp, "%c%c%c%c%ld%s%c", + spat->magic ? 'M' : 'm', // magic + spat->no_scs ? 's' : 'S', // smartcase + spat->off.line ? 'L' : 'l', // line offset + spat->off.end ? 'E' : 'e', // offset from end + spat->off.off, // offset + get_spat_last_idx() == idx ? "~" : "", // last used pat + sc); + mnvinfo_writestring(fp, spat->pat); +} + + static void +write_mnvinfo_search_pattern(FILE *fp) +{ + if (get_mnvinfo_parameter('/') == 0) + return; + +#ifdef FEAT_SEARCH_EXTRA + fprintf(fp, "\n# hlsearch on (H) or off (h):\n~%c", + (no_hlsearch || find_mnvinfo_parameter('h') != NULL) ? 'h' : 'H'); +#endif + wvsp_one(fp, RE_SEARCH, "", '/'); + wvsp_one(fp, RE_SUBST, _("Substitute "), '&'); +} + +/* + * Functions relating to reading/writing registers from mnvinfo + */ + +static yankreg_T *y_read_regs = NULL; + +#define REG_PREVIOUS 1 +#define REG_EXEC 2 + +/* + * Prepare for reading mnvinfo registers when writing mnvinfo later. + */ + static void +prepare_mnvinfo_registers(void) +{ + y_read_regs = ALLOC_CLEAR_MULT(yankreg_T, NUM_REGISTERS); +} + + static void +finish_mnvinfo_registers(void) +{ + int i; + int j; + + if (y_read_regs == NULL) + return; + + for (i = 0; i < NUM_REGISTERS; ++i) + if (y_read_regs[i].y_array != NULL) + { + for (j = 0; j < y_read_regs[i].y_size; j++) + mnv_free(y_read_regs[i].y_array[j].string); + mnv_free(y_read_regs[i].y_array); + } + MNV_CLEAR(y_read_regs); +} + + static int +read_mnvinfo_register(vir_T *virp, int force) +{ + int eof; + int do_it = TRUE; + int size; + int limit; + int i; + int set_prev = FALSE; + char_u *str; + string_T *array = NULL; + int new_type = MCHAR; // init to shut up compiler + colnr_T new_width = 0; // init to shut up compiler + yankreg_T *y_current_p; + + // We only get here (hopefully) if line[0] == '"' + str = virp->vir_line + 1; + + // If the line starts with "" this is the y_previous register. + if (*str == '"') + { + set_prev = TRUE; + str++; + } + + if (!ASCII_ISALNUM(*str) && *str != '-') + { + if (mnvinfo_error("E577: ", _(e_illegal_register_name), virp->vir_line)) + return TRUE; // too many errors, pretend end-of-file + do_it = FALSE; + } + get_yank_register(*str++, FALSE); + y_current_p = get_y_current(); + if (!force && y_current_p->y_array != NULL) + do_it = FALSE; + + if (*str == '@') + { + // "x@: register x used for @@ + if (force || get_execreg_lastc() == NUL) + set_execreg_lastc(str[-1]); + } + + size = 0; + limit = 100; // Optimized for registers containing <= 100 lines + if (do_it) + { + // Build the new register in array[]. + // y_array is kept as-is until done. + // The "do_it" flag is reset when something is wrong, in which case + // array[] needs to be freed. + if (set_prev) + set_y_previous(y_current_p); + array = ALLOC_MULT(string_T, limit); + str = skipwhite(skiptowhite(str)); + if (STRNCMP(str, "CHAR", 4) == 0) + new_type = MCHAR; + else if (STRNCMP(str, "BLOCK", 5) == 0) + new_type = MBLOCK; + else + new_type = MLINE; + // get the block width; if it's missing we get a zero, which is OK + str = skipwhite(skiptowhite(str)); + new_width = getdigits(&str); + } + + while (!(eof = mnvinfo_readline(virp)) + && (virp->vir_line[0] == TAB || virp->vir_line[0] == '<')) + { + if (do_it) + { + if (size == limit) + { + string_T *new_array = (string_T *) + alloc(limit * 2 * sizeof(string_T)); + + if (new_array == NULL) + { + do_it = FALSE; + break; + } + for (i = 0; i < limit; i++) + new_array[i] = array[i]; + mnv_free(array); + array = new_array; + limit *= 2; + } + str = mnvinfo_readstring(virp, 1, TRUE); + if (str != NULL) + { + array[size].string = str; + array[size].length = STRLEN(str); + ++size; + } + else + // error, don't store the result + do_it = FALSE; + } + } + + if (do_it) + { + // free y_array[] + for (i = 0; i < y_current_p->y_size; i++) + mnv_free(y_current_p->y_array[i].string); + mnv_free(y_current_p->y_array); + + y_current_p->y_type = new_type; + y_current_p->y_width = new_width; + y_current_p->y_size = size; + y_current_p->y_time_set = 0; + if (size == 0) + { + y_current_p->y_array = NULL; + } + else + { + // Move the lines from array[] to y_array[]. + y_current_p->y_array = ALLOC_MULT(string_T, size); + for (i = 0; i < size; i++) + { + if (y_current_p->y_array == NULL) + { + MNV_CLEAR_STRING(array[i]); + } + else + { + y_current_p->y_array[i].string = array[i].string; + y_current_p->y_array[i].length = array[i].length; + } + } + } + } + else + { + // Free array[] if it was filled. + for (i = 0; i < size; i++) + mnv_free(array[i].string); + } + mnv_free(array); + + return eof; +} + +/* + * Accept a new style register line from the mnvinfo, store it when it's new. + */ + static void +handle_mnvinfo_register(garray_T *values, int force) +{ + bval_T *vp = (bval_T *)values->ga_data; + int flags; + int name; + int type; + int linecount; + int width; + time_t timestamp; + yankreg_T *y_ptr; + yankreg_T *y_regs_p = get_y_regs(); + int i; + + // Check the format: + // |{bartype},{flags},{name},{type}, + // {linecount},{width},{timestamp},"line1","line2" + if (values->ga_len < 6 + || vp[0].bv_type != BVAL_NR + || vp[1].bv_type != BVAL_NR + || vp[2].bv_type != BVAL_NR + || vp[3].bv_type != BVAL_NR + || vp[4].bv_type != BVAL_NR + || vp[5].bv_type != BVAL_NR) + return; + flags = vp[0].bv_nr; + name = vp[1].bv_nr; + if (name < 0 || name >= NUM_REGISTERS) + return; + type = vp[2].bv_nr; + if (type != MCHAR && type != MLINE && type != MBLOCK) + return; + linecount = vp[3].bv_nr; + if (values->ga_len < 6 + linecount) + return; + width = vp[4].bv_nr; + if (width < 0) + return; + + if (y_read_regs != NULL) + // Reading mnvinfo for merging and writing. Store the register + // content, don't update the current registers. + y_ptr = &y_read_regs[name]; + else + y_ptr = &y_regs_p[name]; + + // Do not overwrite unless forced or the timestamp is newer. + timestamp = (time_t)vp[5].bv_nr; + if (y_ptr->y_array != NULL && !force + && (timestamp == 0 || y_ptr->y_time_set > timestamp)) + return; + + if (y_ptr->y_array != NULL) + for (i = 0; i < y_ptr->y_size; i++) + mnv_free(y_ptr->y_array[i].string); + mnv_free(y_ptr->y_array); + + if (y_read_regs == NULL) + { + if (flags & REG_PREVIOUS) + set_y_previous(y_ptr); + if ((flags & REG_EXEC) && (force || get_execreg_lastc() == NUL)) + set_execreg_lastc(get_register_name(name)); + } + y_ptr->y_type = type; + y_ptr->y_width = width; + y_ptr->y_size = linecount; + y_ptr->y_time_set = timestamp; + if (linecount == 0) + { + y_ptr->y_array = NULL; + return; + } + y_ptr->y_array = ALLOC_MULT(string_T, linecount); + if (y_ptr->y_array == NULL) + { + y_ptr->y_size = 0; // ensure object state is consistent + return; + } + for (i = 0; i < linecount; i++) + { + if (vp[i + 6].bv_allocated) + { + y_ptr->y_array[i].string = vp[i + 6].bv_string; + y_ptr->y_array[i].length = vp[i + 6].bv_len; + vp[i + 6].bv_string = NULL; + } + else if (vp[i + 6].bv_type != BVAL_STRING) + { + free(y_ptr->y_array); + y_ptr->y_array = NULL; + } + else + { + y_ptr->y_array[i].string = mnv_strnsave(vp[i + 6].bv_string, vp[i + 6].bv_len); + y_ptr->y_array[i].length = vp[i + 6].bv_len; + } + } +} + + static void +write_mnvinfo_registers(FILE *fp) +{ + int i, j; + char_u *type; + char_u c; + int num_lines; + int max_num_lines; + int max_kbyte; + long len; + yankreg_T *y_ptr; + yankreg_T *y_regs_p = get_y_regs(); + + fputs(_("\n# Registers:\n"), fp); + + // Get '<' value, use old '"' value if '<' is not found. + max_num_lines = get_mnvinfo_parameter('<'); + if (max_num_lines < 0) + max_num_lines = get_mnvinfo_parameter('"'); + if (max_num_lines == 0) + return; + max_kbyte = get_mnvinfo_parameter('s'); + if (max_kbyte == 0) + return; + + for (i = 0; i < NUM_REGISTERS; i++) + { +#if defined(FEAT_CLIPBOARD) || defined(FEAT_CLIPBOARD_PROVIDER) + // Skip '*'/'+' register, we don't want them back next time + if (i == STAR_REGISTER || i == PLUS_REGISTER || i == REAL_PLUS_REGISTER) + continue; +#endif +#ifdef FEAT_DND + // Neither do we want the '~' register + if (i == TILDE_REGISTER) + continue; +#endif + // When reading mnvinfo for merging and writing: Use the register from + // mnvinfo if it's newer. + if (y_read_regs != NULL + && y_read_regs[i].y_array != NULL + && (y_regs_p[i].y_array == NULL || + y_read_regs[i].y_time_set > y_regs_p[i].y_time_set)) + y_ptr = &y_read_regs[i]; + else if (y_regs_p[i].y_array == NULL) + continue; + else + y_ptr = &y_regs_p[i]; + + // Skip empty registers. + num_lines = y_ptr->y_size; + if (num_lines == 0 + || (num_lines == 1 && y_ptr->y_type == MCHAR + && *y_ptr->y_array[0].string == NUL)) + continue; + + if (max_kbyte > 0) + { + // Skip register if there is more text than the maximum size. + len = 0; + for (j = 0; j < num_lines; j++) + len += (long)y_ptr->y_array[j].length + 1L; + if (len > (long)max_kbyte * 1024L) + continue; + } + + switch (y_ptr->y_type) + { + case MLINE: + type = (char_u *)"LINE"; + break; + case MCHAR: + type = (char_u *)"CHAR"; + break; + case MBLOCK: + type = (char_u *)"BLOCK"; + break; + default: + semsg(_(e_unknown_register_type_nr), y_ptr->y_type); + type = (char_u *)"LINE"; + break; + } + if (get_y_previous() == &y_regs_p[i]) + fprintf(fp, "\""); + c = get_register_name(i); + fprintf(fp, "\"%c", c); + if (c == get_execreg_lastc()) + fprintf(fp, "@"); + fprintf(fp, "\t%s\t%d\n", type, (int)y_ptr->y_width); + + // If max_num_lines < 0, then we save ALL the lines in the register + if (max_num_lines > 0 && num_lines > max_num_lines) + num_lines = max_num_lines; + for (j = 0; j < num_lines; j++) + { + putc('\t', fp); + mnvinfo_writestring(fp, y_ptr->y_array[j].string); + } + + { + int flags = 0; + int remaining; + + // New style with a bar line. Format: + // |{bartype},{flags},{name},{type}, + // {linecount},{width},{timestamp},"line1","line2" + // flags: REG_PREVIOUS - register is y_previous + // REG_EXEC - used for @@ + if (get_y_previous() == &y_regs_p[i]) + flags |= REG_PREVIOUS; + if (c == get_execreg_lastc()) + flags |= REG_EXEC; + fprintf(fp, "|%d,%d,%d,%d,%d,%d,%ld", BARTYPE_REGISTER, flags, + i, y_ptr->y_type, num_lines, (int)y_ptr->y_width, + (long)y_ptr->y_time_set); + // 11 chars for type/flags/name/type, 3 * 20 for numbers + remaining = LSIZE - 71; + for (j = 0; j < num_lines; j++) + { + putc(',', fp); + --remaining; + remaining = barline_writestring(fp, y_ptr->y_array[j].string, + remaining); + } + putc('\n', fp); + } + } +} + +/* + * Functions relating to reading/writing marks from mnvinfo + */ + +static xfmark_T *vi_namedfm = NULL; +static xfmark_T *vi_jumplist = NULL; +static int vi_jumplist_len = 0; + + static void +write_one_mark(FILE *fp_out, int c, pos_T *pos) +{ + if (pos->lnum != 0) + fprintf(fp_out, "\t%c\t%ld\t%d\n", c, (long)pos->lnum, (int)pos->col); +} + + static void +write_buffer_marks(buf_T *buf, FILE *fp_out) +{ + int i; + pos_T pos; + + home_replace(NULL, buf->b_ffname, IObuff, IOSIZE, TRUE); + fprintf(fp_out, "\n> "); + mnvinfo_writestring(fp_out, IObuff); + + // Write the last used timestamp as the lnum of the non-existing mark '*'. + // Older MNVs will ignore it and/or copy it. + pos.lnum = (linenr_T)buf->b_last_used; + pos.col = 0; + write_one_mark(fp_out, '*', &pos); + + write_one_mark(fp_out, '"', &buf->b_last_cursor); + write_one_mark(fp_out, '^', &buf->b_last_insert); + write_one_mark(fp_out, '.', &buf->b_last_change); + // changelist positions are stored oldest first + for (i = 0; i < buf->b_changelistlen; ++i) + { + // skip duplicates + if (i == 0 || !EQUAL_POS(buf->b_changelist[i - 1], + buf->b_changelist[i])) + write_one_mark(fp_out, '+', &buf->b_changelist[i]); + } + for (i = 0; i < NMARKS; i++) + write_one_mark(fp_out, 'a' + i, &buf->b_namedm[i]); +} + +/* + * Return TRUE if marks for "buf" should not be written. + */ + static int +skip_for_mnvinfo(buf_T *buf) +{ + return bt_terminal(buf) || removable(buf->b_ffname); +} + +/* + * Write all the named marks for all buffers. + * When "buflist" is not NULL fill it with the buffers for which marks are to + * be written. + */ + static void +write_mnvinfo_marks(FILE *fp_out, garray_T *buflist) +{ + buf_T *buf; + int is_mark_set; + int i; + win_T *win; + tabpage_T *tp; + + // Set b_last_cursor for the all buffers that have a window. + FOR_ALL_TAB_WINDOWS(tp, win) + set_last_cursor(win); + + fputs(_("\n# History of marks within files (newest to oldest):\n"), fp_out); + FOR_ALL_BUFFERS(buf) + { + // Only write something if buffer has been loaded and at least one + // mark is set. + if (buf->b_marks_read) + { + if (buf->b_last_cursor.lnum != 0) + is_mark_set = TRUE; + else + { + is_mark_set = FALSE; + for (i = 0; i < NMARKS; i++) + if (buf->b_namedm[i].lnum != 0) + { + is_mark_set = TRUE; + break; + } + } + if (is_mark_set && buf->b_ffname != NULL + && buf->b_ffname[0] != NUL + && !skip_for_mnvinfo(buf)) + { + if (buflist == NULL) + write_buffer_marks(buf, fp_out); + else if (ga_grow(buflist, 1) == OK) + ((buf_T **)buflist->ga_data)[buflist->ga_len++] = buf; + } + } + } +} + + static void +write_one_filemark( + FILE *fp, + xfmark_T *fm, + int c1, + int c2) +{ + char_u *name; + + if (fm->fmark.mark.lnum == 0) // not set + return; + + if (fm->fmark.fnum != 0) // there is a buffer + name = buflist_nr2name(fm->fmark.fnum, TRUE, FALSE); + else + name = fm->fname; // use name from .mnvinfo + if (name != NULL && *name != NUL) + { + fprintf(fp, "%c%c %ld %ld ", c1, c2, (long)fm->fmark.mark.lnum, + (long)fm->fmark.mark.col); + mnvinfo_writestring(fp, name); + + // Barline: |{bartype},{name},{lnum},{col},{timestamp},{filename} + // size up to filename: 8 + 3 * 20 + fprintf(fp, "|%d,%d,%ld,%ld,%ld,", BARTYPE_MARK, c2, + (long)fm->fmark.mark.lnum, (long)fm->fmark.mark.col, + (long)fm->time_set); + barline_writestring(fp, name, LSIZE - 70); + putc('\n', fp); + } + + if (fm->fmark.fnum != 0) + mnv_free(name); +} + + static void +write_mnvinfo_filemarks(FILE *fp) +{ + int i; + char_u *name; + buf_T *buf; + xfmark_T *namedfm_p = get_namedfm(); + xfmark_T *fm; + int vi_idx; + int idx; + + if (get_mnvinfo_parameter('f') == 0) + return; + + fputs(_("\n# File marks:\n"), fp); + + // Write the filemarks 'A - 'Z + for (i = 0; i < NMARKS; i++) + { + if (vi_namedfm != NULL + && (vi_namedfm[i].time_set > namedfm_p[i].time_set)) + fm = &vi_namedfm[i]; + else + fm = &namedfm_p[i]; + write_one_filemark(fp, fm, '\'', i + 'A'); + } + + // Find a mark that is the same file and position as the cursor. + // That one, or else the last one is deleted. + // Move '0 to '1, '1 to '2, etc. until the matching one or '9 + // Set the '0 mark to current cursor position. + if (curbuf->b_ffname != NULL && !skip_for_mnvinfo(curbuf)) + { + name = buflist_nr2name(curbuf->b_fnum, TRUE, FALSE); + for (i = NMARKS; i < NMARKS + EXTRA_MARKS - 1; ++i) + if (namedfm_p[i].fmark.mark.lnum == curwin->w_cursor.lnum + && (namedfm_p[i].fname == NULL + ? namedfm_p[i].fmark.fnum == curbuf->b_fnum + : (name != NULL + && STRCMP(name, namedfm_p[i].fname) == 0))) + break; + mnv_free(name); + + mnv_free(namedfm_p[i].fname); + for ( ; i > NMARKS; --i) + namedfm_p[i] = namedfm_p[i - 1]; + namedfm_p[NMARKS].fmark.mark = curwin->w_cursor; + namedfm_p[NMARKS].fmark.fnum = curbuf->b_fnum; + namedfm_p[NMARKS].fname = NULL; + namedfm_p[NMARKS].time_set = mnv_time(); + } + + // Write the filemarks '0 - '9. Newest (highest timestamp) first. + vi_idx = NMARKS; + idx = NMARKS; + for (i = NMARKS; i < NMARKS + EXTRA_MARKS; i++) + { + xfmark_T *vi_fm = vi_namedfm != NULL ? &vi_namedfm[vi_idx] : NULL; + + if (vi_fm != NULL + && vi_fm->fmark.mark.lnum != 0 + && (vi_fm->time_set > namedfm_p[idx].time_set + || namedfm_p[idx].fmark.mark.lnum == 0)) + { + fm = vi_fm; + ++vi_idx; + } + else + { + fm = &namedfm_p[idx++]; + if (vi_fm != NULL + && vi_fm->fmark.mark.lnum == fm->fmark.mark.lnum + && vi_fm->time_set == fm->time_set + && ((vi_fm->fmark.fnum != 0 + && vi_fm->fmark.fnum == fm->fmark.fnum) + || (vi_fm->fname != NULL + && fm->fname != NULL + && STRCMP(vi_fm->fname, fm->fname) == 0))) + ++vi_idx; // skip duplicate + } + write_one_filemark(fp, fm, '\'', i - NMARKS + '0'); + } + + // Write the jumplist with -' + fputs(_("\n# Jumplist (newest first):\n"), fp); + setpcmark(); // add current cursor position + cleanup_jumplist(curwin, FALSE); + vi_idx = 0; + idx = curwin->w_jumplistlen - 1; + for (i = 0; i < JUMPLISTSIZE; ++i) + { + xfmark_T *vi_fm; + + fm = idx >= 0 ? &curwin->w_jumplist[idx] : NULL; + vi_fm = (vi_jumplist != NULL && vi_idx < vi_jumplist_len) + ? &vi_jumplist[vi_idx] : NULL; + if (fm == NULL && vi_fm == NULL) + break; + if (fm == NULL || (vi_fm != NULL && fm->time_set < vi_fm->time_set)) + { + fm = vi_fm; + ++vi_idx; + } + else + --idx; + if (fm->fmark.fnum == 0 + || ((buf = buflist_findnr(fm->fmark.fnum)) != NULL + && !skip_for_mnvinfo(buf))) + write_one_filemark(fp, fm, '-', '\''); + } +} + +/* + * Compare functions for qsort() below, that compares b_last_used. + */ + int +buf_compare(const void *s1, const void *s2) +{ + buf_T *buf1 = *(buf_T **)s1; + buf_T *buf2 = *(buf_T **)s2; + + if (buf1->b_last_used == buf2->b_last_used) + return 0; + return buf1->b_last_used > buf2->b_last_used ? -1 : 1; +} + +/* + * Handle marks in the mnvinfo file: + * fp_out != NULL: copy marks, in time order with buffers in "buflist". + * fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf + * fp_out == NULL && (flags & VIF_ONLY_CURBUF): bail out after curbuf marks + * fp_out == NULL && (flags & VIF_GET_OLDFILES | VIF_FORCEIT): fill v:oldfiles + */ + static void +copy_mnvinfo_marks( + vir_T *virp, + FILE *fp_out, + garray_T *buflist, + int eof, + int flags) +{ + char_u *line = virp->vir_line; + buf_T *buf; + int num_marked_files; + int load_marks; + int copy_marks_out; + char_u *str; + int i; + char_u *p; + char_u *name_buf; + pos_T pos; +#ifdef FEAT_EVAL + list_T *list = NULL; +#endif + int count = 0; + int buflist_used = 0; + buf_T *buflist_buf = NULL; + + if ((name_buf = alloc(LSIZE)) == NULL) + return; + *name_buf = NUL; + + if (fp_out != NULL && buflist->ga_len > 0) + { + // Sort the list of buffers on b_last_used. + qsort(buflist->ga_data, (size_t)buflist->ga_len, + sizeof(buf_T *), buf_compare); + buflist_buf = ((buf_T **)buflist->ga_data)[0]; + } + +#ifdef FEAT_EVAL + if (fp_out == NULL && (flags & (VIF_GET_OLDFILES | VIF_FORCEIT))) + { + list = list_alloc(); + if (list != NULL) + set_mnv_var_list(VV_OLDFILES, list); + } +#endif + + num_marked_files = get_mnvinfo_parameter('\''); + while (!eof && (count < num_marked_files || fp_out == NULL)) + { + if (line[0] != '>') + { + if (line[0] != '\n' && line[0] != '\r' && line[0] != '#') + { + if (mnvinfo_error("E576: ", _(e_nonr_missing_gt), line)) + break; // too many errors, return now + } + eof = mnv_fgets(line, LSIZE, virp->vir_fd); + continue; // Skip this dud line + } + + // Handle long line and translate escaped characters. + // Find file name, set str to start. + // Ignore leading and trailing white space. + str = skipwhite(line + 1); + str = mnvinfo_readstring(virp, (int)(str - virp->vir_line), FALSE); + if (str == NULL) + continue; + p = str + STRLEN(str); + while (p != str && (*p == NUL || mnv_isspace(*p))) + p--; + if (*p) + p++; + *p = NUL; + +#ifdef FEAT_EVAL + if (list != NULL) + list_append_string(list, str, -1); +#endif + + // If fp_out == NULL, load marks for current buffer. + // If fp_out != NULL, copy marks for buffers not in buflist. + load_marks = copy_marks_out = FALSE; + if (fp_out == NULL) + { + if ((flags & VIF_WANT_MARKS) && curbuf->b_ffname != NULL) + { + if (*name_buf == NUL) // only need to do this once + home_replace(NULL, curbuf->b_ffname, name_buf, LSIZE, TRUE); + if (fnamecmp(str, name_buf) == 0) + load_marks = TRUE; + } + } + else // fp_out != NULL + { + // This is slow if there are many buffers!! + FOR_ALL_BUFFERS(buf) + if (buf->b_ffname != NULL) + { + home_replace(NULL, buf->b_ffname, name_buf, LSIZE, TRUE); + if (fnamecmp(str, name_buf) == 0) + break; + } + + // Copy marks if the buffer has not been loaded. + if (buf == NULL || !buf->b_marks_read) + { + int did_read_line = FALSE; + + if (buflist_buf != NULL) + { + // Read the next line. If it has the "*" mark compare the + // time stamps. Write entries from "buflist" that are + // newer. + if (!mnvinfo_readline(virp) && line[0] == TAB) + { + did_read_line = TRUE; + if (line[1] == '*') + { + long ltime; + + sscanf((char *)line + 2, "%ld ", <ime); + while ((time_T)ltime < buflist_buf->b_last_used) + { + write_buffer_marks(buflist_buf, fp_out); + if (++count >= num_marked_files) + break; + if (++buflist_used == buflist->ga_len) + { + buflist_buf = NULL; + break; + } + buflist_buf = + ((buf_T **)buflist->ga_data)[buflist_used]; + } + } + else + { + // No timestamp, must be written by an older MNV. + // Assume all remaining buffers are older than + // ours. + while (count < num_marked_files + && buflist_used < buflist->ga_len) + { + buflist_buf = ((buf_T **)buflist->ga_data) + [buflist_used++]; + write_buffer_marks(buflist_buf, fp_out); + ++count; + } + buflist_buf = NULL; + } + + if (count >= num_marked_files) + { + mnv_free(str); + break; + } + } + } + + fputs("\n> ", fp_out); + mnvinfo_writestring(fp_out, str); + if (did_read_line) + fputs((char *)line, fp_out); + + count++; + copy_marks_out = TRUE; + } + } + mnv_free(str); + + pos.coladd = 0; + while (!(eof = mnvinfo_readline(virp)) && line[0] == TAB) + { + if (load_marks) + { + if (line[1] != NUL) + { + unsigned u; + + sscanf((char *)line + 2, "%ld %u", &pos.lnum, &u); + pos.col = u; + switch (line[1]) + { + case '"': curbuf->b_last_cursor = pos; break; + case '^': curbuf->b_last_insert = pos; break; + case '.': curbuf->b_last_change = pos; break; + case '+': + // changelist positions are stored oldest + // first + if (curbuf->b_changelistlen == JUMPLISTSIZE) + // list is full, remove oldest entry + mch_memmove(curbuf->b_changelist, + curbuf->b_changelist + 1, + sizeof(pos_T) * (JUMPLISTSIZE - 1)); + else + ++curbuf->b_changelistlen; + curbuf->b_changelist[ + curbuf->b_changelistlen - 1] = pos; + break; + + // Using the line number for the last-used + // timestamp. + case '*': curbuf->b_last_used = pos.lnum; break; + + default: if ((i = line[1] - 'a') >= 0 && i < NMARKS) + curbuf->b_namedm[i] = pos; + } + } + } + else if (copy_marks_out) + fputs((char *)line, fp_out); + } + + if (load_marks) + { + win_T *wp; + + FOR_ALL_WINDOWS(wp) + { + if (wp->w_buffer == curbuf) + wp->w_changelistidx = curbuf->b_changelistlen; + } + if (flags & VIF_ONLY_CURBUF) + break; + } + } + + if (fp_out != NULL) + // Write any remaining entries from buflist. + while (count < num_marked_files && buflist_used < buflist->ga_len) + { + buflist_buf = ((buf_T **)buflist->ga_data)[buflist_used++]; + write_buffer_marks(buflist_buf, fp_out); + ++count; + } + + mnv_free(name_buf); +} + +/* + * Read marks for the current buffer from the mnvinfo file, when we support + * buffer marks and the buffer has a name. + */ + void +check_marks_read(void) +{ + if (!curbuf->b_marks_read && get_mnvinfo_parameter('\'') > 0 + && curbuf->b_ffname != NULL) + read_mnvinfo(NULL, VIF_WANT_MARKS | VIF_ONLY_CURBUF); + + // Always set b_marks_read; needed when 'mnvinfo' is changed to include + // the ' parameter after opening a buffer. + curbuf->b_marks_read = TRUE; +} + + static int +read_mnvinfo_filemark(vir_T *virp, int force) +{ + char_u *str; + xfmark_T *namedfm_p = get_namedfm(); + xfmark_T *fm; + int i; + + // We only get here if line[0] == '\'' or '-'. + // Illegal mark names are ignored (for future expansion). + str = virp->vir_line + 1; + if (*str <= 127 + && ((*virp->vir_line == '\'' + && (MNV_ISDIGIT(*str) || SAFE_isupper(*str))) + || (*virp->vir_line == '-' && *str == '\''))) + { + if (*str == '\'') + { + // If the jumplist isn't full insert fmark as oldest entry + if (curwin->w_jumplistlen == JUMPLISTSIZE) + fm = NULL; + else + { + for (i = curwin->w_jumplistlen; i > 0; --i) + curwin->w_jumplist[i] = curwin->w_jumplist[i - 1]; + ++curwin->w_jumplistidx; + ++curwin->w_jumplistlen; + fm = &curwin->w_jumplist[0]; + fm->fmark.mark.lnum = 0; + fm->fname = NULL; + } + } + else if (MNV_ISDIGIT(*str)) + fm = &namedfm_p[*str - '0' + NMARKS]; + else + fm = &namedfm_p[*str - 'A']; + if (fm != NULL && (fm->fmark.mark.lnum == 0 || force)) + { + str = skipwhite(str + 1); + fm->fmark.mark.lnum = getdigits(&str); + str = skipwhite(str); + fm->fmark.mark.col = getdigits(&str); + fm->fmark.mark.coladd = 0; + fm->fmark.fnum = 0; + str = skipwhite(str); + mnv_free(fm->fname); + fm->fname = mnvinfo_readstring(virp, (int)(str - virp->vir_line), + FALSE); + fm->time_set = 0; + } + } + return mnv_fgets(virp->vir_line, LSIZE, virp->vir_fd); +} + +/* + * Prepare for reading mnvinfo marks when writing mnvinfo later. + */ + static void +prepare_mnvinfo_marks(void) +{ + vi_namedfm = ALLOC_CLEAR_MULT(xfmark_T, NMARKS + EXTRA_MARKS); + vi_jumplist = ALLOC_CLEAR_MULT(xfmark_T, JUMPLISTSIZE); + vi_jumplist_len = 0; +} + + static void +finish_mnvinfo_marks(void) +{ + int i; + + if (vi_namedfm != NULL) + { + for (i = 0; i < NMARKS + EXTRA_MARKS; ++i) + mnv_free(vi_namedfm[i].fname); + MNV_CLEAR(vi_namedfm); + } + if (vi_jumplist != NULL) + { + for (i = 0; i < vi_jumplist_len; ++i) + mnv_free(vi_jumplist[i].fname); + MNV_CLEAR(vi_jumplist); + } +} + +/* + * Accept a new style mark line from the mnvinfo, store it when it's new. + */ + static void +handle_mnvinfo_mark(garray_T *values, int force) +{ + bval_T *vp = (bval_T *)values->ga_data; + int name; + linenr_T lnum; + colnr_T col; + time_t timestamp; + xfmark_T *fm = NULL; + + // Check the format: + // |{bartype},{name},{lnum},{col},{timestamp},{filename} + if (values->ga_len < 5 + || vp[0].bv_type != BVAL_NR + || vp[1].bv_type != BVAL_NR + || vp[2].bv_type != BVAL_NR + || vp[3].bv_type != BVAL_NR + || vp[4].bv_type != BVAL_STRING) + return; + + name = vp[0].bv_nr; + if (name != '\'' && !MNV_ISDIGIT(name) && !ASCII_ISUPPER(name)) + return; + lnum = vp[1].bv_nr; + col = vp[2].bv_nr; + if (lnum <= 0 || col < 0) + return; + timestamp = (time_t)vp[3].bv_nr; + + if (name == '\'') + { + if (vi_jumplist != NULL) + { + if (vi_jumplist_len < JUMPLISTSIZE) + fm = &vi_jumplist[vi_jumplist_len++]; + } + else + { + int idx; + int i; + + // If we have a timestamp insert it in the right place. + if (timestamp != 0) + { + for (idx = curwin->w_jumplistlen - 1; idx >= 0; --idx) + if (curwin->w_jumplist[idx].time_set < timestamp) + { + ++idx; + break; + } + // idx cannot be zero now + if (idx < 0 && curwin->w_jumplistlen < JUMPLISTSIZE) + // insert as the oldest entry + idx = 0; + } + else if (curwin->w_jumplistlen < JUMPLISTSIZE) + // insert as oldest entry + idx = 0; + else + idx = -1; + + if (idx >= 0) + { + if (curwin->w_jumplistlen == JUMPLISTSIZE) + { + // Drop the oldest entry. + --idx; + mnv_free(curwin->w_jumplist[0].fname); + for (i = 0; i < idx; ++i) + curwin->w_jumplist[i] = curwin->w_jumplist[i + 1]; + } + else + { + // Move newer entries forward. + for (i = curwin->w_jumplistlen; i > idx; --i) + curwin->w_jumplist[i] = curwin->w_jumplist[i - 1]; + ++curwin->w_jumplistidx; + ++curwin->w_jumplistlen; + } + fm = &curwin->w_jumplist[idx]; + fm->fmark.mark.lnum = 0; + fm->fname = NULL; + fm->time_set = 0; + } + } + } + else + { + int idx; + xfmark_T *namedfm_p = get_namedfm(); + + if (MNV_ISDIGIT(name)) + { + if (vi_namedfm != NULL) + idx = name - '0' + NMARKS; + else + { + int i; + + // Do not use the name from the mnvinfo file, insert in time + // order. + for (idx = NMARKS; idx < NMARKS + EXTRA_MARKS; ++idx) + if (namedfm_p[idx].time_set < timestamp) + break; + if (idx == NMARKS + EXTRA_MARKS) + // All existing entries are newer. + return; + i = NMARKS + EXTRA_MARKS - 1; + + mnv_free(namedfm_p[i].fname); + for ( ; i > idx; --i) + namedfm_p[i] = namedfm_p[i - 1]; + namedfm_p[idx].fname = NULL; + } + } + else + idx = name - 'A'; + if (vi_namedfm != NULL) + fm = &vi_namedfm[idx]; + else + fm = &namedfm_p[idx]; + } + + if (fm != NULL) + { + if (vi_namedfm != NULL || fm->fmark.mark.lnum == 0 + || fm->time_set < timestamp || force) + { + fm->fmark.mark.lnum = lnum; + fm->fmark.mark.col = col; + fm->fmark.mark.coladd = 0; + fm->fmark.fnum = 0; + mnv_free(fm->fname); + if (vp[4].bv_allocated) + { + fm->fname = vp[4].bv_string; + vp[4].bv_string = NULL; + } + else + fm->fname = mnv_strsave(vp[4].bv_string); + fm->time_set = timestamp; + } + } +} + + static int +read_mnvinfo_barline(vir_T *virp, int got_encoding, int force, int writing) +{ + char_u *p = virp->vir_line + 1; + int bartype; + garray_T values; + bval_T *vp; + int i; + int read_next = TRUE; + + // The format is: |{bartype},{value},... + // For a very long string: + // |{bartype},>{length of "{text}{text2}"} + // |<{text1} + // |<{text2},{value} + // For a long line not using a string + // |{bartype},{lots of values},> + // |<{value},{value} + if (*p == '<') + { + // Continuation line of an unrecognized item. + if (writing) + ga_copy_string(&virp->vir_barlines, virp->vir_line); + } + else + { + ga_init2(&values, sizeof(bval_T), 20); + bartype = getdigits(&p); + switch (bartype) + { + case BARTYPE_VERSION: + // Only use the version when it comes before the encoding. + // If it comes later it was copied by a MNV version that + // doesn't understand the version. + if (!got_encoding) + { + read_next = barline_parse(virp, p, &values); + vp = (bval_T *)values.ga_data; + if (values.ga_len > 0 && vp->bv_type == BVAL_NR) + virp->vir_version = vp->bv_nr; + } + break; + + case BARTYPE_HISTORY: + read_next = barline_parse(virp, p, &values); + handle_mnvinfo_history(&values, writing); + break; + + case BARTYPE_REGISTER: + read_next = barline_parse(virp, p, &values); + handle_mnvinfo_register(&values, force); + break; + + case BARTYPE_MARK: + read_next = barline_parse(virp, p, &values); + handle_mnvinfo_mark(&values, force); + break; + + default: + // copy unrecognized line (for future use) + if (writing) + ga_copy_string(&virp->vir_barlines, virp->vir_line); + } + for (i = 0; i < values.ga_len; ++i) + { + vp = (bval_T *)values.ga_data + i; + if (vp->bv_type == BVAL_STRING && vp->bv_allocated) + mnv_free(vp->bv_string); + mnv_free(vp->bv_tofree); + } + ga_clear(&values); + } + + if (read_next) + return mnvinfo_readline(virp); + return FALSE; +} + +/* + * read_mnvinfo_up_to_marks() -- Only called from do_mnvinfo(). Reads in the + * first part of the mnvinfo file which contains everything but the marks that + * are local to a file. Returns TRUE when end-of-file is reached. -- webb + */ + static int +read_mnvinfo_up_to_marks( + vir_T *virp, + int forceit, + int writing) +{ + int eof; + buf_T *buf; + int got_encoding = FALSE; + + prepare_mnvinfo_history(forceit ? 9999 : 0, writing); + + eof = mnvinfo_readline(virp); + while (!eof && virp->vir_line[0] != '>') + { + switch (virp->vir_line[0]) + { + // Characters reserved for future expansion, ignored now + case '+': // "+40 /path/dir file", for running mnv without args + case '^': // to be defined + case '<': // long line - ignored + // A comment or empty line. + case NUL: + case '\r': + case '\n': + case '#': + eof = mnvinfo_readline(virp); + break; + case '|': + eof = read_mnvinfo_barline(virp, got_encoding, + forceit, writing); + break; + case '*': // "*encoding=value" + got_encoding = TRUE; + eof = mnvinfo_encoding(virp); + break; + case '!': // global variable +#ifdef FEAT_EVAL + eof = read_mnvinfo_varlist(virp, writing); +#else + eof = mnvinfo_readline(virp); +#endif + break; + case '%': // entry for buffer list + eof = read_mnvinfo_bufferlist(virp, writing); + break; + case '"': + // When registers are in bar lines skip the old style register + // lines. + if (virp->vir_version < MNVINFO_VERSION_WITH_REGISTERS) + eof = read_mnvinfo_register(virp, forceit); + else + do + { + eof = mnvinfo_readline(virp); + } while (!eof && (virp->vir_line[0] == TAB + || virp->vir_line[0] == '<')); + break; + case '/': // Search string + case '&': // Substitute search string + case '~': // Last search string, followed by '/' or '&' + eof = read_mnvinfo_search_pattern(virp, forceit); + break; + case '$': + eof = read_mnvinfo_sub_string(virp, forceit); + break; + case ':': + case '?': + case '=': + case '@': + // When history is in bar lines skip the old style history + // lines. + if (virp->vir_version < MNVINFO_VERSION_WITH_HISTORY) + eof = read_mnvinfo_history(virp, writing); + else + eof = mnvinfo_readline(virp); + break; + case '-': + case '\'': + // When file marks are in bar lines skip the old style lines. + if (virp->vir_version < MNVINFO_VERSION_WITH_MARKS) + eof = read_mnvinfo_filemark(virp, forceit); + else + eof = mnvinfo_readline(virp); + break; + default: + if (mnvinfo_error("E575: ", _(e_illegal_starting_char), + virp->vir_line)) + eof = TRUE; + else + eof = mnvinfo_readline(virp); + break; + } + } + + // Finish reading history items. + if (!writing) + finish_mnvinfo_history(virp); + + // Change file names to buffer numbers for fmarks. + FOR_ALL_BUFFERS(buf) + fmarks_check_names(buf); + + return eof; +} + +/* + * do_mnvinfo() -- Should only be called from read_mnvinfo() & write_mnvinfo(). + */ + static void +do_mnvinfo(FILE *fp_in, FILE *fp_out, int flags) +{ + int eof = FALSE; + vir_T vir; + int merge = FALSE; + int do_copy_marks = FALSE; + garray_T buflist; + + if ((vir.vir_line = alloc(LSIZE)) == NULL) + return; + vir.vir_fd = fp_in; + vir.vir_conv.vc_type = CONV_NONE; + ga_init2(&vir.vir_barlines, sizeof(char_u *), 100); + vir.vir_version = -1; + + if (fp_in != NULL) + { + if (flags & VIF_WANT_INFO) + { + if (fp_out != NULL) + { + // Registers and marks are read and kept separate from what + // this MNV is using. They are merged when writing. + prepare_mnvinfo_registers(); + prepare_mnvinfo_marks(); + } + + eof = read_mnvinfo_up_to_marks(&vir, + flags & VIF_FORCEIT, fp_out != NULL); + merge = TRUE; + } + else if (flags != 0) + // Skip info, find start of marks + while (!(eof = mnvinfo_readline(&vir)) + && vir.vir_line[0] != '>') + ; + + do_copy_marks = (flags & (VIF_WANT_MARKS | VIF_ONLY_CURBUF + | VIF_GET_OLDFILES | VIF_FORCEIT)); + } + + if (fp_out != NULL) + { + // Write the info: + fprintf(fp_out, _("# This mnvinfo file was generated by MNV %s.\n"), + MNV_VERSION_MEDIUM); + fputs(_("# You may edit it if you're careful!\n\n"), fp_out); + write_mnvinfo_version(fp_out); + fputs(_("# Value of 'encoding' when this file was written\n"), fp_out); + fprintf(fp_out, "*encoding=%s\n\n", p_enc); + write_mnvinfo_search_pattern(fp_out); + write_mnvinfo_sub_string(fp_out); + write_mnvinfo_history(fp_out, merge); + write_mnvinfo_registers(fp_out); + finish_mnvinfo_registers(); +#ifdef FEAT_EVAL + write_mnvinfo_varlist(fp_out); +#endif + write_mnvinfo_filemarks(fp_out); + finish_mnvinfo_marks(); + write_mnvinfo_bufferlist(fp_out); + write_mnvinfo_barlines(&vir, fp_out); + + if (do_copy_marks) + ga_init2(&buflist, sizeof(buf_T *), 50); + write_mnvinfo_marks(fp_out, do_copy_marks ? &buflist : NULL); + } + + if (do_copy_marks) + { + copy_mnvinfo_marks(&vir, fp_out, &buflist, eof, flags); + if (fp_out != NULL) + ga_clear(&buflist); + } + + mnv_free(vir.vir_line); + if (vir.vir_conv.vc_type != CONV_NONE) + convert_setup(&vir.vir_conv, NULL, NULL); + ga_clear_strings(&vir.vir_barlines); +} + +/* + * read_mnvinfo() -- Read the mnvinfo file. Registers etc. which are already + * set are not over-written unless "flags" includes VIF_FORCEIT. -- webb + */ + int +read_mnvinfo( + char_u *file, // file name or NULL to use default name + int flags) // VIF_WANT_INFO et al. +{ + FILE *fp; + char_u *fname; + stat_T st; // mch_stat() of existing mnvinfo file + + if (no_mnvinfo()) + return FAIL; + + fname = mnvinfo_filename(file); // get file name in allocated buffer + if (fname == NULL) + return FAIL; + fp = mch_fopen((char *)fname, READBIN); + + if (p_verbose > 0) + { + verbose_enter(); + smsg(_("Reading mnvinfo file \"%s\"%s%s%s%s"), + fname, + (flags & VIF_WANT_INFO) ? _(" info") : "", + (flags & VIF_WANT_MARKS) ? _(" marks") : "", + (flags & VIF_GET_OLDFILES) ? _(" oldfiles") : "", + fp == NULL ? _(" FAILED") : ""); + verbose_leave(); + } + + mnv_free(fname); + if (fp == NULL) + return FAIL; + if (mch_fstat(fileno(fp), &st) < 0 || S_ISDIR(st.st_mode)) + { + fclose(fp); + return FAIL; + } + + mnvinfo_errcnt = 0; + do_mnvinfo(fp, NULL, flags); + + fclose(fp); + return OK; +} + +/* + * Write the mnvinfo file. The old one is read in first so that effectively a + * merge of current info and old info is done. This allows multiple mnvs to + * run simultaneously, without losing any marks etc. + * If "forceit" is TRUE, then the old file is not read in, and only internal + * info is written to the file. + */ + void +write_mnvinfo(char_u *file, int forceit) +{ + char_u *fname; + FILE *fp_in = NULL; // input mnvinfo file, if any + FILE *fp_out = NULL; // output mnvinfo file + char_u *tempname = NULL; // name of temp mnvinfo file + stat_T st_new; // mch_stat() of potential new file + stat_T st_old; // mch_stat() of existing mnvinfo file +#if defined(UNIX) || defined(VMS) + mode_t umask_save; +#endif +#ifdef UNIX + int shortname = FALSE; // use 8.3 file name +#endif +#ifdef MSWIN + int hidden = FALSE; +#endif + + if (no_mnvinfo()) + return; + + fname = mnvinfo_filename(file); // may set to default if NULL + if (fname == NULL) + return; + + fp_in = mch_fopen((char *)fname, READBIN); + if (fp_in == NULL) + { + int fd; + + // if it does exist, but we can't read it, don't try writing + if (mch_stat((char *)fname, &st_new) == 0) + goto end; + + // Create the new .mnvinfo non-accessible for others, because it may + // contain text from non-accessible documents. It is up to the user to + // widen access (e.g. to a group). This may also fail if there is a + // race condition, then just give up. + fd = mch_open((char *)fname, + O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, 0600); + if (fd < 0) + goto end; + fp_out = fdopen(fd, WRITEBIN); + } + else + { + // There is an existing mnvinfo file. Create a temporary file to + // write the new mnvinfo into, in the same directory as the + // existing mnvinfo file, which will be renamed once all writing is + // successful. + if (mch_fstat(fileno(fp_in), &st_old) < 0 + || S_ISDIR(st_old.st_mode) +#ifdef UNIX + // For Unix we check the owner of the file. It's not very nice + // to overwrite a user's mnvinfo file after a "su root", with a + // mnvinfo file that the user can't read. + || (getuid() != ROOT_UID + && !(st_old.st_uid == getuid() + ? (st_old.st_mode & 0200) + : (st_old.st_gid == getgid() + ? (st_old.st_mode & 0020) + : (st_old.st_mode & 0002)))) +#endif + ) + { + int tt = msg_didany; + + // avoid a wait_return() for this message, it's annoying + semsg(_(e_mnvinfo_file_is_not_writable_str), fname); + msg_didany = tt; + fclose(fp_in); + goto end; + } +#ifdef MSWIN + // Get the file attributes of the existing mnvinfo file. + hidden = mch_ishidden(fname); +#endif + + // Make tempname, find one that does not exist yet. + // Beware of a race condition: If someone logs out and all MNV + // instances exit at the same time a temp file might be created between + // stat() and open(). Use mch_open() with O_EXCL to avoid that. + // May try twice: Once normal and once with shortname set, just in + // case somebody puts his mnvinfo file in an 8.3 filesystem. + for (;;) + { + int next_char = 'z'; + char_u *wp; + + tempname = buf_modname( +#ifdef UNIX + shortname, +#else + FALSE, +#endif + fname, +#ifdef VMS + (char_u *)"-tmp", +#else + (char_u *)".tmp", +#endif + FALSE); + if (tempname == NULL) // out of memory + break; + + // Try a series of names. Change one character, just before + // the extension. This should also work for an 8.3 + // file name, when after adding the extension it still is + // the same file as the original. + wp = tempname + STRLEN(tempname) - 5; + if (wp < gettail(tempname)) // empty file name? + wp = gettail(tempname); + for (;;) + { + // Check if tempfile already exists. Never overwrite an + // existing file! + if (mch_stat((char *)tempname, &st_new) == 0) + { +#ifdef UNIX + // Check if tempfile is same as original file. May happen + // when modname() gave the same file back. E.g. silly + // link, or file name-length reached. Try again with + // shortname set. + if (!shortname && st_new.st_dev == st_old.st_dev + && st_new.st_ino == st_old.st_ino) + { + MNV_CLEAR(tempname); + shortname = TRUE; + break; + } +#endif + } + else + { + // Try creating the file exclusively. This may fail if + // another MNV tries to do it at the same time. +#ifdef VMS + // fdopen() fails for some reason + umask_save = umask(077); + fp_out = mch_fopen((char *)tempname, WRITEBIN); + (void)umask(umask_save); +#else + int fd; + + // Use mch_open() to be able to use O_NOFOLLOW and set file + // protection: + // Unix: same as original file, but strip s-bit. Reset + // umask to avoid it getting in the way. + // Others: r&w for user only. +# ifdef UNIX + umask_save = umask(0); + fd = mch_open((char *)tempname, + O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, + (int)((st_old.st_mode & 0777) | 0600)); + (void)umask(umask_save); +# else + fd = mch_open((char *)tempname, + O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, 0600); +# endif + if (fd < 0) + { + fp_out = NULL; +# ifdef EEXIST + // Avoid trying lots of names while the problem is lack + // of permission, only retry if the file already + // exists. + if (errno != EEXIST) + break; +# endif + } + else + fp_out = fdopen(fd, WRITEBIN); +#endif // VMS + if (fp_out != NULL) + break; + } + + // Assume file exists, try again with another name. + if (next_char == 'a' - 1) + { + // They all exist? Must be something wrong! Don't write + // the mnvinfo file then. + semsg(_(e_too_many_mnvinfo_temp_files_like_str), tempname); + break; + } + *wp = next_char; + --next_char; + } + + if (tempname != NULL) + break; + // continue if shortname was set + } + +#if defined(UNIX) && defined(HAVE_FCHOWN) + if (tempname != NULL && fp_out != NULL) + { + stat_T tmp_st; + + // Make sure the original owner can read/write the tempfile and + // otherwise preserve permissions, making sure the group matches. + if (mch_stat((char *)tempname, &tmp_st) >= 0) + { + if (st_old.st_uid != tmp_st.st_uid) + // Changing the owner might fail, in which case the + // file will now be owned by the current user, oh well. + mnv_ignored = fchown(fileno(fp_out), st_old.st_uid, -1); + if (st_old.st_gid != tmp_st.st_gid + && fchown(fileno(fp_out), -1, st_old.st_gid) == -1) + // can't set the group to what it should be, remove + // group permissions + (void)mch_setperm(tempname, 0600); + } + else + // can't stat the file, set conservative permissions + (void)mch_setperm(tempname, 0600); + } +#endif + } + + // Check if the new mnvinfo file can be written to. + if (fp_out == NULL) + { + semsg(_(e_cant_write_mnvinfo_file_str), + (fp_in == NULL || tempname == NULL) ? fname : tempname); + if (fp_in != NULL) + fclose(fp_in); + goto end; + } + + if (p_verbose > 0) + { + verbose_enter(); + smsg(_("Writing mnvinfo file \"%s\""), fname); + verbose_leave(); + } + + mnvinfo_errcnt = 0; + do_mnvinfo(fp_in, fp_out, forceit ? 0 : (VIF_WANT_INFO | VIF_WANT_MARKS)); + + if (fclose(fp_out) == EOF) + ++mnvinfo_errcnt; + + if (fp_in != NULL) + { + fclose(fp_in); + + // In case of an error keep the original mnvinfo file. Otherwise + // rename the newly written file. Give an error if that fails. + if (mnvinfo_errcnt == 0) + { + if (mnv_rename(tempname, fname) == -1) + { + ++mnvinfo_errcnt; + semsg(_(e_cant_rename_mnvinfo_file_to_str), fname); + } +#ifdef MSWIN + // If the mnvinfo file was hidden then also hide the new file. + else if (hidden) + mch_hide(fname); +#endif + } + if (mnvinfo_errcnt > 0) + mch_remove(tempname); + } + +end: + mnv_free(fname); + mnv_free(tempname); +} + +/* + * ":rmnvinfo" and ":wmnvinfo". + */ + void +ex_mnvinfo( + exarg_T *eap) +{ + char_u *save_mnvinfo; + + save_mnvinfo = p_mnvinfo; + if (*p_mnvinfo == NUL) + p_mnvinfo = (char_u *)"'100"; + if (eap->cmdidx == CMD_rmnvinfo) + { + if (read_mnvinfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS + | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL) + emsg(_(e_cannot_open_mnvinfo_file_for_reading)); + } + else + write_mnvinfo(eap->arg, eap->forceit); + p_mnvinfo = save_mnvinfo; +} + +#endif // FEAT_MNVINFO diff --git a/uvim/src/mnvrun.c b/uvim/src/mnvrun.c new file mode 100644 index 0000000000..68558dddc7 --- /dev/null +++ b/uvim/src/mnvrun.c @@ -0,0 +1,113 @@ +/* vi:set ts=8 sts=4 sw=4 noet: + * + * MNV - MNV is not Vim by Bram Moolenaar + * this file by Vince Negri + * + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. + */ + +/* + * mnvrun.c - Tiny Win32 program to safely run an external command in a + * DOS console. + * This program is required to avoid that typing CTRL-C in the DOS + * console kills MNV. Now it only kills mnvrun. + */ + +#include +#include +#include +#ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif +#include + + int +main(void) +{ + const wchar_t *p; + wchar_t *cmd; + size_t cmdlen; + int retval; + int inquote = 0; + int silent = 0; + HANDLE hstdout; + DWORD written; + + p = (const wchar_t *)GetCommandLineW(); + + /* + * Skip the executable name, which might be in "". + */ + while (*p) + { + if (*p == L'"') + inquote = !inquote; + else if (!inquote && *p == L' ') + { + ++p; + break; + } + ++p; + } + while (*p == L' ') + ++p; + + /* + * "-s" argument: don't wait for a key hit. + */ + if (p[0] == L'-' && p[1] == L's' && p[2] == L' ') + { + silent = 1; + p += 3; + while (*p == L' ') + ++p; + } + + // Print the command, including quotes and redirection. + hstdout = GetStdHandle(STD_OUTPUT_HANDLE); + WriteConsoleW(hstdout, p, wcslen(p), &written, NULL); + WriteConsoleW(hstdout, L"\r\n", 2, &written, NULL); + + // If the command starts and ends with double quotes, + // Enclose the command in parentheses. + cmd = NULL; + cmdlen = wcslen(p); + if (cmdlen >= 2 && p[0] == L'"' && p[cmdlen - 1] == L'"') + { + cmdlen += 3; + cmd = malloc(cmdlen * sizeof(wchar_t)); + if (cmd == NULL) + { + perror("mnvrun malloc(): "); + return -1; + } + _snwprintf(cmd, cmdlen, L"(%s)", p); + p = cmd; + } + + /* + * Do it! + */ + retval = _wsystem(p); + + if (cmd) + free(cmd); + + if (retval == -1) + perror("mnvrun system(): "); + else if (retval != 0) + printf("shell returned %d\n", retval); + + if (!silent) + { + puts("Hit any key to close this window..."); + + while (_kbhit()) + (void)_getch(); + (void)_getch(); + } + + return retval; +} diff --git a/uvim/src/mnvtutor b/uvim/src/mnvtutor new file mode 100755 index 0000000000..ff4f777a74 --- /dev/null +++ b/uvim/src/mnvtutor @@ -0,0 +1,213 @@ +#!/bin/sh + +# Start MNV on a copy of the tutor file. + +# Type "man mnvtutor" (or "mnvtutor --help") to learn more about the supported +# command-line options. +# +# Tutors in several human languages are distributed. Type "mnvtutor" to use +# a tutor in the language of the current locale (:help v:lang), if available; +# otherwise fall back to using the English tutor. To request any bundled +# tutor, specify its ISO639 name as an argument, e.g. "mnvtutor nl". + +# MNV could be called "mnv" or "vi". Also check for "mnvN", for people who +# have MNV installed with its version number. +seq="mnv mnv91 mnv90 mnv81 mnv80 mnv8 mnv74 mnv73 mnv72 mnv71 mnv70 mnv7 mnv6 vi" + +usage() +{ + echo "==USAGE=========================================================================================" + echo "${0##*/} [[-(-l)anguage] ISO639] [-(-c)hapter NUMBER] [-(-g)ui] | [-(-h)elp] | [--list]" + printf "\twhere:\n" + printf "\t\tISO639 (default=en) is a 2 or 3 character language code\n" + printf "\t\tNUMBER (default=1) is a chapter number (1 or 2)\n" + printf "\texamples:\n" + printf "\t\tmnvtutor -l es -c 2 -g\n" + printf "\t\tmnvtutor --language de --chapter 2\n" + printf "\t\tmnvtutor fr\n" + echo "More information at 'man mnvtutor'" + echo "================================================================================================" +} + +listOptions() +{ + echo "==OPTIONS=======================================================================================" + echo "Chapter: 1" + printf "\tLang: %-3s => %s\n" \ +bar Bavarian \ +bg Bulgarian \ +ca Catalan \ +cs Czech \ +da Danish \ +de German \ +el Greek \ +en English\(default\) \ +eo Esperanto \ +es Spanish \ +fr French \ +hr Croatian \ +hu Hungarian \ +it Italian \ +ja Japanese \ +ko Korean \ +lt Lithuanian \ +lv Latvian \ +nb BokmÃ¥l \ +nl Dutch \ +no Norwegian \ +pl Polish \ +pt Portuguese \ +ru Russian \ +sk Slovak \ +sr Serbian \ +sv Swedish \ +tr Turkish \ +uk Ukrainian \ +vi Vietnamese \ +zh Chinese + + echo "Chapter: 2" + printf "\tLang: %-3s => %s\n" \ +en English\(default\) \ +fr French + echo "================================================================================================" +} + +validateLang() +{ + case "$xx" in + '' | *[!a-z]* ) + echo "Error: iso639 code must contain only [a-z]" + exit 1 + esac + + case "${#xx}" in + [23] ) + ;; + * ) + echo "Error: iso639 code must be 2 or 3 characters only" + exit 1 + esac + + export xx +} + +validateChapter() +{ + case "$cc" in + '' | *[!0-9]* ) + echo "Error: chapter argument must contain digits only" + exit 1 + ;; + [12] ) + ;; + * ) + echo "Error: invalid chapter number: [12]" + exit 1 + esac + + export CHAPTER="$cc" +} + +while [ "$1" != "" ]; do + case "$1" in + -g | --gui ) + seq="gmnv gmnv91 gmnv90 gmnv81 gmnv80 gmnv8 gmnv74 gmnv73 gmnv72 gmnv71 gmnv70 gmnv7 gmnv6 $seq" + ;; + -l | --language ) + shift + xx="$1" + validateLang + ;; + -l[a-z][a-z][a-z] | -l[a-z][a-z] ) + export xx="${1#*l}" + ;; + --language[a-z][a-z][a-z] | --language[a-z][a-z] ) + export xx="${1#*e}" + ;; + [a-z][a-z][a-z] | [a-z][a-z] ) + export xx="$1" + ;; + -c | --chapter ) + shift + cc="$1" + validateChapter + ;; + -c[12] ) + export CHAPTER="${1#*c}" + ;; + --chapter[12] ) + export CHAPTER="${1#*r}" + ;; + -h | --help ) + usage + exit + ;; + --list ) + listOptions + exit + ;; + "" ) + ;; + * ) + usage + exit 1 + esac + + shift +done + + +# We need a temp file for the copy. First try using a standard command. +tmp="${TMPDIR-/tmp}" +# shellcheck disable=SC2186 +TUTORCOPY=$(mktemp "$tmp/tutorXXXXXX" || tempfile -p tutor || echo none) + +# If the standard commands failed then create a directory to put the copy in. +# That is a secure way to make a temp file. +if test "$TUTORCOPY" = none; then + tmpdir="$tmp/mnvtutor$$" + OLD_UMASK=$(umask) + umask 077 + getout=no + mkdir "$tmpdir" || getout=yes + umask "$OLD_UMASK" + if test "$getout" = yes; then + echo "Could not create directory for tutor copy, exiting." + exit 1 + fi + TUTORCOPY="$tmpdir/tutorcopy" + touch "$TUTORCOPY" + TODELETE="$tmpdir" +else + TODELETE="$TUTORCOPY" +fi + +export TUTORCOPY + +# remove the copy of the tutor on exit +trap 'rm -rf "$TODELETE"' EXIT HUP INT QUIT SEGV PIPE TERM + +for i in $seq; do + testmnv=$(command -v "$i" 2>/dev/null) + if test -f "$testmnv"; then + MNV="$i" + break + fi +done + +# When no MNV version was found fall back to "mnv", you'll get an error message +# below. +if test -z "$MNV"; then + MNV=mnv +fi + +# Use MNV to copy the tutor, it knows the value of $MNVRUNTIME +# The script tutor.mnv tells MNV which file to copy + +$MNV -f -u NONE -c "so \$MNVRUNTIME/tutor/tutor.mnv" + +# Start mnv without any .mnvrc, set 'nocompatible' and 'showcmd' +$MNV -f -u NONE -c "set nocp showcmd" "$TUTORCOPY" + +# mnv:sw=4:ts=8:noet:nosta: diff --git a/uvim/src/mouse.c b/uvim/src/mouse.c index e043e1b4fc..39cfce651d 100644 --- a/uvim/src/mouse.c +++ b/uvim/src/mouse.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * mouse.c: mouse handling functions */ -#include "vim.h" +#include "mnv.h" /* * Horiziontal and vertical steps used when scrolling. @@ -67,14 +67,14 @@ get_mouse_class(char_u *p) if (c == ' ' || c == '\t') return 0; - if (vim_iswordc(c)) + if (mnv_iswordc(c)) return 2; // There are a few special cases where we want certain combinations of // characters to be considered as a single word. These are things like // "->", "/ *", "*=", "+=", "&=", "<=", ">=", "!=" etc. Otherwise, each // character is in its own class. - if (c != NUL && vim_strchr((char_u *)"-+*/%<>&|^!=", c) != NULL) + if (c != NUL && mnv_strchr((char_u *)"-+*/%<>&|^!=", c) != NULL) return 1; return c; } @@ -1036,13 +1036,13 @@ do_mouse( // not a word character, try finding a match and select a (), // {}, [], #if/#endif, etc. block. end_visual = curwin->w_cursor; - while (gc = gchar_pos(&end_visual), VIM_ISWHITE(gc)) + while (gc = gchar_pos(&end_visual), MNV_ISWHITE(gc)) inc(&end_visual); if (oap != NULL) oap->motion_type = MCHAR; if (oap != NULL && VIsual_mode == 'v' - && !vim_iswordc(gchar_pos(&end_visual)) + && !mnv_iswordc(gchar_pos(&end_visual)) && EQUAL_POS(curwin->w_cursor, VIsual) && (pos = findmatch(oap, NUL)) != NULL) { @@ -1600,7 +1600,7 @@ mouse_has(int c) for (p = p_mouse; *p; ++p) switch (*p) { - case 'a': if (vim_strchr((char_u *)MOUSE_A, c) != NULL) + case 'a': if (mnv_strchr((char_u *)MOUSE_A, c) != NULL) return TRUE; break; case MOUSE_HELP: if (c != MOUSE_RETURN && curbuf->b_help) @@ -2193,7 +2193,7 @@ do_mousescroll_horiz(long_u leftcol) // longest visible line. if ( #ifdef FEAT_GUI - (!gui.in_use || vim_strchr(p_go, GO_HORSCROLL) == NULL) && + (!gui.in_use || mnv_strchr(p_go, GO_HORSCROLL) == NULL) && #endif !virtual_active() && (long)leftcol > scroll_line_len(curwin->w_cursor.lnum)) diff --git a/uvim/src/move.c b/uvim/src/move.c index ebc8853617..9fe7eac6a5 100644 --- a/uvim/src/move.c +++ b/uvim/src/move.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * move.c: Functions for moving the cursor and scrolling text. @@ -17,7 +17,7 @@ * The 'scrolloff' option makes this a bit complicated. */ -#include "vim.h" +#include "mnv.h" static void redraw_for_cursorline(win_T *wp); static int scrolljump_value(void); @@ -1122,7 +1122,7 @@ curwin_col_off(void) int win_col_off2(win_T *wp) { - if ((wp->w_p_nu || wp->w_p_rnu) && vim_strchr(p_cpo, CPO_NUMCOL) != NULL) + if ((wp->w_p_nu || wp->w_p_rnu) && mnv_strchr(p_cpo, CPO_NUMCOL) != NULL) return number_width(wp) + 1; return 0; } @@ -1545,7 +1545,7 @@ f_screenpos(typval_T *argvars UNUSED, typval_T *rettv) return; dict = rettv->vval.v_dict; - if (in_vim9script() + if (in_mnv9script() && (check_for_number_arg(argvars, 0) == FAIL || check_for_number_arg(argvars, 1) == FAIL || check_for_number_arg(argvars, 2) == FAIL)) diff --git a/uvim/src/nbdebug.c b/uvim/src/nbdebug.c index 58fcad3ef8..10824ec63b 100644 --- a/uvim/src/nbdebug.c +++ b/uvim/src/nbdebug.c @@ -1,33 +1,33 @@ /* vi:set ts=8 sw=8 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * Visual Workshop integration by Gordon Prieur * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * NetBeans Debugging Tools. What are these tools and why are they important? * There are two main tools here. The first tool is a tool for delaying or - * stopping gvim during startup. The second tool is a protocol log tool. + * stopping gmnv during startup. The second tool is a protocol log tool. * * The startup delay tool is called nbdebug_wait(). This is very important for - * debugging startup problems because gvim will be started automatically from + * debugging startup problems because gmnv will be started automatically from * netbeans and cannot be run directly from a debugger. The only way to debug - * a gvim started by netbeans is by attaching a debugger to it. Without this + * a gmnv started by netbeans is by attaching a debugger to it. Without this * tool all startup code will have completed before you can get the pid and * attach. * * The second tool is a log tool. * - * This code must have NBDEBUG defined for it to be compiled into vim/gvim. + * This code must have NBDEBUG defined for it to be compiled into mnv/gmnv. */ #ifdef NBDEBUG -#include "vim.h" +#include "mnv.h" FILE *nb_debug = NULL; u_int nb_dlevel = 0; // nb_debug verbosity level @@ -40,9 +40,9 @@ static int errorHandler(Display *, XErrorEvent *); #endif /* - * nbdebug_wait - This function can be used to delay or stop execution of vim. + * nbdebug_wait - This function can be used to delay or stop execution of mnv. * It's normally used to delay startup while attaching a - * debugger to a running process. Since NetBeans starts gvim + * debugger to a running process. Since NetBeans starts gmnv * from a background process this is the only way to debug * startup problems. */ @@ -63,11 +63,11 @@ nbdebug_wait( { sleep(atoi(getenv(wait_var))); } - else if (wait_flags & WT_WAIT && lookup("~/.gvimwait")) + else if (wait_flags & WT_WAIT && lookup("~/.gmnvwait")) { sleep(wait_secs > 0 && wait_secs < 120 ? wait_secs : 20); } - else if (wait_flags & WT_STOP && lookup("~/.gvimstop")) + else if (wait_flags & WT_STOP && lookup("~/.gmnvstop")) { int w = 1; while (w) @@ -147,7 +147,7 @@ errorHandler( char buf[256]; XGetErrorText(dpy, err->error_code, msg, sizeof(msg)); - nbdbg("\n\nNBDEBUG Vim: X Error of failed request: %s\n", msg); + nbdbg("\n\nNBDEBUG MNV: X Error of failed request: %s\n", msg); sprintf(buf, "%d", err->request_code); XGetErrorDatabaseText(dpy, diff --git a/uvim/src/nbdebug.h b/uvim/src/nbdebug.h index 20bbb049e2..e92f7a270b 100644 --- a/uvim/src/nbdebug.h +++ b/uvim/src/nbdebug.h @@ -1,10 +1,10 @@ /* vi:set ts=8 sw=8 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * Visual Workshop integration by Gordon Prieur * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ @@ -38,8 +38,8 @@ typedef enum { WT_ENV = 1, // look for env var if set - WT_WAIT, // look for ~/.gvimwait if set - WT_STOP // look for ~/.gvimstop if set + WT_WAIT, // look for ~/.gmnvwait if set + WT_STOP // look for ~/.gmnvstop if set } WtWait; diff --git a/uvim/src/netbeans.c b/uvim/src/netbeans.c index 976a2574a1..54607b9656 100644 --- a/uvim/src/netbeans.c +++ b/uvim/src/netbeans.c @@ -1,29 +1,29 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * Netbeans integration by David Weatherford * Adopted for Win32 by Sergey Khorev * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* * Implements client side of org.netbeans.modules.emacs editor * integration protocol. Be careful! The protocol uses offsets - * which are *between* characters, whereas vim uses line number + * which are *between* characters, whereas mnv uses line number * and column number which are *on* characters. * See ":help netbeans-protocol" for explanation. * * The Netbeans messages are received and queued in the gui event loop, or in - * the select loop when Vim runs in a terminal. These messages are processed - * by netbeans_parse_messages() which is invoked in the idle loop when Vim is + * the select loop when MNV runs in a terminal. These messages are processed + * by netbeans_parse_messages() which is invoked in the idle loop when MNV is * waiting for user input. The function netbeans_parse_messages() is also * called from the ":sleep" command, to allow the execution of test cases that * may not invoke the idle loop. */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_NETBEANS_INTG) @@ -176,33 +176,33 @@ netbeans_connect(char *params, int doabort) if (address == NULL) address = getenv("__NETBEANS_SOCKET"); if (password == NULL) - password = getenv("__NETBEANS_VIM_PASSWORD"); + password = getenv("__NETBEANS_MNV_PASSWORD"); // Move values to allocated memory. if (hostname != NULL) - hostname = (char *)vim_strsave((char_u *)hostname); + hostname = (char *)mnv_strsave((char_u *)hostname); if (address != NULL) - address = (char *)vim_strsave((char_u *)address); + address = (char *)mnv_strsave((char_u *)address); if (password != NULL) - password = (char *)vim_strsave((char_u *)password); + password = (char *)mnv_strsave((char_u *)password); } } // Use the default when a value is missing. if (hostname == NULL || *hostname == '\0') { - vim_free(hostname); - hostname = (char *)vim_strsave((char_u *)NB_DEF_HOST); + mnv_free(hostname); + hostname = (char *)mnv_strsave((char_u *)NB_DEF_HOST); } if (address == NULL || *address == '\0') { - vim_free(address); - address = (char *)vim_strsave((char_u *)NB_DEF_ADDR); + mnv_free(address); + address = (char *)mnv_strsave((char_u *)NB_DEF_ADDR); } if (password == NULL || *password == '\0') { - vim_free(password); - password = (char *)vim_strsave((char_u *)NB_DEF_PASS); + mnv_free(password); + password = (char *)mnv_strsave((char_u *)NB_DEF_PASS); } if (hostname != NULL && address != NULL && password != NULL) { @@ -216,7 +216,7 @@ netbeans_connect(char *params, int doabort) #endif // success, login - vim_snprintf(buf, sizeof(buf), "AUTH %s\n", password); + mnv_snprintf(buf, sizeof(buf), "AUTH %s\n", password); nb_send(buf, "netbeans_connect"); sprintf(buf, "0:version=0 \"%s\"\n", ExtEdProtocolVersion); @@ -227,9 +227,9 @@ netbeans_connect(char *params, int doabort) if (nb_channel == NULL && doabort) getout(1); - vim_free(hostname); - vim_free(address); - vim_free(password); + mnv_free(hostname); + mnv_free(address); + mnv_free(password); return NETBEANS_OPEN ? OK : FAIL; } @@ -274,23 +274,23 @@ getConnInfo(char *file, char **host, char **port, char **auth) // Read the file. There should be one of each parameter while ((lp = (char_u *)fgets((char *)buf, BUFSIZ, fp)) != NULL) { - if ((nlp = vim_strchr(lp, '\n')) != NULL) + if ((nlp = mnv_strchr(lp, '\n')) != NULL) *nlp = 0; // strip off the trailing newline if (STRNCMP(lp, "host=", 5) == 0) { - vim_free(*host); - *host = (char *)vim_strsave(&buf[5]); + mnv_free(*host); + *host = (char *)mnv_strsave(&buf[5]); } else if (STRNCMP(lp, "port=", 5) == 0) { - vim_free(*port); - *port = (char *)vim_strsave(&buf[5]); + mnv_free(*port); + *port = (char *)mnv_strsave(&buf[5]); } else if (STRNCMP(lp, "auth=", 5) == 0) { - vim_free(*auth); - *auth = (char *)vim_strsave(&buf[5]); + mnv_free(*auth); + *auth = (char *)mnv_strsave(&buf[5]); } } fclose(fp); @@ -337,7 +337,7 @@ postpone_keycommand(char_u *keystr) keyHead.prev->next = node; keyHead.prev = node; - node->keystr = vim_strsave(keystr); + node->keystr = mnv_strsave(keystr); } /* @@ -359,10 +359,10 @@ handle_key_queue(void) // and change keyHead. if (node->keystr != NULL) postponed = !netbeans_keystring(node->keystr); - vim_free(node->keystr); + mnv_free(node->keystr); // Finally, dispose of the node - vim_free(node); + mnv_free(node); } } @@ -419,7 +419,7 @@ netbeans_parse_messages(void) if (own_node) // buffer finished, dispose of it - vim_free(buffer); + mnv_free(buffer); else if (nb_channel != NULL) // more follows, move it to the start channel_consume(nb_channel, PART_SOCK, (int)(p - buffer)); @@ -570,15 +570,15 @@ nb_free(void) for (i = 0; i < buf_list_used; i++) { buf = buf_list[i]; - vim_free(buf.displayname); - vim_free(buf.signmap); + mnv_free(buf.displayname); + mnv_free(buf.signmap); if (buf.bufp != NULL && buf_valid(buf.bufp)) { buf.bufp->b_netbeans_file = FALSE; buf.bufp->b_was_netbeans_file = FALSE; } } - VIM_CLEAR(buf_list); + MNV_CLEAR(buf_list); buf_list_size = 0; buf_list_used = 0; @@ -586,8 +586,8 @@ nb_free(void) while (key_node != NULL && key_node != &keyHead) { keyQ_T *next = key_node->next; - vim_free(key_node->keystr); - vim_free(key_node); + mnv_free(key_node->keystr); + mnv_free(key_node); if (next == &keyHead) { keyHead.next = &keyHead; @@ -626,12 +626,12 @@ isNetbeansBuffer(buf_T *bufp) } /* - * NetBeans and Vim have different undo models. In Vim, the file isn't + * NetBeans and MNV have different undo models. In MNV, the file isn't * changed if changes are undone via the undo command. In NetBeans, once * a change has been made the file is marked as modified until saved. It * doesn't matter if the change was undone. * - * So this function is for the corner case where Vim thinks a buffer is + * So this function is for the corner case where MNV thinks a buffer is * unmodified but NetBeans thinks it IS modified. */ int @@ -686,14 +686,14 @@ nb_get_buf(int bufno) // list size overflow, bail out return NULL; } - buf_list = vim_realloc(buf_list, bufsize); + buf_list = mnv_realloc(buf_list, bufsize); if (buf_list == NULL) { - vim_free(t_buf_list); + mnv_free(t_buf_list); buf_list_size = 0; return NULL; } - vim_memset(buf_list + buf_list_size - incr, 0, + mnv_memset(buf_list + buf_list_size - incr, 0, incr * sizeof(nbbuf_T)); } @@ -802,7 +802,7 @@ nb_reply_text(int cmdno, char_u *result) sprintf((char *)reply, "%d %s\n", cmdno, (char *)result); nb_send((char *)reply, "nb_reply_text"); - vim_free(reply); + mnv_free(reply); } @@ -1011,7 +1011,7 @@ nb_do_cmd( } else if (streq((char *)cmd, "saveAndExit")) { - // Note: this will exit Vim if successful. + // Note: this will exit MNV if successful. coloncmd(":confirm qall"); // We didn't exit: return the number of changed buffers. @@ -1111,7 +1111,7 @@ nb_do_cmd( p += STRLEN(line); *p++ = '\\'; *p++ = 'n'; - vim_free(line); + mnv_free(line); } } *p++ = '\"'; @@ -1123,7 +1123,7 @@ nb_do_cmd( else { nb_reply_text(cmdno, text); - vim_free(text); + mnv_free(text); } // ===================================================================== } @@ -1368,7 +1368,7 @@ nb_do_cmd( do_update = 1; while (*args != NUL) { - nlp = vim_strchr(args, '\n'); + nlp = mnv_strchr(args, '\n'); if (nlp == NULL) { // Incomplete line, probably truncated. Next "insert" @@ -1457,7 +1457,7 @@ nb_do_cmd( // Undo info is invalid now... u_clearallandblockfree(curbuf); } - vim_free(to_free); + mnv_free(to_free); nb_reply_nil(cmdno); // or !error } else @@ -1479,7 +1479,7 @@ nb_do_cmd( emsg(_(e_invalid_buffer_identifier_in_create)); return FAIL; } - VIM_CLEAR(buf->displayname); + MNV_CLEAR(buf->displayname); netbeansReadFile = 0; // don't try to open disk file do_ecmd(0, NULL, 0, 0, ECMD_ONE, ECMD_HIDE + ECMD_OLDBUF, curwin); @@ -1551,7 +1551,7 @@ nb_do_cmd( else { // NetBeans uses stopDocumentListen when it stops editing - // a file. It then expects the buffer in Vim to + // a file. It then expects the buffer in MNV to // disappear. do_bufdel(DOBUF_DEL, (char_u *)"", 1, buf->bufp->b_fnum, buf->bufp->b_fnum, TRUE); @@ -1568,7 +1568,7 @@ nb_do_cmd( emsg(_(e_invalid_buffer_identifier_in_settitle)); return FAIL; } - vim_free(buf->displayname); + mnv_free(buf->displayname); buf->displayname = nb_unquote(args, NULL); // ===================================================================== } @@ -1605,7 +1605,7 @@ nb_do_cmd( if (path == NULL) return FAIL; bufp = buflist_findname(path); - vim_free(path); + mnv_free(path); if (bufp == NULL) { nbdebug((" File %s not found in setBufferNumber\n", args)); @@ -1637,7 +1637,7 @@ nb_do_cmd( emsg(_(e_invalid_buffer_identifier_in_setfullname)); return FAIL; } - vim_free(buf->displayname); + mnv_free(buf->displayname); buf->displayname = nb_unquote(args, NULL); netbeansReadFile = 0; // don't try to open disk file @@ -1661,7 +1661,7 @@ nb_do_cmd( return FAIL; } // Edit a file: like create + setFullName + read the file. - vim_free(buf->displayname); + mnv_free(buf->displayname); buf->displayname = nb_unquote(args, NULL); do_ecmd(0, (char_u *)buf->displayname, NULL, NULL, ECMD_ONE, ECMD_HIDE + ECMD_OLDBUF, curwin); @@ -1709,7 +1709,7 @@ nb_do_cmd( else if (streq((char *)cmd, "raise")) { #ifdef FEAT_GUI - // Bring gvim to the foreground. + // Bring gmnv to the foreground. if (gui.in_use) gui_mch_set_foreground(); #endif @@ -1793,7 +1793,7 @@ nb_do_cmd( */ if (balloonEval != NULL) { - vim_free(text); + mnv_free(text); text = nb_unquote(args, NULL); if (text != NULL) gui_mch_post_balloon(balloonEval, (char_u *)text); @@ -1931,8 +1931,8 @@ nb_do_cmd( args = skipwhite(args + 1); p = (char_u *)nb_unquote(args, &args); - glyphFile = vim_strsave_escaped(p, escape_chars); - vim_free(p); + glyphFile = mnv_strsave_escaped(p, escape_chars); + mnv_free(p); args = skipwhite(args + 1); p = skiptowhite(args); @@ -1941,22 +1941,22 @@ nb_do_cmd( *p = NUL; p = skipwhite(p + 1); } - fg = vim_strsave(args); - bg = vim_strsave(p); + fg = mnv_strsave(args); + bg = mnv_strsave(p); if (STRLEN(fg) > MAX_COLOR_LENGTH || STRLEN(bg) > MAX_COLOR_LENGTH) { emsg(_(e_highlighting_color_name_too_long_in_defineAnnoType)); - VIM_CLEAR(typeName); + MNV_CLEAR(typeName); parse_error = TRUE; } else if (typeName != NULL && tooltip != NULL && glyphFile != NULL) addsigntype(buf, typeNum, typeName, tooltip, glyphFile, fg, bg); - vim_free(typeName); - vim_free(fg); - vim_free(bg); - vim_free(tooltip); - vim_free(glyphFile); + mnv_free(typeName); + mnv_free(fg); + mnv_free(bg); + mnv_free(tooltip); + mnv_free(glyphFile); if (parse_error) return FAIL; @@ -1992,10 +1992,10 @@ nb_do_cmd( pos = get_off_or_lnum(buf->bufp, &args); cp = (char *)args; - vim_ignored = (int)strtol(cp, &cp, 10); + mnv_ignored = (int)strtol(cp, &cp, 10); args = (char_u *)cp; # ifdef NBDEBUG - if (vim_ignored != -1) + if (mnv_ignored != -1) nbdebug((" partial line annotation -- Not Yet Implemented!\n")); # endif if (serNum >= GUARDEDOFFSET) @@ -2261,7 +2261,7 @@ nb_set_curbuf(buf_T *buf) } /* - * Process a vim colon command. + * Process a mnv colon command. */ static void coloncmd(char *cmd, ...) @@ -2270,7 +2270,7 @@ coloncmd(char *cmd, ...) va_list ap; va_start(ap, cmd); - vim_vsnprintf(buf, sizeof(buf), cmd, ap); + mnv_vsnprintf(buf, sizeof(buf), cmd, ap); va_end(ap); nbdebug((" COLONCMD %s\n", buf)); @@ -2321,14 +2321,14 @@ special_keys(char_u *args) if (strlen(tok) + i < KEYBUFLEN) { - vim_strncpy((char_u *)&keybuf[i], (char_u *)tok, KEYBUFLEN - i - 1); - vim_snprintf(cmdbuf, sizeof(cmdbuf), + mnv_strncpy((char_u *)&keybuf[i], (char_u *)tok, KEYBUFLEN - i - 1); + mnv_snprintf(cmdbuf, sizeof(cmdbuf), "<%s> :nbkey %s", keybuf, keybuf); do_map(MAPTYPE_MAP, (char_u *)cmdbuf, MODE_NORMAL, FALSE); } tok = strtok(NULL, " "); } - vim_free(save_str); + mnv_free(save_str); } void @@ -2485,16 +2485,16 @@ netbeans_beval_cb( p = nb_quote(text); if (p != NULL) { - vim_snprintf(buf, MAXPATHL * 2 + 25, + mnv_snprintf(buf, MAXPATHL * 2 + 25, "0:balloonText=%d \"%s\"\n", r_cmdno, p); - vim_free(p); + mnv_free(p); } nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_beval_cb"); - vim_free(buf); + mnv_free(buf); } } - vim_free(text); + mnv_free(text); } #endif @@ -2607,18 +2607,18 @@ netbeans_file_activated(buf_T *bufp) return; if (bp == NULL) { - vim_free(q); + mnv_free(q); return; } - vim_snprintf(buffer, sizeof(buffer), "%d:fileOpened=%d \"%s\" %s %s\n", + mnv_snprintf(buffer, sizeof(buffer), "%d:fileOpened=%d \"%s\" %s %s\n", bufno, bufno, (char *)q, "T", // open in NetBeans "F"); // modified - vim_free(q); + mnv_free(q); nbdebug(("EVT: %s", buffer)); nb_send(buffer, "netbeans_file_opened"); @@ -2647,18 +2647,18 @@ netbeans_file_opened(buf_T *bufp) else bnum = 0; - vim_snprintf(buffer, sizeof(buffer), "%d:fileOpened=%d \"%s\" %s %s\n", + mnv_snprintf(buffer, sizeof(buffer), "%d:fileOpened=%d \"%s\" %s %s\n", bnum, 0, (char *)q, "T", // open in NetBeans "F"); // modified - vim_free(q); + mnv_free(q); nbdebug(("EVT: %s", buffer)); nb_send(buffer, "netbeans_file_opened"); - if (p_acd && vim_chdirfile(bufp->b_ffname, "auto") == OK) + if (p_acd && mnv_chdirfile(bufp->b_ffname, "auto") == OK) { last_chdir_reason = "netbeans"; shorten_fnames(TRUE); @@ -2692,7 +2692,7 @@ netbeans_file_killed(buf_T *bufp) } /* - * Get a pointer to the Netbeans buffer for Vim buffer "bufp". + * Get a pointer to the Netbeans buffer for MNV buffer "bufp". * Return NULL if there is no such buffer or changes are not to be reported. * Otherwise store the buffer number in "*bufnop". */ @@ -2749,7 +2749,7 @@ netbeans_inserted( // send the "insert" EVT newtxt = alloc(newlen + 1); - vim_strncpy(newtxt, txt, newlen); + mnv_strncpy(newtxt, txt, newlen); // Note: this may make "txt" invalid pos.lnum = linenr; @@ -2764,10 +2764,10 @@ netbeans_inserted( bufno, r_cmdno, off, p); nbdebug(("EVT: %s", buf)); nb_send((char *)buf, "netbeans_inserted"); - vim_free(p); - vim_free(buf); + mnv_free(p); + mnv_free(buf); } - vim_free(newtxt); + mnv_free(newtxt); } /* @@ -2895,12 +2895,12 @@ netbeans_keystring(char_u *keyName) : nb_quote(curbuf->b_ffname); if (q == NULL) return TRUE; - vim_snprintf(buf, sizeof(buf), "0:fileOpened=%d \"%s\" %s %s\n", 0, + mnv_snprintf(buf, sizeof(buf), "0:fileOpened=%d \"%s\" %s %s\n", 0, q, "T", // open in NetBeans "F"); // modified if (curbuf->b_ffname != NULL) - vim_free(q); + mnv_free(q); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_keycommand"); @@ -2919,13 +2919,13 @@ netbeans_keystring(char_u *keyName) // more synchronous // now send keyCommand event - vim_snprintf(buf, sizeof(buf), "%d:keyCommand=%d \"%s\"\n", + mnv_snprintf(buf, sizeof(buf), "%d:keyCommand=%d \"%s\"\n", bufno, r_cmdno, keyName); nbdebug(("EVT: %s", buf)); nb_send(buf, "netbeans_keycommand"); // New: do both at once and include the lnum/col. - vim_snprintf(buf, sizeof(buf), "%d:keyAtPos=%d \"%s\" %ld %ld/%ld\n", + mnv_snprintf(buf, sizeof(buf), "%d:keyAtPos=%d \"%s\" %ld %ld/%ld\n", bufno, r_cmdno, keyName, off, (long)curwin->w_cursor.lnum, (long)curwin->w_cursor.col); nbdebug(("EVT: %s", buf)); @@ -3205,7 +3205,7 @@ addsigntype( if (*glyphFile == NUL) // no glyph, line highlighting only coloncmd(":sign define %d linehl=NB_%s", i + 1, typeName); - else if (vim_strsize(glyphFile) <= 2) + else if (mnv_strsize(glyphFile) <= 2) // one- or two-character glyph name, use as text glyph with // texthl coloncmd(":sign define %d text=%s texthl=NB_%s", i + 1, @@ -3237,19 +3237,19 @@ addsigntype( globalsignmaplen *= 2; incr = globalsignmaplen - oldlen; - globalsignmap = vim_realloc(globalsignmap, + globalsignmap = mnv_realloc(globalsignmap, globalsignmaplen * sizeof(char *)); if (globalsignmap == NULL) { - vim_free(t_globalsignmap); + mnv_free(t_globalsignmap); globalsignmaplen = 0; return; } - vim_memset(globalsignmap + oldlen, 0, incr * sizeof(char *)); + mnv_memset(globalsignmap + oldlen, 0, incr * sizeof(char *)); } } - globalsignmap[i] = (char *)vim_strsave(typeName); + globalsignmap[i] = (char *)mnv_strsave(typeName); globalsignmapused = i + 1; } @@ -3274,15 +3274,15 @@ addsigntype( buf->signmaplen *= 2; incr = buf->signmaplen - oldlen; - buf->signmap = vim_realloc(buf->signmap, + buf->signmap = mnv_realloc(buf->signmap, buf->signmaplen * sizeof(int)); if (buf->signmap == NULL) { - vim_free(t_signmap); + mnv_free(t_signmap); buf->signmaplen = 0; return; } - vim_memset(buf->signmap + oldlen, 0, incr * sizeof(int)); + mnv_memset(buf->signmap + oldlen, 0, incr * sizeof(int)); } } @@ -3439,7 +3439,7 @@ print_read_msg(nbbuf_T *buf) msg_add_lines(c, (long)lnum, nchars); // Now display it - VIM_CLEAR(keep_msg); + MNV_CLEAR(keep_msg); msg_scrolled_ign = TRUE; msg_trunc_attr((char *)IObuff, FALSE, 0); msg_scrolled_ign = FALSE; @@ -3466,7 +3466,7 @@ print_save_msg(nbbuf_T *buf, off_T nchars) msg_add_lines(c, buf->bufp->b_ml.ml_line_count, buf->bufp->b_orig_size); - VIM_CLEAR(keep_msg); + MNV_CLEAR(keep_msg); msg_scrolled_ign = TRUE; p = (char_u *)msg_trunc_attr((char *)IObuff, FALSE, 0); if ((msg_scrolled && !need_wait_return) || !buf->initDone) @@ -3486,7 +3486,7 @@ print_save_msg(nbbuf_T *buf, off_T nchars) { char msgbuf[IOSIZE]; - vim_snprintf(msgbuf, IOSIZE, + mnv_snprintf(msgbuf, IOSIZE, _(e_is_read_only_add_bang_to_override), IObuff); nbdebug((" %s\n", msgbuf)); emsg(msgbuf); diff --git a/uvim/src/normal.c b/uvim/src/normal.c index 01ea4c0915..c04998a483 100644 --- a/uvim/src/normal.c +++ b/uvim/src/normal.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar et al. + * MNV - MNV is not Vim by Bram Moolenaar et al. * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * normal.c: Contains the main routine for processing characters in command @@ -12,7 +12,7 @@ * the operators. */ -#include "vim.h" +#include "mnv.h" static int VIsual_mode_orig = NUL; // saved Visual mode @@ -127,7 +127,7 @@ static void nv_cursorhold(cmdarg_T *cap); #define DO_DECLARE_NVCMD #include "nv_cmds.h" -// Include the lookuptable generated by create_nvcmdidx.vim. +// Include the lookuptable generated by create_nvcmdidx.mnv. #include "nv_cmdidxs.h" /* @@ -486,7 +486,7 @@ normal_cmd_get_more_chars( if (*cp == Ctrl_K && ((nv_cmds[idx].cmd_flags & NV_LANG) || cp == &cap->extra_char) - && vim_strchr(p_cpo, CPO_DIGRAPH) == NULL) + && mnv_strchr(p_cpo, CPO_DIGRAPH) == NULL) { c = get_digraph(FALSE); if (c > 0) @@ -569,7 +569,7 @@ normal_cmd_get_more_chars( cap->ncharC2 = c; } ++no_mapping; - // Vim may be in a different mode when the user types the next key, + // MNV may be in a different mode when the user types the next key, // but when replaying a recording the next key is already in the // typeahead buffer, so record an before that to prevent // the vpeekc() above from applying wrong mappings when replaying. @@ -654,11 +654,11 @@ normal_cmd_wait_for_msg(void) // now reset it, otherwise it's put in the history again keep_msg = kmsg; - kmsg = vim_strsave(keep_msg); + kmsg = mnv_strsave(keep_msg); if (kmsg != NULL) { msg_attr((char *)kmsg, keep_msg_attr); - vim_free(kmsg); + mnv_free(kmsg); } } setcursor(); @@ -782,7 +782,7 @@ normal_cmd( // In Select mode, typed text replaces the selection. if (VIsual_active && VIsual_select - && (vim_isprintc(c) || c == NL || c == CAR || c == K_KENTER)) + && (mnv_isprintc(c) || c == NL || c == CAR || c == K_KENTER)) { int len; @@ -1026,7 +1026,7 @@ normal_end: clear_showcmd(); checkpcmark(); // check if we moved since setting pcmark - vim_free(ca.searchbuf); + mnv_free(ca.searchbuf); if (has_mbyte) mb_adjust_cursor(); @@ -1341,7 +1341,7 @@ find_ident_at_pos( } else while (ptr[col] != NUL - && (i == 0 ? !vim_iswordc(ptr[col]) : VIM_ISWHITE(ptr[col])) + && (i == 0 ? !mnv_iswordc(ptr[col]) : MNV_ISWHITE(ptr[col])) && (!(find_type & FIND_EVAL) || ptr[col] != ']') ) ++col; @@ -1387,10 +1387,10 @@ find_ident_at_pos( { while (col > 0 && ((i == 0 - ? vim_iswordc(ptr[col - 1]) - : (!VIM_ISWHITE(ptr[col - 1]) + ? mnv_iswordc(ptr[col - 1]) + : (!MNV_ISWHITE(ptr[col - 1]) && (!(find_type & FIND_IDENT) - || !vim_iswordc(ptr[col - 1])))) + || !mnv_iswordc(ptr[col - 1])))) || ((find_type & FIND_EVAL) && col > 1 && find_is_eval_item(ptr + col - 1, &col, @@ -1400,13 +1400,13 @@ find_ident_at_pos( // If we don't want just any old text, or we've found an // identifier, stop searching. - if (!(find_type & FIND_STRING) || vim_iswordc(ptr[col])) + if (!(find_type & FIND_STRING) || mnv_iswordc(ptr[col])) break; } } if (ptr[col] == NUL || (i == 0 - && (has_mbyte ? this_class != 2 : !vim_iswordc(ptr[col])))) + && (has_mbyte ? this_class != 2 : !mnv_iswordc(ptr[col])))) { // didn't find an identifier or text if ((find_type & FIND_NOERROR) == 0) @@ -1443,8 +1443,8 @@ find_ident_at_pos( col += (*mb_ptr2len)(ptr + col); } else - while ((i == 0 ? vim_iswordc(ptr[col]) - : (ptr[col] != NUL && !VIM_ISWHITE(ptr[col]))) + while ((i == 0 ? mnv_iswordc(ptr[col]) + : (ptr[col] != NUL && !MNV_ISWHITE(ptr[col]))) || ((find_type & FIND_EVAL) && col <= (int)startcol && find_is_eval_item(ptr + col, &col, &bn, FORWARD)) @@ -1657,11 +1657,11 @@ clear_showcmd(void) p_sbr = saved_sbr; curwin->w_p_sbr = saved_w_sbr; #endif - vim_snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%ldx%ld", lines, + mnv_snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%ldx%ld", lines, (long)(rightcol - leftcol + 1)); } else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum) - vim_snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%ld", lines); + mnv_snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%ld", lines); else { char_u *s, *e; @@ -1693,9 +1693,9 @@ clear_showcmd(void) s += l; } if (bytes == chars) - vim_snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%d", chars); + mnv_snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%d", chars); else - vim_snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%d-%d", chars, bytes); + mnv_snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%d-%d", chars, bytes); } showcmd_buf[SHOWCMD_COLS] = NUL; // truncate showcmd_visual = TRUE; @@ -1757,7 +1757,7 @@ add_to_showcmd(int c) if (ignore[i] == c) return FALSE; - if (c <= 0x7f || !vim_isprintc(c)) + if (c <= 0x7f || !mnv_isprintc(c)) { p = transchar(c); if (*p == ' ') @@ -1836,7 +1836,7 @@ pop_showcmd(void) static void display_showcmd(void) { - int len = vim_strsize(showcmd_buf); + int len = mnv_strsize(showcmd_buf); showcmd_is_clear = (len == 0); cursor_off(); @@ -1912,7 +1912,7 @@ do_check_scrollbind(int check) (long)(curwin->w_leftcol - old_leftcol)); } } - else if (vim_strchr(p_sbo, 'j')) // jump flag set in 'scrollopt' + else if (mnv_strchr(p_sbo, 'j')) // jump flag set in 'scrollopt' { // When switching between windows, make sure that the relative // vertical offset is valid for the new window. The relative @@ -1955,11 +1955,11 @@ check_scrollbind(linenr_T topline_diff, long leftcol_diff) long y; // check 'scrollopt' string for vertical and horizontal scroll options - want_ver = (vim_strchr(p_sbo, 'v') && topline_diff != 0); + want_ver = (mnv_strchr(p_sbo, 'v') && topline_diff != 0); #ifdef FEAT_DIFF want_ver |= old_curwin->w_p_diff; #endif - want_hor = (vim_strchr(p_sbo, 'h') && (leftcol_diff || topline_diff != 0)); + want_hor = (mnv_strchr(p_sbo, 'h') && (leftcol_diff || topline_diff != 0)); // loop through the scrollbound windows and scroll accordingly VIsual_select = VIsual_active = 0; @@ -2204,8 +2204,8 @@ find_decl( // Put "\V" before the pattern to avoid that the special meaning of "." // and "~" causes trouble. - patlen = vim_snprintf((char *)pat, len + 7, - vim_iswordp(ptr) ? "\\V\\<%.*s\\>" : "\\V%.*s", len, ptr); + patlen = mnv_snprintf((char *)pat, len + 7, + mnv_iswordp(ptr) ? "\\V\\<%.*s\\>" : "\\V%.*s", len, ptr); old_pos = curwin->w_cursor; save_p_ws = p_ws; @@ -2318,7 +2318,7 @@ find_decl( reset_search_dir(); } - vim_free(pat); + mnv_free(pat); p_ws = save_p_ws; p_scs = save_p_scs; @@ -2467,13 +2467,13 @@ nv_screengo(oparg_T *oap, int dir, long dist) virtcol = curwin->w_virtcol; #if defined(FEAT_LINEBREAK) if (virtcol > (colnr_T)width1 && *get_showbreak_value(curwin) != NUL) - virtcol -= vim_strsize(get_showbreak_value(curwin)); + virtcol -= mnv_strsize(get_showbreak_value(curwin)); #endif c = (*mb_ptr2char)(ml_get_cursor()); if (dir == FORWARD && virtcol < curwin->w_curswant && (curwin->w_curswant <= (colnr_T)width1) - && !vim_isprintc(c) && c > 255) + && !mnv_isprintc(c) && c > 255) oneright(); if (virtcol > curwin->w_curswant @@ -2533,9 +2533,9 @@ nv_z_get_count(cmdarg_T *cap, int *nchar_arg) if (nchar == K_DEL || nchar == K_KDEL) n /= 10; - else if (VIM_ISDIGIT(nchar)) + else if (MNV_ISDIGIT(nchar)) { - if (vim_append_digit_long(&n, nchar - '0') == FAIL) + if (mnv_append_digit_long(&n, nchar - '0') == FAIL) { clearopbeep(cap->oap); break; @@ -2593,7 +2593,7 @@ nv_zg_zw(cmdarg_T *cap, int nchar) --allow_keys; (void)add_to_showcmd(nchar); - if (vim_strchr((char_u *)"gGwW", nchar) == NULL) + if (mnv_strchr((char_u *)"gGwW", nchar) == NULL) { clearopbeep(cap->oap); return OK; @@ -2646,7 +2646,7 @@ nv_zet(cmdarg_T *cap) #endif long siso = get_sidescrolloff_value(); - if (VIM_ISDIGIT(nchar) && !nv_z_get_count(cap, &nchar)) + if (MNV_ISDIGIT(nchar) && !nv_z_get_count(cap, &nchar)) return; if ( @@ -2655,7 +2655,7 @@ nv_zet(cmdarg_T *cap) // and "zC" only in Visual mode. "zj" and "zk" are motion // commands. cap->nchar != 'f' && cap->nchar != 'F' - && !(VIsual_active && vim_strchr((char_u *)"dcCoO", cap->nchar)) + && !(VIsual_active && mnv_strchr((char_u *)"dcCoO", cap->nchar)) && cap->nchar != 'j' && cap->nchar != 'k' && #endif @@ -2664,7 +2664,7 @@ nv_zet(cmdarg_T *cap) // For "z+", "z", "zt", "z.", "zz", "z^", "z-", "zb": // If line number given, set cursor. - if ((vim_strchr((char_u *)"+\r\nt.z^-b", nchar) != NULL) + if ((mnv_strchr((char_u *)"+\r\nt.z^-b", nchar) != NULL) && cap->count0 && cap->count0 != curwin->w_cursor.lnum) { @@ -3091,7 +3091,7 @@ handle_tabmenu(void) do_cmdline_cmd((char_u *)"confirm tabclose"); else { - vim_snprintf((char *)IObuff, IOSIZE, "confirm tabclose %d", + mnv_snprintf((char *)IObuff, IOSIZE, "confirm tabclose %d", current_tab); do_cmdline_cmd(IObuff); } @@ -3102,7 +3102,7 @@ handle_tabmenu(void) do_cmdline_cmd((char_u *)"$tabnew"); else { - vim_snprintf((char *)IObuff, IOSIZE, "%dtabnew", + mnv_snprintf((char *)IObuff, IOSIZE, "%dtabnew", current_tab - 1); do_cmdline_cmd(IObuff); } @@ -3113,7 +3113,7 @@ handle_tabmenu(void) do_cmdline_cmd((char_u *)"browse $tabnew"); else { - vim_snprintf((char *)IObuff, IOSIZE, "browse %dtabnew", + mnv_snprintf((char *)IObuff, IOSIZE, "browse %dtabnew", current_tab - 1); do_cmdline_cmd(IObuff); } @@ -3130,7 +3130,7 @@ nv_exmode(cmdarg_T *cap) { // Ignore 'Q' in Visual mode, just give a beep. if (VIsual_active) - vim_beep(BO_EX); + mnv_beep(BO_EX); else if (!checkclearop(cap->oap)) do_exmode(FALSE); } @@ -3258,8 +3258,8 @@ nv_clear(cmdarg_T *cap) # endif #endif redraw_later(UPD_CLEAR); -#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) -# ifdef VIMDLL +#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)) +# ifdef MNVDLL if (!gui.in_use) # endif resize_console_buf(); @@ -3371,9 +3371,9 @@ nv_K_getcmd( { // 'keywordprog' is an ex command if (cap->count0 != 0) - *buflen = vim_snprintf((char *)buf, bufsize, "%s %ld ", kp, cap->count0); + *buflen = mnv_snprintf((char *)buf, bufsize, "%s %ld ", kp, cap->count0); else - *buflen = vim_snprintf((char *)buf, bufsize, "%s ", kp); + *buflen = mnv_snprintf((char *)buf, bufsize, "%s ", kp); return n; } @@ -3388,7 +3388,7 @@ nv_K_getcmd( { // found dashes only emsg(_(e_no_identifier_under_cursor)); - vim_free(buf); + mnv_free(buf); *ptr_arg = ptr; return 0; } @@ -3398,16 +3398,16 @@ nv_K_getcmd( isman = (STRCMP(kp, "man") == 0); isman_s = (STRCMP(kp, "man -s") == 0); if (cap->count0 != 0 && !(isman || isman_s)) - *buflen = vim_snprintf((char *)buf, bufsize, ".,.+%ld! ", cap->count0 - 1); + *buflen = mnv_snprintf((char *)buf, bufsize, ".,.+%ld! ", cap->count0 - 1); else - *buflen = vim_snprintf((char *)buf, bufsize, "! "); + *buflen = mnv_snprintf((char *)buf, bufsize, "! "); if (cap->count0 == 0 && isman_s) - *buflen += vim_snprintf((char *)buf + *buflen, bufsize - *buflen, "man "); + *buflen += mnv_snprintf((char *)buf + *buflen, bufsize - *buflen, "man "); else - *buflen += vim_snprintf((char *)buf + *buflen, bufsize - *buflen, "%s ", kp); + *buflen += mnv_snprintf((char *)buf + *buflen, bufsize - *buflen, "%s ", kp); if (cap->count0 != 0 && (isman || isman_s)) - *buflen += vim_snprintf((char *)buf + *buflen, bufsize - *buflen, "%ld ", cap->count0); + *buflen += mnv_snprintf((char *)buf + *buflen, bufsize - *buflen, "%ld ", cap->count0); *ptr_arg = ptr; return n; @@ -3500,7 +3500,7 @@ nv_ident(cmdarg_T *cap) setpcmark(); curwin->w_cursor.col = (colnr_T) (ptr - ml_get_curline()); - if (!g_cmd && vim_iswordp(ptr)) + if (!g_cmd && mnv_iswordp(ptr)) { STRCPY(buf, "\\<"); buflen = STRLEN_LITERAL("\\<"); @@ -3550,7 +3550,7 @@ nv_ident(cmdarg_T *cap) buflen = STRLEN_LITERAL("ta "); } else - buflen = vim_snprintf((char *)buf, bufsize, ":%ldta ", cap->count0); + buflen = mnv_snprintf((char *)buf, bufsize, ":%ldta ", cap->count0); } } @@ -3559,31 +3559,31 @@ nv_ident(cmdarg_T *cap) { size_t plen; - ptr = vim_strnsave(ptr, n); + ptr = mnv_strnsave(ptr, n); if (kp_ex) // Escape the argument properly for an Ex command - p = vim_strsave_fnameescape(ptr, VSE_NONE); + p = mnv_strsave_fnameescape(ptr, VSE_NONE); else // Escape the argument properly for a shell command - p = vim_strsave_shellescape(ptr, TRUE, TRUE); - vim_free(ptr); + p = mnv_strsave_shellescape(ptr, TRUE, TRUE); + mnv_free(ptr); if (p == NULL) { - vim_free(buf); + mnv_free(buf); return; } plen = STRLEN(p); - newbuf = vim_realloc(buf, buflen + plen + 1); + newbuf = mnv_realloc(buf, buflen + plen + 1); if (newbuf == NULL) { - vim_free(buf); - vim_free(p); + mnv_free(buf); + mnv_free(p); return; } buf = newbuf; STRCPY(buf + buflen, p); buflen += plen; - vim_free(p); + mnv_free(p); } else { @@ -3606,7 +3606,7 @@ nv_ident(cmdarg_T *cap) while (n-- > 0) { // put a backslash before \ and some others - if (vim_strchr(aux_ptr, *ptr) != NULL) + if (mnv_strchr(aux_ptr, *ptr) != NULL) *p++ = '\\'; // When current byte is a part of multibyte character, copy all @@ -3629,8 +3629,8 @@ nv_ident(cmdarg_T *cap) if (cmdchar == '*' || cmdchar == '#') { if (!g_cmd && (has_mbyte - ? vim_iswordp(mb_prevptr(ml_get_curline(), ptr)) - : vim_iswordc(ptr[-1]))) + ? mnv_iswordp(mb_prevptr(ml_get_curline(), ptr)) + : mnv_iswordc(ptr[-1]))) { STRCPY(buf + buflen, "\\>"); buflen += STRLEN_LITERAL("\\>"); @@ -3649,7 +3649,7 @@ nv_ident(cmdarg_T *cap) g_tag_at_cursor = FALSE; } - vim_free(buf); + mnv_free(buf); } /* @@ -3855,11 +3855,11 @@ nv_right(cmdarg_T *cap) // 'l' wraps to next line if 'whichwrap' has 'l'. // CURS_RIGHT wraps to next line if 'whichwrap' has '>'. if ( ((cap->cmdchar == ' ' - && vim_strchr(p_ww, 's') != NULL) + && mnv_strchr(p_ww, 's') != NULL) || (cap->cmdchar == 'l' - && vim_strchr(p_ww, 'l') != NULL) + && mnv_strchr(p_ww, 'l') != NULL) || (cap->cmdchar == K_RIGHT - && vim_strchr(p_ww, '>') != NULL)) + && mnv_strchr(p_ww, '>') != NULL)) && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { // When deleting we also count the NL as a character. @@ -3943,11 +3943,11 @@ nv_left(cmdarg_T *cap) // CURS_LEFT wraps to previous line if 'whichwrap' has '<'. if ( (((cap->cmdchar == K_BS || cap->cmdchar == Ctrl_H) - && vim_strchr(p_ww, 'b') != NULL) + && mnv_strchr(p_ww, 'b') != NULL) || (cap->cmdchar == 'h' - && vim_strchr(p_ww, 'h') != NULL) + && mnv_strchr(p_ww, 'h') != NULL) || (cap->cmdchar == K_LEFT - && vim_strchr(p_ww, '<') != NULL)) + && mnv_strchr(p_ww, '<') != NULL)) && curwin->w_cursor.lnum > 1) { --(curwin->w_cursor.lnum); @@ -4091,7 +4091,7 @@ nv_gotofile(cmdarg_T *cap) check_cursor_lnum(); beginline(BL_SOL | BL_FIX); } - vim_free(ptr); + mnv_free(ptr); } else clearop(cap->oap); @@ -4470,7 +4470,7 @@ nv_brackets(cmdarg_T *cap) // fwd bwd fwd bwd fwd bwd // identifier "]i" "[i" "]I" "[I" "]^I" "[^I" // define "]d" "[d" "]D" "[D" "]^D" "[^D" - if (vim_strchr((char_u *)"iI\011dD\004", cap->nchar) != NULL) + if (mnv_strchr((char_u *)"iI\011dD\004", cap->nchar) != NULL) { char_u *ptr; int len; @@ -4480,7 +4480,7 @@ nv_brackets(cmdarg_T *cap) else { // Make a copy, if the line was changed it will be freed. - ptr = vim_strnsave(ptr, len); + ptr = mnv_strnsave(ptr, len); if (ptr == NULL) return; @@ -4493,7 +4493,7 @@ nv_brackets(cmdarg_T *cap) cap->cmdchar == ']' ? curwin->w_cursor.lnum + 1 : (linenr_T)1, (linenr_T)MAXLNUM, FALSE, FALSE); - vim_free(ptr); + mnv_free(ptr); curwin->w_set_curswant = TRUE; } } @@ -4506,9 +4506,9 @@ nv_brackets(cmdarg_T *cap) // "[m" or "]m" search for prev/next start of (Java) method. // "[M" or "]M" search for prev/next end of (Java) method. if ( (cap->cmdchar == '[' - && vim_strchr((char_u *)"{(*/#mM", cap->nchar) != NULL) + && mnv_strchr((char_u *)"{(*/#mM", cap->nchar) != NULL) || (cap->cmdchar == ']' - && vim_strchr((char_u *)"})*/#mM", cap->nchar) != NULL)) + && mnv_strchr((char_u *)"})*/#mM", cap->nchar) != NULL)) nv_bracket_block(cap, &old_pos); // "[[", "[]", "]]" and "][": move to start or end of function @@ -5119,7 +5119,7 @@ n_swapchar(cmdarg_T *cap) if (checkclearopq(cap->oap)) return; - if (LINEEMPTY(curwin->w_cursor.lnum) && vim_strchr(p_ww, '~') == NULL) + if (LINEEMPTY(curwin->w_cursor.lnum) && mnv_strchr(p_ww, '~') == NULL) { clearopbeep(cap->oap); return; @@ -5140,7 +5140,7 @@ n_swapchar(cmdarg_T *cap) inc_cursor(); if (gchar_cursor() == NUL) { - if (vim_strchr(p_ww, '~') != NULL + if (mnv_strchr(p_ww, '~') != NULL && curwin->w_cursor.lnum < curbuf->b_ml.ml_line_count) { #ifdef FEAT_NETBEANS_INTG @@ -5246,7 +5246,7 @@ v_visop(cmdarg_T *cap) else if (cap->cmdchar == 'C' || cap->cmdchar == 'D') curwin->w_curswant = MAXCOL; } - cap->cmdchar = *(vim_strchr(trans, cap->cmdchar) + 1); + cap->cmdchar = *(mnv_strchr(trans, cap->cmdchar) + 1); nv_operator(cap); } @@ -5314,7 +5314,7 @@ nv_optrans(cmdarg_T *cap) { // In Vi "2D" doesn't delete the next line. Can't translate it // either, because "2." should also not use the count. - if (cap->cmdchar == 'D' && vim_strchr(p_cpo, CPO_HASH) != NULL) + if (cap->cmdchar == 'D' && mnv_strchr(p_cpo, CPO_HASH) != NULL) { cap->oap->start = curwin->w_cursor; cap->oap->op_type = OP_DELETE; @@ -5331,7 +5331,7 @@ nv_optrans(cmdarg_T *cap) { if (cap->count0) stuffnumReadbuff(cap->count0); - stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]); + stuffReadbuff(ar[(int)(mnv_strchr(str, cap->cmdchar) - str)]); } } cap->opcount = 0; @@ -5594,7 +5594,7 @@ start_selection(void) may_start_select(int c) { VIsual_select = (c == 'o' || (stuff_empty() && typebuf_typed())) - && vim_strchr(p_slm, c) != NULL; + && mnv_strchr(p_slm, c) != NULL; } /* @@ -5809,7 +5809,7 @@ nv_g_home_m_cmd(cmdarg_T *cap) { do i = gchar_cursor(); - while (VIM_ISWHITE(i) && oneright() == OK); + while (MNV_ISWHITE(i) && oneright() == OK); curwin->w_valid &= ~VALID_WCOL; } curwin->w_set_curswant = TRUE; @@ -5851,7 +5851,7 @@ nv_g_underscore_cmd(cmdarg_T *cap) // Decrease the cursor column until it's on a non-blank. while (curwin->w_cursor.col > 0 - && VIM_ISWHITE(ptr[curwin->w_cursor.col])) + && MNV_ISWHITE(ptr[curwin->w_cursor.col])) --curwin->w_cursor.col; curwin->w_set_curswant = TRUE; adjust_for_sel(cap); @@ -5984,7 +5984,7 @@ nv_g_cmd(cmdarg_T *cap) #ifdef MEM_PROFILE // "g^A": dump log of used memory. if (!VIsual_active && cap->nchar == Ctrl_A) - vim_mem_profile_dump(); + mnv_mem_profile_dump(); else #endif // "g^A/g^X": sequentially increment visually selected region @@ -6357,7 +6357,7 @@ n_opencmd(cmdarg_T *cap) curwin->w_valid &= ~VALID_CROW; #endif // When '#' is in 'cpoptions' ignore the count. - if (vim_strchr(p_cpo, CPO_HASH) != NULL) + if (mnv_strchr(p_cpo, CPO_HASH) != NULL) cap->count1 = 1; invoke_edit(cap, FALSE, cap->cmdchar, TRUE); } @@ -6494,7 +6494,7 @@ nv_operator(cmdarg_T *cap) set_op_var(int optype) { if (optype == OP_NOP) - set_vim_var_string(VV_OP, NULL, 0); + set_mnv_var_string(VV_OP, NULL, 0); else { char_u opchars[3]; @@ -6502,7 +6502,7 @@ set_op_var(int optype) opchars[0] = get_op_char(optype); opchars[1] = get_extra_op_char(optype); opchars[2] = NUL; - set_vim_var_string(VV_OP, opchars, 2); + set_mnv_var_string(VV_OP, opchars, 2); } } #endif @@ -6614,13 +6614,13 @@ nv_wordcmd(cmdarg_T *cap) n = gchar_cursor(); if (n != NUL) // not an empty line { - if (VIM_ISWHITE(n)) + if (MNV_ISWHITE(n)) { // Reproduce a funny Vi behaviour: "cw" on a blank only // changes one character, not all blanks until the start of // the next word. Only do this when the 'w' flag is included // in 'cpoptions'. - if (cap->count1 == 1 && vim_strchr(p_cpo, CPO_CW) != NULL) + if (cap->count1 == 1 && mnv_strchr(p_cpo, CPO_CW) != NULL) { cap->oap->inclusive = TRUE; cap->oap->motion_type = MCHAR; @@ -6639,7 +6639,7 @@ nv_wordcmd(cmdarg_T *cap) // will change only one character! This is done by setting // flag. // This can be configured using :set cpo-z - if (vim_strchr(p_cpo, CPO_WORD) != NULL) + if (mnv_strchr(p_cpo, CPO_WORD) != NULL) { cap->oap->inclusive = TRUE; word_end = TRUE; @@ -6879,12 +6879,12 @@ nv_esc(cmdarg_T *cap) { int out_redir = !stdout_isatty && !is_not_a_term_or_gui(); - // The user may accidentally do "vim file | grep word" and then + // The user may accidentally do "mnv file | grep word" and then // CTRL-C doesn't show anything. With a changed buffer give the // message on stderr. Without any changes might as well exit. if (anyBufIsChanged()) { - char *ms = _("Type :qa! and press to abandon all changes and exit Vim"); + char *ms = _("Type :qa! and press to abandon all changes and exit MNV"); if (out_redir) mch_errmsg(ms); @@ -6899,7 +6899,7 @@ nv_esc(cmdarg_T *cap) do_cmdline_cmd((char_u *)"qa"); } else - msg(_("Type :qa and press to exit Vim")); + msg(_("Type :qa and press to exit MNV")); } } @@ -6940,7 +6940,7 @@ nv_esc(cmdarg_T *cap) popup_hide_message_win(); else #endif - vim_beep(BO_ESC); + mnv_beep(BO_ESC); } clearop(cap->oap); @@ -7079,7 +7079,7 @@ nv_edit(cmdarg_T *cap) break; case 'I': // "I"nsert before the first non-blank - if (vim_strchr(p_cpo, CPO_INSEND) == NULL) + if (mnv_strchr(p_cpo, CPO_INSEND) == NULL) beginline(BL_WHITE); else beginline(BL_WHITE|BL_FIX); @@ -7431,7 +7431,7 @@ nv_put_opt(cmdarg_T *cap, int fix_indent) adjust_clip_reg(®name); #endif if (regname == 0 || regname == '"' - || VIM_ISDIGIT(regname) || regname == '-' + || MNV_ISDIGIT(regname) || regname == '-' #ifdef FEAT_CLIPBOARD || (clip_unnamed && (regname == '*' || regname == '+')) #endif diff --git a/uvim/src/nv_cmdidxs.h b/uvim/src/nv_cmdidxs.h index 60071e4824..965ce35f2c 100644 --- a/uvim/src/nv_cmdidxs.h +++ b/uvim/src/nv_cmdidxs.h @@ -1,5 +1,5 @@ /* - * Automatically generated code by the create_nvcmdidxs.vim script. + * Automatically generated code by the create_nvcmdidxs.mnv script. * * Table giving the index in nv_cmds[] to lookup based on * the command character. diff --git a/uvim/src/nv_cmds.h b/uvim/src/nv_cmds.h index 99925f2c50..bcacef92cf 100644 --- a/uvim/src/nv_cmds.h +++ b/uvim/src/nv_cmds.h @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar et al. + * MNV - MNV is not Vim by Bram Moolenaar et al. * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * This file defines the Normal mode commands. @@ -23,7 +23,7 @@ #ifdef DO_DECLARE_NVCMD /* - * Used when building Vim. + * Used when building MNV. */ # define NVCMD(a, b, c, d) \ {a, b, c, d} @@ -87,7 +87,7 @@ typedef void (*nv_func_T)(cmdarg_T *cap); /* * This table contains one entry for every Normal or Visual mode command. - * The order doesn't matter, this will be sorted by the create_nvcmdidx.vim + * The order doesn't matter, this will be sorted by the create_nvcmdidx.mnv * script to generate the nv_cmd_idx[] lookup table. * It is faster when all keys from zero to '~' are present. */ diff --git a/uvim/src/ops.c b/uvim/src/ops.c index 3fad2b44fd..1bb42025b7 100644 --- a/uvim/src/ops.c +++ b/uvim/src/ops.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -12,7 +12,7 @@ * op_change, op_yank, do_join */ -#include "vim.h" +#include "mnv.h" static void shift_block(oparg_T *oap, int amount); static void mb_adjust_opend(oparg_T *oap); @@ -27,7 +27,7 @@ static void pbyte(pos_T lp, int c); /* * The names of operators. - * IMPORTANT: Index must correspond with defines in vim.h!!! + * IMPORTANT: Index must correspond with defines in mnv.h!!! * The third field holds OPF_ flags. */ static const char opchars[][3] = @@ -201,7 +201,7 @@ op_shift(oparg_T *oap, int curs_top, int amount) "%ld line %sed %d times", amount); msg_line_plural = NGETTEXT("%ld lines %sed %d time", "%ld lines %sed %d times", amount); - vim_snprintf((char *)IObuff, IOSIZE, + mnv_snprintf((char *)IObuff, IOSIZE, NGETTEXT(msg_line_single, msg_line_plural, oap->line_count), oap->line_count, op, amount); msg_attr_keep((char *)IObuff, 0, TRUE); @@ -260,15 +260,15 @@ get_vts_sum(int *vts_array, int index) } #endif - static vimlong_T + static mnvlong_T get_new_sw_indent( int left, // TRUE if shift is to the left int round, // TRUE if new indent is to be to a tabstop - vimlong_T amount, // Number of shifts - vimlong_T sw_val) + mnvlong_T amount, // Number of shifts + mnvlong_T sw_val) { - vimlong_T count = get_indent(); - vimlong_T i, j; + mnvlong_T count = get_indent(); + mnvlong_T i, j; if (round) // round off indent { @@ -302,14 +302,14 @@ get_new_sw_indent( } #ifdef FEAT_VARTABS - static vimlong_T + static mnvlong_T get_new_vts_indent( int left, // TRUE if shift is to the left int round, // TRUE if new indent is to be to a tabstop int amount, // Number of shifts int *vts_array) { - vimlong_T indent = get_indent(); + mnvlong_T indent = get_indent(); int vtsi = 0; int vts_indent = 0; int ts = 0; // Silence uninitialized variable warning. @@ -363,9 +363,9 @@ get_new_vts_indent( * * The rules for choosing a shiftwidth are: If 'shiftwidth' is non-zero, use * 'shiftwidth'; else if 'vartabstop' is not empty, use 'vartabstop'; else use - * 'tabstop'. The Vim documentation says nothing about 'softtabstop' or + * 'tabstop'. The MNV documentation says nothing about 'softtabstop' or * 'varsofttabstop' affecting the shiftwidth, and neither affects the - * shiftwidth in current versions of Vim, so they are not considered here. + * shiftwidth in current versions of MNV, so they are not considered here. */ void shift_line( @@ -374,7 +374,7 @@ shift_line( int amount, // Number of shifts int call_changed_bytes) // call changed_bytes() { - vimlong_T count; + mnvlong_T count; long sw_val = curbuf->b_p_sw; long ts_val = curbuf->b_p_ts; #ifdef FEAT_VARTABS @@ -481,7 +481,7 @@ shift_block(oparg_T *oap, int amount) // TODO: is passing bd.textstart for start of the line OK? init_chartabsize_arg(&cts, curwin, curwin->w_cursor.lnum, bd.start_vcol, bd.textstart, bd.textstart); - for ( ; VIM_ISWHITE(*cts.cts_ptr); ) + for ( ; MNV_ISWHITE(*cts.cts_ptr); ) { incr = lbr_chartabsize_adv(&cts); total += incr; @@ -516,9 +516,9 @@ shift_block(oparg_T *oap, int amount) return; mch_memmove(newp, oldp, (size_t)bd.textcol); newlen = bd.textcol; - vim_memset(newp + newlen, TAB, (size_t)tabs); + mnv_memset(newp + newlen, TAB, (size_t)tabs); newlen += tabs; - vim_memset(newp + newlen, ' ', (size_t)spaces); + mnv_memset(newp + newlen, ' ', (size_t)spaces); STRCPY(newp + newlen + spaces, bd.textstart); } else // left @@ -557,7 +557,7 @@ shift_block(oparg_T *oap, int amount) init_chartabsize_arg(&cts, curwin, curwin->w_cursor.lnum, non_white_col, bd.textstart, non_white); - while (VIM_ISWHITE(*cts.cts_ptr)) + while (MNV_ISWHITE(*cts.cts_ptr)) { incr = lbr_chartabsize_adv(&cts); cts.cts_vcol += incr; @@ -615,7 +615,7 @@ shift_block(oparg_T *oap, int amount) return; mch_memmove(newp, oldp, fixedlen); newlen = fixedlen; - vim_memset(newp + newlen, ' ', (size_t)fill); + mnv_memset(newp + newlen, ' ', (size_t)fill); STRCPY(newp + newlen + fill, non_white); } // replace the line @@ -714,7 +714,7 @@ block_insert( oldp += offset; // insert pre-padding - vim_memset(newp + offset, ' ', (size_t)spaces); + mnv_memset(newp + offset, ' ', (size_t)spaces); startcol = offset + spaces; // copy the new text @@ -726,7 +726,7 @@ block_insert( if (*oldp == TAB) { // insert post-padding - vim_memset(newp + offset + spaces, ' ', + mnv_memset(newp + offset + spaces, ' ', (size_t)(ts_val - spaces)); // we're splitting a TAB, don't copy it oldp++; @@ -817,7 +817,7 @@ op_delete(oparg_T *oap) && !oap->block_mode && oap->line_count > 1 && oap->motion_force == NUL - && (vim_strchr(p_cpo, CPO_WORD) != NULL) + && (mnv_strchr(p_cpo, CPO_WORD) != NULL) && oap->op_type == OP_DELETE) { ptr = ml_get(oap->end.lnum) + oap->end.col; @@ -845,7 +845,7 @@ op_delete(oparg_T *oap) // Virtual editing: Nothing gets deleted, but we set the '[ and '] // marks as if it happened. goto setmarks; - if (vim_strchr(p_cpo, CPO_EMPTYREGION) != NULL) + if (mnv_strchr(p_cpo, CPO_EMPTYREGION) != NULL) beep_flush(); return OK; } @@ -973,7 +973,7 @@ op_delete(oparg_T *oap) // copy up to deleted part mch_memmove(newp, oldp, (size_t)bd.textcol); // insert spaces - vim_memset(newp + bd.textcol, ' ', + mnv_memset(newp + bd.textcol, ' ', (size_t)(bd.startspaces + bd.endspaces)); // copy the part after the deleted part STRCPY(newp + bd.textcol + bd.startspaces + bd.endspaces, @@ -1075,7 +1075,7 @@ op_delete(oparg_T *oap) return FAIL; // if 'cpoptions' contains '$', display '$' at end of change - if ( vim_strchr(p_cpo, CPO_DOLLAR) != NULL + if ( mnv_strchr(p_cpo, CPO_DOLLAR) != NULL && oap->op_type == OP_CHANGE && oap->end.lnum == curwin->w_cursor.lnum && !oap->is_VIsual) @@ -1286,12 +1286,12 @@ op_replace(oparg_T *oap, int c) newp = alloc(oldlen + 1 + n); if (newp == NULL) continue; - vim_memset(newp, NUL, (size_t)(oldlen + 1 + n)); + mnv_memset(newp, NUL, (size_t)(oldlen + 1 + n)); // copy up to deleted part mch_memmove(newp, oldp, (size_t)bd.textcol); newlen = bd.textcol; // insert pre-spaces - vim_memset(newp + newlen, ' ', (size_t)bd.startspaces); + mnv_memset(newp + newlen, ' ', (size_t)bd.startspaces); newlen += bd.startspaces; // insert replacement chars CHECK FOR ALLOCATED SPACE // REPLACE_CR_NCHAR/REPLACE_NL_NCHAR is used for entering CR @@ -1305,13 +1305,13 @@ op_replace(oparg_T *oap, int c) } else { - vim_memset(newp + newlen, c, (size_t)numc); + mnv_memset(newp + newlen, c, (size_t)numc); newlen += numc; } if (!bd.is_short) { // insert post-spaces - vim_memset(newp + newlen, ' ', (size_t)bd.endspaces); + mnv_memset(newp + newlen, ' ', (size_t)bd.endspaces); // copy the part after the changed part STRCPY(newp + newlen + bd.endspaces, oldp + bd.textcol + bd.textlen); @@ -1332,7 +1332,7 @@ op_replace(oparg_T *oap, int c) ml_append(curwin->w_cursor.lnum++, after_p, 0, FALSE); appended_lines_mark(curwin->w_cursor.lnum, 1L); oap->end.lnum++; - vim_free(after_p); + mnv_free(after_p); } } } @@ -1881,7 +1881,7 @@ op_insert(oparg_T *oap, long count1) len -= add; if (pre_textlen >= 0 && (ins_len = (int)len - pre_textlen - offset) > 0) { - ins_text = vim_strnsave(firstline, ins_len); + ins_text = mnv_strnsave(firstline, ins_len); if (ins_text != NULL) { // block handled here @@ -1892,7 +1892,7 @@ op_insert(oparg_T *oap, long count1) curwin->w_cursor.col = oap->start.col; check_cursor(); - vim_free(ins_text); + mnv_free(ins_text); } } } @@ -1988,7 +1988,7 @@ op_change(oparg_T *oap) // copy of the inserted text. if ((ins_text = alloc(ins_len + 1)) != NULL) { - vim_strncpy(ins_text, firstline + bd.textcol, ins_len); + mnv_strncpy(ins_text, firstline + bd.textcol, ins_len); for (linenr = oap->start.lnum + 1; linenr <= oap->end.lnum; linenr++) { @@ -2014,7 +2014,7 @@ op_change(oparg_T *oap) // copy up to block start mch_memmove(newp, oldp, (size_t)bd.textcol); newlen = bd.textcol; - vim_memset(newp + newlen, ' ', (size_t)vpos.coladd); + mnv_memset(newp + newlen, ' ', (size_t)vpos.coladd); newlen += vpos.coladd; mch_memmove(newp + newlen, ins_text, ins_len); STRCPY(newp + newlen + ins_len, oldp + bd.textcol); @@ -2031,7 +2031,7 @@ op_change(oparg_T *oap) changed_lines(oap->start.lnum + 1, 0, oap->end.lnum + 1, 0L); } - vim_free(ins_text); + mnv_free(ins_text); } } auto_format(FALSE, TRUE); @@ -2192,7 +2192,7 @@ do_join( comments = lalloc_clear(count * sizeof(int), TRUE); if (comments == NULL) { - vim_free(spaces); + mnv_free(spaces); return FAIL; } } @@ -2254,7 +2254,7 @@ do_join( // extra space when 'joinspaces' set and line ends in '.' if ( p_js && (endcurr1 == '.' - || (vim_strchr(p_cpo, CPO_JOINSP) == NULL + || (mnv_strchr(p_cpo, CPO_JOINSP) == NULL && (endcurr1 == '?' || endcurr1 == '!')))) ++spaces[t]; } @@ -2328,7 +2328,7 @@ do_join( if (spaces[t] > 0) { cend -= spaces[t]; - vim_memset(cend, ' ', (size_t)(spaces[t])); + mnv_memset(cend, ' ', (size_t)(spaces[t])); } // If deleting more spaces than adding, the cursor moves no more than @@ -2378,19 +2378,19 @@ do_join( /* * Set the cursor column: * Vi compatible: use the column of the first join - * vim: use the column of the last join + * mnv: use the column of the last join */ curwin->w_cursor.col = - (vim_strchr(p_cpo, CPO_JOINCOL) != NULL ? currsize : col); + (mnv_strchr(p_cpo, CPO_JOINCOL) != NULL ? currsize : col); check_cursor_col(); curwin->w_cursor.coladd = 0; curwin->w_set_curswant = TRUE; theend: - vim_free(spaces); + mnv_free(spaces); if (remove_comments) - vim_free(comments); + mnv_free(comments); return ret; } @@ -2477,7 +2477,7 @@ block_prep( // Count a tab for what it's worth (if list mode not on) incr = lbr_chartabsize(&cts); cts.cts_vcol += incr; - if (VIM_ISWHITE(*cts.cts_ptr)) + if (MNV_ISWHITE(*cts.cts_ptr)) { bdp->pre_whitesp += incr; bdp->pre_whitesp_c++; @@ -2841,12 +2841,12 @@ do_addsub( pos_T endpos; colnr_T save_coladd = 0; - do_hex = (vim_strchr(curbuf->b_p_nf, 'x') != NULL); // "heX" - do_oct = (vim_strchr(curbuf->b_p_nf, 'o') != NULL); // "Octal" - do_bin = (vim_strchr(curbuf->b_p_nf, 'b') != NULL); // "Bin" - do_alpha = (vim_strchr(curbuf->b_p_nf, 'p') != NULL); // "alPha" - do_unsigned = (vim_strchr(curbuf->b_p_nf, 'u') != NULL); // "Unsigned" - do_blank = (vim_strchr(curbuf->b_p_nf, 'k') != NULL); // "blanK" + do_hex = (mnv_strchr(curbuf->b_p_nf, 'x') != NULL); // "heX" + do_oct = (mnv_strchr(curbuf->b_p_nf, 'o') != NULL); // "Octal" + do_bin = (mnv_strchr(curbuf->b_p_nf, 'b') != NULL); // "Bin" + do_alpha = (mnv_strchr(curbuf->b_p_nf, 'p') != NULL); // "alPha" + do_unsigned = (mnv_strchr(curbuf->b_p_nf, 'u') != NULL); // "Unsigned" + do_blank = (mnv_strchr(curbuf->b_p_nf, 'k') != NULL); // "blanK" if (virtual_active()) { @@ -2868,7 +2868,7 @@ do_addsub( if (!VIsual_active) { if (do_bin) - while (col > 0 && vim_isbdigit(ptr[col])) + while (col > 0 && mnv_isbdigit(ptr[col])) { --col; if (has_mbyte) @@ -2876,7 +2876,7 @@ do_addsub( } if (do_hex) - while (col > 0 && vim_isxdigit(ptr[col])) + while (col > 0 && mnv_isxdigit(ptr[col])) { --col; if (has_mbyte) @@ -2891,14 +2891,14 @@ do_addsub( && ptr[col - 1] == '0' && (!has_mbyte || !(*mb_head_off)(ptr, ptr + col - 1)) - && vim_isxdigit(ptr[col + 1])))) + && mnv_isxdigit(ptr[col + 1])))) { // In case of binary/hexadecimal pattern overlap match, rescan col = pos->col; - while (col > 0 && vim_isdigit(ptr[col])) + while (col > 0 && mnv_isdigit(ptr[col])) { col--; if (has_mbyte) @@ -2913,7 +2913,7 @@ do_addsub( && ptr[col - 1] == '0' && (!has_mbyte || !(*mb_head_off)(ptr, ptr + col - 1)) - && vim_isxdigit(ptr[col + 1])) || + && mnv_isxdigit(ptr[col + 1])) || ( do_bin && col > 0 && (ptr[col] == 'B' @@ -2921,7 +2921,7 @@ do_addsub( && ptr[col - 1] == '0' && (!has_mbyte || !(*mb_head_off)(ptr, ptr + col - 1)) - && vim_isbdigit(ptr[col + 1]))) + && mnv_isbdigit(ptr[col + 1]))) { // Found hexadecimal or binary number, move to its start. --col; @@ -2936,12 +2936,12 @@ do_addsub( col = pos->col; while (ptr[col] != NUL - && !vim_isdigit(ptr[col]) + && !mnv_isdigit(ptr[col]) && !(do_alpha && ASCII_ISALPHA(ptr[col]))) col += mb_ptr2len(ptr + col); while (col > 0 - && vim_isdigit(ptr[col - 1]) + && mnv_isdigit(ptr[col - 1]) && !(do_alpha && ASCII_ISALPHA(ptr[col]))) { --col; @@ -2954,7 +2954,7 @@ do_addsub( if (visual) { while (ptr[col] != NUL && length > 0 - && !vim_isdigit(ptr[col]) + && !mnv_isdigit(ptr[col]) && !(do_alpha && ASCII_ISALPHA(ptr[col]))) { int mb_len = mb_ptr2len(ptr + col); @@ -2970,7 +2970,7 @@ do_addsub( && (!has_mbyte || !(*mb_head_off)(ptr, ptr + col - 1)) && !do_unsigned) { - if (do_blank && col >= 2 && !VIM_ISWHITE(ptr[col - 2])) + if (do_blank && col >= 2 && !MNV_ISWHITE(ptr[col - 2])) blank_unsigned = TRUE; else { @@ -2984,7 +2984,7 @@ do_addsub( * If a number was found, and saving for undo works, replace the number. */ firstdigit = ptr[col]; - if (!VIM_ISDIGIT(firstdigit) && !(do_alpha && ASCII_ISALPHA(firstdigit))) + if (!MNV_ISDIGIT(firstdigit) && !(do_alpha && ASCII_ISALPHA(firstdigit))) { beep_flush(); goto theend; @@ -3041,7 +3041,7 @@ do_addsub( && !visual && !do_unsigned) { - if (do_blank && col >= 2 && !VIM_ISWHITE(ptr[col - 2])) + if (do_blank && col >= 2 && !MNV_ISWHITE(ptr[col - 2])) blank_unsigned = TRUE; else { @@ -3057,7 +3057,7 @@ do_addsub( ? linelen - col : length); int overflow = FALSE; - vim_str2nr(ptr + col, &pre, &length, + mnv_str2nr(ptr + col, &pre, &length, 0 + (do_bin ? STR2NR_BIN : 0) + (do_oct ? STR2NR_OCT : 0) + (do_hex ? STR2NR_HEX : 0), @@ -3200,13 +3200,13 @@ do_addsub( buf2[buf2len] = NUL; } else if (pre == 0) - buf2len = vim_snprintf((char *)buf2, NUMBUFLEN, "%llu", n); + buf2len = mnv_snprintf((char *)buf2, NUMBUFLEN, "%llu", n); else if (pre == '0') - buf2len = vim_snprintf((char *)buf2, NUMBUFLEN, "%llo", n); + buf2len = mnv_snprintf((char *)buf2, NUMBUFLEN, "%llo", n); else if (pre && hexupper) - buf2len = vim_snprintf((char *)buf2, NUMBUFLEN, "%llX", n); + buf2len = mnv_snprintf((char *)buf2, NUMBUFLEN, "%llX", n); else - buf2len = vim_snprintf((char *)buf2, NUMBUFLEN, "%llx", n); + buf2len = mnv_snprintf((char *)buf2, NUMBUFLEN, "%llx", n); length -= buf2len; /* @@ -3231,7 +3231,7 @@ do_addsub( if (todel > 0) inc_cursor(); ins_str(buf1, (size_t)buf1len); // insert the new number - vim_free(buf1); + mnv_free(buf1); // del_char() will also mark line needing displaying if (todel > 0) @@ -3309,13 +3309,13 @@ line_count_info( { if (is_word) { - if (vim_isspace(line[i])) + if (mnv_isspace(line[i])) { words++; is_word = 0; } } - else if (!vim_isspace(line[i])) + else if (!mnv_isspace(line[i])) is_word = 1; ++chars; i += (*mb_ptr2len)(line + i); @@ -3513,7 +3513,7 @@ cursor_pos_info(dict_T *dict) { getvcols(curwin, &min_pos, &max_pos, &min_pos.col, &max_pos.col); - vim_snprintf((char *)buf1, sizeof(buf1), _("%ld Cols; "), + mnv_snprintf((char *)buf1, sizeof(buf1), _("%ld Cols; "), (long)(oparg.end_vcol - oparg.start_vcol + 1)); } else @@ -3521,7 +3521,7 @@ cursor_pos_info(dict_T *dict) if (char_count_cursor == byte_count_cursor && char_count == byte_count) - vim_snprintf((char *)IObuff, IOSIZE, + mnv_snprintf((char *)IObuff, IOSIZE, _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes"), buf1, line_count_selected, (long)curbuf->b_ml.ml_line_count, @@ -3530,7 +3530,7 @@ cursor_pos_info(dict_T *dict) byte_count_cursor, byte_count); else - vim_snprintf((char *)IObuff, IOSIZE, + mnv_snprintf((char *)IObuff, IOSIZE, _("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of %lld Bytes"), buf1, line_count_selected, (long)curbuf->b_ml.ml_line_count, @@ -3552,7 +3552,7 @@ cursor_pos_info(dict_T *dict) if (char_count_cursor == byte_count_cursor && char_count == byte_count) - vim_snprintf((char *)IObuff, IOSIZE, + mnv_snprintf((char *)IObuff, IOSIZE, _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Byte %lld of %lld"), (char *)buf1, (char *)buf2, (long)curwin->w_cursor.lnum, @@ -3560,7 +3560,7 @@ cursor_pos_info(dict_T *dict) word_count_cursor, word_count, byte_count_cursor, byte_count); else - vim_snprintf((char *)IObuff, IOSIZE, + mnv_snprintf((char *)IObuff, IOSIZE, _("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte %lld of %lld"), (char *)buf1, (char *)buf2, (long)curwin->w_cursor.lnum, @@ -3576,7 +3576,7 @@ cursor_pos_info(dict_T *dict) { size_t len = STRLEN(IObuff); - vim_snprintf((char *)IObuff + len, IOSIZE - len, + mnv_snprintf((char *)IObuff + len, IOSIZE - len, _("(+%lld for BOM)"), bom_count); } if (dict == NULL) @@ -3904,7 +3904,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) { // Yank can be redone when 'y' is in 'cpoptions', but not when yanking // for the clipboard. - int redo_yank = vim_strchr(p_cpo, CPO_YANK) != NULL && !gui_yank; + int redo_yank = mnv_strchr(p_cpo, CPO_YANK) != NULL && !gui_yank; #ifdef FEAT_LINEBREAK // Avoid a problem with unwanted linebreaks in block mode. @@ -3963,7 +3963,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) { // If 'cpoptions' does not contain 'r', insert the search // pattern to really repeat the same command. - if (vim_strchr(p_cpo, CPO_REDO) == NULL) + if (mnv_strchr(p_cpo, CPO_REDO) == NULL) AppendToRedobuffLit(cap->searchbuf, -1); AppendToRedobuff(NL_STR); } @@ -3981,7 +3981,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) else AppendToRedobuffSpec(repeat_cmdline); AppendToRedobuff(NL_STR); - VIM_CLEAR(repeat_cmdline); + MNV_CLEAR(repeat_cmdline); } } } @@ -4275,7 +4275,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) // For delete, change and yank, it's an error to operate on an // empty region, when 'E' included in 'cpoptions' (Vi compatible). empty_region_error = (oap->empty - && vim_strchr(p_cpo, CPO_EMPTYREGION) != NULL); + && mnv_strchr(p_cpo, CPO_EMPTYREGION) != NULL); // Force a redraw when operating on an empty Visual region, when // 'modifiable is off or creating a fold. @@ -4349,7 +4349,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) VIsual_reselect = FALSE; // don't reselect now if (empty_region_error) { - vim_beep(BO_OPER); + mnv_beep(BO_OPER); CancelRedo(); } else @@ -4367,7 +4367,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) { if (!gui_yank) { - vim_beep(BO_OPER); + mnv_beep(BO_OPER); CancelRedo(); } } @@ -4386,7 +4386,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) VIsual_reselect = FALSE; // don't reselect now if (empty_region_error) { - vim_beep(BO_OPER); + mnv_beep(BO_OPER); CancelRedo(); } else @@ -4416,7 +4416,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) break; case OP_FILTER: - if (vim_strchr(p_cpo, CPO_FILTER) != NULL) + if (mnv_strchr(p_cpo, CPO_FILTER) != NULL) AppendToRedobuff((char_u *)"!\r"); // use any last used !cmd else bangredo = TRUE; // do_bang() will put cmd in redo buffer @@ -4455,7 +4455,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) case OP_ROT13: if (empty_region_error) { - vim_beep(BO_OPER); + mnv_beep(BO_OPER); CancelRedo(); } else @@ -4503,7 +4503,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) VIsual_reselect = FALSE; // don't reselect now if (empty_region_error) { - vim_beep(BO_OPER); + mnv_beep(BO_OPER); CancelRedo(); } else @@ -4542,7 +4542,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) VIsual_reselect = FALSE; // don't reselect now if (empty_region_error) { - vim_beep(BO_OPER); + mnv_beep(BO_OPER); CancelRedo(); } else @@ -4586,7 +4586,7 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank) case OP_NR_SUB: if (empty_region_error) { - vim_beep(BO_OPER); + mnv_beep(BO_OPER); CancelRedo(); } else diff --git a/uvim/src/option.c b/uvim/src/option.c index c369fdbf0e..0d59a9e706 100644 --- a/uvim/src/option.c +++ b/uvim/src/option.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -25,18 +25,18 @@ * - If it's a list of flags, add some code in did_set_string_option(), search * for WW_ALL. * - When adding an option with expansion (P_EXPAND), but with a different - * default for Vi and Vim (no P_VI_DEF), add some code at VIMEXP. + * default for Vi and MNV (no P_VI_DEF), add some code at MNVEXP. * - Add documentation! One line in doc/quickref.txt, full description in * options.txt, and any other related places. - * - Add an entry in runtime/optwin.vim. + * - Add an entry in runtime/optwin.mnv. * When making changes: * - Adjust the help for the option in doc/option.txt. - * - When an entry has the P_VIM flag, or is lacking the P_VI_DEF flag, add a + * - When an entry has the P_MNV flag, or is lacking the P_VI_DEF flag, add a * comment at the help for the 'compatible' option. */ #define IN_OPTION_C -#include "vim.h" +#include "mnv.h" #include "optiondefs.h" static void set_options_default(int opt_flags); @@ -54,17 +54,17 @@ static char *set_bool_option(int opt_idx, char_u *varp, int value, int opt_flags static char *set_num_option(int opt_idx, char_u *varp, long value, char *errbuf, size_t errbuflen, int opt_flags); static int find_key_option(char_u *arg_arg, int has_lt); static void showoptions(int all, int opt_flags); -static int optval_default(struct vimoption *, char_u *varp, int compatible); -static void showoneopt(struct vimoption *, int opt_flags); +static int optval_default(struct mnvoption *, char_u *varp, int compatible); +static void showoneopt(struct mnvoption *, int opt_flags); static int put_setstring(FILE *fd, char *cmd, char *name, char_u **valuep, long_u flags); static int put_setnum(FILE *fd, char *cmd, char *name, long *valuep); static int put_setbool(FILE *fd, char *cmd, char *name, int value); -static int istermoption(struct vimoption *p); +static int istermoption(struct mnvoption *p); static int istermoption_idx(int opt_idx); -static char_u *get_varp_scope(struct vimoption *p, int scope); -static char_u *get_varp(struct vimoption *); +static char_u *get_varp_scope(struct mnvoption *p, int scope); +static char_u *get_varp(struct mnvoption *); static void check_win_options(win_T *win); -static void option_value2string(struct vimoption *, int scope); +static void option_value2string(struct mnvoption *, int scope); static void check_winopt(winopt_T *wop); static int wc_use_keyname(char_u *varp, long *wcp); static void compatible_set(void); @@ -106,15 +106,15 @@ set_init_default_shell(void) char_u *cmd; size_t len; - if (vim_strchr(p, ' ') != NULL) + if (mnv_strchr(p, ' ') != NULL) { len = STRLEN(p) + 3; // two quotes and a trailing NUL cmd = alloc(len); if (cmd != NULL) { - vim_snprintf((char *)cmd, len, "\"%s\"", p); + mnv_snprintf((char *)cmd, len, "\"%s\"", p); set_string_default("sh", cmd); - vim_free(cmd); + mnv_free(cmd); } } else @@ -163,7 +163,7 @@ set_init_default_backupskip(void) else #endif { - p = vim_getenv((char_u *)names[i], &mustfree); + p = mnv_getenv((char_u *)names[i], &mustfree); plen = 0; // will be calculated below } if (p != NULL && *p != NUL) @@ -191,25 +191,25 @@ set_init_default_backupskip(void) size_t itemseplen = (ga.ga_len == 0) ? 0 : 1; size_t itemlen; - itemlen = vim_snprintf((char *)item, itemsize, "%s%s*", p, (has_trailing_path_sep) ? "" : PATHSEPSTR); + itemlen = mnv_snprintf((char *)item, itemsize, "%s%s*", p, (has_trailing_path_sep) ? "" : PATHSEPSTR); if (find_dup_item(ga.ga_data, item, itemlen, options[opt_idx].flags) == NULL && ga_grow(&ga, (int)(itemseplen + itemlen + 1)) == OK) { - ga.ga_len += vim_snprintf((char *)ga.ga_data + ga.ga_len, + ga.ga_len += mnv_snprintf((char *)ga.ga_data + ga.ga_len, itemseplen + itemlen + 1, "%s%s", (itemseplen > 0) ? "," : "", item); } - vim_free(item); + mnv_free(item); } } if (mustfree) - vim_free(p); + mnv_free(p); } if (ga.ga_data != NULL) { set_string_default("bsk", ga.ga_data); - vim_free(ga.ga_data); + mnv_free(ga.ga_data); } } @@ -235,7 +235,7 @@ set_init_default_maxmemtot(void) // Use amount of memory available at this moment. n = (mch_avail_mem(FALSE) >> 1); #elif defined(HAVE_TOTAL_MEM) - // Use amount of memory available to Vim. + // Use amount of memory available to MNV. n = (mch_total_mem(FALSE) >> 1); #else n = (0x7fffffff >> 11); @@ -266,7 +266,7 @@ set_init_default_cdpath(void) int j; int mustfree = FALSE; - cdpath = vim_getenv((char_u *)"CDPATH", &mustfree); + cdpath = mnv_getenv((char_u *)"CDPATH", &mustfree); if (cdpath == NULL) return; @@ -277,7 +277,7 @@ set_init_default_cdpath(void) j = 1; for (i = 0; cdpath[i] != NUL; ++i) { - if (vim_ispathlistsep(cdpath[i])) + if (mnv_ispathlistsep(cdpath[i])) buf[j++] = ','; else { @@ -294,10 +294,10 @@ set_init_default_cdpath(void) options[opt_idx].flags |= P_DEF_ALLOCED; } else - vim_free(buf); // cannot happen + mnv_free(buf); // cannot happen } if (mustfree) - vim_free(cdpath); + mnv_free(cdpath); } /* @@ -358,13 +358,13 @@ set_init_restricted_mode(void) return; if (fnamecmp(p, "nologin") == 0 || fnamecmp(p, "false") == 0) restricted = TRUE; - vim_free(p); + mnv_free(p); } #endif #ifdef CLEAN_RUNTIMEPATH /* - * When Vim is started with the "--clean" argument, set the default value + * When MNV is started with the "--clean" argument, set the default value * for the 'runtimepath' and 'packpath' options. */ static void @@ -388,8 +388,8 @@ set_init_clean_rtp(void) #ifdef UNIX /* - * Change 'runtimepath' and 'packdir' to '$XDG_CONFIG_HOME/vim' if the only - * vimrc found is located in '$XDG_CONFIG_HOME/vim/vimrc'. + * Change 'runtimepath' and 'packdir' to '$XDG_CONFIG_HOME/mnv' if the only + * mnvrc found is located in '$XDG_CONFIG_HOME/mnv/mnvrc'. * In case the '$XDG_CONFIG_HOME' variable is not set, '$HOME/.config' is used * as a fallback as is defined in the XDG base dir specification: * @@ -400,16 +400,16 @@ set_init_xdg_rtp(void) int opt_idx; int has_xdg_env = TRUE; int should_free_xdg_dir = FALSE; - char_u *vimrc1 = NULL; - char_u *vimrc2 = NULL; + char_u *mnvrc1 = NULL; + char_u *mnvrc2 = NULL; char_u *xdg_dir = NULL; char_u *xdg_rtp = NULL; - char_u *vimrc_xdg = NULL; + char_u *mnvrc_xdg = NULL; // initialize chartab, so we can expand $HOME (void)init_chartab(); - vimrc1 = expand_env_save((char_u *)USR_VIMRC_FILE); - vimrc2 = expand_env_save((char_u *)USR_VIMRC_FILE2); + mnvrc1 = expand_env_save((char_u *)USR_MNVRC_FILE); + mnvrc2 = expand_env_save((char_u *)USR_MNVRC_FILE2); xdg_dir = mch_getenv("XDG_CONFIG_HOME"); if (!xdg_dir) @@ -418,10 +418,10 @@ set_init_xdg_rtp(void) should_free_xdg_dir = TRUE; has_xdg_env = FALSE; } - vimrc_xdg = concat_fnames(xdg_dir, (char_u *)"vim/vimrc", TRUE); + mnvrc_xdg = concat_fnames(xdg_dir, (char_u *)"mnv/mnvrc", TRUE); - if (file_is_readable(vimrc1) || file_is_readable(vimrc2) || - !file_is_readable(vimrc_xdg)) + if (file_is_readable(mnvrc1) || file_is_readable(mnvrc2) || + !file_is_readable(mnvrc_xdg)) goto theend; xdg_rtp = has_xdg_env ? (char_u *)XDG_RUNTIMEPATH @@ -448,11 +448,11 @@ set_init_xdg_rtp(void) # endif theend: - vim_free(vimrc1); - vim_free(vimrc2); - vim_free(vimrc_xdg); + mnv_free(mnvrc1); + mnv_free(mnvrc2); + mnv_free(mnvrc_xdg); if (should_free_xdg_dir) - vim_free(xdg_dir); + mnv_free(xdg_dir); } #endif @@ -478,15 +478,15 @@ set_init_expand_env(void) p = (char_u *)_(*(char **)options[opt_idx].var); else p = option_expand(opt_idx, NULL); - if (p != NULL && (p = vim_strsave(p)) != NULL) + if (p != NULL && (p = mnv_strsave(p)) != NULL) { *(char_u **)options[opt_idx].var = p; - // VIMEXP + // MNVEXP // Defaults for all expanded options are currently the same for Vi - // and Vim. When this changes, add some code here! Also need to + // and MNV. When this changes, add some code here! Also need to // split P_DEF_ALLOCED in two. if (options[opt_idx].flags & P_DEF_ALLOCED) - vim_free(options[opt_idx].def_val[VI_DEFAULT]); + mnv_free(options[opt_idx].def_val[VI_DEFAULT]); options[opt_idx].def_val[VI_DEFAULT] = p; options[opt_idx].flags |= P_DEF_ALLOCED; } @@ -524,7 +524,7 @@ set_init_lang_env(void) STRCPY(buf, "ja"); else buf[2] = NUL; // truncate to two-letter code - vim_setenv((char_u *)"LANG", (char_u *)buf); + mnv_setenv((char_u *)"LANG", (char_u *)buf); } } #elif defined(MACOS_CONVERT) @@ -546,7 +546,7 @@ set_init_default_encoding(void) // MS-Windows has builtin support for conversion to and from Unicode, using // "utf-8" for 'encoding' should work best for most users. // z/OS built should default to UTF-8 mode as setlocale does not respect utf-8 environment variable locales - p = vim_strnsave((char_u *)ENC_DFLT, STRLEN_LITERAL(ENC_DFLT)); + p = mnv_strnsave((char_u *)ENC_DFLT, STRLEN_LITERAL(ENC_DFLT)); #else // enc_locale() will try to find the encoding of the current locale. // This works best for properly configured systems, old and new. @@ -564,8 +564,8 @@ set_init_default_encoding(void) // We don't support "gb18030", but "cp936" is a good substitute // for practical purposes, thus use that. It's not an alias to // still support conversion between gb18030 and utf-8. - p_enc = vim_strnsave((char_u *)"cp936", STRLEN_LITERAL("cp936")); - vim_free(p); + p_enc = mnv_strnsave((char_u *)"cp936", STRLEN_LITERAL("cp936")); + mnv_free(p); } if (mb_init() == NULL) { @@ -588,19 +588,19 @@ set_init_default_encoding(void) ISK_LATIN1, OPT_FREE, SID_NONE); opt_idx = findoption((char_u *)"isp"); if (opt_idx >= 0) - options[opt_idx].def_val[VIM_DEFAULT] = ISP_LATIN1; + options[opt_idx].def_val[MNV_DEFAULT] = ISP_LATIN1; opt_idx = findoption((char_u *)"isk"); if (opt_idx >= 0) - options[opt_idx].def_val[VIM_DEFAULT] = ISK_LATIN1; + options[opt_idx].def_val[MNV_DEFAULT] = ISK_LATIN1; (void)init_chartab(); } #endif -#if defined(MSWIN) && (!defined(FEAT_GUI) || defined(VIMDLL)) +#if defined(MSWIN) && (!defined(FEAT_GUI) || defined(MNVDLL)) // Win32 console: When GetACP() returns a different value from // GetConsoleCP() set 'termencoding'. if ( -# ifdef VIMDLL +# ifdef MNVDLL (!gui.in_use && !gui.starting) && # endif GetACP() != GetConsoleCP()) @@ -611,10 +611,10 @@ set_init_default_encoding(void) // Win32 console: In ConPTY, GetConsoleCP() returns zero. // Use an alternative value. if (GetConsoleCP() == 0) - buflen = vim_snprintf(buf, sizeof(buf), "cp%ld", (long)GetACP()); + buflen = mnv_snprintf(buf, sizeof(buf), "cp%ld", (long)GetACP()); else - buflen = vim_snprintf(buf, sizeof(buf), "cp%ld", (long)GetConsoleCP()); - p_tenc = vim_strnsave((char_u *)buf, buflen); + buflen = mnv_snprintf(buf, sizeof(buf), "cp%ld", (long)GetConsoleCP()); + p_tenc = mnv_strnsave((char_u *)buf, buflen); if (p_tenc != NULL) { opt_idx = findoption((char_u *)"termencoding"); @@ -637,7 +637,7 @@ set_init_default_encoding(void) } else { - vim_free(p_enc); + mnv_free(p_enc); p_enc = save_enc; } } @@ -646,7 +646,7 @@ set_init_default_encoding(void) * Initialize the options, first part. * * Called only once from main(), just after creating the first buffer. - * If "clean_arg" is TRUE Vim was started with --clean. + * If "clean_arg" is TRUE MNV was started with --clean. */ void set_init_1(int clean_arg) @@ -658,8 +658,8 @@ set_init_1(int clean_arg) // Be Vi compatible by default p_cp = TRUE; - // Use POSIX compatibility when $VIM_POSIX is set. - if (mch_getenv((char_u *)"VIM_POSIX") != NULL) + // Use POSIX compatibility when $MNV_POSIX is set. + if (mch_getenv((char_u *)"MNV_POSIX") != NULL) { set_string_default("cpo", (char_u *)CPO_ALL); set_string_default("shm", (char_u *)SHM_POSIX); @@ -706,7 +706,7 @@ set_init_1(int clean_arg) check_win_options(curwin); check_options(); - // Must be before option_expand(), because that one needs vim_isIDc() + // Must be before option_expand(), because that one needs mnv_isIDc() didset_options(); #ifdef FEAT_SPELL @@ -775,7 +775,7 @@ set_option_default( flags = options[opt_idx].flags; if (varp != NULL) // skip hidden option, nothing to do for it { - dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT; + dvi = ((flags & P_VI_DEF) || compatible) ? VI_DEFAULT : MNV_DEFAULT; if (flags & P_STRING) { // 'fencs' default value depends on 'encoding' @@ -886,22 +886,22 @@ set_string_default_esc(char *name, char_u *val, int escape) char_u *p; int opt_idx; - if (escape && vim_strchr(val, ' ') != NULL) - p = vim_strsave_escaped(val, (char_u *)" "); + if (escape && mnv_strchr(val, ' ') != NULL) + p = mnv_strsave_escaped(val, (char_u *)" "); else - p = vim_strsave(val); + p = mnv_strsave(val); if (p == NULL) // we don't want a NULL return; opt_idx = findoption((char_u *)name); if (opt_idx < 0) { - vim_free(p); + mnv_free(p); return; } if (options[opt_idx].flags & P_DEF_ALLOCED) - vim_free(options[opt_idx].def_val[VI_DEFAULT]); + mnv_free(options[opt_idx].def_val[VI_DEFAULT]); options[opt_idx].def_val[VI_DEFAULT] = p; options[opt_idx].flags |= P_DEF_ALLOCED; } @@ -966,7 +966,7 @@ set_number_default(char *name, long val) #if defined(FEAT_PROP_POPUP) /* - * Set all window-local and buffer-local options to the Vim default. + * Set all window-local and buffer-local options to the MNV default. * local-global options will use the global value. * When "do_buffer" is FALSE don't set buffer-local options. */ @@ -982,7 +982,7 @@ set_local_options_default(win_T *wp, int do_buffer) for (i = 0; !istermoption_idx(i); i++) { - struct vimoption *p = &(options[i]); + struct mnvoption *p = &(options[i]); char_u *varp = get_varp_scope(p, OPT_LOCAL); if (p->indir != PV_NONE @@ -1081,7 +1081,7 @@ set_init_2(void) } /* - * Initialize the options, part three: After reading the .vimrc + * Initialize the options, part three: After reading the .mnvrc */ void set_init_3(void) @@ -1211,7 +1211,7 @@ set_init_3(void) options[idx_srr].def_val[VI_DEFAULT] = p_srr; } } - vim_free(p); + mnv_free(p); } #endif @@ -1337,7 +1337,7 @@ set_helplang_default(char_u *lang) if (options[idx].flags & P_ALLOCED) free_string_option(p_hlg); - p_hlg = vim_strnsave(lang, langlen); + p_hlg = mnv_strnsave(lang, langlen); if (p_hlg == NULL) p_hlg = empty_option; else @@ -1362,8 +1362,8 @@ set_helplang_default(char_u *lang) /* * 'title' and 'icon' only default to true if they have not been set or reset - * in .vimrc and we can read the old value. - * When 'title' and 'icon' have been reset in .vimrc, we won't even check if + * in .mnvrc and we can read the old value. + * When 'title' and 'icon' have been reset in .mnvrc, we won't even check if * they can be reset. This reduces startup time when using X on a remote * machine. */ @@ -1556,7 +1556,7 @@ validate_opt_idx(int opt_idx, int opt_flags, long_u flags, char **errmsg) && (opt_idx < 0 || options[opt_idx].var != VAR_WIN)) return FAIL; - // Skip all options that are window-local (used for :vimgrep). + // Skip all options that are window-local (used for :mnvgrep). if ((opt_flags & OPT_NOWIN) && opt_idx >= 0 && options[opt_idx].var == VAR_WIN) return FAIL; @@ -1602,7 +1602,7 @@ validate_opt_idx(int opt_idx, int opt_flags, long_u flags, char **errmsg) } /* - * Get the Vim/Vi default value for a string option. + * Get the MNV/Vi default value for a string option. */ static char_u * stropt_get_default_val( @@ -1614,7 +1614,7 @@ stropt_get_default_val( char_u *newval; newval = options[opt_idx].def_val[((flags & P_VI_DEF) || cp_val) - ? VI_DEFAULT : VIM_DEFAULT]; + ? VI_DEFAULT : MNV_DEFAULT]; if ((char_u **)varp == &p_bg) { // guess the value of 'background' @@ -1638,7 +1638,7 @@ stropt_get_default_val( char_u *s = option_expand(opt_idx, newval); if (s == NULL) s = newval; - newval = vim_strsave(s); + newval = mnv_strsave(s); } return newval; @@ -1664,16 +1664,16 @@ opt_backspace_nr2str( *(char_u **)varp = empty_option; break; case 1: - *(char_u **)varp = vim_strnsave((char_u *)"indent,eol", STRLEN_LITERAL("indent,eol")); + *(char_u **)varp = mnv_strnsave((char_u *)"indent,eol", STRLEN_LITERAL("indent,eol")); break; case 2: - *(char_u **)varp = vim_strnsave((char_u *)"indent,eol,start", STRLEN_LITERAL("indent,eol,start")); + *(char_u **)varp = mnv_strnsave((char_u *)"indent,eol,start", STRLEN_LITERAL("indent,eol,start")); break; case 3: - *(char_u **)varp = vim_strnsave((char_u *)"indent,eol,nostop", STRLEN_LITERAL("indent,eol,nostop")); + *(char_u **)varp = mnv_strnsave((char_u *)"indent,eol,nostop", STRLEN_LITERAL("indent,eol,nostop")); break; } - vim_free(*oldval_p); + mnv_free(*oldval_p); if (*origval_p == *oldval_p) *origval_p = *(char_u **)varp; if (*origval_l_p == *oldval_p) @@ -1685,7 +1685,7 @@ opt_backspace_nr2str( /* * Convert the 'whichwrap' option number value to a string, for backwards - * compatibility with Vim 3.0. + * compatibility with MNV 3.0. * Note: 'argp' is a pointer to a char_u pointer and is updated. */ static char_u * @@ -1757,15 +1757,15 @@ stropt_copy_value( // are not removed, and keep backslash at start, for "\\machine\path", // but do remove it for "\\\\machine\\path". // The reverse is found in escape_option_str_cmdline(). - while (*arg != NUL && !VIM_ISWHITE(*arg)) + while (*arg != NUL && !MNV_ISWHITE(*arg)) { int i; if (*arg == '\\' && arg[1] != NUL #ifdef BACKSLASH_IN_FILENAME && !((flags & P_EXPAND) - && vim_isfilec(arg[1]) - && !VIM_ISWHITE(arg[1]) + && mnv_isfilec(arg[1]) + && !MNV_ISWHITE(arg[1]) && (arg[1] != '\\' || (s == newval && arg[2] != '\\'))) #endif @@ -1801,7 +1801,7 @@ stropt_expand_envvar( if (s == NULL) return newval; - vim_free(newval); + mnv_free(newval); unsigned newlen = (unsigned)STRLEN(s) + 1; if (op != OP_NONE) newlen += (unsigned)STRLEN(origval) + 1; @@ -1905,7 +1905,7 @@ find_key_item(char_u *src, char_u *key, int keylen, int *itemlenp) && STRNCMP(p, key, keylen) == 0) { // Find the end of this item - char_u *end = vim_strchr(p, ','); + char_u *end = mnv_strchr(p, ','); if (end == NULL) end = p + STRLEN(p); *itemlenp = (int)(end - p); @@ -2025,11 +2025,11 @@ stropt_handle_keymatch( // Check if newval contains any "key:value" item or multiple // comma-separated items. If neither, let the caller use the existing // code path. - if (vim_strchr(newval, ':') == NULL && vim_strchr(newval, ',') == NULL) + if (mnv_strchr(newval, ':') == NULL && mnv_strchr(newval, ',') == NULL) return false; // Work on a copy of newval for iteration. - char_u *newval_copy = vim_strsave(newval); + char_u *newval_copy = mnv_strsave(newval); if (newval_copy == NULL) return false; @@ -2041,13 +2041,13 @@ stropt_handle_keymatch( item_start = newval_copy; for (;;) { - p = vim_strchr(item_start, ','); + p = mnv_strchr(item_start, ','); int item_len = (p == NULL) ? (int)STRLEN(item_start) : (int)(p - item_start); if (item_len > 0) { - char_u *colon = vim_strchr(item_start, ':'); + char_u *colon = mnv_strchr(item_start, ':'); if (colon != NULL && colon < item_start + item_len) { int keylen = (int)(colon - item_start) + 1; @@ -2123,7 +2123,7 @@ stropt_handle_keymatch( item_start = p + 1; } - vim_free(newval_copy); + mnv_free(newval_copy); return true; } @@ -2142,7 +2142,7 @@ stropt_remove_dupflags(char_u *newval, int flags) // if options have P_FLAGLIST and P_ONECOMMA such as 'whichwrap' if (flags & P_ONECOMMA) { - if (*s != ',' && *(s + 1) == ',' && vim_strchr(s + 2, *s) != NULL) + if (*s != ',' && *(s + 1) == ',' && mnv_strchr(s + 2, *s) != NULL) { // Remove the duplicated value and the next comma. STRMOVE(s, s + 2); @@ -2152,7 +2152,7 @@ stropt_remove_dupflags(char_u *newval, int flags) else { if ((!(flags & P_COMMA) || *s != ',') - && vim_strchr(s + 1, *s) != NULL) + && mnv_strchr(s + 1, *s) != NULL) { STRMOVE(s, s + 1); continue; @@ -2198,7 +2198,7 @@ stropt_get_newval( if (nextchar == '&') // set to default val newval = stropt_get_default_val(opt_idx, varp, flags, cp_val); else if (nextchar == '<') // set to global val - newval = vim_strsave(*(char_u **)get_varp_scope( + newval = mnv_strsave(*(char_u **)get_varp_scope( &(options[opt_idx]), OPT_GLOBAL)); else { @@ -2212,13 +2212,13 @@ stropt_get_newval( arg = (char_u *)":help"; } // Convert 'backspace' number to string - else if (varp == (char_u *)&p_bs && VIM_ISDIGIT(**(char_u **)varp)) + else if (varp == (char_u *)&p_bs && MNV_ISDIGIT(**(char_u **)varp)) opt_backspace_nr2str(varp, &origval, &origval_l, &origval_g, &oldval); - else if (varp == (char_u *)&p_ww && VIM_ISDIGIT(*arg)) + else if (varp == (char_u *)&p_ww && MNV_ISDIGIT(*arg)) { // Convert 'whichwrap' number to string, for backwards - // compatibility with Vim 3.0. + // compatibility with MNV 3.0. char_u *t = opt_whichwrap_nr2str(&arg, whichwrap); save_arg = arg; arg = t; @@ -2381,14 +2381,14 @@ do_set_option_string( && origval != NULL && newval != NULL) { // origval may be freed by did_set_string_option(), make a copy. - saved_origval = vim_strsave(origval); + saved_origval = mnv_strsave(origval); // newval (and varp) may become invalid if the buffer is closed by // autocommands. - saved_newval = vim_strsave(newval); + saved_newval = mnv_strsave(newval); if (origval_l != NULL) - saved_origval_l = vim_strsave(origval_l); + saved_origval_l = mnv_strsave(origval_l); if (origval_g != NULL) - saved_origval_g = vim_strsave(origval_g); + saved_origval_g = mnv_strsave(origval_g); } #endif @@ -2421,10 +2421,10 @@ do_set_option_string( if (*errmsg == NULL) trigger_optionset_string(opt_idx, opt_flags, saved_origval, saved_origval_l, saved_origval_g, saved_newval); - vim_free(saved_origval); - vim_free(saved_origval_l); - vim_free(saved_origval_g); - vim_free(saved_newval); + mnv_free(saved_origval); + mnv_free(saved_origval_l); + mnv_free(saved_origval_g); + mnv_free(saved_newval); #endif *argp = arg; @@ -2461,7 +2461,7 @@ do_set_option_bool( value = *(int *)(varp) ^ 1; else if (nextchar == '&') value = (int)(long)(long_i)options[opt_idx].def_val[ - ((flags & P_VI_DEF) || cp_val) ? VI_DEFAULT : VIM_DEFAULT]; + ((flags & P_VI_DEF) || cp_val) ? VI_DEFAULT : MNV_DEFAULT]; else if (nextchar == '<') { // For 'autoread' -1 means to use global value. @@ -2480,7 +2480,7 @@ do_set_option_bool( { // ":set invopt": invert // ":set opt" or ":set noopt": set or reset - if (nextchar != NUL && !VIM_ISWHITE(afterchar)) + if (nextchar != NUL && !MNV_ISWHITE(afterchar)) return e_trailing_characters; if (prefix == PREFIX_INV) value = *(int *)(varp) ^ 1; @@ -2529,7 +2529,7 @@ do_set_option_numeric( ++arg; if (nextchar == '&') value = (long)(long_i)options[opt_idx].def_val[ - ((flags & P_VI_DEF) || cp_val) ? VI_DEFAULT : VIM_DEFAULT]; + ((flags & P_VI_DEF) || cp_val) ? VI_DEFAULT : MNV_DEFAULT]; else if (nextchar == '<') { if ((long *)varp == &curbuf->b_p_ul && opt_flags == OPT_LOCAL) @@ -2547,8 +2547,8 @@ do_set_option_numeric( && (*arg == '<' || *arg == '^' || (*arg != NUL - && (!arg[1] || VIM_ISWHITE(arg[1])) - && !VIM_ISDIGIT(*arg)))) + && (!arg[1] || MNV_ISWHITE(arg[1])) + && !MNV_ISDIGIT(*arg)))) { value = string_to_key(arg, FALSE); if (value == 0) @@ -2557,11 +2557,11 @@ do_set_option_numeric( goto skip; } } - else if (*arg == '-' || VIM_ISDIGIT(*arg)) + else if (*arg == '-' || MNV_ISDIGIT(*arg)) { // Allow negative (for 'undolevels'), octal and hex numbers. - vim_str2nr(arg, NULL, &i, STR2NR_ALL, &value, NULL, 0, TRUE, NULL); - if (i == 0 || (arg[i] != NUL && !VIM_ISWHITE(arg[i]))) + mnv_str2nr(arg, NULL, &i, STR2NR_ALL, &value, NULL, 0, TRUE, NULL); + if (i == 0 || (arg[i] != NUL && !MNV_ISWHITE(arg[i]))) { errmsg = e_number_required_after_equal; goto skip; @@ -2605,7 +2605,7 @@ do_set_option_keycode(char_u **argp, char_u *key_name, int nextchar) else { ++arg; // jump to after the '=' or ':' - for (p = arg; *p && !VIM_ISWHITE(*p); ++p) + for (p = arg; *p && !MNV_ISWHITE(*p); ++p) if (*p == '\\' && p[1] != NUL) ++p; nextchar = *p; @@ -2656,7 +2656,7 @@ do_set_option_value( else { // numeric or string option - if (vim_strchr((char_u *)"=:&<", nextchar) == NULL + if (mnv_strchr((char_u *)"=:&<", nextchar) == NULL || prefix != PREFIX_NONE) { errmsg = e_invalid_argument; @@ -2742,13 +2742,13 @@ do_set_option( // remember character after option name afterchar = arg[len]; - if (in_vim9script()) + if (in_mnv9script()) { char_u *p = skipwhite(arg + len); // disallow white space before =val, +=val, -=val, ^=val if (p > arg + len && (p[0] == '=' - || (vim_strchr((char_u *)"+-^", p[0]) != NULL + || (mnv_strchr((char_u *)"+-^", p[0]) != NULL && p[1] == '='))) { errmsg = e_no_white_space_allowed_between_option_and; @@ -2759,7 +2759,7 @@ do_set_option( } else // skip white space, allow ":set ai ?", ":set hlsearch !" - while (VIM_ISWHITE(arg[len])) + while (MNV_ISWHITE(arg[len])) ++len; op = get_opt_op(arg + len); @@ -2770,8 +2770,8 @@ do_set_option( if (opt_idx == -1 && key == 0) // found a mismatch: skip { - if (in_vim9script() && arg > arg_start - && vim_strchr((char_u *)"!&<", *arg) != NULL) + if (in_mnv9script() && arg > arg_start + && mnv_strchr((char_u *)"!&<", *arg) != NULL) errmsg = e_no_white_space_allowed_between_option_and; else errmsg = e_unknown_option; @@ -2784,7 +2784,7 @@ do_set_option( { // Only give an error message when requesting the value of // a hidden option, ignore setting it. - if (vim_strchr((char_u *)"=:!&<", nextchar) == NULL + if (mnv_strchr((char_u *)"=:!&<", nextchar) == NULL && (!(options[opt_idx].flags & P_BOOL) || nextchar == '?')) errmsg = e_option_not_supported; @@ -2815,24 +2815,24 @@ do_set_option( goto skip; int cp_val = p_cp; - if (vim_strchr((char_u *)"?=:!&<", nextchar) != NULL) + if (mnv_strchr((char_u *)"?=:!&<", nextchar) != NULL) { arg += len; - if (nextchar == '&' && arg[1] == 'v' && arg[2] == 'i') + if (nextchar == '&' && arg[1] == 'm' && arg[2] == 'n' + && arg[3] == 'v') { - if (arg[3] == 'm') // "opt&vim": set to Vim default - { - cp_val = FALSE; - arg += 3; - } - else // "opt&vi": set to Vi default - { - cp_val = TRUE; - arg += 2; - } + // "opt&mnv": set to MNV default + cp_val = FALSE; + arg += 3; + } + else if (nextchar == '&' && arg[1] == 'v' && arg[2] == 'i') + { + // "opt&vi": set to Vi default + cp_val = TRUE; + arg += 2; } - if (vim_strchr((char_u *)"?!&<", nextchar) != NULL - && arg[1] != NUL && !VIM_ISWHITE(arg[1])) + if (mnv_strchr((char_u *)"?!&<", nextchar) != NULL + && arg[1] != NUL && !MNV_ISWHITE(arg[1])) { errmsg = e_trailing_characters; goto skip; @@ -2843,7 +2843,7 @@ do_set_option( // Allows only one '=' character per "set" command line. grrr. (jw) if (nextchar == '?' || (prefix == PREFIX_NONE - && vim_strchr((char_u *)"=:&<", nextchar) == NULL + && mnv_strchr((char_u *)"=:&<", nextchar) == NULL && !(flags & P_BOOL))) { // print value @@ -2886,7 +2886,7 @@ do_set_option( (void)show_one_termcode(key_name, p, TRUE); } if (nextchar != '?' - && nextchar != NUL && !VIM_ISWHITE(afterchar)) + && nextchar != NUL && !MNV_ISWHITE(afterchar)) errmsg = e_trailing_characters; } else @@ -2983,7 +2983,7 @@ do_set( // - skip one "=val" argument (for hidden options ":set gfn =xx") for (i = 0; i < 2 ; ++i) { - while (*arg != NUL && !VIM_ISWHITE(*arg)) + while (*arg != NUL && !MNV_ISWHITE(*arg)) if (*arg++ == '\\' && *arg != NUL) ++arg; arg = skipwhite(arg); @@ -2993,7 +2993,7 @@ do_set( if (errmsg != NULL) { - i = vim_snprintf((char *)IObuff, IOSIZE, "%s", (char_u *)_(errmsg)) + 2; + i = mnv_snprintf((char *)IObuff, IOSIZE, "%s", (char_u *)_(errmsg)) + 2; if (i + (arg - startarg) < IOSIZE) { // append the argument with the error @@ -3273,9 +3273,9 @@ didset_options2(void) (void)did_set_clipboard(NULL); #endif #ifdef FEAT_VARTABS - vim_free(curbuf->b_p_vsts_array); + mnv_free(curbuf->b_p_vsts_array); (void)tabstop_set(curbuf->b_p_vsts, &curbuf->b_p_vsts_array); - vim_free(curbuf->b_p_vts_array); + mnv_free(curbuf->b_p_vts_array); (void)tabstop_set(curbuf->b_p_vts, &curbuf->b_p_vts_array); #endif } @@ -3413,7 +3413,7 @@ valid_name(char_u *val, char *allowed) char_u *s; for (s = val; *s != NUL; ++s) - if (!ASCII_ISALNUM(*s) && vim_strchr((char_u *)allowed, *s) == NULL) + if (!ASCII_ISALNUM(*s) && mnv_strchr((char_u *)allowed, *s) == NULL) return FALSE; return TRUE; } @@ -3513,44 +3513,44 @@ apply_optionset_autocmd( size_t len; // Don't do this while starting up, failure or recursively. - if (starting || errmsg != NULL || *get_vim_var_str(VV_OPTION_TYPE) != NUL) + if (starting || errmsg != NULL || *get_mnv_var_str(VV_OPTION_TYPE) != NUL) return; - len = vim_snprintf_safelen((char *)buf_new, sizeof(buf_new), "%ld", newval); - set_vim_var_string(VV_OPTION_NEW, buf_new, (int)len); - len = vim_snprintf_safelen((char *)buf_type, sizeof(buf_type), "%s", + len = mnv_snprintf_safelen((char *)buf_new, sizeof(buf_new), "%ld", newval); + set_mnv_var_string(VV_OPTION_NEW, buf_new, (int)len); + len = mnv_snprintf_safelen((char *)buf_type, sizeof(buf_type), "%s", (opt_flags & OPT_LOCAL) ? "local" : "global"); - set_vim_var_string(VV_OPTION_TYPE, buf_type, (int)len); + set_mnv_var_string(VV_OPTION_TYPE, buf_type, (int)len); - buf_oldlen = vim_snprintf_safelen((char *)buf_old, sizeof(buf_old), "%ld", oldval); - set_vim_var_string(VV_OPTION_OLD, buf_old, (int)buf_oldlen); + buf_oldlen = mnv_snprintf_safelen((char *)buf_old, sizeof(buf_old), "%ld", oldval); + set_mnv_var_string(VV_OPTION_OLD, buf_old, (int)buf_oldlen); if (opt_flags & OPT_LOCAL) { - set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setlocal", STRLEN_LITERAL("setlocal")); - set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, (int)buf_oldlen); + set_mnv_var_string(VV_OPTION_COMMAND, (char_u *)"setlocal", STRLEN_LITERAL("setlocal")); + set_mnv_var_string(VV_OPTION_OLDLOCAL, buf_old, (int)buf_oldlen); } if (opt_flags & OPT_GLOBAL) { - set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setglobal", STRLEN_LITERAL("setglobal")); - set_vim_var_string(VV_OPTION_OLDGLOBAL, buf_old, (int)buf_oldlen); + set_mnv_var_string(VV_OPTION_COMMAND, (char_u *)"setglobal", STRLEN_LITERAL("setglobal")); + set_mnv_var_string(VV_OPTION_OLDGLOBAL, buf_old, (int)buf_oldlen); } if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) { char_u buf_old_global[12]; size_t buf_old_globallen; - buf_old_globallen = vim_snprintf_safelen((char *)buf_old_global, + buf_old_globallen = mnv_snprintf_safelen((char *)buf_old_global, sizeof(buf_old_global), "%ld", oldval_g); - set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"set", STRLEN_LITERAL("set")); - set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, (int)buf_oldlen); - set_vim_var_string(VV_OPTION_OLDGLOBAL, buf_old_global, (int)buf_old_globallen); + set_mnv_var_string(VV_OPTION_COMMAND, (char_u *)"set", STRLEN_LITERAL("set")); + set_mnv_var_string(VV_OPTION_OLDLOCAL, buf_old, (int)buf_oldlen); + set_mnv_var_string(VV_OPTION_OLDGLOBAL, buf_old_global, (int)buf_old_globallen); } if (opt_flags & OPT_MODELINE) { - set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"modeline", STRLEN_LITERAL("modeline")); - set_vim_var_string(VV_OPTION_OLDLOCAL, buf_old, (int)buf_oldlen); + set_mnv_var_string(VV_OPTION_COMMAND, (char_u *)"modeline", STRLEN_LITERAL("modeline")); + set_mnv_var_string(VV_OPTION_OLDLOCAL, buf_old, (int)buf_oldlen); } apply_autocmds(EVENT_OPTIONSET, (char_u *)options[opt_idx].fullname, NULL, FALSE, NULL); @@ -3596,7 +3596,7 @@ did_set_arabic(optset_T *args UNUSED) msg_source(HL_ATTR(HLF_W)); msg_attr(_(w_arabic), HL_ATTR(HLF_W)); # ifdef FEAT_EVAL - set_vim_var_string(VV_WARNINGMSG, (char_u *)_(w_arabic), -1); + set_mnv_var_string(VV_WARNINGMSG, (char_u *)_(w_arabic), -1); # endif } @@ -4061,7 +4061,7 @@ did_set_laststatus(optset_T *args UNUSED) char * did_set_linespace(optset_T *args UNUSED) { - // Recompute gui.char_height and resize the Vim window to keep the + // Recompute gui.char_height and resize the MNV window to keep the // same number of lines. if (gui.in_use && gui_mch_adjust_charheight() == OK) gui_set_shellsize(FALSE, FALSE, RESIZE_VERT); @@ -4250,10 +4250,10 @@ did_set_paste(optset_T *args UNUSED) buf->b_p_et_nopaste = buf->b_p_et; #ifdef FEAT_VARTABS if (buf->b_p_vsts_nopaste) - vim_free(buf->b_p_vsts_nopaste); + mnv_free(buf->b_p_vsts_nopaste); buf->b_p_vsts_nopaste = buf->b_p_vsts && buf->b_p_vsts != empty_option - ? vim_strsave(buf->b_p_vsts) : NULL; + ? mnv_strsave(buf->b_p_vsts) : NULL; #endif } @@ -4273,9 +4273,9 @@ did_set_paste(optset_T *args UNUSED) p_wm_nopaste = p_wm; #ifdef FEAT_VARTABS if (p_vsts_nopaste) - vim_free(p_vsts_nopaste); + mnv_free(p_vsts_nopaste); p_vsts_nopaste = p_vsts && p_vsts != empty_option - ? vim_strsave(p_vsts) : NULL; + ? mnv_strsave(p_vsts) : NULL; #endif } @@ -4292,7 +4292,7 @@ did_set_paste(optset_T *args UNUSED) if (buf->b_p_vsts) free_string_option(buf->b_p_vsts); buf->b_p_vsts = empty_option; - VIM_CLEAR(buf->b_p_vsts_array); + MNV_CLEAR(buf->b_p_vsts_array); #endif } @@ -4334,8 +4334,8 @@ did_set_paste(optset_T *args UNUSED) if (buf->b_p_vsts) free_string_option(buf->b_p_vsts); buf->b_p_vsts = buf->b_p_vsts_nopaste - ? vim_strsave(buf->b_p_vsts_nopaste) : empty_option; - vim_free(buf->b_p_vsts_array); + ? mnv_strsave(buf->b_p_vsts_nopaste) : empty_option; + mnv_free(buf->b_p_vsts_array); if (buf->b_p_vsts && buf->b_p_vsts != empty_option) (void)tabstop_set(buf->b_p_vsts, &buf->b_p_vsts_array); else @@ -4362,7 +4362,7 @@ did_set_paste(optset_T *args UNUSED) #ifdef FEAT_VARTABS if (p_vsts) free_string_option(p_vsts); - p_vsts = p_vsts_nopaste ? vim_strsave(p_vsts_nopaste) : empty_option; + p_vsts = p_vsts_nopaste ? mnv_strsave(p_vsts_nopaste) : empty_option; #endif } @@ -4631,7 +4631,7 @@ did_set_termguicolors(optset_T *args UNUSED) # ifdef FEAT_VTP // Do not turn on 'tgc' when 24-bit colors are not supported. if ( -# ifdef VIMDLL +# ifdef MNVDLL !gui.in_use && !gui.starting && # endif !has_vtp_working()) @@ -4704,7 +4704,7 @@ did_set_terse(optset_T *args UNUSED) char_u *p; // when 'terse' is set change 'shortmess' - p = vim_strchr(p_shm, SHM_SEARCH); + p = mnv_strchr(p_shm, SHM_SEARCH); // insert 's' in p_shm if (p_terse && p == NULL) @@ -4727,7 +4727,7 @@ did_set_textauto(optset_T *args) { // when 'textauto' is set or reset also change 'fileformats' set_string_option_direct((char_u *)"ffs", -1, - p_ta ? (char_u *)DFLT_FFS_VIM : (char_u *)"", + p_ta ? (char_u *)DFLT_FFS_MNV : (char_u *)"", OPT_FREE | args->os_flags, 0); return NULL; @@ -5256,7 +5256,7 @@ check_num_option_bounds( { if (errbuf != NULL) { - vim_snprintf(errbuf, errbuflen, + mnv_snprintf(errbuf, errbuflen, _(e_need_at_least_nr_lines), min_rows_for_all_tabpages()); errmsg = errbuf; } @@ -5266,7 +5266,7 @@ check_num_option_bounds( { if (errbuf != NULL) { - vim_snprintf(errbuf, errbuflen, + mnv_snprintf(errbuf, errbuflen, _(e_need_at_least_nr_columns), MIN_COLUMNS); errmsg = errbuf; } @@ -5551,8 +5551,7 @@ findoption(char_u *arg) s = NULL; if (s == NULL && !is_term_opt) { - opt_idx = quick_tab[CharOrdLow(arg[0])]; - for ( ; options[opt_idx].fullname != NULL; opt_idx++) + for (opt_idx = 0; options[opt_idx].fullname != NULL; opt_idx++) { s = options[opt_idx].shortname; if (s != NULL && STRCMP(arg, s) == 0) // match short name @@ -5621,7 +5620,7 @@ get_option_value( if (p != NULL) { if (stringval != NULL) - *stringval = vim_strsave(p); + *stringval = mnv_strsave(p); return gov_string; } } @@ -5647,10 +5646,10 @@ get_option_value( // never return the value of the crypt key else if ((char_u **)varp == &curbuf->b_p_key && **(char_u **)(varp) != NUL) - *stringval = vim_strnsave((char_u *)"*****", STRLEN_LITERAL("*****")); + *stringval = mnv_strnsave((char_u *)"*****", STRLEN_LITERAL("*****")); # endif else - *stringval = vim_strsave(*(char_u **)(varp)); + *stringval = mnv_strsave(*(char_u **)(varp)); } return gov_string; } @@ -5687,10 +5686,10 @@ get_option_value( * * Returned flags: * 0 hidden or unknown option, also option that does not have requested - * type (see SREQ_* in vim.h) - * see SOPT_* in vim.h for other flags + * type (see SREQ_* in mnv.h) + * see SOPT_* in mnv.h for other flags * - * Possible opt_type values: see SREQ_* in vim.h + * Possible opt_type values: see SREQ_* in mnv.h */ int get_option_value_strict( @@ -5702,7 +5701,7 @@ get_option_value_strict( { int opt_idx; char_u *varp = NULL; - struct vimoption *p; + struct mnvoption *p; int r = 0; opt_idx = findoption(name); @@ -5805,7 +5804,7 @@ get_option_value_strict( if (varp != NULL) { if (p->flags & P_STRING) - *stringval = vim_strsave(*(char_u **)(varp)); + *stringval = mnv_strsave(*(char_u **)(varp)); else if (p->flags & P_NUM) *numval = *(long *) varp; else @@ -5830,20 +5829,20 @@ get_option_value_strict( char_u * option_iter_next(void **option, int opt_type) { - struct vimoption *ret = NULL; + struct mnvoption *ret = NULL; do { if (*option == NULL) *option = (void *) options; - else if (((struct vimoption *) (*option))->fullname == NULL) + else if (((struct mnvoption *) (*option))->fullname == NULL) { *option = NULL; return NULL; } else - *option = (void *) (((struct vimoption *) (*option)) + 1); + *option = (void *) (((struct mnvoption *) (*option)) + 1); - ret = ((struct vimoption *) (*option)); + ret = ((struct mnvoption *) (*option)); // Hidden option if (ret->var == NULL) @@ -6152,11 +6151,11 @@ showoptions( int all, int opt_flags) // OPT_LOCAL and/or OPT_GLOBAL { - struct vimoption *p; + struct mnvoption *p; int col; int isterm; char_u *varp; - struct vimoption **items; + struct mnvoption **items; int item_count; int run; int row, rows; @@ -6167,7 +6166,7 @@ showoptions( #define INC 20 #define GAP 3 - items = ALLOC_MULT(struct vimoption *, OPTION_COUNT); + items = ALLOC_MULT(struct mnvoption *, OPTION_COUNT); if (items == NULL) return; @@ -6216,7 +6215,7 @@ showoptions( else { option_value2string(p, opt_flags); - len = (int)STRLEN(p->fullname) + vim_strsize(NameBuff) + 1; + len = (int)STRLEN(p->fullname) + mnv_strsize(NameBuff) + 1; } if ((len <= INC - GAP && run == 1) || (len > INC - GAP && run == 2)) @@ -6250,20 +6249,20 @@ showoptions( ui_breakcheck(); } } - vim_free(items); + mnv_free(items); } /* * Return TRUE if option "p" has its default value. */ static int -optval_default(struct vimoption *p, char_u *varp, int compatible) +optval_default(struct mnvoption *p, char_u *varp, int compatible) { int dvi; if (varp == NULL) return TRUE; // hidden option is always at default - dvi = ((p->flags & P_VI_DEF) || compatible) ? VI_DEFAULT : VIM_DEFAULT; + dvi = ((p->flags & P_VI_DEF) || compatible) ? VI_DEFAULT : MNV_DEFAULT; if (p->flags & P_NUM) return (*(long *)varp == (long)(long_i)p->def_val[dvi]); if (p->flags & P_BOOL) @@ -6280,7 +6279,7 @@ optval_default(struct vimoption *p, char_u *varp, int compatible) */ static void showoneopt( - struct vimoption *p, + struct mnvoption *p, int opt_flags) // OPT_LOCAL or OPT_GLOBAL { char_u *varp; @@ -6320,7 +6319,7 @@ showoneopt( * buffer-local options (used for start of a session * file). * OPT_GLOBAL + OPT_LOCAL: Idem, add fresh values of window-local options for - * curwin (used for a vimrc file). + * curwin (used for a mnvrc file). * OPT_LOCAL: Write buffer-local option values for curbuf, fresh * and local values for window-local options of * curwin. Local values are also written when at the @@ -6337,7 +6336,7 @@ showoneopt( int makeset(FILE *fd, int opt_flags, int local_only) { - struct vimoption *p; + struct mnvoption *p; char_u *varp; // currently used value char_u *varp_fresh; // local value char_u *varp_local = NULL; // fresh value @@ -6362,7 +6361,7 @@ makeset(FILE *fd, int opt_flags, int local_only) if (p->indir == PV_NONE && !(opt_flags & OPT_GLOBAL)) continue; - // Do not store options like 'bufhidden' and 'syntax' in a vimrc + // Do not store options like 'bufhidden' and 'syntax' in a mnvrc // file, they are always buffer-specific. if ((opt_flags & OPT_GLOBAL) && (p->flags & P_NOGLOB)) continue; @@ -6521,7 +6520,7 @@ put_setstring( // each comma separated part of the option separately, so that it // can be expanded when read back. if (size >= MAXPATHL && (flags & P_COMMA) != 0 - && vim_strchr(*valuep, ',') != NULL) + && mnv_strchr(*valuep, ',') != NULL) { part = alloc(size); if (part == NULL) @@ -6542,16 +6541,16 @@ put_setstring( if (put_escstr(fd, part, 2) == FAIL || put_eol(fd) == FAIL) goto fail; } - vim_free(buf); - vim_free(part); + mnv_free(buf); + mnv_free(part); return OK; } if (put_escstr(fd, buf, 2) == FAIL) { - vim_free(buf); + mnv_free(buf); return FAIL; } - vim_free(buf); + mnv_free(buf); } else if (put_escstr(fd, *valuep, 2) == FAIL) return FAIL; @@ -6560,8 +6559,8 @@ put_setstring( return FAIL; return OK; fail: - vim_free(buf); - vim_free(part); + mnv_free(buf); + mnv_free(part); return FAIL; } @@ -6631,7 +6630,7 @@ clear_termoptions(void) void free_termoptions(void) { - struct vimoption *p; + struct mnvoption *p; for (p = options; p->fullname != NULL; p++) if (istermoption(p)) @@ -6659,7 +6658,7 @@ free_termoptions(void) void free_one_termoption(char_u *var) { - struct vimoption *p; + struct mnvoption *p; for (p = &options[0]; p->fullname != NULL; p++) if (p->var == var) @@ -6679,7 +6678,7 @@ free_one_termoption(char_u *var) void set_term_defaults(void) { - struct vimoption *p; + struct mnvoption *p; for (p = &options[0]; p->fullname != NULL; p++) { @@ -6704,7 +6703,7 @@ set_term_defaults(void) * return TRUE if 'p' starts with 't_' */ static int -istermoption(struct vimoption *p) +istermoption(struct mnvoption *p) { return (p->fullname[0] == 't' && p->fullname[1] == '_'); } @@ -6725,7 +6724,7 @@ istermoption_idx(int opt_idx) void unset_global_local_option(char_u *name, void *from) { - struct vimoption *p; + struct mnvoption *p; int opt_idx; buf_T *buf = (buf_T *)from; @@ -6881,7 +6880,7 @@ unset_global_local_option(char_u *name, void *from) * "scope" can be OPT_LOCAL, OPT_GLOBAL or a combination. */ static char_u * -get_varp_scope(struct vimoption *p, int scope) +get_varp_scope(struct mnvoption *p, int scope) { if ((scope & OPT_GLOBAL) && p->indir != PV_NONE) { @@ -6969,7 +6968,7 @@ get_option_varp_scope(int opt_idx, int scope) * Get pointer to option variable. */ static char_u * -get_varp(struct vimoption *p) +get_varp(struct mnvoption *p) { // hidden option, always return NULL if (p->var == NULL) @@ -7346,7 +7345,7 @@ copy_option_val(char_u *val) { if (val == empty_option) return empty_option; // no need to allocate memory - return vim_strsave(val); + return mnv_strsave(val); } /* @@ -7434,7 +7433,7 @@ copy_winopt(winopt_T *from, winopt_T *to) to->wo_fdl_save = from->wo_fdl_save; to->wo_fdm = copy_option_val(from->wo_fdm); to->wo_fdm_save = from->wo_diff_saved - ? vim_strsave(from->wo_fdm_save) : empty_option; + ? mnv_strsave(from->wo_fdm_save) : empty_option; to->wo_fdn = from->wo_fdn; # ifdef FEAT_EVAL to->wo_fde = copy_option_val(from->wo_fde); @@ -7637,10 +7636,10 @@ buf_copy_options(buf_T *buf, int flags) * X no no no TRUE * no yes no X TRUE */ - if ((vim_strchr(p_cpo, CPO_BUFOPTGLOB) == NULL || !(flags & BCO_ENTER)) + if ((mnv_strchr(p_cpo, CPO_BUFOPTGLOB) == NULL || !(flags & BCO_ENTER)) && (buf->b_p_initialized || (!(flags & BCO_ENTER) - && vim_strchr(p_cpo, CPO_BUFOPT) != NULL))) + && mnv_strchr(p_cpo, CPO_BUFOPT) != NULL))) should_copy = FALSE; if (should_copy || (flags & BCO_ALWAYS)) @@ -7666,17 +7665,17 @@ buf_copy_options(buf_T *buf, int flags) free_buf_options(buf, TRUE); buf->b_p_ro = FALSE; // don't copy readonly buf->b_p_tx = p_tx; - buf->b_p_fenc = vim_strsave(p_fenc); + buf->b_p_fenc = mnv_strsave(p_fenc); switch (*p_ffs) { case 'm': - buf->b_p_ff = vim_strsave((char_u *)FF_MAC); break; + buf->b_p_ff = mnv_strsave((char_u *)FF_MAC); break; case 'd': - buf->b_p_ff = vim_strsave((char_u *)FF_DOS); break; + buf->b_p_ff = mnv_strsave((char_u *)FF_DOS); break; case 'u': - buf->b_p_ff = vim_strsave((char_u *)FF_UNIX); break; + buf->b_p_ff = mnv_strsave((char_u *)FF_UNIX); break; default: - buf->b_p_ff = vim_strsave(p_ff); + buf->b_p_ff = mnv_strsave(p_ff); } if (buf->b_p_ff != NULL) buf->b_start_ffc = *buf->b_p_ff; @@ -7721,25 +7720,25 @@ buf_copy_options(buf_T *buf, int flags) buf->b_p_swf = p_swf; COPY_OPT_SCTX(buf, BV_SWF); } - buf->b_p_cpt = vim_strsave(p_cpt); + buf->b_p_cpt = mnv_strsave(p_cpt); COPY_OPT_SCTX(buf, BV_CPT); #ifdef FEAT_COMPL_FUNC set_buflocal_cpt_callbacks(buf); #endif #ifdef BACKSLASH_IN_FILENAME - buf->b_p_csl = vim_strsave(p_csl); + buf->b_p_csl = mnv_strsave(p_csl); COPY_OPT_SCTX(buf, BV_CSL); #endif #ifdef FEAT_COMPL_FUNC - buf->b_p_cfu = vim_strsave(p_cfu); + buf->b_p_cfu = mnv_strsave(p_cfu); COPY_OPT_SCTX(buf, BV_CFU); set_buflocal_cfu_callback(buf); - buf->b_p_ofu = vim_strsave(p_ofu); + buf->b_p_ofu = mnv_strsave(p_ofu); COPY_OPT_SCTX(buf, BV_OFU); set_buflocal_ofu_callback(buf); #endif #ifdef FEAT_EVAL - buf->b_p_tfu = vim_strsave(p_tfu); + buf->b_p_tfu = mnv_strsave(p_tfu); COPY_OPT_SCTX(buf, BV_TFU); set_buflocal_tfu_callback(buf); #endif @@ -7747,30 +7746,30 @@ buf_copy_options(buf_T *buf, int flags) COPY_OPT_SCTX(buf, BV_STS); buf->b_p_sts_nopaste = p_sts_nopaste; #ifdef FEAT_VARTABS - buf->b_p_vsts = vim_strsave(p_vsts); + buf->b_p_vsts = mnv_strsave(p_vsts); COPY_OPT_SCTX(buf, BV_VSTS); if (p_vsts && p_vsts != empty_option) (void)tabstop_set(p_vsts, &buf->b_p_vsts_array); else buf->b_p_vsts_array = NULL; buf->b_p_vsts_nopaste = p_vsts_nopaste - ? vim_strsave(p_vsts_nopaste) : NULL; + ? mnv_strsave(p_vsts_nopaste) : NULL; #endif buf->b_p_sn = p_sn; COPY_OPT_SCTX(buf, BV_SN); - buf->b_p_com = vim_strsave(p_com); + buf->b_p_com = mnv_strsave(p_com); COPY_OPT_SCTX(buf, BV_COM); - buf->b_p_cms = vim_strsave(p_cms); + buf->b_p_cms = mnv_strsave(p_cms); COPY_OPT_SCTX(buf, BV_CMS); - buf->b_p_fo = vim_strsave(p_fo); + buf->b_p_fo = mnv_strsave(p_fo); COPY_OPT_SCTX(buf, BV_FO); - buf->b_p_flp = vim_strsave(p_flp); + buf->b_p_flp = mnv_strsave(p_flp); COPY_OPT_SCTX(buf, BV_FLP); // NOTE: Valgrind may report a bogus memory leak for 'nrformats' - // when it is set to 8 bytes in defaults.vim. - buf->b_p_nf = vim_strsave(p_nf); + // when it is set to 8 bytes in defaults.mnv. + buf->b_p_nf = mnv_strsave(p_nf); COPY_OPT_SCTX(buf, BV_NF); - buf->b_p_mps = vim_strsave(p_mps); + buf->b_p_mps = mnv_strsave(p_mps); COPY_OPT_SCTX(buf, BV_MPS); buf->b_p_si = p_si; COPY_OPT_SCTX(buf, BV_SI); @@ -7779,20 +7778,20 @@ buf_copy_options(buf_T *buf, int flags) buf->b_p_cin = p_cin; COPY_OPT_SCTX(buf, BV_CIN); - buf->b_p_cink = vim_strsave(p_cink); + buf->b_p_cink = mnv_strsave(p_cink); COPY_OPT_SCTX(buf, BV_CINK); - buf->b_p_cino = vim_strsave(p_cino); + buf->b_p_cino = mnv_strsave(p_cino); COPY_OPT_SCTX(buf, BV_CINO); - buf->b_p_cinsd = vim_strsave(p_cinsd); + buf->b_p_cinsd = mnv_strsave(p_cinsd); COPY_OPT_SCTX(buf, BV_CINSD); - buf->b_p_lop = vim_strsave(p_lop); + buf->b_p_lop = mnv_strsave(p_lop); COPY_OPT_SCTX(buf, BV_LOP); // Don't copy 'filetype', it must be detected buf->b_p_ft = empty_option; buf->b_p_pi = p_pi; COPY_OPT_SCTX(buf, BV_PI); - buf->b_p_cinw = vim_strsave(p_cinw); + buf->b_p_cinw = mnv_strsave(p_cinw); COPY_OPT_SCTX(buf, BV_CINW); buf->b_p_lisp = p_lisp; COPY_OPT_SCTX(buf, BV_LISP); @@ -7804,35 +7803,35 @@ buf_copy_options(buf_T *buf, int flags) buf->b_s.b_syn_isk = empty_option; #endif #ifdef FEAT_SPELL - buf->b_s.b_p_spc = vim_strsave(p_spc); + buf->b_s.b_p_spc = mnv_strsave(p_spc); COPY_OPT_SCTX(buf, BV_SPC); (void)compile_cap_prog(&buf->b_s); - buf->b_s.b_p_spf = vim_strsave(p_spf); + buf->b_s.b_p_spf = mnv_strsave(p_spf); COPY_OPT_SCTX(buf, BV_SPF); - buf->b_s.b_p_spl = vim_strsave(p_spl); + buf->b_s.b_p_spl = mnv_strsave(p_spl); COPY_OPT_SCTX(buf, BV_SPL); - buf->b_s.b_p_spo = vim_strsave(p_spo); + buf->b_s.b_p_spo = mnv_strsave(p_spo); COPY_OPT_SCTX(buf, BV_SPO); #endif #if defined(FEAT_EVAL) - buf->b_p_inde = vim_strsave(p_inde); + buf->b_p_inde = mnv_strsave(p_inde); COPY_OPT_SCTX(buf, BV_INDE); - buf->b_p_indk = vim_strsave(p_indk); + buf->b_p_indk = mnv_strsave(p_indk); COPY_OPT_SCTX(buf, BV_INDK); #endif buf->b_p_fp = empty_option; #if defined(FEAT_EVAL) - buf->b_p_fex = vim_strsave(p_fex); + buf->b_p_fex = mnv_strsave(p_fex); COPY_OPT_SCTX(buf, BV_FEX); #endif #ifdef FEAT_CRYPT - buf->b_p_key = vim_strsave(p_key); + buf->b_p_key = mnv_strsave(p_key); COPY_OPT_SCTX(buf, BV_KEY); #endif - buf->b_p_sua = vim_strsave(p_sua); + buf->b_p_sua = mnv_strsave(p_sua); COPY_OPT_SCTX(buf, BV_SUA); #ifdef FEAT_KEYMAP - buf->b_p_keymap = vim_strsave(p_keymap); + buf->b_p_keymap = mnv_strsave(p_keymap); COPY_OPT_SCTX(buf, BV_KMAP); buf->b_kmap_state |= KEYMAP_INIT; #endif @@ -7876,7 +7875,7 @@ buf_copy_options(buf_T *buf, int flags) buf->b_p_def = empty_option; buf->b_p_inc = empty_option; # ifdef FEAT_EVAL - buf->b_p_inex = vim_strsave(p_inex); + buf->b_p_inex = mnv_strsave(p_inex); COPY_OPT_SCTX(buf, BV_INEX); # endif #endif @@ -7890,7 +7889,7 @@ buf_copy_options(buf_T *buf, int flags) #ifdef FEAT_COMPL_FUNC buf->b_p_tsrfu = empty_option; #endif - buf->b_p_qe = vim_strsave(p_qe); + buf->b_p_qe = mnv_strsave(p_qe); COPY_OPT_SCTX(buf, BV_QE); #if defined(FEAT_BEVAL) && defined(FEAT_EVAL) buf->b_p_bexpr = empty_option; @@ -7921,13 +7920,13 @@ buf_copy_options(buf_T *buf, int flags) } else { - buf->b_p_isk = vim_strsave(p_isk); + buf->b_p_isk = mnv_strsave(p_isk); COPY_OPT_SCTX(buf, BV_ISK); did_isk = TRUE; buf->b_p_ts = p_ts; COPY_OPT_SCTX(buf, BV_TS); #ifdef FEAT_VARTABS - buf->b_p_vts = vim_strsave(p_vts); + buf->b_p_vts = mnv_strsave(p_vts); COPY_OPT_SCTX(buf, BV_VTS); if (p_vts && *p_vts != NUL && !buf->b_p_vts_array) (void)tabstop_set(p_vts, &buf->b_p_vts_array); @@ -8310,10 +8309,10 @@ match_str( { if (!fuzzy) { - if (vim_regexec(regmatch, str, (colnr_T)0)) + if (mnv_regexec(regmatch, str, (colnr_T)0)) { if (!test_only) - matches[idx] = vim_strsave(str); + matches[idx] = mnv_strsave(str); return TRUE; } } @@ -8327,7 +8326,7 @@ match_str( if (!test_only) { fuzmatch[idx].idx = idx; - fuzmatch[idx].str = vim_strsave(str); + fuzmatch[idx].str = mnv_strsave(str); fuzmatch[idx].score = score; } @@ -8409,7 +8408,7 @@ ExpandSettings( count++; } else if (!fuzzy && options[opt_idx].shortname != NULL - && vim_regexec(regmatch, + && mnv_regexec(regmatch, (char_u *)options[opt_idx].shortname, (colnr_T)0)) { // Compare against the abbreviated option name (for regular @@ -8423,7 +8422,7 @@ ExpandSettings( num_normal++; } else - (*matches)[count++] = vim_strsave(str); + (*matches)[count++] = mnv_strsave(str); } else if (is_term_opt) { @@ -8553,7 +8552,7 @@ escape_option_str_cmdline(char_u *var) // A backslash is required before some characters. This is the reverse of // what happens in do_set(). - buf = vim_strsave_escaped(var, escape_chars); + buf = mnv_strsave_escaped(var, escape_chars); if (buf == NULL) return NULL; @@ -8565,7 +8564,7 @@ escape_option_str_cmdline(char_u *var) if (var[0] == '\\' && var[1] == '\\' && expand_option_idx >= 0 && (options[expand_option_idx].flags & P_EXPAND) - && vim_isfilec(var[2]) + && mnv_isfilec(var[2]) && (var[2] != '\\' || (var == buf && var[4] != '\\'))) STRMOVE(var, var + 1); #endif @@ -8606,7 +8605,7 @@ ExpandOldSetting(int *numMatches, char_u ***matches) buf = escape_option_str_cmdline(var); if (buf == NULL) { - VIM_CLEAR(*matches); + MNV_CLEAR(*matches); return FAIL; } @@ -8659,7 +8658,7 @@ ExpandStringSetting( int num_ret = options[expand_option_idx].opt_expand_cb(&args, numMatches, matches); - vim_free(buf); + mnv_free(buf); return num_ret; } @@ -8701,7 +8700,7 @@ ExpandSettingSubtract( return FAIL; // Make a copy as we need to inject null characters destructively. - option_copy = vim_strsave(option_val); + option_copy = mnv_strsave(option_val); if (option_copy == NULL) return FAIL; next_val = option_copy; @@ -8711,13 +8710,13 @@ ExpandSettingSubtract( do { item = next_val; - comma = vim_strchr(next_val, ','); + comma = mnv_strchr(next_val, ','); while (comma != NULL && comma != next_val && *(comma - 1) == '\\') { // "\," is interpreted as a literal comma rather than option // separator when reading options in copy_option_part(). Skip // it. - comma = vim_strchr(comma + 1, ','); + comma = mnv_strchr(comma + 1, ','); } if (comma != NULL) { @@ -8731,24 +8730,24 @@ ExpandSettingSubtract( // empty value, don't add to list continue; - if (!vim_regexec(regmatch, item, (colnr_T)0)) + if (!mnv_regexec(regmatch, item, (colnr_T)0)) continue; char_u *buf = escape_option_str_cmdline(item); if (buf == NULL) { - vim_free(option_copy); + mnv_free(option_copy); ga_clear_strings(&ga); return FAIL; } if (ga_add_string(&ga, buf) != OK) { - vim_free(buf); + mnv_free(buf); break; } } while (next_val != NULL); - vim_free(option_copy); + mnv_free(option_copy); *matches = ga.ga_data; *numMatches = ga.ga_len; @@ -8761,7 +8760,7 @@ ExpandSettingSubtract( if (*xp->xp_pattern != NUL) { - // Don't suggest anything if cmdline is non-empty. Vim's set-= + // Don't suggest anything if cmdline is non-empty. MNV's set-= // behavior requires consecutive strings and it's usually // unintuitive to users if they try to subtract multiple flags at // once. @@ -8779,10 +8778,10 @@ ExpandSettingSubtract( int count = 0; char_u *p; - p = vim_strnsave(option_val, num_flags); + p = mnv_strnsave(option_val, num_flags); if (p == NULL) { - VIM_CLEAR(*matches); + MNV_CLEAR(*matches); return FAIL; } (*matches)[count++] = p; @@ -8793,7 +8792,7 @@ ExpandSettingSubtract( // character as individual choice. for (char_u *flag = option_val; *flag != NUL; flag++) { - p = vim_strnsave(flag, 1); + p = mnv_strnsave(flag, 1); if (p == NULL) break; (*matches)[count++] = p; @@ -8813,7 +8812,7 @@ ExpandSettingSubtract( */ static void option_value2string( - struct vimoption *opp, + struct mnvoption *opp, int scope) // OPT_GLOBAL and/or OPT_LOCAL { char_u *varp; @@ -8847,7 +8846,7 @@ option_value2string( else if ((char_u **)opp->var == &p_pt) str2specialbuf(p_pt, NameBuff, MAXPATHL); else - vim_strncpy(NameBuff, varp, MAXPATHL - 1); + mnv_strncpy(NameBuff, varp, MAXPATHL - 1); } } @@ -8876,21 +8875,21 @@ wc_use_keyname(char_u *varp, long *wcp) shortmess(int x) { return p_shm != NULL && - ( vim_strchr(p_shm, x) != NULL - || (vim_strchr(p_shm, 'a') != NULL - && vim_strchr((char_u *)SHM_A, x) != NULL)); + ( mnv_strchr(p_shm, x) != NULL + || (mnv_strchr(p_shm, 'a') != NULL + && mnv_strchr((char_u *)SHM_A, x) != NULL)); } /* - * vimrc_found() - Called when a ".vimrc" or "VIMINIT" has been found. + * mnvrc_found() - Called when a ".mnvrc" or "MNVINIT" has been found. * * Reset 'compatible' and set the values for options that didn't get set yet - * to the Vim defaults. + * to the MNV defaults. * Don't do this if the 'compatible' option has been set or reset before. * When "fname" is not NULL, use it to set $"envname" when it wasn't set yet. */ void -vimrc_found(char_u *fname, char_u *envname) +mnvrc_found(char_u *fname, char_u *envname) { int opt_idx; int dofree = FALSE; @@ -8908,21 +8907,21 @@ vimrc_found(char_u *fname, char_u *envname) if (fname != NULL) { - p = vim_getenv(envname, &dofree); + p = mnv_getenv(envname, &dofree); if (p == NULL) { - // Set $MYVIMRC to the first vimrc file found. + // Set $MYMNVRC to the first mnvrc file found. p = FullName_save(fname, FALSE); if (p != NULL) { - vim_setenv(envname, p); - vim_free(p); + mnv_setenv(envname, p); + mnv_free(p); } - // Set $MYVIMDIR - export_myvimdir(); + // Set $MYMNVDIR + export_mymnvdir(); } else if (dofree) - vim_free(p); + mnv_free(p); } } @@ -8979,10 +8978,10 @@ reset_option_was_set(char_u *name) /* * compatible_set() - Called when 'compatible' has been set or unset. * - * When 'compatible' set: Set all relevant options (those that have the P_VIM) + * When 'compatible' set: Set all relevant options (those that have the P_MNV) * flag) to a Vi compatible value. * When 'compatible' is unset: Set all options that have a different default - * for Vim (without the P_VI_DEF flag) to that default. + * for MNV (without the P_VI_DEF flag) to that default. */ static void compatible_set(void) @@ -8990,7 +8989,7 @@ compatible_set(void) int opt_idx; for (opt_idx = 0; !istermoption_idx(opt_idx); opt_idx++) - if ( ((options[opt_idx].flags & P_VIM) && p_cp) + if ( ((options[opt_idx].flags & P_MNV) && p_cp) || (!(options[opt_idx].flags & P_VI_DEF) && !p_cp)) set_option_default(opt_idx, OPT_FREE, p_cp); didset_options(); @@ -9015,7 +9014,7 @@ can_bs( case '1': return (what != BS_START); case '0': return FALSE; } - return vim_strchr(p_bs, what) != NULL; + return mnv_strchr(p_bs, what) != NULL; } /* @@ -9101,7 +9100,7 @@ get_winbuf_options(int bufopt) for (opt_idx = 0; !istermoption_idx(opt_idx); opt_idx++) { - struct vimoption *opt = &options[opt_idx]; + struct mnvoption *opt = &options[opt_idx]; if ((bufopt && (opt->indir & PV_BUF)) || (!bufopt && (opt->indir & PV_WIN))) @@ -9178,7 +9177,7 @@ fill_culopt_flags(char_u *val, win_T *wp) #endif /* - * Get the value of 'magic' adjusted for Vim9 script. + * Get the value of 'magic' adjusted for MNV9 script. */ int magic_isset(void) @@ -9190,7 +9189,7 @@ magic_isset(void) case OPTION_MAGIC_NOT_SET: break; } #ifdef FEAT_EVAL - if (in_vim9script()) + if (in_mnv9script()) return TRUE; #endif return p_magic; @@ -9216,7 +9215,7 @@ option_set_callback_func(char_u *optval UNUSED, callback_T *optcb UNUSED) return OK; } - if (*optval == '{' || (in_vim9script() && *optval == '(') + if (*optval == '{' || (in_mnv9script() && *optval == '(') || (STRNCMP(optval, "function(", 9) == 0) || (STRNCMP(optval, "funcref(", 8) == 0)) // Lambda expression or a funcref @@ -9224,7 +9223,7 @@ option_set_callback_func(char_u *optval UNUSED, callback_T *optcb UNUSED) else { // treat everything else as a function name string - tv = alloc_string_tv(vim_strsave(optval)); + tv = alloc_string_tv(mnv_strsave(optval)); funcname = TRUE; } if (tv == NULL) @@ -9242,11 +9241,11 @@ option_set_callback_func(char_u *optval UNUSED, callback_T *optcb UNUSED) free_tv(tv); char_u *dot = NULL; - if (in_vim9script() && funcname - && ((dot = vim_strchr(optval, '.')) != NULL)) + if (in_mnv9script() && funcname + && ((dot = mnv_strchr(optval, '.')) != NULL)) { if (optcb->cb_free_name) - vim_free(optcb->cb_name); + mnv_free(optcb->cb_name); imported_T *import = find_imported(optval, dot - optval, FALSE); if (import != NULL && SCRIPT_ID_VALID(import->imp_sid) @@ -9256,20 +9255,20 @@ option_set_callback_func(char_u *optval UNUSED, callback_T *optcb UNUSED) // Imported non-autoloaded function. Replace the import script // name (import.funcname) with the script ID (123_funcname) - vim_snprintf((char *)fnamebuf, sizeof(fnamebuf), "%d_%s", + mnv_snprintf((char *)fnamebuf, sizeof(fnamebuf), "%d_%s", import->imp_sid, dot + 1); - optcb->cb_name = vim_strsave(fnamebuf); + optcb->cb_name = mnv_strsave(fnamebuf); optcb->cb_free_name = TRUE; } else { // Imported autoloaded function. Store the function name as // "import.funcname". - optcb->cb_name = vim_strsave(optval); + optcb->cb_name = mnv_strsave(optval); optcb->cb_free_name = TRUE; } } - // when using Vim9 style "import.funcname" it needs to be expanded to + // when using MNV9 style "import.funcname" it needs to be expanded to // "import#funcname". expand_autload_callback(optcb); diff --git a/uvim/src/option.h b/uvim/src/option.h index 305a92ad88..3a3f8e8b92 100644 --- a/uvim/src/option.h +++ b/uvim/src/option.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* @@ -28,11 +28,11 @@ #define P_NO_CMD_EXPAND 0x20 // don't perform cmdline completions #define P_NODEFAULT 0x40 // don't set to default value #define P_DEF_ALLOCED 0x80 // default value is in allocated memory, must - // use vim_free() when assigning new value + // use mnv_free() when assigning new value #define P_WAS_SET 0x100 // option has been set/reset -#define P_NO_MKRC 0x200 // don't include in :mkvimrc output -#define P_VI_DEF 0x400 // Use Vi default for Vim -#define P_VIM 0x800 // Vim option, reset when 'cp' set +#define P_NO_MKRC 0x200 // don't include in :mkmnvrc output +#define P_VI_DEF 0x400 // Use Vi default for MNV +#define P_MNV 0x800 // MNV option, reset when 'cp' set // when option changed, what to display: #define P_RSTAT 0x1000 // redraw status lines @@ -49,10 +49,10 @@ #define P_SECURE 0x80000L // cannot change in modeline or secure mode #define P_GETTEXT 0x100000L // expand default value with _() -#define P_NOGLOB 0x200000L // do not use local value for global vimrc +#define P_NOGLOB 0x200000L // do not use local value for global mnvrc #define P_NFNAME 0x400000L // only normal file name chars allowed #define P_INSECURE 0x800000L // option was set from a modeline -#define P_PRI_MKRC 0x1000000L // priority for :mkvimrc (setting option has +#define P_PRI_MKRC 0x1000000L // priority for :mkmnvrc (setting option has // side effects) #define P_NO_ML 0x2000000L // not allowed in modeline #define P_CURSWANT 0x4000000L // update curswant required; not needed when @@ -110,12 +110,12 @@ typedef enum { #ifdef USE_CRNL # define DFLT_FF "dos" -# define DFLT_FFS_VIM "dos,unix" +# define DFLT_FFS_MNV "dos,unix" # define DFLT_FFS_VI "dos,unix" // also autodetect in compatible mode # define DFLT_TEXTAUTO TRUE #else # define DFLT_FF "unix" -# define DFLT_FFS_VIM "unix,dos" +# define DFLT_FFS_MNV "unix,dos" # ifdef __CYGWIN__ # define DFLT_FFS_VI "unix,dos" // Cygwin always needs file detection # define DFLT_TEXTAUTO TRUE @@ -165,7 +165,7 @@ typedef enum { #define FO_PERIOD_ABBR 'p' // don't break a single space after a period #define DFLT_FO_VI "vt" -#define DFLT_FO_VIM "tcq" +#define DFLT_FO_MNV "tcq" #define FO_ALL "tcro/q2vlb1mMBn,aw]jp" // for do_set() // characters for the p_cpo option: @@ -232,8 +232,8 @@ typedef enum { #define CPO_SCOLON ';' // using "," and ";" will skip over char if // cursor would not move #define CPO_NOSYMLINKS '~' // don't resolve symlinks when changing directory -// default values for Vim, Vi and POSIX -#define CPO_VIM "aABceFsz" +// default values for MNV, Vi and POSIX +#define CPO_MNV "aABceFsz" #define CPO_VI "aAbBcCdDeEfFgHiIjJkKlLmMnoOpPqrRsStuvwWxXyZz$!%*-+<>;" #define CPO_ALL "aAbBcCdDeEfFgHiIjJkKlLmMnoOpPqrRsStuvwWxXyZz$!%*-+<>#{|&/\\.;~" @@ -294,7 +294,7 @@ typedef enum { #define GO_FORG 'f' // start GUI in foreground #define GO_GREY 'g' // use grey menu items #define GO_HORSCROLL 'h' // flexible horizontal scrolling -#define GO_ICON 'i' // use Vim icon +#define GO_ICON 'i' // use MNV icon #define GO_LEFT 'l' // use left scrollbar #define GO_VLEFT 'L' // left scrollbar with vert split #define GO_MENUS 'm' // use menu bar @@ -357,7 +357,7 @@ typedef enum { #define STL_ARGLISTSTAT 'a' // argument list status as (x of y) #define STL_PAGENUM 'N' // page number (when printing) #define STL_SHOWCMD 'S' // 'showcmd' buffer -#define STL_VIM_EXPR '{' // start of expression to substitute +#define STL_MNV_EXPR '{' // start of expression to substitute #define STL_SEPARATE '=' // separation between alignment // sections #define STL_TRUNCMARK '<' // truncation mark if line is too long @@ -1104,9 +1104,9 @@ EXTERN long p_ut; // 'updatetime' EXTERN char_u *p_vsts; // 'varsofttabstop' EXTERN char_u *p_vts; // 'vartabstop' #endif -#ifdef FEAT_VIMINFO -EXTERN char_u *p_viminfo; // 'viminfo' -EXTERN char_u *p_viminfofile; // 'viminfofile' +#ifdef FEAT_MNVINFO +EXTERN char_u *p_mnvinfo; // 'mnvinfo' +EXTERN char_u *p_mnvinfofile; // 'mnvinfofile' #endif #ifdef FEAT_SESSION EXTERN char_u *p_vdir; // 'viewdir' diff --git a/uvim/src/optiondefs.h b/uvim/src/optiondefs.h index a6f8383084..09a547d7f7 100644 --- a/uvim/src/optiondefs.h +++ b/uvim/src/optiondefs.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* @@ -272,7 +272,7 @@ static long p_wm_nopaste; static char_u *p_vsts_nopaste; #endif -struct vimoption +struct mnvoption { char *fullname; // full option name char *shortname; // permissible abbreviation @@ -290,7 +290,7 @@ struct vimoption // cmdline. Only useful for string options. opt_expand_cb_T opt_expand_cb; - char_u *def_val[2]; // default values for variable (vi and vim) + char_u *def_val[2]; // default values for variable (vi and mnv) #ifdef FEAT_EVAL sctx_T script_ctx; // script context where the option was last set # define SCTX_INIT , {0, 0, 0, 1} @@ -300,7 +300,7 @@ struct vimoption }; #define VI_DEFAULT 0 // def_val[VI_DEFAULT] is Vi default value -#define VIM_DEFAULT 1 // def_val[VIM_DEFAULT] is Vim default value +#define MNV_DEFAULT 1 // def_val[MNV_DEFAULT] is MNV default value #define ISK_LATIN1 (char_u *)"@,48-57,_,192-255" @@ -334,7 +334,7 @@ struct vimoption // Exception: "t_" options are at the end. // The options with a NULL variable are 'hidden': a set command for them is // ignored and they are not printed. -static struct vimoption options[] = +static struct mnvoption options[] = { {"aleph", "al", P_NUM|P_VI_DEF|P_CURSWANT, #ifdef FEAT_RIGHTLEFT @@ -350,7 +350,7 @@ static struct vimoption options[] = (char_u *)224L, #endif (char_u *)0L} SCTX_INIT}, - {"allowrevins", "ari", P_BOOL|P_VI_DEF|P_VIM, + {"allowrevins", "ari", P_BOOL|P_VI_DEF|P_MNV, #ifdef FEAT_RIGHTLEFT (char_u *)&p_ari, PV_NONE, NULL, NULL, #else @@ -364,18 +364,18 @@ static struct vimoption options[] = (char_u *)&p_ambw, PV_NONE, did_set_ambiwidth, expand_set_ambiwidth, {(char_u *)"single", (char_u *)0L} SCTX_INIT}, - {"antialias", "anti", P_BOOL|P_VI_DEF|P_VIM|P_RCLR, + {"antialias", "anti", P_BOOL|P_VI_DEF|P_MNV|P_RCLR, (char_u *)NULL, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)FALSE} SCTX_INIT}, - {"arabic", "arab", P_BOOL|P_VI_DEF|P_VIM|P_CURSWANT, + {"arabic", "arab", P_BOOL|P_VI_DEF|P_MNV|P_CURSWANT, #ifdef FEAT_ARABIC (char_u *)VAR_WIN, PV_ARAB, did_set_arabic, NULL, #else (char_u *)NULL, PV_NONE, NULL, NULL, #endif {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"arabicshape", "arshape", P_BOOL|P_VI_DEF|P_VIM|P_RCLR, + {"arabicshape", "arshape", P_BOOL|P_VI_DEF|P_MNV|P_RCLR, #ifdef FEAT_ARABIC (char_u *)&p_arshape, PV_NONE, NULL, NULL, #else @@ -435,13 +435,13 @@ static struct vimoption options[] = (char_u *)"light", #endif (char_u *)0L} SCTX_INIT}, - {"backspace", "bs", P_STRING|P_VIM|P_ONECOMMA|P_NODUP, + {"backspace", "bs", P_STRING|P_MNV|P_ONECOMMA|P_NODUP, (char_u *)&p_bs, PV_NONE, did_set_backspace, expand_set_backspace, {(char_u *)"", (char_u *)"indent,eol,start"} SCTX_INIT}, - {"backup", "bk", P_BOOL|P_VI_DEF|P_VIM, + {"backup", "bk", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_bk, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"backupcopy", "bkc", P_STRING|P_VIM|P_ONECOMMA|P_NODUP, + {"backupcopy", "bkc", P_STRING|P_MNV|P_ONECOMMA|P_NODUP, (char_u *)&p_bkc, PV_BKC, did_set_backupcopy, expand_set_backupcopy, #ifdef UNIX {(char_u *)"yes", (char_u *)"auto"} @@ -495,7 +495,7 @@ static struct vimoption options[] = {(char_u *)0L, (char_u *)0L} #endif SCTX_INIT}, - {"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM|P_MLE, + {"balloonexpr", "bexpr", P_STRING|P_ALLOCED|P_VI_DEF|P_MNV|P_MLE, #if defined(FEAT_BEVAL) && defined(FEAT_EVAL) (char_u *)&p_bexpr, PV_BEXPR, did_set_optexpr, NULL, {(char_u *)"", (char_u *)0L} @@ -529,7 +529,7 @@ static struct vimoption options[] = {(char_u *)0L, (char_u *)0L} #endif SCTX_INIT}, - {"breakindent", "bri", P_BOOL|P_VI_DEF|P_VIM|P_RWIN, + {"breakindent", "bri", P_BOOL|P_VI_DEF|P_MNV|P_RWIN, #ifdef FEAT_LINEBREAK (char_u *)VAR_WIN, PV_BRI, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} @@ -574,7 +574,7 @@ static struct vimoption options[] = (char_u *)&p_cmp, PV_NONE, did_set_casemap, expand_set_casemap, {(char_u *)"internal,keepascii", (char_u *)0L} SCTX_INIT}, - {"cdhome", "cdh", P_BOOL|P_VI_DEF|P_VIM|P_SECURE, + {"cdhome", "cdh", P_BOOL|P_VI_DEF|P_MNV|P_SECURE, (char_u *)&p_cdh, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, @@ -604,7 +604,7 @@ static struct vimoption options[] = {(char_u *)0L, (char_u *)0L} #endif SCTX_INIT}, - {"cindent", "cin", P_BOOL|P_VI_DEF|P_VIM, + {"cindent", "cin", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_cin, PV_CIN, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"cinkeys", "cink", P_STRING|P_ALLOCED|P_VI_DEF|P_ONECOMMA|P_NODUP, @@ -715,7 +715,7 @@ static struct vimoption options[] = {(char_u *)NULL, (char_u *)0L} #endif SCTX_INIT}, - {"completeslash", "csl", P_STRING|P_VI_DEF|P_VIM, + {"completeslash", "csl", P_STRING|P_VI_DEF|P_MNV, #if defined(BACKSLASH_IN_FILENAME) (char_u *)&p_csl, PV_CSL, did_set_completeslash, expand_set_completeslash, {(char_u *)"", (char_u *)0L} @@ -754,12 +754,12 @@ static struct vimoption options[] = {"conskey", "consk",P_BOOL|P_VI_DEF, (char_u *)NULL, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"copyindent", "ci", P_BOOL|P_VI_DEF|P_VIM, + {"copyindent", "ci", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_ci, PV_CI, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"cpoptions", "cpo", P_STRING|P_VIM|P_RALL|P_FLAGLIST, + {"cpoptions", "cpo", P_STRING|P_MNV|P_RALL|P_FLAGLIST, (char_u *)&p_cpo, PV_NONE, did_set_cpoptions, expand_set_cpoptions, - {(char_u *)CPO_VI, (char_u *)CPO_VIM} + {(char_u *)CPO_VI, (char_u *)CPO_MNV} SCTX_INIT}, {"cryptmethod", "cm", P_STRING|P_ALLOCED|P_VI_DEF, #ifdef FEAT_CRYPT @@ -770,7 +770,7 @@ static struct vimoption options[] = {(char_u *)0L, (char_u *)0L} #endif SCTX_INIT}, - {"cscopepathcomp", "cspc", P_NUM|P_VI_DEF|P_VIM, + {"cscopepathcomp", "cspc", P_NUM|P_VI_DEF|P_MNV, #ifdef FEAT_CSCOPE (char_u *)&p_cspc, PV_NONE, NULL, NULL, #else @@ -796,28 +796,28 @@ static struct vimoption options[] = {(char_u *)0L, (char_u *)0L} #endif SCTX_INIT}, - {"cscoperelative", "csre", P_BOOL|P_VI_DEF|P_VIM, + {"cscoperelative", "csre", P_BOOL|P_VI_DEF|P_MNV, #ifdef FEAT_CSCOPE (char_u *)&p_csre, PV_NONE, NULL, NULL, #else (char_u *)NULL, PV_NONE, NULL, NULL, #endif {(char_u *)0L, (char_u *)0L} SCTX_INIT}, - {"cscopetag", "cst", P_BOOL|P_VI_DEF|P_VIM, + {"cscopetag", "cst", P_BOOL|P_VI_DEF|P_MNV, #ifdef FEAT_CSCOPE (char_u *)&p_cst, PV_NONE, NULL, NULL, #else (char_u *)NULL, PV_NONE, NULL, NULL, #endif {(char_u *)0L, (char_u *)0L} SCTX_INIT}, - {"cscopetagorder", "csto", P_NUM|P_VI_DEF|P_VIM, + {"cscopetagorder", "csto", P_NUM|P_VI_DEF|P_MNV, #ifdef FEAT_CSCOPE (char_u *)&p_csto, PV_NONE, NULL, NULL, #else (char_u *)NULL, PV_NONE, NULL, NULL, #endif {(char_u *)0L, (char_u *)0L} SCTX_INIT}, - {"cscopeverbose", "csverb", P_BOOL|P_VI_DEF|P_VIM, + {"cscopeverbose", "csverb", P_BOOL|P_VI_DEF|P_MNV, #ifdef FEAT_CSCOPE (char_u *)&p_csverbose, PV_NONE, NULL, NULL, #else @@ -861,7 +861,7 @@ static struct vimoption options[] = {(char_u *)NULL, (char_u *)0L} #endif SCTX_INIT}, - {"delcombine", "deco", P_BOOL|P_VI_DEF|P_VIM, + {"delcombine", "deco", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_deco, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"dictionary", "dict", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP|P_NDNAME, @@ -901,7 +901,7 @@ static struct vimoption options[] = {(char_u *)"", (char_u *)NULL} #endif SCTX_INIT}, - {"digraph", "dg", P_BOOL|P_VI_DEF|P_VIM, + {"digraph", "dg", P_BOOL|P_VI_DEF|P_MNV, #ifdef FEAT_DIGRAPHS (char_u *)&p_dg, PV_NONE, NULL, NULL, #else @@ -965,7 +965,7 @@ static struct vimoption options[] = {(char_u *)NULL, (char_u *)0L} #endif SCTX_INIT}, - {"esckeys", "ek", P_BOOL|P_VIM, + {"esckeys", "ek", P_BOOL|P_MNV, (char_u *)&p_ek, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)TRUE} SCTX_INIT}, {"eventignore", "ei", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, @@ -974,7 +974,7 @@ static struct vimoption options[] = {"eventignorewin", "eiw", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, (char_u *)VAR_WIN, PV_EIW, did_set_eventignore, expand_set_eventignore, {(char_u *)"", (char_u *)0L} SCTX_INIT}, - {"expandtab", "et", P_BOOL|P_VI_DEF|P_VIM, + {"expandtab", "et", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_et, PV_ET, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"exrc", "ex", P_BOOL|P_VI_DEF|P_SECURE, @@ -993,9 +993,9 @@ static struct vimoption options[] = |P_CURSWANT, (char_u *)&p_ff, PV_FF, did_set_fileformat, expand_set_fileformat, {(char_u *)DFLT_FF, (char_u *)0L} SCTX_INIT}, - {"fileformats", "ffs", P_STRING|P_VIM|P_ONECOMMA|P_NODUP, + {"fileformats", "ffs", P_STRING|P_MNV|P_ONECOMMA|P_NODUP, (char_u *)&p_ffs, PV_NONE, did_set_fileformats, expand_set_fileformat, - {(char_u *)DFLT_FFS_VI, (char_u *)DFLT_FFS_VIM} + {(char_u *)DFLT_FFS_VI, (char_u *)DFLT_FFS_MNV} SCTX_INIT}, {"fileignorecase", "fic", P_BOOL|P_VI_DEF, (char_u *)&p_fic, PV_NONE, NULL, NULL, @@ -1063,7 +1063,7 @@ static struct vimoption options[] = {(char_u *)NULL, (char_u *)0L} #endif SCTX_INIT}, - {"foldexpr", "fde", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN|P_MLE, + {"foldexpr", "fde", P_STRING|P_ALLOCED|P_MNV|P_VI_DEF|P_RWIN|P_MLE, #if defined(FEAT_FOLDING) && defined(FEAT_EVAL) (char_u *)VAR_WIN, PV_FDE, did_set_foldexpr, NULL, {(char_u *)"0", (char_u *)NULL} @@ -1072,7 +1072,7 @@ static struct vimoption options[] = {(char_u *)NULL, (char_u *)0L} #endif SCTX_INIT}, - {"foldignore", "fdi", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN, + {"foldignore", "fdi", P_STRING|P_ALLOCED|P_MNV|P_VI_DEF|P_RWIN, #ifdef FEAT_FOLDING (char_u *)VAR_WIN, PV_FDI, did_set_foldignore, NULL, {(char_u *)"#", (char_u *)NULL} @@ -1099,7 +1099,7 @@ static struct vimoption options[] = {(char_u *)NULL, (char_u *)0L} #endif SCTX_INIT}, - {"foldmarker", "fmr", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF| + {"foldmarker", "fmr", P_STRING|P_ALLOCED|P_MNV|P_VI_DEF| P_RWIN|P_ONECOMMA|P_NODUP, #ifdef FEAT_FOLDING (char_u *)VAR_WIN, PV_FMR, did_set_foldmarker, NULL, @@ -1109,7 +1109,7 @@ static struct vimoption options[] = {(char_u *)NULL, (char_u *)0L} #endif SCTX_INIT}, - {"foldmethod", "fdm", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN, + {"foldmethod", "fdm", P_STRING|P_ALLOCED|P_MNV|P_VI_DEF|P_RWIN, #ifdef FEAT_FOLDING (char_u *)VAR_WIN, PV_FDM, did_set_foldmethod, expand_set_foldmethod, {(char_u *)"manual", (char_u *)NULL} @@ -1146,7 +1146,7 @@ static struct vimoption options[] = {(char_u *)NULL, (char_u *)0L} #endif SCTX_INIT}, - {"foldtext", "fdt", P_STRING|P_ALLOCED|P_VIM|P_VI_DEF|P_RWIN|P_MLE, + {"foldtext", "fdt", P_STRING|P_ALLOCED|P_MNV|P_VI_DEF|P_RWIN|P_MLE, #if defined(FEAT_FOLDING) && defined(FEAT_EVAL) (char_u *)VAR_WIN, PV_FDT, did_set_optexpr, NULL, {(char_u *)"foldtext()", (char_u *)NULL} @@ -1155,7 +1155,7 @@ static struct vimoption options[] = {(char_u *)NULL, (char_u *)0L} #endif SCTX_INIT}, - {"formatexpr", "fex", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM|P_MLE, + {"formatexpr", "fex", P_STRING|P_ALLOCED|P_VI_DEF|P_MNV|P_MLE, #ifdef FEAT_EVAL (char_u *)&p_fex, PV_FEX, did_set_optexpr, NULL, {(char_u *)"", (char_u *)0L} @@ -1168,9 +1168,9 @@ static struct vimoption options[] = (char_u *)&p_flp, PV_FLP, NULL, NULL, {(char_u *)"^\\s*\\d\\+[\\]:.)}\\t ]\\s*", (char_u *)0L} SCTX_INIT}, - {"formatoptions","fo", P_STRING|P_ALLOCED|P_VIM|P_FLAGLIST, + {"formatoptions","fo", P_STRING|P_ALLOCED|P_MNV|P_FLAGLIST, (char_u *)&p_fo, PV_FO, did_set_formatoptions, expand_set_formatoptions, - {(char_u *)DFLT_FO_VI, (char_u *)DFLT_FO_VIM} + {(char_u *)DFLT_FO_VI, (char_u *)DFLT_FO_MNV} SCTX_INIT}, {"formatprg", "fp", P_STRING|P_EXPAND|P_VI_DEF|P_SECURE, (char_u *)&p_fp, PV_FP, NULL, NULL, @@ -1184,7 +1184,7 @@ static struct vimoption options[] = {(char_u *)FALSE, (char_u *)0L} #endif SCTX_INIT}, - {"gdefault", "gd", P_BOOL|P_VI_DEF|P_VIM, + {"gdefault", "gd", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_gd, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"graphic", "gr", P_BOOL|P_VI_DEF, @@ -1360,24 +1360,24 @@ static struct vimoption options[] = (char_u *)&p_hl, PV_NONE, did_set_highlight, expand_set_highlight, {(char_u *)HIGHLIGHT_INIT, (char_u *)0L} SCTX_INIT}, - {"history", "hi", P_NUM|P_VIM, + {"history", "hi", P_NUM|P_MNV, (char_u *)&p_hi, PV_NONE, NULL, NULL, {(char_u *)0L, (char_u *)200L} SCTX_INIT}, - {"hkmap", "hk", P_BOOL|P_VI_DEF|P_VIM, + {"hkmap", "hk", P_BOOL|P_VI_DEF|P_MNV, #ifdef FEAT_RIGHTLEFT (char_u *)&p_hkmap, PV_NONE, NULL, NULL, #else (char_u *)NULL, PV_NONE, NULL, NULL, #endif {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"hkmapp", "hkp", P_BOOL|P_VI_DEF|P_VIM, + {"hkmapp", "hkp", P_BOOL|P_VI_DEF|P_MNV, #ifdef FEAT_RIGHTLEFT (char_u *)&p_hkmapp, PV_NONE, NULL, NULL, #else (char_u *)NULL, PV_NONE, NULL, NULL, #endif {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"hlsearch", "hls", P_BOOL|P_VI_DEF|P_VIM|P_RALL|P_HLONLY, + {"hlsearch", "hls", P_BOOL|P_VI_DEF|P_MNV|P_RALL|P_HLONLY, #if defined(FEAT_SEARCH_EXTRA) (char_u *)&p_hls, PV_NONE, did_set_hlsearch, NULL, #else @@ -1396,7 +1396,7 @@ static struct vimoption options[] = {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"imactivatefunc","imaf",P_STRING|P_VI_DEF|P_SECURE|P_FUNC, #if defined(FEAT_EVAL) && \ - (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM) || defined(VIMDLL)) + (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM) || defined(MNVDLL)) (char_u *)&p_imaf, PV_NONE, did_set_imactivatefunc, NULL, {(char_u *)"", (char_u *)NULL} @@ -1435,7 +1435,7 @@ static struct vimoption options[] = SCTX_INIT}, {"imstatusfunc","imsf",P_STRING|P_VI_DEF|P_SECURE|P_FUNC, #if defined(FEAT_EVAL) && \ - (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM) || defined(VIMDLL)) + (defined(FEAT_XIM) || defined(IME_WITHOUT_XIM) || defined(MNVDLL)) (char_u *)&p_imsf, PV_NONE, did_set_imstatusfunc, NULL, {(char_u *)"", (char_u *)NULL} #else @@ -1470,10 +1470,10 @@ static struct vimoption options[] = {(char_u *)0L, (char_u *)0L} #endif SCTX_INIT}, - {"incsearch", "is", P_BOOL|P_VI_DEF|P_VIM, + {"incsearch", "is", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_is, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"indentexpr", "inde", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM|P_MLE, + {"indentexpr", "inde", P_STRING|P_ALLOCED|P_VI_DEF|P_MNV|P_MLE, #if defined(FEAT_EVAL) (char_u *)&p_inde, PV_INDE, did_set_optexpr, NULL, {(char_u *)"", (char_u *)0L} @@ -1494,7 +1494,7 @@ static struct vimoption options[] = {"infercase", "inf", P_BOOL|P_VI_DEF, (char_u *)&p_inf, PV_INF, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"insertmode", "im", P_BOOL|P_VI_DEF|P_VIM, + {"insertmode", "im", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_im, PV_NONE, did_set_insertmode, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"isfname", "isf", P_STRING|P_VI_DEF|P_COMMA|P_NODUP, @@ -1523,7 +1523,7 @@ static struct vimoption options[] = (char_u *)"@,48-57,_,192-255", #endif (char_u *)0L} SCTX_INIT}, - {"iskeyword", "isk", P_STRING|P_ALLOCED|P_VIM|P_COMMA|P_NODUP, + {"iskeyword", "isk", P_STRING|P_ALLOCED|P_MNV|P_COMMA|P_NODUP, (char_u *)&p_isk, PV_ISK, did_set_iskeyword, NULL, { (char_u *)"@,48-57,_", @@ -1542,10 +1542,10 @@ static struct vimoption options[] = ISP_LATIN1, #endif (char_u *)0L} SCTX_INIT}, - {"joinspaces", "js", P_BOOL|P_VI_DEF|P_VIM, + {"joinspaces", "js", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_js, PV_NONE, NULL, NULL, {(char_u *)TRUE, (char_u *)0L} SCTX_INIT}, - {"jumpoptions", "jop", P_STRING|P_VI_DEF|P_VIM|P_ONECOMMA|P_NODUP, + {"jumpoptions", "jop", P_STRING|P_VI_DEF|P_MNV|P_ONECOMMA|P_NODUP, (char_u *)&p_jop, PV_NONE, did_set_jumpoptions, expand_set_jumpoptions, {(char_u *)"", (char_u *)0L} SCTX_INIT}, {"key", NULL, P_STRING|P_ALLOCED|P_VI_DEF|P_NO_MKRC|P_NO_CMD_EXPAND, @@ -1776,7 +1776,7 @@ static struct vimoption options[] = {(char_u *)0L, (char_u *)0L} #endif SCTX_INIT}, - {"modeline", "ml", P_BOOL|P_VIM, + {"modeline", "ml", P_BOOL|P_MNV, (char_u *)&p_ml, PV_ML, NULL, NULL, {(char_u *)FALSE, (char_u *)TRUE} SCTX_INIT}, {"modelineexpr", "mle", P_BOOL|P_VI_DEF|P_SECURE, @@ -1791,7 +1791,7 @@ static struct vimoption options[] = {"modified", "mod", P_BOOL|P_NO_MKRC|P_VI_DEF|P_RSTAT, (char_u *)&p_mod, PV_MOD, did_set_modified, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"more", NULL, P_BOOL|P_VIM, + {"more", NULL, P_BOOL|P_MNV, (char_u *)&p_more, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)TRUE} SCTX_INIT}, {"mouse", NULL, P_STRING|P_VI_DEF|P_FLAGLIST, @@ -1873,6 +1873,32 @@ static struct vimoption options[] = #else (char_u *)NULL, PV_NONE, NULL, NULL, {(char_u *)"", (char_u *)0L} +#endif + SCTX_INIT}, + {"mnvinfo", "vi", P_STRING|P_ONECOMMA|P_NODUP|P_SECURE, +#ifdef FEAT_MNVINFO + (char_u *)&p_mnvinfo, PV_NONE, did_set_mnvinfo, NULL, +# if defined(MSWIN) + {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"} +# elif defined(AMIGA) + {(char_u *)"", + (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"} +# else + {(char_u *)"", (char_u *)"'100,<50,s10,h"} +# endif +#else + (char_u *)NULL, PV_NONE, NULL, NULL, + {(char_u *)0L, (char_u *)0L} +#endif + SCTX_INIT}, + {"mnvinfofile", "vif", P_STRING|P_EXPAND|P_ONECOMMA|P_NODUP + |P_SECURE|P_VI_DEF, +#ifdef FEAT_MNVINFO + (char_u *)&p_mnvinfofile, PV_NONE, NULL, NULL, + {(char_u *)"", (char_u *)0L} +#else + (char_u *)NULL, PV_NONE, NULL, NULL, + {(char_u *)0L, (char_u *)0L} #endif SCTX_INIT}, {"novice", NULL, P_BOOL|P_VI_DEF, @@ -1886,7 +1912,7 @@ static struct vimoption options[] = (char_u *)VAR_WIN, PV_NU, did_set_number_relativenumber, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"numberwidth", "nuw", P_NUM|P_RWIN|P_VIM, + {"numberwidth", "nuw", P_NUM|P_RWIN|P_MNV, #ifdef FEAT_LINEBREAK (char_u *)VAR_WIN, PV_NUW, did_set_numberwidth, NULL, #else @@ -1972,7 +1998,7 @@ static struct vimoption options[] = {(char_u *)0L, (char_u *)0L} #endif SCTX_INIT}, - {"preserveindent", "pi", P_BOOL|P_VI_DEF|P_VIM, + {"preserveindent", "pi", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_pi, PV_PI, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"previewheight", "pvh", P_NUM|P_VI_DEF, @@ -2138,7 +2164,7 @@ static struct vimoption options[] = #endif {(char_u *)DEFAULT_PYTHON_VER, (char_u *)0L} SCTX_INIT}, - {"quickfixtextfunc", "qftf", P_STRING|P_ALLOCED|P_VI_DEF|P_VIM|P_SECURE|P_FUNC, + {"quickfixtextfunc", "qftf", P_STRING|P_ALLOCED|P_VI_DEF|P_MNV|P_SECURE|P_FUNC, #if defined(FEAT_QUICKFIX) && defined(FEAT_EVAL) (char_u *)&p_qftf, PV_NONE, did_set_quickfixtextfunc, NULL, @@ -2193,7 +2219,7 @@ static struct vimoption options[] = (char_u *)NULL, PV_NONE, NULL, NULL, #endif {(char_u *)TRUE, (char_u *)0L} SCTX_INIT}, - {"revins", "ri", P_BOOL|P_VI_DEF|P_VIM, + {"revins", "ri", P_BOOL|P_VI_DEF|P_MNV, #ifdef FEAT_RIGHTLEFT (char_u *)&p_ri, PV_NONE, NULL, NULL, #else @@ -2225,7 +2251,7 @@ static struct vimoption options[] = {(char_u *)NULL, (char_u *)0L} #endif SCTX_INIT}, - {"ruler", "ru", P_BOOL|P_VIM|P_RSTAT, + {"ruler", "ru", P_BOOL|P_MNV|P_RSTAT, (char_u *)&p_ru, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)TRUE} SCTX_INIT}, {"rulerformat", "ruf", P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT|P_MLE, @@ -2253,10 +2279,10 @@ static struct vimoption options[] = (char_u *)NULL, PV_NONE, NULL, NULL, #endif {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"scrolljump", "sj", P_NUM|P_VI_DEF|P_VIM, + {"scrolljump", "sj", P_NUM|P_VI_DEF|P_MNV, (char_u *)&p_sj, PV_NONE, NULL, NULL, {(char_u *)1L, (char_u *)0L} SCTX_INIT}, - {"scrolloff", "so", P_NUM|P_VI_DEF|P_VIM|P_RALL, + {"scrolloff", "so", P_NUM|P_VI_DEF|P_MNV|P_RALL, (char_u *)&p_so, PV_SO, NULL, NULL, {(char_u *)0L, (char_u *)0L} SCTX_INIT}, {"scrollopt", "sbo", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP, @@ -2366,14 +2392,14 @@ static struct vimoption options[] = (char_u *)"", #endif (char_u *)0L} SCTX_INIT}, - {"shiftround", "sr", P_BOOL|P_VI_DEF|P_VIM, + {"shiftround", "sr", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_sr, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"shiftwidth", "sw", P_NUM|P_VI_DEF, (char_u *)&p_sw, PV_SW, did_set_shiftwidth_tabstop, NULL, {(char_u *)8L, (char_u *)0L} SCTX_INIT}, - {"shortmess", "shm", P_STRING|P_VIM|P_FLAGLIST, + {"shortmess", "shm", P_STRING|P_MNV|P_FLAGLIST, (char_u *)&p_shm, PV_NONE, did_set_shortmess, expand_set_shortmess, {(char_u *)"S", (char_u *)"filnxtToOS"} SCTX_INIT}, @@ -2387,7 +2413,7 @@ static struct vimoption options[] = (char_u *)NULL, PV_NONE, NULL, NULL, #endif {(char_u *)"", (char_u *)0L} SCTX_INIT}, - {"showcmd", "sc", P_BOOL|P_VIM, + {"showcmd", "sc", P_BOOL|P_MNV, (char_u *)&p_sc, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)TRUE} SCTX_INIT}, {"showcmdloc", "sloc", P_STRING|P_RSTAT, @@ -2399,7 +2425,7 @@ static struct vimoption options[] = {"showmatch", "sm", P_BOOL|P_VI_DEF, (char_u *)&p_sm, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"showmode", "smd", P_BOOL|P_VIM, + {"showmode", "smd", P_BOOL|P_MNV, (char_u *)&p_smd, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)TRUE} SCTX_INIT}, {"showtabline", "stal", P_NUM|P_VI_DEF|P_RALL, @@ -2413,7 +2439,7 @@ static struct vimoption options[] = {"sidescroll", "ss", P_NUM|P_VI_DEF, (char_u *)&p_ss, PV_NONE, NULL, NULL, {(char_u *)0L, (char_u *)0L} SCTX_INIT}, - {"sidescrolloff", "siso", P_NUM|P_VI_DEF|P_VIM|P_RBUF, + {"sidescrolloff", "siso", P_NUM|P_VI_DEF|P_MNV|P_RBUF, (char_u *)&p_siso, PV_SISO, NULL, NULL, {(char_u *)0L, (char_u *)0L} SCTX_INIT}, {"signcolumn", "scl", P_STRING|P_ALLOCED|P_VI_DEF|P_RWIN, @@ -2428,19 +2454,19 @@ static struct vimoption options[] = {"slowopen", "slow", P_BOOL|P_VI_DEF, (char_u *)NULL, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"smartcase", "scs", P_BOOL|P_VI_DEF|P_VIM, + {"smartcase", "scs", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_scs, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"smartindent", "si", P_BOOL|P_VI_DEF|P_VIM, + {"smartindent", "si", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_si, PV_SI, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"smarttab", "sta", P_BOOL|P_VI_DEF|P_VIM, + {"smarttab", "sta", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_sta, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"smoothscroll", "sms", P_BOOL|P_VI_DEF|P_RWIN, (char_u *)VAR_WIN, PV_SMS, did_set_smoothscroll, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"softtabstop", "sts", P_NUM|P_VI_DEF|P_VIM, + {"softtabstop", "sts", P_NUM|P_VI_DEF|P_MNV, (char_u *)&p_sts, PV_STS, NULL, NULL, {(char_u *)0L, (char_u *)0L} SCTX_INIT}, {"sourceany", NULL, P_BOOL|P_VI_DEF, @@ -2510,7 +2536,7 @@ static struct vimoption options[] = {"splitright", "spr", P_BOOL|P_VI_DEF, (char_u *)&p_spr, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"startofline", "sol", P_BOOL|P_VI_DEF|P_VIM, + {"startofline", "sol", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_sol, PV_NONE, NULL, NULL, {(char_u *)TRUE, (char_u *)0L} SCTX_INIT}, {"statusline" ,"stl", P_STRING|P_VI_DEF|P_ALLOCED|P_RSTAT|P_MLE, @@ -2600,7 +2626,7 @@ static struct vimoption options[] = {(char_u *)TRUE, (char_u *)0L} #endif SCTX_INIT}, - {"tagcase", "tc", P_STRING|P_VIM, + {"tagcase", "tc", P_STRING|P_MNV, (char_u *)&p_tc, PV_TC, did_set_tagcase, expand_set_tagcase, {(char_u *)"followic", (char_u *)"followic"} SCTX_INIT}, {"tagfunc", "tfu", P_STRING|P_ALLOCED|P_VI_DEF|P_SECURE|P_FUNC, @@ -2615,7 +2641,7 @@ static struct vimoption options[] = {"taglength", "tl", P_NUM|P_VI_DEF, (char_u *)&p_tl, PV_NONE, NULL, NULL, {(char_u *)0L, (char_u *)0L} SCTX_INIT}, - {"tagrelative", "tr", P_BOOL|P_VIM, + {"tagrelative", "tr", P_BOOL|P_MNV, (char_u *)&p_tr, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)TRUE} SCTX_INIT}, {"tags", "tag", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP, @@ -2653,7 +2679,7 @@ static struct vimoption options[] = (char_u *)&p_tenc, PV_NONE, did_set_encoding, expand_set_encoding, {(char_u *)"", (char_u *)0L} SCTX_INIT}, - {"termguicolors", "tgc", P_BOOL|P_VI_DEF|P_VIM|P_RCLR, + {"termguicolors", "tgc", P_BOOL|P_VI_DEF|P_MNV|P_RCLR, #ifdef FEAT_TERMGUICOLORS (char_u *)&p_tgc, PV_NONE, did_set_termguicolors, NULL, {(char_u *)FALSE, (char_u *)FALSE} @@ -2683,7 +2709,7 @@ static struct vimoption options[] = {(char_u *)NULL, (char_u *)0L} #endif SCTX_INIT}, - {"termwinscroll", "twsl", P_NUM|P_VI_DEF|P_VIM|P_RBUF, + {"termwinscroll", "twsl", P_NUM|P_VI_DEF|P_MNV|P_RBUF, #ifdef FEAT_TERMINAL (char_u *)&p_twsl, PV_TWSL, did_set_termwinscroll, NULL, {(char_u *)10000L, (char_u *)10000L} @@ -2713,7 +2739,7 @@ static struct vimoption options[] = {"terse", NULL, P_BOOL|P_VI_DEF, (char_u *)&p_terse, PV_NONE, did_set_terse, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"textauto", "ta", P_BOOL|P_VIM, + {"textauto", "ta", P_BOOL|P_MNV, (char_u *)&p_ta, PV_NONE, did_set_textauto, NULL, {(char_u *)DFLT_TEXTAUTO, (char_u *)TRUE} SCTX_INIT}, @@ -2726,7 +2752,7 @@ static struct vimoption options[] = (char_u *)FALSE, #endif (char_u *)0L} SCTX_INIT}, - {"textwidth", "tw", P_NUM|P_VI_DEF|P_VIM|P_RBUF|P_HLONLY, + {"textwidth", "tw", P_NUM|P_VI_DEF|P_MNV|P_RBUF|P_HLONLY, (char_u *)&p_tw, PV_TW, did_set_textwidth, NULL, {(char_u *)0L, (char_u *)0L} SCTX_INIT}, {"thesaurus", "tsr", P_STRING|P_EXPAND|P_VI_DEF|P_ONECOMMA|P_NODUP|P_NDNAME, @@ -2742,7 +2768,7 @@ static struct vimoption options[] = {(char_u *)0L, (char_u *)0L} #endif SCTX_INIT}, - {"tildeop", "top", P_BOOL|P_VI_DEF|P_VIM, + {"tildeop", "top", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_to, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"timeout", "to", P_BOOL|P_VI_DEF, @@ -2759,7 +2785,7 @@ static struct vimoption options[] = {(char_u *)85L, (char_u *)0L} SCTX_INIT}, {"titleold", NULL, P_STRING|P_VI_DEF|P_GETTEXT|P_SECURE|P_NO_MKRC, (char_u *)&p_titleold, PV_NONE, NULL, NULL, - {(char_u *)N_("Thanks for flying Vim"), + {(char_u *)N_("Thanks for flying MNV"), (char_u *)0L} SCTX_INIT}, {"titlestring", NULL, P_STRING|P_VI_DEF|P_MLE, @@ -2785,7 +2811,7 @@ static struct vimoption options[] = {(char_u *)0L, (char_u *)0L} #endif SCTX_INIT}, - {"ttimeout", NULL, P_BOOL|P_VI_DEF|P_VIM, + {"ttimeout", NULL, P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_ttimeout, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, {"ttimeoutlen", "ttm", P_NUM|P_VI_DEF, @@ -2820,7 +2846,7 @@ static struct vimoption options[] = {(char_u *)0L, (char_u *)0L} #endif SCTX_INIT}, - {"undofile", "udf", P_BOOL|P_VI_DEF|P_VIM, + {"undofile", "udf", P_BOOL|P_VI_DEF|P_MNV, #ifdef FEAT_PERSISTENT_UNDO (char_u *)&p_udf, PV_UDF, did_set_undofile, NULL, #else @@ -2845,7 +2871,7 @@ static struct vimoption options[] = {"updatetime", "ut", P_NUM|P_VI_DEF, (char_u *)&p_ut, PV_NONE, NULL, NULL, {(char_u *)4000L, (char_u *)0L} SCTX_INIT}, - {"varsofttabstop", "vsts", P_STRING|P_VI_DEF|P_VIM|P_COMMA, + {"varsofttabstop", "vsts", P_STRING|P_VI_DEF|P_MNV|P_COMMA, #ifdef FEAT_VARTABS (char_u *)&p_vsts, PV_VSTS, did_set_varsofttabstop, NULL, @@ -2855,7 +2881,7 @@ static struct vimoption options[] = {(char_u *)"", (char_u *)NULL} #endif SCTX_INIT}, - {"vartabstop", "vts", P_STRING|P_VI_DEF|P_VIM|P_RBUF|P_COMMA, + {"vartabstop", "vts", P_STRING|P_VI_DEF|P_MNV|P_RBUF|P_COMMA, #ifdef FEAT_VARTABS (char_u *)&p_vts, PV_VTS, did_set_vartabstop, NULL, {(char_u *)"", (char_u *)0L} @@ -2887,36 +2913,10 @@ static struct vimoption options[] = #else (char_u *)NULL, PV_NONE, NULL, NULL, {(char_u *)0L, (char_u *)0L} -#endif - SCTX_INIT}, - {"viminfo", "vi", P_STRING|P_ONECOMMA|P_NODUP|P_SECURE, -#ifdef FEAT_VIMINFO - (char_u *)&p_viminfo, PV_NONE, did_set_viminfo, NULL, -# if defined(MSWIN) - {(char_u *)"", (char_u *)"'100,<50,s10,h,rA:,rB:"} -# elif defined(AMIGA) - {(char_u *)"", - (char_u *)"'100,<50,s10,h,rdf0:,rdf1:,rdf2:"} -# else - {(char_u *)"", (char_u *)"'100,<50,s10,h"} -# endif -#else - (char_u *)NULL, PV_NONE, NULL, NULL, - {(char_u *)0L, (char_u *)0L} -#endif - SCTX_INIT}, - {"viminfofile", "vif", P_STRING|P_EXPAND|P_ONECOMMA|P_NODUP - |P_SECURE|P_VI_DEF, -#ifdef FEAT_VIMINFO - (char_u *)&p_viminfofile, PV_NONE, NULL, NULL, - {(char_u *)"", (char_u *)0L} -#else - (char_u *)NULL, PV_NONE, NULL, NULL, - {(char_u *)0L, (char_u *)0L} #endif SCTX_INIT}, {"virtualedit", "ve", P_STRING|P_ONECOMMA|P_NODUP|P_VI_DEF - |P_VIM|P_CURSWANT, + |P_MNV|P_CURSWANT, (char_u *)&p_ve, PV_VE, did_set_virtualedit, expand_set_virtualedit, {(char_u *)"", (char_u *)""} SCTX_INIT}, @@ -2938,10 +2938,10 @@ static struct vimoption options[] = {"weirdinvert", "wiv", P_BOOL|P_VI_DEF|P_RCLR, (char_u *)&p_wiv, PV_NONE, did_set_weirdinvert, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"whichwrap", "ww", P_STRING|P_VIM|P_ONECOMMA|P_FLAGLIST, + {"whichwrap", "ww", P_STRING|P_MNV|P_ONECOMMA|P_FLAGLIST, (char_u *)&p_ww, PV_NONE, did_set_whichwrap, expand_set_whichwrap, {(char_u *)"", (char_u *)"b,s"} SCTX_INIT}, - {"wildchar", "wc", P_NUM|P_VIM, + {"wildchar", "wc", P_NUM|P_MNV, (char_u *)&p_wc, PV_NONE, did_set_wildchar, NULL, {(char_u *)(long)Ctrl_E, (char_u *)(long)TAB} SCTX_INIT}, @@ -3061,7 +3061,7 @@ static struct vimoption options[] = {"writeany", "wa", P_BOOL|P_VI_DEF, (char_u *)&p_wa, PV_NONE, NULL, NULL, {(char_u *)FALSE, (char_u *)0L} SCTX_INIT}, - {"writebackup", "wb", P_BOOL|P_VI_DEF|P_VIM, + {"writebackup", "wb", P_BOOL|P_VI_DEF|P_MNV, (char_u *)&p_wb, PV_NONE, NULL, NULL, { #ifdef FEAT_WRITEBACKUP @@ -3185,5 +3185,5 @@ static struct vimoption options[] = #define OPTION_COUNT ARRAY_LENGTH(options) -// The following is needed to make the gen_opt_test.vim script work. +// The following is needed to make the gen_opt_test.mnv script work. // {" diff --git a/uvim/src/optionstr.c b/uvim/src/optionstr.c index 8f964b9837..9c6e085aea 100644 --- a/uvim/src/optionstr.c +++ b/uvim/src/optionstr.c @@ -1,17 +1,17 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * optionstr.c: Functions related to string options */ -#include "vim.h" +#include "mnv.h" static char_u shm_buf[SHM_LEN]; static int set_shm_recursive = 0; @@ -220,7 +220,7 @@ trigger_optionset_string( { // Don't do this recursively. if (oldval == NULL || newval == NULL - || *get_vim_var_str(VV_OPTION_TYPE) != NUL) + || *get_mnv_var_str(VV_OPTION_TYPE) != NUL) return; char_u buf_type[7]; @@ -228,31 +228,31 @@ trigger_optionset_string( size_t oldvallen; oldvallen = STRLEN(oldval); - set_vim_var_string(VV_OPTION_OLD, oldval, (int)oldvallen); - set_vim_var_string(VV_OPTION_NEW, newval, -1); - buf_typelen = vim_snprintf_safelen((char *)buf_type, sizeof(buf_type), + set_mnv_var_string(VV_OPTION_OLD, oldval, (int)oldvallen); + set_mnv_var_string(VV_OPTION_NEW, newval, -1); + buf_typelen = mnv_snprintf_safelen((char *)buf_type, sizeof(buf_type), "%s", (opt_flags & OPT_LOCAL) ? "local" : "global"); - set_vim_var_string(VV_OPTION_TYPE, buf_type, (int)buf_typelen); + set_mnv_var_string(VV_OPTION_TYPE, buf_type, (int)buf_typelen); if (opt_flags & OPT_LOCAL) { - set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setlocal", STRLEN_LITERAL("setlocal")); - set_vim_var_string(VV_OPTION_OLDLOCAL, oldval, (int)oldvallen); + set_mnv_var_string(VV_OPTION_COMMAND, (char_u *)"setlocal", STRLEN_LITERAL("setlocal")); + set_mnv_var_string(VV_OPTION_OLDLOCAL, oldval, (int)oldvallen); } if (opt_flags & OPT_GLOBAL) { - set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"setglobal", STRLEN_LITERAL("setglobal")); - set_vim_var_string(VV_OPTION_OLDGLOBAL, oldval, (int)oldvallen); + set_mnv_var_string(VV_OPTION_COMMAND, (char_u *)"setglobal", STRLEN_LITERAL("setglobal")); + set_mnv_var_string(VV_OPTION_OLDGLOBAL, oldval, (int)oldvallen); } if ((opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0) { - set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"set", STRLEN_LITERAL("set")); - set_vim_var_string(VV_OPTION_OLDLOCAL, oldval_l, -1); - set_vim_var_string(VV_OPTION_OLDGLOBAL, oldval_g, -1); + set_mnv_var_string(VV_OPTION_COMMAND, (char_u *)"set", STRLEN_LITERAL("set")); + set_mnv_var_string(VV_OPTION_OLDLOCAL, oldval_l, -1); + set_mnv_var_string(VV_OPTION_OLDGLOBAL, oldval_g, -1); } if (opt_flags & OPT_MODELINE) { - set_vim_var_string(VV_OPTION_COMMAND, (char_u *)"modeline", STRLEN_LITERAL("modeline")); - set_vim_var_string(VV_OPTION_OLDLOCAL, oldval, (int)oldvallen); + set_mnv_var_string(VV_OPTION_COMMAND, (char_u *)"modeline", STRLEN_LITERAL("modeline")); + set_mnv_var_string(VV_OPTION_OLDLOCAL, oldval, (int)oldvallen); } apply_autocmds(EVENT_OPTIONSET, get_option_fullname(opt_idx), NULL, FALSE, @@ -266,7 +266,7 @@ illegal_char(char *errbuf, size_t errbuflen, int c) { if (errbuf == NULL) return ""; - vim_snprintf(errbuf, errbuflen, _(e_illegal_character_str), + mnv_snprintf(errbuf, errbuflen, _(e_illegal_character_str), (char *)transchar(c)); return errbuf; } @@ -276,7 +276,7 @@ illegal_char_after_chr(char *errbuf, size_t errbuflen, int c) { if (errbuf == NULL) return ""; - vim_snprintf(errbuf, errbuflen, _(e_illegal_character_after_chr), c); + mnv_snprintf(errbuf, errbuflen, _(e_illegal_character_after_chr), c); return errbuf; } @@ -382,7 +382,7 @@ check_buf_options(buf_T *buf) /* * Free the string allocated for an option. * Checks for the string being empty_option. This may happen if we're out of - * memory, vim_strsave() returned NULL, which was replaced by empty_option by + * memory, mnv_strsave() returned NULL, which was replaced by empty_option by * check_options(). * Does NOT check for P_ALLOCED flag! */ @@ -390,14 +390,14 @@ check_buf_options(buf_T *buf) free_string_option(char_u *p) { if (p != empty_option) - vim_free(p); + mnv_free(p); } void clear_string_option(char_u **pp) { if (*pp != empty_option) - vim_free(*pp); + mnv_free(*pp); *pp = empty_option; } @@ -425,7 +425,7 @@ set_string_option_global( p = (char_u **)get_option_var(opt_idx); if (!is_global_option(opt_idx) && p != varp - && (s = vim_strsave(*varp)) != NULL) + && (s = mnv_strsave(*varp)) != NULL) { free_string_option(*p); *p = s; @@ -467,7 +467,7 @@ set_string_option_direct( if (is_hidden_option(idx)) // can't set hidden option return; - s = vim_strsave(val); + s = mnv_strsave(val); if (s == NULL) return; @@ -589,7 +589,7 @@ set_string_option( if (is_hidden_option(opt_idx)) // don't set hidden option return NULL; - s = vim_strsave(value == NULL ? (char_u *)"" : value); + s = mnv_strsave(value == NULL ? (char_u *)"" : value); if (s == NULL) return NULL; @@ -616,11 +616,11 @@ set_string_option( ) { if (oldval_l != NULL) - saved_oldval_l = vim_strsave(oldval_l); + saved_oldval_l = mnv_strsave(oldval_l); if (oldval_g != NULL) - saved_oldval_g = vim_strsave(oldval_g); - saved_oldval = vim_strsave(oldval); - saved_newval = vim_strsave(s); + saved_oldval_g = mnv_strsave(oldval_g); + saved_oldval = mnv_strsave(oldval); + saved_newval = mnv_strsave(s); } #endif if ((errmsg = did_set_string_option(opt_idx, varp, oldval, value, errbuf, @@ -633,10 +633,10 @@ set_string_option( trigger_optionset_string(opt_idx, opt_flags, saved_oldval, saved_oldval_l, saved_oldval_g, saved_newval); - vim_free(saved_oldval); - vim_free(saved_oldval_l); - vim_free(saved_oldval_g); - vim_free(saved_newval); + mnv_free(saved_oldval); + mnv_free(saved_oldval_l); + mnv_free(saved_oldval_g); + mnv_free(saved_newval); #endif return errmsg; } @@ -690,14 +690,14 @@ check_stl_option(char_u *s) } if (*s == '-') s++; - while (VIM_ISDIGIT(*s)) + while (MNV_ISDIGIT(*s)) s++; if (*s == STL_USER_HL) continue; if (*s == '.') { s++; - while (*s && VIM_ISDIGIT(*s)) + while (*s && MNV_ISDIGIT(*s)) s++; } if (*s == '(') @@ -705,7 +705,7 @@ check_stl_option(char_u *s) groupdepth++; continue; } - if (vim_strchr(STL_ALL, *s) == NULL) + if (mnv_strchr(STL_ALL, *s) == NULL) { return illegal_char(errbuf, errbuflen, *s); } @@ -737,10 +737,10 @@ check_stl_option(char_u *s) check_illegal_path_names(int opt_idx, char_u **varp) { return (((get_option_flags(opt_idx) & P_NFNAME) - && vim_strpbrk(*varp, (char_u *)(secure + && mnv_strpbrk(*varp, (char_u *)(secure ? "/\\*?[|;&<>\r\n" : "/\\*?[<>\r\n")) != NULL) || ((get_option_flags(opt_idx) & P_NDNAME) - && vim_strpbrk(*varp, (char_u *)"*?[|;&<>\r\n") != NULL)); + && mnv_strpbrk(*varp, (char_u *)"*?[|;&<>\r\n") != NULL)); } /* @@ -779,7 +779,7 @@ did_set_option_listflag( char_u *s; for (s = val; *s; ++s) - if (vim_strchr(flags, *s) == NULL) + if (mnv_strchr(flags, *s) == NULL) return illegal_char(errbuf, errbuflen, *s); return NULL; @@ -812,10 +812,10 @@ expand_set_opt_string( if (include_orig_val && *option_val != NUL) { - p = vim_strsave(option_val); + p = mnv_strsave(option_val); if (p == NULL) { - VIM_CLEAR(*matches); + MNV_CLEAR(*matches); return FAIL; } (*matches)[count++] = p; @@ -828,14 +828,14 @@ expand_set_opt_string( if (STRCMP((char_u*)*val, option_val) == 0) continue; } - if (vim_regexec(regmatch, (char_u*)(*val), (colnr_T)0)) + if (mnv_regexec(regmatch, (char_u*)(*val), (colnr_T)0)) { - p = vim_strsave((char_u*)*val); + p = mnv_strsave((char_u*)*val); if (p == NULL) { if (count == 0) { - VIM_CLEAR(*matches); + MNV_CLEAR(*matches); return FAIL; } else @@ -846,7 +846,7 @@ expand_set_opt_string( } if (count == 0) { - VIM_CLEAR(*matches); + MNV_CLEAR(*matches); return FAIL; } *numMatches = count; @@ -927,17 +927,17 @@ expand_set_opt_callback_cb(char_u *val) return OK; if (xp->xp_pattern[0] != NUL && - !vim_regexec(regmatch, val, (colnr_T)0)) + !mnv_regexec(regmatch, val, (colnr_T)0)) return OK; - str = vim_strsave_escaped(val, (char_u *)" \t\\"); + str = mnv_strsave_escaped(val, (char_u *)" \t\\"); if (str == NULL) return FAIL; if (ga_grow(ga, 1) == FAIL) { - vim_free(str); + mnv_free(str); return FAIL; } @@ -970,12 +970,12 @@ expand_set_opt_callback( if (include_orig_val && *option_val != NUL) { - char_u *p = vim_strsave(option_val); + char_u *p = mnv_strsave(option_val); if (p == NULL) return FAIL; if (ga_grow(&ga, 1) == FAIL) { - vim_free(p); + mnv_free(p); return FAIL; } ((char_u **)ga.ga_data)[ga.ga_len] = p; @@ -1023,10 +1023,10 @@ expand_set_opt_listflag( if (include_orig_val) { - p = vim_strsave(option_val); + p = mnv_strsave(option_val); if (p == NULL) { - VIM_CLEAR(*matches); + MNV_CLEAR(*matches); return FAIL; } (*matches)[count++] = p; @@ -1034,10 +1034,10 @@ expand_set_opt_listflag( for (char_u *flag = flags; *flag != NUL; flag++) { - if (append && vim_strchr(option_val, *flag) != NULL) + if (append && mnv_strchr(option_val, *flag) != NULL) continue; - if (vim_strchr(cmdline_val, *flag) == NULL) + if (mnv_strchr(cmdline_val, *flag) == NULL) { if (include_orig_val && option_val[1] == NUL @@ -1047,12 +1047,12 @@ expand_set_opt_listflag( // existing flag. Just skip it to avoid duplicate. continue; } - p = vim_strnsave(flag, 1); + p = mnv_strnsave(flag, 1); if (p == NULL) { if (count == 0) { - VIM_CLEAR(*matches); + MNV_CLEAR(*matches); return FAIL; } else @@ -1064,7 +1064,7 @@ expand_set_opt_listflag( if (count == 0) { - VIM_CLEAR(*matches); + MNV_CLEAR(*matches); return FAIL; } *numMatches = count; @@ -1122,7 +1122,7 @@ did_set_background(optset_T *args) // scheme and set the colors again. do_unlet((char_u *)"g:colors_name", TRUE); free_string_option(p_bg); - p_bg = vim_strsave((char_u *)(dark ? "dark" : "light")); + p_bg = mnv_strsave((char_u *)(dark ? "dark" : "light")); check_string_option(&p_bg); init_highlight(FALSE, FALSE); } @@ -1151,7 +1151,7 @@ expand_set_background(optexpand_T *args, int *numMatches, char_u ***matches) char * did_set_backspace(optset_T *args UNUSED) { - if (VIM_ISDIGIT(*p_bs)) + if (MNV_ISDIGIT(*p_bs)) { if (*p_bs > '3' || p_bs[1] != NUL) return e_invalid_argument; @@ -1437,7 +1437,7 @@ expand_set_clipmethod(optexpand_T *args, int *numMatches, char_u ***matches) char **values; int count, pos = 0, start = 0; # ifdef FEAT_EVAL - dict_T *providers = get_vim_var_dict(VV_CLIPPROVIDERS); + dict_T *providers = get_mnv_var_dict(VV_CLIPPROVIDERS); # else dict_T *providers = NULL; # endif @@ -1470,7 +1470,7 @@ expand_set_clipmethod(optexpand_T *args, int *numMatches, char_u ***matches) hashitem_T *hi = ht->ht_array + i; if (!HASHITEM_EMPTY(hi)) - values[pos++] = (char *)vim_strsave(hi->hi_key); + values[pos++] = (char *)mnv_strsave(hi->hi_key); } values[pos++] = NULL; @@ -1482,8 +1482,8 @@ expand_set_clipmethod(optexpand_T *args, int *numMatches, char_u ***matches) matches); for (int i = start; i < count; i++) - vim_free(values[i]); - vim_free(values); + mnv_free(values[i]); + mnv_free(values); return result; } @@ -1619,8 +1619,8 @@ did_set_comments(optset_T *args) { while (*s && *s != ':') { - if (vim_strchr((char_u *)COM_ALL, *s) == NULL - && !VIM_ISDIGIT(*s) && *s != '-') + if (mnv_strchr((char_u *)COM_ALL, *s) == NULL + && !MNV_ISDIGIT(*s) && *s != '-') { errmsg = illegal_char(args->os_errbuf, args->os_errbuflen, *s); break; @@ -1674,7 +1674,7 @@ did_set_complete(optset_T *args) for (p = *varp; *p; ) { - vim_memset(buffer, 0, LSIZE); + mnv_memset(buffer, 0, LSIZE); buf_ptr = buffer; escape = 0; @@ -1695,16 +1695,16 @@ did_set_complete(optset_T *args) } *buf_ptr = NUL; - if (vim_strchr((char_u *)".wbuksid]tUFo", *buffer) == NULL) + if (mnv_strchr((char_u *)".wbuksid]tUFo", *buffer) == NULL) return illegal_char(args->os_errbuf, args->os_errbuflen, *buffer); - if (vim_strchr((char_u *)"ksF", *buffer) == NULL && *(buffer + 1) != NUL + if (mnv_strchr((char_u *)"ksF", *buffer) == NULL && *(buffer + 1) != NUL && *(buffer + 1) != '^') char_before = *buffer; else { // Test for a number after '^' - if ((t = vim_strchr(buffer, '^')) != NULL) + if ((t = mnv_strchr(buffer, '^')) != NULL) { *t++ = NUL; if (!*t) @@ -1713,7 +1713,7 @@ did_set_complete(optset_T *args) { for (; *t; t++) { - if (!vim_isdigit(*t)) + if (!mnv_isdigit(*t)) { char_before = '^'; break; @@ -1995,7 +1995,7 @@ did_set_cryptmethod(optset_T *args) if (*p_cm == NUL) { free_string_option(p_cm); - p_cm = vim_strsave((char_u *)"zip"); + p_cm = mnv_strsave((char_u *)"zip"); } // When using ":set cm=name" the local value is going to be empty. // Do that here, otherwise the crypt functions will still use the @@ -2061,9 +2061,9 @@ did_set_cscopequickfix(optset_T *args UNUSED) p = p_csqf; while (*p != NUL) { - if (vim_strchr((char_u *)CSQF_CMDS, *p) == NULL + if (mnv_strchr((char_u *)CSQF_CMDS, *p) == NULL || p[1] == NUL - || vim_strchr((char_u *)CSQF_FLAGS, p[1]) == NULL + || mnv_strchr((char_u *)CSQF_FLAGS, p[1]) == NULL || (p[2] != NUL && p[2] != ',')) return e_invalid_argument; else if (p[2] == NUL) @@ -2256,7 +2256,7 @@ did_set_encoding(optset_T *args) { if (!curbuf->b_p_ma && args->os_flags != OPT_GLOBAL) errmsg = e_cannot_make_changes_modifiable_is_off; - else if (vim_strchr(*varp, ',') != NULL) + else if (mnv_strchr(*varp, ',') != NULL) // No comma allowed in 'fileencoding'; catches confusing it // with 'fileencodings'. errmsg = e_invalid_argument; @@ -2274,7 +2274,7 @@ did_set_encoding(optset_T *args) p = enc_canonize(*varp); if (p != NULL) { - vim_free(*varp); + mnv_free(*varp); *varp = p; } if (varp == &p_enc) @@ -2317,11 +2317,11 @@ did_set_encoding(optset_T *args) } #if defined(MSWIN) - // $HOME, $VIM and $VIMRUNTIME may have characters in active code page. + // $HOME, $MNV and $MNVRUNTIME may have characters in active code page. if (varp == &p_enc) { init_homedir(); - init_vimdir(); + init_mnvdir(); } #endif } @@ -2530,7 +2530,7 @@ did_set_foldmarker(optset_T *args) char_u **varp = (char_u **)args->os_varp; char_u *p; - p = vim_strchr(*varp, ','); + p = mnv_strchr(*varp, ','); if (p == NULL) return e_comma_required; else if (p == *varp || p[1] == NUL) @@ -2640,7 +2640,7 @@ did_set_guifont(optset_T *args UNUSED) { p = gui_mch_font_dialog(args->os_oldval.string); free_string_option(p_guifont); - p_guifont = (p != NULL) ? p : vim_strsave(args->os_oldval.string); + p_guifont = (p != NULL) ? p : mnv_strsave(args->os_oldval.string); } # endif if (p != NULL && gui_init_font(p_guifont, FALSE) != OK) @@ -2651,7 +2651,7 @@ did_set_guifont(optset_T *args UNUSED) // Dialog was cancelled: Keep the old value without giving // an error message. free_string_option(p_guifont); - p_guifont = vim_strsave(args->os_oldval.string); + p_guifont = mnv_strsave(args->os_oldval.string); } else # endif @@ -2774,11 +2774,11 @@ did_set_guitablabel(optset_T *args UNUSED) char * did_set_helpfile(optset_T *args UNUSED) { - // May compute new values for $VIM and $VIMRUNTIME - if (didset_vim) - vim_unsetenv_ext((char_u *)"VIM"); - if (didset_vimruntime) - vim_unsetenv_ext((char_u *)"VIMRUNTIME"); + // May compute new values for $MNV and $MNVRUNTIME + if (didset_mnv) + mnv_unsetenv_ext((char_u *)"MNV"); + if (didset_mnvruntime) + mnv_unsetenv_ext((char_u *)"MNVRUNTIME"); return NULL; } @@ -2838,10 +2838,10 @@ expand_hl_occasions( // We still want to return the full option if it's requested. if (args->oe_include_orig_val) { - p = vim_strsave(args->oe_opt_value); + p = mnv_strsave(args->oe_opt_value); if (p == NULL) { - VIM_CLEAR(*matches); + MNV_CLEAR(*matches); return FAIL; } (*matches)[count++] = p; @@ -2854,7 +2854,7 @@ expand_hl_occasions( { if (count == 0) { - VIM_CLEAR(*matches); + MNV_CLEAR(*matches); return FAIL; } else @@ -2869,7 +2869,7 @@ expand_hl_occasions( if (count == 0) { - VIM_CLEAR(*matches); + MNV_CLEAR(*matches); return FAIL; } *numMatches = count; @@ -2922,7 +2922,7 @@ expand_set_highlight(optexpand_T *args, int *numMatches, char_u ***matches) for (i = 0; i < num_hl_modes; i++) { // Don't allow duplicates as these are unique flags - char_u *dup = vim_strchr(xp->xp_pattern + 1, p_hl_mode_values[i]); + char_u *dup = mnv_strchr(xp->xp_pattern + 1, p_hl_mode_values[i]); if (dup != NULL && (int)(dup - xp->xp_pattern) < pattern_len) continue; @@ -2930,12 +2930,12 @@ expand_set_highlight(optexpand_T *args, int *numMatches, char_u ***matches) if (pattern_len > 1 && p_hl_mode_values[i] == ':') continue; - p = vim_strnsave(xp->xp_pattern, pattern_len + 1); + p = mnv_strnsave(xp->xp_pattern, pattern_len + 1); if (p == NULL) { if (i == 0) { - VIM_CLEAR(*matches); + MNV_CLEAR(*matches); return FAIL; } else @@ -2947,7 +2947,7 @@ expand_set_highlight(optexpand_T *args, int *numMatches, char_u ***matches) } if (count == 0) { - VIM_CLEAR(*matches); + MNV_CLEAR(*matches); return FAIL; } *numMatches = count; @@ -2965,7 +2965,7 @@ parse_titleiconstring(optset_T *args UNUSED, int flagval UNUSED) char_u **varp = (char_u **)args->os_varp; // NULL => statusline syntax - if (vim_strchr(*varp, '%') && check_stl_option(*varp) == NULL) + if (mnv_strchr(*varp, '%') && check_stl_option(*varp) == NULL) stl_syntax |= flagval; else stl_syntax &= ~flagval; @@ -3132,8 +3132,8 @@ did_set_keymodel(optset_T *args UNUSED) if (check_opt_strings(p_km, p_km_values, TRUE) != OK) return e_invalid_argument; - km_stopsel = (vim_strchr(p_km, 'o') != NULL); - km_startsel = (vim_strchr(p_km, 'a') != NULL); + km_stopsel = (mnv_strchr(p_km, 'o') != NULL); + km_startsel = (mnv_strchr(p_km, 'a') != NULL); return NULL; } @@ -3557,11 +3557,11 @@ did_set_printencoding(optset_T *args UNUSED) { char_u *s, *p; - // Canonize 'printencoding' if VIM standard one + // Canonize 'printencoding' if MNV standard one p = enc_canonize(p_penc); if (p != NULL) { - vim_free(p_penc); + mnv_free(p_penc); p_penc = p; } else @@ -3723,13 +3723,13 @@ did_set_pumborder(optset_T *args) for (p = *varp; p != NULL && *p != NUL; ) { // end of token is either ',' or NUL - char_u *comma = vim_strchr(p, ','); + char_u *comma = mnv_strchr(p, ','); if (comma != NULL) len = (int)(comma - p); else len = (int)STRLEN(p); - token = vim_strnsave(p, len); + token = mnv_strnsave(p, len); if (token == NULL) goto error; @@ -3742,7 +3742,7 @@ did_set_pumborder(optset_T *args) if (have_border) { // multiple border styles not allowed - vim_free(token); + mnv_free(token); goto error; } have_border = TRUE; @@ -3791,11 +3791,11 @@ did_set_pumborder(optset_T *args) } else { - vim_free(token); + mnv_free(token); goto error; } - vim_free(token); + mnv_free(token); if (comma != NULL) p = comma + 1; // move to next token (skip comma) @@ -4286,7 +4286,7 @@ update_stlo_maxheight(char_u **varp, int actual_stlh) // Replace the last occurrence with the actual value. if (need_comma) buf[len++] = ','; - len += vim_snprintf((char *)buf + len, + len += mnv_snprintf((char *)buf + len, bufsize - len, "maxheight:%d", actual_stlh); need_comma = true; } @@ -4531,7 +4531,7 @@ did_set_term_option(optset_T *args) t_colors = colors; if (t_colors <= 1) { - vim_free(T_CCO); + mnv_free(T_CCO); T_CCO = empty_option; } #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS) @@ -4550,11 +4550,11 @@ did_set_term_option(optset_T *args) { out_str(T_ME); redraw_later(UPD_CLEAR); -#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) +#if defined(MSWIN) && (!defined(FEAT_GUI_MSWIN) || defined(MNVDLL)) // Since t_me has been set, this probably means that the user // wants to use this as default colors. Need to reset default // background/foreground colors. -# ifdef VIMDLL +# ifdef MNVDLL if (!gui.in_use && !gui.starting) # endif mch_set_normal_colors(); @@ -4785,12 +4785,12 @@ did_set_varsofttabstop(optset_T *args) char_u *cp; if (!((*varp)[0]) || ((*varp)[0] == '0' && !((*varp)[1]))) - VIM_CLEAR(curbuf->b_p_vsts_array); + MNV_CLEAR(curbuf->b_p_vsts_array); else { for (cp = *varp; *cp; ++cp) { - if (vim_isdigit(*cp)) + if (mnv_isdigit(*cp)) continue; if (*cp == ',' && cp > *varp && *(cp-1) != ',') continue; @@ -4801,7 +4801,7 @@ did_set_varsofttabstop(optset_T *args) if (tabstop_set(*varp, &(curbuf->b_p_vsts_array)) == OK) { if (oldarray) - vim_free(oldarray); + mnv_free(oldarray); } else return e_invalid_argument; @@ -4820,12 +4820,12 @@ did_set_vartabstop(optset_T *args) char_u *cp; if (!((*varp)[0]) || ((*varp)[0] == '0' && !((*varp)[1]))) - VIM_CLEAR(curbuf->b_p_vts_array); + MNV_CLEAR(curbuf->b_p_vts_array); else { for (cp = *varp; *cp; ++cp) { - if (vim_isdigit(*cp)) + if (mnv_isdigit(*cp)) continue; if (*cp == ',' && cp > *varp && *(cp-1) != ',') continue; @@ -4836,7 +4836,7 @@ did_set_vartabstop(optset_T *args) if (tabstop_set(*varp, &(curbuf->b_p_vts_array)) == OK) { - vim_free(oldarray); + mnv_free(oldarray); # ifdef FEAT_FOLDING if (foldmethodIsIndent(curwin)) foldUpdateAll(curwin); @@ -4874,20 +4874,20 @@ did_set_viewoptions(optset_T *args UNUSED) } #endif -#if defined(FEAT_VIMINFO) +#if defined(FEAT_MNVINFO) /* - * The 'viminfo' option is changed. + * The 'mnvinfo' option is changed. */ char * -did_set_viminfo(optset_T *args) +did_set_mnvinfo(optset_T *args) { char_u *s; char *errmsg = NULL; - for (s = p_viminfo; *s;) + for (s = p_mnvinfo; *s;) { // Check it's a valid character - if (vim_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL) + if (mnv_strchr((char_u *)"!\"%'/:<@cfhnrs", *s) == NULL) { errmsg = illegal_char(args->os_errbuf, args->os_errbuflen, *s); break; @@ -4902,21 +4902,21 @@ did_set_viminfo(optset_T *args) else if (*s == '%') { // optional number - while (vim_isdigit(*++s)) + while (mnv_isdigit(*++s)) ; } else if (*s == '!' || *s == 'h' || *s == 'c') ++s; // no extra chars else // must have a number { - while (vim_isdigit(*++s)) + while (mnv_isdigit(*++s)) ; - if (!VIM_ISDIGIT(*(s - 1))) + if (!MNV_ISDIGIT(*(s - 1))) { if (args->os_errbuf != NULL) { - vim_snprintf(args->os_errbuf, args->os_errbuflen, + mnv_snprintf(args->os_errbuf, args->os_errbuflen, _(e_missing_number_after_angle_str_angle), transchar_byte(*(s - 1))); errmsg = args->os_errbuf; @@ -4937,7 +4937,7 @@ did_set_viminfo(optset_T *args) break; } } - if (*p_viminfo && errmsg == NULL && get_viminfo_parameter('\'') < 0) + if (*p_mnvinfo && errmsg == NULL && get_mnvinfo_parameter('\'') < 0) errmsg = e_must_specify_a_value; return errmsg; @@ -5130,7 +5130,7 @@ expand_set_winhighlight(optexpand_T *args, int *numMatches, char_u ***matches) matches); } - VIM_CLEAR(*matches); + MNV_CLEAR(*matches); return FAIL; } @@ -5197,7 +5197,7 @@ do_filetype_autocmd(char_u **varp, int opt_flags, int value_changed) #ifdef FEAT_SPELL /* - * When the 'spelllang' option is set, source the spell/LANG.vim file in + * When the 'spelllang' option is set, source the spell/LANG.mnv file in * 'runtimepath'. */ static void @@ -5218,7 +5218,7 @@ do_spelllang_source(void) break; if (p > q) { - vim_snprintf((char *)fname, 200, "spell/%.*s.vim", + mnv_snprintf((char *)fname, 200, "spell/%.*s.mnv", (int)(p - q), q); source_runtime(fname, DIP_ALL); } @@ -5353,7 +5353,7 @@ did_set_string_option( if (varp == &p_rtp) { - export_myvimdir(); + export_mymnvdir(); #if defined(FEAT_LUA) update_package_paths_in_lua(); #endif @@ -5508,15 +5508,15 @@ restore_shm_value(void) if (--set_shm_recursive == 0) { set_option_value_give_err((char_u *)"shm", 0L, shm_buf, 0); - vim_memset(shm_buf, 0, SHM_LEN); + mnv_memset(shm_buf, 0, SHM_LEN); } } /* - * Export the environment variable $MYVIMDIR to the first item in runtimepath + * Export the environment variable $MYMNVDIR to the first item in runtimepath */ void -export_myvimdir(void) +export_mymnvdir(void) { int dofree = FALSE; char_u *p; @@ -5529,7 +5529,7 @@ export_myvimdir(void) buf.length = (size_t)copy_option_part(&q, buf.string, MAXPATHL, ","); - p = vim_getenv((char_u *)"MYVIMDIR", &dofree); + p = mnv_getenv((char_u *)"MYMNVDIR", &dofree); if (p == NULL || STRCMP(p, buf.string) != 0) { @@ -5541,9 +5541,9 @@ export_myvimdir(void) if (*q == '/') *q = '\\'; #endif - vim_setenv((char_u *)"MYVIMDIR", buf.string); + mnv_setenv((char_u *)"MYMNVDIR", buf.string); } if (dofree) - vim_free(p); - vim_free(buf.string); + mnv_free(p); + mnv_free(buf.string); } diff --git a/uvim/src/os_amiga.c b/uvim/src/os_amiga.c index db433e4442..940e29ee6b 100644 --- a/uvim/src/os_amiga.c +++ b/uvim/src/os_amiga.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -13,7 +13,7 @@ * Amiga system-dependent routines. */ -#include "vim.h" +#include "mnv.h" #include "version.h" #ifdef Window @@ -47,7 +47,7 @@ # include # define free_fib(x) FreeDosObject(DOS_FIB, x) #else -# define free_fib(x) vim_free(fib) +# define free_fib(x) mnv_free(fib) #endif #if defined(LATTICE) && !defined(SASC) && defined(FEAT_ARP) @@ -85,7 +85,7 @@ static int sortcmp(const void *a, const void *b); static BPTR raw_in = (BPTR)NULL; static BPTR raw_out = (BPTR)NULL; -static int close_win = FALSE; // set if Vim opened the window +static int close_win = FALSE; // set if MNV opened the window /* Use autoopen for AmigaOS4, AROS and MorphOS */ #if !defined(__amigaos4__) && !defined(__AROS__) && !defined(__MORPHOS__) @@ -105,9 +105,9 @@ int size_set = FALSE; // set to TRUE if window size was set #ifdef __GNUC__ static char version[] __attribute__((used)) = - "\0$VER: Vim " - VIM_VERSION_MAJOR_STR "." - VIM_VERSION_MINOR_STR + "\0$VER: MNV " + MNV_VERSION_MAJOR_STR "." + MNV_VERSION_MINOR_STR # ifdef PATCHLEVEL "." PATCHLEVEL # endif @@ -259,7 +259,7 @@ mch_init(void) #endif #ifdef AZTEC_C - Enable_Abort = 0; // disallow vim to be aborted + Enable_Abort = 0; // disallow mnv to be aborted #endif Columns = 80; Rows = 24; @@ -273,8 +273,8 @@ mch_init(void) raw_out = Output(); /* * If Input() is not interactive, then Output() will be (because of - * check in mch_check_win()). Used for "Vim -". - * Also check the other way around, for "Vim -h | more". + * check in mch_check_win()). Used for "MNV -". + * Also check the other way around, for "MNV -h | more". */ if (!IsInteractive(raw_in)) raw_in = raw_out; @@ -322,7 +322,7 @@ mch_check_win(int argc, char **argv) static char_u *(constrings[3]) = {(char_u *)"con:0/0/662/210/", (char_u *)"con:0/0/640/200/", (char_u *)"con:0/0/320/200/"}; - static char_u *winerr = (char_u *)N_("VIM: Can't open window!\n"); + static char_u *winerr = (char_u *)N_("MNV: Can't open window!\n"); struct WBArg *argp; int ac; char *av; @@ -490,10 +490,10 @@ mch_check_win(int argc, char **argv) ++i; continue; } - if (vim_strchr((char_u *)av, ' ')) + if (mnv_strchr((char_u *)av, ' ')) Write(fh, "\"", 1L); Write(fh, av, (long)strlen(av)); - if (vim_strchr((char_u *)av, ' ')) + if (mnv_strchr((char_u *)av, ' ')) Write(fh, "\"", 1L); Write(fh, " ", 1L); } @@ -670,7 +670,7 @@ mch_get_user_name(char_u *s, int len) if (pwd != NULL && pwd->pw_name && len > 0) { - vim_strncpy(s, (char_u *)pwd->pw_name, len - 1); + mnv_strncpy(s, (char_u *)pwd->pw_name, len - 1); return OK; } #endif @@ -687,7 +687,7 @@ mch_get_host_name(char_u *s, int len) #if !defined(__AROS__) gethostname(s, len); #else - vim_strncpy(s, "Amiga", len - 1); + mnv_strncpy(s, "Amiga", len - 1); #endif } @@ -759,7 +759,7 @@ mch_FullName( { if (i < len - 1 && (i == 0 || buf[i - 1] != ':')) buf[i++] = '/'; - vim_strncpy(buf + i, fname, len - i - 1); + mnv_strncpy(buf + i, fname, len - i - 1); } } } @@ -775,7 +775,7 @@ mch_FullName( int mch_isFullName(char_u *fname) { - return (vim_strchr(fname, ':') != NULL && *fname != ':'); + return (mnv_strchr(fname, ':') != NULL && *fname != ':'); } /* @@ -983,7 +983,7 @@ mch_exit(int r) if (close_win) Close(raw_in); if (r) - printf(_("Vim exiting with %d\n"), r); // somehow this makes :cq work!? + printf(_("MNV exiting with %d\n"), r); // somehow this makes :cq work!? exit(r); } @@ -1064,7 +1064,7 @@ mch_get_shellsize(void) // Read return sequence from input. if (Read(raw_in, answ, sizeof(answ) - 1) > 0) { - // Parse result and set Vim globals. + // Parse result and set MNV globals. if (sscanf(answ, scan, &Rows, &Columns) == 2) { // Restore console mode. @@ -1272,7 +1272,7 @@ dos_packet( int mch_call_shell( char_u *cmd, - int options) // SHELL_*, see vim.h + int options) // SHELL_*, see mnv.h { BPTR mydir; int x; @@ -1286,7 +1286,7 @@ mch_call_shell( if (close_win) { - // if Vim opened a window: Executing a shell may cause crashes + // if MNV opened a window: Executing a shell may cause crashes emsg(_(e_cannot_execute_shell_with_f_option)); return -1; } @@ -1366,7 +1366,7 @@ mch_call_shell( /* * separate shell name from argument */ - shellcmd = vim_strsave(p_sh); + shellcmd = mnv_strsave(p_sh); if (shellcmd == NULL) // out of memory, use Execute use_execute = 1; else @@ -1458,7 +1458,7 @@ mch_call_shell( retval = x; } } - vim_free(shellcmd); + mnv_free(shellcmd); #endif // AZTEC_C if ((mydir = CurrentDir(mydir)) != 0) // make sure we stay in the same directory @@ -1588,7 +1588,7 @@ mch_expandpath( } *dp = NUL; Result = MatchFirst((UBYTE *)starbuf, Anchor); - vim_free(starbuf); + mnv_free(starbuf); #ifdef FEAT_ARP } else @@ -1644,7 +1644,7 @@ Return: #ifdef __amigaos4__ FreeDosObject(DOS_ANCHORPATH, Anchor); #else - vim_free(Anchor); + mnv_free(Anchor); #endif return matches; @@ -1669,7 +1669,7 @@ mch_has_exp_wildcard(char_u *p) { if (*p == '\\' && p[1] != NUL) ++p; - else if (vim_strchr((char_u *)"*?[(#", *p) != NULL) + else if (mnv_strchr((char_u *)"*?[(#", *p) != NULL) return TRUE; } return FALSE; @@ -1683,7 +1683,7 @@ mch_has_wildcard(char_u *p) if (*p == '\\' && p[1] != NUL) ++p; else - if (vim_strchr((char_u *)"*?[(#$`", *p) != NULL + if (mnv_strchr((char_u *)"*?[(#$`", *p) != NULL || (*p == '~' && p[1] != NUL)) return TRUE; } @@ -1711,7 +1711,7 @@ mch_getenv(char_u *var) else #endif { - VIM_CLEAR(alloced); + MNV_CLEAR(alloced); retval = NULL; buf = alloc(IOSIZE); @@ -1721,16 +1721,16 @@ mch_getenv(char_u *var) len = GetVar((UBYTE *)var, buf, (long)(IOSIZE - 1), (long)0); if (len >= 0) { - retval = vim_strsave((char_u *)buf); + retval = mnv_strsave((char_u *)buf); alloced = retval; } - vim_free(buf); + mnv_free(buf); } - // if $VIM is not defined, use "vim:" instead - if (retval == NULL && STRCMP(var, "VIM") == 0) - retval = (char_u *)"vim:"; + // if $MNV is not defined, use "mnv:" instead + if (retval == NULL && STRCMP(var, "MNV") == 0) + retval = (char_u *)"mnv:"; return retval; } diff --git a/uvim/src/os_amiga.h b/uvim/src/os_amiga.h index 799bdd52d3..2f5903443d 100644 --- a/uvim/src/os_amiga.h +++ b/uvim/src/os_amiga.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* @@ -41,10 +41,10 @@ #endif #ifndef DFLT_RUNTIMEPATH -# define DFLT_RUNTIMEPATH "VIM:vimfiles,VIM:,VIM:vimfiles/after" +# define DFLT_RUNTIMEPATH "MNV:mnvfiles,MNV:,MNV:mnvfiles/after" #endif #ifndef CLEAN_RUNTIMEPATH -# define CLEAN_RUNTIMEPATH "VIM:vimfiles,VIM:,VIM:vimfiles/after" +# define CLEAN_RUNTIMEPATH "MNV:mnvfiles,MNV:,MNV:mnvfiles/after" #endif #ifndef BASENAMELEN @@ -109,64 +109,64 @@ typedef long off_t; * Names for the EXRC, HELP and temporary files. * Some of these may have been defined in the makefile. */ -#ifndef SYS_VIMRC_FILE -# define SYS_VIMRC_FILE "VIM:vimrc" +#ifndef SYS_MNVRC_FILE +# define SYS_MNVRC_FILE "MNV:mnvrc" #endif -#ifndef SYS_GVIMRC_FILE -# define SYS_GVIMRC_FILE "VIM:gvimrc" +#ifndef SYS_GMNVRC_FILE +# define SYS_GMNVRC_FILE "MNV:gmnvrc" #endif #ifndef SYS_MENU_FILE -# define SYS_MENU_FILE "VIM:menu.vim" +# define SYS_MENU_FILE "MNV:menu.mnv" #endif #ifndef DFLT_HELPFILE -# define DFLT_HELPFILE "VIM:doc/help.txt" +# define DFLT_HELPFILE "MNV:doc/help.txt" #endif #ifndef SYNTAX_FNAME -# define SYNTAX_FNAME "VIM:syntax/%s.vim" +# define SYNTAX_FNAME "MNV:syntax/%s.mnv" #endif #ifndef USR_EXRC_FILE # define USR_EXRC_FILE "HOME:.exrc" #endif #ifndef USR_EXRC_FILE2 -# define USR_EXRC_FILE2 "VIM:.exrc" +# define USR_EXRC_FILE2 "MNV:.exrc" #endif -#ifndef USR_VIMRC_FILE -# define USR_VIMRC_FILE "HOME:.vimrc" +#ifndef USR_MNVRC_FILE +# define USR_MNVRC_FILE "HOME:.mnvrc" #endif -#ifndef USR_VIMRC_FILE2 -# define USR_VIMRC_FILE2 "VIM:.vimrc" +#ifndef USR_MNVRC_FILE2 +# define USR_MNVRC_FILE2 "MNV:.mnvrc" #endif -#ifndef USR_VIMRC_FILE3 -# define USR_VIMRC_FILE3 "HOME:vimfiles/vimrc" +#ifndef USR_MNVRC_FILE3 +# define USR_MNVRC_FILE3 "HOME:mnvfiles/mnvrc" #endif -#ifndef USR_VIMRC_FILE4 -# define USR_VIMRC_FILE4 "S:.vimrc" +#ifndef USR_MNVRC_FILE4 +# define USR_MNVRC_FILE4 "S:.mnvrc" #endif -#ifndef VIM_DEFAULTS_FILE -# define VIM_DEFAULTS_FILE "VIM:defaults.vim" +#ifndef MNV_DEFAULTS_FILE +# define MNV_DEFAULTS_FILE "MNV:defaults.mnv" #endif -#ifndef EVIM_FILE -# define EVIM_FILE "VIM:evim.vim" +#ifndef EMNV_FILE +# define EMNV_FILE "MNV:emnv.mnv" #endif -#ifndef USR_GVIMRC_FILE -# define USR_GVIMRC_FILE "HOME:.gvimrc" +#ifndef USR_GMNVRC_FILE +# define USR_GMNVRC_FILE "HOME:.gmnvrc" #endif -#ifndef USR_GVIMRC_FILE2 -# define USR_GVIMRC_FILE2 "VIM:.gvimrc" +#ifndef USR_GMNVRC_FILE2 +# define USR_GMNVRC_FILE2 "MNV:.gmnvrc" #endif -#ifndef USR_GVIMRC_FILE3 -# define USR_GVIMRC_FILE3 "HOME:vimfiles/gvimrc" +#ifndef USR_GMNVRC_FILE3 +# define USR_GMNVRC_FILE3 "HOME:mnvfiles/gmnvrc" #endif -#ifndef USR_GVIMRC_FILE4 -# define USR_GVIMRC_FILE4 "S:.gvimrc" +#ifndef USR_GMNVRC_FILE4 +# define USR_GMNVRC_FILE4 "S:.gmnvrc" #endif -#ifdef FEAT_VIMINFO -# ifndef VIMINFO_FILE -# define VIMINFO_FILE "VIM:.viminfo" +#ifdef FEAT_MNVINFO +# ifndef MNVINFO_FILE +# define MNVINFO_FILE "MNV:.mnvinfo" # endif #endif @@ -174,12 +174,12 @@ typedef long off_t; # define EXRC_FILE ".exrc" #endif -#ifndef VIMRC_FILE -# define VIMRC_FILE ".vimrc" +#ifndef MNVRC_FILE +# define MNVRC_FILE ".mnvrc" #endif -#ifndef GVIMRC_FILE -# define GVIMRC_FILE ".gvimrc" +#ifndef GMNVRC_FILE +# define GMNVRC_FILE ".gmnvrc" #endif #ifndef DFLT_BDIR @@ -191,7 +191,7 @@ typedef long off_t; #endif #ifndef DFLT_VDIR -# define DFLT_VDIR "HOME:vimfiles/view" // default for 'viewdir' +# define DFLT_VDIR "HOME:mnvfiles/view" // default for 'viewdir' #endif #ifndef DFLT_MAXMEM @@ -208,4 +208,4 @@ int setenv(const char *, const char *); #define mch_remove(x) remove((char *)(x)) #define mch_rename(src, dst) rename(src, dst) #define mch_chdir(s) chdir(s) -#define vim_mkdir(x, y) mch_mkdir(x) +#define mnv_mkdir(x, y) mch_mkdir(x) diff --git a/uvim/src/os_dos.h b/uvim/src/os_dos.h index f53434824e..687b1cbfe2 100644 --- a/uvim/src/os_dos.h +++ b/uvim/src/os_dos.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* @@ -13,65 +13,65 @@ * Some of these may have been defined in the makefile or feature.h. */ -#ifndef SYS_VIMRC_FILE -# define SYS_VIMRC_FILE "$VIM\\vimrc" +#ifndef SYS_MNVRC_FILE +# define SYS_MNVRC_FILE "$MNV\\mnvrc" #endif -#ifndef USR_VIMRC_FILE -# define USR_VIMRC_FILE "$HOME\\_vimrc" +#ifndef USR_MNVRC_FILE +# define USR_MNVRC_FILE "$HOME\\_mnvrc" #endif -#ifndef USR_VIMRC_FILE2 -# define USR_VIMRC_FILE2 "$HOME\\vimfiles\\vimrc" +#ifndef USR_MNVRC_FILE2 +# define USR_MNVRC_FILE2 "$HOME\\mnvfiles\\mnvrc" #endif -#ifndef USR_VIMRC_FILE3 -# define USR_VIMRC_FILE3 "$VIM\\_vimrc" +#ifndef USR_MNVRC_FILE3 +# define USR_MNVRC_FILE3 "$MNV\\_mnvrc" #endif -#ifndef VIM_DEFAULTS_FILE -# define VIM_DEFAULTS_FILE "$VIMRUNTIME\\defaults.vim" +#ifndef MNV_DEFAULTS_FILE +# define MNV_DEFAULTS_FILE "$MNVRUNTIME\\defaults.mnv" #endif -#ifndef EVIM_FILE -# define EVIM_FILE "$VIMRUNTIME\\evim.vim" +#ifndef EMNV_FILE +# define EMNV_FILE "$MNVRUNTIME\\emnv.mnv" #endif #ifndef USR_EXRC_FILE # define USR_EXRC_FILE "$HOME\\_exrc" #endif #ifndef USR_EXRC_FILE2 -# define USR_EXRC_FILE2 "$VIM\\_exrc" +# define USR_EXRC_FILE2 "$MNV\\_exrc" #endif #ifdef FEAT_GUI -# ifndef SYS_GVIMRC_FILE -# define SYS_GVIMRC_FILE "$VIM\\gvimrc" +# ifndef SYS_GMNVRC_FILE +# define SYS_GMNVRC_FILE "$MNV\\gmnvrc" # endif -# ifndef USR_GVIMRC_FILE -# define USR_GVIMRC_FILE "$HOME\\_gvimrc" +# ifndef USR_GMNVRC_FILE +# define USR_GMNVRC_FILE "$HOME\\_gmnvrc" # endif -# ifndef USR_GVIMRC_FILE2 -# define USR_GVIMRC_FILE2 "$HOME\\vimfiles\\gvimrc" +# ifndef USR_GMNVRC_FILE2 +# define USR_GMNVRC_FILE2 "$HOME\\mnvfiles\\gmnvrc" # endif -# ifndef USR_GVIMRC_FILE3 -# define USR_GVIMRC_FILE3 "$VIM\\_gvimrc" +# ifndef USR_GMNVRC_FILE3 +# define USR_GMNVRC_FILE3 "$MNV\\_gmnvrc" # endif # ifndef SYS_MENU_FILE -# define SYS_MENU_FILE "$VIMRUNTIME\\menu.vim" +# define SYS_MENU_FILE "$MNVRUNTIME\\menu.mnv" # endif #endif #ifndef SYS_OPTWIN_FILE -# define SYS_OPTWIN_FILE "$VIMRUNTIME\\optwin.vim" +# define SYS_OPTWIN_FILE "$MNVRUNTIME\\optwin.mnv" #endif -#ifdef FEAT_VIMINFO -# ifndef VIMINFO_FILE -# define VIMINFO_FILE "$HOME\\_viminfo" +#ifdef FEAT_MNVINFO +# ifndef MNVINFO_FILE +# define MNVINFO_FILE "$HOME\\_mnvinfo" # endif -# ifndef VIMINFO_FILE2 -# define VIMINFO_FILE2 "$VIM\\_viminfo" +# ifndef MNVINFO_FILE2 +# define MNVINFO_FILE2 "$MNV\\_mnvinfo" # endif #endif -#ifndef VIMRC_FILE -# define VIMRC_FILE "_vimrc" +#ifndef MNVRC_FILE +# define MNVRC_FILE "_mnvrc" #endif #ifndef EXRC_FILE @@ -79,17 +79,17 @@ #endif #ifdef FEAT_GUI -# ifndef GVIMRC_FILE -# define GVIMRC_FILE "_gvimrc" +# ifndef GMNVRC_FILE +# define GMNVRC_FILE "_gmnvrc" # endif #endif #ifndef DFLT_HELPFILE -# define DFLT_HELPFILE "$VIMRUNTIME\\doc\\help.txt" +# define DFLT_HELPFILE "$MNVRUNTIME\\doc\\help.txt" #endif #ifndef SYNTAX_FNAME -# define SYNTAX_FNAME "$VIMRUNTIME\\syntax\\%s.vim" +# define SYNTAX_FNAME "$MNVRUNTIME\\syntax\\%s.mnv" #endif #ifndef DFLT_BDIR @@ -97,7 +97,7 @@ #endif #ifndef DFLT_VDIR -# define DFLT_VDIR "$HOME/vimfiles/view" // default for 'viewdir' +# define DFLT_VDIR "$HOME/mnvfiles/view" // default for 'viewdir' #endif #ifndef DFLT_DIR @@ -105,8 +105,8 @@ #endif #define DFLT_ERRORFILE "errors.err" -#define DFLT_RUNTIMEPATH "$HOME/vimfiles,$VIM/vimfiles,$VIMRUNTIME,$HOME/vimfiles/after,$VIM/vimfiles/after" -#define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" +#define DFLT_RUNTIMEPATH "$HOME/mnvfiles,$MNV/mnvfiles,$MNVRUNTIME,$HOME/mnvfiles/after,$MNV/mnvfiles/after" +#define CLEAN_RUNTIMEPATH "$MNV/mnvfiles,$MNVRUNTIME,$MNV/mnvfiles/after" #define CASE_INSENSITIVE_FILENAME // ignore case when comparing file names #define SPACE_IN_FILENAME diff --git a/uvim/src/os_haiku.h b/uvim/src/os_haiku.h index cd6feb2c16..95c8c4a702 100644 --- a/uvim/src/os_haiku.h +++ b/uvim/src/os_haiku.h @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * Haiku port by Siarzhuk Zharski * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* @@ -13,31 +13,31 @@ #define USE_TERM_CONSOLE -#define USR_VIM_DIR "$BE_USER_SETTINGS/vim" +#define USR_MNV_DIR "$BE_USER_SETTINGS/mnv" -#define USR_EXRC_FILE USR_VIM_DIR "/exrc" -#define USR_EXRC_FILE2 USR_VIM_DIR "/vim/exrc" -#define USR_VIMRC_FILE USR_VIM_DIR "/vimrc" -#define USR_VIMRC_FILE2 USR_VIM_DIR "/vim/vimrc" -#define USR_GVIMRC_FILE USR_VIM_DIR "/gvimrc" -#define USR_GVIMRC_FILE2 USR_VIM_DIR "/vim/gvimrc" -#define VIMINFO_FILE USR_VIM_DIR "/viminfo" +#define USR_EXRC_FILE USR_MNV_DIR "/exrc" +#define USR_EXRC_FILE2 USR_MNV_DIR "/mnv/exrc" +#define USR_MNVRC_FILE USR_MNV_DIR "/mnvrc" +#define USR_MNVRC_FILE2 USR_MNV_DIR "/mnv/mnvrc" +#define USR_GMNVRC_FILE USR_MNV_DIR "/gmnvrc" +#define USR_GMNVRC_FILE2 USR_MNV_DIR "/mnv/gmnvrc" +#define MNVINFO_FILE USR_MNV_DIR "/mnvinfo" #ifdef RUNTIME_GLOBAL # ifdef RUNTIME_GLOBAL_AFTER -# define DFLT_RUNTIMEPATH USR_VIM_DIR "," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL_AFTER "," USR_VIM_DIR "/after" -# define XDG_RUNTIMEPATH "$XDG_CONFIG_HOME/vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL_AFTER ",$XDG_CONFIG_HOME/vim/after" -# define XDG_RUNTIMEPATH_FB "~/config/settings/vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL_AFTER ",~/config/settings/vim/after" -# define CLEAN_RUNTIMEPATH RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL_AFTER +# define DFLT_RUNTIMEPATH USR_MNV_DIR "," RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL_AFTER "," USR_MNV_DIR "/after" +# define XDG_RUNTIMEPATH "$XDG_CONFIG_HOME/mnv," RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL_AFTER ",$XDG_CONFIG_HOME/mnv/after" +# define XDG_RUNTIMEPATH_FB "~/config/settings/mnv," RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL_AFTER ",~/config/settings/mnv/after" +# define CLEAN_RUNTIMEPATH RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL_AFTER # else -# define DFLT_RUNTIMEPATH USR_VIM_DIR "," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after," USR_VIM_DIR "/after" -# define XDG_RUNTIMEPATH "$XDG_CONFIG_HOME/vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after,$XDG_CONFIG_HOME/vim/after" -# define XDG_RUNTIMEPATH_FB "~/config/settings/vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after,~/config/settings/vim/after" -# define CLEAN_RUNTIMEPATH RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after" +# define DFLT_RUNTIMEPATH USR_MNV_DIR "," RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL "/after," USR_MNV_DIR "/after" +# define XDG_RUNTIMEPATH "$XDG_CONFIG_HOME/mnv," RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL "/after,$XDG_CONFIG_HOME/mnv/after" +# define XDG_RUNTIMEPATH_FB "~/config/settings/mnv," RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL "/after,~/config/settings/mnv/after" +# define CLEAN_RUNTIMEPATH RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL "/after" # endif #else -# define DFLT_RUNTIMEPATH USR_VIM_DIR ",$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after," USR_VIM_DIR "/after" -# define XDG_RUNTIMEPATH "$XDG_CONFIG_HOME/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$XDG_CONFIG_HOME/vim/after" -# define XDG_RUNTIMEPATH_FB "~/config/settings/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/config/settings/vim/after" -# define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" +# define DFLT_RUNTIMEPATH USR_MNV_DIR ",$MNV/mnvfiles,$MNVRUNTIME,$MNV/mnvfiles/after," USR_MNV_DIR "/after" +# define XDG_RUNTIMEPATH "$XDG_CONFIG_HOME/mnv,$MNV/mnvfiles,$MNVRUNTIME,$MNV/mnvfiles/after,$XDG_CONFIG_HOME/mnv/after" +# define XDG_RUNTIMEPATH_FB "~/config/settings/mnv,$MNV/mnvfiles,$MNVRUNTIME,$MNV/mnvfiles/after,~/config/settings/mnv/after" +# define CLEAN_RUNTIMEPATH "$MNV/mnvfiles,$MNVRUNTIME,$MNV/mnvfiles/after" #endif diff --git a/uvim/src/os_haiku.rdef.in b/uvim/src/os_haiku.rdef.in index 64ba9f4a10..d774da4d62 100644 --- a/uvim/src/os_haiku.rdef.in +++ b/uvim/src/os_haiku.rdef.in @@ -2,7 +2,7 @@ * os_haiku.rdef.in: Assets and resources file for Haiku */ -resource app_signature "application/x-vnd.Haiku-Vim-8"; +resource app_signature "application/x-vnd.Haiku-MNV-8"; resource app_version { major = @MAJOR@, @@ -11,8 +11,8 @@ resource app_version { variety = B_APPV_FINAL, internal = 0, - short_info = "VIM Editor", - long_info = "VI Improved Editor by Bram Moolenaar et al." + short_info = "MNV Editor", + long_info = "MNV is not Vim Editor by Bram Moolenaar et al." }; resource app_flags B_MULTIPLE_LAUNCH; diff --git a/uvim/src/os_mac.h b/uvim/src/os_mac.h index f171d7ccf6..5587f2b9de 100644 --- a/uvim/src/os_mac.h +++ b/uvim/src/os_mac.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ #ifndef OS_MAC__H @@ -28,7 +28,7 @@ */ #if defined(__APPLE_CC__) // for Project Builder and ... # include -// Get stat.h or something similar. Comment: How come some OS get in vim.h +// Get stat.h or something similar. Comment: How come some OS get in mnv.h # include // && defined(HAVE_CURSE) // The curses.h from MacOS X provides by default some BACKWARD compatibility @@ -58,21 +58,21 @@ // This will go away when CMD_KEY fully tested #define USE_CMD_KEY // On MacOS X use the / not the : -// TODO: Should file such as ~/.vimrc reside instead in -// ~/Library/Vim or ~/Library/Preferences/org.vim.vim/ ? (Dany) +// TODO: Should file such as ~/.mnvrc reside instead in +// ~/Library/MNV or ~/Library/Preferences/org.mnv.mnv/ ? (Dany) // When compiled under MacOS X (including CARBON version) // we use the Unix File path style. Also when UNIX is defined. #define USE_UNIXFILENAME /* - * Generic Vim #define for Mac + * Generic MNV #define for Mac */ #define FEAT_SOURCE_FFS #define FEAT_SOURCE_FF_MAC -#define USE_EXE_NAME // to find $VIM +#define USE_EXE_NAME // to find $MNV #define CASE_INSENSITIVE_FILENAME // ignore case when comparing file names #define SPACE_IN_FILENAME @@ -102,43 +102,43 @@ * Some of these may have been defined in the makefile. */ -#ifndef SYS_VIMRC_FILE -# define SYS_VIMRC_FILE "$VIM/vimrc" +#ifndef SYS_MNVRC_FILE +# define SYS_MNVRC_FILE "$MNV/mnvrc" #endif -#ifndef SYS_GVIMRC_FILE -# define SYS_GVIMRC_FILE "$VIM/gvimrc" +#ifndef SYS_GMNVRC_FILE +# define SYS_GMNVRC_FILE "$MNV/gmnvrc" #endif #ifndef SYS_MENU_FILE -# define SYS_MENU_FILE "$VIMRUNTIME/menu.vim" +# define SYS_MENU_FILE "$MNVRUNTIME/menu.mnv" #endif #ifndef SYS_OPTWIN_FILE -# define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim" +# define SYS_OPTWIN_FILE "$MNVRUNTIME/optwin.mnv" #endif -#ifndef VIM_DEFAULTS_FILE -# define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim" +#ifndef MNV_DEFAULTS_FILE +# define MNV_DEFAULTS_FILE "$MNVRUNTIME/defaults.mnv" #endif -#ifndef EVIM_FILE -# define EVIM_FILE "$VIMRUNTIME/evim.vim" +#ifndef EMNV_FILE +# define EMNV_FILE "$MNVRUNTIME/emnv.mnv" #endif #ifdef FEAT_GUI -# ifndef USR_GVIMRC_FILE -# define USR_GVIMRC_FILE "~/.gvimrc" +# ifndef USR_GMNVRC_FILE +# define USR_GMNVRC_FILE "~/.gmnvrc" # endif -# ifndef GVIMRC_FILE -# define GVIMRC_FILE "_gvimrc" +# ifndef GMNVRC_FILE +# define GMNVRC_FILE "_gmnvrc" # endif #endif -#ifndef USR_VIMRC_FILE -# define USR_VIMRC_FILE "~/.vimrc" +#ifndef USR_MNVRC_FILE +# define USR_MNVRC_FILE "~/.mnvrc" #endif #ifndef USR_EXRC_FILE # define USR_EXRC_FILE "~/.exrc" #endif -#ifndef VIMRC_FILE -# define VIMRC_FILE "_vimrc" +#ifndef MNVRC_FILE +# define MNVRC_FILE "_mnvrc" #endif #ifndef EXRC_FILE @@ -146,18 +146,18 @@ #endif #ifndef DFLT_HELPFILE -# define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt" +# define DFLT_HELPFILE "$MNVRUNTIME/doc/help.txt" #endif #ifndef SYNTAX_FNAME -# define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim" +# define SYNTAX_FNAME "$MNVRUNTIME/syntax/%s.mnv" #endif -#ifdef FEAT_VIMINFO -# ifndef VIMINFO_FILE -# define VIMINFO_FILE "~/.viminfo" +#ifdef FEAT_MNVINFO +# ifndef MNVINFO_FILE +# define MNVINFO_FILE "~/.mnvinfo" # endif -#endif // FEAT_VIMINFO +#endif // FEAT_MNVINFO #ifndef DFLT_BDIR # define DFLT_BDIR "." // default for 'backupdir' @@ -168,16 +168,16 @@ #endif #ifndef DFLT_VDIR -# define DFLT_VDIR "$VIM/vimfiles/view" // default for 'viewdir' +# define DFLT_VDIR "$MNV/mnvfiles/view" // default for 'viewdir' #endif #define DFLT_ERRORFILE "errors.err" #ifndef DFLT_RUNTIMEPATH -# define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after" +# define DFLT_RUNTIMEPATH "~/.mnv,$MNV/mnvfiles,$MNVRUNTIME,$MNV/mnvfiles/after,~/.mnv/after" #endif #ifndef CLEAN_RUNTIMEPATH -# define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" +# define CLEAN_RUNTIMEPATH "$MNV/mnvfiles,$MNVRUNTIME,$MNV/mnvfiles/after" #endif /* @@ -190,7 +190,7 @@ #endif #ifndef DFLT_MAXMEMTOT -# define DFLT_MAXMEMTOT 2048 // use up to 2048 Kbyte for Vim +# define DFLT_MAXMEMTOT 2048 // use up to 2048 Kbyte for MNV #endif #define WILDCHAR_LIST "*?[{`$" @@ -203,9 +203,9 @@ # define mch_getenv(name) ((char_u *)getenv((char *)(name))) # define mch_setenv(name, val, x) setenv(name, val, x) # else - // vim_getenv() is in pty.c -# define USE_VIMPTY_GETENV -# define mch_getenv(x) vimpty_getenv(x) + // mnv_getenv() is in pty.c +# define USE_MNVPTY_GETENV +# define mch_getenv(x) mnvpty_getenv(x) # define mch_setenv(name, val, x) setenv(name, val, x) # endif #endif diff --git a/uvim/src/os_mac_conv.c b/uvim/src/os_mac_conv.c index 7327cba9df..763b950c0f 100644 --- a/uvim/src/os_mac_conv.c +++ b/uvim/src/os_mac_conv.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * os_mac_conv.c: Code specifically for Mac string conversions. @@ -15,7 +15,7 @@ #define NO_X11_INCLUDES -#include "vim.h" +#include "mnv.h" #include @@ -114,7 +114,7 @@ mac_string_convert( CFRelease(cfstr); if (fail_on_error) { - vim_free(retval); + mnv_free(retval); return NULL; } @@ -249,7 +249,7 @@ enc2macroman( if (r.length != CFStringGetBytes(cfstr, r, kCFStringEncodingMacRoman, 0, // no lossy conversion - 0, // not external representation (since vim + 0, // not external representation (since mnv // handles this internally) to, maxtolen, &l)) { @@ -327,7 +327,7 @@ mac_utf16_to_enc( size_t *actualLen) { // Following code borrows somewhat from os_mswin.c - vimconv_T conv; + mnvconv_T conv; size_t utf8_len; char_u *utf8_str; char_u *result = NULL; @@ -341,7 +341,7 @@ mac_utf16_to_enc( // We might be called before we have p_enc set up. conv.vc_type = CONV_NONE; - // If encoding (p_enc) is any unicode, it is actually in utf-8 (vim + // If encoding (p_enc) is any unicode, it is actually in utf-8 (mnv // internal unicode is always utf-8) so don't convert in such cases if ((enc_canon_props(p_enc) & ENC_UNICODE) == 0) @@ -357,7 +357,7 @@ mac_utf16_to_enc( int len = utf8_len; result = string_convert(&conv, utf8_str, &len); utf8_len = len; - vim_free(utf8_str); + mnv_free(utf8_str); } convert_setup(&conv, NULL, NULL); @@ -383,7 +383,7 @@ mac_enc_to_utf16( size_t *actualLen) { // Following code borrows somewhat from os_mswin.c - vimconv_T conv; + mnvconv_T conv; size_t utf8_len; char_u *utf8_str; UniChar *result = NULL; @@ -420,7 +420,7 @@ mac_enc_to_utf16( result = mac_utf8_to_utf16(utf8_str, utf8_len, actualLen); if (should_free_utf8) - vim_free(utf8_str); + mnv_free(utf8_str); return result; } while (0); @@ -448,7 +448,7 @@ mac_enc_to_cfstring( if (utf16_str) { result = CFStringCreateWithCharacters(NULL, utf16_str, utf16_len/sizeof(UniChar)); - vim_free(utf16_str); + mnv_free(utf16_str); } return (void *)result; @@ -474,7 +474,7 @@ mac_precompose_path( if (TECConvertText(gPathConverter, decompPath, decompLen, &decompLen, result, decompLen, &actualLen) != noErr) - VIM_CLEAR(result); + MNV_CLEAR(result); } } @@ -508,7 +508,7 @@ mac_utf16_to_utf8( utf8_len += inputRead; } else - VIM_CLEAR(result); + MNV_CLEAR(result); } else { @@ -558,7 +558,7 @@ mac_utf8_to_utf16( } /* - * Sets LANG environment variable in Vim from Mac locale + * Sets LANG environment variable in MNV from Mac locale */ void mac_lang_init(void) @@ -568,7 +568,7 @@ mac_lang_init(void) char buf[50]; - // $LANG is not set, either because it was unset or Vim was started + // $LANG is not set, either because it was unset or MNV was started // from the Dock. Query the system locale. if (LocaleRefGetPartString(NULL, kLocaleLanguageMask | kLocaleLanguageVariantMask | @@ -577,7 +577,7 @@ mac_lang_init(void) { if (strcasestr(buf, "utf-8") == NULL) strcat(buf, ".UTF-8"); - vim_setenv((char_u *)"LANG", (char_u *)buf); + mnv_setenv((char_u *)"LANG", (char_u *)buf); #ifdef HAVE_LOCALE_H setlocale(LC_ALL, ""); #endif diff --git a/uvim/src/os_macosx.m b/uvim/src/os_macosx.m index 1a633b9d6c..0e8bfc4dfe 100644 --- a/uvim/src/os_macosx.m +++ b/uvim/src/os_macosx.m @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -32,7 +32,7 @@ #include #endif -#include "vim.h" +#include "mnv.h" #import @@ -41,9 +41,9 @@ */ #if defined(FEAT_CLIPBOARD) -/* Used to identify clipboard data copied from Vim. */ +/* Used to identify clipboard data copied from MNV. */ -NSString *VimPboardType = @"VimPboardType"; +NSString *MNVPboardType = @"MNVPboardType"; void clip_mch_lose_selection(Clipboard_T *cbd UNUSED) @@ -70,10 +70,10 @@ clip_mch_request_selection(Clipboard_T *cbd) NSPasteboard *pb = [NSPasteboard generalPasteboard]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 - NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType, + NSArray *supportedTypes = [NSArray arrayWithObjects:MNVPboardType, NSPasteboardTypeString, nil]; #else - NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType, + NSArray *supportedTypes = [NSArray arrayWithObjects:MNVPboardType, NSStringPboardType, nil]; #endif NSString *bestType = [pb availableTypeFromArray:supportedTypes]; @@ -82,14 +82,14 @@ clip_mch_request_selection(Clipboard_T *cbd) int motion_type = MAUTO; NSString *string = nil; - if ([bestType isEqual:VimPboardType]) + if ([bestType isEqual:MNVPboardType]) { /* This type should consist of an array with two objects: * 1. motion type (NSNumber) * 2. text (NSString) * If this is not the case we fall back on using NSPasteboardTypeString. */ - id plist = [pb propertyListForType:VimPboardType]; + id plist = [pb propertyListForType:MNVPboardType]; if ([plist isKindOfClass:[NSArray class]] && [plist count] == 2) { id obj = [plist objectAtIndex:1]; @@ -143,7 +143,7 @@ clip_mch_request_selection(Clipboard_T *cbd) clip_yank_selection(motion_type, str, len, cbd); if (input_conv.vc_type != CONV_NONE) - vim_free(str); + mnv_free(str); releasepool: [pool release]; @@ -176,7 +176,7 @@ clip_mch_set_selection(Clipboard_T *cbd) char_u *conv_str = string_convert(&output_conv, str, &len); if (conv_str) { - vim_free(str); + mnv_free(str); str = conv_str; } } @@ -189,17 +189,17 @@ clip_mch_set_selection(Clipboard_T *cbd) /* See clip_mch_request_selection() for info on pasteboard types. */ NSPasteboard *pb = [NSPasteboard generalPasteboard]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 - NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType, + NSArray *supportedTypes = [NSArray arrayWithObjects:MNVPboardType, NSPasteboardTypeString, nil]; #else - NSArray *supportedTypes = [NSArray arrayWithObjects:VimPboardType, + NSArray *supportedTypes = [NSArray arrayWithObjects:MNVPboardType, NSStringPboardType, nil]; #endif [pb declareTypes:supportedTypes owner:nil]; NSNumber *motion = [NSNumber numberWithInt:motion_type]; NSArray *plist = [NSArray arrayWithObjects:motion, string, nil]; - [pb setPropertyList:plist forType:VimPboardType]; + [pb setPropertyList:plist forType:MNVPboardType]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 [pb setString:string forType:NSPasteboardTypeString]; @@ -210,7 +210,7 @@ clip_mch_set_selection(Clipboard_T *cbd) [string release]; } - vim_free(str); + mnv_free(str); releasepool: [pool release]; } @@ -302,7 +302,7 @@ timer_create(clockid_t clockid, struct sigevent *sevp, timer_t *timerid) *timerid = timer; timer->tim_queue = dispatch_queue_create( - "org.vim.timerqueue", NULL); + "org.mnv.timerqueue", NULL); if (timer->tim_queue == NULL) { errno = ENOMEM; diff --git a/uvim/src/os_mswin.c b/uvim/src/os_mswin.c index be71fac73f..7b38d2c920 100644 --- a/uvim/src/os_mswin.c +++ b/uvim/src/os_mswin.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -13,7 +13,7 @@ * Routines for Win32. */ -#include "vim.h" +#include "mnv.h" #include #include @@ -38,7 +38,7 @@ FILE* fdDump = NULL; #endif -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) extern char g_szOrigTitle[]; #endif @@ -159,12 +159,12 @@ mch_early_init(void) mch_input_isatty(void) { #ifdef FEAT_GUI_MSWIN -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) # endif return TRUE; // GUI always has a tty #endif -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) if (isatty(read_cmd_fd)) return TRUE; return FALSE; @@ -180,7 +180,7 @@ mch_settitle( char_u *icon UNUSED) { #ifdef FEAT_GUI_MSWIN -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) # endif { @@ -188,7 +188,7 @@ mch_settitle( return; } #endif -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) if (title != NULL) { WCHAR *wp = enc_to_utf16(title, NULL); @@ -197,7 +197,7 @@ mch_settitle( return; SetConsoleTitleW(wp); - vim_free(wp); + mnv_free(wp); return; } #endif @@ -214,8 +214,8 @@ mch_settitle( void mch_restore_title(int which UNUSED) { -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) -# ifdef VIMDLL +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) +# ifdef MNVDLL if (!gui.in_use) # endif SetConsoleTitle(g_szOrigTitle); @@ -268,12 +268,12 @@ mch_FullName( cname = utf16_to_enc((short_u *)wbuf, NULL); if (cname != NULL) { - vim_strncpy(buf, cname, len - 1); + mnv_strncpy(buf, cname, len - 1); nResult = OK; } } - vim_free(wname); - vim_free(cname); + mnv_free(wname); + mnv_free(cname); #ifdef USE_FNAME_CASE fname_case(buf, len); @@ -377,7 +377,7 @@ resolve_appexeclink(char_u *fname) if (attr == INVALID_FILE_ATTRIBUTES || (attr & FILE_ATTRIBUTE_REPARSE_POINT) == 0) { - vim_free(wname); + mnv_free(wname); return NULL; } @@ -386,10 +386,10 @@ resolve_appexeclink(char_u *fname) // ERROR_FILE_NOT_FOUND even though the file exists. if (read_reparse_point(wname, buf, &buf_len) == FAIL) { - vim_free(wname); + mnv_free(wname); return NULL; } - vim_free(wname); + mnv_free(wname); if (rb->ReparseTag != IO_REPARSE_TAG_APPEXECLINK) return NULL; @@ -445,7 +445,7 @@ mswin_stat_impl(const WCHAR *name, stat_T *stp, const int resolve) // The expected behavior occurs when linking to a static runtime. However, // the expected behavior does not occur when linking to a dynamic runtime, // and it succeeds for empty symlinks. This causes Test_glob_symlinks in - // test_functions.vim to fail when linking to a dynamic runtime. + // test_functions.mnv to fail when linking to a dynamic runtime. // // For more details, see: // https://github.com/koron/vc-stat-behavior-verification @@ -504,7 +504,7 @@ stat_impl(const char *name, stat_T *stp, const int resolve) WCHAR *wp; int n; - vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1); + mnv_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1); buflen = STRLEN(buf); p = buf + buflen; if (p > buf) @@ -520,10 +520,10 @@ stat_impl(const char *name, stat_T *stp, const int resolve) if ((buf[0] == '\\' && buf[1] == '\\') || (buf[0] == '/' && buf[1] == '/')) { // UNC root path must be followed by '\\'. - p = vim_strpbrk(buf + 2, (char_u *)"\\/"); + p = mnv_strpbrk(buf + 2, (char_u *)"\\/"); if (p != NULL) { - p = vim_strpbrk(p + 1, (char_u *)"\\/"); + p = mnv_strpbrk(p + 1, (char_u *)"\\/"); if (p == NULL) STRCPY(buf + buflen, "\\"); } @@ -534,23 +534,23 @@ stat_impl(const char *name, stat_T *stp, const int resolve) return -1; n = mswin_stat_impl(wp, stp, resolve); - vim_free(wp); + mnv_free(wp); return n; } int -vim_lstat(const char *name, stat_T *stp) +mnv_lstat(const char *name, stat_T *stp) { return stat_impl(name, stp, FALSE); } int -vim_stat(const char *name, stat_T *stp) +mnv_stat(const char *name, stat_T *stp) { return stat_impl(name, stp, TRUE); } -#if defined(FEAT_GUI_MSWIN) && !defined(VIMDLL) +#if defined(FEAT_GUI_MSWIN) && !defined(MNVDLL) void mch_settmode(tmode_T tmode UNUSED) { @@ -605,7 +605,7 @@ display_errors(void) # ifdef FEAT_GUI char_u *p; -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use || gui.starting) # endif { @@ -619,8 +619,8 @@ display_errors(void) // write text to a file. if (!gui_dialog_log((char_u *)"Errors", p)) (void)gui_mch_dialog( - gui.starting ? VIM_INFO : - VIM_ERROR, + gui.starting ? MNV_INFO : + MNV_ERROR, gui.starting ? (char_u *)_("Message") : (char_u *)_("Error"), p, (char_u *)_("&Ok"), @@ -632,7 +632,7 @@ display_errors(void) return; } # endif -# if !defined(FEAT_GUI) || defined(VIMDLL) +# if !defined(FEAT_GUI) || defined(MNVDLL) FlushFileBuffers(GetStdHandle(STD_ERROR_HANDLE)); # endif } @@ -648,7 +648,7 @@ mch_has_exp_wildcard(char_u *p) { for ( ; *p; MB_PTR_ADV(p)) { - if (vim_strchr((char_u *)"?*[", *p) != NULL + if (mnv_strchr((char_u *)"?*[", *p) != NULL || (*p == '~' && p[1] != NUL)) return TRUE; } @@ -664,7 +664,7 @@ mch_has_wildcard(char_u *p) { for ( ; *p; MB_PTR_ADV(p)) { - if (vim_strchr((char_u *)"?*$[`", *p) != NULL + if (mnv_strchr((char_u *)"?*$[`", *p) != NULL || (*p == '~' && p[1] != NUL)) return TRUE; } @@ -708,12 +708,12 @@ mch_chdir(char *path) return -1; n = _wchdir(p); - vim_free(p); + mnv_free(p); return n; } -#if defined(FEAT_GUI_MSWIN) && !defined(VIMDLL) +#if defined(FEAT_GUI_MSWIN) && !defined(MNVDLL) /* * return non-zero if a character is available */ @@ -790,7 +790,7 @@ check_str_len(char_u *str) } /* - * Passed to do_in_runtimepath() to load a vim.ico file. + * Passed to do_in_runtimepath() to load a mnv.ico file. */ static void mch_icon_load_cb(char_u *fname, void *cookie) @@ -811,7 +811,7 @@ mch_icon_load_cb(char_u *fname, void *cookie) int mch_icon_load(HANDLE *iconp) { - return do_in_runtimepath((char_u *)"bitmaps/vim.ico", + return do_in_runtimepath((char_u *)"bitmaps/mnv.ico", 0, mch_icon_load_cb, iconp); } @@ -828,7 +828,7 @@ mch_get_random(char_u *buf, int len) if (initialized == NOTDONE) { - hInstLib = vimLoadLib("bcryptprimitives.dll"); + hInstLib = mnvLoadLib("bcryptprimitives.dll"); if (hInstLib != NULL) pProcessPrng = (void *)GetProcAddress(hInstLib, "ProcessPrng"); if (hInstLib == NULL || pProcessPrng == NULL) @@ -863,7 +863,7 @@ mch_libcall( BOOL fRunTimeLinkSuccess = FALSE; // Get a handle to the DLL module. - hinstLib = vimLoadLib((char *)libname); + hinstLib = mnvLoadLib((char *)libname); // If the handle is valid, try to get the function address. if (hinstLib != NULL) @@ -1001,7 +1001,7 @@ Trace( #endif //_DEBUG -#if !defined(FEAT_GUI) || defined(VIMDLL) +#if !defined(FEAT_GUI) || defined(MNVDLL) extern HWND g_hWnd; // This is in os_win32.c. /* @@ -1067,19 +1067,19 @@ static int prt_number_width; static int prt_left_margin; static int prt_right_margin; static int prt_top_margin; -static char_u szAppName[] = TEXT("VIM"); +static char_u szAppName[] = TEXT("MNV"); static HWND hDlgPrint; static int *bUserAbort = NULL; static char_u *prt_name = NULL; -// Defines which are also in vim.rc. +// Defines which are also in mnv.rc. # define IDC_BOX1 400 # define IDC_PRINTTEXT1 401 # define IDC_PRINTTEXT2 402 # define IDC_PROGRESS 403 static BOOL -vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s) +mnvSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s) { WCHAR *wp; BOOL ret; @@ -1089,7 +1089,7 @@ vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s) return FALSE; ret = SetDlgItemTextW(hDlg, nIDDlgItem, wp); - vim_free(wp); + mnv_free(wp); return ret; } @@ -1140,23 +1140,23 @@ PrintDlgProc( { SendDlgItemMessage(hDlg, i, WM_SETFONT, (WPARAM)hfont, 1); if (GetDlgItemText(hDlg,i, buff, sizeof(buff))) - vimSetDlgItemText(hDlg,i, (char_u *)_(buff)); + mnvSetDlgItemText(hDlg,i, (char_u *)_(buff)); } SendDlgItemMessage(hDlg, IDCANCEL, WM_SETFONT, (WPARAM)hfont, 1); if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff))) - vimSetDlgItemText(hDlg,IDCANCEL, (char_u *)_(buff)); + mnvSetDlgItemText(hDlg,IDCANCEL, (char_u *)_(buff)); } # endif SetWindowText(hDlg, (LPCSTR)szAppName); if (prt_name != NULL) { - vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (char_u *)prt_name); - VIM_CLEAR(prt_name); + mnvSetDlgItemText(hDlg, IDC_PRINTTEXT2, (char_u *)prt_name); + MNV_CLEAR(prt_name); } EnableMenuItem(GetSystemMenu(hDlg, FALSE), SC_CLOSE, MF_GRAYED); -# if !defined(FEAT_GUI) || defined(VIMDLL) -# ifdef VIMDLL +# if !defined(FEAT_GUI) || defined(MNVDLL) +# ifdef MNVDLL if (!gui.in_use) # endif BringWindowToTop(s_hwnd); @@ -1384,8 +1384,8 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) bUserAbort = &(psettings->user_abort); CLEAR_FIELD(prt_dlg); prt_dlg.lStructSize = sizeof(PRINTDLGW); -# if !defined(FEAT_GUI) || defined(VIMDLL) -# ifdef VIMDLL +# if !defined(FEAT_GUI) || defined(MNVDLL) +# ifdef MNVDLL if (!gui.in_use) # endif GetConsoleHwnd(); // get value of s_hwnd @@ -1410,8 +1410,8 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) * never show dialog if we are running over telnet */ if (forceit -# if !defined(FEAT_GUI) || defined(VIMDLL) -# ifdef VIMDLL +# if !defined(FEAT_GUI) || defined(MNVDLL) +# ifdef MNVDLL || (!gui.in_use && !term_console) # else || !term_console @@ -1496,8 +1496,8 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit) if (prt_name != NULL) wsprintf((char *)prt_name, (const char *)text, printer_name, port_name); - vim_free(printer_name); - vim_free(port_name); + mnv_free(printer_name); + mnv_free(port_name); } GlobalUnlock(prt_dlg.hDevNames); @@ -1589,7 +1589,7 @@ mch_print_begin(prt_settings_T *psettings) prt_dlg.hwndOwner, PrintDlgProc); SetAbortProc(prt_dlg.hDC, AbortProc); wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname)); - vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (char_u *)szBuffer); + mnvSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (char_u *)szBuffer); wp = enc_to_utf16(psettings->jobname, NULL); if (wp != NULL) @@ -1600,12 +1600,12 @@ mch_print_begin(prt_settings_T *psettings) di.cbSize = sizeof(di); di.lpszDocName = wp; ret = StartDocW(prt_dlg.hDC, &di); - vim_free(wp); + mnv_free(wp); } # ifdef FEAT_GUI // Give focus back to main window (when using MDI). -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) # endif SetFocus(s_hwnd); @@ -1632,7 +1632,7 @@ mch_print_end_page(void) mch_print_begin_page(char_u *msg) { if (msg != NULL) - vimSetDlgItemText(hDlgPrint, IDC_PROGRESS, msg); + mnvSetDlgItemText(hDlgPrint, IDC_PROGRESS, msg); return (StartPage(prt_dlg.hDC) > 0); } @@ -1671,7 +1671,7 @@ mch_print_text_out(char_u *p, int len) TextOutW(prt_dlg.hDC, prt_pos_x + prt_left_margin, prt_pos_y + prt_top_margin, wp, wlen); GetTextExtentPoint32W(prt_dlg.hDC, wp, wlen, &sz); - vim_free(wp); + mnv_free(wp); prt_pos_x += (sz.cx - prt_tm.tmOverhang); // This is wrong when printing spaces for a TAB. if (p[len] != NUL) @@ -1682,7 +1682,7 @@ mch_print_text_out(char_u *p, int len) { GetTextExtentPoint32W(prt_dlg.hDC, wp, 1, &sz); ret = (prt_pos_x + prt_left_margin + sz.cx > prt_right_margin); - vim_free(wp); + mnv_free(wp); } } return ret; @@ -1775,13 +1775,13 @@ resolve_reparse_point(char_u *fname) if (!is_reparse_point_included(p)) { - vim_free(p); + mnv_free(p); goto fail; } h = CreateFileW(p, 0, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); - vim_free(p); + mnv_free(p); if (h == INVALID_HANDLE_VALUE) goto fail; @@ -1811,7 +1811,7 @@ fail: if (h != INVALID_HANDLE_VALUE) CloseHandle(h); if (buff != NULL) - vim_free(buff); + mnv_free(buff); return rfname; } @@ -1863,7 +1863,7 @@ resolve_shortcut(char_u *fname) hr = ppf->lpVtbl->Load(ppf, p, STGM_READ); if (hr != S_OK) goto shortcut_errorw; -# if 0 // This makes Vim wait a long time if the target does not exist. +# if 0 // This makes MNV wait a long time if the target does not exist. hr = pslw->lpVtbl->Resolve(pslw, NULL, SLR_NO_UI); if (hr != S_OK) goto shortcut_errorw; @@ -1876,7 +1876,7 @@ resolve_shortcut(char_u *fname) rfname = utf16_to_enc(wsz, NULL); shortcut_errorw: - vim_free(p); + mnv_free(p); } } @@ -1903,7 +1903,7 @@ mch_resolve_path(char_u *fname, int reparse_point) } #endif -#if defined(FEAT_EVAL) && (!defined(FEAT_GUI) || defined(VIMDLL)) +#if defined(FEAT_EVAL) && (!defined(FEAT_GUI) || defined(MNVDLL)) /* * Bring ourselves to the foreground. Does work if the OS doesn't allow it. */ @@ -1918,7 +1918,7 @@ win32_set_foreground(void) #if defined(FEAT_CLIENTSERVER) /* - * Client-server code for Vim + * Client-server code for MNV * * Originally written by Paul Moore */ @@ -1931,11 +1931,11 @@ win32_set_foreground(void) // So we create a hidden window, and arrange to destroy it on exit. HWND message_window = 0; // window that's handling messages -# define VIM_CLASSNAME "VIM_MESSAGES" -# define VIM_CLASSNAME_LEN (sizeof(VIM_CLASSNAME) - 1) +# define MNV_CLASSNAME "MNV_MESSAGES" +# define MNV_CLASSNAME_LEN (sizeof(MNV_CLASSNAME) - 1) -// Timeout for sending a message to another Vim instance. Normally this works -// instantly, but it may hang when the other Vim instance is halted. +// Timeout for sending a message to another MNV instance. Normally this works +// instantly, but it may hang when the other MNV instance is halted. # define SENDMESSAGE_TIMEOUT (5 * 1000) // Communication is via WM_COPYDATA messages. The message type is sent in @@ -1999,14 +1999,14 @@ static int save_reply(HWND server, char_u *reply, int expr); * is started (in the GUI) is careful to pump messages when it needs * to. Features which require message delivery during normal use will * not work in the console version - this basically means those - * features which allow Vim to act as a server, rather than a client. + * features which allow MNV to act as a server, rather than a client. */ static LRESULT CALLBACK Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { if (msg == WM_COPYDATA) { - // This is a message from another Vim. The dwData member of the + // This is a message from another MNV. The dwData member of the // COPYDATASTRUCT determines the type of message: // COPYDATA_ENCODING: // The encoding that the client uses. Following messages will @@ -2039,7 +2039,7 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { case COPYDATA_ENCODING: // Remember the encoding that the client uses. - vim_free(client_enc); + mnv_free(client_enc); client_enc = enc_canonize((char_u *)data->lpData); return 1; @@ -2051,11 +2051,11 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) // for the user to do something should check the input buffer. str = serverConvert(client_enc, (char_u *)data->lpData, &tofree); server_to_input_buf(str); - vim_free(tofree); + mnv_free(tofree); # ifdef FEAT_GUI // Wake up the main GUI loop. -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) # endif if (s_hwnd != 0) @@ -2077,7 +2077,7 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) res = alloc(len); if (res != NULL) - reply.cbData = (DWORD)vim_snprintf_safelen( + reply.cbData = (DWORD)mnv_snprintf_safelen( (char *)res, len, "%s: \"%s\"", err, str); else reply.cbData = 0; @@ -2101,8 +2101,8 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) else retval = (int)dwret; } - vim_free(tofree); - vim_free(res); + mnv_free(tofree); + mnv_free(res); return retval; case COPYDATA_REPLY: @@ -2113,12 +2113,12 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) str = serverConvert(client_enc, (char_u *)data->lpData, &tofree); if (tofree == NULL) - str = vim_strsave(str); + str = mnv_strsave(str); if (save_reply(sender, str, (data->dwData == COPYDATA_REPLY ? 0 : (data->dwData == COPYDATA_RESULT ? 1 : 2))) == FAIL) - vim_free(str); + mnv_free(str); else if (data->dwData == COPYDATA_REPLY) { char_u winstr[30]; @@ -2138,8 +2138,8 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { // When the message window is activated (brought to the foreground), // this actually applies to the text window. -# if !defined(FEAT_GUI) || defined(VIMDLL) -# ifdef VIMDLL +# if !defined(FEAT_GUI) || defined(MNVDLL) +# ifdef MNVDLL if (!gui.in_use) # endif GetConsoleHwnd(); // get value of s_hwnd @@ -2177,36 +2177,36 @@ serverInitMessaging(void) wndclass.hCursor = NULL; wndclass.hbrBackground = NULL; wndclass.lpszMenuName = NULL; - wndclass.lpszClassName = VIM_CLASSNAME; + wndclass.lpszClassName = MNV_CLASSNAME; RegisterClass(&wndclass); // Create the message window. It will be hidden, so the details don't // matter. Don't use WS_OVERLAPPEDWINDOW, it will make a shortcut remove - // focus from gvim. - message_window = CreateWindow(VIM_CLASSNAME, "", + // focus from gmnv. + message_window = CreateWindow(MNV_CLASSNAME, "", WS_POPUPWINDOW | WS_CAPTION, CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, g_hinst, NULL); } -// Used by serverSendToVim() to find an alternate server name. +// Used by serverSendToMNV() to find an alternate server name. static char_u *altname_buf_ptr = NULL; /* - * Get the title of the window "hwnd", which is the Vim server name, in + * Get the title of the window "hwnd", which is the MNV server name, in * "name[namelen]" and return the length. - * Returns zero if window "hwnd" is not a Vim server. + * Returns zero if window "hwnd" is not a MNV server. */ static int -getVimServerName(HWND hwnd, char *name, int namelen) +getMNVServerName(HWND hwnd, char *name, int namelen) { int len; - char buffer[VIM_CLASSNAME_LEN + 1]; + char buffer[MNV_CLASSNAME_LEN + 1]; - // Ignore windows which aren't Vim message windows + // Ignore windows which aren't MNV message windows len = GetClassName(hwnd, buffer, sizeof(buffer)); - if (len != VIM_CLASSNAME_LEN || STRCMP(buffer, VIM_CLASSNAME) != 0) + if (len != MNV_CLASSNAME_LEN || STRCMP(buffer, MNV_CLASSNAME) != 0) return 0; // Get the title of the window @@ -2220,7 +2220,7 @@ enumWindowsGetServer(HWND hwnd, LPARAM lparam) char server[MAX_PATH]; // Get the title of the window - if (getVimServerName(hwnd, server, sizeof(server)) == 0) + if (getMNVServerName(hwnd, server, sizeof(server)) == 0) return TRUE; // If this is the server we're looking for, return its HWND @@ -2236,7 +2236,7 @@ enumWindowsGetServer(HWND hwnd, LPARAM lparam) size_t namelen = STRLEN(id->name); if (STRNICMP(server, id->name, namelen) == 0 - && vim_isdigit(server[namelen])) + && mnv_isdigit(server[namelen])) { STRCPY(altname_buf_ptr, server); altname_buf_ptr = NULL; // don't use another name @@ -2254,7 +2254,7 @@ enumWindowsGetNames(HWND hwnd, LPARAM lparam) char server[MAX_PATH]; // Get the title of the window - if (getVimServerName(hwnd, server, sizeof(server)) == 0) + if (getMNVServerName(hwnd, server, sizeof(server)) == 0) return TRUE; // Add the name to the list @@ -2348,25 +2348,25 @@ serverSetName(char_u *name) } if (hwnd != 0) - vim_free(ok_name); + mnv_free(ok_name); else { // Remember the name serverName = ok_name; - need_maketitle = TRUE; // update Vim window title later + need_maketitle = TRUE; // update MNV window title later // Update the message window title SetWindowText(message_window, (LPCSTR)ok_name); # ifdef FEAT_EVAL // Set the servername variable - set_vim_var_string(VV_SEND_SERVER, serverName, -1); + set_mnv_var_string(VV_SEND_SERVER, serverName, -1); # endif } } char_u * -serverGetVimNames(void) +serverGetMNVNames(void) { garray_T ga; @@ -2413,7 +2413,7 @@ serverSendReply( } int -serverSendToVim( +serverSendToMNV( char_u *name, // Where to send. char_u *cmd, // What to send. char_u **result, // Result of eval'ed expression @@ -2432,12 +2432,12 @@ serverSendToVim( // Execute locally if no display or target is ourselves if (serverName != NULL && STRICMP(name, serverName) == 0) - return sendToLocalVim(cmd, asExpr, result); + return sendToLocalMNV(cmd, asExpr, result); // If the server name does not end in a digit then we look for an - // alternate name. e.g. when "name" is GVIM then we may find GVIM2. + // alternate name. e.g. when "name" is GMNV then we may find GMNV2. namelen = STRLEN(name); - if (namelen > 1 && !vim_isdigit(name[namelen - 1])) + if (namelen > 1 && !mnv_isdigit(name[namelen - 1])) altname_buf_ptr = altname_buf; altname_buf[0] = NUL; target = findServer(name); @@ -2473,7 +2473,7 @@ serverSendToVim( retval = serverGetReply(target, &retcode, TRUE, TRUE, timeout); if (result == NULL) - vim_free(retval); + mnv_free(retval); else *result = retval; // Caller assumes responsibility for freeing @@ -2793,7 +2793,7 @@ points_to_pixels(WCHAR *str, WCHAR **end, int vertical, long_i pprinter_dc) } else { - if (!VIM_ISDIGIT(*str)) + if (!MNV_ISDIGIT(*str)) break; points *= 10; @@ -2953,7 +2953,7 @@ expand_font_enumproc( return 0; add_match(faceName); - vim_free(faceName); + mnv_free(faceName); return 1; } @@ -2983,7 +2983,7 @@ gui_mch_expand_font( // convenience. We simply round to the closest integer for simplicity. int font_height = (int)round( pixels_to_points(-current_font_height, TRUE, (long_i)NULL)); - vim_snprintf(buf, ARRAY_LENGTH(buf), "h%d", font_height); + mnv_snprintf(buf, ARRAY_LENGTH(buf), "h%d", font_height); add_match((char_u *)buf); // Note: Keep this in sync with get_logfont(). Don't include 'c' and @@ -2995,13 +2995,13 @@ gui_mch_expand_font( for (i = 0; i < (int)ARRAY_LENGTH(charset_pairs); ++i) { - vim_snprintf(buf, sizeof(buf), "c%s", charset_pairs[i].name.string); + mnv_snprintf(buf, sizeof(buf), "c%s", charset_pairs[i].name.string); add_match((char_u *)buf); } for (i = 0; i < (int)ARRAY_LENGTH(quality_pairs); ++i) { - vim_snprintf(buf, sizeof(buf), "q%s", quality_pairs[i].name.string); + mnv_snprintf(buf, sizeof(buf), "q%s", quality_pairs[i].name.string); add_match((char_u *)buf); } return; @@ -3039,7 +3039,7 @@ utf16ascncmp(const WCHAR *w, const char *p, size_t n) * Equivalent of GetDpiForSystem(). */ UINT WINAPI -vimGetDpiForSystem(void) +mnvGetDpiForSystem(void) { HWND hwnd = GetDesktopWindow(); HDC hdc = GetWindowDC(hwnd); @@ -3064,7 +3064,7 @@ set_default_logfont(LOGFONTW *lf) fontname = "Consolas"; *lf = s_lfDefault; - lf->lfHeight = DEFAULT_FONT_HEIGHT * (int)vimGetDpiForSystem() / 96; + lf->lfHeight = DEFAULT_FONT_HEIGHT * (int)mnvGetDpiForSystem() / 96; if (current_font_height == 0) current_font_height = lf->lfHeight; @@ -3072,7 +3072,7 @@ set_default_logfont(LOGFONTW *lf) if (wfontname != NULL) { wcscpy_s(lf->lfFaceName, LF_FACESIZE, wfontname); - vim_free(wfontname); + mnv_free(wfontname); } } @@ -3133,7 +3133,7 @@ get_logfont( lf->lfFaceName[p - wname] = NUL; // First set defaults - lf->lfHeight = DEFAULT_FONT_HEIGHT * (int)vimGetDpiForSystem() / 96; + lf->lfHeight = DEFAULT_FONT_HEIGHT * (int)mnvGetDpiForSystem() / 96; lf->lfWidth = 0; lf->lfWeight = FW_NORMAL; lf->lfItalic = FALSE; @@ -3206,7 +3206,7 @@ get_logfont( { semsg(_(e_illegal_str_name_str_in_font_name_str), "charset", s, name); - vim_free(s); + mnv_free(s); } } break; @@ -3229,7 +3229,7 @@ get_logfont( { semsg(_(e_illegal_str_name_str_in_font_name_str), "quality", s, name); - vim_free(s); + mnv_free(s); } } break; @@ -3247,12 +3247,12 @@ theend: // ron: init lastlf if (ret == OK && printer_dc == NULL) { - vim_free(lastlf); + mnv_free(lastlf); lastlf = ALLOC_ONE(LOGFONTW); if (lastlf != NULL) mch_memmove(lastlf, lf, sizeof(LOGFONTW)); } - vim_free(wname); + mnv_free(wname); return ret; } diff --git a/uvim/src/os_qnx.c b/uvim/src/os_qnx.c index c0a51c025a..55f0b1786b 100644 --- a/uvim/src/os_qnx.c +++ b/uvim/src/os_qnx.c @@ -1,18 +1,18 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * * QNX port by Julian Kinraid * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* * os_qnx.c */ -#include "vim.h" +#include "mnv.h" #if defined(FEAT_GUI_PHOTON) @@ -33,10 +33,10 @@ void qnx_init(void) #if defined(FEAT_GUI_PHOTON) && defined(FEAT_CLIPBOARD) -# define CLIP_TYPE_VIM "VIMTYPE" +# define CLIP_TYPE_MNV "MNVTYPE" # define CLIP_TYPE_TEXT "TEXT" -// Turn on the clipboard for a console vim when photon is running +// Turn on the clipboard for a console mnv when photon is running void qnx_clip_init(void) { if (is_photon_available == TRUE && !gui.in_use) @@ -70,8 +70,8 @@ clip_mch_request_selection(Clipboard_T *cbd) if (cbdata == NULL) return; - // Look for the vim specific clip first - clip_header = PhClipboardPasteType(cbdata, CLIP_TYPE_VIM); + // Look for the mnv specific clip first + clip_header = PhClipboardPasteType(cbdata, CLIP_TYPE_MNV); if (clip_header != NULL && clip_header->data != NULL) { switch(*(char *) clip_header->data) @@ -106,7 +106,7 @@ clip_mch_set_selection(Clipboard_T *cbd) { int type; long_u len; - char_u *text_clip, vim_clip[2], *str = NULL; + char_u *text_clip, mnv_clip[2], *str = NULL; PhClipHeader clip_header[2]; // Prevent recursion from clip_get_selection() @@ -122,13 +122,13 @@ clip_mch_set_selection(Clipboard_T *cbd) { text_clip = alloc(len + 1); // Normal text - if (text_clip && vim_clip) + if (text_clip && mnv_clip) { CLEAR_FIELD(clip_header); - STRNCPY(clip_header[0].type, CLIP_TYPE_VIM, 8); - clip_header[0].length = sizeof(vim_clip); - clip_header[0].data = vim_clip; + STRNCPY(clip_header[0].type, CLIP_TYPE_MNV, 8); + clip_header[0].length = sizeof(mnv_clip); + clip_header[0].data = mnv_clip; STRNCPY(clip_header[1].type, CLIP_TYPE_TEXT, 8); clip_header[1].length = len + 1; @@ -137,19 +137,19 @@ clip_mch_set_selection(Clipboard_T *cbd) switch(type) { default: // fallthrough to MLINE - case MLINE: *vim_clip = 'L'; break; - case MCHAR: *vim_clip = 'C'; break; - case MBLOCK: *vim_clip = 'B'; break; + case MLINE: *mnv_clip = 'L'; break; + case MCHAR: *mnv_clip = 'C'; break; + case MBLOCK: *mnv_clip = 'B'; break; } - vim_strncpy(text_clip, str, len); + mnv_strncpy(text_clip, str, len); - vim_clip[ 1 ] = NUL; + mnv_clip[ 1 ] = NUL; PhClipboardCopy(PhInputGroup(NULL), 2, clip_header); } - vim_free(text_clip); + mnv_free(text_clip); } - vim_free(str); + mnv_free(str); } #endif diff --git a/uvim/src/os_qnx.h b/uvim/src/os_qnx.h index 503805a7f5..75aeec4dec 100644 --- a/uvim/src/os_qnx.h +++ b/uvim/src/os_qnx.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ #ifdef __QNXNTO__ diff --git a/uvim/src/os_unix.c b/uvim/src/os_unix.c index 1d382f7f33..36b7d4c315 100644 --- a/uvim/src/os_unix.c +++ b/uvim/src/os_unix.c @@ -1,12 +1,12 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * OS/2 port by Paul Slootman * VMS merge by Zoltan Arpadffy * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* @@ -18,7 +18,7 @@ * changed beyond recognition. */ -#include "vim.h" +#include "mnv.h" #ifdef FEAT_MZSCHEME # include "if_mzsch.h" @@ -204,7 +204,7 @@ typedef struct { # define SS_CMD_INFO_SIZE (sizeof(char_u) + (sizeof(uint32_t) * 2)) # define SS_MSG_INFO_SIZE (sizeof(char_u) + sizeof(uint32_t)) -// Represents a pending reply from a command sent to a Vim server. When a +// Represents a pending reply from a command sent to a MNV server. When a // command is sent out, we generate unique serial number with it. When we // receive any reply, we check which pending command has a matching serial // number, and is therefore the reply for that pending command. @@ -229,7 +229,7 @@ static uint32_t ss_serial = 0; // Represents a reply from a server2client call. Each client that calls a // server2client call to us has its own ss_reply_T. Each time a client sends -// data using server2client, Vim creates a ss_reply_T if it doesn't exist and +// data using server2client, MNV creates a ss_reply_T if it doesn't exist and // adds the string to the array. When remote_read is called, the server id is // used to find the specific ss_reply_T, and a single string is popped from the // array. @@ -434,7 +434,7 @@ static struct signalinfo #endif #if defined(SIGPROF) && !defined(FEAT_MZSCHEME) && !defined(WE_ARE_PROFILING) // MzScheme uses SIGPROF for its own needs; On Linux with profiling - // this makes Vim exit. WE_ARE_PROFILING is defined in Makefile. + // this makes MNV exit. WE_ARE_PROFILING is defined in Makefile. {SIGPROF, "PROF", TRUE}, #endif #ifdef SIGXCPU @@ -548,7 +548,7 @@ mch_chdir(char *path) void mch_write(char_u *s, int len) { - vim_ignored = (int)write(1, (char *)s, len); + mnv_ignored = (int)write(1, (char *)s, len); if (p_wd) // Unix is too fast, slow down a bit more RealWaitForChar(read_cmd_fd, p_wd, NULL, NULL); } @@ -755,7 +755,7 @@ mch_total_mem(int special UNUSED) # endif // Return the minimum of the physical memory and the user limit, because - // using more than the user limit may cause Vim to be terminated. + // using more than the user limit may cause MNV to be terminated. # if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) { struct rlimit rlp; @@ -1230,7 +1230,7 @@ deathtrap SIGDEFARG(sigarg) # ifdef SIGQUIT // While in mch_delay() we go to cooked mode to allow a CTRL-C to // interrupt us. But in cooked mode we may also get SIGQUIT, e.g., when - // pressing CTRL-\, but we don't want Vim to exit then. + // pressing CTRL-\, but we don't want MNV to exit then. if (in_mch_delay && sigarg == SIGQUIT) return; # endif @@ -1259,7 +1259,7 @@ deathtrap SIGDEFARG(sigarg) || sigarg == SIGUSR2 # endif ) - && !vim_handle_signal(sigarg)) + && !mnv_handle_signal(sigarg)) return; #endif @@ -1272,7 +1272,7 @@ deathtrap SIGDEFARG(sigarg) #ifdef FEAT_EVAL // Set the v:dying variable. - set_vim_var_nr(VV_DYING, (long)entered); + set_mnv_var_nr(VV_DYING, (long)entered); #endif v_dying = entered; @@ -1283,12 +1283,12 @@ deathtrap SIGDEFARG(sigarg) #endif #if 0 - // This is for opening gdb the moment Vim crashes. - // You need to manually adjust the file name and Vim executable name. + // This is for opening gdb the moment MNV crashes. + // You need to manually adjust the file name and MNV executable name. // Suggested by SungHyun Nam. { -# define VI_GDB_FILE "/tmp/vimgdb" -# define VIM_NAME "/usr/bin/vim" +# define VI_GDB_FILE "/tmp/mnvgdb" +# define MNV_NAME "/usr/bin/mnv" FILE *fp = fopen(VI_GDB_FILE, "w"); if (fp) { @@ -1297,7 +1297,7 @@ deathtrap SIGDEFARG(sigarg) "attach %d\n" "set height 1000\n" "bt full\n" - , VIM_NAME, getpid()); + , MNV_NAME, getpid()); fclose(fp); system("xterm -e gdb -x "VI_GDB_FILE); unlink(VI_GDB_FILE); @@ -1335,17 +1335,17 @@ deathtrap SIGDEFARG(sigarg) if (entered == 2) { // No translation, it may call malloc(). - OUT_STR("Vim: Double signal, exiting\n"); + OUT_STR("MNV: Double signal, exiting\n"); out_flush(); getout(1); } // No translation, it may call malloc(). #ifdef SIGHASARG - sprintf((char *)IObuff, "Vim: Caught deadly signal %s\r\n", + sprintf((char *)IObuff, "MNV: Caught deadly signal %s\r\n", signal_info[i].name); #else - sprintf((char *)IObuff, "Vim: Caught deadly signal\r\n"); + sprintf((char *)IObuff, "MNV: Caught deadly signal\r\n"); #endif // Preserve files and exit. This sets the really_exiting flag to prevent @@ -1428,7 +1428,7 @@ static void *clip_plus_save = NULL; # if defined(FEAT_CLIPBOARD) && (defined(FEAT_X11) \ || defined(FEAT_WAYLAND_CLIPBOARD)) /* - * Called when Vim is going to sleep or execute a shell command. + * Called when MNV is going to sleep or execute a shell command. * We can't respond to requests for the X or Wayland selections. * Lose them, otherwise other applications will hang. But first * copy the text to cut buffer 0 (for X11). Wayland users must have @@ -1525,7 +1525,7 @@ mch_suspend(void) * Wait for the SIGCONT signal to be handled. It generally happens * immediately, but somehow not all the time, probably because it's handled * in another thread. Do not call pause() because there would be race - * condition which would hang Vim if signal happened in between the test of + * condition which would hang MNV if signal happened in between the test of * sigcont_received and the call to pause(). If signal is not yet received, * sleep 0, 1, 2, 3 ms. Don't bother waiting further if signal is not * received after 1+2+3 ms (not expected to happen). @@ -1557,7 +1557,7 @@ mch_init(void) // Check whether we were invoked with SIGTSTP set to be ignored. If it is // that indicates the shell (or program) that launched us does not support // tty job control and thus we should ignore that signal. If invoked as a - // restricted editor (e.g., as "rvim") SIGTSTP is always ignored. + // restricted editor (e.g., as "rmnv") SIGTSTP is always ignored. ignore_sigtstp = restricted || SIG_IGN == mch_signal(SIGTSTP, SIG_ERR); #endif set_signals(); @@ -1636,7 +1636,7 @@ set_signals(void) #endif /* - * Arrange for other signals to gracefully shutdown Vim. + * Arrange for other signals to gracefully shutdown MNV. */ catch_signals(deathtrap, SIG_ERR); @@ -1760,10 +1760,10 @@ unblock_signals(sigset_t *set) * "when" == SIGNAL_BLOCK: Going to be busy, block signals * "when" == SIGNAL_UNBLOCK: Going to wait, unblock signals, use postponed * signal - * Returns TRUE when Vim should exit. + * Returns TRUE when MNV should exit. */ int -vim_handle_signal(int sig) +mnv_handle_signal(int sig) { static int got_signal = 0; static int blocked = TRUE; @@ -1844,7 +1844,7 @@ static int got_x_error = FALSE; x_error_handler(Display *dpy, XErrorEvent *error_event) { XGetErrorText(dpy, error_event->error_code, (char *)IObuff, IOSIZE); - STRCAT(IObuff, _("\nVim: Got X error\n")); + STRCAT(IObuff, _("\nMNV: Got X error\n")); // In the GUI we cannot print a message and continue, because no X calls // are allowed here (causes my system to hang). Silently continuing seems @@ -1895,7 +1895,7 @@ x_connect_to_server(void) if (regprog_in_use(clip_exclude_prog)) return FALSE; - if (vim_regexec_prog(&clip_exclude_prog, FALSE, T_NAME, (colnr_T)0)) + if (mnv_regexec_prog(&clip_exclude_prog, FALSE, T_NAME, (colnr_T)0)) return FALSE; } return TRUE; @@ -1940,7 +1940,7 @@ x_IOerror_handler(Display *dpy UNUSED) /* * If the X11 connection was lost try to restore it. - * Helps when the X11 server was stopped and restarted while Vim was inactive + * Helps when the X11 server was stopped and restarted while MNV was inactive * (e.g. through tmux). */ static void @@ -1952,7 +1952,7 @@ may_restore_x11_clipboard(void) --xterm_dpy_retry_count; # ifndef LESSTIF_VERSION - // This has been reported to avoid Vim getting stuck. + // This has been reported to avoid MNV getting stuck. if (app_context != (XtAppContext)NULL) { XtDestroyApplicationContext(app_context); @@ -1974,8 +1974,8 @@ ex_xrestore(exarg_T *eap) if (eap->arg != NULL && (arglen = STRLEN(eap->arg)) > 0) { if (xterm_display_allocated) - vim_free(xterm_display); - xterm_display = (char *)vim_strnsave(eap->arg, arglen); + mnv_free(xterm_display); + xterm_display = (char *)mnv_strnsave(eap->arg, arglen); xterm_display_allocated = TRUE; } smsg(_("restoring X11 display %s"), xterm_display == NULL @@ -2049,7 +2049,7 @@ get_x11_windis(void) if (gui.in_use) { /* - * If the X11 display was opened here before, for the window where Vim + * If the X11 display was opened here before, for the window where MNV * was started, close that one now to avoid a memory leak. */ if (x11_display_from == XD_HERE && x11_display != NULL) @@ -2100,7 +2100,7 @@ get_x11_windis(void) { /* * If the X11 display was opened here before, for the window where - * Vim was started, close that one now to avoid a memory leak. + * MNV was started, close that one now to avoid a memory leak. */ if (x11_display_from == XD_HERE && x11_display != NULL) XCloseDisplay(x11_display); @@ -2179,7 +2179,7 @@ get_x11_windis(void) return (result = FAIL); # ifdef FEAT_EVAL - set_vim_var_nr(VV_WINDOWID, (long)x11_window); + set_mnv_var_nr(VV_WINDOWID, (long)x11_window); # endif return (result = OK); @@ -2208,9 +2208,9 @@ get_x11_icon(int test_only) if (oldicon == NULL && !test_only) { if (STRNCMP(T_NAME, "builtin_", 8) == 0) - oldicon = vim_strsave(T_NAME + 8); + oldicon = mnv_strsave(T_NAME + 8); else - oldicon = vim_strsave(T_NAME); + oldicon = mnv_strsave(T_NAME); } return retval; @@ -2272,15 +2272,15 @@ get_x11_thing( if (!test_only) { if (get_title) - vim_free(oldtitle); + mnv_free(oldtitle); else - vim_free(oldicon); + mnv_free(oldicon); if (text_prop.encoding == XA_STRING && !has_mbyte) { if (get_title) - oldtitle = vim_strsave((char_u *)text_prop.value); + oldtitle = mnv_strsave((char_u *)text_prop.value); else - oldicon = vim_strsave((char_u *)text_prop.value); + oldicon = mnv_strsave((char_u *)text_prop.value); } else { @@ -2294,17 +2294,17 @@ get_x11_thing( if (transform_status >= Success && n > 0 && cl[0]) { if (get_title) - oldtitle = vim_strsave((char_u *) cl[0]); + oldtitle = mnv_strsave((char_u *) cl[0]); else - oldicon = vim_strsave((char_u *) cl[0]); + oldicon = mnv_strsave((char_u *) cl[0]); XFreeStringList(cl); } else { if (get_title) - oldtitle = vim_strsave((char_u *)text_prop.value); + oldtitle = mnv_strsave((char_u *)text_prop.value); else - oldicon = vim_strsave((char_u *)text_prop.value); + oldicon = mnv_strsave((char_u *)text_prop.value); } } } @@ -2410,9 +2410,9 @@ get_x11_icon(int test_only) if (!test_only) { if (STRNCMP(T_NAME, "builtin_", 8) == 0) - oldicon = vim_strsave(T_NAME + 8); + oldicon = mnv_strsave(T_NAME + 8); else - oldicon = vim_strsave(T_NAME); + oldicon = mnv_strsave(T_NAME); } return FALSE; } @@ -2473,7 +2473,7 @@ mch_settitle(char_u *title, char_u *icon) if (oldtitle_outdated) { oldtitle_outdated = FALSE; - VIM_CLEAR(oldtitle); + MNV_CLEAR(oldtitle); } if (oldtitle == NULL #ifdef FEAT_GUI @@ -2546,13 +2546,13 @@ mch_restore_title(int which) char_u *tofree = NULL; if (title == oldtitle && oldtitle != NULL) { - tofree = vim_strsave(title); + tofree = mnv_strsave(title); if (tofree != NULL) title = tofree; } mch_settitle(title, ((which & SAVE_RESTORE_ICON) && did_set_icon) ? oldicon : NULL); - vim_free(tofree); + mnv_free(tofree); if (do_push_pop) { @@ -2571,7 +2571,7 @@ mch_restore_title(int which) * Seiichi Sato mentioned that "mlterm" works like xterm. */ int -vim_is_xterm(char_u *name) +mnv_is_xterm(char_u *name) { if (name == NULL) return FALSE; @@ -2630,7 +2630,7 @@ use_xterm_mouse(void) * Return TRUE if "name" is an iris-ansi terminal name. */ int -vim_is_iris(char_u *name) +mnv_is_iris(char_u *name) { if (name == NULL) return FALSE; @@ -2643,14 +2643,14 @@ vim_is_iris(char_u *name) * Return TRUE if "name" is a vt300-like terminal name. */ int -vim_is_vt300(char_u *name) +mnv_is_vt300(char_u *name) { if (name == NULL) return FALSE; // Actually all ANSI compatible terminals should be here. // Catch at least VT1xx - VT5xx return ((STRNICMP(name, "vt", 2) == 0 - && vim_strchr((char_u *)"12345", name[2]) != NULL) + && mnv_strchr((char_u *)"12345", name[2]) != NULL) || STRCMP(name, "builtin_vt320") == 0); } #endif @@ -2663,7 +2663,7 @@ vim_is_vt300(char_u *name) mch_get_user_name(char_u *s, int len) { #ifdef VMS - vim_strncpy(s, (char_u *)cuserid(NULL), len - 1); + mnv_strncpy(s, (char_u *)cuserid(NULL), len - 1); return OK; #else return mch_get_uname(getuid(), s, len); @@ -2683,7 +2683,7 @@ mch_get_uname(uid_t uid, char_u *s, int len) if ((pw = getpwuid(uid)) != NULL && pw->pw_name != NULL && *(pw->pw_name) != NUL) { - vim_strncpy(s, (char_u *)pw->pw_name, len - 1); + mnv_strncpy(s, (char_u *)pw->pw_name, len - 1); return OK; } #endif @@ -2704,7 +2704,7 @@ mch_get_host_name(char_u *s, int len) if (uname(&vutsname) < 0) *s = NUL; else - vim_strncpy(s, (char_u *)vutsname.nodename, len - 1); + mnv_strncpy(s, (char_u *)vutsname.nodename, len - 1); } #else // HAVE_SYS_UTSNAME_H @@ -2834,7 +2834,7 @@ mch_FullName( // Expand it if forced or not an absolute path. // Do not do it for "/file", the result is always "/". if ((force || !mch_isFullName(fname)) - && ((p = vim_strrchr(fname, '/')) == NULL || p != fname)) + && ((p = mnv_strrchr(fname, '/')) == NULL || p != fname)) { if (p == NULL && STRCMP(fname, "..") == 0) // Handle ".." without path separators. @@ -2889,7 +2889,7 @@ mch_FullName( retval = FAIL; else { - vim_strncpy(buf, fname, p - fname); + mnv_strncpy(buf, fname, p - fname); if (mch_chdir((char *)buf)) { // Path does not exist (yet). For a full path fail, @@ -3003,7 +3003,7 @@ fname_case( return; // Open the directory where the file is located. - slash = vim_strrchr(name, '/'); + slash = mnv_strrchr(name, '/'); if (slash == NULL) { dirp = opendir("."); @@ -3032,8 +3032,8 @@ fname_case( struct stat st2; // Verify the inode is equal. - vim_strncpy(newname, name, MAXPATHL); - vim_strncpy(newname + (tail - name), (char_u *)dp->d_name, + mnv_strncpy(newname, name, MAXPATHL); + mnv_strncpy(newname + (tail - name), (char_u *)dp->d_name, MAXPATHL - (tail - name)); if (mch_lstat((char *)newname, &st2) >= 0 && st.st_ino == st2.st_ino @@ -3111,10 +3111,10 @@ mch_fsetperm(int fd, long perm) # endif # ifdef HAVE_SOLARIS_ACL -typedef struct vim_acl_solaris_T { +typedef struct mnv_acl_solaris_T { int acl_cnt; aclent_t *acl_entry; -} vim_acl_solaris_T; +} mnv_acl_solaris_T; # endif # if defined(HAVE_SELINUX) @@ -3214,7 +3214,7 @@ mch_copy_sec(char_u *from_file, char_u *to_file) ret = setxattr((char*)to_file, name, buffer, (size_t)size, 0); if (ret < 0) { - vim_snprintf((char *)IObuff, IOSIZE, + mnv_snprintf((char *)IObuff, IOSIZE, _("Could not set security context %s for %s"), name, to_file); msg_outtrans(IObuff); @@ -3234,7 +3234,7 @@ mch_copy_sec(char_u *from_file, char_u *to_file) case ERANGE: default: // no enough size OR unexpected error - vim_snprintf((char *)IObuff, IOSIZE, + mnv_snprintf((char *)IObuff, IOSIZE, _("Could not get security context %s for %s. Removing it!"), name, from_file); msg_puts((char *)IObuff); @@ -3336,8 +3336,8 @@ mch_copy_xattr(char_u *from_file, char_u *to_file) } error_exit: - vim_free(xattr_buf); - vim_free(val); + mnv_free(xattr_buf); + mnv_free(val); if (errmsg != NULL) emsg(_(errmsg)); @@ -3348,24 +3348,24 @@ error_exit: * Return a pointer to the ACL of file "fname" in allocated memory. * Return NULL if the ACL is not available for whatever reason. */ - vim_acl_T + mnv_acl_T mch_get_acl(char_u *fname UNUSED) { - vim_acl_T ret = NULL; + mnv_acl_T ret = NULL; # ifdef HAVE_POSIX_ACL - ret = (vim_acl_T)acl_get_file((char *)fname, ACL_TYPE_ACCESS); + ret = (mnv_acl_T)acl_get_file((char *)fname, ACL_TYPE_ACCESS); # else # ifdef HAVE_SOLARIS_ZFS_ACL acl_t *aclent; if (acl_get((char *)fname, 0, &aclent) < 0) return NULL; - ret = (vim_acl_T)aclent; + ret = (mnv_acl_T)aclent; # else # ifdef HAVE_SOLARIS_ACL - vim_acl_solaris_T *aclent; + mnv_acl_solaris_T *aclent; - aclent = malloc(sizeof(vim_acl_solaris_T)); + aclent = malloc(sizeof(mnv_acl_solaris_T)); if (aclent == NULL) return NULL; if ((aclent->acl_cnt = acl((char *)fname, GETACLCNT, 0, NULL)) < 0) @@ -3385,7 +3385,7 @@ mch_get_acl(char_u *fname UNUSED) free(aclent); return NULL; } - ret = (vim_acl_T)aclent; + ret = (mnv_acl_T)aclent; # else # if defined(HAVE_AIX_ACL) int aclsize; @@ -3413,7 +3413,7 @@ mch_get_acl(char_u *fname UNUSED) return NULL; } } - ret = (vim_acl_T)aclent; + ret = (mnv_acl_T)aclent; # endif // HAVE_AIX_ACL # endif // HAVE_SOLARIS_ACL # endif // HAVE_SOLARIS_ZFS_ACL @@ -3425,7 +3425,7 @@ mch_get_acl(char_u *fname UNUSED) * Set the ACL of file "fname" to "acl" (unless it's NULL). */ void -mch_set_acl(char_u *fname UNUSED, vim_acl_T aclent) +mch_set_acl(char_u *fname UNUSED, mnv_acl_T aclent) { if (aclent == NULL) return; @@ -3436,8 +3436,8 @@ mch_set_acl(char_u *fname UNUSED, vim_acl_T aclent) acl_set((char *)fname, (acl_t *)aclent); # else # ifdef HAVE_SOLARIS_ACL - acl((char *)fname, SETACL, ((vim_acl_solaris_T *)aclent)->acl_cnt, - ((vim_acl_solaris_T *)aclent)->acl_entry); + acl((char *)fname, SETACL, ((mnv_acl_solaris_T *)aclent)->acl_cnt, + ((mnv_acl_solaris_T *)aclent)->acl_entry); # else # ifdef HAVE_AIX_ACL chacl((char *)fname, aclent, ((struct acl *)aclent)->acl_len); @@ -3448,7 +3448,7 @@ mch_set_acl(char_u *fname UNUSED, vim_acl_T aclent) } void -mch_free_acl(vim_acl_T aclent) +mch_free_acl(mnv_acl_T aclent) { if (aclent == NULL) return; @@ -3459,7 +3459,7 @@ mch_free_acl(vim_acl_T aclent) acl_free((acl_t *)aclent); # else # ifdef HAVE_SOLARIS_ACL - free(((vim_acl_solaris_T *)aclent)->acl_entry); + free(((mnv_acl_solaris_T *)aclent)->acl_entry); free(aclent); # else # ifdef HAVE_AIX_ACL @@ -3574,7 +3574,7 @@ mch_can_exe(char_u *name, char_u **path, int use_path) if (name[0] != '/') *path = FullName_save(name, TRUE); else - *path = vim_strsave(name); + *path = mnv_strsave(name); } return TRUE; } @@ -3605,7 +3605,7 @@ mch_can_exe(char_u *name, char_u **path, int use_path) p = (char_u *)"./"; elen = STRLEN_LITERAL("./"); } - buflen = vim_snprintf((char *)buf, bufsize, "%.*s%s%s", + buflen = mnv_snprintf((char *)buf, bufsize, "%.*s%s%s", (int)elen, p, (after_pathsep(p, p + elen)) ? "" : PATHSEPSTR, @@ -3618,7 +3618,7 @@ mch_can_exe(char_u *name, char_u **path, int use_path) if (buf[0] != '/') *path = FullName_save(buf, TRUE); else - *path = vim_strnsave(buf, buflen); + *path = mnv_strnsave(buf, buflen); } break; } @@ -3628,7 +3628,7 @@ mch_can_exe(char_u *name, char_u **path, int use_path) p = e + 1; } - vim_free(buf); + mnv_free(buf); return retval; } @@ -3679,7 +3679,7 @@ mch_early_init(void) #endif /* - * Inform the macOS scheduler that Vim renders UI, and so shouldn’t have its + * Inform the macOS scheduler that MNV renders UI, and so shouldn’t have its * threads’ quality of service classes clamped. */ #ifdef MACOS_X @@ -3725,10 +3725,10 @@ mch_free_mem(void) XCloseDisplay(x11_display); # endif # if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK) - VIM_CLEAR(signal_stack); + MNV_CLEAR(signal_stack); # endif - vim_free(oldtitle); - vim_free(oldicon); + mnv_free(oldtitle); + mnv_free(oldicon); } #endif @@ -3819,7 +3819,7 @@ mch_exit(int r) exit_scroll(); // Cursor may have been switched off without calling starttermcap() - // when doing "vim -u vimrc" and vimrc contains ":q". + // when doing "mnv -u mnvrc" and mnvrc contains ":q". if (full_screen) cursor_on(); } @@ -4484,7 +4484,7 @@ mch_get_shellsize(void) * When being POSIX compliant ('|' flag in 'cpoptions') this overrules * the ioctl() values! */ - if (columns == 0 || rows == 0 || vim_strchr(p_cpo, CPO_TSIZE) != NULL) + if (columns == 0 || rows == 0 || mnv_strchr(p_cpo, CPO_TSIZE) != NULL) { if ((p = (char_u *)getenv("LINES"))) { @@ -4721,12 +4721,12 @@ set_child_environment( # ifdef FEAT_TERMINAL if (is_terminal) { - sprintf((char *)envbuf, "%ld", (long)get_vim_var_nr(VV_VERSION)); - setenv("VIM_TERMINAL", (char *)envbuf, 1); + sprintf((char *)envbuf, "%ld", (long)get_mnv_var_nr(VV_VERSION)); + setenv("MNV_TERMINAL", (char *)envbuf, 1); } # endif # ifdef FEAT_CLIENTSERVER - setenv("VIM_SERVERNAME", serverName == NULL ? "" : (char *)serverName, 1); + setenv("MNV_SERVERNAME", serverName == NULL ? "" : (char *)serverName, 1); # endif # else /* @@ -4734,28 +4734,28 @@ set_child_environment( * Use a static array to avoid losing allocated memory. * This won't work well when running multiple children... */ - vim_snprintf(envbuf_Term, sizeof(envbuf_Term), "TERM=%s", term); + mnv_snprintf(envbuf_Term, sizeof(envbuf_Term), "TERM=%s", term); putenv(envbuf_Term); - vim_snprintf(envbuf_Rows, sizeof(envbuf_Rows), "ROWS=%ld", rows); + mnv_snprintf(envbuf_Rows, sizeof(envbuf_Rows), "ROWS=%ld", rows); putenv(envbuf_Rows); - vim_snprintf(envbuf_Lines, sizeof(envbuf_Lines), "LINES=%ld", rows); + mnv_snprintf(envbuf_Lines, sizeof(envbuf_Lines), "LINES=%ld", rows); putenv(envbuf_Lines); - vim_snprintf(envbuf_Columns, sizeof(envbuf_Columns), + mnv_snprintf(envbuf_Columns, sizeof(envbuf_Columns), "COLUMNS=%ld", columns); putenv(envbuf_Columns); - vim_snprintf(envbuf_Colors, sizeof(envbuf_Colors), "COLORS=%ld", t_colors); + mnv_snprintf(envbuf_Colors, sizeof(envbuf_Colors), "COLORS=%ld", t_colors); putenv(envbuf_Colors); # ifdef FEAT_TERMINAL if (is_terminal) { - vim_snprintf(envbuf_Version, sizeof(envbuf_Version), - "VIM_TERMINAL=%ld", (long)get_vim_var_nr(VV_VERSION)); + mnv_snprintf(envbuf_Version, sizeof(envbuf_Version), + "MNV_TERMINAL=%ld", (long)get_mnv_var_nr(VV_VERSION)); putenv(envbuf_Version); } # endif # ifdef FEAT_CLIENTSERVER - vim_snprintf(envbuf_Servername, sizeof(envbuf_Servername), - "VIM_SERVERNAME=%s", serverName == NULL ? "" : (char *)serverName); + mnv_snprintf(envbuf_Servername, sizeof(envbuf_Servername), + "MNV_SERVERNAME=%s", serverName == NULL ? "" : (char *)serverName); putenv(envbuf_Servername); # endif # endif @@ -4805,9 +4805,9 @@ open_pty(int *pty_master_fd, int *pty_slave_fd, char_u **name1, char_u **name2) else { if (name1 != NULL) - *name1 = vim_strsave((char_u *)tty_name); + *name1 = mnv_strsave((char_u *)tty_name); if (name2 != NULL) - *name2 = vim_strsave((char_u *)tty_name); + *name2 = mnv_strsave((char_u *)tty_name); } } #endif @@ -4849,7 +4849,7 @@ unix_build_argv( char **argv = NULL; int argc; - *sh_tofree = vim_strsave(p_sh); + *sh_tofree = mnv_strsave(p_sh); if (*sh_tofree == NULL) // out of memory return FAIL; @@ -4895,7 +4895,7 @@ unix_build_argv( static int mch_call_shell_terminal( char_u *cmd, - int options UNUSED) // SHELL_*, see vim.h + int options UNUSED) // SHELL_*, see mnv.h { jobopt_T opt; char **argv = NULL; @@ -4953,9 +4953,9 @@ mch_call_shell_terminal( do_buffer(DOBUF_WIPE, DOBUF_FIRST, FORWARD, buf->b_fnum, TRUE); theend: - vim_free(argv); - vim_free(tofree1); - vim_free(tofree2); + mnv_free(argv); + mnv_free(tofree1); + mnv_free(tofree2); return retval; } #endif @@ -4967,7 +4967,7 @@ theend: static int mch_call_shell_system( char_u *cmd, - int options) // SHELL_*, see vim.h + int options) // SHELL_*, see mnv.h { # ifdef VMS char *ifn = NULL; @@ -5023,7 +5023,7 @@ mch_call_shell_system( (char *)p_shcf, (char *)cmd); x = system((char *)newcmd); - vim_free(newcmd); + mnv_free(newcmd); } # endif } @@ -5067,7 +5067,7 @@ mch_call_shell_system( static int mch_call_shell_fork( char_u *cmd, - int options) // SHELL_*, see vim.h + int options) // SHELL_*, see mnv.h { tmode_T tmode = cur_tmode; pid_t pid; @@ -5101,7 +5101,7 @@ mch_call_shell_fork( /* * For the GUI, when writing the output into the buffer and when reading * input from the buffer: Try using a pseudo-tty to get the stdin/stdout - * of the executed command into the Vim window. Or use a pipe. + * of the executed command into the MNV window. Or use a pipe. */ if ((options & (SHELL_READ|SHELL_WRITE)) # ifdef FEAT_GUI @@ -5214,9 +5214,9 @@ mch_call_shell_fork( */ if (fd >= 0) { - vim_ignored = dup(fd); // To replace stdin (fd 0) - vim_ignored = dup(fd); // To replace stdout (fd 1) - vim_ignored = dup(fd); // To replace stderr (fd 2) + mnv_ignored = dup(fd); // To replace stdin (fd 0) + mnv_ignored = dup(fd); // To replace stdout (fd 1) + mnv_ignored = dup(fd); // To replace stderr (fd 2) // Don't need this now that we've duplicated it close(fd); @@ -5272,13 +5272,13 @@ mch_call_shell_fork( // set up stdin/stdout/stderr for the child close(0); - vim_ignored = dup(pty_slave_fd); + mnv_ignored = dup(pty_slave_fd); close(1); - vim_ignored = dup(pty_slave_fd); + mnv_ignored = dup(pty_slave_fd); if (gui.in_use) { close(2); - vim_ignored = dup(pty_slave_fd); + mnv_ignored = dup(pty_slave_fd); } close(pty_slave_fd); // has been dupped, close it now @@ -5289,13 +5289,13 @@ mch_call_shell_fork( // set up stdin for the child close(fd_toshell[1]); close(0); - vim_ignored = dup(fd_toshell[0]); + mnv_ignored = dup(fd_toshell[0]); close(fd_toshell[0]); // set up stdout for the child close(fd_fromshell[0]); close(1); - vim_ignored = dup(fd_fromshell[1]); + mnv_ignored = dup(fd_fromshell[1]); close(fd_fromshell[1]); # ifdef FEAT_GUI @@ -5303,7 +5303,7 @@ mch_call_shell_fork( { // set up stderr for the child close(2); - vim_ignored = dup(1); + mnv_ignored = dup(1); } # endif } @@ -5420,7 +5420,7 @@ mch_call_shell_fork( len = write(toshell_fd, "", (size_t)1); else { - char_u *s = vim_strchr(lp + written, NL); + char_u *s = mnv_strchr(lp + written, NL); len = write(toshell_fd, (char *)lp + written, s == NULL ? lplen - written @@ -5436,7 +5436,7 @@ mch_call_shell_fork( || (lnum != curbuf->b_no_eol_lnum && (lnum != curbuf->b_ml.ml_line_count || curbuf->b_p_eol))) - vim_ignored = write(toshell_fd, "\n", + mnv_ignored = write(toshell_fd, "\n", (size_t)1); ++lnum; if (lnum > curbuf->b_op_end.lnum) @@ -5529,7 +5529,7 @@ mch_call_shell_fork( } } - // Remove Vim-specific codes from the input. + // Remove MNV-specific codes from the input. len = term_replace_keycodes(ta_buf, ta_len, len); /* @@ -5850,7 +5850,7 @@ finished: /* * Set to raw mode right now, otherwise a CTRL-C after - * catch_signals() will kill Vim. + * catch_signals() will kill MNV. */ if (tmode == TMODE_RAW) settmode(TMODE_RAW); @@ -5887,9 +5887,9 @@ error: if (tmode == TMODE_RAW) settmode(TMODE_RAW); // set to raw mode resettitle(); - vim_free(argv); - vim_free(tofree1); - vim_free(tofree2); + mnv_free(argv); + mnv_free(tofree1); + mnv_free(tofree2); return retval; } @@ -5898,13 +5898,13 @@ error: int mch_call_shell( char_u *cmd, - int options) // SHELL_*, see vim.h + int options) // SHELL_*, see mnv.h { #ifdef FEAT_EVAL ch_log(NULL, "executing shell command: %s", cmd); #endif #if defined(FEAT_GUI) && defined(FEAT_TERMINAL) - if (gui.in_use && vim_strchr(p_go, GO_TERMINAL) != NULL + if (gui.in_use && mnv_strchr(p_go, GO_TERMINAL) != NULL && (options & SHELL_SILENT) == 0) return mch_call_shell_terminal(cmd, options); #endif @@ -5979,7 +5979,7 @@ mch_get_cmd_output_direct( if (fd_in >= 0) { close(0); - vim_ignored = dup(fd_in); + mnv_ignored = dup(fd_in); close(fd_in); } } @@ -5989,7 +5989,7 @@ mch_get_cmd_output_direct( if (nullfd >= 0) { close(0); - vim_ignored = dup(nullfd); + mnv_ignored = dup(nullfd); close(nullfd); } } @@ -5997,10 +5997,10 @@ mch_get_cmd_output_direct( // Set up stdout: write end of pipe. close(fd_out[0]); close(1); - vim_ignored = dup(fd_out[1]); + mnv_ignored = dup(fd_out[1]); // Also redirect stderr to the pipe. close(2); - vim_ignored = dup(fd_out[1]); + mnv_ignored = dup(fd_out[1]); close(fd_out[1]); execvp(argv[0], argv); @@ -6033,7 +6033,7 @@ mch_get_cmd_output_direct( status = WEXITSTATUS(status); else status = -1; - set_vim_var_nr(VV_SHELL_ERROR, (long)status); + set_mnv_var_nr(VV_SHELL_ERROR, (long)status); if (ga.ga_len > 0) { @@ -6239,7 +6239,7 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options, int is_terminal) { typval_T *item = &dict_lookup(hi)->di_tv; - vim_setenv(hi->hi_key, tv_get_string(item)); + mnv_setenv(hi->hi_key, tv_get_string(item)); --todo; } } @@ -6268,34 +6268,34 @@ mch_job_start(char **argv, job_T *job, jobopt_T *options, int is_terminal) // set up stdin for the child close(0); if (use_null_for_in && null_fd >= 0) - vim_ignored = dup(null_fd); + mnv_ignored = dup(null_fd); else if (fd_in[0] < 0) - vim_ignored = dup(pty_slave_fd); + mnv_ignored = dup(pty_slave_fd); else - vim_ignored = dup(fd_in[0]); + mnv_ignored = dup(fd_in[0]); // set up stderr for the child close(2); if (use_null_for_err && null_fd >= 0) { - vim_ignored = dup(null_fd); + mnv_ignored = dup(null_fd); stderr_works = FALSE; } else if (use_out_for_err) - vim_ignored = dup(fd_out[1]); + mnv_ignored = dup(fd_out[1]); else if (fd_err[1] < 0) - vim_ignored = dup(pty_slave_fd); + mnv_ignored = dup(pty_slave_fd); else - vim_ignored = dup(fd_err[1]); + mnv_ignored = dup(fd_err[1]); // set up stdout for the child close(1); if (use_null_for_out && null_fd >= 0) - vim_ignored = dup(null_fd); + mnv_ignored = dup(null_fd); else if (fd_out[1] < 0) - vim_ignored = dup(pty_slave_fd); + mnv_ignored = dup(pty_slave_fd); else - vim_ignored = dup(fd_out[1]); + mnv_ignored = dup(fd_out[1]); if (fd_in[0] >= 0) close(fd_in[0]); @@ -6416,14 +6416,14 @@ get_signal_name(int sig) char_u numbuf[NUMBUFLEN]; if (sig == SIGKILL) - return vim_strnsave((char_u *)"kill", STRLEN_LITERAL("kill")); + return mnv_strnsave((char_u *)"kill", STRLEN_LITERAL("kill")); for (i = 0; signal_info[i].sig != -1; i++) if (sig == signal_info[i].sig) return strlow_save((char_u *)signal_info[i].name); - i = vim_snprintf((char *)numbuf, NUMBUFLEN, "%d", sig); - return vim_strnsave(numbuf, i); + i = mnv_snprintf((char *)numbuf, NUMBUFLEN, "%d", sig); + return mnv_strnsave(numbuf, i); } char * @@ -6806,7 +6806,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) int towait = (int)msec; # ifdef FEAT_MZSCHEME - mzvim_check_threads(); + mzmnv_check_threads(); if (mzthreads_allowed() && p_mzq > 0 && (msec < 0 || msec > p_mzq)) { towait = (int)p_mzq; // don't wait longer than 'mzquantum' @@ -6949,7 +6949,7 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted) long towait = msec; # ifdef FEAT_MZSCHEME - mzvim_check_threads(); + mzmnv_check_threads(); if (mzthreads_allowed() && p_mzq > 0 && (msec < 0 || msec > p_mzq)) { towait = p_mzq; // don't wait longer than 'mzquantum' @@ -7251,7 +7251,7 @@ mch_expand_wildcards( char_u *buffer; # define STYLE_ECHO 0 // use "echo", the default # define STYLE_GLOB 1 // use "glob", for csh -# define STYLE_VIMGLOB 2 // use "vimglob", for Posix sh +# define STYLE_MNVGLOB 2 // use "mnvglob", for Posix sh # define STYLE_PRINT 3 // use "print -N", for zsh # define STYLE_BT 4 // `cmd` expansion, execute the pattern directly # define STYLE_GLOBSTAR 5 // use extended shell glob for bash (this uses extended @@ -7262,9 +7262,9 @@ mch_expand_wildcards( int ampersand = FALSE; # define STRING_INIT(s) \ {(char_u *)(s), STRLEN_LITERAL(s)} - // vimglob() function to define for Posix shell - static string_T sh_vimglob_func = STRING_INIT("vimglob() { while [ $# -ge 1 ]; do echo \"$1\"; shift; done }; vimglob >"); - // vimglob() function with globstar setting enabled, only for bash >= 4.X + // mnvglob() function to define for Posix shell + static string_T sh_mnvglob_func = STRING_INIT("mnvglob() { while [ $# -ge 1 ]; do echo \"$1\"; shift; done }; mnvglob >"); + // mnvglob() function with globstar setting enabled, only for bash >= 4.X static string_T sh_globstar_opt = STRING_INIT("[[ ${BASH_VERSINFO[0]} -ge 4 ]] && shopt -s globstar; "); # undef STRING_INIT @@ -7290,14 +7290,14 @@ mch_expand_wildcards( */ if (secure || restricted) for (i = 0; i < num_pat; ++i) - if (vim_strchr(pat[i], '`') != NULL + if (mnv_strchr(pat[i], '`') != NULL && (check_restricted() || check_secure())) return FAIL; /* * get a name for the temp file */ - if ((tempname = vim_tempname('o', FALSE)) == NULL) + if ((tempname = mnv_tempname('o', FALSE)) == NULL) { emsg(_(e_cant_get_temp_file_name)); return FAIL; @@ -7312,10 +7312,10 @@ mch_expand_wildcards( * If we use *csh, "glob" will work better than "echo". * STYLE_PRINT: NL or NUL separated * If we use *zsh, "print -N" will work better than "glob". - * STYLE_VIMGLOB: NL separated - * If we use *sh*, we define "vimglob()". + * STYLE_MNVGLOB: NL separated + * If we use *sh*, we define "mnvglob()". * STYLE_GLOBSTAR: NL separated - * If we use *bash*, we define "vimglob() and enable globstar option". + * If we use *bash*, we define "mnvglob() and enable globstar option". * STYLE_ECHO: space separated. * A shell we don't know, stay safe and use "echo". */ @@ -7335,7 +7335,7 @@ mch_expand_wildcards( if (strstr((char *)gettail(p_sh), "bash") != NULL) shell_style = STYLE_GLOBSTAR; else if (strstr((char *)gettail(p_sh), "sh") != NULL) - shell_style = STYLE_VIMGLOB; + shell_style = STYLE_MNVGLOB; } // Compute the length of the command. We need 2 extra bytes: for the @@ -7343,10 +7343,10 @@ mch_expand_wildcards( // Worst case: "unset nonomatch; print -N >" plus two is 29 tempnamelen = STRLEN(tempname); len = tempnamelen + 29; - if (shell_style == STYLE_VIMGLOB) - len += sh_vimglob_func.length; + if (shell_style == STYLE_MNVGLOB) + len += sh_mnvglob_func.length; else if (shell_style == STYLE_GLOBSTAR) - len += sh_vimglob_func.length + sh_globstar_opt.length; + len += sh_mnvglob_func.length + sh_globstar_opt.length; for (i = 0; i < num_pat; ++i) { @@ -7358,7 +7358,7 @@ mch_expand_wildcards( ++len; // add space for (j = 0; pat[i][j] != NUL; ++j) { - if (vim_strchr(SHELL_SPECIAL, pat[i][j]) != NULL) + if (mnv_strchr(SHELL_SPECIAL, pat[i][j]) != NULL) ++len; // may add a backslash ++len; } @@ -7368,7 +7368,7 @@ mch_expand_wildcards( if (command == NULL) { // out of memory - vim_free(tempname); + mnv_free(tempname); return FAIL; } @@ -7383,7 +7383,7 @@ mch_expand_wildcards( if (shell_style == STYLE_BT) { // change `command; command& ` to (command; command ) - commandlen = vim_snprintf((char *)command, len, "(%s)>%s", pat[0] + 1, tempname); // +1 to exclude first backtick + commandlen = mnv_snprintf((char *)command, len, "(%s)>%s", pat[0] + 1, tempname); // +1 to exclude first backtick p = (char_u *)strstr((char *)command, ")>"); if (p == NULL) @@ -7393,13 +7393,13 @@ mch_expand_wildcards( else { --p; - while (p > command && VIM_ISWHITE(*p)) + while (p > command && MNV_ISWHITE(*p)) --p; if (*p == '`') // remove backtick *p = ' '; --p; - while (p > command && VIM_ISWHITE(*p)) + while (p > command && MNV_ISWHITE(*p)) --p; if (*p == '&') // remove ampersand { @@ -7415,18 +7415,18 @@ mch_expand_wildcards( // Assume the nonomatch option is valid only for csh like shells, // otherwise, this may set the positional parameters for the shell, // e.g. "$*". - commandlen = vim_snprintf((char *)command, len, "%sset nonomatch; glob >%s", + commandlen = mnv_snprintf((char *)command, len, "%sset nonomatch; glob >%s", (flags & EW_NOTFOUND) ? "" : "un", tempname); } else if (shell_style == STYLE_PRINT) - commandlen = vim_snprintf((char *)command, len, "print -N >%s", tempname); - else if (shell_style == STYLE_VIMGLOB) - commandlen = vim_snprintf((char *)command, len, "%s%s", sh_vimglob_func.string, tempname); + commandlen = mnv_snprintf((char *)command, len, "print -N >%s", tempname); + else if (shell_style == STYLE_MNVGLOB) + commandlen = mnv_snprintf((char *)command, len, "%s%s", sh_mnvglob_func.string, tempname); else if (shell_style == STYLE_GLOBSTAR) - commandlen = vim_snprintf((char *)command, len, "%s%s%s", sh_globstar_opt.string, - sh_vimglob_func.string, tempname); + commandlen = mnv_snprintf((char *)command, len, "%s%s%s", sh_globstar_opt.string, + sh_mnvglob_func.string, tempname); else - commandlen = vim_snprintf((char *)command, len, "echo >%s", tempname); + commandlen = mnv_snprintf((char *)command, len, "echo >%s", tempname); for (i = 0; i < num_pat; ++i) { @@ -7434,7 +7434,7 @@ mch_expand_wildcards( // is started twice. Otherwise put a backslash before special // characters, except inside ``. # ifdef USE_SYSTEM - commandlen += vim_snprintf((char *)command + commandlen, len, " \"%s\"", pat[i]); + commandlen += mnv_snprintf((char *)command + commandlen, len, " \"%s\"", pat[i]); # else int intick = FALSE; @@ -7450,14 +7450,14 @@ mch_expand_wildcards( // backslash inside backticks, before a special character // and before a backtick. if (intick - || vim_strchr(SHELL_SPECIAL, pat[i][j + 1]) != NULL + || mnv_strchr(SHELL_SPECIAL, pat[i][j + 1]) != NULL || pat[i][j + 1] == '`') *p++ = '\\'; ++j; } else if (!intick && ((flags & EW_KEEPDOLLAR) == 0 || pat[i][j] != '$') - && vim_strchr(SHELL_SPECIAL, pat[i][j]) != NULL) + && mnv_strchr(SHELL_SPECIAL, pat[i][j]) != NULL) // Put a backslash before a special character, but not // when inside ``. And not for $var when EW_KEEPDOLLAR is // set. @@ -7504,12 +7504,12 @@ mch_expand_wildcards( extra_shell_arg = NULL; // cleanup show_shell_mess = TRUE; - vim_free(command); + mnv_free(command); if (i != 0) // mch_call_shell() failed { mch_remove(tempname); - vim_free(tempname); + mnv_free(tempname); /* * With interactive completion, the error message is not printed. * However with USE_SYSTEM, I don't know how to turn off error messages @@ -7549,7 +7549,7 @@ mch_expand_wildcards( msg(_(e_cannot_expand_wildcards)); msg_start(); // don't overwrite this message } - vim_free(tempname); + mnv_free(tempname); goto notfound; } fseek(fd, 0L, SEEK_END); @@ -7564,7 +7564,7 @@ mch_expand_wildcards( { // out of memory mch_remove(tempname); - vim_free(tempname); + mnv_free(tempname); fclose(fd); return FAIL; } @@ -7576,11 +7576,11 @@ mch_expand_wildcards( { // unexpected read error semsg(_(e_cant_read_file_str), tempname); - vim_free(tempname); - vim_free(buffer); + mnv_free(tempname); + mnv_free(buffer); return FAIL; } - vim_free(tempname); + mnv_free(tempname); # ifdef __CYGWIN__ // Translate into . Caution, buffer may contain NUL. @@ -7606,7 +7606,7 @@ mch_expand_wildcards( } // file names are separated with NL else if (shell_style == STYLE_BT || - shell_style == STYLE_VIMGLOB || + shell_style == STYLE_MNVGLOB || shell_style == STYLE_GLOBSTAR) { buffer[len] = NUL; // make sure the buffer ends in NUL @@ -7667,7 +7667,7 @@ mch_expand_wildcards( * /bin/sh will happily expand it to nothing rather than returning an * error; and hey, it's good to check anyway -- webb. */ - vim_free(buffer); + mnv_free(buffer); goto notfound; } *num_file = i; @@ -7675,7 +7675,7 @@ mch_expand_wildcards( if (*file == NULL) { // out of memory - vim_free(buffer); + mnv_free(buffer); return FAIL; } @@ -7688,7 +7688,7 @@ mch_expand_wildcards( (*file)[i] = p; // Space or NL separates if (shell_style == STYLE_ECHO || shell_style == STYLE_BT - || shell_style == STYLE_VIMGLOB || shell_style == STYLE_GLOBSTAR) + || shell_style == STYLE_MNVGLOB || shell_style == STYLE_GLOBSTAR) { while (!(shell_style == STYLE_ECHO && *p == ' ') && *p != '\n' && *p != NUL) @@ -7737,12 +7737,12 @@ mch_expand_wildcards( (*file)[j++] = p; } } - vim_free(buffer); + mnv_free(buffer); *num_file = j; if (*num_file == 0) // rejected all entries { - VIM_CLEAR(*file); + MNV_CLEAR(*file); goto notfound; } @@ -7771,7 +7771,7 @@ save_patterns( return FAIL; for (i = 0; i < num_pat; i++) { - s = vim_strsave(pat[i]); + s = mnv_strsave(pat[i]); if (s != NULL) // Be compatible with expand_filename(): halve the number of // backslashes. @@ -7794,7 +7794,7 @@ mch_has_exp_wildcard(char_u *p) if (*p == '\\' && p[1] != NUL) ++p; else - if (vim_strchr((char_u *) + if (mnv_strchr((char_u *) #ifdef VMS "*?%" #else @@ -7818,7 +7818,7 @@ mch_has_wildcard(char_u *p) if (*p == '\\' && p[1] != NUL) ++p; else - if (vim_strchr((char_u *) + if (mnv_strchr((char_u *) #ifdef VMS "*?%$" #else @@ -7848,7 +7848,7 @@ have_dollars(int num, char_u **file) int i; for (i = 0; i < num; i++) - if (vim_strchr(file[i], '$') != NULL) + if (mnv_strchr(file[i], '$') != NULL) return TRUE; return FALSE; } @@ -7956,7 +7956,7 @@ gpm_open(void) Gpm_Close(); // We don't want to talk to xterm via gpm // Gpm_Close fails to properly restore the WINCH and TSTP handlers, - // leading to Vim ignoring resize signals. We have to re-initialize + // leading to MNV ignoring resize signals. We have to re-initialize // these handlers again here. # ifdef SIGWINCH mch_signal(SIGWINCH, sig_winch); @@ -7998,7 +7998,7 @@ mch_gpm_process(void) int button; static Gpm_Event gpm_event; char_u string[6]; - int_u vim_modifiers; + int_u mnv_modifiers; int row,col; unsigned char buttons_mask; unsigned char gpm_modifiers; @@ -8054,18 +8054,18 @@ mch_gpm_process(void) } // This code is based on gui_x11_mouse_cb in gui_x11.c gpm_modifiers = gpm_event.modifiers; - vim_modifiers = 0x0; + mnv_modifiers = 0x0; // I ignore capslock stats. Aren't we all just hate capslock mixing with - // Vim commands ? Besides, gpm_event.modifiers is unsigned char, and + // MNV commands ? Besides, gpm_event.modifiers is unsigned char, and // K_CAPSSHIFT is defined 8, so it probably isn't even reported if (gpm_modifiers & ((1 << KG_SHIFT) | (1 << KG_SHIFTR) | (1 << KG_SHIFTL))) - vim_modifiers |= MOUSE_SHIFT; + mnv_modifiers |= MOUSE_SHIFT; if (gpm_modifiers & ((1 << KG_CTRL) | (1 << KG_CTRLR) | (1 << KG_CTRLL))) - vim_modifiers |= MOUSE_CTRL; + mnv_modifiers |= MOUSE_CTRL; if (gpm_modifiers & ((1 << KG_ALT) | (1 << KG_ALTGR))) - vim_modifiers |= MOUSE_ALT; - string[3] |= vim_modifiers; + mnv_modifiers |= MOUSE_ALT; + string[3] |= mnv_modifiers; string[4] = (char_u)(col + ' ' + 1); string[5] = (char_u)(row + ' ' + 1); add_to_input_buf(string, 6); @@ -8339,7 +8339,7 @@ mch_libcall( else if (retval_str != NULL && retval_str != (char_u *)1 && retval_str != (char_u *)-1) - *string_result = vim_strsave(retval_str); + *string_result = mnv_strsave(retval_str); } # ifdef USING_SETJMP @@ -8427,7 +8427,7 @@ setup_term_clip(void) # endif { xterm_dpy = XtOpenDisplay(app_context, xterm_display, - "vim_xterm", "Vim_xterm", NULL, 0, &z, &strp); + "mnv_xterm", "MNV_xterm", NULL, 0, &z, &strp); if (xterm_dpy != NULL) xterm_dpy_retry_count = 0; # if defined(USING_SETJMP) @@ -8462,12 +8462,12 @@ setup_term_clip(void) # endif // Create a Shell to make converters work. - AppShell = XtVaAppCreateShell("vim_xterm", "Vim_xterm", + AppShell = XtVaAppCreateShell("mnv_xterm", "MNV_xterm", applicationShellWidgetClass, xterm_dpy, NULL); if (AppShell == (Widget)0) return; - xterm_Shell = XtVaCreatePopupShell("VIM", + xterm_Shell = XtVaCreatePopupShell("MNV", topLevelShellWidgetClass, AppShell, XtNmappedWhenManaged, 0, XtNwidth, 1, @@ -8667,7 +8667,7 @@ xterm_update(void) { XtInputMask mask = XtAppPending(app_context); - if (mask == 0 || vim_is_input_buf_full()) + if (mask == 0 || mnv_is_input_buf_full()) break; if (mask & XtIMXEvent) @@ -8943,7 +8943,7 @@ xsmp_init(void) // If the message is too long it might not be NUL terminated. Add // a NUL at the end to make sure we don't go over the end. errorstring[sizeof(errorstring) - 1] = NUL; - vim_snprintf(errorreport, sizeof(errorreport), + mnv_snprintf(errorreport, sizeof(errorreport), _("XSMP SmcOpenConnection failed: %s"), errorstring); verb_msg(errorreport); } @@ -8953,7 +8953,7 @@ xsmp_init(void) # if 0 // ID ourselves - smname.value = "vim"; + smname.value = "mnv"; smname.length = 3; smnameprop.name = "SmProgram"; smnameprop.type = "SmARRAY8"; @@ -9219,7 +9219,7 @@ mch_create_anon_file(void) { int fd = -1; #ifdef HAVE_SHM_OPEN - const char template[] = "/vimXXXXXX"; + const char template[] = "/mnvXXXXXX"; for (int i = 0; i < 100; i++) { @@ -9239,14 +9239,14 @@ mch_create_anon_file(void) { char_u *tempname; // get a name for the temp file - if ((tempname = vim_tempname('w', FALSE)) == NULL) + if ((tempname = mnv_tempname('w', FALSE)) == NULL) { emsg(_(e_cant_get_temp_file_name)); return -1; } fd = mch_open((char *)tempname, O_CREAT | O_RDWR | O_EXCL, 0600); mch_remove(tempname); - vim_free(tempname); + mnv_free(tempname); } return fd; } @@ -9284,7 +9284,7 @@ socket_server_init(char_u *name) if (fd == -1) { - vim_free(path); + mnv_free(path); return FAIL; } @@ -9295,14 +9295,14 @@ socket_server_init(char_u *name) if (name[0] == '/' || STRNCMP(name, "./", 2) == 0 || STRNCMP(name, "../", 3) == 0) num_printed = - vim_snprintf((char *)path, sizeof(addr.sun_path), "%s", name); + mnv_snprintf((char *)path, sizeof(addr.sun_path), "%s", name); else { const char_u *dir; char_u *buf; // Check if there are slashes in the name - if (vim_strchr(name, '/') != NULL) + if (mnv_strchr(name, '/') != NULL) { emsg(_(e_socket_name_no_slashes)); goto fail; @@ -9327,31 +9327,31 @@ socket_server_init(char_u *name) if (buf == NULL) goto fail; - vim_snprintf((char *)buf, sz, "%s/vim-%lu", dir, + mnv_snprintf((char *)buf, sz, "%s/mnv-%lu", dir, (unsigned long int)getuid()); } else { - buf = alloc(STRLEN(dir) + STRLEN("vim") + 2); + buf = alloc(STRLEN(dir) + STRLEN("mnv") + 2); if (buf == NULL) goto fail; - sprintf((char *)buf, "%s/vim", dir); + sprintf((char *)buf, "%s/mnv", dir); } // Always set directory permissions to 0700 for security - if (vim_mkdir(buf, 0700) == -1 && errno != EEXIST) + if (mnv_mkdir(buf, 0700) == -1 && errno != EEXIST) { semsg(_("Failed creating socket directory: %s"), strerror(errno)); - vim_free(buf); + mnv_free(buf); goto fail; } - num_printed = vim_snprintf((char *)path, sizeof(addr.sun_path), + num_printed = mnv_snprintf((char *)path, sizeof(addr.sun_path), "%s/%s", buf, name); - vim_free(buf); + mnv_free(buf); } // Check if path was too big @@ -9361,7 +9361,7 @@ socket_server_init(char_u *name) goto fail; } - vim_snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path); + mnv_snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path); // Bind to a suitable path/address while (i < 1000) @@ -9391,7 +9391,7 @@ socket_server_init(char_u *name) else break; - num_printed = vim_snprintf(addr.sun_path, sizeof(addr.sun_path), + num_printed = mnv_snprintf(addr.sun_path, sizeof(addr.sun_path), "%s%d", path, i); if ((size_t)num_printed >= sizeof(addr.sun_path)) @@ -9423,13 +9423,13 @@ socket_server_init(char_u *name) if (mch_FullName((char_u *)addr.sun_path, socket_server_path, MAXPATHL, FALSE) == FAIL) { - vim_free(socket_server_path); + mnv_free(socket_server_path); goto fail; } - serverName = vim_strsave(socket_server_path); + serverName = mnv_strsave(socket_server_path); # ifdef FEAT_EVAL - set_vim_var_string(VV_SEND_SERVER, serverName, -1); + set_mnv_var_string(VV_SEND_SERVER, serverName, -1); # endif socket_server_fd = fd; @@ -9440,11 +9440,11 @@ socket_server_init(char_u *name) gui_gtk_init_socket_server(); # endif - vim_free(path); + mnv_free(path); return OK; fail: close(fd); - vim_free(path); + mnv_free(path); socket_server_uninit(); return FAIL; } @@ -9461,7 +9461,7 @@ socket_server_uninit(void) if (socket_server_path != NULL) { mch_remove(socket_server_path); - vim_free(socket_server_path); + mnv_free(socket_server_path); socket_server_path = NULL; } # ifdef FEAT_GUI_GTK @@ -9472,7 +9472,7 @@ socket_server_uninit(void) /* * List available sockets that can be connected to, only in common directories - * that Vim knows about. Vim instances with custom socket paths will not be + * that MNV knows about. MNV instances with custom socket paths will not be * detected. Returns a newline separated string on success and NULL on failure. */ char_u * @@ -9494,7 +9494,7 @@ socket_server_list_sockets(void) return NULL; if ((path.string = alloc(sizeof(addr.sun_path))) == NULL) { - vim_free(buf.string); + mnv_free(buf.string); return NULL; } buf.length = 0; @@ -9511,11 +9511,11 @@ socket_server_list_sockets(void) if (STRCMP(dir, "/tmp") == 0 || (known_dirs[1] != NULL && STRCMP(dir, known_dirs[1]) == 0)) - path.length = vim_snprintf_safelen((char *)path.string, sizeof(addr.sun_path), - "%s/vim-%lu", dir, (unsigned long int)getuid()); + path.length = mnv_snprintf_safelen((char *)path.string, sizeof(addr.sun_path), + "%s/mnv-%lu", dir, (unsigned long int)getuid()); else - path.length = vim_snprintf_safelen((char *)path.string, sizeof(addr.sun_path), - "%s/vim", dir); + path.length = mnv_snprintf_safelen((char *)path.string, sizeof(addr.sun_path), + "%s/mnv", dir); dirp = opendir((char *)path.string); if (dirp == NULL) @@ -9527,7 +9527,7 @@ socket_server_list_sockets(void) if (STRCMP(dp->d_name, ".") == 0 || STRCMP(dp->d_name, "..") == 0) continue; - buf.length = vim_snprintf_safelen((char *)buf.string, sizeof(addr.sun_path), + buf.length = mnv_snprintf_safelen((char *)buf.string, sizeof(addr.sun_path), "%s/%s", path.string, dp->d_name); // Don't want to send to ourselves, but we do want to list our @@ -9553,8 +9553,8 @@ socket_server_list_sockets(void) break; } - vim_free(path.string); - vim_free(buf.string); + mnv_free(path.string); + mnv_free(buf.string); ga_append(&str, NUL); @@ -9600,7 +9600,7 @@ socket_server_valid(void) } /* - * If "name" is a pathless name such as "VIM", search known directories for the + * If "name" is a pathless name such as "MNV", search known directories for the * socket named "name", and return the alloc'ed path to it. If "name" starts * with a '/', './' or '../', then a copy of "name" is returned. Returns NULL * on failure or if no socket was found. @@ -9622,7 +9622,7 @@ socket_server_get_path_from_name(char_u *name) // Ignore if name is a path if (name[0] == '/' || STRNCMP(name, "./", 2) == 0 || STRNCMP(name, "../", 3) == 0) - return vim_strsave(name); + return mnv_strsave(name); buf = alloc(MAXPATHL); @@ -9637,10 +9637,10 @@ socket_server_get_path_from_name(char_u *name) continue; else if (STRCMP(dir, "/tmp") == 0 || (known_dirs[1] != NULL && STRCMP(dir, known_dirs[1]) == 0)) - vim_snprintf((char *)buf, MAXPATHL, "%s/vim-%lu/%s", dir, + mnv_snprintf((char *)buf, MAXPATHL, "%s/mnv-%lu/%s", dir, (unsigned long int)getuid(), name); else - vim_snprintf((char *)buf, MAXPATHL, "%s/vim/%s", dir, name); + mnv_snprintf((char *)buf, MAXPATHL, "%s/mnv/%s", dir, name); if (mch_stat((char *)buf,&s) == 0 && S_ISSOCK(s.st_mode)) { @@ -9651,7 +9651,7 @@ socket_server_get_path_from_name(char_u *name) } } - vim_free(buf); + mnv_free(buf); return NULL; } @@ -9695,9 +9695,9 @@ socket_server_send( // Execute locally if target is ourselves if (serverName != NULL && STRICMP(path, serverName) == 0) { - vim_free(path); + mnv_free(path); close(socket_fd); - return sendToLocalVim(str, is_expr, result); + return sendToLocalMNV(str, is_expr, result); } socket_server_init_cmd(&cmd, @@ -9728,14 +9728,14 @@ socket_server_send( if (final != NULL) emsg(_(e_failed_to_send_command_to_destination_program)); - vim_free(path); + mnv_free(path); socket_server_free_cmd(&cmd); close(socket_fd); - vim_free(final); + mnv_free(final); return -1; } socket_server_free_cmd(&cmd); - vim_free(final); + mnv_free(final); close(socket_fd); @@ -9744,7 +9744,7 @@ socket_server_send( if (receiver != NULL) *receiver = path; else - vim_free(path); + mnv_free(path); // Exit, we aren't waiting for a response return 0; @@ -9773,19 +9773,19 @@ socket_server_send( if (pending.result == NULL) { socket_server_pop_pending_cmd(&pending); - vim_free(path); + mnv_free(path); return -1; } if (result != NULL) *result = pending.result; else - vim_free(pending.result); + mnv_free(pending.result); if (receiver != NULL) *receiver = path; else - vim_free(path); + mnv_free(path); socket_server_pop_pending_cmd(&pending); @@ -9934,13 +9934,13 @@ socket_server_send_reply(char_u *client, char_u *str) socket_server_write(socket_fd, final, sz, 1000) == FAIL) { socket_server_free_cmd(&cmd); - vim_free(final); + mnv_free(final); close(socket_fd); return FAIL; } socket_server_free_cmd(&cmd); - vim_free(final); + mnv_free(final); close(socket_fd); return OK; @@ -9969,7 +9969,7 @@ socket_server_connect(char_u *name, char_u **path, int silent) if (STRLEN(socket_path) >= sizeof(addr.sun_path)) { // Path too big - vim_free(socket_path); + mnv_free(socket_path); return -1; } @@ -9977,12 +9977,12 @@ socket_server_connect(char_u *name, char_u **path, int silent) if (socket_fd == -1) { - vim_free(socket_path); + mnv_free(socket_path); return -1; } addr.sun_family = AF_UNIX; - vim_snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socket_path); + mnv_snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", socket_path); res = connect(socket_fd, (struct sockaddr *)&addr, sizeof(addr)); @@ -9992,14 +9992,14 @@ socket_server_connect(char_u *name, char_u **path, int silent) semsg(_(e_socket_server_failed_connecting), socket_path, strerror(errno)); close(socket_fd); - vim_free(socket_path); + mnv_free(socket_path); return -1; } if (path != NULL) *path = socket_path; else - vim_free(socket_path); + mnv_free(socket_path); return socket_fd; @@ -10094,7 +10094,7 @@ socket_server_free_cmd(ss_cmd_T *cmd) { ss_msg_T *msg = cmd->cmd_msgs + i; - vim_free(msg->msg_contents); + mnv_free(msg->msg_contents); } } @@ -10159,7 +10159,7 @@ socket_server_decode_cmd(ss_cmd_T *cmd, int socket_fd, int timeout) # endif // We also poll the socket server listening file descriptor to handle - // recursive remote calls between Vim instances, such as when one Vim + // recursive remote calls between MNV instances, such as when one MNV // instance calls remote_expr for an expression that calls remote_expr to // itself again. # ifndef HAVE_SELECT @@ -10234,7 +10234,7 @@ socket_server_decode_cmd(ss_cmd_T *cmd, int socket_fd, int timeout) // Now that we now the total size of messages, we can realloc // the buffer to contain all data - tmp = vim_realloc(buf, SS_CMD_INFO_SIZE + cmd->cmd_len); + tmp = mnv_realloc(buf, SS_CMD_INFO_SIZE + cmd->cmd_len); if (tmp == NULL) goto fail; @@ -10289,11 +10289,11 @@ continue_loop: } exit: - vim_free(buf); + mnv_free(buf); return OK; fail: socket_server_free_cmd(cmd); - vim_free(buf); + mnv_free(buf); return FAIL; } @@ -10396,7 +10396,7 @@ socket_server_add_reply(char_u *sender) { reply = ((ss_reply_T *)ss_replies.ga_data) + ss_replies.ga_len++; - reply->sender = vim_strsave(sender); + reply->sender = mnv_strsave(sender); if (reply->sender == NULL) return NULL; @@ -10418,7 +10418,7 @@ socket_server_remove_reply(char_u *sender) ss_reply_T *arr = ss_replies.ga_data; // Free strings - vim_free(reply->sender); + mnv_free(reply->sender); ga_clear_strings(&reply->strings); // Move all elements after the removed reply forward by one @@ -10460,8 +10460,8 @@ socket_server_exec_cmd(ss_cmd_T *cmd, int fd) sender = msg->msg_contents; // Save in global - vim_free(client_socket); - client_socket = vim_strsave(sender); + mnv_free(client_socket); + client_socket = mnv_strsave(sender); } } @@ -10527,14 +10527,14 @@ socket_server_exec_cmd(ss_cmd_T *cmd, int fd) if (fd2 >= 0) socket_server_write(fd2, buf, sz, 1000); - vim_free(buf); + mnv_free(buf); close(fd2); } socket_server_free_cmd(&rcmd); - vim_free(result); + mnv_free(result); } - vim_free(to_free); + mnv_free(to_free); } return; } @@ -10554,7 +10554,7 @@ socket_server_exec_cmd(ss_cmd_T *cmd, int fd) pending->code = rcode; if (to_free == NULL) - pending->result = vim_strsave(str); + pending->result = mnv_strsave(str); else pending->result = str; break; @@ -10580,8 +10580,8 @@ socket_server_exec_cmd(ss_cmd_T *cmd, int fd) apply_autocmds(EVENT_REMOTEREPLY, sender, str, TRUE, curbuf); - vim_free(to_free); - vim_free(to_free2); + mnv_free(to_free); + mnv_free(to_free2); } return; } @@ -10722,11 +10722,11 @@ socket_server_check_alive(char_u *name) if (final == NULL || socket_server_write(socket_fd, final, sz, 1000) == FAIL) { - vim_free(final); + mnv_free(final); close(socket_fd); return FALSE; } - vim_free(final); + mnv_free(final); // Poll for response # ifndef HAVE_SELECT @@ -10764,7 +10764,7 @@ socket_server_get_fd(void) static int socket_server_name_is_valid(char_u *name) { - if (STRLEN(name) == 0 || (name[0] != '/' && vim_strchr(name, '/') != NULL)) + if (STRLEN(name) == 0 || (name[0] != '/' && mnv_strchr(name, '/') != NULL)) { semsg(_(e_invalid_server_id_used_str), name); return FALSE; diff --git a/uvim/src/os_unix.h b/uvim/src/os_unix.h index a507392277..76f685620d 100644 --- a/uvim/src/os_unix.h +++ b/uvim/src/os_unix.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ #include @@ -57,11 +57,11 @@ // always use unlink() to remove files #ifndef PROTO # ifdef VMS -# define vim_mkdir(x, y) mkdir((char *)vms_fixfilename(x), y) +# define mnv_mkdir(x, y) mkdir((char *)vms_fixfilename(x), y) # define mch_rmdir(x) delete((char *)vms_fixfilename(x)) # define mch_remove(x) delete((char *)vms_fixfilename(x)) # else -# define vim_mkdir(x, y) mkdir((char *)(x), y) +# define mnv_mkdir(x, y) mkdir((char *)(x), y) # define mch_rmdir(x) rmdir((char *)(x)) # define mch_remove(x) unlink((char *)(x)) # endif @@ -187,17 +187,17 @@ typedef struct dsc$descriptor DESC; /* * Unix system-dependent file names */ -#ifndef SYS_VIMRC_FILE -# define SYS_VIMRC_FILE "$VIM/vimrc" +#ifndef SYS_MNVRC_FILE +# define SYS_MNVRC_FILE "$MNV/mnvrc" #endif -#ifndef SYS_GVIMRC_FILE -# define SYS_GVIMRC_FILE "$VIM/gvimrc" +#ifndef SYS_GMNVRC_FILE +# define SYS_GMNVRC_FILE "$MNV/gmnvrc" #endif #ifndef DFLT_HELPFILE -# define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt" +# define DFLT_HELPFILE "$MNVRUNTIME/doc/help.txt" #endif #ifndef SYS_MENU_FILE -# define SYS_MENU_FILE "$VIMRUNTIME/menu.vim" +# define SYS_MENU_FILE "$MNVRUNTIME/menu.mnv" #endif #ifndef USR_EXRC_FILE @@ -212,79 +212,79 @@ typedef struct dsc$descriptor DESC; # define USR_EXRC_FILE2 "sys$login:_exrc" #endif -#ifndef USR_VIMRC_FILE +#ifndef USR_MNVRC_FILE # ifdef VMS -# define USR_VIMRC_FILE "sys$login:.vimrc" +# define USR_MNVRC_FILE "sys$login:.mnvrc" # else -# define USR_VIMRC_FILE "$HOME/.vimrc" +# define USR_MNVRC_FILE "$HOME/.mnvrc" # endif #endif -#if !defined(USR_VIMRC_FILE2) +#if !defined(USR_MNVRC_FILE2) # ifdef VMS -# define USR_VIMRC_FILE2 "sys$login:vimfiles/vimrc" +# define USR_MNVRC_FILE2 "sys$login:mnvfiles/mnvrc" # else -# define USR_VIMRC_FILE2 "~/.vim/vimrc" +# define USR_MNVRC_FILE2 "~/.mnv/mnvrc" # endif #endif -#ifndef XDG_VIMRC_FILE -# define XDG_VIMRC_FILE (mch_getenv((char_u *)"XDG_CONFIG_HOME") \ - ? "$XDG_CONFIG_HOME/vim/vimrc" \ - : "~/.config/vim/vimrc") +#ifndef XDG_MNVRC_FILE +# define XDG_MNVRC_FILE (mch_getenv((char_u *)"XDG_CONFIG_HOME") \ + ? "$XDG_CONFIG_HOME/mnv/mnvrc" \ + : "~/.config/mnv/mnvrc") #endif -#if !defined(USR_VIMRC_FILE3) && defined(VMS) -# define USR_VIMRC_FILE3 "sys$login:_vimrc" +#if !defined(USR_MNVRC_FILE3) && defined(VMS) +# define USR_MNVRC_FILE3 "sys$login:_mnvrc" #endif -#ifndef USR_GVIMRC_FILE +#ifndef USR_GMNVRC_FILE # ifdef VMS -# define USR_GVIMRC_FILE "sys$login:.gvimrc" +# define USR_GMNVRC_FILE "sys$login:.gmnvrc" # else -# define USR_GVIMRC_FILE "$HOME/.gvimrc" +# define USR_GMNVRC_FILE "$HOME/.gmnvrc" # endif #endif -#ifndef USR_GVIMRC_FILE2 +#ifndef USR_GMNVRC_FILE2 # ifdef VMS -# define USR_GVIMRC_FILE2 "sys$login:vimfiles/gvimrc" +# define USR_GMNVRC_FILE2 "sys$login:mnvfiles/gmnvrc" # else -# define USR_GVIMRC_FILE2 "~/.vim/gvimrc" +# define USR_GMNVRC_FILE2 "~/.mnv/gmnvrc" # endif #endif #ifdef VMS -# ifndef USR_GVIMRC_FILE3 -# define USR_GVIMRC_FILE3 "sys$login:_gvimrc" +# ifndef USR_GMNVRC_FILE3 +# define USR_GMNVRC_FILE3 "sys$login:_gmnvrc" # endif #else -# ifndef USR_GVIMRC_FILE3 -# define USR_GVIMRC_FILE3 (mch_getenv("XDG_CONFIG_HOME") \ - ? "$XDG_CONFIG_HOME/vim/gvimrc" \ - : "~/.config/vim/gvimrc") +# ifndef USR_GMNVRC_FILE3 +# define USR_GMNVRC_FILE3 (mch_getenv("XDG_CONFIG_HOME") \ + ? "$XDG_CONFIG_HOME/mnv/gmnvrc" \ + : "~/.config/mnv/gmnvrc") # endif #endif -#ifndef VIM_DEFAULTS_FILE -# define VIM_DEFAULTS_FILE "$VIMRUNTIME/defaults.vim" +#ifndef MNV_DEFAULTS_FILE +# define MNV_DEFAULTS_FILE "$MNVRUNTIME/defaults.mnv" #endif -#ifndef EVIM_FILE -# define EVIM_FILE "$VIMRUNTIME/evim.vim" +#ifndef EMNV_FILE +# define EMNV_FILE "$MNVRUNTIME/emnv.mnv" #endif -#ifdef FEAT_VIMINFO -# ifndef VIMINFO_FILE +#ifdef FEAT_MNVINFO +# ifndef MNVINFO_FILE # ifdef VMS -# define VIMINFO_FILE "sys$login:.viminfo" +# define MNVINFO_FILE "sys$login:.mnvinfo" # else -# define VIMINFO_FILE "$HOME/.viminfo" +# define MNVINFO_FILE "$HOME/.mnvinfo" # endif # endif -# if !defined(VIMINFO_FILE2) && defined(VMS) -# define VIMINFO_FILE2 "sys$login:_viminfo" +# if !defined(MNVINFO_FILE2) && defined(VMS) +# define MNVINFO_FILE2 "sys$login:_mnvinfo" # endif #endif @@ -292,18 +292,18 @@ typedef struct dsc$descriptor DESC; # define EXRC_FILE ".exrc" #endif -#ifndef VIMRC_FILE -# define VIMRC_FILE ".vimrc" +#ifndef MNVRC_FILE +# define MNVRC_FILE ".mnvrc" #endif #ifdef FEAT_GUI -# ifndef GVIMRC_FILE -# define GVIMRC_FILE ".gvimrc" +# ifndef GMNVRC_FILE +# define GMNVRC_FILE ".gmnvrc" # endif #endif #ifndef SYNTAX_FNAME -# define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim" +# define SYNTAX_FNAME "$MNVRUNTIME/syntax/%s.mnv" #endif #ifndef DFLT_BDIR @@ -324,11 +324,11 @@ typedef struct dsc$descriptor DESC; #ifndef DFLT_VDIR # ifdef VMS -# define DFLT_VDIR "sys$login:vimfiles/view" +# define DFLT_VDIR "sys$login:mnvfiles/view" # else -# define DFLT_VDIR "$HOME/.vim/view" // default for 'viewdir' +# define DFLT_VDIR "$HOME/.mnv/view" // default for 'viewdir' # define XDG_VDIR (mch_getenv("XDG_CONFIG_HOME") ? \ - "$XDG_CONFIG_HOME/vim/view" : "~/.config/vim/view") + "$XDG_CONFIG_HOME/mnv/view" : "~/.config/mnv/view") # endif #endif @@ -337,26 +337,26 @@ typedef struct dsc$descriptor DESC; #ifndef DFLT_RUNTIMEPATH # ifdef VMS -# define DFLT_RUNTIMEPATH "sys$login:vimfiles,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,sys$login:vimfiles/after" -# define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" +# define DFLT_RUNTIMEPATH "sys$login:mnvfiles,$MNV/mnvfiles,$MNVRUNTIME,$MNV/mnvfiles/after,sys$login:mnvfiles/after" +# define CLEAN_RUNTIMEPATH "$MNV/mnvfiles,$MNVRUNTIME,$MNV/mnvfiles/after" # else # ifdef RUNTIME_GLOBAL # ifdef RUNTIME_GLOBAL_AFTER -# define DFLT_RUNTIMEPATH "~/.vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL_AFTER ",~/.vim/after" -# define XDG_RUNTIMEPATH "$XDG_CONFIG_HOME/vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL_AFTER ",$XDG_CONFIG_HOME/vim/after" -# define XDG_RUNTIMEPATH_FB "~/.config/vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL_AFTER ",~/.config/vim/after" -# define CLEAN_RUNTIMEPATH RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL_AFTER +# define DFLT_RUNTIMEPATH "~/.mnv," RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL_AFTER ",~/.mnv/after" +# define XDG_RUNTIMEPATH "$XDG_CONFIG_HOME/mnv," RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL_AFTER ",$XDG_CONFIG_HOME/mnv/after" +# define XDG_RUNTIMEPATH_FB "~/.config/mnv," RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL_AFTER ",~/.config/mnv/after" +# define CLEAN_RUNTIMEPATH RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL_AFTER # else -# define DFLT_RUNTIMEPATH "~/.vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after,~/.vim/after" -# define XDG_RUNTIMEPATH "$XDG_CONFIG_HOME/vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after,$XDG_CONFIG_HOME/vim/after" -# define XDG_RUNTIMEPATH_FB "~/.config/vim," RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after,~/.config/vim/after" -# define CLEAN_RUNTIMEPATH RUNTIME_GLOBAL ",$VIMRUNTIME," RUNTIME_GLOBAL "/after" +# define DFLT_RUNTIMEPATH "~/.mnv," RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL "/after,~/.mnv/after" +# define XDG_RUNTIMEPATH "$XDG_CONFIG_HOME/mnv," RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL "/after,$XDG_CONFIG_HOME/mnv/after" +# define XDG_RUNTIMEPATH_FB "~/.config/mnv," RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL "/after,~/.config/mnv/after" +# define CLEAN_RUNTIMEPATH RUNTIME_GLOBAL ",$MNVRUNTIME," RUNTIME_GLOBAL "/after" # endif # else -# define DFLT_RUNTIMEPATH "~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after" -# define XDG_RUNTIMEPATH "$XDG_CONFIG_HOME/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$XDG_CONFIG_HOME/vim/after" -# define XDG_RUNTIMEPATH_FB "~/.config/vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.config/vim/after" -# define CLEAN_RUNTIMEPATH "$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after" +# define DFLT_RUNTIMEPATH "~/.mnv,$MNV/mnvfiles,$MNVRUNTIME,$MNV/mnvfiles/after,~/.mnv/after" +# define XDG_RUNTIMEPATH "$XDG_CONFIG_HOME/mnv,$MNV/mnvfiles,$MNVRUNTIME,$MNV/mnvfiles/after,$XDG_CONFIG_HOME/mnv/after" +# define XDG_RUNTIMEPATH_FB "~/.config/mnv,$MNV/mnvfiles,$MNVRUNTIME,$MNV/mnvfiles/after,~/.config/mnv/after" +# define CLEAN_RUNTIMEPATH "$MNV/mnvfiles,$MNVRUNTIME,$MNV/mnvfiles/after" # endif # endif @@ -403,7 +403,7 @@ typedef struct dsc$descriptor DESC; # define DFLT_MAXMEM (5*1024) // use up to 5 Mbyte for a buffer # endif # ifndef DFLT_MAXMEMTOT -# define DFLT_MAXMEMTOT (10*1024) // use up to 10 Mbyte for Vim +# define DFLT_MAXMEMTOT (10*1024) // use up to 10 Mbyte for MNV # endif #endif diff --git a/uvim/src/os_unixx.h b/uvim/src/os_unixx.h index 73a21934b5..2c5248503c 100644 --- a/uvim/src/os_unixx.h +++ b/uvim/src/os_unixx.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* diff --git a/uvim/src/os_vms.c b/uvim/src/os_vms.c index bb93544f09..48caccde31 100644 --- a/uvim/src/os_vms.c +++ b/uvim/src/os_vms.c @@ -1,15 +1,15 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * VMS port by Henk Elbers * VMS deport by Zoltan Arpadffy * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ -#include "vim.h" +#include "mnv.h" // define _generic_64 for use in time functions #if !defined(VAX) @@ -414,16 +414,16 @@ vms_wproc(char *name, int val) // add more space to store matches vms_match_alloced += EXPL_ALLOC_INC; - vms_fmatch = vim_realloc(old_vms_fmatch, + vms_fmatch = mnv_realloc(old_vms_fmatch, sizeof(char **) * vms_match_alloced); if (!vms_fmatch) { - vim_free(old_vms_fmatch); + mnv_free(old_vms_fmatch); return 0; } vms_match_free = EXPL_ALLOC_INC; } - vms_fmatch[vms_match_num] = vim_strsave((char_u *)name); + vms_fmatch[vms_match_num] = mnv_strsave((char_u *)name); ++vms_match_num; return 1; @@ -468,7 +468,7 @@ mch_expand_wildcards( for (i = 0; i < num_pat; i++) { // expand environment var or home dir - if (vim_strchr(pat[i],'$') || vim_strchr(pat[i],'~')) + if (mnv_strchr(pat[i],'$') || mnv_strchr(pat[i],'~')) expand_env(pat[i],buf,MAXPATHL); else STRCPY(buf,pat[i]); @@ -511,10 +511,10 @@ mch_expand_wildcards( char_u **old_file = *file; files_alloced += EXPL_ALLOC_INC; - *file = vim_realloc(old_file, sizeof(char_u **) * files_alloced); + *file = mnv_realloc(old_file, sizeof(char_u **) * files_alloced); if (*file == NULL) { - vim_free(old_file); + mnv_free(old_file); *file = (char_u **)""; *num_file = 0; return(FAIL); @@ -687,7 +687,7 @@ vms_fixfilename(void *instring) if (len > buflen) { buflen = len + 128; - buf = vim_realloc(buf, buflen * sizeof(char)); + buf = mnv_realloc(buf, buflen * sizeof(char)); } #ifdef DEBUG diff --git a/uvim/src/os_vms_conf.h b/uvim/src/os_vms_conf.h index 5831cb1f74..9da884f8a2 100644 --- a/uvim/src/os_vms_conf.h +++ b/uvim/src/os_vms_conf.h @@ -146,8 +146,8 @@ #define FEAT_IPV6 #define FEAT_XTERM_SAVE -#define VIM_SIZEOF_INT 4 -#define VIM_SIZEOF_LONG 4 +#define MNV_SIZEOF_INT 4 +#define MNV_SIZEOF_LONG 4 #if __USE_OFF64_T # define SIZEOF_OFF_T 8 diff --git a/uvim/src/os_vms_mms.c b/uvim/src/os_vms_mms.c index 4da7b1ad41..36cdbc2d6f 100644 --- a/uvim/src/os_vms_mms.c +++ b/uvim/src/os_vms_mms.c @@ -2,7 +2,7 @@ #include #include #include -#include "vim.h" +#include "mnv.h" int main(int argc, char *argv[]) { FILE *fpi, *fpo; @@ -40,10 +40,10 @@ int main(int argc, char *argv[]) strcat(target, argp); } } - vim_snprintf(cmd, sizeof(cmd), "%s/output=tmp:errors.vim_tmp %s", + mnv_snprintf(cmd, sizeof(cmd), "%s/output=tmp:errors.mnv_tmp %s", mms, target); system(cmd); - fpi = fopen("tmp:errors.vim_tmp", "r"); + fpi = fopen("tmp:errors.mnv_tmp", "r"); fpo = fopen(error_file, "w"); while (fgets(buf, BUFSIZ, fpi)) { @@ -70,7 +70,7 @@ int main(int argc, char *argv[]) } fclose(fpi); fclose(fpo); - while (!delete("tmp:errors.vim_tmp")) + while (!delete("tmp:errors.mnv_tmp")) /*nop*/; exit(err ? 44 : 1); return(0); diff --git a/uvim/src/os_w32dll.c b/uvim/src/os_w32dll.c index 651f96c978..b14dab0381 100644 --- a/uvim/src/os_w32dll.c +++ b/uvim/src/os_w32dll.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * Windows GUI/Console: main program (DLL) entry point: diff --git a/uvim/src/os_w32exe.c b/uvim/src/os_w32exe.c index 7aa4ead99d..038e6aa46c 100644 --- a/uvim/src/os_w32exe.c +++ b/uvim/src/os_w32exe.c @@ -1,11 +1,11 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * GUI support by Robert Webb * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * Windows GUI/Console: main program (EXE) entry point: @@ -13,15 +13,15 @@ * Ron Aaron wrote this and the DLL support code. * Adapted by Ken Takata. */ -#include "vim.h" +#include "mnv.h" -// cproto doesn't create a prototype for VimMain() -#ifdef VIMDLL +// cproto doesn't create a prototype for MNVMain() +#ifdef MNVDLL __declspec(dllimport) #endif -int VimMain(int argc, char **argv); +int MNVMain(int argc, char **argv); -#ifdef VIMDLL +#ifdef MNVDLL # define SaveInst(hInst) // Do nothing #else void SaveInst(HINSTANCE hInst); @@ -36,43 +36,43 @@ wWinMain( int nCmdShow UNUSED) { SaveInst(hInstance); - return VimMain(0, NULL); + return MNVMain(0, NULL); } #else int wmain(int argc UNUSED, wchar_t **argv UNUSED) { SaveInst(GetModuleHandleW(NULL)); - return VimMain(0, NULL); + return MNVMain(0, NULL); } #endif #ifdef USE_OWNSTARTUP // Use our own entry point and don't use the default CRT startup code to -// reduce the size of (g)vim.exe. This works only when VIMDLL is defined. +// reduce the size of (g)mnv.exe. This works only when MNVDLL is defined. // // For MSVC, the /GS- compiler option is needed to avoid the undefined symbol // error. (It disables the security check. However, it affects only this -// function and doesn't have any effect on Vim itself.) +// function and doesn't have any effect on MNV itself.) // For MinGW, the -nostdlib compiler option and the --entry linker option are // needed. # ifdef FEAT_GUI void WINAPI wWinMainCRTStartup(void) { - VimMain(0, NULL); + MNVMain(0, NULL); } # else void wmainCRTStartup(void) { - VimMain(0, NULL); + MNVMain(0, NULL); } # endif #endif // USE_OWNSTARTUP -#if defined(VIMDLL) && defined(FEAT_MZSCHEME) +#if defined(MNVDLL) && defined(FEAT_MZSCHEME) # if defined(_MSC_VER) static __declspec(thread) void *tls_space; diff --git a/uvim/src/os_win32.c b/uvim/src/os_win32.c index edbe895ecd..8400df1810 100644 --- a/uvim/src/os_win32.c +++ b/uvim/src/os_win32.c @@ -1,10 +1,10 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. - * See README.txt for an overview of the Vim source code. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. + * See README.txt for an overview of the MNV source code. */ /* * os_win32.c @@ -17,10 +17,10 @@ * NetHack 3.1.3, GNU Emacs 19.30, and Vile 5.5. * * George V. Reilly wrote most of this. - * Roger Knobbe did the initial port of Vim 3.0. + * Roger Knobbe did the initial port of MNV 3.0. */ -#include "vim.h" +#include "mnv.h" #ifdef FEAT_MZSCHEME # include "if_mzsch.h" @@ -49,7 +49,7 @@ FILE* fdDump = NULL; #endif -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) // Win32 Console handles for input and output static HANDLE g_hConIn = INVALID_HANDLE_VALUE; static HANDLE g_hConOut = INVALID_HANDLE_VALUE; @@ -100,10 +100,10 @@ static int read_input_record_buffer(INPUT_RECORD* irEvents, int nMaxLength); static int write_input_record_buffer(INPUT_RECORD* irEvents, int nLength); #endif #ifdef FEAT_GUI_MSWIN -static int s_dont_use_vimrun = TRUE; -static int need_vimrun_warning = FALSE; -static string_T vimrun_path = {(char_u *)"vimrun ", 7}; -static int vimrun_path_allocated = FALSE; +static int s_dont_use_mnvrun = TRUE; +static int need_mnvrun_warning = FALSE; +static string_T mnvrun_path = {(char_u *)"mnvrun ", 7}; +static int mnvrun_path_allocated = FALSE; #endif static int win32_getattrs(char_u *name); @@ -116,7 +116,7 @@ static int conpty_stable = 0; static int conpty_fix_type = 0; static void vtp_flag_init(void); -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) static int vtp_working = 0; static void vtp_init(void); static void vtp_exit(void); @@ -147,26 +147,26 @@ static int default_console_color_fg = 0xc0c0c0; // white static void set_console_color_rgb(void); static void reset_console_color_rgb(void); static void restore_console_color_rgb(void); -#endif // !FEAT_GUI_MSWIN || VIMDLL +#endif // !FEAT_GUI_MSWIN || MNVDLL // This flag is newly created from Windows 10 #ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING # define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004 #endif -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) static int suppress_winsize = 1; // don't fiddle with console #endif static WCHAR *exe_pathw = NULL; -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) static BOOL use_alternate_screen_buffer = FALSE; #endif extern DWORD win_version; // this is in os_mswin.c -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) static BOOL is_ambiwidth_event( INPUT_RECORD *ir) @@ -335,7 +335,7 @@ wait_for_single_object( return WaitForSingleObject(hHandle, dwMilliseconds); } # endif -#endif // !FEAT_GUI_MSWIN || VIMDLL +#endif // !FEAT_GUI_MSWIN || MNVDLL void mch_get_exe_name(void) @@ -350,13 +350,13 @@ mch_get_exe_name(void) WCHAR buf[MAX_PATH]; WCHAR *p; - // store the name of the executable, may be used for $VIM + // store the name of the executable, may be used for $MNV p = buf + GetModuleFileNameW(NULL, buf, MAX_PATH); if (p > buf) { if (enc_codepage == -1) enc_codepage = GetACP(); - vim_free(exe_name); + mnv_free(exe_name); exe_name = utf16_to_enc(buf, NULL); enc_prev = enc_codepage; @@ -372,7 +372,7 @@ mch_get_exe_name(void) } } while (p > buf); - vim_free(exe_pathw); + mnv_free(exe_pathw); exe_pathw = _wcsdup(buf); updated = TRUE; } @@ -440,7 +440,7 @@ unescape_shellxquote(char_u *p, char_u *escaped) while (*p != NUL) { - if (*p == '^' && vim_strchr(escaped, p[1]) != NULL) + if (*p == '^' && mnv_strchr(escaped, p[1]) != NULL) mch_memmove(p, p + 1, l--); n = (*mb_ptr2len)(p); p += n; @@ -452,7 +452,7 @@ unescape_shellxquote(char_u *p, char_u *escaped) * Load library "name". */ HINSTANCE -vimLoadLib(const char *name) +mnvLoadLib(const char *name) { HINSTANCE dll = NULL; @@ -461,7 +461,7 @@ vimLoadLib(const char *name) return NULL; // NOTE: Do not use mch_dirname() and mch_chdir() here, they may call - // vimLoadLib() recursively, which causes a stack overflow. + // mnvLoadLib() recursively, which causes a stack overflow. if (exe_pathw == NULL) { mch_get_exe_name(); @@ -483,7 +483,7 @@ vimLoadLib(const char *name) return dll; } -#if defined(VIMDLL) +#if defined(MNVDLL) /* * Check if the current executable file is for the GUI subsystem. */ @@ -719,14 +719,14 @@ dyn_libintl_init(void) if (hLibintlDLL != NULL) return 1; // Load gettext library (libintl.dll and other names). - hLibintlDLL = vimLoadLib(GETTEXT_DLL); + hLibintlDLL = mnvLoadLib(GETTEXT_DLL); # ifdef GETTEXT_DLL_ALT1 if (!hLibintlDLL) - hLibintlDLL = vimLoadLib(GETTEXT_DLL_ALT1); + hLibintlDLL = mnvLoadLib(GETTEXT_DLL_ALT1); # endif # ifdef GETTEXT_DLL_ALT2 if (!hLibintlDLL) - hLibintlDLL = vimLoadLib(GETTEXT_DLL_ALT2); + hLibintlDLL = mnvLoadLib(GETTEXT_DLL_ALT2); # endif if (!hLibintlDLL) { @@ -896,7 +896,7 @@ PlatformId(void) #ifdef FEAT_EVAL DWORD major = (win_version >> 24) & 0xFF; DWORD minor = (win_version >> 16) & 0xFF; - vim_snprintf(windowsVersion, sizeof(windowsVersion), "%d.%d", major, minor); + mnv_snprintf(windowsVersion, sizeof(windowsVersion), "%d.%d", major, minor); #endif #ifdef HAVE_ACL @@ -906,7 +906,7 @@ PlatformId(void) #endif } -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) # define SHIFT (SHIFT_PRESSED) # define CTRL (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED) @@ -916,7 +916,7 @@ PlatformId(void) // When uChar.AsciiChar is 0, then we need to look at wVirtualKeyCode. // We map function keys to their ANSI terminal equivalents, as produced -// by ANSI.SYS, for compatibility with the MS-DOS version of Vim. Any +// by ANSI.SYS, for compatibility with the MS-DOS version of MNV. Any // ANSI key with a value >= '\300' is nonstandard, but provided anyway // so that the user can have access to all SHIFT-, CTRL-, and ALT- // combinations of function/arrow/etc keys. @@ -1259,7 +1259,7 @@ encode_key_event(dict_T *args, INPUT_RECORD *ir) ker.wVirtualScanCode = 0; ker.dwControlKeyState = 0; int mods = (int)dict_get_number(args, "modifiers"); - // Encode the win32 console key modifiers from Vim keyboard modifiers. + // Encode the win32 console key modifiers from MNV keyboard modifiers. if (mods) { // If "modifiers" is explicitly set in the args, then we reset any @@ -1314,7 +1314,7 @@ encode_key_event(dict_T *args, INPUT_RECORD *ir) ker.wVirtualKeyCode = vkCode; ker.uChar.UnicodeChar = 0; ir->Event.KeyEvent = ker; - vim_free(action); + mnv_free(action); } else { @@ -1325,20 +1325,20 @@ encode_key_event(dict_T *args, INPUT_RECORD *ir) else { semsg(_(e_invalid_value_for_argument_str_str), "event", action); - vim_free(action); + mnv_free(action); } return FALSE; } return TRUE; } # endif // FEAT_EVAL -#endif // !FEAT_GUI_MSWIN || VIMDLL +#endif // !FEAT_GUI_MSWIN || MNVDLL /* * For the GUI the mouse handling is in gui_w32.c. */ -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) static int g_fMouseAvail = FALSE; // mouse present static int g_fMouseActive = FALSE; // mouse enabled static int g_nMouseClick = -1; // mouse status @@ -1355,7 +1355,7 @@ mch_setmouse(int on) { DWORD cmodein; -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) return; # endif @@ -1459,13 +1459,13 @@ decode_mouse_wheel(MOUSE_EVENT_RECORD *pmer) char_u modifiers = 0; char_u direction = 0; - // Decode the direction into an event that Vim can process + // Decode the direction into an event that MNV can process if (horizontal) direction = zDelta >= 0 ? KE_MOUSELEFT : KE_MOUSERIGHT; else direction = zDelta >= 0 ? KE_MOUSEDOWN : KE_MOUSEUP; - // Decode the win32 console key modifiers into Vim mouse modifiers. + // Decode the win32 console key modifiers into MNV mouse modifiers. if (pmer->dwControlKeyState & SHIFT_PRESSED) modifiers |= MOD_MASK_SHIFT; // MOUSE_SHIFT; if (pmer->dwControlKeyState & (RIGHT_CTRL_PRESSED | LEFT_CTRL_PRESSED)) @@ -1850,7 +1850,7 @@ encode_mouse_event(dict_T *args, INPUT_RECORD *ir) mer.dwControlKeyState = 0; if (mods != 0) { - // Encode the win32 console key modifiers from Vim MOUSE modifiers. + // Encode the win32 console key modifiers from MNV MOUSE modifiers. if (mods & MOUSE_SHIFT) mer.dwControlKeyState |= SHIFT_PRESSED; if (mods & MOUSE_CTRL) @@ -1903,24 +1903,24 @@ read_input_record_buffer(INPUT_RECORD* irEvents, int nMaxLength) input_record_buffer_node_T *pop_head = input_record_buffer.head; irEvents[nCount++] = pop_head->ir; input_record_buffer.head = pop_head->next; - vim_free(pop_head); + mnv_free(pop_head); if (input_record_buffer.length == 0) input_record_buffer.tail = NULL; } return nCount; } -#else // FEAT_GUI_MSWIN && !VIMDLL +#else // FEAT_GUI_MSWIN && !MNVDLL void mch_setmouse(int on UNUSED) { } -#endif // FEAT_GUI_MSWIN && !VIMDLL +#endif // FEAT_GUI_MSWIN && !MNVDLL #ifdef FEAT_EVAL /* - * The 'test_mswin_event' function is for testing Vim's low-level handling of + * The 'test_mswin_event' function is for testing MNV's low-level handling of * user input events. ie, this manages the encoding of INPUT_RECORD events - * so that we have a way to test how Vim decodes INPUT_RECORD events in Windows + * so that we have a way to test how MNV decodes INPUT_RECORD events in Windows * consoles. * * The 'test_mswin_event' function is based on 'test_gui_event'. In fact, when @@ -1939,12 +1939,12 @@ test_mswin_event(char_u *event, dict_T *args) { int lpEventsWritten = 0; -# if defined(VIMDLL) || defined(FEAT_GUI_MSWIN) +# if defined(MNVDLL) || defined(FEAT_GUI_MSWIN) if (gui.in_use) return test_gui_w32_sendevent(event, args); # endif -# if defined(VIMDLL) || !defined(FEAT_GUI_MSWIN) +# if defined(MNVDLL) || !defined(FEAT_GUI_MSWIN) // Currently implemented event record types are; KEY_EVENT and MOUSE_EVENT // Potentially could also implement: FOCUS_EVENT and WINDOW_BUFFER_SIZE_EVENT @@ -2040,7 +2040,7 @@ mch_update_cursor(void) int idx; int thickness; -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) return; # endif @@ -2058,7 +2058,7 @@ mch_update_cursor(void) } #endif -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) /* * Handle FOCUS_EVENT. */ @@ -2106,7 +2106,7 @@ WaitForChar(long msec, int ignore_input) parse_queued_messages(); # endif # ifdef FEAT_MZSCHEME - mzvim_check_threads(); + mzmnv_check_threads(); # endif # ifdef FEAT_CLIENTSERVER serverProcessPendingMessages(); @@ -2263,7 +2263,7 @@ WaitForChar(long msec, int ignore_input) int mch_char_avail(void) { -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) return TRUE; # endif @@ -2277,7 +2277,7 @@ mch_char_avail(void) int mch_check_messages(void) { -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) return TRUE; # endif @@ -2361,11 +2361,11 @@ mch_inchar( long time UNUSED, int tb_change_cnt UNUSED) { -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) int len; int c; -# ifdef VIMDLL +# ifdef MNVDLL // Extra space for maximum three CSIs. E.g. U+1B6DB -> 0xF0 0x9B 0x9B 0x9B. # define TYPEAHEADSPACE 6 # else @@ -2375,7 +2375,7 @@ mch_inchar( static char_u typeahead[TYPEAHEADLEN]; // previously typed bytes. static int typeaheadlen = 0; -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) return 0; # endif @@ -2536,7 +2536,7 @@ mch_inchar( for (i = 0, j = 0; i < n; i++) { typeahead[typeaheadlen + j++] = p[i]; -# ifdef VIMDLL +# ifdef MNVDLL if (p[i] == CSI) { typeahead[typeaheadlen + j++] = KS_EXTRA; @@ -2545,13 +2545,13 @@ mch_inchar( # endif } n = j; - vim_free(p); + mnv_free(p); } } else { typeahead[typeaheadlen] = c; -# ifdef VIMDLL +# ifdef MNVDLL if (c == CSI) { typeahead[typeaheadlen + 1] = KS_EXTRA; @@ -2649,9 +2649,9 @@ theend: # endif return len; -#else // FEAT_GUI_MSWIN && !VIMDLL +#else // FEAT_GUI_MSWIN && !MNVDLL return 0; -#endif // FEAT_GUI_MSWIN && !VIMDLL +#endif // FEAT_GUI_MSWIN && !MNVDLL } /* @@ -2681,7 +2681,7 @@ executable_file(char *name, char_u **path) if (path != NULL) *path = res; else - vim_free(res); + mnv_free(res); } else if (path != NULL) *path = FullName_save((char_u *)name, FALSE); @@ -2756,7 +2756,7 @@ executable_exists( ++p; continue; } - e = vim_strchr(p, ';'); + e = mnv_strchr(p, ';'); if (e == NULL) e = pathext.string + pathext.length; plen = (size_t)(e - p); @@ -2843,7 +2843,7 @@ executable_exists( ++p; continue; } - e = vim_strchr(p, ';'); + e = mnv_strchr(p, ';'); if (e == NULL) e = pathbuf.string + pathbuf.length; @@ -2860,7 +2860,7 @@ executable_exists( } else { - buflen = vim_snprintf_safelen( + buflen = mnv_snprintf_safelen( (char *)buf, sizeof(buf), "%.*s%s%s", (int)(e - p), p, @@ -2883,7 +2883,7 @@ executable_exists( ++p; continue; } - e2 = vim_strchr(p, ';'); + e2 = mnv_strchr(p, ';'); if (e2 == NULL) e2 = pathext.string + pathext.length; @@ -2895,7 +2895,7 @@ executable_exists( retval = FALSE; goto theend; } - vim_strncpy(buf + buflen, p, e2 - p); + mnv_strncpy(buf + buflen, p, e2 - p); } if (executable_file((char *)buf, path)) { @@ -2971,66 +2971,66 @@ mch_init_g(void) Rows = 25; Columns = 80; - // Look for 'vimrun'. + // Look for 'mnvrun'. { - char_u vimrun_location[_MAX_PATH + 4]; + char_u mnvrun_location[_MAX_PATH + 4]; size_t exe_pathlen = (size_t)(gettail(exe_name) - exe_name); - // Note: 10 is length of 'vimrun.exe'. - if (exe_pathlen + 10 >= sizeof(vimrun_location)) + // Note: 10 is length of 'mnvrun.exe'. + if (exe_pathlen + 10 >= sizeof(mnvrun_location)) { - if (executable_exists("vimrun.exe", STRLEN_LITERAL("vimrun.exe"), + if (executable_exists("mnvrun.exe", STRLEN_LITERAL("mnvrun.exe"), NULL, TRUE, FALSE)) - s_dont_use_vimrun = FALSE; + s_dont_use_mnvrun = FALSE; } else { - // First try in same directory as gvim.exe. + // First try in same directory as gmnv.exe. if (exe_pathlen > 0) - vim_strncpy(vimrun_location, exe_name, exe_pathlen); - STRCPY(vimrun_location + exe_pathlen, "vimrun.exe"); + mnv_strncpy(mnvrun_location, exe_name, exe_pathlen); + STRCPY(mnvrun_location + exe_pathlen, "mnvrun.exe"); - if (mch_getperm(vimrun_location) >= 0) + if (mch_getperm(mnvrun_location) >= 0) { char_u *p; size_t plen; - if (exe_pathlen > 0 && *skiptowhite(vimrun_location) != NUL) + if (exe_pathlen > 0 && *skiptowhite(mnvrun_location) != NUL) { // Enclose path with white space in double quotes. - plen = vim_snprintf_safelen( - (char *)vimrun_location, - sizeof(vimrun_location), - "\"%.*svimrun\" ", + plen = mnv_snprintf_safelen( + (char *)mnvrun_location, + sizeof(mnvrun_location), + "\"%.*smnvrun\" ", (int)exe_pathlen, exe_name); } else { // Remove the suffix ('.exe'). - vimrun_location[exe_pathlen + 6] = ' '; - vimrun_location[exe_pathlen + 7] = NUL; + mnvrun_location[exe_pathlen + 6] = ' '; + mnvrun_location[exe_pathlen + 7] = NUL; plen = exe_pathlen + 7; } - p = vim_strnsave(vimrun_location, plen); + p = mnv_strnsave(mnvrun_location, plen); if (p != NULL) { - vimrun_path.string = p; - vimrun_path.length = plen; - vimrun_path_allocated = TRUE; - s_dont_use_vimrun = FALSE; + mnvrun_path.string = p; + mnvrun_path.length = plen; + mnvrun_path_allocated = TRUE; + s_dont_use_mnvrun = FALSE; } } - else if (executable_exists("vimrun.exe", STRLEN_LITERAL("vimrun.exe"), + else if (executable_exists("mnvrun.exe", STRLEN_LITERAL("mnvrun.exe"), NULL, TRUE, FALSE)) - s_dont_use_vimrun = FALSE; + s_dont_use_mnvrun = FALSE; } - // Don't give the warning for a missing vimrun.exe right now, but only - // when vimrun was supposed to be used. Don't bother people that do - // not need vimrun.exe. - if (s_dont_use_vimrun) - need_vimrun_warning = TRUE; + // Don't give the warning for a missing mnvrun.exe right now, but only + // when mnvrun was supposed to be used. Don't bother people that do + // not need mnvrun.exe. + if (s_dont_use_mnvrun) + need_mnvrun_warning = TRUE; } /* @@ -3052,7 +3052,7 @@ mch_init_g(void) #endif // FEAT_GUI_MSWIN -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) # define SRWIDTH(sr) ((sr).Right - (sr).Left + 1) # define SRHEIGHT(sr) ((sr).Bottom - (sr).Top + 1) @@ -3196,7 +3196,7 @@ SaveConsoleBuffer( cb->BufferSize.X = cb->Info.dwSize.X; cb->BufferSize.Y = cb->Info.dwSize.Y; NumCells = cb->BufferSize.X * cb->BufferSize.Y; - vim_free(cb->Buffer); + mnv_free(cb->Buffer); cb->Buffer = ALLOC_MULT(CHAR_INFO, NumCells); if (cb->Buffer == NULL) return FALSE; @@ -3220,11 +3220,11 @@ SaveConsoleBuffer( if (cb->Regions == NULL || numregions != cb->NumRegions) { cb->NumRegions = numregions; - vim_free(cb->Regions); + mnv_free(cb->Regions); cb->Regions = ALLOC_MULT(SMALL_RECT, cb->NumRegions); if (cb->Regions == NULL) { - VIM_CLEAR(cb->Buffer); + MNV_CLEAR(cb->Buffer); return FALSE; } } @@ -3249,8 +3249,8 @@ SaveConsoleBuffer( BufferCoord, // offset in our buffer &ReadRegion)) // region to save { - VIM_CLEAR(cb->Buffer); - VIM_CLEAR(cb->Regions); + MNV_CLEAR(cb->Buffer); + MNV_CLEAR(cb->Regions); return FALSE; } cb->Regions[i] = ReadRegion; @@ -3345,7 +3345,7 @@ char g_szOrigTitle[256] = { 0 }; HWND g_hWnd = NULL; // also used in os_mswin.c static HICON g_hOrigIconSmall = NULL; static HICON g_hOrigIcon = NULL; -static HICON g_hVimIcon = NULL; +static HICON g_hMNVIcon = NULL; static BOOL g_fCanChangeIcon = FALSE; /* @@ -3407,7 +3407,7 @@ SetConsoleIcon( * restoration. Also, attempts to obtain a handle to the console window, * and use it to save the small and big icons currently in use by the * console window. This is not always possible on some versions of Windows; - * nor is it possible when running Vim remotely using Telnet (since the + * nor is it possible when running MNV remotely using Telnet (since the * console window the user sees is owned by a remote process). */ static void @@ -3433,14 +3433,14 @@ SaveConsoleTitleAndIcon(void) if (g_hOrigIconSmall == NULL || g_hOrigIcon == NULL) return; - // Extract the first icon contained in the Vim executable. + // Extract the first icon contained in the MNV executable. if ( # ifdef FEAT_LIBCALL - mch_icon_load((HANDLE *)&g_hVimIcon) == FAIL || + mch_icon_load((HANDLE *)&g_hMNVIcon) == FAIL || # endif - g_hVimIcon == NULL) - g_hVimIcon = ExtractIcon(NULL, (LPCSTR)exe_name, 0); - if (g_hVimIcon != NULL) + g_hMNVIcon == NULL) + g_hMNVIcon = ExtractIcon(NULL, (LPCSTR)exe_name, 0); + if (g_hMNVIcon != NULL) g_fCanChangeIcon = TRUE; } @@ -3507,12 +3507,12 @@ mch_init_c(void) SaveConsoleTitleAndIcon(); /* - * Set both the small and big icons of the console window to Vim's icon. - * Note that Vim presently only has one size of icon (32x32), but it + * Set both the small and big icons of the console window to MNV's icon. + * Note that MNV presently only has one size of icon (32x32), but it * automatically gets scaled down to 16x16 when setting the small icon. */ if (g_fCanChangeIcon) - SetConsoleIcon(g_hWnd, g_hVimIcon, g_hVimIcon); + SetConsoleIcon(g_hWnd, g_hMNVIcon, g_hMNVIcon); ui_get_shellsize(); @@ -3574,7 +3574,7 @@ mch_exit_c(int r) /* * Restore both the small and big icons of the console window to * what they were at startup. Don't do this when the window is - * closed, Vim would hang here. + * closed, MNV would hang here. */ if (g_fCanChangeIcon && !g_fForceExit) SetConsoleIcon(g_hWnd, g_hOrigIconSmall, g_hOrigIcon); @@ -3602,12 +3602,12 @@ mch_exit_c(int r) exit(r); } -#endif // !FEAT_GUI_MSWIN || VIMDLL +#endif // !FEAT_GUI_MSWIN || MNVDLL void mch_init(void) { -#ifdef VIMDLL +#ifdef MNVDLL if (gui.starting) mch_init_g(); else @@ -3626,17 +3626,17 @@ mch_exit(int r) netbeans_send_disconnect(); #endif -#ifdef VIMDLL - if (vimrun_path_allocated) - vim_free(vimrun_path.string); +#ifdef MNVDLL + if (mnvrun_path_allocated) + mnv_free(mnvrun_path.string); if (gui.in_use || gui.starting) mch_exit_g(r); else mch_exit_c(r); #elif defined(FEAT_GUI_MSWIN) - if (vimrun_path_allocated) - vim_free(vimrun_path.string); + if (mnvrun_path_allocated) + mnv_free(mnvrun_path.string); mch_exit_g(r); #else mch_exit_c(r); @@ -3653,10 +3653,10 @@ mch_check_win( { mch_get_exe_name(); -#if defined(FEAT_GUI_MSWIN) && !defined(VIMDLL) +#if defined(FEAT_GUI_MSWIN) && !defined(MNVDLL) return OK; // GUI always has a tty #else -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) return OK; # endif @@ -3694,18 +3694,18 @@ fname_case( if (q != NULL) { if (len > 0) - vim_strncpy(name, q, len - 1); + mnv_strncpy(name, q, len - 1); else { size_t namelen = STRLEN(name); if (namelen >= STRLEN(q)) - vim_strncpy(name, q, namelen); + mnv_strncpy(name, q, namelen); } - vim_free(q); + mnv_free(q); } } - vim_free(p); + mnv_free(p); } @@ -3726,8 +3726,8 @@ mch_get_user_name( if (p != NULL) { - vim_strncpy(s, p, len - 1); - vim_free(p); + mnv_strncpy(s, p, len - 1); + mnv_free(p); return OK; } } @@ -3754,8 +3754,8 @@ mch_get_host_name( if (p == NULL) return; - vim_strncpy(s, p, len - 1); - vim_free(p); + mnv_strncpy(s, p, len - 1); + mnv_free(p); } @@ -3817,7 +3817,7 @@ mch_dirname( if (STRLEN(p) >= (size_t)len) { // long path name is too long, fall back to short one - VIM_CLEAR(p); + MNV_CLEAR(p); } } } @@ -3827,8 +3827,8 @@ mch_dirname( if (p == NULL) return FAIL; - vim_strncpy(buf, p, len - 1); - vim_free(p); + mnv_strncpy(buf, p, len - 1); + mnv_free(p); return OK; } @@ -3863,7 +3863,7 @@ mch_setperm(char_u *name, long perm) return FAIL; n = _wchmod(p, perm); - vim_free(p); + mnv_free(p); if (n == -1) return FAIL; @@ -3940,7 +3940,7 @@ mch_mkdir(char_u *name) if (p == NULL) return -1; retval = _wmkdir(p); - vim_free(p); + mnv_free(p); return retval; } @@ -3958,7 +3958,7 @@ mch_rmdir(char_u *name) if (p == NULL) return -1; retval = _wrmdir(p); - vim_free(p); + mnv_free(p); return retval; } @@ -3991,7 +3991,7 @@ mch_is_symbolic_link(char_u *name) return FALSE; hFind = FindFirstFileW(wn, &findDataW); - vim_free(wn); + mnv_free(wn); if (hFind != INVALID_HANDLE_VALUE) { fileFlags = findDataW.dwFileAttributes; @@ -4044,7 +4044,7 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info) OPEN_EXISTING, // creation disposition FILE_FLAG_BACKUP_SEMANTICS, // file attributes NULL); // handle to template file - vim_free(wn); + mnv_free(wn); if (hFile == INVALID_HANDLE_VALUE) return FILEINFO_READ_FAIL; @@ -4074,7 +4074,7 @@ win32_getattrs(char_u *name) return INVALID_FILE_ATTRIBUTES; attr = GetFileAttributesW(p); - vim_free(p); + mnv_free(p); return attr; } @@ -4095,7 +4095,7 @@ win32_setattrs(char_u *name, int attrs) return -1; res = SetFileAttributesW(p, attrs); - vim_free(p); + mnv_free(p); return res ? 0 : -1; } @@ -4154,7 +4154,7 @@ mch_nodetype(char_u *name) WCHAR *wn; // We can't open a file with a name "\\.\con" or "\\.\prn" and trying to - // read from it later will cause Vim to hang. Thus return NODE_WRITABLE + // read from it later will cause MNV to hang. Thus return NODE_WRITABLE // here. if (STRNCMP(name, "\\\\.\\", 4) == 0) return NODE_WRITABLE; @@ -4170,7 +4170,7 @@ mch_nodetype(char_u *name) OPEN_EXISTING, // creation disposition 0, // file attributes NULL); // handle to template file - vim_free(wn); + mnv_free(wn); if (hFile == INVALID_HANDLE_VALUE) return NODE_NORMAL; @@ -4198,11 +4198,11 @@ struct my_acl * Return a pointer to the ACL of file "fname" in allocated memory. * Return NULL if the ACL is not available for whatever reason. */ - vim_acl_T + mnv_acl_T mch_get_acl(char_u *fname) { #ifndef HAVE_ACL - return (vim_acl_T)NULL; + return (mnv_acl_T)NULL; #else struct my_acl *p = NULL; DWORD err; @@ -4215,7 +4215,7 @@ mch_get_acl(char_u *fname) wn = enc_to_utf16(fname, NULL); if (wn == NULL) { - vim_free(p); + mnv_free(p); return NULL; } @@ -4248,13 +4248,13 @@ mch_get_acl(char_u *fname) } if (p->pSecurityDescriptor == NULL) { - mch_free_acl((vim_acl_T)p); + mch_free_acl((mnv_acl_T)p); p = NULL; } - vim_free(wn); + mnv_free(wn); } - return (vim_acl_T)p; + return (mnv_acl_T)p; #endif } @@ -4287,7 +4287,7 @@ is_acl_inherited(PACL acl) * This must only be called with "acl" equal to what mch_get_acl() returned. */ void -mch_set_acl(char_u *fname, vim_acl_T acl) +mch_set_acl(char_u *fname, mnv_acl_T acl) { #ifdef HAVE_ACL struct my_acl *p = (struct my_acl *)acl; @@ -4326,12 +4326,12 @@ mch_set_acl(char_u *fname, vim_acl_T acl) p->pDacl, // Discretionary information. p->pSacl // For auditing purposes. ); - vim_free(wn); + mnv_free(wn); #endif } void -mch_free_acl(vim_acl_T acl) +mch_free_acl(mnv_acl_T acl) { #ifdef HAVE_ACL struct my_acl *p = (struct my_acl *)acl; @@ -4339,12 +4339,12 @@ mch_free_acl(vim_acl_T acl) if (p != NULL) { LocalFree(p->pSecurityDescriptor); // Free the memory just in case - vim_free(p); + mnv_free(p); } #endif } -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) /* * handler for ctrl-break, ctrl-c interrupts, and fatal events. @@ -4384,7 +4384,7 @@ handler_routine( windgoto((int)Rows - 1, cmdline_col_off); g_fForceExit = TRUE; - vim_snprintf((char *)IObuff, IOSIZE, _("Vim: Caught %s event\n"), + mnv_snprintf((char *)IObuff, IOSIZE, _("MNV: Caught %s event\n"), (dwCtrlType == CTRL_CLOSE_EVENT ? _("close") : dwCtrlType == CTRL_LOGOFF_EVENT @@ -4414,7 +4414,7 @@ mch_settmode(tmode_T tmode) DWORD cmodeout; BOOL bEnableHandler; -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) return; # endif @@ -4477,7 +4477,7 @@ mch_get_shellsize(void) { CONSOLE_SCREEN_BUFFER_INFO csbi; -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) return OK; # endif @@ -4486,7 +4486,7 @@ mch_get_shellsize(void) /* * For some reason, we are trying to get the screen dimensions * even though we are not in termcap mode. The 'Rows' and 'Columns' - * variables are really intended to mean the size of Vim screen + * variables are really intended to mean the size of MNV screen * while in termcap mode. */ Rows = g_cbTermcap.Info.dwSize.Y; @@ -4637,7 +4637,7 @@ mch_set_shellsize(void) { COORD coordScreen; -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) return; # endif @@ -4668,7 +4668,7 @@ mch_set_shellsize(void) void mch_new_shellsize(void) { -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) return; # endif @@ -4693,7 +4693,7 @@ mch_set_winsize_now(void) #endif static BOOL -vim_create_process( +mnv_create_process( char *cmd, BOOL inherit_handles, DWORD flags, @@ -4727,14 +4727,14 @@ vim_create_process( (LPSTARTUPINFOW)si, // Startup information pi); // Process information theend: - vim_free(wcmd); - vim_free(wcwd); + mnv_free(wcmd); + mnv_free(wcwd); return ret; } static HINSTANCE -vim_shell_execute( +mnv_shell_execute( char *cmd, INT n_show_cmd) { @@ -4746,7 +4746,7 @@ vim_shell_execute( return (HINSTANCE) 0; ret = ShellExecuteW(NULL, NULL, wcmd, NULL, NULL, n_show_cmd); - vim_free(wcmd); + mnv_free(wcmd); return ret; } @@ -4776,7 +4776,7 @@ mch_system_classic(char *cmd, int options) si.dwFlags = STARTF_USESHOWWINDOW; /* * It's nicer to run a filter command in a minimized window. - * Don't activate the window to keep focus on Vim. + * Don't activate the window to keep focus on MNV. */ if (options & SHELL_DOOUT) si.wShowWindow = SW_SHOWMINNOACTIVE; @@ -4786,7 +4786,7 @@ mch_system_classic(char *cmd, int options) si.lpReserved2 = NULL; // Now, run the command - vim_create_process(cmd, FALSE, + mnv_create_process(cmd, FALSE, CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE, &si, &pi, NULL, NULL); @@ -4836,7 +4836,7 @@ mch_system_classic(char *cmd, int options) /* * Thread launched by the gui to send the current buffer data to the - * process. This way avoid to hang up vim totally if the children + * process. This way avoid to hang up mnv totally if the children * process take a long time to process the lines. */ static unsigned int __stdcall @@ -4862,7 +4862,7 @@ sub_process_writer(LPVOID param) } else { - s = vim_strchr(lp + written, NL); + s = mnv_strchr(lp + written, NL); WriteFile(g_hChildStd_IN_Wr, (char *)lp + written, s == NULL ? l : (DWORD)(s - (lp + written)), &len, NULL); @@ -4879,7 +4879,7 @@ sub_process_writer(LPVOID param) || curbuf->b_p_eol))) { WriteFile(g_hChildStd_IN_Wr, "\n", 1, - (LPDWORD)&vim_ignored, NULL); + (LPDWORD)&mnv_ignored, NULL); } ++lnum; @@ -5080,7 +5080,7 @@ mch_system_piped(char *cmd, int options) if (cmd != NULL) { - p = (char *)vim_strsave((char_u *)cmd); + p = (char *)mnv_strsave((char_u *)cmd); if (p != NULL) unescape_shellxquote((char_u *)p, p_sxe); else @@ -5091,11 +5091,11 @@ mch_system_piped(char *cmd, int options) // About "Inherit handles" being TRUE: this command can be litigious, // handle inheritance was deactivated for pending temp file, but, if we // deactivate it, the pipes don't work for some reason. - vim_create_process(p, TRUE, CREATE_DEFAULT_ERROR_MODE, + mnv_create_process(p, TRUE, CREATE_DEFAULT_ERROR_MODE, &si, &pi, NULL, NULL); if (p != cmd) - vim_free(p); + mnv_free(p); // Close our unused side of the pipes CloseHandle(g_hChildStd_IN_Rd); @@ -5292,7 +5292,7 @@ mch_system_g(char *cmd, int options) } #endif -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) static int mch_system_c(char *cmd, int options UNUSED) { @@ -5310,7 +5310,7 @@ mch_system_c(char *cmd, int options UNUSED) buf = alloc(len); if (buf == NULL) return -1; - vim_snprintf((char *)buf, len, "(%s)", cmd); + mnv_snprintf((char *)buf, len, "(%s)", cmd); wcmd = enc_to_utf16(buf, NULL); free(buf); } @@ -5321,7 +5321,7 @@ mch_system_c(char *cmd, int options UNUSED) return -1; ret = _wsystem(wcmd); - vim_free(wcmd); + mnv_free(wcmd); return ret; } @@ -5330,7 +5330,7 @@ mch_system_c(char *cmd, int options UNUSED) static int mch_system(char *cmd, int options) { -#ifdef VIMDLL +#ifdef MNVDLL if (gui.in_use || gui.starting) return mch_system_g(cmd, options); else @@ -5349,7 +5349,7 @@ mch_system(char *cmd, int options) static int mch_call_shell_terminal( char_u *cmd, - int options UNUSED) // SHELL_*, see vim.h + int options UNUSED) // SHELL_*, see mnv.h { jobopt_T opt; char_u *newcmd = NULL; @@ -5375,7 +5375,7 @@ mch_call_shell_terminal( } else { - vim_snprintf((char *)newcmd, cmdlen, "%s %s %s", p_sh, p_shcf, cmd); + mnv_snprintf((char *)newcmd, cmdlen, "%s %s %s", p_sh, p_shcf, cmd); ch_log(NULL, "starting terminal for system command '%s'", cmd); } @@ -5387,7 +5387,7 @@ mch_call_shell_terminal( buf = term_start(argvar, NULL, &opt, TERM_START_SYSTEM); if (buf == NULL) { - vim_free(newcmd); + mnv_free(newcmd); return 255; } @@ -5424,7 +5424,7 @@ mch_call_shell_terminal( wait_return(TRUE); do_buffer(DOBUF_WIPE, DOBUF_FIRST, FORWARD, buf->b_fnum, TRUE); - vim_free(newcmd); + mnv_free(newcmd); return retval; } #endif @@ -5436,12 +5436,12 @@ restore_env_var(char_u *name, char_u *old_value, int must_free) { if (old_value != NULL) { - vim_setenv(name, old_value); + mnv_setenv(name, old_value); if (must_free) - vim_free(old_value); + mnv_free(old_value); return; } - vim_unsetenv(name); + mnv_unsetenv(name); } /* @@ -5450,7 +5450,7 @@ restore_env_var(char_u *name, char_u *old_value, int must_free) int mch_call_shell( char_u *cmd, - int options) // SHELL_*, see vim.h + int options) // SHELL_*, see mnv.h { int x = 0; int tmode = cur_tmode; @@ -5477,15 +5477,15 @@ mch_call_shell( ARRAY_LENGTH(szShellTitle))) wcscat(szShellTitle, wn); SetConsoleTitleW(szShellTitle); - vim_free(wn); + mnv_free(wn); } } } // do not execute anything from the current directory by setting the // environment variable $NoDefaultCurrentDirectoryInExePath - oldval = vim_getenv((char_u *)"NoDefaultCurrentDirectoryInExePath", + oldval = mnv_getenv((char_u *)"NoDefaultCurrentDirectoryInExePath", &must_free); - vim_setenv((char_u *)"NoDefaultCurrentDirectoryInExePath", (char_u *)"1"); + mnv_setenv((char_u *)"NoDefaultCurrentDirectoryInExePath", (char_u *)"1"); out_flush(); @@ -5499,10 +5499,10 @@ mch_call_shell( #if defined(FEAT_GUI) && defined(FEAT_TERMINAL) // TODO: make the terminal window work with input or output redirected. if ( -# ifdef VIMDLL +# ifdef MNVDLL gui.in_use && # endif - vim_strchr(p_go, GO_TERMINAL) != NULL + mnv_strchr(p_go, GO_TERMINAL) != NULL && (options & (SHELL_FILTER|SHELL_DOOUT|SHELL_WRITE|SHELL_READ)) == 0) { char_u *cmdbase = cmd; @@ -5514,7 +5514,7 @@ mch_call_shell( // Check the command does not begin with "start " if (cmdbase == NULL || STRNICMP(cmdbase, "start", 5) != 0 - || !VIM_ISWHITE(cmdbase[5])) + || !MNV_ISWHITE(cmdbase[5])) { // Use a terminal window to run the command in. x = mch_call_shell_terminal(cmd, options); @@ -5558,7 +5558,7 @@ mch_call_shell( if (*cmdbase == '(') ++cmdbase; - if ((STRNICMP(cmdbase, "start", 5) == 0) && VIM_ISWHITE(cmdbase[5])) + if ((STRNICMP(cmdbase, "start", 5) == 0) && MNV_ISWHITE(cmdbase[5])) { STARTUPINFO si; PROCESS_INFORMATION pi; @@ -5577,7 +5577,7 @@ mch_call_shell( cmdbase = skipwhite(cmdbase + 5); if ((STRNICMP(cmdbase, "/min", 4) == 0) - && VIM_ISWHITE(cmdbase[4])) + && MNV_ISWHITE(cmdbase[4])) { cmdbase = skipwhite(cmdbase + 4); si.dwFlags = STARTF_USESHOWWINDOW; @@ -5585,7 +5585,7 @@ mch_call_shell( n_show_cmd = SW_SHOWMINNOACTIVE; } else if ((STRNICMP(cmdbase, "/b", 2) == 0) - && VIM_ISWHITE(cmdbase[2])) + && MNV_ISWHITE(cmdbase[2])) { cmdbase = skipwhite(cmdbase + 2); flags = CREATE_NO_WINDOW; @@ -5631,7 +5631,7 @@ mch_call_shell( if (cmd_shell == NULL || *cmd_shell == NUL) cmd_shell = (char_u *)default_shell(); - subcmd = vim_strsave_escaped_ext(cmdbase, + subcmd = mnv_strsave_escaped_ext(cmdbase, (char_u *)"|", '^', FALSE); if (subcmd != NULL) { @@ -5639,11 +5639,11 @@ mch_call_shell( cmdlen = STRLEN(cmd_shell) + STRLEN(subcmd) + 5; newcmd = alloc(cmdlen); if (newcmd != NULL) - vim_snprintf((char *)newcmd, cmdlen, "%s /c %s", + mnv_snprintf((char *)newcmd, cmdlen, "%s /c %s", cmd_shell, subcmd); else newcmd = cmdbase; - vim_free(subcmd); + mnv_free(subcmd); } } @@ -5652,17 +5652,17 @@ mch_call_shell( * inherit our handles which causes unpleasant dangling swap * files if we exit before the spawned process */ - if (vim_create_process((char *)newcmd, FALSE, flags, + if (mnv_create_process((char *)newcmd, FALSE, flags, &si, &pi, NULL, NULL)) x = 0; - else if (vim_shell_execute((char *)newcmd, n_show_cmd) + else if (mnv_shell_execute((char *)newcmd, n_show_cmd) > (HINSTANCE)32) x = 0; else { x = -1; #ifdef FEAT_GUI_MSWIN -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) # endif emsg(_(e_command_not_found)); @@ -5670,7 +5670,7 @@ mch_call_shell( } if (newcmd != cmdbase) - vim_free(newcmd); + mnv_free(newcmd); if (si.dwFlags == STARTF_USESTDHANDLES && si.hStdInput != NULL) { @@ -5686,8 +5686,8 @@ mch_call_shell( cmdlen = #ifdef FEAT_GUI_MSWIN ((gui.in_use || gui.starting) ? - (!s_dont_use_vimrun && p_stmp ? - vimrun_path.length : STRLEN(p_sh) + STRLEN(p_shcf)) + (!s_dont_use_mnvrun && p_stmp ? + mnvrun_path.length : STRLEN(p_sh) + STRLEN(p_shcf)) : 0) + #endif STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10; @@ -5697,50 +5697,50 @@ mch_call_shell( { #if defined(FEAT_GUI_MSWIN) if ( -# ifdef VIMDLL +# ifdef MNVDLL (gui.in_use || gui.starting) && # endif - need_vimrun_warning) + need_mnvrun_warning) { - char *msg = _("VIMRUN.EXE not found in your $PATH.\n" + char *msg = _("MNVRUN.EXE not found in your $PATH.\n" "External commands will not pause after completion.\n" - "See :help win32-vimrun for more information."); - char *title = _("Vim Warning"); + "See :help win32-mnvrun for more information."); + char *title = _("MNV Warning"); WCHAR *wmsg = enc_to_utf16((char_u *)msg, NULL); WCHAR *wtitle = enc_to_utf16((char_u *)title, NULL); if (wmsg != NULL && wtitle != NULL) MessageBoxW(NULL, wmsg, wtitle, MB_ICONWARNING); - vim_free(wmsg); - vim_free(wtitle); - need_vimrun_warning = FALSE; + mnv_free(wmsg); + mnv_free(wtitle); + need_mnvrun_warning = FALSE; } if ( -# ifdef VIMDLL +# ifdef MNVDLL (gui.in_use || gui.starting) && # endif - !s_dont_use_vimrun && p_stmp) - // Use vimrun to execute the command. It opens a console - // window, which can be closed without killing Vim. - vim_snprintf((char *)newcmd, cmdlen, "%s%s%s %s %s", - vimrun_path.string, + !s_dont_use_mnvrun && p_stmp) + // Use mnvrun to execute the command. It opens a console + // window, which can be closed without killing MNV. + mnv_snprintf((char *)newcmd, cmdlen, "%s%s%s %s %s", + mnvrun_path.string, (msg_silent != 0 || (options & SHELL_DOOUT)) ? "-s " : "", p_sh, p_shcf, cmd); else if ( -# ifdef VIMDLL +# ifdef MNVDLL (gui.in_use || gui.starting) && # endif - s_dont_use_vimrun && STRCMP(p_shcf, "/c") == 0) - // workaround for the case that "vimrun" does not exist - vim_snprintf((char *)newcmd, cmdlen, "%s %s %s %s %s", + s_dont_use_mnvrun && STRCMP(p_shcf, "/c") == 0) + // workaround for the case that "mnvrun" does not exist + mnv_snprintf((char *)newcmd, cmdlen, "%s %s %s %s %s", p_sh, p_shcf, p_sh, p_shcf, cmd); else #endif - vim_snprintf((char *)newcmd, cmdlen, "%s %s %s", + mnv_snprintf((char *)newcmd, cmdlen, "%s %s %s", p_sh, p_shcf, cmd); x = mch_system((char *)newcmd, options); - vim_free(newcmd); + mnv_free(newcmd); } } } @@ -5756,11 +5756,11 @@ mch_call_shell( settmode(TMODE_RAW); // set to raw mode } - // Print the return value, unless "vimrun" was used. + // Print the return value, unless "mnvrun" was used. if (x != 0 && !(options & SHELL_SILENT) && !emsg_silent #if defined(FEAT_GUI_MSWIN) && ((gui.in_use || gui.starting) ? - ((options & SHELL_DOOUT) || s_dont_use_vimrun || !p_stmp) : 1) + ((options & SHELL_DOOUT) || s_dont_use_mnvrun || !p_stmp) : 1) #endif ) { @@ -5800,13 +5800,13 @@ job_io_file_open( h = CreateFileW(wn, dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, NULL); - vim_free(wn); + mnv_free(wn); return h; } /* * Turn the dictionary "env" into a NUL separated list that can be used as the - * environment argument of vim_create_process(). + * environment argument of mnv_create_process(). */ void win32_build_env(dict_T *env, garray_T *gap, int is_terminal) @@ -5844,8 +5844,8 @@ win32_build_env(dict_T *env, garray_T *gap, int is_terminal) *((WCHAR*)gap->ga_data + gap->ga_len++) = wval[n]; *((WCHAR*)gap->ga_data + gap->ga_len++) = L'\0'; } - vim_free(wkey); - vim_free(wval); + mnv_free(wkey); + mnv_free(wval); } } } @@ -5871,15 +5871,15 @@ win32_build_env(dict_T *env, garray_T *gap, int is_terminal) # if defined(FEAT_CLIENTSERVER) || defined(FEAT_TERMINAL) { # ifdef FEAT_CLIENTSERVER - char_u *servername = get_vim_var_str(VV_SEND_SERVER); + char_u *servername = get_mnv_var_str(VV_SEND_SERVER); size_t servername_len = STRLEN(servername); # endif # ifdef FEAT_TERMINAL - char_u *version = get_vim_var_str(VV_VERSION); + char_u *version = get_mnv_var_str(VV_VERSION); size_t version_len = STRLEN(version); # endif - // size of "VIM_SERVERNAME=" and value, - // plus "VIM_TERMINAL=" and value, + // size of "MNV_SERVERNAME=" and value, + // plus "MNV_TERMINAL=" and value, // plus two terminating NULs size_t n = 0 # ifdef FEAT_CLIENTSERVER @@ -5895,7 +5895,7 @@ win32_build_env(dict_T *env, garray_T *gap, int is_terminal) # ifdef FEAT_CLIENTSERVER for (n = 0; n < 15; n++) *((WCHAR*)gap->ga_data + gap->ga_len++) = - (WCHAR)"VIM_SERVERNAME="[n]; + (WCHAR)"MNV_SERVERNAME="[n]; for (n = 0; n < servername_len; n++) *((WCHAR*)gap->ga_data + gap->ga_len++) = (WCHAR)servername[n]; @@ -5906,7 +5906,7 @@ win32_build_env(dict_T *env, garray_T *gap, int is_terminal) { for (n = 0; n < 13; n++) *((WCHAR*)gap->ga_data + gap->ga_len++) = - (WCHAR)"VIM_TERMINAL="[n]; + (WCHAR)"MNV_TERMINAL="[n]; for (n = 0; n < version_len; n++) *((WCHAR*)gap->ga_data + gap->ga_len++) = (WCHAR)version[n]; @@ -5929,7 +5929,7 @@ create_pipe_pair(HANDLE handles[2]) char name[64]; SECURITY_ATTRIBUTES sa; - sprintf(name, "\\\\?\\pipe\\vim-%08lx-%08lx", + sprintf(name, "\\\\?\\pipe\\mnv-%08lx-%08lx", GetCurrentProcessId(), InterlockedIncrement(&s)); @@ -6084,7 +6084,7 @@ mch_get_cmd_output_direct( hChildStdinRd = CreateFileW(winfile, GENERIC_READ, FILE_SHARE_READ, &saAttr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - vim_free(winfile); + mnv_free(winfile); } } @@ -6101,7 +6101,7 @@ mch_get_cmd_output_direct( ch_log(NULL, "directly executing: %s", (char *)cmd_ga.ga_data); // Create the child process directly, without going through the shell. - if (!vim_create_process((char *)cmd_ga.ga_data, TRUE, + if (!mnv_create_process((char *)cmd_ga.ga_data, TRUE, CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_PROCESS_GROUP, &si, &pi, NULL, NULL)) { @@ -6140,7 +6140,7 @@ mch_get_cmd_output_direct( CloseHandle(pi.hProcess); CloseHandle(pi.hThread); - set_vim_var_nr(VV_SHELL_ERROR, (long)exit_code); + set_mnv_var_nr(VV_SHELL_ERROR, (long)exit_code); if (out_ga.ga_len > 0) { @@ -6302,7 +6302,7 @@ mch_job_start(char *cmd, job_T *job, jobopt_T *options) goto failed; } - if (!vim_create_process(cmd, TRUE, + if (!mnv_create_process(cmd, TRUE, CREATE_SUSPENDED | CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_PROCESS_GROUP | @@ -6502,7 +6502,7 @@ mch_clear_job(job_T *job) #endif -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) /* * Start termcap mode @@ -6627,7 +6627,7 @@ termcap_mode_end(void) #endif -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) /* * clear `n' chars, starting from `coord' @@ -6818,7 +6818,7 @@ insert_lines(unsigned cLines) // Here we have to deal with a win32 console flake: If the scroll // region looks like abc and we scroll c to a and fill with d we get // cbd... if we scroll block c one line at a time to a, we get cdd... - // vim expects cdd consistently... So we have to deal with that + // mnv expects cdd consistently... So we have to deal with that // here... (this also occurs scrolling the same way in the other // direction). @@ -7099,7 +7099,7 @@ visual_bell(void) { WriteConsoleOutputAttribute(g_hConOut, oldattrs, Rows * Columns, coordOrigin, &dwDummy); - vim_free(oldattrs); + mnv_free(oldattrs); } } @@ -7152,7 +7152,7 @@ write_chars( unicodebuf, unibuflen); if (length && length <= unibuflen) break; - vim_free(unicodebuf); + mnv_free(unicodebuf); unicodebuf = length ? LALLOC_MULT(WCHAR, length) : NULL; unibuflen = unibuflen ? 0 : length; } while (TRUE); @@ -7348,7 +7348,7 @@ mch_write( { char_u *end = s + len; -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) return; # endif @@ -7703,7 +7703,7 @@ notsgr: # endif } -#else // FEAT_GUI_MSWIN && !VIMDLL +#else // FEAT_GUI_MSWIN && !MNVDLL void mch_write( char_u *s UNUSED, @@ -7723,10 +7723,10 @@ mch_delay( long msec, int flags UNUSED) { -#if defined(FEAT_GUI_MSWIN) && !defined(VIMDLL) +#if defined(FEAT_GUI_MSWIN) && !defined(MNVDLL) Sleep((int)msec); // never wait for input #else // Console -# ifdef VIMDLL +# ifdef MNVDLL if (gui.in_use) { Sleep((int)msec); // never wait for input @@ -7742,7 +7742,7 @@ mch_delay( // if msec is large enough, wait by portions in p_mzq while (msec > 0) { - mzvim_check_threads(); + mzmnv_check_threads(); if (msec < towait) towait = msec; Sleep(towait); @@ -7783,7 +7783,7 @@ mch_remove(char_u *name) return -1; n = DeleteFileW(wn) ? 0 : -1; - vim_free(wn); + mnv_free(wn); return n; } @@ -7794,8 +7794,8 @@ mch_remove(char_u *name) void mch_breakcheck(int force UNUSED) { -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) -# ifdef VIMDLL +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) +# ifdef MNVDLL if (!gui.in_use) # endif if (g_fCtrlCPressed || g_fCBrkPressed) @@ -7811,7 +7811,7 @@ mch_breakcheck(int force UNUSED) #define WINNT_RESERVE_BYTES (256*1024*1024) /* - * How much main memory in KiB that can be used by VIM. + * How much main memory in KiB that can be used by MNV. */ long_u mch_total_mem(int special UNUSED) @@ -7900,7 +7900,7 @@ mch_wrename(WCHAR *wold, WCHAR *wnew) *p = NUL; // Get (and create) a unique temporary file name in directory of new file - if (GetTempFileNameW(szNewPath, L"VIM", 0, szTempFile) == 0) + if (GetTempFileNameW(szNewPath, L"MNV", 0, szTempFile) == 0) return -2; // blow the temp file away @@ -7963,8 +7963,8 @@ mch_rename( wnew = enc_to_utf16((char_u *)pszNewFile, NULL); if (wold != NULL && wnew != NULL) retval = mch_wrename(wold, wnew); - vim_free(wold); - vim_free(wnew); + mnv_free(wold); + mnv_free(wnew); return retval; } @@ -8023,7 +8023,7 @@ mch_access(char *n, int p) // directories on read-only network shares. However, in // directories whose ACL allows writes but denies deletes will end // up keeping the temporary file :-(. - if (!GetTempFileNameW(wn, L"VIM", 0, TempNameW)) + if (!GetTempFileNameW(wn, L"MNV", 0, TempNameW)) goto getout; else DeleteFileW(TempNameW); @@ -8048,7 +8048,7 @@ mch_access(char *n, int p) retval = 0; // success getout: - vim_free(wn); + mnv_free(wn); return retval; } @@ -8066,7 +8066,7 @@ mch_open(const char *name, int flags, int mode) return -1; f = _wopen(wn, flags, mode); - vim_free(wn); + mnv_free(wn); return f; } @@ -8095,8 +8095,8 @@ mch_fopen(const char *name, const char *mode) wm = enc_to_utf16((char_u *)mode, NULL); if (wn != NULL && wm != NULL) f = _wfopen(wn, wm); - vim_free(wn); - vim_free(wm); + mnv_free(wn); + mnv_free(wm); #if defined(DEBUG) && _MSC_VER >= 1400 _set_fmode(oldMode); @@ -8246,8 +8246,8 @@ copy_infostreams(char_u *from, char_u *to) CloseHandle(sh); } } - vim_free(fromw); - vim_free(tow); + mnv_free(fromw); + mnv_free(tow); } /* @@ -8402,7 +8402,7 @@ copy_extattr(char_u *from, char_u *to) if (pNtQueryEaFile(h, &iosb, ea, eainfo.EaSize, FALSE, NULL, 0, NULL, TRUE) != STATUS_SUCCESS) { - VIM_CLEAR(ea); + MNV_CLEAR(ea); } } } @@ -8422,11 +8422,11 @@ copy_extattr(char_u *from, char_u *to) } theend: - vim_free(fromf); - vim_free(tof); - vim_free(fromw); - vim_free(tow); - vim_free(ea); + mnv_free(fromf); + mnv_free(tof); + mnv_free(fromw); + mnv_free(tow); + mnv_free(ea); } /* @@ -8619,7 +8619,7 @@ fix_arg_enc(void) r = concat_fnames(str, gettail(alist_name(&GARGLIST[0])), TRUE); if (r != NULL) { - vim_free(str); + mnv_free(str); str = r; } } @@ -8647,11 +8647,11 @@ fix_arg_enc(void) // Now expand wildcards in the arguments. // Temporarily add '(' and ')' to 'isfname'. These are valid // filename characters but are excluded from 'isfname' to make - // "gf" work on a file name in parentheses (e.g.: see vim.h). + // "gf" work on a file name in parentheses (e.g.: see mnv.h). // Also, unset wildignore to not be influenced by this option. // The arguments specified in command-line should be kept even if // encoding options were changed. - // Use :legacy so that it also works when in Vim9 script. + // Use :legacy so that it also works when in MNV9 script. do_cmdline_cmd((char_u *)":legacy let g:SaVe_ISF = &isf|set isf+=(,)"); do_cmdline_cmd((char_u *)":legacy let g:SaVe_WIG = &wig|set wig="); alist_expand(fnum_list, used_alist_count); @@ -8667,7 +8667,7 @@ fix_arg_enc(void) { do_cmdline_cmd((char_u *)":rewind"); if (GARGCOUNT == 1 && used_file_full_path - && vim_chdirfile(alist_name(&GARGLIST[0]), "drop") == OK) + && mnv_chdirfile(alist_name(&GARGLIST[0]), "drop") == OK) last_chdir_reason = "drop"; } @@ -8688,7 +8688,7 @@ mch_setenv(char *var, char *value, int x UNUSED) p = enc_to_utf16(envbuf, NULL); - vim_free(envbuf); + mnv_free(envbuf); if (p == NULL) return -1; _wputenv(p); @@ -8696,7 +8696,7 @@ mch_setenv(char *var, char *value, int x UNUSED) libintl_wputenv(p); #endif // Unlike Un*x systems, we can free the string for _wputenv(). - vim_free(p); + mnv_free(p); return 0; } @@ -8750,11 +8750,11 @@ mch_setenv(char *var, char *value, int x UNUSED) static void vtp_flag_init(void) { -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) DWORD mode; HANDLE out; -# ifdef VIMDLL +# ifdef MNVDLL if (!gui.in_use) # endif { @@ -8769,7 +8769,7 @@ vtp_flag_init(void) // VTP uses alternate screen buffer. // But, not if running in a nested terminal use_alternate_screen_buffer = win_version >= MAKE_VER(10, 0, 19045) - && p_rs && vtp_working && !mch_getenv("VIM_TERMINAL"); + && p_rs && vtp_working && !mch_getenv("MNV_TERMINAL"); } #endif @@ -8791,7 +8791,7 @@ vtp_flag_init(void) conpty_fix_type = 1; } -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) static void vtp_init(void) @@ -8838,7 +8838,7 @@ vtp_printf( return 0; va_start(list, format); - len = vim_vsnprintf((char *)buf, 100, (char *)format, list); + len = mnv_vsnprintf((char *)buf, 100, (char *)format, list); va_end(list); WriteConsoleA(g_hConOut, buf, (DWORD)len, &result, NULL); return (int)result; @@ -9209,7 +9209,7 @@ get_conpty_fix_type(void) return conpty_fix_type; } -#if !defined(FEAT_GUI_MSWIN) || defined(VIMDLL) +#if !defined(FEAT_GUI_MSWIN) || defined(MNVDLL) void resize_console_buf(void) { @@ -9256,7 +9256,7 @@ GetWin32Error(void) // clean oldmsg if remained. if (oldmsg != NULL) { - vim_free(oldmsg); + mnv_free(oldmsg); oldmsg = NULL; } diff --git a/uvim/src/os_win32.h b/uvim/src/os_win32.h index 6f395eede7..e556b21f07 100644 --- a/uvim/src/os_win32.h +++ b/uvim/src/os_win32.h @@ -1,9 +1,9 @@ /* vi:set ts=8 sts=4 sw=4 noet: * - * VIM - Vi IMproved by Bram Moolenaar + * MNV - MNV is not Vim by Bram Moolenaar * - * Do ":help uganda" in Vim to read copying and usage conditions. - * Do ":help credits" in Vim to see a list of people who contributed. + * Do ":help uganda" in MNV to read copying and usage conditions. + * Do ":help credits" in MNV to see a list of people who contributed. */ /* @@ -14,7 +14,7 @@ #include // for _mkdir() #define BINARY_FILE_IO -#define USE_EXE_NAME // use argv[0] for $VIM +#define USE_EXE_NAME // use argv[0] for $MNV #define USE_TERM_CONSOLE #ifndef HAVE_STRING_H # define HAVE_STRING_H @@ -59,7 +59,7 @@ #define HAVE_PUTENV // at least Bcc 5.2 and MSC have it -#if defined(FEAT_GUI_MSWIN) && !defined(VIMDLL) +#if defined(FEAT_GUI_MSWIN) && !defined(MNVDLL) # define NO_CONSOLE // don't include console-only code #endif @@ -116,7 +116,7 @@ typedef void (*sighandler_T)(int, int); #endif #ifndef DFLT_MAXMEMTOT -# define DFLT_MAXMEMTOT (5*1024) // use up to 5 Mbyte for Vim +# define DFLT_MAXMEMTOT (5*1024) // use up to 5 Mbyte for MNV #endif /* @@ -223,7 +223,7 @@ Trace(char *pszFormat, ...); # define HAVE_SETENV #endif #define mch_getenv(x) (char_u *)getenv((char *)(x)) -#define vim_mkdir(x, y) mch_mkdir(x) +#define mnv_mkdir(x, y) mch_mkdir(x) // Windows Version #define MAKE_VER(major, minor, build) \ diff --git a/uvim/src/osdef.sh b/uvim/src/osdef.sh index ead1aeff32..efc3fdfa3f 100755 --- a/uvim/src/osdef.sh +++ b/uvim/src/osdef.sh @@ -84,7 +84,7 @@ rm osdef0.c osdef0.cc osdef0.ccc osdef11.sed osdef21.sed osdef2.sed if test -f core*; then file core* echo " Sorry, your sed is broken. Call the system administrator." - echo " Meanwhile, you may try to compile Vim with an empty osdef.h file." + echo " Meanwhile, you may try to compile MNV with an empty osdef.h file." echo " If you compiler complains about missing prototypes, move the needed" echo " ones from osdef1.h.in and osdef2.h.in to osdef.h." exit 1 diff --git a/uvim/src/osdef1.h.in b/uvim/src/osdef1.h.in index e8204b0a6c..7e46951b8b 100644 --- a/uvim/src/osdef1.h.in +++ b/uvim/src/osdef1.h.in @@ -4,10 +4,10 @@ * can clean out the forest. Everything else belongs in os_unix.h * * How this works: - * - This file contains all unix prototypes that Vim might need. + * - This file contains all unix prototypes that MNV might need. * - The shell script osdef.sh is executed at compile time to remove all the * prototypes that are in an include file. This results in osdef.h. - * - osdef.h is included in vim.h. + * - osdef.h is included in mnv.h. * * sed cannot always handle so many commands, this is file 1 of 2 */ diff --git a/uvim/src/pathdef.sh b/uvim/src/pathdef.sh index b2a83a0172..c801069da8 100755 --- a/uvim/src/pathdef.sh +++ b/uvim/src/pathdef.sh @@ -8,4 +8,4 @@ if test -s auto/link.sed; then rm -f auto/pathdef.tmp fi -# vim:set sw=2 et: +# mnv:set sw=2 et: diff --git a/uvim/src/po/Make_all.mak b/uvim/src/po/Make_all.mak index 6d03846d66..b649b677fa 100644 --- a/uvim/src/po/Make_all.mak +++ b/uvim/src/po/Make_all.mak @@ -192,12 +192,12 @@ CHECKFILES = \ zh_TW.UTF-8.ck \ zh_TW.ck \ -PO_VIM_INPUTLIST = \ - ../../runtime/optwin.vim \ - ../../runtime/autoload/typeset.vim \ - ../../runtime/defaults.vim +PO_MNV_INPUTLIST = \ + ../../runtime/optwin.mnv \ + ../../runtime/autoload/typeset.mnv \ + ../../runtime/defaults.mnv -PO_VIM_JSLIST = \ +PO_MNV_JSLIST = \ optwin.js \ typeset.js \ defaults.js diff --git a/uvim/src/po/Make_cyg.mak b/uvim/src/po/Make_cyg.mak index d4d8eb8ee0..31b9d010b9 100644 --- a/uvim/src/po/Make_cyg.mak +++ b/uvim/src/po/Make_cyg.mak @@ -1,4 +1,4 @@ -# Makefile for the Vim message translations for Cygwin +# Makefile for the MNV message translations for Cygwin # by Tony Mechelynck # after Make_ming.mak by # Eduardo F. Amatria @@ -8,15 +8,15 @@ # Use at your own risk but with care, it could even kill your canary. # -ifndef VIMRUNTIME -VIMRUNTIME = ../../runtime +ifndef MNVRUNTIME +MNVRUNTIME = ../../runtime endif # get LANGUAGES, MOFILES and MOCONVERTED include Make_all.mak -PACKAGE = vim -VIMPROG = ../vim +PACKAGE = mnv +MNVPROG = ../mnv # Uncomment one of the lines below or modify it to put the path to your # gettext binaries @@ -55,27 +55,27 @@ all: $(MOFILES) $(MOCONVERTED) PO_INPUTLIST = \ $(wildcard ../*.c) \ ../if_perl.xs \ - ../GvimExt/gvimext.cpp \ + ../GmnvExt/gmnvext.cpp \ ../errors.h \ ../globals.h \ ../if_py_both.h \ - ../vim.h \ - gvim.desktop.in \ - vim.desktop.in + ../mnv.h \ + gmnv.desktop.in \ + mnv.desktop.in -first_time: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST) - $(VIMPROG) -u NONE --not-a-term -S tojavascript.vim $(LANGUAGE).pot $(PO_VIM_INPUTLIST) +first_time: $(PO_INPUTLIST) $(PO_MNV_INPUTLIST) + $(MNVPROG) -u NONE --not-a-term -S tojavascript.mnv $(LANGUAGE).pot $(PO_MNV_INPUTLIST) $(XGETTEXT) --default-domain=$(LANGUAGE) \ - --add-comments $(XGETTEXT_KEYWORDS) $(PO_INPUTLIST) $(PO_VIM_JSLIST) - $(VIMPROG) -u NONE --not-a-term -S fixfilenames.vim $(LANGUAGE).pot $(PO_VIM_INPUTLIST) + --add-comments $(XGETTEXT_KEYWORDS) $(PO_INPUTLIST) $(PO_MNV_JSLIST) + $(MNVPROG) -u NONE --not-a-term -S fixfilenames.mnv $(LANGUAGE).pot $(PO_MNV_INPUTLIST) $(RM) *.js -$(PACKAGE).pot: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST) - $(VIMPROG) -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST) +$(PACKAGE).pot: $(PO_INPUTLIST) $(PO_MNV_INPUTLIST) + $(MNVPROG) -u NONE --not-a-term -S tojavascript.mnv $(PACKAGE).pot $(PO_MNV_INPUTLIST) $(XGETTEXT) --default-domain=$(PACKAGE) \ - --add-comments $(XGETTEXT_KEYWORDS) $(PO_INPUTLIST) $(PO_VIM_JSLIST) + --add-comments $(XGETTEXT_KEYWORDS) $(PO_INPUTLIST) $(PO_MNV_JSLIST) $(MV) $(PACKAGE).po $(PACKAGE).pot - $(VIMPROG) -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST) + $(MNVPROG) -u NONE --not-a-term -S fixfilenames.mnv $(PACKAGE).pot $(PO_MNV_INPUTLIST) $(RM) *.js # Don't add a dependency here, we only want to update the .po files manually @@ -88,8 +88,8 @@ $(LANGUAGES): install: $(MOFILES) $(MOCONVERTED) for TARGET in $(LANGUAGES); do \ - $(MKD) $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES ; \ - $(CP) $$TARGET.mo $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES/$(PACKAGE).mo ; \ + $(MKD) $(MNVRUNTIME)/lang/$$TARGET/LC_MESSAGES ; \ + $(CP) $$TARGET.mo $(MNVRUNTIME)/lang/$$TARGET/LC_MESSAGES/$(PACKAGE).mo ; \ done install-all: install diff --git a/uvim/src/po/Make_ming.mak b/uvim/src/po/Make_ming.mak index fb62827214..04b24d96a2 100644 --- a/uvim/src/po/Make_ming.mak +++ b/uvim/src/po/Make_ming.mak @@ -1,4 +1,4 @@ -# Makefile for the Vim message translations for mingw32 +# Makefile for the MNV message translations for mingw32 # # Eduardo F. Amatria # @@ -10,22 +10,22 @@ # language (xx) and add it to the next three lines. # -ifndef VIMRUNTIME +ifndef MNVRUNTIME ifeq (sh.exe, $(SHELL)) -VIMRUNTIME = ..\..\runtime +MNVRUNTIME = ..\..\runtime else -VIMRUNTIME = ../../runtime +MNVRUNTIME = ../../runtime endif endif # get LANGUAGES, MOFILES, MOCONVERTED and others include Make_all.mak -PACKAGE = vim +PACKAGE = mnv ifeq (sh.exe, $(SHELL)) -VIMPROG = ..\vim +MNVPROG = ..\mnv else -VIMPROG = ../vim +MNVPROG = ../mnv endif # Uncomment one of the lines below or modify it to put the path to your @@ -68,27 +68,27 @@ all: $(MOFILES) $(MOCONVERTED) PO_INPUTLIST = \ $(wildcard ../*.c) \ ../if_perl.xs \ - ../GvimExt/gvimext.cpp \ + ../GmnvExt/gmnvext.cpp \ ../errors.h \ ../globals.h \ ../if_py_both.h \ - ../vim.h \ - gvim.desktop.in \ - vim.desktop.in + ../mnv.h \ + gmnv.desktop.in \ + mnv.desktop.in -first_time: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST) - $(VIMPROG) -u NONE --not-a-term -S tojavascript.vim $(LANGUAGE).pot $(PO_VIM_INPUTLIST) +first_time: $(PO_INPUTLIST) $(PO_MNV_INPUTLIST) + $(MNVPROG) -u NONE --not-a-term -S tojavascript.mnv $(LANGUAGE).pot $(PO_MNV_INPUTLIST) $(XGETTEXT) --default-domain=$(LANGUAGE) \ - --add-comments $(XGETTEXT_KEYWORDS) $(PO_INPUTLIST) $(PO_VIM_JSLIST) - $(VIMPROG) -u NONE --not-a-term -S fixfilenames.vim $(LANGUAGE).pot $(PO_VIM_INPUTLIST) + --add-comments $(XGETTEXT_KEYWORDS) $(PO_INPUTLIST) $(PO_MNV_JSLIST) + $(MNVPROG) -u NONE --not-a-term -S fixfilenames.mnv $(LANGUAGE).pot $(PO_MNV_INPUTLIST) $(RM) *.js -$(PACKAGE).pot: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST) - $(VIMPROG) -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST) +$(PACKAGE).pot: $(PO_INPUTLIST) $(PO_MNV_INPUTLIST) + $(MNVPROG) -u NONE --not-a-term -S tojavascript.mnv $(PACKAGE).pot $(PO_MNV_INPUTLIST) $(XGETTEXT) --default-domain=$(PACKAGE) \ - --add-comments $(XGETTEXT_KEYWORDS) $(PO_INPUTLIST) $(PO_VIM_JSLIST) + --add-comments $(XGETTEXT_KEYWORDS) $(PO_INPUTLIST) $(PO_MNV_JSLIST) $(MV) $(PACKAGE).po $(PACKAGE).pot - $(VIMPROG) -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot $(PO_VIM_INPUTLIST) + $(MNVPROG) -u NONE --not-a-term -S fixfilenames.mnv $(PACKAGE).pot $(PO_MNV_INPUTLIST) $(RM) *.js # Don't add a dependency here, we only want to update the .po files manually @@ -100,20 +100,20 @@ $(LANGUAGES): $(RM) $@.po.old install: - $(MKD) $(VIMRUNTIME)\lang\$(LANGUAGE) - $(MKD) $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES - $(CP) $(LANGUAGE).mo $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES\$(PACKAGE).mo + $(MKD) $(MNVRUNTIME)\lang\$(LANGUAGE) + $(MKD) $(MNVRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES + $(CP) $(LANGUAGE).mo $(MNVRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES\$(PACKAGE).mo ifeq (sh.exe, $(SHELL)) install-all: all - FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(VIMRUNTIME)\lang\%%l $(MKD) $(VIMRUNTIME)\lang\%%l - FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(VIMRUNTIME)\lang\%%l\LC_MESSAGES $(MKD) $(VIMRUNTIME)\lang\%%l\LC_MESSAGES - FOR %%l IN ($(LANGUAGES)) DO @$(CP) %%l.mo $(VIMRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo + FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(MNVRUNTIME)\lang\%%l $(MKD) $(MNVRUNTIME)\lang\%%l + FOR %%l IN ($(LANGUAGES)) DO @IF NOT EXIST $(MNVRUNTIME)\lang\%%l\LC_MESSAGES $(MKD) $(MNVRUNTIME)\lang\%%l\LC_MESSAGES + FOR %%l IN ($(LANGUAGES)) DO @$(CP) %%l.mo $(MNVRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo else install-all: all for TARGET in $(LANGUAGES); do \ - $(MKD) $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES ; \ - $(CP) $$TARGET.mo $(VIMRUNTIME)/lang/$$TARGET/LC_MESSAGES/$(PACKAGE).mo ; \ + $(MKD) $(MNVRUNTIME)/lang/$$TARGET/LC_MESSAGES ; \ + $(CP) $$TARGET.mo $(MNVRUNTIME)/lang/$$TARGET/LC_MESSAGES/$(PACKAGE).mo ; \ done endif diff --git a/uvim/src/po/Make_mvc.mak b/uvim/src/po/Make_mvc.mak index 026e37433f..ea5e1335e4 100644 --- a/uvim/src/po/Make_mvc.mak +++ b/uvim/src/po/Make_mvc.mak @@ -1,4 +1,4 @@ -# Makefile for the Vim message translations for MSVC +# Makefile for the MNV message translations for MSVC # (based on make_ming.mak) # # Mike Williams, @@ -29,14 +29,14 @@ # Get LANGUAGES, MOFILES, MOCONVERTED and others. !INCLUDE .\Make_all.mak -!IFNDEF VIMRUNTIME -VIMRUNTIME = ..\..\runtime +!IFNDEF MNVRUNTIME +MNVRUNTIME = ..\..\runtime !ENDIF -# Correct the following line for the where executable file vim is +# Correct the following line for the where executable file mnv is # installed. Please do not put the path in quotes. -!IFNDEF VIMPROG -VIMPROG = ..\vim.exe +!IFNDEF MNVPROG +MNVPROG = ..\mnv.exe !ENDIF # Correct the following line for the directory where gettext et al is @@ -45,8 +45,8 @@ VIMPROG = ..\vim.exe GETTEXT_PATH = D:\Programs\GetText\bin !ENDIF -INSTALLDIR = $(VIMRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES -PACKAGE = vim +INSTALLDIR = $(MNVRUNTIME)\lang\$(LANGUAGE)\LC_MESSAGES +PACKAGE = mnv # Starting from version 0.22, msgfmt forcibly converts text to UTF-8 regardless # of the value of the "charset" field. @@ -87,8 +87,8 @@ originals : $(MOFILES) converted: $(MOCONVERTED) .po.ck: - "$(VIMPROG)" -u NONE --noplugins -e -s --cmd "set enc=utf-8" \ - -S check.vim \ + "$(MNVPROG)" -u NONE --noplugins -e -s --cmd "set enc=utf-8" \ + -S check.mnv \ -c "if error == 0 | q | else | num 2 | cq | endif" $< @ < .\files first_time: files - "$(VIMPROG)" -u NONE --not-a-term -S tojavascript.vim $(LANGUAGE).po \ - $(PO_VIM_INPUTLIST) - @ $(CP) /B .\files+.\vim_to_js .\allfiles + "$(MNVPROG)" -u NONE --not-a-term -S tojavascript.mnv $(LANGUAGE).po \ + $(PO_MNV_INPUTLIST) + @ $(CP) /B .\files+.\mnv_to_js .\allfiles set OLD_PO_FILE_INPUT=yes set OLD_PO_FILE_OUTPUT=yes $(XGETTEXT) --default-domain=$(LANGUAGE) --add-comments \ $(XGETTEXT_KEYWORDS) --files-from=.\allfiles \ - --copyright-holder="$(Year), The Vim Project" \ - --package-name=Vim --msgid-bugs-address="vim-dev@vim.org" - "$(VIMPROG)" -u NONE --not-a-term -S fixfilenames.vim $(LANGUAGE).po \ - $(PO_VIM_INPUTLIST) - $(RM) *.js .\vim_to_js + --copyright-holder="$(Year), The MNV Project" \ + --package-name=MNV --msgid-bugs-address="mnv-dev@mnv.org" + "$(MNVPROG)" -u NONE --not-a-term -S fixfilenames.mnv $(LANGUAGE).po \ + $(PO_MNV_INPUTLIST) + $(RM) *.js .\mnv_to_js @ $(MAKE) -lf Make_mvc.mak clean $(PACKAGE).pot: files - "$(VIMPROG)" -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot \ - $(PO_VIM_INPUTLIST) - @ $(CP) /B .\files+.\vim_to_js .\allfiles + "$(MNVPROG)" -u NONE --not-a-term -S tojavascript.mnv $(PACKAGE).pot \ + $(PO_MNV_INPUTLIST) + @ $(CP) /B .\files+.\mnv_to_js .\allfiles set OLD_PO_FILE_INPUT=yes set OLD_PO_FILE_OUTPUT=yes $(XGETTEXT) --default-domain=$(PACKAGE) --output=$(PACKAGE).pot \ --add-comments $(XGETTEXT_KEYWORDS) --files-from=.\allfiles \ - --no-location --copyright-holder="$(Year), The Vim Project" \ - --package-name=Vim --msgid-bugs-address="vim-dev@vim.org" - "$(VIMPROG)" -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot \ - $(PO_VIM_INPUTLIST) - $(RM) *.js .\vim_to_js + --no-location --copyright-holder="$(Year), The MNV Project" \ + --package-name=MNV --msgid-bugs-address="mnv-dev@mnv.org" + "$(MNVPROG)" -u NONE --not-a-term -S fixfilenames.mnv $(PACKAGE).pot \ + $(PO_MNV_INPUTLIST) + $(RM) *.js .\mnv_to_js @ $(MAKE) -lf Make_mvc.mak clean # Only original translations with default encoding should be updated. @@ -443,16 +443,16 @@ install: $(LANGUAGE).mo install-all: all for %%l in ($(LANGUAGES)) do \ - @if not exist "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES" \ - $(MKD) "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES" + @if not exist "$(MNVRUNTIME)\lang\%%l\LC_MESSAGES" \ + $(MKD) "$(MNVRUNTIME)\lang\%%l\LC_MESSAGES" for %%l in ($(LANGUAGES)) do @$(CP) %%l.mo \ - "$(VIMRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo" + "$(MNVRUNTIME)\lang\%%l\LC_MESSAGES\$(PACKAGE).mo" cleanup-po: $(LANGUAGE).po - @ "$(VIMPROG)" -u NONE -e -s -S cleanup.vim -c wq $(LANGUAGE).po + @ "$(MNVPROG)" -u NONE -e -s -S cleanup.mnv -c wq $(LANGUAGE).po cleanup-po-all: $(POFILES) - !@ "$(VIMPROG)" -u NONE -e -s -S cleanup.vim -c wq $** + !@ "$(MNVPROG)" -u NONE -e -s -S cleanup.mnv -c wq $** ####### # For translations of plug-ins @@ -461,15 +461,15 @@ cleanup-po-all: $(POFILES) # Preparing the POT file of the plug-in package POT_PLUGPACKAGE_PATH = $(MAKEDIR) $(PLUGPACKAGE).pot : $(PO_PLUG_INPUTLIST) - "$(VIMPROG)" -u NONE --not-a-term -S tojavascript.vim \ + "$(MNVPROG)" -u NONE --not-a-term -S tojavascript.mnv \ $(PLUGPACKAGE).pot $** $(XGETTEXT) --from-code=UTF-8 --default-domain=$(PLUGPACKAGE) \ --package-name=$(PLUGPACKAGE) \ --output-dir="$(POT_PLUGPACKAGE_PATH)" \ - --output=$(PLUGPACKAGE).pot --files-from=.\vim_to_js - "$(VIMPROG)" -u NONE --not-a-term -S fixfilenames.vim \ + --output=$(PLUGPACKAGE).pot --files-from=.\mnv_to_js + "$(MNVPROG)" -u NONE --not-a-term -S fixfilenames.mnv \ "$(POT_PLUGPACKAGE_PATH)\$(PLUGPACKAGE).pot" $** - $(RM) *.js .\vim_to_js + $(RM) *.js .\mnv_to_js # Converting the PO file of the plug-in package to the binary format of the MO file MO_PLUGPACKAGE_PATH = $(MAKEDIR) @@ -485,4 +485,4 @@ clean: checkclean # - $(RM) *.pot # - $(RM) big5corr.obj big5corr.exe -# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=79 ft=make: +# mnv: set noet sw=8 ts=8 sts=0 wm=0 tw=79 ft=make: diff --git a/uvim/src/po/Makefile b/uvim/src/po/Makefile index e63abd0ef0..ff915bded7 100644 --- a/uvim/src/po/Makefile +++ b/uvim/src/po/Makefile @@ -1,4 +1,4 @@ -# Makefile for the Vim message translations. +# Makefile for the MNV message translations. # Include stuff found by configure. include ../auto/config.mk @@ -9,9 +9,9 @@ include Make_all.mak # Note: ja.sjis, *.cp1250 and zh_CN.cp936 are only for MS-Windows, they are # not installed on Unix. -PACKAGE = vim +PACKAGE = mnv SHELL = /bin/sh -VIMPROG = ../vim +MNVPROG = ../mnv # MacOS sed is locale aware, set $LANG to avoid problems. SED = LANG=C sed @@ -40,8 +40,8 @@ converted: $(MOCONVERTED) $(MSGFMTCMD) -o $@ $< .po.ck: - $(VIMPROG) -u NONE --noplugins -e -s -X --cmd "set enc=utf-8" \ - -S check.vim -c "if error == 0 | q | else | num 2 | cq | endif" \ + $(MNVPROG) -u NONE --noplugins -e -s -X --cmd "set enc=utf-8" \ + -S check.mnv -c "if error == 0 | q | else | num 2 | cq | endif" \ $< touch $@ @@ -180,9 +180,9 @@ zh_TW.po: zh_TW.UTF-8.po # # 06.11.23, added by Restorer # For more details, see: -# https://github.com/vim/vim/pull/3261 -# https://github.com/vim/vim/pull/3476 -# https://github.com/vim/vim/pull/12153 +# https://github.com/Project-Tick/Project-Tick/pull/3261 +# https://github.com/Project-Tick/Project-Tick/pull/3476 +# https://github.com/Project-Tick/Project-Tick/pull/12153 # (read all comments) # # I checked the workability on the list of backslash characters @@ -236,7 +236,7 @@ prefixcheck: clean: checkclean - rm -f core core.* *.old.po *.mo sjiscorr - - rm -f LINGUAS vim.desktop gvim.desktop tmp_*desktop + - rm -f LINGUAS mnv.desktop gmnv.desktop tmp_*desktop - rm -f ./allfiles # - rm -f big5corr @@ -248,50 +248,50 @@ checkclean: PO_INPUTLIST = \ ../*.c \ ../if_perl.xs \ - ../GvimExt/gvimext.cpp \ + ../GmnvExt/gmnvext.cpp \ ../errors.h \ ../globals.h \ ../if_py_both.h \ - ../vim.h \ - gvim.desktop.in \ - vim.desktop.in - -$(PACKAGE).pot: $(PO_INPUTLIST) $(PO_VIM_INPUTLIST) - # Convert the Vim scripts to (what looks like) Javascript. - $(VIMPROG) -u NONE --not-a-term -S tojavascript.vim $(PACKAGE).pot \ - $(PO_VIM_INPUTLIST) + ../mnv.h \ + gmnv.desktop.in \ + mnv.desktop.in + +$(PACKAGE).pot: $(PO_INPUTLIST) $(PO_MNV_INPUTLIST) + # Convert the MNV scripts to (what looks like) Javascript. + $(MNVPROG) -u NONE --not-a-term -S tojavascript.mnv $(PACKAGE).pot \ + $(PO_MNV_INPUTLIST) @ echo ${PO_INPUTLIST} | tr ' ' '\n' > ./allfiles - @ cat ./vim_to_js >> ./allfiles - # Create vim.pot. + @ cat ./mnv_to_js >> ./allfiles + # Create mnv.pot. $(XGETTEXT) --default-domain=$(PACKAGE) --output=$(PACKAGE).pot \ --add-comments $(XGETTEXT_KEYWORDS) --files-from=./allfiles \ - --no-location --copyright-holder="$$(date +%Y), The Vim Project" \ - --package-name=Vim --msgid-bugs-address="vim-dev@vim.org" - # Fix Vim scripts names, so that "gf" works. - $(VIMPROG) -u NONE --not-a-term -S fixfilenames.vim $(PACKAGE).pot \ - $(PO_VIM_INPUTLIST) + --no-location --copyright-holder="$$(date +%Y), The MNV Project" \ + --package-name=MNV --msgid-bugs-address="mnv-dev@mnv.org" + # Fix MNV scripts names, so that "gf" works. + $(MNVPROG) -u NONE --not-a-term -S fixfilenames.mnv $(PACKAGE).pot \ + $(PO_MNV_INPUTLIST) # Delete the temporary files. - rm -f *.js ./vim_to_js allfiles + rm -f *.js ./mnv_to_js allfiles -vim.desktop: vim.desktop.in $(POFILES) +mnv.desktop: mnv.desktop.in $(POFILES) echo $(LANGUAGES) | tr " " "\n" |$(SED) -e '/[.]/d' | sort > LINGUAS - $(MSGFMT) --desktop -d . --template vim.desktop.in -o tmp_vim.desktop + $(MSGFMT) --desktop -d . --template mnv.desktop.in -o tmp_mnv.desktop rm -f LINGUAS if command -v desktop-file-validate; \ - then desktop-file-validate tmp_vim.desktop; fi - mv tmp_vim.desktop vim.desktop - cp vim.desktop ../../runtime/ + then desktop-file-validate tmp_mnv.desktop; fi + mv tmp_mnv.desktop mnv.desktop + cp mnv.desktop ../../runtime/ -# The dependency on vim.desktop is only to avoid the two targets are build at +# The dependency on mnv.desktop is only to avoid the two targets are build at # the same time, which causes a race for the LINGUAS file. -gvim.desktop: gvim.desktop.in $(POFILES) vim.desktop +gmnv.desktop: gmnv.desktop.in $(POFILES) mnv.desktop echo $(LANGUAGES) | tr " " "\n" |$(SED) -e '/[.]/d' | sort > LINGUAS - $(MSGFMT) --desktop -d . --template gvim.desktop.in -o tmp_gvim.desktop + $(MSGFMT) --desktop -d . --template gmnv.desktop.in -o tmp_gmnv.desktop rm -f LINGUAS if command -v desktop-file-validate; \ - then desktop-file-validate tmp_gvim.desktop; fi - mv tmp_gvim.desktop gvim.desktop - cp gvim.desktop ../../runtime/ + then desktop-file-validate tmp_gmnv.desktop; fi + mv tmp_gmnv.desktop gmnv.desktop + cp gmnv.desktop ../../runtime/ # Only original translations with default encoding should be updated. # The files that are converted to a different encoding clearly state "DO NOT EDIT". @@ -316,19 +316,19 @@ $(LANGUAGES): # Preparing the POT file of the plug-in package POT_PLUGPACKAGE_PATH = $(PWD) $(PLUGPACKAGE).pot: $(PO_PLUG_INPUTLIST) - $(VIMPROG) -u NONE --not-a-term -S tojavascript.vim \ + $(MNVPROG) -u NONE --not-a-term -S tojavascript.mnv \ $(PLUGPACKAGE).pot $? $(XGETTEXT) --from-code=UTF-8 --default-domain=$(PLUGPACKAGE) \ --package-name=$(PLUGPACKAGE) \ --output-dir=$(POT_PLUGPACKAGE_PATH) \ - --output=$(PLUGPACKAGE).pot --files-from=./vim_to_js - $(VIMPROG) -u NONE --not-a-term -S fixfilenames.vim \ + --output=$(PLUGPACKAGE).pot --files-from=./mnv_to_js + $(MNVPROG) -u NONE --not-a-term -S fixfilenames.mnv \ $(POT_PLUGPACKAGE_PATH)/$(PLUGPACKAGE).pot $? - rm -f *.js ./vim_to_js + rm -f *.js ./mnv_to_js # Converting the PO file of the plug-in package to the binary format of the MO MO_PLUGPACKAGE_PATH = $(PWD) $(PLUGPACKAGE).mo: $(PO_PLUGPACKAGE) $(MSGFMTCMD) -o $(MO_PLUGPACKAGE_PATH)/$@ $? -# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0 ft=make: +# mnv: set noet sw=8 ts=8 sts=0 wm=0 tw=0 ft=make: diff --git a/uvim/src/po/README.txt b/uvim/src/po/README.txt index 580400743e..283b9ab3cd 100644 --- a/uvim/src/po/README.txt +++ b/uvim/src/po/README.txt @@ -1,7 +1,7 @@ -TRANSLATING VIM MESSAGES +TRANSLATING MNV MESSAGES In this directory you will find xx.po files, where "xx" is a language code. -Each file contains the translation of English Vim messages for one language. +Each file contains the translation of English MNV messages for one language. The files are in "po" format, used by the gettext package. Please refer to the gettext documentation for more information. @@ -14,14 +14,14 @@ encoding. The GNU gettext library, starting with version 0.10.36, uses a new format for some encodings. This follows the C99 standard for strings. It means that when a multi-byte character includes the 0x5c byte, this is not recognized as -a backslash. Since this format is incompatible with Solaris, Vim uses the old +a backslash. Since this format is incompatible with Solaris, MNV uses the old format. This is done by setting the OLD_PO_FILE_OUTPUT and OLD_PO_FILE_INPUT environment variables. When you use the Makefile in this directory that will be done for you. This does NOT work with gettext 0.10.36. Don't use it, get 0.10.37. Have a look at these helper scripts, they may be useful for you: -https://github.com/adaext/vim-menutrans-helper +https://github.com/adaext/mnv-menutrans-helper ON MS-WINDOWS @@ -35,9 +35,9 @@ or You might have to do the commands manually. Example: - cd c:\vim\vim91 + cd c:\mnv\mnv91 mkdir runtime\lang\ja\LC_MESSAGES - msgfmt -o runtime\lang\ja\LC_MESSAGES\vim.mo src\po\ja.po + msgfmt -o runtime\lang\ja\LC_MESSAGES\mnv.mo src\po\ja.po WHEN THERE IS A MISTAKE @@ -45,7 +45,7 @@ WHEN THERE IS A MISTAKE If you find there is a mistake in one of the translations, please report this to the maintainer of the translation. His/her e-mail address is in the comments at the start of the file. You can also see this with the ":messages" -command in Vim when the translation is being used. +command in MNV when the translation is being used. CREATING A NEW PO FILE @@ -57,14 +57,14 @@ language. POFILES and xx.ck to CHECKFILES. - If the encoding of the translation text differs from the default UTF-8, add a corresponding entry in MOCONVERTED, specifying the required encoding. -- If you haven't done so already, run ./configure in the top vim directory +- If you haven't done so already, run ./configure in the top mnv directory (i.e. go up two directories) and then come back here afterwards. - Execute these commands: - % make vim.pot + % make mnv.pot % msginit -l xx - % rm vim.pot - The first command will generate a vim.pot file which is used by msginit to - generate a correct xx.po file. After that vim.pot is not needed. + % rm mnv.pot + The first command will generate a mnv.pot file which is used by msginit to + generate a correct xx.po file. After that mnv.pot is not needed. - The remaining work is like updating, see the next section. @@ -74,11 +74,11 @@ If you are the maintainer of a .po file, this is how you update the file. We will use "xx.po" as an example here, replace "xx" with the name of your language. -(1) Add new and changed messages from the Vim sources: +(1) Add new and changed messages from the MNV sources: make xx - This will extract all the strings from Vim and merge them in with the + This will extract all the strings from MNV and merge them in with the existing translations. Requires the GNU gettext utilities. Your original xx.po file will be copied to xx.po.orig @@ -95,9 +95,9 @@ language. Remove the "#, fuzzy" line after adding the translation. There is one special message: - msgid "Messages maintainer: The Vim Project" + msgid "Messages maintainer: The MNV Project" You should include your name and E-mail address instead, for example: - msgstr "Berichten übersetzt bei: John Doe " + msgstr "Berichten �bersetzt bei: John Doe " (3) Remove unused messages (optional) Remove messages that have been marked as obsolete. @@ -110,9 +110,9 @@ language. Comment-out all non-translated strings. There are two types: - items marked with "#, fuzzy" - items with an empty msgstr - You can do this with the cleanup.vim script: + You can do this with the cleanup.mnv script: - :source cleanup.vim + :source cleanup.mnv Background: on Solaris an empty msgstr results in an empty message; GNU gettext ignores empty strings and items marked with "#, fuzzy". @@ -124,20 +124,20 @@ language. (5) Check: While editing the .po file: - :source check.vim + :source check.mnv From the command line: - vim -S check.vim xx.po + mnv -S check.mnv xx.po make xx.mo Look out for syntax errors and fix them. (6) Local tryout: - Vim normally picks up the .mo files from: - $VIMRUNTIME/lang/{lang}/LC_MESSAGES/vim.mo - To try out the messages with Vim use: + MNV normally picks up the .mo files from: + $MNVRUNTIME/lang/{lang}/LC_MESSAGES/mnv.mo + To try out the messages with MNV use: make tryoutinstall - And run Vim with $VIMRUNTIME set to ../runtime + And run MNV with $MNVRUNTIME set to ../runtime USING GETTEXT WITHOUT ICONV @@ -162,16 +162,16 @@ convert ja.po to EUC-JP (supposed as your system encoding): There are examples in the Makefile for the conversions already supported. -TRANSLATION OF VIM THE EDITOR PLUG-INS +TRANSLATION OF MNV THE EDITOR PLUG-INS -Vim supports displaying plugin messages for various native languages. -Translation is available both for plugins that are supplied as part of the Vim -editor (e.g. "optwin.vim") and for third-party plugin packages. +MNV supports displaying plugin messages for various native languages. +Translation is available both for plugins that are supplied as part of the MNV +editor (e.g. "optwin.mnv") and for third-party plugin packages. -To translate the plugins supplied with the Vim editor, you must specify a +To translate the plugins supplied with the MNV editor, you must specify a gettext() function call for the strings you want to translate. The translation of these strings will be retrieved by gettext() from the MO -file "vim.mo". +file "mnv.mo". For third-party plugins, it is necessary to specify a one-time call to the bindtextdomain() function in scripts containing translation strings and for diff --git a/uvim/src/po/README_mingw.txt b/uvim/src/po/README_mingw.txt index a7e3259dca..66a17cf9b2 100644 --- a/uvim/src/po/README_mingw.txt +++ b/uvim/src/po/README_mingw.txt @@ -1,4 +1,4 @@ -TRANSLATING VIM MESSAGES +TRANSLATING MNV MESSAGES This file explains how to create and maintain po files using gnu-gettext.win32, a MINGW32 Windows port of gettext by Franco Bez @@ -29,8 +29,8 @@ If you don't have a xx.po file, you must create it with the command: make -f Make_ming.mak first_time -This will produce a new brand xx.po file with all the messages in Vim ready -for translation. Then you must source the cleanup.vim script from inside Vim; +This will produce a new brand xx.po file with all the messages in MNV ready +for translation. Then you must source the cleanup.mnv script from inside MNV; it will comment the untranslated messages (now, all). I recommend to use syntax highlighting so you can identify the untranslated messages easily. You also must remove the '..\' that prepends the name of the source files. @@ -42,11 +42,11 @@ Then you must go step (2) below. If you are updating a po file you must follow the next steps (they are nearly the same as in the Unix case, only the commands change): -(1) Add new and changed messages from the Vim sources: +(1) Add new and changed messages from the MNV sources: make -f Make_ming.mak xx - This will extract all the strings from Vim and merge them in with the + This will extract all the strings from MNV and merge them in with the existing translations. Requires the GNU gettext utilities. Also requires unpacking the extra archive. Your original xx.po file will be copied to xx.po.orig @@ -61,33 +61,33 @@ the same as in the Unix case, only the commands change): Remove "#~" and "#, fuzzy" after adding the translation. There is one special message: - msgid "Messages maintainer: The Vim Project" + msgid "Messages maintainer: The MNV Project" You should include your name and e-mail address instead, for example: - msgstr "Berichten übersetzt bei: John Doe " + msgstr "Berichten �bersetzt bei: John Doe " (3) Clean up This is very important to make sure the translation works on all systems. Comment-out all non-translated strings. There are two types: - items marked with "#, fuzzy" - items with an empty msgstr - You can do this with the cleanup.vim script: + You can do this with the cleanup.mnv script: - :source cleanup.vim + :source cleanup.mnv (4) Check: - vim -S check.vim xx.po + mnv -S check.mnv xx.po make -f Make_ming.mak xx.mo Look out for syntax errors and fix them. -(5) This is an extra step, ;-). If you want the vim.mo file installed in your +(5) This is an extra step, ;-). If you want the mnv.mo file installed in your system you must run: make -f Make_ming.mak install This will create the xx\LC_MESSAGES directory (if it does not exist) and - will copy vim.po to it. + will copy mnv.po to it. You can also use the following command to install all languages: make -f Make_ming.mak install-all @@ -102,6 +102,6 @@ Suggestions will be welcomed. Eduardo F. Amatria -Happy Vimming with NLS!! +Happy MNVming with NLS!! -vim:tw=78: +mnv:tw=78: diff --git a/uvim/src/po/README_mvc.txt b/uvim/src/po/README_mvc.txt index e5fd85e2ec..2116b36d30 100644 --- a/uvim/src/po/README_mvc.txt +++ b/uvim/src/po/README_mvc.txt @@ -1,4 +1,4 @@ -TRANSLATING VIM MESSAGES +TRANSLATING MNV MESSAGES This file explains how to create and maintain po files using a number of GnuWin packages. You will need gettext, libiconv and libexpat. As of @@ -21,13 +21,13 @@ iconv 1.16 for Windows on his site: https://mlocati.github.io/articles/gettext-iconv-windows.html First read the README.txt file in this directory for general remarks on -translating Vim messages. +translating MNV messages. SETUP Set the environment variable LANGUAGE to the language code for the language -you are translating Vim messages to. Language codes are typically two +you are translating MNV messages to. Language codes are typically two characters and you can find a list of them at: https://www.loc.gov/standards/iso639-2/php/code_list.php @@ -72,22 +72,22 @@ To create the initial .po file for your language you must use the command: Note: You need to be in the po directory when using this makefile. -Once you have your new .po file load it into Vim and source cleanup.vim, this +Once you have your new .po file load it into MNV and source cleanup.mnv, this will convert untranslated messages to comments. If you have syntax highlighting turned on then untranslated messages will stand out more easily. You will also need to edit the file names in the comments in the .po file. You need to remove the absolute directory specification (which has the form -c:\vim91\src\). You can do this in Vim with the following command with the -appropriate directory specification for where you have installed the Vim +c:\mnv91\src\). You can do this in MNV with the following command with the +appropriate directory specification for where you have installed the MNV source: - %s/c:\\vim91\\src\\//g + %s/c:\\mnv91\\src\\//g UPDATING A TRANSLATION -If there are new or changed messages in Vim that need translating, then the +If there are new or changed messages in MNV that need translating, then the first thing to do is merge them into the existing translations. This is done with the following command: @@ -104,7 +104,7 @@ need it. See README.txt for specific instructions. Once you have finished translating the messages you should make sure all non-translated strings are commented out. This can be done by sourcing -cleanup.vim once again. +cleanup.mnv once again. CHECKING THE TRANSLATION @@ -138,16 +138,16 @@ command: nmake.exe -f Make_mvc.mak clean -TRANSLATION OF VIM THE EDITOR PLUG-INS +TRANSLATION OF MNV THE EDITOR PLUG-INS -Vim supports displaying plugin messages for various native languages. -Translation is available both for plugins that are supplied as part of the Vim -editor (e.g. "optwin.vim") and for third-party plugin packages. +MNV supports displaying plugin messages for various native languages. +Translation is available both for plugins that are supplied as part of the MNV +editor (e.g. "optwin.mnv") and for third-party plugin packages. -To translate the plugins supplied with the Vim editor, you must specify a +To translate the plugins supplied with the MNV editor, you must specify a gettext() function call for the strings you want to translate. The translation of these strings will be retrieved by gettext() from the MO -file "vim.mo". +file "mnv.mo". For third-party plugins, it is necessary to specify a one-time call to the bindtextdomain() function in scripts containing translation strings and for @@ -155,4 +155,4 @@ all message strings to add a {package} argument to the gettext() function. For more information, see ":help package-translation". -vim:tw=78: +mnv:tw=78: diff --git a/uvim/src/po/af.po b/uvim/src/po/af.po index 5ad9f47523..19e59c0b0c 100644 --- a/uvim/src/po/af.po +++ b/uvim/src/po/af.po @@ -1,6 +1,6 @@ -# Afrikaans translation for Vim -# Do ":help uganda" in Vim to read copying and usage conditions. -# Do ":help credits" in Vim to see a list of people who contributed. +# Afrikaans translation for MNV +# Do ":help uganda" in MNV to read copying and usage conditions. +# Do ":help credits" in MNV to see a list of people who contributed. # Danie Roux , 2001 # Edited: Jean Jordaan (njj) , 10/01/2001 # Edited by Danie on the 31st of October 2001 @@ -9,12 +9,12 @@ # # njj: Save == Stoor. Write == Skryf. # njj: "deleted" == "geskrap"; "remove" == "verwyder" -# njj: "source" == "uitvoer", want "sourced" lêers word uitgevoer +# njj: "source" == "uitvoer", want "sourced" l�ers word uitgevoer # njj: "abort" == "staak" # close == sluit # Onseker: # X Display - vertoonskerm? (njj: ek dink dis reg.) -# open vim in another GTK Widget - het vertaal as element (njj: OK, maar +# open mnv in another GTK Widget - het vertaal as element (njj: OK, maar # 'n element is algemener as 'n widget: mens kry byvoorbeeld HTML # en XML elemente. Maar ek kan nie nou aan 'n spesifieker woord dink # nie.) @@ -25,7 +25,7 @@ # socket - WEET NIE msgid "" msgstr "" -"Project-Id-Version: Vim 8.2\n" +"Project-Id-Version: MNV 8.2\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-05-11 01:36+1000\n" "PO-Revision-Date: Wed May 11 11:42:18 UTC 2022\n" @@ -92,10 +92,10 @@ msgstr[0] "%d buffer geskrap" msgstr[1] "%d buffers geskrap" msgid "W14: Warning: List of file names overflow" -msgstr "W14: Waarskuwing: Lêerlys loop oor" +msgstr "W14: Waarskuwing: L�erlys loop oor" msgid "line %ld" -msgstr "reël %ld" +msgstr "re�l %ld" msgid " [Modified]" msgstr " [Gewysig]" @@ -114,11 +114,11 @@ msgstr "[lees alleen]" msgid "%ld line --%d%%--" msgid_plural "%ld lines --%d%%--" -msgstr[0] "%ld reël --%d%%--" -msgstr[1] "%ld reëls --%d%%--" +msgstr[0] "%ld re�l --%d%%--" +msgstr[1] "%ld re�ls --%d%%--" msgid "line %ld of %ld --%d%%-- col " -msgstr "reël %ld van %ld --%d%%-- kolom " +msgstr "re�l %ld van %ld --%d%%-- kolom " msgid "[No Name]" msgstr "[Geen Naam]" @@ -142,7 +142,7 @@ msgid "Top" msgstr "Bo" msgid "WARNING: The file has been changed since reading it!!!" -msgstr "WAARSKUWING: Die lêer het verander sedert dit gelees is!!!" +msgstr "WAARSKUWING: Die l�er het verander sedert dit gelees is!!!" msgid "Do you really want to write to it" msgstr "Wil jy regtig soontoe skryf?" @@ -151,13 +151,13 @@ msgid "[New]" msgstr "[Nuut]" msgid "[New File]" -msgstr "[Nuwe lêer]" +msgstr "[Nuwe l�er]" msgid " CONVERSION ERROR" msgstr " OMSETTINGSFOUT" msgid " in line %ld;" -msgstr " in reël %ld;" +msgstr " in re�l %ld;" msgid "[NOT converted]" msgstr "[NIE omgesit nie]" @@ -185,13 +185,13 @@ msgid "" "WARNING: Original file may be lost or damaged\n" msgstr "" "\n" -"WAARSKUWING: Oorspronklike lêer mag verlore of beskadig wees\n" +"WAARSKUWING: Oorspronklike l�er mag verlore of beskadig wees\n" msgid "don't quit the editor until the file is successfully written!" -msgstr "moenie die verwerker verlaat voor die lêer suksesvol geskryf is nie!" +msgstr "moenie die verwerker verlaat voor die l�er suksesvol geskryf is nie!" msgid "W10: Warning: Changing a readonly file" -msgstr "W10: Waarskuwing: Jy wysig aan 'n leesalleen lêer" +msgstr "W10: Waarskuwing: Jy wysig aan 'n leesalleen l�er" msgid "No display" msgstr "Geen vertoonskerm" @@ -203,7 +203,7 @@ msgid ": Send failed. Trying to execute locally\n" msgstr ": Stuur het gefaal. Probeer om lokaal uit te voer\n" msgid "%d of %d edited" -msgstr "%d van %d lêers bewerk" +msgstr "%d van %d l�ers bewerk" msgid "No display: Send expression failed.\n" msgstr "Geen vertoonskerm: Stuur van uitdrukking het gefaal.\n" @@ -212,13 +212,13 @@ msgid ": Send expression failed.\n" msgstr ": Stuur van uitdrukking het gefaal.\n" msgid "Used CUT_BUFFER0 instead of empty selection" -msgstr "'CUT_BUFFER0' is gebruik in plaas van leë seleksie" +msgstr "'CUT_BUFFER0' is gebruik in plaas van le� seleksie" msgid "tagname" msgstr "etiketnaam" msgid " kind file\n" -msgstr " tipe lêer\n" +msgstr " tipe l�er\n" msgid "'history' option is zero" msgstr "'history' opsie is nul" @@ -239,22 +239,22 @@ msgid "Entering Debug mode. Type \"cont\" to continue." msgstr "Ontfoutmodus begin nou. Tik \"cont\" om te verlaat." msgid "line %ld: %s" -msgstr "reël %ld: %s" +msgstr "re�l %ld: %s" msgid "cmd: %s" msgstr "cmd: %s" msgid "Breakpoint in \"%s%s\" line %ld" -msgstr "Inspeksiepunt in \"%s%s\" reël %ld" +msgstr "Inspeksiepunt in \"%s%s\" re�l %ld" msgid "No breakpoints defined" msgstr "Geen inspeksiepunte gedefinieer nie" msgid "%3d %s %s line %ld" -msgstr "%3d %s %s reël %ld" +msgstr "%3d %s %s re�l %ld" msgid "Patch file" -msgstr "Laslap lêer" +msgstr "Laslap l�er" msgid "Hebrew" msgstr "Hebreeus" @@ -293,11 +293,11 @@ msgstr "> %d, Hex %08x, Oktaal %o" msgid "%ld line moved" msgid_plural "%ld lines moved" -msgstr[0] "%ld reël geskuif" -msgstr[1] "%ld reëls geskuif" +msgstr[0] "%ld re�l geskuif" +msgstr[1] "%ld re�ls geskuif" msgid "%ld lines filtered" -msgstr "%ld reëls filtreer" +msgstr "%ld re�ls filtreer" msgid "[No write since last change]\n" msgstr "[Ongestoor sedert vorige verandering]\n" @@ -306,10 +306,10 @@ msgid "Save As" msgstr "Stoor As" msgid "Write partial file?" -msgstr "Skryf gedeeltelike lêer?" +msgstr "Skryf gedeeltelike l�er?" msgid "Overwrite existing file \"%s\"?" -msgstr "Oorskryf bestaande lêer \"%s\"?" +msgstr "Oorskryf bestaande l�er \"%s\"?" msgid "" "'readonly' option is set for \"%s\".\n" @@ -319,7 +319,7 @@ msgstr "" "Wil jy dit forseer?" msgid "Edit File" -msgstr "Verander lêer" +msgstr "Verander l�er" msgid "replace with %s (y/n/a/q/l/^E/^Y)?" msgstr "vervang met %s (y/n/a/q/l/^E/^Y)?" @@ -328,7 +328,7 @@ msgid "(Interrupted) " msgstr "(Onderbreek) " msgid "Pattern found in every line: %s" -msgstr "Patroon gevind in elke reël: %s" +msgstr "Patroon gevind in elke re�l: %s" msgid "Pattern not found: %s" msgstr "Patroon nie gevind nie: %s" @@ -343,7 +343,7 @@ msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." msgstr "Betree Ex modus. Tik \"visual\" om na Normale modus terug te keer." msgid "End of sourced file" -msgstr "Einde van uitvoerlêer" +msgstr "Einde van uitvoerl�er" msgid "End of function" msgstr "Einde van funksie " @@ -353,23 +353,23 @@ msgstr "Terugwaardse omvang gegee, OK om te ruil" msgid "%d more file to edit. Quit anyway?" msgid_plural "%d more files to edit. Quit anyway?" -msgstr[0] "Nog %d lêer om te bewerk. Stop in elk geval?" -msgstr[1] "Nog %d lêers om te bewerk. Stop in elk geval?" +msgstr[0] "Nog %d l�er om te bewerk. Stop in elk geval?" +msgstr[1] "Nog %d l�ers om te bewerk. Stop in elk geval?" msgid "unknown" msgstr "onbekend" -msgid "Greetings, Vim user!" -msgstr "Goeiedag, Vim gebruiker!" +msgid "Greetings, MNV user!" +msgstr "Goeiedag, MNV gebruiker!" msgid "Edit File in new window" -msgstr "Bewerk lêer in nuwe venster" +msgstr "Bewerk l�er in nuwe venster" msgid "No swap file" -msgstr "Geen ruillêer" +msgstr "Geen ruill�er" msgid "Append File" -msgstr "Las aan by lêer" +msgstr "Las aan by l�er" msgid "Window position: X %d, Y %d" msgstr "Vensterposisie: X %d, Y %d" @@ -390,7 +390,7 @@ msgid "Exception discarded: %s" msgstr "Uitsondering weg gegooi: %s" msgid "%s, line %ld" -msgstr "%s, reël %ld" +msgstr "%s, re�l %ld" msgid "Exception caught: %s" msgstr "Uitsondering gevang: %s" @@ -417,22 +417,22 @@ msgid "Interrupt" msgstr "Onderbreek" msgid "[Command Line]" -msgstr "[Bevelreël]" +msgstr "[Bevelre�l]" msgid "is a directory" msgstr "is 'n gids" msgid "Illegal file name" -msgstr "Ongeldige lêernaam" +msgstr "Ongeldige l�ernaam" msgid "is not a file" -msgstr "is nie 'n lêer nie" +msgstr "is nie 'n l�er nie" msgid "[Permission Denied]" msgstr "[Toestemming Geweier]" -msgid "Vim: Reading from stdin...\n" -msgstr "Vim: Lees nou vanaf 'stdin'...\n" +msgid "MNV: Reading from stdin...\n" +msgstr "MNV: Lees nou vanaf 'stdin'...\n" msgid "Reading from stdin..." msgstr "Lees nou vanaf stdin... " @@ -447,19 +447,19 @@ msgid "[CR missing]" msgstr "[CR ontbreek]" msgid "[long lines split]" -msgstr "[lang reëls verdeel]" +msgstr "[lang re�ls verdeel]" msgid "[CONVERSION ERROR in line %ld]" -msgstr "[OMSETTINGSFOUT in reël %ld]" +msgstr "[OMSETTINGSFOUT in re�l %ld]" msgid "[ILLEGAL BYTE in line %ld]" -msgstr "[ONWETTIGE GREEP in reël %ld]" +msgstr "[ONWETTIGE GREEP in re�l %ld]" msgid "[READ ERRORS]" msgstr "[LEESFOUTE]" msgid "Can't find temp file for conversion" -msgstr "Kan nie tydelike lêer vir omsetting vind nie" +msgstr "Kan nie tydelike l�er vir omsetting vind nie" msgid "Conversion with 'charconvert' failed" msgstr "Omsetting met 'charconvert' het gefaal" @@ -487,8 +487,8 @@ msgstr "[unix formaat]" msgid "%ld line, " msgid_plural "%ld lines, " -msgstr[0] "%ld reël, " -msgstr[1] "%ld reëls, " +msgstr[0] "%ld re�l, " +msgstr[1] "%ld re�ls, " msgid "%lld byte" msgid_plural "%lld bytes" @@ -499,53 +499,53 @@ msgid "[noeol]" msgstr "[noeol]" msgid "[Incomplete last line]" -msgstr "[Onvoltooide laaste reël]" +msgstr "[Onvoltooide laaste re�l]" msgid "" -"W12: Warning: File \"%s\" has changed and the buffer was changed in Vim as " +"W12: Warning: File \"%s\" has changed and the buffer was changed in MNV as " "well" msgstr "" -"W12: Waarskuwing: Lêer \"%s\" het verander sedert bewerking begin het en die " -"buffer in Vim het ook verander" +"W12: Waarskuwing: L�er \"%s\" het verander sedert bewerking begin het en die " +"buffer in MNV het ook verander" msgid "W11: Warning: File \"%s\" has changed since editing started" -msgstr "W11: Waarskuwing: Lêer \"%s\" het verander sedert bewerking begin het" +msgstr "W11: Waarskuwing: L�er \"%s\" het verander sedert bewerking begin het" msgid "See \":help W11\" for more info." msgstr "Sien \":help W11\" vir meer inligting." msgid "W16: Warning: Mode of file \"%s\" has changed since editing started" msgstr "" -"W16: Waarskuwing: Modus van lêer \"%s\" het verander sedert bewerking begin " +"W16: Waarskuwing: Modus van l�er \"%s\" het verander sedert bewerking begin " "het" msgid "See \":help W16\" for more info." msgstr "Sien \":help W16\" vir meer inligting." msgid "W13: Warning: File \"%s\" has been created after editing started" -msgstr "W13: Waarskuwing: Lêer \"%s\" is geskep sedert bewerking begin het" +msgstr "W13: Waarskuwing: L�er \"%s\" is geskep sedert bewerking begin het" msgid "Warning" msgstr "Waarskuwing" msgid "Save File dialog" -msgstr "Stoor Lêer dialooghokkie" +msgstr "Stoor L�er dialooghokkie" msgid "Open File dialog" -msgstr "Maak lêer oop dialooghokkie" +msgstr "Maak l�er oop dialooghokkie" msgid "no matches" msgstr "geen treffers" msgid "+--%3ld line folded " msgid_plural "+--%3ld lines folded " -msgstr[0] "+--%3ld reël gevou " -msgstr[1] "+--%3ld reëls gevou " +msgstr[0] "+--%3ld re�l gevou " +msgstr[1] "+--%3ld re�ls gevou " msgid "+-%s%3ld line: " msgid_plural "+-%s%3ld lines: " -msgstr[0] "+-%s%3ld reël: " -msgstr[1] "+-%s%3ld reëls: " +msgstr[0] "+-%s%3ld re�l: " +msgstr[1] "+-%s%3ld re�ls: " msgid "" "&Yes\n" @@ -571,11 +571,11 @@ msgstr "Kanselleer" msgid "Input _Methods" msgstr "Invoer _Metodes" -msgid "VIM - Search and Replace..." -msgstr "VIM - Soek en Vervang..." +msgid "MNV - Search and Replace..." +msgstr "MNV - Soek en Vervang..." -msgid "VIM - Search..." -msgstr "VIM - Soek..." +msgid "MNV - Search..." +msgstr "MNV - Soek..." msgid "Find what:" msgstr "Soek na:" @@ -607,11 +607,11 @@ msgstr "Vervang" msgid "Replace All" msgstr "Vervang alles" -msgid "Vim: Received \"die\" request from session manager\n" -msgstr "Vim: Het die \"die\" opdrag ontvang van sessiebestuurder\n" +msgid "MNV: Received \"die\" request from session manager\n" +msgstr "MNV: Het die \"die\" opdrag ontvang van sessiebestuurder\n" -msgid "Vim: Main window unexpectedly destroyed\n" -msgstr "Vim: Hoofvenster onverwags verwoes\n" +msgid "MNV: Main window unexpectedly destroyed\n" +msgstr "MNV: Hoofvenster onverwags verwoes\n" msgid "Directories" msgstr "Gidse" @@ -623,7 +623,7 @@ msgid "&Help" msgstr "&Hulp" msgid "Files" -msgstr "Lêers" +msgstr "L�ers" msgid "&OK" msgstr "&OK" @@ -631,8 +631,8 @@ msgstr "&OK" msgid "Selection" msgstr "Seleksie" -msgid "Vim dialog" -msgstr "Vim dialooghokkie" +msgid "MNV dialog" +msgstr "MNV dialooghokkie" msgid "Font0: %s" msgstr "Font0: %s" @@ -641,7 +641,7 @@ msgid "Font%d: %s" msgstr "Font%d: %s" msgid "Font%d width is not twice that of font0" -msgstr "Font%d wydte is nie twee keer díe van font0 nie" +msgstr "Font%d wydte is nie twee keer d�e van font0 nie" msgid "Font0 width: %d" msgstr "Font0 wydte: %d" @@ -680,7 +680,7 @@ msgid "Print job sent." msgstr "Druktaak gestuur." msgid "Sorry, help file \"%s\" not found" -msgstr "Jammer, hulplêer \"%s\" kan nie gevind word nie" +msgstr "Jammer, hulpl�er \"%s\" kan nie gevind word nie" msgid "W18: Invalid character in group name" msgstr "W18: Ongeldige karakter groepnaam" @@ -736,10 +736,10 @@ msgid "" " # line" msgstr "" "\n" -" # reël" +" # re�l" msgid "filename / context / line\n" -msgstr "lêernaam / konteks / reël\n" +msgstr "l�ernaam / konteks / re�l\n" msgid "All cscope databases reset" msgstr "Alle 'cscope' databasisse herstel" @@ -764,37 +764,37 @@ msgid "unknown option" msgstr "onbekende opsie" msgid "cannot delete line" -msgstr "kan reël nie verwyder nie" +msgstr "kan re�l nie verwyder nie" msgid "cannot replace line" -msgstr "kan reël nie vervang nie" +msgstr "kan re�l nie vervang nie" msgid "cannot insert line" -msgstr "kan reël nie byvoeg nie" +msgstr "kan re�l nie byvoeg nie" msgid "string cannot contain newlines" msgstr "string kan nie 'newlines' bevat nie" -msgid "Vim error: ~a" -msgstr "vim fout: ~a" +msgid "MNV error: ~a" +msgstr "mnv fout: ~a" -msgid "Vim error" -msgstr "vim fout" +msgid "MNV error" +msgstr "mnv fout" msgid "linenr out of range" msgstr "linenr buite omvang" -msgid "not allowed in the Vim sandbox" -msgstr "nie toegelaat in die Vim sandput nie" +msgid "not allowed in the MNV sandbox" +msgstr "nie toegelaat in die MNV sandput nie" msgid "invalid buffer number" msgstr "ongeldige buffernommer" msgid "not implemented yet" -msgstr "nog nie geïmplementeer nie" +msgstr "nog nie ge�mplementeer nie" msgid "cannot set line(s)" -msgstr "kan nie reël(s) stel nie" +msgstr "kan nie re�l(s) stel nie" msgid "invalid mark name" msgstr "onbekende merknaam" @@ -806,16 +806,16 @@ msgid "row %d column %d" msgstr "ry %d kolom %d" msgid "cannot insert/append line" -msgstr "kan nie reël invoeg/aanlas nie" +msgstr "kan nie re�l invoeg/aanlas nie" msgid "line number out of range" -msgstr "reëlnommer buite omvang" +msgstr "re�lnommer buite omvang" msgid "unknown flag: " msgstr "onbekende vlag: " -msgid "unknown vimOption" -msgstr "onbekende 'vimOption'" +msgid "unknown mnvOption" +msgstr "onbekende 'mnvOption'" msgid "keyboard interrupt" msgstr "sleutelbordonderbreking" @@ -833,18 +833,18 @@ msgstr "" "kan terugroepbevel nie registreer nie: buffer/vensterverwysing nie gevind nie" msgid "cannot get line" -msgstr "kan nie reël kry nie" +msgstr "kan nie re�l kry nie" msgid "Unable to register a command server name" msgstr "Kon nie bevelbediener naam registreer nie" msgid "%ld lines to indent... " -msgstr "%ld reëls om in te keep..." +msgstr "%ld re�ls om in te keep..." msgid "%ld line indented " msgid_plural "%ld lines indented " -msgstr[0] "%ld reël ingekeep " -msgstr[1] "%ld reëls ingekeep " +msgstr[0] "%ld re�l ingekeep " +msgstr[1] "%ld re�ls ingekeep " msgid " Keyword completion (^N^P)" msgstr " Sleutelwoord voltooiing (^N^P)" @@ -853,10 +853,10 @@ msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " ^X modus (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgid " Whole line completion (^L^N^P)" -msgstr " Hele-reël voltooiing (^L^N^P)" +msgstr " Hele-re�l voltooiing (^L^N^P)" msgid " File name completion (^F^N^P)" -msgstr " Lêernaam voltooiing (^F^N^P)" +msgstr " L�ernaam voltooiing (^F^N^P)" msgid " Tag completion (^]^N^P)" msgstr " Etiketvoltooiing (^]^N^P)" @@ -874,7 +874,7 @@ msgid " Thesaurus completion (^T^N^P)" msgstr " Tesourusvoltooiing (^T^N^P)" msgid " Command-line completion (^V^N^P)" -msgstr " Bevelreëlvoltooiing (^V^N^P)" +msgstr " Bevelre�lvoltooiing (^V^N^P)" msgid " Keyword Local completion (^N^P)" msgstr " Sleutelwoord Lokale voltooiing (^N^P)" @@ -913,7 +913,7 @@ msgid "Back at original" msgstr "Terug by oorspronklike" msgid "Word from other line" -msgstr "Woord van ander reël" +msgstr "Woord van ander re�l" msgid "The only match" msgstr "Die enigste treffer" @@ -946,13 +946,13 @@ msgid "Invalid argument for" msgstr "Ongeldige parameter vir" msgid "%d files to edit\n" -msgstr "%d lêers om te bewerk\n" +msgstr "%d l�ers om te bewerk\n" -msgid "This Vim was not compiled with the diff feature." -msgstr "Hierdie Vim is nie gekompileer met 'diff' funksionaliteit nie." +msgid "This MNV was not compiled with the diff feature." +msgstr "Hierdie MNV is nie gekompileer met 'diff' funksionaliteit nie." msgid "Attempt to open script file again: \"" -msgstr "Probeer weer om skriplêer oop te maak: \"" +msgstr "Probeer weer om skripl�er oop te maak: \"" msgid "Cannot open for reading: \"" msgstr "Kan nie oopmaak om te lees nie: \"" @@ -960,33 +960,33 @@ msgstr "Kan nie oopmaak om te lees nie: \"" msgid "Cannot open for script output: \"" msgstr "Kan nie oopmaak vir skrip-afvoer nie: \"" -msgid "Vim: Warning: Output is not to a terminal\n" -msgstr "Vim: Waarskuwing: Afvoer gaan nie na 'n terminaal nie\n" +msgid "MNV: Warning: Output is not to a terminal\n" +msgstr "MNV: Waarskuwing: Afvoer gaan nie na 'n terminaal nie\n" -msgid "Vim: Warning: Input is not from a terminal\n" -msgstr "Vim: Waarskuwing: Invoer kom nie vanaf 'n terminaal nie\n" +msgid "MNV: Warning: Input is not from a terminal\n" +msgstr "MNV: Waarskuwing: Invoer kom nie vanaf 'n terminaal nie\n" -msgid "pre-vimrc command line" -msgstr "vóór-'vimrc' bevelreël" +msgid "pre-mnvrc command line" +msgstr "v��r-'mnvrc' bevelre�l" msgid "" "\n" -"More info with: \"vim -h\"\n" +"More info with: \"mnv -h\"\n" msgstr "" "\n" -"Meer inligting met: \"vim -h\"\n" +"Meer inligting met: \"mnv -h\"\n" msgid "[file ..] edit specified file(s)" -msgstr "[lêer ..] bewerk lêer(s)" +msgstr "[l�er ..] bewerk l�er(s)" msgid "- read text from stdin" msgstr "- lees teks uit 'stdin'" msgid "-t tag edit file where tag is defined" -msgstr "-t tag bewerk lêer waar etiket gedefinieer is" +msgstr "-t tag bewerk l�er waar etiket gedefinieer is" msgid "-q [errorfile] edit file with first error" -msgstr "-q [foutlêer] bewerk lêer met eerste fout" +msgstr "-q [foutl�er] bewerk l�er met eerste fout" msgid "" "\n" @@ -997,8 +997,8 @@ msgstr "" "\n" "Gebruik:" -msgid " vim [arguments] " -msgstr " vim [parameters] " +msgid " mnv [arguments] " +msgstr " mnv [parameters] " msgid "" "\n" @@ -1017,19 +1017,19 @@ msgstr "" "Parameters:\n" msgid "--\t\t\tOnly file names after this" -msgstr "--\t\t\tSlegs lêername hierna" +msgstr "--\t\t\tSlegs l�ername hierna" msgid "--literal\t\tDon't expand wildcards" msgstr "--literal\t\tMoet nie plekhouers uitbrei nie" -msgid "-register\t\tRegister this gvim for OLE" -msgstr "-register\t\tRegistreer hierdie gvim vir OLE" +msgid "-register\t\tRegister this gmnv for OLE" +msgstr "-register\t\tRegistreer hierdie gmnv vir OLE" -msgid "-unregister\t\tUnregister gvim for OLE" -msgstr "-unregister\t\tOnregistreer gvim vir OLE" +msgid "-unregister\t\tUnregister gmnv for OLE" +msgstr "-unregister\t\tOnregistreer gmnv vir OLE" -msgid "-g\t\t\tRun using GUI (like \"gvim\")" -msgstr "-g\t\t\tVoer uit met die GUI (soos \"gvim\")" +msgid "-g\t\t\tRun using GUI (like \"gmnv\")" +msgstr "-g\t\t\tVoer uit met die GUI (soos \"gmnv\")" msgid "-f or --nofork\tForeground: Don't fork when starting GUI" msgstr "-f of --nofork\tVoorgrond: Moenie vurk wanneer GUI begin nie" @@ -1043,26 +1043,26 @@ msgstr "-e\t\t\tEx modus (soos \"ex\")" msgid "-s\t\t\tSilent (batch) mode (only for \"ex\")" msgstr "-s\t\t\tStil (bondel) modus (slegs vir \"ex\")" -msgid "-d\t\t\tDiff mode (like \"vimdiff\")" -msgstr "-d\t\t\tDiff modus (soos \"vimdiff\")" +msgid "-d\t\t\tDiff mode (like \"mnvdiff\")" +msgstr "-d\t\t\tDiff modus (soos \"mnvdiff\")" -msgid "-y\t\t\tEasy mode (like \"evim\", modeless)" -msgstr "-y\t\t\tEasy modus (soos \"evim\", modusloos)" +msgid "-y\t\t\tEasy mode (like \"emnv\", modeless)" +msgstr "-y\t\t\tEasy modus (soos \"emnv\", modusloos)" msgid "-R\t\t\tReadonly mode (like \"view\")" msgstr "-R\t\t\tLeesalleen modus (soos \"view\")" -msgid "-Z\t\t\tRestricted mode (like \"rvim\")" -msgstr "-Z\t\t\tBeperkte modus (soos \"rvim\")" +msgid "-Z\t\t\tRestricted mode (like \"rmnv\")" +msgstr "-Z\t\t\tBeperkte modus (soos \"rmnv\")" msgid "-m\t\t\tModifications (writing files) not allowed" -msgstr "-m\t\t\tVeranderings (skryf van lêers) nie toegelaat nie" +msgstr "-m\t\t\tVeranderings (skryf van l�ers) nie toegelaat nie" msgid "-M\t\t\tModifications in text not allowed" msgstr "-M\t\t\tVeranderings aan teks nie toegelaat nie" msgid "-b\t\t\tBinary mode" -msgstr "-b\t\t\tBinêre modus" +msgstr "-b\t\t\tBin�re modus" msgid "-l\t\t\tLisp mode" msgstr "-l\t\t\tLisp modus" @@ -1077,13 +1077,13 @@ msgid "-D\t\t\tDebugging mode" msgstr "-D\t\t\tOntfoutmodus" msgid "-n\t\t\tNo swap file, use memory only" -msgstr "-n\t\t\tGeen ruillêer, gebruik slegs geheue" +msgstr "-n\t\t\tGeen ruill�er, gebruik slegs geheue" msgid "-r\t\t\tList swap files and exit" -msgstr "-r\t\t\tLys ruillêers en verlaat vim" +msgstr "-r\t\t\tLys ruill�ers en verlaat mnv" msgid "-r (with file name)\tRecover crashed session" -msgstr "-r (met lêer naam)\tHerwin ineengestorte sessie" +msgstr "-r (met l�er naam)\tHerwin ineengestorte sessie" msgid "-L\t\t\tSame as -r" msgstr "-L\t\t\tSelfde as -r" @@ -1103,90 +1103,90 @@ msgstr "-H\t\t\tBegin in Hebreeuse modus" msgid "-T \tSet terminal type to " msgstr "-T \tStel terminaaltipe na " -msgid "-u \t\tUse instead of any .vimrc" -msgstr "-u \t\tGebruik in plaas van enige ander .vimrc" +msgid "-u \t\tUse instead of any .mnvrc" +msgstr "-u \t\tGebruik in plaas van enige ander .mnvrc" -msgid "-U \t\tUse instead of any .gvimrc" -msgstr "-U \t\tGebruik in plaas van enige .gvimrc" +msgid "-U \t\tUse instead of any .gmnvrc" +msgstr "-U \t\tGebruik in plaas van enige .gmnvrc" msgid "--noplugin\t\tDon't load plugin scripts" msgstr "--noplugin\t\tMoet nie inpropskripte laai nie" msgid "-o[N]\t\tOpen N windows (default: one for each file)" -msgstr "-o[N]\t\tMaak N vensters oop (verstek: een vir elke lêer)" +msgstr "-o[N]\t\tMaak N vensters oop (verstek: een vir elke l�er)" msgid "-O[N]\t\tLike -o but split vertically" msgstr "-O[N]\t\tSoos -o maar verdeel vertikaal" msgid "+\t\t\tStart at end of file" -msgstr "+\t\t\tBegin by einde van lêer" +msgstr "+\t\t\tBegin by einde van l�er" msgid "+\t\tStart at line " -msgstr "+\t\tBegin by reël " +msgstr "+\t\tBegin by re�l " -msgid "--cmd \tExecute before loading any vimrc file" -msgstr "--cmd \tVoer uit voor enige .vimrc-lêer gelaai word" +msgid "--cmd \tExecute before loading any mnvrc file" +msgstr "--cmd \tVoer uit voor enige .mnvrc-l�er gelaai word" msgid "-c \t\tExecute after loading the first file" -msgstr "-c \t\tVoer uit na eerste lêer gelaai is" +msgstr "-c \t\tVoer uit na eerste l�er gelaai is" msgid "-S \t\tSource file after loading the first file" msgstr "" -"-S \t\tVoer bevele in lêer uit na eerste lêer gelaai is" +"-S \t\tVoer bevele in l�er uit na eerste l�er gelaai is" msgid "-s \tRead Normal mode commands from file " -msgstr "-s \t\tLees Normale-modus bevele van lêer " +msgstr "-s \t\tLees Normale-modus bevele van l�er " msgid "-w \tAppend all typed commands to file " -msgstr "-w \tLas alle getikte bevele aan by lêer " +msgstr "-w \tLas alle getikte bevele aan by l�er " msgid "-W \tWrite all typed commands to file " -msgstr "-W \tSkryf alle getikte bevele na lêer " +msgstr "-W \tSkryf alle getikte bevele na l�er " msgid "-x\t\t\tEdit encrypted files" -msgstr "-x\t\t\tBewerk geënkripteerde lêers" +msgstr "-x\t\t\tBewerk ge�nkripteerde l�ers" -msgid "-display \tConnect Vim to this particular X-server" -msgstr "-display \tKoppel Vim aan hierdie X-bediener" +msgid "-display \tConnect MNV to this particular X-server" +msgstr "-display \tKoppel MNV aan hierdie X-bediener" msgid "-X\t\t\tDo not connect to X server" msgstr "-X\t\t\tMoet nie verbinding met X-bediener maak nie" -msgid "--remote \tEdit in a Vim server if possible" -msgstr "--remote \tWysig die in a Vim bediener indien moontlik" +msgid "--remote \tEdit in a MNV server if possible" +msgstr "--remote \tWysig die iMNV MNV bediener indien moontlik" msgid "--remote-silent Same, don't complain if there is no server" msgstr "" -"--remote-silent Dieselfde, moet nie kla as daar nie so 'n bediener " +"--remote-silent Dieselfde, moet nie kla as daar nie so 'n bediener " "is nie" msgid "" "--remote-wait As --remote but wait for files to have been edited" msgstr "" -"--remote-wait Soos '--remote', maar wag vir lêers om gewysig te word" +"--remote-wait Soos '--remote', maar wag vir l�ers om gewysig te word" msgid "" "--remote-wait-silent Same, don't complain if there is no server" msgstr "" -"--remote-wait-silent Dieselfde, moet nie kla as daar nie so 'n " +"--remote-wait-silent Dieselfde, moet nie kla as daar nie so 'n " "bediener is nie" -msgid "--remote-send \tSend to a Vim server and exit" +msgid "--remote-send \tSend to a MNV server and exit" msgstr "" -"--remote-send \tStuur na 'n Vim-bediener en verlaat" +"--remote-send \tStuur na 'n MNV-bediener en verlaat" -msgid "--remote-expr \tEvaluate in a Vim server and print result" +msgid "--remote-expr \tEvaluate in a MNV server and print result" msgstr "" -"--remote-expr \tEvalueer in 'n Vim-bediener en druk resultaat" +"--remote-expr \tEvalueer in 'n MNV-bediener en druk resultaat" -msgid "--serverlist\t\tList available Vim server names and exit" -msgstr "--serverlist\t\tLys beskikbare Vim-bediener name en verlaat" +msgid "--serverlist\t\tList available MNV server names and exit" +msgstr "--serverlist\t\tLys beskikbare MNV-bediener name en verlaat" -msgid "--servername \tSend to/become the Vim server " -msgstr "--servername \tStuur na/word die Vim-bediener " +msgid "--servername \tSend to/become the MNV server " +msgstr "--servername \tStuur na/word die MNV-bediener " -msgid "-i \t\tUse instead of .viminfo" -msgstr "-i \t\tGebruik in plaas van .viminfo" +msgid "-i \t\tUse instead of .mnvinfo" +msgstr "-i \t\tGebruik in plaas van .mnvinfo" msgid "-h or --help\tPrint Help (this message) and exit" msgstr "-h of --help\tSkryf Hulp (hierdie boodskap) en sluit" @@ -1196,16 +1196,16 @@ msgstr "--version\t\tSkryf weergawe-inligting en sluit" msgid "" "\n" -"Arguments recognised by gvim (Motif version):\n" +"Arguments recognised by gmnv (Motif version):\n" msgstr "" "\n" -"Parameters deur gvim herken (Motif weergawe):\n" +"Parameters deur gmnv herken (Motif weergawe):\n" -msgid "-display \tRun Vim on " -msgstr "-display \tVoer Vim op uit" +msgid "-display \tRun MNV on " +msgstr "-display \tVoer MNV op uit" -msgid "-iconic\t\tStart Vim iconified" -msgstr "-iconic\t\tBegin vim as ikoon" +msgid "-iconic\t\tStart MNV iconified" +msgstr "-iconic\t\tBegin mnv as ikoon" msgid "-background \tUse for the background (also: -bg)" msgstr "-background \tGebruik vir die agtergrond (ook: -bg)" @@ -1217,7 +1217,7 @@ msgid "-font \t\tUse for normal text (also: -fn)" msgstr "-font \t\tGebruik vir normale teks (ook -fn)" msgid "-boldfont \tUse for bold text" -msgstr "­boldfont \t Gebruik vir vetletter teks" +msgstr "�boldfont \t Gebruik vir vetletter teks" msgid "-italicfont \tUse for italic text" msgstr "-italicfont \tGebruik vir kursiewe teks" @@ -1243,22 +1243,22 @@ msgstr "-xrm \tStel die gespesifiseerde hulpbron" msgid "" "\n" -"Arguments recognised by gvim (GTK+ version):\n" +"Arguments recognised by gmnv (GTK+ version):\n" msgstr "" "\n" -"Parameters wat gvim verstaan (GTK+ weergawe):\n" +"Parameters wat gmnv verstaan (GTK+ weergawe):\n" -msgid "-display \tRun Vim on (also: --display)" -msgstr "-display \tVoer Vim op uit: (ook --display)" +msgid "-display \tRun MNV on (also: --display)" +msgstr "-display \tVoer MNV op uit: (ook --display)" msgid "--role \tSet a unique role to identify the main window" msgstr "--role \tStel 'n unieke rol om die hoofvenster te identifiseer" -msgid "--socketid \tOpen Vim inside another GTK widget" -msgstr "--socketid \tMaak Vim in 'n ander GTK element oop" +msgid "--socketid \tOpen MNV inside another GTK widget" +msgstr "--socketid \tMaak MNV in 'n ander GTK element oop" -msgid "-P \tOpen Vim inside parent application" -msgstr "-P \tMaak Vim oop binne 'n ouer toepassing" +msgid "-P \tOpen MNV inside parent application" +msgstr "-P \tMaak MNV oop binne 'n ouer toepassing" msgid "No abbreviation found" msgstr "Geen afkorting gevind nie" @@ -1274,80 +1274,80 @@ msgid "" "mark line col file/text" msgstr "" "\n" -"merk reël kol lêer/teks" +"merk re�l kol l�er/teks" msgid "" "\n" " jump line col file/text" msgstr "" "\n" -" spring reël kol lêer/teks" +" spring re�l kol l�er/teks" msgid "" "\n" "change line col text" msgstr "" "\n" -"verander reël kol teks" +"verander re�l kol teks" msgid "Enter number of swap file to use (0 to quit): " -msgstr "Tik die nommer van die ruillêer om te gebruik (0 om te stop)" +msgstr "Tik die nommer van die ruill�er om te gebruik (0 om te stop)" msgid "Unable to read block 0 from " msgstr "Kan nie blok 0 lees vanaf " msgid "" "\n" -"Maybe no changes were made or Vim did not update the swap file." +"Maybe no changes were made or MNV did not update the swap file." msgstr "" "\n" -"Vim het die ruillêer nie opgedateer nie. Dalk was niks verander nie." +"MNV het die ruill�er nie opgedateer nie. Dalk was niks verander nie." -msgid " cannot be used with this version of Vim.\n" -msgstr " kan nie gebruik word met hierdie weergawe van Vim nie.\n" +msgid " cannot be used with this version of MNV.\n" +msgstr " kan nie gebruik word met hierdie weergawe van MNV nie.\n" -msgid "Use Vim version 3.0.\n" -msgstr "Gebruik Vim weergawe 3.0.\n" +msgid "Use MNV version 3.0.\n" +msgstr "Gebruik MNV weergawe 3.0.\n" msgid " cannot be used on this computer.\n" msgstr " kan nie gebruik word op hierdie rekenaar nie.\n" msgid "The file was created on " -msgstr "Die lêer is geskep op " +msgstr "Die l�er is geskep op " msgid "" ",\n" "or the file has been damaged." msgstr "" ",\n" -"of die lêer is beskadig." +"of die l�er is beskadig." msgid "Using swap file \"%s\"" -msgstr "Gebruik ruillêer \"%s\"" +msgstr "Gebruik ruill�er \"%s\"" msgid "Original file \"%s\"" -msgstr "Oorspronklike lêer \"%s\"" +msgstr "Oorspronklike l�er \"%s\"" msgid "???MANY LINES MISSING" -msgstr "???BAIE REËLS WEG" +msgstr "???BAIE RE�LS WEG" msgid "???LINE COUNT WRONG" -msgstr "???REËLTELLING FOUTIEF" +msgstr "???RE�LTELLING FOUTIEF" msgid "???EMPTY BLOCK" -msgstr "???LEË BLOK" +msgstr "???LE� BLOK" msgid "???LINES MISSING" -msgstr "???REËLS WEG" +msgstr "???RE�LS WEG" msgid "???BLOCK MISSING" msgstr "???BLOK WEG" msgid "??? from here until ???END lines may be messed up" -msgstr "??? van hier tot ???END mag reëls deurmekaar wees" +msgstr "??? van hier tot ???END mag re�ls deurmekaar wees" msgid "??? from here until ???END lines may have been inserted/deleted" -msgstr "??? van hier tot ???END mag daar reëls ingevoeg/geskrap wees" +msgstr "??? van hier tot ???END mag daar re�ls ingevoeg/geskrap wees" msgid "???END" msgstr "???END" @@ -1363,13 +1363,13 @@ msgid "" "(You might want to write out this file under another name\n" msgstr "" "\n" -"(Jy wil dalk die lêer stoor onder 'n ander naam\n" +"(Jy wil dalk die l�er stoor onder 'n ander naam\n" msgid "and run diff with the original file to check for changes)\n" -msgstr "en dit \"diff\" teen die oorspronklike lêer om wysigings te soek)\n" +msgstr "en dit \"diff\" teen die oorspronklike l�er om wysigings te soek)\n" msgid "Swap files found:" -msgstr "Ruillêers gevind:" +msgstr "Ruill�ers gevind:" msgid " In current directory:\n" msgstr " In huidige gids:\n" @@ -1392,14 +1392,14 @@ msgstr " gedateer: " msgid " dated: " msgstr " gedateer: " -msgid " [from Vim version 3.0]" -msgstr " [van Vim weergawe 3.0]" +msgid " [from MNV version 3.0]" +msgstr " [van MNV weergawe 3.0]" -msgid " [does not look like a Vim swap file]" -msgstr " [lyk nie soos 'n Vim ruillêer nie]" +msgid " [does not look like a MNV swap file]" +msgstr " [lyk nie soos 'n MNV ruill�er nie]" msgid " file name: " -msgstr " lêernaam: " +msgstr " l�ernaam: " msgid "" "\n" @@ -1440,10 +1440,10 @@ msgstr "" msgid "" "\n" -" [not usable with this version of Vim]" +" [not usable with this version of MNV]" msgstr "" "\n" -" [nie bruikbaar met hierdie weergawe van Vim nie]" +" [nie bruikbaar met hierdie weergawe van MNV nie]" msgid "" "\n" @@ -1459,7 +1459,7 @@ msgid " [cannot be opened]" msgstr " [kan nie oopgemaak word nie]" msgid "File preserved" -msgstr "Lêer bewaar" +msgstr "L�er bewaar" msgid "stack_idx should be 0" msgstr "'stack_idx' moet 0 wees" @@ -1478,13 +1478,13 @@ msgid "" "Found a swap file by the name \"" msgstr "" "\n" -"Het 'n ruillêer gevind met die naam \"" +"Het 'n ruill�er gevind met die naam \"" msgid "While opening file \"" -msgstr "Tydens oopmaak van lêer \"" +msgstr "Tydens oopmaak van l�er \"" msgid " NEWER than swap file!\n" -msgstr " NUWER as die ruillêer!\n" +msgstr " NUWER as die ruill�er!\n" msgid "" "\n" @@ -1493,16 +1493,16 @@ msgid "" " file when making changes. Quit, or continue with caution.\n" msgstr "" "\n" -"(1) 'n Ander program mag besig wees met hierdie lêer.\n" +"(1) 'n Ander program mag besig wees met hierdie l�er.\n" " Indien wel, pas op om nie met twee verskillende weergawes\n" -" van dieselfde lêer te sit wanneer veranderinge gemaak word nie.\n" +" van dieselfde l�er te sit wanneer veranderinge gemaak word nie.\n" msgid "(2) An edit session for this file crashed.\n" msgstr "" -"(2) 'n Bewerkingsessie van hierdie lêer het ineengestort.\n" +"(2) 'n Bewerkingsessie van hierdie l�er het ineengestort.\n" -msgid " If this is the case, use \":recover\" or \"vim -r " -msgstr " Indien wel, gebruik \":recover\" of \"vim -r" +msgid " If this is the case, use \":recover\" or \"mnv -r " +msgstr " Indien wel, gebruik \":recover\" of \"mnv -r" msgid "" "\"\n" @@ -1512,7 +1512,7 @@ msgstr "" " om die veranderinge te herwin (sien \":help recovery\").\n" msgid " If you did this already, delete the swap file \"" -msgstr " Indien jy dit alreeds gedoen het, verwyder die ruillêer \"" +msgstr " Indien jy dit alreeds gedoen het, verwyder die ruill�er \"" msgid "" "\"\n" @@ -1522,16 +1522,16 @@ msgstr "" " om hierdie boodskap te vermy.\n" msgid "Swap file \"" -msgstr "Ruillêer \"" +msgstr "Ruill�er \"" msgid "\" already exists!" msgstr "\" bestaan alreeds!" -msgid "VIM - ATTENTION" -msgstr "VIM - LET OP" +msgid "MNV - ATTENTION" +msgstr "MNV - LET OP" msgid "Swap file already exists!" -msgstr "Ruillêer bestaan alreeds!" +msgstr "Ruill�er bestaan alreeds!" msgid "" "&Open Read-Only\n" @@ -1560,9 +1560,9 @@ msgid "Error detected while processing %s:" msgstr "Fout ontdek tydens verwerking van %s: " msgid "line %4ld:" -msgstr "reël %4ld:" +msgstr "re�l %4ld:" -msgid "Messages maintainer: The Vim Project" +msgid "Messages maintainer: The MNV Project" msgstr "Boodskappe onderhouers: Danie Roux en Jean Jordaan " msgid "Interrupt: " @@ -1575,7 +1575,7 @@ msgid "Unknown" msgstr "Onbekend" msgid "%s line %ld" -msgstr "%s reël %ld" +msgstr "%s re�l %ld" msgid "-- More --" msgstr "-- Meer --" @@ -1605,13 +1605,13 @@ msgstr "" msgid "%ld more line" msgid_plural "%ld more lines" -msgstr[0] "%ld meer reël" -msgstr[1] "%ld meer reëls" +msgstr[0] "%ld meer re�l" +msgstr[1] "%ld meer re�ls" msgid "%ld line less" msgid_plural "%ld fewer lines" -msgstr[0] "%ld reël minder" -msgstr[1] "%ld reëls minder" +msgstr[0] "%ld re�l minder" +msgstr[1] "%ld re�ls minder" msgid " (Interrupted)" msgstr " (Onderbreek)" @@ -1627,13 +1627,13 @@ msgstr "kan nie pluk nie: verwyder in elk geval" msgid "%ld line changed" msgid_plural "%ld lines changed" -msgstr[0] "%ld reël verander" -msgstr[1] "%ld reëls verander" +msgstr[0] "%ld re�l verander" +msgstr[1] "%ld re�ls verander" msgid "%d line changed" msgid_plural "%d lines changed" -msgstr[0] "%d reël verander" -msgstr[1] "%d reëls verander" +msgstr[0] "%d re�l verander" +msgstr[1] "%d re�ls verander" msgid "%ld Cols; " msgstr "%ld Kolomme; " @@ -1679,8 +1679,8 @@ msgstr "" msgid "cannot open " msgstr "kan nie oopmaak nie " -msgid "VIM: Can't open window!\n" -msgstr "VIM: Kan nie venster oopmaak nie!\n" +msgid "MNV: Can't open window!\n" +msgstr "MNV: Kan nie venster oopmaak nie!\n" msgid "Need Amigados version 2.04 or later\n" msgstr "Benodig Amigados weergawe 2.04 of later\n" @@ -1694,8 +1694,8 @@ msgstr "Kan nie NIL: oopmaak nie\n" msgid "Cannot create " msgstr "Kan nie skep nie: " -msgid "Vim exiting with %d\n" -msgstr "Vim stop met %d\n" +msgid "MNV exiting with %d\n" +msgstr "MNV stop met %d\n" msgid "cannot change console mode ?!\n" msgstr "kan konsole-modus nie verander nie ?!\n" @@ -1729,10 +1729,10 @@ msgstr "Om die X-vertoonskerm oop te maak het %ld msek gevat" msgid "" "\n" -"Vim: Got X error\n" +"MNV: Got X error\n" msgstr "" "\n" -"Vim: Het X fout ontvang\n" +"MNV: Het X fout ontvang\n" msgid "Testing the X display failed" msgstr "Toetsing van die X-vertoonskerm het gefaal" @@ -1780,7 +1780,7 @@ msgid "" "Command terminated\n" msgstr "" "\n" -"Bevel beëindig\n" +"Bevel be�indig\n" msgid "XSMP lost ICE connection" msgstr "XSMP het ICE konneksie verloor" @@ -1801,10 +1801,10 @@ msgid "XSMP SmcOpenConnection failed: %s" msgstr "XSMP 'SmcOpenConnection' het gefaal: %s" msgid "At line" -msgstr "By reël" +msgstr "By re�l" -msgid "Vim: Caught %s event\n" -msgstr "Vim: Het %s gebeurtenis gevang\n" +msgid "MNV: Caught %s event\n" +msgstr "MNV: Het %s gebeurtenis gevang\n" msgid "close" msgstr "maak toe" @@ -1816,16 +1816,16 @@ msgid "shutdown" msgstr "sit af" msgid "" -"VIMRUN.EXE not found in your $PATH.\n" +"MNVRUN.EXE not found in your $PATH.\n" "External commands will not pause after completion.\n" -"See :help win32-vimrun for more information." +"See :help win32-mnvrun for more information." msgstr "" -"'VIMRUN.EXE' nie gevind in '$PATH' nie.\n" +"'MNVRUN.EXE' nie gevind in '$PATH' nie.\n" "Eksterne opdragte sal nie wag na voltooiing nie\n" -"Sien ':help win32-vimrun' vir meer inligting." +"Sien ':help win32-mnvrun' vir meer inligting." -msgid "Vim Warning" -msgstr "Vim Waarskuwing" +msgid "MNV Warning" +msgstr "MNV Waarskuwing" msgid "shell returned %d" msgstr "dop het %d gelewer" @@ -1834,18 +1834,18 @@ msgid "(%d of %d)%s%s: " msgstr "(%d van %d)%s%s: " msgid " (line deleted)" -msgstr " (reël verwyder)" +msgstr " (re�l verwyder)" msgid "Cannot open file \"%s\"" -msgstr "Kan nie lêer \"%s\" oopmaak nie" +msgstr "Kan nie l�er \"%s\" oopmaak nie" msgid "External submatches:\n" msgstr "Eksterne subtreffers:\n" msgid "%ld line yanked%s" msgid_plural "%ld lines yanked%s" -msgstr[0] "%ld reël gepluk%s" -msgstr[1] "%ld reëls gepluk%s" +msgstr[0] "%ld re�l gepluk%s" +msgstr[1] "%ld re�ls gepluk%s" msgid " VREPLACE" msgstr " VVERVANG" @@ -1881,7 +1881,7 @@ msgid " VISUAL" msgstr " VISUELE" msgid " VISUAL LINE" -msgstr " VISUELE REËL" +msgstr " VISUELE RE�L" msgid " VISUAL BLOCK" msgstr " VISUELE BLOK" @@ -1890,7 +1890,7 @@ msgid " SELECT" msgstr " KIES" msgid " SELECT LINE" -msgstr " KIES REËL" +msgstr " KIES RE�L" msgid " SELECT BLOCK" msgstr " KIES BLOK" @@ -1904,8 +1904,8 @@ msgstr "Besig om te soek vir \"%s\" in \"%s\"" msgid "Searching for \"%s\"" msgstr "Besig om te soek vir \"%s\"" -msgid "Source Vim script" -msgstr "Voer Vim skrip uit" +msgid "Source MNV script" +msgstr "Voer MNV skrip uit" msgid "Cannot source a directory: \"%s\"" msgstr "Kan nie gids uitvoer nie: \"%s\"" @@ -1914,13 +1914,13 @@ msgid "could not source \"%s\"" msgstr "kon nie \"%s\" uitvoer nie" msgid "line %ld: could not source \"%s\"" -msgstr "reël %ld: kon nie \"%s\" uitvoer nie" +msgstr "re�l %ld: kon nie \"%s\" uitvoer nie" msgid "sourcing \"%s\"" msgstr "besig om \"%s\" uit te voer" msgid "line %ld: sourcing \"%s\"" -msgstr "reël %ld: voer nou \"%s\" uit" +msgstr "re�l %ld: voer nou \"%s\" uit" msgid "finished sourcing %s" msgstr "%s klaar uitgevoer" @@ -1929,13 +1929,13 @@ msgid "continuing in %s" msgstr "vervolg in %s" msgid "W15: Warning: Wrong line separator, ^M may be missing" -msgstr "W15: Waarskuwing: Verkeerde reëlskeiding, ^M ontbreek dalk" +msgstr "W15: Waarskuwing: Verkeerde re�lskeiding, ^M ontbreek dalk" msgid " (includes previously listed match)" msgstr " (sluit in vorige gelyste treffer)" msgid "--- Included files " -msgstr "--- Ingeslote lêers" +msgstr "--- Ingeslote l�ers" msgid "not found " msgstr "nie gevind nie " @@ -1950,16 +1950,16 @@ msgid " NOT FOUND" msgstr " NIE GEVIND NIE" msgid "Scanning included file: %s" -msgstr "Deursoek ingeslote lêer: %s" +msgstr "Deursoek ingeslote l�er: %s" msgid "Searching included file %s" -msgstr "Deursoek ingeslote lêer: %s" +msgstr "Deursoek ingeslote l�er: %s" msgid "All included files were found" -msgstr "Alle ingeslote lêers is gevind" +msgstr "Alle ingeslote l�ers is gevind" msgid "No included files" -msgstr "Geen ingeslote lêers nie" +msgstr "Geen ingeslote l�ers nie" msgid "Save View" msgstr "Stoor Oorsig" @@ -1984,7 +1984,7 @@ msgid "Signs for %s:" msgstr "Tekens vir %s:" msgid " line=%ld id=%d%s name=%s priority=%d" -msgstr " reël=%ld id=%d%s naam=%s prioriteit=%d" +msgstr " re�l=%ld id=%d%s naam=%s prioriteit=%d" msgid " (NOT FOUND)" msgstr " (NIE GEVIND NIE)" @@ -2005,7 +2005,7 @@ msgid "syncing starts " msgstr "sinchronisasie begin " msgid " lines before top line" -msgstr " reëls voor boonste lyn" +msgstr " re�ls voor boonste lyn" msgid "" "\n" @@ -2038,10 +2038,10 @@ msgid "; match " msgstr "; treffer " msgid " line breaks" -msgstr " reël breuke" +msgstr " re�l breuke" msgid "File \"%s\" does not exist" -msgstr "Lêer \"%s\" bestaan nie" +msgstr "L�er \"%s\" bestaan nie" msgid "tag %d of %d%s" msgstr "etiket %d van %d%s" @@ -2056,20 +2056,20 @@ msgid " # pri kind tag" msgstr " # pri tipe etiket" msgid "file\n" -msgstr "lêer\n" +msgstr "l�er\n" msgid "" "\n" " # TO tag FROM line in file/text" msgstr "" "\n" -" # NA etiket VAN reël in lêer/teks" +" # NA etiket VAN re�l in l�er/teks" msgid "Before byte %ld" msgstr "Voor greep %ld" msgid "Searching tags file %s" -msgstr "Deursoek etiketlêer %s" +msgstr "Deursoek etiketl�er %s" msgid "' not known. Available builtin terminals are:" msgstr "' onbekend. Beskikbare ingeboude terminale is:" @@ -2095,8 +2095,8 @@ msgstr "(Ongeldig)" msgid "new shell started\n" msgstr "nuwe dop begin\n" -msgid "Vim: Error reading input, exiting...\n" -msgstr "Vim: Fout met lees van invoer, verlaat...\n" +msgid "MNV: Error reading input, exiting...\n" +msgstr "MNV: Fout met lees van invoer, verlaat...\n" msgid "No undo possible; continue anyway" msgstr "Geen herstel moontlik; gaan in elk geval voort" @@ -2266,44 +2266,44 @@ msgstr "met GUI." msgid " Features included (+) or not (-):\n" msgstr " Kenmerke in- (+) of uitgesluit (-):\n" -msgid " system vimrc file: \"" -msgstr " stelsel vimrc-lêer: \"" +msgid " system mnvrc file: \"" +msgstr " stelsel mnvrc-l�er: \"" -msgid " user vimrc file: \"" -msgstr " gebruiker vimrc-lêer: \"" +msgid " user mnvrc file: \"" +msgstr " gebruiker mnvrc-l�er: \"" -msgid " 2nd user vimrc file: \"" -msgstr " 2de gebruiker vimrc-lêer \"" +msgid " 2nd user mnvrc file: \"" +msgstr " 2de gebruiker mnvrc-l�er \"" -msgid " 3rd user vimrc file: \"" -msgstr " 3de gebruiker vimrc-lêer \"" +msgid " 3rd user mnvrc file: \"" +msgstr " 3de gebruiker mnvrc-l�er \"" msgid " user exrc file: \"" -msgstr " gebruiker exrc-lêer: \"" +msgstr " gebruiker exrc-l�er: \"" msgid " 2nd user exrc file: \"" -msgstr " 2de gebruiker exrc-lêer: \"" +msgstr " 2de gebruiker exrc-l�er: \"" -msgid " system gvimrc file: \"" -msgstr " stelsel gvimrc-lêer: \"" +msgid " system gmnvrc file: \"" +msgstr " stelsel gmnvrc-l�er: \"" -msgid " user gvimrc file: \"" -msgstr " gebruiker gvimrc-lêer: \"" +msgid " user gmnvrc file: \"" +msgstr " gebruiker gmnvrc-l�er: \"" -msgid "2nd user gvimrc file: \"" -msgstr "2de gebruiker gvimrc-lêer: \"" +msgid "2nd user gmnvrc file: \"" +msgstr "2de gebruiker gmnvrc-l�er: \"" -msgid "3rd user gvimrc file: \"" -msgstr "3de gebruiker gvimrc-lêer: \"" +msgid "3rd user gmnvrc file: \"" +msgstr "3de gebruiker gmnvrc-l�er: \"" msgid " system menu file: \"" -msgstr " stelsel kieslys-lêer: \"" +msgstr " stelsel kieslys-l�er: \"" -msgid " fall-back for $VIM: \"" -msgstr " bystand vir $VIM: \"" +msgid " fall-back for $MNV: \"" +msgstr " bystand vir $MNV: \"" -msgid " f-b for $VIMRUNTIME: \"" -msgstr " bystand vir $VIMRUNTIME: \"" +msgid " f-b for $MNVRUNTIME: \"" +msgstr " bystand vir $MNVRUNTIME: \"" msgid "Compilation: " msgstr "Kompilering: " @@ -2317,8 +2317,8 @@ msgstr "Koppeling: " msgid " DEBUG BUILD" msgstr " ONTFOUTINGS-KOMPILERING" -msgid "VIM - Vi IMproved" -msgstr "VIM - Vi Met skop" +msgid "MNV - MNV is not Vim" +msgstr "MNV - Vi Met skop" # njj: :)) msgid "version " @@ -2327,8 +2327,8 @@ msgstr "Weergawe " msgid "by Bram Moolenaar et al." msgstr "deur Bram Moolenaar et al." -msgid "Vim is open source and freely distributable" -msgstr "Vim is vryekode, en vrylik verspreibaar" +msgid "MNV is open source and freely distributable" +msgstr "MNV is vryekode, en vrylik verspreibaar" msgid "Help poor children in Uganda!" msgstr "Help arm kinders in Uganda!" @@ -2348,8 +2348,8 @@ msgstr "tik :help version9 vir weergawe-inligting" msgid "Running in Vi compatible mode" msgstr "Voer tans uit in Vi-versoenbare modus" -msgid "type :set nocp for Vim defaults" -msgstr "tik :set nocp vir Vim verstekwaardes " +msgid "type :set nocp for MNV defaults" +msgstr "tik :set nocp vir MNV verstekwaardes " msgid "type :help cp-default for info on this" msgstr "tik :help cp-default vir meer inligting hieroor" @@ -2369,14 +2369,14 @@ msgstr " vir twee modusse " msgid "menu Edit->Global Settings->Toggle Vi Compatible" msgstr "menu Redigeer->Global verstellings->Stel en herstel Vi Versoenbaar" -msgid " for Vim defaults " -msgstr " vir Vim verstekwaardes" +msgid " for MNV defaults " +msgstr " vir MNV verstekwaardes" -msgid "Sponsor Vim development!" -msgstr "Borg Vim ontwikkeling!" +msgid "Sponsor MNV development!" +msgstr "Borg MNV ontwikkeling!" -msgid "Become a registered Vim user!" -msgstr "Word 'n geregistreerde Vim gebruiker!" +msgid "Become a registered MNV user!" +msgstr "Word 'n geregistreerde MNV gebruiker!" msgid "type :help sponsor for information " msgstr "tik :help sponsor vir meer inligting hieroor " @@ -2402,7 +2402,7 @@ msgstr "" "# %s Geskiedenis (van nuutste na oudste):\n" msgid "Command Line" -msgstr "Bevelreël" +msgstr "Bevelre�l" msgid "Search String" msgstr "Soekstring" @@ -2413,8 +2413,8 @@ msgstr "Uitdrukking" msgid "Input Line" msgstr "Invoer Lyn" -msgid "%sviminfo: %s in line: " -msgstr "%sviminfo: %s in reël: " +msgid "%smnvinfo: %s in line: " +msgstr "%smnvinfo: %s in re�l: " msgid "" "\n" @@ -2444,14 +2444,14 @@ msgid "" "# History of marks within files (newest to oldest):\n" msgstr "" "\n" -"# Geskiedenis van merkers in lêers (nuutste tot oudste):\n" +"# Geskiedenis van merkers in l�ers (nuutste tot oudste):\n" msgid "" "\n" "# File marks:\n" msgstr "" "\n" -"# Lêermerkers:\n" +"# L�ermerkers:\n" msgid "" "\n" @@ -2460,8 +2460,8 @@ msgstr "" "\n" "# Springlys (nuutste eerste):\n" -msgid "# This viminfo file was generated by Vim %s.\n" -msgstr "# Hierdie viminfo lêer is gegenereer deur Vim %s.\n" +msgid "# This mnvinfo file was generated by MNV %s.\n" +msgstr "# Hierdie mnvinfo l�er is gegenereer deuMNMNV %s.\n" msgid "" "# You may edit it if you're careful!\n" @@ -2471,10 +2471,10 @@ msgstr "" "\n" msgid "# Value of 'encoding' when this file was written\n" -msgstr "# Waarde van 'encoding' toe hierdie lêer gestoor is\n" +msgstr "# Waarde van 'encoding' toe hierdie l�er gestoor is\n" -msgid "Reading viminfo file \"%s\"%s%s%s%s" -msgstr "Besig om viminfo lêer \"%s\"%s%s%s%s te lees" +msgid "Reading mnvinfo file \"%s\"%s%s%s%s" +msgstr "Besig om mnvinfo l�er \"%s\"%s%s%s%s te lees" msgid " info" msgstr " inligting" @@ -2485,8 +2485,8 @@ msgstr " merkers" msgid " FAILED" msgstr " GEFAAL" -msgid "Writing viminfo file \"%s\"" -msgstr "Besig om viminfo lêer \"%s\" te stoor" +msgid "Writing mnvinfo file \"%s\"" +msgstr "Besig om mnvinfo l�er \"%s\" te stoor" msgid "Already only one window" msgstr "Daar is alreeds slegs een venster" @@ -2499,23 +2499,23 @@ msgstr "" "Jammer, hierdie bevel is afgeskakel: die Perl biblioteek kon nie gelaai word " "nie." -msgid "Edit with single &Vim" -msgstr "Wysig met 'n enkel &Vim" +msgid "Edit with single &MNV" +msgstr "Wysig met 'n enkel &MNV" -msgid "Edit with &Vim" -msgstr "Wysig met &Vim" +msgid "Edit with &MNV" +msgstr "Wysig met &MNV" -msgid "Edit with existing Vim - " -msgstr "Wysig met bestaande Vim - " +msgid "Edit with existing MNV - " +msgstr "Wysig met bestaande MNV - " -msgid "Edits the selected file(s) with Vim" -msgstr "Wysig die gekose lêer(s) met Vim" +msgid "Edits the selected file(s) with MNV" +msgstr "Wysig die gekose l�er(s) meMNMNV" -msgid "Error creating process: Check if gvim is in your path!" -msgstr "FOut met die skep van proses: Kyk of gvim in jou pad is!" +msgid "Error creating process: Check if gmnv is in your path!" +msgstr "FOut met die skep van proses: Kyk of gmnv in jou pad is!" -msgid "gvimext.dll error" -msgstr "'gvimext.dll' fout" +msgid "gmnvext.dll error" +msgstr "'gmnvext.dll' fout" msgid "Interrupted" msgstr "Onderbreek" @@ -2524,14 +2524,14 @@ msgid "E10: \\ should be followed by /, ? or &" msgstr "E10: \\ moet gevolg word deur /, ? of &" msgid "E11: Invalid in command-line window; executes, CTRL-C quits" -msgstr "E11: Ongeldig in bevelreël venster: voer uit, CTRL-C stop" +msgstr "E11: Ongeldig in bevelre�l venster: voer uit, CTRL-C stop" -msgid "E12: Command not allowed from exrc/vimrc in current dir or tag search" +msgid "E12: Command not allowed from exrc/mnvrc in current dir or tag search" msgstr "" -"E12: Bevel uit exrc/vimrc nie toegelaat in huidige gids- of etiketsoektog nie" +"E12: Bevel uit exrc/mnvrc nie toegelaat in huidige gids- of etiketsoektog nie" msgid "E13: File exists (add ! to override)" -msgstr "E13: Lêer bestaan (gebruik ! om te dwing)" +msgstr "E13: L�er bestaan (gebruik ! om te dwing)" msgid "E15: Invalid expression: \"%s\"" msgstr "E15: Ongeldige uitdrukking: \"%s\"" @@ -2546,7 +2546,7 @@ msgid "E18: Unexpected characters in :let" msgstr "E18: Onverwagte karakters in ':let'" msgid "E19: Mark has invalid line number" -msgstr "E19: Merker het ongeldige reëlnommer" +msgstr "E19: Merker het ongeldige re�lnommer" msgid "E20: Mark not set" msgstr "E20: Merker nie gestel nie" @@ -2558,7 +2558,7 @@ msgid "E22: Scripts nested too deep" msgstr "E22: Skripte te diep ge-nes" msgid "E23: No alternate file" -msgstr "E23: Geen alternatiewe lêer nie" +msgstr "E23: Geen alternatiewe l�er nie" msgid "E24: No such abbreviation" msgstr "E24: Afkorting bestaan nie" @@ -2577,13 +2577,13 @@ msgid "E29: No inserted text yet" msgstr "E29: Nog geen ingevoegde teks nie" msgid "E30: No previous command line" -msgstr "E30: Geen vorige bevelreël nie" +msgstr "E30: Geen vorige bevelre�l nie" msgid "E31: No such mapping" msgstr "E31: Geen so 'n binding nie" msgid "E32: No file name" -msgstr "E32: Geen lêernaam" +msgstr "E32: Geen l�ernaam" msgid "E33: No previous substitute regular expression" msgstr "E33: Geen vorige vervangingspatroon nie" @@ -2610,7 +2610,7 @@ msgid "E39: Number expected" msgstr "E39: Nommer verwag" msgid "E40: Can't open errorfile %s" -msgstr "E40: Kan nie foutlêer %s oopmaak nie" +msgstr "E40: Kan nie foutl�er %s oopmaak nie" msgid "E41: Out of memory!" msgstr "E41: Geheue op!" @@ -2694,13 +2694,13 @@ msgid "E69: Missing ] after %s%%[" msgstr "E69: Ontbrekende ] na %s%%[" msgid "E70: Empty %s%%[]" -msgstr "E70: Leë %s%%[]" +msgstr "E70: Le� %s%%[]" msgid "E71: Invalid character after %s%%" msgstr "E71: Ongeldige karakter na %s%%" msgid "E72: Close error on swap file" -msgstr "E72: Sluitfout met ruillêer" +msgstr "E72: Sluitfout met ruill�er" msgid "E73: Tag stack empty" msgstr "E73: Etiketstapel leeg" @@ -2715,7 +2715,7 @@ msgid "E76: Too many [" msgstr "E76: Te veel [" msgid "E77: Too many file names" -msgstr "E77: Te veel lêername" +msgstr "E77: Te veel l�ername" msgid "E78: Unknown mark" msgstr "E78: Onbekende merker" @@ -2748,7 +2748,7 @@ msgid "E87: Cannot go beyond last buffer" msgstr "E87: Kan nie verby laaste buffer gaan nie" msgid "E88: Cannot go before first buffer" -msgstr "E88: Kan nie vóór eerste buffer gaan nie" +msgstr "E88: Kan nie v��r eerste buffer gaan nie" msgid "E89: No write since last change for buffer %d (add ! to override)" msgstr "" @@ -2802,7 +2802,7 @@ msgid "E104: Escape not allowed in digraph" msgstr "E104: 'Escape' nie toegelaat in digraaf nie" msgid "E105: Using :loadkeymap not in a sourced file" -msgstr "E105: :loadkeymap word buite 'n uitvoerlêer gebruik" +msgstr "E105: :loadkeymap word buite 'n uitvoerl�er gebruik" msgid "E107: Missing parentheses: %s" msgstr "E107: Ontbrekende hakies: %s" @@ -2882,26 +2882,26 @@ msgstr "E133: ':return' buite funksie" msgid "E135: *Filter* Autocommands must not change current buffer" msgstr "E135: *Filter* Outobevele mag nie die huidige buffer verander nie" -msgid "E136: viminfo: Too many errors, skipping rest of file" -msgstr "E136: viminfo: Te veel foute, slaan die res van die lêer oor" +msgid "E136: mnvinfo: Too many errors, skipping rest of file" +msgstr "E136: mnvinfo: Te veel foute, slaan die res van die l�er oor" -msgid "E137: Viminfo file is not writable: %s" -msgstr "E137: Viminfo lêer is nie skryfbaar nie: %s" +msgid "E137: MNVinfo file is not writable: %s" +msgstr "E137: MNVinfo l�er is nie skryfbaar nie: %s" -msgid "E138: Can't write viminfo file %s!" -msgstr "E138: Kan nie viminfo lêer %s stoor nie!" +msgid "E138: Can't write mnvinfo file %s!" +msgstr "E138: Kan nie mnvinfo l�er %s stoor nie!" msgid "E139: File is loaded in another buffer" -msgstr "E139: Lêer is gelaai in ander buffer" +msgstr "E139: L�er is gelaai in ander buffer" msgid "E140: Use ! to write partial buffer" msgstr "E140: Gebruik ! om gedeeltelike buffer te skryf" msgid "E141: No file name for buffer %ld" -msgstr "E141: Geen lêernaam vir buffer %ld nie" +msgstr "E141: Geen l�ernaam vir buffer %ld nie" msgid "E142: File not written: Writing is disabled by 'write' option" -msgstr "E142: Lêer nie gestoor nie: Stoor is afgeskakel deur die 'write' opsie" +msgstr "E142: L�er nie gestoor nie: Stoor is afgeskakel deur die 'write' opsie" msgid "E143: Autocommands unexpectedly deleted new buffer %s" msgstr "E143: Outobevele het nuwe buffer %s onverwags geskrap" @@ -2909,8 +2909,8 @@ msgstr "E143: Outobevele het nuwe buffer %s onverwags geskrap" msgid "E144: Non-numeric argument to :z" msgstr "E144: Nie-numeriese parameter vir :z" -msgid "E145: Shell commands and some functionality not allowed in rvim" -msgstr "E145: Dop bevele nie toegelaat in rvim" +msgid "E145: Shell commands and some functionality not allowed in rmnv" +msgstr "E145: Dop bevele nie toegelaat in rmnv" msgid "E146: Regular expressions can't be delimited by letters" msgstr "E146: Patrone kan nie deur letters afgebaken word nie" @@ -2934,7 +2934,7 @@ msgid "E153: Unable to open %s for reading" msgstr "E153: Kan nie %s oop maak om te lees nie" msgid "E154: Duplicate tag \"%s\" in file %s/%s" -msgstr "E154: Duplikaat etiket \"%s\" in lêer %s/%s" +msgstr "E154: Duplikaat etiket \"%s\" in l�er %s/%s" msgid "E155: Unknown sign: %s" msgstr "E155: Onbekende opsie: %s" @@ -2961,22 +2961,22 @@ msgid "E162: No write since last change for buffer \"%s\"" msgstr "E162: Buffer \"%s\" is nie geskryf sedert vorige wysiging nie" msgid "E163: There is only one file to edit" -msgstr "E163: Daar is net een lêer om te bewerk" +msgstr "E163: Daar is net een l�er om te bewerk" msgid "E164: Cannot go before first file" -msgstr "E164: Kan nie vóór die eerste lêer gaan nie" +msgstr "E164: Kan nie v��r die eerste l�er gaan nie" msgid "E165: Cannot go beyond last file" -msgstr "E165: Kan nie verby die laaste lêer gaan nie" +msgstr "E165: Kan nie verby die laaste l�er gaan nie" msgid "E166: Can't open linked file for writing" -msgstr "E166: Kan lêer nie oopmaak vir skryf nie" +msgstr "E166: Kan l�er nie oopmaak vir skryf nie" msgid "E167: :scriptencoding used outside of a sourced file" -msgstr "E167: ':scriptencoding' buite 'n uitvoerlêer gebruik" +msgstr "E167: ':scriptencoding' buite 'n uitvoerl�er gebruik" msgid "E168: :finish used outside of a sourced file" -msgstr "E168: ':finish' buite 'n uitvoerlêer gebruik" +msgstr "E168: ':finish' buite 'n uitvoerl�er gebruik" msgid "E169: Command too recursive" msgstr "E169: Bevel te rekursief" @@ -2991,10 +2991,10 @@ msgid "E171: Missing :endif" msgstr "E171: Ontbrekende ':endif'" msgid "E173: %d more file to edit" -msgstr "E173: Nog %d lêer om te bewerk" +msgstr "E173: Nog %d l�er om te bewerk" msgid "E173: %d more files to edit" -msgstr "E173: Nog %d lêers om te bewerk" +msgstr "E173: Nog %d l�ers om te bewerk" msgid "E174: Command already exists: add ! to replace it: %s" msgstr "E174: Bevel bestaan alreeds: gebruik ! om te herdefinieer: %s" @@ -3041,7 +3041,7 @@ msgstr "E187: Gids onbekend" msgid "E188: Obtaining window position not implemented for this platform" msgstr "" "E188: Verkryging van vensterposisie is nie vir hierdie platform " -"geïmplementeer nie" +"ge�mplementeer nie" msgid "E189: \"%s\" exists (add ! to override)" msgstr "E189: \"%s\" bestaan (gebruik ! om te dwing)" @@ -3057,10 +3057,10 @@ msgid "E192: Recursive use of :normal too deep" msgstr "E192: Rekursiewe gebruik van ':normal' te diep" msgid "E194: No alternate file name to substitute for '#'" -msgstr "E194: Geen alternatiewe lêernaam vir '#' nie" +msgstr "E194: Geen alternatiewe l�ernaam vir '#' nie" -msgid "E195: Cannot open viminfo file for reading" -msgstr "E195: Kan 'viminfo' lêer nie oopmaak om te lees nie" +msgid "E195: Cannot open mnvinfo file for reading" +msgstr "E195: Kan 'mnvinfo' l�er nie oopmaak om te lees nie" msgid "E196: No digraphs in this version" msgstr "E196: Geen digrawe in hierdie weergawe nie" @@ -3072,28 +3072,28 @@ msgid "E199: Active window or buffer deleted" msgstr "E199: Aktiewe venster of buffer geskrap" msgid "E200: *ReadPre autocommands made the file unreadable" -msgstr "E200: '*ReadPre' outobevele het die lêer onleesbaar gemaak" +msgstr "E200: '*ReadPre' outobevele het die l�er onleesbaar gemaak" msgid "E201: *ReadPre autocommands must not change current buffer" msgstr "E201: '*ReadPre' outobevele mag nie die huidige buffer verander nie" msgid "E202: Conversion made file unreadable!" -msgstr "E202: Omsetting het lêer onleesbaar gemaak!" +msgstr "E202: Omsetting het l�er onleesbaar gemaak!" msgid "E203: Autocommands deleted or unloaded buffer to be written" msgstr "E203: Outobevele het die skryfbuffer geskrap of uitgelaai" msgid "E204: Autocommand changed number of lines in unexpected way" -msgstr "E204: Outobevel het etlike reëls op onverwagse wyse verander " +msgstr "E204: Outobevel het etlike re�ls op onverwagse wyse verander " msgid "E205: patchmode: Can't save original file" -msgstr "E205: patchmode: Kan oorspronklike lêer nie stoor nie" +msgstr "E205: patchmode: Kan oorspronklike l�er nie stoor nie" msgid "E206: patchmode: Can't touch empty original file" -msgstr "E206: patchmode: Kan leë oorspronglêer nie 'touch' nie" +msgstr "E206: patchmode: Kan le� oorsprongl�er nie 'touch' nie" msgid "E207: Can't delete backup file" -msgstr "E207: Kan rugsteunlêer nie verwyder nie" +msgstr "E207: Kan rugsteunl�er nie verwyder nie" msgid "E208: Error writing to \"%s\"" msgstr "E208: Kan nie skryf na \"%s\"" @@ -3105,16 +3105,16 @@ msgid "E210: Error reading \"%s\"" msgstr "E210: Kan \"%s\" nie lees nie" msgid "E211: File \"%s\" no longer available" -msgstr "E211: Lêer \"%s\" is nie meer beskikbaar nie" +msgstr "E211: L�er \"%s\" is nie meer beskikbaar nie" msgid "E212: Can't open file for writing" -msgstr "E212: Kan lêer nie oopmaak vir skryf nie" +msgstr "E212: Kan l�er nie oopmaak vir skryf nie" msgid "E213: Cannot convert (add ! to write without conversion)" msgstr "E213: Kan nie omsit nie (gebruik ! om te skryf sonder omsetting)" msgid "E214: Can't find temp file for writing" -msgstr "E214: Kan nie tydelike lêer vind vir skryf nie" +msgstr "E214: Kan nie tydelike l�er vind vir skryf nie" msgid "E215: Illegal character after *: %s" msgstr "E215: Ongeldige karakter na *: %s" @@ -3210,8 +3210,8 @@ msgid "E250: Fonts for the following charsets are missing in fontset %s:" msgstr "" "E250: Fonte vir die volgende karakterstelle ontbreek in fontversameling %s:" -msgid "E251: VIM instance registry property is badly formed. Deleted!" -msgstr "E251: VIM instansie register-kenmerk is swak gevorm. Geskrap!" +msgid "E251: MNV instance registry property is badly formed. Deleted!" +msgstr "E251: MNV instansie register-kenmerk is swak gevorm. Geskrap!" msgid "E253: Fontset name: %s\n" msgstr "E253: Fontstel naam: %s\n" @@ -3223,7 +3223,7 @@ msgid "E257: cstag: Tag not found" msgstr "E257: 'cstag': Etiket nie gevind nie" msgid "E258: Unable to send to client" -msgstr "E258: Kan nie na kliënt stuur nie" +msgstr "E258: Kan nie na kli�nt stuur nie" msgid "E259: No matches found for cscope query %s of %s" msgstr "E259: Geen treffers gevind vir 'cscope' versoek %s van %s nie" @@ -3241,7 +3241,7 @@ msgid "" "E263: Sorry, this command is disabled, the Python library could not be " "loaded." msgstr "" -"E263: Jammer, hierdie bevel is afgeskakel, die Python biblioteek lêer kon " +"E263: Jammer, hierdie bevel is afgeskakel, die Python biblioteek l�er kon " "nie gelaai word nie." msgid "E264: Python: Error initialising I/O objects" @@ -3250,7 +3250,7 @@ msgstr "E264: Python: Kon nie I/O objekte inwy nie" msgid "" "E266: Sorry, this command is disabled, the Ruby library could not be loaded." msgstr "" -"E266: Jammer, hierdie bevel is afgeskakel, die Ruby biblioteeklêer kon nie " +"E266: Jammer, hierdie bevel is afgeskakel, die Ruby biblioteekl�er kon nie " "gelaai word nie." msgid "E273: Unknown longjmp status %d" @@ -3260,10 +3260,10 @@ msgid "E277: Unable to read a server reply" msgstr "E277: Kon bediener-terugvoer nie lees nie" msgid "" -"E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim." +"E280: TCL FATAL ERROR: reflist corrupt!? Please report this to mnv-dev@mnv." "org" msgstr "" -"E280: TCL FATALE FOUT: verwlys korrup!? Rapporteer dit asb. aan " msgid "E282: Cannot read from \"%s\"" @@ -3294,16 +3294,16 @@ msgid "E293: Block was not locked" msgstr "E293: Blok was nie gesluit nie" msgid "E294: Seek error in swap file read" -msgstr "E294: Soekfout in lees van ruillêer" +msgstr "E294: Soekfout in lees van ruill�er" msgid "E295: Read error in swap file" -msgstr "E295: Leesfout in ruillêer" +msgstr "E295: Leesfout in ruill�er" msgid "E296: Seek error in swap file write" -msgstr "E296: Soekfout in skryf van ruillêer" +msgstr "E296: Soekfout in skryf van ruill�er" msgid "E297: Write error in swap file" -msgstr "E297: Skryffout in ruillêer" +msgstr "E297: Skryffout in ruill�er" msgid "E298: Didn't get block nr 0?" msgstr "E298: Het nie blok no 0 gekry nie?" @@ -3318,37 +3318,37 @@ msgid "E299: Perl evaluation forbidden in sandbox without the Safe module" msgstr "E299: Perl evaluasie verbied in die sandput sonder die 'Safe' module" msgid "E300: Swap file already exists (symlink attack?)" -msgstr "E300: Ruillêer bestaan alreeds! ('symlink' probleem?)" +msgstr "E300: Ruill�er bestaan alreeds! ('symlink' probleem?)" msgid "E301: Oops, lost the swap file!!!" -msgstr "E301: Hiert, die ruillêer is weg!!!" +msgstr "E301: Hiert, die ruill�er is weg!!!" msgid "E302: Could not rename swap file" -msgstr "E302: Kon nie ruillêer vernoem nie" +msgstr "E302: Kon nie ruill�er vernoem nie" msgid "E303: Unable to open swap file for \"%s\", recovery impossible" -msgstr "E303: Kon nie ruillêer oopmaak vir \"%s\" nie, herwinning onmoontlik" +msgstr "E303: Kon nie ruill�er oopmaak vir \"%s\" nie, herwinning onmoontlik" msgid "E304: ml_upd_block0(): Didn't get block 0??" msgstr "E304: 'ml_upd_block0()': Het nie blok 0 gekry nie??" msgid "E305: No swap file found for %s" -msgstr "E305: Geen ruillêer gevind vir %s nie" +msgstr "E305: Geen ruill�er gevind vir %s nie" msgid "E306: Cannot open %s" msgstr "E306: Kan %s nie oopmaak nie" -msgid "E307: %s does not look like a Vim swap file" -msgstr "E307: %s lyk nie soos 'n Vim ruillêer nie" +msgid "E307: %s does not look like a MNV swap file" +msgstr "E307: %s lyk nie soos 'n MNV ruill�er nie" msgid "E308: Warning: Original file may have been changed" -msgstr "E308: Waarskuwing: Oorspronklike lêer is dalk gewysig" +msgstr "E308: Waarskuwing: Oorspronklike l�er is dalk gewysig" msgid "E309: Unable to read block 1 from %s" msgstr "E309: Kan nie block 1 lees van %s" msgid "E310: Block 1 ID wrong (%s not a .swp file?)" -msgstr "E310: Blok 1 se ID is foutief (%s nie 'n .swp lêer nie?)" +msgstr "E310: Blok 1 se ID is foutief (%s nie 'n .swp l�er nie?)" msgid "E311: Recovery Interrupted" msgstr "E311: Herwinning onderbreek" @@ -3356,10 +3356,10 @@ msgstr "E311: Herwinning onderbreek" msgid "" "E312: Errors detected while recovering; look for lines starting with ???" msgstr "" -"E312: Foute raakgesien gedurende herwinning; soek vir reëls wat begin met ???" +"E312: Foute raakgesien gedurende herwinning; soek vir re�ls wat begin met ???" msgid "E313: Cannot preserve, there is no swap file" -msgstr "E313: Kan nie bewaar nie, daar is geen ruillêer nie" +msgstr "E313: Kan nie bewaar nie, daar is geen ruill�er nie" msgid "E314: Preserve failed" msgstr "E314: Kon nie bewaar nie" @@ -3383,28 +3383,28 @@ msgid "E318: Updated too many blocks?" msgstr "E318: Te veel blokke opgedateer?" msgid "E319: Sorry, the command is not available in this version" -msgstr "E319: Jammer, die bevel is nie geïmplementeer nie" +msgstr "E319: Jammer, die bevel is nie ge�mplementeer nie" msgid "E320: Cannot find line %ld" -msgstr "E320: Kan nie reël %ld vind nie" +msgstr "E320: Kan nie re�l %ld vind nie" msgid "E321: Could not reload \"%s\"" msgstr "E321: Kon nie \"%s\" herlaai nie" msgid "E322: Line number out of range: %ld past the end" -msgstr "E322: Reëlnommer buite perke: %ld verby die einde" +msgstr "E322: Re�lnommer buite perke: %ld verby die einde" msgid "E323: Line count wrong in block %ld" -msgstr "E323: Reëltelling mag verkeerd wees in blok %ld" +msgstr "E323: Re�ltelling mag verkeerd wees in blok %ld" msgid "E324: Can't open PostScript output file" -msgstr "E324: Kan nie 'PostScript' afvoerlêer oopmaak nie" +msgstr "E324: Kan nie 'PostScript' afvoerl�er oopmaak nie" msgid "E325: ATTENTION" msgstr "E325: LET OP" msgid "E326: Too many swap files found" -msgstr "E326: Te veel ruillêers gevind" +msgstr "E326: Te veel ruill�ers gevind" msgid "E327: Part of menu-item path is not sub-menu" msgstr "E327: Deel van kieslys-item pad is nie 'n sub-kieslys nie" @@ -3437,7 +3437,7 @@ msgid "E337: Menu not found - check menu names" msgstr "E337: Kieslys nie gevind nie - maak seker oor die kieslys name" msgid "E338: Sorry, no file browser in console mode" -msgstr "E338: Jammer, lêerblaaier nie beskikbaar in konsole-modus nie" +msgstr "E338: Jammer, l�erblaaier nie beskikbaar in konsole-modus nie" msgid "E339: Pattern too long" msgstr "E339: Patroon te lank" @@ -3459,13 +3459,13 @@ msgid "E344: Can't find directory \"%s\" in cdpath" msgstr "E344: Kan nie gids \"%s\" in 'cdpath' vind nie" msgid "E345: Can't find file \"%s\" in path" -msgstr "E345: Kan lêer \"%s\" nie vind in pad nie" +msgstr "E345: Kan l�er \"%s\" nie vind in pad nie" msgid "E346: No more directory \"%s\" found in cdpath" msgstr "E346: Geen gids \"%s\" meer gevind in 'cdpath' nie" msgid "E347: No more file \"%s\" found in path" -msgstr "E347: Geen lêer \"%s\" meer gevind in pad nie" +msgstr "E347: Geen l�er \"%s\" meer gevind in pad nie" msgid "E348: No string under cursor" msgstr "E348: Geen string onder loper nie" @@ -3510,7 +3510,7 @@ msgid "E364: Library call failed for \"%s()\"" msgstr "E364: Biblioteekroep het gefaal vir \"%s\"()" msgid "E365: Failed to print PostScript file" -msgstr "E365: Kon nie 'PostScript' lêer druk nie" +msgstr "E365: Kon nie 'PostScript' l�er druk nie" msgid "E367: No such group: \"%s\"" msgstr "E367: Geen sodanige groep nie: \"%s\"" @@ -3546,7 +3546,7 @@ msgid "E378: 'errorformat' contains no pattern" msgstr "E378: 'errorformat' bevat geen patroon nie" msgid "E379: Missing or empty directory name" -msgstr "E379: Ontbrekende of leë gidsnaam" +msgstr "E379: Ontbrekende of le� gidsnaam" msgid "E380: At bottom of quickfix stack" msgstr "E380: Onder aan 'quickfix' stapel" @@ -3570,7 +3570,7 @@ msgid "E386: Expected '?' or '/' after ';'" msgstr "E386: Verwag '?' of '/' na ';'" msgid "E387: Match is on current line" -msgstr "E387: Treffer is op huidige reël" +msgstr "E387: Treffer is op huidige re�l" msgid "E388: Couldn't find definition" msgstr "E388: Kon definisie nie vind nie" @@ -3597,7 +3597,7 @@ msgid "E395: Contains argument not accepted here" msgstr "E395: Bevat parameters nie hier aanvaar nie" msgid "E397: Filename required" -msgstr "E397: Lêernaam benodig" +msgstr "E397: L�ernaam benodig" msgid "E398: Missing '=': %s" msgstr "E398: Ontbrekende '=': %s" @@ -3615,7 +3615,7 @@ msgid "E402: Garbage after pattern: %s" msgstr "E402: Gemors na patroon: %s" msgid "E403: syntax sync: Line continuations pattern specified twice" -msgstr "E403: sintaks sync: Reëlvoortgaanpatroon twee keer gespesifiseer" +msgstr "E403: sintaks sync: Re�lvoortgaanpatroon twee keer gespesifiseer" msgid "E404: Illegal arguments: %s" msgstr "E404: Ongeldige parameters: %s" @@ -3624,13 +3624,13 @@ msgid "E405: Missing equal sign: %s" msgstr "E405: Ontbrekende gelykaanteken: %s" msgid "E406: Empty argument: %s" -msgstr "E406: Leë parameter: %s" +msgstr "E406: Le� parameter: %s" msgid "E407: %s not allowed here" msgstr "E407: %s nie toegelaat hier nie" msgid "E408: %s must be first in contains list" -msgstr "E408: %s moet vóór in 'contains' lys wees" +msgstr "E408: %s moet v��r in 'contains' lys wees" msgid "E409: Unknown group name: %s" msgstr "E409: Onbekende groepnaam: %s" @@ -3649,7 +3649,7 @@ msgstr "E413: Te veel parameters: \":highlight link %s\"" msgid "E414: Group has settings, highlight link ignored" msgstr "" -"E414: Groep het instellings, uitligskakel ('highlight link') geïgnoreer" +"E414: Groep het instellings, uitligskakel ('highlight link') ge�gnoreer" msgid "E415: Unexpected equal sign: %s" msgstr "E415: Onverwagte gelykaanteken: %s" @@ -3682,7 +3682,7 @@ msgid "E424: Too many different highlighting attributes in use" msgstr "E424: Te veel verskillende uitlig-eienskappe in gebruik" msgid "E425: Cannot go before first matching tag" -msgstr "E425: Kan nie vóór eerste etiket-treffer gaan nie" +msgstr "E425: Kan nie v��r eerste etiket-treffer gaan nie" msgid "E426: Tag not found: %s" msgstr "E426: Etiket nie gevind nie: %s" @@ -3694,19 +3694,19 @@ msgid "E428: Cannot go beyond last matching tag" msgstr "E428: Kan nie verby laaste etiket-treffer gaan nie" msgid "E429: File \"%s\" does not exist" -msgstr "E429: Lêer \"%s\" bestaan nie" +msgstr "E429: L�er \"%s\" bestaan nie" msgid "E430: Tag file path truncated for %s\n" -msgstr "E430: Etiketlêergids afgekap vir %s\n" +msgstr "E430: Etiketl�ergids afgekap vir %s\n" msgid "E431: Format error in tags file \"%s\"" -msgstr "E431: Formaatfout in etiketlêer \"%s\"" +msgstr "E431: Formaatfout in etiketl�er \"%s\"" msgid "E432: Tags file not sorted: %s" -msgstr "E432: Etiketlêer ongesorteer: %s" +msgstr "E432: Etiketl�er ongesorteer: %s" msgid "E433: No tags file" -msgstr "E433: Geen etiketlêer nie" +msgstr "E433: Geen etiketl�er nie" msgid "E434: Can't find tag pattern" msgstr "E434: Kan nie etiketpatroon vind nie" @@ -3718,16 +3718,16 @@ msgid "E436: No \"%s\" entry in termcap" msgstr "E436: Geen \"%s\" inskrywing in termcap nie" msgid "E437: Terminal capability \"cm\" required" -msgstr "E437: Terminaalvermoë \"cm\" vereis" +msgstr "E437: Terminaalvermo� \"cm\" vereis" msgid "E438: u_undo: Line numbers wrong" -msgstr "E438: u_undo: Reëlnommers foutief" +msgstr "E438: u_undo: Re�lnommers foutief" msgid "E439: Undo list corrupt" msgstr "E439: Herstellys korrup" msgid "E440: Undo line missing" -msgstr "E440: Herstelreël ontbreek" +msgstr "E440: Herstelre�l ontbreek" msgid "E441: There is no preview window" msgstr "E441: Daar is nie 'n voorskou-venster nie" @@ -3745,10 +3745,10 @@ msgid "E445: Other window contains changes" msgstr "E445: Die ander venster bevat veranderinge" msgid "E446: No file name under cursor" -msgstr "E446: Geen lêernaam onder loper" +msgstr "E446: Geen l�ernaam onder loper" msgid "E447: Can't find file \"%s\" in path" -msgstr "E447: Kan lêer \"%s\" nie vind in pad nie" +msgstr "E447: Kan l�er \"%s\" nie vind in pad nie" msgid "E448: Could not load library function %s" msgstr "E448: Kon nie biblioteek funksie laai nie %s" @@ -3760,16 +3760,16 @@ msgid "E453: UL color unknown" msgstr "E453: UL kleur onbekend" msgid "E455: Error writing to PostScript output file" -msgstr "E455: Kan nie na 'PostScript' afvoerlêer skryf nie" +msgstr "E455: Kan nie na 'PostScript' afvoerl�er skryf nie" msgid "E456: Can't open file \"%s\"" -msgstr "E456: Kan nie lêer %s oopmaak nie" +msgstr "E456: Kan nie l�er %s oopmaak nie" msgid "E456: Can't find PostScript resource file \"%s.ps\"" -msgstr "E456: Kan nie 'PostScript' hulpbron-lêer \"%s\" vind nie" +msgstr "E456: Kan nie 'PostScript' hulpbron-l�er \"%s\" vind nie" msgid "E457: Can't read PostScript resource file \"%s\"" -msgstr "E457: Kan nie 'PostScript' hulpbron-lêer \"%s\" lees nie" +msgstr "E457: Kan nie 'PostScript' hulpbron-l�er \"%s\" lees nie" msgid "E458: Cannot allocate colormap entry, some colors may be incorrect" msgstr "" @@ -3849,16 +3849,16 @@ msgid "E481: No range allowed" msgstr "E481: Geen omvang toegelaat nie" msgid "E482: Can't create file %s" -msgstr "E482: Kan nie lêer %s skep nie" +msgstr "E482: Kan nie l�er %s skep nie" msgid "E483: Can't get temp file name" -msgstr "E483: Kan nie tydelike lêernaam kry nie" +msgstr "E483: Kan nie tydelike l�ernaam kry nie" msgid "E484: Can't open file %s" -msgstr "E484: Kan nie lêer %s oopmaak nie" +msgstr "E484: Kan nie l�er %s oopmaak nie" msgid "E485: Can't read file %s" -msgstr "E485: Kan nie lêer %s lees nie" +msgstr "E485: Kan nie l�er %s lees nie" msgid "E486: Pattern not found" msgstr "E486: Patroon nie gevind nie" @@ -3888,7 +3888,7 @@ msgid "E494: Use w or w>>" msgstr "E494: Gebruik w of w>>" msgid "E495: No autocommand file name to substitute for \"\"" -msgstr "E495: Geen outobevel-lêernaam om \"\" mee te vervang nie" +msgstr "E495: Geen outobevel-l�ernaam om \"\" mee te vervang nie" msgid "E496: No autocommand buffer number to substitute for \"\"" msgstr "E496: Geen outobevel buffernommer om \"\" mee te vervang nie" @@ -3897,44 +3897,44 @@ msgid "E497: No autocommand match name to substitute for \"\"" msgstr "E497: Geen outobevel treffernaam om \"\" mee te vervang nie" msgid "E498: No :source file name to substitute for \"\"" -msgstr "E498: Geen ':source' lêernaam om \"\" mee te vervang nie" +msgstr "E498: Geen ':source' l�ernaam om \"\" mee te vervang nie" #, no-c-format msgid "E499: Empty file name for '%' or '#', only works with \":p:h\"" -msgstr "E499: Leë lêernaam vir '%' of '#', werk slegs met \":p:h\"" +msgstr "E499: Le� l�ernaam vir '%' of '#', werk slegs met \":p:h\"" msgid "E500: Evaluates to an empty string" -msgstr "E500: Evalueer na 'n leë string" +msgstr "E500: Evalueer na 'n le� string" msgid "E501: At end-of-file" -msgstr "E501: By lêereinde" +msgstr "E501: By l�ereinde" msgid "is not a file or writable device" -msgstr "is nie 'n lêer of 'n skryfbare toestel nie" +msgstr "is nie 'n l�er of 'n skryfbare toestel nie" msgid "is read-only (add ! to override)" msgstr "is lees-alleen (gebruik ! om te dwing)" msgid "E506: Can't write to backup file (add ! to override)" -msgstr "E506: Kan nie na rugsteunlêer skryf nie (gebruik ! om te dwing)" +msgstr "E506: Kan nie na rugsteunl�er skryf nie (gebruik ! om te dwing)" msgid "E507: Close error for backup file (add ! to write anyway)" -msgstr "E507: Sluitfout vir rugsteunlêer (gebruik ! om te dwing)" +msgstr "E507: Sluitfout vir rugsteunl�er (gebruik ! om te dwing)" msgid "E508: Can't read file for backup (add ! to write anyway)" -msgstr "E508: Kan rugsteunlêer nie lees nie (gebruik ! om te dwing)" +msgstr "E508: Kan rugsteunl�er nie lees nie (gebruik ! om te dwing)" msgid "E509: Cannot create backup file (add ! to override)" -msgstr "E509: Kan rugsteunlêer nie skep nie (gebruik ! om te dwing)" +msgstr "E509: Kan rugsteunl�er nie skep nie (gebruik ! om te dwing)" msgid "E510: Can't make backup file (add ! to write anyway)" -msgstr "E510: Kan rugsteunlêer nie skep nie (gebruik ! om te dwing)" +msgstr "E510: Kan rugsteunl�er nie skep nie (gebruik ! om te dwing)" msgid "E512: Close failed" msgstr "E512: Sluiting gefaal" msgid "E514: Write error (file system full?)" -msgstr "E514: Skryffout (lêerstelsel vol?)" +msgstr "E514: Skryffout (l�erstelsel vol?)" msgid "E515: No buffers were unloaded" msgstr "E515: Geen buffers is uitgelaai nie" @@ -3982,7 +3982,7 @@ msgid "E528: Must specify a ' value" msgstr "E528: Moet 'n ' waarde spesifiseer" msgid "E529: Cannot set 'term' to empty string" -msgstr "E529: Kan nie 'term' stel na leë string nie" +msgstr "E529: Kan nie 'term' stel na le� string nie" msgid "E530: Cannot change 'term' in the GUI" msgstr "E530: Kan nie 'term' verander in GUI nie" @@ -4006,7 +4006,7 @@ msgid "E537: 'commentstring' must be empty or contain %s" msgstr "E537: 'commentstring' moet leeg wees of %s bevat" msgid "E538: Pattern found in every line: %s" -msgstr "E538: Patroon gevind in elke reël: %s" +msgstr "E538: Patroon gevind in elke re�l: %s" msgid "E539: Illegal character <%s>" msgstr "E539: Ongeldige karakter <%s>" @@ -4021,7 +4021,7 @@ msgid "E543: Not a valid codepage" msgstr "E543: Nie 'n geldige kodeblad nie" msgid "E544: Keymap file not found" -msgstr "E544: Sleutelbindinglêer nie gevind nie" +msgstr "E544: Sleutelbindingl�er nie gevind nie" msgid "E545: Missing colon" msgstr "E545: Ontbrekende dubbelpunt" @@ -4060,7 +4060,7 @@ msgid "E556: At top of tag stack" msgstr "E556: Bo-aan etiketstapel" msgid "E557: Cannot open termcap file" -msgstr "E557: Kan nie 'termcap'-lêer oopmaak nie" +msgstr "E557: Kan nie 'termcap'-l�er oopmaak nie" msgid "E558: Terminal entry not found in terminfo" msgstr "E558: Terminaalinskrywing nie in 'terminfo' gevind nie" @@ -4165,7 +4165,7 @@ msgid "E592: 'winwidth' cannot be smaller than 'winminwidth'" msgstr "E592: 'winwidth' kan nie kleiner as 'winminwidth' wees nie" msgid "E593: Need at least %d lines" -msgstr "E593: Benodig ten minste %d reëls" +msgstr "E593: Benodig ten minste %d re�ls" msgid "E594: Need at least %d columns" msgstr "E594: Benodig ten minste %d kolomme" @@ -4209,8 +4209,8 @@ msgstr "E606: ':finally' sonder ':try'" msgid "E607: Multiple :finally" msgstr "E607: Meer as een ':finally'" -msgid "E608: Cannot :throw exceptions with 'Vim' prefix" -msgstr "E608: Kan nie uitsonderings ':throw' met 'Vim' voorvoegsel nie" +msgid "E608: Cannot :throw exceptions with 'MNV' prefix" +msgstr "E608: Kan nie uitsonderings ':throw' met 'MNV' voorvoegsel nie" msgid "E609: Cscope error: %s" msgstr "E609: Cscope fout: %s" @@ -4225,14 +4225,14 @@ msgid "E617: Cannot be changed in the GTK GUI" msgstr "E617: Kan nie in die GTK GUI verander word nie" msgid "E618: File \"%s\" is not a PostScript resource file" -msgstr "E618: Lêer \"%s\" is nie 'n 'PostScript' hulpbron-lêer nie" +msgstr "E618: L�er \"%s\" is nie 'n 'PostScript' hulpbron-l�er nie" msgid "E619: File \"%s\" is not a supported PostScript resource file" msgstr "" -"E619: Lêer \"%s\" is nie 'n ondersteunde 'PostScript' hulpbron-lêer nie" +"E619: L�er \"%s\" is nie 'n ondersteunde 'PostScript' hulpbron-l�er nie" msgid "E621: \"%s\" resource file has wrong version" -msgstr "E621: \"%s\" die hulpbron lêer het die verkeerde weergawe" +msgstr "E621: \"%s\" die hulpbron l�er het die verkeerde weergawe" msgid "E622: Could not fork for cscope" msgstr "E622: Kon nie vurk vir 'cscope' nie" @@ -4241,7 +4241,7 @@ msgid "E623: Could not spawn cscope process" msgstr "E623: Kon nie 'cscope' proses skep nie" msgid "E624: Can't open file \"%s\"" -msgstr "E624: Kan nie lêer \"%s\" oopmaak nie" +msgstr "E624: Kan nie l�er \"%s\" oopmaak nie" msgid "E625: Cannot open cscope database: %s" msgstr "E625: Kon nie 'cscope' databasis oopmaak nie: %s" @@ -4287,13 +4287,13 @@ msgstr "E667: 'Fsync' het gefaal" msgid "E668: Wrong access mode for NetBeans connection info file: \"%s\"" msgstr "" -"E668: Verkeerde toegangsmodue vir NetBeans konneksie inligtingslêer: \"%s\"" +"E668: Verkeerde toegangsmodue vir NetBeans konneksie inligtingsl�er: \"%s\"" msgid "E669: Unprintable character in group name" msgstr "E669: Onvertoonbare karakter in groepnaam" msgid "E670: Mix of help file encodings within a language: %s" -msgstr "E670: 'n Mengsel van hulplêer enkoderings in 'n taal: %s" +msgstr "E670: 'n Mengsel van hulpl�er enkoderings in 'n taal: %s" msgid "E671: Cannot find window title \"%s\"" msgstr "E671: Kan nie venster titel vind nie \"%s\"" @@ -4304,8 +4304,8 @@ msgstr "E672: Kon nie venster oopmaak binne 'n MDI toepassing nie" msgid "E678: Invalid character after %s%%[dxouU]" msgstr "E678: Ongeldige karakter na %s%%[dxouU]" -msgid "E679: Recursive loop loading syncolor.vim" -msgstr "E679: Rekursiewe lus gedurende laai van syncolor.vim" +msgid "E679: Recursive loop loading syncolor.mnv" +msgstr "E679: Rekursiewe lus gedurende laai van syncolor.mnv" msgid "E680: : invalid buffer number" msgstr "E680: : ongeldige buffernommer" @@ -4360,7 +4360,7 @@ msgid "E964: Invalid column number: %ld" msgstr "E964: Ongeldige kolomnommer: %ld" msgid "E966: Invalid line number: %ld" -msgstr "E966: Ongeldige reëlnommer: %ld" +msgstr "E966: Ongeldige re�lnommer: %ld" msgid "E983: Duplicate argument: %s" msgstr "E983: Duplikaat parameter: %s" @@ -4405,7 +4405,7 @@ msgid "E1279: Missing '}': %s" msgstr "E1279: Ontbrekende '}': %s" msgid "--No lines in buffer--" -msgstr "--Geen reëls in buffer--" +msgstr "--Geen re�ls in buffer--" msgid "search hit TOP, continuing at BOTTOM" msgstr "soektog het BO getref, gaan voort van ONDER af" @@ -4414,7 +4414,7 @@ msgid "search hit BOTTOM, continuing at TOP" msgstr "soektog het ONDER getref, gaan voort van BO af" msgid " line " -msgstr " reël " +msgstr " re�l " msgid "can't delete OutputObject attributes" msgstr "kan nie 'OutputObject' eienskappe skrap nie" diff --git a/uvim/src/po/big5corr.c b/uvim/src/po/big5corr.c index de8045e444..d080525f59 100644 --- a/uvim/src/po/big5corr.c +++ b/uvim/src/po/big5corr.c @@ -7,9 +7,9 @@ /* * 06.11.23, added by Restorer: * For more details, see: - * https://github.com/vim/vim/pull/3261 - * https://github.com/vim/vim/pull/3476 - * https://github.com/vim/vim/pull/12153 + * https://github.com/Project-Tick/Project-Tick/pull/3261 + * https://github.com/Project-Tick/Project-Tick/pull/3476 + * https://github.com/Project-Tick/Project-Tick/pull/12153 * (read all comments) * * I checked the workability on the list of backslash characters diff --git a/uvim/src/po/ca.po b/uvim/src/po/ca.po index 052caad20e..7e51ccafcf 100644 --- a/uvim/src/po/ca.po +++ b/uvim/src/po/ca.po @@ -1,14 +1,14 @@ -# Catalan messages for vim. -# Copyright (C) 2003-2022 Ernest Adrogué . -# This file is distributed under the Vim License. +# Catalan messages for mnv. +# Copyright (C) 2003-2022 Ernest Adrogu� . +# This file is distributed under the MNV License. # msgid "" msgstr "" -"Project-Id-Version: vim 9.0\n" +"Project-Id-Version: mnv 9.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-12-06 11:03+0100\n" "PO-Revision-Date: 2022-12-11 16:59+0100\n" -"Last-Translator: Ernest Adrogué \n" +"Last-Translator: Ernest Adrogu� \n" "Language-Team: Catalan \n" "Language: ca\n" "MIME-Version: 1.0\n" @@ -25,7 +25,7 @@ msgid "" "[bytes] total alloc-freed %lu-%lu, in use %lu, peak use %lu\n" msgstr "" "\n" -"[octets] total assignat-alliberat %lu-%lu, en ús %lu, màxim ús %lu\n" +"[octets] total assignat-alliberat %lu-%lu, en �s %lu, m�xim �s %lu\n" #, c-format msgid "" @@ -40,27 +40,27 @@ msgstr "--Eliminat--" #, c-format msgid "auto-removing autocommand: %s " -msgstr "s'elimina l'ordre automàtica: %s " +msgstr "s'elimina l'ordre autom�tica: %s " msgid "W19: Deleting augroup that is still in use" -msgstr "W19: S'elimina un grup d'ordres automàtiques que està en ús" +msgstr "W19: S'elimina un grup d'ordres autom�tiques que est� en �s" msgid "" "\n" "--- Autocommands ---" msgstr "" "\n" -"--- Ordres automàtiques ---" +"--- Ordres autom�tiques ---" #, c-format msgid "No matching autocommands: %s" -msgstr "No hi ha ordres automàtiques coincidents: %s" +msgstr "No hi ha ordres autom�tiques coincidents: %s" # todo: substitucions # ... #, c-format msgid "%s Autocommands for \"%s\"" -msgstr "Ordres automàtiques de %s per a \"%s\"" +msgstr "Ordres autom�tiques de %s per a \"%s\"" #, c-format msgid "Executing %s" @@ -68,7 +68,7 @@ msgstr "Executant %s" #, c-format msgid "autocommand %s" -msgstr "ordre automàtica %s" +msgstr "ordre autom�tica %s" msgid "add() argument" msgstr "argument a add()" @@ -97,15 +97,15 @@ msgstr[1] "S'han eliminat %d buffers" #, c-format msgid "%d buffer wiped out" msgid_plural "%d buffers wiped out" -msgstr[0] "S'ha destruït %d buffer" -msgstr[1] "S'han destruït %d buffers" +msgstr[0] "S'ha destru�t %d buffer" +msgstr[1] "S'han destru�t %d buffers" msgid "W14: Warning: List of file names overflow" -msgstr "W14: Atenció: S'ha desbordat la llista de noms de fitxers" +msgstr "W14: Atenci�: S'ha desbordat la llista de noms de fitxers" #, c-format msgid "line %ld" -msgstr "línia %ld" +msgstr "l�nia %ld" msgid " [Modified]" msgstr " [Modificat]" @@ -121,17 +121,17 @@ msgid "[RO]" msgstr "[NL]" msgid "[readonly]" -msgstr "[només lectura]" +msgstr "[nom�s lectura]" #, c-format msgid "%ld line --%d%%--" msgid_plural "%ld lines --%d%%--" -msgstr[0] "%ld línia --%d%%--" -msgstr[1] "%ld línies --%d%%--" +msgstr[0] "%ld l�nia --%d%%--" +msgstr[1] "%ld l�nies --%d%%--" #, c-format msgid "line %ld of %ld --%d%%-- col " -msgstr "línia %ld de %ld --%d%%-- col " +msgstr "l�nia %ld de %ld --%d%%-- col " msgid "[No Name]" msgstr "[Sense nom]" @@ -143,7 +143,7 @@ msgid "[Help]" msgstr "[Ajuda]" msgid "[Preview]" -msgstr "[Vista prèvia]" +msgstr "[Vista pr�via]" msgid "All" msgstr "Tot" @@ -165,7 +165,7 @@ msgid "[Scratch]" msgstr "[Esborrany]" msgid "WARNING: The file has been changed since reading it!!!" -msgstr "ATENCIÓ: El fitxer ha canviat des de que s'ha llegit!!!" +msgstr "ATENCI�: El fitxer ha canviat des de que s'ha llegit!!!" # pregunta ask_yesno() msgid "Do you really want to write to it" @@ -178,11 +178,11 @@ msgid "[New File]" msgstr "[Fitxer nou]" msgid " CONVERSION ERROR" -msgstr " ERROR DE CONVERSIÓ" +msgstr " ERROR DE CONVERSI�" #, c-format msgid " in line %ld;" -msgstr " a la línia %ld" +msgstr " a la l�nia %ld" msgid "[NOT converted]" msgstr "[NO convertit]" @@ -210,13 +210,13 @@ msgid "" "WARNING: Original file may be lost or damaged\n" msgstr "" "\n" -"ATENCIÓ: El fitxer original es pot haver perdut o fet malbé\n" +"ATENCI�: El fitxer original es pot haver perdut o fet malb�\n" msgid "don't quit the editor until the file is successfully written!" -msgstr "no sortiu de l'editor fins que s'hagi desat el fitxer amb èxit!" +msgstr "no sortiu de l'editor fins que s'hagi desat el fitxer amb �xit!" msgid "W10: Warning: Changing a readonly file" -msgstr "W10: Atenció: S'està modificant un fitxer de només lectura" +msgstr "W10: Atenci�: S'est� modificant un fitxer de nom�s lectura" msgid "No display" msgstr "No hi ha cap pantalla" @@ -225,20 +225,20 @@ msgid ": Send failed.\n" msgstr ": Error en enviar.\n" msgid ": Send failed. Trying to execute locally\n" -msgstr ": Error en enviar. Intentant executar vim localment\n" +msgstr ": Error en enviar. Intentant executar mnv localment\n" #, c-format msgid "%d of %d edited" msgstr "editat %d de %d" msgid "No display: Send expression failed.\n" -msgstr "No hi ha cap pantalla: Error en enviar l'expressió.\n" +msgstr "No hi ha cap pantalla: Error en enviar l'expressi�.\n" msgid ": Send expression failed.\n" -msgstr ": Error en enviar l'expressió.\n" +msgstr ": Error en enviar l'expressi�.\n" msgid "Used CUT_BUFFER0 instead of empty selection" -msgstr "S'ha usat CUT_BUFFER0 en lloc d'una selecció buida" +msgstr "S'ha usat CUT_BUFFER0 en lloc d'una selecci� buida" # :set wop=tagfile # :ts @@ -250,19 +250,19 @@ msgid " kind file\n" msgstr " tip fitxer\n" msgid "'history' option is zero" -msgstr "el valor de 'history' és zero" +msgstr "el valor de 'history' �s zero" msgid "Warning: Using a weak encryption method; see :help 'cm'" -msgstr "Atenció: esteu utilitzant un xifratge poc potent; vegeu :help 'cm'" +msgstr "Atenci�: esteu utilitzant un xifratge poc potent; vegeu :help 'cm'" msgid "Note: Encryption of swapfile not supported, disabling swap file" msgstr "Nota: No se suporta xifratge en el fitxer d'intercanvi, es deshabilita" msgid "Enter encryption key: " -msgstr "Introduïu la clau de xifratge: " +msgstr "Introdu�u la clau de xifratge: " msgid "Enter same key again: " -msgstr "Introduïu la mateixa clau un altre cop: " +msgstr "Introdu�u la mateixa clau un altre cop: " msgid "Keys don't match!" msgstr "Les claus no coincideixen!" @@ -271,7 +271,7 @@ msgid "[crypted]" msgstr "[xifrat]" msgid "Entering Debug mode. Type \"cont\" to continue." -msgstr "Mode de depuració. Escriviu \"cont\" per a continuar." +msgstr "Mode de depuraci�. Escriviu \"cont\" per a continuar." #, c-format msgid "Oldval = \"%s\"" @@ -283,29 +283,29 @@ msgstr "Valor nou = \"%s\"" #, c-format msgid "line %ld: %s" -msgstr "línia %ld: %s" +msgstr "l�nia %ld: %s" #, c-format msgid "cmd: %s" msgstr "ordre: %s" msgid "frame is zero" -msgstr "el marc és zero" +msgstr "el marc �s zero" #, c-format msgid "frame at highest level: %d" -msgstr "marc al nivell màxim: %d" +msgstr "marc al nivell m�xim: %d" #, c-format msgid "Breakpoint in \"%s%s\" line %ld" -msgstr "Punt de ruptura a \"%s%s\" línia %ld" +msgstr "Punt de ruptura a \"%s%s\" l�nia %ld" msgid "No breakpoints defined" msgstr "No s'han definit punts de ruptura" #, c-format msgid "%3d %s %s line %ld" -msgstr "%3d %s %s línia %ld" +msgstr "%3d %s %s l�nia %ld" #, c-format msgid "%3d expr %s" @@ -316,47 +316,47 @@ msgstr "%3d expr %s" # :lockvar foo # :echo extend(foo, bar) # -# la forma fun() argument es repeteix més avall +# la forma fun() argument es repeteix m�s avall msgid "extend() argument" msgstr "argument a extend()" #, c-format msgid "Not enough memory to use internal diff for buffer \"%s\"" -msgstr "No hi ha prou memòria per a computar diferències per al buffer \"%s\"" +msgstr "No hi ha prou mem�ria per a computar difer�ncies per al buffer \"%s\"" -# És el nom d'un diàleg. Menú "Split patched by..." +# �s el nom d'un di�leg. Men� "Split patched by..." msgid "Patch file" -msgstr "Fitxer de diferències" +msgstr "Fitxer de difer�ncies" msgid "Custom" msgstr "Personalitzat" msgid "Latin supplement" -msgstr "Suplement llatí" +msgstr "Suplement llat�" msgid "Greek and Coptic" -msgstr "Grec i còptic" +msgstr "Grec i c�ptic" msgid "Cyrillic" -msgstr "Ciríl·lic" +msgstr "Cir�l�lic" msgid "Hebrew" msgstr "Hebreu" msgid "Arabic" -msgstr "Àrab" +msgstr "�rab" msgid "Latin extended" -msgstr "Llatí estès" +msgstr "Llat� est�s" msgid "Greek extended" -msgstr "Grec estès" +msgstr "Grec est�s" msgid "Punctuation" -msgstr "Puntuació" +msgstr "Puntuaci�" msgid "Super- and subscripts" -msgstr "Superíndexs i subíndexs" +msgstr "Super�ndexs i sub�ndexs" msgid "Currency" msgstr "Moneda" @@ -365,16 +365,16 @@ msgid "Other" msgstr "Altres" msgid "Roman numbers" -msgstr "Números romans" +msgstr "N�meros romans" msgid "Arrows" msgstr "Fletxes" msgid "Mathematical operators" -msgstr "Operadors matemàtics" +msgstr "Operadors matem�tics" msgid "Technical" -msgstr "Tècnic" +msgstr "T�cnic" msgid "Box drawing" msgstr "Caixes" @@ -383,16 +383,16 @@ msgid "Block elements" msgstr "Elements de bloc" msgid "Geometric shapes" -msgstr "Formes geomètriques" +msgstr "Formes geom�triques" msgid "Symbols" -msgstr "Símbols" +msgstr "S�mbols" msgid "Dingbats" msgstr "Dingbats" msgid "CJK symbols and punctuation" -msgstr "Símbols i puntuació CJK" +msgstr "S�mbols i puntuaci� CJK" msgid "Hiragana" msgstr "Hiragana" @@ -404,14 +404,14 @@ msgid "Bopomofo" msgstr "Bopomofo" msgid "Not enough memory to set references, garbage collection aborted!" -msgstr "No hi ha prou memòria, s'avorta el col·lector de brossa!" +msgstr "No hi ha prou mem�ria, s'avorta el col�lector de brossa!" msgid "" "\n" "\tLast set from " msgstr "" "\n" -"\tDefinit per últim cop a " +"\tDefinit per �ltim cop a " msgid "&Ok" msgstr "&D'acord" @@ -421,10 +421,10 @@ msgid "" "&Cancel" msgstr "" "&D'acord\n" -"&Cancel·la" +"&Cancel�la" msgid "called inputrestore() more often than inputsave()" -msgstr "s'ha cridat inputrestore() més sovint que inputsave()" +msgstr "s'ha cridat inputrestore() m�s sovint que inputsave()" # E.G: :ascii #, c-format @@ -459,15 +459,15 @@ msgstr "> %d, Hex %08x, Octal %o" #, c-format msgid "%ld line moved" msgid_plural "%ld lines moved" -msgstr[0] "%ld línies desplaçades" -msgstr[1] "%ld línies desplaçades" +msgstr[0] "%ld l�nies despla�ades" +msgstr[1] "%ld l�nies despla�ades" #, c-format msgid "%ld lines filtered" -msgstr "%ld línies filtrades" +msgstr "%ld l�nies filtrades" msgid "[No write since last change]\n" -msgstr "[No s'han desat els últims canvis]\n" +msgstr "[No s'han desat els �ltims canvis]\n" # GUI :browse w msgid "Save As" @@ -489,7 +489,7 @@ msgid "" "'readonly' option is set for \"%s\".\n" "Do you wish to write anyway?" msgstr "" -"S'ha establert l'opció 'readonly' per a \"%s\".\n" +"S'ha establert l'opci� 'readonly' per a \"%s\".\n" "El voleu escriure de totes maneres?" #, c-format @@ -498,8 +498,8 @@ msgid "" "It may still be possible to write it.\n" "Do you wish to try?" msgstr "" -"El fitxer \"%s\" és de només lectura.\n" -"Tot i això és possible escriure-hi.\n" +"El fitxer \"%s\" �s de nom�s lectura.\n" +"Tot i aix� �s possible escriure-hi.\n" "Voleu intentar-ho?" # :browse edit @@ -516,34 +516,34 @@ msgstr "(Interromput) " #, c-format msgid "%ld match on %ld line" msgid_plural "%ld matches on %ld line" -msgstr[0] "%ld coincidència a %ld línia" -msgstr[1] "%ld coincidències a %ld línia" +msgstr[0] "%ld coincid�ncia a %ld l�nia" +msgstr[1] "%ld coincid�ncies a %ld l�nia" #, c-format msgid "%ld substitution on %ld line" msgid_plural "%ld substitutions on %ld line" -msgstr[0] "%ld substitució a %ld línia" -msgstr[1] "%ld substitucions a %ld línia" +msgstr[0] "%ld substituci� a %ld l�nia" +msgstr[1] "%ld substitucions a %ld l�nia" #, c-format msgid "%ld match on %ld lines" msgid_plural "%ld matches on %ld lines" -msgstr[0] "%ld coincidència a %ld línies" -msgstr[1] "%ld coincidències a %ld línies" +msgstr[0] "%ld coincid�ncia a %ld l�nies" +msgstr[1] "%ld coincid�ncies a %ld l�nies" #, c-format msgid "%ld substitution on %ld lines" msgid_plural "%ld substitutions on %ld lines" -msgstr[0] "%ld substitució a %ld línies" -msgstr[1] "%ld substitucions a %ld línies" +msgstr[0] "%ld substituci� a %ld l�nies" +msgstr[1] "%ld substitucions a %ld l�nies" #, c-format msgid "Pattern found in every line: %s" -msgstr "El patró apareix a totes les línies: %s" +msgstr "El patr� apareix a totes les l�nies: %s" #, c-format msgid "Pattern not found: %s" -msgstr "No s'ha trobat el patró: %s" +msgstr "No s'ha trobat el patr�: %s" msgid "No old files" msgstr "No hi ha fitxers antics" @@ -553,15 +553,15 @@ msgid "Save changes to \"%s\"?" msgstr "Voleu desar els canvis a \"%s\"?" msgid "Warning: Entered other buffer unexpectedly (check autocommands)" -msgstr "Atenció: S'ha canviat de buffer (reviseu les ordres automàtiques)" +msgstr "Atenci�: S'ha canviat de buffer (reviseu les ordres autom�tiques)" #, c-format msgid "W20: Required python version 2.x not supported, ignoring file: %s" -msgstr "W20: La versió 2.x de Python està suportada, s'ignora: %s" +msgstr "W20: La versi� 2.x de Python est� suportada, s'ignora: %s" #, c-format msgid "W21: Required python version 3.x not supported, ignoring file: %s" -msgstr "W21: La versió 3.x de Python no està suportada, s'ignora: %s" +msgstr "W21: La versi� 3.x de Python no est� suportada, s'ignora: %s" msgid "Entering Ex mode. Type \"visual\" to go to Normal mode." msgstr "Mode Ex. Escriviu \"visual\" per a tornar al mode Normal." @@ -574,9 +574,9 @@ msgid "End of sourced file" msgstr "Final de l'script" msgid "End of function" -msgstr "Final de la funció" +msgstr "Final de la funci�" -# és una pregunta. +# �s una pregunta. msgid "Backwards range given, OK to swap" msgstr "Interval decreixent. El voleu invertir" @@ -595,11 +595,11 @@ msgstr[1] "Queden %d fitxers per editar. Voleu sortir de totes maneres?" msgid "unknown" msgstr "desconegut" -msgid "Greetings, Vim user!" -msgstr "Salutacions, usuari del Vim!" +msgid "Greetings, MNV user!" +msgstr "Salutacions, usuari del MNV!" msgid "Already only one tab page" -msgstr "Només hi ha una pestanya" +msgstr "Nom�s hi ha una pestanya" # :browse split msgid "Edit File in new tab page" @@ -622,33 +622,33 @@ msgstr "Afegeix un fitxer" #, c-format msgid "Window position: X %d, Y %d" -msgstr "Posició de la finestra: X %d, Y %d" +msgstr "Posici� de la finestra: X %d, Y %d" msgid "Save Redirection" -msgstr "Desa la redirecció" +msgstr "Desa la redirecci�" msgid "Untitled" msgstr "Sense-nom" #, c-format msgid "Exception thrown: %s" -msgstr "Excepció generada: %s" +msgstr "Excepci� generada: %s" #, c-format msgid "Exception finished: %s" -msgstr "Excepció finalitzada: %s" +msgstr "Excepci� finalitzada: %s" #, c-format msgid "Exception discarded: %s" -msgstr "Excepció descartada: %s" +msgstr "Excepci� descartada: %s" #, c-format msgid "%s, line %ld" -msgstr "%s, línia %ld" +msgstr "%s, l�nia %ld" #, c-format msgid "Exception caught: %s" -msgstr "Excepció interceptada: %s" +msgstr "Excepci� interceptada: %s" #, c-format msgid "%s made pending" @@ -656,38 +656,38 @@ msgstr "%s s'ha posposat" #, c-format msgid "%s resumed" -msgstr "%s s'ha reprès" +msgstr "%s s'ha repr�s" #, c-format msgid "%s discarded" msgstr "%s s'ha descartat" msgid "Exception" -msgstr "Excepció" +msgstr "Excepci�" msgid "Error and interrupt" -msgstr "Error i interrupció" +msgstr "Error i interrupci�" msgid "Error" msgstr "Error" msgid "Interrupt" -msgstr "Interrupció" +msgstr "Interrupci�" msgid "[Command Line]" -msgstr "[Línia d'ordres]" +msgstr "[L�nia d'ordres]" msgid "is a directory" -msgstr "és un directori" +msgstr "�s un directori" msgid "Illegal file name" -msgstr "El nom de fitxer és il·legal" +msgstr "El nom de fitxer �s il�legal" msgid "is not a file" -msgstr "no és un fitxer" +msgstr "no �s un fitxer" msgid "is a device (disabled with 'opendevice' option)" -msgstr "és un dispositiu (deshabilitat amb el paràmetre 'opendevice')" +msgstr "�s un dispositiu (deshabilitat amb el par�metre 'opendevice')" msgid "[New DIRECTORY]" msgstr "[Nou DIRECTORI]" @@ -696,13 +696,13 @@ msgid "[File too big]" msgstr "[Fitxer massa gran]" msgid "[Permission Denied]" -msgstr "[Permís denegat]" +msgstr "[Perm�s denegat]" -msgid "Vim: Reading from stdin...\n" -msgstr "Vim: Llegint l'entrada estàndard...\n" +msgid "MNV: Reading from stdin...\n" +msgstr "MNV: Llegint l'entrada est�ndard...\n" msgid "Reading from stdin..." -msgstr "Llegint l'entrada estàndard..." +msgstr "Llegint l'entrada est�ndard..." msgid "[fifo]" msgstr "[fifo]" @@ -711,30 +711,30 @@ msgid "[socket]" msgstr "[socket]" msgid "[character special]" -msgstr "[caràcter especial]" +msgstr "[car�cter especial]" msgid "[CR missing]" msgstr "[falta retorn-de-carro]" msgid "[long lines split]" -msgstr "[línies llargues partides]" +msgstr "[l�nies llargues partides]" #, c-format msgid "[CONVERSION ERROR in line %ld]" -msgstr "[ERROR DE CONVERSIÓ a la línia %ld]" +msgstr "[ERROR DE CONVERSI� a la l�nia %ld]" #, c-format msgid "[ILLEGAL BYTE in line %ld]" -msgstr "[OCTET IL·LEGAL a la línia %ld]" +msgstr "[OCTET IL�LEGAL a la l�nia %ld]" msgid "[READ ERRORS]" msgstr "[ERRORS DE LECTURA]" msgid "Can't find temp file for conversion" -msgstr "No s'ha trobat el fitxer temporal per a fer la conversió" +msgstr "No s'ha trobat el fitxer temporal per a fer la conversi�" msgid "Conversion with 'charconvert' failed" -msgstr "La conversió amb 'charconvert' ha fallat" +msgstr "La conversi� amb 'charconvert' ha fallat" msgid "can't read output of 'charconvert'" msgstr "No s'ha pogut llegir la sortida de 'charconvert'" @@ -760,8 +760,8 @@ msgstr "[format unix]" #, c-format msgid "%ld line, " msgid_plural "%ld lines, " -msgstr[0] "%ld línia, " -msgstr[1] "%ld línies, " +msgstr[0] "%ld l�nia, " +msgstr[1] "%ld l�nies, " #, c-format msgid "%lld byte" @@ -769,42 +769,42 @@ msgid_plural "%lld bytes" msgstr[0] "%lld octet" msgstr[1] "%lld octets" -# eol = final de línia +# eol = final de l�nia msgid "[noeol]" msgstr "[nofl]" msgid "[Incomplete last line]" -msgstr "[Última línia incompleta]" +msgstr "[�ltima l�nia incompleta]" #, c-format msgid "" -"W12: Warning: File \"%s\" has changed and the buffer was changed in Vim as " +"W12: Warning: File \"%s\" has changed and the buffer was changed in MNV as " "well" -msgstr "W12: Atenció: Tant el fitxer \"%s\" com el buffer del Vim han canviat" +msgstr "W12: Atenci�: Tant el fitxer \"%s\" com el buffer deMNMNV han canviat" msgid "See \":help W12\" for more info." -msgstr "Vegeu \":help W12\" per a més informació." +msgstr "Vegeu \":help W12\" per a m�s informaci�." #, c-format msgid "W11: Warning: File \"%s\" has changed since editing started" -msgstr "W11: Atenció: El fitxer \"%s\" ha canviat després de ser obert" +msgstr "W11: Atenci�: El fitxer \"%s\" ha canviat despr�s de ser obert" msgid "See \":help W11\" for more info." -msgstr "Vegeu \":help W11\" per a més informació." +msgstr "Vegeu \":help W11\" per a m�s informaci�." #, c-format msgid "W16: Warning: Mode of file \"%s\" has changed since editing started" -msgstr "W16: Atenció: Els permisos de \"%s\" han canviat després de ser obert" +msgstr "W16: Atenci�: Els permisos de \"%s\" han canviat despr�s de ser obert" msgid "See \":help W16\" for more info." -msgstr "Vegeu \":help W16\" per a més informació." +msgstr "Vegeu \":help W16\" per a m�s informaci�." #, c-format msgid "W13: Warning: File \"%s\" has been created after editing started" -msgstr "W13: Atenció: El fitxer \"%s\" ha estat creat després de ser obert" +msgstr "W13: Atenci�: El fitxer \"%s\" ha estat creat despr�s de ser obert" msgid "Warning" -msgstr "Atenció" +msgstr "Atenci�" msgid "" "&OK\n" @@ -822,7 +822,7 @@ msgid "writefile() first argument must be a List or a Blob" msgstr "writefile() el primer argument ha de ser List o Blob" msgid "Select Directory dialog" -msgstr "Selecció de directori" +msgstr "Selecci� de directori" msgid "Save File dialog" msgstr "Desa el fitxer" @@ -831,22 +831,22 @@ msgid "Open File dialog" msgstr "Obre el fitxer" msgid "no matches" -msgstr "cap coincidència" +msgstr "cap coincid�ncia" #, c-format msgid "+--%3ld line folded " msgid_plural "+--%3ld lines folded " -msgstr[0] "+--%3ld línia plegada" -msgstr[1] "+--%3ld línies plegades" +msgstr[0] "+--%3ld l�nia plegada" +msgstr[1] "+--%3ld l�nies plegades" #, c-format msgid "+-%s%3ld line: " msgid_plural "+-%s%3ld lines: " -msgstr[0] "+-%s%3ld línia: " -msgstr[1] "+-%s%3ld línies: " +msgstr[0] "+-%s%3ld l�nia: " +msgstr[1] "+-%s%3ld l�nies: " msgid "No match at cursor, finding next" -msgstr "Cap coincidència al cursor, cercant la següent" +msgstr "Cap coincid�ncia al cursor, cercant la seg�ent" # :browse w msgid "_Save" @@ -856,7 +856,7 @@ msgid "_Open" msgstr "_Obre" msgid "_Cancel" -msgstr "_Cancel·la" +msgstr "_Cancel�la" msgid "_OK" msgstr "D'_acord" @@ -866,30 +866,30 @@ msgid "" "&No\n" "&Cancel" msgstr "" -"&Sí\n" +"&S�\n" "&No\n" -"&Cancel·la" +"&Cancel�la" msgid "OK" msgstr "D'acord" msgid "Yes" -msgstr "Sí" +msgstr "S�" msgid "No" msgstr "No" msgid "Cancel" -msgstr "Cancel·la" +msgstr "Cancel�la" msgid "Input _Methods" -msgstr "_Mètodes d'entrada" +msgstr "_M�todes d'entrada" -msgid "VIM - Search and Replace..." -msgstr "VIM - Cerca i substitueix..." +msgid "MNV - Search and Replace..." +msgstr "MNV - Cerca i substitueix..." -msgid "VIM - Search..." -msgstr "VIM - Cerca..." +msgid "MNV - Search..." +msgstr "MNV - Cerca..." msgid "Find what:" msgstr "Cerca:" @@ -898,13 +898,13 @@ msgid "Replace with:" msgstr "Substitueix amb:" msgid "Match whole word only" -msgstr "Només paraules senceres" +msgstr "Nom�s paraules senceres" msgid "Match case" -msgstr "Sensible a les majúscules" +msgstr "Sensible a les maj�scules" msgid "Direction" -msgstr "Direcció" +msgstr "Direcci�" msgid "Up" msgstr "Amunt" @@ -913,7 +913,7 @@ msgid "Down" msgstr "Avall" msgid "Find Next" -msgstr "Cerca el següent" +msgstr "Cerca el seg�ent" msgid "Replace" msgstr "Substitueix" @@ -924,8 +924,8 @@ msgstr "Substitueix-les totes" msgid "_Close" msgstr "_Tanca" -msgid "Vim: Received \"die\" request from session manager\n" -msgstr "Vim: S'ha rebut una petició \"die\" del gestor de sessions\n" +msgid "MNV: Received \"die\" request from session manager\n" +msgstr "MNV: S'ha rebut una petici� \"die\" del gestor de sessions\n" msgid "Close tab" msgstr "Tanca la pestanya" @@ -936,14 +936,14 @@ msgstr "Nova pestanya" msgid "Open Tab..." msgstr "Obre una pestanya..." -msgid "Vim: Main window unexpectedly destroyed\n" -msgstr "Vim: La finestra principal s'ha destruït inesperadament\n" +msgid "MNV: Main window unexpectedly destroyed\n" +msgstr "MNV: La finestra principal s'ha destru�t inesperadament\n" msgid "&Filter" msgstr "&Filtre" msgid "&Cancel" -msgstr "&Cancel·la" +msgstr "&Cancel�la" msgid "Directories" msgstr "Directoris" @@ -961,13 +961,13 @@ msgid "&OK" msgstr "&D'acord" msgid "Selection" -msgstr "Selecció" +msgstr "Selecci�" -msgid "Vim dialog" -msgstr "Diàleg del Vim" +msgid "MNV dialog" +msgstr "Di�leg deMNMNV" msgid "Find &Next" -msgstr "&Cerca el següent" +msgstr "&Cerca el seg�ent" msgid "&Replace" msgstr "&Substitueix" @@ -976,7 +976,7 @@ msgid "Replace &All" msgstr "Substitueix-les &totes" msgid "&Undo" -msgstr "&Desfés" +msgstr "&Desf�s" msgid "Open tab..." msgstr "Obre una pestanya..." @@ -1003,7 +1003,7 @@ msgstr "Fosa%d: %s" #, c-format msgid "Font%d width is not twice that of font0" -msgstr "L'amplada de fosa%d no és el doble que la de fosa0" +msgstr "L'amplada de fosa%d no �s el doble que la de fosa0" #, c-format msgid "Font0 width: %d" @@ -1014,16 +1014,16 @@ msgid "Font%d width: %d" msgstr "Amplada de fosa%d: %d" msgid "Invalid font specification" -msgstr "L'especificació de tipus de lletra no és vàlida" +msgstr "L'especificaci� de tipus de lletra no �s v�lida" msgid "&Dismiss" msgstr "&Ignora" msgid "no specific match" -msgstr "no hi ha coincidències" +msgstr "no hi ha coincid�ncies" -msgid "Vim - Font Selector" -msgstr "Vim - Selector de fosa" +msgid "MNV - Font Selector" +msgstr "MNV - Selector de fosa" msgid "Name:" msgstr "Nom:" @@ -1032,7 +1032,7 @@ msgid "Show size in Points" msgstr "Mostra la mida en punts" msgid "Encoding:" -msgstr "Codificació:" +msgstr "Codificaci�:" msgid "Font:" msgstr "Fosa:" @@ -1045,50 +1045,50 @@ msgstr "Mida:" #, c-format msgid "Page %d" -msgstr "Pàgina %d" +msgstr "P�gina %d" msgid "No text to be printed" msgstr "No hi ha text per imprimir" #, c-format msgid "Printing page %d (%d%%)" -msgstr "Imprimint la pàgina %d (%d%%)" +msgstr "Imprimint la p�gina %d (%d%%)" #, c-format msgid " Copy %d of %d" -msgstr " Còpia %d de %d" +msgstr " C�pia %d de %d" #, c-format msgid "Printed: %s" -msgstr "S'ha imprès: %s" +msgstr "S'ha impr�s: %s" msgid "Printing aborted" -msgstr "S'ha avortat la impressió" +msgstr "S'ha avortat la impressi�" msgid "Sending to printer..." msgstr "Enviant a la impressora..." msgid "Print job sent." -msgstr "S'ha enviat la feina d'impressió." +msgstr "S'ha enviat la feina d'impressi�." #, c-format msgid "Sorry, help file \"%s\" not found" msgstr "No s'ha trobat el fitxer d'ajuda \"%s\"" msgid "W18: Invalid character in group name" -msgstr "W18: Hi ha un caràcter no vàlid en el nom del grup" +msgstr "W18: Hi ha un car�cter no v�lid en el nom del grup" msgid "Add a new database" msgstr "Afegeix una base de dades nova" msgid "Query for a pattern" -msgstr "Cerca un patró" +msgstr "Cerca un patr�" msgid "Show this message" msgstr "Mostra aquest missatge" msgid "Kill a connection" -msgstr "Talla una connexió" +msgstr "Talla una connexi�" msgid "Reinit all connections" msgstr "Reinicia totes les connexions" @@ -1135,19 +1135,19 @@ msgid "" " t: Find this text string\n" msgstr "" "\n" -" a: Cerca assignacions a aquest símbol\n" -" c: Cerca funcions que criden aquesta funció\n" -" d: Cerca funcions cridades per aquesta funció\n" -" e: Cerca aquest patró egrep\n" +" a: Cerca assignacions a aquest s�mbol\n" +" c: Cerca funcions que criden aquesta funci�\n" +" d: Cerca funcions cridades per aquesta funci�\n" +" e: Cerca aquest patr� egrep\n" " f: Cerca aquest fitxer\n" -" g: Cerca aquesta definició\n" +" g: Cerca aquesta definici�\n" " i: Cerca fitxers que fan #include amb aquest fitxer\n" -" s: Cerca aquest símbol C\n" -" t: Cerca aquesta cadena de caràcters\n" +" s: Cerca aquest s�mbol C\n" +" t: Cerca aquesta cadena de car�cters\n" #, c-format msgid "cscope connection %s closed" -msgstr "s'ha tancat la connexió cscope %s" +msgstr "s'ha tancat la connexi� cscope %s" #, c-format msgid "Cscope tag: %s" @@ -1158,10 +1158,10 @@ msgid "" " # line" msgstr "" "\n" -" # línia" +" # l�nia" msgid "filename / context / line\n" -msgstr "fitxer / context / línia\n" +msgstr "fitxer / context / l�nia\n" msgid "All cscope databases reset" msgstr "S'han restablert totes les bases de dades cscope" @@ -1170,76 +1170,76 @@ msgid "no cscope connections\n" msgstr "no hi ha connexions cscope\n" msgid " # pid database name prepend path\n" -msgstr " # pid base de dades prefix d'ubicació\n" +msgstr " # pid base de dades prefix d'ubicaci�\n" msgid "Lua library cannot be loaded." msgstr "No s'ha pogut carregar la biblioteca Lua." msgid "cannot save undo information" -msgstr "no s'ha pogut desar la informació de desfer" +msgstr "no s'ha pogut desar la informaci� de desfer" msgid "invalid expression" -msgstr "l'expressió no és vàlida" +msgstr "l'expressi� no �s v�lida" msgid "expressions disabled at compile time" msgstr "no s'ha compilat suport per a expressions" msgid "hidden option" -msgstr "opció amagada" +msgstr "opci� amagada" msgid "unknown option" -msgstr "opció desconeguda" +msgstr "opci� desconeguda" msgid "window index is out of range" -msgstr "l'índex de la finestra està fora d'interval" +msgstr "l'�ndex de la finestra est� fora d'interval" msgid "couldn't open buffer" msgstr "no s'ha pogut obrir el buffer" msgid "cannot delete line" -msgstr "no s'ha pogut esborrar la línia" +msgstr "no s'ha pogut esborrar la l�nia" msgid "cannot replace line" -msgstr "no s'ha pogut substituir la línia" +msgstr "no s'ha pogut substituir la l�nia" msgid "cannot insert line" -msgstr "no s'ha pogut inserir la línia" +msgstr "no s'ha pogut inserir la l�nia" msgid "string cannot contain newlines" -msgstr "la cadena no pot contenir salts de línia" +msgstr "la cadena no pot contenir salts de l�nia" -msgid "error converting Scheme values to Vim" -msgstr "error en convertir els valors de Scheme a Vim" +msgid "error converting Scheme values to MNV" +msgstr "error en convertir els valors de Scheme a MNV" -msgid "Vim error: ~a" -msgstr "Error del Vim: ~a" +msgid "MNV error: ~a" +msgstr "Error del MNV: ~a" -msgid "Vim error" -msgstr "Error del Vim" +msgid "MNV error" +msgstr "Error del MNV" msgid "buffer is invalid" -msgstr "el buffer no és vàlid" +msgstr "el buffer no �s v�lid" msgid "window is invalid" -msgstr "la finestra no és vàlida" +msgstr "la finestra no �s v�lida" msgid "linenr out of range" -msgstr "número de línia fora d'interval" +msgstr "n�mero de l�nia fora d'interval" -msgid "not allowed in the Vim sandbox" -msgstr "no permès a l'entorn d'aïllament del Vim" +msgid "not allowed in the MNV sandbox" +msgstr "no perm�s a l'entorn d'a�llament MNV MNV" msgid "invalid buffer number" -msgstr "número de buffer no vàlid" +msgstr "n�mero de buffer no v�lid" msgid "not implemented yet" msgstr "no implementat (de moment)" msgid "cannot set line(s)" -msgstr "no s'han pogut establir les línies" +msgstr "no s'han pogut establir les l�nies" msgid "invalid mark name" -msgstr "nom de marca no vàlid" +msgstr "nom de marca no v�lid" msgid "mark not set" msgstr "marca no establerta" @@ -1249,95 +1249,95 @@ msgid "row %d column %d" msgstr "fila %d columna %d" msgid "cannot insert/append line" -msgstr "no s'ha pogut inserir/afegir la línia" +msgstr "no s'ha pogut inserir/afegir la l�nia" msgid "line number out of range" -msgstr "número de línia fora d'interval" +msgstr "n�mero de l�nia fora d'interval" msgid "unknown flag: " -msgstr "paràmetre desconegut: " +msgstr "par�metre desconegut: " -msgid "unknown vimOption" -msgstr "opció del Vim desconeguda" +msgid "unknown mnvOption" +msgstr "opci� deMNMNV desconeguda" msgid "keyboard interrupt" -msgstr "interrupció de teclat" +msgstr "interrupci� de teclat" msgid "cannot create buffer/window command: object is being deleted" -msgstr "no es pot crear l'ordre Tcl: l'objecte està sent eliminant" +msgstr "no es pot crear l'ordre Tcl: l'objecte est� sent eliminant" msgid "" "cannot register callback command: buffer/window is already being deleted" -msgstr "no es pot registrar el callback: l'objecte està sent eliminant" +msgstr "no es pot registrar el callback: l'objecte est� sent eliminant" msgid "cannot register callback command: buffer/window reference not found" -msgstr "no es pot registrar el callback: no s'ha trobat la referència" +msgstr "no es pot registrar el callback: no s'ha trobat la refer�ncia" msgid "cannot get line" -msgstr "no s'ha pogut obtenir la línia" +msgstr "no s'ha pogut obtenir la l�nia" msgid "Unable to register a command server name" msgstr "No s'ha pogut registrar un nom de servidor d'ordres" #, c-format msgid "%ld lines to indent... " -msgstr "%ld línies a sagnar... " +msgstr "%ld l�nies a sagnar... " #, c-format msgid "%ld line indented " msgid_plural "%ld lines indented " -msgstr[0] "%ld línia sagnada " -msgstr[1] "%ld línies sagnades " +msgstr[0] "%ld l�nia sagnada " +msgstr[1] "%ld l�nies sagnades " msgid " Keyword completion (^N^P)" -msgstr " Compleció de paraules clau (^N^P)" +msgstr " Compleci� de paraules clau (^N^P)" msgid " ^X mode (^]^D^E^F^I^K^L^N^O^Ps^U^V^Y)" msgstr " Mode ^X (^]^D^E^F^|^K^L^N^O^Ps^U^V^Y)" msgid " Whole line completion (^L^N^P)" -msgstr " Compleció de línies senceres (^L^N^P)" +msgstr " Compleci� de l�nies senceres (^L^N^P)" msgid " File name completion (^F^N^P)" -msgstr " Compleció de noms de fitxer (^F^N^P)" +msgstr " Compleci� de noms de fitxer (^F^N^P)" msgid " Tag completion (^]^N^P)" -msgstr " Compleció d'etiquetes (^]^N^P)" +msgstr " Compleci� d'etiquetes (^]^N^P)" msgid " Path pattern completion (^N^P)" -msgstr " Compleció d'ubicacions (^N^P)" +msgstr " Compleci� d'ubicacions (^N^P)" msgid " Definition completion (^D^N^P)" -msgstr " Compleció de definicions (^D^N^P)" +msgstr " Compleci� de definicions (^D^N^P)" # todo: expecificar diccionari? msgid " Dictionary completion (^K^N^P)" -msgstr " Compleció de paraules (^K^N^P)" +msgstr " Compleci� de paraules (^K^N^P)" msgid " Thesaurus completion (^T^N^P)" -msgstr " Compleció de sinònims (^T^N^P)" +msgstr " Compleci� de sin�nims (^T^N^P)" msgid " Command-line completion (^V^N^P)" -msgstr " Compleció de la línia d'ordres (^V^N^P)" +msgstr " Compleci� de la l�nia d'ordres (^V^N^P)" msgid " User defined completion (^U^N^P)" -msgstr " Compleció definida per l'usuari (^U^N^P)" +msgstr " Compleci� definida per l'usuari (^U^N^P)" msgid " Omni completion (^O^N^P)" -msgstr " Omni-compleció (^O^N^P)" +msgstr " Omni-compleci� (^O^N^P)" msgid " Spelling suggestion (^S^N^P)" msgstr " Suggeriment d'ortografia (^S^N^P)" # i C-x C-p msgid " Keyword Local completion (^N^P)" -msgstr " Compleció de paraules clau locals (^N^P)" +msgstr " Compleci� de paraules clau locals (^N^P)" msgid "'dictionary' option is empty" -msgstr "El paràmetre 'dictionary' està en blanc" +msgstr "El par�metre 'dictionary' est� en blanc" msgid "'thesaurus' option is empty" -msgstr "El paràmetre 'thesaurus' està en blanc" +msgstr "El par�metre 'thesaurus' est� en blanc" # i C-x C-k #, c-format @@ -1346,10 +1346,10 @@ msgstr "Cercant al diccionari: %s" # i C-x C-e msgid " (insert) Scroll (^E/^Y)" -msgstr " (inserir) Desplaçament (^E/^Y)" +msgstr " (inserir) Despla�ament (^E/^Y)" msgid " (replace) Scroll (^E/^Y)" -msgstr " (substituir) Desplaçament (^E/^Y)" +msgstr " (substituir) Despla�ament (^E/^Y)" #, c-format msgid "Scanning: %s" @@ -1359,7 +1359,7 @@ msgid "Scanning tags." msgstr "Cercant etiquetes." msgid "match in file" -msgstr "coincidència al fitxer" +msgstr "coincid�ncia al fitxer" msgid " Adding" msgstr " Afegint" @@ -1368,27 +1368,27 @@ msgid "-- Searching..." msgstr "-- Cercant..." msgid "Hit end of paragraph" -msgstr "S'ha arribat al final del paràgraf" +msgstr "S'ha arribat al final del par�graf" msgid "Pattern not found" -msgstr "No s'ha trobat el patró" +msgstr "No s'ha trobat el patr�" msgid "Back at original" msgstr "Original" msgid "Word from other line" -msgstr "Paraula d'una altra línia" +msgstr "Paraula d'una altra l�nia" msgid "The only match" -msgstr "L'única coincidència" +msgstr "L'�nica coincid�ncia" #, c-format msgid "match %d of %d" -msgstr "coincidència %d de %d" +msgstr "coincid�ncia %d de %d" #, c-format msgid "match %d" -msgstr "coincidència %d" +msgstr "coincid�ncia %d" msgid "flatten() argument" msgstr "argument per a filter()" @@ -1413,7 +1413,7 @@ msgstr "argument per a filter()" # :lockvar foo # :echo extend(foo, bar) # -# la forma fun() argument es repeteix més avall +# la forma fun() argument es repeteix m�s avall msgid "extendnew() argument" msgstr "argument per a extendnew()" @@ -1427,38 +1427,38 @@ msgstr "argument per a reverse()" msgid "Current %slanguage: \"%s\"" msgstr "Idioma actual ( %s): \"%s\"" -# vim --foo +# mnv --foo msgid "Unknown option argument" -msgstr "Opció desconeguda" +msgstr "Opci� desconeguda" msgid "Too many edit arguments" -msgstr "Sobren arguments d'edició" +msgstr "Sobren arguments d'edici�" msgid "Argument missing after" -msgstr "Falta un argument després de" +msgstr "Falta un argument despr�s de" -# vim -Tx +# mnv -Tx msgid "Garbage after option argument" -msgstr "Caràcters sobrants després de l'opció" +msgstr "Car�cters sobrants despr�s de l'opci�" msgid "Too many \"+command\", \"-c command\" or \"--cmd command\" arguments" msgstr "Sobren arguments \"+ordre\", \"-c ordre\" o \"--cmd ordre\"" msgid "Invalid argument for" -msgstr "Argument no vàlid per a" +msgstr "Argument no v�lid per a" #, c-format msgid "%d files to edit\n" msgstr "%d fitxers per editar\n" msgid "netbeans is not supported with this GUI\n" -msgstr "aquesta interfície gràfica no suporta NetBeans\n" +msgstr "aquesta interf�cie gr�fica no suporta NetBeans\n" msgid "'-nb' cannot be used: not enabled at compile time\n" -msgstr "'-nb' no està disponible: no s'ha compilat el suport\n" +msgstr "'-nb' no est� disponible: no s'ha compilat el suport\n" -msgid "This Vim was not compiled with the diff feature." -msgstr "Aquest Vim no ha estat compilat amb la funcionalitat diff." +msgid "This MNV was not compiled with the diff feature." +msgstr "Aquest MNV no ha estat compilat amb la funcionalitat diff." msgid "Attempt to open script file again: \"" msgstr "Es torna a intentar obrir l'script: \"" @@ -1469,41 +1469,41 @@ msgstr "No es pot obrir per a lectura: \"" msgid "Cannot open for script output: \"" msgstr "No es pot obrir per a la sortida de l'script: \"" -msgid "Vim: Error: Failure to start gvim from NetBeans\n" -msgstr "Vim: Error: No s'ha pogut iniciar gvim des de NetBeans\n" +msgid "MNV: Error: Failure to start gmnv from NetBeans\n" +msgstr "MNV: Error: No s'ha pogut iniciar gmnv des de NetBeans\n" -msgid "Vim: Error: This version of Vim does not run in a Cygwin terminal\n" -msgstr "Vim: Error: Aquesta versió de Vim no funciona en terminals Cygwin\n" +msgid "MNV: Error: This version of MNV does not run in a Cygwin terminal\n" +msgstr "MNV: Error: Aquesta versi� dMNMNV no funciona en terminals Cygwin\n" -msgid "Vim: Warning: Output is not to a terminal\n" -msgstr "Vim: Atenció: La sortida no està connectada a un terminal\n" +msgid "MNV: Warning: Output is not to a terminal\n" +msgstr "MNV: Atenci�: La sortida no est� connectada a un terminal\n" -msgid "Vim: Warning: Input is not from a terminal\n" -msgstr "Vim: Atenció: L'entrada no està connectada a un terminal\n" +msgid "MNV: Warning: Input is not from a terminal\n" +msgstr "MNV: Atenci�: L'entrada no est� connectada a un terminal\n" -msgid "pre-vimrc command line" -msgstr "línia d'ordres prèvia a vimrc" +msgid "pre-mnvrc command line" +msgstr "l�nia d'ordres pr�via a mnvrc" msgid "" "\n" -"More info with: \"vim -h\"\n" +"More info with: \"mnv -h\"\n" msgstr "" "\n" -"Més informació amb: \"vim -h\"\n" +"M�s informaci� amb: \"mnv -h\"\n" -# max 56 caràcters +# max 56 car�cters msgid "[file ..] edit specified file(s)" msgstr "[fitxer ...] edita el(s) fitxer(s) especificat(s)" -# max 56 caràcters +# max 56 car�cters msgid "- read text from stdin" -msgstr "- edita el text de l'entrada estàndard" +msgstr "- edita el text de l'entrada est�ndard" -# max 56 caràcters +# max 56 car�cters msgid "-t tag edit file where tag is defined" msgstr "-t etiqueta edita el fitxer on hi ha l'etiqueta" -# max 56 caràcters +# max 56 car�cters msgid "-q [errorfile] edit file with first error" msgstr "-q [ftxerrors] edita el fitxer on hi ha el primer error" @@ -1515,17 +1515,17 @@ msgid "" msgstr "" "\n" "\n" -" ús:" +" �s:" -msgid " vim [arguments] " -msgstr " vim [arguments] " +msgid " mnv [arguments] " +msgstr " mnv [arguments] " msgid "" "\n" " or:" msgstr "" "\n" -"o bé:" +"o b�:" # VMS msgid "" @@ -1533,7 +1533,7 @@ msgid "" "Where case is ignored prepend / to make flag upper case" msgstr "" "\n" -"On no es distingeixen majúscules el prefix / indica majúscules" +"On no es distingeixen maj�scules el prefix / indica maj�scules" msgid "" "\n" @@ -1545,22 +1545,22 @@ msgstr "" "Arguments:\n" msgid "--\t\t\tOnly file names after this" -msgstr "--\t\t\tDesprés d'això només noms de fitxers" +msgstr "--\t\t\tDespr�s d'aix� nom�s noms de fitxers" msgid "--literal\t\tDon't expand wildcards" msgstr "--literal\t\tNo expandeix patrons de noms" -msgid "-register\t\tRegister this gvim for OLE" -msgstr "-register\t\tRegistra aquest gvim a OLE" +msgid "-register\t\tRegister this gmnv for OLE" +msgstr "-register\t\tRegistra aquest gmnv a OLE" -msgid "-unregister\t\tUnregister gvim for OLE" -msgstr "-unregister\t\tDona de baixa aquest gvim a OLE" +msgid "-unregister\t\tUnregister gmnv for OLE" +msgstr "-unregister\t\tDona de baixa aquest gmnv a OLE" -msgid "-g\t\t\tRun using GUI (like \"gvim\")" -msgstr "-g\t\t\tUsa la interfície gràfica (com \"gvim\")" +msgid "-g\t\t\tRun using GUI (like \"gmnv\")" +msgstr "-g\t\t\tUsa la interf�cie gr�fica (com \"gmnv\")" msgid "-f or --nofork\tForeground: Don't fork when starting GUI" -msgstr "-f o --nofork\tNo crea un procés nou per al GUI" +msgstr "-f o --nofork\tNo crea un proc�s nou per al GUI" msgid "-v\t\t\tVi mode (like \"vi\")" msgstr "-v\t\t\tMode Vi (com \"vi\")" @@ -1572,19 +1572,19 @@ msgid "-E\t\t\tImproved Ex mode" msgstr "-E\t\t\tMode Ex millorat" msgid "-s\t\t\tSilent (batch) mode (only for \"ex\")" -msgstr "-s\t\t\tMode silenciós per lots (només per a \"ex\")" +msgstr "-s\t\t\tMode silenci�s per lots (nom�s per a \"ex\")" -msgid "-d\t\t\tDiff mode (like \"vimdiff\")" -msgstr "-d\t\t\tMode diff (com \"vimdiff\")" +msgid "-d\t\t\tDiff mode (like \"mnvdiff\")" +msgstr "-d\t\t\tMode diff (com \"mnvdiff\")" -msgid "-y\t\t\tEasy mode (like \"evim\", modeless)" -msgstr "-y\t\t\tMode senzill (com \"evim\", sense modes)" +msgid "-y\t\t\tEasy mode (like \"emnv\", modeless)" +msgstr "-y\t\t\tMode senzill (com \"emnv\", sense modes)" msgid "-R\t\t\tReadonly mode (like \"view\")" -msgstr "-R\t\t\tMode només lectura (com \"view\")" +msgstr "-R\t\t\tMode nom�s lectura (com \"view\")" -msgid "-Z\t\t\tRestricted mode (like \"rvim\")" -msgstr "-Z\t\t\tMode restringit (com \"rvim)" +msgid "-Z\t\t\tRestricted mode (like \"rmnv\")" +msgstr "-Z\t\t\tMode restringit (com \"rmnv)" msgid "-m\t\t\tModifications (writing files) not allowed" msgstr "-m\t\t\tNo permet modificar (escriure) fitxers" @@ -1608,16 +1608,16 @@ msgid "-V[N][fname]\t\tBe verbose [level N] [log messages to fname]" msgstr "-V[N][nomf]\t\tLoquacitat [nivell N] [desa missatges a nomf]" msgid "-D\t\t\tDebugging mode" -msgstr "-D\t\t\tMode de depuració" +msgstr "-D\t\t\tMode de depuraci�" msgid "-n\t\t\tNo swap file, use memory only" -msgstr "-n\t\t\tNo usa fitxers d'intercanvi, només memòria" +msgstr "-n\t\t\tNo usa fitxers d'intercanvi, nom�s mem�ria" msgid "-r\t\t\tList swap files and exit" msgstr "-r\t\t\tLlistat dels fitxers d'intercanvi" msgid "-r (with file name)\tRecover crashed session" -msgstr "-r (amb nom de fitxer) Recupera una sessió accidentada" +msgstr "-r (amb nom de fitxer) Recupera una sessi� accidentada" msgid "-L\t\t\tSame as -r" msgstr "-L\t\t\tIgual que -r" @@ -1629,10 +1629,10 @@ msgid "-dev \t\tUse for I/O" msgstr "-dev \t\tUsa per a l'E/S" msgid "-A\t\t\tStart in Arabic mode" -msgstr "-A\t\t\tComença en mode aràbic" +msgstr "-A\t\t\tComen�a en mode ar�bic" msgid "-H\t\t\tStart in Hebrew mode" -msgstr "-H\t\t\tComença en mode hebreu" +msgstr "-H\t\t\tComen�a en mode hebreu" msgid "-T \tSet terminal type to " msgstr "-T \tDefineix el tipus de terminal" @@ -1641,40 +1641,40 @@ msgid "--not-a-term\t\tSkip warning for input/output not being a terminal" msgstr "--not-a-term\t\tOmet avisos relacionats amb el terminal" msgid "--gui-dialog-file {fname} For testing: write dialog text" -msgstr "--gui-dialog-file {fitxer} Per proves: escriu el contingut el diàleg" +msgstr "--gui-dialog-file {fitxer} Per proves: escriu el contingut el di�leg" msgid "--ttyfail\t\tExit if input or output is not a terminal" -msgstr "--ttyfail\t\tSurt si l'entrada/sortida no són un terminal" +msgstr "--ttyfail\t\tSurt si l'entrada/sortida no s�n un terminal" -msgid "-u \t\tUse instead of any .vimrc" -msgstr "-u \t\tUsa en lloc de qualsevol altre .vimrc" +msgid "-u \t\tUse instead of any .mnvrc" +msgstr "-u \t\tUsa en lloc de qualsevol altre .mnvrc" -msgid "-U \t\tUse instead of any .gvimrc" -msgstr "-U \t\tUsa en lloc de qualsevol altre .gvimrc" +msgid "-U \t\tUse instead of any .gmnvrc" +msgstr "-U \t\tUsa en lloc de qualsevol altre .gmnvrc" msgid "--noplugin\t\tDon't load plugin scripts" msgstr "--noplugin\t\tNo carrega plugins" msgid "-p[N]\t\tOpen N tab pages (default: one for each file)" -msgstr "-p[N]\t\tObre N pestanyes (per omissió: una per fitxer)" +msgstr "-p[N]\t\tObre N pestanyes (per omissi�: una per fitxer)" msgid "-o[N]\t\tOpen N windows (default: one for each file)" -msgstr "-o[N]\t\tObre N finestres (per omissió: una per fitxer)" +msgstr "-o[N]\t\tObre N finestres (per omissi�: una per fitxer)" msgid "-O[N]\t\tLike -o but split vertically" -msgstr "-O[N]\t\tCom -o però amb divisió vertical" +msgstr "-O[N]\t\tCom -o per� amb divisi� vertical" msgid "+\t\t\tStart at end of file" -msgstr "+\t\t\tComença al final del fitxer" +msgstr "+\t\t\tComen�a al final del fitxer" msgid "+\t\tStart at line " -msgstr "+\t\tComença a la línia " +msgstr "+\t\tComen�a a la l�nia " -msgid "--cmd \tExecute before loading any vimrc file" -msgstr "--cmd \tExecuta abans de llegir els fitxers vimrc" +msgid "--cmd \tExecute before loading any mnvrc file" +msgstr "--cmd \tExecuta abans de llegir els fitxers mnvrc" msgid "-c \t\tExecute after loading the first file" -msgstr "-c \t\tExecuta després de carregar el primer fitxer" +msgstr "-c \t\tExecuta despr�s de carregar el primer fitxer" msgid "-S \t\tSource file after loading the first file" msgstr "-S \t\tExecuta un cop carregat el primer fitxer" @@ -1691,14 +1691,14 @@ msgstr "-W