Compare commits

...
Author SHA1 Message Date
cvs2svn 2641b0c407 This commit was manufactured by cvs2svn to create tag
'RELENG_4_1_1_RELEASE'.
2000-09-25 21:57:54 +00:00
241 changed files with 43 additions and 63764 deletions

No files matched your search

-286
View File
@@ -1,286 +0,0 @@
# Makefile for GNU Awk.
#
# Copyright (C) 1986, 1988-2000 the Free Software Foundation, Inc.
#
# This file is part of GAWK, the GNU implementation of the
# AWK Programming Language.
#
# GAWK is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# GAWK is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
@SET_MAKE@
MAKEINFO = makeinfo --no-split
srcdir = @srcdir@
VPATH = @srcdir@
CC = @CC@
YACC = @YACC@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
ALLOCA = @ALLOCA@
LN = ln
LN_S = @LN_S@
exec_prefix = @exec_prefix@
prefix = @prefix@
binprefix =
manprefix =
bindir = @bindir@
libdir = @libdir@
manexta = 1
mandir = @mandir@/man$(manexta)
manext = .$(manexta)
infodir = @infodir@
datadir = @datadir@/awk
libexecdir = @libexecdir@/awk
DEFPATH = ".:$(datadir)"
SHELL = /bin/sh
CPPFLAGS = @CPPFLAGS@
CFLAGS = @CFLAGS@
COMPFLAGS = -DGAWK -I. -I$(srcdir) $(CPPFLAGS) @DEFS@ $(CFLAGS)
# object files
AWKOBJS = array.o builtin.o eval.o field.o gawkmisc.o io.o main.o \
missing.o msg.o node.o re.o version.o
ALLOBJS = $(AWKOBJS) awktab.o
# LIBOBJS
# GNU and other stuff that gawk uses as library routines.
LIBOBJS= getopt.o getopt1.o regex.o dfa.o random.o $(ALLOCA)
# source and documentation files
SRC = array.c builtin.c eval.c field.c gawkmisc.c io.c main.c \
missing.c msg.c node.c re.c version.c
ALLSRC= $(SRC) awktab.c
AWKSRC= awk.h awk.y custom.h $(ALLSRC) patchlevel.h protos.h random.h
LIBSRC = alloca.c dfa.c dfa.h regex.c regex.h getopt.h getopt.c getopt1.c random.c
COPIES = missing/system.c missing/tzset.c \
missing/memcmp.c missing/memcpy.c missing/memset.c \
missing/strncasecmp.c missing/strchr.c \
missing/strerror.c missing/strtod.c \
missing/strftime.c missing/strftime.3
DOCS= doc/gawk.1 doc/gawk.texi doc/texinfo.tex
TEXFILES= doc/gawk.aux doc/gawk.cp doc/gawk.cps doc/gawk.fn doc/gawk.fns \
doc/gawk.ky doc/gawk.kys doc/gawk.pg doc/gawk.pgs doc/gawk.toc \
doc/gawk.tp doc/gawk.tps doc/gawk.vr doc/gawk.vrs
MISC = NEWS COPYING FUTURES Makefile.in PROBLEMS README PORTS POSIX.STD \
configure configure.in acconfig.h configh.in ACKNOWLEDGMENT \
ChangeLog INSTALL LIMITATIONS install-sh mkinstalldirs aclocal.m4 \
stamp-h.in
OTHERS= doc pc atari vms README_d posix awklib
ALLDOC= doc/gawk.dvi $(TEXFILES) doc/gawk.info*
MAKEFILEIN = Makefile.in awklib/Makefile.in doc/Makefile.in test/Makefile.in
# Release of gawk. There can be no leading or trailing white space here!
REL=3.0
# clear out suffixes list
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:
$(CC) -c $(COMPFLAGS) $<
# rules to build gawk
all: gawk awklib/all doc/all
# stuff to make sure that configure has been run.
$(srcdir)/configure: configure.in aclocal.m4
cd $(srcdir) && autoconf
# autoheader might not change confh.in, so touch a stamp file
$(srcdir)/configh.in: stamp-h.in
$(srcdir)/stamp-h.in: configure.in aclocal.m4 acconfig.h
cd $(srcdir) && autoheader
date > $(srcdir)/stamp-h.in
config.h: stamp-h
stamp-h: configh.in config.status
$(SHELL) ./config.status
Makefile: $(MAKEFILEIN) config.status
$(SHELL) ./config.status
config.status: configure
$(SHELL) ./config.status --recheck
# Note: if you need something at both compile time and link time, like -pg,
# you will have to edit the Makefile manually to set LDFLAGS.
gawk: $(ALLOBJS) $(LIBOBJS) $(REOBJS)
$(CC) -o gawk $(CFLAGS) $(LDFLAGS) $(ALLOBJS) $(LIBOBJS) $(REOBJS) $(LIBS)
$(ALLOBJS): awk.h dfa.h regex.h config.h custom.h
$(LIBOBJS): config.h custom.h
# SunOS make's (at least) VPATH doesn't do subdirectories...
# Solaris make doesn't allow $< in the actual rule
gawkmisc.o: $(srcdir)/atari/gawkmisc.atr \
$(srcdir)/pc/gawkmisc.pc $(srcdir)/posix/gawkmisc.c \
$(srcdir)/vms/gawkmisc.vms
$(CC) -c $(COMPFLAGS) -DDEFPATH='$(DEFPATH)' $(srcdir)/gawkmisc.c
getopt.o: getopt.h
getopt1.o: getopt.h
builtin.o: random.h
main.o: patchlevel.h
awktab.c: awk.y
$(YACC) -v $(srcdir)/awk.y && \
if test -f y.tab.c ; then mv y.tab.c ytab.c ; else true ; fi && \
sed '/^extern char .malloc(), .realloc();$$/d' ytab.c >awktab.c && \
rm ytab.c
# VMS POSIX make won't apply the default .c.o rule to awktab.o for some reason
awktab.o: awktab.c awk.h
$(CC) -c $(COMPFLAGS) $(srcdir)/awktab.c
alloca.o: alloca.c
install: gawk info installdirs
-rm -f $(bindir)/gawk
fullname=gawk-$(REL).`./gawk '{print $$3}' $(srcdir)/patchlevel.h` ; \
$(INSTALL_PROGRAM) gawk $(bindir)/$$fullname ; \
(cd $(bindir); $(LN) $$fullname gawk)
(cd $(bindir); \
if [ ! -f awk ]; \
then $(LN_S) gawk awk; \
fi; exit 0)
cd doc && $(MAKE) install
cd awklib && $(MAKE) install
installdirs: mkinstalldirs
$(srcdir)/mkinstalldirs $(bindir) $(datadir) \
$(libdir) $(infodir) $(mandir) $(libexecdir)
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
uninstall:
(cd $(bindir); \
if [ -f awk ] && cmp awk gawk > /dev/null; then rm -f awk; fi)
(fullname=gawk-$(REL).`gawk '{print $$3}' $(srcdir)/patchlevel.h` ; \
cd $(bindir); \
if cmp gawk $$fullname; then rm -f gawk; fi ; \
rm -f $(bindir)/$$fullname)
cd doc && $(MAKE) uninstall
cd awklib && $(MAKE) uninstall
-rmdir $(datadir) $(libexecdir)
# auxiliary rules for release maintenance
lint: $(ALLSRC)
lint -hcbax $(COMPFLAGS) $(ALLSRC)
xref:
cxref -c $(COMPFLAGS) $(ALLSRC) | grep -v ' /' >xref
mostlyclean:
: mostly clean does nothing for gawk
: use "make clean" to really clean things out
clean:
rm -rf gawk *.o core */core y.output
cd doc && $(MAKE) clean
cd test && $(MAKE) clean
cd awklib && $(MAKE) clean
local-distclean:
rm -f Makefile *.orig *.rej */*.orig */*.rej awk.output \
gmon.out make.out config.h config.status config.cache \
config.log stamp-h tags TAGS *~
distclean: clean local-distclean
cd doc && $(MAKE) distclean
cd awklib && $(MAKE) distclean
cd test && $(MAKE) distclean
maintainer-clean: clean local-distclean
@echo "This command is intended for maintainers to use; it"
@echo "deletes files that may require special tools to rebuild."
rm -f awktab.c
cd doc && $(MAKE) maintainer-clean
cd test && $(MAKE) maintainer-clean
cd awklib && $(MAKE) maintainer-clean
clobber: maintainer-clean
TAGS:
etags $(AWKSRC)
tags:
ctags $(AWKSRC)
dvi: $(srcdir)/doc/gawk.texi
cd doc && $(MAKE) dvi
info: $(srcdir)/doc/gawk.texi
cd doc && $(MAKE) info
doc/all:
cd doc && $(MAKE) all
awklib/all: gawk
cd awklib && $(MAKE) CFLAGS="$(CFLAGS)" all
dist: $(AWKSRC) $(LIBSRC) $(DOCS) $(MISC) $(COPIES) awklib/stamp-eg info distclean
-rm -rf gawk-$(REL)*
dir=gawk-$(REL).`gawk '{print $$3}' patchlevel.h` && \
mkdir $$dir && \
cp -pr $(AWKSRC) $(LIBSRC) $(MISC) $$dir && \
mkdir $$dir/missing && \
cp -p $(COPIES) $$dir/missing && \
for i in $(OTHERS); \
do \
cp -pr $$i $$dir ; \
done && \
cp -pr test $$dir && \
find $$dir -type d -exec chmod 777 {} ';' && \
find $$dir -print | doschk && \
tar -cf - $$dir | gzip > $$dir.tar.gz && \
rm -fr $$dir
awklib/stamp-eg:
cd awklib ; $(MAKE) stamp-eg
check: gawk
cd test; $(MAKE) -k
test: check
-46
View File
@@ -1,46 +0,0 @@
Date: Sat, 22 Apr 2000 06:07:06 -0600 (MDT)
From: "Nelson H. F. Beebe" <[email protected]>
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: gawk-3.0.4 and a GNU/Linux gotcha
Yesterday, I was assisting a colleague install some software on his
GNU/Linux machine for which uname -r reports 2.2.14.
A (mis)feature of this system, which I've never encountered before,
broke the build of one of my programs, and also of gawk-3.0.4.
Namely, the kernel will not execute anything that resides in /tmp,
though it will if the same script is in /usr/tmp!
% cat /tmp/foo.sh
#! /bin/sh
echo hello
ls -l /tmp/foo.sh
-rwxr-xr-x 1 othmer math 22 Apr 21 10:34 /tmp/foo.sh*
% /tmp/foo.sh
bash: /tmp/foo.sh: Permission denied
% cp /tmp/foo.sh /usr/tmp
% /usr/tmp/foo.sh
hello
Thus, programs that do a temporary install in /tmp, as some of mine do
in order to run the validation suite, will fail.
gawk-3.0.4, and likely other gawk versions, hits this problem too. It
fails because test/poundbang starts with
#! /tmp/gawk -f
I tracked down where it comes from:
% grep /tmp /etc/fstab
/dev/hda3 /tmp ext2 rw,nosuid,noexec,nouser,auto,async,nodev 1 1
!!!!!!
Since this is done via a mount command, potentially ANY directory tree
could be mounted with noexec.
-129
View File
@@ -1,129 +0,0 @@
dnl
dnl aclocal.m4 --- autoconf input file for gawk
dnl
dnl Copyright (C) 1995, 1996, 1998, 1999, 2000 the Free Software Foundation, Inc.
dnl
dnl This file is part of GAWK, the GNU implementation of the
dnl AWK Progamming Language.
dnl
dnl GAWK is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl GAWK is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
dnl
dnl gawk-specific macros for autoconf. one day hopefully part of autoconf
AC_DEFUN(GAWK_AC_C_STRINGIZE, [
AC_REQUIRE([AC_PROG_CPP])
AC_MSG_CHECKING([for ANSI stringizing capability])
AC_CACHE_VAL(gawk_cv_c_stringize,
AC_EGREP_CPP([#teststring],[
#define x(y) #y
char *s = x(teststring);
], gawk_cv_c_stringize=no, gawk_cv_c_stringize=yes))
if test "${gawk_cv_c_stringize}" = yes
then
AC_DEFINE(HAVE_STRINGIZE)
fi
AC_MSG_RESULT([${gawk_cv_c_stringize}])
])dnl
dnl By default, many hosts won't let programs access large files;
dnl one must use special compiler options to get large-file access to work.
dnl For more details about this brain damage please see:
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
dnl Written by Paul Eggert <[email protected]>.
dnl Internal subroutine of GAWK_AC_SYS_LARGEFILE.
dnl GAWK_AC_SYS_LARGEFILE_TEST_INCLUDES
AC_DEFUN(GAWK_AC_SYS_LARGEFILE_TEST_INCLUDES,
[[#include <sys/types.h>
int a[(off_t) 9223372036854775807 == 9223372036854775807 ? 1 : -1];
]])
dnl Internal subroutine of GAWK_AC_SYS_LARGEFILE.
dnl GAWK_AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, FUNCTION-BODY)
AC_DEFUN(GAWK_AC_SYS_LARGEFILE_MACRO_VALUE,
[AC_CACHE_CHECK([for $1 value needed for large files], $3,
[$3=no
AC_TRY_COMPILE(GAWK_AC_SYS_LARGEFILE_TEST_INCLUDES
$5
,
[$6],
,
[AC_TRY_COMPILE([#define $1 $2]
GAWK_AC_SYS_LARGEFILE_TEST_INCLUDES
$5
,
[$6],
[$3=$2])])])
if test "[$]$3" != no; then
AC_DEFINE_UNQUOTED([$1], [$]$3, [$4])
fi])
AC_DEFUN(GAWK_AC_SYS_LARGEFILE,
[AC_ARG_ENABLE(largefile,
[ --disable-largefile omit support for large files])
if test "$enable_largefile" != no; then
AC_CACHE_CHECK([for special C compiler options needed for large files],
gawk_cv_sys_largefile_CC,
[gawk_cv_sys_largefile_CC=no
if test "$GCC" != yes; then
# IRIX 6.2 and later do not support large files by default,
# so use the C compiler's -n32 option if that helps.
AC_TRY_COMPILE(GAWK_AC_SYS_LARGEFILE_TEST_INCLUDES, , ,
[ac_save_CC="$CC"
CC="$CC -n32"
AC_TRY_COMPILE(GAWK_AC_SYS_LARGEFILE_TEST_INCLUDES, ,
gawk_cv_sys_largefile_CC=' -n32')
CC="$ac_save_CC"])
fi])
if test "$gawk_cv_sys_largefile_CC" != no; then
CC="$CC$gawk_cv_sys_largefile_CC"
fi
GAWK_AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64,
gawk_cv_sys_file_offset_bits,
[Number of bits in a file offset, on hosts where this is settable.])
GAWK_AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1,
gawk_cv_sys_largefile_source,
[Define to make ftello visible on some hosts (e.g. HP-UX 10.20).],
[#include <stdio.h>], [return !ftello;])
GAWK_AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1,
gawk_cv_sys_large_files,
[Define for large files, on AIX-style hosts.])
GAWK_AC_SYS_LARGEFILE_MACRO_VALUE(_XOPEN_SOURCE, 500,
gawk_cv_sys_xopen_source,
[Define to make ftello visible on some hosts (e.g. glibc 2.1.3).],
[#include <stdio.h>], [return !ftello;])
fi
])
dnl Check for AIX and add _XOPEN_SOURCE_EXTENDED
AC_DEFUN(GAWK_AC_AIX_TWEAK, [
AC_MSG_CHECKING([for AIX compilation hacks])
AC_CACHE_VAL(gawk_cv_aix_hack, [
if test -d /lpp/bos
then
CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
gawk_cv_aix_hack=yes
else
gawk_cv_aix_hack=no
fi
])dnl
AC_MSG_RESULT([${gawk_cv_aix_hack}])
])dnl
-496
View File
@@ -1,496 +0,0 @@
/* alloca.c -- allocate automatically reclaimed memory
(Mostly) portable public-domain implementation -- D A Gwyn
This implementation of the PWB library alloca function,
which is used to allocate space off the run-time stack so
that it is automatically reclaimed upon procedure exit,
was inspired by discussions with J. Q. Johnson of Cornell.
J.Otto Tennant <[email protected]> contributed the Cray support.
There are some preprocessor constants that can
be defined when compiling for your specific system, for
improved efficiency; however, the defaults should be okay.
The general concept of this implementation is to keep
track of all alloca-allocated blocks, and reclaim any
that are found to be deeper in the stack than the current
invocation. This heuristic does not reclaim storage as
soon as it becomes invalid, but it will do so eventually.
As a special case, alloca(0) reclaims storage without
allocating any. It is a good idea to use alloca(0) in
your main control loop, etc. to force garbage collection. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef emacs
#include "blockinput.h"
#endif
/* If compiling with GCC 2, this file's not needed. */
#if !defined (__GNUC__) || __GNUC__ < 2
/* If someone has defined alloca as a macro,
there must be some other way alloca is supposed to work. */
#ifndef alloca
#ifdef emacs
#ifdef static
/* actually, only want this if static is defined as ""
-- this is for usg, in which emacs must undefine static
in order to make unexec workable
*/
#ifndef STACK_DIRECTION
you
lose
-- must know STACK_DIRECTION at compile-time
#endif /* STACK_DIRECTION undefined */
#endif /* static */
#endif /* emacs */
/* If your stack is a linked list of frames, you have to
provide an "address metric" ADDRESS_FUNCTION macro. */
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
long i00afunc ();
#define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg))
#else
#define ADDRESS_FUNCTION(arg) &(arg)
#endif
#if __STDC__
typedef void *pointer;
#else
typedef char *pointer;
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef malloc
/* Different portions of Emacs need to call different versions of
malloc. The Emacs executable needs alloca to call xmalloc, because
ordinary malloc isn't protected from input signals. On the other
hand, the utilities in lib-src need alloca to call malloc; some of
them are very simple, and don't have an xmalloc routine.
Non-Emacs programs expect this to call xmalloc.
Callers below should use malloc. */
#ifndef emacs
#define malloc xmalloc
#endif
extern pointer malloc ();
#endif /* malloc */
/* Define STACK_DIRECTION if you know the direction of stack
growth for your system; otherwise it will be automatically
deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#ifndef STACK_DIRECTION
#define STACK_DIRECTION 0 /* Direction unknown. */
#endif
#if STACK_DIRECTION != 0
#define STACK_DIR STACK_DIRECTION /* Known at compile-time. */
#else /* STACK_DIRECTION == 0; need run-time code. */
static int stack_dir; /* 1 or -1 once known. */
#define STACK_DIR stack_dir
static void
find_stack_direction ()
{
static char *addr = NULL; /* Address of first `dummy', once known. */
auto char dummy; /* To get stack address. */
if (addr == NULL)
{ /* Initial entry. */
addr = ADDRESS_FUNCTION (dummy);
find_stack_direction (); /* Recurse once. */
}
else
{
/* Second entry. */
if (ADDRESS_FUNCTION (dummy) > addr)
stack_dir = 1; /* Stack grew upward. */
else
stack_dir = -1; /* Stack grew downward. */
}
}
#endif /* STACK_DIRECTION == 0 */
/* An "alloca header" is used to:
(a) chain together all alloca'ed blocks;
(b) keep track of stack depth.
It is very important that sizeof(header) agree with malloc
alignment chunk size. The following default should work okay. */
#ifndef ALIGN_SIZE
#define ALIGN_SIZE sizeof(double)
#endif
typedef union hdr
{
char align[ALIGN_SIZE]; /* To force sizeof(header). */
struct
{
union hdr *next; /* For chaining headers. */
char *deep; /* For stack depth measure. */
} h;
} header;
static header *last_alloca_header = NULL; /* -> last alloca header. */
/* Return a pointer to at least SIZE bytes of storage,
which will be automatically reclaimed upon exit from
the procedure that called alloca. Originally, this space
was supposed to be taken from the current stack frame of the
caller, but that method cannot be made to work for some
implementations of C, for example under Gould's UTX/32. */
pointer
alloca (size)
unsigned size;
{
auto char probe; /* Probes stack depth: */
register char *depth = ADDRESS_FUNCTION (probe);
#if STACK_DIRECTION == 0
if (STACK_DIR == 0) /* Unknown growth direction. */
find_stack_direction ();
#endif
/* Reclaim garbage, defined as all alloca'd storage that
was allocated from deeper in the stack than currently. */
{
register header *hp; /* Traverses linked list. */
#ifdef emacs
BLOCK_INPUT;
#endif
for (hp = last_alloca_header; hp != NULL;)
if ((STACK_DIR > 0 && hp->h.deep > depth)
|| (STACK_DIR < 0 && hp->h.deep < depth))
{
register header *np = hp->h.next;
free ((pointer) hp); /* Collect garbage. */
hp = np; /* -> next header. */
}
else
break; /* Rest are not deeper. */
last_alloca_header = hp; /* -> last valid storage. */
#ifdef emacs
UNBLOCK_INPUT;
#endif
}
if (size == 0)
return NULL; /* No allocation required. */
/* Allocate combined header + user data storage. */
{
register pointer new = malloc (sizeof (header) + size);
/* Address of header. */
((header *) new)->h.next = last_alloca_header;
((header *) new)->h.deep = depth;
last_alloca_header = (header *) new;
/* User storage begins just after header. */
return (pointer) ((char *) new + sizeof (header));
}
}
#if defined (CRAY) && defined (CRAY_STACKSEG_END)
#ifdef DEBUG_I00AFUNC
#include <stdio.h>
#endif
#ifndef CRAY_STACK
#define CRAY_STACK
#ifndef CRAY2
/* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */
struct stack_control_header
{
long shgrow:32; /* Number of times stack has grown. */
long shaseg:32; /* Size of increments to stack. */
long shhwm:32; /* High water mark of stack. */
long shsize:32; /* Current size of stack (all segments). */
};
/* The stack segment linkage control information occurs at
the high-address end of a stack segment. (The stack
grows from low addresses to high addresses.) The initial
part of the stack segment linkage control information is
0200 (octal) words. This provides for register storage
for the routine which overflows the stack. */
struct stack_segment_linkage
{
long ss[0200]; /* 0200 overflow words. */
long sssize:32; /* Number of words in this segment. */
long ssbase:32; /* Offset to stack base. */
long:32;
long sspseg:32; /* Offset to linkage control of previous
segment of stack. */
long:32;
long sstcpt:32; /* Pointer to task common address block. */
long sscsnm; /* Private control structure number for
microtasking. */
long ssusr1; /* Reserved for user. */
long ssusr2; /* Reserved for user. */
long sstpid; /* Process ID for pid based multi-tasking. */
long ssgvup; /* Pointer to multitasking thread giveup. */
long sscray[7]; /* Reserved for Cray Research. */
long ssa0;
long ssa1;
long ssa2;
long ssa3;
long ssa4;
long ssa5;
long ssa6;
long ssa7;
long sss0;
long sss1;
long sss2;
long sss3;
long sss4;
long sss5;
long sss6;
long sss7;
};
#else /* CRAY2 */
/* The following structure defines the vector of words
returned by the STKSTAT library routine. */
struct stk_stat
{
long now; /* Current total stack size. */
long maxc; /* Amount of contiguous space which would
be required to satisfy the maximum
stack demand to date. */
long high_water; /* Stack high-water mark. */
long overflows; /* Number of stack overflow ($STKOFEN) calls. */
long hits; /* Number of internal buffer hits. */
long extends; /* Number of block extensions. */
long stko_mallocs; /* Block allocations by $STKOFEN. */
long underflows; /* Number of stack underflow calls ($STKRETN). */
long stko_free; /* Number of deallocations by $STKRETN. */
long stkm_free; /* Number of deallocations by $STKMRET. */
long segments; /* Current number of stack segments. */
long maxs; /* Maximum number of stack segments so far. */
long pad_size; /* Stack pad size. */
long current_address; /* Current stack segment address. */
long current_size; /* Current stack segment size. This
number is actually corrupted by STKSTAT to
include the fifteen word trailer area. */
long initial_address; /* Address of initial segment. */
long initial_size; /* Size of initial segment. */
};
/* The following structure describes the data structure which trails
any stack segment. I think that the description in 'asdef' is
out of date. I only describe the parts that I am sure about. */
struct stk_trailer
{
long this_address; /* Address of this block. */
long this_size; /* Size of this block (does not include
this trailer). */
long unknown2;
long unknown3;
long link; /* Address of trailer block of previous
segment. */
long unknown5;
long unknown6;
long unknown7;
long unknown8;
long unknown9;
long unknown10;
long unknown11;
long unknown12;
long unknown13;
long unknown14;
};
#endif /* CRAY2 */
#endif /* not CRAY_STACK */
#ifdef CRAY2
/* Determine a "stack measure" for an arbitrary ADDRESS.
I doubt that "lint" will like this much. */
static long
i00afunc (long *address)
{
struct stk_stat status;
struct stk_trailer *trailer;
long *block, size;
long result = 0;
/* We want to iterate through all of the segments. The first
step is to get the stack status structure. We could do this
more quickly and more directly, perhaps, by referencing the
$LM00 common block, but I know that this works. */
STKSTAT (&status);
/* Set up the iteration. */
trailer = (struct stk_trailer *) (status.current_address
+ status.current_size
- 15);
/* There must be at least one stack segment. Therefore it is
a fatal error if "trailer" is null. */
if (trailer == 0)
abort ();
/* Discard segments that do not contain our argument address. */
while (trailer != 0)
{
block = (long *) trailer->this_address;
size = trailer->this_size;
if (block == 0 || size == 0)
abort ();
trailer = (struct stk_trailer *) trailer->link;
if ((block <= address) && (address < (block + size)))
break;
}
/* Set the result to the offset in this segment and add the sizes
of all predecessor segments. */
result = address - block;
if (trailer == 0)
{
return result;
}
do
{
if (trailer->this_size <= 0)
abort ();
result += trailer->this_size;
trailer = (struct stk_trailer *) trailer->link;
}
while (trailer != 0);
/* We are done. Note that if you present a bogus address (one
not in any segment), you will get a different number back, formed
from subtracting the address of the first block. This is probably
not what you want. */
return (result);
}
#else /* not CRAY2 */
/* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP.
Determine the number of the cell within the stack,
given the address of the cell. The purpose of this
routine is to linearize, in some sense, stack addresses
for alloca. */
static long
i00afunc (long address)
{
long stkl = 0;
long size, pseg, this_segment, stack;
long result = 0;
struct stack_segment_linkage *ssptr;
/* Register B67 contains the address of the end of the
current stack segment. If you (as a subprogram) store
your registers on the stack and find that you are past
the contents of B67, you have overflowed the segment.
B67 also points to the stack segment linkage control
area, which is what we are really interested in. */
stkl = CRAY_STACKSEG_END ();
ssptr = (struct stack_segment_linkage *) stkl;
/* If one subtracts 'size' from the end of the segment,
one has the address of the first word of the segment.
If this is not the first segment, 'pseg' will be
nonzero. */
pseg = ssptr->sspseg;
size = ssptr->sssize;
this_segment = stkl - size;
/* It is possible that calling this routine itself caused
a stack overflow. Discard stack segments which do not
contain the target address. */
while (!(this_segment <= address && address <= stkl))
{
#ifdef DEBUG_I00AFUNC
fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl);
#endif
if (pseg == 0)
break;
stkl = stkl - pseg;
ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
this_segment = stkl - size;
}
result = address - this_segment;
/* If you subtract pseg from the current end of the stack,
you get the address of the previous stack segment's end.
This seems a little convoluted to me, but I'll bet you save
a cycle somewhere. */
while (pseg != 0)
{
#ifdef DEBUG_I00AFUNC
fprintf (stderr, "%011o %011o\n", pseg, size);
#endif
stkl = stkl - pseg;
ssptr = (struct stack_segment_linkage *) stkl;
size = ssptr->sssize;
pseg = ssptr->sspseg;
result += size;
}
return (result);
}
#endif /* not CRAY2 */
#endif /* CRAY */
#endif /* no alloca */
#endif /* not GCC version 2 */
-3983
View File
File diff suppressed because it is too large. Load diff
-225
View File
@@ -1,225 +0,0 @@
/* configh.in. Generated automatically from configure.in by autoheader. */
/*
* acconfig.h -- configuration definitions for gawk.
*/
/*
* Copyright (C) 1995-2000 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
*
* GAWK is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GAWK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
#undef _ALL_SOURCE
#endif
/* Define if using alloca.c. */
#undef C_ALLOCA
/* Define if type char is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
#undef __CHAR_UNSIGNED__
#endif
/* Define to empty if the keyword does not work. */
#undef const
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END
/* Define to the type of elements in the array set by `getgroups'.
Usually this is either `int' or `gid_t'. */
#undef GETGROUPS_T
/* Define if the `getpgrp' function takes no argument. */
#undef GETPGRP_VOID
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define if you have alloca, as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if your struct stat has st_blksize. */
#undef HAVE_ST_BLKSIZE
/* Define if you have the ANSI # stringizing operator in cpp. */
#undef HAVE_STRINGIZE
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define if your struct tm has tm_zone. */
#undef HAVE_TM_ZONE
/* Define if you don't have tm_zone but do have the external array
tzname. */
#undef HAVE_TZNAME
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define if on MINIX. */
#undef _MINIX
/* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t
/* Define if the system does not provide POSIX.1 features except
with this defined. */
#undef _POSIX_1_SOURCE
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#undef STACK_DIRECTION
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define if your <sys/time.h> declares struct tm. */
#undef TM_IN_SYS_TIME
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
#undef HAVE_STRINGIZE /* can use ANSI # operator in cpp */
#undef REGEX_MALLOC /* use malloc instead of alloca in regex.c */
#undef SPRINTF_RET /* return type of sprintf */
#undef BITOPS /* bitwise ops (undocumented feature) */
#undef NONDECDATA /* non-decimal input data (undocumented feature) */
#undef _FILE_OFFSET_BITS /* bits in a file offset, where this matters */
#undef _LARGEFILE_SOURCE /* makes fseeko etc. visible on some hosts */
#undef _LARGE_FILES /* emables large files on AIX-style hosts */
/* Define if you have the fmod function. */
#undef HAVE_FMOD
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
/* Define if you have the madvise function. */
#undef HAVE_MADVISE
/* Define if you have the memcmp function. */
#undef HAVE_MEMCMP
/* Define if you have the memcpy function. */
#undef HAVE_MEMCPY
/* Define if you have the memset function. */
#undef HAVE_MEMSET
/* Define if you have the setlocale function. */
#undef HAVE_SETLOCALE
/* Define if you have the strchr function. */
#undef HAVE_STRCHR
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
/* Define if you have the strftime function. */
#undef HAVE_STRFTIME
/* Define if you have the strncasecmp function. */
#undef HAVE_STRNCASECMP
/* Define if you have the strtod function. */
#undef HAVE_STRTOD
/* Define if you have the system function. */
#undef HAVE_SYSTEM
/* Define if you have the tzset function. */
#undef HAVE_TZSET
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define if you have the <signum.h> header file. */
#undef HAVE_SIGNUM_H
/* Define if you have the <stdarg.h> header file. */
#undef HAVE_STDARG_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the m library (-lm). */
#undef HAVE_LIBM
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define to make ftello visible on some hosts (e.g. HP-UX 10.20). */
#undef _LARGEFILE_SOURCE
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to make ftello visible on some hosts (e.g. glibc 2.1.3). */
#undef _XOPEN_SOURCE
#include <custom.h> /* overrides for stuff autoconf can't deal with */
-3685
View File
File diff suppressed because it is too large. Load diff
-165
View File
@@ -1,165 +0,0 @@
dnl
dnl configure.in --- autoconf input file for gawk
dnl
dnl Copyright (C) 1995-2000 the Free Software Foundation, Inc.
dnl
dnl This file is part of GAWK, the GNU implementation of the
dnl AWK Programming Language.
dnl
dnl GAWK is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl GAWK is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
dnl
dnl Process this file with autoconf to produce a configure script.
dnl this makes sure that the local install-sh gets found
dnl define(AC_CONFIG_AUX_DIR,)
dnl This is the configure.in script proper
AC_INIT(awk.h)
AC_PREREQ(2.12)
AC_CONFIG_HEADER(config.h:configh.in)
dnl Additional argument stuff
AC_ARG_ENABLE(bitops, [ --enable-bitops Enable Octal and Hex constants and bit functions], AC_DEFINE(BITOPS))
AC_ARG_ENABLE(non-decimal-data, [ --enable-non-decimal-data Enable Octal and Hex constants as valid input data], AC_DEFINE(NONDECDATA))
dnl checks for programs
AC_PROG_YACC
AC_PROG_LN_S
AC_PROG_CC
AC_PROG_CPP
# This is a hack. Different versions of install on different systems
# are just too different. Chuck it and use install-sh.
INSTALL="$srcdir/install-sh -c"; export INSTALL
AC_PROG_INSTALL
AC_PROG_MAKE_SET
if test "$CFLAGS" = ""
then
dnl no user provided CFLAGS, feel free to do this our way
if test "$GCC" = yes
then
CFLAGS="-g -O"
else
dnl go for speed, not debugging. :-)
CFLAGS="-O"
fi
fi
# This is mainly for my use during testing and development.
# Yes, it's a bit of a hack.
if test -f $srcdir/.developing
then
AC_DEFINE(BITOPS)
AC_DEFINE(NONDECDATA)
CFLAGS="$CFLAGS -DARRAYDEBUG"
fi
AC_SUBST(CFLAGS)
dnl checks for systems
AC_AIX
AC_ISC_POSIX
AC_MINIX
GAWK_AC_SYS_LARGEFILE
GAWK_AC_AIX_TWEAK
if test "$ISC" = 1 # will be set by test for ISC
then
dnl need -D_SYSV3 for ISC
CFLAGS="$CFLAGS -D_SYSV3"
fi
dnl checks for header files
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(limits.h locale.h stdarg.h unistd.h signum.h sys/param.h string.h)
if test "$ac_cv_header_string_h" = yes
then
AC_CHECK_HEADERS(memory.h)
else
AC_CHECK_HEADERS(strings.h)
fi
dnl checks for typedefs
AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_SIZE_T
AC_TYPE_GETGROUPS
AC_EGREP_HEADER([int.*sprintf], stdio.h,
AC_DEFINE(SPRINTF_RET, int),
AC_DEFINE(SPRINTF_RET, char *))
dnl checks for functions
if test "$YACC" = "bison -y" ||
{ test -f $srcdir/awktab.c && grep 'alloca *(' $srcdir/awktab.c > /dev/null; }
then
AC_FUNC_ALLOCA
fi
AC_DEFINE(REGEX_MALLOC)
AC_FUNC_VPRINTF
AC_CHECK_LIB(m, fmod)
AC_CHECK_FUNCS(madvise memset memcpy memcmp fmod setlocale strchr strerror \
strftime strncasecmp strtod system tzset)
dnl see if we have mmap
AC_FUNC_MMAP
dnl check for how to use getpgrp
dnl have to hardwire it for VMS POSIX. Sigh.
if (uname) > /dev/null 2>&1
then
case `uname` in
*VMS*|*BeOS*)
AC_DEFINE(GETPGRP_VOID)
;;
*HP-UX*) # not getpgrp related
if test "$GCC" = yes
then
:
else
# stupid HP linker leaves the output file
# around even when a link fails. This confuses
# the alloca tests, so we have to do this
# manually. Sucks big time.
LIBS="$LIBS -lPW"
fi
# have to do the getpgrp test since won't
# fall into the default
AC_FUNC_GETPGRP
;;
*) AC_FUNC_GETPGRP
;;
esac
else
AC_FUNC_GETPGRP
fi
dnl checks for structure members
AC_STRUCT_ST_BLKSIZE
AC_HEADER_TIME
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
dnl checks for compiler characteristics
AC_C_CHAR_UNSIGNED
AC_C_CONST
GAWK_AC_C_STRINGIZE
AC_OUTPUT(Makefile doc/Makefile test/Makefile awklib/Makefile, [date > stamp-h])
-129
View File
@@ -1,129 +0,0 @@
# Makefile for GNU Awk documentation.
#
# Copyright (C) 1993-2000 the Free Software Foundation, Inc.
#
# This file is part of GAWK, the GNU implementation of the
# AWK Programming Language.
#
# GAWK is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# GAWK is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
SHELL = /bin/sh
srcdir = @srcdir@
VPATH = @srcdir@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
prefix = @prefix@
exec_prefix = @exec_prefix@
binprefix =
manprefix =
bindir = @bindir@
libdir = @libdir@
mandir = @mandir@/man1
manext = .1
infodir = @infodir@
datadir = @datadir@/awk
TEXI2DVI = texi2dvi
TEX = tex
MAKEINFO = makeinfo --no-split
TROFF = groff -t -Tps
SEDME = sed -e "s/^level0 restore/level0 restore flashme 100 72 moveto (Copyright `date '+%m-%d-%y %T'`, FSF, Inc. (all)) show/" \
-e "s/^\/level0 save def/\/level0 save def 30 -48 translate/"
DOCS= gawk.1 igawk.1 gawk.texi
TEXFILES= gawk.aux gawk.cp gawk.cps gawk.fn gawk.fns gawk.ky gawk.kys \
gawk.pg gawk.pgs gawk.toc gawk.tp gawk.tps gawk.vr gawk.vrs
ALLDOC= gawk.dvi $(TEXFILES) gawk.log awkcard.tr
CARDSRC = $(srcdir)/macros $(srcdir)/cardfonts $(srcdir)/colors awkcard.tr
CARDSRC_N = $(srcdir)/macros $(srcdir)/cardfonts $(srcdir)/no.colors awkcard.tr
CARDFILES= $(CARDSRC) ad.block awkcard.in setter.outline
# Use this if your troff can correctly handle macros from 'colors' file
AWKCARD = awkcard.ps
# Uncomment the following definition of AWKCARD if your troff can produce
# Postscript but still has troubles with macros from 'colors'. As this
# is not groff you will have to change TROFF macro as well. Do not forget
# to ensure that awkcard.tr is processed by tbl.
#AWKCARD = awkcard.nc
all: $(DOCS) info
install: $(mandir)/gawk$(manext) $(mandir)/igawk$(manext) $(infodir)/gawk.info
$(infodir)/gawk.info::
-if test -f gawk.info; then d=.; \
else d=$(srcdir); fi; \
if [ -f $(infodir)/dir -a -f $(infodir)/gawk.info ] \
&& cmp $$d/gawk.info $(infodir)/gawk.info > /dev/null \
&& grep '(gawk)' $(infodir)/dir > /dev/null; then \
exit 0; \
fi; \
$(INSTALL_DATA) $$d/gawk.info $(infodir)/gawk.info ; \
if $(SHELL) -c 'install-info --version' > /dev/null 2>&1 ; \
then install-info --info-dir=$(infodir) gawk.info ; \
else true ; fi; exit 0
$(mandir)/gawk$(manext):: gawk.1
$(INSTALL_DATA) $(srcdir)/gawk.1 $(mandir)/gawk$(manext)
$(mandir)/igawk$(manext):: igawk.1
$(INSTALL_DATA) $(srcdir)/igawk.1 $(mandir)/igawk$(manext)
uninstall:
rm -f $(mandir)/gawk$(manext) $(mandir)/igawk$(manext) $(infodir)/gawk.info*
dvi: gawk.dvi
gawk.dvi: gawk.texi
-TEXINPUTS=$(srcdir):$$TEXINPUTS $(TEXI2DVI) $(srcdir)/gawk.texi
info: gawk.info
gawk.info: gawk.texi
$(MAKEINFO) $(srcdir)/gawk.texi
postscript: dvi gawk.1 igawk.1 $(AWKCARD)
-groff -man $(srcdir)/gawk.1 > gawk.1.ps
-groff -man $(srcdir)/igawk.1 > igawk.1.ps
dvips -o gawk.ps gawk.dvi
awkcard.tr: awkcard.in
sed 's:SRCDIR:$(srcdir):' < $(srcdir)/awkcard.in > awkcard.tr
awkcard.ps: $(CARDFILES)
$(TROFF) $(CARDSRC) | $(SEDME) | cat $(srcdir)/setter.outline - > awkcard.ps
awkcard.nc: $(CARDFILES)
$(TROFF) $(CARDSRC_N) | $(SEDME) | cat $(srcdir)/setter.outline - > awkcard.ps && touch awkcard.nc
clean:
rm -f *.ps $(ALLDOC) *~ awkcard.nc
distclean: clean
rm -f Makefile
maintainer-clean: distclean
@echo "This command is intended for maintainers to use; it"
@echo "deletes files that may require special tools to rebuild."
rm -f gawk.info
-19
View File
@@ -1,19 +0,0 @@
Mon Dec 9 12:45:48 EST 1996
The AWK reference card included here requires a modern version of troff
(ditroff). GNU Troff (groff) is known to work.
If your troff is able to produce Postscript but does not know how to
properly use the macros from `colors' file then try to uncomment in
Makefile the defintion which sets AWKCARD to awkcard.nc (no colors).
This will definitely require changes to the TROFF macro and you have to
ensure that the tbl preprocessor is called. For example, the following
modifications on NeXT:
TROFF = tbl
SEDME = ptroff -t | sed -e \
"s/^level0 restore/level0 restore flashme 100 72 moveto\
(Copyright `date`, FSF, Inc. (all)) show/" \
-e "s/^\/level0 save def/\/level0 save def 30 -48 translate/"
will produce a correctly formatted, albeit monochromatic, reference card.
-49
View File
@@ -1,49 +0,0 @@
.\" AWK Reference Card --- Arnold Robbins, [email protected]
.\" This file is the Ad block (included in cover)
.\"
.\" Copyright (C) 1996, 98 Free Software Foundation, Inc.
.\"
.\" Permission is granted to make and distribute verbatim copies of
.\" this reference card provided the copyright notice and this permission
.\" notice are preserved on all copies.
.\"
.\" Permission is granted to process this file through troff and print the
.\" results, provided the printed document carries copying permission
.\" notice identical to this one except for the removal of this paragraph
.\" (this paragraph not being relevant to the printed reference card).
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" reference card under the conditions for verbatim copying, provided that
.\" the entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Permission is granted to copy and distribute translations of this
.\" reference card into another language, under the above conditions for
.\" modified versions, except that this permission notice may be stated in
.\" a translation approved by the Foundation.
.\"
.ft HB
.ps 10
.vs 12
.ES
.nf
.ce 7
\*(CBFree Software Foundation, Inc.
.ft H
59 Temple Place \(em Suite 330
Boston, MA 02111-1307 USA
Phone: +1-617-542-5942
Fax (including Japan): +1-617-542-2652
E-mail: [email protected]
URL: http://www.gnu.org
.ce 7
.ft HB
\*(CGFree Software
Source Distributions on CD-ROM
Deluxe Distributions
Emacs, Gawk, Make and GDB Manuals
Emacs and GDB References\*(CX
.EB "\f(HBOTHER FSF PRODUCTS:\*(FR"
.ps
.vs
File diff suppressed because it is too large. Load diff
-150
View File
@@ -1,150 +0,0 @@
Draft for ACM SIGPLAN Patterns (Language Trends)
1996
Why GAWK for AI?
Ronald P. Loui
Most people are surprised when I tell them what language we use in our
undergraduate AI programming class. That's understandable. We use
GAWK. GAWK, Gnu's version of Aho, Weinberger, and Kernighan's old
pattern scanning language isn't even viewed as a programming language by
most people. Like PERL and TCL, most prefer to view it as a "scripting
language." It has no objects; it is not functional; it does no built-in
logic programming. Their surprise turns to puzzlement when I confide
that (a) while the students are allowed to use any language they want;
(b) with a single exception, the best work consistently results from
those working in GAWK. (footnote: The exception was a PASCAL
programmer who is now an NSF graduate fellow getting a Ph.D. in
mathematics at Harvard.) Programmers in C, C++, and LISP haven't even
been close (we have not seen work in PROLOG or JAVA).
Why GAWK?
There are some quick answers that have to do with the pragmatics of
undergraduate programming. Then there are more instructive answers that
might be valuable to those who debate programming paradigms or to those
who study the history of AI languages. And there are some deep
philosophical answers that expose the nature of reasoning and symbolic
AI. I think the answers, especially the last ones, can be even more
surprising than the observed effectiveness of GAWK for AI.
First it must be confessed that PERL programmers can cobble together AI
projects well, too. Most of GAWK's attractiveness is reproduced in
PERL, and the success of PERL forebodes some of the success of GAWK.
Both are powerful string-processing languages that allow the programmer
to exploit many of the features of a UNIX environment. Both provide
powerful constructions for manipulating a wide variety of data in
reasonably efficient ways. Both are interpreted, which can reduce
development time. Both have short learning curves. The GAWK manual can
be consumed in a single lab session and the language can be mastered by
the next morning by the average student. GAWK's automatic
initialization, implicit coercion, I/O support and lack of pointers
forgive many of the mistakes that young programmers are likely to make.
Those who have seen C but not mastered it are happy to see that GAWK
retains some of the same sensibilities while adding what must be
regarded as spoonsful of syntactic sugar. Some will argue that
PERL has superior functionality, but for quick AI applications, the
additional functionality is rarely missed. In fact, PERL's terse syntax
is not friendly when regular expressions begin to proliferate and
strings contain fragments of HTML, WWW addresses, or shell commands.
PERL provides new ways of doing things, but not necessarily ways of
doing new things.
In the end, despite minor difference, both PERL and GAWK minimize
programmer time. Neither really provides the programmer the setting in
which to worry about minimizing run-time.
There are further simple answers. Probably the best is the fact that
increasingly, undergraduate AI programming is involving the Web. Oren
Etzioni (University of Washington, Seattle) has for a while been arguing
that the "softbot" is replacing the mechanical engineers' robot as the
most glamorous AI testbed. If the artifact whose behavior needs to be
controlled in an intelligent way is the software agent, then a language
that is well-suited to controlling the software environment is the
appropriate language. That would imply a scripting language. If the
robot is KAREL, then the right language is "turn left; turn right." If
the robot is Netscape, then the right language is something that can
generate "netscape -remote 'openURL(http://cs.wustl.edu/~loui)'" with
elan.
Of course, there are deeper answers. Jon Bentley found two pearls in
GAWK: its regular expressions and its associative arrays. GAWK asks
the programmer to use the file system for data organization and the
operating system for debugging tools and subroutine libraries. There is
no issue of user-interface. This forces the programmer to return to the
question of what the program does, not how it looks. There is no time
spent programming a binsort when the data can be shipped to /bin/sort
in no time. (footnote: I am reminded of my IBM colleague Ben Grosof's
advice for Palo Alto: Don't worry about whether it's highway 101 or 280.
Don't worry if you have to head south for an entrance to go north. Just
get on the highway as quickly as possible.)
There are some similarities between GAWK and LISP that are illuminating.
Both provided a powerful uniform data structure (the associative array
implemented as a hash table for GAWK and the S-expression, or list of
lists, for LISP). Both were well-supported in their environments (GAWK
being a child of UNIX, and LISP being the heart of lisp machines). Both
have trivial syntax and find their power in the programmer's willingness
to use the simple blocks to build a complex approach.
Deeper still, is the nature of AI programming. AI is about
functionality and exploratory programming. It is about bottom-up design
and the building of ambitions as greater behaviors can be demonstrated.
Woe be to the top-down AI programmer who finds that the bottom-level
refinements, "this subroutine parses the sentence," cannot actually be
implemented. Woe be to the programmer who perfects the data structures
for that heapsort when the whole approach to the high-level problem
needs to be rethought, and the code is sent to the junkheap the next day.
AI programming requires high-level thinking. There have always been a few
gifted programmers who can write high-level programs in assembly language.
Most however need the ambient abstraction to have a higher floor.
Now for the surprising philosophical answers. First, AI has discovered
that brute-force combinatorics, as an approach to generating intelligent
behavior, does not often provide the solution. Chess, neural nets, and
genetic programming show the limits of brute computation. The
alternative is clever program organization. (footnote: One might add
that the former are the AI approaches that work, but that is easily
dismissed: those are the AI approaches that work in general, precisely
because cleverness is problem-specific.) So AI programmers always want
to maximize the content of their program, not optimize the efficiency
of an approach. They want minds, not insects. Instead of enumerating
large search spaces, they define ways of reducing search, ways of
bringing different knowledge to the task. A language that maximizes
what the programmer can attempt rather than one that provides tremendous
control over how to attempt it, will be the AI choice in the end.
Second, inference is merely the expansion of notation. No matter whether
the logic that underlies an AI program is fuzzy, probabilistic, deontic,
defeasible, or deductive, the logic merely defines how strings can be
transformed into other strings. A language that provides the best
support for string processing in the end provides the best support for
logic, for the exploration of various logics, and for most forms of
symbolic processing that AI might choose to call "reasoning" instead of
"logic." The implication is that PROLOG, which saves the AI programmer
from having to write a unifier, saves perhaps two dozen lines of GAWK
code at the expense of strongly biasing the logic and representational
expressiveness of any approach.
I view these last two points as news not only to the programming language
community, but also to much of the AI community that has not reflected on
the past decade's lessons.
In the puny language, GAWK, which Aho, Weinberger, and Kernighan thought
not much more important than grep or sed, I find lessons in AI's trends,
AI's history, and the foundations of AI. What I have found not only
surprising but also hopeful, is that when I have approached the AI
people who still enjoy programming, some of them are not the least bit
surprised.
R. Loui ([email protected]) is Associate Professor of Computer Science,
at Washington University in St. Louis. He has published in AI Journal,
Computational Intelligence, ACM SIGART, AI Magazine, AI and Law, the ACM
Computing Surveys Symposium on AI, Cognitive Science, Minds and
Machines, Journal of Philosophy, and is on this year's program
committees for AAAI (National AI conference) and KR (Knowledge
Representation and Reasoning).
-37
View File
@@ -1,37 +0,0 @@
.\" AWK Reference Card --- Arnold Robbins, [email protected]
.\" cardfonts --- this file sets the fonts to use for the reference card
.\"
.\" Copyright (C) 1996 Free Software Foundation, Inc.
.\"
.\" Permission is granted to make and distribute verbatim copies of
.\" this reference card provided the copyright notice and this permission
.\" notice are preserved on all copies.
.\"
.\" Permission is granted to process this file through troff and print the
.\" results, provided the printed document carries copying permission
.\" notice identical to this one except for the removal of this paragraph
.\" (this paragraph not being relevant to the printed reference card).
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" reference card under the conditions for verbatim copying, provided that
.\" the entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Permission is granted to copy and distribute translations of this
.\" reference card into another language, under the above conditions for
.\" modified versions, except that this permission notice may be stated in
.\" a translation approved by the Foundation.
.\"
.ig
Strings for inline font change.
FR - font roman
FI - font italic
FC - font courier
..
.ds FR \fR
.ds FI \fI
.ds FC \f(CB
.ds RN Times Roman
.ds IN Times Italic
.ds CN Courier Bold
.ds AM \fIThe GNU Awk User's Guide\fP
-39
View File
@@ -1,39 +0,0 @@
.\" AWK Reference Card --- Arnold Robbins, [email protected]
.\" This file sets the colors to use.
.\"
.\" Copyright (C) 1996,97,99 Free Software Foundation, Inc.
.\"
.\" Permission is granted to make and distribute verbatim copies of
.\" this reference card provided the copyright notice and this permission
.\" notice are preserved on all copies.
.\"
.\" Permission is granted to process this file through troff and print the
.\" results, provided the printed document carries copying permission
.\" notice identical to this one except for the removal of this paragraph
.\" (this paragraph not being relevant to the printed reference card).
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" reference card under the conditions for verbatim copying, provided that
.\" the entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Permission is granted to copy and distribute translations of this
.\" reference card into another language, under the above conditions for
.\" modified versions, except that this permission notice may be stated in
.\" a translation approved by the Foundation.
.\"
.ig
Strings for inline color change.
CR - color red
CG - color green
CL - color light blue
CB - color blue
CD - color dark, i.e. black
CX - color boX, i.e. for the surrounding boxes (red for now)
..
.ds CR \X'ps: exec 0 .96 .65 0 setcmykcolor'
.ds CG \X'ps: exec 1.0 0 .51 .43 setcmykcolor'
.ds CL \X'ps: exec .69 .34 0 0 setcmykcolor'
.ds CB \X'ps: exec 1 .72 0 .06 setcmykcolor'
.ds CD \X'ps: exec 1 1 1 1 setcmykcolor'
.ds CX \*(CG
File diff suppressed because it is too large. Load diff
-73
View File
@@ -1,73 +0,0 @@
.TH IGAWK 1 "Nov 3 1999" "Free Software Foundation" "Utility Commands"
.SH NAME
igawk \- gawk with include files
.SH SYNOPSIS
.B igawk
[ all
.I gawk
options ]
.B \-f
.I program-file
[
.B \-\^\-
] file .\^.\^.
.br
.B igawk
[ all
.I gawk
options ]
[
.B \-\^\-
]
.I program-text
file .\^.\^.
.SH DESCRIPTION
.I Igawk
is a simple shell script that adds the ability to have ``include files'' to
.IR gawk (1).
.PP
AWK programs for
.I igawk
are the same as for
.IR gawk ,
except that, in addition, you may have lines like
.RS
.sp
.ft B
@include getopt.awk
.ft R
.sp
.RE
in your program to include the file
.B getopt.awk
from either the current directory or one of the other directories
in the search path.
.SH OPTIONS
See
.IR gawk (1)
for a full description of the AWK language and the options that
.I gawk
supports.
.SH EXAMPLES
.nf
.ft B
cat << EOF > test.awk
@include getopt.awk
.sp
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != \-1)
\&.\^.\^.
}
EOF
.sp
igawk \-f test.awk
.ft R
.fi
.SH SEE ALSO
.IR gawk (1)
.PP
.IR "Effective AWK Programming" ,
Edition 1.0, published by the Free Software Foundation, 1995.
.SH AUTHOR
Arnold Robbins
.RB ( [email protected] ).
-211
View File
@@ -1,211 +0,0 @@
.\" SSC Reference card macros
.\"
.\" Copyright (C) 1996, Specialized System Consultants Inc. (SSC)
.\"
.\" These macros are free software; you can redistribute them and/or modify
.\" them under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
.\"
.\" These macros are distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
.\"
.\" Generic SSC "card" macros
.\" based on lots of other macros
.\" Last update: 4-25-91 ph
.\" attempting to get margins in the boxes Aug 3 09:43:48 PDT 1994
.ll 3i \" length of text line
.lt 3.2i \" length of title line
.de BT \" bottom of page trap
.sp |8.2i \" go to where we put footer
.ie \\n(CL=1 \{\
. nr CL 2
.tl ''\\*(CD\\n+(PN'' \" footer is just page number
. po 4i \" go to second column
.TP \" print header if any
\}
.el \{\
. nr CL 1
.tl ''\\*(CD\\n+(PN'' \" footer is just page number
. po .5i \" go to first column
. bp \" force a new page (which will force header)
. TP
\}
..
.de TP \" top of page
.\" .sp |.2i
.sp |0
.\" put page header stuff here
.\" for example: .tl ''WOW!''
.\".sp
..
.\" .wh 8.1i BT \" set bottom of column trap
.nf \" don't fill lines
.nh \" no hyphenation
.nr CL 1 \" start with column = 1
.po .5i \" offset for first column
.vs 9 \" line spacing
.ps 8 \" point size
.de ST \" set tabs to normal places
.ta .2i .78i 1.2i 1.7i \" set tabs
..
.ig
From: [email protected] (Bryan Glennon)
Box macro. Do a .mk z where the box is to start, and a .eb
where it is to end. Optional argument is a title to be centered
within the top box line.
Usage:
.mk z
Text, etc to be boxed...
.eb "Optional title goes here"
~or~
.mk z
Text, etc to be boxed...
.eb
Some explanation:
The macro name is eb <.de eb>. First thing we do is to go up on line
<.sp -1> and turn off fill mode <.nf>. Now it gets interesting: the
.ie is the if/else construct. We check the number of arguments provided
to the macro <\\n(.$> and if it is greater than 0 (meaning we have a title),
we do the rest of the .ie line, as follows:
\h'-.5n' - move left one-half of an n
\L'|\\nzu-1' - draw a vertical line <\L> to the
absolute position (|) given by \\nzu-1,
which is the position set with the .mk
command into register z <\\nz> in base
units <u> minus 1.
\l'(\\n(.lu+1n-\w'\\$1'u/2u)\(ul' - Draw a horizontal line <\l> with length
equal to the current line length
<\\n(.l> in base units <u> plus the
space required for an 'n' <1n>, minus
the width <\w> of the title string
<\\$1> in base units <u> divided by 2
<in base units <u>>. Draw the line
using the underline character, <\(ul>.
\v'.3m'\|\\$1\|\v'-.3m' - Move down the page 3/10 of an m,
<\v'.3m'>, output a 1/6 of an m space
<\|>, output the title <\\$1>, another
1/6 of an m space <\|>, and then move
up the page 3/10 of an m <\v'-.3m'>.
\l'...\(ul' - Draw the second part of the line, just
like the corresponding left half done
before.
\L'-|\\nzu+1' - Draw a verticle line <\L> going down
the absolute distance <-|> from where
the macro was given to where the start
point was marked <\\nz> in base units
<u> plus one line <+1>
\l'|0u-.5n\(ul' - Draw a horizontal line to the absolute
position (|0) when the macro was
invoked, minus half an n <-.5n> using
the underline character <\(ul>.
The .el beings the else part, which is identical to the above, except
the string dosen't get printed. This makes the printing of the top
line much easier: just draw a line <\l> with width equal to the
current line plus the witdh of an n <\\n(.l+1n> using the underline
character <.\(ul>.
..
.de ES \" start "text in a box"
.mk z
.in +.5n
.ll -.5n
.sp 1.3
..
.de EB \" end "text in a box" -- optional box title as argument
.sp -.6
.nf
.in -.5n
.ll +.5n
.ie \\n(.$\
\L'|\\nzu'\
\l'(\\n(.lu-\w'\\$1'u)/2u-.33m\(ul'\
\v'.3m'\|\\$1\|\v'-.3m'\
\l'(\\n(.lu-\w'\\$1'u)/2u\(ul'\
\L'-|\\nzu'\
\l'|0u\(ul'
.el \h'-.5n'\L'|\\nzu-1'\l'\\n(.lu+1n\(ul'\L'-|\\nzu+1'\l'|0u-.5n\(ul'
.in 0
..
.de SL \" draw single line (works in non-fill mode only)
.sp -.8
.ti 0
\l'\\n(.lu\(ul'
..
.de Hl \" draw horizontal line
.br
.ti 0
\l'\\n(.lu-\\n(.iu'
.br
..
.de DL \" draw double line (works in non-fill mode only)
.sp -.8
.ti 0
\l'\\n(.lu\(ul'
.sp -.8
.ti 0
\l'\\n(.lu\(ul'
..
.ST
.nr PN 0 1 \" sets starting page number and auto-increment
.\" must define page header (if any) before here
.TP
.ds 3) \|\v'3p'\s+5\z\(sq\s0\v'-3p'\h'1.25p'\v'-.5p'3\v'.5p'\h'2p'
.\" old one .ds 2) \h'-1.5p'\v'1p'\s+4\z\(ci\s0\v'-1p'\h'3.25p'2
.ds 2) \|\v'-2.4p'\D'c.095id'\h'-5.15p'\v'2.4p'2\h'1.9p'
.ds dC \v'1p'\s+5\(bu\s0\v'-1p'\" for development commands
.ds tC \s+2\(dm\s0\" (for DWB) should be a triangle
.ds tP \s+2\(dm\s0\" (for other text processing) should be a triangle
.\" various trademark symbols
.ds Tm \v'-0.5m'\s8TM\s0\v'0.5m'
.ds Ts \v'-0.5m'\s4TM\s0\v'0.5m'
.ig ++
.\" mount Serifa fonts
.fp 5 SR
.fp 6 SB
.fp 4 Si
.++
.\" other assorted junk
.lg 0
.\" Fl requires extended version of troff
.de Fl \" draw fat horizontal line
.br
.ti 0
.ruw 1.5p
\l'\\n(.lu-\\n(.iu'
.br
.ruw
..
.de Bx \" box for keys in text
\\$3\&\|\&\c
\s-3\(br\|\fH\v'.18n'\\$1\v'-.18n\fP\|\(br\l'|0\(rn'\l'|0\(ul'\&\s0\|\\$2
..
.de Fn \" function name - left justified, gray background
.\" bold with gray for function name
.ns
.br
\
.ns
.br
\!! gsave ( ) stringwidth neg 0 rmoveto
\!! /Serifa-Bold findfont 8 scalefont setfont
\!! (\\$1) dup stringwidth pop 6 gsave dup 0 exch rlineto neg exch 0 rlineto
\!! 0 exch rlineto closepath .9 setgray fill grestore show
\!! grestore
.nf
.rs
..
.rs
-31
View File
@@ -1,31 +0,0 @@
.\" AWK Reference Card --- Arnold Robbins, [email protected]
.\" This file is for troff which does not know what to do
.\" with a literal Poscript and cannot use macros from 'colors'.
.\"
.\" Copyright (C) 1996 Free Software Foundation, Inc.
.\"
.\" Permission is granted to make and distribute verbatim copies of
.\" this reference card provided the copyright notice and this permission
.\" notice are preserved on all copies.
.\"
.\" Permission is granted to process this file through troff and print the
.\" results, provided the printed document carries copying permission
.\" notice identical to this one except for the removal of this paragraph
.\" (this paragraph not being relevant to the printed reference card).
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" reference card under the conditions for verbatim copying, provided that
.\" the entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Permission is granted to copy and distribute translations of this
.\" reference card into another language, under the above conditions for
.\" modified versions, except that this permission notice may be stated in
.\" a translation approved by the Foundation.
.\"
.ds CR
.ds CG
.ds CL
.ds CB
.ds CD
.ds CX
-77
View File
@@ -1,77 +0,0 @@
%!PS-Adobe-3.0
% SSC Reference card typesetter outline / cut marks
%
% Copyright (C) 1996, Specialized System Consultants Inc. (SSC)
%
% This file is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This file is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
%
%! page cut marks and stuff for Pocket References - 10-26-88 - ph
%! modified to move the cut marks onto the page
%! center a string
/inch {72 mul} def
/cshow % stk: string
% center string in space (space us variable)
{
dup stringwidth pop % get length of string
space exch sub 2 div % compute initial space needed
0 rmoveto % move over
show
} def
/flashme
{ /space 612 def
0 0 0 setrgbcolor % always print this stuff
/Helvetica findfont 12 scalefont setfont
gsave
% for groff (I hope)
-6 -6 translate
0.2 setlinewidth
0.25 inch 10.5 inch moveto
0.5 inch 10.5 inch lineto
.75 inch 10.75 inch moveto
.75 inch 11 inch lineto
stroke
0.25 inch 2 inch moveto
0.5 inch 2 inch lineto
.75 inch 1.75 inch moveto
.75 inch 1.50 inch lineto
stroke
4.25 inch 11 inch moveto
4.25 inch 10.75 inch lineto
stroke
4.25 inch 1.75 inch moveto
4.25 inch 1.5 inch lineto
stroke
7.75 inch 1.5 inch moveto
7.75 inch 1.75 inch lineto
8 inch 2 inch moveto
8.25 inch 2 inch lineto
stroke
7.75 inch 11 inch moveto
7.75 inch 10.75 inch lineto
8 inch 10.5 inch moveto
8.25 inch 10.5 inch lineto
stroke
grestore
} def
% actually do something
File diff suppressed because it is too large. Load diff
-238
View File
@@ -1,238 +0,0 @@
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
#
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
tranformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0
-32
View File
@@ -1,32 +0,0 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <[email protected]>
# Created: 1993-05-16
# Last modified: 1994-03-25
# Public domain
errstatus=0
for file in ${1+"$@"} ; do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d in ${1+"$@"} ; do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp" 1>&2
mkdir "$pathcomp" || errstatus=$?
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here
-128
View File
@@ -1,128 +0,0 @@
/*
* protos.h -- function prototypes for when the headers don't have them.
*/
/*
* Copyright (C) 1991 - 2000 the Free Software Foundation, Inc.
*
* This file is part of GAWK, the GNU implementation of the
* AWK Programming Language.
*
* GAWK is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* GAWK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#ifdef __STDC__
#define aptr_t void * /* arbitrary pointer type */
#else
#define aptr_t char *
#endif
extern aptr_t malloc P((MALLOC_ARG_T));
extern aptr_t realloc P((aptr_t, MALLOC_ARG_T));
extern aptr_t calloc P((MALLOC_ARG_T, MALLOC_ARG_T));
extern void free P((aptr_t));
extern char *getenv P((const char *));
#if ! defined(HAVE_STRING_H) && ! defined(HAVE_STRINGS_H)
extern char *strcpy P((char *, const char *));
extern char *strcat P((char *, const char *));
extern char *strncpy P((char *, const char *, size_t));
extern int strcmp P((const char *, const char *));
extern int strncmp P((const char *, const char *, size_t));
extern char *strchr P((const char *, int));
extern char *strrchr P((const char *, int));
extern char *strstr P((const char *s1, const char *s2));
extern size_t strlen P((const char *));
extern long strtol P((const char *, char **, int));
extern aptr_t memset P((aptr_t, int, size_t));
extern aptr_t memcpy P((aptr_t, const aptr_t, size_t));
extern aptr_t memmove P((aptr_t, const aptr_t, size_t));
extern aptr_t memchr P((const aptr_t, int, size_t));
extern int memcmp P((const aptr_t, const aptr_t, size_t));
#endif /* ! defined(HAVE_STRING_H) && ! defined(HAVE_STRINGS_H) */
#ifndef VMS
extern char *strerror P((int));
#else
extern char *strerror P((int,...));
#endif
#if ! defined(_MSC_VER) && ! defined(__GNU_LIBRARY__)
extern size_t strftime P((char *, size_t, const char *, const struct tm *));
#endif
#ifdef __STDC__
extern time_t time P((time_t *));
#else
extern long time();
#endif
extern FILE *fdopen P((int, const char *));
extern int fprintf P((FILE *, const char *, ...));
#if ! defined(MSDOS) && ! defined(__GNU_LIBRARY__)
#ifdef __STDC__
extern size_t fwrite P((const aptr_t, size_t, size_t, FILE *));
#else
extern int fwrite();
#endif
extern int fputs P((const char *, FILE *));
extern int unlink P((const char *));
#endif
extern int fflush P((FILE *));
extern int fclose P((FILE *));
extern FILE *popen P((const char *, const char *));
extern int pclose P((FILE *));
extern void abort P(());
extern int isatty P((int));
extern void exit P((int));
extern int system P((const char *));
extern int sscanf P((const char *, const char *, ...));
#ifndef toupper
extern int toupper P((int));
#endif
#ifndef tolower
extern int tolower P((int));
#endif
extern double pow P((double x, double y));
extern double atof P((const char *));
extern double strtod P((const char *, char **));
extern int fstat P((int, struct stat *));
extern int stat P((const char *, struct stat *));
extern off_t lseek P((int, off_t, int));
extern int fseek P((FILE *, long, int));
extern int close P((int));
extern int creat P((const char *, mode_t));
extern int open P((const char *, int, ...));
extern int pipe P((int *));
extern int dup P((int));
extern int dup2 P((int,int));
extern int fork P(());
extern int execl P((const char *, const char *, ...));
#ifndef __STDC__
extern int read P((int, void *, unsigned int));
#endif
#ifndef HAVE_SYS_WAIT_H
extern int wait P((int *));
#endif
extern void _exit P((int));
#ifndef __STDC__
extern long time P((long *));
#endif
extern SPRINTF_RET sprintf P((char *, const char *, ...));
#undef aptr_t
-5744
View File
File diff suppressed because it is too large. Load diff
-1
View File
@@ -1 +0,0 @@
Mon Jun 12 15:56:11 IDT 2000
-95
View File
@@ -1,95 +0,0 @@
#To: [email protected]
#From: Kristján Jónasson <[email protected]>
#Subject: Gawk bug
#Cc: [email protected]
#
#Hi!
#
#The following seems to be a bug in gawk. I have tried as I could to
#minimize the bug-causing program, so of course it does not seem to do
#anything useful in its present form. The error message received is:
#
#gawk: test.awk:15: fatal error: internal error
#Aborted
#
#Note that there is an attached file that the program reads, called "a". I
#played with the program a fair bit and my feeling is that the error is
#related with the delete statement, and not the reading of the file and the
#close statement. At one point I was able to remove the file reading and
#still obtain the error. If, for example, I remove the close statement and
#make two copies of the file instead, (reading one copy in sub1 and the
#other in sub2), the error still occurs.
#
#The operating system is Red Hat Linux, version 6.0, the gawk is version
#3.0.4, and the gawk was obtained from an rpm file gawk-3.0.4-1.i386.rpm.
#
#The program is:
#
# Wed Mar 8 13:41:34 IST 2000
# ADR: modified to use INPUT, so can set it from command line.
# When run, no output is produced, but it shouldn't core
# dump, either.
#
# The program bug is to not close the file in sub2.
function sub1(x) {
# while (getline < "a" == 1) i++
while (getline < INPUT == 1) i++
# close("a")
close(INPUT)
}
function sub2(x) {
i=0
delete y
# while (getline < "a" == 1) z[++i] = $1
while (getline < INPUT == 1) z[++i] = $1
for(i in z) y[i] = x[i] + z[i]
}
function sub3(x, y, z) {
sub2(x)
for(i=1; i<=4; i++) z[i] = y[i]
}
BEGIN {
sub1(x)
sub2(x)
sub3(x, y, z)
}
#
#And the data file is:
#
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
# 32.440 3.830 3.383700000000000 10.08 298 865
#
#
-30
View File
@@ -1,30 +0,0 @@
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
32.440 3.830 3.383700000000000 10.08 298 865
View File
Whitespace-only changes.
-1
View File
@@ -1 +0,0 @@
BEGIN { n = 11 ; foo[n] = n; print (2 <= n) }
-1
View File
@@ -1 +0,0 @@
1
-1
View File
@@ -1 +0,0 @@
function foo() { print foo } {foo()}
-1
View File
@@ -1 +0,0 @@
foo
-1
View File
@@ -1 +0,0 @@
gawk: fnamedat.awk:1: (FILENAME=- FNR=1) fatal: can't use function name `foo' as variable or array
-31
View File
@@ -1,31 +0,0 @@
# fnparydl.awk --- check that deleting works with arrays
# that are parameters.
#
# Tue Jul 11 14:20:58 EDT 2000
function delit(a, k)
{
print "BEFORE LOOP"
for (k in a) {
print "DELETING KEY", k
delete a[k]
}
print "AFTER LOOP"
}
BEGIN {
for (i = 1 ; i <= 7; i++) {
q[i] = sprintf("element %d", i)
x[i] = i
y[i] = q[i]
}
# adump(q)
delit(q)
# for (i in q)
# delete q[i]
j = 0;
for (i in q)
j++
print j, "elements still in q[]"
# adump(q)
}
-10
View File
@@ -1,10 +0,0 @@
BEFORE LOOP
DELETING KEY 4
DELETING KEY 5
DELETING KEY 6
DELETING KEY 7
DELETING KEY 1
DELETING KEY 2
DELETING KEY 3
AFTER LOOP
0 elements still in q[]
-6
View File
@@ -1,6 +0,0 @@
function foo( \
foo)
{
print foo
}
{ foo() }
-1
View File
@@ -1 +0,0 @@
gawk: funsmnam.awk:6: fatal: function `foo': can't use function name as parameter name
-18
View File
@@ -1,18 +0,0 @@
#Date: Tue, 21 Dec 1999 16:11:07 +0100
#From: Daniel Schnell <[email protected]>
#To: [email protected]
#CC: [email protected]
#Subject: BUG in gawk (version 3.0.4 linux, windows): Text mangeling in between
# search for "@K@CODE" segment
$0 ~ /@K@CODE/ {
# get next record
getline temp
printf ("@K@CODE\n")
printf ("%s\n",temp)
}
$0 !~ /@K@CODE/ {
printf ("%s\n", $0)
}
File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
-111
View File
@@ -1,111 +0,0 @@
#From [email protected] Thu Jun 18 09:10 EDT 1998
#Received: from mescaline.gnu.org ([email protected] [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id JAA23649 for <[email protected]>; Thu, 18 Jun 1998 09:10:54 -0400 (EDT)
#Received: from khromeleque.dmat.uevora.pt by mescaline.gnu.org (8.8.5/8.6.12GNU) with ESMTP id JAA21732 for <[email protected]>; Thu, 18 Jun 1998 09:11:19 -0400
#Received: from khromeleque.dmat.uevora.pt (vp@localhost [127.0.0.1])
# by khromeleque.dmat.uevora.pt (8.8.8/8.8.8/Debian/GNU) with ESMTP id OAA11817
# for <[email protected]>; Thu, 18 Jun 1998 14:13:57 +0100
#Message-Id: <[email protected]>
#To: [email protected]
#Subject: concatenation bug in gawk 3.0.3
#Date: Thu, 18 Jun 1998 14:13:57 +0200
#From: Vasco Pedro <[email protected]>
#Content-Type: text
#Content-Length: 2285
#Status: RO
#
#Hi,
#
#The gawk program '{print NR " " 10/NR}' will print:
#
#1 10
#5 5
#3 3.33333
#2 2.5
#2 2
#1 1.66667
#
#instead of the correct:
#
#1 10
#2 5
#3 3.33333
#4 2.5
#5 2
#6 1.66667
#
#You'll notice, on the incorrect output, that the first column is
#the first digit of the second.
#
#I think the problem comes from the way builtin variables are handled.
#Since the items to be concatenated are processed in reverse order and
#the return value of tree_eval(``NR'') is a pointer to the value part
#of `NR_node', the `unref()' of `NR_node' due to its second occurrence
#will leave a dangling pointer in `strlist'. The reason that it doesn't
#reuse the freed space with objects of the same type. (Using Electric
#Fence with EF_PROTECT_FREE set confirms that freed space is being
#accessed.)
#
#The enclosed patch (hack would be a better word to describe it) is
#all I could come up with. With it installed, things seem to work ok,
#but I doubt this is the correct way to do it. (If I treated the
#case for `Node_field_spec' as the I did others, `make check' would
#fail in several places.)
#
#Regards,
#vasco
#
#*** eval.c~ Tue May 6 21:39:55 1997
#--- eval.c Thu Jun 18 13:39:25 1998
#***************
#*** 685,697 ****
# return func_call(tree->rnode, tree->lnode);
#
# /* unary operations */
# case Node_NR:
# case Node_FNR:
# case Node_NF:
# case Node_FIELDWIDTHS:
# case Node_FS:
# case Node_RS:
#- case Node_field_spec:
# case Node_subscript:
# case Node_IGNORECASE:
# case Node_OFS:
#--- 685,700 ----
# return func_call(tree->rnode, tree->lnode);
#
# /* unary operations */
#+ case Node_field_spec:
#+ lhs = get_lhs(tree, (Func_ptr *) NULL);
#+ return *lhs;
#+
# case Node_NR:
# case Node_FNR:
# case Node_NF:
# case Node_FIELDWIDTHS:
# case Node_FS:
# case Node_RS:
# case Node_subscript:
# case Node_IGNORECASE:
# case Node_OFS:
#***************
#*** 699,705 ****
# case Node_OFMT:
# case Node_CONVFMT:
# lhs = get_lhs(tree, (Func_ptr *) NULL);
#! return *lhs;
#
# case Node_var_array:
# fatal("attempt to use array `%s' in a scalar context",
#--- 702,710 ----
# case Node_OFMT:
# case Node_CONVFMT:
# lhs = get_lhs(tree, (Func_ptr *) NULL);
#! r = dupnode(*lhs);
#! r->flags |= TEMP;
#! return r;
#
# case Node_var_array:
# fatal("attempt to use array `%s' in a scalar context",
#
{ print NR " " 10/NR }
-6
View File
@@ -1,6 +0,0 @@
line 1
line 2
line 3
line 4
line 5
line 6
-6
View File
@@ -1,6 +0,0 @@
1 10
2 5
3 3.33333
4 2.5
5 2
6 1.66667
-75
View File
@@ -1,75 +0,0 @@
#From [email protected] Sat Oct 31 22:54:07 1998
#Return-Path: <[email protected]>
#Received: from cssun.mathcs.emory.edu (cssun.mathcs.emory.edu [170.140.150.1])
# by amx.netvision.net.il (8.9.0.Beta5/8.8.6) with ESMTP id HAA08891
# for <[email protected]>; Sat, 31 Oct 1998 07:14:07 +0200 (IST)
#Received: from mescaline.gnu.org ([email protected] [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id AAA14947 for <[email protected]>; Sat, 31 Oct 1998 00:14:32 -0500 (EST)
#Received: from gamgee.acad.emich.edu (gamgee.acad.emich.edu [164.76.102.76])
# by mescaline.gnu.org (8.9.1a/8.9.1) with SMTP id AAA20645
# for <[email protected]>; Sat, 31 Oct 1998 00:17:54 -0500
#Received: by gamgee.acad.emich.edu (Smail3.1.29.1 #57)
# id m0zZUKY-000IDSC; Sat, 31 Oct 98 00:16 CST
#Message-Id: <[email protected]>
#Date: Sat, 31 Oct 98 00:16 CST
#From: [email protected] (David H. West)
#To: [email protected]
#Subject: gawk 3.0.3 bug report
#Cc: [email protected]
#X-UIDL: 7474b825cff989adf38f13883d84fdd7
#Status: RO
#
#gawk version: 3.03
#System used: Linux, kernel 2.0.28, libc 5.4.33, AMD K5PR133 (i586 clone)
#Remark: There seems to be at least one bug shown by the demo below.
# There may also be a Dark Corner involving the value of NR in an
# END block, a topic on which the info file is silent. In gawk
# 3.0.3, NR often seems to have the least-surprise value in an
# END block, but sometimes it doesn't - see example below.
#Problem descr: the log below shows a case where:
# a) (this may be a red herring) the output of the gawk script
# is different depending on whether its input file is named on
# the command line or catted to stdin, without any use of the
# legitimate means which could produce this effect.
# b) NR is clearly getting clobbered; I have tried to simplify
# the 19-line script "awkerr1" below, but seemingly unrelated
# changes, like shortening constant strings which appear only in
# print statements, or removing unexecuted or irrelevant code,
# cause the clobbering to go away. Some previous (larger)
# versions of this code would clobber NR also when reading from
# stdin, but I thought you'd prefer a shorter example :-).
#Reproduce-By: using the gawk script "awkerr1", the contents of
# which appear in the transcript below as the output of the
# command "cat awkerr1". Comments following # were added
# to the transcript later as explanation.
#---------------------------------------------- Script started on Fri
#Oct 30 20:04:16 1998 chipmunk:/ram0# ls -l a1 awkerr1 -rw-r--r-- 1
#root root 2 Oct 30 18:42 a1 -rwxr-xr-x 1 root root
#389 Oct 30 19:54 awkerr1 chipmunk:/ram0# cat a1 #a1 contains
#one printable char and a newline a chipmunk:/ram0# od -c xc a1
#0000000 0a61
# a \n
#0000002 chipmunk:/ram0# cat a1 | awkerr1 #no surprises here
#1 lines in 1 sec: 1 lines/sec; nlines=1 chipmunk:/ram0# awkerr1 a1 È
#lines in 1 sec: 1 lines/sec; nlines=1 #?! first char is an uppercase
#E-grave chipmunk:/ram0# awkerr1 a1 | od -N1 -xc 0000000 00c8
# 310 \0
#0000001 chipmunk:/ram0# cat awkerr1 #the apparent ^M's are not
#actually in the file
#!/usr/bin/awk -f
function process(w) {
if(w in ws) {
printf " : found\n"; lc[p " " w]++; rc[w " " n]++; }
}
BEGIN {IGNORECASE=1;
}
/^/ {if(NR % 10 ==0)print "processing line " NR;
process($1); nlines++;
}
END {p=w; w=n; n="";
if(w)process(w); t=1; print NR " lines in " t " sec: " NR+0 " lines/sec; nlines=" nlines;
}
#chipmunk:/ram0# exit Script done on Fri Oct 30 20:07:31 1998
#---------------------------------------------
#
#-David West [email protected]
#
-1
View File
@@ -1 +0,0 @@
a
-1
View File
@@ -1 +0,0 @@
1 lines in 1 sec: 1 lines/sec; nlines=1
-2
View File
@@ -1,2 +0,0 @@
/@K@CODE/ { print ; getline temp ; print temp ;next }
{print}
-56
View File
@@ -1,56 +0,0 @@
#From [email protected] Mon Feb 21 09:33:32 2000
#Message-id: <[email protected]>
#Date: 20 Feb 2000 18:14:11 EST
#From: [email protected] (Jeffrey B. Woodward)
#Subject: gawk 3.0.4 bug
#To: [email protected]
#Cc: [email protected]
#
#O/S: Digital UNIX 4.0D
#
#C Compiler: DEC C
#
#gawk version: 3.0.4
#
#Sample Program:
#gawk '
BEGIN {
pattern[1] = "bar" ; ignore[1] = 1
pattern[2] = "foo" ; ignore[2] = 0
}
{
for (i = 1 ; i <= 2 ; i++) {
IGNORECASE = ignore[i]
print match($0, pattern[i]) " " pattern[i] ":" $0
}
}
#' << -EOF-
#This is foo
#This is bar
#-EOF-
#
#Program Output:
#0 bar:This is foo
#0 foo:This is foo
#9 bar:This is bar
#9 foo:This is bar
#
#
#**Expected** Output:
#0 bar:This is foo
#9 foo:This is foo
#9 bar:This is bar
#0 foo:This is bar
#
#
#This problem appears to be directly related to IGNORECASE. If
#IGNORECASE remains constant, the program behaves as expected;
#however, switching IGNORECASE seems to causes problems - it is
#almost as though the pattern stored in the variable is treated
#as a constant and the regexp() is not recompiled(?) - just a
#guess...
#
#
#Thanks,
#-Jeff Woodward
-2
View File
@@ -1,2 +0,0 @@
This is foo
This is bar
-4
View File
@@ -1,4 +0,0 @@
0 bar:This is foo
9 foo:This is foo
9 bar:This is bar
0 foo:This is bar
-92
View File
@@ -1,92 +0,0 @@
#From [email protected] Tue Oct 13 22:15:59 1998
#Return-Path: <[email protected]>
#Received: from cssun.mathcs.emory.edu (cssun.mathcs.emory.edu [170.140.150.1])
# by dmx.netvision.net.il (8.9.0.Beta5/8.8.6) with ESMTP id PAA03924
# for <[email protected]>; Tue, 13 Oct 1998 15:32:13 +0200 (IST)
#Received: from mescaline.gnu.org ([email protected] [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id KAA11644 for <[email protected]>; Tue, 13 Oct 1998 10:22:32 -0400 (EDT)
#Received: from manatee.dms.auburn.edu (manatee.dms.auburn.edu [131.204.53.104])
# by mescaline.gnu.org (8.9.1a/8.9.1) with ESMTP id KAA03250
# for <[email protected]>; Tue, 13 Oct 1998 10:25:32 -0400
#Received: (from hankedr@localhost)
# by manatee.dms.auburn.edu (8.9.1a/8.9.1) id JAA13348;
# Tue, 13 Oct 1998 09:22:29 -0500 (CDT)
#Date: Tue, 13 Oct 1998 09:22:29 -0500 (CDT)
#Message-Id: <[email protected]>
#From: Darrel Hankerson <[email protected]>
#To: [email protected]
#In-reply-to: <[email protected]> (message from
# Aharon Robbins on Tue, 13 Oct 1998 16:10:36 +0200)
#Subject: Re: full text of bug report?
#Mime-Version: 1.0
#Content-Type: text/plain; charset=US-ASCII
#X-UIDL: bf3fce492dad4ab030c561e7b2f27d0a
#Status: RO
#
# Do you have the full text of the a = a "\n" f() bug report?
# I can't find it.... I'm not sure there really is a bug.
#
#Yes, see below.
#
#His example has unnecessary fragments (in particular, the use of
#gensub is irrelevant). As I wrote to you earlier, the interesting
#question for me is:
#
# Is the concatenation result undefined? If the result is defined or
# implementation-dependent, then gawk has a bug.
#
#
#=== Original report =====================================================
#From: Attila Torcsvari <[email protected]>
#To: "'[email protected]'" <[email protected]>
#Subject: gawk 3.0.3 bug
#Date: Thu, 17 Sep 1998 18:12:13 +0200
#MIME-Version: 1.0
#Content-Transfer-Encoding: 7bit
#Resent-From: [email protected]
#X-Mailing-List: <[email protected]> archive/latest/3396
#X-Loop: [email protected]
#Precedence: list
#Resent-Sender: [email protected]
#Content-Transfer-Encoding: 7bit
#Content-Type: text/plain; charset="us-ascii"
#Content-Length: 618
#
#Bug-gnuers,
#please pass it to the responsible.
#
#The following generates something interesting:
#
BEGIN{
a="aaaaa"
a=a a #10
a=a a #20
a=a a #40
a=a a #80
a=a a #160
a=a a # i.e. a is long enough
a=a"\n"f() # this causes the trouble
print a # guess the result
}
function f()
{
#print "a before: ", a
#a=gensub("a","123,","g",a) # 'a' will be just a bit longer (4 times, but still should fit: 4*160=640)
gsub(/a/, "123", a)
#print "a after: ", a
return "X"
}
#
#Possible reason:
#during f the a is modified,
#it can be even freed, because gensub modifies its size
#the printout contains trash.
#
#Used version: VC compiled WinNT 32 bit Intel.
#
#Regards,
#
#Attila Torcsvari
#Arcanum Development
#
-2
View File
@@ -1,2 +0,0 @@
123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123123
X
-77
View File
@@ -1,77 +0,0 @@
# From [email protected] Wed Aug 2 13:16:53 2000
# Received: from mail.actcom.co.il
# by localhost with POP3 (fetchmail-5.1.2)
# for arnold@localhost (single-drop); Wed, 02 Aug 2000 13:16:53 -0400 (EDT)
# Received: from lmail.actcom.co.il by actcom.co.il with ESMTP
# (8.9.1a/actcom-0.2) id MAA21699 for <[email protected]>;
# Wed, 2 Aug 2000 12:20:38 +0300 (EET DST)
# (rfc931-sender: lmail.actcom.co.il [192.114.47.13])
# Received: from freefriends.org (freefriends.org [63.85.55.109])
# by lmail.actcom.co.il (8.9.3/8.9.1) with ESMTP id LAA22723
# for <[email protected]>; Wed, 2 Aug 2000 11:23:22 +0300
# Received: from mescaline.gnu.org (mescaline.gnu.org [158.121.106.21])
# by freefriends.org (8.9.3/8.9.3) with ESMTP id FAA23582
# for <[email protected]>; Wed, 2 Aug 2000 05:18:59 -0400
# Received: from dep.chem.rug.nl (dep.chem.rug.nl [129.125.7.81])
# by mescaline.gnu.org (8.9.1a/8.9.1) with ESMTP id FAA30670;
# Wed, 2 Aug 2000 05:20:24 -0400
# Received: from rugmd34.chem.rug.nl (rugmd34.chem.rug.nl [129.125.42.34])
# by dep.chem.rug.nl (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id LAA17089;
# Wed, 2 Aug 2000 11:20:23 +0200
# Received: from chem.rug.nl (localhost [127.0.0.1]) by rugmd34.chem.rug.nl (980427.SGI.8.8.8/980728.SGI.AUTOCF) via ESMTP id LAA25392; Wed, 2 Aug 2000 11:20:22 +0200 (MDT)
# Sender: [email protected]
# Message-ID: <[email protected]>
# Date: Wed, 02 Aug 2000 11:20:21 +0200
# From: Eiso AB <[email protected]>
# X-Mailer: Mozilla 4.72C-SGI [en] (X11; I; IRIX 6.5 IP32)
# X-Accept-Language: en
# MIME-Version: 1.0
# To: [email protected], [email protected]
# Subject: bug? [GNU Awk 3.0.5]
#
# Content-Type: text/plain; charset=us-ascii
# Content-Transfer-Encoding: 7bit
# X-UIDL: \f8"!(8G!!ZL$#!h>X!!
# Status: R
#
# hi Arnold,
#
#
# Please try the script beneath...
# I'm not sure if this is a bug or not, but I would expect
# the empty string as an array index just to be treated
# like any other string
#
# so if ("" in ta) would be true, and for ( i in ta ) should loop only once.
#
BEGIN {
v=""
ta[v]++
if ( v in ta) print "a",v,++ta[v],ta[v]
print "b",v,++ta[v],ta[v]
for( i in ta) print "c",++c,i,ta[i]
}
#
# goodluck, Eiso
#
# --
# _________
# _______________________________/ Eiso AB \_________________________
#
# o
#
# o Dept. of Biochemistry
# University of Groningen
# The Netherlands
# o
# . .
# o ^ mailto:[email protected]
# | - _ mailto:[email protected]
# \__|__/ http://md.chem.rug.nl/~eiso
# | tel 4326
# |
# / \
# / \
# | |
# ________ ._| |_. ________________________________________________
#
-3
View File
@@ -1,3 +0,0 @@
a 2 2
b 3 3
c 1 3
-55
View File
@@ -1,55 +0,0 @@
#To: [email protected]
#cc: [email protected]
#Subject: Possible bug in GNU Awk 3.0.4
#Date: Wed, 24 Nov 1999 21:47:24 +0000
#From: Daniel Elphick <[email protected]>
#Message-Id: <E11qkG4-0000l0-00@cameron>
#
#This is a multipart MIME message.
#
#--==_Exmh_-11192982200
#Content-Type: text/plain; charset=us-ascii
#
#
#When I use the attached awk script unique on the attached data file, it
#reports that all 4 lines of the data are the same. Using mawk it correctly
#reports that there are no repeats.
#
#I don't know if there are limits on the size of associative array keys for the
#purposes of reliable indexing but if there is then it is not (obviously)
#documented.
#
#
#--==_Exmh_-11192982200
#Content-Type: text/plain ; name="data"; charset=us-ascii
#Content-Description: data
#Content-Disposition: attachment; filename="data"
#
#322322111111112232231111
#322322111111112213223111
#322322111111112211132231
#322322111111112211113223
#
#--==_Exmh_-11192982200
#Content-Type: text/plain ; name="unique"; charset=us-ascii
#Content-Description: unique
#Content-Disposition: attachment; filename="unique"
#
{
if($0 in a)
{
printf("line %d has been seen before at line %d\n", NR, a[$0])
repeat_count += 1
}
else
{
a[$0] = NR
}
count += 1
}
END {
# printf("%d %f%%\n", repeat_count, (float)repeat_count / count * 100)
printf("%d %f%%\n", repeat_count, repeat_count / count * 100)
}
#
#--==_Exmh_-11192982200--
-4
View File
@@ -1,4 +0,0 @@
322322111111112232231111
322322111111112213223111
322322111111112211132231
322322111111112211113223
-1
View File
@@ -1 +0,0 @@
0 0.000000%
-1
View File
@@ -1 +0,0 @@
BEGIN { b = 1; a[b] = 2; a[b++] += 1; print b,a[1] }
-1
View File
@@ -1 +0,0 @@
2 3
-6
View File
@@ -1,6 +0,0 @@
BEGIN {
print b += b += 1
b = 6
print b += b++
print b
}
-3
View File
@@ -1,3 +0,0 @@
2
13
13
-19
View File
@@ -1,19 +0,0 @@
# Tue May 25 16:36:16 IDT 1999
#
# Test cases based on email from Andreas Schwab, [email protected]
BEGIN {
fmt[1] = "%8.5d"; data[1] = 100
fmt[2] = "%#o"; data[2] = 0
fmt[3] = "%#.1o"; data[3] = 0
fmt[4] = "%#.0o"; data[4] = 0
fmt[5] = "%#x"; data[5] = 0
fmt[6] = "%.0d"; data[6] = 0
fmt[7] = "%5.0d"; data[7] = 0
for (i = 1; i <= 7; i++) {
format = "%s, %d --- |" fmt[i] "|\n"
printf(format, fmt[i], data[i], data[i])
}
}
-7
View File
@@ -1,7 +0,0 @@
%8.5d, 100 --- | 00100|
%#o, 0 --- |0|
%#.1o, 0 --- |0|
%#.0o, 0 --- |0|
%#x, 0 --- |0|
%.0d, 0 --- ||
%5.0d, 0 --- | |
-1
View File
@@ -1 +0,0 @@
BEGIN { print exp(0), exp(1000000), exp(0.5) }
-2
View File
@@ -1,2 +0,0 @@
1 gawk: reg/exp.awk:1: warning: exp argument 1e+06 is out of range
Inf 1.64872
Whitespace-only changes.
-1
View File
@@ -1 +0,0 @@
BEGIN { print log(0), log(-1), log(100) }
-4
View File
@@ -1,4 +0,0 @@
log: SING error
-Inf gawk: reg/log.awk:1: warning: log called with negative argument -1
log: DOMAIN error
NaN 4.60517
Whitespace-only changes.
-15
View File
@@ -1,15 +0,0 @@
# strftime.awk ; test the strftime code
#
# input is the output of `date', see Makefile.in
#
# The mucking about with $0 and $N is to avoid problems
# on cygwin, where the timezone field is empty and there
# are two consecutive blanks.
{
$3 = sprintf("%02d", $3 + 0)
print > "strftime.ok"
$0 = strftime()
$NF = $NF
print > OUTPUT
}
-6
View File
@@ -1,6 +0,0 @@
BEGIN {
i = 2
a[i] = 5
a[i] /= 2
printf "a[%s] = %f\n", i, a[i]
}
-1
View File
@@ -1 +0,0 @@
a[2] = 2.500000
-1
View File
@@ -1 +0,0 @@
BEGIN { printf("%2.1d---%02.1d\n", 2, 2) }
-1
View File
@@ -1 +0,0 @@
2--- 2
-99
View File
@@ -1,99 +0,0 @@
$FreeBSD$
CVS
testsuite
.cvsignore
config.if
mkdep
*COPYING*
etc
*-hp*
*-macos*
*-ncr*
*.bat
*.com
*.info*
arlex.c
arparse.[ch]
deflex.c
gprof
itbl-lex.c
itbl-parse.[ch]
ldgram.[ch]
ldlex.c
sysinfo.[ch]
syslex.c
testsuite
texinfo
*10[23]00*
*532*
*[a-z]29k*
*[a-z][89]60*
*_be*
*a68*
*adobe*
*aix*
*apollo*
*beos*
*bout*
*cisco*
*d10v*
*delt88*
*delta*
*dgux*
*djgpp*
*dos*
*dpx2*
*dynix*
*epoc*
*go32*
*h8[35]00*
*hp300*
*hp[-.]*
*hppa*
*hpux*
*interix*
*irix*
*lynx*
*m32r*
*m[68]8k*
*mac-*
*mach*
*mcore*
*mpw*
*netware*
*news*
*nlm*
*ns32*
*oasys*
*os9*
*pei*
*pmac*
*psos*
*pyr*
*riscix*
*riscos*
*rs6000*
*sa29200*
*shpe*
*som*
*st2000*
*sun*
*symmetry*
*tahoe*
*u68k*
*vax*
*vms*
*vxworks*
*w65*
*we32k*
*win*
*xcoff*
*i370*
*avr*
*tic54x*
*tic80*
*d30v*
*fr30*
*-sh.*
*pj*
*ver.texi
-34
View File
@@ -1,34 +0,0 @@
/* Name of package. */
#undef PACKAGE
/* Version of package. */
#undef VERSION
/* Whether strstr must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_STRSTR
/* Whether malloc must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_MALLOC
/* Whether realloc must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_REALLOC
/* Whether free must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_FREE
/* Whether getenv must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_GETENV
@TOP@
/* Do we need to use the b modifier when opening binary files? */
#undef USE_BINARY_FOPEN
/* Name of host specific header file to include in trad-core.c. */
#undef TRAD_HEADER
/* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */
#undef HAVE_SYS_PROCFS_H
/* Do we really want to use mmap if it's available? */
#undef USE_MMAP
-62
View File
@@ -1,62 +0,0 @@
# Makefile for gperf
# Copyright (C) 1989, 1992, 1993, 1998 Free Software Foundation, Inc.
# written by Douglas C. Schmidt ([email protected])
#
# This file is part of GNU GPERF.
#
# GNU GPERF is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 1, or (at your option)
# any later version.
#
# GNU GPERF is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU GPERF; see the file COPYING. If not, write to
# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#### Start of system configuration section. ####
# Programs used by "make":
RM = rm -f
@SET_MAKE@
#### End of system configuration section. ####
SHELL = /bin/sh
all : force
cd @subdir@; $(MAKE) all
install : force
cd @subdir@; $(MAKE) install
installdirs : force
cd @subdir@; $(MAKE) installdirs
uninstall : force
cd @subdir@; $(MAKE) uninstall
check : force
cd @subdir@; $(MAKE) check
mostlyclean : force
cd @subdir@; $(MAKE) mostlyclean
clean : force
cd @subdir@; $(MAKE) clean
distclean : force
cd @subdir@; if test -f Makefile; then $(MAKE) distclean; fi
$(RM) config.status config.log config.cache Makefile
maintainer-clean : force
cd @subdir@; if test -f Makefile; then $(MAKE) maintainer-clean; fi
$(RM) config.status config.log config.cache Makefile
force :
-4
View File
@@ -1,4 +0,0 @@
/* Define if the C++ compiler supports "throw ()" declarations. */
#undef HAVE_THROW_DECL
-46
View File
@@ -1,46 +0,0 @@
dnl autoconf configuration for gperf
dnl Copyright (C) 1998 Free Software Foundation, Inc.
dnl written by Douglas C. Schmidt ([email protected])
dnl
dnl This file is part of GNU GPERF.
dnl
dnl GNU GPERF is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 1, or (at your option)
dnl any later version.
dnl
dnl GNU GPERF is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with GNU GPERF; see the file COPYING. If not, write to the
dnl Free Software Foundation, 59 Temple Place - Suite 330, Boston,
dnl MA 02111-1307, USA.
AC_INIT(doc/gperf.1)
AC_PROG_MAKE_SET
dnl This piece of sed script replaces every line containing '@subdir@'
dnl by several consecutive lines, each referencing one subdir.
extrasub="$extrasub"'
/@subdir@/{
h
g
s/@subdir@/lib/
p
g
s/@subdir@/src/
p
g
s/@subdir@/tests/
p
g
s/@subdir@/doc/
p
d
}
'
AC_OUTPUT(Makefile)
AC_OUTPUT_SUBDIRS(lib src tests doc)
-109
View File
@@ -1,109 +0,0 @@
# Makefile for gperf/lib
# Copyright (C) 1989, 1992, 1993, 1998 Free Software Foundation, Inc.
# written by Douglas C. Schmidt ([email protected])
#
# This file is part of GNU GPERF.
#
# GNU GPERF is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 1, or (at your option)
# any later version.
#
# GNU GPERF is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU GPERF; see the file COPYING. If not, write to the Free
# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA.
#### Start of system configuration section. ####
# Directories used by "make":
srcdir = @srcdir@
# Directories used by "make install":
prefix = @prefix@
local_prefix = /usr/local
exec_prefix = @exec_prefix@
# Programs used by "make":
# C compiler
CC = @CC@
CFLAGS = @CFLAGS@
CPP = @CPP@
# C++ compiler
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
CXXCPP = @CXXCPP@
# Other
AR = ar
AR_FLAGS = rc
RANLIB = @RANLIB@
MV = mv
LN = ln
RM = rm -f
@SET_MAKE@
# Programs used by "make install":
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
#### End of system configuration section. ####
SHELL = /bin/sh
VPATH = $(srcdir)
OBJECTS = getopt.o getopt1.o hash.o
CPPFLAGS = -I$(srcdir)
TARGETLIB = libgp.a
all : $(TARGETLIB)
$(TARGETLIB): $(OBJECTS)
$(RM) $@
$(AR) $(AR_FLAGS) $@ $(OBJECTS)
$(RANLIB) $@
# Don't use implicit rules, since AIX "make" and OSF/1 "make" don't always
# expand $< correctly in this context.
#
#%.o : %.c
# $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
#
#%.o : %.cc
# $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
getopt.o : getopt.c getopt.h
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/getopt.c
getopt1.o : getopt1.c getopt.h
$(CC) $(CFLAGS) $(CPPFLAGS) -c $(srcdir)/getopt1.c
hash.o : hash.cc hash.h
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/hash.cc
install : all
installdirs :
uninstall :
check : all
mostlyclean : clean
clean : force
$(RM) *~ *.s *.o *.a $(TARGETLIB) core
distclean : clean
$(RM) config.status config.log config.cache Makefile
maintainer-clean : distclean
force :
-43
View File
@@ -1,43 +0,0 @@
dnl autoconf configuration for gperf/lib
dnl Copyright (C) 1998 Free Software Foundation, Inc.
dnl written by Douglas C. Schmidt ([email protected])
dnl
dnl This file is part of GNU GPERF.
dnl
dnl GNU GPERF is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 1, or (at your option)
dnl any later version.
dnl
dnl GNU GPERF is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with GNU GPERF; see the file COPYING. If not, write to the
dnl Free Software Foundation, 59 Temple Place - Suite 330, Boston,
dnl MA 02111-1307, USA.
AC_INIT(hash.cc)
AC_PROG_MAKE_SET
dnl
dnl checks for programs
dnl
AC_PROG_CC
dnl sets variable CC
AC_PROG_CPP
dnl sets variable CPP
AC_PROG_CXX
dnl sets variable CXX
AC_PROG_CXXCPP
dnl sets variable CXXCPP
CL_PROG_RANLIB
dnl sets variable RANLIB
CL_PROG_INSTALL
dnl sets variables INSTALL, INSTALL_DATA, INSTALL_PROGRAM
dnl
dnl That's it.
dnl
AC_OUTPUT(Makefile)
File diff suppressed because it is too large. Load diff
-25
View File
@@ -1,25 +0,0 @@
getopt.c is a modified version of the getopt.c found in the glibc snapshot
on 1998-04-14. Below the patch that has been applied to this file. The glibc
maintainer has been informed of these patches.
diff -c3 getopt.c.orig getopt.c
*** getopt.c.orig Sun Mar 8 16:06:55 1998
--- getopt.c Thu Apr 16 00:09:41 1998
***************
*** 201,207 ****
/* Avoid depending on library functions or files
whose names are inconsistent. */
! char *getenv ();
static char *
my_index (str, chr)
--- 201,208 ----
/* Avoid depending on library functions or files
whose names are inconsistent. */
! extern char *getenv ();
! extern int strncmp ();
static char *
my_index (str, chr)
-188
View File
@@ -1,188 +0,0 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "getopt.h"
#if !defined __STDC__ || !__STDC__
/* This is a separate conditional since some stdc systems
reject `defined (const)'. */
#ifndef const
#define const
#endif
#endif
#include <stdio.h>
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
and linking in this code is a waste when using the GNU C library
(especially if it is a shared library). Rather than having every GNU
program understand `configure --with-gnu-libc' and omit the object files,
it is simpler to just do this in the source for each such file. */
#define GETOPT_INTERFACE_VERSION 2
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
#include <gnu-versions.h>
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
#define ELIDE_CODE
#endif
#endif
#ifndef ELIDE_CODE
/* This needs to come after some library #include
to get __GNU_LIBRARY__ defined. */
#ifdef __GNU_LIBRARY__
#include <stdlib.h>
#endif
#ifndef NULL
#define NULL 0
#endif
int
getopt_long (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
If an option that starts with '-' (not '--') doesn't match a long option,
but does match a short option, it is parsed as a short option
instead. */
int
getopt_long_only (argc, argv, options, long_options, opt_index)
int argc;
char *const *argv;
const char *options;
const struct option *long_options;
int *opt_index;
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
}
#endif /* Not ELIDE_CODE. */
#ifdef TEST
#include <stdio.h>
int
main (argc, argv)
int argc;
char **argv;
{
int c;
int digit_optind = 0;
while (1)
{
int this_option_optind = optind ? optind : 1;
int option_index = 0;
static struct option long_options[] =
{
{"add", 1, 0, 0},
{"append", 0, 0, 0},
{"delete", 1, 0, 0},
{"verbose", 0, 0, 0},
{"create", 0, 0, 0},
{"file", 1, 0, 0},
{0, 0, 0, 0}
};
c = getopt_long (argc, argv, "abc:d:0123456789",
long_options, &option_index);
if (c == -1)
break;
switch (c)
{
case 0:
printf ("option %s", long_options[option_index].name);
if (optarg)
printf (" with arg %s", optarg);
printf ("\n");
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf ("option %c\n", c);
break;
case 'a':
printf ("option a\n");
break;
case 'b':
printf ("option b\n");
break;
case 'c':
printf ("option c with value `%s'\n", optarg);
break;
case 'd':
printf ("option d with value `%s'\n", optarg);
break;
case '?':
break;
default:
printf ("?? getopt returned character code 0%o ??\n", c);
}
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
printf ("%s ", argv[optind++]);
printf ("\n");
}
exit (0);
}
#endif /* TEST */
-49
View File
@@ -1,49 +0,0 @@
/* Fast lookup table abstraction implemented as an Iteration Number Array
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
GNU GPERF is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU GPERF is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU GPERF; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "bool-array.h"
#include <stdio.h>
#include <string.h>
#include "options.h"
#include "trace.h"
STORAGE_TYPE * Bool_Array::storage_array;
STORAGE_TYPE Bool_Array::iteration_number;
unsigned int Bool_Array::size;
/* Prints out debugging diagnostics. */
Bool_Array::~Bool_Array (void)
{
T (Trace t ("Bool_Array::~Bool_Array");)
if (option[DEBUG])
fprintf (stderr, "\ndumping boolean array information\n"
"size = %d\niteration number = %d\nend of array dump\n",
size, iteration_number);
}
#ifndef __OPTIMIZE__
#define INLINE /* not inline */
#include "bool-array.icc"
#undef INLINE
#endif /* not defined __OPTIMIZE__ */
-66
View File
@@ -1,66 +0,0 @@
/* This may look like C code, but it is really -*- C++ -*- */
/* Simple lookup table abstraction implemented as an Iteration Number Array.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
GNU GPERF is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU GPERF is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU GPERF; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Define and implement a simple boolean array abstraction,
uses an Iteration Numbering implementation to save on initialization time. */
#ifndef bool_array_h
#define bool_array_h 1
#include "trace.h"
#ifdef LO_CAL
/* If we are on a memory diet then we'll only make these use a limited
amount of storage space. */
typedef unsigned short STORAGE_TYPE;
#else
typedef unsigned int STORAGE_TYPE;
#endif
class Bool_Array
{
private:
static STORAGE_TYPE *storage_array; /* Initialization of the index space. */
static STORAGE_TYPE iteration_number; /* Keep track of the current iteration. */
static unsigned int size; /* Keep track of array size. */
public:
Bool_Array (void);
~Bool_Array (void);
static void init (STORAGE_TYPE *buffer, unsigned int s);
static int find (int hash_value);
static void reset (void);
};
#ifdef __OPTIMIZE__ /* efficiency hack! */
#include <stdio.h>
#include <string.h>
#include "options.h"
#define INLINE inline
#include "bool-array.icc"
#undef INLINE
#endif
#endif
-85
View File
@@ -1,85 +0,0 @@
/* Inline Functions for bool-array.{h,cc}.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt ([email protected])
This file is part of GNU GPERF.
GNU GPERF is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU GPERF is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU GPERF; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
// This needs:
//#include <stdio.h>
//#include <string.h>
//#include "options.h"
//#include "trace.h"
INLINE
Bool_Array::Bool_Array (void)
{
T (Trace t ("Bool_Array::Bool_Array");)
storage_array = 0;
iteration_number = size = 0;
}
INLINE void
Bool_Array::init (STORAGE_TYPE *buffer, unsigned int s)
{
T (Trace t ("Bool_Array::init");)
size = s;
iteration_number = 1;
storage_array = buffer;
memset (storage_array, 0, s * sizeof (*storage_array));
if (option[DEBUG])
fprintf (stderr, "\nbool array size = %d, total bytes = %d\n",
size, (unsigned int) (size * sizeof (*storage_array)));
}
INLINE int
Bool_Array::find (int index)
{
T (Trace t ("Bool_Array::find");)
if (storage_array[index] == iteration_number)
return 1;
else
{
storage_array[index] = iteration_number;
return 0;
}
}
INLINE void
Bool_Array::reset (void)
{
T (Trace t ("Bool_Array::reset");)
/* If we wrap around it's time to zero things out again! However, this only
occurs once about every 2^31 or 2^15 iterations, so it should probably
never happen! */
if (++iteration_number == 0)
{
if (option[DEBUG])
{
fprintf (stderr, "(re-initializing bool_array)...");
fflush (stderr);
}
iteration_number = 1;
memset (storage_array, 0, size * sizeof (*storage_array));
if (option[DEBUG])
{
fprintf (stderr, "done\n");
fflush (stderr);
}
}
}
-19
View File
@@ -1,19 +0,0 @@
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if the C++ compiler supports "throw ()" declarations. */
#undef HAVE_THROW_DECL
/* Define if you have the getrlimit function. */
#undef HAVE_GETRLIMIT
/* Define if you have the setrlimit function. */
#undef HAVE_SETRLIMIT
/* Define if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
-96
View File
@@ -1,96 +0,0 @@
/* This may look like C code, but it is really -*- C++ -*- */
/* Data and function member declarations for the keyword list class.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
GNU GPERF is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU GPERF is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU GPERF; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
/* The key word list is a useful abstraction that keeps track of
various pieces of information that enable that fast generation
of the Gen_Perf.hash function. A Key_List is a singly-linked
list of List_Nodes. */
#ifndef key_list_h
#define key_list_h 1
#include "list-node.h"
#include "vectors.h"
#include "read-line.h"
/* OSF/1 cxx needs these forward declarations. */
struct Output_Constants;
struct Output_Compare;
class Key_List : private Read_Line, public Vectors
{
private:
const char *array_type; /* Pointer to the type for word list. */
const char *return_type; /* Pointer to return type for lookup function. */
const char *struct_tag; /* Shorthand for user-defined struct tag type. */
const char *include_src; /* C source code to be included verbatim. */
int max_key_len; /* Maximum length of the longest keyword. */
int min_key_len; /* Minimum length of the shortest keyword. */
int min_hash_value; /* Minimum hash value for all keywords. */
int max_hash_value; /* Maximum hash value for all keywords. */
int occurrence_sort; /* True if sorting by occurrence. */
int hash_sort; /* True if sorting by hash value. */
int additional_code; /* True if any additional C code is included. */
int list_len; /* Length of head's Key_List, not counting duplicates. */
int total_keys; /* Total number of keys, counting duplicates. */
static int determined[MAX_ALPHA_SIZE]; /* Used in function reorder, below. */
static int get_occurrence (List_Node *ptr);
#ifndef strcspn
static int strcspn (const char *s, const char *reject);
#endif
static int already_determined (List_Node *ptr);
static void set_determined (List_Node *ptr);
void compute_min_max (void);
int num_hash_values (void);
void output_constants (struct Output_Constants&);
void output_hash_function (void);
void output_keylength_table (void);
void output_keyword_table (void);
void output_lookup_array (void);
void output_lookup_tables (void);
void output_lookup_function_body (const struct Output_Compare&);
void output_lookup_function (void);
void set_output_types (void);
void dump (void);
const char *get_array_type (void);
const char *save_include_src (void);
const char *get_special_input (char delimiter);
List_Node *merge (List_Node *list1, List_Node *list2);
List_Node *merge_sort (List_Node *head);
protected:
List_Node *head; /* Points to the head of the linked list. */
int total_duplicates; /* Total number of duplicate hash values. */
public:
Key_List (void);
~Key_List (void);
int keyword_list_length (void);
int max_key_length (void);
void reorder (void);
void sort (void);
void read_keys (void);
void output (void);
};
#endif
-87
View File
@@ -1,87 +0,0 @@
/* Defines a buffered memory allocation abstraction that reduces calls to
malloc.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
GNU GPERF is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU GPERF is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU GPERF; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "config.h"
#include <stdio.h>
#include <stdlib.h> /* declares malloc(), exit() */
#include "trace.h"
/* Determine default alignment. If your C++ compiler does not
like this then try something like #define DEFAULT_ALIGNMENT 8. */
struct fooalign {char x; double d;};
const int ALIGNMENT = ((char *)&((struct fooalign *) 0)->d - (char *)0);
/* Provide an abstraction that cuts down on the number of
calls to NEW by buffering the memory pool from which
strings are allocated. */
void *
operator new (size_t size)
{
T (Trace t ("operator new");)
static char *buf_start = 0; /* Large array used to reduce calls to NEW. */
static char *buf_end = 0; /* Indicates end of BUF_START. */
static size_t buf_size = 4096; /* Size of buffer pointed to by BUF_START. */
char *temp;
/* Align this on correct boundaries, just to be safe... */
size = ((size + ALIGNMENT - 1) / ALIGNMENT) * ALIGNMENT;
/* If we are about to overflow our buffer we'll just grab another
chunk of memory. Since we never free the original memory it
doesn't matter that no one points to the beginning of that
chunk. Note we use a heuristic that grows the buffer either by
size of the request or by twice the previous size, whichever is
larger. */
if (buf_start + size >= buf_end)
{
buf_size *= 2;
if (buf_size < size)
buf_size = size;
if ((buf_start = (char *)malloc (buf_size)) != (char *)0)
buf_end = buf_start + buf_size;
else
{
fprintf (stderr, "Virtual memory exhausted in `operator new'\n");
exit (1);
}
}
temp = buf_start;
buf_start += size;
return temp;
}
/* We need this deletion operator in order to make the linker happy.
Because `operator new' and `operator delete' always come together. */
void
operator delete (void *ptr)
#ifdef HAVE_THROW_DECL
throw()
#endif
{
T (Trace t ("operator delete");)
// We cannot call free here, as it doesn't match the mallocs.
// free ((char *) ptr);
(void) ptr;
}
-97
View File
@@ -1,97 +0,0 @@
/* Correctly reads an arbitrarily size string.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
GNU GPERF is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU GPERF is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU GPERF; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "read-line.h"
#include <stdlib.h>
#include <string.h> /* declares memcpy() */
#include "options.h"
#include "trace.h"
/* Recursively fills up the buffer. */
#define CHUNK_SIZE 4096
/* CHUNKS is the number of chunks (each of size CHUNK_SIZE) which have
already been read and which are temporarily stored on the stack.
This function reads the remainder of the line, allocates a buffer
for the entire line, fills the part beyond &buffer[chunks*CHUNK_SIZE],
and returns &buffer[chunks*CHUNK_SIZE]. */
char *
Read_Line::readln_aux (int chunks)
{
T (Trace t ("Read_Line::readln_aux");)
#if LARGE_STACK
char buf[CHUNK_SIZE];
#else
// Note: we don't use new, because that invokes a custom operator new.
char *buf = (char*)malloc(CHUNK_SIZE);
if (buf == NULL)
abort ();
#endif
char *bufptr = buf;
char *ptr;
int c;
while (c = getc (fp), c != EOF && c != '\n') /* fill the current buffer */
{
*bufptr++ = c;
if (bufptr - buf == CHUNK_SIZE)
{
if ((ptr = readln_aux (chunks + 1)) != NULL)
/* prepend remainder to ptr buffer */
{
ptr -= CHUNK_SIZE;
memcpy (ptr, buf, CHUNK_SIZE);
}
goto done;
}
}
if (c == EOF && bufptr == buf && chunks == 0)
ptr = NULL;
else
{
size_t s1 = chunks * CHUNK_SIZE;
size_t s2 = bufptr - buf;
ptr = new char[s1+s2+1];
ptr += s1;
ptr[s2] = '\0';
memcpy (ptr, buf, s2);
}
done:
#if !LARGE_STACK
free (buf);
#endif
return ptr;
}
#ifndef __OPTIMIZE__
#define INLINE /* not inline */
#include "read-line.icc"
#undef INLINE
#endif /* not defined __OPTIMIZE__ */
-53
View File
@@ -1,53 +0,0 @@
/* This may look like C code, but it is really -*- C++ -*- */
/* Reads arbitrarily long string from input file, returning it as a
dynamically allocated buffer.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
GNU GPERF is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU GPERF is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU GPERF; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
/* Returns a pointer to an arbitrary length string. Returns NULL on error or EOF
The storage for the string is dynamically allocated by new. */
#ifndef read_line_h
#define read_line_h 1
#include <stdio.h>
class Read_Line
{
private:
char *readln_aux (int chunks);
FILE *fp; /* FILE pointer to the input stream. */
public:
Read_Line (FILE *stream = stdin) : fp (stream) {}
char *get_line (void);
};
#ifdef __OPTIMIZE__
#include "trace.h"
#define INLINE inline
#include "read-line.icc"
#undef INLINE
#endif
#endif
-47
View File
@@ -1,47 +0,0 @@
/* Inline Functions for read-line.{h,cc}.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt ([email protected])
This file is part of GNU GPERF.
GNU GPERF is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU GPERF is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU GPERF; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
// This needs:
//#include <stdio.h>
//#include "trace.h"
/* Returns the ``next'' line, ignoring comments beginning with '#'. */
INLINE char *
Read_Line::get_line (void)
{
T (Trace t ("Read_Line::get_line");)
int c;
while ((c = getc (fp)) == '#')
{
while (c = getc (fp), c != EOF && c != '\n')
;
if (c == EOF)
return (char *)0;
}
if (c == EOF)
return (char *)0;
ungetc (c, stdin);
return readln_aux (0);
}
-35
View File
@@ -1,35 +0,0 @@
/* Tracing function calls.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
GNU GPERF is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU GPERF is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU GPERF; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "trace.h"
#include <stdio.h>
int Trace::nesting = 0;
Trace::Trace (const char *n)
{
fprintf (stderr, "%*scalling %s\n", 3 * nesting++, "", name = n);
}
Trace::~Trace (void)
{
fprintf (stderr, "%*sleaving %s\n", 3 * --nesting, "", name);
}
-40
View File
@@ -1,40 +0,0 @@
/* Tracing function calls.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
GNU GPERF is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU GPERF is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU GPERF; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#ifndef trace_h
#define trace_h 1
#ifdef TRACE
#define T(X) X
#else
#define T(X)
#endif
class Trace
{
private:
static int nesting;
const char *name;
public:
Trace (const char *n);
~Trace (void);
};
#endif
-25
View File
@@ -1,25 +0,0 @@
/* Static class data members that are shared between several classes.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
GNU GPERF is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU GPERF is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU GPERF; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "vectors.h"
int Vectors::ALPHA_SIZE = MAX_ALPHA_SIZE;
int Vectors::occurrences[MAX_ALPHA_SIZE];
int Vectors::asso_values[MAX_ALPHA_SIZE];
-37
View File
@@ -1,37 +0,0 @@
/* This may look like C code, but it is really -*- C++ -*- */
/* Static class data members that are shared between several classes via
inheritance.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
GNU GPERF is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU GPERF is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU GPERF; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#ifndef vectors_h
#define vectors_h 1
static const int MAX_ALPHA_SIZE = 256;
struct Vectors
{
static int ALPHA_SIZE; /* Size of alphabet. */
static int occurrences[MAX_ALPHA_SIZE]; /* Counts occurrences of each key set character. */
static int asso_values[MAX_ALPHA_SIZE]; /* Value associated with each character. */
};
#endif
-23
View File
@@ -1,23 +0,0 @@
/* Current program version number.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
GNU GPERF is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
GNU GPERF is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU GPERF; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
/* Current release version. */
extern const char *version_string;
-232
View File
@@ -1,232 +0,0 @@
# Makefile for gperf/tests
# Copyright (C) 1989, 1992, 1993, 1995, 1998 Free Software Foundation, Inc.
# written by Douglas C. Schmidt ([email protected])
#
# This file is part of GNU GPERF.
#
# GNU GPERF is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 1, or (at your option)
# any later version.
#
# GNU GPERF is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU GPERF; see the file COPYING. If not, write to the Free
# Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA.
#### Start of system configuration section. ####
# Directories used by "make":
srcdir = @srcdir@
# Programs used by "make":
# C compiler
CC = @CC@
CFLAGS = @CFLAGS@
CPP = @CPP@
# C++ compiler
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
CXXCPP = @CXXCPP@
# Other
MV = mv
LN = ln
RM = rm -f
@SET_MAKE@
#### End of system configuration section. ####
SHELL = /bin/sh
VPATH = $(srcdir)
GPERF = ../src/gperf
all :
install : all
installdirs :
uninstall :
check : check-link-c check-link-c++ check-c check-ada check-modula3 check-pascal check-test
@true
extracheck : @CHECK_LANG_SYNTAX@
@true
check-link-c: force
@echo "performing some tests of the perfect hash generator"
$(CC) -c $(CFLAGS) $(srcdir)/test.c
$(GPERF) -p -c -l -S1 -o $(srcdir)/c.gperf > cinset.c
$(CC) $(CFLAGS) -o cout cinset.c test.o
check-link-c++: force
check-c:
@echo "testing ANSI C reserved words, all items should be found in the set"
./cout -v < $(srcdir)/c.gperf > c.out
diff $(srcdir)/c.exp c.out
check-ada:
$(GPERF) -k1,4,'$$' $(srcdir)/ada.gperf > adainset.c
# double '$$' is only there since make gets confused; program wants only 1 '$'
$(CC) $(CFLAGS) -o aout adainset.c test.o
@echo "testing Ada reserved words, all items should be found in the set"
./aout -v < $(srcdir)/ada.gperf > ada-res.out
diff $(srcdir)/ada-res.exp ada-res.out
$(GPERF) -p -D -k1,'$$' -s 2 -o $(srcdir)/adadefs.gperf > preinset.c
$(CC) $(CFLAGS) -o preout preinset.c test.o
@echo "testing Ada predefined words, all items should be found in the set"
./preout -v < $(srcdir)/adadefs.gperf > ada-pred.out
diff $(srcdir)/ada-pred.exp ada-pred.out
check-modula3:
$(GPERF) -k1,2,'$$' -o $(srcdir)/modula3.gperf > m3inset.c
$(CC) $(CFLAGS) -o m3out m3inset.c test.o
@echo "testing Modula3 reserved words, all items should be found in the set"
./m3out -v < $(srcdir)/modula3.gperf > modula.out
diff $(srcdir)/modula.exp modula.out
check-pascal:
$(GPERF) -o -S2 -p < $(srcdir)/pascal.gperf > pinset.c
$(CC) $(CFLAGS) -o pout pinset.c test.o
@echo "testing Pascal reserved words, all items should be found in the set"
./pout -v < $(srcdir)/pascal.gperf > pascal.out
diff $(srcdir)/pascal.exp pascal.out
# these next 5 are demos that show off the generated code
check-test:
$(GPERF) -p -j1 -g -o -t -N is_reserved_word -k1,3,'$$' < $(srcdir)/c-parse.gperf > test-1.out
diff $(srcdir)/test-1.exp test-1.out
$(GPERF) -n -k1-8 -l < $(srcdir)/modula2.gperf > test-2.out
diff $(srcdir)/test-2.exp test-2.out
$(GPERF) -p -j 1 -o -a -C -g -t -k1,4,$$ < $(srcdir)/gplus.gperf > test-3.out
diff $(srcdir)/test-3.exp test-3.out
$(GPERF) -D -p -t < $(srcdir)/c-parse.gperf > test-4.out
diff $(srcdir)/test-4.exp test-4.out
$(GPERF) -g -o -j1 -t -p -N is_reserved_word < $(srcdir)/gpc.gperf > test-5.out
diff $(srcdir)/test-5.exp test-5.out
# prints out the help message
-$(GPERF) -h > test-6.out 2>&1
diff $(srcdir)/test-6.exp test-6.out
@echo "only if, do, for, case, goto, else, while, and return should be found "
./aout -v < $(srcdir)/c.gperf > test-7.out
diff $(srcdir)/test-7.exp test-7.out
# The following validates valid language syntax with different parameters.
# Works only with gcc and g++, and only on platforms where "gcc -ansi" is
# usable. (There are still platforms where gcc-2.8.0's fixincludes does not
# work well enough.)
VALIDATE = CC='$(CC)' CFLAGS='$(CFLAGS)' CXX='$(CXX)' CXXFLAGS='$(CXXFLAGS)' GPERF='$(GPERF)' ./validate
check-lang-syntax : force
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -c
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -C
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -E
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -G
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -G -C
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -G -E
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -l
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -D
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -D -l
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10 -c
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10 -C
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10 -E
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10 -G
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10 -l
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10 -D
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 10 -D -l
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -S 1000
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -C
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -l
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -D
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -D -l
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -S 10
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -S 10 -C
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -S 10 -l
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -S 10 -D
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -S 10 -D -l
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -p -S 1000
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -K key_name
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -H hash_function_name
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest1.gperf -W word_list_name
sed -e 's,in_word_set,lookup_function_name,g' < jstest1.gperf > tmp-jstest1.gperf && \
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 tmp-jstest1.gperf -N lookup_function_name
sed -e 's,Perfect_Hash,class_name,g' < jstest1.gperf > tmp-jstest1.gperf && \
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 tmp-jstest1.gperf -Z class_name
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -c
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -C
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -E
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -G
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -G -C
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -G -E
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -l
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -D
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -D -l
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10 -c
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10 -C
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10 -E
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10 -G
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10 -l
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10 -D
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 10 -D -l
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -S 1000
sed -e 's,name,key_name,g' < jstest2.gperf > tmp-jstest2.gperf && \
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 tmp-jstest2.gperf -t -p -K key_name
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 jstest2.gperf -t -p -H hash_function_name
sed -e 's,in_word_set,lookup_function_name,g' < jstest2.gperf > tmp-jstest2.gperf && \
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 tmp-jstest2.gperf -t -p -N lookup_function_name
sed -e 's,Perfect_Hash,class_name,g' < jstest2.gperf > tmp-jstest2.gperf && \
$(VALIDATE) KR-C,C,ANSI-C,C++ -k1,2 tmp-jstest2.gperf -t -p -Z class_name
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -c
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -C
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -E
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -G
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -G -C
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -G -E
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -l
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -D
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -D -l
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10 -c
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10 -C
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10 -E
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10 -G
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10 -l
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10 -D
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 10 -D -l
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -S 1000
sed -e 's,name,key_name,g' < jstest3.gperf > tmp-jstest3.gperf && \
$(VALIDATE) C,ANSI-C,C++ -k1,2 tmp-jstest3.gperf -t -p -K key_name
$(VALIDATE) C,ANSI-C,C++ -k1,2 jstest3.gperf -t -p -H hash_function_name
sed -e 's,in_word_set,lookup_function_name,g' < jstest3.gperf > tmp-jstest3.gperf && \
$(VALIDATE) C,ANSI-C,C++ -k1,2 tmp-jstest3.gperf -t -p -N lookup_function_name
sed -e 's,Perfect_Hash,class_name,g' < jstest3.gperf > tmp-jstest3.gperf && \
$(VALIDATE) C,ANSI-C,C++ -k1,2 tmp-jstest3.gperf -t -p -Z class_name
mostlyclean : clean
clean : force
$(RM) *.o core *inset.c output.* *.out aout cout m3out pout preout tmp-* valitest*
distclean : clean
$(RM) config.status config.log config.cache Makefile
maintainer-clean : distclean
force :
Loaded 100 of 241 files, more files were not shown because too many files have changed in this diff. Show more