Import vim from changeset v5628:c9cad40b4181

- Cleanup source tree, leaving only files necessary for compilation/testing
- Process files through unifdef to remove tons of FEAT_* macros
- Process files through uncrustify to normalize source code formatting.
- Port the build system to cmake
This commit is contained in:
Thiago de Arruda 2014-01-31 10:39:15 -03:00
commit 72cf89bce8
380 changed files with 501011 additions and 0 deletions

17
.gitignore vendored Normal file
View File

@ -0,0 +1,17 @@
build/
*.rej
*.orig
*.mo
*.swp
*~
*.pyc
src/po/vim.pot
src/po/*.ck
src/testdir/mbyte.vim
src/testdir/mzscheme.vim
src/testdir/lua.vim
src/testdir/small.vim
src/testdir/tiny.vim
src/testdir/test*.out
src/testdir/test.log

25
CMakeLists.txt Normal file
View File

@ -0,0 +1,25 @@
cmake_minimum_required (VERSION 2.6)
project (NEOVIM)
set(NEOVIM_VERSION_MAJOR 0)
set(NEOVIM_VERSION_MINOR 0)
set(NEOVIM_VERSION_PATCH 0)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_definitions(-DHAVE_CONFIG_H -Wall -std=gnu99)
if(CMAKE_BUILD_TYPE MATCHES Debug)
# cmake automatically appends -g to the compiler flags
set(DEBUG 1)
else()
set(DEBUG 0)
endif()
# add dependencies to include/lib directories
link_directories ("${PROJECT_SOURCE_DIR}/.deps/usr/lib")
include_directories ("${PROJECT_SOURCE_DIR}/.deps/usr/include")
include_directories ("${PROJECT_BINARY_DIR}/config")
add_subdirectory(src)
add_subdirectory(config)

14
Makefile Normal file
View File

@ -0,0 +1,14 @@
CMAKE_FLAGS := -DCMAKE_BUILD_TYPE=Debug
test: build/src/vim
cd src/testdir && make
build/src/vim:
cd build && make
cmake:
rm -rf build
mkdir build
cd build && cmake $(CMAKE_FLAGS) ../
.PHONY: test cmake

30
config/CMakeLists.txt Normal file
View File

@ -0,0 +1,30 @@
include(CheckTypeSize)
check_type_size("int" SIZEOF_INT)
check_type_size("long" SIZEOF_LONG)
check_type_size("time_t" SIZEOF_TIME_T)
check_type_size("off_t" SIZEOF_OFF_T)
# generate configuration header and update include directories
configure_file (
"${PROJECT_SOURCE_DIR}/config/config.h.in"
"${PROJECT_BINARY_DIR}/config/auto/config.h"
)
# generate pathdef.c
find_program(WHOAMI_PROG whoami)
find_program(HOSTNAME_PROG hostname)
if (EXISTS ${WHOAMI_PROG})
execute_process(COMMAND ${WHOAMI_PROG}
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE USERNAME)
endif()
if (EXISTS ${HOSTNAME_PROG})
execute_process(COMMAND ${HOSTNAME_PROG}
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE HOSTNAME)
endif()
configure_file (
"${PROJECT_SOURCE_DIR}/config/pathdef.c.in"
"${PROJECT_BINARY_DIR}/config/auto/pathdef.c"
ESCAPE_QUOTES)

214
config/config.h.in Normal file
View File

@ -0,0 +1,214 @@
#define NEOVIM_VERSION_MAJOR @NEOVIM_VERSION_MAJOR@
#define NEOVIM_VERSION_MINOR @NEOVIM_VERSION_MINOR@
#define NEOVIM_VERSION_PATCH @NEOVIM_VERSION_PATCH@
#if @DEBUG@
#define DEBUG
#endif
#define SIZEOF_INT @SIZEOF_INT@
#define SIZEOF_LONG @SIZEOF_LONG@
#define SIZEOF_TIME_T @SIZEOF_TIME_T@
#define SIZEOF_OFF_T @SIZEOF_OFF_T@
#define _FILE_OFFSET_BITS 64
#define HAVE_ATTRIBUTE_UNUSED 1
#define HAVE_BCMP 1
#define HAVE_BIND_TEXTDOMAIN_CODESET 1
#define HAVE_DATE_TIME 1
#define HAVE_DIRENT_H 1
#define HAVE_DLFCN_H 1
#define HAVE_DLOPEN 1
#define HAVE_DLSYM 1
#define HAVE_ERRNO_H 1
#define HAVE_FCHDIR 1
#define HAVE_FCHOWN 1
#define HAVE_FCNTL_H 1
#define HAVE_FD_CLOEXEC 1
#define HAVE_FLOAT_FUNCS 1
#define HAVE_FSEEKO 1
#define HAVE_FSYNC 1
#define HAVE_GETCWD 1
#define HAVE_GETPWENT 1
#define HAVE_GETPWNAM 1
#define HAVE_GETPWUID 1
#define HAVE_GETRLIMIT 1
#define HAVE_GETTEXT 1
#define HAVE_GETTIMEOFDAY 1
#define HAVE_GETWD 1
#define HAVE_ICONV 1
#define HAVE_ICONV_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_ISWUPPER 1
#define HAVE_LANGINFO_H 1
#define HAVE_LIBGEN_H 1
#define HAVE_LIBINTL_H 1
#define HAVE_LOCALE_H 1
#define HAVE_LSTAT 1
#define HAVE_MATH_H 1
#define HAVE_MEMCMP 1
#define HAVE_MEMSET 1
#define HAVE_MKDTEMP 1
#define HAVE_NANOSLEEP 1
#define HAVE_NL_LANGINFO_CODESET 1
#define HAVE_NL_MSG_CAT_CNTR 1
#define HAVE_OPENDIR 1
#define HAVE_OSPEED 1
#define HAVE_POLL_H 1
#define HAVE_PUTENV 1
#define HAVE_PWD_H 1
#define HAVE_QSORT 1
#define HAVE_READLINK 1
#define HAVE_RENAME 1
#define HAVE_SELECT 1
#define HAVE_SELINUX 1
#define HAVE_SETENV 1
#define HAVE_SETJMP_H 1
#define HAVE_SETPGID 1
#define HAVE_SETSID 1
#define HAVE_SGTTY_H 1
#define HAVE_SIGACTION 1
#define HAVE_SIGALTSTACK 1
#define HAVE_SIGCONTEXT 1
#define HAVE_SIGSTACK 1
#define HAVE_SIGVEC 1
#define HAVE_ST_BLKSIZE 1
#define HAVE_STDARG_H 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRCASECMP 1
#define HAVE_STRERROR 1
#define HAVE_STRFTIME 1
#define HAVE_STRING_H 1
#define HAVE_STRINGS_H 1
#define HAVE_STRNCASECMP 1
#define HAVE_STROPTS_H 1
#define HAVE_STRPBRK 1
#define HAVE_STRTOL 1
#define HAVE_SVR4_PTYS 1
#define HAVE_SYSCONF 1
#define HAVE_SYSINFO 1
#define HAVE_SYSINFO_MEM_UNIT 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_POLL_H 1
#define HAVE_SYS_RESOURCE_H 1
#define HAVE_SYS_SELECT_H 1
#define HAVE_SYS_STATFS_H 1
#define HAVE_SYS_SYSCTL_H 1
#define HAVE_SYS_SYSINFO_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_UTSNAME_H 1
#define HAVE_SYS_WAIT_H 1
#define HAVE_TERMCAP_H 1
#define HAVE_TERMIO_H 1
#define HAVE_TERMIOS_H 1
#define HAVE_TGETENT 1
#define HAVE_TOWLOWER 1
#define HAVE_TOWUPPER 1
#define HAVE_UNISTD_H 1
#define HAVE_UP_BC_PC 1
#define HAVE_USLEEP 1
#define HAVE_UTIME 1
#define HAVE_UTIME_H 1
#define HAVE_UTIMES 1
#define HAVE_WCHAR_H 1
#define HAVE_WCTYPE_H 1
#define RETSIGTYPE void
#define SIGRETURN return
#define SYS_SELECT_WITH_SYS_TIME 1
#define TERMINFO 1
#define TGETENT_ZERO_ERR 0
#define TIME_WITH_SYS_TIME 1
#define UNIX 1
#define USEMAN_S 1
#define USEMEMMOVE 1
#define FEAT_ARABIC
#define FEAT_AUTOCHDIR
#define FEAT_AUTOCMD
#define FEAT_BROWSE
#define FEAT_BROWSE_CMD
#define FEAT_BYTEOFF
#define FEAT_CINDENT
#define FEAT_CMDHIST
#define FEAT_CMDL_COMPL
#define FEAT_CMDL_INFO
#define FEAT_CMDWIN
#define FEAT_COMMENTS
#define FEAT_COMPL_FUNC
#define FEAT_CONCEAL
#define FEAT_CON_DIALOG
#define FEAT_CRYPT
#define FEAT_CSCOPE
#define FEAT_CURSORBIND
#define FEAT_DIFF
#define FEAT_DIGRAPHS
#define FEAT_EVAL
#define FEAT_EX_EXTRA
#define FEAT_FIND_ID
#define FEAT_FKMAP
#define FEAT_FLOAT
#define FEAT_FOLDING
#define FEAT_GETTEXT
#define FEAT_HANGULIN
#define FEAT_INS_EXPAND
#define FEAT_JUMPLIST
#define FEAT_KEYMAP
#define FEAT_LANGMAP
#define FEAT_LINEBREAK
#define FEAT_LISP
#define FEAT_LISTCMDS
#define FEAT_LOCALMAP
#define FEAT_MBYTE
#define FEAT_MENU
#define FEAT_MODIFY_FNAME
#define FEAT_MOUSE
#define FEAT_MOUSE_DEC
#define FEAT_MOUSE_NET
#define FEAT_MOUSE_SGR
#define FEAT_MOUSE_TTY
#define FEAT_MOUSE_URXVT
#define FEAT_MOUSE_XTERM
#define FEAT_MULTI_LANG
#define FEAT_PATH_EXTRA
#define FEAT_PERSISTENT_UNDO
#define FEAT_POSTSCRIPT
#define FEAT_PRINTER
#define FEAT_PROFILE
#define FEAT_QUICKFIX
#define FEAT_RELTIME
#define FEAT_RIGHTLEFT
#define FEAT_SCROLLBIND
#define FEAT_SEARCHPATH
#define FEAT_SEARCH_EXTRA
#define FEAT_SESSION
#define FEAT_SMARTINDENT
#define FEAT_SPELL
#define FEAT_STL_OPT
#define FEAT_SYN_HL
#define FEAT_TAG_BINS
#define FEAT_TAG_OLDSTATIC
#define FEAT_TERMRESPONSE
#define FEAT_TEXTOBJ
#define FEAT_TITLE
#define FEAT_USR_CMDS
#define FEAT_VERTSPLIT
#define FEAT_VIMINFO
#define FEAT_VIRTUALEDIT
#define FEAT_VISUAL
#define FEAT_VISUALEXTRA
#define FEAT_VREPLACE
#define FEAT_WAK
#define FEAT_WILDIGN
#define FEAT_WILDMENU
#define FEAT_WINDOWS
#define FEAT_WRITEBACK
#define FEAT_HUGE
#define FEAT_BIG
#define FEAT_NORMAL
#define FEAT_SMALL
#define FEAT_TINY
#define FEAT_WRITEBACKUP
#define VIM_BACKTICK /* internal backtick expansion */

7
config/pathdef.c.in Normal file
View File

@ -0,0 +1,7 @@
#include "${PROJECT_SOURCE_DIR}/src/vim.h"
char_u *default_vim_dir = (char_u *)"${CMAKE_INSTALL_PREFIX}/share/vim";
char_u *default_vimruntime_dir = (char_u *)"";
char_u *all_cflags = (char_u *)"${COMPILER_FLAGS}";
char_u *all_lflags = (char_u *)"${LINKER_FLAGS}";
char_u *compiled_user = (char_u *)"${USERNAME}";
char_u *compiled_sys = (char_u *)"${HOSTNAME}";

18
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,18 @@
file( GLOB NEOVIM_SOURCES *.c )
foreach(sfile ${NEOVIM_SOURCES})
get_filename_component(f ${sfile} NAME)
if(${f} MATCHES "^(regexp_nfa.c|farsi.c|arabic.c)$")
list(APPEND to_remove ${sfile})
endif()
endforeach()
list(REMOVE_ITEM NEOVIM_SOURCES ${to_remove})
list(APPEND NEOVIM_SOURCES "${PROJECT_BINARY_DIR}/config/auto/pathdef.c")
file( GLOB IO_SOURCES io/*.c )
add_executable (vim ${NEOVIM_SOURCES} ${IO_SOURCES})
target_link_libraries (vim m termcap selinux)
include_directories ("${PROJECT_SOURCE_DIR}/src/proto")

1134
src/arabic.c Normal file

File diff suppressed because it is too large Load Diff

258
src/arabic.h Normal file
View File

@ -0,0 +1,258 @@
/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved 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.
*/
/*
* Arabic characters are categorized into following types:
*
* Isolated - iso-8859-6 form char denoted with a_*
* Initial - unicode form-B start char denoted with a_i_*
* Medial - unicode form-B middle char denoted with a_m_*
* Final - unicode form-B final char denoted with a_f_*
* Stand-Alone - unicode form-B isolated char denoted with a_s_* (NOT USED)
*
* --
*
* Author: Nadim Shaikli & Isam Bayazidi
* - (based on Unicode)
*
*/
/*
* Arabic ISO-10646-1 character set definition
*/
/*
* Arabic ISO-8859-6 (subset of 10646; 0600 - 06FF)
*/
#define a_COMMA 0x060C
#define a_SEMICOLON 0x061B
#define a_QUESTION 0x061F
#define a_HAMZA 0x0621
#define a_ALEF_MADDA 0x0622
#define a_ALEF_HAMZA_ABOVE 0x0623
#define a_WAW_HAMZA 0x0624
#define a_ALEF_HAMZA_BELOW 0x0625
#define a_YEH_HAMZA 0x0626
#define a_ALEF 0x0627
#define a_BEH 0x0628
#define a_TEH_MARBUTA 0x0629
#define a_TEH 0x062a
#define a_THEH 0x062b
#define a_JEEM 0x062c
#define a_HAH 0x062d
#define a_KHAH 0x062e
#define a_DAL 0x062f
#define a_THAL 0x0630
#define a_REH 0x0631
#define a_ZAIN 0x0632
#define a_SEEN 0x0633
#define a_SHEEN 0x0634
#define a_SAD 0x0635
#define a_DAD 0x0636
#define a_TAH 0x0637
#define a_ZAH 0x0638
#define a_AIN 0x0639
#define a_GHAIN 0x063a
#define a_TATWEEL 0x0640
#define a_FEH 0x0641
#define a_QAF 0x0642
#define a_KAF 0x0643
#define a_LAM 0x0644
#define a_MEEM 0x0645
#define a_NOON 0x0646
#define a_HEH 0x0647
#define a_WAW 0x0648
#define a_ALEF_MAKSURA 0x0649
#define a_YEH 0x064a
#define a_FATHATAN 0x064b
#define a_DAMMATAN 0x064c
#define a_KASRATAN 0x064d
#define a_FATHA 0x064e
#define a_DAMMA 0x064f
#define a_KASRA 0x0650
#define a_SHADDA 0x0651
#define a_SUKUN 0x0652
#define a_MADDA_ABOVE 0x0653
#define a_HAMZA_ABOVE 0x0654
#define a_HAMZA_BELOW 0x0655
#define a_ZERO 0x0660
#define a_ONE 0x0661
#define a_TWO 0x0662
#define a_THREE 0x0663
#define a_FOUR 0x0664
#define a_FIVE 0x0665
#define a_SIX 0x0666
#define a_SEVEN 0x0667
#define a_EIGHT 0x0668
#define a_NINE 0x0669
#define a_PERCENT 0x066a
#define a_DECIMAL 0x066b
#define a_THOUSANDS 0x066c
#define a_STAR 0x066d
#define a_MINI_ALEF 0x0670
/* Rest of 8859-6 does not relate to Arabic */
/*
* Arabic Presentation Form-B (subset of 10646; FE70 - FEFF)
*
* s -> isolated
* i -> initial
* m -> medial
* f -> final
*
*/
#define a_s_FATHATAN 0xfe70
#define a_m_TATWEEL_FATHATAN 0xfe71
#define a_s_DAMMATAN 0xfe72
#define a_s_KASRATAN 0xfe74
#define a_s_FATHA 0xfe76
#define a_m_FATHA 0xfe77
#define a_s_DAMMA 0xfe78
#define a_m_DAMMA 0xfe79
#define a_s_KASRA 0xfe7a
#define a_m_KASRA 0xfe7b
#define a_s_SHADDA 0xfe7c
#define a_m_SHADDA 0xfe7d
#define a_s_SUKUN 0xfe7e
#define a_m_SUKUN 0xfe7f
#define a_s_HAMZA 0xfe80
#define a_s_ALEF_MADDA 0xfe81
#define a_f_ALEF_MADDA 0xfe82
#define a_s_ALEF_HAMZA_ABOVE 0xfe83
#define a_f_ALEF_HAMZA_ABOVE 0xfe84
#define a_s_WAW_HAMZA 0xfe85
#define a_f_WAW_HAMZA 0xfe86
#define a_s_ALEF_HAMZA_BELOW 0xfe87
#define a_f_ALEF_HAMZA_BELOW 0xfe88
#define a_s_YEH_HAMZA 0xfe89
#define a_f_YEH_HAMZA 0xfe8a
#define a_i_YEH_HAMZA 0xfe8b
#define a_m_YEH_HAMZA 0xfe8c
#define a_s_ALEF 0xfe8d
#define a_f_ALEF 0xfe8e
#define a_s_BEH 0xfe8f
#define a_f_BEH 0xfe90
#define a_i_BEH 0xfe91
#define a_m_BEH 0xfe92
#define a_s_TEH_MARBUTA 0xfe93
#define a_f_TEH_MARBUTA 0xfe94
#define a_s_TEH 0xfe95
#define a_f_TEH 0xfe96
#define a_i_TEH 0xfe97
#define a_m_TEH 0xfe98
#define a_s_THEH 0xfe99
#define a_f_THEH 0xfe9a
#define a_i_THEH 0xfe9b
#define a_m_THEH 0xfe9c
#define a_s_JEEM 0xfe9d
#define a_f_JEEM 0xfe9e
#define a_i_JEEM 0xfe9f
#define a_m_JEEM 0xfea0
#define a_s_HAH 0xfea1
#define a_f_HAH 0xfea2
#define a_i_HAH 0xfea3
#define a_m_HAH 0xfea4
#define a_s_KHAH 0xfea5
#define a_f_KHAH 0xfea6
#define a_i_KHAH 0xfea7
#define a_m_KHAH 0xfea8
#define a_s_DAL 0xfea9
#define a_f_DAL 0xfeaa
#define a_s_THAL 0xfeab
#define a_f_THAL 0xfeac
#define a_s_REH 0xfead
#define a_f_REH 0xfeae
#define a_s_ZAIN 0xfeaf
#define a_f_ZAIN 0xfeb0
#define a_s_SEEN 0xfeb1
#define a_f_SEEN 0xfeb2
#define a_i_SEEN 0xfeb3
#define a_m_SEEN 0xfeb4
#define a_s_SHEEN 0xfeb5
#define a_f_SHEEN 0xfeb6
#define a_i_SHEEN 0xfeb7
#define a_m_SHEEN 0xfeb8
#define a_s_SAD 0xfeb9
#define a_f_SAD 0xfeba
#define a_i_SAD 0xfebb
#define a_m_SAD 0xfebc
#define a_s_DAD 0xfebd
#define a_f_DAD 0xfebe
#define a_i_DAD 0xfebf
#define a_m_DAD 0xfec0
#define a_s_TAH 0xfec1
#define a_f_TAH 0xfec2
#define a_i_TAH 0xfec3
#define a_m_TAH 0xfec4
#define a_s_ZAH 0xfec5
#define a_f_ZAH 0xfec6
#define a_i_ZAH 0xfec7
#define a_m_ZAH 0xfec8
#define a_s_AIN 0xfec9
#define a_f_AIN 0xfeca
#define a_i_AIN 0xfecb
#define a_m_AIN 0xfecc
#define a_s_GHAIN 0xfecd
#define a_f_GHAIN 0xfece
#define a_i_GHAIN 0xfecf
#define a_m_GHAIN 0xfed0
#define a_s_FEH 0xfed1
#define a_f_FEH 0xfed2
#define a_i_FEH 0xfed3
#define a_m_FEH 0xfed4
#define a_s_QAF 0xfed5
#define a_f_QAF 0xfed6
#define a_i_QAF 0xfed7
#define a_m_QAF 0xfed8
#define a_s_KAF 0xfed9
#define a_f_KAF 0xfeda
#define a_i_KAF 0xfedb
#define a_m_KAF 0xfedc
#define a_s_LAM 0xfedd
#define a_f_LAM 0xfede
#define a_i_LAM 0xfedf
#define a_m_LAM 0xfee0
#define a_s_MEEM 0xfee1
#define a_f_MEEM 0xfee2
#define a_i_MEEM 0xfee3
#define a_m_MEEM 0xfee4
#define a_s_NOON 0xfee5
#define a_f_NOON 0xfee6
#define a_i_NOON 0xfee7
#define a_m_NOON 0xfee8
#define a_s_HEH 0xfee9
#define a_f_HEH 0xfeea
#define a_i_HEH 0xfeeb
#define a_m_HEH 0xfeec
#define a_s_WAW 0xfeed
#define a_f_WAW 0xfeee
#define a_s_ALEF_MAKSURA 0xfeef
#define a_f_ALEF_MAKSURA 0xfef0
#define a_s_YEH 0xfef1
#define a_f_YEH 0xfef2
#define a_i_YEH 0xfef3
#define a_m_YEH 0xfef4
#define a_s_LAM_ALEF_MADDA_ABOVE 0xfef5
#define a_f_LAM_ALEF_MADDA_ABOVE 0xfef6
#define a_s_LAM_ALEF_HAMZA_ABOVE 0xfef7
#define a_f_LAM_ALEF_HAMZA_ABOVE 0xfef8
#define a_s_LAM_ALEF_HAMZA_BELOW 0xfef9
#define a_f_LAM_ALEF_HAMZA_BELOW 0xfefa
#define a_s_LAM_ALEF 0xfefb
#define a_f_LAM_ALEF 0xfefc
#define a_BYTE_ORDER_MARK 0xfeff
/* Range of Arabic characters that might be shaped. */
#define ARABIC_CHAR(c) ((c) >= a_HAMZA && (c) <= a_MINI_ALEF)

96
src/ascii.h Normal file
View File

@ -0,0 +1,96 @@
/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved 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.
*/
/*
* Definitions of various common control characters.
* For EBCDIC we have to use different values.
*/
/* IF_EB(ASCII_constant, EBCDIC_constant) */
#define IF_EB(a, b) a
#define CharOrd(x) ((x) < 'a' ? (x) - 'A' : (x) - 'a')
#define CharOrdLow(x) ((x) - 'a')
#define CharOrdUp(x) ((x) - 'A')
#define ROT13(c, a) (((((c) - (a)) + 13) % 26) + (a))
#define NUL '\000'
#define BELL '\007'
#define BS '\010'
#define TAB '\011'
#define NL '\012'
#define NL_STR (char_u *)"\012"
#define FF '\014'
#define CAR '\015' /* CR is used by Mac OS X */
#define ESC '\033'
#define ESC_STR (char_u *)"\033"
#define ESC_STR_nc "\033"
#define DEL 0x7f
#define DEL_STR (char_u *)"\177"
#define CSI 0x9b /* Control Sequence Introducer */
#define CSI_STR "\233"
#define DCS 0x90 /* Device Control String */
#define STERM 0x9c /* String Terminator */
#define POUND 0xA3
#define Ctrl_chr(x) (TOUPPER_ASC(x) ^ 0x40) /* '?' -> DEL, '@' -> ^@, etc. */
#define Meta(x) ((x) | 0x80)
#define CTRL_F_STR "\006"
#define CTRL_H_STR "\010"
#define CTRL_V_STR "\026"
#define Ctrl_AT 0 /* @ */
#define Ctrl_A 1
#define Ctrl_B 2
#define Ctrl_C 3
#define Ctrl_D 4
#define Ctrl_E 5
#define Ctrl_F 6
#define Ctrl_G 7
#define Ctrl_H 8
#define Ctrl_I 9
#define Ctrl_J 10
#define Ctrl_K 11
#define Ctrl_L 12
#define Ctrl_M 13
#define Ctrl_N 14
#define Ctrl_O 15
#define Ctrl_P 16
#define Ctrl_Q 17
#define Ctrl_R 18
#define Ctrl_S 19
#define Ctrl_T 20
#define Ctrl_U 21
#define Ctrl_V 22
#define Ctrl_W 23
#define Ctrl_X 24
#define Ctrl_Y 25
#define Ctrl_Z 26
/* CTRL- [ Left Square Bracket == ESC*/
#define Ctrl_BSL 28 /* \ BackSLash */
#define Ctrl_RSB 29 /* ] Right Square Bracket */
#define Ctrl_HAT 30 /* ^ */
#define Ctrl__ 31
/*
* Character that separates dir names in a path.
* For MS-DOS, WIN32 and OS/2 we use a backslash. A slash mostly works
* fine, but there are places where it doesn't (e.g. in a command name).
* For Acorn we use a dot.
*/
#ifdef BACKSLASH_IN_FILENAME
# define PATHSEP psepc
# define PATHSEPSTR pseps
#else
# define PATHSEP '/'
# define PATHSEPSTR "/"
#endif

637
src/blowfish.c Normal file
View File

@ -0,0 +1,637 @@
/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved 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.
*
* Blowfish encryption for Vim; in Blowfish output feedback mode.
* Contributed by Mohsin Ahmed, http://www.cs.albany.edu/~mosh
* Based on http://www.schneier.com/blowfish.html by Bruce Schneier.
*/
#include "vim.h"
#define ARRAY_LENGTH(A) (sizeof(A)/sizeof(A[0]))
#define BF_BLOCK 8
#define BF_BLOCK_MASK 7
#define BF_OFB_LEN (8*(BF_BLOCK))
typedef union {
UINT32_T ul[2];
char_u uc[8];
} block8;
static void bf_e_block __ARGS((UINT32_T *p_xl, UINT32_T *p_xr));
static void bf_e_cblock __ARGS((char_u *block));
static int bf_check_tables __ARGS((UINT32_T a_ipa[18], UINT32_T a_sbi[4][256],
UINT32_T val));
static int bf_self_test __ARGS((void));
/* Blowfish code */
static UINT32_T pax[18];
static UINT32_T ipa[18] = {
0x243f6a88u, 0x85a308d3u, 0x13198a2eu,
0x03707344u, 0xa4093822u, 0x299f31d0u,
0x082efa98u, 0xec4e6c89u, 0x452821e6u,
0x38d01377u, 0xbe5466cfu, 0x34e90c6cu,
0xc0ac29b7u, 0xc97c50ddu, 0x3f84d5b5u,
0xb5470917u, 0x9216d5d9u, 0x8979fb1bu
};
static UINT32_T sbx[4][256];
static UINT32_T sbi[4][256] = {
{0xd1310ba6u, 0x98dfb5acu, 0x2ffd72dbu, 0xd01adfb7u,
0xb8e1afedu, 0x6a267e96u, 0xba7c9045u, 0xf12c7f99u,
0x24a19947u, 0xb3916cf7u, 0x0801f2e2u, 0x858efc16u,
0x636920d8u, 0x71574e69u, 0xa458fea3u, 0xf4933d7eu,
0x0d95748fu, 0x728eb658u, 0x718bcd58u, 0x82154aeeu,
0x7b54a41du, 0xc25a59b5u, 0x9c30d539u, 0x2af26013u,
0xc5d1b023u, 0x286085f0u, 0xca417918u, 0xb8db38efu,
0x8e79dcb0u, 0x603a180eu, 0x6c9e0e8bu, 0xb01e8a3eu,
0xd71577c1u, 0xbd314b27u, 0x78af2fdau, 0x55605c60u,
0xe65525f3u, 0xaa55ab94u, 0x57489862u, 0x63e81440u,
0x55ca396au, 0x2aab10b6u, 0xb4cc5c34u, 0x1141e8ceu,
0xa15486afu, 0x7c72e993u, 0xb3ee1411u, 0x636fbc2au,
0x2ba9c55du, 0x741831f6u, 0xce5c3e16u, 0x9b87931eu,
0xafd6ba33u, 0x6c24cf5cu, 0x7a325381u, 0x28958677u,
0x3b8f4898u, 0x6b4bb9afu, 0xc4bfe81bu, 0x66282193u,
0x61d809ccu, 0xfb21a991u, 0x487cac60u, 0x5dec8032u,
0xef845d5du, 0xe98575b1u, 0xdc262302u, 0xeb651b88u,
0x23893e81u, 0xd396acc5u, 0x0f6d6ff3u, 0x83f44239u,
0x2e0b4482u, 0xa4842004u, 0x69c8f04au, 0x9e1f9b5eu,
0x21c66842u, 0xf6e96c9au, 0x670c9c61u, 0xabd388f0u,
0x6a51a0d2u, 0xd8542f68u, 0x960fa728u, 0xab5133a3u,
0x6eef0b6cu, 0x137a3be4u, 0xba3bf050u, 0x7efb2a98u,
0xa1f1651du, 0x39af0176u, 0x66ca593eu, 0x82430e88u,
0x8cee8619u, 0x456f9fb4u, 0x7d84a5c3u, 0x3b8b5ebeu,
0xe06f75d8u, 0x85c12073u, 0x401a449fu, 0x56c16aa6u,
0x4ed3aa62u, 0x363f7706u, 0x1bfedf72u, 0x429b023du,
0x37d0d724u, 0xd00a1248u, 0xdb0fead3u, 0x49f1c09bu,
0x075372c9u, 0x80991b7bu, 0x25d479d8u, 0xf6e8def7u,
0xe3fe501au, 0xb6794c3bu, 0x976ce0bdu, 0x04c006bau,
0xc1a94fb6u, 0x409f60c4u, 0x5e5c9ec2u, 0x196a2463u,
0x68fb6fafu, 0x3e6c53b5u, 0x1339b2ebu, 0x3b52ec6fu,
0x6dfc511fu, 0x9b30952cu, 0xcc814544u, 0xaf5ebd09u,
0xbee3d004u, 0xde334afdu, 0x660f2807u, 0x192e4bb3u,
0xc0cba857u, 0x45c8740fu, 0xd20b5f39u, 0xb9d3fbdbu,
0x5579c0bdu, 0x1a60320au, 0xd6a100c6u, 0x402c7279u,
0x679f25feu, 0xfb1fa3ccu, 0x8ea5e9f8u, 0xdb3222f8u,
0x3c7516dfu, 0xfd616b15u, 0x2f501ec8u, 0xad0552abu,
0x323db5fau, 0xfd238760u, 0x53317b48u, 0x3e00df82u,
0x9e5c57bbu, 0xca6f8ca0u, 0x1a87562eu, 0xdf1769dbu,
0xd542a8f6u, 0x287effc3u, 0xac6732c6u, 0x8c4f5573u,
0x695b27b0u, 0xbbca58c8u, 0xe1ffa35du, 0xb8f011a0u,
0x10fa3d98u, 0xfd2183b8u, 0x4afcb56cu, 0x2dd1d35bu,
0x9a53e479u, 0xb6f84565u, 0xd28e49bcu, 0x4bfb9790u,
0xe1ddf2dau, 0xa4cb7e33u, 0x62fb1341u, 0xcee4c6e8u,
0xef20cadau, 0x36774c01u, 0xd07e9efeu, 0x2bf11fb4u,
0x95dbda4du, 0xae909198u, 0xeaad8e71u, 0x6b93d5a0u,
0xd08ed1d0u, 0xafc725e0u, 0x8e3c5b2fu, 0x8e7594b7u,
0x8ff6e2fbu, 0xf2122b64u, 0x8888b812u, 0x900df01cu,
0x4fad5ea0u, 0x688fc31cu, 0xd1cff191u, 0xb3a8c1adu,
0x2f2f2218u, 0xbe0e1777u, 0xea752dfeu, 0x8b021fa1u,
0xe5a0cc0fu, 0xb56f74e8u, 0x18acf3d6u, 0xce89e299u,
0xb4a84fe0u, 0xfd13e0b7u, 0x7cc43b81u, 0xd2ada8d9u,
0x165fa266u, 0x80957705u, 0x93cc7314u, 0x211a1477u,
0xe6ad2065u, 0x77b5fa86u, 0xc75442f5u, 0xfb9d35cfu,
0xebcdaf0cu, 0x7b3e89a0u, 0xd6411bd3u, 0xae1e7e49u,
0x00250e2du, 0x2071b35eu, 0x226800bbu, 0x57b8e0afu,
0x2464369bu, 0xf009b91eu, 0x5563911du, 0x59dfa6aau,
0x78c14389u, 0xd95a537fu, 0x207d5ba2u, 0x02e5b9c5u,
0x83260376u, 0x6295cfa9u, 0x11c81968u, 0x4e734a41u,
0xb3472dcau, 0x7b14a94au, 0x1b510052u, 0x9a532915u,
0xd60f573fu, 0xbc9bc6e4u, 0x2b60a476u, 0x81e67400u,
0x08ba6fb5u, 0x571be91fu, 0xf296ec6bu, 0x2a0dd915u,
0xb6636521u, 0xe7b9f9b6u, 0xff34052eu, 0xc5855664u,
0x53b02d5du, 0xa99f8fa1u, 0x08ba4799u, 0x6e85076au},
{0x4b7a70e9u, 0xb5b32944u, 0xdb75092eu, 0xc4192623u,
0xad6ea6b0u, 0x49a7df7du, 0x9cee60b8u, 0x8fedb266u,
0xecaa8c71u, 0x699a17ffu, 0x5664526cu, 0xc2b19ee1u,
0x193602a5u, 0x75094c29u, 0xa0591340u, 0xe4183a3eu,
0x3f54989au, 0x5b429d65u, 0x6b8fe4d6u, 0x99f73fd6u,
0xa1d29c07u, 0xefe830f5u, 0x4d2d38e6u, 0xf0255dc1u,
0x4cdd2086u, 0x8470eb26u, 0x6382e9c6u, 0x021ecc5eu,
0x09686b3fu, 0x3ebaefc9u, 0x3c971814u, 0x6b6a70a1u,
0x687f3584u, 0x52a0e286u, 0xb79c5305u, 0xaa500737u,
0x3e07841cu, 0x7fdeae5cu, 0x8e7d44ecu, 0x5716f2b8u,
0xb03ada37u, 0xf0500c0du, 0xf01c1f04u, 0x0200b3ffu,
0xae0cf51au, 0x3cb574b2u, 0x25837a58u, 0xdc0921bdu,
0xd19113f9u, 0x7ca92ff6u, 0x94324773u, 0x22f54701u,
0x3ae5e581u, 0x37c2dadcu, 0xc8b57634u, 0x9af3dda7u,
0xa9446146u, 0x0fd0030eu, 0xecc8c73eu, 0xa4751e41u,
0xe238cd99u, 0x3bea0e2fu, 0x3280bba1u, 0x183eb331u,
0x4e548b38u, 0x4f6db908u, 0x6f420d03u, 0xf60a04bfu,
0x2cb81290u, 0x24977c79u, 0x5679b072u, 0xbcaf89afu,
0xde9a771fu, 0xd9930810u, 0xb38bae12u, 0xdccf3f2eu,
0x5512721fu, 0x2e6b7124u, 0x501adde6u, 0x9f84cd87u,
0x7a584718u, 0x7408da17u, 0xbc9f9abcu, 0xe94b7d8cu,
0xec7aec3au, 0xdb851dfau, 0x63094366u, 0xc464c3d2u,
0xef1c1847u, 0x3215d908u, 0xdd433b37u, 0x24c2ba16u,
0x12a14d43u, 0x2a65c451u, 0x50940002u, 0x133ae4ddu,
0x71dff89eu, 0x10314e55u, 0x81ac77d6u, 0x5f11199bu,
0x043556f1u, 0xd7a3c76bu, 0x3c11183bu, 0x5924a509u,
0xf28fe6edu, 0x97f1fbfau, 0x9ebabf2cu, 0x1e153c6eu,
0x86e34570u, 0xeae96fb1u, 0x860e5e0au, 0x5a3e2ab3u,
0x771fe71cu, 0x4e3d06fau, 0x2965dcb9u, 0x99e71d0fu,
0x803e89d6u, 0x5266c825u, 0x2e4cc978u, 0x9c10b36au,
0xc6150ebau, 0x94e2ea78u, 0xa5fc3c53u, 0x1e0a2df4u,
0xf2f74ea7u, 0x361d2b3du, 0x1939260fu, 0x19c27960u,
0x5223a708u, 0xf71312b6u, 0xebadfe6eu, 0xeac31f66u,
0xe3bc4595u, 0xa67bc883u, 0xb17f37d1u, 0x018cff28u,
0xc332ddefu, 0xbe6c5aa5u, 0x65582185u, 0x68ab9802u,
0xeecea50fu, 0xdb2f953bu, 0x2aef7dadu, 0x5b6e2f84u,
0x1521b628u, 0x29076170u, 0xecdd4775u, 0x619f1510u,
0x13cca830u, 0xeb61bd96u, 0x0334fe1eu, 0xaa0363cfu,
0xb5735c90u, 0x4c70a239u, 0xd59e9e0bu, 0xcbaade14u,
0xeecc86bcu, 0x60622ca7u, 0x9cab5cabu, 0xb2f3846eu,
0x648b1eafu, 0x19bdf0cau, 0xa02369b9u, 0x655abb50u,
0x40685a32u, 0x3c2ab4b3u, 0x319ee9d5u, 0xc021b8f7u,
0x9b540b19u, 0x875fa099u, 0x95f7997eu, 0x623d7da8u,
0xf837889au, 0x97e32d77u, 0x11ed935fu, 0x16681281u,
0x0e358829u, 0xc7e61fd6u, 0x96dedfa1u, 0x7858ba99u,
0x57f584a5u, 0x1b227263u, 0x9b83c3ffu, 0x1ac24696u,
0xcdb30aebu, 0x532e3054u, 0x8fd948e4u, 0x6dbc3128u,
0x58ebf2efu, 0x34c6ffeau, 0xfe28ed61u, 0xee7c3c73u,
0x5d4a14d9u, 0xe864b7e3u, 0x42105d14u, 0x203e13e0u,
0x45eee2b6u, 0xa3aaabeau, 0xdb6c4f15u, 0xfacb4fd0u,
0xc742f442u, 0xef6abbb5u, 0x654f3b1du, 0x41cd2105u,
0xd81e799eu, 0x86854dc7u, 0xe44b476au, 0x3d816250u,
0xcf62a1f2u, 0x5b8d2646u, 0xfc8883a0u, 0xc1c7b6a3u,
0x7f1524c3u, 0x69cb7492u, 0x47848a0bu, 0x5692b285u,
0x095bbf00u, 0xad19489du, 0x1462b174u, 0x23820e00u,
0x58428d2au, 0x0c55f5eau, 0x1dadf43eu, 0x233f7061u,
0x3372f092u, 0x8d937e41u, 0xd65fecf1u, 0x6c223bdbu,
0x7cde3759u, 0xcbee7460u, 0x4085f2a7u, 0xce77326eu,
0xa6078084u, 0x19f8509eu, 0xe8efd855u, 0x61d99735u,
0xa969a7aau, 0xc50c06c2u, 0x5a04abfcu, 0x800bcadcu,
0x9e447a2eu, 0xc3453484u, 0xfdd56705u, 0x0e1e9ec9u,
0xdb73dbd3u, 0x105588cdu, 0x675fda79u, 0xe3674340u,
0xc5c43465u, 0x713e38d8u, 0x3d28f89eu, 0xf16dff20u,
0x153e21e7u, 0x8fb03d4au, 0xe6e39f2bu, 0xdb83adf7u},
{0xe93d5a68u, 0x948140f7u, 0xf64c261cu, 0x94692934u,
0x411520f7u, 0x7602d4f7u, 0xbcf46b2eu, 0xd4a20068u,
0xd4082471u, 0x3320f46au, 0x43b7d4b7u, 0x500061afu,
0x1e39f62eu, 0x97244546u, 0x14214f74u, 0xbf8b8840u,
0x4d95fc1du, 0x96b591afu, 0x70f4ddd3u, 0x66a02f45u,
0xbfbc09ecu, 0x03bd9785u, 0x7fac6dd0u, 0x31cb8504u,
0x96eb27b3u, 0x55fd3941u, 0xda2547e6u, 0xabca0a9au,
0x28507825u, 0x530429f4u, 0x0a2c86dau, 0xe9b66dfbu,
0x68dc1462u, 0xd7486900u, 0x680ec0a4u, 0x27a18deeu,
0x4f3ffea2u, 0xe887ad8cu, 0xb58ce006u, 0x7af4d6b6u,
0xaace1e7cu, 0xd3375fecu, 0xce78a399u, 0x406b2a42u,
0x20fe9e35u, 0xd9f385b9u, 0xee39d7abu, 0x3b124e8bu,
0x1dc9faf7u, 0x4b6d1856u, 0x26a36631u, 0xeae397b2u,
0x3a6efa74u, 0xdd5b4332u, 0x6841e7f7u, 0xca7820fbu,
0xfb0af54eu, 0xd8feb397u, 0x454056acu, 0xba489527u,
0x55533a3au, 0x20838d87u, 0xfe6ba9b7u, 0xd096954bu,
0x55a867bcu, 0xa1159a58u, 0xcca92963u, 0x99e1db33u,
0xa62a4a56u, 0x3f3125f9u, 0x5ef47e1cu, 0x9029317cu,
0xfdf8e802u, 0x04272f70u, 0x80bb155cu, 0x05282ce3u,
0x95c11548u, 0xe4c66d22u, 0x48c1133fu, 0xc70f86dcu,
0x07f9c9eeu, 0x41041f0fu, 0x404779a4u, 0x5d886e17u,
0x325f51ebu, 0xd59bc0d1u, 0xf2bcc18fu, 0x41113564u,
0x257b7834u, 0x602a9c60u, 0xdff8e8a3u, 0x1f636c1bu,
0x0e12b4c2u, 0x02e1329eu, 0xaf664fd1u, 0xcad18115u,
0x6b2395e0u, 0x333e92e1u, 0x3b240b62u, 0xeebeb922u,
0x85b2a20eu, 0xe6ba0d99u, 0xde720c8cu, 0x2da2f728u,
0xd0127845u, 0x95b794fdu, 0x647d0862u, 0xe7ccf5f0u,
0x5449a36fu, 0x877d48fau, 0xc39dfd27u, 0xf33e8d1eu,
0x0a476341u, 0x992eff74u, 0x3a6f6eabu, 0xf4f8fd37u,
0xa812dc60u, 0xa1ebddf8u, 0x991be14cu, 0xdb6e6b0du,
0xc67b5510u, 0x6d672c37u, 0x2765d43bu, 0xdcd0e804u,
0xf1290dc7u, 0xcc00ffa3u, 0xb5390f92u, 0x690fed0bu,
0x667b9ffbu, 0xcedb7d9cu, 0xa091cf0bu, 0xd9155ea3u,
0xbb132f88u, 0x515bad24u, 0x7b9479bfu, 0x763bd6ebu,
0x37392eb3u, 0xcc115979u, 0x8026e297u, 0xf42e312du,
0x6842ada7u, 0xc66a2b3bu, 0x12754cccu, 0x782ef11cu,
0x6a124237u, 0xb79251e7u, 0x06a1bbe6u, 0x4bfb6350u,
0x1a6b1018u, 0x11caedfau, 0x3d25bdd8u, 0xe2e1c3c9u,
0x44421659u, 0x0a121386u, 0xd90cec6eu, 0xd5abea2au,
0x64af674eu, 0xda86a85fu, 0xbebfe988u, 0x64e4c3feu,
0x9dbc8057u, 0xf0f7c086u, 0x60787bf8u, 0x6003604du,
0xd1fd8346u, 0xf6381fb0u, 0x7745ae04u, 0xd736fcccu,
0x83426b33u, 0xf01eab71u, 0xb0804187u, 0x3c005e5fu,
0x77a057beu, 0xbde8ae24u, 0x55464299u, 0xbf582e61u,
0x4e58f48fu, 0xf2ddfda2u, 0xf474ef38u, 0x8789bdc2u,
0x5366f9c3u, 0xc8b38e74u, 0xb475f255u, 0x46fcd9b9u,
0x7aeb2661u, 0x8b1ddf84u, 0x846a0e79u, 0x915f95e2u,
0x466e598eu, 0x20b45770u, 0x8cd55591u, 0xc902de4cu,
0xb90bace1u, 0xbb8205d0u, 0x11a86248u, 0x7574a99eu,
0xb77f19b6u, 0xe0a9dc09u, 0x662d09a1u, 0xc4324633u,
0xe85a1f02u, 0x09f0be8cu, 0x4a99a025u, 0x1d6efe10u,
0x1ab93d1du, 0x0ba5a4dfu, 0xa186f20fu, 0x2868f169u,
0xdcb7da83u, 0x573906feu, 0xa1e2ce9bu, 0x4fcd7f52u,
0x50115e01u, 0xa70683fau, 0xa002b5c4u, 0x0de6d027u,
0x9af88c27u, 0x773f8641u, 0xc3604c06u, 0x61a806b5u,
0xf0177a28u, 0xc0f586e0u, 0x006058aau, 0x30dc7d62u,
0x11e69ed7u, 0x2338ea63u, 0x53c2dd94u, 0xc2c21634u,
0xbbcbee56u, 0x90bcb6deu, 0xebfc7da1u, 0xce591d76u,
0x6f05e409u, 0x4b7c0188u, 0x39720a3du, 0x7c927c24u,
0x86e3725fu, 0x724d9db9u, 0x1ac15bb4u, 0xd39eb8fcu,
0xed545578u, 0x08fca5b5u, 0xd83d7cd3u, 0x4dad0fc4u,
0x1e50ef5eu, 0xb161e6f8u, 0xa28514d9u, 0x6c51133cu,
0x6fd5c7e7u, 0x56e14ec4u, 0x362abfceu, 0xddc6c837u,
0xd79a3234u, 0x92638212u, 0x670efa8eu, 0x406000e0u},
{0x3a39ce37u, 0xd3faf5cfu, 0xabc27737u, 0x5ac52d1bu,
0x5cb0679eu, 0x4fa33742u, 0xd3822740u, 0x99bc9bbeu,
0xd5118e9du, 0xbf0f7315u, 0xd62d1c7eu, 0xc700c47bu,
0xb78c1b6bu, 0x21a19045u, 0xb26eb1beu, 0x6a366eb4u,
0x5748ab2fu, 0xbc946e79u, 0xc6a376d2u, 0x6549c2c8u,
0x530ff8eeu, 0x468dde7du, 0xd5730a1du, 0x4cd04dc6u,
0x2939bbdbu, 0xa9ba4650u, 0xac9526e8u, 0xbe5ee304u,
0xa1fad5f0u, 0x6a2d519au, 0x63ef8ce2u, 0x9a86ee22u,
0xc089c2b8u, 0x43242ef6u, 0xa51e03aau, 0x9cf2d0a4u,
0x83c061bau, 0x9be96a4du, 0x8fe51550u, 0xba645bd6u,
0x2826a2f9u, 0xa73a3ae1u, 0x4ba99586u, 0xef5562e9u,
0xc72fefd3u, 0xf752f7dau, 0x3f046f69u, 0x77fa0a59u,
0x80e4a915u, 0x87b08601u, 0x9b09e6adu, 0x3b3ee593u,
0xe990fd5au, 0x9e34d797u, 0x2cf0b7d9u, 0x022b8b51u,
0x96d5ac3au, 0x017da67du, 0xd1cf3ed6u, 0x7c7d2d28u,
0x1f9f25cfu, 0xadf2b89bu, 0x5ad6b472u, 0x5a88f54cu,
0xe029ac71u, 0xe019a5e6u, 0x47b0acfdu, 0xed93fa9bu,
0xe8d3c48du, 0x283b57ccu, 0xf8d56629u, 0x79132e28u,
0x785f0191u, 0xed756055u, 0xf7960e44u, 0xe3d35e8cu,
0x15056dd4u, 0x88f46dbau, 0x03a16125u, 0x0564f0bdu,
0xc3eb9e15u, 0x3c9057a2u, 0x97271aecu, 0xa93a072au,
0x1b3f6d9bu, 0x1e6321f5u, 0xf59c66fbu, 0x26dcf319u,
0x7533d928u, 0xb155fdf5u, 0x03563482u, 0x8aba3cbbu,
0x28517711u, 0xc20ad9f8u, 0xabcc5167u, 0xccad925fu,
0x4de81751u, 0x3830dc8eu, 0x379d5862u, 0x9320f991u,
0xea7a90c2u, 0xfb3e7bceu, 0x5121ce64u, 0x774fbe32u,
0xa8b6e37eu, 0xc3293d46u, 0x48de5369u, 0x6413e680u,
0xa2ae0810u, 0xdd6db224u, 0x69852dfdu, 0x09072166u,
0xb39a460au, 0x6445c0ddu, 0x586cdecfu, 0x1c20c8aeu,
0x5bbef7ddu, 0x1b588d40u, 0xccd2017fu, 0x6bb4e3bbu,
0xdda26a7eu, 0x3a59ff45u, 0x3e350a44u, 0xbcb4cdd5u,
0x72eacea8u, 0xfa6484bbu, 0x8d6612aeu, 0xbf3c6f47u,
0xd29be463u, 0x542f5d9eu, 0xaec2771bu, 0xf64e6370u,
0x740e0d8du, 0xe75b1357u, 0xf8721671u, 0xaf537d5du,
0x4040cb08u, 0x4eb4e2ccu, 0x34d2466au, 0x0115af84u,
0xe1b00428u, 0x95983a1du, 0x06b89fb4u, 0xce6ea048u,
0x6f3f3b82u, 0x3520ab82u, 0x011a1d4bu, 0x277227f8u,
0x611560b1u, 0xe7933fdcu, 0xbb3a792bu, 0x344525bdu,
0xa08839e1u, 0x51ce794bu, 0x2f32c9b7u, 0xa01fbac9u,
0xe01cc87eu, 0xbcc7d1f6u, 0xcf0111c3u, 0xa1e8aac7u,
0x1a908749u, 0xd44fbd9au, 0xd0dadecbu, 0xd50ada38u,
0x0339c32au, 0xc6913667u, 0x8df9317cu, 0xe0b12b4fu,
0xf79e59b7u, 0x43f5bb3au, 0xf2d519ffu, 0x27d9459cu,
0xbf97222cu, 0x15e6fc2au, 0x0f91fc71u, 0x9b941525u,
0xfae59361u, 0xceb69cebu, 0xc2a86459u, 0x12baa8d1u,
0xb6c1075eu, 0xe3056a0cu, 0x10d25065u, 0xcb03a442u,
0xe0ec6e0eu, 0x1698db3bu, 0x4c98a0beu, 0x3278e964u,
0x9f1f9532u, 0xe0d392dfu, 0xd3a0342bu, 0x8971f21eu,
0x1b0a7441u, 0x4ba3348cu, 0xc5be7120u, 0xc37632d8u,
0xdf359f8du, 0x9b992f2eu, 0xe60b6f47u, 0x0fe3f11du,
0xe54cda54u, 0x1edad891u, 0xce6279cfu, 0xcd3e7e6fu,
0x1618b166u, 0xfd2c1d05u, 0x848fd2c5u, 0xf6fb2299u,
0xf523f357u, 0xa6327623u, 0x93a83531u, 0x56cccd02u,
0xacf08162u, 0x5a75ebb5u, 0x6e163697u, 0x88d273ccu,
0xde966292u, 0x81b949d0u, 0x4c50901bu, 0x71c65614u,
0xe6c6c7bdu, 0x327a140au, 0x45e1d006u, 0xc3f27b9au,
0xc9aa53fdu, 0x62a80f00u, 0xbb25bfe2u, 0x35bdd2f6u,
0x71126905u, 0xb2040222u, 0xb6cbcf7cu, 0xcd769c2bu,
0x53113ec0u, 0x1640e3d3u, 0x38abbd60u, 0x2547adf0u,
0xba38209cu, 0xf746ce76u, 0x77afa1c5u, 0x20756060u,
0x85cbfe4eu, 0x8ae88dd8u, 0x7aaaf9b0u, 0x4cf9aa7eu,
0x1948c25cu, 0x02fb8a8cu, 0x01c36ae4u, 0xd6ebe1f9u,
0x90d4f869u, 0xa65cdea0u, 0x3f09252du, 0xc208e69fu,
0xb74e6132u, 0xce77e25bu, 0x578fdfe3u, 0x3ac372e6u}
};
#define F1(i) \
xl ^= pax[i]; \
xr ^= ((sbx[0][xl >> 24] + \
sbx[1][(xl & 0xFF0000) >> 16]) ^ \
sbx[2][(xl & 0xFF00) >> 8]) + \
sbx[3][xl & 0xFF];
#define F2(i) \
xr ^= pax[i]; \
xl ^= ((sbx[0][xr >> 24] + \
sbx[1][(xr & 0xFF0000) >> 16]) ^ \
sbx[2][(xr & 0xFF00) >> 8]) + \
sbx[3][xr & 0xFF];
static void bf_e_block(p_xl, p_xr)
UINT32_T *p_xl;
UINT32_T *p_xr;
{
UINT32_T temp, xl = *p_xl, xr = *p_xr;
F1(0) F2(1) F1(2) F2(3) F1(4) F2(5) F1(6) F2(7)
F1(8) F2(9) F1(10) F2(11) F1(12) F2(13) F1(14) F2(15)
xl ^= pax[16];
xr ^= pax[17];
temp = xl;
xl = xr;
xr = temp;
*p_xl = xl;
*p_xr = xr;
}
#ifdef WORDS_BIGENDIAN
# define htonl2(x) \
x = ((((x) & 0xffL) << 24) | (((x) & 0xff00L) << 8) | \
(((x) & 0xff0000L) >> 8) | (((x) & 0xff000000L) >> 24))
#else
# define htonl2(x)
#endif
static void bf_e_cblock(block)
char_u *block;
{
block8 bk;
memcpy(bk.uc, block, 8);
htonl2(bk.ul[0]);
htonl2(bk.ul[1]);
bf_e_block(&bk.ul[0], &bk.ul[1]);
htonl2(bk.ul[0]);
htonl2(bk.ul[1]);
memcpy(block, bk.uc, 8);
}
/*
* Initialize the crypt method using "password" as the encryption key and
* "salt[salt_len]" as the salt.
*/
void bf_key_init(password, salt, salt_len)
char_u *password;
char_u *salt;
int salt_len;
{
int i, j, keypos = 0;
unsigned u;
UINT32_T val, data_l, data_r;
char_u *key;
int keylen;
/* Process the key 1000 times.
* See http://en.wikipedia.org/wiki/Key_strengthening. */
key = sha256_key(password, salt, salt_len);
for (i = 0; i < 1000; i++)
key = sha256_key(key, salt, salt_len);
/* Convert the key from 64 hex chars to 32 binary chars. */
keylen = (int)STRLEN(key) / 2;
if (keylen == 0) {
EMSG(_("E831: bf_key_init() called with empty password"));
return;
}
for (i = 0; i < keylen; i++) {
sscanf((char *)&key[i * 2], "%2x", &u);
key[i] = u;
}
mch_memmove(sbx, sbi, 4 * 4 * 256);
for (i = 0; i < 18; ++i) {
val = 0;
for (j = 0; j < 4; ++j)
val = (val << 8) | key[keypos++ % keylen];
pax[i] = ipa[i] ^ val;
}
data_l = data_r = 0;
for (i = 0; i < 18; i += 2) {
bf_e_block(&data_l, &data_r);
pax[i + 0] = data_l;
pax[i + 1] = data_r;
}
for (i = 0; i < 4; ++i) {
for (j = 0; j < 256; j += 2) {
bf_e_block(&data_l, &data_r);
sbx[i][j + 0] = data_l;
sbx[i][j + 1] = data_r;
}
}
}
/*
* BF Self test for corrupted tables or instructions
*/
static int bf_check_tables(a_ipa, a_sbi, val)
UINT32_T a_ipa[18];
UINT32_T a_sbi[4][256];
UINT32_T val;
{
int i, j;
UINT32_T c = 0;
for (i = 0; i < 18; i++)
c ^= a_ipa[i];
for (i = 0; i < 4; i++)
for (j = 0; j < 256; j++)
c ^= a_sbi[i][j];
return c == val;
}
typedef struct {
char_u password[64];
char_u salt[9];
char_u plaintxt[9];
char_u cryptxt[9];
char_u badcryptxt[9]; /* cryptxt when big/little endian is wrong */
UINT32_T keysum;
} struct_bf_test_data;
/*
* Assert bf(password, plaintxt) is cryptxt.
* Assert csum(pax sbx(password)) is keysum.
*/
static struct_bf_test_data bf_test_data[] = {
{
"password",
"salt",
"plaintxt",
"\xad\x3d\xfa\x7f\xe8\xea\x40\xf6", /* cryptxt */
"\x72\x50\x3b\x38\x10\x60\x22\xa7", /* badcryptxt */
0x56701b5du /* keysum */
},
};
/*
* Return FAIL when there is something wrong with blowfish encryption.
*/
static int bf_self_test() {
int i, bn;
int err = 0;
block8 bk;
UINT32_T ui = 0xffffffffUL;
/* We can't simply use sizeof(UINT32_T), it would generate a compiler
* warning. */
if (ui != 0xffffffffUL || ui + 1 != 0) {
err++;
EMSG(_("E820: sizeof(uint32_t) != 4"));
}
if (!bf_check_tables(ipa, sbi, 0x6ffa520a))
err++;
bn = ARRAY_LENGTH(bf_test_data);
for (i = 0; i < bn; i++) {
bf_key_init((char_u *)(bf_test_data[i].password),
bf_test_data[i].salt,
(int)STRLEN(bf_test_data[i].salt));
if (!bf_check_tables(pax, sbx, bf_test_data[i].keysum))
err++;
/* Don't modify bf_test_data[i].plaintxt, self test is idempotent. */
memcpy(bk.uc, bf_test_data[i].plaintxt, 8);
bf_e_cblock(bk.uc);
if (memcmp(bk.uc, bf_test_data[i].cryptxt, 8) != 0) {
if (err == 0 && memcmp(bk.uc, bf_test_data[i].badcryptxt, 8) == 0)
EMSG(_("E817: Blowfish big/little endian use wrong"));
err++;
}
}
return err > 0 ? FAIL : OK;
}
/* Output feedback mode. */
static int randbyte_offset = 0;
static int update_offset = 0;
static char_u ofb_buffer[BF_OFB_LEN]; /* 64 bytes */
/*
* Initialize with seed "iv[iv_len]".
*/
void bf_ofb_init(iv, iv_len)
char_u *iv;
int iv_len;
{
int i, mi;
randbyte_offset = update_offset = 0;
vim_memset(ofb_buffer, 0, BF_OFB_LEN);
if (iv_len > 0) {
mi = iv_len > BF_OFB_LEN ? iv_len : BF_OFB_LEN;
for (i = 0; i < mi; i++)
ofb_buffer[i % BF_OFB_LEN] ^= iv[i % iv_len];
}
}
#define BF_OFB_UPDATE(c) { \
ofb_buffer[update_offset] ^= (char_u)c; \
if (++update_offset == BF_OFB_LEN) \
update_offset = 0; \
}
#define BF_RANBYTE(t) { \
if ((randbyte_offset & BF_BLOCK_MASK) == 0) \
bf_e_cblock(&ofb_buffer[randbyte_offset]); \
t = ofb_buffer[randbyte_offset]; \
if (++randbyte_offset == BF_OFB_LEN) \
randbyte_offset = 0; \
}
/*
* Encrypt "from[len]" into "to[len]".
* "from" and "to" can be equal to encrypt in place.
*/
void bf_crypt_encode(from, len, to)
char_u *from;
size_t len;
char_u *to;
{
size_t i;
int ztemp, t;
for (i = 0; i < len; ++i) {
ztemp = from[i];
BF_RANBYTE(t);
BF_OFB_UPDATE(ztemp);
to[i] = t ^ ztemp;
}
}
/*
* Decrypt "ptr[len]" in place.
*/
void bf_crypt_decode(ptr, len)
char_u *ptr;
long len;
{
char_u *p;
int t;
for (p = ptr; p < ptr + len; ++p) {
BF_RANBYTE(t);
*p ^= t;
BF_OFB_UPDATE(*p);
}
}
/*
* Initialize the encryption keys and the random header according to
* the given password.
*/
void bf_crypt_init_keys(passwd)
char_u *passwd; /* password string with which to modify keys */
{
char_u *p;
for (p = passwd; *p != NUL; ++p) {
BF_OFB_UPDATE(*p);
}
}
static int save_randbyte_offset;
static int save_update_offset;
static char_u save_ofb_buffer[BF_OFB_LEN];
static UINT32_T save_pax[18];
static UINT32_T save_sbx[4][256];
/*
* Save the current crypt state. Can only be used once before
* bf_crypt_restore().
*/
void bf_crypt_save() {
save_randbyte_offset = randbyte_offset;
save_update_offset = update_offset;
mch_memmove(save_ofb_buffer, ofb_buffer, BF_OFB_LEN);
mch_memmove(save_pax, pax, 4 * 18);
mch_memmove(save_sbx, sbx, 4 * 4 * 256);
}
/*
* Restore the current crypt state. Can only be used after
* bf_crypt_save().
*/
void bf_crypt_restore() {
randbyte_offset = save_randbyte_offset;
update_offset = save_update_offset;
mch_memmove(ofb_buffer, save_ofb_buffer, BF_OFB_LEN);
mch_memmove(pax, save_pax, 4 * 18);
mch_memmove(sbx, save_sbx, 4 * 4 * 256);
}
/*
* Run a test to check if the encryption works as expected.
* Give an error and return FAIL when not.
*/
int blowfish_self_test() {
if (sha256_self_test() == FAIL) {
EMSG(_("E818: sha256 test failed"));
return FAIL;
}
if (bf_self_test() == FAIL) {
EMSG(_("E819: Blowfish test failed"));
return FAIL;
}
return OK;
}

4517
src/buffer.c Normal file

File diff suppressed because it is too large Load Diff

1653
src/charset.c Normal file

File diff suppressed because it is too large Load Diff

2296
src/diff.c Normal file

File diff suppressed because it is too large Load Diff

2074
src/digraph.c Normal file

File diff suppressed because it is too large Load Diff

8419
src/edit.c Normal file

File diff suppressed because it is too large Load Diff

20483
src/eval.c Normal file

File diff suppressed because it is too large Load Diff

5679
src/ex_cmds.c Normal file

File diff suppressed because it is too large Load Diff

1191
src/ex_cmds.h Normal file

File diff suppressed because it is too large Load Diff

3618
src/ex_cmds2.c Normal file

File diff suppressed because it is too large Load Diff

9401
src/ex_docmd.c Normal file

File diff suppressed because it is too large Load Diff

2113
src/ex_eval.c Normal file

File diff suppressed because it is too large Load Diff

5487
src/ex_getln.c Normal file

File diff suppressed because it is too large Load Diff

2183
src/farsi.c Normal file

File diff suppressed because it is too large Load Diff

226
src/farsi.h Normal file
View File

@ -0,0 +1,226 @@
/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved 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.
*/
/*
* Farsi characters are categorized into following types:
*
* TyA (for capital letter representation)
* TyB (for types that look like _X e.g. AYN)
* TyC (for types that look like X_ e.g. YE_)
* TyD (for types that look like _X_ e.g. _AYN_)
* TyE (for types that look like X e.g. RE)
*/
/*
* Farsi character set definition
*/
/*
* Begin of the non-standard part
*/
#define TEE_ 0x80
#define ALEF_U_H_ 0x81
#define ALEF_ 0x82
#define _BE 0x83
#define _PE 0x84
#define _TE 0x85
#define _SE 0x86
#define _JIM 0x87
#define _CHE 0x88
#define _HE_J 0x89
#define _XE 0x8a
#define _SIN 0x8b
#define _SHIN 0x8c
#define _SAD 0x8d
#define _ZAD 0x8e
#define _AYN 0x8f
#define _AYN_ 0x90
#define AYN_ 0x91
#define _GHAYN 0x92
#define _GHAYN_ 0x93
#define GHAYN_ 0x94
#define _FE 0x95
#define _GHAF 0x96
#define _KAF 0x97
#define _GAF 0x98
#define _LAM 0x99
#define LA 0x9a
#define _MIM 0x9b
#define _NOON 0x9c
#define _HE 0x9d
#define _HE_ 0x9e
#define _YE 0x9f
#define _IE 0xec
#define IE_ 0xed
#define IE 0xfb
#define _YEE 0xee
#define YEE_ 0xef
#define YE_ 0xff
/*
* End of the non-standard part
*/
/*
* Standard part
*/
#define F_BLANK 0xa0 /* Farsi ' ' (SP) character */
#define F_PSP 0xa1 /* PSP for capitalizing of a character */
#define F_PCN 0xa2 /* PCN for redefining of the hamye meaning */
#define F_EXCL 0xa3 /* Farsi ! character */
#define F_CURRENCY 0xa4 /* Farsi Rial character */
#define F_PERCENT 0xa5 /* Farsi % character */
#define F_PERIOD 0xa6 /* Farsi '.' character */
#define F_COMMA 0xa7 /* Farsi ',' character */
#define F_LPARENT 0xa8 /* Farsi '(' character */
#define F_RPARENT 0xa9 /* Farsi ')' character */
#define F_MUL 0xaa /* Farsi 'x' character */
#define F_PLUS 0xab /* Farsi '+' character */
#define F_BCOMMA 0xac /* Farsi comma character */
#define F_MINUS 0xad /* Farsi '-' character */
#define F_DIVIDE 0xae /* Farsi divide (/) character */
#define F_SLASH 0xaf /* Farsi '/' character */
#define FARSI_0 0xb0
#define FARSI_1 0xb1
#define FARSI_2 0xb2
#define FARSI_3 0xb3
#define FARSI_4 0xb4
#define FARSI_5 0xb5
#define FARSI_6 0xb6
#define FARSI_7 0xb7
#define FARSI_8 0xb8
#define FARSI_9 0xb9
#define F_DCOLON 0xba /* Farsi ':' character */
#define F_SEMICOLON 0xbb /* Farsi ';' character */
#define F_GREATER 0xbc /* Farsi '>' character */
#define F_EQUALS 0xbd /* Farsi '=' character */
#define F_LESS 0xbe /* Farsi '<' character */
#define F_QUESTION 0xbf /* Farsi ? character */
#define ALEF_A 0xc0
#define ALEF 0xc1
#define HAMZE 0xc2
#define BE 0xc3
#define PE 0xc4
#define TE 0xc5
#define SE 0xc6
#define JIM 0xc7
#define CHE 0xc8
#define HE_J 0xc9
#define XE 0xca
#define DAL 0xcb
#define ZAL 0xcc
#define RE 0xcd
#define ZE 0xce
#define JE 0xcf
#define SIN 0xd0
#define SHIN 0xd1
#define SAD 0xd2
#define ZAD 0xd3
#define _TA 0xd4
#define _ZA 0xd5
#define AYN 0xd6
#define GHAYN 0xd7
#define FE 0xd8
#define GHAF 0xd9
#define KAF 0xda
#define GAF 0xdb
#define LAM 0xdc
#define MIM 0xdd
#define NOON 0xde
#define WAW 0xdf
#define F_HE 0xe0 /* F_ added for name clash with Perl */
#define YE 0xe1
#define TEE 0xfc
#define _KAF_H 0xfd
#define YEE 0xfe
#define F_LBRACK 0xe2 /* Farsi '[' character */
#define F_RBRACK 0xe3 /* Farsi ']' character */
#define F_LBRACE 0xe4 /* Farsi '{' character */
#define F_RBRACE 0xe5 /* Farsi '}' character */
#define F_LQUOT 0xe6 /* Farsi left quotation character */
#define F_RQUOT 0xe7 /* Farsi right quotation character */
#define F_STAR 0xe8 /* Farsi '*' character */
#define F_UNDERLINE 0xe9 /* Farsi '_' character */
#define F_PIPE 0xea /* Farsi '|' character */
#define F_BSLASH 0xeb /* Farsi '\' character */
#define MAD 0xf0
#define JAZR 0xf1
#define OW 0xf2
#define MAD_N 0xf3
#define JAZR_N 0xf4
#define OW_OW 0xf5
#define TASH 0xf6
#define OO 0xf7
#define ALEF_U_H 0xf8
#define WAW_H 0xf9
#define ALEF_D_H 0xfa
/*
* global definitions
* ==================
*/
#define SRC_EDT 0
#define SRC_CMD 1
#define AT_CURSOR 0
/*
* definitions for the window dependent functions (w_farsi).
*/
#define W_CONV 0x1
#define W_R_L 0x2
/* special Farsi text messages */
EXTERN char_u farsi_text_1[]
#ifdef DO_INIT
= { YE_, _SIN, RE, ALEF_, _FE, ' ', 'V', 'I', 'M',
' ', F_HE, _BE, ' ', SHIN, RE, _GAF, DAL,' ', NOON,
ALEF_, _YE, ALEF_, _PE, '\0'}
#endif
;
EXTERN char_u farsi_text_2[]
#ifdef DO_INIT
= { YE_, _SIN, RE, ALEF_, _FE, ' ', FARSI_3, FARSI_3,
FARSI_4, FARSI_2, ' ', DAL, RE, ALEF, DAL, _NOON,
ALEF_, _TE, _SIN, ALEF, ' ', F_HE, _BE, ' ', SHIN,
RE, _GAF, DAL, ' ', NOON, ALEF_, _YE, ALEF_, _PE, '\0'}
#endif
;
EXTERN char_u farsi_text_3[]
#ifdef DO_INIT
= { DAL, WAW, _SHIN, _YE, _MIM, _NOON, ' ', YE_, _NOON,
ALEF_,_BE, _YE, _TE, _SHIN, _PE, ' ', 'R','E','P','L',
'A','C','E', ' ', NOON, ALEF_, _MIM, RE, _FE, ZE, ALEF,
' ', 'R', 'E', 'V', 'E', 'R', 'S', 'E', ' ', 'I', 'N',
'S', 'E', 'R', 'T', ' ', SHIN, WAW, RE, ' ', ALEF_, _BE,
' ', YE_, _SIN, RE, ALEF_, _FE, ' ', RE, DAL, ' ', RE,
ALEF_, _KAF,' ', MIM, ALEF_, _GAF, _NOON, _HE, '\0'}
#endif
;
EXTERN char_u farsi_text_5[]
#ifdef DO_INIT
= { ' ', YE_, _SIN, RE, ALEF_, _FE, '\0'}
#endif
;

8496
src/fileio.c Normal file

File diff suppressed because it is too large Load Diff

3104
src/fold.c Normal file

File diff suppressed because it is too large Load Diff

4279
src/getchar.c Normal file

File diff suppressed because it is too large Load Diff

1228
src/globals.h Normal file

File diff suppressed because it is too large Load Diff

1518
src/hangulin.c Normal file

File diff suppressed because it is too large Load Diff

3258
src/hardcopy.c Normal file

File diff suppressed because it is too large Load Diff

416
src/hashtab.c Normal file
View File

@ -0,0 +1,416 @@
/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved 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.
*/
/*
* hashtab.c: Handling of a hashtable with Vim-specific properties.
*
* Each item in a hashtable has a NUL terminated string key. A key can appear
* only once in the table.
*
* A hash number is computed from the key for quick lookup. When the hashes
* of two different keys point to the same entry an algorithm is used to
* iterate over other entries in the table until the right one is found.
* To make the iteration work removed keys are different from entries where a
* key was never present.
*
* The mechanism has been partly based on how Python Dictionaries are
* implemented. The algorithm is from Knuth Vol. 3, Sec. 6.4.
*
* The hashtable grows to accommodate more entries when needed. At least 1/3
* of the entries is empty to keep the lookup efficient (at the cost of extra
* memory).
*/
#include "vim.h"
/* Magic value for algorithm that walks through the array. */
#define PERTURB_SHIFT 5
static int hash_may_resize __ARGS((hashtab_T *ht, int minitems));
/*
* Initialize an empty hash table.
*/
void hash_init(ht)
hashtab_T *ht;
{
/* This zeroes all "ht_" entries and all the "hi_key" in "ht_smallarray". */
vim_memset(ht, 0, sizeof(hashtab_T));
ht->ht_array = ht->ht_smallarray;
ht->ht_mask = HT_INIT_SIZE - 1;
}
/*
* Free the array of a hash table. Does not free the items it contains!
* If "ht" is not freed then you should call hash_init() next!
*/
void hash_clear(ht)
hashtab_T *ht;
{
if (ht->ht_array != ht->ht_smallarray)
vim_free(ht->ht_array);
}
/*
* Free the array of a hash table and all the keys it contains. The keys must
* have been allocated. "off" is the offset from the start of the allocate
* memory to the location of the key (it's always positive).
*/
void hash_clear_all(ht, off)
hashtab_T *ht;
int off;
{
long todo;
hashitem_T *hi;
todo = (long)ht->ht_used;
for (hi = ht->ht_array; todo > 0; ++hi) {
if (!HASHITEM_EMPTY(hi)) {
vim_free(hi->hi_key - off);
--todo;
}
}
hash_clear(ht);
}
/*
* Find "key" in hashtable "ht". "key" must not be NULL.
* Always returns a pointer to a hashitem. If the item was not found then
* HASHITEM_EMPTY() is TRUE. The pointer is then the place where the key
* would be added.
* WARNING: The returned pointer becomes invalid when the hashtable is changed
* (adding, setting or removing an item)!
*/
hashitem_T * hash_find(ht, key)
hashtab_T *ht;
char_u *key;
{
return hash_lookup(ht, key, hash_hash(key));
}
/*
* Like hash_find(), but caller computes "hash".
*/
hashitem_T * hash_lookup(ht, key, hash)
hashtab_T *ht;
char_u *key;
hash_T hash;
{
hash_T perturb;
hashitem_T *freeitem;
hashitem_T *hi;
unsigned idx;
#ifdef HT_DEBUG
++hash_count_lookup;
#endif
/*
* Quickly handle the most common situations:
* - return if there is no item at all
* - skip over a removed item
* - return if the item matches
*/
idx = (unsigned)(hash & ht->ht_mask);
hi = &ht->ht_array[idx];
if (hi->hi_key == NULL)
return hi;
if (hi->hi_key == HI_KEY_REMOVED)
freeitem = hi;
else if (hi->hi_hash == hash && STRCMP(hi->hi_key, key) == 0)
return hi;
else
freeitem = NULL;
/*
* Need to search through the table to find the key. The algorithm
* to step through the table starts with large steps, gradually becoming
* smaller down to (1/4 table size + 1). This means it goes through all
* table entries in the end.
* When we run into a NULL key it's clear that the key isn't there.
* Return the first available slot found (can be a slot of a removed
* item).
*/
for (perturb = hash;; perturb >>= PERTURB_SHIFT) {
#ifdef HT_DEBUG
++hash_count_perturb; /* count a "miss" for hashtab lookup */
#endif
idx = (unsigned)((idx << 2U) + idx + perturb + 1U);
hi = &ht->ht_array[idx & ht->ht_mask];
if (hi->hi_key == NULL)
return freeitem == NULL ? hi : freeitem;
if (hi->hi_hash == hash
&& hi->hi_key != HI_KEY_REMOVED
&& STRCMP(hi->hi_key, key) == 0)
return hi;
if (hi->hi_key == HI_KEY_REMOVED && freeitem == NULL)
freeitem = hi;
}
}
/*
* Print the efficiency of hashtable lookups.
* Useful when trying different hash algorithms.
* Called when exiting.
*/
void hash_debug_results() {
#ifdef HT_DEBUG
fprintf(stderr, "\r\n\r\n\r\n\r\n");
fprintf(stderr, "Number of hashtable lookups: %ld\r\n", hash_count_lookup);
fprintf(stderr, "Number of perturb loops: %ld\r\n", hash_count_perturb);
fprintf(stderr, "Percentage of perturb loops: %ld%%\r\n",
hash_count_perturb * 100 / hash_count_lookup);
#endif
}
/*
* Add item with key "key" to hashtable "ht".
* Returns FAIL when out of memory or the key is already present.
*/
int hash_add(ht, key)
hashtab_T *ht;
char_u *key;
{
hash_T hash = hash_hash(key);
hashitem_T *hi;
hi = hash_lookup(ht, key, hash);
if (!HASHITEM_EMPTY(hi)) {
EMSG2(_(e_intern2), "hash_add()");
return FAIL;
}
return hash_add_item(ht, hi, key, hash);
}
/*
* Add item "hi" with "key" to hashtable "ht". "key" must not be NULL and
* "hi" must have been obtained with hash_lookup() and point to an empty item.
* "hi" is invalid after this!
* Returns OK or FAIL (out of memory).
*/
int hash_add_item(ht, hi, key, hash)
hashtab_T *ht;
hashitem_T *hi;
char_u *key;
hash_T hash;
{
/* If resizing failed before and it fails again we can't add an item. */
if (ht->ht_error && hash_may_resize(ht, 0) == FAIL)
return FAIL;
++ht->ht_used;
if (hi->hi_key == NULL)
++ht->ht_filled;
hi->hi_key = key;
hi->hi_hash = hash;
/* When the space gets low may resize the array. */
return hash_may_resize(ht, 0);
}
/*
* Remove item "hi" from hashtable "ht". "hi" must have been obtained with
* hash_lookup().
* The caller must take care of freeing the item itself.
*/
void hash_remove(ht, hi)
hashtab_T *ht;
hashitem_T *hi;
{
--ht->ht_used;
hi->hi_key = HI_KEY_REMOVED;
hash_may_resize(ht, 0);
}
/*
* Lock a hashtable: prevent that ht_array changes.
* Don't use this when items are to be added!
* Must call hash_unlock() later.
*/
void hash_lock(ht)
hashtab_T *ht;
{
++ht->ht_locked;
}
/*
* Unlock a hashtable: allow ht_array changes again.
* Table will be resized (shrink) when necessary.
* This must balance a call to hash_lock().
*/
void hash_unlock(ht)
hashtab_T *ht;
{
--ht->ht_locked;
(void)hash_may_resize(ht, 0);
}
/*
* Shrink a hashtable when there is too much empty space.
* Grow a hashtable when there is not enough empty space.
* Returns OK or FAIL (out of memory).
*/
static int hash_may_resize(ht, minitems)
hashtab_T *ht;
int minitems; /* minimal number of items */
{
hashitem_T temparray[HT_INIT_SIZE];
hashitem_T *oldarray, *newarray;
hashitem_T *olditem, *newitem;
unsigned newi;
int todo;
long_u oldsize, newsize;
long_u minsize;
long_u newmask;
hash_T perturb;
/* Don't resize a locked table. */
if (ht->ht_locked > 0)
return OK;
#ifdef HT_DEBUG
if (ht->ht_used > ht->ht_filled)
EMSG("hash_may_resize(): more used than filled");
if (ht->ht_filled >= ht->ht_mask + 1)
EMSG("hash_may_resize(): table completely filled");
#endif
if (minitems == 0) {
/* Return quickly for small tables with at least two NULL items. NULL
* items are required for the lookup to decide a key isn't there. */
if (ht->ht_filled < HT_INIT_SIZE - 1
&& ht->ht_array == ht->ht_smallarray)
return OK;
/*
* Grow or refill the array when it's more than 2/3 full (including
* removed items, so that they get cleaned up).
* Shrink the array when it's less than 1/5 full. When growing it is
* at least 1/4 full (avoids repeated grow-shrink operations)
*/
oldsize = ht->ht_mask + 1;
if (ht->ht_filled * 3 < oldsize * 2 && ht->ht_used > oldsize / 5)
return OK;
if (ht->ht_used > 1000)
minsize = ht->ht_used * 2; /* it's big, don't make too much room */
else
minsize = ht->ht_used * 4; /* make plenty of room */
} else {
/* Use specified size. */
if ((long_u)minitems < ht->ht_used) /* just in case... */
minitems = (int)ht->ht_used;
minsize = minitems * 3 / 2; /* array is up to 2/3 full */
}
newsize = HT_INIT_SIZE;
while (newsize < minsize) {
newsize <<= 1; /* make sure it's always a power of 2 */
if (newsize == 0)
return FAIL; /* overflow */
}
if (newsize == HT_INIT_SIZE) {
/* Use the small array inside the hashdict structure. */
newarray = ht->ht_smallarray;
if (ht->ht_array == newarray) {
/* Moving from ht_smallarray to ht_smallarray! Happens when there
* are many removed items. Copy the items to be able to clean up
* removed items. */
mch_memmove(temparray, newarray, sizeof(temparray));
oldarray = temparray;
} else
oldarray = ht->ht_array;
} else {
/* Allocate an array. */
newarray = (hashitem_T *)alloc((unsigned)
(sizeof(hashitem_T) * newsize));
if (newarray == NULL) {
/* Out of memory. When there are NULL items still return OK.
* Otherwise set ht_error, because lookup may result in a hang if
* we add another item. */
if (ht->ht_filled < ht->ht_mask)
return OK;
ht->ht_error = TRUE;
return FAIL;
}
oldarray = ht->ht_array;
}
vim_memset(newarray, 0, (size_t)(sizeof(hashitem_T) * newsize));
/*
* Move all the items from the old array to the new one, placing them in
* the right spot. The new array won't have any removed items, thus this
* is also a cleanup action.
*/
newmask = newsize - 1;
todo = (int)ht->ht_used;
for (olditem = oldarray; todo > 0; ++olditem)
if (!HASHITEM_EMPTY(olditem)) {
/*
* The algorithm to find the spot to add the item is identical to
* the algorithm to find an item in hash_lookup(). But we only
* need to search for a NULL key, thus it's simpler.
*/
newi = (unsigned)(olditem->hi_hash & newmask);
newitem = &newarray[newi];
if (newitem->hi_key != NULL)
for (perturb = olditem->hi_hash;; perturb >>= PERTURB_SHIFT) {
newi = (unsigned)((newi << 2U) + newi + perturb + 1U);
newitem = &newarray[newi & newmask];
if (newitem->hi_key == NULL)
break;
}
*newitem = *olditem;
--todo;
}
if (ht->ht_array != ht->ht_smallarray)
vim_free(ht->ht_array);
ht->ht_array = newarray;
ht->ht_mask = newmask;
ht->ht_filled = ht->ht_used;
ht->ht_error = FALSE;
return OK;
}
/*
* 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
* when exiting. Try that with the current hash algorithm and yours. The
* lower the percentage the better.
*/
hash_T hash_hash(key)
char_u *key;
{
hash_T hash;
char_u *p;
if ((hash = *key) == 0)
return (hash_T)0; /* Empty keys are not allowed, but we don't
want to crash if we get one. */
p = key + 1;
/* A simplistic algorithm that appears to do very well.
* Suggested by George Reilly. */
while (*p != NUL)
hash = hash * 101 + *p++;
return hash;
}

2352
src/if_cscope.c Normal file

File diff suppressed because it is too large Load Diff

72
src/if_cscope.h Normal file
View File

@ -0,0 +1,72 @@
/* vi:set ts=8 sts=4 sw=4:
*
* CSCOPE support for Vim added by Andy Kahn <kahn@zk3.dec.com>
* Ported to Win32 by Sergey Khorev <sergey.khorev@gmail.com>
*
* The basic idea/structure of cscope for Vim was borrowed from Nvi.
* There might be a few lines of code that look similar to what Nvi
* has. If this is a problem and requires inclusion of the annoying
* BSD license, then sue me; I'm not worth much anyway.
*/
#if defined(UNIX)
# include <sys/types.h> /* pid_t */
# include <sys/stat.h> /* dev_t, ino_t */
#else
#endif
#define CSCOPE_SUCCESS 0
#define CSCOPE_FAILURE -1
#define CSCOPE_DBFILE "cscope.out"
#define CSCOPE_PROMPT ">> "
/*
* s 0name Find this C symbol
* g 1name Find this definition
* d 2name Find functions called by this function
* c 3name Find functions calling this function
* t 4string find text string (cscope 12.9)
* t 4name Find assignments to (cscope 13.3)
* 5pattern change pattern -- NOT USED
* e 6pattern Find this egrep pattern
* f 7name Find this file
* i 8name Find files #including this file
*/
typedef struct {
char * name;
int (*func)__ARGS((exarg_T *eap));
char * help;
char * usage;
int cansplit; /* if supports splitting window */
} cscmd_T;
typedef struct csi {
char * fname; /* cscope db name */
char * ppath; /* path to prepend (the -P option) */
char * flags; /* additional cscope flags/options (e.g, -p2) */
#if defined(UNIX)
pid_t pid; /* PID of the connected cscope process. */
dev_t st_dev; /* ID of dev containing cscope db */
ino_t st_ino; /* inode number of cscope db */
#else
#endif
FILE * fr_fp; /* from cscope: FILE. */
FILE * to_fp; /* to cscope: FILE. */
} csinfo_T;
typedef enum { Add, Find, Help, Kill, Reset, Show } csid_e;
typedef enum {
Store,
Get,
Free,
Print
} mcmd_e;
/* the end */

