From:	CSBVAX::CSBVAX::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 19-NOV-1988 08:03
To:	MRGATE::"ARISIA::EVERHART"
Subj:	GAWK diffs


Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Wed, 16 NOV 88 00:28:26 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Wed, 16 Nov 88 00:09:40 PST
Received: by ucbvax.Berkeley.EDU (5.59/1.31)
	id AA25536; Sun, 13 Nov 88 21:35:59 PST
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 11 Nov 88 22:48:49 GMT
From: unmvax!nmtsun!warner%hydrovax.nmt.edu@ucbvax.Berkeley.EDU  (M. Warner Losh)
Organization: New Mexico Tech Hydrology Program
Subject: GAWK diffs
Message-Id: <1429@nmtsun.nmt.edu>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

About three weeks ago, I asked if I should post the diffs to GAWK to this
news group/mailing list.  So far, my mail is 10 to 1 in favor of posting 
the diffs, so that's what I'm about to do.  Many thanks to all of you that
have asked for the GAWK stuff.  If all goes well, the whole thing will be 
on the DECUS tape this fall.  I am only posting the VMS-style diffs to the
program.  The distribution of gawk can be found at prep.ai.mit.edu or
cis.ohio-state.edu for retrieval via anonymous FTP.  I toyed with the
idea of posting the whole thing to the net, but desided against it when I 
discovered that it would have come in 19 parts.  So that is obviously out.

All of the diffs fit into one VMS_SHARE file of 25 blocks.  That is small 
enough to post to the net.  So with out much further fanfare, here are the
diffs to GAWK to make it work on VMS 4.5 running VAX-11 C V2.2.  Your
milage may vary.
--
Warner Losh
warner@hydrovax.nmt.edu		...!unmvax!nmtsun!warner%hydrovax
My spelling and views are my own.  Only the letters have been changed...

$!..................... Cut between dotted lines and save. ....................
$!.............................................................................
$! VAX/VMS archive file created by VMS_SHARE V06.03 20-Oct-1988.
$!
$! VMS_SHARE was written by James Gray (Gray:OSBUSouth@Xerox.COM) from
$! VMS_SHAR by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au).
$!
$! To unpack, simply save, concatinate all parts into one file and
$! execute (@) that file.
$!
$! This archive was created by user WARNER
$! on 11-NOV-1988 15:48:00.90.
$!
$! It contains the following 10 files:
$!        ALLOCA.MAR	From GCC bootstrap for VMS
$!        AWK.H-DIFF
$!        AWK2.C-DIFF
$!        BCMP.MAR	From GCC bootstrap for VMS
$!        BCOPY.MAR	From GCC bootstrap for VMS
$!        BZERO.MAR	From GCC bootstrap for VMS
$!        CLINK.OPT
$!        MAKE-GAWK.COM
$!        README.VMS
$!        VMS-PORT.C
$!
$!=============================================================================
$ SET SYMBOL/SCOPE=( NOLOCAL, NOGLOBAL )
$ VERSION = F$GETSYI( "VERSION" )
$ IF VERSION .GES "V4.4" THEN GOTO VERSION_OK
$ WRITE SYS$OUTPUT "You are running VMS ''VERSION'; ", -
    "VMS_SHARE V06.03 20-Oct-1988 requires VMS V4.4 or higher."
$ EXIT 44 
$VERSION_OK:
$ GOTO START
$
$UNPACK_FILE:
$ WRITE SYS$OUTPUT "Creating ''FILE_IS'"
$ DEFINE/USER_MODE SYS$OUTPUT NL:
$ EDIT/TPU/COMMAND=SYS$INPUT/NODISPLAY/OUTPUT='FILE_IS'/NOSECTION -
    VMS_SHARE_DUMMY.DUMMY

