From 69154f22a69cf421095771f16b12073a1a3bdb6d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 18 Jul 2010 21:42:34 +0200 Subject: Fixes and improvements for MS-Windows build. --- src/Make_mvc.mak | 4 +++ src/Makefile | 2 +- src/bigvim.bat | 2 +- src/if_python3.c | 14 +++++----- src/undo.c | 83 ++++++++++++++++++++++++++------------------------------ src/version.h | 4 +-- 6 files changed, 53 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index c0704503c2..9d34633ce0 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -817,7 +817,11 @@ RUBY_INSTALL_NAME = mswin32-ruby$(RUBY_VER) !message Ruby requested (version $(RUBY_VER)) - root dir is "$(RUBY)" CFLAGS = $(CFLAGS) -DFEAT_RUBY RUBY_OBJ = $(OUTDIR)\if_ruby.obj +!if $(RUBY_VER) >= 190 +RUBY_INC = /I "$(RUBY)\include\ruby-$(RUBY_VER_LONG)\$(RUBY_PLATFORM)" /I "$(RUBY)\include\ruby-$(RUBY_VER_LONG)" +!else RUBY_INC = /I "$(RUBY)\lib\ruby\$(RUBY_VER_LONG)\$(RUBY_PLATFORM)" +!endif RUBY_LIB = $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib # Do we want to load Ruby dynamically? !if "$(DYNAMIC_RUBY)" == "yes" diff --git a/src/Makefile b/src/Makefile index db38f937f6..2211ba0528 100644 --- a/src/Makefile +++ b/src/Makefile @@ -404,7 +404,7 @@ CClink = $(CC) # If both python2.x and python3.x are enabled then the linking will be via # dlopen(), dlsym(), dlclose(), i.e. pythonX.Y.so must be available #CONF_OPT_PYTHON = --enable-pythoninterp -#CONF_OPT_PYTHON3 = --enable-python3interp +CONF_OPT_PYTHON3 = --enable-python3interp # RUBY # Uncomment this when you want to include the Ruby interface. diff --git a/src/bigvim.bat b/src/bigvim.bat index ded5bc41d6..6ba89e62c5 100644 --- a/src/bigvim.bat +++ b/src/bigvim.bat @@ -1,3 +1,3 @@ :: command to build big Vim with OLE, Perl, Python, Ruby and Tcl -nmake -f Make_mvc.mak GUI=yes OLE=yes PERL=E:\perl58 DYNAMIC_PERL=yes PERL_VER=58 PYTHON=e:\python24 DYNAMIC_PYTHON=yes PYTHON_VER=24 RUBY=e:\ruby18 DYNAMIC_RUBY=yes RUBY_VER=18 RUBY_VER_LONG=1.8 TCL=e:\tcl DYNAMIC_TCL=yes %1 IME=yes CSCOPE=yes XPM=e:\xpm +nmake -f Make_mvc.mak GUI=yes OLE=yes PERL=E:\perl512 DYNAMIC_PERL=yes PERL_VER=512 PYTHON=e:\python27 DYNAMIC_PYTHON=yes PYTHON_VER=27 PYTHON3=e:\python31 DYNAMIC_PYTHON3=yes PYTHON3_VER=31 RUBY=e:\ruby191 DYNAMIC_RUBY=yes RUBY_VER=191 RUBY_VER_LONG=1.9.1 TCL=e:\tcl DYNAMIC_TCL=yes %1 IME=yes CSCOPE=yes XPM=e:\xpm diff --git a/src/if_python3.c b/src/if_python3.c index 5400dc6165..410dc1484f 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -321,6 +321,7 @@ static void end_dynamic_python3(void) static int py3_runtime_link_init(char *libname, int verbose) { int i; + void *ucs_from_string, *ucs_from_string_and_size; if (hinstPy3) return OK; @@ -346,11 +347,8 @@ static int py3_runtime_link_init(char *libname, int verbose) } } - /* load unicode functions separately as only the ucs2 or the ucs4 functions - * will be present in the library - */ - void *ucs_from_string, *ucs_from_string_and_size; - + /* Load unicode functions separately as only the ucs2 or the ucs4 functions + * will be present in the library. */ ucs_from_string = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_FromString"); ucs_from_string_and_size = symbol_from_dll(hinstPy3, "PyUnicodeUCS2_FromStringAndSize"); @@ -438,7 +436,7 @@ static Py_ssize_t RangeEnd; static void PythonIO_Flush(void); static int PythonIO_Init(void); static void PythonIO_Fini(void); -static PyMODINIT_FUNC Py3Init_vim(void); +PyMODINIT_FUNC Py3Init_vim(void); /* Utility functions for the vim/python interface * ---------------------------------------------- @@ -2222,7 +2220,8 @@ PyDoc_STRVAR(vim_module_doc,"vim python interface\n"); static struct PyModuleDef vimmodule; -static PyMODINIT_FUNC Py3Init_vim(void) +#ifndef PROTO +PyMODINIT_FUNC Py3Init_vim(void) { PyObject *mod; /* The special value is removed from sys.path in Python3_Init(). */ @@ -2255,6 +2254,7 @@ static PyMODINIT_FUNC Py3Init_vim(void) return mod; } +#endif /************************************************************************* * 4. Utility functions for handling the interface between Vim and Python. diff --git a/src/undo.c b/src/undo.c index 0423094fe4..7abd67b2b3 100644 --- a/src/undo.c +++ b/src/undo.c @@ -106,7 +106,7 @@ static size_t fwrite_crypt __ARGS((buf_T *buf UNUSED, char_u *ptr, size_t len, F static char_u *read_string_decrypt __ARGS((buf_T *buf UNUSED, FILE *fd, int len)); static int serialize_header __ARGS((FILE *fp, buf_T *buf, char_u *hash)); static int serialize_uhp __ARGS((FILE *fp, buf_T *buf, u_header_T *uhp)); -static u_header_T *unserialize_uhp __ARGS((FILE *fp, char_u *file_name, int new_version)); +static u_header_T *unserialize_uhp __ARGS((FILE *fp, char_u *file_name)); static int serialize_uep __ARGS((FILE *fp, buf_T *buf, u_entry_T *uep)); static u_entry_T *unserialize_uep __ARGS((FILE *fp, int *error, char_u *file_name)); static void serialize_pos __ARGS((pos_T pos, FILE *fp)); @@ -694,9 +694,7 @@ nomem: # define UF_HEADER_END_MAGIC 0xe7aa /* magic after last header */ # define UF_ENTRY_MAGIC 0xf518 /* magic at start of entry */ # define UF_ENTRY_END_MAGIC 0x3581 /* magic after last entry */ -# define UF_VERSION_PREV 1 /* 2-byte undofile version number */ # define UF_VERSION 2 /* 2-byte undofile version number */ -# define UF_VERSION_CRYPT_PREV 0x8001 /* idem, encrypted */ # define UF_VERSION_CRYPT 0x8002 /* idem, encrypted */ /* extra fields for header */ @@ -1019,10 +1017,9 @@ serialize_uhp(fp, buf, uhp) } static u_header_T * -unserialize_uhp(fp, file_name, new_version) +unserialize_uhp(fp, file_name) FILE *fp; char_u *file_name; - int new_version; { u_header_T *uhp; int i; @@ -1068,26 +1065,25 @@ unserialize_uhp(fp, file_name, new_version) uhp->uh_time = get8ctime(fp); /* Optional fields. */ - if (new_version) - for (;;) - { - int len = getc(fp); - int what; + for (;;) + { + int len = getc(fp); + int what; - if (len == 0) + if (len == 0) + break; + what = getc(fp); + switch (what) + { + case UHP_SAVE_NR: + uhp->uh_save_nr = get4c(fp); break; - what = getc(fp); - switch (what) - { - case UHP_SAVE_NR: - uhp->uh_save_nr = get4c(fp); - break; - default: - /* field not supported, skip */ - while (--len >= 0) - (void)getc(fp); - } + default: + /* field not supported, skip */ + while (--len >= 0) + (void)getc(fp); } + } /* Unserialize the uep list. */ last_uep = NULL; @@ -1564,7 +1560,6 @@ u_read_undo(name, hash, orig_name) char_u *file_name; FILE *fp; long version, str_len; - int new_version; char_u *line_ptr = NULL; linenr_T line_lnum; colnr_T line_colnr; @@ -1645,7 +1640,7 @@ u_read_undo(name, hash, orig_name) goto error; } version = get2c(fp); - if (version == UF_VERSION_CRYPT || version == UF_VERSION_CRYPT_PREV) + if (version == UF_VERSION_CRYPT) { #ifdef FEAT_CRYPT if (*curbuf->b_p_key == NUL) @@ -1665,12 +1660,11 @@ u_read_undo(name, hash, orig_name) goto error; #endif } - else if (version != UF_VERSION && version != UF_VERSION_PREV) + else if (version != UF_VERSION) { EMSG2(_("E824: Incompatible undo file: %s"), file_name); goto error; } - new_version = (version == UF_VERSION || version == UF_VERSION_CRYPT); if (fread(read_hash, UNDO_HASH_SIZE, 1, fp) != 1) { @@ -1716,27 +1710,26 @@ u_read_undo(name, hash, orig_name) seq_cur = get4c(fp); seq_time = get8ctime(fp); - /* Optional header fields, not in previous version. */ - if (new_version) - for (;;) - { - int len = getc(fp); - int what; + /* Optional header fields. */ + for (;;) + { + int len = getc(fp); + int what; - if (len == 0 || len == EOF) + if (len == 0 || len == EOF) + break; + what = getc(fp); + switch (what) + { + case UF_LAST_SAVE_NR: + last_save_nr = get4c(fp); break; - what = getc(fp); - switch (what) - { - case UF_LAST_SAVE_NR: - last_save_nr = get4c(fp); - break; - default: - /* field not supported, skip */ - while (--len >= 0) - (void)getc(fp); - } + default: + /* field not supported, skip */ + while (--len >= 0) + (void)getc(fp); } + } /* uhp_table will store the freshly created undo headers we allocate * until we insert them into curbuf. The table remains sorted by the @@ -1758,7 +1751,7 @@ u_read_undo(name, hash, orig_name) goto error; } - uhp = unserialize_uhp(fp, file_name, new_version); + uhp = unserialize_uhp(fp, file_name); if (uhp == NULL) goto error; uhp_table[num_read_uhps++] = uhp; diff --git a/src/version.h b/src/version.h index df420abad0..7dd45890da 100644 --- a/src/version.h +++ b/src/version.h @@ -36,5 +36,5 @@ #define VIM_VERSION_NODOT "vim73a" #define VIM_VERSION_SHORT "7.3a" #define VIM_VERSION_MEDIUM "7.3a BETA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.3 BETA (2010 Jul 7)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.3 BETA (2010 Jul 7, compiled " +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.3a BETA (2010 Jul 18)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.3a BETA (2010 Jul 18, compiled " -- cgit v1.2.3