499
src/keymap.h Normal file
View File

@ -0,0 +1,499 @@
/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved 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.
*/
/*
* Keycode definitions for special keys.
*
* Any special key code sequences are replaced by these codes.
*/
/*
* For MSDOS some keys produce codes larger than 0xff. They are split into two
* chars, the first one is K_NUL (same value used in term.h).
*/
#define K_NUL (0xce) /* for MSDOS: special key follows */
/*
* K_SPECIAL is the first byte of a special key code and is always followed by
* two bytes.
* The second byte can have any value. ASCII is used for normal termcap
* entries, 0x80 and higher for special keys, see below.
* The third byte is guaranteed to be between 0x02 and 0x7f.
*/
#define K_SPECIAL (0x80)
/*
* Positive characters are "normal" characters.
* Negative characters are special key codes. Only characters below -0x200
* are used to so that the absolute value can't be mistaken for a single-byte
* character.
*/
#define IS_SPECIAL(c) ((c) < 0)
/*
* Characters 0x0100 - 0x01ff have a special meaning for abbreviations.
* Multi-byte characters also have ABBR_OFF added, thus are above 0x0200.
*/
#define ABBR_OFF 0x100
/*
* NUL cannot be in the input string, therefore it is replaced by
* K_SPECIAL KS_ZERO KE_FILLER
*/
#define KS_ZERO 255
/*
* K_SPECIAL cannot be in the input string, therefore it is replaced by
* K_SPECIAL KS_SPECIAL KE_FILLER
*/
#define KS_SPECIAL 254
/*
* KS_EXTRA is used for keys that have no termcap name
* K_SPECIAL KS_EXTRA KE_xxx
*/
#define KS_EXTRA 253
/*
* KS_MODIFIER is used when a modifier is given for a (special) key
* K_SPECIAL KS_MODIFIER bitmask
*/
#define KS_MODIFIER 252
/*
* These are used for the GUI
* K_SPECIAL KS_xxx KE_FILLER
*/
#define KS_MOUSE 251
#define KS_MENU 250
#define KS_VER_SCROLLBAR 249
#define KS_HOR_SCROLLBAR 248
/*
* These are used for DEC mouse
*/
#define KS_NETTERM_MOUSE 247
#define KS_DEC_MOUSE 246
/*
* Used for switching Select mode back on after a mapping or menu.
*/
#define KS_SELECT 245
#define K_SELECT_STRING (char_u *)"\200\365X"
/*
* Used for tearing off a menu.
*/
#define KS_TEAROFF 244
/* Used for JSB term mouse. */
#define KS_JSBTERM_MOUSE 243
/* Used a termcap entry that produces a normal character. */
#define KS_KEY 242
/* Used for the qnx pterm mouse. */
#define KS_PTERM_MOUSE 241
/* Used for click in a tab pages label. */
#define KS_TABLINE 240
/* Used for menu in a tab pages line. */
#define KS_TABMENU 239
/* Used for the urxvt mouse. */
#define KS_URXVT_MOUSE 238
/* Used for the sgr mouse. */
#define KS_SGR_MOUSE 237
/*
* Filler used after KS_SPECIAL and others
*/
#define KE_FILLER ('X')
/*
* translation of three byte code "K_SPECIAL a b" into int "K_xxx" and back
*/
#define TERMCAP2KEY(a, b) (-((a) + ((int)(b) << 8)))
#define KEY2TERMCAP0(x) ((-(x)) & 0xff)
#define KEY2TERMCAP1(x) (((unsigned)(-(x)) >> 8) & 0xff)
/*
* get second or third byte when translating special key code into three bytes
*/
#define K_SECOND(c) ((c) == K_SPECIAL ? KS_SPECIAL : (c) == \
NUL ? KS_ZERO : KEY2TERMCAP0(c))
#define K_THIRD(c) (((c) == K_SPECIAL || (c) == \
NUL) ? KE_FILLER : KEY2TERMCAP1(c))
/*
* get single int code from second byte after K_SPECIAL
*/
#define TO_SPECIAL(a, b) ((a) == KS_SPECIAL ? K_SPECIAL : (a) == \
KS_ZERO ? K_ZERO : TERMCAP2KEY(a, b))
/*
* Codes for keys that do not have a termcap name.
*
* K_SPECIAL KS_EXTRA KE_xxx
*/
enum key_extra {
KE_NAME = 3 /* name of this terminal entry */
, KE_S_UP /* shift-up */
, KE_S_DOWN /* shift-down */
, KE_S_F1 /* shifted function keys */
, KE_S_F2
, KE_S_F3
, KE_S_F4
, KE_S_F5
, KE_S_F6
, KE_S_F7
, KE_S_F8
, KE_S_F9
, KE_S_F10
, KE_S_F11
, KE_S_F12
, KE_S_F13
, KE_S_F14
, KE_S_F15
, KE_S_F16
, KE_S_F17
, KE_S_F18
, KE_S_F19
, KE_S_F20
, KE_S_F21
, KE_S_F22
, KE_S_F23
, KE_S_F24
, KE_S_F25
, KE_S_F26
, KE_S_F27
, KE_S_F28
, KE_S_F29
, KE_S_F30
, KE_S_F31
, KE_S_F32
, KE_S_F33
, KE_S_F34
, KE_S_F35
, KE_S_F36
, KE_S_F37
, KE_MOUSE /* mouse event start */
/*
* Symbols for pseudo keys which are translated from the real key symbols
* above.
*/
, KE_LEFTMOUSE /* Left mouse button click */
, KE_LEFTDRAG /* Drag with left mouse button down */
, KE_LEFTRELEASE /* Left mouse button release */
, KE_MIDDLEMOUSE /* Middle mouse button click */
, KE_MIDDLEDRAG /* Drag with middle mouse button down */
, KE_MIDDLERELEASE /* Middle mouse button release */
, KE_RIGHTMOUSE /* Right mouse button click */
, KE_RIGHTDRAG /* Drag with right mouse button down */
, KE_RIGHTRELEASE /* Right mouse button release */
, KE_IGNORE /* Ignored mouse drag/release */
, KE_TAB /* unshifted TAB key */
, KE_S_TAB_OLD /* shifted TAB key (no longer used) */
, KE_SNIFF /* SNiFF+ input waiting */
, KE_XF1 /* extra vt100 function keys for xterm */
, KE_XF2
, KE_XF3
, KE_XF4
, KE_XEND /* extra (vt100) end key for xterm */
, KE_ZEND /* extra (vt100) end key for xterm */
, KE_XHOME /* extra (vt100) home key for xterm */
, KE_ZHOME /* extra (vt100) home key for xterm */
, KE_XUP /* extra vt100 cursor keys for xterm */
, KE_XDOWN
, KE_XLEFT
, KE_XRIGHT
, KE_LEFTMOUSE_NM /* non-mappable Left mouse button click */
, KE_LEFTRELEASE_NM /* non-mappable left mouse button release */
, KE_S_XF1 /* extra vt100 shifted function keys for xterm */
, KE_S_XF2
, KE_S_XF3
, KE_S_XF4
/* NOTE: The scroll wheel events are inverted: i.e. UP is the same as
* moving the actual scroll wheel down, LEFT is the same as moving the
* scroll wheel right. */
, KE_MOUSEDOWN /* scroll wheel pseudo-button Down */
, KE_MOUSEUP /* scroll wheel pseudo-button Up */
, KE_MOUSELEFT /* scroll wheel pseudo-button Left */
, KE_MOUSERIGHT /* scroll wheel pseudo-button Right */
, KE_KINS /* keypad Insert key */
, KE_KDEL /* keypad Delete key */
, KE_CSI /* CSI typed directly */
, KE_SNR /* <SNR> */
, KE_PLUG /* <Plug> */
, KE_CMDWIN /* open command-line window from Command-line Mode */
, KE_C_LEFT /* control-left */
, KE_C_RIGHT /* control-right */
, KE_C_HOME /* control-home */
, KE_C_END /* control-end */
, KE_X1MOUSE /* X1/X2 mouse-buttons */
, KE_X1DRAG
, KE_X1RELEASE
, KE_X2MOUSE
, KE_X2DRAG
, KE_X2RELEASE
, KE_DROP /* DnD data is available */
, KE_CURSORHOLD /* CursorHold event */
, KE_NOP /* doesn't do something */
, KE_FOCUSGAINED /* focus gained */
, KE_FOCUSLOST /* focus lost */
};
/*
* the three byte codes are replaced with the following int when using vgetc()
*/
#define K_ZERO TERMCAP2KEY(KS_ZERO, KE_FILLER)
#define K_UP TERMCAP2KEY('k', 'u')
#define K_DOWN TERMCAP2KEY('k', 'd')
#define K_LEFT TERMCAP2KEY('k', 'l')
#define K_RIGHT TERMCAP2KEY('k', 'r')
#define K_S_UP TERMCAP2KEY(KS_EXTRA, KE_S_UP)
#define K_S_DOWN TERMCAP2KEY(KS_EXTRA, KE_S_DOWN)
#define K_S_LEFT TERMCAP2KEY('#', '4')
#define K_C_LEFT TERMCAP2KEY(KS_EXTRA, KE_C_LEFT)
#define K_S_RIGHT TERMCAP2KEY('%', 'i')
#define K_C_RIGHT TERMCAP2KEY(KS_EXTRA, KE_C_RIGHT)
#define K_S_HOME TERMCAP2KEY('#', '2')
#define K_C_HOME TERMCAP2KEY(KS_EXTRA, KE_C_HOME)
#define K_S_END TERMCAP2KEY('*', '7')
#define K_C_END TERMCAP2KEY(KS_EXTRA, KE_C_END)
#define K_TAB TERMCAP2KEY(KS_EXTRA, KE_TAB)
#define K_S_TAB TERMCAP2KEY('k', 'B')
/* extra set of function keys F1-F4, for vt100 compatible xterm */
#define K_XF1 TERMCAP2KEY(KS_EXTRA, KE_XF1)
#define K_XF2 TERMCAP2KEY(KS_EXTRA, KE_XF2)
#define K_XF3 TERMCAP2KEY(KS_EXTRA, KE_XF3)
#define K_XF4 TERMCAP2KEY(KS_EXTRA, KE_XF4)
/* extra set of cursor keys for vt100 compatible xterm */
#define K_XUP TERMCAP2KEY(KS_EXTRA, KE_XUP)
#define K_XDOWN TERMCAP2KEY(KS_EXTRA, KE_XDOWN)
#define K_XLEFT TERMCAP2KEY(KS_EXTRA, KE_XLEFT)
#define K_XRIGHT TERMCAP2KEY(KS_EXTRA, KE_XRIGHT)
#define K_F1 TERMCAP2KEY('k', '1') /* function keys */
#define K_F2 TERMCAP2KEY('k', '2')
#define K_F3 TERMCAP2KEY('k', '3')
#define K_F4 TERMCAP2KEY('k', '4')
#define K_F5 TERMCAP2KEY('k', '5')
#define K_F6 TERMCAP2KEY('k', '6')
#define K_F7 TERMCAP2KEY('k', '7')
#define K_F8 TERMCAP2KEY('k', '8')
#define K_F9 TERMCAP2KEY('k', '9')
#define K_F10 TERMCAP2KEY('k', ';')
#define K_F11 TERMCAP2KEY('F', '1')
#define K_F12 TERMCAP2KEY('F', '2')
#define K_F13 TERMCAP2KEY('F', '3')
#define K_F14 TERMCAP2KEY('F', '4')
#define K_F15 TERMCAP2KEY('F', '5')
#define K_F16 TERMCAP2KEY('F', '6')
#define K_F17 TERMCAP2KEY('F', '7')
#define K_F18 TERMCAP2KEY('F', '8')
#define K_F19 TERMCAP2KEY('F', '9')
#define K_F20 TERMCAP2KEY('F', 'A')
#define K_F21 TERMCAP2KEY('F', 'B')
#define K_F22 TERMCAP2KEY('F', 'C')
#define K_F23 TERMCAP2KEY('F', 'D')
#define K_F24 TERMCAP2KEY('F', 'E')
#define K_F25 TERMCAP2KEY('F', 'F')
#define K_F26 TERMCAP2KEY('F', 'G')
#define K_F27 TERMCAP2KEY('F', 'H')
#define K_F28 TERMCAP2KEY('F', 'I')
#define K_F29 TERMCAP2KEY('F', 'J')
#define K_F30 TERMCAP2KEY('F', 'K')
#define K_F31 TERMCAP2KEY('F', 'L')
#define K_F32 TERMCAP2KEY('F', 'M')
#define K_F33 TERMCAP2KEY('F', 'N')
#define K_F34 TERMCAP2KEY('F', 'O')
#define K_F35 TERMCAP2KEY('F', 'P')
#define K_F36 TERMCAP2KEY('F', 'Q')
#define K_F37 TERMCAP2KEY('F', 'R')
/* extra set of shifted function keys F1-F4, for vt100 compatible xterm */
#define K_S_XF1 TERMCAP2KEY(KS_EXTRA, KE_S_XF1)
#define K_S_XF2 TERMCAP2KEY(KS_EXTRA, KE_S_XF2)
#define K_S_XF3 TERMCAP2KEY(KS_EXTRA, KE_S_XF3)
#define K_S_XF4 TERMCAP2KEY(KS_EXTRA, KE_S_XF4)
#define K_S_F1 TERMCAP2KEY(KS_EXTRA, KE_S_F1) /* shifted func. keys */
#define K_S_F2 TERMCAP2KEY(KS_EXTRA, KE_S_F2)
#define K_S_F3 TERMCAP2KEY(KS_EXTRA, KE_S_F3)
#define K_S_F4 TERMCAP2KEY(KS_EXTRA, KE_S_F4)
#define K_S_F5 TERMCAP2KEY(KS_EXTRA, KE_S_F5)
#define K_S_F6 TERMCAP2KEY(KS_EXTRA, KE_S_F6)
#define K_S_F7 TERMCAP2KEY(KS_EXTRA, KE_S_F7)
#define K_S_F8 TERMCAP2KEY(KS_EXTRA, KE_S_F8)
#define K_S_F9 TERMCAP2KEY(KS_EXTRA, KE_S_F9)
#define K_S_F10 TERMCAP2KEY(KS_EXTRA, KE_S_F10)
#define K_S_F11 TERMCAP2KEY(KS_EXTRA, KE_S_F11)
#define K_S_F12 TERMCAP2KEY(KS_EXTRA, KE_S_F12)
/* K_S_F13 to K_S_F37 are currently not used */
#define K_HELP TERMCAP2KEY('%', '1')
#define K_UNDO TERMCAP2KEY('&', '8')
#define K_BS TERMCAP2KEY('k', 'b')
#define K_INS TERMCAP2KEY('k', 'I')
#define K_KINS TERMCAP2KEY(KS_EXTRA, KE_KINS)
#define K_DEL TERMCAP2KEY('k', 'D')
#define K_KDEL TERMCAP2KEY(KS_EXTRA, KE_KDEL)
#define K_HOME TERMCAP2KEY('k', 'h')
#define K_KHOME TERMCAP2KEY('K', '1') /* keypad home (upper left) */
#define K_XHOME TERMCAP2KEY(KS_EXTRA, KE_XHOME)
#define K_ZHOME TERMCAP2KEY(KS_EXTRA, KE_ZHOME)
#define K_END TERMCAP2KEY('@', '7')
#define K_KEND TERMCAP2KEY('K', '4') /* keypad end (lower left) */
#define K_XEND TERMCAP2KEY(KS_EXTRA, KE_XEND)
#define K_ZEND TERMCAP2KEY(KS_EXTRA, KE_ZEND)
#define K_PAGEUP TERMCAP2KEY('k', 'P')
#define K_PAGEDOWN TERMCAP2KEY('k', 'N')
#define K_KPAGEUP TERMCAP2KEY('K', '3') /* keypad pageup (upper R.) */
#define K_KPAGEDOWN TERMCAP2KEY('K', '5') /* keypad pagedown (lower R.) */
#define K_KPLUS TERMCAP2KEY('K', '6') /* keypad plus */
#define K_KMINUS TERMCAP2KEY('K', '7') /* keypad minus */
#define K_KDIVIDE TERMCAP2KEY('K', '8') /* keypad / */
#define K_KMULTIPLY TERMCAP2KEY('K', '9') /* keypad * */
#define K_KENTER TERMCAP2KEY('K', 'A') /* keypad Enter */
#define K_KPOINT TERMCAP2KEY('K', 'B') /* keypad . or ,*/
#define K_K0 TERMCAP2KEY('K', 'C') /* keypad 0 */
#define K_K1 TERMCAP2KEY('K', 'D') /* keypad 1 */
#define K_K2 TERMCAP2KEY('K', 'E') /* keypad 2 */
#define K_K3 TERMCAP2KEY('K', 'F') /* keypad 3 */
#define K_K4 TERMCAP2KEY('K', 'G') /* keypad 4 */
#define K_K5 TERMCAP2KEY('K', 'H') /* keypad 5 */
#define K_K6 TERMCAP2KEY('K', 'I') /* keypad 6 */
#define K_K7 TERMCAP2KEY('K', 'J') /* keypad 7 */
#define K_K8 TERMCAP2KEY('K', 'K') /* keypad 8 */
#define K_K9 TERMCAP2KEY('K', 'L') /* keypad 9 */
#define K_MOUSE TERMCAP2KEY(KS_MOUSE, KE_FILLER)
#define K_MENU TERMCAP2KEY(KS_MENU, KE_FILLER)
#define K_VER_SCROLLBAR TERMCAP2KEY(KS_VER_SCROLLBAR, KE_FILLER)
#define K_HOR_SCROLLBAR TERMCAP2KEY(KS_HOR_SCROLLBAR, KE_FILLER)
#define K_NETTERM_MOUSE TERMCAP2KEY(KS_NETTERM_MOUSE, KE_FILLER)
#define K_DEC_MOUSE TERMCAP2KEY(KS_DEC_MOUSE, KE_FILLER)
#define K_JSBTERM_MOUSE TERMCAP2KEY(KS_JSBTERM_MOUSE, KE_FILLER)
#define K_PTERM_MOUSE TERMCAP2KEY(KS_PTERM_MOUSE, KE_FILLER)
#define K_URXVT_MOUSE TERMCAP2KEY(KS_URXVT_MOUSE, KE_FILLER)
#define K_SGR_MOUSE TERMCAP2KEY(KS_SGR_MOUSE, KE_FILLER)
#define K_SELECT TERMCAP2KEY(KS_SELECT, KE_FILLER)
#define K_TEAROFF TERMCAP2KEY(KS_TEAROFF, KE_FILLER)
#define K_TABLINE TERMCAP2KEY(KS_TABLINE, KE_FILLER)
#define K_TABMENU TERMCAP2KEY(KS_TABMENU, KE_FILLER)
/*
* Symbols for pseudo keys which are translated from the real key symbols
* above.
*/
#define K_LEFTMOUSE TERMCAP2KEY(KS_EXTRA, KE_LEFTMOUSE)
#define K_LEFTMOUSE_NM TERMCAP2KEY(KS_EXTRA, KE_LEFTMOUSE_NM)
#define K_LEFTDRAG TERMCAP2KEY(KS_EXTRA, KE_LEFTDRAG)
#define K_LEFTRELEASE TERMCAP2KEY(KS_EXTRA, KE_LEFTRELEASE)
#define K_LEFTRELEASE_NM TERMCAP2KEY(KS_EXTRA, KE_LEFTRELEASE_NM)
#define K_MIDDLEMOUSE TERMCAP2KEY(KS_EXTRA, KE_MIDDLEMOUSE)
#define K_MIDDLEDRAG TERMCAP2KEY(KS_EXTRA, KE_MIDDLEDRAG)
#define K_MIDDLERELEASE TERMCAP2KEY(KS_EXTRA, KE_MIDDLERELEASE)
#define K_RIGHTMOUSE TERMCAP2KEY(KS_EXTRA, KE_RIGHTMOUSE)
#define K_RIGHTDRAG TERMCAP2KEY(KS_EXTRA, KE_RIGHTDRAG)
#define K_RIGHTRELEASE TERMCAP2KEY(KS_EXTRA, KE_RIGHTRELEASE)
#define K_X1MOUSE TERMCAP2KEY(KS_EXTRA, KE_X1MOUSE)
#define K_X1MOUSE TERMCAP2KEY(KS_EXTRA, KE_X1MOUSE)
#define K_X1DRAG TERMCAP2KEY(KS_EXTRA, KE_X1DRAG)
#define K_X1RELEASE TERMCAP2KEY(KS_EXTRA, KE_X1RELEASE)
#define K_X2MOUSE TERMCAP2KEY(KS_EXTRA, KE_X2MOUSE)
#define K_X2DRAG TERMCAP2KEY(KS_EXTRA, KE_X2DRAG)
#define K_X2RELEASE TERMCAP2KEY(KS_EXTRA, KE_X2RELEASE)
#define K_IGNORE TERMCAP2KEY(KS_EXTRA, KE_IGNORE)
#define K_NOP TERMCAP2KEY(KS_EXTRA, KE_NOP)
#define K_SNIFF TERMCAP2KEY(KS_EXTRA, KE_SNIFF)
#define K_MOUSEDOWN TERMCAP2KEY(KS_EXTRA, KE_MOUSEDOWN)
#define K_MOUSEUP TERMCAP2KEY(KS_EXTRA, KE_MOUSEUP)
#define K_MOUSELEFT TERMCAP2KEY(KS_EXTRA, KE_MOUSELEFT)
#define K_MOUSERIGHT TERMCAP2KEY(KS_EXTRA, KE_MOUSERIGHT)
#define K_CSI TERMCAP2KEY(KS_EXTRA, KE_CSI)
#define K_SNR TERMCAP2KEY(KS_EXTRA, KE_SNR)
#define K_PLUG TERMCAP2KEY(KS_EXTRA, KE_PLUG)
#define K_CMDWIN TERMCAP2KEY(KS_EXTRA, KE_CMDWIN)
#define K_DROP TERMCAP2KEY(KS_EXTRA, KE_DROP)
#define K_FOCUSGAINED TERMCAP2KEY(KS_EXTRA, KE_FOCUSGAINED)
#define K_FOCUSLOST TERMCAP2KEY(KS_EXTRA, KE_FOCUSLOST)
#define K_CURSORHOLD TERMCAP2KEY(KS_EXTRA, KE_CURSORHOLD)
/* Bits for modifier mask */
/* 0x01 cannot be used, because the modifier must be 0x02 or higher */
#define MOD_MASK_SHIFT 0x02
#define MOD_MASK_CTRL 0x04
#define MOD_MASK_ALT 0x08 /* aka META */
#define MOD_MASK_META 0x10 /* META when it's different from ALT */
#define MOD_MASK_2CLICK 0x20 /* use MOD_MASK_MULTI_CLICK */
#define MOD_MASK_3CLICK 0x40 /* use MOD_MASK_MULTI_CLICK */
#define MOD_MASK_4CLICK 0x60 /* use MOD_MASK_MULTI_CLICK */
#define MOD_MASK_MULTI_CLICK (MOD_MASK_2CLICK|MOD_MASK_3CLICK| \
MOD_MASK_4CLICK)
/*
* The length of the longest special key name, including modifiers.
* Current longest is <M-C-S-T-4-MiddleRelease> (length includes '<' and '>').
*/
#define MAX_KEY_NAME_LEN 25
/* Maximum length of a special key event as tokens. This includes modifiers.
* The longest event is something like <M-C-S-T-4-LeftDrag> which would be the
* following string of tokens:
*
* <K_SPECIAL> <KS_MODIFIER> bitmask <K_SPECIAL> <KS_EXTRA> <KT_LEFTDRAG>.
*
* This is a total of 6 tokens, and is currently the longest one possible.
*/
#define MAX_KEY_CODE_LEN 6

190
src/macros.h Normal file
View File

@ -0,0 +1,190 @@
/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved 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.
*/
/*
* macros.h: macro definitions for often used code
*/
/*
* pchar(lp, c) - put character 'c' at position 'lp'
*/
#define pchar(lp, c) (*(ml_get_buf(curbuf, (lp).lnum, TRUE) + (lp).col) = (c))
/*
* Position comparisons
*/
# define lt(a, b) (((a).lnum != (b).lnum) \
? (a).lnum < (b).lnum \
: (a).col != (b).col \
? (a).col < (b).col \
: (a).coladd < (b).coladd)
# define ltp(a, b) (((a)->lnum != (b)->lnum) \
? (a)->lnum < (b)->lnum \
: (a)->col != (b)->col \
? (a)->col < (b)->col \
: (a)->coladd < (b)->coladd)
# define equalpos(a, b) (((a).lnum == (b).lnum) && ((a).col == (b).col) && \
((a).coladd == (b).coladd))
# define clearpos(a) {(a)->lnum = 0; (a)->col = 0; (a)->coladd = 0; }
#define ltoreq(a, b) (lt(a, b) || equalpos(a, b))
/*
* lineempty() - return TRUE if the line is empty
*/
#define lineempty(p) (*ml_get(p) == NUL)
/*
* bufempty() - return TRUE if the current buffer is empty
*/
#define bufempty() (curbuf->b_ml.ml_line_count == 1 && *ml_get((linenr_T)1) == \
NUL)
/*
* toupper() and tolower() that use the current locale.
* On some systems toupper()/tolower() only work on lower/uppercase
* characters, first use islower() or isupper() then.
* Careful: Only call TOUPPER_LOC() and TOLOWER_LOC() with a character in the
* range 0 - 255. toupper()/tolower() on some systems can't handle others.
* Note: It is often better to use MB_TOLOWER() and MB_TOUPPER(), because many
* toupper() and tolower() implementations only work for ASCII.
*/
# ifdef BROKEN_TOUPPER
# define TOUPPER_LOC(c) (islower(c) ? toupper(c) : (c))
# define TOLOWER_LOC(c) (isupper(c) ? tolower(c) : (c))
# else
# define TOUPPER_LOC toupper
# define TOLOWER_LOC tolower
# endif
/* toupper() and tolower() for ASCII only and ignore the current locale. */
# define TOUPPER_ASC(c) (((c) < 'a' || (c) > 'z') ? (c) : (c) - ('a' - 'A'))
# define TOLOWER_ASC(c) (((c) < 'A' || (c) > 'Z') ? (c) : (c) + ('a' - 'A'))
/*
* 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)
/* 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)
/* 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))
/* macro version of chartab().
* Only works with values 0-255!
* Doesn't work for UTF-8 mode with chars >= 0x80. */
#define CHARSIZE(c) (chartab[c] & CT_CELL_MASK)
/*
* Adjust chars in a language according to 'langmap' option.
* NOTE that there is no noticeable overhead if 'langmap' is not set.
* When set the overhead for characters < 256 is small.
* Don't apply 'langmap' if the character comes from the Stuff buffer.
* The do-while is just to ignore a ';' after the macro.
*/
# define LANGMAP_ADJUST(c, condition) \
do { \
if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0) \
{ \
if ((c) < 256) \
c = langmap_mapchar[c]; \
else \
c = langmap_adjust_mb(c); \
} \
} while (0)
/*
* vim_isbreak() is used very often if 'linebreak' is set, use a macro to make
* it work fast.
*/
#define vim_isbreak(c) (breakat_flags[(char_u)(c)])
/*
* On VMS file names are different and require a translation.
* On the Mac open() has only two arguments.
*/
# define mch_access(n, p) access((n), (p))
# define mch_fopen(n, p) fopen((n), (p))
# define mch_fstat(n, p) fstat((n), (p))
# ifdef STAT_IGNORES_SLASH
/* On Solaris stat() accepts "file/" as if it was "file". Return -1 if
* the name ends in "/" and it's not a directory. */
# define mch_stat(n, p) (illegal_slash(n) ? -1 : stat((n), (p)))
# else
# define mch_stat(n, p) stat((n), (p))
# endif
#ifdef HAVE_LSTAT
# define mch_lstat(n, p) lstat((n), (p))
#else
# define mch_lstat(n, p) mch_stat((n), (p))
#endif
# define mch_open(n, m, p) open((n), (m), (p))
/* mch_open_rw(): invoke mch_open() with third argument for user R/W. */
#if defined(UNIX) || defined(VMS) /* open in rw------- mode */
# define mch_open_rw(n, f) mch_open((n), (f), (mode_t)0600)
#else
# define mch_open_rw(n, f) mch_open((n), (f), 0)
#endif
#ifdef STARTUPTIME
# define TIME_MSG(s) { if (time_fd != NULL) time_msg(s, NULL); }
#else
# define TIME_MSG(s)
#endif
# define REPLACE_NORMAL(s) (((s) & REPLACE_FLAG) && !((s) & VREPLACE_FLAG))
# define UTF_COMPOSINGLIKE(p1, p2) utf_composinglike((p1), (p2))
/* Whether to draw the vertical bar on the right side of the cell. */
# define CURSOR_BAR_RIGHT (curwin->w_p_rl && (!(State & CMDLINE) || cmdmsg_rl))
/*
* mb_ptr_adv(): advance a pointer to the next character, taking care of
* multi-byte characters if needed.
* mb_ptr_back(): backup a pointer to the previous character, taking care of
* multi-byte characters if needed.
* MB_COPY_CHAR(f, t): copy one char from "f" to "t" and advance the pointers.
* PTR2CHAR(): get character from pointer.
*/
/* Get the length of the character p points to */
# define MB_PTR2LEN(p) (has_mbyte ? (*mb_ptr2len)(p) : 1)
/* Advance multi-byte pointer, skip over composing chars. */
# define mb_ptr_adv(p) p += has_mbyte ? (*mb_ptr2len)(p) : 1
/* Advance multi-byte pointer, do not skip over composing chars. */
# define mb_cptr_adv(p) p += \
enc_utf8 ? utf_ptr2len(p) : has_mbyte ? (*mb_ptr2len)(p) : 1
/* Backup multi-byte pointer. */
# define mb_ptr_back(s, p) p -= has_mbyte ? ((*mb_head_off)(s, p - 1) + 1) : 1
/* get length of multi-byte char, not including composing chars */
# define mb_cptr2len(p) (enc_utf8 ? utf_ptr2len(p) : (*mb_ptr2len)(p))
# define MB_COPY_CHAR(f, \
t) if (has_mbyte) mb_copy_char(&f, &t); else *t++ = *f++
# define MB_CHARLEN(p) (has_mbyte ? mb_charlen(p) : (int)STRLEN(p))
# define MB_CHAR2LEN(c) (has_mbyte ? mb_char2len(c) : 1)
# define PTR2CHAR(p) (has_mbyte ? mb_ptr2char(p) : (int)*(p))
# define DO_AUTOCHDIR if (p_acd) do_autochdir();
# define RESET_BINDING(wp) (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE

2343
src/main.c Normal file

File diff suppressed because it is too large Load Diff

1563
src/mark.c Normal file

File diff suppressed because it is too large Load Diff

4217
src/mbyte.c Normal file

File diff suppressed because it is too large Load Diff

1366
src/memfile.c Normal file

File diff suppressed because it is too large Load Diff

4681
src/memline.c Normal file

File diff suppressed because it is too large Load Diff

1646
src/menu.c Normal file

File diff suppressed because it is too large Load Diff

4004
src/message.c Normal file

File diff suppressed because it is too large Load Diff

9097
src/misc1.c Normal file

File diff suppressed because it is too large Load Diff

5505
src/misc2.c Normal file

File diff suppressed because it is too large Load Diff

2215
src/move.c Normal file

File diff suppressed because it is too large Load Diff

7585
src/normal.c Normal file

File diff suppressed because it is too large Load Diff

5275
src/ops.c Normal file

File diff suppressed because it is too large Load Diff

8298
src/option.c Normal file

File diff suppressed because it is too large Load Diff

768
src/option.h Normal file
View File

@ -0,0 +1,768 @@
/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved 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.
*/
/*
* option.h: definition of global variables for settable options
*/
/*
* Default values for 'errorformat'.
* The "%f|%l| %m" one is used for when the contents of the quickfix window is
* written to a file.
*/
#define DFLT_EFM \
"%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c:,%-GIn file included from %f:%l:%c\\,,%-GIn file included from %f:%l:%c,%-GIn file included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G%*[ ]from %f:%l:,%-G%*[ ]from %f:%l\\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory %*[`']%f',%X%*\\a[%*\\d]: Leaving directory %*[`']%f',%D%*\\a: Entering directory %*[`']%f',%X%*\\a: Leaving directory %*[`']%f',%DMaking %*\\a in %f,%f|%l| %m"
#define DFLT_GREPFORMAT "%f:%l:%m,%f:%l%m,%f %l%m"
/* default values for b_p_ff 'fileformat' and p_ffs 'fileformats' */
#define FF_DOS "dos"
#define FF_MAC "mac"
#define FF_UNIX "unix"
#ifdef USE_CRNL
# define DFLT_FF "dos"
# define DFLT_FFS_VIM "dos,unix"
# define DFLT_FFS_VI "dos,unix" /* also autodetect in compatible mode */
# define DFLT_TEXTAUTO TRUE
#else
# ifdef USE_CR
# define DFLT_FF "mac"
# define DFLT_FFS_VIM "mac,unix,dos"
# define DFLT_FFS_VI "mac,unix,dos"
# define DFLT_TEXTAUTO TRUE
# else
# define DFLT_FF "unix"
# define DFLT_FFS_VIM "unix,dos"
# define DFLT_FFS_VI ""
# define DFLT_TEXTAUTO FALSE
# endif
#endif
/* Possible values for 'encoding' */
# define ENC_UCSBOM "ucs-bom" /* check for BOM at start of file */
/* default value for 'encoding' */
# define ENC_DFLT "latin1"
/* end-of-line style */
#define EOL_UNKNOWN -1 /* not defined yet */
#define EOL_UNIX 0 /* NL */
#define EOL_DOS 1 /* CR NL */
#define EOL_MAC 2 /* CR */
/* Formatting options for p_fo 'formatoptions' */
#define FO_WRAP 't'
#define FO_WRAP_COMS 'c'
#define FO_RET_COMS 'r'
#define FO_OPEN_COMS 'o'
#define FO_Q_COMS 'q'
#define FO_Q_NUMBER 'n'
#define FO_Q_SECOND '2'
#define FO_INS_VI 'v'
#define FO_INS_LONG 'l'
#define FO_INS_BLANK 'b'
#define FO_MBYTE_BREAK 'm' /* break before/after multi-byte char */
#define FO_MBYTE_JOIN 'M' /* no space before/after multi-byte char */
#define FO_MBYTE_JOIN2 'B' /* no space between multi-byte chars */
#define FO_ONE_LETTER '1'
#define FO_WHITE_PAR 'w' /* trailing white space continues paragr. */
#define FO_AUTO 'a' /* automatic formatting */
#define FO_REMOVE_COMS 'j' /* remove comment leaders when joining lines */
#define DFLT_FO_VI "vt"
#define DFLT_FO_VIM "tcq"
#define FO_ALL "tcroq2vlb1mMBn,awj" /* for do_set() */
/* characters for the p_cpo option: */
#define CPO_ALTREAD 'a' /* ":read" sets alternate file name */
#define CPO_ALTWRITE 'A' /* ":write" sets alternate file name */
#define CPO_BAR 'b' /* "\|" ends a mapping */
#define CPO_BSLASH 'B' /* backslash in mapping is not special */
#define CPO_SEARCH 'c'
#define CPO_CONCAT 'C' /* Don't concatenate sourced lines */
#define CPO_DOTTAG 'd' /* "./tags" in 'tags' is in current dir */
#define CPO_DIGRAPH 'D' /* No digraph after "r", "f", etc. */
#define CPO_EXECBUF 'e'
#define CPO_EMPTYREGION 'E' /* operating on empty region is an error */
#define CPO_FNAMER 'f' /* set file name for ":r file" */
#define CPO_FNAMEW 'F' /* set file name for ":w file" */
#define CPO_GOTO1 'g' /* goto line 1 for ":edit" */
#define CPO_INSEND 'H' /* "I" inserts before last blank in line */
#define CPO_INTMOD 'i' /* interrupt a read makes buffer modified */
#define CPO_INDENT 'I' /* remove auto-indent more often */
#define CPO_JOINSP 'j' /* only use two spaces for join after '.' */
#define CPO_ENDOFSENT 'J' /* need two spaces to detect end of sentence */
#define CPO_KEYCODE 'k' /* don't recognize raw key code in mappings */
#define CPO_KOFFSET 'K' /* don't wait for key code in mappings */
#define CPO_LITERAL 'l' /* take char after backslash in [] literal */
#define CPO_LISTWM 'L' /* 'list' changes wrapmargin */
#define CPO_SHOWMATCH 'm'
#define CPO_MATCHBSL 'M' /* "%" ignores use of backslashes */
#define CPO_NUMCOL 'n' /* 'number' column also used for text */
#define CPO_LINEOFF 'o'
#define CPO_OVERNEW 'O' /* silently overwrite new file */
#define CPO_LISP 'p' /* 'lisp' indenting */
#define CPO_FNAMEAPP 'P' /* set file name for ":w >>file" */
#define CPO_JOINCOL 'q' /* with "3J" use column after first join */
#define CPO_REDO 'r'
#define CPO_REMMARK 'R' /* remove marks when filtering */
#define CPO_BUFOPT 's'
#define CPO_BUFOPTGLOB 'S'
#define CPO_TAGPAT 't'
#define CPO_UNDO 'u' /* "u" undoes itself */
#define CPO_BACKSPACE 'v' /* "v" keep deleted text */
#define CPO_CW 'w' /* "cw" only changes one blank */
#define CPO_FWRITE 'W' /* "w!" doesn't overwrite readonly files */
#define CPO_ESC 'x'
#define CPO_REPLCNT 'X' /* "R" with a count only deletes chars once */
#define CPO_YANK 'y'
#define CPO_KEEPRO 'Z' /* don't reset 'readonly' on ":w!" */
#define CPO_DOLLAR '$'
#define CPO_FILTER '!'
#define CPO_MATCH '%'
#define CPO_STAR '*' /* ":*" means ":@" */
#define CPO_PLUS '+' /* ":write file" resets 'modified' */
#define CPO_MINUS '-' /* "9-" fails at and before line 9 */
#define CPO_SPECI '<' /* don't recognize <> in mappings */
#define CPO_REGAPPEND '>' /* insert NL when appending to a register */
/* POSIX flags */
#define CPO_HASH '#' /* "D", "o" and "O" do not use a count */
#define CPO_PARA '{' /* "{" is also a paragraph boundary */
#define CPO_TSIZE '|' /* $LINES and $COLUMNS overrule term size */
#define CPO_PRESERVE '&' /* keep swap file after :preserve */
#define CPO_SUBPERCENT '/' /* % in :s string uses previous one */
#define CPO_BACKSL '\\' /* \ is not special in [] */
#define CPO_CHDIR '.' /* don't chdir if buffer is modified */
#define CPO_SCOLON ';' /* using "," and ";" will skip over char if
* cursor would not move */
/* default values for Vim, Vi and POSIX */
#define CPO_VIM "aABceFs"
#define CPO_VI "aAbBcCdDeEfFgHiIjJkKlLmMnoOpPqrRsStuvwWxXyZ$!%*-+<>;"
#define CPO_ALL \
"aAbBcCdDeEfFgHiIjJkKlLmMnoOpPqrRsStuvwWxXyZ$!%*-+<>#{|&/\\.;"
/* characters for p_ww option: */
#define WW_ALL "bshl<>[],~"
/* characters for p_mouse option: */
#define MOUSE_NORMAL 'n' /* use mouse in Normal mode */
#define MOUSE_VISUAL 'v' /* use mouse in Visual/Select mode */
#define MOUSE_INSERT 'i' /* use mouse in Insert mode */
#define MOUSE_COMMAND 'c' /* use mouse in Command-line mode */
#define MOUSE_HELP 'h' /* use mouse in help buffers */
#define MOUSE_RETURN 'r' /* use mouse for hit-return message */
#define MOUSE_A "nvich" /* used for 'a' flag */
#define MOUSE_ALL "anvichr" /* all possible characters */
#define MOUSE_NONE ' ' /* don't use Visual selection */
#define MOUSE_NONEF 'x' /* forced modeless selection */
#define COCU_ALL "nvic" /* flags for 'concealcursor' */
/* characters for p_shm option: */
#define SHM_RO 'r' /* readonly */
#define SHM_MOD 'm' /* modified */
#define SHM_FILE 'f' /* (file 1 of 2) */
#define SHM_LAST 'i' /* last line incomplete */
#define SHM_TEXT 'x' /* tx instead of textmode */
#define SHM_LINES 'l' /* "L" instead of "lines" */
#define SHM_NEW 'n' /* "[New]" instead of "[New file]" */
#define SHM_WRI 'w' /* "[w]" instead of "written" */
#define SHM_A "rmfixlnw" /* represented by 'a' flag */
#define SHM_WRITE 'W' /* don't use "written" at all */
#define SHM_TRUNC 't' /* trunctate file messages */
#define SHM_TRUNCALL 'T' /* trunctate all messages */
#define SHM_OVER 'o' /* overwrite file messages */
#define SHM_OVERALL 'O' /* overwrite more messages */
#define SHM_SEARCH 's' /* no search hit bottom messages */
#define SHM_ATTENTION 'A' /* no ATTENTION messages */
#define SHM_INTRO 'I' /* intro messages */
#define SHM_ALL "rmfixlnwaWtToOsAI" /* all possible flags for 'shm' */
/* characters for p_go: */
#define GO_ASEL 'a' /* autoselect */
#define GO_ASELML 'A' /* autoselect modeless selection */
#define GO_BOT 'b' /* use bottom scrollbar */
#define GO_CONDIALOG 'c' /* use console dialog */
#define GO_TABLINE 'e' /* may show tabline */
#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_LEFT 'l' /* use left scrollbar */
#define GO_VLEFT 'L' /* left scrollbar with vert split */
#define GO_MENUS 'm' /* use menu bar */
#define GO_NOSYSMENU 'M' /* don't source system menu */
#define GO_POINTER 'p' /* pointer enter/leave callbacks */
#define GO_ASELPLUS 'P' /* autoselectPlus */
#define GO_RIGHT 'r' /* use right scrollbar */
#define GO_VRIGHT 'R' /* right scrollbar with vert split */
#define GO_TEAROFF 't' /* add tear-off menu items */
#define GO_TOOLBAR 'T' /* add toolbar */
#define GO_FOOTER 'F' /* add footer */
#define GO_VERTICAL 'v' /* arrange dialog buttons vertically */
#define GO_ALL "aAbcefFghilmMprtTv" /* all possible flags for 'go' */
/* flags for 'comments' option */
#define COM_NEST 'n' /* comments strings nest */
#define COM_BLANK 'b' /* needs blank after string */
#define COM_START 's' /* start of comment */
#define COM_MIDDLE 'm' /* middle of comment */
#define COM_END 'e' /* end of comment */
#define COM_AUTO_END 'x' /* last char of end closes comment */
#define COM_FIRST 'f' /* first line comment only */
#define COM_LEFT 'l' /* left adjusted */
#define COM_RIGHT 'r' /* right adjusted */
#define COM_NOBACK 'O' /* don't use for "O" command */
#define COM_ALL "nbsmexflrO" /* all flags for 'comments' option */
#define COM_MAX_LEN 50 /* maximum length of a part */
/* flags for 'statusline' option */
#define STL_FILEPATH 'f' /* path of file in buffer */
#define STL_FULLPATH 'F' /* full path of file in buffer */
#define STL_FILENAME 't' /* last part (tail) of file path */
#define STL_COLUMN 'c' /* column og cursor*/
#define STL_VIRTCOL 'v' /* virtual column */
#define STL_VIRTCOL_ALT 'V' /* - with 'if different' display */
#define STL_LINE 'l' /* line number of cursor */
#define STL_NUMLINES 'L' /* number of lines in buffer */
#define STL_BUFNO 'n' /* current buffer number */
#define STL_KEYMAP 'k' /* 'keymap' when active */
#define STL_OFFSET 'o' /* offset of character under cursor*/
#define STL_OFFSET_X 'O' /* - in hexadecimal */
#define STL_BYTEVAL 'b' /* byte value of character */
#define STL_BYTEVAL_X 'B' /* - in hexadecimal */
#define STL_ROFLAG 'r' /* readonly flag */
#define STL_ROFLAG_ALT 'R' /* - other display */
#define STL_HELPFLAG 'h' /* window is showing a help file */
#define STL_HELPFLAG_ALT 'H' /* - other display */
#define STL_FILETYPE 'y' /* 'filetype' */
#define STL_FILETYPE_ALT 'Y' /* - other display */
#define STL_PREVIEWFLAG 'w' /* window is showing the preview buf */
#define STL_PREVIEWFLAG_ALT 'W' /* - other display */
#define STL_MODIFIED 'm' /* modified flag */
#define STL_MODIFIED_ALT 'M' /* - other display */
#define STL_QUICKFIX 'q' /* quickfix window description */
#define STL_PERCENTAGE 'p' /* percentage through file */
#define STL_ALTPERCENT 'P' /* percentage as TOP BOT ALL or NN% */
#define STL_ARGLISTSTAT 'a' /* argument list status as (x of y) */
#define STL_PAGENUM 'N' /* page number (when printing)*/
#define STL_VIM_EXPR '{' /* start of expression to substitute */
#define STL_MIDDLEMARK '=' /* separation between left and right */
#define STL_TRUNCMARK '<' /* truncation mark if line is too long*/
#define STL_USER_HL '*' /* highlight from (User)1..9 or 0 */
#define STL_HIGHLIGHT '#' /* highlight name */
#define STL_TABPAGENR 'T' /* tab page label nr */
#define STL_TABCLOSENR 'X' /* tab page close nr */
#define STL_ALL ((char_u *) "fFtcvVlLknoObBrRhHmYyWwMqpPaN{#")
/* flags used for parsed 'wildmode' */
#define WIM_FULL 1
#define WIM_LONGEST 2
#define WIM_LIST 4
/* arguments for can_bs() */
#define BS_INDENT 'i' /* "Indent" */
#define BS_EOL 'o' /* "eOl" */
#define BS_START 's' /* "Start" */
#define LISPWORD_VALUE \
"defun,define,defmacro,set!,lambda,if,case,let,flet,let*,letrec,do,do*,define-syntax,let-syntax,letrec-syntax,destructuring-bind,defpackage,defparameter,defstruct,deftype,defvar,do-all-symbols,do-external-symbols,do-symbols,dolist,dotimes,ecase,etypecase,eval-when,labels,macrolet,multiple-value-bind,multiple-value-call,multiple-value-prog1,multiple-value-setq,prog1,progv,typecase,unless,unwind-protect,when,with-input-from-string,with-open-file,with-open-stream,with-output-to-string,with-package-iterator,define-condition,handler-bind,handler-case,restart-bind,restart-case,with-simple-restart,store-value,use-value,muffle-warning,abort,continue,with-slots,with-slots*,with-accessors,with-accessors*,defclass,defmethod,print-unreadable-object"
/*
* The following are actual variables for the options
*/
EXTERN long p_aleph; /* 'aleph' */
EXTERN int p_acd; /* 'autochdir' */
EXTERN char_u *p_ambw; /* 'ambiwidth' */
EXTERN int p_ar; /* 'autoread' */
EXTERN int p_aw; /* 'autowrite' */
EXTERN int p_awa; /* 'autowriteall' */
EXTERN char_u *p_bs; /* 'backspace' */
EXTERN char_u *p_bg; /* 'background' */
EXTERN int p_bk; /* 'backup' */
EXTERN char_u *p_bkc; /* 'backupcopy' */
EXTERN unsigned bkc_flags;
#ifdef IN_OPTION_C
static char *(p_bkc_values[]) =
{"yes", "auto", "no", "breaksymlink", "breakhardlink", NULL};
#endif
# define BKC_YES 0x001
# define BKC_AUTO 0x002
# define BKC_NO 0x004
# define BKC_BREAKSYMLINK 0x008
# define BKC_BREAKHARDLINK 0x010
EXTERN char_u *p_bdir; /* 'backupdir' */
EXTERN char_u *p_bex; /* 'backupext' */
EXTERN char_u *p_bsk; /* 'backupskip' */
EXTERN char_u *p_cm; /* 'cryptmethod' */
EXTERN char_u *p_breakat; /* 'breakat' */
EXTERN char_u *p_cmp; /* 'casemap' */
EXTERN unsigned cmp_flags;
# ifdef IN_OPTION_C
static char *(p_cmp_values[]) = {"internal", "keepascii", NULL};
# endif
# define CMP_INTERNAL 0x001
# define CMP_KEEPASCII 0x002
EXTERN char_u *p_enc; /* 'encoding' */
EXTERN int p_deco; /* 'delcombine' */
EXTERN char_u *p_ccv; /* 'charconvert' */
EXTERN char_u *p_cedit; /* 'cedit' */
EXTERN long p_cwh; /* 'cmdwinheight' */
EXTERN long p_ch; /* 'cmdheight' */
EXTERN int p_confirm; /* 'confirm' */
EXTERN int p_cp; /* 'compatible' */
EXTERN char_u *p_cot; /* 'completeopt' */
EXTERN long p_ph; /* 'pumheight' */
EXTERN char_u *p_cpo; /* 'cpoptions' */
EXTERN char_u *p_csprg; /* 'cscopeprg' */
EXTERN int p_csre; /* 'cscoperelative' */
EXTERN char_u *p_csqf; /* 'cscopequickfix' */
# define CSQF_CMDS "sgdctefi"
# define CSQF_FLAGS "+-0"
EXTERN int p_cst; /* 'cscopetag' */
EXTERN long p_csto; /* 'cscopetagorder' */
EXTERN long p_cspc; /* 'cscopepathcomp' */
EXTERN int p_csverbose; /* 'cscopeverbose' */
EXTERN char_u *p_debug; /* 'debug' */
EXTERN char_u *p_def; /* 'define' */
EXTERN char_u *p_inc;
EXTERN char_u *p_dip; /* 'diffopt' */
EXTERN char_u *p_dex; /* 'diffexpr' */
EXTERN char_u *p_dict; /* 'dictionary' */
EXTERN int p_dg; /* 'digraph' */
EXTERN char_u *p_dir; /* 'directory' */
EXTERN char_u *p_dy; /* 'display' */
EXTERN unsigned dy_flags;
#ifdef IN_OPTION_C
static char *(p_dy_values[]) = {"lastline", "uhex", NULL};
#endif
#define DY_LASTLINE 0x001
#define DY_UHEX 0x002
EXTERN int p_ed; /* 'edcompatible' */
EXTERN char_u *p_ead; /* 'eadirection' */
EXTERN int p_ea; /* 'equalalways' */
EXTERN char_u *p_ep; /* 'equalprg' */
EXTERN int p_eb; /* 'errorbells' */
EXTERN char_u *p_ef; /* 'errorfile' */
EXTERN char_u *p_efm; /* 'errorformat' */
EXTERN char_u *p_gefm; /* 'grepformat' */
EXTERN char_u *p_gp; /* 'grepprg' */
EXTERN char_u *p_ei; /* 'eventignore' */
EXTERN int p_ek; /* 'esckeys' */
EXTERN int p_exrc; /* 'exrc' */
EXTERN char_u *p_fencs; /* 'fileencodings' */
EXTERN char_u *p_ffs; /* 'fileformats' */
EXTERN long p_fic; /* 'fileignorecase' */
EXTERN char_u *p_fcl; /* 'foldclose' */
EXTERN long p_fdls; /* 'foldlevelstart' */
EXTERN char_u *p_fdo; /* 'foldopen' */
EXTERN unsigned fdo_flags;
# ifdef IN_OPTION_C
static char *(p_fdo_values[]) = {"all", "block", "hor", "mark", "percent",
"quickfix", "search", "tag", "insert",
"undo", "jump", NULL};
# endif
# define FDO_ALL 0x001
# define FDO_BLOCK 0x002
# define FDO_HOR 0x004
# define FDO_MARK 0x008
# define FDO_PERCENT 0x010
# define FDO_QUICKFIX 0x020
# define FDO_SEARCH 0x040
# define FDO_TAG 0x080
# define FDO_INSERT 0x100
# define FDO_UNDO 0x200
# define FDO_JUMP 0x400
EXTERN char_u *p_fp; /* 'formatprg' */
#ifdef HAVE_FSYNC
EXTERN int p_fs; /* 'fsync' */
#endif
EXTERN int p_gd; /* 'gdefault' */
EXTERN char_u *p_pdev; /* 'printdevice' */
EXTERN char_u *p_penc; /* 'printencoding' */
EXTERN char_u *p_pexpr; /* 'printexpr' */
EXTERN char_u *p_pmfn; /* 'printmbfont' */
EXTERN char_u *p_pmcs; /* 'printmbcharset' */
EXTERN char_u *p_pfn; /* 'printfont' */
EXTERN char_u *p_popt; /* 'printoptions' */
EXTERN char_u *p_header; /* 'printheader' */
EXTERN int p_prompt; /* 'prompt' */
#ifdef CURSOR_SHAPE
EXTERN char_u *p_guicursor; /* 'guicursor' */
#endif
EXTERN char_u *p_hf; /* 'helpfile' */
EXTERN long p_hh; /* 'helpheight' */
EXTERN char_u *p_hlg; /* 'helplang' */
EXTERN int p_hid; /* 'hidden' */
/* Use P_HID to check if a buffer is to be hidden when it is no longer
* visible in a window. */
# define P_HID(buf) (buf_hide(buf))
EXTERN char_u *p_hl; /* 'highlight' */
EXTERN int p_hls; /* 'hlsearch' */
EXTERN long p_hi; /* 'history' */
EXTERN int p_hkmap; /* 'hkmap' */
EXTERN int p_hkmapp; /* 'hkmapp' */
EXTERN int p_fkmap; /* 'fkmap' */
EXTERN int p_altkeymap; /* 'altkeymap' */
EXTERN int p_arshape; /* 'arabicshape' */
EXTERN int p_icon; /* 'icon' */
EXTERN char_u *p_iconstring; /* 'iconstring' */
EXTERN int p_ic; /* 'ignorecase' */
#ifdef USE_IM_CONTROL
EXTERN int p_imcmdline; /* 'imcmdline' */
EXTERN int p_imdisable; /* 'imdisable' */
#endif
EXTERN int p_is; /* 'incsearch' */
EXTERN int p_im; /* 'insertmode' */
EXTERN char_u *p_isf; /* 'isfname' */
EXTERN char_u *p_isi; /* 'isident' */
EXTERN char_u *p_isp; /* 'isprint' */
EXTERN int p_js; /* 'joinspaces' */
EXTERN char_u *p_kp; /* 'keywordprg' */
EXTERN char_u *p_km; /* 'keymodel' */
EXTERN char_u *p_langmap; /* 'langmap'*/
EXTERN char_u *p_lm; /* 'langmenu' */
EXTERN char_u *p_lispwords; /* 'lispwords' */
EXTERN long p_ls; /* 'laststatus' */
EXTERN long p_stal; /* 'showtabline' */
EXTERN char_u *p_lcs; /* 'listchars' */
EXTERN int p_lz; /* 'lazyredraw' */
EXTERN int p_lpl; /* 'loadplugins' */
EXTERN int p_magic; /* 'magic' */
EXTERN char_u *p_mef; /* 'makeef' */
EXTERN char_u *p_mp; /* 'makeprg' */
EXTERN char_u *p_cc; /* 'colorcolumn' */
EXTERN int p_cc_cols[256]; /* array for 'colorcolumn' columns */
EXTERN long p_mat; /* 'matchtime' */
EXTERN long p_mco; /* 'maxcombine' */
EXTERN long p_mfd; /* 'maxfuncdepth' */
EXTERN long p_mmd; /* 'maxmapdepth' */
EXTERN long p_mm; /* 'maxmem' */
EXTERN long p_mmp; /* 'maxmempattern' */
EXTERN long p_mmt; /* 'maxmemtot' */
EXTERN long p_mis; /* 'menuitems' */
EXTERN char_u *p_msm; /* 'mkspellmem' */
EXTERN long p_mls; /* 'modelines' */
EXTERN char_u *p_mouse; /* 'mouse' */
EXTERN char_u *p_mousem; /* 'mousemodel' */
EXTERN long p_mouset; /* 'mousetime' */
EXTERN int p_more; /* 'more' */
EXTERN char_u *p_opfunc; /* 'operatorfunc' */
EXTERN char_u *p_para; /* 'paragraphs' */
EXTERN int p_paste; /* 'paste' */
EXTERN char_u *p_pt; /* 'pastetoggle' */
EXTERN char_u *p_pex; /* 'patchexpr' */
EXTERN char_u *p_pm; /* 'patchmode' */
EXTERN char_u *p_path; /* 'path' */
EXTERN char_u *p_cdpath; /* 'cdpath' */
EXTERN long p_rdt; /* 'redrawtime' */
EXTERN int p_remap; /* 'remap' */
EXTERN long p_re; /* 'regexpengine' */
EXTERN long p_report; /* 'report' */
EXTERN long p_pvh; /* 'previewheight' */
EXTERN int p_ari; /* 'allowrevins' */
EXTERN int p_ri; /* 'revins' */
EXTERN int p_ru; /* 'ruler' */
EXTERN char_u *p_ruf; /* 'rulerformat' */
EXTERN char_u *p_rtp; /* 'runtimepath' */
EXTERN long p_sj; /* 'scrolljump' */
EXTERN long p_so; /* 'scrolloff' */
EXTERN char_u *p_sbo; /* 'scrollopt' */
EXTERN char_u *p_sections; /* 'sections' */
EXTERN int p_secure; /* 'secure' */
EXTERN char_u *p_sel; /* 'selection' */
EXTERN char_u *p_slm; /* 'selectmode' */
EXTERN char_u *p_ssop; /* 'sessionoptions' */
EXTERN unsigned ssop_flags;
# ifdef IN_OPTION_C
/* Also used for 'viewoptions'! */
static char *(p_ssop_values[]) = {"buffers", "winpos", "resize", "winsize",
"localoptions", "options", "help", "blank",
"globals", "slash", "unix",
"sesdir", "curdir", "folds", "cursor",
"tabpages", NULL};
# endif
# define SSOP_BUFFERS 0x001
# define SSOP_WINPOS 0x002
# define SSOP_RESIZE 0x004
# define SSOP_WINSIZE 0x008
# define SSOP_LOCALOPTIONS 0x010
# define SSOP_OPTIONS 0x020
# define SSOP_HELP 0x040
# define SSOP_BLANK 0x080
# define SSOP_GLOBALS 0x100
# define SSOP_SLASH 0x200
# define SSOP_UNIX 0x400
# define SSOP_SESDIR 0x800
# define SSOP_CURDIR 0x1000
# define SSOP_FOLDS 0x2000
# define SSOP_CURSOR 0x4000
# define SSOP_TABPAGES 0x8000
EXTERN char_u *p_sh; /* 'shell' */
EXTERN char_u *p_shcf; /* 'shellcmdflag' */
EXTERN char_u *p_sp; /* 'shellpipe' */
EXTERN char_u *p_shq; /* 'shellquote' */
EXTERN char_u *p_sxq; /* 'shellxquote' */
EXTERN char_u *p_sxe; /* 'shellxescape' */
EXTERN char_u *p_srr; /* 'shellredir' */
EXTERN int p_stmp; /* 'shelltemp' */
#ifdef BACKSLASH_IN_FILENAME
EXTERN int p_ssl; /* 'shellslash' */
#endif
EXTERN char_u *p_stl; /* 'statusline' */
EXTERN int p_sr; /* 'shiftround' */
EXTERN char_u *p_shm; /* 'shortmess' */
EXTERN char_u *p_sbr; /* 'showbreak' */
EXTERN int p_sc; /* 'showcmd' */
EXTERN int p_sft; /* 'showfulltag' */
EXTERN int p_sm; /* 'showmatch' */
EXTERN int p_smd; /* 'showmode' */
EXTERN long p_ss; /* 'sidescroll' */
EXTERN long p_siso; /* 'sidescrolloff' */
EXTERN int p_scs; /* 'smartcase' */
EXTERN int p_sta; /* 'smarttab' */
EXTERN int p_sb; /* 'splitbelow' */
EXTERN long p_tpm; /* 'tabpagemax' */
EXTERN char_u *p_tal; /* 'tabline' */
EXTERN char_u *p_sps; /* 'spellsuggest' */
EXTERN int p_spr; /* 'splitright' */
EXTERN int p_sol; /* 'startofline' */
EXTERN char_u *p_su; /* 'suffixes' */
EXTERN char_u *p_sws; /* 'swapsync' */
EXTERN char_u *p_swb; /* 'switchbuf' */
EXTERN unsigned swb_flags;
#ifdef IN_OPTION_C
static char *(p_swb_values[]) = {"useopen", "usetab", "split", "newtab", NULL};
#endif
#define SWB_USEOPEN 0x001
#define SWB_USETAB 0x002
#define SWB_SPLIT 0x004
#define SWB_NEWTAB 0x008
EXTERN int p_tbs; /* 'tagbsearch' */
EXTERN long p_tl; /* 'taglength' */
EXTERN int p_tr; /* 'tagrelative' */
EXTERN char_u *p_tags; /* 'tags' */
EXTERN int p_tgst; /* 'tagstack' */
EXTERN int p_tbidi; /* 'termbidi' */
EXTERN char_u *p_tenc; /* 'termencoding' */
EXTERN int p_terse; /* 'terse' */
EXTERN int p_ta; /* 'textauto' */
EXTERN int p_to; /* 'tildeop' */
EXTERN int p_timeout; /* 'timeout' */
EXTERN long p_tm; /* 'timeoutlen' */
EXTERN int p_title; /* 'title' */
EXTERN long p_titlelen; /* 'titlelen' */
EXTERN char_u *p_titleold; /* 'titleold' */
EXTERN char_u *p_titlestring; /* 'titlestring' */
EXTERN char_u *p_tsr; /* 'thesaurus' */
EXTERN int p_ttimeout; /* 'ttimeout' */
EXTERN long p_ttm; /* 'ttimeoutlen' */
EXTERN int p_tbi; /* 'ttybuiltin' */
EXTERN int p_tf; /* 'ttyfast' */
EXTERN long p_ttyscroll; /* 'ttyscroll' */
#if defined(FEAT_MOUSE) && (defined(UNIX) || defined(VMS))
EXTERN char_u *p_ttym; /* 'ttymouse' */
EXTERN unsigned ttym_flags;
# ifdef IN_OPTION_C
static char *(p_ttym_values[]) =
{"xterm", "xterm2", "dec", "netterm", "jsbterm", "pterm", "urxvt", "sgr", NULL};
# endif
# define TTYM_XTERM 0x01
# define TTYM_XTERM2 0x02
# define TTYM_DEC 0x04
# define TTYM_NETTERM 0x08
# define TTYM_JSBTERM 0x10
# define TTYM_PTERM 0x20
# define TTYM_URXVT 0x40
# define TTYM_SGR 0x80
#endif
EXTERN char_u *p_udir; /* 'undodir' */
EXTERN long p_ul; /* 'undolevels' */
EXTERN long p_ur; /* 'undoreload' */
EXTERN long p_uc; /* 'updatecount' */
EXTERN long p_ut; /* 'updatetime' */
EXTERN char_u *p_fcs; /* 'fillchar' */
EXTERN char_u *p_viminfo; /* 'viminfo' */
EXTERN char_u *p_vdir; /* 'viewdir' */
EXTERN char_u *p_vop; /* 'viewoptions' */
EXTERN unsigned vop_flags; /* uses SSOP_ flags */
EXTERN int p_vb; /* 'visualbell' */
EXTERN char_u *p_ve; /* 'virtualedit' */
EXTERN unsigned ve_flags;
# ifdef IN_OPTION_C
static char *(p_ve_values[]) = {"block", "insert", "all", "onemore", NULL};
# endif
# define VE_BLOCK 5 /* includes "all" */
# define VE_INSERT 6 /* includes "all" */
# define VE_ALL 4
# define VE_ONEMORE 8
EXTERN long p_verbose; /* 'verbose' */
#ifdef IN_OPTION_C
char_u *p_vfile = (char_u *)""; /* used before options are initialized */
#else
extern char_u *p_vfile; /* 'verbosefile' */
#endif
EXTERN int p_warn; /* 'warn' */
EXTERN char_u *p_wop; /* 'wildoptions' */
EXTERN long p_window; /* 'window' */
#if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(LINT) \
|| defined (FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON)
#define FEAT_WAK
EXTERN char_u *p_wak; /* 'winaltkeys' */
#endif
EXTERN char_u *p_wak;
EXTERN char_u *p_wig; /* 'wildignore' */
EXTERN int p_wiv; /* 'weirdinvert' */
EXTERN char_u *p_ww; /* 'whichwrap' */
EXTERN long p_wc; /* 'wildchar' */
EXTERN long p_wcm; /* 'wildcharm' */
EXTERN long p_wic; /* 'wildignorecase' */
EXTERN char_u *p_wim; /* 'wildmode' */
EXTERN int p_wmnu; /* 'wildmenu' */
EXTERN long p_wh; /* 'winheight' */
EXTERN long p_wmh; /* 'winminheight' */
EXTERN long p_wmw; /* 'winminwidth' */
EXTERN long p_wiw; /* 'winwidth' */
EXTERN int p_ws; /* 'wrapscan' */
EXTERN int p_write; /* 'write' */
EXTERN int p_wa; /* 'writeany' */
EXTERN int p_wb; /* 'writebackup' */
EXTERN long p_wd; /* 'writedelay' */
/*
* "indir" values for buffer-local opions.
* These need to be defined globally, so that the BV_COUNT can be used with
* b_p_scriptID[].
*/
enum {
BV_AI = 0
, BV_AR
, BV_BH
, BV_BT
, BV_EFM
, BV_GP
, BV_MP
, BV_BIN
, BV_BL
, BV_BOMB
, BV_CI
, BV_CIN
, BV_CINK
, BV_CINO
, BV_CINW
, BV_CM
, BV_CMS
, BV_COM
, BV_CPT
, BV_DICT
, BV_TSR
, BV_CFU
, BV_DEF
, BV_INC
, BV_EOL
, BV_EP
, BV_ET
, BV_FENC
, BV_BEXPR
, BV_FEX
, BV_FF
, BV_FLP
, BV_FO
, BV_FT
, BV_IMI
, BV_IMS
, BV_INDE
, BV_INDK
, BV_INEX
, BV_INF
, BV_ISK
, BV_KEY
, BV_KMAP
, BV_KP
, BV_LISP
, BV_MA
, BV_ML
, BV_MOD
, BV_MPS
, BV_NF
, BV_OFU
, BV_PATH
, BV_PI
, BV_QE
, BV_RO
, BV_SI
#ifndef SHORT_FNAME
, BV_SN
#endif
, BV_SMC
, BV_SYN
, BV_SPC
, BV_SPF
, BV_SPL
, BV_STS
, BV_SUA
, BV_SW
, BV_SWF
, BV_TAGS
, BV_TS
, BV_TW
, BV_TX
, BV_UDF
, BV_UL
, BV_WM
, BV_COUNT /* must be the last one */
};
/*
* "indir" values for window-local options.
* These need to be defined globally, so that the WV_COUNT can be used in the
* window structure.
*/
enum {
WV_LIST = 0
, WV_ARAB
, WV_COCU
, WV_COLE
, WV_CRBIND
, WV_DIFF
, WV_FDC
, WV_FEN
, WV_FDI
, WV_FDL
, WV_FDM
, WV_FML
, WV_FDN
, WV_FDE
, WV_FDT
, WV_FMR
, WV_LBR
, WV_NU
, WV_RNU
, WV_NUW
, WV_PVW
, WV_RL
, WV_RLC
, WV_SCBIND
, WV_SCROLL
, WV_SPELL
, WV_CUC
, WV_CUL
, WV_CC
, WV_STL
, WV_WFH
, WV_WFW
, WV_WRAP
, WV_COUNT /* must be the last one */
};
/* Value for b_p_ul indicating the global value must be used. */
#define NO_LOCAL_UNDOLEVEL -123456