b_part := CREATE_BUFFER( "{Part}", GET_INFO( COMMAND_LINE, "file_name" ) );
s_file_spec := GET_INFO( COMMAND_LINE, "output_file" );SET( OUTPUT_FILE
, b_part, s_file_spec ); 
b_errors := CREATE_BUFFER( "{Errors}" );i_errors := 0; 
pat_beg_1 := ANCHOR & "-+-+-+ Beginning";
pat_beg_2 := LINE_BEGIN & "+-+-+-+ Beginning";
pat_end := ANCHOR & "+-+-+-+-+ End";
pat_trail := " " & LINE_END;POSITION( BEGINNING_OF( b_part ) ); LOOP b 
:= SEARCH( pat_trail, FORWARD); EXITIF b=0; POSITION( END_OF( b ) )
; LOOP MOVE_HORIZONTAL( -1 ); EXITIF CURRENT_CHARACTER <> ' '; ERASE_CHARACTER
( 1 ); EXITIF CURRENT_OFFSET=0; ENDLOOP; ENDLOOP; POSITION( BEGINNING_OF
( b_part ) ); i_append_line := 0; LOOP EXITIF MARK( NONE ) = END_OF( b_part )
; s_x := ERASE_CHARACTER( 1 ); 
  IF s_x = "+" THEN r_skip := SEARCH( pat_beg_1, FORWARD, EXACT ); IF r_skip <
> 0 THEN 
      s_x := ""; MOVE_HORIZONTAL( -CURRENT_OFFSET ); ERASE_LINE; ENDIF; ENDIF; 
  IF s_x = "-" THEN r_skip := SEARCH( pat_end, FORWARD, EXACT ); IF r_skip <
> 0 THEN 
      s_x := ""; MOVE_HORIZONTAL( -CURRENT_OFFSET ); m_skip := MARK( NONE )
; r_skip := SEARCH( pat_beg_2, FORWARD, EXACT ); IF r_skip <> 0 THEN POSITION
( END_OF( r_skip ) ); MOVE_HORIZONTAL( -CURRENT_OFFSET ); MOVE_VERTICAL( 1 )
; MOVE_HORIZONTAL( -1 ); ELSE POSITION( END_OF( b_part ) ); ENDIF; ERASE
( CREATE_RANGE( m_skip, MARK( NONE ), NONE ) ); ENDIF; ENDIF; 
  IF s_x = "V" THEN 
    s_x := ""; IF i_append_line <> 0 THEN APPEND_LINE; MOVE_HORIZONTAL
( -CURRENT_OFFSET ); ENDIF; i_append_line := 1; MOVE_VERTICAL( 1 ); ENDIF; 
  IF s_x = "X" THEN 
    s_x := ""; IF i_append_line <> 0 THEN APPEND_LINE; MOVE_HORIZONTAL
( -CURRENT_OFFSET ); ENDIF; i_append_line := 0; MOVE_VERTICAL( 1 ); ENDIF; 
  IF s_x <> "" THEN i_errors := i_errors + 1; s_text := CURRENT_LINE; POSITION
( b_errors ); 
    COPY_TEXT( "The following line could not be unpacked properly:" )
; SPLIT_LINE; COPY_TEXT( s_x ); COPY_TEXT( s_text ); POSITION( b_part )
; MOVE_VERTICAL( 1 ); ENDIF; ENDLOOP; POSITION( BEGINNING_OF( b_part ) ); LOOP 
  r_x := SEARCH( "`", FORWARD, EXACT ); EXITIF r_x = 0; POSITION( r_x )
; ERASE_CHARACTER( 1 ); 
  IF CURRENT_CHARACTER = "`" THEN MOVE_HORIZONTAL( 1 ); ELSE COPY_TEXT( ASCII
( INT( ERASE_CHARACTER( 3 ) ) ) ); ENDIF; ENDLOOP; IF i_errors = 0 THEN SET
( NO_WRITE, b_errors, ON ); ELSE POSITION( BEGINNING_OF( b_errors ) ); 
  COPY_TEXT( FAO( "The following !UL errors were detected while unpacking !AS"
, i_errors, s_file_spec ) ); SPLIT_LINE; 
  SET( OUTPUT_FILE, b_errors, "SYS$COMMAND" );ENDIF; EXIT; 
