To: vim-dev@vim.org Subject: Patch 5.6.073 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6.073 (extra) (depends on 5.6.034) Problem: Win32 GUI: When compiled with Bcc 5.5 menus don't work. In dosinst.c toupper() and tolower() give an "internal compiler error" for Bcc 5.5. Solution: Define WINVER to 4 to avoid compiling for Windows 2000. (Dan Sharp) Also cleaned up compilation arguments. Use our own implementation of toupper() in dosinst.c. Use mytoupper() instead of tolower(). Files: src/Makefile.bor, src/dosinst.c *** ../vim-5.6.72/src/Makefile.bor Mon Mar 27 21:52:26 2000 --- src/Makefile.bor Thu Jun 1 18:48:22 2000 *************** *** 10,15 **** --- 10,17 ---- # Has been reported NOT to work with BC 4.52. Maybe it can be fixed? # 10/1997 - ron - fixed bugs w/ BC 5.02 # 8/1998 - ron - updated with new targets, fixed some stuff + # 3/2000 - Bram: Made it work with BC 5.5 free command line compiler, + # cleaned up variables. # # It builds on Windows 95 and NT-Intel, producing the same binary in either # case. To build using Microsoft Visual C++, use Makefile.w32. *************** *** 23,99 **** .AUTODEPEND .CACHEAUTODEPEND # ! # VARIABLES LIST: # ! # BOR - path to root of Borland C install, typ: \BC5 ! # DEBUG - define if you wish a DEBUGging build ! # CODEGUARD - define (for BORLAND only) if you want to use CODEGUARD ! # GUI - define if you want the GUI version ! # CPU - one of 1 through 6 - select CPU to compile for ! # USEDLL - use the Runtime library DLL ! # VIMDLL - create vim32.dll, and stub (g)vim.exe ! # ALIGN - Alignment to use (1,2,4) ! # FASTCALL - Use register-based function protocol ! # OS - DOS16 or WIN32 # ! # Change this to point to the root of *your* BC installation: !if ("$(BOR)"=="") BOR = c:\bc5 !endif # ! # PERL STUFF ! # 'USEDLL' doesn't seem to work with perl, don't know why. ! # if the following line is uncommented, you will have perl support in vim: ! # PERL=perl.exe ! PERLLIB=c:\perl\lib ! # ! # OS Target - can be DOS16 or WIN32 ! !if ("$(OS)"=="") ! OS = WIN32 ! !endif ! # ! # Uncomment to make an executable for debugging: ! #DEBUG = -v # ! # Comment out to make a console-mode only version: !if ("$(GUI)"=="") GUI = 1 !endif # ! # Uncomment to make an OLE-capable version: #OLE = 1 # ! # Uncomment to use the CODEGUARD stuff (BC 5.0 or later): ! #CODEGUARD = -vG # ! # Uncomment to use FASTCALL calling convention (RECOMMENDED!) ! FASTCALL = 1 # ! # Optimize for space or speed? (SPEED RECOMMENDED) ! OPTIMIZE = SPEED # ! # Change as appropriate for your target processor (3 to 6): CPU = 3 # ! # Comment out to use precompiled headers (faster, but uses lots of disk!) HEADERS = -H -H=vim.csm -Hc # ! # Comment out to use statically linked version of run-time: USEDLL = 1 # ! # Uncomment to make a DLL version of VIM (NOT RECOMMENDED): #VIMDLL = 1 # ! # Change to alignment you desire: (1,2 or 4: s/b 4 for Win32, 2 for DOS) ! !if ($(OS)==DOS16) ALIGN = 2 !else ALIGN = 4 !endif # # Sanity checks for the above options: # ! !if ($(OS)==DOS16) !if (($(CPU)+0)>4) !error CPU Must be less than or equal to 4 for DOS16 !endif --- 25,125 ---- .AUTODEPEND .CACHEAUTODEPEND # ! # VARIABLES: ! # name value (default) # ! # BOR path to root of Borland C install (c:\bc5) ! # LINK name of the linker ($(BOR)\bin\tlink if OSTYPE is DOS16, ! # $(BOR)\bin\ilink32 otherwise) ! # GUI 0 or 1: set to 1 if you want the GUI version (1) ! # PERL define to "perl.exe" to get Perl support (not defined) ! # OLE 0 or 1: set to 1 to make OLE gvim (0) ! # OSTYPE DOS16 or WIN32 (WIN32) ! # DEBUG set to "-v" if you wish a DEBUGging build (not defined) ! # CODEGUARD set to "-vG" if you want to use CODEGUARD (not defined) ! # CPU 1 through 6: select CPU to compile for (3) ! # USEDLL 0 or 1: set to 1 to use the Runtime library DLL (1) ! # VIMDLL 0 or 1: create vim32.dll, and stub (g)vim.exe (0) ! # ALIGN 1, 2 or 4: Alignment to use (4 for Win32, 2 for DOS16) ! # FASTCALL 0 or 1: set to 1 to use register-based function protocol (1) ! # OPTIMIZE SPEED or SPACE: type of optimization (SPEED) # ! ### BOR: root of the BC installation !if ("$(BOR)"=="") BOR = c:\bc5 !endif # ! ### LINK: Name of the linker: tlink or tlink32 (this is below, depends on ! # $(OSTYPE) # ! ### GUI: 1 for GUI version, 0 for console version !if ("$(GUI)"=="") GUI = 1 !endif # ! ### PERL: uncommented this line if you want perl support in vim ! # 'USEDLL' doesn't seem to work with perl, don't know why. ! # PERL=perl.exe ! PERLLIB=c:\perl\lib ! # ! ### OLE: 0 for normal gvim, 1 for OLE-capable gvim (only works with GUI) #OLE = 1 # ! ### OSTYPE: DOS16 for Windows 3.1 version, WIN32 for Windows 95/98/NT/2000 ! # version ! !if ("$(OSTYPE)"=="") ! OSTYPE = WIN32 ! !endif # ! ### DEBUG: Uncomment to make an executable for debugging ! #DEBUG = -v # ! ### CODEGUARD: Uncomment to use the CODEGUARD stuff (BC 5.0 or later): ! #CODEGUARD = -vG # ! ### CPU: set your target processor (3 to 6) ! !if ("$(CPU)"=="") CPU = 3 + !endif # ! ### Comment out to use precompiled headers (faster, but uses lots of disk!) HEADERS = -H -H=vim.csm -Hc # ! ### USEDLL: 0 for statically linked version of run-time, 1 for DLL runtime ! !if ("$(USEDLL)"=="") USEDLL = 1 + !endif # ! ### VIMDLL: 1 for a DLL version of VIM (NOT RECOMMENDED), 0 otherwise #VIMDLL = 1 # ! ### ALIGN: alignment you desire: (1,2 or 4: s/b 4 for Win32, 2 for DOS) ! !if ("$(ALIGN)"=="") ! !if ($(OSTYPE)==DOS16) ALIGN = 2 !else ALIGN = 4 !endif + !endif + # + ### FASTCALL: 1 to use FASTCALL calling convention (RECOMMENDED!), 0 otherwise + !if ("$(FASTCALL)"=="") + FASTCALL = 1 + !endif + # + ### OPTIMIZE: SPEED to optimize for speed, SPACE otherwise (SPEED RECOMMENDED) + !if ("$(OPTIMIZE)"=="") + OPTIMIZE = SPEED + !endif + # + ### Set the default $(WINVER) to make it work with Bcc 5.5. + !ifndef WINVER + WINVER = -DWINVER=0x0400 -D_WIN32_WINNT=0x0400 + !endif # # Sanity checks for the above options: # ! !if ($(OSTYPE)==DOS16) !if (($(CPU)+0)>4) !error CPU Must be less than or equal to 4 for DOS16 !endif *************** *** 108,115 **** !endif !endif # ! !if ($(OS)!=WIN32) && ($(OS)!=DOS16) ! !error Check the OS variable again: $(OS) is not supported! !endif # # Optimizations: change as desired (RECOMMENDATION: Don't change!): --- 134,141 ---- !endif !endif # ! !if ($(OSTYPE)!=WIN32) && ($(OSTYPE)!=DOS16) ! !error Check the OSTYPE variable again: $(OSTYPE) is not supported! !endif # # Optimizations: change as desired (RECOMMENDATION: Don't change!): *************** *** 122,147 **** !else OPT = -O2 -f- -d -N- -Oca -O !endif ! !ifdef FASTCALL OPT = $(OPT) -pr !endif !ifndef CODEGUARD OPT = $(OPT) -vi- !endif !endif ! !if ($(OS)==DOS16) !undef GUI !undef VIMDLL !undef USEDLL !endif # shouldn't have to change: LIB = $(BOR)\lib ! INCLUDE = $(BOR)\include;$(PERLLIB)\core;.;proto ! DEFINES = -DWIN32 -DPC # !ifdef PERL DEFINES = $(DEFINES) -DHAVE_PERL_INTERP ! INCLUDE = $(PERLIB)\core;$(INCLUDE) !endif # # DO NOT change below: --- 148,173 ---- !else OPT = -O2 -f- -d -N- -Oca -O !endif ! !if ($(FASTCALL)==1) OPT = $(OPT) -pr !endif !ifndef CODEGUARD OPT = $(OPT) -vi- !endif !endif ! !if ($(OSTYPE)==DOS16) !undef GUI !undef VIMDLL !undef USEDLL !endif # shouldn't have to change: LIB = $(BOR)\lib ! INCLUDE = $(BOR)\include;.;proto ! DEFINES = -DWIN32 -DPC $(WINVER) # !ifdef PERL DEFINES = $(DEFINES) -DHAVE_PERL_INTERP ! INCLUDE = $(PERLLIB)\core;$(INCLUDE) !endif # # DO NOT change below: *************** *** 164,170 **** !else TARGET = gvim.exe !endif ! !ifdef VIMDLL EXETYPE=-WD DEFINES = $(DEFINES) -DVIMDLL !else --- 190,196 ---- !else TARGET = gvim.exe !endif ! !if ($(VIMDLL)==1) EXETYPE=-WD DEFINES = $(DEFINES) -DVIMDLL !else *************** *** 181,187 **** !undef VIMDLL TARGET = vim.exe !endif ! !if ($(OS)==DOS16) DEFINES=-DMSDOS EXETYPE=-ml STARTUPOBJ = c0l.obj --- 207,213 ---- !undef VIMDLL TARGET = vim.exe !endif ! !if ($(OSTYPE)==DOS16) DEFINES=-DMSDOS EXETYPE=-ml STARTUPOBJ = c0l.obj *************** *** 194,215 **** RESFILE = !endif ! !ifdef USEDLL DEFINES = $(DEFINES) -D_RTLDLL !endif !ifdef DEBUG ! OBJDIR = $(OS)\objdbg !else !if ($(GUI)==1) ! OBJDIR = $(OS)\gobj !else ! OBJDIR = $(OS)\obj !endif !endif ##### BASE COMPILER/TOOLS RULES ##### ! !if ($(OS)==DOS16) BRC = !if ("$(LINK)"=="") LINK = $(BOR)\BIN\TLink --- 220,245 ---- RESFILE = !endif ! !if ($(USEDLL)==1) DEFINES = $(DEFINES) -D_RTLDLL !endif !ifdef DEBUG ! OBJDIR = $(OSTYPE)\objdbg !else !if ($(GUI)==1) ! !if ($(OLE)==1) ! OBJDIR = $(OSTYPE)\oleobj ! !else ! OBJDIR = $(OSTYPE)\gobj ! !endif !else ! OBJDIR = $(OSTYPE)\obj !endif !endif ##### BASE COMPILER/TOOLS RULES ##### ! !if ($(OSTYPE)==DOS16) BRC = !if ("$(LINK)"=="") LINK = $(BOR)\BIN\TLink *************** *** 240,250 **** .cpp.obj: $(CC) $(CC1) $(CC2)$@ $*.cpp ! !if ($(OS)==DOS16) !else # win32: vimmain = \ $(OBJDIR)\os_w32exe.obj ! !ifdef VIMDLL vimwinmain = \ $(OBJDIR)\os_w32dll.obj !else --- 270,280 ---- .cpp.obj: $(CC) $(CC1) $(CC2)$@ $*.cpp ! !if ($(OSTYPE)==DOS16) !else # win32: vimmain = \ $(OBJDIR)\os_w32exe.obj ! !if ($(VIMDLL)==1) vimwinmain = \ $(OBJDIR)\os_w32dll.obj !else *************** *** 298,304 **** $(OBJDIR)\if_perl.obj !endif ! !ifdef VIMDLL vimdllobj = $(vimobj) !ifdef DEBUG DLLTARGET = vim32d.dll --- 328,334 ---- $(OBJDIR)\if_perl.obj !endif ! !if ($(VIMDLL)==1) vimdllobj = $(vimobj) !ifdef DEBUG DLLTARGET = vim32d.dll *************** *** 315,338 **** $(OBJDIR)\gui_w32.obj !endif ! !if ($(OS)==WIN32) vimobj = $(vimobj) \ $(OBJDIR)\os_win32.obj ! !elif ($(OS)==DOS16) vimobj = $(vimobj) \ $(OBJDIR)\os_msdos.obj !endif # Blab what we are going to do: ! MSG = Compiling $(OS) $(TARGET) $(OLETARGET), with: ! !ifdef GUI MSG = $(MSG) GUI !endif ! !ifdef USEDLL MSG = $(MSG) USEDLL !endif ! !ifdef VIMDLL MSG = $(MSG) VIMDLL !endif !ifdef DEBUG MSG = $(MSG) DEBUG !endif --- 345,374 ---- $(OBJDIR)\gui_w32.obj !endif ! !if ($(OSTYPE)==WIN32) vimobj = $(vimobj) \ $(OBJDIR)\os_win32.obj ! !elif ($(OSTYPE)==DOS16) vimobj = $(vimobj) \ $(OBJDIR)\os_msdos.obj !endif # Blab what we are going to do: ! MSG = Compiling $(OSTYPE) $(TARGET) $(OLETARGET), with: ! !if ($(GUI)==1) MSG = $(MSG) GUI !endif ! !if ($(OLE)==1) ! MSG = $(MSG) OLE ! !endif ! !if ($(USEDLL)==1) MSG = $(MSG) USEDLL !endif ! !if ($(VIMDLL)==1) MSG = $(MSG) VIMDLL !endif + !if ($(FASTCALL)==1) + MSG = $(MSG) FASTCALL + !endif !ifdef DEBUG MSG = $(MSG) DEBUG !endif *************** *** 344,393 **** !message $(MSG) ! !if ($(OS)==DOS16) TARGETS = $(TARGET) !else ! !ifdef VIMDLL TARGETS = $(DLLTARGET) !endif TARGETS = $(TARGETS) $(TARGET) !endif # Targets: vim: dirs $(OBJDIR)\bcc.cfg $(TARGETS) @del $(OBJDIR)\version.obj dirs: ! -@md $(OS) -@md $(OBJDIR) - all: vim vimrun.exe install.exe xxd ctags - - ########################################################################### - ###### Note well: Before you attempt to make 'xxd' or 'ctags', you will - ###### have to edit their respective makefile.w32 files to work with - ###### Borland C. It isn't hard, but I can't do it for you! - ########################################################################### xxd: @cd xxd ! $(MAKE) -f makefile.w32 @cd .. ctags: @cd ctags ! $(MAKE) -f makefile.w32 @cd .. install.exe: dosinst.c ! $(BOR)\BIN\bcc32 -WC -einstall dosinst.c clean: ! -@del /y $(OBJDIR)\*.* ! -@del /y *.res ! -@del /y *.dll ! -@del /y *vim*.exe ! -@del /y *.csm ! -@del /y *.map $(DLLTARGET): $(OBJDIR) $(vimdllobj) $(LINK) @&&| --- 380,428 ---- !message $(MSG) ! !if ($(OSTYPE)==DOS16) TARGETS = $(TARGET) !else ! !if ($(VIMDLL)==1) TARGETS = $(DLLTARGET) !endif TARGETS = $(TARGETS) $(TARGET) !endif # Targets: + all: vim vimrun.exe install.exe xxd ctags + vim: dirs $(OBJDIR)\bcc.cfg $(TARGETS) @del $(OBJDIR)\version.obj dirs: ! -@md $(OSTYPE) -@md $(OBJDIR) xxd: @cd xxd ! $(MAKE) /f Makefile.bor BOR="$(BOR)" CC="$(CC)" @cd .. ctags: @cd ctags ! $(MAKE) /f Makefile.bc5 @cd .. install.exe: dosinst.c ! !if ($(OSTYPE)==WIN32) ! $(CC) -WC -DWIN32 -einstall dosinst.c ! !else ! $(CC) -WC -einstall dosinst.c ! !endif clean: ! -@echo y | del $(OBJDIR)\*.* ! -@del *.res ! -@del *.dll ! -@del *vim*.exe ! -@del *.csm ! -@del *.map $(DLLTARGET): $(OBJDIR) $(vimdllobj) $(LINK) @&&| *************** *** 401,407 **** !if ($(OLE)==1) ole2w32.lib + !endif ! !if ($(OS)==WIN32) import32.lib+ !ifdef PERL $(PERLLIB)\core\perl.lib+ --- 436,442 ---- !if ($(OLE)==1) ole2w32.lib + !endif ! !if ($(OSTYPE)==WIN32) import32.lib+ !ifdef PERL $(PERLLIB)\core\perl.lib+ *************** *** 417,423 **** !endif | ! !ifdef VIMDLL $(TARGET): $(OBJDIR) $(DLLTARGET) $(vimmain) $(RESFILE) !else $(TARGET): $(OBJDIR) $(vimobj) $(RESFILE) --- 452,458 ---- !endif | ! !if ($(VIMDLL)==1) $(TARGET): $(OBJDIR) $(DLLTARGET) $(vimmain) $(RESFILE) !else $(TARGET): $(OBJDIR) $(vimobj) $(RESFILE) *************** *** 425,437 **** $(LINK) @&&| $(LFLAGS) + $(STARTUPOBJ) + ! !ifdef VIMDLL $(vimmain) !else $(vimobj) !endif $<,$* ! !if ($(OS)==WIN32) !ifdef CODEGUARD cg32.lib+ !endif --- 460,472 ---- $(LINK) @&&| $(LFLAGS) + $(STARTUPOBJ) + ! !if ($(VIMDLL)==1) $(vimmain) !else $(vimobj) !endif $<,$* ! !if ($(OSTYPE)==WIN32) !ifdef CODEGUARD cg32.lib+ !endif *************** *** 533,545 **** $(OBJDIR)\os_w32dll.obj: os_w32dll.c $(OBJDIR)\if_ole.obj: if_ole.cpp - copy if_ole.obj $(OBJDIR) $(OBJDIR)\os_w32exe.obj: os_w32exe.c $(CC) $(CC1) -WE $(CC2)$@ os_w32exe.c $(OBJDIR): ! -@if not exist $(OBJDIR)\nul mkdir $(OS) -@if not exist $(OBJDIR)\nul mkdir $(OBJDIR) $(OBJDIR)\if_perl.obj: if_perl.c --- 568,579 ---- $(OBJDIR)\os_w32dll.obj: os_w32dll.c $(OBJDIR)\if_ole.obj: if_ole.cpp $(OBJDIR)\os_w32exe.obj: os_w32exe.c $(CC) $(CC1) -WE $(CC2)$@ os_w32exe.c $(OBJDIR): ! -@if not exist $(OBJDIR)\nul mkdir $(OSTYPE) -@if not exist $(OBJDIR)\nul mkdir $(OBJDIR) $(OBJDIR)\if_perl.obj: if_perl.c *************** *** 551,561 **** $(PERLLIB)\ExtUtils\typemap if_perl.xs > $@ vim.res: vim.rc version.h tools.bmp tearoff.bmp vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico ! $(BRC) $(DEFINES) -i $(BOR)\include -32 -r $*.rc # vimrun.exe: vimrun.exe: vimrun.c ! !if $d(USEDLL) $(BOR)\BIN\BCC32 -WC -O1 -I$(INCLUDE) -D_RTLDLL vimrun.c cw32mti.lib !else $(BOR)\BIN\BCC32 -WC -O1 -I$(INCLUDE) vimrun.c --- 585,595 ---- $(PERLLIB)\ExtUtils\typemap if_perl.xs > $@ vim.res: vim.rc version.h tools.bmp tearoff.bmp vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico ! $(BRC) $(DEFINES) -i $(BOR)\include -w32 -r $*.rc # vimrun.exe: vimrun.exe: vimrun.c ! !if ($(USEDLL)==1) $(BOR)\BIN\BCC32 -WC -O1 -I$(INCLUDE) -D_RTLDLL vimrun.c cw32mti.lib !else $(BOR)\BIN\BCC32 -WC -O1 -I$(INCLUDE) vimrun.c *** ../vim-5.6.72/src/dosinst.c Fri Mar 31 10:57:17 2000 --- src/dosinst.c Thu Jun 1 18:34:23 2000 *************** *** 47,52 **** --- 47,63 ---- #endif /* + * The toupper() in Bcc 5.5 doesn't work, use our own implementation. + */ + static int + mytoupper(int c) + { + if (c >= 'a' && c <= 'z') + return c - 'a' + 'A'; + return c; + } + + /* * Return TRUE if the user types a 'y' or 'Y', FALSE otherwise. * Eats white space first. */ *************** *** 55,61 **** { char answer[10]; ! return (scanf(" %c", answer) == 1 && toupper(answer[0]) == 'Y'); } /* --- 66,72 ---- { char answer[10]; ! return (scanf(" %c", answer) == 1 && mytoupper(answer[0]) == 'Y'); } /* *************** *** 145,151 **** return 0; if (path[1] == ':') /* has a drive name */ { ! if (change_drive(tolower(path[0]) - 'a' + 1)) return -1; /* invalid drive name */ path += 2; } --- 156,162 ---- return 0; if (path[1] == ':') /* has a drive name */ { ! if (change_drive(mytoupper(path[0]) - 'A' + 1)) return -1; /* invalid drive name */ path += 2; } *************** *** 274,279 **** --- 285,291 ---- } } + # ifndef __BORLANDC__ char * searchpath(char *name) { *************** *** 303,308 **** --- 315,321 ---- } return NULL; } + # endif #endif /* *************** *** 551,557 **** { for (i = 0; i < vimdirend - 1; ++i) { ! if (toupper(p[i]) == toupper(vimdir[i])) continue; if ((p[i] == '/' || p[i] == '\\') && (vimdir[i] == '/' || vimdir[i] == '\\')) --- 564,570 ---- { for (i = 0; i < vimdirend - 1; ++i) { ! if (mytoupper(p[i]) == mytoupper(vimdir[i])) continue; if ((p[i] == '/' || p[i] == '\\') && (vimdir[i] == '/' || vimdir[i] == '\\')) *************** *** 575,581 **** { for (i = 0; p[i] || vimdir[i]; ++i) { ! if (toupper(p[i]) == toupper(vimdir[i])) continue; if ((p[i] == '/' || p[i] == '\\') && (vimdir[i] == '/' || vimdir[i] == '\\')) --- 588,594 ---- { for (i = 0; p[i] || vimdir[i]; ++i) { ! if (mytoupper(p[i]) == mytoupper(vimdir[i])) continue; if ((p[i] == '/' || p[i] == '\\') && (vimdir[i] == '/' || vimdir[i] == '\\')) *** ../vim-5.6.72/src/version.c Tue May 9 21:46:26 2000 --- src/version.c Thu Jun 1 18:18:34 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 73, /**/ -- Dogs must have a permit signed by the mayor in order to congregate in groups of three or more on private property. [real standing law in Oklahoma, United States of America] /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\ \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/