4091
src/os_unix.c Normal file

File diff suppressed because it is too large Load Diff

372
src/os_unix.h Normal file
View File

@ -0,0 +1,372 @@
/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved 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.
*/
/*
* NextStep has a problem with configure, undefine a few things:
*/
#include <stdio.h>
#include <ctype.h>
# include <sys/types.h>
# include <sys/stat.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
/* On AIX 4.2 there is a conflicting prototype for ioctl() in stropts.h and
* unistd.h. This hack should fix that (suggested by Jeff George).
* But on AIX 4.3 it's alright (suggested by Jake Hamby). */
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_LIBC_H
# include <libc.h> /* for NeXT */
#endif
#ifdef HAVE_SYS_PARAM_H
# include <sys/param.h> /* defines BSD, if it's a BSD system */
#endif
/*
* Sun defines FILE on SunOS 4.x.x, Solaris has a typedef for FILE
*/
/*
* Using getcwd() is preferred, because it checks for a buffer overflow.
* Don't use getcwd() on systems do use system("sh -c pwd"). There is an
* autoconf check for this.
* Use getcwd() anyway if getwd() isn't present.
*/
#if defined(HAVE_GETCWD) && !(defined(BAD_GETCWD) && defined(HAVE_GETWD))
# define USE_GETCWD
#endif
#ifndef __ARGS
/* The AIX VisualAge cc compiler defines __EXTENDED__ instead of __STDC__
* because it includes pre-ansi features. */
# if defined(__STDC__) || defined(__GNUC__) || defined(__EXTENDED__)
# define __ARGS(x) x
# else
# define __ARGS(x) ()
# endif
#endif
/* always use unlink() to remove files */
# define vim_mkdir(x, y) mkdir((char *)(x), y)
# define mch_rmdir(x) rmdir((char *)(x))
# define mch_remove(x) unlink((char *)(x))
/* The number of arguments to a signal handler is configured here. */
/* It used to be a long list of almost all systems. Any system that doesn't
* have an argument??? */
#define SIGHASARG
/* List 3 arg systems here. I guess __sgi, please test and correct me. jw. */
#ifdef SIGHASARG
# ifdef SIGHAS3ARGS
# define SIGPROTOARG (int, int, struct sigcontext *)
# define SIGDEFARG(s) (s, sig2, scont) int s, sig2; struct sigcontext *scont;
# define SIGDUMMYARG 0, 0, (struct sigcontext *)0
# else
# define SIGPROTOARG (int)
# define SIGDEFARG(s) (s) int s UNUSED;
# define SIGDUMMYARG 0
# endif
#else
# define SIGPROTOARG (void)
# define SIGDEFARG(s) ()
# define SIGDUMMYARG
#endif
#ifdef HAVE_DIRENT_H
# include <dirent.h>
# ifndef NAMLEN
# define NAMLEN(dirent) strlen((dirent)->d_name)
# endif
#else
# define dirent direct
# define NAMLEN(dirent) (dirent)->d_namlen
# if HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
# if HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
# if HAVE_NDIR_H
# include <ndir.h>
# endif
#endif
#if !defined(HAVE_SYS_TIME_H) || defined(TIME_WITH_SYS_TIME)
# include <time.h> /* on some systems time.h should not be
included together with sys/time.h */
#endif
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
#include <signal.h>
#if defined(DIRSIZ) && !defined(MAXNAMLEN)
# define MAXNAMLEN DIRSIZ
#endif
#if defined(UFS_MAXNAMLEN) && !defined(MAXNAMLEN)
# define MAXNAMLEN UFS_MAXNAMLEN /* for dynix/ptx */
#endif
#if defined(NAME_MAX) && !defined(MAXNAMLEN)
# define MAXNAMLEN NAME_MAX /* for Linux before .99p3 */
#endif
/*
* Note: if MAXNAMLEN has the wrong value, you will get error messages
* for not being able to open the swap file.
*/
#if !defined(MAXNAMLEN)
# define MAXNAMLEN 512 /* for all other Unix */
#endif
#define BASENAMELEN (MAXNAMLEN - 5)
#ifdef HAVE_PWD_H
# include <pwd.h>
#endif
#ifdef __COHERENT__
# undef __ARGS
#endif
#if (defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT)) \
|| (defined(HAVE_SYS_SYSINFO_H) && defined(HAVE_SYSINFO)) \
|| defined(HAVE_SYSCTL) || defined(HAVE_SYSCONF)
# define HAVE_TOTAL_MEM
#endif
/*
* Unix system-dependent file names
*/
#ifndef SYS_VIMRC_FILE
# define SYS_VIMRC_FILE "$VIM/vimrc"
#endif
#ifndef SYS_GVIMRC_FILE
# define SYS_GVIMRC_FILE "$VIM/gvimrc"
#endif
#ifndef DFLT_HELPFILE
# define DFLT_HELPFILE "$VIMRUNTIME/doc/help.txt"
#endif
#ifndef FILETYPE_FILE
# define FILETYPE_FILE "filetype.vim"
#endif
#ifndef FTPLUGIN_FILE
# define FTPLUGIN_FILE "ftplugin.vim"
#endif
#ifndef INDENT_FILE
# define INDENT_FILE "indent.vim"
#endif
#ifndef FTOFF_FILE
# define FTOFF_FILE "ftoff.vim"
#endif
#ifndef FTPLUGOF_FILE
# define FTPLUGOF_FILE "ftplugof.vim"
#endif
#ifndef INDOFF_FILE
# define INDOFF_FILE "indoff.vim"
#endif
#ifndef SYS_MENU_FILE
# define SYS_MENU_FILE "$VIMRUNTIME/menu.vim"
#endif
#ifndef USR_EXRC_FILE
# define USR_EXRC_FILE "$HOME/.exrc"
#endif
#ifndef USR_VIMRC_FILE
# define USR_VIMRC_FILE "$HOME/.vimrc"
#endif
#if !defined(USR_EXRC_FILE2)
# define USR_VIMRC_FILE2 "~/.vim/vimrc"
#endif
#ifndef USR_GVIMRC_FILE
# define USR_GVIMRC_FILE "$HOME/.gvimrc"
#endif
#ifndef USR_GVIMRC_FILE2
# define USR_GVIMRC_FILE2 "~/.vim/gvimrc"
#endif
#ifndef EVIM_FILE
# define EVIM_FILE "$VIMRUNTIME/evim.vim"
#endif
# ifndef VIMINFO_FILE
# define VIMINFO_FILE "$HOME/.viminfo"
# endif
#ifndef EXRC_FILE
# define EXRC_FILE ".exrc"
#endif
#ifndef VIMRC_FILE
# define VIMRC_FILE ".vimrc"
#endif
#ifndef SYNTAX_FNAME
# define SYNTAX_FNAME "$VIMRUNTIME/syntax/%s.vim"
#endif
#ifndef DFLT_BDIR
# define DFLT_BDIR ".,~/tmp,~/" /* default for 'backupdir' */
#endif
#ifndef DFLT_DIR
# define DFLT_DIR ".,~/tmp,/var/tmp,/tmp" /* default for 'directory' */
#endif
#ifndef DFLT_VDIR
# define DFLT_VDIR "$HOME/.vim/view" /* default for 'viewdir' */
#endif
#define DFLT_ERRORFILE "errors.err"
# ifdef RUNTIME_GLOBAL
# define DFLT_RUNTIMEPATH "~/.vim," RUNTIME_GLOBAL ",$VIMRUNTIME," \
RUNTIME_GLOBAL "/after,~/.vim/after"
# else
# define DFLT_RUNTIMEPATH \
"~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after"
# endif
# define TEMPDIRNAMES "$TMPDIR", "/tmp", ".", "$HOME"
# define TEMPNAMELEN 256
/* Special wildcards that need to be handled by the shell */
#define SPECIAL_WILDCHAR "`'{"
#ifndef HAVE_OPENDIR
# define NO_EXPANDPATH
#endif
/*
* Unix has plenty of memory, use large buffers
*/
#define CMDBUFFSIZE 1024 /* size of the command processing buffer */
/* Use the system path length if it makes sense. */
#if defined(PATH_MAX) && (PATH_MAX > 1000)
# define MAXPATHL PATH_MAX
#else
# define MAXPATHL 1024
#endif
#define CHECK_INODE /* used when checking if a swap file already
exists for a file */
# ifndef DFLT_MAXMEM
# 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 */
# endif
/* memmove is not present on all systems, use memmove, bcopy, memcpy or our
* own version */
/* Some systems have (void *) arguments, some (char *). If we use (char *) it
* works for all */
#ifdef USEMEMMOVE
# define mch_memmove(to, from, len) memmove((char *)(to), (char *)(from), len)
#else
# ifdef USEBCOPY
# define mch_memmove(to, from, len) bcopy((char *)(from), (char *)(to), len)
# else
# ifdef USEMEMCPY
# define mch_memmove(to, from, len) memcpy((char *)(to), (char *)(from), len)
# else
# define VIM_MEMMOVE /* found in misc2.c */
# endif
# endif
#endif
# ifdef HAVE_RENAME
# define mch_rename(src, dst) rename(src, dst)
# else
int mch_rename __ARGS((const char *src, const char *dest));
# endif
# ifdef __MVS__
/* on OS390 Unix getenv() doesn't return a pointer to persistent
* storage -> use __getenv() */
# define mch_getenv(x) (char_u *)__getenv((char *)(x))
# else
# define mch_getenv(x) (char_u *)getenv((char *)(x))
# endif
# define mch_setenv(name, val, x) setenv(name, val, x)
#if !defined(S_ISDIR) && defined(S_IFDIR)
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
#if !defined(S_ISREG) && defined(S_IFREG)
# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
#if !defined(S_ISBLK) && defined(S_IFBLK)
# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#endif
#if !defined(S_ISSOCK) && defined(S_IFSOCK)
# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
#endif
#if !defined(S_ISFIFO) && defined(S_IFIFO)
# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#endif
#if !defined(S_ISCHR) && defined(S_IFCHR)
# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#endif
/* Note: Some systems need both string.h and strings.h (Savage). However,
* some systems can't handle both, only use string.h in that case. */
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#if defined(HAVE_STRINGS_H) && !defined(NO_STRINGS_WITH_STRING_H)
# include <strings.h>
#endif
#if defined(HAVE_SETJMP_H)
# include <setjmp.h>
# ifdef HAVE_SIGSETJMP
# define JMP_BUF sigjmp_buf
# define SETJMP(x) sigsetjmp((x), 1)
# define LONGJMP siglongjmp
# else
# define JMP_BUF jmp_buf
# define SETJMP(x) setjmp(x)
# define LONGJMP longjmp
# endif
#endif
#define HAVE_DUP /* have dup() */
#define HAVE_ST_MODE /* have stat.st_mode */
/* We have three kinds of ACL support. */
#define HAVE_ACL (HAVE_POSIX_ACL || HAVE_SOLARIS_ACL || HAVE_AIX_ACL)

122
src/os_unixx.h Normal file
View File

@ -0,0 +1,122 @@
/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved 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.
*/
/*
* os_unixx.h -- include files that are only used in os_unix.c
*/
/*
* Stuff for signals
*/
#if defined(HAVE_SIGSET) && !defined(signal)
# define signal sigset
#endif
/* sun's sys/ioctl.h redefines symbols from termio world */
#if defined(HAVE_SYS_IOCTL_H) && !defined(sun)
# include <sys/ioctl.h>
#endif
#ifndef USE_SYSTEM /* use fork/exec to start the shell */
# if defined(HAVE_SYS_WAIT_H) || defined(HAVE_UNION_WAIT)
# include <sys/wait.h>
# endif
# ifndef WEXITSTATUS
# ifdef HAVE_UNION_WAIT
# define WEXITSTATUS(stat_val) ((stat_val).w_T.w_Retcode)
# else
# define WEXITSTATUS(stat_val) (((stat_val) >> 8) & 0377)
# endif
# endif
# ifndef WIFEXITED
# ifdef HAVE_UNION_WAIT
# define WIFEXITED(stat_val) ((stat_val).w_T.w_Termsig == 0)
# else
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
# endif
# endif
#endif /* !USE_SYSTEM */
#ifdef HAVE_STROPTS_H
#ifdef sinix
#define buf_T __system_buf_t__
#endif
# include <stropts.h>
#ifdef sinix
#undef buf_T
#endif
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_SYS_STREAM_H
# include <sys/stream.h>
#endif
#ifdef HAVE_SYS_UTSNAME_H
# include <sys/utsname.h>
#endif
#ifdef HAVE_SYS_SYSTEMINFO_H
/*
* foolish Sinix <sys/systeminfo.h> uses SYS_NMLN but doesn't include
* <limits.h>, where it is defined. Perhaps other systems have the same
* problem? Include it here. -- Slootman
*/
# if defined(HAVE_LIMITS_H) && !defined(_LIMITS_H)
# include <limits.h> /* for SYS_NMLN (Sinix 5.41 / Unix SysV.4) */
# endif
/* Define SYS_NMLN ourselves if it still isn't defined (for CrayT3E). */
# ifndef SYS_NMLN
# define SYS_NMLN 32
# endif
# include <sys/systeminfo.h> /* for sysinfo */
#endif
/*
* We use termios.h if both termios.h and termio.h are available.
* Termios is supposed to be a superset of termio.h. Don't include them both,
* it may give problems on some systems (e.g. hpux).
* I don't understand why we don't want termios.h for apollo.
*/
#if defined(HAVE_TERMIOS_H) && !defined(apollo)
# include <termios.h>
#else
# ifdef HAVE_TERMIO_H
# include <termio.h>
# else
# ifdef HAVE_SGTTY_H
# include <sgtty.h>
# endif
# endif
#endif
#ifdef HAVE_SYS_PTEM_H
# include <sys/ptem.h> /* must be after termios.h for Sinix */
# ifndef _IO_PTEM_H /* For UnixWare that should check for _IO_PT_PTEM_H */
# define _IO_PTEM_H
# endif
#endif
/* shared library access */
#if defined(HAVE_DLFCN_H) && defined(USE_DLOPEN)
# ifdef __MVS__
/* needed to define RTLD_LAZY (Anthony Giorgio) */
# define __SUSV3
# endif
# include <dlfcn.h>
#else
#endif

292
src/po/Makefile Normal file
View File

