2027 lines · 63.8 KB · C
RawDownload
/* 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. */ #ifndef VIM__H# define VIM__H /* use fastcall for Borland, when compiling for Win32 (not for DOS16) */#if defined(__BORLANDC__) && defined(WIN32) && !defined(DEBUG)#if defined(FEAT_PERL) || \    defined(FEAT_PYTHON) || \    defined(FEAT_RUBY) || \    defined(FEAT_TCL) || \    defined(FEAT_MZSCHEME) || \    defined(DYNAMIC_GETTEXT) || \    defined(DYNAMIC_ICONV) || \    defined(DYNAMIC_IME) || \    defined(XPM)  #pragma option -pc# else  #pragma option -pr# endif#endif /* ============ the header file puzzle (ca. 50-100 pieces) ========= */ #ifdef HAVE_CONFIG_H	/* GNU autoconf (or something else) was here */# include "auto/config.h"# define HAVE_PATHDEF /* * Check if configure correctly managed to find sizeof(int).  If this failed, * it becomes zero.  This is likely a problem of not being able to run the * test program.  Other items from configure may also be wrong then! */# if (SIZEOF_INT == 0)    Error: configure did not run properly.  Check auto/config.log.# endif /* * Cygwin may have fchdir() in a newer release, but in most versions it * doesn't work well and avoiding it keeps the binary backward compatible. */# if defined(__CYGWIN32__) && defined(HAVE_FCHDIR)#  undef HAVE_FCHDIR# endif#endif /* user ID of root is usually zero, but not for everybody */#ifdef __TANDEM# define _TANDEM_SOURCE# include <floss.h># define ROOT_UID 65535#else# define ROOT_UID 0#endif #ifdef __EMX__		/* hand-edited config.h for OS/2 with EMX */# include "os_os2_cfg.h"#endif /* * MACOS_CLASSIC compiling for MacOS prior to MacOS X * MACOS_X_UNIX  compiling for MacOS X (using os_unix.c) * MACOS_X       compiling for MacOS X (using os_unix.c) * MACOS	 compiling for either one */#if defined(macintosh) && !defined(MACOS_CLASSIC)# define MACOS_CLASSIC#endif#if defined(MACOS_X_UNIX)# define MACOS_X# ifndef HAVE_CONFIG_H#  define UNIX# endif#endif#if defined(MACOS_X) || defined(MACOS_CLASSIC)#  define MACOS#endif#if defined(MACOS_X) && defined(MACOS_CLASSIC)    Error: To compile for both MACOS X and Classic use a Classic Carbon#endif/* Unless made through the Makefile enforce GUI on Mac */#if defined(MACOS) && !defined(HAVE_CONFIG_H)# define FEAT_GUI_MAC#endif #if defined(FEAT_GUI_MOTIF) \    || defined(FEAT_GUI_GTK) \    || defined(FEAT_GUI_ATHENA) \    || defined(FEAT_GUI_MAC) \    || defined(FEAT_GUI_W32) \    || defined(FEAT_GUI_W16) \    || defined(FEAT_GUI_PHOTON)# if !defined(FEAT_GUI) && !defined(NO_X11_INCLUDES)#  define FEAT_GUI# endif#endif /* Visual Studio 2005 has 'deprecated' many of the standard CRT functions */#if _MSC_VER >= 1400# define _CRT_SECURE_NO_DEPRECATE# define _CRT_NONSTDC_NO_DEPRECATE#endif #if defined(FEAT_GUI_W32) || defined(FEAT_GUI_W16)# define FEAT_GUI_MSWIN#endif#if defined(WIN16) || defined(WIN32) || defined(_WIN64)# define MSWIN#endif/* Practically everything is common to both Win32 and Win64 */#if defined(WIN32) || defined(_WIN64)# define WIN3264#endif /* * SIZEOF_INT is used in feature.h, and the system-specific included files * need items from feature.h.  Therefore define SIZEOF_INT here. */#ifdef WIN3264# define SIZEOF_INT 4#endif#ifdef MSDOS# ifdef DJGPP#  ifndef FEAT_GUI_GTK		/* avoid problems when generating prototypes */#   define SIZEOF_INT 4		/* 32 bit ints */#  endif#  define DOS32#  define FEAT_CLIPBOARD# else#  ifndef FEAT_GUI_GTK		/* avoid problems when generating prototypes */#   define SIZEOF_INT 2		/* 16 bit ints */#  endif#  define SMALL_MALLOC		/* 16 bit storage allocation */#  define DOS16# endif#endif #ifdef AMIGA  /* Be conservative about sizeof(int). It could be 4 too. */# ifndef FEAT_GUI_GTK	/* avoid problems when generating prototypes */#  ifdef __GNUC__#   define SIZEOF_INT	4#  else#   define SIZEOF_INT	2#  endif# endif#endif#ifdef MACOS# if defined(__POWERPC__) || defined(MACOS_X) || defined(__fourbyteints__) \  || defined(__MRC__) || defined(__SC__) || defined(__APPLE_CC__)/* MPW Compilers */#  define SIZEOF_INT 4# else#  define SIZEOF_INT 2# endif#endif#ifdef RISCOS# define SIZEOF_INT 4#endif#ifdef PLAN9# define SIZEOF_INT 4#endif  #include "feature.h"	/* #defines for optionals and features */ /* +x11 is only enabled when it's both available and wanted. */#if defined(HAVE_X11) && defined(WANT_X11)# define FEAT_X11#endif #ifdef NO_X11_INCLUDES    /* In os_mac_conv.c NO_X11_INCLUDES is defined to avoid X11 headers.     * Disable all X11 related things to avoid conflicts. */# ifdef FEAT_X11#  undef FEAT_X11# endif# ifdef FEAT_XCLIPBOARD#  undef FEAT_XCLIPBOARD# endif# ifdef FEAT_GUI_MOTIF#  undef FEAT_GUI_MOTIF# endif# ifdef FEAT_GUI_ATHENA#  undef FEAT_GUI_ATHENA# endif# ifdef FEAT_GUI_GTK#  undef FEAT_GUI_GTK# endif# ifdef FEAT_BEVAL_TIP#  undef FEAT_BEVAL_TIP# endif# ifdef FEAT_XIM#  undef FEAT_XIM# endif# ifdef FEAT_CLIENTSERVER#  undef FEAT_CLIENTSERVER# endif#endif /* The Mac conversion stuff doesn't work under X11. */#if defined(FEAT_MBYTE) && defined(MACOS_X)# define MACOS_CONVERT#endif /* Can't use "PACKAGE" here, conflicts with a Perl include file. */#ifndef VIMPACKAGE# define VIMPACKAGE	"vim"#endif /* * Find out if function definitions should include argument types */#ifdef AZTEC_C# include <functions.h># define __ARGS(x)  x#endif #ifdef SASC# include <clib/exec_protos.h># define __ARGS(x)  x#endif #ifdef _DCC# include <clib/exec_protos.h># define __ARGS(x)  x#endif #ifdef __TURBOC__# define __ARGS(x) x#endif #ifdef __BEOS__# include "os_beos.h"# define __ARGS(x)  x#endif #if (defined(UNIX) || defined(__EMX__) || defined(VMS)) \	&& (!defined(MACOS_X) || defined(HAVE_CONFIG_H))# include "os_unix.h"	    /* bring lots of system header files */#endif #if defined(MACOS) && (defined(__MRC__) || defined(__SC__))   /* Apple's Compilers support prototypes */# define __ARGS(x) x#endif#ifndef __ARGS# if defined(__STDC__) || defined(__GNUC__) || defined(WIN3264)#  define __ARGS(x) x# else#  define __ARGS(x) ()# endif#endif /* __ARGS and __PARMS are the same thing. */#ifndef __PARMS# define __PARMS(x) __ARGS(x)#endif /* if we're compiling in C++ (currently only KVim), the system * headers must have the correct prototypes or nothing will build. * conversely, our prototypes might clash due to throw() specifiers and * cause compilation failures even though the headers are correct.  For * a concrete example, gcc-3.2 enforces exception specifications, and * glibc-2.2.5 has them in their system headers. */#if !defined(__cplusplus) && defined(UNIX) \  && !defined(MACOS_X) /* MACOS_X doesn't yet support osdef.h */# include "auto/osdef.h"	/* bring missing declarations in */#endif #ifdef __EMX__# define    getcwd  _getcwd2# define    chdir   _chdir2# undef	    CHECK_INODE#endif #ifdef AMIGA# include "os_amiga.h"#endif #ifdef MSDOS# include "os_msdos.h"#endif #ifdef WIN16# include "os_win16.h"#endif #ifdef WIN3264# include "os_win32.h"#endif #ifdef __MINT__# include "os_mint.h"#endif #if defined(MACOS)# if defined(__MRC__) || defined(__SC__) /* MPW Compilers */#  define HAVE_SETENV# endif# include "os_mac.h"#endif #if defined(PLAN9)# include "os_plan9.h"#endif #ifdef RISCOS# include "os_riscos.h"#endif #ifdef __QNX__# include "os_qnx.h"#endif #ifdef FEAT_SUN_WORKSHOP# include "workshop.h"#endif #ifdef X_LOCALE# include <X11/Xlocale.h>#else# ifdef HAVE_LOCALE_H#  include <locale.h># endif#endif /* * Maximum length of a path (for non-unix systems) Make it a bit long, to stay * on the safe side.  But not too long to put on the stack. */#ifndef MAXPATHL# ifdef MAXPATHLEN#  define MAXPATHL  MAXPATHLEN# else#  define MAXPATHL  256# endif#endif#ifdef BACKSLASH_IN_FILENAME# define PATH_ESC_CHARS ((char_u *)" \t*?[{`%#")#else# define PATH_ESC_CHARS ((char_u *)" \t*?[{`$\\%#'\"|")# define SHELL_ESC_CHARS ((char_u *)" \t*?[{`$\\%#'\"|<>();&!")#endif #define NUMBUFLEN 30	    /* length of a buffer to store a number in ASCII */ /* * Shorthand for unsigned variables. Many systems, but not all, have u_char * already defined, so we use char_u to avoid trouble. */typedef unsigned char	char_u;typedef unsigned short	short_u;typedef unsigned int	int_u;/* Make sure long_u is big enough to hold a pointer. * On Win64 longs are 32 bit and pointers 64 bit. * For printf() and scanf() we need to take care of long_u specifically. */#ifdef _WIN64typedef unsigned __int64 long_u;typedef		 __int64 long_i;# define SCANF_HEX_LONG_U  "%Ix"# define PRINTF_HEX_LONG_U "0x%Ix"#elsetypedef unsigned long	long_u;typedef		 long	long_i;# define SCANF_HEX_LONG_U  "%lx"# define PRINTF_HEX_LONG_U "0x%lx"#endif /* * The characters and attributes cached for the screen. */typedef char_u schar_T;#ifdef FEAT_SYN_HLtypedef unsigned short sattr_T;# define MAX_TYPENR 65535#elsetypedef unsigned char sattr_T;# define MAX_TYPENR 255#endif /* * The u8char_T can hold one decoded UTF-8 character. * We normally use 32 bits now, since some Asian characters don't fit in 16 * bits.  u8char_T is only used for displaying, it could be 16 bits to save * memory. */#ifdef FEAT_MBYTE# ifdef UNICODE16typedef unsigned short u8char_T;    /* short should be 16 bits */# else#  if SIZEOF_INT >= 4typedef unsigned int u8char_T;	    /* int is 32 bits */#  elsetypedef unsigned long u8char_T;	    /* long should be 32 bits or more */#  endif# endif#endif #ifndef UNIX		    /* For Unix this is included in os_unix.h */# include <stdio.h># include <ctype.h>#endif #include "ascii.h"#include "keymap.h"#include "term.h"#include "macros.h" #ifdef LATTICE# include <sys/types.h># include <sys/stat.h>#endif#ifdef _DCC# include <sys/stat.h>#endif#if defined(MSDOS) || defined(MSWIN)# include <sys/stat.h>#endif /* * Allow other (non-unix) systems to configure themselves now * These are also in os_unix.h, because osdef.sh needs them there. */#ifndef UNIX/* Note: Some systems need both string.h and strings.h (Savage).  If the * system can't handle this, define NO_STRINGS_WITH_STRING_H. */# ifdef HAVE_STRING_H#  include <string.h># endif# if defined(HAVE_STRINGS_H) && !defined(NO_STRINGS_WITH_STRING_H)#   include <strings.h># endif# ifdef HAVE_STAT_H#  include <stat.h># endif# ifdef HAVE_STDLIB_H#  include <stdlib.h># endif#endif /* NON-UNIX */ #include <assert.h> #ifdef HAVE_WCTYPE_H# include <wctype.h>#endif#if defined(HAVE_STDARG_H) && !defined(PLAN9)# include <stdarg.h>#endif /* ================ end of the header file puzzle =============== */ /* * For dynamically loaded imm library. Currently, only for Win32. */#ifdef DYNAMIC_IME# ifndef FEAT_MBYTE_IME#  define FEAT_MBYTE_IME# endif#endif /* * Check input method control. */#if defined(FEAT_XIM) || \    (defined(FEAT_GUI) && (defined(FEAT_MBYTE_IME) || defined(GLOBAL_IME)))# define USE_IM_CONTROL#endif /* * For dynamically loaded gettext library.  Currently, only for Win32. */#ifdef DYNAMIC_GETTEXT# ifndef FEAT_GETTEXT#  define FEAT_GETTEXT# endif/* These are in os_win32.c */extern char *(*dyn_libintl_gettext)(const char *msgid);extern char *(*dyn_libintl_bindtextdomain)(const char *domainname, const char *dirname);extern char *(*dyn_libintl_bind_textdomain_codeset)(const char *domainname, const char *codeset);extern char *(*dyn_libintl_textdomain)(const char *domainname);#endif  /* * The _() stuff is for using gettext().  It is a no-op when libintl.h is not * found or the +multilang feature is disabled. */#ifdef FEAT_GETTEXT# ifdef DYNAMIC_GETTEXT#  define _(x) (*dyn_libintl_gettext)((char *)(x))#  define N_(x) x#  define bindtextdomain(domain, dir) (*dyn_libintl_bindtextdomain)((domain), (dir))#  define bind_textdomain_codeset(domain, codeset) (*dyn_libintl_bind_textdomain_codeset)((domain), (codeset))

Lines 1–500 of 2027.