$ DELETE VMS_SHARE_DUMMY.DUMMY;*
$ CHECKSUM 'FILE_IS
$ WRITE SYS$OUTPUT " CHECKSUM ", -
  F$ELEMENT( CHECKSUM_IS .EQ. CHECKSUM$CHECKSUM, ",", "failed!,passed." )
$ RETURN
$
$START:
$ FILE_IS = "ALLOCA.MAR"
$ CHECKSUM_IS = 7999314
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X`009.TITLE`009ALLOCA`009Allocate dynamic storage on stack/free on return
X`009.IDENT`009/1.00/
X
X`009.PSECT`009$CODE,LONG,PIC,REL,SHR,EXE,RD,NOWRT
X`009.ENTRY`009ALLOCA,`094M<>
X`009SUBL2`0094(AP),SP
X`009MOVL`00916(FP),R1
X`009MOVQ`0098(FP),AP
X`009BICL2`009#3,SP
X`009ADDL2`009#28,SP
X`009MOVL`009SP,R0
X`009JMP `009(R1)
X
X`009.END
$ GOSUB UNPACK_FILE
$ FILE_IS = "AWK.H-DIFF"
$ CHECKSUM_IS = 1767329072
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X************
XFile USER:[WARNER.SRC.AWK.ORG]AWK.H;1
X   35   char *malloc(),*realloc();
X******
XFile USER:[WARNER.SRC.AWK]AWK.H;2
X   35   #ifdef VMS`009`009/* Needed for VAX C 2.2, but not 2.3... */
X   36   #define exit(x) vms_exit(x)
X   37   #endif
X   38  `032
X   39   char *malloc(),*realloc();
X************
X
XNumber of difference sections found: 1
XNumber of difference records found: 4
X
XDIFFERENCES /IGNORE=()/MERGED=1/OUTPUT=USER:[WARNER.SRC.AWK.ORG]AWK.H-DIFF;1-
X    USER:[WARNER.SRC.AWK.ORG]AWK.H;1-
X    USER:[WARNER.SRC.AWK]AWK.H;2
$ GOSUB UNPACK_FILE
$ FILE_IS = "AWK2.C-DIFF"
$ CHECKSUM_IS = 73745698
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X************
XFile USER:[WARNER.SRC.AWK.ORG]AWK2.C;1
X   36   #include "awk.h"
X******
XFile USER:[WARNER.SRC.AWK]AWK2.C;4
X   36   # ifdef VMS
X   37   #define Generic char
X   38   #define _setjmp setjmp
X   39   #define _longjmp longjmp
X   40   # else
X   41   #define Generic void
X   42   # endif
X   43  `032
X   44   #include "awk.h"
X************
X************
XFile USER:[WARNER.SRC.AWK.ORG]AWK2.C;1
X  983   `009`009`009free((void *)bucket);
X  984   `009`009`125
X******
XFile USER:[WARNER.SRC.AWK]AWK2.C;4
X  991   `009`009`009free((Generic *)bucket);
X  992   `009`009`125
X************
X
XNumber of difference sections found: 2
XNumber of difference records found: 9
X
XDIFFERENCES /IGNORE=()/MERGED=1/OUTPUT=USER:[WARNER.SRC.AWK.ORG]AWK2.C-DIFF;1-
X    USER:[WARNER.SRC.AWK.ORG]AWK2.C;1-
X    USER:[WARNER.SRC.AWK]AWK2.C;4
$ GOSUB UNPACK_FILE
$ FILE_IS = "BCMP.MAR"
$ CHECKSUM_IS = 24650371
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X`009.TITLE`009BCMP`009Compare 2 strings of bytes
X`009.IDENT`009/1.00/
X
X
X
X`009.PSECT`009$CODE,LONG,PIC,REL,SHR,EXE,RD,NOWRT
X
X; bcmp(s1, s2, n)
X
X`009.ENTRY`009BCMP,`094M<R2,R3,R4,R5>
X`009MOVL`0094(AP),R1
X`009MOVL`0098(AP),R3
X`009MOVL`00912(AP),R4
X1$:
X`009MOVZWL`009#65535,R0
X`009CMPL`009R4,R0
X`009BLEQ`0092$
X`009SUBL2`009R0,R4
X`009CMPC3`009R0,(R1),(R3)
X`009BEQL`0091$
X`009ADDL2`009R4,R0
X`009RET
X2$:
X`009CMPC3`009R4,(R1),(R3)
X`009RET
X
X`009.END
$ GOSUB UNPACK_FILE
$ FILE_IS = "BCOPY.MAR"
$ CHECKSUM_IS = 136364532
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X`009.TITLE`009BCOPY`009Copy bytes from one array to another
X`009.IDENT`009/1.00/
X
X`009.PSECT`009$CODE,LONG,PIC,REL,SHR,EXE,RD,NOWRT
X
X; bcopy(from, to, size)
X
X`009.ENTRY`009BCOPY,`094M<R2,R3,R4,R5,R6>
X`009MOVL`0094(AP),R1
X`009MOVL`0098(AP),R3
X`009MOVL`00912(AP),R6
X`009CMPL`009R1,R3
X`009BGTR`0092$`009`009; NORMAL FORWARD CASE
X`009BLSS`0093$`009`009; OVERLAPPING, MUST DO BACKWARDS
X`009RET`009`009`009; EQUAL, NOTHING TO DO
X1$:
X`009SUBL2`009R0,R6
X`009MOVC3`009R0,(R1),(R3)
X2$:
X`009MOVZWL`009#65535,R0
X`009CMPL`009R6,R0
X`009BGTR`0091$
X`009MOVC3`009R6,(R1),(R3)
X`009RET
X3$:
X`009ADDL2`009R6,R1
X`009ADDL2`009R6,R3
X`009MOVZWL`009#65535,R0
X`009BRW`0095$
X4$:
X`009SUBL2`009R0,R6
X`009SUBL2`009R0,R1
X`009SUBL2`009R0,R3
X`009MOVC3`009R0,(R1),(R3)
X`009MOVZWL`009#65535,R0
X`009SUBL2`009R0,R1
X`009SUBL2`009R0,R3
X5$:
X`009CMPL`009R6,R0
X`009BGTR`0094$
X`009SUBL2`009R6,R1
X`009SUBL2`009R6,R3
X`009MOVC3`009R6,(R1),(R3)
X`009RET
X
X`009.END
$ GOSUB UNPACK_FILE
$ FILE_IS = "BZERO.MAR"
$ CHECKSUM_IS = 137252688
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X`009.TITLE`009BZERO`009Zero out an array of bytes
X`009.IDENT`009/1.00/
X
X`009.PSECT`009$CODE,LONG,PIC,REL,SHR,EXE,RD,NOWRT
X
X; bzero(ptr, size)
X
X`009.ENTRY`009BZERO,`094M<R2,R3,R4,R5>
X`009MOVL`0094(AP),R3
X`009BRB`0092$
X1$:
X`009SUBL2`009R0,8(AP)
X`009MOVC5`009#0,(R3),#0,R0,(R3)
X2$:
X`009MOVZWL`009#65535,R0
X`009CMPL`0098(AP),R0
X`009BGTR`0091$
X`009MOVC5`009#0,(R3),#0,8(AP),(R3)
X`009RET
X
X`009.END
$ GOSUB UNPACK_FILE
$ FILE_IS = "CLINK.OPT"
$ CHECKSUM_IS = 1392527948
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
Xsys$share:vaxcrtl.exe/share
$ GOSUB UNPACK_FILE
$ FILE_IS = "MAKE-GAWK.COM"
$ CHECKSUM_IS = 1398514891
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X$`009DEFINE VAXC$INCLUDE 'F$ENVIRONMENT("DEFAULT")',SYS$LIBRARY/nolog
X$`009IF`009F$SEARCH (F$PARSE ("GCCLIB", "GCCLIB.OLB")) .NES. "" -
X`009THEN`009GOTO LibOk
X$`009IF`009F$SEARCH ("[]ALLOCA.MAR") .EQS. "" -
X`009THEN`009GOTO NoWay
X$`009MACRO`009ALLOCA.MAR
X$`009MACRO`009BZERO.MAR
X$`009MACRO`009BCMP.MAR
X$`009MACRO`009BCOPY.MAR
X$`009LIBRARY/CREATE []GCCLIB ALLOCA,BZERO,BCMP,BCOPY
X$`009DELETE`009ALLOCA.OBJ;
X$`009DELETE`009BZERO.OBJ;
X$`009DELETE`009BCMP.OBJ;
X$`009DELETE`009BCOPY.OBJ;
X$`009GOTO LibOk
X$ No_Way:
X$`009TYPE SYS$INPUT
X
X`009I can't seem to find GCCLIB.  Please define the logical GCCLIB to point
Xto that library.  It comes from the VMS bootstrap tape.  You need it for
Xsome of the berekely-isms that gawk uses.
X
X$`009EXIT
X$ LibOk:
X$`009IF`009P1 .EQS. "LINK" -
X`009THEN`009GOTO LinkIt
X$`009mycc :== cc`009`009! Change to GCC for gcc.
X$`009mycc awk1
X$`009mycc awk2
X$`009mycc awk3
X$`009mycc awk_tab
X$`009mycc debug
X$`009mycc version
X$`009mycc regex
X$`009mycc obstack
X$`009mycc vms-port
X$ LinkIt:
X$`009LINK/exe=gawk awk1,awk2,awk3,awk_tab,debug,regex,obstack,vms-port,-
X`009`009gcclib/lib,[]clink/opt
X$
$ GOSUB UNPACK_FILE
$ FILE_IS = "README.VMS"
$ CHECKSUM_IS = 86785999
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
XThe VMS GAWK port was done by M. Warner Losh at the New Mexico
XInstitute of Mininng and Technology.  Included here are the diff that
Xare needed to make GAWK work on VMS 4.5 using VAX-C 2.2.  If you have
Xa later version of VMS/VAX-C all should be ok, but this has not been
Xtested, so use it at your own risk.  All of the functionality of GAWK
Xappears to work, except for pipes (but including redirects).  Since
XVMS does not support pipes very well, I wasn't sure as to how to
Ximplement this.
X
XI don't have any documentation on GAWK, I don't know if it is awk-like
Xor nawk-like.  If someone does come up with some documentation, I'd
Xlike a copy.
X
XThere are three new files plus a couple of minor changes to the
Xoriginal files.  MAKE-GAWK.COM should make gawk on your system.  It
Xuses a file called CLINK.OPT to link in the sharable version of the
X'C' runtime library.  The final new file is VMS-PORT.C.  It contains
Xall of the functions that are needed to make this run under VMS.  Also
Xneeded, but not included in this distribution is the GCCLIB library
Xfrom the GCC compiler.  GAWK wants some of the berkeleyism that are in
Xthis library.  Specifically: bcmp, bcopy, bzero and alloca.  I have
Xincluded code for these.
X
XAll of the sources for this were obtained from cis.ohio-state.edu via
Xanonymous FTP.  The diffs are for "verison 1.03 (I think)".  Newer
Xversions should require little or no effort to get working.
X
$ GOSUB UNPACK_FILE
$ FILE_IS = "VMS-PORT.C"
$ CHECKSUM_IS = 739015048
$ COPY SYS$INPUT VMS_SHARE_DUMMY.DUMMY
X# include <stdio.h>
X# include <ssdef.h>
X`009
X/*
X *    Simulate the popen command on VMS.  For now just always fail.  Maybe
X * someome can figure out how to do this correctly in the future....
X */
X
XFILE *popen (name, mode)
Xchar *name;
Xchar *mode;
X`123
X`009return (FILE *) NULL;
X`125
X
X/*
X *`009Simulate the UNIX exit command.  If zero then exit SS$_NORMAL,
X * else exit SS$_ABORT.
X */
X
Xvms_exit(x)
Xint x;
X`123
X`009if (x == 0)
X`009`009exit (SS$_NORMAL);
X`009exit (SS$_ABORT);
X`125
$ GOSUB UNPACK_FILE
$ EXIT