@ -0,0 +1,292 @@
# Makefile for the Vim message translations.
# TODO make this configurable
# Note: ja.sjis, *.cp1250 and zh_CN.cp936 are only for MS-Windows, they are
# not installed on Unix
LANGUAGES = \
af \
ca \
cs \
de \
en_GB \
eo \
es \
fi \
fr \
ga \
it \
ja \
ko \
ko.UTF-8 \
nb \
nl \
no \
pl \
pt_BR \
ru \
sk \
sv \
uk \
vi \
zh_CN \
zh_CN.UTF-8 \
zh_TW \
zh_TW.UTF-8
CONVERTED = \
cs.cp1250 \
ja.sjis \
ja.euc-jp \
pl.cp1250 \
pl.UTF-8 \
ru.cp1251 \
sk.cp1250 \
uk.cp1251 \
zh_CN.cp936
MOFILES = \
af.mo \
ca.mo \
cs.mo \
de.mo \
en_GB.mo \
eo.mo \
es.mo \
fi.mo \
fr.mo \
ga.mo \
it.mo \
ja.mo \
ko.mo \
ko.UTF-8.mo \
nb.mo \
nl.mo \
no.mo \
pl.mo \
pt_BR.mo \
ru.mo \
sk.mo \
sv.mo \
uk.mo \
vi.mo \
zh_CN.UTF-8.mo \
zh_CN.mo \
zh_TW.UTF-8.mo \
zh_TW.mo
MOCONVERTED = \
cs.cp1250.mo \
ja.sjis.mo \
ja.euc-jp.mo \
pl.cp1250.mo \
pl.UTF-8.mo \
ru.cp1251.mo \
sk.cp1250.mo \
uk.cp1251.mo \
zh_CN.cp936.mo
CHECKFILES = \
af.ck \
ca.ck \
cs.ck \
de.ck \
en_GB.ck \
eo.ck \
es.ck \
fi.ck \
fr.ck \
ga.ck \
it.ck \
ja.ck \
ko.ck \
ko.UTF-8.ck \
nb.ck \
nl.ck \
no.ck \
pl.ck \
pt_BR.ck \
ru.ck \
sk.ck \
sv.ck \
uk.ck \
vi.ck \
zh_CN.UTF-8.ck \
zh_CN.ck \
zh_TW.UTF-8.ck \
zh_TW.ck \
cs.cp1250.ck \
ja.sjis.ck \
ja.euc-jp.ck \
pl.cp1250.ck \
pl.UTF-8.ck \
ru.cp1251.ck \
sk.cp1250.ck \
uk.cp1251.ck \
zh_CN.cp936.ck
PACKAGE = vim
SHELL = /bin/sh
VIM = ../../build/src/vim
# The OLD_PO_FILE_INPUT and OLD_PO_FILE_OUTPUT are for the new GNU gettext
# tools 0.10.37, which use a slightly different .po file format that is not
# compatible with Solaris (and old gettext implementations) unless these are
# set. gettext 0.10.36 will not work!
MSGFMT = OLD_PO_FILE_INPUT=yes msgfmt -v
XGETTEXT = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes xgettext
MSGMERGE = OLD_PO_FILE_INPUT=yes OLD_PO_FILE_OUTPUT=yes msgmerge
.SUFFIXES:
.SUFFIXES: .po .mo .pot .ck
.PHONY: all install uninstall prefixcheck converted check clean checkclean distclean update-po $(LANGUAGES) $(CONVERTED)
.po.mo:
$(MSGFMT) -o $@ $<
.po.ck:
$(VIM) -u NONE -e -X -S check.vim -c "if error == 0 | q | endif" -c cq $<
touch $@
all: $(MOFILES) $(MOCONVERTED)
check: $(CHECKFILES)
install: $(MOFILES) $(MOCONVERTED)
@$(MAKE) prefixcheck
for lang in $(LANGUAGES) $(CONVERTED); do \
dir=$(LOCALEDIR)/$$lang/; \
if test ! -x "$$dir"; then \
mkdir $$dir; chmod 755 $$dir; \
fi; \
dir=$(LOCALEDIR)/$$lang/LC_MESSAGES; \
if test ! -x "$$dir"; then \
mkdir $$dir; chmod 755 $$dir; \
fi; \
if test -r $$lang.mo; then \
$(INSTALL_DATA) $$lang.mo $$dir/$(PACKAGE).mo; \
chmod $(FILEMOD) $$dir/$(PACKAGE).mo; \
fi; \
done
uninstall:
@$(MAKE) prefixcheck
for cat in $(MOFILES) $(MOCONVERTED); do \
cat=`basename $$cat`; \
lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
rm -f $(LOCALEDIR)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
done
converted: $(MOCONVERTED)
# nl.po was added later, if it does not exist use a file with just a # in it
# (an empty file doesn't work with old msgfmt).
nl.po:
@( echo \# > nl.po )
# Norwegian/Bokmal: "nb" is an alias for "no".
# Copying the file is not efficient, but I don't know of another way to make
# this work.
nb.po: no.po
cp no.po nb.po
# Convert ja.po to create ja.sjis.po. Requires doubling backslashes in the
# second byte. Don't depend on sjiscorr, it should only be compiled when
# ja.sjis.po is outdated.
ja.sjis.po: ja.po
@$(MAKE) sjiscorr
rm -f ja.sjis.po
iconv -f utf-8 -t cp932 ja.po | ./sjiscorr > ja.sjis.po
sjiscorr: sjiscorr.c
$(CC) -o sjiscorr sjiscorr.c
ja.euc-jp.po: ja.po
iconv -f utf-8 -t euc-jp ja.po | \
sed -e 's/charset=utf-8/charset=euc-jp/' -e 's/# Original translations/# Generated from ja.po, DO NOT EDIT/' > ja.euc-jp.po
# Convert cs.po to create cs.cp1250.po.
cs.cp1250.po: cs.po
rm -f cs.cp1250.po
iconv -f iso-8859-2 -t cp1250 cs.po | \
sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from cs.po, DO NOT EDIT/' > cs.cp1250.po
# Convert pl.po to create pl.cp1250.po.
pl.cp1250.po: pl.po
rm -f pl.cp1250.po
iconv -f iso-8859-2 -t cp1250 pl.po | \
sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.cp1250.po
# Convert pl.po to create pl.UTF-8.po.
pl.UTF-8.po: pl.po
rm -f pl.UTF-8.po
iconv -f iso-8859-2 -t utf-8 pl.po | \
sed -e 's/charset=ISO-8859-2/charset=utf-8/' -e 's/# Original translations/# Generated from pl.po, DO NOT EDIT/' > pl.UTF-8.po
# Convert sk.po to create sk.cp1250.po.
sk.cp1250.po: sk.po
rm -f sk.cp1250.po
iconv -f iso-8859-2 -t cp1250 sk.po | \
sed -e 's/charset=ISO-8859-2/charset=cp1250/' -e 's/# Original translations/# Generated from sk.po, DO NOT EDIT/' > sk.cp1250.po
# Convert zh_CN.po to create zh_CN.cp936.po.
# set 'charset' to gbk to avoid that msfmt generates a warning
zh_CN.cp936.po: zh_CN.po
rm -f zh_CN.cp936.po
iconv -f gb2312 -t cp936 zh_CN.po | \
sed -e 's/charset=gb2312/charset=gbk/' -e 's/# Original translations/# Generated from zh_CN.po, DO NOT EDIT/' > zh_CN.cp936.po
# Convert ko.UTF-8.po to create ko.po.
ko.po: ko.UTF-8.po
rm -f ko.po
iconv -f UTF-8 -t euc-kr ko.UTF-8.po | \
sed -e 's/charset=UTF-8/charset=euc-kr/' \
-e 's/# Korean translation for Vim/# Generated from ko.UTF-8.po, DO NOT EDIT/' \
> ko.po
# Convert ru.po to create ru.cp1251.po.
ru.cp1251.po: ru.po
rm -f ru.cp1251.po
iconv -f utf-8 -t cp1251 ru.po | \
sed -e 's/charset=utf-8/charset=cp1251/' -e 's/# Original translations/# Generated from ru.po, DO NOT EDIT/' > ru.cp1251.po
# Convert uk.po to create uk.cp1251.po.
uk.cp1251.po: uk.po
rm -f uk.cp1251.po
iconv -f utf-8 -t cp1251 uk.po | \
sed -e 's/charset=utf-8/charset=cp1251/' -e 's/# Original translations/# Generated from uk.po, DO NOT EDIT/' > uk.cp1251.po
prefixcheck:
@if test "x" = "x$(prefix)"; then \
echo "******************************************"; \
echo " please use make from the src directory "; \
echo "******************************************"; \
exit 1; \
fi
clean: checkclean
rm -f core core.* *.old.po *.mo *.pot sjiscorr
distclean: clean
checkclean:
rm -f *.ck
$(PACKAGE).pot: ../*.c ../if_perl.xs ../GvimExt/gvimext.cpp ../globals.h ../if_py_both.h
cd ..; $(XGETTEXT) --default-domain=$(PACKAGE) \
--add-comments --keyword=_ --keyword=N_ \
*.c if_perl.xs GvimExt/gvimext.cpp globals.h if_py_both.h
mv -f ../$(PACKAGE).po $(PACKAGE).pot
update-po: $(LANGUAGES)
# Don't add a dependency here, we only want to update the .po files manually
$(LANGUAGES):
@$(MAKE) $(PACKAGE).pot
if test ! -f $@.po.orig; then cp $@.po $@.po.orig; fi
mv $@.po $@.po.old
if $(MSGMERGE) $@.po.old $(PACKAGE).pot -o $@.po; then \
rm -f $@.po.old; \
else \
echo "msgmerge for $@.po failed!"; mv $@.po.old $@.po; \
fi

5393
src/po/af.po Normal file

File diff suppressed because it is too large Load Diff

6201
src/po/ca.po Normal file

File diff suppressed because it is too large Load Diff

88
src/po/check.vim Normal file
View File

@ -0,0 +1,88 @@
" Vim script for checking .po files.
"
" Go through the file and verify that:
" - All %...s items in "msgid" are identical to the ones in "msgstr".
" - An error or warning code in "msgid" matches the one in "msgstr".
if 1 " Only execute this if the eval feature is available.
" Function to get a split line at the cursor.
" Used for both msgid and msgstr lines.
" Removes all text except % items and returns the result.
func! GetMline()
let idline = substitute(getline('.'), '"\(.*\)"$', '\1', '')
while line('.') < line('$')
+
let line = getline('.')
if line[0] != '"'
break
endif
let idline .= substitute(line, '"\(.*\)"$', '\1', '')
endwhile
" remove '%', not used for formatting.
let idline = substitute(idline, "'%'", '', 'g')
" remove '%' used for plural forms.
let idline = substitute(idline, '\\nPlural-Forms: .\+;\\n', '', '')
" remove everything but % items.
return substitute(idline, '[^%]*\(%[-+ #''.0-9*]*l\=[dsuxXpoc%]\)\=', '\1', 'g')
endfunc
" This only works when 'wrapscan' is set.
let s:save_wrapscan = &wrapscan
set wrapscan
" Start at the first "msgid" line.
1
/^msgid
let startline = line('.')
let error = 0
while 1
if getline(line('.') - 1) !~ "no-c-format"
let fromline = GetMline()
if getline('.') !~ '^msgstr'
echo 'Missing "msgstr" in line ' . line('.')
let error = 1
endif
let toline = GetMline()
if fromline != toline
echo 'Mismatching % in line ' . (line('.') - 1)
echo 'msgid: ' . fromline
echo 'msgstr: ' . toline
let error = 1
endif
endif
" Find next msgid.
" Wrap around at the end of the file, quit when back at the first one.
/^msgid
if line('.') == startline
break
endif
endwhile
" Check that error code in msgid matches the one in msgstr.
"
" Examples of mismatches found with msgid "E123: ..."
" - msgstr "E321: ..." error code mismatch
" - msgstr "W123: ..." warning instead of error
" - msgstr "E123 ..." missing colon
" - msgstr "..." missing error code
"
1
if search('msgid "\("\n"\)\?\([EW][0-9]\+:\).*\nmsgstr "\("\n"\)\?[^"]\@=\2\@!') > 0
echo 'Mismatching error/warning code in line ' . line('.')
let error = 1
endif
if error == 0
echo "OK"
endif
let &wrapscan = s:save_wrapscan
unlet s:save_wrapscan
endif

19
src/po/cleanup.vim Normal file
View File

@ -0,0 +1,19 @@
" Vim script to cleanup a .po file:
" - Remove line numbers (avoids that diffs are messy).
" - Comment-out fuzzy and empty messages.
" - Make sure there is a space before the string (required for Solaris).
" Requires Vim 6.0 or later (because of multi-line search patterns).
" Disable diff mode, because it makes this very slow
let s:was_diff = &diff
setl nodiff
silent g/^#: /d
silent g/^#, fuzzy\(, .*\)\=\nmsgid ""\@!/.+1,/^$/-1s/^/#\~ /
silent g/^msgstr"/s//msgstr "/
silent g/^msgid"/s//msgid "/
silent g/^msgstr ""\(\n"\)\@!/?^msgid?,.s/^/#\~ /
if s:was_diff
setl diff
endif

4664
src/po/cs.cp1250.po Normal file

File diff suppressed because it is too large Load Diff

4664
src/po/cs.po Normal file

File diff suppressed because it is too large Load Diff

6117
src/po/de.po Normal file

File diff suppressed because it is too large Load Diff

290
src/po/en_GB.po Normal file
View File

@ -0,0 +1,290 @@
# UK English Translation for Vim vim:set foldmethod=marker:
#
# Do ":help uganda" in Vim to read copying and usage conditions.
# Do ":help credits" in Vim to see a list of people who contributed.
#
# FIRST AUTHOR Mike Williams <mrw@eandem.co.uk>, 2003.
#
# Style Guide:
# o English spelling!
# o -ise, not -ize.
# o No contractions.
# o Cannot, not can not.
# o Backward (no s) when used as an adjective.
# o TBC ...
#
msgid ""
msgstr ""
"Project-Id-Version: Vim(UK English)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-07-19 18:03+0100\n"
"PO-Revision-Date: 2003-02-25 11:05+0000\n"
"Last-Translator: Mike Williams <mrw@eandem.co.uk>\n"
"Language-Team: Mike Williams <mrw@eandem.co.uk>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ISO_8859-1\n"
"Content-Transfer-Encoding: 7bit\n"
#, c-format
msgid "E96: Can not diff more than %ld buffers"
msgstr "E96: Cannot diff more than %ld buffers"
msgid "E101: More than two buffers in diff mode, don't know which one to use"
msgstr "E101: More than two buffers in diff mode, do not know which one to use"
#, c-format
msgid "E102: Can't find buffer \"%s\""
msgstr "E102: Cannot find buffer \"%s\""
#, c-format
msgid "E738: Can't list variables for %s"
msgstr "E738: Cannot list variables for %s"
#, c-format
msgid "E138: Can't write viminfo file %s!"
msgstr "E138: Cannot write viminfo file %s!"
msgid ""
"# You may edit it if you're careful!\n"
"\n"
msgstr ""
"# You may edit it if you are careful!\n"
"\n"
msgid "E146: Regular expressions can't be delimited by letters"
msgstr "E146: Regular expressions cannot be delimited by letters"
msgid "E493: Backwards range given"
msgstr "E493: Backward range given"
msgid "Backwards range given, OK to swap"
msgstr "Backward range given, OK to swap"
#, c-format
msgid "E185: Cannot find color scheme %s"
msgstr "E185: Cannot find colour scheme %s"
msgid "Can't find temp file for conversion"
msgstr "Cannot find temp file for conversion"
msgid "can't read output of 'charconvert'"
msgstr "cannot read output of 'charconvert'"
msgid "E506: Can't write to backup file (add ! to override)"
msgstr "E506: Cannot write to backup file (add ! to override)"
msgid "E508: Can't read file for backup (add ! to override)"
msgstr "E508: Cannot read file for backup (add ! to override)"
msgid "E510: Can't make backup file (add ! to override)"
msgstr "E510: Cannot make backup file (add ! to override)"
msgid "E214: Can't find temp file for writing"
msgstr "E214: Cannot find temp file for writing"
msgid "E166: Can't open linked file for writing"
msgstr "E166: Cannot open linked file for writing"
msgid "E212: Can't open file for writing"
msgstr "E212: Cannot open file for writing"
msgid "E205: Patchmode: can't save original file"
msgstr "E205: Patchmode: cannot save original file"
msgid "E206: patchmode: can't touch empty original file"
msgstr "E206: patchmode: cannot touch empty original file"
msgid "E207: Can't delete backup file"
msgstr "E207: Cannot delete backup file"
msgid "don't quit the editor until the file is successfully written!"
msgstr "do not quit the editor until the file is successfully written!"
msgid "E217: Can't execute autocommands for ALL events"
msgstr "E217: Cannot execute autocommands for ALL events"
#, c-format
msgid "E482: Can't create file %s"
msgstr "E482: Cannot create file %s"
msgid "E483: Can't get temp file name"
msgstr "E483: Cannot get temp file name"
#, c-format
msgid "E484: Can't open file %s"
msgstr "E484: Cannot open file %s"
#, c-format
msgid "E485: Can't read file %s"
msgstr "E485: Cannot read file %s"
#, c-format
msgid "E40: Can't open errorfile %s"
msgstr "E40: Cannot open errorfile %s"
msgid "E255: Couldn't read in sign data!"
msgstr "E255: Could not read in sign data!"
#, c-format
msgid "E254: Cannot allocate color %s"
msgstr "E254: Cannot allocate colour %s"
#, c-format
msgid "E616: vim_SelFile: can't get font %s"
msgstr "E616: vim_SelFile: cannot get font %s"
msgid "E614: vim_SelFile: can't return to current directory"
msgstr "E614: vim_SelFile: cannot return to current directory"
msgid "E615: vim_SelFile: can't get current directory"
msgstr "E615: vim_SelFile: cannot get current directory"
msgid "Vim E458: Cannot allocate colormap entry, some colors may be incorrect"
msgstr ""
"Vim E458: Cannot allocate colourmap entry, some colours may be incorrect"
#, c-format
msgid "E624: Can't open file \"%s\""
msgstr "E624: Cannot open file \"%s\""
#, c-format
msgid "E457: Can't read PostScript resource file \"%s\""
msgstr "E457: Cannot read PostScript resource file \"%s\""
msgid "E324: Can't open PostScript output file"
msgstr "E324: Cannot open PostScript output file"
#, c-format
msgid "E456: Can't open file \"%s\""
msgstr "E456: Cannot open file \"%s\""
msgid "E456: Can't find PostScript resource file \"prolog.ps\""
msgstr "E456: Cannot find PostScript resource file \"prolog.ps\""
msgid "E456: Can't find PostScript resource file \"cidfont.ps\""
msgstr "E456: Cannot find PostScript resource file \"cidfont.ps\""
#, c-format
msgid "E456: Can't find PostScript resource file \"%s.ps\""
msgstr "E456: Cannot find PostScript resource file \"%s.ps\""
msgid "couldn't open buffer"
msgstr "could not open buffer"
msgid "can't delete OutputObject attributes"
msgstr "cannot delete OutputObject attributes"
msgid "--literal\t\tDon't expand wildcards"
msgstr "--literal\t\tDo not expand wildcards"
msgid "-f or --nofork\tForeground: Don't fork when starting GUI"
msgstr "-f or --nofork\tForeground: Do not fork when starting GUI"
msgid "-f\t\t\tDon't use newcli to open window"
msgstr "-f\t\t\tDo not use newcli to open window"
msgid "--noplugin\t\tDon't load plugin scripts"
msgstr "--noplugin\t\tDo not load plugin scripts"
msgid "--remote-silent <files> Same, don't complain if there is no server"
msgstr "--remote-silent <files> Same, do not complain if there is no server"
msgid ""
"--remote-wait-silent <files> Same, don't complain if there is no server"
msgstr ""
"--remote-wait-silent <files> Same, do not complain if there is no server"
msgid "-background <color>\tUse <color> for the background (also: -bg)"
msgstr "-background <colour>\tUse <colour> for the background (also: -bg)"
msgid "-foreground <color>\tUse <color> for normal text (also: -fg)"
msgstr "-foreground <colour>\tUse <colour> for normal text (also: -fg)"
msgid "+reverse\t\tDon't use reverse video (also: +rv)"
msgstr "+reverse\t\tDo not use reverse video (also: +rv)"
msgid "E288: input method doesn't support any style"
msgstr "E288: input method does not support any style"
msgid "E289: input method doesn't support my preedit type"
msgstr "E289: input method does not support my preedit type"
msgid "E298: Didn't get block nr 0?"
msgstr "E298: Did not get block nr 0?"
msgid "E298: Didn't get block nr 1?"
msgstr "E298: Did not get block nr 1?"
msgid "E298: Didn't get block nr 2?"
msgstr "E298: Did not get block nr 2?"
msgid "E304: ml_upd_block0(): Didn't get block 0??"
msgstr "E304: ml_upd_block0(): Did not get block 0??"
msgid "Messages maintainer: Bram Moolenaar <Bram@vim.org>"
msgstr "Messages maintainer: Mike Williams <mrw@eandem.co.uk>"
msgid "Keys don't match!"
msgstr "Keys do not match!"
#, c-format
msgid "E344: Can't find directory \"%s\" in cdpath"
msgstr "E344: Cannot find directory \"%s\" in cdpath"
#, c-format
msgid "E345: Can't find file \"%s\" in path"
msgstr "E345: Cannot find file \"%s\" in path"
msgid "E597: can't select fontset"
msgstr "E597: cannot select fontset"
msgid "E533: can't select wide font"
msgstr "E533: cannot select wide font"
msgid "VIM: Can't open window!\n"
msgstr "VIM: Cannot open window!\n"
msgid "E388: Couldn't find definition"
msgstr "E388: Could not find definition"
msgid "E389: Couldn't find pattern"
msgstr "E389: Could not find pattern"
#, c-format
msgid "Unrecognized or duplicate item in %s line %d: %s"
msgstr "Unrecognised or duplicate item in %s line %d: %s"
#, c-format
msgid "Unrecognized flags in %s line %d: %s"
msgstr "Unrecognised flags in %s line %d: %s"
#, c-format
msgid "E781: .sug file doesn't match .spl file: %s"
msgstr "E781: .sug file does not match .spl file: %s"
#, c-format
msgid "E394: Didn't find region item for %s"
msgstr "E394: Did not find region item for %s"
msgid "E419: FG color unknown"
msgstr "E419: FG colour unknown"
msgid "E420: BG color unknown"
msgstr "E420: BG colour unknown"
#, c-format
msgid "E421: Color name or number not recognized: %s"
msgstr "E421: Colour name or number not recognised: %s"
msgid "E434: Can't find tag pattern"
msgstr "E434: Cannot find tag pattern"
msgid "E435: Couldn't find tag, just guessing!"
msgstr "E435: Could not find tag, just guessing!"
msgid "E442: Can't split topleft and botright at the same time"
msgstr "E442: Cannot split topleft and botright at the same time"
#, c-format
msgid "E447: Can't find file \"%s\" in path"
msgstr "E447: Cannot find file \"%s\" in path"

6825
src/po/eo.po Normal file

File diff suppressed because it is too large Load Diff

8279
src/po/es.po Normal file

File diff suppressed because it is too large Load Diff

6526
src/po/fi.po Normal file

File diff suppressed because it is too large Load Diff

7091
src/po/fr.po Normal file

File diff suppressed because it is too large Load Diff

6503
src/po/ga.po Normal file

File diff suppressed because it is too large Load Diff

6803
src/po/it.po Normal file

File diff suppressed because it is too large Load Diff

6808
src/po/ja.euc-jp.po Normal file

File diff suppressed because it is too large Load Diff

6808
src/po/ja.po Normal file

File diff suppressed because it is too large Load Diff

6808
src/po/ja.sjis.po Normal file

File diff suppressed because it is too large Load Diff

6447
src/po/ko.UTF-8.po Normal file

File diff suppressed because it is too large Load Diff

6447
src/po/ko.po Normal file

File diff suppressed because it is too large Load Diff

6166
src/po/nb.po Normal file

File diff suppressed because it is too large Load Diff

5852
src/po/nl.po Normal file

File diff suppressed because it is too large Load Diff

6166
src/po/no.po Normal file

File diff suppressed because it is too large Load Diff

6904
src/po/pl.UTF-8.po Normal file

File diff suppressed because it is too large Load Diff

6904
src/po/pl.cp1250.po Normal file

File diff suppressed because it is too large Load Diff

6904
src/po/pl.po Normal file

File diff suppressed because it is too large Load Diff

6236
src/po/pt_BR.po Normal file

File diff suppressed because it is too large Load Diff

6893
src/po/ru.cp1251.po Normal file

File diff suppressed because it is too large Load Diff

6893
src/po/ru.po Normal file

File diff suppressed because it is too large Load Diff

50
src/po/sjiscorr.c Normal file
View File

@ -0,0 +1,50 @@
/*
* Simplistic program to correct SJIS inside strings. When a trail byte is a
* backslash it needs to be doubled.
* Public domain.
*/
#include <stdio.h>
#include <string.h>
int
main(argc, argv)
int argc;
char **argv;
{
char buffer[BUFSIZ];
char *p;
while (fgets(buffer, BUFSIZ, stdin) != NULL)
{
for (p = buffer; *p != 0; p++)
{
if (strncmp(p, "charset=utf-8", 13) == 0)
{
fputs("charset=cp932", stdout);
p += 12;
}
else if (strncmp(p, "ja.po - Japanese message file", 29) == 0)
{
fputs("ja.sjis.po - Japanese message file for Vim (version 6.x)\n", stdout);
fputs("# generated from ja.po, DO NOT EDIT", stdout);
while (p[1] != '\n')
++p;
}
else if (*(unsigned char *)p == 0x81 && p[1] == '_')
{
putchar('\\');
++p;
}
else
{
if (*p & 0x80)
{
putchar(*p++);
if (*p == '\\')
putchar(*p);
}
putchar(*p);
}
}
}
}

5821
src/po/sk.cp1250.po Normal file

File diff suppressed because it is too large Load Diff

5821
src/po/sk.po Normal file

File diff suppressed because it is too large Load Diff

6148
src/po/sv.po Normal file

File diff suppressed because it is too large Load Diff

7027
src/po/uk.cp1251.po Normal file

File diff suppressed because it is too large Load Diff

7027
src/po/uk.po Normal file

File diff suppressed because it is too large Load Diff

5196
src/po/vi.po Normal file

File diff suppressed because it is too large Load Diff

6139
src/po/zh_CN.UTF-8.po Normal file

File diff suppressed because it is too large Load Diff

6140
src/po/zh_CN.cp936.po Normal file

File diff suppressed because it is too large Load Diff

6140
src/po/zh_CN.po Normal file

File diff suppressed because it is too large Load Diff

5282
src/po/zh_TW.UTF-8.po Normal file

File diff suppressed because it is too large Load Diff

5275
src/po/zh_TW.po Normal file

File diff suppressed because it is too large Load Diff

617
src/popupmnu.c Normal file
View File

@ -0,0 +1,617 @@
/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved 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.
*/
/*
* popupmnu.c: Popup menu (PUM)
*/
#include "vim.h"
static pumitem_T *pum_array = NULL; /* items of displayed pum */
static int pum_size; /* nr of items in "pum_array" */
static int pum_selected; /* index of selected item or -1 */
static int pum_first = 0; /* index of top item */
static int pum_height; /* nr of displayed pum items */
static int pum_width; /* width of displayed pum items */
static int pum_base_width; /* width of pum items base */
static int pum_kind_width; /* width of pum items kind column */
static int pum_scrollbar; /* TRUE when scrollbar present */
static int pum_row; /* top row of pum */
static int pum_col; /* left column of pum */
static int pum_do_redraw = FALSE; /* do redraw anyway */
static int pum_set_selected __ARGS((int n, int repeat));
#define PUM_DEF_HEIGHT 10
#define PUM_DEF_WIDTH 15
/*
* Show the popup menu with items "array[size]".
* "array" must remain valid until pum_undisplay() is called!
* When possible the leftmost character is aligned with screen column "col".
* The menu appears above the screen line "row" or at "row" + "height" - 1.
*/
void pum_display(array, size, selected)
pumitem_T *array;
int size;
int selected; /* index of initially selected item, none if
out of range */
{
int w;
int def_width;
int max_width;
int kind_width;
int extra_width;
int i;
int top_clear;
int row;
int context_lines;
int col;
int above_row = cmdline_row;
int redo_count = 0;
redo:
def_width = PUM_DEF_WIDTH;
max_width = 0;
kind_width = 0;
extra_width = 0;
/* Pretend the pum is already there to avoid that must_redraw is set when
* 'cuc' is on. */
pum_array = (pumitem_T *)1;
validate_cursor_col();
pum_array = NULL;
row = curwin->w_wrow + W_WINROW(curwin);
if (firstwin->w_p_pvw)
top_clear = firstwin->w_height;
else
top_clear = 0;
/* When the preview window is at the bottom stop just above it. Also
* avoid drawing over the status line so that it's clear there is a window
* boundary. */
if (lastwin->w_p_pvw)
above_row -= lastwin->w_height + lastwin->w_status_height + 1;
/*
* Figure out the size and position of the pum.
*/
if (size < PUM_DEF_HEIGHT)
pum_height = size;
else
pum_height = PUM_DEF_HEIGHT;
if (p_ph > 0 && pum_height > p_ph)
pum_height = p_ph;
/* Put the pum below "row" if possible. If there are few lines decide on
* where there is more room. */
if (row + 2 >= above_row - pum_height
&& row > (above_row - top_clear) / 2) {
/* pum above "row" */
/* Leave two lines of context if possible */
if (curwin->w_wrow - curwin->w_cline_row >= 2)
context_lines = 2;
else
context_lines = curwin->w_wrow - curwin->w_cline_row;
if (row >= size + context_lines) {
pum_row = row - size - context_lines;
pum_height = size;
} else {
pum_row = 0;
pum_height = row - context_lines;
}
if (p_ph > 0 && pum_height > p_ph) {
pum_row += pum_height - p_ph;
pum_height = p_ph;
}
} else {
/* pum below "row" */
/* Leave two lines of context if possible */
if (curwin->w_cline_row + curwin->w_cline_height - curwin->w_wrow >= 3)
context_lines = 3;
else
context_lines = curwin->w_cline_row
+ curwin->w_cline_height - curwin->w_wrow;
pum_row = row + context_lines;
if (size > above_row - pum_row)
pum_height = above_row - pum_row;
else
pum_height = size;
if (p_ph > 0 && pum_height > p_ph)
pum_height = p_ph;
}
/* don't display when we only have room for one line */
if (pum_height < 1 || (pum_height == 1 && size > 1))
return;
/* If there is a preview window at the top avoid drawing over it. */
if (firstwin->w_p_pvw
&& pum_row < firstwin->w_height
&& pum_height > firstwin->w_height + 4) {
pum_row += firstwin->w_height;
pum_height -= firstwin->w_height;
}
/* Compute the width of the widest match and the widest extra. */
for (i = 0; i < size; ++i) {
w = vim_strsize(array[i].pum_text);
if (max_width < w)
max_width = w;
if (array[i].pum_kind != NULL) {
w = vim_strsize(array[i].pum_kind) + 1;
if (kind_width < w)
kind_width = w;
}
if (array[i].pum_extra != NULL) {
w = vim_strsize(array[i].pum_extra) + 1;
if (extra_width < w)
extra_width = w;
}
}
pum_base_width = max_width;
pum_kind_width = kind_width;
/* Calculate column */
if (curwin->w_p_rl)
col = W_WINCOL(curwin) + W_WIDTH(curwin) - curwin->w_wcol - 1;
else
col = W_WINCOL(curwin) + curwin->w_wcol;
/* if there are more items than room we need a scrollbar */
if (pum_height < size) {
pum_scrollbar = 1;
++max_width;
} else
pum_scrollbar = 0;
if (def_width < max_width)
def_width = max_width;
if (((col < Columns - PUM_DEF_WIDTH || col < Columns - max_width)
&& !curwin->w_p_rl)
|| (curwin->w_p_rl && (col > PUM_DEF_WIDTH || col > max_width)
)) {
/* align pum column with "col" */
pum_col = col;
if (curwin->w_p_rl)
pum_width = pum_col - pum_scrollbar + 1;
else
pum_width = Columns - pum_col - pum_scrollbar;
if (pum_width > max_width + kind_width + extra_width + 1
&& pum_width > PUM_DEF_WIDTH) {
pum_width = max_width + kind_width + extra_width + 1;
if (pum_width < PUM_DEF_WIDTH)
pum_width = PUM_DEF_WIDTH;
}
} else if (Columns < def_width) {
/* not enough room, will use what we have */
if (curwin->w_p_rl)
pum_col = Columns - 1;
else
pum_col = 0;
pum_width = Columns - 1;
} else {
if (max_width > PUM_DEF_WIDTH)
max_width = PUM_DEF_WIDTH; /* truncate */
if (curwin->w_p_rl)
pum_col = max_width - 1;
else
pum_col = Columns - max_width;
pum_width = max_width - pum_scrollbar;
}
pum_array = array;
pum_size = size;
/* Set selected item and redraw. If the window size changed need to redo
* the positioning. Limit this to two times, when there is not much
* room the window size will keep changing. */
if (pum_set_selected(selected, redo_count) && ++redo_count <= 2)
goto redo;
}
/*
* Redraw the popup menu, using "pum_first" and "pum_selected".
*/
void pum_redraw() {
int row = pum_row;
int col;
int attr_norm = highlight_attr[HLF_PNI];
int attr_select = highlight_attr[HLF_PSI];
int attr_scroll = highlight_attr[HLF_PSB];
int attr_thumb = highlight_attr[HLF_PST];
int attr;
int i;
int idx;
char_u *s;
char_u *p = NULL;
int totwidth, width, w;
int thumb_pos = 0;
int thumb_heigth = 1;
int round;
int n;
/* Never display more than we have */
if (pum_first > pum_size - pum_height)
pum_first = pum_size - pum_height;
if (pum_scrollbar) {
thumb_heigth = pum_height * pum_height / pum_size;
if (thumb_heigth == 0)
thumb_heigth = 1;
thumb_pos = (pum_first * (pum_height - thumb_heigth)
+ (pum_size - pum_height) / 2)
/ (pum_size - pum_height);
}
for (i = 0; i < pum_height; ++i) {
idx = i + pum_first;
attr = (idx == pum_selected) ? attr_select : attr_norm;
/* prepend a space if there is room */
if (curwin->w_p_rl) {
if (pum_col < W_WINCOL(curwin) + W_WIDTH(curwin) - 1)
screen_putchar(' ', row, pum_col + 1, attr);
} else if (pum_col > 0)
screen_putchar(' ', row, pum_col - 1, attr);
/* Display each entry, use two spaces for a Tab.
* Do this 3 times: For the main text, kind and extra info */
col = pum_col;
totwidth = 0;
for (round = 1; round <= 3; ++round) {
width = 0;
s = NULL;
switch (round) {
case 1: p = pum_array[idx].pum_text; break;
case 2: p = pum_array[idx].pum_kind; break;
case 3: p = pum_array[idx].pum_extra; break;
}
if (p != NULL)
for (;; mb_ptr_adv(p)) {
if (s == NULL)
s = p;
w = ptr2cells(p);
if (*p == NUL || *p == TAB || totwidth + w > pum_width) {
/* Display the text that fits or comes before a Tab.
* First convert it to printable characters. */
char_u *st;
int saved = *p;
*p = NUL;
st = transstr(s);
*p = saved;
if (curwin->w_p_rl) {
if (st != NULL) {
char_u *rt = reverse_text(st);
if (rt != NULL) {
char_u *rt_start = rt;
int size;
size = vim_strsize(rt);
if (size > pum_width) {
do {
size -= has_mbyte
? (*mb_ptr2cells)(rt) : 1;
mb_ptr_adv(rt);
} while (size > pum_width);
if (size < pum_width) {
/* Most left character requires
* 2-cells but only 1 cell is
* available on screen. Put a
* '<' on the left of the pum
* item */
*(--rt) = '<';
size++;
}
}
screen_puts_len(rt, (int)STRLEN(rt),
row, col - size + 1, attr);
vim_free(rt_start);
}
vim_free(st);
}
col -= width;
} else {
if (st != NULL) {
screen_puts_len(st, (int)STRLEN(st), row, col,
attr);
vim_free(st);
}
col += width;
}
if (*p != TAB)
break;
/* Display two spaces for a Tab. */
if (curwin->w_p_rl) {
screen_puts_len((char_u *)" ", 2, row, col - 1,
attr);
col -= 2;
} else {
screen_puts_len((char_u *)" ", 2, row, col, attr);
col += 2;
}
totwidth += 2;
s = NULL; /* start text at next char */
width = 0;
} else
width += w;
}
if (round > 1)
n = pum_kind_width + 1;
else
n = 1;
/* Stop when there is nothing more to display. */
if (round == 3
|| (round == 2 && pum_array[idx].pum_extra == NULL)
|| (round == 1 && pum_array[idx].pum_kind == NULL
&& pum_array[idx].pum_extra == NULL)
|| pum_base_width + n >= pum_width)
break;
if (curwin->w_p_rl) {
screen_fill(row, row + 1, pum_col - pum_base_width - n + 1,
col + 1, ' ', ' ', attr);
col = pum_col - pum_base_width - n + 1;
} else {
screen_fill(row, row + 1, col, pum_col + pum_base_width + n,
' ', ' ', attr);
col = pum_col + pum_base_width + n;
}
totwidth = pum_base_width + n;
}
if (curwin->w_p_rl)
screen_fill(row, row + 1, pum_col - pum_width + 1, col + 1, ' ',
' ', attr);
else
screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ',
attr);
if (pum_scrollbar > 0) {
if (curwin->w_p_rl)
screen_putchar(' ', row, pum_col - pum_width,
i >= thumb_pos && i < thumb_pos + thumb_heigth
? attr_thumb : attr_scroll);
else
screen_putchar(' ', row, pum_col + pum_width,
i >= thumb_pos && i < thumb_pos + thumb_heigth
? attr_thumb : attr_scroll);
}
++row;
}
}
/*
* Set the index of the currently selected item. The menu will scroll when
* necessary. When "n" is out of range don't scroll.
* This may be repeated when the preview window is used:
* "repeat" == 0: open preview window normally
* "repeat" == 1: open preview window but don't set the size
* "repeat" == 2: don't open preview window
* Returns TRUE when the window was resized and the location of the popup menu
* must be recomputed.
*/
static int pum_set_selected(n, repeat)
int n;
int repeat;
{
int resized = FALSE;
int context = pum_height / 2;
pum_selected = n;
if (pum_selected >= 0 && pum_selected < pum_size) {
if (pum_first > pum_selected - 4) {
/* scroll down; when we did a jump it's probably a PageUp then
* scroll a whole page */
if (pum_first > pum_selected - 2) {
pum_first -= pum_height - 2;
if (pum_first < 0)
pum_first = 0;
else if (pum_first > pum_selected)
pum_first = pum_selected;
} else
pum_first = pum_selected;
} else if (pum_first < pum_selected - pum_height + 5) {
/* scroll up; when we did a jump it's probably a PageDown then
* scroll a whole page */
if (pum_first < pum_selected - pum_height + 1 + 2) {
pum_first += pum_height - 2;
if (pum_first < pum_selected - pum_height + 1)
pum_first = pum_selected - pum_height + 1;
} else
pum_first = pum_selected - pum_height + 1;
}
/* Give a few lines of context when possible. */
if (context > 3)
context = 3;
if (pum_height > 2) {
if (pum_first > pum_selected - context) {
/* scroll down */
pum_first = pum_selected - context;
if (pum_first < 0)
pum_first = 0;
} else if (pum_first < pum_selected + context - pum_height + 1) {
/* scroll up */
pum_first = pum_selected + context - pum_height + 1;
}
}
/*
* Show extra info in the preview window if there is something and
* 'completeopt' contains "preview".
* Skip this when tried twice already.
* Skip this also when there is not much room.
* NOTE: Be very careful not to sync undo!
*/
if (pum_array[pum_selected].pum_info != NULL
&& Rows > 10
&& repeat <= 1
&& vim_strchr(p_cot, 'p') != NULL) {
win_T *curwin_save = curwin;
int res = OK;
/* Open a preview window. 3 lines by default. Prefer
* 'previewheight' if set and smaller. */
g_do_tagpreview = 3;
if (p_pvh > 0 && p_pvh < g_do_tagpreview)
g_do_tagpreview = p_pvh;
resized = prepare_tagpreview(FALSE);
g_do_tagpreview = 0;
if (curwin->w_p_pvw) {
if (curbuf->b_fname == NULL
&& curbuf->b_p_bt[0] == 'n' && curbuf->b_p_bt[2] == 'f'
&& curbuf->b_p_bh[0] == 'w') {
/* Already a "wipeout" buffer, make it empty. */
while (!bufempty())
ml_delete((linenr_T)1, FALSE);
} else {
/* Don't want to sync undo in the current buffer. */
++no_u_sync;
res = do_ecmd(0, NULL, NULL, NULL, ECMD_ONE, 0, NULL);
--no_u_sync;
if (res == OK) {
/* Edit a new, empty buffer. Set options for a "wipeout"
* buffer. */
set_option_value((char_u *)"swf", 0L, NULL, OPT_LOCAL);
set_option_value((char_u *)"bt", 0L,
(char_u *)"nofile", OPT_LOCAL);
set_option_value((char_u *)"bh", 0L,
(char_u *)"wipe", OPT_LOCAL);
set_option_value((char_u *)"diff", 0L,
NULL, OPT_LOCAL);
}
}
if (res == OK) {
char_u *p, *e;
linenr_T lnum = 0;
for (p = pum_array[pum_selected].pum_info; *p != NUL; ) {
e = vim_strchr(p, '\n');
if (e == NULL) {
ml_append(lnum++, p, 0, FALSE);
break;
} else {
*e = NUL;
ml_append(lnum++, p, (int)(e - p + 1), FALSE);
*e = '\n';
p = e + 1;
}
}
/* Increase the height of the preview window to show the
* text, but no more than 'previewheight' lines. */
if (repeat == 0) {
if (lnum > p_pvh)
lnum = p_pvh;
if (curwin->w_height < lnum) {
win_setheight((int)lnum);
resized = TRUE;
}
}
curbuf->b_changed = 0;
curbuf->b_p_ma = FALSE;
curwin->w_cursor.lnum = 1;
curwin->w_cursor.col = 0;
if (curwin != curwin_save && win_valid(curwin_save)) {
/* Return cursor to where we were */
validate_cursor();
redraw_later(SOME_VALID);
/* When the preview window was resized we need to
* update the view on the buffer. Only go back to
* the window when needed, otherwise it will always be
* redraw. */
if (resized) {
win_enter(curwin_save, TRUE);
update_topline();
}
/* Update the screen before drawing the popup menu.
* Enable updating the status lines. */
pum_do_redraw = TRUE;
update_screen(0);
pum_do_redraw = FALSE;
if (!resized && win_valid(curwin_save))
win_enter(curwin_save, TRUE);
/* May need to update the screen again when there are
* autocommands involved. */
pum_do_redraw = TRUE;
update_screen(0);
pum_do_redraw = FALSE;
}
}
}
}
}
if (!resized)
pum_redraw();
return resized;
}
/*
* Undisplay the popup menu (later).
*/
void pum_undisplay() {
pum_array = NULL;
redraw_all_later(SOME_VALID);
redraw_tabline = TRUE;
status_redraw_all();
}
/*
* Clear the popup menu. Currently only resets the offset to the first
* displayed item.
*/
void pum_clear() {
pum_first = 0;
}
/*
* Return TRUE if the popup menu is displayed.
* Overruled when "pum_do_redraw" is set, used to redraw the status lines.
*/
int pum_visible() {
return !pum_do_redraw && pum_array != NULL;
}
/*
* Return the height of the popup menu, the number of entries visible.
* Only valid when pum_visible() returns TRUE!
*/
int pum_get_height() {
return pum_height;
}

