Thread View: comp.sources.reviewed
1 messages
1 total messages
Started by Mike Brennan
Tue, 13 Oct 1992 22:13
v02i029: mawk - (Ver. 1.1) An interpreter for the AWK language, Patch02b/4
Author: Mike Brennan
Date: Tue, 13 Oct 1992 22:13
Date: Tue, 13 Oct 1992 22:13
2421 lines
64226 bytes
64226 bytes
Submitted-by: Mike Brennan <brennan@boeing.com>
Posting-number: Volume 2, Issue 29
Archive-name: mawk/patch02b
Patch-To: mawk: Volume 1, Issue 50-68
#!/bin/sh
# this is part.02 (part 2 of a multipart archive)
# do not concatenate these parts, unpack them in order with /bin/sh
# file diffs2 continued
#
if test ! -r _shar_seq_.tmp; then
echo 'Please unpack part 1 first!'
exit 1
fi
(read Scheck
if test "$Scheck" != 2; then
echo Please unpack part "$Scheck" next!
exit 1
else
exit 0
fi
) < _shar_seq_.tmp || exit 1
if test ! -f _shar_wnt_.tmp; then
echo 'x - still skipping diffs2'
else
echo 'x - continuing file diffs2'
sed 's/^X//' << 'SHAR_EOF' >> 'diffs2' &&
X sizes.h
! copyright 1991, Michael D. Brennan
X
X This is a source file for mawk, an implementation of
--- 2,6 ----
X /********************************************
X sizes.h
! copyright 1991, 1992. Michael D. Brennan
X
X This is a source file for mawk, an implementation of
***************
*** 11,18 ****
X ********************************************/
X
! /* $Log: sizes.h,v $
! * Revision 5.1 91/12/05 07:59:35 brennan
X * 1.1 pre-release
! *
X */
X
--- 11,21 ----
X ********************************************/
X
! /* $Log: sizes.h,v $
! * Revision 5.2 1992/08/27 03:20:08 mike
! * patch2: increase A_HASH_PRIME
! *
! * Revision 5.1 1991/12/05 07:59:35 brennan
X * 1.1 pre-release
! *
X */
X
***************
*** 23,27 ****
X
X #if ! HAVE_SMALL_MEMORY
! #define EVAL_STACK_SIZE 256 /* limit on recursion */
X /* number of fields at startup, must be a power of 2
X and FBANK_SZ-1 must be divisible by 3! */
--- 26,30 ----
X
X #if ! HAVE_SMALL_MEMORY
! #define EVAL_STACK_SIZE 256 /* initial size , can grow */
X /* number of fields at startup, must be a power of 2
X and FBANK_SZ-1 must be divisible by 3! */
***************
*** 50,54 ****
X
X #define HASH_PRIME 53
! #define A_HASH_PRIME 37
X
X
--- 53,62 ----
X
X #define HASH_PRIME 53
!
! #if ! HAVE_SMALL_MEMORY
! #define A_HASH_PRIME 199
! #else
! #define A_HASH_PRIME 37
! #endif
X
X
*** mawk/split.c Tue Mar 3 17:23:48 1992
--- mawk112/split.c Wed Jul 8 14:16:36 1992
***************
*** 11,18 ****
X ********************************************/
X
! /* $Log: split.c,v $
! * Revision 5.1 91/12/05 07:56:31 brennan
X * 1.1 pre-release
! *
X */
X
--- 11,24 ----
X ********************************************/
X
! /* $Log: split.c,v $
! * Revision 5.2 1992/07/08 21:19:09 brennan
! * patch2
! * change in split() requires that
! * bi_split() call load_array() even
! * when cnt is 0.
! *
! * Revision 5.1 1991/12/05 07:56:31 brennan
X * 1.1 pre-release
! *
X */
X
***************
*** 219,227 ****
X
X if ( string(sp)->len == 0 ) /* nothing to split */
! { free_STRING( string(sp) ) ;
! sp->type = C_DOUBLE ; sp->dval = 0.0 ;
! return sp ;
! }
!
X switch ( (sp+2)->type )
X {
--- 225,230 ----
X
X if ( string(sp)->len == 0 ) /* nothing to split */
! cnt = 0 ;
! else
X switch ( (sp+2)->type )
X {
*** mawk/symtype.h Tue Mar 3 17:23:48 1992
--- mawk112/symtype.h Wed Jul 8 08:41:15 1992
***************
*** 11,18 ****
X ********************************************/
X
! /*$Log: symtype.h,v $
! * Revision 5.1 91/12/05 07:59:37 brennan
X * 1.1 pre-release
! *
X */
X
--- 11,21 ----
X ********************************************/
X
! /*$Log: symtype.h,v $
! * Revision 5.2 1992/07/08 15:44:44 brennan
! * patch2: length returns. I am a wimp
! *
! * Revision 5.1 1991/12/05 07:59:37 brennan
X * 1.1 pre-release
! *
X */
X
***************
*** 111,117 ****
X #define ST_NR 7 /* NR is special */
X #define ST_ENV 8 /* and so is ENVIRON */
! #define ST_LOCAL_NONE 9
! #define ST_LOCAL_VAR 10
! #define ST_LOCAL_ARRAY 11
X
X #define is_local(stp) ((stp)->type>=ST_LOCAL_NONE)
--- 114,121 ----
X #define ST_NR 7 /* NR is special */
X #define ST_ENV 8 /* and so is ENVIRON */
! #define ST_LENGTH 9 /* ditto and bozo */
! #define ST_LOCAL_NONE 10
! #define ST_LOCAL_VAR 11
! #define ST_LOCAL_ARRAY 12
X
X #define is_local(stp) ((stp)->type>=ST_LOCAL_NONE)
*** mawk/types.h Tue Mar 3 17:23:50 1992
--- mawk112/types.h Tue Apr 7 12:56:39 1992
***************
*** 12,19 ****
X
X
! /* $Log: types.h,v $
! * Revision 5.1 91/12/05 07:59:39 brennan
X * 1.1 pre-release
! *
X */
X
--- 12,19 ----
X
X
! /* $Log: types.h,v $
! * Revision 5.1 1991/12/05 07:59:39 brennan
X * 1.1 pre-release
! *
X */
X
*** mawk/version.c Tue Mar 3 17:29:24 1992
--- mawk112/version.c Thu Aug 27 04:50:46 1992
***************
*** 2,6 ****
X /********************************************
X version.c
! copyright 1991, Michael D. Brennan
X
X This is a source file for mawk, an implementation of
--- 2,6 ----
X /********************************************
X version.c
! copyright 1991, 1992. Michael D. Brennan
X
X This is a source file for mawk, an implementation of
***************
*** 11,18 ****
X ********************************************/
X
! /*$Log: version.c,v $
! * Revision 5.3 92/03/03 16:42:23 brennan
X * patch 1
! *
X * Revision 5.2 92/01/22 05:34:10 brennan
X * version 1.1
--- 11,21 ----
X ********************************************/
X
! /*$Log: version.c,v $
! * Revision 5.4 1992/08/27 11:50:38 mike
! * patch2
! *
! * Revision 5.3 1992/03/03 16:42:23 brennan
X * patch 1
! *
X * Revision 5.2 92/01/22 05:34:10 brennan
X * version 1.1
***************
*** 27,31 ****
X
X #define VERSION_STRING \
! "mawk 1.1%s%s Feb 1992, Copyright (C) Michael D. Brennan\n\n"
X
X #define DOS_STRING ""
--- 30,34 ----
X
X #define VERSION_STRING \
! "mawk 1.1%s%s Aug 1992, Copyright (C) Michael D. Brennan\n\n"
X
X #define DOS_STRING ""
*** mawk/zmalloc.c Tue Mar 3 17:23:52 1992
--- mawk112/zmalloc.c Tue Apr 7 12:56:40 1992
***************
*** 11,18 ****
X ********************************************/
X
! /*$Log: zmalloc.c,v $
! * Revision 5.1 91/12/05 07:56:35 brennan
X * 1.1 pre-release
! *
X */
X
--- 11,18 ----
X ********************************************/
X
! /*$Log: zmalloc.c,v $
! * Revision 5.1 1991/12/05 07:56:35 brennan
X * 1.1 pre-release
! *
X */
X
*** mawk/zmalloc.h Tue Mar 3 17:23:52 1992
--- mawk112/zmalloc.h Tue Apr 7 12:56:41 1992
***************
*** 11,18 ****
X ********************************************/
X
! /*$Log: zmalloc.h,v $
! * Revision 5.1 91/12/05 07:59:41 brennan
X * 1.1 pre-release
! *
X */
X
--- 11,18 ----
X ********************************************/
X
! /*$Log: zmalloc.h,v $
! * Revision 5.1 1991/12/05 07:59:41 brennan
X * 1.1 pre-release
! *
X */
X
*** mawk/config/Idefault.h Tue Mar 3 17:29:32 1992
--- mawk112/config/Idefault.h Wed Jul 8 09:13:16 1992
***************
*** 12,16 ****
X
X
! /* $Log: Idefault.h,v $
X * Revision 3.13 92/03/03 16:40:56 brennan
X * remove HAVE_PRINTF_HD
--- 12,22 ----
X
X
! /* $Log: Idefault.h,v $
! * Revision 3.15 1992/07/08 16:16:08 brennan
! * don't attempt any #def or #undef with __STDC__
! *
! * Revision 3.14 1992/03/31 13:39:00 brennan
! * TURN_ON_FPE_TRAPS() macro
! *
X * Revision 3.13 92/03/03 16:40:56 brennan
X * remove HAVE_PRINTF_HD
***************
*** 186,189 ****
--- 192,199 ----
X #endif
X
+ #ifndef TURN_ON_FPE_TRAPS
+ #define TURN_ON_FPE_TRAPS() /* nothing */
+ #endif
+
X #ifndef HAVE_SMALL_MEMORY
X #define HAVE_SMALL_MEMORY 0
***************
*** 194,203 ****
X
X
! #ifndef __STDC__
! #define __STDC__ 0
! #endif
!
X #if __STDC__
-
X #undef HAVE_PROTOS
X #define HAVE_PROTOS 1
--- 204,209 ----
X
X
! #ifdef __STDC__
X #if __STDC__
X #undef HAVE_PROTOS
X #define HAVE_PROTOS 1
***************
*** 208,217 ****
X #undef HAVE_STRING_H
X #define HAVE_STRING_H 1
- #endif
-
- #if __STDC__ && ! __GNUC__
- /* with gcc __STDC__ can be defined, but stdlib.h is missing */
X #undef HAVE_STDLIB_H
X #define HAVE_STDLIB_H 1
X #endif
X
--- 214,220 ----
X #undef HAVE_STRING_H
X #define HAVE_STRING_H 1
X #undef HAVE_STDLIB_H
X #define HAVE_STDLIB_H 1
+ #endif
X #endif
X
***************
*** 218,222 ****
X
X
-
X /* the painfull case: we need to catch fpe's and look at errno
X after lib calls */
--- 221,224 ----
***************
*** 275,285 ****
X #endif
X
- /* ultrix pukes if __STDC__ is defined 0 */
- /* SCO UNIX's cc (from Microsoft) sneezes if __STDC__ is re-#define-d */
- #if (__STDC__ == 0)
- #ifndef M_I386
- #undef __STDC__
- #endif
- #endif
X
X /* for Think C on the Macintosh, sizeof(size_t) != sizeof(unsigned
--- 277,280 ----
*** mawk/config/V7.h Tue Mar 3 17:24:12 1992
--- mawk112/config/V7.h Tue Apr 7 12:56:53 1992
***************
*** 16,23 ****
X */
X
! /*$Log: V7.h,v $
! * Revision 4.2 91/11/21 13:30:34 brennan
! *
! *
X * 11/17/91 C. Mascott declare fprintf, sprintf on V7
X *
--- 16,22 ----
X */
X
! /*$Log: V7.h,v $
! * Revision 4.2 1991/11/21 13:30:34 brennan
! *
X * 11/17/91 C. Mascott declare fprintf, sprintf on V7
X *
*** mawk/config/atarist.h Tue Mar 3 17:24:18 1992
--- mawk112/config/atarist.h Tue Apr 7 12:56:56 1992
***************
*** 17,24 ****
X */
X
! /*$Log: atarist.h,v $
! * Revision 1.1 91/10/29 10:48:52 brennan
X * Initial revision
! *
X */
X
--- 17,24 ----
X */
X
! /*$Log: atarist.h,v $
! * Revision 1.1 1991/10/29 10:48:52 brennan
X * Initial revision
! *
X */
X
*** mawk/config/bsd43_vax.h Tue Mar 3 17:24:10 1992
--- mawk112/config/bsd43_vax.h Tue Apr 7 12:56:50 1992
***************
*** 12,19 ****
X
X
! /* $Log: bsd43_vax.h,v $
! * Revision 4.1 91/09/25 11:41:07 brennan
X * VERSION 1.0
! *
X * Revision 3.2 91/08/13 09:04:09 brennan
X * VERSION .9994
--- 12,19 ----
X
X
! /* $Log: bsd43_vax.h,v $
! * Revision 4.1 1991/09/25 11:41:07 brennan
X * VERSION 1.0
! *
X * Revision 3.2 91/08/13 09:04:09 brennan
X * VERSION .9994
*** mawk/config/generic.h Tue Mar 3 17:29:30 1992
--- mawk112/config/generic.h Tue Apr 7 12:56:48 1992
***************
*** 12,19 ****
X
X
! /* $Log: generic.h,v $
! * Revision 4.4 92/03/03 16:40:54 brennan
X * remove HAVE_PRINTF_HD
! *
X * Revision 4.3 91/10/29 10:48:26 brennan
X * version 1.09
--- 12,19 ----
X
X
! /* $Log: generic.h,v $
! * Revision 4.4 1992/03/03 16:40:54 brennan
X * remove HAVE_PRINTF_HD
! *
X * Revision 4.3 91/10/29 10:48:26 brennan
X * version 1.09
*** mawk/config/mips.h Tue Mar 3 17:24:20 1992
--- mawk112/config/mips.h Tue Apr 7 12:56:56 1992
***************
*** 10,17 ****
X ********************************************/
X
! /*$Log: mips.h,v $
! * Revision 1.2 91/11/15 08:13:20 brennan
X * declaration for sprintf
! *
X * Revision 1.1 91/10/28 09:58:05 brennan
X * Initial revision
--- 10,17 ----
X ********************************************/
X
! /*$Log: mips.h,v $
! * Revision 1.2 1991/11/15 08:13:20 brennan
X * declaration for sprintf
! *
X * Revision 1.1 91/10/28 09:58:05 brennan
X * Initial revision
*** mawk/config/msc_dos.h Tue Mar 3 17:24:16 1992
--- mawk112/config/msc_dos.h Tue Apr 7 12:56:55 1992
***************
*** 13,20 ****
X /* Microsoft C 6.0A under MSDOS */
X
! /*$Log: msc_dos.h,v $
! * Revision 4.3 92/01/09 08:54:09 brennan
X * changed SAMESEG macro
! *
X * Revision 4.2 91/10/29 09:36:59 brennan
X * Large model macro
--- 13,20 ----
X /* Microsoft C 6.0A under MSDOS */
X
! /*$Log: msc_dos.h,v $
! * Revision 4.3 1992/01/09 08:54:09 brennan
X * changed SAMESEG macro
! *
X * Revision 4.2 91/10/29 09:36:59 brennan
X * Large model macro
*** mawk/config/next.h Tue Mar 3 17:29:36 1992
--- mawk112/config/next.h Tue Apr 7 12:56:57 1992
***************
*** 14,21 ****
X */
X
! /* $Log: next.h,v $
! * Revision 1.1 92/02/25 08:13:12 brennan
X * Initial revision
! *
X */
X
--- 14,21 ----
X */
X
! /* $Log: next.h,v $
! * Revision 1.1 1992/02/25 08:13:12 brennan
X * Initial revision
! *
X */
X
*** mawk/config/sgi.h Tue Mar 3 17:29:38 1992
--- mawk112/config/sgi.h Tue Apr 7 12:56:57 1992
***************
*** 14,21 ****
X */
X
! /* $Log: sgi.h,v $
! * Revision 1.1 92/02/25 08:10:22 brennan
X * Initial revision
! *
X */
X
--- 14,21 ----
X */
X
! /* $Log: sgi.h,v $
! * Revision 1.1 1992/02/25 08:10:22 brennan
X * Initial revision
! *
X */
X
*** mawk/config/sun_os40.h Tue Mar 3 17:24:10 1992
--- mawk112/config/sun_os40.h Tue Apr 7 12:56:51 1992
***************
*** 12,19 ****
X
X
! /* $Log: sun_os40.h,v $
! * Revision 4.2 91/11/17 12:34:11 brennan
X * added a declaration for sprintf()
! *
X * Revision 4.1 91/09/25 11:41:35 brennan
X * VERSION 1.0
--- 12,19 ----
X
X
! /* $Log: sun_os40.h,v $
! * Revision 4.2 1991/11/17 12:34:11 brennan
X * added a declaration for sprintf()
! *
X * Revision 4.1 91/09/25 11:41:35 brennan
X * VERSION 1.0
*** mawk/config/sun_os41.h Tue Mar 3 17:24:10 1992
--- mawk112/config/sun_os41.h Tue Jul 7 08:42:39 1992
***************
*** 2,6 ****
X /********************************************
X sun_os41.h
! copyright 1991, Michael D. Brennan
X
X This is a source file for mawk, an implementation of
--- 2,6 ----
X /********************************************
X sun_os41.h
! copyright 1991, 1992. Michael D. Brennan
X
X This is a source file for mawk, an implementation of
***************
*** 12,19 ****
X
X
! /* $Log: sun_os41.h,v $
! * Revision 1.3 91/12/05 08:24:02 brennan
X * 1.1 pre-release
! *
X */
X
--- 12,22 ----
X
X
! /* $Log: sun_os41.h,v $
! * Revision 1.4 1992/07/07 15:45:58 brennan
! * <stdlib.h> is non-standard
! *
! * Revision 1.3 1991/12/05 08:24:02 brennan
X * 1.1 pre-release
! *
X */
X
***************
*** 23,26 ****
--- 26,32 ----
X /* this is missing (actually its in 5include) */
X int fprintf() ;
+
+ /* this is not in <stdlib.h> */
+ double strtod() ;
X
X
*** mawk/config/sysV.h Tue Mar 3 17:24:14 1992
--- mawk112/config/sysV.h Tue Apr 7 12:56:54 1992
***************
*** 24,31 ****
X */
X
! /*$Log: sysV.h,v $
! * Revision 4.1 91/09/25 11:41:40 brennan
X * VERSION 1.0
! *
X * Revision 1.2 91/08/13 09:04:15 brennan
X * VERSION .9994
--- 24,31 ----
X */
X
! /*$Log: sysV.h,v $
! * Revision 4.1 1991/09/25 11:41:40 brennan
X * VERSION 1.0
! *
X * Revision 1.2 91/08/13 09:04:15 brennan
X * VERSION .9994
*** mawk/config/sysV_ieeefp.h Tue Mar 3 17:24:14 1992
--- mawk112/config/sysV_ieeefp.h Tue Apr 7 12:56:54 1992
***************
*** 12,19 ****
X
X
! /* $Log: sysV_ieeefp.h,v $
! * Revision 4.1 91/09/25 11:41:45 brennan
X * VERSION 1.0
! *
X * Revision 1.3 91/09/10 09:19:41 brennan
X * fixed comment typo
--- 12,19 ----
X
X
! /* $Log: sysV_ieeefp.h,v $
! * Revision 4.1 1991/09/25 11:41:45 brennan
X * VERSION 1.0
! *
X * Revision 1.3 91/09/10 09:19:41 brennan
X * fixed comment typo
*** mawk/config/tcc_dos.h Tue Mar 3 17:24:12 1992
--- mawk112/config/tcc_dos.h Tue Apr 7 12:56:52 1992
***************
*** 13,20 ****
X /* Turbo C under MSDOS */
X
! /* $Log: tcc_dos.h,v $
! * Revision 4.2 91/10/29 09:37:54 brennan
X * changes for 1.09
! *
X * Revision 4.1 91/09/25 11:41:51 brennan
X * VERSION 1.0
--- 13,20 ----
X /* Turbo C under MSDOS */
X
! /* $Log: tcc_dos.h,v $
! * Revision 4.2 1991/10/29 09:37:54 brennan
X * changes for 1.09
! *
X * Revision 4.1 91/09/25 11:41:51 brennan
X * VERSION 1.0
*** mawk/config/ultrix42mips.h Tue Mar 3 17:29:36 1992
--- mawk112/config/ultrix42mips.h Tue Apr 7 12:56:50 1992
***************
*** 12,19 ****
X
X
! /* $Log: ultrix42mips.h,v $
! * Revision 1.1 92/03/03 12:35:21 brennan
X * Initial revision
! *
X */
X
--- 12,19 ----
X
X
! /* $Log: ultrix42mips.h,v $
! * Revision 1.1 1992/03/03 12:35:21 brennan
X * Initial revision
! *
X */
X
*** mawk/config/ultrix_vax.h Tue Mar 3 17:24:08 1992
--- mawk112/config/ultrix_vax.h Tue Apr 7 12:56:49 1992
***************
*** 12,19 ****
X
X
! /* $Log: ultrix_vax.h,v $
! * Revision 4.1 91/09/25 11:42:07 brennan
X * VERSION 1.0
! *
X * Revision 3.2 91/08/13 09:04:23 brennan
X * VERSION .9994
--- 12,19 ----
X
X
! /* $Log: ultrix_vax.h,v $
! * Revision 4.1 1991/09/25 11:42:07 brennan
X * VERSION 1.0
! *
X * Revision 3.2 91/08/13 09:04:23 brennan
X * VERSION .9994
*** mawk/config/xenix_r2.h Tue Mar 3 17:24:14 1992
--- mawk112/config/xenix_r2.h Tue Apr 7 12:56:53 1992
***************
*** 24,31 ****
X */
X
! /*$Log: xenix_r2.h,v $
! * Revision 4.1 91/09/25 11:42:13 brennan
X * VERSION 1.0
! *
X * Revision 1.2 91/08/13 09:04:24 brennan
X * VERSION .9994
--- 24,31 ----
X */
X
! /*$Log: xenix_r2.h,v $
! * Revision 4.1 1991/09/25 11:42:13 brennan
X * VERSION 1.0
! *
X * Revision 1.2 91/08/13 09:04:24 brennan
X * VERSION .9994
*** mawk/man/mawk.1 Tue Mar 3 17:23:54 1992
--- mawk112/man/mawk.1 Wed Aug 26 21:14:36 1992
***************
*** 1,3 ****
! .TH MAWK 1 "Jan 22 1992" "Version 1.1" "USER COMMANDS"
X .\" strings
X .ds ex \fIexpr\fR
--- 1,3 ----
! .TH MAWK 1 "Jul 13 1992" "Version 1.1.2" "USER COMMANDS"
X .\" strings
X .ds ex \fIexpr\fR
***************
*** 4,8 ****
X .SH NAME
X mawk \- pattern scanning and text processing language
-
X .SH SYNOPSIS
X .B mawk
--- 4,7 ----
***************
*** 25,29 ****
X .IR program-file ]
X [\-\|\-] [file ...]
-
X .SH DESCRIPTION
X .B mawk
--- 24,27 ----
***************
*** 47,51 ****
X .B mawk
X provides a small number of extensions.
!
X An AWK program is a sequence of \fIpattern {action}\fR pairs and
X function definitions.
--- 45,49 ----
X .B mawk
X provides a small number of extensions.
! .PP
X An AWK program is a sequence of \fIpattern {action}\fR pairs and
X function definitions.
***************
*** 60,64 ****
X record separator variable, \fBRS\fR. Initially,
X .B RS
! = "\\n" and records are synonymous with lines.
X Each record is compared against each
X .I pattern
--- 58,62 ----
X record separator variable, \fBRS\fR. Initially,
X .B RS
! = "\en" and records are synonymous with lines.
X Each record is compared against each
X .I pattern
***************
*** 66,82 ****
X .I "{action}"
X is executed.
-
X .SH OPTIONS
!
! .TP \w'\-\fBv'+\w'\fIvar=value'u+2n
! \-\fBF \fIvalue
X sets the field separator, \fBFS\fR, to
X .IR value .
!
! .IP "\-\fBf \fIfile"
X Program text is read from \fIfile\fR instead of from the
! command line. Multiple \-f options are allowed.
!
! .IP "\-\fBv \fIvar=value"
X assigns
X .I value
--- 64,80 ----
X .I "{action}"
X is executed.
X .SH OPTIONS
! .TP \w'\-\fBW'u+\w'\fRsprintf=\fInum\fR'u+2n
! \-\fBF \fIvalue\fP
X sets the field separator, \fBFS\fR, to
X .IR value .
! .TP
! \-\fBf \fIfile
X Program text is read from \fIfile\fR instead of from the
! command line. Multiple
! .B \-f
! options are allowed.
! .TP
! \-\fBv \fIvar=value\fR
X assigns
X .I value
***************
*** 83,88 ****
X to program variable
X .IR var .
!
! .IP "\-\|\-"
X indicates the unambiguous end of options.
X .PP
--- 81,86 ----
X to program variable
X .IR var .
! .TP
! \-\|\-
X indicates the unambiguous end of options.
X .PP
***************
*** 89,97 ****
X The above options will be available with any Posix compatible
X implementation of AWK, and implementation specific options are
! prefaced with \-W.
X .B mawk
! provides three:
!
! .TP \w'\-\fBv'+\w'\fIvar=value'u+2n
X \-\fBW \fRversion
X .B mawk
--- 87,95 ----
X The above options will be available with any Posix compatible
X implementation of AWK, and implementation specific options are
! prefaced with
! .BR \-W .
X .B mawk
! provides four:
! .TP \w'\-\fBW'u+\w'\fRsprintf=\fInum\fR'u+2n
X \-\fBW \fRversion
X .B mawk
***************
*** 104,108 ****
X representation of the program to stderr.
X .TP
! \-\fBW \fRsprintf=\fInum
X adjusts the size of
X .B mawk's
--- 102,106 ----
X representation of the program to stderr.
X .TP
! \-\fBW \fRsprintf=\fInum\fR
X adjusts the size of
X .B mawk's
***************
*** 116,121 ****
X forces
X .B mawk
! not to consider '\\n' to be space.
!
X .SH "THE AWK LANGUAGE"
X .SS "\fB1. Program structure"
--- 114,118 ----
X forces
X .B mawk
! not to consider '\en' to be space.
X .SH "THE AWK LANGUAGE"
X .SS "\fB1. Program structure"
***************
*** 152,156 ****
X have no meaning; an empty statement is terminated with a
X semi-colon. Long statements
! can be continued with a backslash, \\\|. A statement can be broken
X without a backslash after a comma, left brace, &&, ||,
X .BR do ,
--- 149,153 ----
X have no meaning; an empty statement is terminated with a
X semi-colon. Long statements
! can be continued with a backslash, \e\|. A statement can be broken
X without a backslash after a comma, left brace, &&, ||,
X .BR do ,
***************
*** 218,241 ****
X .sp
X .ce
! "This is a string with a newline at the end.\\n"
X .sp
! Strings can be continued across a line by escaping (\\) the newline.
X The following escape sequences are recognized.
X .nf
X .sp
! \\\\ \\
! \\" "
! \\a alert, ascii 7
! \\b backspace, ascii 8
! \\t tab, ascii 9
! \\n newline, ascii 10
! \\v vertical tab, ascii 11
! \\f formfeed, ascii 12
! \\r carriage return, ascii 13
! \\ddd 1, 2 or 3 octal digits for ascii ddd
! \\xhh 1 or 2 hex digits for ascii hh
X .sp
X .fi
! If you escape any other character \\c, you get \\c, i.e.,
X .B mawk
X ignores the escape.
--- 215,238 ----
X .sp
X .ce
! "This is a string with a newline at the end.\en"
X .sp
! Strings can be continued across a line by escaping (\e) the newline.
X The following escape sequences are recognized.
X .nf
X .sp
! \e\e \e
! \e" "
! \ea alert, ascii 7
! \eb backspace, ascii 8
! \et tab, ascii 9
! \en newline, ascii 10
! \ev vertical tab, ascii 11
! \ef formfeed, ascii 12
! \er carriage return, ascii 13
! \eddd 1, 2 or 3 octal digits for ascii ddd
! \exhh 1 or 2 hex digits for ascii hh
X .sp
X .fi
! If you escape any other character \ec, you get \ec, i.e.,
X .B mawk
X ignores the escape.
***************
*** 296,306 ****
X \*(ex\d1\u \fBrel-op \*(ex\d2\u,
X if both operands are numeric or number and string then the comparison
! is numeric; if both operands are string the comparison is string.
! If exactly one operand is string and after trimming spaces and
! tabs from the front and back the remaining string is entirely
! numeric in form, then the string is converted to number and the
! comparison is numeric; otherwise, the numeric operand is converted
! to string and the comparison is string.
! The result of a comparison is numeric, 0 or 1.
X .PP
X In boolean contexts such as,
--- 293,299 ----
X \*(ex\d1\u \fBrel-op \*(ex\d2\u,
X if both operands are numeric or number and string then the comparison
! is numeric; if both operands are string the comparison is string;
! if one operand is string, the non-string operand is converted and
! the comparison is string. The result is numeric, 1 or 0.
X .PP
X In boolean contexts such as,
***************
*** 360,364 ****
X matches any non-metacharacter
X .IR c .
! .IP "\e\fIc\fR"
X matches a character defined by the same escape sequences used
X in string constants or the literal
--- 353,358 ----
X matches any non-metacharacter
X .IR c .
! .TP
! "\e\fIc\fR"
X matches a character defined by the same escape sequences used
X in string constants or the literal
***************
*** 366,372 ****
X .I c
X if
! \\\fIc\fR
X is not an escape sequence.
! .IP \.
X matches any character (including newline).
X .TP
--- 360,367 ----
X .I c
X if
! \e\fIc\fR
X is not an escape sequence.
! .TP
! \&\.
X matches any character (including newline).
X .TP
***************
*** 390,394 ****
X as follows:
X .RS
! .TP
X \fIr\fR\d1\u\fIr\fR\d2\u
X matches
--- 385,389 ----
X as follows:
X .RS
! .TP \w'[^c\d1\uc\d2\uc\d3\u...]'u+1n
X \fIr\fR\d1\u\fIr\fR\d2\u
X matches
***************
*** 425,429 ****
X .sp
X /^[_a\-zA-Z][_a\-zA\-Z0\-9]*$/ and
! /^[\-+]?([0\-9]+\\\|.?|\\\|.[0\-9])[0\-9]*([eE][\-+]?[0\-9]+)?$/
X .sp
X .fi
--- 420,424 ----
X .sp
X /^[_a\-zA-Z][_a\-zA\-Z0\-9]*$/ and
! /^[\-+]?([0\-9]+\e\|.?|\e\|.[0\-9])[0\-9]*([eE][\-+]?[0\-9]+)?$/
X .sp
X .fi
***************
*** 513,517 ****
X echo 24 24E |
X mawk '{ print($1>100, $1>"100", $2>100, $2>"100") }'
! 0 0 1 1
X .fi
X .sp
--- 508,512 ----
X echo 24 24E |
X mawk '{ print($1>100, $1>"100", $2>100, $2>"100") }'
! 0 1 1 1
X .fi
X .sp
***************
*** 521,529 ****
X are string and
X .B $1
! is number and string. The first
! and second comparisons are numeric and the last
! two are string. In the second "100" is
! converted to 100, and in the third 100 is
! converted to "100".
X .\"
X .SS "\fB5. Expressions and operators"
--- 516,523 ----
X are string and
X .B $1
! is number and string. The first comparison is numeric,
! the second is string, the third is string
! (100 is converted to "100"),
! and the last is string.
X .\"
X .SS "\fB5. Expressions and operators"
***************
*** 672,676 ****
X .TP
X .B ORS
! terminates each record on output, initially = "\\n".
X .TP
X .B RLENGTH
--- 666,670 ----
X .TP
X .B ORS
! terminates each record on output, initially = "\en".
X .TP
X .B RLENGTH
***************
*** 679,683 ****
X .TP
X .B RS
! input record separator, initially = "\\n".
X .TP
X .B RSTART
--- 673,677 ----
X .TP
X .B RS
! input record separator, initially = "\en".
X .TP
X .B RSTART
***************
*** 686,690 ****
X .TP
X .B SUBSEP
! used to build multiple array subscripts, initially = "\\034".
X .RE
X .\"
--- 680,684 ----
X .TP
X .B SUBSEP
! used to build multiple array subscripts, initially = "\e034".
X .RE
X .\"
***************
*** 709,713 ****
X is replaced by the matched substring of
X .IR t .
! \\& puts a literal & in the replacement string.
X .TP
X index(\fIs,t\fR)
--- 703,707 ----
X is replaced by the matched substring of
X .IR t .
! \e& puts a literal & in the replacement string.
X .TP
X index(\fIs,t\fR)
***************
*** 723,731 ****
X is in position 1.
X .TP
! length(\fIs\fR) length()
X Returns the length of string
! .IR s ;
! without an argument, returns the length of
! .BR $0 .
X .TP
X match(\fIs,r\fR)
--- 717,723 ----
X is in position 1.
X .TP
! length(\fIs\fR)
X Returns the length of string
! .IR s .
X .TP
X match(\fIs,r\fR)
***************
*** 1036,1040 ****
X .B mawk
X defines <SPACE> as the regular expression
! /[\ \\t\\n]+/.
X Otherwise
X .I sep
--- 1028,1032 ----
X .B mawk
X defines <SPACE> as the regular expression
! /[\ \et\en]+/.
X Otherwise
X .I sep
***************
*** 1042,1046 ****
X are ignored for a string of length 1,
X e.g.,
! split(x, A, "*") and split(x, A, /\\*/) are the same.
X .TP
X (3)
--- 1034,1038 ----
X are ignored for a string of length 1,
X e.g.,
! split(x, A, "*") and split(x, A, /\e*/) are the same.
X .TP
X (3)
***************
*** 1049,1053 ****
X and
X .I A
! is unchanged.
X Otherwise,
X all non-overlapping, non-null and longest matches of
--- 1041,1045 ----
X and
X .I A
! is set empty.
X Otherwise,
X all non-overlapping, non-null and longest matches of
***************
*** 1119,1123 ****
X records are easy. Setting
X .B RS
! = "\\n\\n+", makes one or more blank
X lines separate records. If
X .B FS
--- 1111,1115 ----
X records are easy. Setting
X .B RS
! = "\en\en+", makes one or more blank
X lines separate records. If
X .B FS
***************
*** 1127,1138 ****
X .RS
X .PP
! For example, if a file is "a\ b\\nc\\n\\n",
X .B RS
! = "\\n\\n+" and
X .B FS
! = "\ ", then there is one record "a\ b\\nc" with three
X fields "a", "b" and "c". Changing
X .B FS
! = "\\n", gives two
X fields "a b" and "c"; changing
X .B FS
--- 1119,1130 ----
X .RS
X .PP
! For example, if a file is "a\ b\enc\en\en",
X .B RS
! = "\en\en+" and
X .B FS
! = "\ ", then there is one record "a\ b\enc" with three
X fields "a", "b" and "c". Changing
X .B FS
! = "\en", gives two
X fields "a b" and "c"; changing
X .B FS
***************
*** 1144,1148 ****
X set
X .B RS
! = "\\n([\ \\t]*\\n)+".
X For compatibility with other awks, setting
X .B RS
--- 1136,1140 ----
X set
X .B RS
! = "\en([\ \et]*\en)+".
X For compatibility with other awks, setting
X .B RS
***************
*** 1151,1156 ****
X front and back of files and then records are determined as if
X .B RS
! = "\\n\\n+".
! Posix requires that "\\n" always separates records when
X .B RS
X = "" regardless of the value of
--- 1143,1148 ----
X front and back of files and then records are determined as if
X .B RS
! = "\en\en+".
! Posix requires that "\en" always separates records when
X .B RS
X = "" regardless of the value of
***************
*** 1158,1162 ****
X .B mawk
X does not support this convention, because defining
! "\\n" as <SPACE> makes it unnecessary.
X .\"
X .PP
--- 1150,1154 ----
X .B mawk
X does not support this convention, because defining
! "\en" as <SPACE> makes it unnecessary.
X .\"
X .PP
***************
*** 1166,1170 ****
X will also want to change
X .B ORS
! to "\\n\\n" so the record spacing is preserved on output.
X .\"
X .SS "\fB13. Program execution"
--- 1158,1162 ----
X will also want to change
X .B ORS
! to "\en\en" so the record spacing is preserved on output.
X .\"
X .SS "\fB13. Program execution"
***************
*** 1198,1202 ****
X .B ARGV[4]
X = "B".
!
X Next, each
X .B BEGIN
--- 1190,1194 ----
X .B ARGV[4]
X = "B".
! .PP
X Next, each
X .B BEGIN
***************
*** 1326,1330 ****
X .B exit
X or subsequent error.
-
X .SH EXAMPLES
X .nf
--- 1318,1321 ----
***************
*** 1335,1339 ****
X 2. emulate wc.
X
! { chars += length($0) + 1 # add one for the \\n
X words += NF
X }
--- 1326,1330 ----
X 2. emulate wc.
X
! { chars += length($0) + 1 # add one for the \en
X words += NF
X }
***************
*** 1385,1389 ****
X
X .fi
-
X .SH "COMPATIBILITY ISSUES"
X The Posix 1003.2(draft 11.2) definition of the AWK language
--- 1376,1379 ----
***************
*** 1405,1409 ****
X a time.
X .B RS
! can be changed from "\\n" to another single character,
X but it
X is hard to find any use for this \(em there are no
--- 1395,1399 ----
X a time.
X .B RS
! can be changed from "\en" to another single character,
X but it
X is hard to find any use for this \(em there are no
***************
*** 1411,1415 ****
X By convention, \fBRS\fR = "", makes one or more blank lines
X separate records, allowing multi-line records. When
! \fBRS\fR = "", "\\n" is always a field separator
X regardless of the value in
X .BR FS .
--- 1401,1405 ----
X By convention, \fBRS\fR = "", makes one or more blank lines
X separate records, allowing multi-line records. When
! \fBRS\fR = "", "\en" is always a field separator
X regardless of the value in
X .BR FS .
***************
*** 1420,1424 ****
X .B RS
X to be a regular expression.
! When "\\n" appears in records, it is treated as space, and
X .B FS
X always determines fields.
--- 1410,1414 ----
X .B RS
X to be a regular expression.
! When "\en" appears in records, it is treated as space, and
X .B FS
X always determines fields.
***************
*** 1450,1454 ****
X .sp
X BEGIN {
! RS = "/\|\\*([^*]\||\|\\*+[^/*])*\\*+/"
X # comment is record separator
X ORS = " "
--- 1440,1444 ----
X .sp
X BEGIN {
! RS = "/\|\e*([^*]\||\|\e*+[^/*])*\e*+/"
X # comment is record separator
X ORS = " "
***************
*** 1469,1473 ****
X .nf
X .sp
! x ~ /a\\+b/ x ~ "a\\+b" x ~ "a\\\\+b"
X .sp
X .fi
--- 1459,1463 ----
X .nf
X .sp
! x ~ /a\e+b/ x ~ "a\e+b" x ~ "a\e\e+b"
X .sp
X .fi
***************
*** 1486,1493 ****
X the more portable but less readable, double escape.
X .PP
! Posix AWK does not recognize "/dev/stderr" or \\x hex escape
X sequences in strings. Unlike ANSI C,
X .B mawk
! limits the number of digits that follows \\x to two.
X .PP
X Finally, here is how
--- 1476,1483 ----
X the more portable but less readable, double escape.
X .PP
! Posix AWK does not recognize "/dev/stderr" or \ex hex escape
X sequences in strings. Unlike ANSI C,
X .B mawk
! limits the number of digits that follows \ex to two.
X .PP
X Finally, here is how
***************
*** 1504,1508 ****
X returned; so substr("ABC", 1, 0) = "" and
X substr("ABC", \-4, 6) = "A".
!
X Every string, including the empty string, matches the empty string
X at the
--- 1494,1498 ----
X returned; so substr("ABC", 1, 0) = "" and
X substr("ABC", \-4, 6) = "A".
! .PP
X Every string, including the empty string, matches the empty string
X at the
***************
*** 1511,1515 ****
X .B RLENGTH
X to 0.
!
X index(s, t) is always the same as match(s, t1) where t1 is the
X same as t with metacharacters escaped. Hence consistency
--- 1501,1505 ----
X .B RLENGTH
X to 0.
! .PP
X index(s, t) is always the same as match(s, t1) where t1 is the
X same as t with metacharacters escaped. Hence consistency
***************
*** 1518,1522 ****
X Also the condition, index(s,t) != 0 if and only t is a substring
X of s, requires index("","") = 1.
!
X If getline encounters end of file, getline var, leaves var
X unchanged. Similarly, on entry to the
--- 1508,1512 ----
X Also the condition, index(s,t) != 0 if and only t is a substring
X of s, requires index("","") = 1.
! .PP
X If getline encounters end of file, getline var, leaves var
X unchanged. Similarly, on entry to the
***************
*** 1527,1534 ****
X .B NF
X have their value unaltered from the last record.
-
X .SH SEE ALSO
! .I egrep
! (1)
X .PP
X Aho, Kernighan and Weinberger,
--- 1517,1522 ----
X .B NF
X have their value unaltered from the last record.
X .SH SEE ALSO
! .IR egrep (1)
X .PP
X Aho, Kernighan and Weinberger,
***************
*** 1547,1558 ****
X The section on AWK arrays is excellent. It also
X discusses Posix requirements for AWK.
-
-
X .SH BUGS
X .B mawk
! cannot handle ascii NUL \\0 in the source or data files. You
X can output NUL using printf with %c, and any other 8 bit
X character is acceptable input.
!
X .B mawk
X implements printf() and sprintf() using the C library functions,
--- 1535,1544 ----
X The section on AWK arrays is excellent. It also
X discusses Posix requirements for AWK.
X .SH BUGS
X .B mawk
! cannot handle ascii NUL \e0 in the source or data files. You
X can output NUL using printf with %c, and any other 8 bit
X character is acceptable input.
! .PP
X .B mawk
X implements printf() and sprintf() using the C library functions,
***************
*** 1562,1569 ****
X .B mawk
X inherits any bugs or limitations of the library functions.
!
X Implementors of the AWK language have shown a consistent lack
X of imagination when naming their programs.
-
X .SH AUTHOR
X Mike Brennan (brennan@boeing.com).
--- 1548,1554 ----
X .B mawk
X inherits any bugs or limitations of the library functions.
! .PP
X Implementors of the AWK language have shown a consistent lack
X of imagination when naming their programs.
X .SH AUTHOR
X Mike Brennan (brennan@boeing.com).
*** mawk/msdos/Makefile.tcc Tue Mar 3 17:24:52 1992
--- mawk112/msdos/Makefile.tcc Tue Apr 7 12:56:59 1992
***************
*** 8,13 ****
X # make -DLARGE -DREARGV -- bmawk.exe unix command line
X
! #$Log: Makefile.tcc,v $
! #Revision 1.2 91/11/12 09:59:26 brennan
X #changed tcc to $(CC) and .o to .obj
X #
--- 8,13 ----
X # make -DLARGE -DREARGV -- bmawk.exe unix command line
X
! #$Log: Makefile.tcc,v $
! #Revision 1.2 1991/11/12 09:59:26 brennan
X #changed tcc to $(CC) and .o to .obj
X #
*** mawk/msdos/NOTES Tue Mar 3 17:24:48 1992
--- mawk112/msdos/NOTES Fri Jul 10 09:28:23 1992
***************
*** 142,150 ****
X POSSIBLE PROBLEMS:
X
! 1) Using TurboC++ 1.0, the code segment is 153 bytes short of
! 64K. With another compiler or a different version of TurboC++,
! this might not fit in 64K. If this is a problem,
! then compile with -DNO_BINMODE which removes the BINMODE features
! from small model only and then it should fit.
X
X 2) MSC 5.1 requires /Os and /Gs for small model to fit in 64K.
--- 142,148 ----
X POSSIBLE PROBLEMS:
X
! 1) Hopefully you can compile for speed and still fit the code
! in 64K. If not set your compiler switches to compile for
! optimized (ie small) size.
X
X 2) MSC 5.1 requires /Os and /Gs for small model to fit in 64K.
*** mawk/msdos/dosexec.c Tue Mar 3 17:24:48 1992
--- mawk112/msdos/dosexec.c Tue Jul 28 09:47:03 1992
***************
*** 11,18 ****
X ********************************************/
X
! /*$Log: dosexec.c,v $
! * Revision 1.2 91/11/16 10:27:18 brennan
! * BINMODE
! *
X * Revision 1.1 91/10/29 09:45:56 brennan
X * Initial revision
--- 11,21 ----
X ********************************************/
X
! /*$Log: dosexec.c,v $
! * Revision 1.3 1992/07/10 16:21:57 brennan
! * store exit code of input pipes
! *
! * Revision 1.2 1991/11/16 10:27:18 brennan
! * BINMODE
! *
X * Revision 1.1 91/10/29 09:45:56 brennan
X * Initial revision
***************
*** 99,107 ****
X
X
! static int next_tmp ;
! static char *tmpdir ;
X
- /* put the name of a temp file in string buff */
X
X char *tmp_file_name( id )
X int id ;
--- 102,110 ----
X
X
! static int next_tmp ; /* index for naming temp files */
! static char *tmpdir ; /* directory to hold temp files */
X
X
+ /* put the name of a temp file in string buff */
X char *tmp_file_name( id )
X int id ;
***************
*** 133,137 ****
X
X sprintf(xbuff, "%s > %s" , command, tmpfile) ;
! DOSexec(xbuff) ;
X retval = (PTR) FINopen(tmpfile, 0) ;
X }
--- 136,140 ----
X
X sprintf(xbuff, "%s > %s" , command, tmpfile) ;
! tmp_idp[1] = DOSexec(xbuff) ;
X retval = (PTR) FINopen(tmpfile, 0) ;
X }
***************
*** 160,164 ****
X
X #endif /* MSDOS */
-
-
-
--- 163,164 ----
*** mawk/msdos/see2obj.c Tue Mar 3 17:24:52 1992
--- mawk112/msdos/see2obj.c Tue Apr 7 12:56:58 1992
***************
*** 11,18 ****
X */
X
! /*$Log: see2obj.c,v $
! * Revision 1.1 91/10/29 07:53:53 brennan
X * Initial revision
! *
X */
X
--- 11,18 ----
X */
X
! /*$Log: see2obj.c,v $
! * Revision 1.1 1991/10/29 07:53:53 brennan
X * Initial revision
! *
X */
X
*** mawk/rexp/rexp.c Tue Mar 3 17:23:58 1992
--- mawk112/rexp/rexp.c Tue Apr 7 12:56:42 1992
***************
*** 11,18 ****
X ********************************************/
X
! /*$Log: rexp.c,v $
! * Revision 3.4 91/08/13 09:09:59 brennan
X * VERSION .9994
! *
X * Revision 3.3 91/08/04 15:45:03 brennan
X * no longer attempt to recover mem on failed REcompile
--- 11,18 ----
X ********************************************/
X
! /*$Log: rexp.c,v $
! * Revision 3.4 1991/08/13 09:09:59 brennan
X * VERSION .9994
! *
X * Revision 3.3 91/08/04 15:45:03 brennan
X * no longer attempt to recover mem on failed REcompile
*** mawk/rexp/rexp.h Tue Mar 3 17:24:00 1992
--- mawk112/rexp/rexp.h Tue Apr 7 12:56:43 1992
***************
*** 11,18 ****
X ********************************************/
X
! /*$Log: rexp.h,v $
! * Revision 3.6 92/01/21 17:31:45 brennan
X * moved ison() macro out of rexp[23].c
! *
X * Revision 3.5 91/10/29 10:53:55 brennan
X * SIZE_T
--- 11,18 ----
X ********************************************/
X
! /*$Log: rexp.h,v $
! * Revision 3.6 1992/01/21 17:31:45 brennan
X * moved ison() macro out of rexp[23].c
! *
X * Revision 3.5 91/10/29 10:53:55 brennan
X * SIZE_T
*** mawk/rexp/rexp0.c Tue Mar 3 17:24:00 1992
--- mawk112/rexp/rexp0.c Tue Apr 21 13:20:31 1992
***************
*** 11,15 ****
X ********************************************/
X
! /*$Log: rexp0.c,v $
X * Revision 3.6 92/01/21 17:32:51 brennan
X * added some casts so that character classes work with signed chars
--- 11,23 ----
X ********************************************/
X
! /*$Log: rexp0.c,v $
! * Revision 3.8 1992/04/21 20:22:38 brennan
! * 1.1 patch2
! * [c1-c2] now works if c2 is an escaped character
! *
! * Revision 3.7 1992/03/24 09:33:12 brennan
! * 1.1 patch2
! * When backing up in do_str, check if last character was escaped
! *
X * Revision 3.6 92/01/21 17:32:51 brennan
X * added some casts so that character classes work with signed chars
***************
*** 186,189 ****
--- 194,202 ----
X }
X
+ /*
+ collect a run of characters into a string
+ machine
+ */
+
X static int do_str( c, pp, mp)
X int c ; /* the first character */
***************
*** 191,199 ****
X MACHINE *mp ; /* where to put the string machine */
X { register char *p , *s ;
! char *str ;
! unsigned len ;
X
X
! p = *pp ;
X s = str = RE_malloc( re_len ) ;
X *s++ = c ; len = 1 ;
--- 204,213 ----
X MACHINE *mp ; /* where to put the string machine */
X { register char *p , *s ;
! char *p_entry ;
! char *str ; /* collect it here */
! unsigned len ; /* length collected */
X
X
! p = p_entry = *pp ;
X s = str = RE_malloc( re_len ) ;
X *s++ = c ; len = 1 ;
***************
*** 219,224 ****
X /* if len > 1 and we failed on a ? + or * , need to back up */
X if ( len > 1 && (*p == '*' || *p == '+' || *p == '?' ) )
! { len-- ; p-- ; s-- ; }
X
X *s = 0 ;
X *pp = p ;
--- 233,251 ----
X /* if len > 1 and we failed on a ? + or * , need to back up */
X if ( len > 1 && (*p == '*' || *p == '+' || *p == '?' ) )
! { len-- ; p-- ; s-- ;
X
+ /* if the last character was escaped, back up one more */
+ {
+ int cnt = 0 ;
+ char *bp = p-1 ;
+
+ while ( bp >= p_entry && *bp == '\\' )
+ {
+ cnt++ ; bp-- ;
+ }
+ if ( cnt & 1 ) p-- ;
+ }
+ }
+
X *s = 0 ;
X *pp = p ;
***************
*** 232,236 ****
X *---------------------------*/
X
! #define on( b, x) ( (b)[((unsigned char)(x))>>3] |= ( 1 << ((x)&7) ))
X
X static void PROTO(block_on, (BV,int,int) ) ;
--- 259,263 ----
X *---------------------------*/
X
! #define on( b, x) ((b)[(x)>>3] |= ( 1 << ((x)&7) ))
X
X static void PROTO(block_on, (BV,int,int) ) ;
***************
*** 237,243 ****
X
X static void block_on( b, x, y)
! BV b ; int x, y ;
! { int lo = (x&0xff) >> 3 ;
! int hi = (y&0xff) >> 3 ;
X int i, j, bit ;
X
--- 264,272 ----
X
X static void block_on( b, x, y)
! BV b ;
! int x, y ;
! /* caller makes sure x<=y and x>0 y>0 */
! { int lo = x >> 3 ;
! int hi = y >> 3 ;
X int i, j, bit ;
X
***************
*** 267,271 ****
X int comp_flag ;
X
! p = (*start) + 1 ;
X if ( *p == ']' || *p == '^' && *(p+1) == ']' )
X RE_error_trap(-E3) ;
--- 296,300 ----
X int comp_flag ;
X
! p = t = (*start) + 1 ;
X if ( *p == ']' || *p == '^' && *(p+1) == ']' )
X RE_error_trap(-E3) ;
***************
*** 280,284 ****
X }
X /* q now pts at the back of the class */
! p = (*start) + 1 ;
X *start = q + 1 ;
X
--- 309,313 ----
X }
X /* q now pts at the back of the class */
! p = t ;
X *start = q + 1 ;
X
***************
*** 286,290 ****
X (void) memset( bvp, 0, SIZE_T(sizeof(BV)) ) ;
X
! comp_flag = *p == '^' ? (p++ , 1) : 0 ;
X prev = -1 ; /* indicates - cannot be part of a range */
X
--- 315,321 ----
X (void) memset( bvp, 0, SIZE_T(sizeof(BV)) ) ;
X
! if ( *p == '^' ) { comp_flag = 1 ; p++ ; }
! else comp_flag = 0 ;
!
X prev = -1 ; /* indicates - cannot be part of a range */
X
***************
*** 292,318 ****
X {
X switch( *p )
! { case '\\' :
! t = ++p ;
X prev = escape(&t) ;
X on(*bvp, prev) ;
X p = t ;
! continue ;
X
X case '-' :
- if ( prev == -1 || p+1 == q || prev > *(unsigned char*)(p+1) )
- { prev = '-' ; on(*bvp, '-') ; }
- else
- { p++ ;
- block_on(*bvp, prev, *p) ;
- prev = -1 ;
- }
- break ;
X
X default :
! prev = *(unsigned char*)p ;
! on(*bvp, *p) ;
X break ;
X }
- p++ ;
X }
X
--- 323,375 ----
X {
X switch( *p )
! {
! case '\\' :
!
! t = p+1 ;
X prev = escape(&t) ;
X on(*bvp, prev) ;
X p = t ;
! break ;
X
X case '-' :
X
+ if ( prev == -1 || p+1 == q )
+ {
+ prev = '-' ;
+ on(*bvp,'-') ;
+ p++ ;
+ }
+ else
+ {
+ int c ;
+ char *mark = ++p ;
+
+ if ( *p != '\\' ) c = *(unsigned char *) p++ ;
+ else
+ {
+ t = p+1 ;
+ c = escape(&t) ;
+ p = t ;
+ }
+
+ if ( prev <= c )
+ {
+ block_on(*bvp, prev, c) ;
+ prev = -1 ;
+ }
+ else /* back up */
+ {
+ p = mark ;
+ prev = '-' ;
+ on(*bvp,'-') ;
+ }
+ }
+ break ;
+
X default :
! prev = *(unsigned char*)p++ ;
! on(*bvp, prev) ;
X break ;
X }
X }
X
***************
*** 455,458 ****
X /* anything else \c -> c */
X *start_p = p ;
! return p[-1] ;
X }
--- 512,515 ----
X /* anything else \c -> c */
X *start_p = p ;
! return *(unsigned char*)(p-1) ;
X }
*** mawk/rexp/rexp1.c Tue Mar 3 17:29:26 1992
--- mawk112/rexp/rexp1.c Mon Apr 27 10:14:01 1992
***************
*** 11,18 ****
X ********************************************/
X
! /*$Log: rexp1.c,v $
! * Revision 3.4 92/02/20 16:08:12 brennan
X * change new_TWO() to work around sun acc bug
! *
X * Revision 3.3 91/10/29 10:54:01 brennan
X * SIZE_T
--- 11,18 ----
X ********************************************/
X
! /*$Log: rexp1.c,v $
! * Revision 3.4 1992/02/20 16:08:12 brennan
X * change new_TWO() to work around sun acc bug
! *
X * Revision 3.3 91/10/29 10:54:01 brennan
X * SIZE_T
*** mawk/rexp/rexp2.c Tue Mar 3 17:24:02 1992
--- mawk112/rexp/rexp2.c Tue Apr 7 12:56:46 1992
***************
*** 11,18 ****
X ********************************************/
X
! /*$Log: rexp2.c,v $
! * Revision 3.7 92/01/21 17:33:15 brennan
X * added some casts so that character classes work with signed chars
! *
X * Revision 3.6 91/10/29 10:54:03 brennan
X * SIZE_T
--- 11,18 ----
X ********************************************/
X
! /*$Log: rexp2.c,v $
! * Revision 3.7 1992/01/21 17:33:15 brennan
X * added some casts so that character classes work with signed chars
! *
X * Revision 3.6 91/10/29 10:54:03 brennan
X * SIZE_T
*** mawk/rexp/rexp3.c Tue Mar 3 17:24:04 1992
--- mawk112/rexp/rexp3.c Tue Apr 7 12:56:46 1992
***************
*** 11,18 ****
X ********************************************/
X
! /*$Log: rexp3.c,v $
! * Revision 3.5 92/01/21 17:33:20 brennan
X * added some casts so that character classes work with signed chars
! *
X * Revision 3.4 91/10/29 10:54:09 brennan
X * SIZE_T
--- 11,18 ----
X ********************************************/
X
! /*$Log: rexp3.c,v $
! * Revision 3.5 1992/01/21 17:33:20 brennan
X * added some casts so that character classes work with signed chars
! *
X * Revision 3.4 91/10/29 10:54:09 brennan
X * SIZE_T
*** mawk/rexp/rexpdb.c Tue Mar 3 17:24:04 1992
--- mawk112/rexp/rexpdb.c Tue Apr 7 12:56:47 1992
***************
*** 12,19 ****
X
X
! /*$Log: rexpdb.c,v $
! * Revision 3.2 91/08/13 09:10:09 brennan
X * VERSION .9994
! *
X * Revision 3.1 91/06/07 10:33:30 brennan
X * VERSION 0.995
--- 12,19 ----
X
X
! /*$Log: rexpdb.c,v $
! * Revision 3.2 1991/08/13 09:10:09 brennan
X * VERSION .9994
! *
X * Revision 3.1 91/06/07 10:33:30 brennan
X * VERSION 0.995
*** /dev/null Thu Oct 8 13:30:24 1992
--- mawk112/config/aix.h Mon Jul 6 13:23:10 1992
***************
*** 0 ****
--- 1,36 ----
+
+ /********************************************
+ aix.h
+ copyright 1992. Michael D. Brennan
+
+ This is a source file for mawk, an implementation of
+ the AWK programming language.
+
+ Mawk is distributed without warranty under the terms of
+ the GNU General Public License, version 2, 1991.
+ ********************************************/
+
+
+ /* $Log: aix.h,v $
+ * Revision 1.1 1992/07/06 20:26:36 brennan
+ * Initial revision
+ *
+ */
+
+ /* AIX 3.1 on RS6000 */
+
+
+ #ifndef CONFIG_H
+ #define CONFIG_H 1
+
+ #define HAVE_STDLIB_H 1
+ #define HAVE_PROTOS 1
+ #define HAVE_STDARG_H 1
+ #define DONT_PROTO_OPEN
+
+
+
+
+ #include "config/Idefault.h"
+
+ #endif
*** /dev/null Thu Oct 8 13:30:24 1992
--- mawk112/config/convex.h Wed Jul 8 09:04:08 1992
***************
*** 0 ****
--- 1,46 ----
+
+ /********************************************
+ convex.h
+ copyright 1992, Michael D. Brennan
+
+ This is a source file for mawk, an implementation of
+ the AWK programming language.
+
+ Mawk is distributed without warranty under the terms of
+ the GNU General Public License, version 2, 1991.
+ ********************************************/
+
+
+ /* tested on ConvexOS 9.1
+
+ There is a bug in convex strtod(3) in OS 8.1, 9.0 and 9.1.
+
+ It is supposed to be fixed in 10.0
+
+ The patch is PR-25399
+
+ */
+
+ /*$Log: convex.h,v $
+ * Revision 1.1 1992/07/08 16:07:31 brennan
+ * Initial revision
+ *
+ */
+
+ /* convex.h */
+
+ #ifndef CONFIG_H
+ #define CONFIG_H 1
+
+ #define FPE_TRAPS_ON 1
+ #define FPE_ZERODIVIDE 0x4
+ #define FPE_OVERFLOW 0x3
+ #define HAVE_MATHERR 0
+
+ #define sys_nerr __ap$sys_nerr
+ #define sys_errlist __ap$sys_errlist
+
+ #include "config/Idefault.h"
+ #endif /* CONFIG_H */
+
+
*** /dev/null Thu Oct 8 13:30:24 1992
--- mawk112/config/sysVr4i386.h Tue Jul 14 07:20:41 1992
***************
*** 0 ****
--- 1,52 ----
+
+ /********************************************
+ sysVr4i386.h
+ copyright 1992, Michael D. Brennan
+
+ This is a source file for mawk, an implementation of
+ the AWK programming language.
+
+ Mawk is distributed without warranty under the terms of
+ the GNU General Public License, version 2, 1991.
+ ********************************************/
+
+
+ /*
+
+ On Intel platforms and maybe others,
+ for some strange reason, division by zero traps but overflow
+ does not, so we have to turn on the overflow trap.
+ (This seems like a small bug to me.)
+ If the trap is on, it won't hurt to turn it on some more.
+
+ If you have ieee754 hardware *and* a math lib that
+ supports it use sysV_ieeefp.h instead.
+
+ */
+
+ /*$Log: sysVr4i386.h,v $
+ * Revision 1.3 1992/07/14 14:23:35 brennan
+ * fixed typo
+ *
+ * Revision 1.2 1992/07/07 15:40:02 brennan
+ * DONT_PROTO_OPEN
+ *
+ * Revision 1.1 1992/07/01 18:07:47 brennan
+ * Initial revision
+ *
+ */
+
+ #ifndef CONFIG_H
+ #define CONFIG_H 1
+
+ #define FPE_TRAPS_ON 1
+ #define NOINFO_SIGFPE 1
+
+ #define USE_IEEEFP_H
+ #define TURN_ON_FPE_TRAPS() (void)fpsetmask(fpgetmask()|FP_X_OFL)
+
+ #define DONT_PROTO_OPEN
+
+ #include "config/Idefault.h"
+
+ #endif /* CONFIG_H */
SHAR_EOF
echo 'File diffs2 is complete' &&
chmod 0644 diffs2 ||
echo 'restore of diffs2 failed'
Wc_c="`wc -c < 'diffs2'`"
test 107075 -eq "$Wc_c" ||
echo 'diffs2: original size 107075, current size' "$Wc_c"
rm -f _shar_wnt_.tmp
fi
# ============= Xparse.c ==============
if test -f 'Xparse.c' -a X"$1" != X"-c"; then
echo 'x - skipping Xparse.c (File already exists)'
rm -f _shar_wnt_.tmp
else
> _shar_wnt_.tmp
echo 'x - extracting Xparse.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'Xparse.c' &&
#ifndef lint
static char yyid[] = "@(#)modification of yaccpar 1.8 (Berkeley) 01/20/90";
#endif
#define YYXBYACC 1 /* XBYACC -- modified Berkeley yacc */
/*
X Berkeley yacc modified so only tables and
X yydebug and yylval are global
X #define YYGLOBAL -- gives standard byacc
X #define YYPURE -- gives a reentrant parser
X
X Mike Brennan 11/05/91
*/
#line 31 "parse.y"
#include <stdio.h>
#include "mawk.h"
#include "code.h"
#include "symtype.h"
#include "memory.h"
#include "bi_funct.h"
#include "bi_vars.h"
#include "jmp.h"
#include "field.h"
#include "files.h"
X
#ifdef YYXBYACC
#define YYBYACC 1
#endif
X
#define YYMAXDEPTH 200
X
/* Bison's use of MSDOS and ours clashes */
#undef MSDOS
X
extern void PROTO( eat_nl, (void) ) ;
static void PROTO( resize_fblock, (FBLOCK *, INST *) ) ;
static void PROTO( code_array, (SYMTAB *) ) ;
static void PROTO( code_call_id, (CA_REC *, SYMTAB *) ) ;
static void PROTO( field_A2I, (void)) ;
static int PROTO( current_offset, (void) ) ;
static void PROTO( check_var, (SYMTAB *) ) ;
static void PROTO( check_array, (SYMTAB *) ) ;
static void PROTO( RE_as_arg, (void)) ;
X
static int scope ;
static FBLOCK *active_funct ;
X /* when scope is SCOPE_FUNCT */
X
#define code_address(x) if( is_local(x) )\
X { code1(L_PUSHA) ; code1((x)->offset) ; }\
X else code2(_PUSHA, (x)->stval.cp)
X
/* this nonsense caters to MSDOS large model */
#define CODE_FE_PUSHA() code_ptr->ptr = (PTR) 0 ; code1(FE_PUSHA)
X
#line 74 "parse.y"
typedef union{
CELL *cp ;
SYMTAB *stp ;
INST *start ; /* code starting address */
PF_CP fp ; /* ptr to a (print/printf) or (sub/gsub) function */
BI_REC *bip ; /* ptr to info about a builtin */
FBLOCK *fbp ; /* ptr to a function block */
ARG2_REC *arg2p ;
CA_REC *ca_p ;
int ival ;
PTR ptr ;
} YYSTYPE;
#line 69 "y.tab.c"
#define UNEXPECTED 257
#define BAD_DECIMAL 258
#define NL 259
#define SEMI_COLON 260
#define LBRACE 261
#define RBRACE 262
#define LBOX 263
#define RBOX 264
#define COMMA 265
#define IO_OUT 266
#define ASSIGN 267
#define ADD_ASG 268
#define SUB_ASG 269
#define MUL_ASG 270
#define DIV_ASG 271
#define MOD_ASG 272
#define POW_ASG 273
#define QMARK 274
#define COLON 275
#define OR 276
#define AND 277
#define IN 278
#define MATCH 279
#define EQ 280
#define NEQ 281
#define LT 282
#define LTE 283
#define GT 284
#define GTE 285
#define CAT 286
#define GETLINE 287
#define PLUS 288
#define MINUS 289
#define MUL 290
#define DIV 291
#define MOD 292
#define NOT 293
#define UMINUS 294
#define IO_IN 295
#define PIPE 296
#define POW 297
#define INC_or_DEC 298
#define DOLLAR 299
#define FIELD 300
#define LPAREN 301
#define RPAREN 302
#define DOUBLE 303
#define STRING_ 304
#define RE 305
#define ID 306
#define D_ID 307
#define FUNCT_ID 308
#define BUILTIN 309
#define LENGTH 310
#define PRINT 311
#define PRINTF 312
#define SPLIT 313
#define MATCH_FUNC 314
#define SUB 315
#define GSUB 316
#define DO 317
#define WHILE 318
#define FOR 319
#define BREAK 320
#define CONTINUE 321
#define IF 322
#define ELSE 323
#define DELETE 324
#define BEGIN 325
#define END 326
#define EXIT 327
#define NEXT 328
#define RETURN 329
#define FUNCTION 330
#define YYERRCODE 256
short yylhs[] = { -1,
X 0, 0, 36, 36, 36, 37, 40, 37, 41, 37,
X 42, 37, 43, 44, 37, 1, 1, 2, 2, 3,
X 3, 4, 4, 4, 4, 4, 4, 4, 4, 45,
X 45, 13, 13, 13, 13, 13, 13, 13, 13, 13,
X 13, 13, 13, 13, 13, 13, 46, 13, 47, 13,
X 48, 49, 13, 14, 14, 15, 15, 15, 15, 15,
X 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
X 15, 15, 15, 15, 10, 25, 25, 26, 26, 8,
X 8, 5, 4, 27, 27, 6, 6, 6, 7, 7,
X 50, 50, 17, 4, 51, 4, 52, 4, 16, 4,
X 4, 18, 18, 19, 19, 53, 53, 13, 13, 10,
X 15, 15, 4, 20, 4, 11, 11, 11, 11, 11,
X 15, 13, 13, 13, 13, 13, 13, 13, 15, 22,
X 54, 54, 15, 23, 4, 4, 21, 21, 15, 15,
X 15, 15, 15, 55, 12, 12, 9, 9, 15, 28,
X 28, 24, 24, 38, 29, 30, 30, 34, 34, 35,
X 35, 39, 15, 31, 31, 32, 32, 32, 33, 33,
};
short yylen[] = { 2,
X 1, 2, 1, 1, 2, 1, 0, 3, 0, 3,
X 0, 3, 0, 0, 6, 3, 3, 1, 1, 1,
X 2, 1, 2, 1, 2, 2, 2, 1, 2, 1,
X 1, 1, 3, 3, 3, 3, 3, 3, 3, 3,
X 3, 3, 3, 3, 3, 3, 0, 4, 0, 4,
X 0, 0, 7, 1, 2, 1, 1, 1, 3, 1,
X 3, 3, 3, 3, 3, 3, 2, 2, 2, 1,
X 2, 2, 2, 2, 1, 0, 1, 1, 3, 5,
X 1, 0, 5, 1, 1, 1, 3, 2, 3, 3,
X 0, 2, 4, 2, 1, 4, 1, 7, 4, 2,
X 4, 3, 4, 1, 2, 1, 2, 3, 5, 5,
X 5, 6, 7, 6, 2, 1, 2, 6, 2, 3,
X 1, 3, 3, 3, 3, 3, 3, 3, 2, 5,
X 1, 3, 6, 1, 2, 3, 2, 3, 1, 2,
X 2, 3, 4, 1, 1, 1, 2, 3, 6, 1,
X 1, 1, 3, 2, 4, 2, 2, 0, 1, 1,
X 3, 1, 3, 2, 2, 1, 3, 3, 2, 2,
};
short yydefred[] = { 0,
X 162, 0, 144, 0, 0, 0, 0, 0, 116, 0,
X 56, 57, 60, 0, 82, 82, 81, 0, 0, 150,
X 151, 7, 9, 0, 0, 6, 70, 0, 0, 0,
X 0, 0, 0, 0, 0, 0, 0, 1, 3, 4,
X 0, 0, 0, 30, 31, 84, 85, 97, 0, 0,
X 0, 0, 0, 0, 0, 0, 0, 22, 0, 20,
X 0, 0, 0, 0, 0, 28, 82, 24, 0, 0,
X 0, 0, 0, 0, 0, 0, 0, 72, 74, 0,
X 119, 0, 0, 0, 71, 0, 0, 0, 0, 0,
X 0, 0, 156, 157, 2, 0, 0, 0, 0, 0,
X 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
X 73, 13, 51, 47, 49, 0, 0, 0, 0, 0,
X 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
X 0, 0, 0, 131, 129, 0, 154, 0, 5, 147,
X 145, 146, 0, 17, 25, 0, 0, 26, 27, 0,
X 82, 0, 135, 29, 0, 137, 0, 16, 21, 23,
X 100, 0, 104, 0, 0, 115, 0, 0, 0, 0,
X 0, 0, 0, 0, 0, 120, 0, 59, 0, 0,
X 163, 0, 0, 0, 0, 8, 10, 0, 0, 0,
X 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
X 0, 0, 0, 0, 0, 108, 0, 40, 41, 42,
X 43, 44, 45, 18, 12, 19, 0, 0, 0, 0,
X 0, 0, 0, 0, 0, 0, 160, 0, 0, 148,
X 0, 102, 0, 0, 0, 0, 136, 138, 95, 0,
X 105, 106, 0, 0, 0, 0, 0, 86, 0, 0,
X 0, 0, 0, 0, 0, 0, 0, 164, 0, 0,
X 165, 0, 0, 0, 0, 0, 0, 0, 143, 132,
X 0, 155, 0, 99, 0, 103, 93, 0, 96, 107,
X 101, 88, 0, 0, 0, 0, 0, 0, 0, 0,
X 109, 0, 168, 170, 167, 169, 80, 130, 0, 0,
X 52, 0, 161, 0, 0, 0, 0, 83, 0, 0,
X 0, 110, 118, 112, 133, 15, 0, 0, 152, 149,
X 114, 0, 0, 0, 0, 113, 98, 153,
};
short yydgoto[] = { 25,
X 58, 215, 59, 60, 86, 246, 82, 27, 28, 29,
X 30, 143, 61, 32, 33, 62, 63, 64, 165, 65,
X 66, 34, 226, 320, 248, 249, 67, 35, 36, 37,
X 181, 182, 261, 228, 229, 38, 39, 40, 41, 91,
X 92, 124, 202, 300, 68, 204, 205, 203, 317, 285,
X 240, 69, 244, 135, 42,
};
short yysindex[] = { 35,
X 0, 278, 0, 2243, 2243, 2243, -26, 2153, 0, 2273,
X 0, 0, 0, -286, 0, 0, 0, -269, -228, 0,
X 0, 0, 0, -255, 35, 0, 0, 2243, 284, 2166,
X 2547, 2243, 116, -257, -161, -246, -159, 0, 0, 0,
X -246, -63, -124, 0, 0, 0, 0, 0, -157, -151,
X -196, -196, -148, -141, 1729, -196, 1729, 0, 130, 0,
X 2499, 352, 352, 69, 352, 0, 0, 0, 352, 2273,
X -286, -220, -211, -211, -211, -282, 0, 0, 0, 0,
X 0, -232, 2146, 2093, 0, -96, -132, -122, 2273, 2273,
X -246, -246, 0, 0, 0, -120, 2273, 2273, 2273, 2273,
X 2273, 2273, 2273, 2273, 2273, 2273, 2273, 2273, 2273, 2273,
X 0, 0, 0, 0, 0, -110, 2273, 2273, 2273, 2273,
SHAR_EOF
true || echo 'restore of Xparse.c failed'
fi
echo 'End of part 2'
echo 'File Xparse.c is continued in part 3'
echo 3 > _shar_seq_.tmp
exit 0
exit 0 # Just in case...
--
Andrew Patrick acting as Comp.Sources.Reviewed Moderator
Department of Communications, Ottawa, CANADA
csr@calvin.dgbt.doc.CA
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads