D From:	MX%"roberts@nsrl31.nsrl.rochester.edu"  3-DEC-1993 15:17:09.03 To:	GOATHUNTER CC:	% Subj:	VMS GNU grep v2.0, mods for gcc   0 Return-Path: <roberts@nsrl31.nsrl.rochester.edu>O Received: from wkuvx1.wku.edu by alpha.wku.edu (MX V3.3 AXP) with SMTP; Fri, 03            Dec 1993 15:17:03 CST M Received: from nsvs35.nsrl.rochester.edu by wkuvx1.wku.edu (MX V3.3 VAX) with -           SMTP; Fri, 03 Dec 1993 15:15:24 CDT N Received: by nsrl31.nsrl.rochester.edu (MX V3.3 VAX) id 4037; Fri, 03 Dec 1993           16:11:05 EST# Date: Fri, 03 Dec 1993 16:10:54 EST : From: Roland B Roberts <roberts@nsrl31.nsrl.rochester.edu> To: goathunter@WKUVX1.WKU.EDU ( Subject: VMS GNU grep v2.0, mods for gcc   Hunter,   G I'm attaching a set of patches for GNU grep v2.0 to allow it to compile G under gcc (I'm running VMS 5.5-2, gcc 2.3.3, VAXC 3.2); it still builds  fine with VAXC.   3 Here is a description of why the changes were made:   D dfa.c: loading stdlib.h gets several prototypes that silence warningF     errors.  However, the gcc header includes a prototype to delete();H     therefore, the local function conflicts.  The cure was a "temporary"#     define when stdlib.h is loaded.   H getpagesize.h: I haven't quite figured out the logic in the #ifdefs, but@     gcc ends up definining getpagesize() twice---the second time.     catching the "#define getpagesize() 8192".  > regex.c: gcc has the bstring functions as builtins; therefore,+     #define-ing these as macros is no good.   A shell_mung.c: stdlib.h eliminates some warning errors.  Also, the G     GLOBALDEF macros are needed for gcc.  I initializes gopher_setup to      FALSE, just like for VAXC.  D vmsmake.com: I eliminated the HAVE_STRING_H so the includes will useF     strings.h.  This eliminates some errors, and avoids conflicts withA     the bstring functions in regex.c.  I also added a "define sys F     sys$library" so this still works for VAXC.  The "lib=..." picks upF     gcclib for gcc.  I changes "say" to "write sys$output", the symbol     was undefined.  A [.tests]vmsregress.com: `diff' is ambiguous is the unix-like diff <     command is defined (it is on our system).  In this case,E     vmsregress.com erroneously reports a failure on the khadafy test.   F The context diffs follow.  If another format is better for you, let me know....   roland --O Roland B Roberts                          Nuclear Structure Research Laboratory O roberts@uornsrl.bitnet                                      271 East River Road O roberts@nsrl.rochester.edu                                  Rochester, NY 14627 O --                                                               (716) 275-8962 0 I'm job hunting; tips and leads are appreciated!     $ diff -c dfa.c-orig dfa.c *** dfa.c-orig	 --- dfa.c  **************	 *** 23,28    #include <stdio.h>      #ifdef STDC_HEADERS    #include <stdlib.h>    #else    #include <sys/types.h> --- 23,30 -----    #include <stdio.h>      #ifdef STDC_HEADERS  + #ifdef VMS + #define delete sys_delete    #include <stdlib.h>    #undef delete    #else  **************	 *** 24,29       #ifdef STDC_HEADERS    #include <stdlib.h>    #else    #include <sys/types.h>/   extern char *calloc(), *malloc(), *realloc();  --- 26,35 -----    #ifdef VMS   #define delete sys_delete    #include <stdlib.h>  + #undef delete  + #else  + #include <stdlib.h>  + #endif /* VMS */   #else    #include <sys/types.h>/   extern char *calloc(), *malloc(), *realloc();    *** getpagesize.h-orig --- getpagesize.h  ************** *** 7,12   #ifndef HAVE_GETPAGESIZE      #ifdef VMS   #define getpagesize() 512    #endif    --- 7,15 -----   #ifndef HAVE_GETPAGESIZE      #ifdef VMS + #ifdef __GNUC__  + #define HAVE_SYS_PARAM_H + #else    #define getpagesize() 512    #endif   #endif ************** *** 8,13      #ifdef VMS   #define getpagesize() 512    #endif      #ifdef HAVE_UNISTD_H --- 11,17 -----    #define HAVE_SYS_PARAM_H   #else    #define getpagesize() 512  + #endif   #endif      #ifdef HAVE_UNISTD_H   *** regex.c-orig --- regex.c  **************	 *** 48,54    F   /* We used to test for `BSTRING' here, but only GCC and Emacs defineH      `BSTRING', as far as I know, and neither of them use this code.  */# ! #if HAVE_STRING_H || STDC_HEADERS    #include <string.h>    #ifndef bcmp2   #define bcmp(s1, s2, n)	memcmp ((s1), (s2), (n)) --- 48,54 -----    F   /* We used to test for `BSTRING' here, but only GCC and Emacs defineH      `BSTRING', as far as I know, and neither of them use this code.  */9 ! #if HAVE_STRING_H || STDC_HEADERS && !defined(__GNUC__)    #include <string.h>    #ifndef bcmp2   #define bcmp(s1, s2, n)	memcmp ((s1), (s2), (n))   *** shell_mung.c-orig  --- shell_mung.c ************** *** 140,145    #include <errno.h>   #include <stdio.h>   #include <string.h>       #include <fab.h>   #include <nam.h> --- 140,146 -----    #include <errno.h>   #include <stdio.h>   #include <string.h>  + #include <stdlib.h>       #include <fab.h>   #include <nam.h> ************** *** 145,150    #include <nam.h>   #include <rmsdef.h>    #include <stsdef.h>        #ifndef VAXC				/* v1.2-004 */E   #define _tolower(c)     ((c) >= 'A' && (c) <= 'Z' ? (c) | 0x20:(c))  --- 146,154 -----    #include <nam.h>   #include <rmsdef.h>    #include <stsdef.h>  + #ifdef __GNUC__  + #include <gnu_hacks.h> + #endif       #ifndef VAXC				/* v1.2-004 */E   #define _tolower(c)     ((c) >= 'A' && (c) <= 'Z' ? (c) | 0x20:(c))  ************** *** 174,179     */    #ifdef VAXC				/* v1.2-004 */ 4   globaldef char shell_default[NAM$C_MAXRSS+1] = "";#   static char gopher_setup = FALSE;    #else *   char shell_default[NAM$C_MAXRSS+1] = ""; --- 178,187 -----     */    #ifdef VAXC				/* v1.2-004 */ 4   globaldef char shell_default[NAM$C_MAXRSS+1] = "";# + static char gopher_setup = FALSE;  + #elif __GNUC__' + typedef char charvec[NAM$C_MAXRSS+1]; ' + GLOBALDEF(charvec,shell_default,{0}); #   static char gopher_setup = FALSE;    #else *   char shell_default[NAM$C_MAXRSS+1] = "";   *** vmsmake.com-orig --- vmsmake.com  ************** *** 2,9    $!B   $!  VMSMAKE.COM - DCL command procedure to build GNU grep on VMS   $!$ ! $!  To use VAX C, define CC = "CC"% ! $!  To use GNU C, define CC = "GCC"    $!&   $ axp = f$getsyi("HW_MODEL").ge.1024>   $ CC = "CC/DEFINE=(HAVE_STRING_H,HAVE_MEMCHR,HAVE_STRERROR)"
 --- 2,9 -----    $!B   $!  VMSMAKE.COM - DCL command procedure to build GNU grep on VMS   $! ! $!  Uses VAXC by default3 ! $!  To use GNU C, run this file as `@vmsmake gcc'    $!&   $ axp = f$getsyi("HW_MODEL").ge.1024   $ if p1 .eqs. "GCC"  ************** *** 6,12%   $!  To use GNU C, define CC = "GCC"    $!&   $ axp = f$getsyi("HW_MODEL").ge.1024> ! $ CC = "CC/DEFINE=(HAVE_STRING_H,HAVE_MEMCHR,HAVE_STRERROR)"*   $ if axp then cc = "''cc'/STANDARD=VAXC"   $ call compile_it GREP.C   $ call compile_it ALLOCA.C --- 6,20 -----3   $!  To use GNU C, run this file as `@vmsmake gcc'    $!&   $ axp = f$getsyi("HW_MODEL").ge.1024 ! $ if p1 .eqs. "GCC"  ! $ then@ ! $   cc = "GCC/DEFINE=(HAVE_MEMCHR,HAVE_STRERROR,STDC_HEADERS)"( ! $   lib = "gnu_cc:[000000]gcclib/lib," ! $ else@ ! $   CC = "CC/DEFINE=(HAVE_STRING_H,HAVE_MEMCHR,HAVE_STRERROR)" ! $   lib = "" ! $   define sys sys$library	 ! $ endif *   $ if axp then cc = "''cc'/STANDARD=VAXC"   $ call compile_it GREP.C   $ call compile_it ALLOCA.C **************	 *** 20,26 '   $ write sys$output "Linking GREP...." 
   $ if axp<   $ then	link/notrace grep.olb/include=(grep,search)/libraryN ! $ else	link/notrace grep.olb/include=(grep,search)/library,sys$input/options   sys$share:vaxcrtl.exe/share 	   $ endif !   $ say "Generating on-line help"  --- 28,34 ----- '   $ write sys$output "Linking GREP...." 
   $ if axp<   $ then	link/notrace grep.olb/include=(grep,search)/libraryS ! $ else	link/notrace grep.olb/include=(grep,search)/library,'lib'sys$input/options    sys$share:vaxcrtl.exe/share 	   $ endif /   $ if f$trnlnm("SYS").nes."" then deassign sys  **************	 *** 23,29 N   $ else	link/notrace grep.olb/include=(grep,search)/library,sys$input/options   sys$share:vaxcrtl.exe/shareo	   $ endif"! ! $ say "Generating on-line help"U   $ runoff grep.rnh    $ say "Build completed" #   $ exit 1.or.f$verify(save_verify). --- 31,38 -----eS   $ else	link/notrace grep.olb/include=(grep,search)/library,'lib'sys$input/options    sys$share:vaxcrtl.exe/sharee	   $ endifn/ ! $ if f$trnlnm("SYS").nes."" then deassign sys.. ! $ write sys$output "Generating on-line help"   $ runoff grep.rnhd&   $ write sys$output "Build completed"#   $ exit 1.or.f$verify(save_verify)  **************	 *** 25,31,	   $ endif3!   $ say "Generating on-line help"r   $ runoff grep.rnhr ! $ say "Build completed"u#   $ exit 1.or.f$verify(save_verify)U   $ Compile_It: SUBROUTINE,   $   write sys$output "Compiling ''p1'...." --- 34,40 ----- /   $ if f$trnlnm("SYS").nes."" then deassign sys5.   $ write sys$output "Generating on-line help"   $ runoff grep.rnhe& ! $ write sys$output "Build completed"#   $ exit 1.or.f$verify(save_verify)e   $ Compile_It: SUBROUTINE,   $   write sys$output "Compiling ''p1'...."   *** [.tests]vmsregress.com-origt< --- NSRL31$DUA0:[USERSITE1.TOOLS.GREP.TESTS]VMSREGRESS.COM;1 **************	 *** 18,24e   $!   $ define/user sys$output nl:   $ define/user sys$error nl:o" ! $ diff khadafy.lines khadafy.out   $ if $status.eq.%X006C80099   $ then	write sys$output "egrep passed the khadafy test"    $	delete/nolog khadafy.out;: --- 18,24 -----i   $!   $ define/user sys$output nl:   $ define/user sys$error nl: ) ! $ differences khadafy.lines khadafy.outi   $ if $status.eq.%X006C80099   $ then	write sys$output "egrep passed the khadafy test"a   $	delete/nolog khadafy.out;S $ deassign sys$output 