137
src/proto.h Normal file
View File

@ -0,0 +1,137 @@
/* vi:set ts=8 sts=4 sw=4:
*
* VIM - Vi IMproved 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.
*/
/*
* proto.h: include the (automatically generated) function prototypes
*/
/*
* Don't include these while generating prototypes. Prevents problems when
* files are missing.
*/
#if !defined(PROTO) && !defined(NOPROTO)
/*
* Machine-dependent routines.
*/
/* avoid errors in function prototypes */
# define Display int
# define Widget int
# define GdkEvent int
# define GdkEventKey int
# define XImage int
# if defined(UNIX) || defined(__EMX__) || defined(VMS)
# include "os_unix.pro"
# endif
# include "blowfish.pro"
# include "buffer.pro"
# include "charset.pro"
# include "if_cscope.pro"
# include "diff.pro"
# include "digraph.pro"
# include "edit.pro"
# include "eval.pro"
# include "ex_cmds.pro"
# include "ex_cmds2.pro"
# include "ex_docmd.pro"
# include "ex_eval.pro"
# include "ex_getln.pro"
# include "fileio.pro"
# include "fold.pro"
# include "getchar.pro"
# include "hangulin.pro"
# include "hardcopy.pro"
# include "hashtab.pro"
# include "main.pro"
# include "mark.pro"
# include "memfile.pro"
# include "memline.pro"
# include "menu.pro"
# if !defined MESSAGE_FILE || defined(HAVE_STDARG_H)
/* These prototypes cannot be produced automatically and conflict with
* the old-style prototypes in message.c. */
int
smsg __ARGS((char_u *, ...));
int
smsg_attr __ARGS((int, char_u *, ...));
int
vim_snprintf_add __ARGS((char *, size_t, char *, ...));
int
vim_snprintf __ARGS((char *, size_t, char *, ...));
# if defined(HAVE_STDARG_H)
int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs);
# endif
# endif
# include "message.pro"
# include "misc1.pro"
# include "misc2.pro"
#ifndef HAVE_STRPBRK /* not generated automatically from misc2.c */
char_u *vim_strpbrk __ARGS((char_u *s, char_u *charset));
#endif
#ifndef HAVE_QSORT
/* Use our own qsort(), don't define the prototype when not used. */
void qsort __ARGS((void *base, size_t elm_count, size_t elm_size, int (*cmp)(
const void *, const void *)));
#endif
# include "move.pro"
# if defined(FEAT_MBYTE) || defined(FEAT_XIM) || defined(FEAT_KEYMAP) \
|| defined(FEAT_POSTSCRIPT)
# include "mbyte.pro"
# endif
# include "normal.pro"
# include "ops.pro"
# include "option.pro"
# include "popupmnu.pro"
# include "quickfix.pro"
# include "regexp.pro"
# include "screen.pro"
# include "sha256.pro"
# include "search.pro"
# include "spell.pro"
# include "syntax.pro"
# include "tag.pro"
# include "term.pro"
# include "ui.pro"
# include "undo.pro"
# include "version.pro"
# include "window.pro"
/* Ugly solution for "BalloonEval" not being defined while it's used in some
* .pro files. */
# define BalloonEval int
# ifdef FEAT_OLE
# endif
/*
* The perl include files pollute the namespace, therefore proto.h must be
* included before the perl include files. But then CV is not defined, which
* not included here for the perl files. Use a dummy define for CV for the
* other files.
*/
#ifdef MACOS_CONVERT
#endif
#endif /* !PROTO && !NOPROTO */

10
src/proto/blowfish.pro Normal file
View File

@ -0,0 +1,10 @@
/* blowfish.c */
void bf_key_init __ARGS((char_u *password, char_u *salt, int salt_len));
void bf_ofb_init __ARGS((char_u *iv, int iv_len));
void bf_crypt_encode __ARGS((char_u *from, size_t len, char_u *to));
void bf_crypt_decode __ARGS((char_u *ptr, long len));
void bf_crypt_init_keys __ARGS((char_u *passwd));
void bf_crypt_save __ARGS((void));
void bf_crypt_restore __ARGS((void));
int blowfish_self_test __ARGS((void));
/* vim: set ft=c : */

81
src/proto/buffer.pro Normal file
View File

@ -0,0 +1,81 @@
/* buffer.c */
int open_buffer __ARGS((int read_stdin, exarg_T *eap, int flags));
int buf_valid __ARGS((buf_T *buf));
void close_buffer __ARGS((win_T *win, buf_T *buf, int action, int abort_if_last));
void buf_clear_file __ARGS((buf_T *buf));
void buf_freeall __ARGS((buf_T *buf, int flags));
void goto_buffer __ARGS((exarg_T *eap, int start, int dir, int count));
void handle_swap_exists __ARGS((buf_T *old_curbuf));
char_u *do_bufdel __ARGS((int command, char_u *arg, int addr_count,
int start_bnr, int end_bnr,
int forceit));
int do_buffer __ARGS((int action, int start, int dir, int count, int forceit));
void set_curbuf __ARGS((buf_T *buf, int action));
void enter_buffer __ARGS((buf_T *buf));
void do_autochdir __ARGS((void));
buf_T *buflist_new __ARGS((char_u *ffname, char_u *sfname, linenr_T lnum,
int flags));
void free_buf_options __ARGS((buf_T *buf, int free_p_ff));
int buflist_getfile __ARGS((int n, linenr_T lnum, int options, int forceit));
void buflist_getfpos __ARGS((void));
buf_T *buflist_findname_exp __ARGS((char_u *fname));
buf_T *buflist_findname __ARGS((char_u *ffname));
int buflist_findpat __ARGS((char_u *pattern, char_u *pattern_end, int unlisted,
int diffmode,
int curtab_only));
int ExpandBufnames __ARGS((char_u *pat, int *num_file, char_u ***file,
int options));
buf_T *buflist_findnr __ARGS((int nr));
char_u *buflist_nr2name __ARGS((int n, int fullname, int helptail));
void get_winopts __ARGS((buf_T *buf));
pos_T *buflist_findfpos __ARGS((buf_T *buf));
linenr_T buflist_findlnum __ARGS((buf_T *buf));
void buflist_list __ARGS((exarg_T *eap));
int buflist_name_nr __ARGS((int fnum, char_u **fname, linenr_T *lnum));
int setfname __ARGS((buf_T *buf, char_u *ffname, char_u *sfname, int message));
void buf_set_name __ARGS((int fnum, char_u *name));
void buf_name_changed __ARGS((buf_T *buf));
buf_T *setaltfname __ARGS((char_u *ffname, char_u *sfname, linenr_T lnum));
char_u *getaltfname __ARGS((int errmsg));
int buflist_add __ARGS((char_u *fname, int flags));
void buflist_slash_adjust __ARGS((void));
void buflist_altfpos __ARGS((win_T *win));
int otherfile __ARGS((char_u *ffname));
void buf_setino __ARGS((buf_T *buf));
void fileinfo __ARGS((int fullname, int shorthelp, int dont_truncate));
void col_print __ARGS((char_u *buf, size_t buflen, int col, int vcol));
void maketitle __ARGS((void));
void resettitle __ARGS((void));
void free_titles __ARGS((void));
int build_stl_str_hl __ARGS((win_T *wp, char_u *out, size_t outlen, char_u *fmt,
int use_sandbox, int fillchar, int maxwidth,
struct stl_hlrec *hltab,
struct stl_hlrec *tabtab));
void get_rel_pos __ARGS((win_T *wp, char_u *buf, int buflen));
char_u *fix_fname __ARGS((char_u *fname));
void fname_expand __ARGS((buf_T *buf, char_u **ffname, char_u **sfname));
char_u *alist_name __ARGS((aentry_T *aep));
void do_arg_all __ARGS((int count, int forceit, int keep_tabs));
void ex_buffer_all __ARGS((exarg_T *eap));
void do_modelines __ARGS((int flags));
int read_viminfo_bufferlist __ARGS((vir_T *virp, int writing));
void write_viminfo_bufferlist __ARGS((FILE *fp));
char_u *buf_spname __ARGS((buf_T *buf));
int find_win_for_buf __ARGS((buf_T *buf, win_T **wp, tabpage_T **tp));
void buf_addsign __ARGS((buf_T *buf, int id, linenr_T lnum, int typenr));
linenr_T buf_change_sign_type __ARGS((buf_T *buf, int markId, int typenr));
int buf_getsigntype __ARGS((buf_T *buf, linenr_T lnum, int type));
linenr_T buf_delsign __ARGS((buf_T *buf, int id));
int buf_findsign __ARGS((buf_T *buf, int id));
int buf_findsign_id __ARGS((buf_T *buf, linenr_T lnum));
int buf_findsigntype_id __ARGS((buf_T *buf, linenr_T lnum, int typenr));
int buf_signcount __ARGS((buf_T *buf, linenr_T lnum));
void buf_delete_signs __ARGS((buf_T *buf));
void buf_delete_all_signs __ARGS((void));
void sign_list_placed __ARGS((buf_T *rbuf));
void sign_mark_adjust __ARGS((linenr_T line1, linenr_T line2, long amount,
long amount_after));
void set_buflisted __ARGS((int on));
int buf_contents_changed __ARGS((buf_T *buf));
void wipe_buffer __ARGS((buf_T *buf, int aucmd));
/* vim: set ft=c : */

64
src/proto/charset.pro Normal file
View File

@ -0,0 +1,64 @@
/* charset.c */
int init_chartab __ARGS((void));
int buf_init_chartab __ARGS((buf_T *buf, int global));
void trans_characters __ARGS((char_u *buf, int bufsize));
char_u *transstr __ARGS((char_u *s));
char_u *str_foldcase __ARGS((char_u *str, int orglen, char_u *buf, int buflen));
char_u *transchar __ARGS((int c));
char_u *transchar_byte __ARGS((int c));
void transchar_nonprint __ARGS((char_u *buf, int c));
void transchar_hex __ARGS((char_u *buf, int c));
int byte2cells __ARGS((int b));
int char2cells __ARGS((int c));
int ptr2cells __ARGS((char_u *p));
int vim_strsize __ARGS((char_u *s));
int vim_strnsize __ARGS((char_u *s, int len));
int chartabsize __ARGS((char_u *p, colnr_T col));
int linetabsize __ARGS((char_u *s));
int linetabsize_col __ARGS((int startcol, char_u *s));
int win_linetabsize __ARGS((win_T *wp, char_u *p, colnr_T len));
int vim_isIDc __ARGS((int c));
int vim_iswordc __ARGS((int c));
int vim_iswordc_buf __ARGS((int c, buf_T *buf));
int vim_iswordp __ARGS((char_u *p));
int vim_iswordp_buf __ARGS((char_u *p, buf_T *buf));
int vim_isfilec __ARGS((int c));
int vim_isfilec_or_wc __ARGS((int c));
int vim_isprintc __ARGS((int c));
int vim_isprintc_strict __ARGS((int c));
int lbr_chartabsize __ARGS((unsigned char *s, colnr_T col));
int lbr_chartabsize_adv __ARGS((char_u **s, colnr_T col));
int win_lbr_chartabsize __ARGS((win_T *wp, char_u *s, colnr_T col, int *headp));
int in_win_border __ARGS((win_T *wp, colnr_T vcol));
void getvcol __ARGS((win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor,
colnr_T *end));
colnr_T getvcol_nolist __ARGS((pos_T *posp));
void getvvcol __ARGS((win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor,
colnr_T *end));
void getvcols __ARGS((win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left,
colnr_T *right));
char_u *skipwhite __ARGS((char_u *q));
char_u *skipdigits __ARGS((char_u *q));
char_u *skiphex __ARGS((char_u *q));
char_u *skiptodigit __ARGS((char_u *q));
char_u *skiptohex __ARGS((char_u *q));
int vim_isdigit __ARGS((int c));
int vim_isxdigit __ARGS((int c));
int vim_islower __ARGS((int c));
int vim_isupper __ARGS((int c));
int vim_toupper __ARGS((int c));
int vim_tolower __ARGS((int c));
char_u *skiptowhite __ARGS((char_u *p));
char_u *skiptowhite_esc __ARGS((char_u *p));
long getdigits __ARGS((char_u **pp));
int vim_isblankline __ARGS((char_u *lbuf));
void vim_str2nr __ARGS((char_u *start, int *hexp, int *len, int dooct,
int dohex, long *nptr,
unsigned long *unptr));
int hex2nr __ARGS((int c));
int hexhex2nr __ARGS((char_u *p));
int rem_backslash __ARGS((char_u *str));
void backslash_halve __ARGS((char_u *p));
char_u *backslash_halve_save __ARGS((char_u *p));
void ebcdic2ascii __ARGS((char_u *buffer, int len));
/* vim: set ft=c : */

30
src/proto/diff.pro Normal file
View File

@ -0,0 +1,30 @@
/* diff.c */
void diff_buf_delete __ARGS((buf_T *buf));
void diff_buf_adjust __ARGS((win_T *win));
void diff_buf_add __ARGS((buf_T *buf));
void diff_invalidate __ARGS((buf_T *buf));
void diff_mark_adjust __ARGS((linenr_T line1, linenr_T line2, long amount,
long amount_after));
void ex_diffupdate __ARGS((exarg_T *eap));
void ex_diffpatch __ARGS((exarg_T *eap));
void ex_diffsplit __ARGS((exarg_T *eap));
void ex_diffthis __ARGS((exarg_T *eap));
void diff_win_options __ARGS((win_T *wp, int addbuf));
void ex_diffoff __ARGS((exarg_T *eap));
void diff_clear __ARGS((tabpage_T *tp));
int diff_check __ARGS((win_T *wp, linenr_T lnum));
int diff_check_fill __ARGS((win_T *wp, linenr_T lnum));
void diff_set_topline __ARGS((win_T *fromwin, win_T *towin));
int diffopt_changed __ARGS((void));
int diffopt_horizontal __ARGS((void));
int diff_find_change __ARGS((win_T *wp, linenr_T lnum, int *startp, int *endp));
int diff_infold __ARGS((win_T *wp, linenr_T lnum));
void nv_diffgetput __ARGS((int put));
void ex_diffgetput __ARGS((exarg_T *eap));
int diff_mode_buf __ARGS((buf_T *buf));
int diff_move_to __ARGS((int dir, long count));
linenr_T diff_get_corresponding_line __ARGS((buf_T *buf1, linenr_T lnum1,
buf_T *buf2,
linenr_T lnum3));
linenr_T diff_lnum_win __ARGS((linenr_T lnum, win_T *wp));
/* vim: set ft=c : */

Some files were not shown because too many files have changed in this diff Show More